This commit is contained in:
X1nto 2020-06-25 19:58:23 +04:00
parent 72d278c57c
commit d930b04f20
2 changed files with 19 additions and 26 deletions

View File

@ -72,23 +72,24 @@ class HomeFragment : Home() {
}
}
view.findViewById<LinearLayout>(R.id.viewpager_container).visibility = View.VISIBLE
view.findViewById<ImageButton>(R.id.changelog_button).setOnClickListener {
cardExpandCollapse()
}
}
}
private fun cardExpandCollapse() {
val viewPagerContainer = view?.findViewById<LinearLayout>(R.id.viewpager_container)
val viewPagerContainer = view?.findViewById<ViewPager2>(R.id.viewpager)
val tabLayoutContainer = view?.findViewById<TabLayout>(R.id.tablayout)
val arrow = view?.findViewById<ImageButton>(R.id.changelog_button)
val arrowAnimation: RotateAnimation
if (isExpanded) {
viewPagerContainer?.visibility = View.GONE
tabLayoutContainer?.visibility = View.GONE
isExpanded = false
arrowAnimation = RotateAnimation(180f, 0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f)
} else {
viewPagerContainer?.visibility = View.VISIBLE
tabLayoutContainer?.visibility = View.VISIBLE
isExpanded = true
arrowAnimation = RotateAnimation(0f, 180f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f)
}

View File

@ -28,34 +28,26 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/arrow_down"
android:backgroundTint="@android:color/transparent"
android:layout_alignParentEnd="true" />
android:layout_alignParentEnd="true"
android:background="@android:color/transparent"/>
</RelativeLayout>
<LinearLayout
android:id="@+id/viewpager_container"
<com.google.android.material.tabs.TabLayout
android:id="@+id/tablayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
android:background="?colorSurfaceVariant"
app:tabIndicatorColor="?colorPrimary"
app:tabSelectedTextColor="?colorPrimary"
app:tabTextColor="?colorPrimary"
app:layout_constraintTop_toBottomOf="parent" />
<com.google.android.material.tabs.TabLayout
android:id="@+id/tablayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?colorSurfaceVariant"
app:tabIndicatorColor="?colorPrimary"
app:tabSelectedTextColor="?colorPrimary"
app:tabTextColor="?colorPrimary"
app:layout_constraintTop_toBottomOf="parent" />
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/viewpager"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1"/>
</LinearLayout>
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
</LinearLayout>