Commit 05de6a68 authored by Christof Wolke's avatar Christof Wolke

letzte bugs

parent a9c70991
......@@ -91,7 +91,7 @@
<activity
android:name=".member_view.FavoriteActivity"
android:label="@string/title_activity_favorite"
android:theme="@style/AppTheme"></activity>
android:theme="@style/AppTheme"/>
</application>
</manifest>
\ No newline at end of file
......@@ -32,6 +32,7 @@ import classes.apps.event.Favorite;
import de.uni_oldenburg.bidl.BaseActivity;
import de.uni_oldenburg.bidl.R;
import de.uni_oldenburg.bidl.guest_view.LoginActivity;
import services.db.DBHelper;
import services.servercommunication.NetworkService;
public class MainActivity extends BaseActivity {
......@@ -275,7 +276,6 @@ public class MainActivity extends BaseActivity {
MainActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
setEvent(event);
initGui(event);
}
});
......@@ -316,6 +316,9 @@ public class MainActivity extends BaseActivity {
**/
private void initGui(Event event) {
progress.dismiss();
if(DBHelper.getEvent() != null){
DBHelper.clearEvents();
}
event.save();
setEvent(event);
setTitle(event.getName());
......
......@@ -73,7 +73,7 @@ public class ChangePasswordActivity extends AppCompatActivity {
case "error":
toastMessage(getString(R.string.profil_passwordChangeFail));
break;
default:
case "no_Connection":
toastMessage(getString(R.string.register_response_noconnection));
break;
}
......
......@@ -67,11 +67,17 @@ public class ProfileActivity extends BaseActivity {
NetworkService.changeProfileEmail((int) user.getUserId(), email, new NetworkService.RequestChangeProfileEmailHandler() {
@Override
public void done(String statusResponseObj) {
if (statusResponseObj.equals("ok")) {
setUserEmail(email);
toastMessage(getString(R.string.profil_useremailChanged));
} else {
toastMessage(getString(R.string.profil_useremailNotChanged));
switch (statusResponseObj) {
case "ok":
setUserEmail(email);
toastMessage(getString(R.string.profil_useremailChanged));
break;
case "error":
toastMessage(getString(R.string.profil_useremailNotChanged));
break;
case "no_Connection":
toastMessage(getString(R.string.noConnection));
break;
}
}
});
......
......@@ -46,14 +46,14 @@ public class SearchActivity extends BaseActivity implements ListCommunicator {
this.eventContainer = (ListView) findViewById(R.id.search_eventContainer);
setSearchQueryTextListener();
seteventContainerClickListener();
setEventContainerClickListener();
}
/**
* when the user clicked on an item, start the HomeActivity and show the eventItem
**/
private void seteventContainerClickListener() {
private void setEventContainerClickListener() {
eventContainer.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
......@@ -144,13 +144,18 @@ public class SearchActivity extends BaseActivity implements ListCommunicator {
SearchActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
if (events.size() > 0) {
setEvents(events);
addEventFragment();
} else {
eventContainer.setAdapter(null);
Toast.makeText(getApplicationContext(), getString(R.string.noEventFound), Toast.LENGTH_SHORT).show();
if(events != null){
if (events.size() > 0) {
setEvents(events);
addEventFragment();
} else {
eventContainer.setAdapter(null);
Toast.makeText(getApplicationContext(), getString(R.string.noEventFound), Toast.LENGTH_SHORT).show();
}
} else{
Toast.makeText(getApplicationContext(), getString(R.string.noConnection),Toast.LENGTH_SHORT).show();
}
}
});
}
......
......@@ -82,7 +82,7 @@ public class DBHelper {
clearQuestions();
}
private static void clearEvents() {
public static void clearEvents() {
RushCore.getInstance().deleteAll(Event.class);
}
......
......@@ -559,6 +559,9 @@ public abstract class NetworkService {
public static void changeProfileEmail(int userId, String newEmail, final RequestChangeProfileEmailHandler handler) {
okHttpClient.setReadTimeout(15, TimeUnit.SECONDS);
if (!ConnectionHelper.isNetworkAvailable()){
handler.done("no_Connection");
}
/* request body with POST params */
RequestBody requestBody = new FormEncodingBuilder()
.add("userId", Integer.toString(userId))
......@@ -682,7 +685,7 @@ public abstract class NetworkService {
@Override
public void onFailure(Request request, IOException e) {
e.printStackTrace();
handler.done(null);
handler.done("no_Connection");
}
@Override
......@@ -691,7 +694,7 @@ public abstract class NetworkService {
StatusResponse statusResponseObj = LoganSquare.parse(response.body().byteStream(), StatusResponse.class);
handler.done(statusResponseObj.getStatus());
} else {
handler.done(null);
handler.done("error");
}
}
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment