From 9af80f008df6c039d211b9771f8b8cf6389d18a0 Mon Sep 17 00:00:00 2001 From: Christian Basler Date: Wed, 2 Nov 2016 20:55:56 +0100 Subject: [PATCH] "Up" navigation now brings you back to the selected label --- .../ch/dissem/apps/abit/DetailActivity.java | 25 +++++++++--------- .../ch/dissem/apps/abit/MainActivity.java | 14 ++++++---- .../apps/abit/MessageDetailActivity.java | 26 ++++++++++++++++--- 3 files changed, 45 insertions(+), 20 deletions(-) diff --git a/app/src/main/java/ch/dissem/apps/abit/DetailActivity.java b/app/src/main/java/ch/dissem/apps/abit/DetailActivity.java index f725c46..0289b64 100644 --- a/app/src/main/java/ch/dissem/apps/abit/DetailActivity.java +++ b/app/src/main/java/ch/dissem/apps/abit/DetailActivity.java @@ -35,18 +35,19 @@ public abstract class DetailActivity extends AppCompatActivity { @Override public boolean onOptionsItemSelected(MenuItem item) { - int id = item.getItemId(); - if (id == android.R.id.home) { - // This ID represents the Home or Up button. In the case of this - // activity, the Up button is shown. Use NavUtils to allow users - // to navigate up one level in the application structure. For - // more details, see the Navigation pattern on Android Design: - // - // http://developer.android.com/design/patterns/navigation.html#up-vs-back - // - NavUtils.navigateUpTo(this, new Intent(this, MainActivity.class)); - return true; + switch (item.getItemId()) { + case android.R.id.home: + // This ID represents the Home or Up button. In the case of this + // activity, the Up button is shown. Use NavUtils to allow users + // to navigate up one level in the application structure. For + // more details, see the Navigation pattern on Android Design: + // + // http://developer.android.com/design/patterns/navigation.html#up-vs-back + // + NavUtils.navigateUpTo(this, new Intent(this, MainActivity.class)); + return true; + default: + return super.onOptionsItemSelected(item); } - return super.onOptionsItemSelected(item); } } diff --git a/app/src/main/java/ch/dissem/apps/abit/MainActivity.java b/app/src/main/java/ch/dissem/apps/abit/MainActivity.java index e49e5a3..af705e0 100644 --- a/app/src/main/java/ch/dissem/apps/abit/MainActivity.java +++ b/app/src/main/java/ch/dissem/apps/abit/MainActivity.java @@ -91,6 +91,7 @@ import static ch.dissem.apps.abit.service.BitmessageService.isRunning; public class MainActivity extends AppCompatActivity implements ListSelectionListener, ActionBarListener { public static final String EXTRA_SHOW_MESSAGE = "ch.dissem.abit.ShowMessage"; + public static final String EXTRA_SHOW_LABEL = "ch.dissem.abit.ShowLabel"; public static final String EXTRA_REPLY_TO_MESSAGE = "ch.dissem.abit.ReplyToMessage"; public static final String ACTION_SHOW_INBOX = "ch.dissem.abit.ShowInbox"; @@ -122,7 +123,9 @@ public class MainActivity extends AppCompatActivity instance = new WeakReference<>(this); bmc = Singleton.getBitmessageContext(this); List