Cherish: Monet settings

Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
This commit is contained in:
jhonboy121
2022-09-27 23:49:29 +07:00
committed by Hưng Phan
parent d3bdfeccb1
commit 7d6755e20e
18 changed files with 990 additions and 2 deletions

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="6dp" />
</shape>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="5dp" />
<gradient android:type="linear" />
</shape>

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="#FFFFFF">
<item>
<shape android:shape="oval">
<solid android:color="?android:attr/colorPrimaryDark" />
<size android:width="20dp"
android:height="20dp" />
</shape>
</item>
</ripple>

View File

@@ -0,0 +1,135 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2022 FlamingoOS 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.
-->
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/default_padding"
android:paddingBottom="@dimen/default_padding">
<View
android:id="@+id/color_preview"
android:layout_width="0dp"
android:layout_height="@dimen/color_picker_preview_height"
android:layout_marginStart="@dimen/default_margin"
android:layout_marginEnd="@dimen/default_margin"
android:background="@drawable/color_picker_preview_background"
settings:layout_constraintEnd_toEndOf="parent"
settings:layout_constraintStart_toStartOf="parent"
settings:layout_constraintTop_toTopOf="parent" />
<EditText
android:id="@+id/color_input"
style="@style/ColorPickerEditTextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
settings:layout_constraintStart_toStartOf="@id/color_preview"
settings:layout_constraintTop_toTopOf="@id/color_preview"
settings:layout_constraintEnd_toEndOf="@id/color_preview"
settings:layout_constraintBottom_toBottomOf="@id/color_preview" />
<SeekBar
android:id="@+id/seekBar1"
style="@style/ColorPickerSeekBarStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
settings:layout_constraintBottom_toTopOf="@id/seekBar2"
settings:layout_constraintEnd_toEndOf="parent"
settings:layout_constraintStart_toStartOf="parent"
settings:layout_constraintTop_toBottomOf="@id/color_preview" />
<SeekBar
android:id="@+id/seekBar2"
style="@style/ColorPickerSeekBarStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
settings:layout_constraintBottom_toTopOf="@id/seekBar3"
settings:layout_constraintEnd_toEndOf="parent"
settings:layout_constraintStart_toStartOf="parent"
settings:layout_constraintTop_toBottomOf="@id/seekBar1" />
<SeekBar
android:id="@+id/seekBar3"
style="@style/ColorPickerSeekBarStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/default_margin"
settings:layout_constraintBottom_toTopOf="@id/barrier"
settings:layout_constraintEnd_toEndOf="parent"
settings:layout_constraintStart_toStartOf="parent"
settings:layout_constraintTop_toBottomOf="@id/seekBar2" />
<RadioGroup
android:id="@+id/color_model_group"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/default_margin"
android:orientation="horizontal"
settings:layout_constraintBottom_toBottomOf="@id/confirm_button"
settings:layout_constraintStart_toStartOf="parent"
settings:layout_constraintTop_toTopOf="@id/confirm_button">
<RadioButton
android:id="@+id/rgb_button"
style="@style/ColorPickerRadioButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="@string/rgb" />
<RadioButton
android:id="@+id/hsl_button"
style="@style/ColorPickerRadioButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hsl" />
<RadioButton
android:id="@+id/hsv_button"
style="@style/ColorPickerRadioButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hsv" />
</RadioGroup>
<Button
android:id="@+id/cancel_button"
style="@style/ColorPickerButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="12dp"
android:text="@string/cancel"
settings:layout_constraintBottom_toBottomOf="@id/confirm_button"
settings:layout_constraintEnd_toStartOf="@id/confirm_button"
settings:layout_constraintTop_toTopOf="@id/confirm_button" />
<Button
android:id="@+id/confirm_button"
style="@style/ColorPickerButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/default_margin"
android:text="@string/confirm"
settings:layout_constraintBottom_toBottomOf="parent"
settings:layout_constraintEnd_toEndOf="parent" />
<androidx.constraintlayout.widget.Barrier
android:id="@+id/barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
settings:barrierDirection="top"
settings:constraint_referenced_ids="color_model_group, confirm_button" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2010 The Android Open Source 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.
-->
<resources>
<style name="ColorPickerStyle" parent="Theme.MaterialComponents.BottomSheetDialog">
<item name="colorPrimary">@*android:color/primary_device_default_settings</item>
<item name="colorPrimaryDark">@*android:color/primary_device_default_settings_light</item>
<item name="colorAccent">@*android:color/accent_device_default_dark</item>
<item name="android:fontFamily">@*android:string/config_headlineFontFamilyMedium</item>
<item name="android:textColorPrimary">#FFFFFF</item>
</style>
</resources>

View File

@@ -22,6 +22,8 @@
<dimen name="alert_dialog_padding_material">20dp</dimen>
<dimen name="color_preference_width">18dip</dimen>
<dimen name="color_preference_height">18dip</dimen>
<dimen name="color_picker_preview_height">80dp</dimen>
<!-- Shortcut picker -->
<dimen name="shortcut_picker_left_padding">70dip</dimen>

View File

@@ -97,6 +97,12 @@
<!-- Power menu Animations -->
<string name="power_menu_animation">Power menu</string>
<!-- Color picker -->
<string name="rgb">RGB</string>
<string name="hsl">HSL</string>
<string name="hsv">HSV</string>
<string name="invalid_color">Invalid color!</string>
<!-- QS header image -->
<!-- Lockscreen -->
@@ -715,5 +721,20 @@
<string name="app_lock_biometrics_allowed_title">Enable biometrics for unlocking</string>
<string name="app_lock_footer_text">Bubbles will be automatically dismissed after timeout</string>
<string name="enable_protection">Enable protection</string>
<!-- Monet engine -->
<string name="monet_engine_settings_title">Monet engine</string>
<string name="monet_engine_settings_summary">Custom color, colorfulness, brightness</string>
<string name="accurate_shades_title">Use accurate shades</string>
<string name="color_override_title">Custom color picker</string>
<string name="color_override_default_summary">Using wallpaper color</string>
<string name="custom_color_override_summary_placeholder">
Choosen color: <xliff:g example="#FF0000" id="Color">%1$s</xliff:g>. Set an empty value to use wallpaper color.
</string>
<string name="invalid_color_input">Invalid color input!</string>
<string name="chroma_factor_title">Colorfulness</string>
<string name="linear_lightness_title">Use custom lightness scale</string>
<string name="white_luminance_title">Brightness</string>
<string name="confirm">Confirm</string>
</resources>

View File

@@ -23,4 +23,46 @@
<dimen name="fod_picker_item_padding">20dp</dimen>
<color name="option_border_default">#5f6368</color>
<style name="ColorPickerStyle" parent="Theme.MaterialComponents.BottomSheetDialog">
<item name="colorPrimary">@*android:color/primary_device_default_settings_light</item>
<item name="colorPrimaryDark">@*android:color/primary_device_default_settings</item>
<item name="colorAccent">@*android:color/accent_device_default_light</item>
<item name="android:fontFamily">@*android:string/config_headlineFontFamilyMedium</item>
<item name="android:textColorPrimary">#000000</item>
</style>
<style name="ColorPickerSeekBarStyle" parent="Widget.AppCompat.SeekBar">
<item name="android:layout_marginTop">30dp</item>
<item name="android:paddingStart">16dp</item>
<item name="android:paddingEnd">18dp</item>
<item name="android:maxHeight">8dp</item>
<item name="android:progressDrawable">@drawable/color_picker_seekbar_background</item>
<item name="android:thumb">@drawable/color_picker_seekbar_thumb</item>
<item name="android:splitTrack">false</item>
</style>
<style name="ColorPickerRadioButtonStyle">
<item name="android:paddingTop">12dp</item>
<item name="android:paddingBottom">12dp</item>
<item name="android:buttonTint">?android:attr/colorAccent</item>
<item name="android:textColor">?android:attr/textColorPrimary</item>
</style>
<style name="ColorPickerButtonStyle">
<item name="android:background">@android:color/transparent</item>
<item name="android:minWidth">0dp</item>
<item name="android:minHeight">0dp</item>
<item name="android:padding">8dp</item>
<item name="android:textColor">?android:attr/colorAccent</item>
</style>
<style name="ColorPickerEditTextStyle">
<item name="android:gravity">center</item>
<item name="android:inputType">textCapCharacters|textNoSuggestions</item>
<item name="android:importantForAutofill">no</item>
<item name="android:textCursorDrawable">@null</item>
<item name="android:imeOptions">actionDone</item>
<item name="android:singleLine">true</item>
</style>
</resources>

View File

@@ -65,6 +65,13 @@
android:summary="@string/dark_ui_mode_summary"
android:fragment="com.android.settings.display.darkmode.DarkModeSettingsFragment"
settings:controller="com.android.settings.display.DarkUIPreferenceController" />
<!-- Monet -->
<Preference
android:key="monet_engine_settings"
android:title="@string/monet_engine_settings_title"
android:summary="@string/monet_engine_settings_summary"
android:fragment="com.cherish.settings.fragments.MonetEngineSettings" />
<!-- Font style -->
<Preference

View File

@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2022 FlamingoOS 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.
-->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res-auto"
android:title="@string/monet_engine_settings_title">
<!-- Accurate shades -->
<com.cherish.settings.preferences.SecureSettingSwitchPreference
android:key="monet_engine_accurate_shades"
android:title="@string/accurate_shades_title"
android:defaultValue="true" />
<!-- Color override -->
<com.cherish.settings.preferences.SecureSettingColorPickerPreference
android:key="monet_engine_color_override"
android:title="@string/color_override_title"
settings:controller="com.cherish.settings.fragments.MonetCustomColorPreferenceController" />
<!-- Chroma factor -->
<com.cherish.settings.preferences.CustomSeekBarPreference
android:key="chroma_factor"
android:title="@string/chroma_factor_title"
android:defaultValue="100"
android:max="100"
android:persistent="false"
android:min="0"
settings:interval="10"
settings:controller="com.cherish.settings.fragments.MonetChromaFactorPreferenceController" />
<!-- Custom lightness scale -->
<com.cherish.settings.preferences.SecureSettingSwitchPreference
android:key="monet_engine_linear_lightness"
android:title="@string/linear_lightness_title"
android:defaultValue="0" />
<!-- Brightness -->
<com.cherish.settings.preferences.SecureSettingSeekBarPreference
android:key="monet_engine_white_luminance"
android:title="@string/white_luminance_title"
android:defaultValue="425"
android:max="1000"
settings:min="1"
settings:interval="100" />
</PreferenceScreen>