fix: Reduce padding DPI for swipe zones

This commit is contained in:
EXAM454 2022-07-06 23:53:07 +05:30 committed by GitHub
parent eb41894d0a
commit b944f6bd59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -38,7 +38,7 @@ fun MotionEvent.getSwipeControlZone(context: Context): SwipeControlZone {
// check in what detection zone the event is in // check in what detection zone the event is in
val _40dp = 40.applyDimension(context, TypedValue.COMPLEX_UNIT_DIP).toFloat() val _40dp = 40.applyDimension(context, TypedValue.COMPLEX_UNIT_DIP).toFloat()
val _80dp = 80.applyDimension(context, TypedValue.COMPLEX_UNIT_DIP).toFloat() val _80dp = 80.applyDimension(context, TypedValue.COMPLEX_UNIT_DIP).toFloat()
val _220dp = 220.applyDimension(context, TypedValue.COMPLEX_UNIT_DIP).toFloat() val _200dp = 200.applyDimension(context, TypedValue.COMPLEX_UNIT_DIP).toFloat()
// Y- Axis: // Y- Axis:
// -------- 0 // -------- 0
@ -60,13 +60,13 @@ fun MotionEvent.getSwipeControlZone(context: Context): SwipeControlZone {
// X- Axis: // X- Axis:
// 0 xBrigStart xBrigEnd xVolStart xVolEnd screenWidth // 0 xBrigStart xBrigEnd xVolStart xVolEnd screenWidth
// | | | | | | // | | | | | |
// | 40dp | 220dp | | 220dp | 40dp | // | 40dp | 200dp | | 200dp | 40dp |
// | <------> | <------> | <------> | <------> | <------> | // | <------> | <------> | <------> | <------> | <------> |
// | dead | brightness | dead | volume | dead | // | dead | brightness | dead | volume | dead |
val xBrightStart = _40dp val xBrightStart = _40dp
val xBrightEnd = xBrightStart + _220dp val xBrightEnd = xBrightStart + _200dp
val xVolEnd = screenWidth - _40dp val xVolEnd = screenWidth - _40dp
val xVolStart = xVolEnd - _220dp val xVolStart = xVolEnd - _200dp
// test detection zone // test detection zone
if (y in yDeadTop..yDeadBtm) { if (y in yDeadTop..yDeadBtm) {