Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 92750617 authored by Philip Milne's avatar Philip Milne Committed by Android Git Automerger
Browse files

am 5ab6e12b: Merge "Fix 6538388: Home buttons do not respect the no "vibrate...

am 5ab6e12b: Merge "Fix 6538388: Home buttons do not respect the no "vibrate on touch" option." into jb-dev

* commit '5ab6e12b':
  Fix 6538388: Home buttons do not respect the no "vibrate on touch" option.
parents ea2acd48 5ab6e12b
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -61,6 +61,9 @@
    <integer name="config_show_search_delay">200</integer>

    <!-- Vibration duration for MultiWaveView used in SearchPanelView -->
    <integer translatable="false" name="config_vibration_duration">20</integer>
    <integer translatable="false" name="config_vibration_duration">0</integer>

    <!-- Vibration duration for MultiWaveView used in SearchPanelView -->
    <integer translatable="false" name="config_search_panel_view_vibration_duration">20</integer>
</resources>
+18 −4
Original line number Diff line number Diff line
@@ -24,6 +24,9 @@ import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.os.Vibrator;
import android.provider.Settings;
import android.util.AttributeSet;
import android.util.Slog;
import android.view.MotionEvent;
@@ -32,7 +35,6 @@ import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.ViewTreeObserver.OnPreDrawListener;
import android.widget.FrameLayout;

import com.android.internal.widget.multiwaveview.MultiWaveView;
import com.android.internal.widget.multiwaveview.MultiWaveView.OnTriggerListener;
import com.android.systemui.R;
@@ -141,6 +143,7 @@ public class SearchPanelView extends FrameLayout implements
                case com.android.internal.R.drawable.ic_lockscreen_search:
                    mWaitingForLaunch = true;
                    startAssistActivity();
                    vibrate();
                    postDelayed(new Runnable() {
                        public void run() {
                            mWaitingForLaunch = false;
@@ -193,6 +196,16 @@ public class SearchPanelView extends FrameLayout implements
        }
    };

    private void vibrate() {
        Context context = getContext();
        if (Settings.System.getInt(context.getContentResolver(),
                Settings.System.HAPTIC_FEEDBACK_ENABLED, 1) != 0) {
            Resources res = context.getResources();
            Vibrator vibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
            vibrator.vibrate(res.getInteger(R.integer.config_search_panel_view_vibration_duration));
        }
    }

    public void show(final boolean show, boolean animate) {
        if (!show) {
            final LayoutTransition transitioner = animate ? createLayoutTransitioner() : null;
@@ -206,6 +219,7 @@ public class SearchPanelView extends FrameLayout implements
                // right before we are drawn
                mMultiWaveView.suspendAnimations();
                getViewTreeObserver().addOnPreDrawListener(mPreDrawListener);
                vibrate();
            }
            setFocusable(true);
            setFocusableInTouchMode(true);