AdvancedDisplay: 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.

 * Add required appcompat and preference support libraries.

 * Integrate into display settings category using IA.

Change-Id: I8438e0ebec27085df2be4668f8f7170d2010fb20
tirimbino
Bruno Martins 7 years ago committed by Lukasz Patron
parent 4eacd85752
commit 6deaa3b648
  1. 7
      AdvancedDisplay/Android.mk
  2. 14
      AdvancedDisplay/AndroidManifest.xml
  3. 2
      AdvancedDisplay/res/values/dimens.xml
  4. 3
      AdvancedDisplay/res/values/strings.xml
  5. 39
      AdvancedDisplay/res/values/styles.xml
  6. 7
      AdvancedDisplay/src/org/lineageos/settings/device/AdvancedDisplayActivity.java
  7. 6
      lineage.dependencies

@ -9,16 +9,19 @@ LOCAL_PACKAGE_NAME := AdvancedDisplay
LOCAL_CERTIFICATE := platform LOCAL_CERTIFICATE := platform
LOCAL_STATIC_JAVA_LIBRARIES := \ LOCAL_STATIC_JAVA_LIBRARIES := \
android-support-v14-preference \ android-support-v4 \
android-support-v7-appcompat \ android-support-v7-appcompat \
android-support-v7-preference \ android-support-v7-preference \
android-support-v7-recyclerview \ android-support-v7-recyclerview \
android-support-v13 \
android-support-v14-preference \
org.lineageos.platform.internal org.lineageos.platform.internal
LOCAL_PROGUARD_FLAG_FILES := proguard.flags LOCAL_PROGUARD_FLAG_FILES := proguard.flags
LOCAL_RESOURCE_DIR := \ LOCAL_RESOURCE_DIR := \
$(LOCAL_PATH)/res \ $(LOCAL_PATH)/res \
$(TOP)/packages/resources/devicesettings/res \
frameworks/support/v14/preference/res \ frameworks/support/v14/preference/res \
frameworks/support/v7/appcompat/res \ frameworks/support/v7/appcompat/res \
frameworks/support/v7/preference/res \ frameworks/support/v7/preference/res \
@ -31,8 +34,6 @@ LOCAL_AAPT_FLAGS := \
--extra-packages android.support.v7.preference \ --extra-packages android.support.v7.preference \
--extra-packages android.support.v7.recyclerview --extra-packages android.support.v7.recyclerview
include frameworks/base/packages/SettingsLib/common.mk
include $(BUILD_PACKAGE) include $(BUILD_PACKAGE)
include $(call all-makefiles-under,$(LOCAL_PATH)) include $(call all-makefiles-under,$(LOCAL_PATH))

@ -6,7 +6,8 @@
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<application <application
android:label="@string/app_name"> android:label="@string/app_name"
android:theme="@style/Theme.Main">
<receiver android:name="org.lineageos.settings.device.BootCompletedReceiver"> <receiver android:name="org.lineageos.settings.device.BootCompletedReceiver">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" /> <action android:name="android.intent.action.BOOT_COMPLETED" />
@ -16,17 +17,16 @@
<activity <activity
android:name=".AdvancedDisplayActivity" android:name=".AdvancedDisplayActivity"
android:label="@string/app_name" android:label="@string/app_name">
android:theme="@style/AdvancedDisplay">
<intent-filter> <intent-filter>
<action android:name="com.android.settings.action.EXTRA_SETTINGS" /> <action android:name="com.android.settings.action.EXTRA_SETTINGS" />
</intent-filter> </intent-filter>
<meta-data
android:name="com.android.settings.icon"
android:resource="@drawable/ic_settings_advanced_display" />
<meta-data <meta-data
android:name="com.android.settings.category" android:name="com.android.settings.category"
android:value="com.android.settings.category.device" /> android:value="com.android.settings.category.ia.display" />
<meta-data
android:name="com.android.settings.summary"
android:value="@string/summary_empty" />
</activity> </activity>
</application> </application>
</manifest> </manifest>

@ -17,4 +17,6 @@
<resources> <resources>
<!-- ActionBar contentInsetStart --> <!-- ActionBar contentInsetStart -->
<dimen name="actionbar_subsettings_contentInsetStart">72dp</dimen> <dimen name="actionbar_subsettings_contentInsetStart">72dp</dimen>
<dimen name="settings_side_margin">0dip</dimen>
</resources> </resources>

@ -26,4 +26,7 @@
<string name="mdnie_scenario_summary_head">Set the mDNIe scenario</string> <string name="mdnie_scenario_summary_head">Set the mDNIe scenario</string>
<string name="mdnie_negative_title_head">Negative mode</string> <string name="mdnie_negative_title_head">Negative mode</string>
<string name="mdnie_negative_summary_head">Enable/disable inverted colors</string> <string name="mdnie_negative_summary_head">Enable/disable inverted colors</string>
<!-- DO NOT TRANSLATE Empty summary for dynamic preferences -->
<string name="summary_empty" translatable="false"></string>
</resources> </resources>

@ -16,7 +16,42 @@
limitations under the License. limitations under the License.
--> -->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<style name="AdvancedDisplay" parent="@android:style/Theme.Material.Settings"> <style name="Theme.Main" parent="@android:style/Theme.DeviceDefault.Settings">
<item name="preferenceTheme">@android:style/Theme.Material.Settings</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="dialogPreferenceStyle">@style/Theme.Main.DialogPreferenceStyle</item>
<item name="switchPreferenceStyle">@style/Theme.Main.SwitchPreferenceStyle</item>
</style>
<style name="Theme.Main.PreferenceCategoryStyle" parent="@*android:style/Preference.DeviceDefault.Category">
<item name="allowDividerAbove">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.DialogPreferenceStyle" parent="@*android:style/Preference.DeviceDefault.DialogPreference">
<item name="allowDividerAbove">false</item>
<item name="allowDividerBelow">true</item>
<item name="singleLineTitle">false</item>
<item name="android:iconSpaceReserved">true</item>
</style>
<style name="Theme.Main.SwitchPreferenceStyle" parent="@style/Theme.Main.PreferenceStyle">
<item name="widgetLayout">@*android:layout/preference_widget_switch</item>
</style> </style>
</resources> </resources>

@ -17,15 +17,14 @@
package org.lineageos.settings.device; package org.lineageos.settings.device;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceActivity;
import com.android.settingslib.drawer.SettingsDrawerActivity; public class AdvancedDisplayActivity extends PreferenceActivity {
public class AdvancedDisplayActivity extends SettingsDrawerActivity {
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
getFragmentManager().beginTransaction().replace(R.id.content_frame, getFragmentManager().beginTransaction().replace(android.R.id.content,
new AdvancedDisplayFragment()).commit(); new AdvancedDisplayFragment()).commit();
} }
} }

@ -0,0 +1,6 @@
[
{
"repository": "android_packages_resources_devicesettings",
"target_path": "packages/resources/devicesettings"
}
]
Loading…
Cancel
Save