From bde5edaf1d1996f3f235e551e534f1c365eead05 Mon Sep 17 00:00:00 2001 From: TheScarastic Date: Wed, 6 Oct 2021 07:25:13 +0000 Subject: [PATCH] AdvancedDisplay: Adapt to S style * Use Theme.SubSettingsBase for theme Original Change-Id: Ic879ce61d83a33da12829008a4336c8a23230d63 Change-Id: Ib16512c898f7419cd40ab71985945dc5636c26de Change-Id: I603bde2d7e3f6d3a1fbae37ca0300100917fa7be Signed-off-by: Francescodario Cuzzocrea --- AdvancedDisplay/AndroidManifest.xml | 2 +- .../settings/device/AdvancedDisplayActivity.java | 8 +++++--- .../settings/device/AdvancedDisplayFragment.java | 14 -------------- 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/AdvancedDisplay/AndroidManifest.xml b/AdvancedDisplay/AndroidManifest.xml index 71b93b0..f5fd7c3 100644 --- a/AdvancedDisplay/AndroidManifest.xml +++ b/AdvancedDisplay/AndroidManifest.xml @@ -7,7 +7,7 @@ + android:theme="@style/Theme.SubSettingsBase"> diff --git a/AdvancedDisplay/src/org/lineageos/settings/device/AdvancedDisplayActivity.java b/AdvancedDisplay/src/org/lineageos/settings/device/AdvancedDisplayActivity.java index 92397c3..30189f4 100644 --- a/AdvancedDisplay/src/org/lineageos/settings/device/AdvancedDisplayActivity.java +++ b/AdvancedDisplay/src/org/lineageos/settings/device/AdvancedDisplayActivity.java @@ -17,14 +17,16 @@ package org.lineageos.settings.device; import android.os.Bundle; -import android.preference.PreferenceActivity; -public class AdvancedDisplayActivity extends PreferenceActivity { +import com.android.settingslib.collapsingtoolbar.CollapsingToolbarBaseActivity; +import com.android.settingslib.collapsingtoolbar.R; + +public class AdvancedDisplayActivity extends CollapsingToolbarBaseActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - getFragmentManager().beginTransaction().replace(android.R.id.content, + getFragmentManager().beginTransaction().replace(R.id.content_frame, new AdvancedDisplayFragment()).commit(); } } diff --git a/AdvancedDisplay/src/org/lineageos/settings/device/AdvancedDisplayFragment.java b/AdvancedDisplay/src/org/lineageos/settings/device/AdvancedDisplayFragment.java index 371a203..5446860 100644 --- a/AdvancedDisplay/src/org/lineageos/settings/device/AdvancedDisplayFragment.java +++ b/AdvancedDisplay/src/org/lineageos/settings/device/AdvancedDisplayFragment.java @@ -16,10 +16,8 @@ package org.lineageos.settings.device; -import android.app.ActionBar; import android.content.res.Resources; import android.os.Bundle; -import android.view.MenuItem; import androidx.preference.PreferenceFragment; @@ -36,9 +34,6 @@ public class AdvancedDisplayFragment extends PreferenceFragment { addPreferencesFromResource(R.xml.screen_preferences); Resources res = getResources(); - final ActionBar actionBar = getActivity().getActionBar(); - actionBar.setDisplayHomeAsUpEnabled(true); - /* mDNIe */ mmDNIeScenario = (mDNIeScenario) findPreference(Constants.KEY_MDNIE_SCENARIO); mmDNIeScenario.setEnabled( @@ -48,13 +43,4 @@ public class AdvancedDisplayFragment extends PreferenceFragment { mmDNIeAccessibility.setEnabled( FileUtils.isFileWritable(res.getString(R.string.mdnie_accessibility_sysfs_file))); } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - if (item.getItemId() == android.R.id.home) { - getActivity().onBackPressed(); - return true; - } - return false; - } } -- 2.20.1