diff --git a/app/src/main/java/com/alirezabdn/whygoogle/SecondFragment.kt b/app/src/main/java/com/alirezabdn/whygoogle/SecondFragment.kt index edaaf1b..f47f2ed 100644 --- a/app/src/main/java/com/alirezabdn/whygoogle/SecondFragment.kt +++ b/app/src/main/java/com/alirezabdn/whygoogle/SecondFragment.kt @@ -20,7 +20,7 @@ class SecondFragment : WhyGoogleFragment() { } } - override var preventFromPop: Boolean = true + override var lockedSwipe: Boolean = true override val bindingInflater: (LayoutInflater, ViewGroup?, Boolean) -> MainFragmentBinding get() = MainFragmentBinding::inflate diff --git a/whygoogle/build.gradle b/whygoogle/build.gradle index f6640b0..aa94622 100644 --- a/whygoogle/build.gradle +++ b/whygoogle/build.gradle @@ -11,7 +11,7 @@ android { minSdkVersion 17 targetSdkVersion 30 versionCode 1 - versionName "0.6.6" + versionName "0.6.7" } buildFeatures { viewBinding true diff --git a/whygoogle/src/main/java/ir/ayantech/whygoogle/activity/SwipableWhyGoogleActivity.kt b/whygoogle/src/main/java/ir/ayantech/whygoogle/activity/SwipableWhyGoogleActivity.kt index 3b001cb..2bf5c7d 100644 --- a/whygoogle/src/main/java/ir/ayantech/whygoogle/activity/SwipableWhyGoogleActivity.kt +++ b/whygoogle/src/main/java/ir/ayantech/whygoogle/activity/SwipableWhyGoogleActivity.kt @@ -263,7 +263,6 @@ abstract class SwipableWhyGoogleActivity : AppCompatActivity(), } override fun onTopFragmentChanged(whyGoogleFragment: WhyGoogleFragment<*>) { - fragmentHost.isUserInputEnabled = !whyGoogleFragment.lockedSwipe } override fun getTopFragment(): WhyGoogleFragment<*>? = diff --git a/whygoogle/src/main/java/ir/ayantech/whygoogle/widget/SwipeBackContainer.kt b/whygoogle/src/main/java/ir/ayantech/whygoogle/widget/SwipeBackContainer.kt index 99d3ea6..712e6e0 100644 --- a/whygoogle/src/main/java/ir/ayantech/whygoogle/widget/SwipeBackContainer.kt +++ b/whygoogle/src/main/java/ir/ayantech/whygoogle/widget/SwipeBackContainer.kt @@ -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 @@ -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