mirror of
https://github.com/YTVanced/VancedManager
synced 2025-01-03 14:10:59 +00:00
removed unnoticable animation to improve performance
This commit is contained in:
parent
c84e795d75
commit
ff8177e147
2 changed files with 6 additions and 15 deletions
|
@ -55,24 +55,22 @@ class ExpandableAppListAdapter(
|
|||
appDownload.setOnClickListener {
|
||||
viewModel.openInstallDialog(dataModel?.buttonTag?.value, apps[position])
|
||||
}
|
||||
appExpandCard.setOnClickListener {
|
||||
appClickableLayout.setOnClickListener {
|
||||
if (isAnimationRunning) return@setOnClickListener
|
||||
val rootHeight = root.measuredHeight
|
||||
val expandedViewHeight = appExpandedView.height
|
||||
val expandedTranslation = appExpandCard.height.toFloat()
|
||||
val expandedTranslation = appClickableLayout.height.toFloat()
|
||||
|
||||
when (isExpanded.also { isExpanded = !isExpanded }) {
|
||||
true -> {
|
||||
appExpandedView.toggle(0f, 0.8f, -expandedTranslation)
|
||||
root.toggleCard(rootHeight - expandedViewHeight) { addAnimListener() }
|
||||
appExpandArrow.rotateArrow(90f)
|
||||
appExpandCard.animateCardRadius(0f, 16f)
|
||||
}
|
||||
false -> {
|
||||
root.toggleCard(rootHeight + expandedViewHeight) { addAnimListener() }
|
||||
appExpandedView.toggle(1f, 1f, expandedTranslation)
|
||||
appExpandArrow.rotateArrow(-90f)
|
||||
appExpandCard.animateCardRadius(16f, 0f)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -141,14 +139,6 @@ class ExpandableAppListAdapter(
|
|||
}
|
||||
}
|
||||
|
||||
private fun MaterialCardView.animateCardRadius(startPoint: Float, endPoint: Float) {
|
||||
ValueAnimator.ofFloat(startPoint, endPoint).setDuration(animationDuration).apply {
|
||||
addUpdateListener {
|
||||
radius = it.animatedValue as Float
|
||||
}
|
||||
}.start()
|
||||
}
|
||||
|
||||
private inline fun MaterialCardView.toggleCard(
|
||||
resultHeight: Int,
|
||||
onAnimation: Animator.() -> Unit
|
||||
|
|
|
@ -112,18 +112,19 @@
|
|||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/app_expand_card"
|
||||
android:id="@+id/app_clickable_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:contentPadding="16dp"
|
||||
app:cardCornerRadius="16dp"
|
||||
app:cardCornerRadius="0dp"
|
||||
app:cardElevation="0dp"
|
||||
app:cardBackgroundColor="?colorLinkBG"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/app_icon"
|
||||
|
|
Loading…
Reference in a new issue