Cherish: Incall vibration option [3/3]
* this works with google and aosp dialer :) Adapted to PE Change-Id: Ia3a239ef4c3c5e9ad6e1efae5def7e06f333cbfe
This commit is contained in:
4
res/drawable/ic_vibrate.xml
Normal file
4
res/drawable/ic_vibrate.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<vector android:height="24dp" android:viewportHeight="612"
|
||||
android:viewportWidth="612" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="?android:attr/colorControlNormal" android:pathData="M0,382.5h51v-153H0V382.5zM76.5,433.5h51v-255h-51V433.5zM561,229.5v153h51v-153H561zM484.5,433.5h51v-255h-51V433.5zM420.75,76.5h-229.5c-20.4,0 -38.25,17.85 -38.25,38.25v382.5c0,20.4 17.85,38.25 38.25,38.25h229.5c20.4,0 38.25,-17.85 38.25,-38.25v-382.5C459,94.35 441.15,76.5 420.75,76.5zM408,484.5H204v-357h204V484.5z"/>
|
||||
</vector>
|
||||
@@ -54,4 +54,7 @@
|
||||
<string name="qs_bg_use_new_tint">QS tile colors</string>
|
||||
<string name="qs_bg_use_new_tint_summary">Use accent color for qs tile icons and background</string>
|
||||
|
||||
<!-- In-call feedback -->
|
||||
<string name="incall_feeedback_vibrate_title">Vibrate to indicate call status</string>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -18,4 +18,12 @@
|
||||
android:title="@string/misc_title"
|
||||
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
|
||||
|
||||
<!-- In-call feedback -->
|
||||
<com.cherish.settings.preferences.SystemSettingSwitchPreference
|
||||
android:key="incall_feeedback_vibrate"
|
||||
android:icon="@drawable/ic_vibrate"
|
||||
android:title="@string/incall_feeedback_vibrate_title"
|
||||
android:defaultValue="false"
|
||||
settings:controller="com.cherish.settings.fragments.IncallFeedbackPreferenceController" />
|
||||
|
||||
</PreferenceScreen>
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (C) 2019 The PixelExperience 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.content.Context;
|
||||
import android.telephony.TelephonyManager;
|
||||
|
||||
import com.android.settings.core.BasePreferenceController;
|
||||
|
||||
public class IncallFeedbackPreferenceController extends BasePreferenceController {
|
||||
|
||||
public IncallFeedbackPreferenceController(Context context, String key) {
|
||||
super(context, key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAvailabilityStatus() {
|
||||
return isVoiceCapable() ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
|
||||
private boolean isVoiceCapable() {
|
||||
TelephonyManager telephony =
|
||||
(TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
|
||||
return telephony != null && telephony.isVoiceCapable();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user