如果我们需要根据设置中的触摸震动开关来开启和取消滑动解锁的震动效果,就需要做以下修改了。
在LockScreen.java类中的LockScreen方法中的
MultiWaveViewMethods multiWaveViewMethods = new MultiWaveViewMethods(multiWaveView);
multiWaveView.setOnTriggerListener(multiWaveViewMethods);
mUnlockWidgetMethods = multiWaveViewMethods;
private final MultiWaveView mMultiWaveView;
private boolean mCameraDisabled;
MultiWaveViewMethods(MultiWaveView multiWaveView) {
mMultiWaveView = multiWaveView;
multiWaveView.setVibrateEnabled(Settings.System.getInt(mContext.getContentResolver(),
Settings.System.HAPTIC_FEEDBACK_ENABLED, 1) != 0);
final boolean cameraDisabled = mLockPatternUtils.getDevicePolicyManager()
.getCameraDisabled(null);
因为滑动解锁主要使用的就是MultiWaveView这个控件,而这个控件是有设置是否振动的属性。
新闻热点
疑难解答
图片精选