Merge "Play haptic on ACTION_DOWN for 3-button-nav buttons" into main
This commit is contained in:
commit
2fb39cf4f2
2 files changed
+9
-3
No files matched your search
@@ -58,6 +58,7 @@ import android.animation.ObjectAnimator;
|
||||
import android.annotation.DrawableRes;
|
||||
import android.annotation.IdRes;
|
||||
import android.annotation.LayoutRes;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.pm.ActivityInfo.Config;
|
||||
import android.content.res.ColorStateList;
|
||||
@@ -880,6 +881,7 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
R.layout.taskbar_nav_button);
|
||||
}
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
private ImageView addButton(@DrawableRes int drawableId, @TaskbarButton int buttonType,
|
||||
ViewGroup parent, TaskbarNavButtonController navButtonController, @IdRes int id,
|
||||
@LayoutRes int layoutId) {
|
||||
@@ -899,6 +901,12 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
navButtonController.onButtonClick(buttonType, view));
|
||||
buttonView.setOnLongClickListener(view ->
|
||||
navButtonController.onButtonLongClick(buttonType, view));
|
||||
buttonView.setOnTouchListener((v, event) -> {
|
||||
if (event.getAction() == MotionEvent.ACTION_DOWN) {
|
||||
buttonView.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
return buttonView;
|
||||
}
|
||||
@@ -939,6 +947,7 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
hasSentDownEvent.set(false);
|
||||
mHandler.postDelayed(longPressTimeout, PREDICTIVE_BACK_TIMEOUT_MS);
|
||||
rect.set(0, 0, v.getWidth(), v.getHeight());
|
||||
buttonView.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
|
||||
}
|
||||
boolean isCancelled = motionEventAction == MotionEvent.ACTION_CANCEL
|
||||
|| (!rect.contains(event.getX(), event.getY())
|
||||
@@ -960,7 +969,6 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
navButtonController.sendBackKeyEvent(KeyEvent.ACTION_UP, isCancelled);
|
||||
if (motionEventAction == MotionEvent.ACTION_UP && !isCancelled) {
|
||||
buttonView.performClick();
|
||||
buttonView.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user