From ca17291561d9190c593c5a2122f302ed930653ab Mon Sep 17 00:00:00 2001 From: Catfriend1 Date: Sun, 10 Feb 2019 13:52:17 +0100 Subject: [PATCH] Fix action bar not showing on sub-prefs screen (fixes #317) on Android < 7 --- .../syncthingandroid/activities/SettingsActivity.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/nutomic/syncthingandroid/activities/SettingsActivity.java b/app/src/main/java/com/nutomic/syncthingandroid/activities/SettingsActivity.java index 93aa3e6e..2fb4030c 100644 --- a/app/src/main/java/com/nutomic/syncthingandroid/activities/SettingsActivity.java +++ b/app/src/main/java/com/nutomic/syncthingandroid/activities/SettingsActivity.java @@ -412,7 +412,12 @@ public class SettingsActivity extends SyncthingActivity { // User has clicked on a sub-preferences screen. try { mCurrentPrefScreenDialog = ((PreferenceScreen) preference).getDialog(); - LinearLayout root = (LinearLayout) mCurrentPrefScreenDialog.findViewById(android.R.id.list).getParent().getParent(); + LinearLayout root; + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { + root = (LinearLayout) mCurrentPrefScreenDialog.findViewById(android.R.id.list).getParent().getParent(); + } else { + root = (LinearLayout) mCurrentPrefScreenDialog.findViewById(android.R.id.list).getParent(); + } SyncthingActivity syncthingActivity = (SyncthingActivity) getActivity(); LayoutInflater layoutInflater = syncthingActivity.getLayoutInflater(); Toolbar toolbar = (Toolbar) layoutInflater.inflate(R.layout.widget_toolbar, root, false);