diff options
author | Zeapo <mohamed@zenadi.com> | 2014-08-07 00:15:07 +0100 |
---|---|---|
committer | Zeapo <mohamed@zenadi.com> | 2014-08-07 00:15:07 +0100 |
commit | 835bbc01dc7a76f71702ccb8a07b19558285327c (patch) | |
tree | 7c1864702482105cef7c36ecfa019014b98bbca5 /app/src/main/java | |
parent | 19b48565f40d96bdd2a277378758c98e99edf490 (diff) |
use home button to return from preferences
Diffstat (limited to 'app/src/main/java')
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/PasswordStore.java | 6 | ||||
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/UserPreference.java | 17 |
2 files changed, 18 insertions, 5 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java b/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java index f49a7dca..374163a9 100644 --- a/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java +++ b/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java @@ -78,6 +78,7 @@ public class PasswordStore extends Activity implements ToCloneOrNot.OnFragmentI System.out.println("Exception caught :("); e.printStackTrace(); } + this.leftActivity = true; return true; case R.id.menu_add_password: @@ -91,11 +92,6 @@ public class PasswordStore extends Activity implements ToCloneOrNot.OnFragmentI refreshListAdapter(); return true; - - case android.R.id.home: - getFragmentManager().popBackStack(); - return true; - default: break; } diff --git a/app/src/main/java/com/zeapo/pwdstore/UserPreference.java b/app/src/main/java/com/zeapo/pwdstore/UserPreference.java index a0c5d49c..6a3967d1 100644 --- a/app/src/main/java/com/zeapo/pwdstore/UserPreference.java +++ b/app/src/main/java/com/zeapo/pwdstore/UserPreference.java @@ -2,6 +2,7 @@ package com.zeapo.pwdstore; import android.os.Bundle; import android.preference.PreferenceActivity; +import android.view.MenuItem; public class UserPreference extends PreferenceActivity { @@ -12,4 +13,20 @@ public class UserPreference extends PreferenceActivity { getActionBar().setDisplayHomeAsUpEnabled(true); } + + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + // Handle action bar item clicks here. The action bar will + // automatically handle clicks on the Home/Up button, so long + // as you specify a parent activity in AndroidManifest.xml. + int id = item.getItemId(); + switch (id) { + case android.R.id.home: + setResult(RESULT_OK); + finish(); + return true; + } + return super.onOptionsItemSelected(item); + } } |