diff options
author | Yorke Lee <yorkelee@google.com> | 2013-08-22 09:40:42 -0700 |
---|---|---|
committer | Yorke Lee <yorkelee@google.com> | 2013-09-09 17:50:31 -0700 |
commit | a2bdac8d96eaed2dacea274c55036ca9c1a77b4d (patch) | |
tree | 1f347987aa77143c028807e37c6c4c21d157e69f | |
parent | b968f5ee8081c9e582ea7c196efeaa1d710e392d (diff) |
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
4 files changed, 15 insertions, 24 deletions
diff --git a/src/com/android/dialer/list/PhoneFavoriteRegularRowView.java b/src/com/android/dialer/list/PhoneFavoriteRegularRowView.java index 11dc00a90..374f733ec 100644 --- a/src/com/android/dialer/list/PhoneFavoriteRegularRowView.java +++ b/src/com/android/dialer/list/PhoneFavoriteRegularRowView.java @@ -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); diff --git a/src/com/android/dialer/list/PhoneFavoriteTileView.java b/src/com/android/dialer/list/PhoneFavoriteTileView.java index 8887a2c47..43dbad347 100644 --- a/src/com/android/dialer/list/PhoneFavoriteTileView.java +++ b/src/com/android/dialer/list/PhoneFavoriteTileView.java @@ -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) { diff --git a/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java b/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java index 8eba964b2..91acc6fe0 100644 --- a/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java +++ b/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java @@ -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 diff --git a/src/com/android/dialer/list/SwipeableListView.java b/src/com/android/dialer/list/SwipeableListView.java index 8f50f4cd4..449628da7 100644 --- a/src/com/android/dialer/list/SwipeableListView.java +++ b/src/com/android/dialer/list/SwipeableListView.java @@ -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); |