android滑动解锁震动效果的开启和取消
如果我们需要根据设置中的触摸震动开关来开启和取消滑动解锁的震动效果,就需要做以下修改了。
在lockscreen.java类中的lockscreen方法中的
else if (munlockwidget instanceof multiwaveview) {
multiwaveview multiwaveview = (multiwaveview) munlockwidget;
multiwaveview.setvibrateenabled(settings.system.getint(mcontext.getcontentresolver(),//通过判断是否设置了触摸震动效果来设置解锁的震动。
settings.system.haptic_feedback_enabled, 1) != 0);
multiwaveviewmethods multiwaveviewmethods = new multiwaveviewmethods(multiwaveview);
multiwaveview.setontriggerlistener(multiwaveviewmethods);
munlockwidgetmethods = multiwaveviewmethods;
还要在这里加入
class multiwaveviewmethods implements multiwaveview.ontriggerlistener,
unlockwidgetcommonmethods {
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这个控件,而这个控件是有设置是否振动的属性。
上一篇: 蓝光浏览器更新和卸载教程