add ViewConfiguration::getScaledAmbiguousGestureMultiplier

This commit is contained in:
侯歌 2024-07-24 18:21:05 +08:00
parent 3d8e60f58f
commit b5bff34d9e
2 changed files with 11 additions and 2 deletions

View File

@ -21,6 +21,7 @@ ViewConfiguration::ViewConfiguration(){
mPagingTouchSlop = PAGING_TOUCH_SLOP;
mDoubleTapSlop = DOUBLE_TAP_SLOP;
mWindowTouchSlop = WINDOW_TOUCH_SLOP;
mAmbiguousGestureMultiplier = AMBIGUOUS_GESTURE_MULTIPLIER;
//noinspection deprecation
mMaximumDrawingCacheSize = MAXIMUM_DRAWING_CACHE_SIZE;
mOverscrollDistance = OVERSCROLL_DISTANCE;
@ -48,6 +49,7 @@ ViewConfiguration::ViewConfiguration(Context* context):ViewConfiguration(){
mMaximumDrawingCacheSize = 4 * metrics.widthPixels * metrics.heightPixels;
mOverscrollDistance = (int) (sizeAndDensity * OVERSCROLL_DISTANCE + 0.5f);
mOverflingDistance = (int) (sizeAndDensity * OVERFLING_DISTANCE + 0.5f);
mAmbiguousGestureMultiplier = atts.getFloat("config_ambiguousGestureMultiplier",AMBIGUOUS_GESTURE_MULTIPLIER);
if(atts.size()){
mIsScreenRound = atts.getBoolean("config_isScreenRound",false);
@ -304,6 +306,9 @@ long ViewConfiguration::getAccessibilityShortcutKeyTimeoutAfterConfirmation() {
return A11Y_SHORTCUT_KEY_TIMEOUT_AFTER_CONFIRMATION;
}
float ViewConfiguration::getScaledAmbiguousGestureMultiplier() const{
return mAmbiguousGestureMultiplier;
}
/**
* Report if the device has a permanent menu key available to the user.
*

View File

@ -184,6 +184,7 @@ private:
int mOverflingDistance;
bool mFadingMarqueeEnabled;
long mGlobalActionsKeyTimeout;
float mAmbiguousGestureMultiplier;
float mVerticalScrollFactor;
float mHorizontalScrollFactor;
bool mShowMenuShortcutsWhenKeyboardPresent;
@ -316,6 +317,7 @@ public:
*/
int getScaledPagingTouchSlop();
static constexpr int getDoubleTapSlop(){return DOUBLE_TAP_SLOP;}
/**
* @return Distance in pixels between the first touch and second touch to still be
* considered a double tap
@ -339,12 +341,13 @@ public:
*/
int getScaledWindowTouchSlop();
static constexpr int getMinimumFlingVelocity() {return MINIMUM_FLING_VELOCITY;}
/**
* @return Minimum velocity to initiate a fling, as measured in pixels per second.
*/
int getScaledMinimumFlingVelocity();
static constexpr int getMaximumFlingVelocity() { return MAXIMUM_FLING_VELOCITY;}
/**
* @return Maximum velocity to initiate a fling, as measured in pixels per second.
*/
@ -436,7 +439,8 @@ public:
*
* @deprecated Use {@link #getScaledAmbiguousGestureMultiplier()}.
*/
static constexpr float getScaledAmbiguousGestureMultiplier() {return AMBIGUOUS_GESTURE_MULTIPLIER;}
static constexpr float getAmbiguousGestureMultiplier() {return AMBIGUOUS_GESTURE_MULTIPLIER;}
float getScaledAmbiguousGestureMultiplier()const;
/**
* @return the default duration in milliseconds for {@link ActionMode#hide(long)}.
*/