X-Git-Url: https://git.ktnx.net/?p=mobile-ledger.git;a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2Fui%2Fpatterns%2FPatternsActivity.java;h=945123d95e32c5990be4d6ae305f510623383db0;hp=793a2be207f52cf8619ec3019e66c2f4c75698bd;hb=0162f26f7b07bf2db15f5cb4026f94655f019618;hpb=ed573ab92e563419bfabed1f1a4aba57462273ad diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/patterns/PatternsActivity.java b/app/src/main/java/net/ktnx/mobileledger/ui/patterns/PatternsActivity.java index 793a2be2..945123d9 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/patterns/PatternsActivity.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/patterns/PatternsActivity.java @@ -19,6 +19,7 @@ package net.ktnx.mobileledger.ui.patterns; import android.os.Bundle; import android.view.Menu; +import android.view.MenuItem; import androidx.appcompat.app.ActionBar; import androidx.lifecycle.ViewModelProvider; @@ -78,6 +79,20 @@ public class PatternsActivity extends CrashReportingActivity b.fabAdd.setOnClickListener(v -> onEditPattern(null)); b.fabSave.setOnClickListener(v -> onSavePattern()); } + @Override + public boolean onOptionsItemSelected(MenuItem item) { + if (item.getItemId() == android.R.id.home) { + if (navController.getCurrentDestination() + .getId() == R.id.patternDetailsFragment) + navController.popBackStack(); + else + finish(); + + return true; + } + return super.onOptionsItemSelected(item); + } + @Override public void onEditPattern(Long id) { if (id == null) {