Skip to content
This repository has been archived by the owner on Nov 24, 2020. It is now read-only.

Commit

Permalink
Further homescreen activity functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
dbrgn committed May 5, 2012
1 parent 3a8d1b6 commit a8e93df
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions application/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
<string name="dashboardscreen_profileButtonText">Profil</string>
<string name="dashboardscreen_consumptionButtonText">Konsum</string>
<string name="dashboardscreen_ratingButtonText">Rating</string>
<string name="dashboardscreen_loggedOut">Logout erfolgreich!</string>

<!-- Beer list -->
<string name="beerlist_title">BierListe</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,17 @@ public boolean onCreateOptionsMenu(Menu menu) {

@Override
public boolean onOptionsItemSelected(MenuItem item) {
final Intent intent;
switch (item.getItemId()) {
case R.id_mainmenu.about:
final Intent intent = new Intent(this.getBaseContext(), AboutScreenActivity.class);
intent = new Intent(this.getBaseContext(), AboutScreenActivity.class);
startActivity(intent);
break;
case R.id_mainmenu.logout:
// TODO
Toast.makeText(this, "TODO logout!", Toast.LENGTH_LONG).show();
Auth.clearAuth();
Toast.makeText(this.getApplicationContext(), getString(R.string.dashboardscreen_loggedOut), Toast.LENGTH_SHORT).show();
intent = new Intent(this.getBaseContext(), LoginScreenActivity.class);
startActivity(intent);
break;
}
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ public static boolean getAutologin() {
*/
public static boolean dataAvailable() {
SharedPreferences authStore = getSharedPreferences();
return authStore.contains(USERNAME_KEY) && authStore.contains(PASSWORD_KEY);
boolean keysAvailable = authStore.contains(USERNAME_KEY) && authStore.contains(PASSWORD_KEY);

boolean nonEmptyValues = !(getUsername().isEmpty() || getPassword().isEmpty());
return keysAvailable && nonEmptyValues;
}
}

0 comments on commit a8e93df

Please sign in to comment.