Skip to content

Commit

Permalink
0.6.7
Browse files Browse the repository at this point in the history
fixed locked swipe
  • Loading branch information
A.Badakhshan committed Oct 8, 2023
1 parent 076ec3a commit 5fd0df5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class SecondFragment : WhyGoogleFragment<MainFragmentBinding>() {
}
}

override var preventFromPop: Boolean = true
override var lockedSwipe: Boolean = true

override val bindingInflater: (LayoutInflater, ViewGroup?, Boolean) -> MainFragmentBinding
get() = MainFragmentBinding::inflate
Expand Down
2 changes: 1 addition & 1 deletion whygoogle/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ android {
minSdkVersion 17
targetSdkVersion 30
versionCode 1
versionName "0.6.6"
versionName "0.6.7"
}
buildFeatures {
viewBinding true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ abstract class SwipableWhyGoogleActivity<T : ViewBinding> : AppCompatActivity(),
}

override fun onTopFragmentChanged(whyGoogleFragment: WhyGoogleFragment<*>) {
fragmentHost.isUserInputEnabled = !whyGoogleFragment.lockedSwipe
}

override fun getTopFragment(): WhyGoogleFragment<*>? =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import android.util.AttributeSet
import android.view.MotionEvent
import android.view.animation.AccelerateDecelerateInterpolator
import com.alirezabdn.whyfinal.widget.NonFinalViewPager2
import ir.ayantech.whygoogle.activity.SwipableWhyGoogleActivity
import ir.ayantech.whygoogle.helper.FloatCallBack
import ir.ayantech.whygoogle.helper.SimpleCallBack

Expand All @@ -15,6 +16,11 @@ abstract class SwipeBackContainer @JvmOverloads constructor(
) : NonFinalViewPager2(context, attrs) {
abstract fun onPageSettled(callback: SimpleCallBack)

override fun isUserInputEnabled(): Boolean {
if ((this.adapter as? SwipableWhyGoogleActivity.WhyGoogleFragmentAdapter)?.fragmentActivity?.getTopFragment()?.lockedSwipe == true)
return false
return super.isUserInputEnabled()
}
fun listener(
onPageSettled: SimpleCallBack,
onPageScrolled: FloatCallBack
Expand Down

0 comments on commit 5fd0df5

Please sign in to comment.