Cherish: incall vibration options [3/3]

*allow setting vibration when call is connected
*allow setting vibration when call is disconnected
*allow setting vibration for call waiting
*this works with google and aosp dialer :)

Change-Id: Id1a431124174571f8d0091825af2418971cfe35d
Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
This commit is contained in:
beanstown106
2017-10-14 23:17:23 +05:30
committed by Hưng Phan
parent f76ee81981
commit 693fa1a354
3 changed files with 33 additions and 1 deletions

View File

@@ -179,5 +179,11 @@
<string name="notifications_category_title">Annoying notifications protection</string> <string name="notifications_category_title">Annoying notifications protection</string>
<string name="less_boring_heads_up_title">Make heads up less annoying</string> <string name="less_boring_heads_up_title">Make heads up less annoying</string>
<string name="less_boring_heads_up_summary">Show heads up only for dialer or messaging app if they are not in foreground</string> <string name="less_boring_heads_up_summary">Show heads up only for dialer or messaging app if they are not in foreground</string>
<!-- Incall vibrate options -->
<string name="incall_vibration_category">In-call vibration options</string>
<string name="incall_vibrate_connect_title">Vibrate on connect</string>
<string name="incall_vibrate_call_wait_title">Vibrate on call waiting</string>
<string name="incall_vibrate_disconnect_title">Vibrate on disconnect</string>
</resources> </resources>

View File

@@ -65,4 +65,25 @@
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory
android:key="incall_vib_options"
android:title="@string/incall_vibration_category" >
<com.cherish.settings.preferences.SystemSettingSwitchPreference
android:key="vibrate_on_connect"
android:title="@string/incall_vibrate_connect_title"
android:defaultValue="false" />
<com.cherish.settings.preferences.SystemSettingSwitchPreference
android:key="vibrate_on_callwaiting"
android:title="@string/incall_vibrate_call_wait_title"
android:defaultValue="false" />
<com.cherish.settings.preferences.SystemSettingSwitchPreference
android:key="vibrate_on_disconnect"
android:title="@string/incall_vibrate_disconnect_title"
android:defaultValue="false" />
</PreferenceCategory>
</PreferenceScreen> </PreferenceScreen>

View File

@@ -31,13 +31,13 @@ import com.cherish.settings.preferences.SystemSettingListPreference;
import com.cherish.settings.preferences.SystemSettingSwitchPreference; import com.cherish.settings.preferences.SystemSettingSwitchPreference;
import net.margaritov.preference.colorpicker.ColorPickerPreference; import net.margaritov.preference.colorpicker.ColorPickerPreference;
import com.android.internal.util.cherish.CherishUtils; import com.android.internal.util.cherish.CherishUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC) @SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC)
public class NotificationSettings extends SettingsPreferenceFragment implements Preference.OnPreferenceChangeListener{ public class NotificationSettings extends SettingsPreferenceFragment implements Preference.OnPreferenceChangeListener{
private static final String INCALL_VIB_OPTIONS = "incall_vib_options";
private Preference mChargingLeds; private Preference mChargingLeds;
@Override @Override
public void onCreate(Bundle icicle) { public void onCreate(Bundle icicle) {
@@ -54,6 +54,11 @@ public class NotificationSettings extends SettingsPreferenceFragment implements
com.android.internal.R.bool.config_intrusiveBatteryLed)) { com.android.internal.R.bool.config_intrusiveBatteryLed)) {
prefScreen.removePreference(mChargingLeds); prefScreen.removePreference(mChargingLeds);
} }
PreferenceCategory incallVibCategory = (PreferenceCategory) findPreference(INCALL_VIB_OPTIONS);
if (!CherishUtils.isVoiceCapable(getActivity())) {
prefScreen.removePreference(incallVibCategory);
}
} }