Mholloway has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/372191 )

Change subject: Fix: ellipsize reading list descriptions
......................................................................

Fix: ellipsize reading list descriptions

Reading list descriptions were not being ellipsized despite our specifying
maxLines="2" and ellipsize="end" in the layout xml.  Apparently because of
a platform bug, tt turns out that the ellipsize directive doesn't work for
TextViews with a TextWatcher set on them, and therefore won't work with a
GoneIfEmptyTextView.  We don't need to use that class anyway, so this
swaps in a plain TextView.

Added some cautionary comments to GoneIfEmptyTextView to reflect this.

Bug: T164926
Change-Id: Ie97a9407e83c10719dbcbc6c0554631a7e30b034
---
M app/src/main/java/org/wikipedia/views/AppTextView.java
M app/src/main/java/org/wikipedia/views/GoneIfEmptyTextView.java
M app/src/main/res/layout/item_reading_list.xml
3 files changed, 10 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/apps/android/wikipedia 
refs/changes/91/372191/1

diff --git a/app/src/main/java/org/wikipedia/views/AppTextView.java 
b/app/src/main/java/org/wikipedia/views/AppTextView.java
index 014ca94..a4c863b 100644
--- a/app/src/main/java/org/wikipedia/views/AppTextView.java
+++ b/app/src/main/java/org/wikipedia/views/AppTextView.java
@@ -5,6 +5,7 @@
 import android.util.AttributeSet;
 import android.view.MotionEvent;
 
+// TODO: Document where it is desirable to use this class vs. a vanilla 
TextView
 public class AppTextView extends ConfigurableTextView {
 
     public AppTextView(Context context) {
diff --git a/app/src/main/java/org/wikipedia/views/GoneIfEmptyTextView.java 
b/app/src/main/java/org/wikipedia/views/GoneIfEmptyTextView.java
index 952f756..860a488 100644
--- a/app/src/main/java/org/wikipedia/views/GoneIfEmptyTextView.java
+++ b/app/src/main/java/org/wikipedia/views/GoneIfEmptyTextView.java
@@ -6,6 +6,12 @@
 import android.util.AttributeSet;
 import android.view.View;
 
+/**
+ * WARNING: This class was created for a very specific purpose: allowing the 
correct vertical
+ * centering of a vertical set of TextViews within a parent view, when the 
content of one or more of
+ * those TextViews was optional.  Don't use this if you don't need it!  It may 
break other things
+ * (for example, it breaks "android:ellipsize=true").
+ */
 public class GoneIfEmptyTextView extends AppTextView {
     public GoneIfEmptyTextView(Context context) {
         super(context);
diff --git a/app/src/main/res/layout/item_reading_list.xml 
b/app/src/main/res/layout/item_reading_list.xml
index ebc6d95..4a2fec7 100644
--- a/app/src/main/res/layout/item_reading_list.xml
+++ b/app/src/main/res/layout/item_reading_list.xml
@@ -82,10 +82,9 @@
                 android:ellipsize="end"
                 android:maxLines="1"
                 android:textColor="?attr/list_item_text_secondary_color"
-                tools:text="x items"
-                />
+                tools:text="x items" />
 
-            <org.wikipedia.views.GoneIfEmptyTextView
+            <TextView
                 android:id="@+id/item_description"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
@@ -95,8 +94,7 @@
                 android:ellipsize="end"
                 android:maxLines="2"
                 android:textColor="?attr/list_item_text_secondary_color"
-                tools:text="Sample description"
-                />
+                tools:text="Sample description" />
 
         </LinearLayout>
     </LinearLayout>

-- 
To view, visit https://gerrit.wikimedia.org/r/372191
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie97a9407e83c10719dbcbc6c0554631a7e30b034
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Mholloway <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to