aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
authorHarsh Shandilya <msfjarvis@gmail.com>2019-11-06 19:58:09 +0530
committerHarsh Shandilya <msfjarvis@gmail.com>2019-11-06 19:58:09 +0530
commit3b758928ffa1712f38a52ef87454da559fc5fcb7 (patch)
tree1c31fb93794518bc91344f0a3d9372461d10e385 /app/src/main/java
parentbe0d89958ad0ee18d3bba79db8d21666148d52ce (diff)
Stop relying on parent activties in subsettings
Signed-off-by: Harsh Shandilya <msfjarvis@gmail.com>
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/SshKeyGen.java11
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/autofill/AutofillPreferenceActivity.kt18
2 files changed, 15 insertions, 14 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/SshKeyGen.java b/app/src/main/java/com/zeapo/pwdstore/SshKeyGen.java
index 8f5d1718..1bbe5235 100644
--- a/app/src/main/java/com/zeapo/pwdstore/SshKeyGen.java
+++ b/app/src/main/java/com/zeapo/pwdstore/SshKeyGen.java
@@ -16,6 +16,7 @@ import android.os.AsyncTask;
import android.os.Bundle;
import android.text.InputType;
import android.view.LayoutInflater;
+import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
@@ -61,6 +62,16 @@ public class SshKeyGen extends AppCompatActivity {
}
}
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ if (item.getItemId() == android.R.id.home) {
+ // The back arrow in the action bar should act the same as the back button.
+ onBackPressed();
+ return true;
+ }
+ return super.onOptionsItemSelected(item);
+ }
+
// Invoked when 'Generate' button of SshKeyGenFragment clicked. Generates a
// private and public key, then replaces the SshKeyGenFragment with a
// ShowSshKeyFragment which displays the public key.
diff --git a/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillPreferenceActivity.kt b/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillPreferenceActivity.kt
index 0794e6c8..3fe5e9e7 100644
--- a/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillPreferenceActivity.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/autofill/AutofillPreferenceActivity.kt
@@ -14,8 +14,6 @@ import android.view.MenuItem
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.SearchView
-import androidx.core.app.NavUtils
-import androidx.core.app.TaskStackBuilder
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
@@ -86,18 +84,10 @@ class AutofillPreferenceActivity : AppCompatActivity() {
override fun onOptionsItemSelected(item: MenuItem): Boolean {
// in service, we CLEAR_TASK. then we set the recreate flag.
// something of a hack, but w/o CLEAR_TASK, behaviour was unpredictable
- if (item.itemId == android.R.id.home) {
- val upIntent = NavUtils.getParentActivityIntent(this)
- if (recreate) {
- TaskStackBuilder.create(this)
- .addNextIntentWithParentStack(upIntent!!)
- .startActivities()
- } else {
- NavUtils.navigateUpTo(this, upIntent!!)
- }
- return true
- }
- return super.onOptionsItemSelected(item)
+ return if (item.itemId == android.R.id.home) {
+ onBackPressed()
+ true
+ } else super.onOptionsItemSelected(item)
}
fun showDialog(packageName: String?, appName: String?, isWeb: Boolean) {