Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cce954f3 authored by Kevin's avatar Kevin
Browse files

Fix views not being visible on Recents Go.

If we bind the loading task views but then on the tasks being loaded
realize there are no items, it's possible to animate from the empty
content view to the regular content view and then back. Currently, this
leads to updateContentView not being called properly the second time
since both views are still visible during the animation, so this CL
fixes that and cancels any on-going crossfade animations.

Bug: 114136250
Fixes: 130580680
Test: Remove last item from recents, go to recents again, empty view
shown
Change-Id: If1a4caab15f9b6d7ccd3abbc06f5866e06650db8
parent a4397929
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -99,6 +99,7 @@ public final class IconRecentsView extends FrameLayout {

    private RecentsToActivityHelper mActivityHelper;
    private RecyclerView mTaskRecyclerView;
    private View mShowingContentView;
    private View mEmptyView;
    private View mContentView;
    private View mClearAllView;
@@ -335,11 +336,13 @@ public final class IconRecentsView extends FrameLayout {
     */
    private void updateContentViewVisibility() {
        int taskListSize = mTaskAdapter.getItemCount();
        if (mEmptyView.getVisibility() != VISIBLE && taskListSize == 0) {
        if (mShowingContentView != mEmptyView && taskListSize == 0) {
            mShowingContentView = mEmptyView;
            crossfadeViews(mEmptyView, mContentView);
            mActivityHelper.leaveRecents();
        }
        if (mContentView.getVisibility() != VISIBLE && taskListSize > 0) {
        if (mShowingContentView != mContentView && taskListSize > 0) {
            mShowingContentView = mContentView;
            crossfadeViews(mContentView, mEmptyView);
        }
    }
@@ -351,6 +354,7 @@ public final class IconRecentsView extends FrameLayout {
     * @param fadeOutView view that should fade out
     */
    private void crossfadeViews(View fadeInView, View fadeOutView) {
        fadeInView.animate().cancel();
        fadeInView.setVisibility(VISIBLE);
        fadeInView.setAlpha(0f);
        fadeInView.animate()
@@ -358,6 +362,7 @@ public final class IconRecentsView extends FrameLayout {
                .setDuration(CROSSFADE_DURATION)
                .setListener(null);

        fadeOutView.animate().cancel();
        fadeOutView.animate()
                .alpha(0f)
                .setDuration(CROSSFADE_DURATION)