From b1ba19826edefe134bc4f13f6279784b6fbec615 Mon Sep 17 00:00:00 2001 From: Matthieu <24-artectrex@users.noreply.shinice.net> Date: Sun, 9 May 2021 18:42:28 +0200 Subject: [PATCH 1/2] Update dependencies --- app/build.gradle | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 63c8756f..3b16a442 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -136,11 +136,11 @@ dependencies { implementation 'com.google.android.material:material:1.3.0' //Dagger (dependency injection) - implementation 'com.google.dagger:dagger-android:2.34.1' - implementation 'com.google.dagger:dagger-android-support:2.34.1' + implementation 'com.google.dagger:dagger-android:2.35.1' + implementation 'com.google.dagger:dagger-android-support:2.35.1' // if you use the support libraries - kapt 'com.google.dagger:dagger-android-processor:2.34.1' - kapt 'com.google.dagger:dagger-compiler:2.34.1' + kapt 'com.google.dagger:dagger-android-processor:2.35.1' + kapt 'com.google.dagger:dagger-compiler:2.35.1' implementation 'com.squareup.okhttp3:okhttp:4.9.0' implementation 'com.squareup.retrofit2:retrofit:2.9.0' From b97bfdfe6facf5dd6ce131a2b440e338a68b99ff Mon Sep 17 00:00:00 2001 From: Matthieu <24-artectrex@users.noreply.shinice.net> Date: Sun, 9 May 2021 18:42:50 +0200 Subject: [PATCH 2/2] Add animation on double tap to like --- .../pixeldroid/app/posts/StatusViewHolder.kt | 14 ++++++ app/src/main/res/drawable/heart_anim.xml | 47 +++++++++++++++++++ app/src/main/res/layout/post_fragment.xml | 13 +++++ 3 files changed, 74 insertions(+) create mode 100644 app/src/main/res/drawable/heart_anim.xml diff --git a/app/src/main/java/org/pixeldroid/app/posts/StatusViewHolder.kt b/app/src/main/java/org/pixeldroid/app/posts/StatusViewHolder.kt index ba9151a9..1a2fbbf2 100644 --- a/app/src/main/java/org/pixeldroid/app/posts/StatusViewHolder.kt +++ b/app/src/main/java/org/pixeldroid/app/posts/StatusViewHolder.kt @@ -4,6 +4,7 @@ import android.Manifest import android.app.AlertDialog import android.content.Intent import android.graphics.Typeface +import android.graphics.drawable.AnimatedVectorDrawable import android.graphics.drawable.Drawable import android.text.method.LinkMovementMethod import android.util.Log @@ -14,6 +15,7 @@ import android.widget.* import androidx.core.content.ContextCompat import androidx.lifecycle.LifecycleCoroutineScope import androidx.recyclerview.widget.RecyclerView +import androidx.vectordrawable.graphics.drawable.AnimatedVectorDrawableCompat import com.bumptech.glide.Glide import com.bumptech.glide.RequestBuilder import com.google.android.material.snackbar.Snackbar @@ -472,6 +474,7 @@ class StatusViewHolder(val binding: PostFragmentBinding) : RecyclerView.ViewHold // Button is inactive, like binding.liker.playAnimation() binding.liker.isChecked = true + binding.likeAnimation.animateView() likePostCall(api) } } else { @@ -484,6 +487,17 @@ class StatusViewHolder(val binding: PostFragmentBinding) : RecyclerView.ViewHold } } } + private fun ImageView.animateView() { + visibility = View.VISIBLE + when (val drawable = drawable) { + is AnimatedVectorDrawableCompat -> { + drawable.start() + } + is AnimatedVectorDrawable -> { + drawable.start() + } + } + } private suspend fun likePostCall(api: PixelfedAPI) { //Call the api function diff --git a/app/src/main/res/drawable/heart_anim.xml b/app/src/main/res/drawable/heart_anim.xml new file mode 100644 index 00000000..0ca38bea --- /dev/null +++ b/app/src/main/res/drawable/heart_anim.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/post_fragment.xml b/app/src/main/res/layout/post_fragment.xml index 10e73aae..2bb55c1a 100644 --- a/app/src/main/res/layout/post_fragment.xml +++ b/app/src/main/res/layout/post_fragment.xml @@ -82,6 +82,19 @@ app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent"/> + +