Cherish: Allow to flash on call only when entirely silent [3/3] and Add DND & Rate settings to flash on call [3/3]
In addition improve the strings
This commit is contained in:
7
res/drawable/ic_call.xml
Normal file
7
res/drawable/ic_call.xml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:height="24dp"
|
||||||
|
android:width="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path android:fillColor="?android:attr/colorControlNormal" android:pathData="M20,15.5C18.8,15.5 17.5,15.3 16.4,14.9C16.3,14.9 16.2,14.9 16.1,14.9C15.8,14.9 15.6,15 15.4,15.2L13.2,17.4C10.4,15.9 8,13.6 6.6,10.8L8.8,8.6C9.1,8.3 9.2,7.9 9,7.6C8.7,6.5 8.5,5.2 8.5,4C8.5,3.5 8,3 7.5,3H4C3.5,3 3,3.5 3,4C3,13.4 10.6,21 20,21C20.5,21 21,20.5 21,20V16.5C21,16 20.5,15.5 20,15.5M5,5H6.5C6.6,5.9 6.8,6.8 7,7.6L5.8,8.8C5.4,7.6 5.1,6.3 5,5M19,19C17.7,18.9 16.4,18.6 15.2,18.2L16.4,17C17.2,17.2 18.1,17.4 19,17.4V19Z" />
|
||||||
|
</vector>
|
||||||
7
res/drawable/ic_call_dnd.xml
Normal file
7
res/drawable/ic_call_dnd.xml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:height="24dp"
|
||||||
|
android:width="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path android:fillColor="?android:attr/colorControlNormal" android:pathData="M12,9C10.4,9 8.85,9.25 7.4,9.72V12.82C7.4,13.22 7.17,13.56 6.84,13.72C5.86,14.21 4.97,14.84 4.17,15.57C4,15.75 3.75,15.86 3.5,15.86C3.2,15.86 2.95,15.74 2.77,15.56L0.29,13.08C0.11,12.9 0,12.65 0,12.38C0,12.1 0.11,11.85 0.29,11.67C3.34,8.77 7.46,7 12,7C16.54,7 20.66,8.77 23.71,11.67C23.89,11.85 24,12.1 24,12.38C24,12.65 23.89,12.9 23.71,13.08L21.23,15.56C21.05,15.74 20.8,15.86 20.5,15.86C20.25,15.86 20,15.75 19.82,15.57C19.03,14.84 18.14,14.21 17.16,13.72C16.83,13.56 16.6,13.22 16.6,12.82V9.72C15.15,9.25 13.6,9 12,9Z" />
|
||||||
|
</vector>
|
||||||
@@ -657,6 +657,7 @@
|
|||||||
<string-array name="flashlight_on_call_entries">
|
<string-array name="flashlight_on_call_entries">
|
||||||
<item>@string/flashlight_on_call_disabled</item>
|
<item>@string/flashlight_on_call_disabled</item>
|
||||||
<item>@string/flashlight_on_call_ringer</item>
|
<item>@string/flashlight_on_call_ringer</item>
|
||||||
|
<item>@string/flashlight_on_call_no_ringer</item>
|
||||||
<item>@string/flashlight_on_call_silent</item>
|
<item>@string/flashlight_on_call_silent</item>
|
||||||
<item>@string/flashlight_on_call_always</item>
|
<item>@string/flashlight_on_call_always</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
@@ -666,5 +667,6 @@
|
|||||||
<item>1</item>
|
<item>1</item>
|
||||||
<item>2</item>
|
<item>2</item>
|
||||||
<item>3</item>
|
<item>3</item>
|
||||||
|
<item>4</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -736,9 +736,15 @@
|
|||||||
<string name="center_notification_headers_summary">Whether to Center R style notification headers (Requires a SystemUI restart)</string>
|
<string name="center_notification_headers_summary">Whether to Center R style notification headers (Requires a SystemUI restart)</string>
|
||||||
|
|
||||||
<!-- Blink flashlight for incoming calls -->
|
<!-- Blink flashlight for incoming calls -->
|
||||||
<string name="flashlight_on_call_title">Blink Flashlight for call</string>
|
<string name="flashlight_category">Flashlight</string>
|
||||||
|
<string name="flashlight_on_call_title">Blink Flashlight for incoming call</string>
|
||||||
<string name="flashlight_on_call_disabled">Disabled</string>
|
<string name="flashlight_on_call_disabled">Disabled</string>
|
||||||
<string name="flashlight_on_call_ringer">Only in ringer mode</string>
|
<string name="flashlight_on_call_ringer">When ringing</string>
|
||||||
<string name="flashlight_on_call_silent">Only when ringer is silent</string>
|
<string name="flashlight_on_call_no_ringer">When ringer is silent</string>
|
||||||
|
<string name="flashlight_on_call_silent">When entirely silent (no ringer or vibrator)</string>
|
||||||
<string name="flashlight_on_call_always">Always</string>
|
<string name="flashlight_on_call_always">Always</string>
|
||||||
|
<string name="flashlight_on_call_ignore_dnd_title">Ignore DND</string>
|
||||||
|
<string name="flashlight_on_call_ignore_dnd_summary">Whether to flash when in Do Not Disturb mode</string>
|
||||||
|
<string name="flashlight_on_call_rate_title">Rate</string>
|
||||||
|
<string name="flashlight_on_call_rate_summary">Flashlight on call blink rate</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -65,6 +65,9 @@
|
|||||||
android:defaultValue="false" />
|
android:defaultValue="false" />
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
|
<PreferenceCategory
|
||||||
|
android:title="@string/flashlight_category">
|
||||||
|
|
||||||
<com.cherish.settings.preferences.SystemSettingListPreference
|
<com.cherish.settings.preferences.SystemSettingListPreference
|
||||||
android:key="flashlight_on_call"
|
android:key="flashlight_on_call"
|
||||||
android:icon="@drawable/ic_flashlight"
|
android:icon="@drawable/ic_flashlight"
|
||||||
@@ -73,4 +76,22 @@
|
|||||||
android:entryValues="@array/flashlight_on_call_values"
|
android:entryValues="@array/flashlight_on_call_values"
|
||||||
android:defaultValue="0" />
|
android:defaultValue="0" />
|
||||||
|
|
||||||
|
<com.cherish.settings.preferences.SystemSettingSwitchPreference
|
||||||
|
android:key="flashlight_on_call_ignore_dnd"
|
||||||
|
android:icon="@drawable/ic_call_dnd"
|
||||||
|
android:title="@string/flashlight_on_call_ignore_dnd_title"
|
||||||
|
android:summary="@string/flashlight_on_call_ignore_dnd_summary"
|
||||||
|
android:defaultValue="false" />
|
||||||
|
|
||||||
|
<com.cherish.settings.preferences.CustomSeekBarPreference
|
||||||
|
android:key="flashlight_on_call_rate"
|
||||||
|
android:icon="@drawable/ic_call"
|
||||||
|
android:title="@string/flashlight_on_call_rate_title"
|
||||||
|
android:summary="@string/flashlight_on_call_rate_summary"
|
||||||
|
android:max="5"
|
||||||
|
settings:min="1"
|
||||||
|
settings:defaultValue="1"
|
||||||
|
settings:units="Hz" />
|
||||||
|
</PreferenceCategory>
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
|||||||
@@ -14,14 +14,23 @@ import android.provider.Settings;
|
|||||||
|
|
||||||
import com.android.settings.SettingsPreferenceFragment;
|
import com.android.settings.SettingsPreferenceFragment;
|
||||||
import com.cherish.settings.preferences.SystemSettingMasterSwitchPreference;
|
import com.cherish.settings.preferences.SystemSettingMasterSwitchPreference;
|
||||||
|
import com.cherish.settings.preferences.CustomSeekBarPreference;
|
||||||
|
import com.cherish.settings.preferences.SystemSettingListPreference;
|
||||||
|
import com.cherish.settings.preferences.SystemSettingSwitchPreference;
|
||||||
import net.margaritov.preference.colorpicker.ColorPickerPreference;
|
import net.margaritov.preference.colorpicker.ColorPickerPreference;
|
||||||
|
|
||||||
public class NotificationSettings extends SettingsPreferenceFragment implements Preference.OnPreferenceChangeListener{
|
public class NotificationSettings extends SettingsPreferenceFragment implements Preference.OnPreferenceChangeListener{
|
||||||
|
|
||||||
private static final String PULSE_AMBIENT_LIGHT = "pulse_ambient_light";
|
private static final String PULSE_AMBIENT_LIGHT = "pulse_ambient_light";
|
||||||
|
private static final String PREF_FLASH_ON_CALL = "flashlight_on_call";
|
||||||
|
private static final String PREF_FLASH_ON_CALL_DND = "flashlight_on_call_ignore_dnd";
|
||||||
|
private static final String PREF_FLASH_ON_CALL_RATE = "flashlight_on_call_rate";
|
||||||
|
|
||||||
private Preference mChargingLeds;
|
private Preference mChargingLeds;
|
||||||
private SystemSettingMasterSwitchPreference mEdgePulse;
|
private SystemSettingMasterSwitchPreference mEdgePulse;
|
||||||
|
private SystemSettingListPreference mFlashOnCall;
|
||||||
|
private SystemSettingSwitchPreference mFlashOnCallIgnoreDND;
|
||||||
|
private CustomSeekBarPreference mFlashOnCallRate;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle icicle) {
|
public void onCreate(Bundle icicle) {
|
||||||
@@ -43,6 +52,24 @@ public class NotificationSettings extends SettingsPreferenceFragment implements
|
|||||||
PULSE_AMBIENT_LIGHT, 0);
|
PULSE_AMBIENT_LIGHT, 0);
|
||||||
mEdgePulse.setChecked(edgePulse != 0);
|
mEdgePulse.setChecked(edgePulse != 0);
|
||||||
|
|
||||||
|
mFlashOnCallRate = (CustomSeekBarPreference)
|
||||||
|
findPreference(PREF_FLASH_ON_CALL_RATE);
|
||||||
|
int value = Settings.System.getInt(resolver,
|
||||||
|
Settings.System.FLASHLIGHT_ON_CALL_RATE, 1);
|
||||||
|
mFlashOnCallRate.setValue(value);
|
||||||
|
mFlashOnCallRate.setOnPreferenceChangeListener(this);
|
||||||
|
|
||||||
|
mFlashOnCallIgnoreDND = (SystemSettingSwitchPreference)
|
||||||
|
findPreference(PREF_FLASH_ON_CALL_DND);
|
||||||
|
value = Settings.System.getInt(resolver,
|
||||||
|
Settings.System.FLASHLIGHT_ON_CALL, 0);
|
||||||
|
mFlashOnCallIgnoreDND.setVisible(value > 1);
|
||||||
|
mFlashOnCallRate.setVisible(value != 0);
|
||||||
|
|
||||||
|
mFlashOnCall = (SystemSettingListPreference)
|
||||||
|
findPreference(PREF_FLASH_ON_CALL);
|
||||||
|
mFlashOnCall.setOnPreferenceChangeListener(this);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -53,7 +80,19 @@ public class NotificationSettings extends SettingsPreferenceFragment implements
|
|||||||
Settings.System.putInt(getContentResolver(),
|
Settings.System.putInt(getContentResolver(),
|
||||||
PULSE_AMBIENT_LIGHT, value ? 1 : 0);
|
PULSE_AMBIENT_LIGHT, value ? 1 : 0);
|
||||||
return true;
|
return true;
|
||||||
}
|
} else if (preference == mFlashOnCall) {
|
||||||
|
int value = Integer.parseInt((String) newValue);
|
||||||
|
Settings.System.putInt(resolver,
|
||||||
|
Settings.System.FLASHLIGHT_ON_CALL, value);
|
||||||
|
mFlashOnCallIgnoreDND.setVisible(value > 1);
|
||||||
|
mFlashOnCallRate.setVisible(value != 0);
|
||||||
|
return true;
|
||||||
|
} else if (preference == mFlashOnCallRate) {
|
||||||
|
int value = (Integer) newValue;
|
||||||
|
Settings.System.putInt(resolver,
|
||||||
|
Settings.System.FLASHLIGHT_ON_CALL_RATE, value);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user