Skip to content

Commit

Permalink
fix: disabled backgesture in video seekbar view
Browse files Browse the repository at this point in the history
  • Loading branch information
gowtham.balamurugan committed Sep 5, 2023
1 parent 1e7ed74 commit de8c5f4
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
import com.gowtham.library.utils.TrimVideo;
import com.gowtham.library.utils.TrimVideoOptions;
import com.gowtham.library.utils.TrimmerUtils;
import com.gowtham.library.utils.ViewUtil;

import org.jetbrains.annotations.NotNull;

Expand Down Expand Up @@ -172,6 +173,7 @@ protected void onPostCreate(@Nullable Bundle savedInstanceState) {
ImageView imageSix = findViewById(R.id.image_six);
ImageView imageSeven = findViewById(R.id.image_seven);
ImageView imageEight = findViewById(R.id.image_eight);
ViewUtil.systemGestureExclusionRects(findViewById(R.id.root_view));
imageViews = new ImageView[]{imageOne, imageTwo, imageThree,
imageFour, imageFive, imageSix, imageSeven, imageEight};
seekHandler = new Handler();
Expand Down
32 changes: 32 additions & 0 deletions library/src/main/java/com/gowtham/library/utils/ViewUtil.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.gowtham.library.utils

import android.content.res.Resources
import android.graphics.Rect
import android.os.Build
import android.util.TypedValue
import android.view.View
import androidx.core.view.doOnLayout

object ViewUtil {

val Number.toPx get() = TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_DIP,
this.toFloat(),
Resources.getSystem().displayMetrics).toInt()

@JvmStatic
fun systemGestureExclusionRects(viewRoot: View) {
viewRoot.post {
viewRoot.apply {
doOnLayout {
// updating exclusion rect
val rects = mutableListOf<Rect>()
rects.add(Rect(0,resources.displayMetrics.heightPixels-(120.toPx),width,resources.displayMetrics.heightPixels-(55.toPx)))
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
systemGestureExclusionRects = rects
}
}
}
}
}
}
1 change: 1 addition & 0 deletions library/src/main/res/layout/act_video_trimmer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
style="@style/StyleRoot"
android:background="#303030"
android:id="@+id/root_view"
tools:ignore="ContentDescription">

<LinearLayout style="@style/FView">
Expand Down

0 comments on commit de8c5f4

Please sign in to comment.