Skip to content

Commit

Permalink
Merge pull request #20452 from wordpress-mobile/fix/19573-confetti-an…
Browse files Browse the repository at this point in the history
…imation

Fixes broken milestone notification confetti effect
  • Loading branch information
Antonis Lilis authored Mar 14, 2024
2 parents 71f607b + 5ad2182 commit 5d7af8f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ class NotificationsDetailListFragment : ListFragment(), NotificationFragment {
private var commentListPosition = ListView.INVALID_POSITION
private var onCommentStatusChangeListener: OnCommentStatusChangeListener? = null
private var noteBlockAdapter: NoteBlockAdapter? = null
private var confettiShown = false

@Inject
lateinit var imageManager: ImageManager
Expand Down Expand Up @@ -134,10 +133,8 @@ class NotificationsDetailListFragment : ListFragment(), NotificationFragment {
showErrorToastAndFinish()
}

val confetti: LottieAnimationView = requireActivity().findViewById(R.id.confetti)
if (note?.isViewMilestoneType == true && !confettiShown) {
confetti.playAnimation()
confettiShown = true
if (note?.isViewMilestoneType == true) {
view?.findViewById<LottieAnimationView>(R.id.confetti)?.playAnimation()
}
}

Expand All @@ -162,9 +159,6 @@ class NotificationsDetailListFragment : ListFragment(), NotificationFragment {
showErrorToastAndFinish()
return
}
if (noteId != note.id) {
confettiShown = false
}
notification = note
}

Expand Down
10 changes: 0 additions & 10 deletions WordPress/src/main/res/layout/notifications_detail_activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,6 @@
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:visibility="visible" />

<com.airbnb.lottie.LottieAnimationView
android:id="@+id/confetti"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="top"
android:scaleType="centerCrop"
app:lottie_autoPlay="false"
app:lottie_loop="false"
app:lottie_rawRes="@raw/confetti" />

<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar_main"
android:layout_width="match_parent"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/colorSurface">
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/colorSurface">

<com.airbnb.lottie.LottieAnimationView
android:id="@+id/confetti"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="top"
android:scaleType="centerCrop"
app:lottie_autoPlay="false"
app:lottie_loop="false"
app:lottie_rawRes="@raw/confetti" />

<!-- this container is needed in order to center the content of 'badge' notification types. -->
<LinearLayout
Expand Down

0 comments on commit 5d7af8f

Please sign in to comment.