]> git.ktnx.net Git - mobile-ledger.git/commitdiff
make the "home" (back arrow) toolbar button in the profile detail activity behave...
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Thu, 14 May 2020 08:16:43 +0000 (11:16 +0300)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Thu, 14 May 2020 17:39:53 +0000 (17:39 +0000)
this already done for the new transaction activity and seems proper here too
without it, pressing back (on the "keyboard") finishes the activity returning
to the main activity without changing its state (e.g. the drawer is kept
open), while pressing the home arrow (usually at the top left) re-starts
the main activity, closing its drawer

app/src/main/java/net/ktnx/mobileledger/ui/activity/ProfileDetailActivity.java

index 323568b4ea9cdac4a339fe6b0512485f281ba413..7daa3d315cbfbd479970efb26fcbc3121c285c61 100644 (file)
@@ -19,6 +19,7 @@ package net.ktnx.mobileledger.ui.activity;
 
 import android.os.Bundle;
 import android.view.Menu;
+import android.view.MenuItem;
 
 import androidx.appcompat.app.ActionBar;
 import androidx.appcompat.widget.Toolbar;
@@ -110,5 +111,12 @@ public class ProfileDetailActivity extends CrashReportingActivity {
 
         return true;
     }
-
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        if (item.getItemId() == android.R.id.home) {
+            finish();
+            return true;
+        }
+        return super.onOptionsItemSelected(item);
+    }
 }