1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2025-01-07 10:42:07 +00:00

Fix action bar not showing on sub-prefs screen (fixes #317)

on Android < 7
This commit is contained in:
Catfriend1 2019-02-10 13:52:17 +01:00
parent 3a7705bde6
commit ca17291561

View file

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