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

Commit a2bdac8d authored by Yorke Lee's avatar Yorke Lee
Browse files

Fix the lack of gray background behind swiped contacts

Move setting of background resource to PhoneFavoriteRowView, instead
of ContactTileView, for rowed favorites.
Remove unnecessary animations
Remove unneeded setting of transient view states

Bug: 10393120
Change-Id: I8eab1a868beaf1f3235ed39ca0ea4d862ef06a60
parent b968f5ee
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -57,6 +57,8 @@ public class PhoneFavoriteRegularRowView extends PhoneFavoriteTileView {
        rowPaddingBottom = resources.getDimensionPixelSize(
                R.dimen.favorites_row_bottom_padding);

        favoriteContactCard.setBackgroundResource(R.drawable.bottom_border_background);

        favoriteContactCard.setPaddingRelative(rowPaddingStart, rowPaddingTop, rowPaddingEnd,
                rowPaddingBottom);

+7 −17
Original line number Diff line number Diff line
@@ -131,20 +131,10 @@ public abstract class PhoneFavoriteTileView extends ContactTileView {
    public void displayRemovalDialog() {
        mRemovalDialogue.setVisibility(VISIBLE);
        mRemovalDialogue.setAlpha(0f);
        final int animationLength = ANIMATION_LENGTH;
        final AnimatorSet animSet = new AnimatorSet();
        final ObjectAnimator fadeIn = ObjectAnimator.ofFloat(mRemovalDialogue, "alpha",
                1.f).setDuration(animationLength);

        if (mParentRow.getItemViewType() == ViewTypes.FREQUENT) {
            final ObjectAnimator backgroundFadeIn = ObjectAnimator.ofInt(
                    mParentRow.getBackground(), "alpha", 0).setDuration(animationLength);
            animSet.playTogether(fadeIn, backgroundFadeIn);
        } else {
            animSet.playTogether(fadeIn);
        }
                1.f).setDuration(ANIMATION_LENGTH);

        animSet.addListener(new AnimatorListenerAdapter() {
        fadeIn.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationStart(Animator animation) {
                mParentRow.setHasTransientState(true);
@@ -155,8 +145,7 @@ public abstract class PhoneFavoriteTileView extends ContactTileView {
                mParentRow.setHasTransientState(false);
            }
        });

        animSet.start();
        fadeIn.start();
    }

    /**
@@ -172,10 +161,11 @@ public abstract class PhoneFavoriteTileView extends ContactTileView {
                setDuration(ANIMATION_LENGTH);
        final ObjectAnimator moveBack = ObjectAnimator.ofFloat(mFavoriteContactCard, "translationX",
                0.f).setDuration(ANIMATION_LENGTH);
        final ObjectAnimator backgroundFadeOut = ObjectAnimator.ofInt(mParentRow.getBackground(),
                "alpha", 255).setDuration(ANIMATION_LENGTH);

        final AnimatorSet animSet = new AnimatorSet();
        animSet.playTogether(fadeIn, moveBack, backgroundFadeOut);

        animSet.playTogether(fadeIn, moveBack);

        animSet.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationStart(Animator animation) {
+5 −5
Original line number Diff line number Diff line
@@ -688,6 +688,8 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements
                        R.dimen.favorites_row_start_padding);
                mRowPaddingEnd = resources.getDimensionPixelSize(
                        R.dimen.favorites_row_end_padding);

                setBackgroundResource(R.drawable.bottom_border_background);
            } else {
                // For row views, padding is set on the view itself.
                mRowPaddingTop = 0;
@@ -696,8 +698,6 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements
                mRowPaddingEnd = 0;
            }

            setBackgroundResource(R.drawable.bottom_border_background);

            setPaddingRelative(mRowPaddingStart, mRowPaddingTop, mRowPaddingEnd,
                    mRowPaddingBottom);

@@ -743,7 +743,6 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements
                }
            }
            setPressed(false);
            getBackground().setAlpha(255);
        }

        private void addTileFromEntry(ContactEntry entry, int childIndex, boolean isLastRow) {
@@ -960,11 +959,12 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements
        public void onBeginDrag(View v) {
            removePendingContactEntry();
            final int index = indexOfChild(v);
            // Move tile to front so that any overlap will be hidden behind its siblings

            /*
            if (index > 0) {
                detachViewFromParent(index);
                attachViewToParent(v, 0, v.getLayoutParams());
            }
            }*/

            // We do this so the underlying ScrollView knows that it won't get
            // the chance to intercept events anymore
+1 −2
Original line number Diff line number Diff line
@@ -152,13 +152,12 @@ public class SwipeableListView extends ListView implements SwipeHelperCallback {

    @Override
    public void onDragCancelled(View v) {
        v.setHasTransientState(false);
    }

    @Override
    public void onBeginDrag(View v) {
        final View tileRow = (View) v.getParent();
        tileRow.setHasTransientState(true);

        // We do this so the underlying ScrollView knows that it won't get
        // the chance to intercept events anymore
        requestDisallowInterceptTouchEvent(true);