0
0
Fork 0
mirror of https://github.com/YTVanced/VancedManager synced 2024-11-16 16:25:11 +00:00
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 { view.findViewById<ImageButton>(R.id.changelog_button).setOnClickListener {
cardExpandCollapse() cardExpandCollapse()
}
} }
}
private fun 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 arrow = view?.findViewById<ImageButton>(R.id.changelog_button)
val arrowAnimation: RotateAnimation val arrowAnimation: RotateAnimation
if (isExpanded) { if (isExpanded) {
viewPagerContainer?.visibility = View.GONE viewPagerContainer?.visibility = View.GONE
tabLayoutContainer?.visibility = View.GONE
isExpanded = false isExpanded = false
arrowAnimation = RotateAnimation(180f, 0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f) arrowAnimation = RotateAnimation(180f, 0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f)
} else { } else {
viewPagerContainer?.visibility = View.VISIBLE viewPagerContainer?.visibility = View.VISIBLE
tabLayoutContainer?.visibility = View.VISIBLE
isExpanded = true isExpanded = true
arrowAnimation = RotateAnimation(0f, 180f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f) 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_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:src="@drawable/arrow_down" android:src="@drawable/arrow_down"
android:backgroundTint="@android:color/transparent" android:layout_alignParentEnd="true"
android:layout_alignParentEnd="true" /> android:background="@android:color/transparent"/>
</RelativeLayout> </RelativeLayout>
<LinearLayout <com.google.android.material.tabs.TabLayout
android:id="@+id/viewpager_container" android:id="@+id/tablayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" 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 <androidx.viewpager2.widget.ViewPager2
android:id="@+id/tablayout" android:id="@+id/viewpager"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="0dp"
android:background="?colorSurfaceVariant" android:layout_weight="1"/>
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>
</LinearLayout> </LinearLayout>