mirror of
https://github.com/YTVanced/VancedManager
synced 2025-01-07 07:51:00 +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 {
|
appDownload.setOnClickListener {
|
||||||
viewModel.openInstallDialog(dataModel?.buttonTag?.value, apps[position])
|
viewModel.openInstallDialog(dataModel?.buttonTag?.value, apps[position])
|
||||||
}
|
}
|
||||||
appExpandCard.setOnClickListener {
|
appClickableLayout.setOnClickListener {
|
||||||
if (isAnimationRunning) return@setOnClickListener
|
if (isAnimationRunning) return@setOnClickListener
|
||||||
val rootHeight = root.measuredHeight
|
val rootHeight = root.measuredHeight
|
||||||
val expandedViewHeight = appExpandedView.height
|
val expandedViewHeight = appExpandedView.height
|
||||||
val expandedTranslation = appExpandCard.height.toFloat()
|
val expandedTranslation = appClickableLayout.height.toFloat()
|
||||||
|
|
||||||
when (isExpanded.also { isExpanded = !isExpanded }) {
|
when (isExpanded.also { isExpanded = !isExpanded }) {
|
||||||
true -> {
|
true -> {
|
||||||
appExpandedView.toggle(0f, 0.8f, -expandedTranslation)
|
appExpandedView.toggle(0f, 0.8f, -expandedTranslation)
|
||||||
root.toggleCard(rootHeight - expandedViewHeight) { addAnimListener() }
|
root.toggleCard(rootHeight - expandedViewHeight) { addAnimListener() }
|
||||||
appExpandArrow.rotateArrow(90f)
|
appExpandArrow.rotateArrow(90f)
|
||||||
appExpandCard.animateCardRadius(0f, 16f)
|
|
||||||
}
|
}
|
||||||
false -> {
|
false -> {
|
||||||
root.toggleCard(rootHeight + expandedViewHeight) { addAnimListener() }
|
root.toggleCard(rootHeight + expandedViewHeight) { addAnimListener() }
|
||||||
appExpandedView.toggle(1f, 1f, expandedTranslation)
|
appExpandedView.toggle(1f, 1f, expandedTranslation)
|
||||||
appExpandArrow.rotateArrow(-90f)
|
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(
|
private inline fun MaterialCardView.toggleCard(
|
||||||
resultHeight: Int,
|
resultHeight: Int,
|
||||||
onAnimation: Animator.() -> Unit
|
onAnimation: Animator.() -> Unit
|
||||||
|
|
|
@ -112,18 +112,19 @@
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
<com.google.android.material.card.MaterialCardView
|
<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_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:contentPadding="16dp"
|
app:contentPadding="16dp"
|
||||||
app:cardCornerRadius="16dp"
|
app:cardCornerRadius="0dp"
|
||||||
app:cardElevation="0dp"
|
app:cardElevation="0dp"
|
||||||
app:cardBackgroundColor="?colorLinkBG"
|
app:cardBackgroundColor="?colorLinkBG"
|
||||||
app:layout_constraintTop_toTopOf="parent">
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatImageView
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
android:id="@+id/app_icon"
|
android:id="@+id/app_icon"
|
||||||
|
|
Loading…
Reference in a new issue