summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2018-04-26 07:25:18 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2018-04-26 07:25:18 +0000
commit130b768389fa246e8fae8018718d62100c98479e (patch)
tree65c6df1883f61e34efd782cd555a51982c663b7f
parent0b317f5ee6199613c069947e8ddba716caf59508 (diff)
parent186357b18efe58929d910d6e699492db1f2d13cb (diff)
downloadDialer-130b768389fa246e8fae8018718d62100c98479e.tar.gz
Snap for 4745538 from 186357b18efe58929d910d6e699492db1f2d13cb to pi-release
Change-Id: I7e71b93b5784e788825446214ff127b06a3dd87c
-rw-r--r--src/com/android/car/dialer/ui/CallHistoryListItemProvider.java11
-rw-r--r--src/com/android/car/dialer/ui/listitem/CallLogListItem.java53
2 files changed, 56 insertions, 8 deletions
diff --git a/src/com/android/car/dialer/ui/CallHistoryListItemProvider.java b/src/com/android/car/dialer/ui/CallHistoryListItemProvider.java
index bff1c22e..2b905efa 100644
--- a/src/com/android/car/dialer/ui/CallHistoryListItemProvider.java
+++ b/src/com/android/car/dialer/ui/CallHistoryListItemProvider.java
@@ -22,24 +22,19 @@ import androidx.car.widget.ListItem;
import androidx.car.widget.ListItemProvider;
import androidx.car.widget.TextListItem;
+import com.android.car.dialer.ui.listitem.CallLogListItem;
+
import java.util.ArrayList;
import java.util.List;
public class CallHistoryListItemProvider extends ListItemProvider {
-
private List<TextListItem> mItems = new ArrayList<>();
public void setCallHistoryListItems(Context context,
List<CallLogListingTask.CallLogItem> items) {
-
for (CallLogListingTask.CallLogItem callLogItem : items) {
- TextListItem textListItem = new TextListItem(context);
- textListItem.setPrimaryActionIcon(
- new BitmapDrawable(context.getResources(), callLogItem.mIcon), true);
- textListItem.setTitle(callLogItem.mTitle);
- textListItem.setBody(callLogItem.mText);
- mItems.add(textListItem);
+ mItems.add(new CallLogListItem(context, callLogItem));
}
}
diff --git a/src/com/android/car/dialer/ui/listitem/CallLogListItem.java b/src/com/android/car/dialer/ui/listitem/CallLogListItem.java
new file mode 100644
index 00000000..c0cb4143
--- /dev/null
+++ b/src/com/android/car/dialer/ui/listitem/CallLogListItem.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.car.dialer.ui.listitem;
+
+import android.content.Context;
+import android.graphics.drawable.BitmapDrawable;
+
+import androidx.car.widget.TextListItem;
+
+import com.android.car.dialer.telecom.UiCallManager;
+import com.android.car.dialer.ui.CallHistoryListItemProvider;
+import com.android.car.dialer.ui.CallLogListingTask;
+
+/**
+ * List item which is created by {@link CallHistoryListItemProvider} binds a call list item to a
+ * list view item.
+ */
+public class CallLogListItem extends TextListItem {
+ private final CallLogListingTask.CallLogItem mCallLogItem;
+ private final Context mContext;
+
+ public CallLogListItem(Context context, CallLogListingTask.CallLogItem callLog) {
+ super(context);
+ mCallLogItem = callLog;
+ mContext = context;
+ }
+
+ @Override
+ public void onBind(ViewHolder viewHolder) {
+ super.onBind(viewHolder);
+ setPrimaryActionIcon(
+ new BitmapDrawable(mContext.getResources(), mCallLogItem.mIcon), true);
+ setTitle(mCallLogItem.mTitle);
+ setBody(mCallLogItem.mText);
+
+ viewHolder.itemView.setOnClickListener((v) -> {
+ UiCallManager.get().safePlaceCall(mCallLogItem.mNumber, false);
+ });
+ }
+}