Cherish: Ambient Edge Pulse layout [2/2]

Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
This commit is contained in:
AnkitGourav
2021-03-21 21:50:32 -04:00
committed by Hưng Phan
parent c746eec262
commit b47fa93b0e
4 changed files with 26 additions and 0 deletions

View File

@@ -1404,4 +1404,16 @@
<item>2</item>
<item>3</item>
</string-array>
<!-- Edge light layout -->
<string-array name="pulse_ambient_light_layout_entries">
<item>@string/pulse_ambient_light_layout_solid</item>
<item>@string/pulse_ambient_light_layout_faded</item>
</string-array>
<string-array name="pulse_ambient_light_layout_values" translatable="false">
<item>0</item>
<item>1</item>
</string-array>
</resources>

View File

@@ -910,6 +910,9 @@
<string name="pulse_ambient_light_duration_summary">Sets the ambient light animation duration</string>
<string name="pulse_ambient_light_repeat_count_title">Edge Light Repeat count</string>
<string name="pulse_ambient_light_repeat_count_summary">Set max repeat count. 0 for infinite</string>
<string name="pulse_ambient_light_layout_title">Edge Light View</string>
<string name="pulse_ambient_light_layout_solid">Solid</string>
<string name="pulse_ambient_light_layout_faded">Faded</string>
<!-- Power menu on lockscreen -->
<string name="lockscreen_power_menu_disabled_title">Disable power menu on lock screen</string>

View File

@@ -162,6 +162,13 @@
android:defaultValue="false"
android:dependency="ambient_notification_light_enabled"/>
<com.cherish.settings.preferences.SystemSettingListPreference
android:key="pulse_ambient_light_layout"
android:title="@string/pulse_ambient_light_layout_title"
android:entries="@array/pulse_ambient_light_layout_entries"
android:entryValues="@array/pulse_ambient_light_layout_values"
android:defaultValue="0" />
<com.cherish.settings.preferences.SystemSettingListPreference
android:key="ambient_notification_light_timeout"
android:dialogTitle="@string/ambient_notification_light_timeout_title"

View File

@@ -18,6 +18,7 @@ import com.cherish.settings.preferences.SystemSettingMasterSwitchPreference;
import com.cherish.settings.preferences.SystemSettingSeekBarPreference;
import com.cherish.settings.preferences.CustomSeekBarPreference;
import com.cherish.settings.preferences.SystemSettingListPreference;
import com.cherish.settings.preferences.SystemSettingListPreference;
import com.cherish.settings.preferences.SystemSettingSwitchPreference;
import net.margaritov.preference.colorpicker.ColorPickerPreference;
import com.android.internal.util.cherish.CherishUtils;
@@ -35,6 +36,7 @@ public class NotificationSettings extends SettingsPreferenceFragment implements
private SystemSettingSeekBarPreference mEdgeLightDurationPreference;
private SystemSettingSeekBarPreference mEdgeLightRepeatCountPreference;
private ListPreference mColorMode;
private SystemSettingListPreference mAmbientLightLayout;
@Override
public void onCreate(Bundle icicle) {
@@ -69,6 +71,7 @@ public class NotificationSettings extends SettingsPreferenceFragment implements
mEdgeLightDurationPreference.setValue(duration);
mColorMode = (ListPreference) findPreference(PULSE_COLOR_MODE_PREF);
mAmbientLightLayout = (SystemSettingListPreference) findPreference("pulse_ambient_light_layout");
int value;
boolean colorModeAutomatic = Settings.System.getInt(getContentResolver(),
Settings.System.NOTIFICATION_PULSE_COLOR_AUTOMATIC, 0) != 0;
@@ -91,6 +94,7 @@ public class NotificationSettings extends SettingsPreferenceFragment implements
Settings.System.NOTIFICATION_PULSE_COLOR, 0xFF3980FF);
mEdgeLightColorPreference.setNewPreviewColor(edgeLightColor);
mEdgeLightColorPreference.setAlphaSliderEnabled(false);
mAmbientLightLayout.setEnabled(true);
String edgeLightColorHex = String.format("#%08x", (0xFF3980FF & edgeLightColor));
if (edgeLightColorHex.equals("#ff3980ff")) {
mEdgeLightColorPreference.setSummary(R.string.color_default);