From 9172636127d3161076ba9ce766d50a8955828ffb Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Thu, 9 Mar 2017 18:09:32 +0100 Subject: [PATCH] Add back buttons to favourites/blocks activities --- .../com/keylesspalace/tusky/BlocksActivity.java | 14 ++++++++++++++ .../keylesspalace/tusky/FavouritesActivity.java | 14 ++++++++++++++ app/src/main/res/values/strings.xml | 10 +++++----- 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/BlocksActivity.java b/app/src/main/java/com/keylesspalace/tusky/BlocksActivity.java index 99e391931..534e5ea67 100644 --- a/app/src/main/java/com/keylesspalace/tusky/BlocksActivity.java +++ b/app/src/main/java/com/keylesspalace/tusky/BlocksActivity.java @@ -21,6 +21,7 @@ import android.support.v4.app.Fragment; import android.support.v4.app.FragmentTransaction; import android.support.v7.app.ActionBar; import android.support.v7.widget.Toolbar; +import android.view.MenuItem; public class BlocksActivity extends BaseActivity { @Override @@ -33,6 +34,8 @@ public class BlocksActivity extends BaseActivity { ActionBar bar = getSupportActionBar(); if (bar != null) { bar.setTitle(getString(R.string.title_blocks)); + bar.setDisplayHomeAsUpEnabled(true); + bar.setDisplayShowHomeEnabled(true); } FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); @@ -40,4 +43,15 @@ public class BlocksActivity extends BaseActivity { fragmentTransaction.add(R.id.fragment_container, fragment); fragmentTransaction.commit(); } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case android.R.id.home: { + onBackPressed(); + return true; + } + } + return super.onOptionsItemSelected(item); + } } diff --git a/app/src/main/java/com/keylesspalace/tusky/FavouritesActivity.java b/app/src/main/java/com/keylesspalace/tusky/FavouritesActivity.java index 6b66b8462..8241b950b 100644 --- a/app/src/main/java/com/keylesspalace/tusky/FavouritesActivity.java +++ b/app/src/main/java/com/keylesspalace/tusky/FavouritesActivity.java @@ -21,6 +21,7 @@ import android.support.v4.app.Fragment; import android.support.v4.app.FragmentTransaction; import android.support.v7.app.ActionBar; import android.support.v7.widget.Toolbar; +import android.view.MenuItem; public class FavouritesActivity extends BaseActivity { @Override @@ -33,6 +34,8 @@ public class FavouritesActivity extends BaseActivity { ActionBar bar = getSupportActionBar(); if (bar != null) { bar.setTitle(getString(R.string.title_favourites)); + bar.setDisplayHomeAsUpEnabled(true); + bar.setDisplayShowHomeEnabled(true); } FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); @@ -40,4 +43,15 @@ public class FavouritesActivity extends BaseActivity { fragmentTransaction.add(R.id.fragment_container, fragment); fragmentTransaction.commit(); } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case android.R.id.home: { + onBackPressed(); + return true; + } + } + return super.onOptionsItemSelected(item); + } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 20c9d4d80..cfc9ffd33 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -143,15 +143,15 @@ Mention from %s Notifications - Enable Pull Notifcations - check for notifications periodically - Check Interval - how often to pull + Enable pull notifcations + Check for notifications periodically + Check interval + How often to pull Notify with a sound Notify with vibration Notify with light Appearance - Use The Light Theme + Use the Light Theme Submit Add media Privacy options