From 4f1a6fd97ccc0c3b96acfdadb2f43e24255b0e3f Mon Sep 17 00:00:00 2001 From: Florian CUNY Date: Sat, 4 Jul 2020 17:26:01 +0200 Subject: [PATCH] Added appbar at the top of the SettingsActivity --- .../peertube/activity/SettingsActivity.java | 13 +++++++++++++ app/src/main/res/layout/activity_settings.xml | 17 ++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/net/schueller/peertube/activity/SettingsActivity.java b/app/src/main/java/net/schueller/peertube/activity/SettingsActivity.java index 52db457..38126d2 100644 --- a/app/src/main/java/net/schueller/peertube/activity/SettingsActivity.java +++ b/app/src/main/java/net/schueller/peertube/activity/SettingsActivity.java @@ -38,12 +38,25 @@ public class SettingsActivity extends CommonActivity { .beginTransaction() .replace(R.id.settings, new SettingsFragment()) .commit(); + + // Attaching the layout to the toolbar object + Toolbar toolbar = findViewById(R.id.tool_bar_settings); + // Setting toolbar as the ActionBar with setSupportActionBar() call + setSupportActionBar(toolbar); + ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); + actionBar.setHomeAsUpIndicator(R.drawable.ic_baseline_close_24); } } + @Override + public boolean onSupportNavigateUp() { + finish(); // close this activity as oppose to navigating up + return false; + } + public static class SettingsFragment extends PreferenceFragmentCompat { @Override public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index de6591a..4fb6dcc 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -1,6 +1,21 @@ + android:layout_height="match_parent" + android:orientation="vertical"> + + + + + +