Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
BIDL
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Christof Wolke
BIDL
Commits
a9c70991
Commit
a9c70991
authored
Sep 19, 2016
by
Christof Wolke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
code formatiert, beschreibungen ergänzt und letzte bugs behoben
parent
4d0d3c8f
Changes
43
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
43 changed files
with
1500 additions
and
1275 deletions
+1500
-1275
BIDL/BIDL/app/src/main/AndroidManifest.xml
BIDL/BIDL/app/src/main/AndroidManifest.xml
+1
-1
BIDL/BIDL/app/src/main/java/classes/LocalStorage.java
BIDL/BIDL/app/src/main/java/classes/LocalStorage.java
+0
-10
BIDL/BIDL/app/src/main/java/de/uni_oldenburg/bidl/AppClass.java
...IDL/app/src/main/java/de/uni_oldenburg/bidl/AppClass.java
+29
-1
BIDL/BIDL/app/src/main/java/de/uni_oldenburg/bidl/BaseActivity.java
...app/src/main/java/de/uni_oldenburg/bidl/BaseActivity.java
+27
-16
BIDL/BIDL/app/src/main/java/de/uni_oldenburg/bidl/guest_view/LoginActivity.java
.../java/de/uni_oldenburg/bidl/guest_view/LoginActivity.java
+2
-4
BIDL/BIDL/app/src/main/java/de/uni_oldenburg/bidl/guest_view/RegisterActivity.java
...va/de/uni_oldenburg/bidl/guest_view/RegisterActivity.java
+36
-12
BIDL/BIDL/app/src/main/java/de/uni_oldenburg/bidl/guest_view/ResetPasswordActivity.java
.../uni_oldenburg/bidl/guest_view/ResetPasswordActivity.java
+29
-23
BIDL/BIDL/app/src/main/java/de/uni_oldenburg/bidl/home_view/MainActivity.java
...in/java/de/uni_oldenburg/bidl/home_view/MainActivity.java
+197
-165
BIDL/BIDL/app/src/main/java/de/uni_oldenburg/bidl/listfragment/SuperListFragment.java
...de/uni_oldenburg/bidl/listfragment/SuperListFragment.java
+17
-3
BIDL/BIDL/app/src/main/java/de/uni_oldenburg/bidl/member_view/ChangePasswordActivity.java
...ni_oldenburg/bidl/member_view/ChangePasswordActivity.java
+35
-26
BIDL/BIDL/app/src/main/java/de/uni_oldenburg/bidl/member_view/FavoriteActivity.java
...a/de/uni_oldenburg/bidl/member_view/FavoriteActivity.java
+83
-75
BIDL/BIDL/app/src/main/java/de/uni_oldenburg/bidl/member_view/FeedbackActivity.java
...a/de/uni_oldenburg/bidl/member_view/FeedbackActivity.java
+44
-36
BIDL/BIDL/app/src/main/java/de/uni_oldenburg/bidl/member_view/ForumActivity.java
...java/de/uni_oldenburg/bidl/member_view/ForumActivity.java
+53
-38
BIDL/BIDL/app/src/main/java/de/uni_oldenburg/bidl/member_view/MaterialsActivity.java
.../de/uni_oldenburg/bidl/member_view/MaterialsActivity.java
+46
-43
BIDL/BIDL/app/src/main/java/de/uni_oldenburg/bidl/member_view/ProfileActivity.java
...va/de/uni_oldenburg/bidl/member_view/ProfileActivity.java
+47
-43
BIDL/BIDL/app/src/main/java/de/uni_oldenburg/bidl/member_view/SearchActivity.java
...ava/de/uni_oldenburg/bidl/member_view/SearchActivity.java
+64
-30
BIDL/BIDL/app/src/main/java/services/db/DBHelper.java
BIDL/BIDL/app/src/main/java/services/db/DBHelper.java
+23
-50
BIDL/BIDL/app/src/main/java/services/servercommunication/NetworkService.java
...ain/java/services/servercommunication/NetworkService.java
+163
-151
BIDL/BIDL/app/src/main/java/services/servercommunication/REST.java
.../app/src/main/java/services/servercommunication/REST.java
+6
-8
BIDL/BIDL/app/src/main/res/layout/activity_change_password.xml
...BIDL/app/src/main/res/layout/activity_change_password.xml
+17
-23
BIDL/BIDL/app/src/main/res/layout/activity_favorite.xml
BIDL/BIDL/app/src/main/res/layout/activity_favorite.xml
+31
-19
BIDL/BIDL/app/src/main/res/layout/activity_feedback.xml
BIDL/BIDL/app/src/main/res/layout/activity_feedback.xml
+56
-30
BIDL/BIDL/app/src/main/res/layout/activity_forum.xml
BIDL/BIDL/app/src/main/res/layout/activity_forum.xml
+50
-28
BIDL/BIDL/app/src/main/res/layout/activity_login.xml
BIDL/BIDL/app/src/main/res/layout/activity_login.xml
+72
-73
BIDL/BIDL/app/src/main/res/layout/activity_main.xml
BIDL/BIDL/app/src/main/res/layout/activity_main.xml
+41
-1
BIDL/BIDL/app/src/main/res/layout/activity_materials.xml
BIDL/BIDL/app/src/main/res/layout/activity_materials.xml
+46
-19
BIDL/BIDL/app/src/main/res/layout/activity_profil.xml
BIDL/BIDL/app/src/main/res/layout/activity_profil.xml
+0
-97
BIDL/BIDL/app/src/main/res/layout/activity_profile.xml
BIDL/BIDL/app/src/main/res/layout/activity_profile.xml
+102
-0
BIDL/BIDL/app/src/main/res/layout/activity_register.xml
BIDL/BIDL/app/src/main/res/layout/activity_register.xml
+40
-24
BIDL/BIDL/app/src/main/res/layout/activity_reset_password.xml
.../BIDL/app/src/main/res/layout/activity_reset_password.xml
+10
-11
BIDL/BIDL/app/src/main/res/layout/activity_search.xml
BIDL/BIDL/app/src/main/res/layout/activity_search.xml
+37
-37
BIDL/BIDL/app/src/main/res/layout/app_bar_main.xml
BIDL/BIDL/app/src/main/res/layout/app_bar_main.xml
+1
-8
BIDL/BIDL/app/src/main/res/layout/comment_item.xml
BIDL/BIDL/app/src/main/res/layout/comment_item.xml
+27
-32
BIDL/BIDL/app/src/main/res/layout/content_favorite.xml
BIDL/BIDL/app/src/main/res/layout/content_favorite.xml
+0
-22
BIDL/BIDL/app/src/main/res/layout/content_main.xml
BIDL/BIDL/app/src/main/res/layout/content_main.xml
+0
-53
BIDL/BIDL/app/src/main/res/layout/event_item.xml
BIDL/BIDL/app/src/main/res/layout/event_item.xml
+15
-15
BIDL/BIDL/app/src/main/res/layout/favorit_popup_activity.xml
BIDL/BIDL/app/src/main/res/layout/favorit_popup_activity.xml
+6
-6
BIDL/BIDL/app/src/main/res/layout/favorite_item.xml
BIDL/BIDL/app/src/main/res/layout/favorite_item.xml
+14
-10
BIDL/BIDL/app/src/main/res/layout/fragment_bidl_list.xml
BIDL/BIDL/app/src/main/res/layout/fragment_bidl_list.xml
+2
-4
BIDL/BIDL/app/src/main/res/layout/grid_item.xml
BIDL/BIDL/app/src/main/res/layout/grid_item.xml
+7
-7
BIDL/BIDL/app/src/main/res/layout/popup_item.xml
BIDL/BIDL/app/src/main/res/layout/popup_item.xml
+14
-13
BIDL/BIDL/app/src/main/res/menu/activity_main_drawer.xml
BIDL/BIDL/app/src/main/res/menu/activity_main_drawer.xml
+2
-2
BIDL/BIDL/app/src/main/res/values/strings.xml
BIDL/BIDL/app/src/main/res/values/strings.xml
+8
-6
No files found.
BIDL/BIDL/app/src/main/AndroidManifest.xml
View file @
a9c70991
...
...
@@ -83,7 +83,7 @@
android:label=
"@string/title_activity_search"
android:screenOrientation=
"sensorPortrait"
/>
<activity
android:name=
".member_view.ProfilActivity"
android:name=
".member_view.Profil
e
Activity"
android:label=
"@string/title_activity_profil"
android:screenOrientation=
"sensorPortrait"
/>
<activity
android:name=
".member_view.ChangePasswordActivity"
/>
...
...
BIDL/BIDL/app/src/main/java/classes/LocalStorage.java
View file @
a9c70991
...
...
@@ -3,7 +3,6 @@ package classes;
import
android.content.Context
;
import
android.content.SharedPreferences
;
import
co.uk.rushorm.core.RushCore
;
/**
* Created by Christof on 25.08.2016.
...
...
@@ -85,15 +84,6 @@ public class LocalStorage {
return
this
.
userLocalDatabase
.
getString
(
"image"
,
""
);
}
/**
* Ändert den Pfad zum Profilbild des Nutzers
* @param image neuen Pfad zum Profilbild des Nutzers
*/
public
void
setUserImage
(
String
image
)
{
SharedPreferences
.
Editor
spEditor
=
this
.
userLocalDatabase
.
edit
();
spEditor
.
putString
(
"image"
,
image
);
spEditor
.
apply
();
}
/**
...
...
BIDL/BIDL/app/src/main/java/de/uni_oldenburg/bidl/AppClass.java
View file @
a9c70991
...
...
@@ -2,7 +2,20 @@ package de.uni_oldenburg.bidl;
import
android.app.Application
;
import
java.util.ArrayList
;
import
java.util.List
;
import
classes.apps.event.Event
;
import
classes.apps.event.EventTime
;
import
classes.apps.event.Favorite
;
import
classes.apps.feedback.Feedback
;
import
classes.apps.feedback.Question
;
import
classes.apps.forum.Comment
;
import
classes.apps.forum.CommentList
;
import
classes.apps.forum.Forum
;
import
classes.apps.materials.Materials
;
import
co.uk.rushorm.android.AndroidInitializeConfig
;
import
co.uk.rushorm.core.Rush
;
import
co.uk.rushorm.core.RushCore
;
/**
...
...
@@ -21,7 +34,22 @@ public class AppClass extends Application {
* */
//this.deleteDatabase("bidl.db");
AndroidInitializeConfig
config
=
new
AndroidInitializeConfig
(
getApplicationContext
());
List
<
Class
<?
extends
Rush
>>
classes
=
new
ArrayList
<>();
// Add classes
classes
.
add
(
Event
.
class
);
classes
.
add
(
EventTime
.
class
);
classes
.
add
(
Favorite
.
class
);
classes
.
add
(
Feedback
.
class
);
classes
.
add
(
Question
.
class
);
classes
.
add
(
Comment
.
class
);
classes
.
add
(
Forum
.
class
);
classes
.
add
(
Materials
.
class
);
AndroidInitializeConfig
config
=
new
AndroidInitializeConfig
(
this
);
config
.
setClasses
(
classes
);
RushCore
.
initialize
(
config
);
}
}
BIDL/BIDL/app/src/main/java/de/uni_oldenburg/bidl/BaseActivity.java
View file @
a9c70991
package
de.uni_oldenburg.bidl
;
import
android.content.Intent
;
import
android.support.annotation.NonNull
;
import
android.support.design.widget.NavigationView
;
import
android.support.v4.view.GravityCompat
;
import
android.support.v4.widget.DrawerLayout
;
...
...
@@ -17,20 +18,20 @@ import classes.LocalStorage;
import
de.uni_oldenburg.bidl.guest_view.LoginActivity
;
import
de.uni_oldenburg.bidl.home_view.MainActivity
;
import
de.uni_oldenburg.bidl.member_view.FavoriteActivity
;
import
de.uni_oldenburg.bidl.member_view.ProfilActivity
;
import
de.uni_oldenburg.bidl.member_view.Profil
e
Activity
;
import
de.uni_oldenburg.bidl.member_view.SearchActivity
;
import
services.db.DBHelper
;
/**
*
Created by Christof on 30.08.2016.
*
BaseActivity for each Activity, which has an menu
*/
public
class
BaseActivity
extends
AppCompatActivity
implements
NavigationView
.
OnNavigationItemSelectedListener
{
public
class
BaseActivity
extends
AppCompatActivity
implements
NavigationView
.
OnNavigationItemSelectedListener
{
protected
LocalStorage
localStorage
;
protected
int
drawerLayout
;
@SuppressWarnings
(
"deprecation"
)
protected
void
setMenu
(
int
drawer_layout
)
{
setDrawerLayout
(
drawer_layout
);
Toolbar
toolbar
=
(
Toolbar
)
findViewById
(
R
.
id
.
toolbar
);
...
...
@@ -51,19 +52,27 @@ public class BaseActivity extends AppCompatActivity implements NavigationView.On
@Override
public
void
onBackPressed
()
{
DrawerLayout
drawer
=
(
DrawerLayout
)
findViewById
(
drawerLayout
);
if
(
drawer
.
isDrawerOpen
(
GravityCompat
.
START
))
{
drawer
.
closeDrawer
(
GravityCompat
.
START
);
if
(
drawer
!=
null
)
{
if
(
drawer
.
isDrawerOpen
(
GravityCompat
.
START
))
{
drawer
.
closeDrawer
(
GravityCompat
.
START
);
}
else
{
super
.
onBackPressed
();
}
}
else
{
super
.
onBackPressed
();
}
}
/**
* Menu
*
* @param item clicked menuItem
* @return true
*/
@SuppressWarnings
(
"StatementWithEmptyBody"
)
@Override
public
boolean
onNavigationItemSelected
(
MenuItem
item
)
{
public
boolean
onNavigationItemSelected
(
@NonNull
MenuItem
item
)
{
// Handle navigation view item clicks here.
int
id
=
item
.
getItemId
();
...
...
@@ -75,7 +84,7 @@ public class BaseActivity extends AppCompatActivity implements NavigationView.On
toProfilActivity
();
}
else
if
(
id
==
R
.
id
.
nav_favorite
)
{
toFavoriteAcitvity
();
}
else
if
(
id
==
R
.
id
.
nav_logout
){
}
else
if
(
id
==
R
.
id
.
nav_logout
)
{
toLoginActivity
();
}
else
if
(
id
==
R
.
id
.
nav_share
)
{
shareEvent
();
...
...
@@ -91,7 +100,7 @@ public class BaseActivity extends AppCompatActivity implements NavigationView.On
}
private
void
toProfilActivity
()
{
startActivity
(
new
Intent
(
this
,
ProfilActivity
.
class
));
startActivity
(
new
Intent
(
this
,
Profil
e
Activity
.
class
));
}
private
void
toSearchActivity
()
{
...
...
@@ -102,9 +111,9 @@ public class BaseActivity extends AppCompatActivity implements NavigationView.On
Intent
sendIntent
=
new
Intent
();
sendIntent
.
setAction
(
Intent
.
ACTION_SEND
);
Event
event
=
DBHelper
.
getEvent
();
if
(
event
!=
null
)
{
if
(
event
.
getCurrentEnd
()
>=
getCurrentTime
()){
sendIntent
.
putExtra
(
Intent
.
EXTRA_TEXT
,
"Ich sitze gerade in der Veranstaltung "
+
event
.
getName
()+
"."
);
if
(
event
!=
null
)
{
if
(
event
.
getCurrentEnd
()
>=
getCurrentTime
())
{
sendIntent
.
putExtra
(
Intent
.
EXTRA_TEXT
,
"Ich sitze gerade in der Veranstaltung "
+
event
.
getName
()
+
"."
);
}
else
{
sendIntent
.
putExtra
(
Intent
.
EXTRA_TEXT
,
"Ich benutze gerade die Bidl App der Universität Oldenburg!"
);
}
...
...
@@ -136,13 +145,15 @@ public class BaseActivity extends AppCompatActivity implements NavigationView.On
/**
* Get the current Time
*
* @return the current Time with the format from the Server
*/
@SuppressWarnings
(
"deprecation"
)
public
int
getCurrentTime
()
{
Calendar
calendar
=
Calendar
.
getInstance
();
Date
date
=
calendar
.
getTime
();
int
hour
=
date
.
getHours
()
*
60
;
int
hour
=
date
.
getHours
()
*
60
;
int
minute
=
date
.
getMinutes
();
return
hour
+
minute
;
return
hour
+
minute
;
}
}
BIDL/BIDL/app/src/main/java/de/uni_oldenburg/bidl/guest_view/LoginActivity.java
View file @
a9c70991
...
...
@@ -30,13 +30,11 @@ public class LoginActivity extends AppCompatActivity {
private
Button
btLogin
;
private
TextView
tvRegister
;
private
LocalStorage
localStorage
;
/** values **/
private
String
email
;
private
String
password
;
private
boolean
keepLoggedIn
;
private
static
final
String
TOAST_ERROR_MESSAGE
=
"Falsche Login Daten"
;
private
LocalStorage
localStorage
;
...
...
@@ -87,7 +85,7 @@ public class LoginActivity extends AppCompatActivity {
LoginActivity
.
this
.
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
Toast
.
makeText
(
getApplicationContext
(),
TOAST_ERROR_MESSAGE
,
Toast
.
LENGTH_SHORT
).
show
();
Toast
.
makeText
(
getApplicationContext
(),
getString
(
R
.
string
.
wrongLoginData
)
,
Toast
.
LENGTH_SHORT
).
show
();
view
.
setEnabled
(
true
);
}
});
...
...
BIDL/BIDL/app/src/main/java/de/uni_oldenburg/bidl/guest_view/RegisterActivity.java
View file @
a9c70991
...
...
@@ -15,17 +15,23 @@ import services.servercommunication.NetworkService;
public
class
RegisterActivity
extends
AppCompatActivity
{
/** GUI **/
/**
* GUI
**/
private
EditText
etUsername
;
private
EditText
etEmail
;
private
EditText
etPassword
;
private
EditText
etRepeatPassword
;
private
Button
btNewAccount
;
private
TextView
tvToLogin
;
/** values **/
/**
* values
**/
private
String
name
;
private
String
email
;
private
String
password
;
private
String
repeatPassword
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
...
...
@@ -36,6 +42,7 @@ public class RegisterActivity extends AppCompatActivity {
etUsername
=
(
EditText
)
findViewById
(
R
.
id
.
etFullName
);
etEmail
=
(
EditText
)
findViewById
(
R
.
id
.
etEmail
);
etPassword
=
(
EditText
)
findViewById
(
R
.
id
.
etPassword
);
etRepeatPassword
=
(
EditText
)
findViewById
(
R
.
id
.
etRepeatPassword
);
btNewAccount
=
(
Button
)
findViewById
(
R
.
id
.
btRegister
);
tvToLogin
=
(
TextView
)
findViewById
(
R
.
id
.
link_to_login
);
...
...
@@ -46,17 +53,23 @@ public class RegisterActivity extends AppCompatActivity {
name
=
etUsername
.
getText
().
toString
();
email
=
etEmail
.
getText
().
toString
();
password
=
etPassword
.
getText
().
toString
();
if
(!(
name
.
isEmpty
()
||
email
.
isEmpty
()
||
password
.
isEmpty
())){
if
(
isEmailOk
()){
btNewAccount
.
setEnabled
(
false
);
register
(
email
,
name
,
password
);
toMainActivity
();
}
else
{
repeatPassword
=
etRepeatPassword
.
getText
().
toString
();
if
(!(
name
.
isEmpty
()
||
email
.
isEmpty
()
||
password
.
isEmpty
()
||
repeatPassword
.
isEmpty
()))
{
if
(
isEmailOk
())
{
if
(
isPasswordOk
())
{
btNewAccount
.
setEnabled
(
false
);
register
(
email
,
name
,
password
);
toMainActivity
();
}
else
{
showToastMessage
(
getString
(
R
.
string
.
register_response_passwordDontMatch
));
}
}
else
{
showToastMessage
(
getString
(
R
.
string
.
register_response_emailNotOk
));
}
}
else
{
}
else
{
showToastMessage
(
getString
(
R
.
string
.
register_response_fillOutAllFields
));
}
...
...
@@ -71,6 +84,14 @@ public class RegisterActivity extends AppCompatActivity {
});
}
/**
* check if Passwords are equal
*
* @return true: ok
*/
private
boolean
isPasswordOk
()
{
return
password
.
equals
(
repeatPassword
);
}
private
void
toMainActivity
()
{
...
...
@@ -79,6 +100,7 @@ public class RegisterActivity extends AppCompatActivity {
/**
* checks, if the email is valid
*
* @return true: ok
*/
private
boolean
isEmailOk
()
{
...
...
@@ -88,8 +110,9 @@ public class RegisterActivity extends AppCompatActivity {
/**
* Register a User in the DB.
* @param email Email from the USer.
* @param name Name of the new User.
*
* @param email Email from the USer.
* @param name Name of the new User.
* @param password Password from the User.
*/
private
void
register
(
String
email
,
String
name
,
String
password
)
{
...
...
@@ -121,6 +144,7 @@ public class RegisterActivity extends AppCompatActivity {
/**
* Shows the User different messages.
*
* @param message Toast message for the User.
*/
private
void
showToastMessage
(
final
String
message
)
{
...
...
BIDL/BIDL/app/src/main/java/de/uni_oldenburg/bidl/guest_view/ResetPasswordActivity.java
View file @
a9c70991
...
...
@@ -13,14 +13,20 @@ import services.servercommunication.NetworkService;
public
class
ResetPasswordActivity
extends
AppCompatActivity
{
// Tag constant for Logging
/**
* Tag constant for Logging
**/
private
static
final
String
Tag
=
ResetPasswordActivity
.
class
.
getSimpleName
();
// GUI
/**
* GUI
**/
private
EditText
resetPwEditText
;
private
Button
resetPwButton
;
// Values
/**
* values
**/
private
String
mail
;
...
...
@@ -35,35 +41,35 @@ public class ResetPasswordActivity extends AppCompatActivity {
}
public
void
resetPassword
(
View
view
){
public
void
resetPassword
(
View
view
)
{
mail
=
resetPwEditText
.
getText
().
toString
();
if
(
mail
.
isEmpty
()){
if
(
mail
.
isEmpty
())
{
Toast
.
makeText
(
getApplicationContext
(),
getString
(
R
.
string
.
resetPassword_emial
),
Toast
.
LENGTH_SHORT
).
show
();
}
else
{
}
else
{
NetworkService
.
resetPassword
(
mail
,
new
NetworkService
.
RequestResetPasswordHandler
()
{
@Override
public
void
done
(
final
String
statusResponse
)
{
ResetPasswordActivity
.
this
.
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
if
(
statusResponse
.
equals
(
"ok"
))
{
Toast
.
makeText
(
getApplicationContext
(),
getString
(
R
.
string
.
resetPassword_success
),
Toast
.
LENGTH_SHORT
).
show
();
}
else
if
(
statusResponse
.
equals
(
"error"
))
{
Toast
.
makeText
(
getApplicationContext
(),
getString
(
R
.
string
.
resetPassword_error
),
Toast
.
LENGTH_SHORT
).
show
();
}
else
{
Toast
.
makeText
(
getApplicationContext
(),
getString
(
R
.
string
.
register_response_noconnection
),
Toast
.
LENGTH_SHORT
).
show
();
switch
(
statusResponse
)
{
case
"ok"
:
Toast
.
makeText
(
getApplicationContext
(),
getString
(
R
.
string
.
resetPassword_success
),
Toast
.
LENGTH_SHORT
).
show
();
break
;
case
"error"
:
Toast
.
makeText
(
getApplicationContext
(),
getString
(
R
.
string
.
resetPassword_error
),
Toast
.
LENGTH_SHORT
).
show
();
break
;
default
:
Toast
.
makeText
(
getApplicationContext
(),
getString
(
R
.
string
.
register_response_noconnection
),
Toast
.
LENGTH_SHORT
).
show
();
break
;
}
}
...
...
@@ -77,7 +83,7 @@ public class ResetPasswordActivity extends AppCompatActivity {
}
public
void
onBackPressed
(){
public
void
onBackPressed
()
{
startActivity
(
new
Intent
(
this
,
LoginActivity
.
class
));
finish
();
}
...
...
BIDL/BIDL/app/src/main/java/de/uni_oldenburg/bidl/home_view/MainActivity.java
View file @
a9c70991
This diff is collapsed.
Click to expand it.
BIDL/BIDL/app/src/main/java/de/uni_oldenburg/bidl/listfragment/SuperListFragment.java
View file @
a9c70991
package
de.uni_oldenburg.bidl.listfragment
;
import
android.app.Activity
;
import
android.content.Context
;
import
android.support.v4.app.ListFragment
;
import
android.os.Bundle
;
import
android.support.v4.widget.SwipeRefreshLayout
;
...
...
@@ -9,10 +8,12 @@ import android.util.Log;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.ListView
;
import
classes.MyList
;
import
classes.apps.forum.CommentList
;
import
de.uni_oldenburg.bidl.R
;
import
services.ViewHelper.SwipeDismissListViewTouchListener
;
/**
* Created by Christof on 01.09.2016.
...
...
@@ -64,8 +65,20 @@ public class SuperListFragment extends ListFragment implements SwipeRefreshLayou
@Override
public
void
onViewCreated
(
View
view
,
Bundle
savedInstanceState
)
{
super
.
onViewCreated
(
view
,
savedInstanceState
);
if
(
withSwipe
){
//ToDo: das Löschen von Daten durch swipen realisieren.
if
(
withSwipe
)
{
SwipeDismissListViewTouchListener
swipeListener
=
new
SwipeDismissListViewTouchListener
(
this
.
getListView
(),
new
SwipeDismissListViewTouchListener
.
DismissCallbacks
()
{
@Override
public
boolean
canDismiss
(
int
position
)
{
return
true
;
}
@Override
public
void
onDismiss
(
ListView
listView
,
int
[]
reverseSortedPositions
)
{
communicator
.
onSwipeDismiss
(
listView
,
reverseSortedPositions
);
}
});
this
.
getListView
().
setOnTouchListener
(
swipeListener
);
this
.
getListView
().
setOnScrollListener
(
swipeListener
.
makeScrollListener
());
}
swipeRefreshLayout
=
(
SwipeRefreshLayout
)
view
.
findViewById
(
R
.
id
.
swipelayout
);
if
(
isRefreshable
){
...
...
@@ -108,6 +121,7 @@ public class SuperListFragment extends ListFragment implements SwipeRefreshLayou
this
.
communicator
=
null
;
}
@Override
public
void
onRefresh
()
{
communicator
.
updateFragList
();
...
...
BIDL/BIDL/app/src/main/java/de/uni_oldenburg/bidl/member_view/ChangePasswordActivity.java
View file @
a9c70991
...
...
@@ -2,7 +2,6 @@ package de.uni_oldenburg.bidl.member_view;
import
android.support.v7.app.AppCompatActivity
;
import
android.os.Bundle
;
import
android.util.Log
;
import
android.view.View
;
import
android.widget.Button
;
import
android.widget.EditText
;
...
...
@@ -14,28 +13,34 @@ import de.uni_oldenburg.bidl.R;
import
services.servercommunication.NetworkService
;
public
class
ChangePasswordActivity
extends
AppCompatActivity
{
/**
* Tag for loggin
**/
private
static
final
String
TAG
=
ChangePasswordActivity
.
class
.
getSimpleName
();
// Values
/**
* GUI
**/
private
EditText
newPasswordEditText
;
private
EditText
currentPasswordEditText
;
private
EditText
repeatPasswordEditText
;
private
Button
changePasswordButton
;
/**
* values
**/
private
User
user
;
private
String
newPassword
;
private
String
currentPassword
;
private
String
repeatPassword
;
private
Boolean
equalPassword
;
// GUI
private
EditText
newPasswordEditText
;
private
EditText
currentPasswordEditText
;
private
EditText
repeatPasswordEditText
;
private
Button
changePasswordButton
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_change_password
);
LocalStorage
storage
=
new
LocalStorage
(
this
);
this
.
user
=
storage
.
getLoggedInUser
();
...
...
@@ -47,41 +52,45 @@ public class ChangePasswordActivity extends AppCompatActivity {
}
public
void
changePassword
(
View
view
)
{
//
hole aktuelles Passwort
//
get current Password
currentPassword
=
currentPasswordEditText
.
getText
().
toString
();
//
hole neues Passwort
//
get new Password
newPassword
=
newPasswordEditText
.
getText
().
toString
();
//
hole das neue Passwort, wiederholt
//
repeat new Password
repeatPassword
=
repeatPasswordEditText
.
getText
().
toString
();
//
vergleiche Passwörter
//
compare Passwords
equalPassword
=
newPassword
.
equals
(
repeatPassword
);
if
(
currentPassword
.
isEmpty
()
||
newPassword
.
isEmpty
()
||
repeatPassword
.
isEmpty
())
{
if
(
currentPassword
.
isEmpty
()
||
newPassword
.
isEmpty
()
||
repeatPassword
.
isEmpty
())
{
toastMessage
(
getString
(
R
.
string
.
enterPassword
));
}
else
if
(
equalPassword
){
}
else
if
(
equalPassword
)
{
NetworkService
.
changePassword
((
int
)
user
.
getUserId
(),
currentPassword
,
newPassword
,
new
NetworkService
.
RequestChangePasswordHandler
()
{
@Override
public
void
done
(
String
response
)
{
if
(
response
.
equals
(
"ok"
))
{
toastMessage
(
getString
(
R
.
string
.
profil_passwordChangeSuccess
));
}
else
if
(
response
.
equals
(
"error"
))
{
toastMessage
(
getString
(
R
.
string
.
profil_passwordChangeFail
));
}
else
{
toastMessage
(
getString
(
R
.
string
.
register_response_noconnection
));
switch
(
response
)
{
case
"ok"
:
toastMessage
(
getString
(
R
.
string
.
profil_passwordChangeSuccess
));
break
;
case
"error"
:
toastMessage
(
getString
(
R
.
string
.
profil_passwordChangeFail
));
break
;
default
:
toastMessage
(
getString
(
R
.
string
.
register_response_noconnection
));
break
;
}
}
});
}
else
{
}
else
{
toastMessage
(
getString
(
R
.
string
.
register_response_passwordDontMatch
));
}
}
/**
* Zeigt eine Toastmessage an
* @param message Nachricht, die angezeigt werden soll
* Show Toastmessage
*
* @param message which should be displayed
*/
protected
void
toastMessage
(
final
String
message
)
{
this
.
runOnUiThread
(
new
Runnable
()
{
...
...
BIDL/BIDL/app/src/main/java/de/uni_oldenburg/bidl/member_view/FavoriteActivity.java
View file @
a9c70991
package
de.uni_oldenburg.bidl.member_view
;
import
android.app.Dialog
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.support.design.widget.FloatingActionButton
;
import
android.support.design.widget.Snackbar
;
import
android.support.v7.app.AppCompatActivity
;
import
android.support.v7.widget.ListPopupWindow
;
import
android.support.v7.widget.Toolbar
;
import
android.view.Gravity
;
import
android.view.MotionEvent
;
import
android.view.View
;
import
android.view.WindowManager
;
import
android.widget.AdapterView
;
import
android.widget.ArrayAdapter
;
import
android.widget.ListView
;
import
android.widget.PopupWindow
;
import
android.widget.Toast
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;