Enable and cancel the android sliding unlock vibration effect

Source: Internet
Author: User

If you need to enable or cancel the shake Effect of sliding and unlocking Based on the touch vibration switch in the settings, you need to make the following changes.

In the LockScreen method of the LockScreen. java class

Copy codeThe Code is as follows: else if (mUnlockWidget instanceof MultiWaveView ){
MultiWaveView multiWaveView = (MultiWaveView) mUnlockWidget;

MultiWaveView. setVibrateEnabled (Settings. System. getInt (mContext. getContentResolver (), // sets the unlock vibration by checking whether the touch vibration effect is set.
Settings. System. HAPTIC_FEEDBACK_ENABLED, 1 )! = 0 );

MultiWaveViewMethods multiWaveViewMethods = new MultiWaveViewMethods (multiWaveView );
MultiWaveView. setOnTriggerListener (multiWaveViewMethods );
MUnlockWidgetMethods = multiWaveViewMethods;

Also addCopy codeThe Code is as follows: 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 );

Because the MultiWaveView control is mainly used for sliding and unlocking, which has the attribute of setting whether to vibrate.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.