From 8bb8f47dd2c74e8c89a6d344f83d24cd3e9225d2 Mon Sep 17 00:00:00 2001 From: Bruno Martins Date: Wed, 18 Oct 2017 03:10:01 +0200 Subject: [PATCH] samsung: doze: Re-integrate into Settings * Apply the default Oreo theme and inherit the layouts from Google for the Settings app, in order to keep UI consistency. * Get rid of SettingsDrawerActivity as it no longer fits in and include the back button in the action bar. * Kill the icon drawable not only because is a leftover, but also doesn't really serve any puropose in the new UI. Change-Id: I71ea2c118dcfd387904d04516572902babb16e35 --- doze/Android.mk | 8 ++-- doze/AndroidManifest.xml | 10 ++--- doze/res/drawable/ic_settings_gestures.xml | 32 --------------- doze/res/values/styles.xml | 39 ++++++++++++++++++- .../settings/device/SamsungDozeActivity.java | 21 ++-------- .../device/TouchscreenGestureSettings.java | 13 +++++++ 6 files changed, 62 insertions(+), 61 deletions(-) delete mode 100644 doze/res/drawable/ic_settings_gestures.xml diff --git a/doze/Android.mk b/doze/Android.mk index 18fd4c46..4f9f9047 100644 --- a/doze/Android.mk +++ b/doze/Android.mk @@ -12,10 +12,12 @@ LOCAL_PRIVILEGED_MODULE := true LOCAL_USE_AAPT2 := true LOCAL_STATIC_ANDROID_LIBRARIES := \ - android-support-v14-preference \ + android-support-v4 \ + android-support-v13 \ android-support-v7-appcompat \ android-support-v7-preference \ - android-support-v7-recyclerview + android-support-v7-recyclerview \ + android-support-v14-preference LOCAL_STATIC_JAVA_LIBRARIES := \ org.lineageos.platform.internal @@ -31,8 +33,6 @@ ifneq ($(INCREMENTAL_BUILDS),) LOCAL_JACK_ENABLED := incremental endif -include frameworks/base/packages/SettingsLib/common.mk - include $(BUILD_PACKAGE) include $(call all-makefiles-under,$(LOCAL_PATH)) diff --git a/doze/AndroidManifest.xml b/doze/AndroidManifest.xml index e8ad9dec..060ad2c2 100644 --- a/doze/AndroidManifest.xml +++ b/doze/AndroidManifest.xml @@ -13,28 +13,28 @@ + android:minSdkVersion="24" + android:targetSdkVersion="26"/> - + - + android:theme="@style/Theme.Main"> diff --git a/doze/res/drawable/ic_settings_gestures.xml b/doze/res/drawable/ic_settings_gestures.xml deleted file mode 100644 index c0a02820..00000000 --- a/doze/res/drawable/ic_settings_gestures.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - diff --git a/doze/res/values/styles.xml b/doze/res/values/styles.xml index 69e4ff38..1ecca6c5 100644 --- a/doze/res/values/styles.xml +++ b/doze/res/values/styles.xml @@ -15,7 +15,42 @@ limitations under the License. --> - + + + + + + + + + + + + + + diff --git a/doze/src/org/lineageos/settings/device/SamsungDozeActivity.java b/doze/src/org/lineageos/settings/device/SamsungDozeActivity.java index 7ea9853c..571f34a6 100644 --- a/doze/src/org/lineageos/settings/device/SamsungDozeActivity.java +++ b/doze/src/org/lineageos/settings/device/SamsungDozeActivity.java @@ -15,32 +15,17 @@ */ package org.lineageos.settings.device; -import android.app.Fragment; -import android.app.FragmentTransaction; import android.os.Bundle; -import android.view.MenuItem; +import android.preference.PreferenceActivity; -import com.android.settingslib.drawer.SettingsDrawerActivity; - -public class SamsungDozeActivity extends SettingsDrawerActivity { +public class SamsungDozeActivity extends PreferenceActivity { private static final String TAG = "samsung_doze"; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - getFragmentManager().beginTransaction().replace(R.id.content_frame, + getFragmentManager().beginTransaction().replace(android.R.id.content, new TouchscreenGestureSettings(), TAG).commit(); - - getActionBar().setDisplayHomeAsUpEnabled(true); - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - if (item.getItemId() == android.R.id.home) { - onBackPressed(); - return true; - } - return false; } } diff --git a/doze/src/org/lineageos/settings/device/TouchscreenGestureSettings.java b/doze/src/org/lineageos/settings/device/TouchscreenGestureSettings.java index 4bf29004..44c9b942 100644 --- a/doze/src/org/lineageos/settings/device/TouchscreenGestureSettings.java +++ b/doze/src/org/lineageos/settings/device/TouchscreenGestureSettings.java @@ -16,11 +16,13 @@ package org.lineageos.settings.device; +import android.app.ActionBar; import android.os.Bundle; import android.support.v14.preference.PreferenceFragment; import android.support.v14.preference.SwitchPreference; import android.support.v7.preference.Preference; import android.provider.Settings; +import android.view.MenuItem; import org.lineageos.internal.util.ScreenType; @@ -35,6 +37,8 @@ public class TouchscreenGestureSettings extends PreferenceFragment { @Override public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { addPreferencesFromResource(R.xml.gesture_panel); + final ActionBar actionBar = getActivity().getActionBar(); + actionBar.setDisplayHomeAsUpEnabled(true); mHandwavePreference = (SwitchPreference) findPreference(KEY_HAND_WAVE); @@ -68,4 +72,13 @@ public class TouchscreenGestureSettings extends PreferenceFragment { return true; } }; + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + if (item.getItemId() == android.R.id.home) { + getActivity().onBackPressed(); + return true; + } + return false; + } }