LiveDisplaySettings: Inject into Settings via IA
* Simply declare the activity-alias in the manifest and make use
of the new information architecture for the Setting app to inject
LiveDisplay settings into Display category.
* Set intent priority to -2, so that the preference is placed
two positions bellow top one (right bellow Adaptive Brightness).
Change-Id: Ia743eb198343f69b22771c78f24b4f32929c9143
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index d23d317..86c3871 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -88,6 +88,23 @@
</intent-filter>
</provider>
+ <!-- LiveDisplay settings (Display category) -->
+ <activity-alias
+ android:name=".livedisplay.LiveDisplaySettings"
+ android:label="@*lineageos.platform:string/live_display_title"
+ android:targetActivity="PartsActivity">
+ <intent-filter android:priority="-2">
+ <action android:name="org.lineageos.lineageparts.action.SETTINGS" />
+ <category android:name="android.intent.category.DEFAULT" />
+ </intent-filter>
+ <meta-data
+ android:name="com.android.settings.category"
+ android:value="com.android.settings.category.ia.display" />
+ <meta-data
+ android:name="com.android.settings.summary"
+ android:resource="@string/live_display_summary" />
+ </activity-alias>
+
<!-- Privacy settings (dashboard) -->
<!--
<activity-alias
diff --git a/res/xml/parts_catalog.xml b/res/xml/parts_catalog.xml
index f6f4e09..6318f03 100644
--- a/res/xml/parts_catalog.xml
+++ b/res/xml/parts_catalog.xml
@@ -46,7 +46,7 @@
<part android:key="livedisplay"
android:title="@*lineageos.platform:string/live_display_title"
android:summary="@string/live_display_summary"
- android:fragment="org.lineageos.lineageparts.livedisplay.LiveDisplay"
+ android:fragment="org.lineageos.lineageparts.livedisplay.LiveDisplaySettings"
lineage:xmlRes="@xml/livedisplay" />
<part android:key="notification_lights"
diff --git a/src/org/lineageos/lineageparts/livedisplay/LiveDisplay.java b/src/org/lineageos/lineageparts/livedisplay/LiveDisplaySettings.java
similarity index 98%
rename from src/org/lineageos/lineageparts/livedisplay/LiveDisplay.java
rename to src/org/lineageos/lineageparts/livedisplay/LiveDisplaySettings.java
index 0dec65f..a28482b 100644
--- a/src/org/lineageos/lineageparts/livedisplay/LiveDisplay.java
+++ b/src/org/lineageos/lineageparts/livedisplay/LiveDisplaySettings.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 The CyanogenMod Project
+ * 2017 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -55,7 +56,7 @@
import static lineageos.hardware.LiveDisplayManager.MODE_OFF;
import static lineageos.hardware.LiveDisplayManager.MODE_OUTDOOR;
-public class LiveDisplay extends SettingsPreferenceFragment implements Searchable,
+public class LiveDisplaySettings extends SettingsPreferenceFragment implements Searchable,
Preference.OnPreferenceChangeListener, SettingsHelper.OnSettingsChangeListener {
private static final String TAG = "LiveDisplay";