diff options
author | Cassie(Yitong) Wang <cassieyw@google.com> | 2019-06-18 15:00:00 -0700 |
---|---|---|
committer | Cassie(Yitong) Wang <cassieyw@google.com> | 2019-06-19 18:08:26 -0700 |
commit | 0c4e61a64cc2338ac14108b968dab289479b8b58 (patch) | |
tree | 11a86042b6e5628c729a687ac88e0f9f30556c99 | |
parent | 7643b97bd6ef8cbec85b46f08c4b178640acb67a (diff) | |
download | Dialer-0c4e61a64cc2338ac14108b968dab289479b8b58.tar.gz |
Enable OEMs to customize primary text color in call history
Bug: 135552016
Test: Manually
Change-Id: Ibdcfa5bafe2e75e635e0a1a2e7a22e6225bae1a0
-rw-r--r-- | res/layout/call_history_list_item.xml | 1 | ||||
-rw-r--r-- | res/values/styles.xml | 6 | ||||
-rw-r--r-- | src/com/android/car/dialer/ui/calllog/CallLogViewHolder.java | 7 | ||||
-rw-r--r-- | src/com/android/car/dialer/ui/common/entity/UiCallLog.java | 10 |
4 files changed, 23 insertions, 1 deletions
diff --git a/res/layout/call_history_list_item.xml b/res/layout/call_history_list_item.xml index 60c28100..e2fd81e4 100644 --- a/res/layout/call_history_list_item.xml +++ b/res/layout/call_history_list_item.xml @@ -58,7 +58,6 @@ limitations under the License. android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginEnd="@dimen/call_history_text_margin_end" - android:textAppearance="?android:attr/textAppearanceLarge" android:singleLine="true" app:layout_constraintVertical_chainStyle="packed" app:layout_constraintTop_toTopOf="parent" diff --git a/res/values/styles.xml b/res/values/styles.xml index df73ff68..6293f050 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -118,6 +118,12 @@ <item name="android:textColor">#B8FFFFFF</item> </style> + <!-- Call history --> + <style name="TextAppearance.CallLogTitleDefault" parent="@style/TextAppearance.Body1"/> + + <!-- Customized text color for missed calls can be added here --> + <style name="TextAppearance.CallLogTitleMissedCall" parent="@style/TextAppearance.Body1"/> + <!-- Contact details --> <style name="TextAppearance.ContactDetailsTitle" parent="@style/TextAppearance.Display2"/> diff --git a/src/com/android/car/dialer/ui/calllog/CallLogViewHolder.java b/src/com/android/car/dialer/ui/calllog/CallLogViewHolder.java index aa4b609d..fd0a734c 100644 --- a/src/com/android/car/dialer/ui/calllog/CallLogViewHolder.java +++ b/src/com/android/car/dialer/ui/calllog/CallLogViewHolder.java @@ -24,6 +24,7 @@ import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import com.android.car.dialer.R; +import com.android.car.dialer.livedata.CallHistoryLiveData; import com.android.car.dialer.telecom.UiCallManager; import com.android.car.dialer.ui.common.entity.UiCallLog; import com.android.car.dialer.ui.view.ContactAvatarOutputlineProvider; @@ -71,6 +72,12 @@ public class CallLogViewHolder extends RecyclerView.ViewHolder { uiCallLog.getAvatarUri(), uiCallLog.getTitle()); mTitleView.setText(uiCallLog.getTitle()); + if (uiCallLog.getMostRecentCallType() == CallHistoryLiveData.CallType.MISSED_TYPE) { + mTitleView.setTextAppearance(R.style.TextAppearance_CallLogTitleMissedCall); + } else { + mTitleView.setTextAppearance(R.style.TextAppearance_CallLogTitleDefault); + } + for (PhoneCallLog.Record record : uiCallLog.getCallRecords()) { mCallTypeIconsView.add(record.getCallType()); } diff --git a/src/com/android/car/dialer/ui/common/entity/UiCallLog.java b/src/com/android/car/dialer/ui/common/entity/UiCallLog.java index d3d6ba1f..999d66e1 100644 --- a/src/com/android/car/dialer/ui/common/entity/UiCallLog.java +++ b/src/com/android/car/dialer/ui/common/entity/UiCallLog.java @@ -17,6 +17,8 @@ package com.android.car.dialer.ui.common.entity; import android.net.Uri; + +import com.android.car.dialer.livedata.CallHistoryLiveData; import com.android.car.telephony.common.PhoneCallLog; import java.util.ArrayList; @@ -107,4 +109,12 @@ public class UiCallLog { return mCallRecords.isEmpty() ? 0 : mCallRecords.get(0).getCallEndTimestamp(); } + + /** + * Returns the most recent call's call type. + */ + public int getMostRecentCallType() { + return mCallRecords.isEmpty() ? CallHistoryLiveData.CallType.CALL_TYPE_ALL + : mCallRecords.get(0).getCallType(); + } } |