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

Change subject: add support for exact leading
......................................................................

add support for exact leading

Change-Id: I241adb3454087f1dc1148468474c4bebc852a067
---
D 
app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testLayoutDirection-480dp-en-ltr-font1.0x-light.png
D 
app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testLayoutDirection-480dp-en-rtl-font1.0x-light.png
D 
app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testLeading-320dp-en-ltr-font1.0x-light-1x_leading.png
D 
app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testLeading-320dp-en-ltr-font1.0x-light-2x_leading.png
D 
app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testLeading-320dp-en-ltr-font1.5x-light-1x_leading.png
D 
app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testLeading-320dp-en-ltr-font1.5x-light-2x_leading.png
D 
app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testLeading-480dp-en-ltr-font1.0x-light-1x_leading.png
D 
app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testLeading-480dp-en-ltr-font1.0x-light-2x_leading.png
D 
app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testLeading-480dp-en-ltr-font1.5x-light-1x_leading.png
D 
app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testLeading-480dp-en-ltr-font1.5x-light-2x_leading.png
D 
app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testWidth-320dp-en-ltr-font1.0x-light-long_text.png
D 
app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testWidth-320dp-en-ltr-font1.0x-light-null_text.png
D 
app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testWidth-320dp-en-ltr-font1.0x-light-short_text.png
D 
app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testWidth-320dp-en-ltr-font1.5x-light-long_text.png
D 
app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testWidth-320dp-en-ltr-font1.5x-light-null_text.png
D 
app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testWidth-320dp-en-ltr-font1.5x-light-short_text.png
D 
app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testWidth-480dp-en-ltr-font1.0x-light-long_text.png
D 
app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testWidth-480dp-en-ltr-font1.0x-light-null_text.png
D 
app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testWidth-480dp-en-ltr-font1.0x-light-short_text.png
D 
app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testWidth-480dp-en-ltr-font1.5x-light-long_text.png
D 
app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testWidth-480dp-en-ltr-font1.5x-light-null_text.png
D 
app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testWidth-480dp-en-ltr-font1.5x-light-short_text.png
M 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLayoutDirection-480dp-en-ltr-font1.0x-light.png
M 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLayoutDirection-480dp-en-rtl-font1.0x-light.png
A 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.0x-light--1.0_leading.png
A 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.0x-light-0.0_leading.png
A 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.0x-light-10.0_leading.png
A 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.0x-light-100.0_leading.png
A 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.0x-light-20.0_leading.png
A 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.0x-light-50.0_leading.png
D 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.0x-light.png
A 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.5x-light--1.0_leading.png
A 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.5x-light-0.0_leading.png
A 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.5x-light-10.0_leading.png
A 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.5x-light-100.0_leading.png
A 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.5x-light-20.0_leading.png
A 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.5x-light-50.0_leading.png
D 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.5x-light.png
A 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.0x-light--1.0_leading.png
A 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.0x-light-0.0_leading.png
A 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.0x-light-10.0_leading.png
A 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.0x-light-100.0_leading.png
A 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.0x-light-20.0_leading.png
A 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.0x-light-50.0_leading.png
D 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.0x-light.png
A 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.5x-light--1.0_leading.png
A 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.5x-light-0.0_leading.png
A 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.5x-light-10.0_leading.png
A 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.5x-light-100.0_leading.png
A 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.5x-light-20.0_leading.png
A 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.5x-light-50.0_leading.png
D 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.5x-light.png
M 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-320dp-en-ltr-font1.0x-light-long_text.png
M 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-320dp-en-ltr-font1.0x-light-short_text.png
M 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-320dp-en-ltr-font1.5x-light-long_text.png
M 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-320dp-en-ltr-font1.5x-light-short_text.png
M 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-480dp-en-ltr-font1.0x-light-long_text.png
M 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-480dp-en-ltr-font1.0x-light-short_text.png
M 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-480dp-en-ltr-font1.5x-light-long_text.png
M 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-480dp-en-ltr-font1.5x-light-short_text.png
D app/src/androidTest/java/org/wikipedia/richtext/LeadingSpanTest.java
M app/src/androidTest/java/org/wikipedia/views/AppTextViewTest.java
M app/src/main/java/org/wikipedia/page/leadimages/PageHeaderView.java
D app/src/main/java/org/wikipedia/richtext/LeadingSpan.java
M app/src/main/java/org/wikipedia/views/AppTextView.java
M app/src/main/res/layout/view_page_header.xml
M app/src/main/res/values-v23/dimens.xml
M app/src/main/res/values/attrs.xml
M app/src/main/res/values/dimens.xml
M app/src/main/res/values/styles.xml
70 files changed, 73 insertions(+), 119 deletions(-)


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

diff --git 
a/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testLayoutDirection-480dp-en-ltr-font1.0x-light.png
 
b/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testLayoutDirection-480dp-en-ltr-font1.0x-light.png
deleted file mode 100644
index d347971..0000000
--- 
a/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testLayoutDirection-480dp-en-ltr-font1.0x-light.png
+++ /dev/null
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testLayoutDirection-480dp-en-rtl-font1.0x-light.png
 
b/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testLayoutDirection-480dp-en-rtl-font1.0x-light.png
deleted file mode 100644
index ea0af03..0000000
--- 
a/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testLayoutDirection-480dp-en-rtl-font1.0x-light.png
+++ /dev/null
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testLeading-320dp-en-ltr-font1.0x-light-1x_leading.png
 
b/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testLeading-320dp-en-ltr-font1.0x-light-1x_leading.png
deleted file mode 100644
index 912d3c7..0000000
--- 
a/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testLeading-320dp-en-ltr-font1.0x-light-1x_leading.png
+++ /dev/null
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testLeading-320dp-en-ltr-font1.0x-light-2x_leading.png
 
b/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testLeading-320dp-en-ltr-font1.0x-light-2x_leading.png
deleted file mode 100644
index dcf1a83..0000000
--- 
a/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testLeading-320dp-en-ltr-font1.0x-light-2x_leading.png
+++ /dev/null
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testLeading-320dp-en-ltr-font1.5x-light-1x_leading.png
 
b/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testLeading-320dp-en-ltr-font1.5x-light-1x_leading.png
deleted file mode 100644
index 832836d..0000000
--- 
a/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testLeading-320dp-en-ltr-font1.5x-light-1x_leading.png
+++ /dev/null
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testLeading-320dp-en-ltr-font1.5x-light-2x_leading.png
 
b/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testLeading-320dp-en-ltr-font1.5x-light-2x_leading.png
deleted file mode 100644
index 5ed3f38..0000000
--- 
a/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testLeading-320dp-en-ltr-font1.5x-light-2x_leading.png
+++ /dev/null
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testLeading-480dp-en-ltr-font1.0x-light-1x_leading.png
 
b/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testLeading-480dp-en-ltr-font1.0x-light-1x_leading.png
deleted file mode 100644
index 99b9017..0000000
--- 
a/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testLeading-480dp-en-ltr-font1.0x-light-1x_leading.png
+++ /dev/null
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testLeading-480dp-en-ltr-font1.0x-light-2x_leading.png
 
b/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testLeading-480dp-en-ltr-font1.0x-light-2x_leading.png
deleted file mode 100644
index f170d7a..0000000
--- 
a/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testLeading-480dp-en-ltr-font1.0x-light-2x_leading.png
+++ /dev/null
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testLeading-480dp-en-ltr-font1.5x-light-1x_leading.png
 
b/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testLeading-480dp-en-ltr-font1.5x-light-1x_leading.png
deleted file mode 100644
index 94c7eac..0000000
--- 
a/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testLeading-480dp-en-ltr-font1.5x-light-1x_leading.png
+++ /dev/null
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testLeading-480dp-en-ltr-font1.5x-light-2x_leading.png
 
b/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testLeading-480dp-en-ltr-font1.5x-light-2x_leading.png
deleted file mode 100644
index c2f3caf..0000000
--- 
a/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testLeading-480dp-en-ltr-font1.5x-light-2x_leading.png
+++ /dev/null
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testWidth-320dp-en-ltr-font1.0x-light-long_text.png
 
b/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testWidth-320dp-en-ltr-font1.0x-light-long_text.png
deleted file mode 100644
index b08fafa..0000000
--- 
a/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testWidth-320dp-en-ltr-font1.0x-light-long_text.png
+++ /dev/null
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testWidth-320dp-en-ltr-font1.0x-light-null_text.png
 
b/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testWidth-320dp-en-ltr-font1.0x-light-null_text.png
deleted file mode 100644
index 6d65e91..0000000
--- 
a/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testWidth-320dp-en-ltr-font1.0x-light-null_text.png
+++ /dev/null
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testWidth-320dp-en-ltr-font1.0x-light-short_text.png
 
b/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testWidth-320dp-en-ltr-font1.0x-light-short_text.png
deleted file mode 100644
index af50098..0000000
--- 
a/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testWidth-320dp-en-ltr-font1.0x-light-short_text.png
+++ /dev/null
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testWidth-320dp-en-ltr-font1.5x-light-long_text.png
 
b/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testWidth-320dp-en-ltr-font1.5x-light-long_text.png
deleted file mode 100644
index 95874ac..0000000
--- 
a/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testWidth-320dp-en-ltr-font1.5x-light-long_text.png
+++ /dev/null
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testWidth-320dp-en-ltr-font1.5x-light-null_text.png
 
b/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testWidth-320dp-en-ltr-font1.5x-light-null_text.png
deleted file mode 100644
index 3ad537f..0000000
--- 
a/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testWidth-320dp-en-ltr-font1.5x-light-null_text.png
+++ /dev/null
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testWidth-320dp-en-ltr-font1.5x-light-short_text.png
 
b/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testWidth-320dp-en-ltr-font1.5x-light-short_text.png
deleted file mode 100644
index 50e79c2..0000000
--- 
a/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testWidth-320dp-en-ltr-font1.5x-light-short_text.png
+++ /dev/null
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testWidth-480dp-en-ltr-font1.0x-light-long_text.png
 
b/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testWidth-480dp-en-ltr-font1.0x-light-long_text.png
deleted file mode 100644
index 9a32512..0000000
--- 
a/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testWidth-480dp-en-ltr-font1.0x-light-long_text.png
+++ /dev/null
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testWidth-480dp-en-ltr-font1.0x-light-null_text.png
 
b/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testWidth-480dp-en-ltr-font1.0x-light-null_text.png
deleted file mode 100644
index dfbca86..0000000
--- 
a/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testWidth-480dp-en-ltr-font1.0x-light-null_text.png
+++ /dev/null
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testWidth-480dp-en-ltr-font1.0x-light-short_text.png
 
b/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testWidth-480dp-en-ltr-font1.0x-light-short_text.png
deleted file mode 100644
index d347971..0000000
--- 
a/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testWidth-480dp-en-ltr-font1.0x-light-short_text.png
+++ /dev/null
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testWidth-480dp-en-ltr-font1.5x-light-long_text.png
 
b/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testWidth-480dp-en-ltr-font1.5x-light-long_text.png
deleted file mode 100644
index 30eab9c..0000000
--- 
a/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testWidth-480dp-en-ltr-font1.5x-light-long_text.png
+++ /dev/null
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testWidth-480dp-en-ltr-font1.5x-light-null_text.png
 
b/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testWidth-480dp-en-ltr-font1.5x-light-null_text.png
deleted file mode 100644
index 34744a5..0000000
--- 
a/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testWidth-480dp-en-ltr-font1.5x-light-null_text.png
+++ /dev/null
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testWidth-480dp-en-ltr-font1.5x-light-short_text.png
 
b/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testWidth-480dp-en-ltr-font1.5x-light-short_text.png
deleted file mode 100644
index 0647f7b..0000000
--- 
a/app/screenshots-ref/org.wikipedia.richtext.LeadingSpanTest.testWidth-480dp-en-ltr-font1.5x-light-short_text.png
+++ /dev/null
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLayoutDirection-480dp-en-ltr-font1.0x-light.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLayoutDirection-480dp-en-ltr-font1.0x-light.png
index d347971..e7d9a0a 100644
--- 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLayoutDirection-480dp-en-ltr-font1.0x-light.png
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLayoutDirection-480dp-en-ltr-font1.0x-light.png
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLayoutDirection-480dp-en-rtl-font1.0x-light.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLayoutDirection-480dp-en-rtl-font1.0x-light.png
index ea0af03..e4b73d3 100644
--- 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLayoutDirection-480dp-en-rtl-font1.0x-light.png
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLayoutDirection-480dp-en-rtl-font1.0x-light.png
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.0x-light--1.0_leading.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.0x-light--1.0_leading.png
new file mode 100644
index 0000000..7e0852d
--- /dev/null
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.0x-light--1.0_leading.png
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.0x-light-0.0_leading.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.0x-light-0.0_leading.png
new file mode 100644
index 0000000..7e0852d
--- /dev/null
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.0x-light-0.0_leading.png
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.0x-light-10.0_leading.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.0x-light-10.0_leading.png
new file mode 100644
index 0000000..8cb918c
--- /dev/null
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.0x-light-10.0_leading.png
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.0x-light-100.0_leading.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.0x-light-100.0_leading.png
new file mode 100644
index 0000000..265c684
--- /dev/null
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.0x-light-100.0_leading.png
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.0x-light-20.0_leading.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.0x-light-20.0_leading.png
new file mode 100644
index 0000000..ba0c44e
--- /dev/null
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.0x-light-20.0_leading.png
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.0x-light-50.0_leading.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.0x-light-50.0_leading.png
new file mode 100644
index 0000000..1f43f59
--- /dev/null
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.0x-light-50.0_leading.png
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.0x-light.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.0x-light.png
deleted file mode 100644
index 94dc452..0000000
--- 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.0x-light.png
+++ /dev/null
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.5x-light--1.0_leading.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.5x-light--1.0_leading.png
new file mode 100644
index 0000000..650b3f7
--- /dev/null
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.5x-light--1.0_leading.png
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.5x-light-0.0_leading.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.5x-light-0.0_leading.png
new file mode 100644
index 0000000..650b3f7
--- /dev/null
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.5x-light-0.0_leading.png
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.5x-light-10.0_leading.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.5x-light-10.0_leading.png
new file mode 100644
index 0000000..987fdd9
--- /dev/null
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.5x-light-10.0_leading.png
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.5x-light-100.0_leading.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.5x-light-100.0_leading.png
new file mode 100644
index 0000000..e811de6
--- /dev/null
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.5x-light-100.0_leading.png
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.5x-light-20.0_leading.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.5x-light-20.0_leading.png
new file mode 100644
index 0000000..b4508a7
--- /dev/null
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.5x-light-20.0_leading.png
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.5x-light-50.0_leading.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.5x-light-50.0_leading.png
new file mode 100644
index 0000000..706930e
--- /dev/null
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.5x-light-50.0_leading.png
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.5x-light.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.5x-light.png
deleted file mode 100644
index e3c63f1..0000000
--- 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.5x-light.png
+++ /dev/null
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.0x-light--1.0_leading.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.0x-light--1.0_leading.png
new file mode 100644
index 0000000..d07369c
--- /dev/null
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.0x-light--1.0_leading.png
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.0x-light-0.0_leading.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.0x-light-0.0_leading.png
new file mode 100644
index 0000000..d07369c
--- /dev/null
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.0x-light-0.0_leading.png
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.0x-light-10.0_leading.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.0x-light-10.0_leading.png
new file mode 100644
index 0000000..1f0303b
--- /dev/null
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.0x-light-10.0_leading.png
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.0x-light-100.0_leading.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.0x-light-100.0_leading.png
new file mode 100644
index 0000000..3668a62
--- /dev/null
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.0x-light-100.0_leading.png
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.0x-light-20.0_leading.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.0x-light-20.0_leading.png
new file mode 100644
index 0000000..004dd06
--- /dev/null
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.0x-light-20.0_leading.png
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.0x-light-50.0_leading.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.0x-light-50.0_leading.png
new file mode 100644
index 0000000..68ee10f
--- /dev/null
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.0x-light-50.0_leading.png
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.0x-light.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.0x-light.png
deleted file mode 100644
index dffc44c..0000000
--- 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.0x-light.png
+++ /dev/null
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.5x-light--1.0_leading.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.5x-light--1.0_leading.png
new file mode 100644
index 0000000..455303c
--- /dev/null
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.5x-light--1.0_leading.png
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.5x-light-0.0_leading.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.5x-light-0.0_leading.png
new file mode 100644
index 0000000..455303c
--- /dev/null
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.5x-light-0.0_leading.png
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.5x-light-10.0_leading.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.5x-light-10.0_leading.png
new file mode 100644
index 0000000..084dc9e
--- /dev/null
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.5x-light-10.0_leading.png
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.5x-light-100.0_leading.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.5x-light-100.0_leading.png
new file mode 100644
index 0000000..dfdcdb8
--- /dev/null
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.5x-light-100.0_leading.png
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.5x-light-20.0_leading.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.5x-light-20.0_leading.png
new file mode 100644
index 0000000..d6bd542
--- /dev/null
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.5x-light-20.0_leading.png
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.5x-light-50.0_leading.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.5x-light-50.0_leading.png
new file mode 100644
index 0000000..ca269ef
--- /dev/null
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.5x-light-50.0_leading.png
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.5x-light.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.5x-light.png
deleted file mode 100644
index a990a0c..0000000
--- 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.5x-light.png
+++ /dev/null
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-320dp-en-ltr-font1.0x-light-long_text.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-320dp-en-ltr-font1.0x-light-long_text.png
index cd9c164..3105a65 100644
--- 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-320dp-en-ltr-font1.0x-light-long_text.png
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-320dp-en-ltr-font1.0x-light-long_text.png
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-320dp-en-ltr-font1.0x-light-short_text.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-320dp-en-ltr-font1.0x-light-short_text.png
index af50098..0552fe8 100644
--- 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-320dp-en-ltr-font1.0x-light-short_text.png
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-320dp-en-ltr-font1.0x-light-short_text.png
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-320dp-en-ltr-font1.5x-light-long_text.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-320dp-en-ltr-font1.5x-light-long_text.png
index eef510f..677e83b 100644
--- 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-320dp-en-ltr-font1.5x-light-long_text.png
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-320dp-en-ltr-font1.5x-light-long_text.png
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-320dp-en-ltr-font1.5x-light-short_text.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-320dp-en-ltr-font1.5x-light-short_text.png
index 50e79c2..ee5fa17 100644
--- 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-320dp-en-ltr-font1.5x-light-short_text.png
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-320dp-en-ltr-font1.5x-light-short_text.png
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-480dp-en-ltr-font1.0x-light-long_text.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-480dp-en-ltr-font1.0x-light-long_text.png
index 93e5f02..fe46195 100644
--- 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-480dp-en-ltr-font1.0x-light-long_text.png
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-480dp-en-ltr-font1.0x-light-long_text.png
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-480dp-en-ltr-font1.0x-light-short_text.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-480dp-en-ltr-font1.0x-light-short_text.png
index d347971..e7d9a0a 100644
--- 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-480dp-en-ltr-font1.0x-light-short_text.png
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-480dp-en-ltr-font1.0x-light-short_text.png
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-480dp-en-ltr-font1.5x-light-long_text.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-480dp-en-ltr-font1.5x-light-long_text.png
index 830086f..0c506f5 100644
--- 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-480dp-en-ltr-font1.5x-light-long_text.png
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-480dp-en-ltr-font1.5x-light-long_text.png
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-480dp-en-ltr-font1.5x-light-short_text.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-480dp-en-ltr-font1.5x-light-short_text.png
index 0647f7b..14f19e8 100644
--- 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-480dp-en-ltr-font1.5x-light-short_text.png
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-480dp-en-ltr-font1.5x-light-short_text.png
Binary files differ
diff --git 
a/app/src/androidTest/java/org/wikipedia/richtext/LeadingSpanTest.java 
b/app/src/androidTest/java/org/wikipedia/richtext/LeadingSpanTest.java
deleted file mode 100644
index 65d01aa..0000000
--- a/app/src/androidTest/java/org/wikipedia/richtext/LeadingSpanTest.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package org.wikipedia.richtext;
-
-import android.os.Build;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
-import android.support.test.filters.SmallTest;
-import android.text.Spannable;
-import android.text.SpannableString;
-import android.text.Spanned;
-import android.view.View;
-import android.widget.TextView;
-
-import org.apache.commons.lang3.StringUtils;
-import org.junit.experimental.theories.Theory;
-import org.junit.experimental.theories.suppliers.TestedOn;
-import org.wikipedia.test.view.FontScale;
-import org.wikipedia.test.view.LayoutDirection;
-import org.wikipedia.test.view.PrimaryTestStr;
-import org.wikipedia.test.view.TestStr;
-import org.wikipedia.test.view.ViewTest;
-import org.wikipedia.theme.Theme;
-import org.wikipedia.views.AppTextView;
-
-import static org.apache.commons.lang3.StringUtils.defaultIfEmpty;
-
-@SmallTest public class LeadingSpanTest extends ViewTest {
-    private TextView textView;
-
-    @Theory public void testWidth(@TestedOn(ints = {WIDTH_DP_L, WIDTH_DP_M}) 
int widthDp,
-                                  @NonNull FontScale fontScale, @NonNull 
PrimaryTestStr text) {
-        setUp(widthDp, LayoutDirection.LOCALE, fontScale, Theme.LIGHT, text);
-        snap(textView, text + "_text");
-    }
-
-    @Theory public void testLayoutDirection(@NonNull LayoutDirection 
direction) {
-        setUp(WIDTH_DP_L, direction, FontScale.DEFAULT, Theme.LIGHT, 
PrimaryTestStr.SHORT);
-        snap(textView);
-    }
-
-    @Theory public void testLeading(@TestedOn(ints = {WIDTH_DP_L, WIDTH_DP_M}) 
int widthDp,
-                                    @NonNull FontScale fontScale,
-                                    @TestedOn(ints = {1, 2}) int 
leadingScalar) {
-        final String str = StringUtils.repeat("Mm%Z@OQW|Pbdpqg ", 100);
-        setUp(widthDp, LayoutDirection.LOCALE, fontScale, Theme.LIGHT, str, 
leadingScalar);
-        snap(textView, leadingScalar + "x_leading");
-    }
-
-    private void setUp(int widthDp, @NonNull LayoutDirection layoutDirection,
-                       @NonNull FontScale fontScale, @NonNull Theme theme, 
@NonNull TestStr text) {
-        setUp(widthDp, layoutDirection, fontScale, theme);
-        init(str(text), 1);
-    }
-
-    private void setUp(int widthDp, @NonNull LayoutDirection layoutDirection,
-                       @NonNull FontScale fontScale, @NonNull Theme theme,
-                       @Nullable CharSequence text, float leadingScalar) {
-        setUp(widthDp, layoutDirection, fontScale, theme);
-        init(text, leadingScalar);
-    }
-
-    private void init(@Nullable CharSequence text, float leadingScalar) {
-        textView = new AppTextView(ctx());
-        textView.setText(spanned(text, leadingScalar));
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
-            textView.setTextAlignment(View.TEXT_ALIGNMENT_VIEW_START);
-        }
-    }
-
-    private Spanned spanned(@Nullable CharSequence text, float leadingScalar) {
-        int flags = text == null
-                ? Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
-                : Spannable.SPAN_INCLUSIVE_EXCLUSIVE;
-        Spannable spannable = new SpannableString(defaultIfEmpty(text, ""));
-        spannable.setSpan(new LeadingSpan(leadingScalar), 0, 
spannable.length(), flags);
-        return spannable;
-    }
-}
\ No newline at end of file
diff --git a/app/src/androidTest/java/org/wikipedia/views/AppTextViewTest.java 
b/app/src/androidTest/java/org/wikipedia/views/AppTextViewTest.java
index a61926f..49dc70d 100644
--- a/app/src/androidTest/java/org/wikipedia/views/AppTextViewTest.java
+++ b/app/src/androidTest/java/org/wikipedia/views/AppTextViewTest.java
@@ -31,10 +31,12 @@
     }
 
     @Theory public void testLeading(@TestedOn(ints = {WIDTH_DP_L, WIDTH_DP_M}) 
int widthDp,
-                                    @NonNull FontScale fontScale) {
+                                    @NonNull FontScale fontScale,
+                                    @TestedOn(ints = {-1, 0, 10, 20, 50, 100}) 
float leading) {
         final String str = StringUtils.repeat("Mm%Z@OQW|Pbdpqg ", 100);
         setUp(widthDp, LayoutDirection.LOCALE, fontScale, Theme.LIGHT, str);
-        snap(subject);
+        subject.setLeading(leading > 0 ? leading : null);
+        snap(subject, leading + "_leading");
     }
 
     private void setUp(int widthDp, @NonNull LayoutDirection layoutDirection,
diff --git 
a/app/src/main/java/org/wikipedia/page/leadimages/PageHeaderView.java 
b/app/src/main/java/org/wikipedia/page/leadimages/PageHeaderView.java
index 7be54b5..c10f30b 100644
--- a/app/src/main/java/org/wikipedia/page/leadimages/PageHeaderView.java
+++ b/app/src/main/java/org/wikipedia/page/leadimages/PageHeaderView.java
@@ -38,7 +38,6 @@
 import org.wikipedia.media.DefaultAvPlayer;
 import org.wikipedia.media.MediaPlayerImplementation;
 import org.wikipedia.richtext.AudioUrlSpan;
-import org.wikipedia.richtext.LeadingSpan;
 import org.wikipedia.richtext.ParagraphSpan;
 import org.wikipedia.richtext.RichTextUtil;
 import org.wikipedia.util.DimenUtil;
@@ -302,7 +301,6 @@
     }
 
     private Spanned subtitleSpanned() {
-        final float leadingScalar = 
DimenUtil.getFloat(R.dimen.lead_subtitle_leading_scalar);
         final float paragraphScalar = 
DimenUtil.getFloat(R.dimen.lead_subtitle_paragraph_scalar);
         String description = TextUtils.isEmpty(subtitle)
                 ? 
getResources().getString(R.string.description_edit_add_description)
@@ -311,7 +309,6 @@
                 0,
                 description.length(),
                 Spannable.SPAN_INCLUSIVE_EXCLUSIVE,
-                new LeadingSpan(leadingScalar),
                 new ParagraphSpan(paragraphScalar),
                 TextUtils.isEmpty(subtitle) ? descriptionClickSpan : new 
ForegroundColorSpan(getColor(R.color.dark_gray)),
                 TextUtils.isEmpty(subtitle) ? new StyleSpan(Typeface.ITALIC) : 
null);
diff --git a/app/src/main/java/org/wikipedia/richtext/LeadingSpan.java 
b/app/src/main/java/org/wikipedia/richtext/LeadingSpan.java
deleted file mode 100644
index 71bda3b..0000000
--- a/app/src/main/java/org/wikipedia/richtext/LeadingSpan.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.wikipedia.richtext;
-
-import android.graphics.Paint;
-import android.text.Spanned;
-
-public class LeadingSpan extends RelativeLineHeightSpan {
-    public LeadingSpan(float scalar) {
-        super(scalar);
-    }
-
-    @Override public void chooseHeight(CharSequence text, int start, int end, 
int spanstartv, int v,
-                                       Paint.FontMetricsInt metrics) {
-        // Only operate on the first line (see IconMarginSpan, 
DrawableMarginSpan). This will affect
-        // all following lines through the metrics parameter output
-        if (start == ((Spanned) text).getSpanStart(this)) {
-            // Don't change the state of metrics until all calculations are 
performed.
-            int scaledAscender = (int) scaledAscender(metrics);
-            int scaledDescender = (int) scaledDescender(metrics);
-
-            metrics.ascent = scaledAscender;
-            metrics.descent = scaledDescender;
-        }
-    }
-}
\ No newline at end of file
diff --git a/app/src/main/java/org/wikipedia/views/AppTextView.java 
b/app/src/main/java/org/wikipedia/views/AppTextView.java
index 0c7bfb1..8033747 100644
--- a/app/src/main/java/org/wikipedia/views/AppTextView.java
+++ b/app/src/main/java/org/wikipedia/views/AppTextView.java
@@ -2,37 +2,72 @@
 
 import android.annotation.TargetApi;
 import android.content.Context;
+import android.content.res.TypedArray;
+import android.graphics.Paint;
 import android.os.Build;
+import android.support.annotation.AttrRes;
+import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
+import android.support.annotation.StyleRes;
+import android.support.annotation.StyleableRes;
 import android.util.AttributeSet;
 
-public class AppTextView extends ConfigurableTextView {
+import org.wikipedia.R;
 
-    public AppTextView(Context context) {
+/** When app:leading is specified, android:lineSpacingExtra is overridden */
+public class AppTextView extends ConfigurableTextView {
+    @StyleRes protected static final int DEFAULT_STYLE = R.style.AppTextView;
+    @StyleableRes protected static final int[] ATTRS = R.styleable.AppTextView;
+    protected static final int DEFAULT_STYLE_ATTR = 
R.styleable.AppTextView_appTextViewStyle;
+
+    @Nullable private Float leadingPx;
+
+    public AppTextView(@NonNull Context context) {
         this(context, null);
     }
 
-    public AppTextView(Context context, AttributeSet attrs) {
-        this(context, attrs, android.R.attr.textViewStyle);
+    public AppTextView(@NonNull Context context, @Nullable AttributeSet attrs) 
{
+        this(context, attrs, DEFAULT_STYLE_ATTR);
     }
 
-    public AppTextView(Context context, AttributeSet attrs, int defStyleAttr) {
+    public AppTextView(@NonNull Context context, @Nullable AttributeSet attrs, 
int defStyleAttr) {
         super(context, attrs, defStyleAttr);
+        init(attrs, defStyleAttr, DEFAULT_STYLE);
     }
 
     @TargetApi(Build.VERSION_CODES.LOLLIPOP)
-    public AppTextView(Context context, AttributeSet attrs, int defStyleAttr, 
int defStyleRes) {
+    public AppTextView(@NonNull Context context, @Nullable AttributeSet attrs,
+                       @AttrRes int defStyleAttr, @StyleRes int defStyleRes) {
         super(context, attrs, defStyleAttr, defStyleRes);
+        init(attrs, defStyleAttr, defStyleRes);
     }
 
-    @Override
-    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+    public void setLeading(@Nullable Float leadingPx) {
+        this.leadingPx = leadingPx;
+        requestLayout();
+        invalidate();
+    }
+
+    @Override protected void onMeasure(int widthMeasureSpec, int 
heightMeasureSpec) {
         super.onMeasure(widthMeasureSpec, heightMeasureSpec);
-        remeasureForLineSpacing();
+        if (leadingPx != null) {
+            setLineSpacing(calcLeadingExtra(), getLineSpacingMultiplier());
+        }
+        remeasureForFinalLineSpacing();
+    }
+
+    private float calcLeadingExtra() {
+        if (leadingPx == null) {
+            return 0;
+        }
+
+        Paint.FontMetrics metrics = getPaint().getFontMetrics();
+        return leadingPx - (metrics.ascent - metrics.descent);
     }
 
     // Ensure the descenders of the final line are not truncated. This usually 
happens when
     // lineSpacingMultiplier is less than one.
-    private void remeasureForLineSpacing() {
+    private void remeasureForFinalLineSpacing() {
         setMeasuredDimension(getMeasuredWidth(), getMeasuredHeight() + 
calculateExtraDescenderSpace());
     }
 
@@ -44,4 +79,19 @@
     private int getIntrinsicLineHeight() {
         return getPaint().getFontMetricsInt(null);
     }
+
+    private void init(@Nullable AttributeSet attrs, @AttrRes int defStyleAttr, 
int defStyleRes) {
+        if (attrs == null) {
+            return;
+        }
+
+        TypedArray array = getContext().obtainStyledAttributes(attrs, ATTRS, 
defStyleAttr, defStyleRes);
+
+        float leading = array.getDimension(R.styleable.AppTextView_leading, 
Float.MIN_VALUE);
+        if (leading != Float.MIN_VALUE) {
+            leadingPx = leading;
+        }
+
+        array.recycle();
+    }
 }
\ No newline at end of file
diff --git a/app/src/main/res/layout/view_page_header.xml 
b/app/src/main/res/layout/view_page_header.xml
index 414a8a9..2b6eec3 100644
--- a/app/src/main/res/layout/view_page_header.xml
+++ b/app/src/main/res/layout/view_page_header.xml
@@ -45,7 +45,7 @@
             android:paddingEnd="40dp"
             android:paddingRight="40dp"
             android:textSize="@dimen/descriptionTextSize"
-            android:lineSpacingMultiplier="@dimen/lead_subtitle_leading_scalar"
+            app:leading="24sp"
             android:textColor="@color/dark_gray"
             android:textColorLink="@color/dark_gray"
             android:textColorHighlight="?attr/window_background_color"
diff --git a/app/src/main/res/values-v23/dimens.xml 
b/app/src/main/res/values-v23/dimens.xml
index 9924f96..96919dc 100644
--- a/app/src/main/res/values-v23/dimens.xml
+++ b/app/src/main/res/values-v23/dimens.xml
@@ -3,6 +3,5 @@
     <!-- Value for android:lineSpacingMultiplier in the article title TextView.
          Note that the default value is undocumented but less than 1.0. -->
     <item name="lead_title_leading_scalar" format="float" 
type="dimen">1.05</item>
-    <item name="lead_subtitle_leading_scalar" format="float" 
type="dimen">1.17</item>
     <item name="lead_subtitle_paragraph_scalar" format="float" 
type="dimen">1.15</item>
 </resources>
\ No newline at end of file
diff --git a/app/src/main/res/values/attrs.xml 
b/app/src/main/res/values/attrs.xml
index c461d33..1acc110 100644
--- a/app/src/main/res/values/attrs.xml
+++ b/app/src/main/res/values/attrs.xml
@@ -45,6 +45,11 @@
         <attr name="minColumnWidth" format="dimension" />
     </declare-styleable>
 
+    <declare-styleable name="AppTextView">
+        <attr name="appTextViewStyle" format="reference" />
+        <attr name="leading" format="dimension" />
+    </declare-styleable>
+
     <declare-styleable name="EditTextAutoSummarizePreference">
         <attr name="editTextAutoSummarizePreferenceStyle" format="reference" />
         <attr name="autoSummarize" format="boolean" />
diff --git a/app/src/main/res/values/dimens.xml 
b/app/src/main/res/values/dimens.xml
index 239584c..2cf20cf 100644
--- a/app/src/main/res/values/dimens.xml
+++ b/app/src/main/res/values/dimens.xml
@@ -67,7 +67,6 @@
     <!-- Value for android:lineSpacingMultiplier in the article title TextView.
          Note that the default value is undocumented but less than 1.0. -->
     <item name="lead_title_leading_scalar" format="float" 
type="dimen">1.05</item>
-    <item name="lead_subtitle_leading_scalar" format="float" 
type="dimen">1.35</item>
     <item name="lead_subtitle_paragraph_scalar" format="float" 
type="dimen">1.15</item>
     <dimen name="lead_no_image_top_offset_dp">56dp</dimen>
 
diff --git a/app/src/main/res/values/styles.xml 
b/app/src/main/res/values/styles.xml
index 70bc807..0afbaf2 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -192,6 +192,9 @@
         <item name="android:divider">@null</item>
     </style>
 
+    <style name="AppTextView" parent="TextAppearance.AppCompat">
+    </style>
+
     <style name="EditTextAutoSummarizePreference" 
parent="Preference.DialogPreference.EditTextPreference.Material">
         <item 
name="android:dialogLayout">@layout/preference_dialog_edittext</item>
     </style>

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I241adb3454087f1dc1148468474c4bebc852a067
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Niedzielski <sniedziel...@wikimedia.org>
Gerrit-Reviewer: Sniedzielski <sniedziel...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to