Merge "Disable pinch gesture when accessibility is enabled." into ub-launcher3-calgary
This commit is contained in:
@@ -84,6 +84,7 @@ import android.view.ViewGroup;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.view.WindowManager;
|
||||
import android.view.accessibility.AccessibilityEvent;
|
||||
import android.view.accessibility.AccessibilityManager;
|
||||
import android.view.animation.OvershootInterpolator;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.Advanceable;
|
||||
@@ -138,7 +139,8 @@ import java.util.Locale;
|
||||
*/
|
||||
public class Launcher extends Activity
|
||||
implements View.OnClickListener, OnLongClickListener, LauncherModel.Callbacks,
|
||||
View.OnTouchListener, PageSwitchListener, LauncherProviderChangeListener {
|
||||
View.OnTouchListener, PageSwitchListener, LauncherProviderChangeListener,
|
||||
AccessibilityManager.AccessibilityStateChangeListener {
|
||||
public static final String TAG = "Launcher";
|
||||
static final boolean LOGD = false;
|
||||
|
||||
@@ -450,6 +452,9 @@ public class Launcher extends Activity
|
||||
mExtractedColors = new ExtractedColors();
|
||||
loadExtractedColorsAndColorItems();
|
||||
|
||||
((AccessibilityManager) getSystemService(ACCESSIBILITY_SERVICE))
|
||||
.addAccessibilityStateChangeListener(this);
|
||||
|
||||
lockAllApps();
|
||||
|
||||
mSavedState = savedInstanceState;
|
||||
@@ -2009,6 +2014,9 @@ public class Launcher extends Activity
|
||||
|
||||
TextKeyListener.getInstance().release();
|
||||
|
||||
((AccessibilityManager) getSystemService(ACCESSIBILITY_SERVICE))
|
||||
.removeAccessibilityStateChangeListener(this);
|
||||
|
||||
unregisterReceiver(mCloseSystemDialogsReceiver);
|
||||
|
||||
LauncherAnimUtils.onDestroyActivity();
|
||||
@@ -2783,6 +2791,11 @@ public class Launcher extends Activity
|
||||
return mHapticFeedbackTouchListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccessibilityStateChanged(boolean enabled) {
|
||||
mDragLayer.onAccessibilityStateChanged(enabled);
|
||||
}
|
||||
|
||||
public void onDragStarted(View view) {
|
||||
if (isOnCustomContent()) {
|
||||
// Custom content screen doesn't participate in drag and drop. If on custom
|
||||
|
||||
@@ -29,6 +29,7 @@ import android.graphics.Rect;
|
||||
import android.graphics.Region;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.DragEvent;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MotionEvent;
|
||||
@@ -43,7 +44,6 @@ import android.widget.TextView;
|
||||
|
||||
import com.android.launcher3.AppWidgetResizeFrame;
|
||||
import com.android.launcher3.CellLayout;
|
||||
import com.android.launcher3.Hotseat;
|
||||
import com.android.launcher3.InsettableFrameLayout;
|
||||
import com.android.launcher3.ItemInfo;
|
||||
import com.android.launcher3.Launcher;
|
||||
@@ -142,9 +142,9 @@ public class DragLayer extends InsettableFrameLayout {
|
||||
mLauncher = launcher;
|
||||
mDragController = controller;
|
||||
|
||||
if (!FeatureFlags.LAUNCHER3_DISABLE_PINCH_TO_OVERVIEW) {
|
||||
mPinchListener = new PinchToOverviewListener(mLauncher);
|
||||
}
|
||||
boolean isAccessibilityEnabled = ((AccessibilityManager) mLauncher.getSystemService(
|
||||
Context.ACCESSIBILITY_SERVICE)).isEnabled();
|
||||
onAccessibilityStateChanged(isAccessibilityEnabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -152,6 +152,11 @@ public class DragLayer extends InsettableFrameLayout {
|
||||
return mDragController.dispatchKeyEvent(event) || super.dispatchKeyEvent(event);
|
||||
}
|
||||
|
||||
public void onAccessibilityStateChanged(boolean isAccessibilityEnabled) {
|
||||
mPinchListener = FeatureFlags.LAUNCHER3_DISABLE_PINCH_TO_OVERVIEW || isAccessibilityEnabled
|
||||
? null : new PinchToOverviewListener(mLauncher);
|
||||
}
|
||||
|
||||
public void showOverlayView(View overlayView) {
|
||||
LayoutParams lp = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
|
||||
mOverlayView = overlayView;
|
||||
|
||||
Reference in New Issue
Block a user