Add back buttons to favourites/blocks activities

This commit is contained in:
Eugen Rochko 2017-03-09 18:09:32 +01:00
parent 02ccaf4610
commit 9172636127
3 changed files with 33 additions and 5 deletions

View file

@ -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);
}
}

View file

@ -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);
}
}

View file

@ -143,15 +143,15 @@
<string name="notification_service_one_mention">Mention from %s</string>
<string name="pref_title_notification_settings">Notifications</string>
<string name="pref_title_pull_notifications">Enable Pull Notifcations</string>
<string name="pref_summary_pull_notifications">check for notifications periodically</string>
<string name="pref_title_pull_notification_check_interval">Check Interval</string>
<string name="pref_summary_pull_notification_check_interval">how often to pull</string>
<string name="pref_title_pull_notifications">Enable pull notifcations</string>
<string name="pref_summary_pull_notifications">Check for notifications periodically</string>
<string name="pref_title_pull_notification_check_interval">Check interval</string>
<string name="pref_summary_pull_notification_check_interval">How often to pull</string>
<string name="pref_title_notification_alert_sound">Notify with a sound</string>
<string name="pref_title_notification_style_vibrate">Notify with vibration</string>
<string name="pref_title_notification_style_light">Notify with light</string>
<string name="pref_title_appearance_settings">Appearance</string>
<string name="pref_title_light_theme">Use The Light Theme</string>
<string name="pref_title_light_theme">Use the Light Theme</string>
<string name="action_submit">Submit</string>
<string name="action_photo_pick">Add media</string>
<string name="action_compose_options">Privacy options</string>