diff options
author | Tyler Gunn <tgunn@google.com> | 2015-04-21 20:10:55 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-04-21 20:10:58 +0000 |
commit | 46c0882525fa7c17e048d847f297674e863b5b29 (patch) | |
tree | c1a7ad1dd5021fd9f939c8d4f350cb41945065b8 | |
parent | 76154901be6b2bd0545d9d3b869762fd0e6ba116 (diff) | |
parent | 9afa723dcebf18759c63dc1c976b05050e348d2a (diff) |
Merge "CallLogAdapter cleanup and refactoring."
-rw-r--r-- | res/layout/call_log_list_item.xml | 8 | ||||
-rw-r--r-- | res/values/styles.xml | 9 | ||||
-rw-r--r-- | src/com/android/dialer/calllog/CallLogAdapter.java | 18 |
3 files changed, 20 insertions, 15 deletions
diff --git a/res/layout/call_log_list_item.xml b/res/layout/call_log_list_item.xml index 7a826d9f5..a0ed5c799 100644 --- a/res/layout/call_log_list_item.xml +++ b/res/layout/call_log_list_item.xml @@ -38,14 +38,8 @@ <!-- Linear layout to separate the primary area containing the contact badge and caller information and the secondary action (call details / play voicemail). --> <android.support.v7.widget.CardView - xmlns:card_view="http://schemas.android.com/apk/res-auto" android:id="@+id/call_log_row" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_margin="4dp" - android:baselineAligned="false" - card_view:cardCornerRadius="4dp" - card_view:cardBackgroundColor="@color/background_dialer_call_log_list_item"> + style="@style/CallLogCardStyle"> <!-- Primary area containing the contact badge and caller information --> <LinearLayout diff --git a/res/values/styles.xml b/res/values/styles.xml index cfb2480c8..dacf6a47c 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -192,4 +192,13 @@ <style name="AlertDialogTheme" parent="@android:style/Theme.Material.Light.Dialog"> <item name="android:colorAccent">@color/dialtacts_theme_color</item> </style> + + <style name="CallLogCardStyle" parent="CardView"> + <item name="android:layout_width">match_parent</item> + <item name="android:layout_height">wrap_content</item> + <item name="android:layout_margin">4dp</item> + <item name="android:baselineAligned">false</item> + <item name="cardCornerRadius">4dp</item> + <item name="cardBackgroundColor">@color/background_dialer_call_log_list_item</item> + </style> </resources> diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java index cc1a4a632..f2a84c99f 100644 --- a/src/com/android/dialer/calllog/CallLogAdapter.java +++ b/src/com/android/dialer/calllog/CallLogAdapter.java @@ -22,22 +22,17 @@ import android.content.res.Resources; import android.database.Cursor; import android.net.Uri; import android.provider.ContactsContract.CommonDataKinds.Phone; -import android.provider.ContactsContract.PhoneLookup; import android.support.v7.widget.RecyclerView.ViewHolder; import android.telecom.PhoneAccountHandle; import android.telephony.PhoneNumberUtils; import android.text.TextUtils; -import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.View.AccessibilityDelegate; import android.view.ViewGroup; import android.view.ViewTreeObserver; import android.view.accessibility.AccessibilityEvent; -import android.widget.ImageView; -import android.widget.TextView; -import com.android.contacts.common.util.UriUtils; import com.android.dialer.PhoneCallDetails; import com.android.dialer.PhoneCallDetailsHelper; import com.android.dialer.R; @@ -54,7 +49,6 @@ import java.util.HashMap; */ public class CallLogAdapter extends GroupingListAdapter implements ViewTreeObserver.OnPreDrawListener, CallLogGroupBuilder.GroupCreator { - private static final String TAG = CallLogAdapter.class.getSimpleName(); /** Interface used to inform a parent UI element that a list item has been expanded. */ public interface CallItemExpandedListener { @@ -126,8 +120,6 @@ public class CallLogAdapter extends GroupingListAdapter /** Helper to group call log entries. */ private final CallLogGroupBuilder mCallLogGroupBuilder; - private CallItemExpandedListener mCallItemExpandedListener; - /** Listener for the primary or secondary actions in the list. * Primary opens the call details. * Secondary calls or plays. @@ -262,6 +254,16 @@ public class CallLogAdapter extends GroupingListAdapter @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { + return createCallLogEntryViewHolder(parent); + } + + /** + * Creates a new call log entry {@link ViewHolder}. + * + * @param parent the parent view. + * @return The {@link ViewHolder}. + */ + private ViewHolder createCallLogEntryViewHolder(ViewGroup parent) { LayoutInflater inflater = LayoutInflater.from(mContext); View view = inflater.inflate(R.layout.call_log_list_item, parent, false); |