Skip to content

Commit b3a07c5

Browse files
author
A.Badakhshan
committed
0.4.13
1 parent e8476ee commit b3a07c5

File tree

5 files changed

+13
-9
lines changed

5 files changed

+13
-9
lines changed

app/src/main/java/com/alirezabdn/whygoogle/MainFragment.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import android.util.Log
44
import android.view.LayoutInflater
55
import android.view.ViewGroup
66
import androidx.fragment.app.Fragment
7-
import androidx.viewpager2.adapter.FragmentStateAdapter
7+
import com.alirezabdn.whyfinal.adapter.FragmentStateAdapter
88
import com.alirezabdn.whygoogle.databinding.MainFragmentBinding
99
import ir.ayantech.whygoogle.fragment.WhyGoogleFragment
1010

@@ -15,7 +15,7 @@ class MainFragment : WhyGoogleFragment<MainFragmentBinding>() {
1515
accessViews {
1616
testTv.text = "tested now more than once"
1717
go.setOnClickListener {
18-
start(MainFragment(), popAll = true)
18+
start(MainFragment())
1919
}
2020
go2.setOnClickListener {
2121
start(SecondFragment(), true)
@@ -28,6 +28,9 @@ class MainFragment : WhyGoogleFragment<MainFragmentBinding>() {
2828
}
2929
}
3030

31+
override val defaultBackground: Int
32+
get() = R.color.teal_700
33+
3134
override fun onBackToFragment() {
3235
super.onBackToFragment()
3336
Log.d("WhG", "backtofrag")

app/src/main/res/layout/main_fragment.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
android:text="go2"
2929
app:layout_constraintTop_toBottomOf="@+id/testTv" />
3030

31-
<androidx.viewpager2.widget.ViewPager2
31+
<com.alirezabdn.whyfinal.widget.NonFinalViewPager2
3232
android:id="@+id/myVp2"
3333
android:layout_width="match_parent"
3434
android:layout_height="0dp"

whygoogle/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ android {
1111
minSdkVersion 17
1212
targetSdkVersion 30
1313
versionCode 1
14-
versionName "0.4.12"
14+
versionName "0.4.13"
1515
}
1616
buildFeatures {
1717
viewBinding true
@@ -39,5 +39,5 @@ dependencies {
3939
implementation 'com.google.android.material:material:1.4.0'
4040
implementation "androidx.lifecycle:lifecycle-common-java8:2.3.1"
4141
implementation "androidx.lifecycle:lifecycle-process:2.3.1"
42-
api 'com.github.shadowalker77:nonfinalviewpager2:0.2.1'
42+
api 'com.github.shadowalker77:nonfinalviewpager2:0.2.3'
4343
}

whygoogle/src/main/java/ir/ayantech/whygoogle/activity/SwipableWhyGoogleActivity.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ abstract class SwipableWhyGoogleActivity<T : ViewBinding> : AppCompatActivity(),
3636
private val whyGoogleFragmentAdapter: WhyGoogleFragmentAdapter by lazy {
3737
WhyGoogleFragmentAdapter(this).also {
3838
fragmentHost.offscreenPageLimit = 3
39-
fragmentHost.rotationY = 180f
39+
fragmentHost.rotation = 180f
4040
fragmentHost.changeToNeedsOfWhyGoogle()
4141
fragmentHost.setPageTransformer(IOSPageTransition())
4242
fragmentHost.adapter = it
@@ -89,7 +89,7 @@ abstract class SwipableWhyGoogleActivity<T : ViewBinding> : AppCompatActivity(),
8989
payloads: MutableList<Any>
9090
) {
9191
super.onBindViewHolder(holder, position, payloads)
92-
holder.itemView.rotationY = 180f
92+
holder.itemView.rotation = 180f
9393
}
9494

9595
override fun getItemId(position: Int): Long {
@@ -121,7 +121,7 @@ abstract class SwipableWhyGoogleActivity<T : ViewBinding> : AppCompatActivity(),
121121
stack: Boolean,
122122
onFragmentCreationEndedCallback: SimpleCallBack?
123123
) {
124-
if (getFragmentCount() == 1 && fragment.javaClass == getTopFragment()?.javaClass)
124+
if (getFragmentCount() == 1 && fragment.javaClass == getTopFragment()?.javaClass && popAll)
125125
return
126126
fragment.asyncInflate { fragment ->
127127
fragmentStack.add(fragment)

whygoogle/src/main/java/ir/ayantech/whygoogle/widget/SwipeBackContainer.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import android.view.View
1212
import android.view.ViewGroup
1313
import android.view.animation.AccelerateDecelerateInterpolator
1414
import androidx.annotation.RequiresApi
15+
import androidx.core.view.ViewCompat
1516
import com.alirezabdn.whyfinal.widget.NonFinalViewPager2
1617
import ir.ayantech.whygoogle.activity.SwipableWhyGoogleActivity
1718
import ir.ayantech.whygoogle.helper.SimpleCallBack
@@ -65,7 +66,7 @@ class SwipeBackContainer : NonFinalViewPager2 {
6566
}
6667

6768
private fun canViewScroll(view: View?, orientation: Int, delta: Float): Boolean {
68-
val direction = -delta.sign.toInt()
69+
val direction = delta.sign.toInt()
6970
return when (orientation) {
7071
0 -> view?.canScrollHorizontally(direction) ?: false
7172
1 -> view?.canScrollVertically(direction) ?: false

0 commit comments

Comments
 (0)