Skip to content

Commit

Permalink
alioth: parts: Adapt to S style
Browse files Browse the repository at this point in the history
 * Use Theme.SubSettingsBase for theme
 * Replace PreferenceActivity with CollapsingToolbarBaseActivity
 * Add Titles to prefernce screen
 * Remove onOptionsItemSelected and where neccessary move to activity

Change-Id: Ib5bc3e8ff69e603a063c7d8116ded6a19956ad32
  • Loading branch information
TheScarastic authored and Laulan56 committed Aug 15, 2022
1 parent 95fd842 commit 5e55f0b
Show file tree
Hide file tree
Showing 21 changed files with 73 additions and 377 deletions.
6 changes: 3 additions & 3 deletions parts/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<activity
android:name=".dirac.DiracActivity"
android:label="@string/dirac_title"
android:theme="@style/Theme.Main">
android:theme="@style/Theme.SubSettingsBase">
<intent-filter>
<action android:name="com.android.settings.action.IA_SETTINGS" />
</intent-filter>
Expand Down Expand Up @@ -72,7 +72,7 @@
<activity
android:name=".doze.DozeSettingsActivity"
android:label="@string/ambient_display_title"
android:theme="@style/Theme.Main">
android:theme="@style/Theme.SubSettingsBase">
<intent-filter>
<action android:name="org.lineageos.settings.device.DOZE_SETTINGS" />
<category android:name="android.intent.category.DEFAULT" />
Expand All @@ -82,7 +82,7 @@
<activity
android:name=".display.DcDimmingSettingsActivity"
android:label="@string/dc_dimming_enable_title"
android:theme="@style/Theme.Main">
android:theme="@style/Theme.SubSettingsBase">
<intent-filter>
<action android:name="com.android.settings.action.IA_SETTINGS" />
</intent-filter>
Expand Down
20 changes: 0 additions & 20 deletions parts/res/color/switch_bar_bg.xml

This file was deleted.

20 changes: 0 additions & 20 deletions parts/res/drawable/switchbar_background.xml

This file was deleted.

27 changes: 0 additions & 27 deletions parts/res/layout/dirac.xml

This file was deleted.

28 changes: 0 additions & 28 deletions parts/res/layout/doze.xml

This file was deleted.

49 changes: 0 additions & 49 deletions parts/res/layout/switch_bar.xml

This file was deleted.

21 changes: 0 additions & 21 deletions parts/res/values-night/colors.xml

This file was deleted.

4 changes: 4 additions & 0 deletions parts/res/values-zh/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
limitations under the License.
-->
<resources>
<!-- Ambient settings -->
<string name="ambient_enable">启用环境显示</string>

<!-- Dirac settings -->
<string name="dirac_enable">启用米音</string>
<string name="dirac_title">米音</string>
<string name="dirac_summary">使用米音和 Hi-Fi 来优化音质</string>
<string name="dirac_headset_title">耳机类型</string>
Expand Down
22 changes: 0 additions & 22 deletions parts/res/values/colors.xml

This file was deleted.

4 changes: 4 additions & 0 deletions parts/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
limitations under the License.
-->
<resources>
<!-- Ambient settings -->
<string name="ambient_enable">Enable ambient display</string>

<!-- Dirac settings -->
<string name="dirac_enable">Enable dirac</string>
<string name="dirac_title">Dirac sound enhancer</string>
<string name="dirac_summary">Optimize sound quality with Dirac, Hi-Fi</string>
<string name="dirac_headset_title">Headset type</string>
Expand Down
55 changes: 1 addition & 54 deletions parts/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,58 +16,5 @@
limitations under the License.
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<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" parent="@style/PreferenceThemeOverlay.SettingsBase">
<item name="preferenceCategoryTitleTextAppearance">
@style/Theme.Main.TextAppearance.CategoryTitle
</item>
</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>

<style name="Theme.Main.SwitchBar.Switch">
<item name="android:trackTint">@color/switchbar_switch_track_tint</item>
<item name="android:thumbTint">@color/switchbar_switch_thumb_tint</item>
</style>

<style name="Theme.Main.TextAppearance.CategoryTitle"
parent="@*android:style/TextAppearance.DeviceDefault.Body2">
<item name="android:textAllCaps">true</item>
<item name="android:textSize">11sp</item>
<!-- 0.8 Spacing, 0.8/11 = 0.072727273 -->
<item name="android:letterSpacing">0.072727273</item>
</style>
<style name="TextAppearance.Medium" parent="@android:style/TextAppearance.Material.Medium" />
</resources>
5 changes: 4 additions & 1 deletion parts/res/xml/dcdimming_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/dc_dimming_enable_title">

<SwitchPreference
android:key="dc_dimming_enable"
android:defaultValue="false"
Expand Down
10 changes: 8 additions & 2 deletions parts/res/xml/dirac_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/dirac_title">

<com.android.settingslib.widget.MainSwitchPreference
android:defaultValue="false"
android:key="dirac_enable"
android:title="@string/dirac_enable" />

<ListPreference
android:key="dirac_headset_pref"
Expand All @@ -32,7 +39,6 @@
android:title="@string/dirac_preset_title"
android:summary="%s" />


<PreferenceCategory
android:key="dirac_hifi"
android:title="@string/dirac_hifi_title">
Expand Down
9 changes: 8 additions & 1 deletion parts/res/xml/doze_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,14 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/ambient_display_title">

<com.android.settingslib.widget.MainSwitchPreference
android:defaultValue="false"
android:key="doze_enable"
android:title="@string/ambient_enable" />

<SwitchPreference
android:key="always_on_display"
Expand Down
8 changes: 5 additions & 3 deletions parts/src/org/lineageos/settings/dirac/DiracActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,19 @@
package org.lineageos.settings.dirac;

import android.os.Bundle;
import android.preference.PreferenceActivity;

public class DiracActivity extends PreferenceActivity {
import com.android.settingslib.collapsingtoolbar.CollapsingToolbarBaseActivity;
import com.android.settingslib.collapsingtoolbar.R;

public class DiracActivity extends CollapsingToolbarBaseActivity {

private static final String TAG_DIRAC = "dirac";

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

getFragmentManager().beginTransaction().replace(android.R.id.content,
getFragmentManager().beginTransaction().replace(R.id.content_frame,
new DiracSettingsFragment(), TAG_DIRAC).commit();
}
}
Loading

0 comments on commit 5e55f0b

Please sign in to comment.