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
tirimbino
Bruno Martins 7 years ago committed by Jan Altensen
parent a4b1e16b80
commit 8bb8f47dd2
No known key found for this signature in database
GPG Key ID: 3E45BB95F7AD33DA
  1. 8
      doze/Android.mk
  2. 10
      doze/AndroidManifest.xml
  3. 32
      doze/res/drawable/ic_settings_gestures.xml
  4. 39
      doze/res/values/styles.xml
  5. 21
      doze/src/org/lineageos/settings/device/SamsungDozeActivity.java
  6. 13
      doze/src/org/lineageos/settings/device/TouchscreenGestureSettings.java

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

@ -13,28 +13,28 @@
<protected-broadcast android:name="com.android.systemui.doze.pulse" />
<uses-sdk
android:minSdkVersion="21"
android:targetSdkVersion="21"/>
android:minSdkVersion="24"
android:targetSdkVersion="26"/>
<application
android:label="@string/device_settings_app_name"
android:persistent="true">
<receiver android:name="org.lineageos.settings.device.BootCompletedReceiver">
<receiver android:name=".BootCompletedReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<service android:name="org.lingeageos.settings.device.SamsungDozeService"
<service android:name=".SamsungDozeService"
android:permission="SamsungDozeService">
</service>
<activity
android:name=".SamsungDozeActivity"
android:label="@string/ambient_display_title"
android:theme="@style/SamsungDozeSettings">
android:theme="@style/Theme.Main">
<intent-filter>
<action android:name="org.lineageos.settings.device.DOZE_SETTINGS" />
<category android:name="android.intent.category.DEFAULT" />

@ -1,32 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) 2015 The CyanogenMod Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@*android:color/material_deep_teal_500"
android:pathData="M4.7,6.9c0.7-0.7,1.4-1.4,1.7-1.2c0.5,0.2,0,1-0.3,1.5c-0.2,0.4-2.8,3.9-2.8,6.3c0,1.3,0.5,2.3,1.3,3
c0.7,0.6,1.7,0.7,2.6,0.5c1.1-0.3,1.9-1.4,3-2.8c1.2-1.5,2.8-3.4,4-3.4c1.6,0,1.6,1,1.7,1.8c-3.7,0.6-5.3,3.7-5.3,5.4
s1.4,3.1,3.2,3.1c1.6,0,4.3-1.3,4.6-6.1H21v-2.5h-2.4c-0.1-1.7-1.1-4.2-4-4.2c-2.2,0-4.1,1.9-4.9,2.8c-0.6,0.7-2,2.5-2.3,2.7
c-0.2,0.3-0.7,0.8-1.1,0.8c-0.4,0-0.7-0.8-0.4-1.9c0.3-1.1,1.4-2.9,1.8-3.5C8.5,8,9.1,7.2,9.1,5.9C9.1,3.7,7.4,3,6.6,3
C5.3,3,4.1,4,3.9,4.3C3.5,4.6,3.2,4.9,3,5.2L4.7,6.9z
M13.9,18.6c-0.3,0-0.7-0.3-0.7-0.7c0-0.6,0.7-2.2,2.8-2.8
C15.8,17.8,14.6,18.6,13.9,18.6z" />
</vector>

@ -15,7 +15,42 @@
limitations under the License.
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<style name="SamsungDozeSettings" parent="@android:style/Theme.Material.Settings">
<item name="preferenceTheme">@android:style/Theme.Material.Settings</item>
<style name="Theme.Main" parent="@android:style/Theme.DeviceDefault.Settings">
<item name="dialogPreferenceStyle">@style/Theme.Main.DialogPreferenceStyle</item>
<item name="preferenceCategoryStyle">@style/Theme.Main.PreferenceCategoryStyle</item>
<item name="preferenceFragmentStyle">@style/Theme.Main.PreferenceFragmentStyle</item>
<item name="preferenceStyle">@style/Theme.Main.PreferenceStyle</item>
<item name="preferenceTheme">@style/Theme.Main.PreferenceTheme</item>
<item name="switchPreferenceStyle">@style/Theme.Main.SwitchPreferenceStyle</item>
</style>
<style name="Theme.Main.DialogPreferenceStyle" parent="@style/Theme.Main.PreferenceStyle">
</style>
<style name="Theme.Main.PreferenceCategoryStyle" parent="@*android:style/Preference.DeviceDefault.Category">
<item name="allowDividerAbove">true</item>
<item name="allowDividerBelow">true</item>
<item name="android:layout">@layout/preference_category_material_settings</item>
</style>
<style name="Theme.Main.PreferenceFragmentStyle" parent="@*android:style/PreferenceFragment.Material">
<item name="allowDividerAfterLastItem">false</item>
</style>
<style name="Theme.Main.PreferenceStyle" parent="@*android:style/Preference.DeviceDefault">
<item name="allowDividerAbove">false</item>
<item name="allowDividerBelow">true</item>
<item name="singleLineTitle">false</item>
<item name="android:layout">@layout/preference_material_settings</item>
</style>
<style name="Theme.Main.PreferenceTheme">
</style>
<style name="Theme.Main.SwitchPreferenceStyle" parent="@style/Theme.Main.PreferenceStyle">
<item name="widgetLayout">@*android:layout/preference_widget_switch</item>
</style>
<style name="Theme.Main.SwitchBar" parent="@android:style/ThemeOverlay.Material.ActionBar">
</style>
</resources>

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

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

Loading…
Cancel
Save