summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorlinyuh <linyuh@google.com>2018-05-08 12:53:33 -0700
committerCopybara-Service <copybara-piper@google.com>2018-05-09 16:56:36 -0700
commit6d728d52339f4d3bb92f45bb1412cd89f3c318b8 (patch)
tree26f966e42e8c4c0d99b5d4d525cdc478a4d7cd5e /java
parent267cdad8f95c541d421292a5675a2e13f81850e0 (diff)
Allow the TextView for call log primary text to adjust size when recycled.
Bug: 77835800 Test: Manual PiperOrigin-RevId: 195861757 Change-Id: I79f99c3468324922560961ea71dcc792a4d83a24
Diffstat (limited to 'java')
-rw-r--r--java/com/android/dialer/calllog/ui/res/layout/new_call_log_entry.xml20
1 files changed, 18 insertions, 2 deletions
diff --git a/java/com/android/dialer/calllog/ui/res/layout/new_call_log_entry.xml b/java/com/android/dialer/calllog/ui/res/layout/new_call_log_entry.xml
index b0fb48f1a..2fc8e7bb8 100644
--- a/java/com/android/dialer/calllog/ui/res/layout/new_call_log_entry.xml
+++ b/java/com/android/dialer/calllog/ui/res/layout/new_call_log_entry.xml
@@ -17,6 +17,7 @@
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="72dp">
@@ -43,16 +44,31 @@
android:layout_height="wrap_content"
android:orientation="horizontal">
+ <!--
+ Important note:
+
+ The following TextView is the only widget that defines a weight in the containing
+ LinearLayout, of which the purpose is to avoid pushing the widgets after it out of the
+ boundary when the text is too long.
+
+ Generally it is more efficient to assign a width/height of 0dp so that the TextView does
+ not have to measure its own size since it will absorb all the remaining space anyway.
+
+ However, as the TextView is part of an entry in the call log's RecyclerView, we must set
+ layout_width to "wrap_content" so that the TextView can adjust its size when recycled for
+ text of different lengths.
+ -->
<TextView
android:id="@+id/primary_text"
style="@style/PrimaryText"
- android:layout_width="0dp"
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginEnd="6dp"
android:ellipsize="end"
android:lineSpacingMultiplier="1.5"
- android:singleLine="true"/>
+ android:singleLine="true"
+ tools:ignore="InefficientWeight"/>
<ImageView
android:id="@+id/hd_icon"