diff --git a/res/values/cherish_arrays.xml b/res/values/cherish_arrays.xml
index 27e31ea..4570e1f 100644
--- a/res/values/cherish_arrays.xml
+++ b/res/values/cherish_arrays.xml
@@ -606,4 +606,114 @@
- 1
- 2
+
+
+
+ - @string/ambient_text_align_start_top
+ - @string/ambient_text_align_start_center
+
+ - @string/ambient_text_align_center
+ - @string/ambient_text_align_end_top
+ - @string/ambient_text_align_end_center
+
+
+
+ - 0
+ - 1
+
+ - 3
+ - 4
+ - 5
+
+
+
+
+ - @string/ambient_notification_light_color_mode_accent
+ - @string/ambient_notification_light_color_mode_wall
+ - @string/ambient_notification_light_color_mode_custom
+
+
+ - 0
+ - 1
+ - 2
+
+
+
+
+ - @string/lock_clock_font_stock
+ - @string/lock_clock_font_italic
+ - @string/lock_clock_font_bold
+ - @string/lock_clock_font_bold_italic
+ - @string/lock_clock_font_light_italic
+ - @string/lock_clock_font_light
+ - @string/lock_clock_font_thin_italic
+ - @string/lock_clock_font_thin
+ - @string/lock_clock_font_condensed_normal
+ - @string/lock_clock_font_condensed_italic
+ - @string/lock_clock_font_condensed_bold
+ - @string/lock_clock_font_condensed_bold_italic
+ - @string/lock_clock_font_condensed_light
+ - @string/lock_clock_font_condensed_light_italic
+ - @string/lock_clock_font_medium_normal
+ - @string/lock_clock_font_medium_italic
+ - @string/lock_clock_font_black
+ - @string/lock_clock_font_black_italic
+ - @string/lock_clock_font_dancingscript
+ - @string/lock_clock_font_dancingscript_bold
+ - @string/lock_clock_font_comingsoon
+ - @string/lock_clock_font_notoserif
+ - @string/lock_clock_font_notoserif_italic
+ - @string/lock_clock_font_notoserif_bold
+ - @string/lock_clock_font_notoserif_bold_italic
+ - @string/lock_clock_font_gobold
+ - @string/lock_clock_font_roadrage
+ - @string/lock_clock_font_snowstorm
+ - @string/lock_clock_font_googlesans
+ - @string/lock_clock_font_neoneon
+ - @string/lock_clock_font_themeable
+ - @string/lock_clock_font_samsung
+ - @string/lock_clock_font_mexcellent
+ - @string/lock_clock_font_burnstown
+ - @string/lock_clock_font_dumbledor
+ - @string/lock_clock_font_phantombold
+
+
+
+ - 0
+ - 1
+ - 2
+ - 3
+ - 4
+ - 5
+ - 6
+ - 7
+ - 8
+ - 9
+ - 10
+ - 11
+ - 12
+ - 13
+ - 14
+ - 15
+ - 16
+ - 17
+ - 18
+ - 19
+ - 20
+ - 21
+ - 22
+ - 23
+ - 24
+ - 25
+ - 26
+ - 27
+ - 28
+ - 29
+ - 30
+ - 31
+ - 32
+ - 33
+ - 34
+ - 35
+
diff --git a/res/values/cherish_strings.xml b/res/values/cherish_strings.xml
index a290c50..0461b59 100644
--- a/res/values/cherish_strings.xml
+++ b/res/values/cherish_strings.xml
@@ -841,4 +841,73 @@
All Four Sides
Only Top-Bottom
Only Left-Right
+
+
+ Text Customization
+ Image Customization
+ Ambient-AOD Customization
+ Customizing the looks of ambient-aod
+ Ambient Text
+ Show Ambient Text in AoD
+ Ambient Text Animation
+ Show a Animation when show AoD
+ Ambient Text Size
+ Ambient Text Font
+ Set Ambient Text
+ Ambient Text Align
+ Right n Top
+ Right n Center
+ Right n Bottom
+ Center
+ Left n Top
+ Left n Center
+ Left n Bottom
+ Ambient Text Type Color
+ Ambient Text Color
+ System accent color
+ Custom color
+ Wallpaper color
+ Ambient Image
+ Select local image
+ Select image from storage
+
+
+ LS Clock font style
+ Select lockscreen clock font
+ Normal (default)
+ Bold
+ Italic
+ Bold Italic
+ Light Italic
+ Thin Italic
+ Light
+ Thin
+ Condensed
+ Condensed Italic
+ Condensed Bold
+ Condensed Bold Italic
+ Condensed Light
+ Condensed Light Italic
+ Medium
+ Medium Italic
+ Black
+ Black Italic
+ DancingScript
+ DancingScript Bold
+ ComingSoon
+ NotoSerif Normal
+ NotoSerif Italic
+ NotoSerif Bold
+ NotoSerif Bold Italic
+ GoBold Light
+ Road Rage
+ Snowstorm
+ Google Sans
+ Neoneon
+ Themeable (or VCR OSD Mono)
+ Shamshung
+ Mexcellent
+ Burnstown
+ Dumbledor
+ PhantomBold
diff --git a/res/xml/cherish_ambient_customization.xml b/res/xml/cherish_ambient_customization.xml
new file mode 100644
index 0000000..073d7dd
--- /dev/null
+++ b/res/xml/cherish_ambient_customization.xml
@@ -0,0 +1,105 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/res/xml/cherish_settings_notifications.xml b/res/xml/cherish_settings_notifications.xml
index 8b3361f..90f2d87 100644
--- a/res/xml/cherish_settings_notifications.xml
+++ b/res/xml/cherish_settings_notifications.xml
@@ -115,6 +115,12 @@
android:entryValues="@array/ambient_notification_light_timeout_values"
android:summary="%s"
android:defaultValue="0" />
+
+
diff --git a/src/com/cherish/settings/fragments/AmbientCustomizations.java b/src/com/cherish/settings/fragments/AmbientCustomizations.java
new file mode 100644
index 0000000..07db2df
--- /dev/null
+++ b/src/com/cherish/settings/fragments/AmbientCustomizations.java
@@ -0,0 +1,225 @@
+/**
+ * Copyright (C) 2014 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.
+ */
+package com.cherish.settings.fragments;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.ContentResolver;
+import android.app.WallpaperManager;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.content.pm.PackageManager.NameNotFoundException;
+import android.content.pm.ResolveInfo;
+import android.content.res.Resources;
+import android.hardware.fingerprint.FingerprintManager;
+import android.net.Uri;
+import android.os.Bundle;
+import androidx.preference.SwitchPreference;
+import androidx.preference.ListPreference;
+import androidx.preference.Preference;
+import androidx.preference.PreferenceCategory;
+import androidx.preference.PreferenceScreen;
+import android.provider.SearchIndexableResource;
+import android.provider.Settings;
+
+import com.android.internal.logging.nano.MetricsProto;
+import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
+import com.android.settings.R;
+import com.android.settings.SettingsPreferenceFragment;
+import com.android.settings.search.BaseSearchIndexProvider;
+import com.android.settingslib.search.SearchIndexable;
+import android.provider.SearchIndexableResource;
+
+import com.cherish.settings.preferences.CustomSeekBarPreference;
+import com.cherish.settings.preferences.SystemSettingListPreference;
+import com.cherish.settings.preferences.SystemSettingEditTextPreference;
+import net.margaritov.preference.colorpicker.ColorPickerPreference;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+
+@SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC)
+public class AmbientCustomizations extends SettingsPreferenceFragment implements
+ Preference.OnPreferenceChangeListener {
+
+ private static final String AMBIENT_TEXT_STRING = "ambient_text_string";
+ private static final String AMBIENT_TEXT_ALIGNMENT = "ambient_text_alignment";
+ private static final String AMBIENT_TEXT_FONT = "ambient_text_font";
+ private static final String AMBIENT_TEXT_TYPE_COLOR = "ambient_text_type_color";
+ private static final String AMBIENT_TEXT_COLOR = "ambient_text_color";
+ private static final String FILE_AMBIENT_SELECT = "file_ambient_select";
+
+ private static final int REQUEST_PICK_IMAGE = 0;
+
+ private SystemSettingEditTextPreference mAmbientText;
+ private ListPreference mAmbientTextAlign;
+ private ListPreference mAmbientTextFonts;
+ private ListPreference mAmbientTextTypeColor;
+ private ColorPickerPreference mAmbientTextColor;
+
+ private Preference mAmbientImage;
+
+ @Override
+ public void onCreate(Bundle icicle) {
+ super.onCreate(icicle);
+
+ addPreferencesFromResource(R.xml.cherish_ambient_customization);
+ final PreferenceScreen prefScreen = getPreferenceScreen();
+ ContentResolver resolver = getActivity().getContentResolver();
+ Resources resources = getResources();
+
+ // set ambient text alignment
+ mAmbientTextAlign = (ListPreference) findPreference(AMBIENT_TEXT_ALIGNMENT);
+ int align = Settings.System.getInt(resolver,
+ Settings.System.AMBIENT_TEXT_ALIGNMENT, 3);
+ mAmbientTextAlign.setValue(String.valueOf(align));
+ mAmbientTextAlign.setSummary(mAmbientTextAlign.getEntry());
+ mAmbientTextAlign.setOnPreferenceChangeListener(this);
+
+ // ambient text Fonts
+ mAmbientTextFonts = (ListPreference) findPreference(AMBIENT_TEXT_FONT);
+ mAmbientTextFonts.setValue(String.valueOf(Settings.System.getInt(
+ getContentResolver(), Settings.System.AMBIENT_TEXT_FONT, 8)));
+ mAmbientTextFonts.setSummary(mAmbientTextFonts.getEntry());
+ mAmbientTextFonts.setOnPreferenceChangeListener(this);
+
+ // ambient text color type
+ mAmbientTextTypeColor = (ListPreference) findPreference(AMBIENT_TEXT_TYPE_COLOR);
+ mAmbientTextTypeColor.setValue(String.valueOf(Settings.System.getInt(
+ getContentResolver(), Settings.System.AMBIENT_TEXT_TYPE_COLOR, 0)));
+ mAmbientTextTypeColor.setSummary(mAmbientTextTypeColor.getEntry());
+ mAmbientTextTypeColor.setOnPreferenceChangeListener(this);
+
+ mAmbientTextColor = (ColorPickerPreference) findPreference(AMBIENT_TEXT_COLOR);
+ mAmbientTextColor.setOnPreferenceChangeListener(this);
+ int ambientTextColor = Settings.System.getInt(getContentResolver(),
+ Settings.System.AMBIENT_TEXT_COLOR, 0xFF3980FF);
+ String ambientTextColorHex = String.format("#%08x", (0xFF3980FF & ambientTextColor));
+ if (ambientTextColorHex.equals("#ff3980ff")) {
+ mAmbientTextColor.setSummary(R.string.default_string);
+ } else {
+ mAmbientTextColor.setSummary(ambientTextColorHex);
+ }
+ mAmbientTextColor.setNewPreviewColor(ambientTextColor);
+
+ mAmbientImage = findPreference(FILE_AMBIENT_SELECT);
+
+ }
+
+ @Override
+ public boolean onPreferenceTreeClick(Preference preference) {
+ if (preference == mAmbientImage) {
+ Intent intent = new Intent(Intent.ACTION_PICK);
+ intent.setType("image/*");
+ startActivityForResult(intent, REQUEST_PICK_IMAGE);
+ return true;
+ }
+ return super.onPreferenceTreeClick(preference);
+ }
+
+ @Override
+ public boolean onPreferenceChange(Preference preference, Object newValue) {
+ ContentResolver resolver = getActivity().getContentResolver();
+ if (preference == mAmbientText) {
+ String value = (String) newValue;
+ Settings.System.putString(resolver,
+ Settings.System.AMBIENT_TEXT_STRING, value);
+ return true;
+ } else if (preference == mAmbientTextAlign) {
+ int align = Integer.valueOf((String) newValue);
+ int index = mAmbientTextAlign.findIndexOfValue((String) newValue);
+ Settings.System.putInt(getActivity().getContentResolver(),
+ Settings.System.AMBIENT_TEXT_ALIGNMENT, align);
+ mAmbientTextAlign.setSummary(mAmbientTextAlign.getEntries()[index]);
+ return true;
+ } else if (preference == mAmbientTextFonts) {
+ Settings.System.putInt(getContentResolver(), Settings.System.AMBIENT_TEXT_FONT,
+ Integer.valueOf((String) newValue));
+ mAmbientTextFonts.setValue(String.valueOf(newValue));
+ mAmbientTextFonts.setSummary(mAmbientTextFonts.getEntry());
+ return true;
+ } else if (preference == mAmbientTextTypeColor) {
+ int value = Integer.valueOf((String) newValue);
+ int vIndex = mAmbientTextTypeColor.findIndexOfValue((String) newValue);
+ mAmbientTextTypeColor.setSummary(mAmbientTextTypeColor.getEntries()[vIndex]);
+ Settings.System.putInt(getActivity().getContentResolver(),
+ Settings.System.AMBIENT_TEXT_TYPE_COLOR, value);
+ if (value == 2) {
+ mAmbientTextColor.setEnabled(true);
+ } else {
+ mAmbientTextColor.setEnabled(false);
+ }
+ return true;
+ } else if (preference == mAmbientTextColor) {
+ String hex = ColorPickerPreference.convertToARGB(
+ Integer.valueOf(String.valueOf(newValue)));
+ if (hex.equals("#ff3980ff")) {
+ preference.setSummary(R.string.default_string);
+ } else {
+ preference.setSummary(hex);
+ }
+ int intHex = ColorPickerPreference.convertToColorInt(hex);
+ Settings.System.putInt(getContentResolver(),
+ Settings.System.AMBIENT_TEXT_COLOR, intHex);
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public void onActivityResult(int requestCode, int resultCode, Intent result) {
+ if (requestCode == REQUEST_PICK_IMAGE) {
+ if (resultCode != Activity.RESULT_OK) {
+ return;
+ }
+ final Uri imageUri = result.getData();
+ Settings.System.putString(getContentResolver(), Settings.System.AMBIENT_CUSTOM_IMAGE, imageUri.toString());
+ }
+ }
+
+ @Override
+ public int getMetricsCategory() {
+ return MetricsProto.MetricsEvent.CHERISH_SETTINGS;
+ }
+
+ public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
+ new BaseSearchIndexProvider() {
+
+ @Override
+ public List getXmlResourcesToIndex(Context context,
+ boolean enabled) {
+ ArrayList result =
+ new ArrayList();
+ SearchIndexableResource sir = new SearchIndexableResource(context);
+ sir.xmlResId = R.xml.cherish_ambient_customization;
+ result.add(sir);
+ return result;
+ }
+
+ @Override
+ public List getNonIndexableKeys(Context context) {
+ List keys = super.getNonIndexableKeys(context);
+ return keys;
+ }
+ };
+}
+