summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2013-08-15 08:15:54 -0700
committerYorke Lee <yorkelee@google.com>2013-08-15 08:15:54 -0700
commitba6b3366f21c47454b3ba5189e94bb6bf58fd11d (patch)
treead3c52ecb7e3676a6835d56b04fe6e7deeebc98a
parent1197d3322b7905724b3eefe40ff8374dd5e26939 (diff)
Fix padding for favorites
Bug: 10327648 Change-Id: Ida9a4a0fdbeda147667398ab8ea9771a7f56d2ee
-rw-r--r--src/com/android/dialer/list/PhoneFavoriteRegularRowView.java20
-rw-r--r--src/com/android/dialer/list/PhoneFavoritesTileAdapter.java28
2 files changed, 40 insertions, 8 deletions
diff --git a/src/com/android/dialer/list/PhoneFavoriteRegularRowView.java b/src/com/android/dialer/list/PhoneFavoriteRegularRowView.java
index 6d9fdcbbb..14c1043f4 100644
--- a/src/com/android/dialer/list/PhoneFavoriteRegularRowView.java
+++ b/src/com/android/dialer/list/PhoneFavoriteRegularRowView.java
@@ -16,6 +16,7 @@
package com.android.dialer.list;
import android.content.Context;
+import android.content.res.Resources;
import android.util.AttributeSet;
import android.view.GestureDetector;
@@ -40,6 +41,25 @@ public class PhoneFavoriteRegularRowView extends PhoneFavoriteTileView {
super.onFinishInflate();
mFavoriteContactCard = findViewById(R.id.contact_favorite_card);
+
+ final int rowPaddingStart;
+ final int rowPaddingEnd;
+ final int rowPaddingTop;
+ final int rowPaddingBottom;
+
+ final Resources resources = getResources();
+ rowPaddingStart = resources.getDimensionPixelSize(
+ R.dimen.favorites_row_start_padding);
+ rowPaddingEnd = resources.getDimensionPixelSize(
+ R.dimen.favorites_row_end_padding);
+ rowPaddingTop = resources.getDimensionPixelSize(
+ R.dimen.favorites_row_top_padding);
+ rowPaddingBottom = resources.getDimensionPixelSize(
+ R.dimen.favorites_row_bottom_padding);
+
+ mFavoriteContactCard.setPaddingRelative(rowPaddingStart, rowPaddingTop, rowPaddingEnd,
+ rowPaddingBottom);
+
mRemovalDialogue = findViewById(R.id.favorite_remove_dialogue);
mUndoRemovalButton = findViewById(R.id.favorite_remove_undo_button);
diff --git a/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java b/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java
index 3aa85e884..b4e00fb3b 100644
--- a/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java
+++ b/src/com/android/dialer/list/PhoneFavoritesTileAdapter.java
@@ -652,14 +652,26 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter {
mPosition = position;
final Resources resources = mContext.getResources();
- mRowPaddingStart = resources.getDimensionPixelSize(
- R.dimen.favorites_row_start_padding);
- mRowPaddingEnd = resources.getDimensionPixelSize(
- R.dimen.favorites_row_end_padding);
- mRowPaddingTop = resources.getDimensionPixelSize(
- R.dimen.favorites_row_top_padding);
- mRowPaddingBottom = resources.getDimensionPixelSize(
- R.dimen.favorites_row_bottom_padding);
+
+ if (mItemViewType == ViewTypes.TOP) {
+ // For tiled views, we still want padding to be set on the ContactTileRow.
+ // Otherwise the padding would be set around each of the tiles, which we don't want
+ mRowPaddingTop = resources.getDimensionPixelSize(
+ R.dimen.favorites_row_top_padding);
+ mRowPaddingBottom = resources.getDimensionPixelSize(
+ R.dimen.favorites_row_bottom_padding);
+ mRowPaddingStart = resources.getDimensionPixelSize(
+ R.dimen.favorites_row_start_padding);
+ mRowPaddingEnd = resources.getDimensionPixelSize(
+ R.dimen.favorites_row_end_padding);
+
+ } else {
+ // For row views, padding is set on the view itself.
+ mRowPaddingTop = 0;
+ mRowPaddingBottom = 0;
+ mRowPaddingStart = 0;
+ mRowPaddingEnd = 0;
+ }
setBackgroundResource(R.drawable.bottom_border_background);