This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.android.animationproject.view | |
import android.animation.AnimatorSet | |
import android.os.Bundle | |
import android.view.View | |
import android.view.ViewTreeObserver.OnGlobalLayoutListener | |
import androidx.appcompat.app.AppCompatActivity | |
import androidx.cardview.widget.CardView | |
import androidx.constraintlayout.widget.ConstraintLayout | |
import androidx.core.content.ContextCompat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private fun collapseAnimation() { | |
val changeColor = AnimatorUtils.changeColor( | |
cardBox::setCardBackgroundColor, | |
ContextCompat.getColor(this, R.color.white), | |
ContextCompat.getColor(this, R.color.red), | |
500) | |
val resize = AnimatorUtils.resize(cardBox, newHeight, oldHeight, 250) | |
val fadeOut = AnimatorUtils.hideWithFadeOut(detail, 200) | |
val fadeIn = AnimatorUtils.showWithFadeIn(intro, 300) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private fun expandAnimation() { | |
val changeColor = AnimatorUtils.changeColor( | |
cardBox::setCardBackgroundColor, | |
ContextCompat.getColor(this, R.color.red), | |
ContextCompat.getColor(this,R.color.white), | |
500) | |
val resize = AnimatorUtils.resize(cardBox, oldHeight, newHeight, 300) | |
val fadeOut = AnimatorUtils.hideWithFadeOut(intro, 200) | |
val fadeIn = AnimatorUtils.showWithFadeIn(detail, 300) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private fun setViewHeight() { | |
intro.viewTreeObserver.addOnGlobalLayoutListener( | |
object : OnGlobalLayoutListener { | |
override fun onGlobalLayout() { | |
oldHeight = intro.getHeight() | |
intro.viewTreeObserver.removeOnGlobalLayoutListener(this) | |
} | |
}) | |
detail.viewTreeObserver.addOnGlobalLayoutListener( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.android.animationproject.utils | |
import android.animation.* | |
import android.view.View | |
import androidx.interpolator.view.animation.FastOutSlowInInterpolator | |
object AnimatorUtils { | |
fun changeColor( | |
backgroundColor: (Int) -> Unit, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content"> | |
<androidx.constraintlayout.widget.ConstraintLayout | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
tools:context=".view.ExpandViewActivity" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<androidx.constraintlayout.widget.ConstraintLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:background="?attr/selectableItemBackground" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content"> | |
<ImageView |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<androidx.constraintlayout.widget.ConstraintLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:background="?attr/selectableItemBackground" | |
tools:background="@color/red"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
searchView.setOnQueryTextListener(object : SearchView.OnQueryTextListener { | |
override fun onQueryTextSubmit(query: String): Boolean { | |
adapter?.filter?.filter(query) | |
return false | |
} | |
override fun onQueryTextChange(query: String): Boolean { | |
adapter?.filter?.filter(query) | |
return false | |
} | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
adapter = GenericAdapter<Movie>(movies) | |
adapter?.listener = this | |
recyclerView.adapter = adapter |
NewerOlder