BearND has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/191915

Change subject: Fix several Lint issues
......................................................................

Fix several Lint issues

- xml: Unexpected namespace prefix "xmlns" found
- Assert: Assertions are unreliable. Use BuildConfig.DEBUG conditional checks 
instead.
- Invalid package reference in library; not included in Android: java.nio.file.
  Referenced from okio.Okio.
- IconLocation: Image defined in density-independent drawable folder
- ContentDescription: Image without contentDescription
+ Updated README

Change-Id: I0ac2c5704a4516f63ba8006be918f6bb2388e3af
---
M README.mediawiki
A wikipedia/lint.xml
M wikipedia/res/layout-land/activity_onboarding.xml
M wikipedia/res/layout/activity_about.xml
M wikipedia/res/layout/dialog_share_preview.xml
M wikipedia/res/layout/fragment_preview_edit.xml
M wikipedia/res/layout/fragment_search_results.xml
M wikipedia/res/layout/group_captcha.xml
M wikipedia/res/layout/item_history_entry.xml
M wikipedia/res/layout/item_saved_page_entry.xml
M wikipedia/res/layout/item_search_recent.xml
M wikipedia/res/values-qq/strings.xml
M wikipedia/res/values/strings.xml
M wikipedia/src/main/java/org/wikipedia/views/DisableableDrawerLayout.java
M wikipedia/src/main/java/org/wikipedia/views/FlowLayout.java
15 files changed, 81 insertions(+), 39 deletions(-)


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

diff --git a/README.mediawiki b/README.mediawiki
index 9f0c286..ce35ded 100644
--- a/README.mediawiki
+++ b/README.mediawiki
@@ -97,18 +97,21 @@
  ./gradlew -q installAlphaDebug
 
 To see ProGuard output:
-./gradlew clean --info proguardBetaRelease
+ ./gradlew clean --info proguardBetaRelease
 
 To run checkstyle:
-./gradlew checkstyle
+ ./gradlew checkstyle
+
+To run Lint:
+ ./gradlew lintAlphaDebug
 
 To run tests:
-./gradlew wikipedia:connectedAndroidTestAlphaDebug
+ ./gradlew wikipedia:connectedAndroidTestAlphaDebug
 This might take some time.
 The output will contain an HTML page with nicely formatted test results
 
 Refresh dependencies (usually not needed):
-./gradlew --refresh-dependencies
+ ./gradlew --refresh-dependencies
 
 List dependencies:
  ./gradlew wikipedia:dependencies --configuration compile
diff --git a/wikipedia/lint.xml b/wikipedia/lint.xml
new file mode 100644
index 0000000..0626891
--- /dev/null
+++ b/wikipedia/lint.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<lint>
+    <!-- https://github.com/square/okio/issues/58 -->
+    <issue id="InvalidPackage">
+        <!--<ignore regexp="okio-1.0.1.jar" />-->
+        <ignore regexp="okio-\d+\.\d+\.\d+\.jar" />
+    </issue>
+
+    <!-- Ignore the IconLocation issue in the given files -->
+    <issue id="IconLocation">
+        <!-- only used to create fixed size bitmap: -->
+        <ignore path="res/drawable/cc_by_sa_white.png" />
+
+        <!-- big images we don't want to duplicate multiple times: -->
+        <ignore path="res/drawable/lead_default.png" />
+        <ignore path="res/drawable/lead_default_dark.png" />
+        <ignore path="res/drawable/wp_globe.png" />
+        <ignore path="res/drawable/wp_wordmark.png" />
+    </issue>
+</lint>
\ No newline at end of file
diff --git a/wikipedia/res/layout-land/activity_onboarding.xml 
b/wikipedia/res/layout-land/activity_onboarding.xml
index b9cba02..8d19219 100644
--- a/wikipedia/res/layout-land/activity_onboarding.xml
+++ b/wikipedia/res/layout-land/activity_onboarding.xml
@@ -11,7 +11,7 @@
     android:paddingRight="@dimen/activity_horizontal_margin"
     android:paddingTop="@dimen/activity_vertical_margin">
 
-    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android";
+    <LinearLayout
         android:layout_width="0dp"
         android:layout_height="match_parent"
         android:layout_weight="1"
@@ -21,7 +21,7 @@
         <include layout="@layout/group_onboarding1" />
     </LinearLayout>
 
-    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android";
+    <LinearLayout
         android:layout_width="0dp"
         android:layout_height="match_parent"
         android:layout_weight="1"
diff --git a/wikipedia/res/layout/activity_about.xml 
b/wikipedia/res/layout/activity_about.xml
index 065f968..166390a 100644
--- a/wikipedia/res/layout/activity_about.xml
+++ b/wikipedia/res/layout/activity_about.xml
@@ -129,7 +129,8 @@
                 >
             <ImageView android:layout_width="wrap_content" 
android:layout_height="wrap_content"
                        android:src="@drawable/wmf_logo" android:padding="4dp"
-                    />
+                       android:contentDescription="@null"
+                       />
             <TextView android:id="@+id/about_wmf"
                       android:layout_width="0dp" 
android:layout_height="match_parent"
                       android:gravity="center_vertical" 
android:text="@string/about_wmf"
diff --git a/wikipedia/res/layout/dialog_share_preview.xml 
b/wikipedia/res/layout/dialog_share_preview.xml
index 4030b0f..ac352ac 100644
--- a/wikipedia/res/layout/dialog_share_preview.xml
+++ b/wikipedia/res/layout/dialog_share_preview.xml
@@ -5,36 +5,37 @@
     android:layout_height="wrap_content"
     android:layout_gravity="center_horizontal"
     android:background="@color/white_progressive_dark">
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android";
-    android:layout_width="wrap_content"
-    android:layout_height="wrap_content"
-    android:layout_gravity="center_horizontal"
-    android:layout_margin="0dp"
-    android:orientation="vertical">
 
-    <ImageView
-        android:id="@+id/preview_img"
+    <LinearLayout
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:layout_gravity="center_horizontal|center_vertical"
-        android:layout_marginTop="16dp"
-        android:layout_marginBottom="16dp"
-        android:scaleType="centerInside"
-        android:src="?attr/lead_image_drawable"
-        android:background="@android:color/black"
-        android:contentDescription="@string/snippet_share_preview_image_desc" 
/>
-
-    <Button
-        android:id="@+id/share_as_image_button"
-        style="@style/button_blue_on_white"
         android:layout_gravity="center_horizontal"
-        android:text="@string/share_snippet_button" />
+        android:layout_margin="0dp"
+        android:orientation="vertical">
 
-    <Button
-        android:id="@+id/share_as_text_button"
-        style="@style/button_blue_on_white"
-        android:layout_gravity="center_horizontal"
-        android:text="@string/share_normal_button" />
+        <ImageView
+            android:id="@+id/preview_img"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center_horizontal|center_vertical"
+            android:layout_marginTop="16dp"
+            android:layout_marginBottom="16dp"
+            android:scaleType="centerInside"
+            android:src="?attr/lead_image_drawable"
+            android:background="@android:color/black"
+            
android:contentDescription="@string/snippet_share_preview_image_desc" />
 
-</LinearLayout>
+        <Button
+            android:id="@+id/share_as_image_button"
+            style="@style/button_blue_on_white"
+            android:layout_gravity="center_horizontal"
+            android:text="@string/share_snippet_button" />
+
+        <Button
+            android:id="@+id/share_as_text_button"
+            style="@style/button_blue_on_white"
+            android:layout_gravity="center_horizontal"
+            android:text="@string/share_normal_button" />
+
+    </LinearLayout>
 </ScrollView>
\ No newline at end of file
diff --git a/wikipedia/res/layout/fragment_preview_edit.xml 
b/wikipedia/res/layout/fragment_preview_edit.xml
index 639d49a..678d3c5 100644
--- a/wikipedia/res/layout/fragment_preview_edit.xml
+++ b/wikipedia/res/layout/fragment_preview_edit.xml
@@ -54,7 +54,7 @@
                     android:layout_height="20dp"
                     android:src="@drawable/cc_logo"
                     android:layout_gravity="center_vertical"
-                    />
+                    android:contentDescription="@string/cc_logo" />
 
             <TextView
                     android:id="@+id/edit_section_license_text"
diff --git a/wikipedia/res/layout/fragment_search_results.xml 
b/wikipedia/res/layout/fragment_search_results.xml
index fa41da9..bba2144 100644
--- a/wikipedia/res/layout/fragment_search_results.xml
+++ b/wikipedia/res/layout/fragment_search_results.xml
@@ -37,6 +37,7 @@
                 android:layout_width="match_parent"
                 android:layout_height="match_parent"
                 android:layout_marginRight="8dp"
+                android:layout_marginEnd="8dp"
                 android:dividerHeight="0dp"
                 />
         <TextView
diff --git a/wikipedia/res/layout/group_captcha.xml 
b/wikipedia/res/layout/group_captcha.xml
index eb56475..b6fc8a0 100644
--- a/wikipedia/res/layout/group_captcha.xml
+++ b/wikipedia/res/layout/group_captcha.xml
@@ -24,6 +24,7 @@
                 android:layout_width="240dp"
                 android:scaleType="fitCenter"
                 android:layout_height="80dp"
+                android:contentDescription="@string/captcha_image"
                 />
         <ProgressBar
                 android:id="@+id/captcha_image_progress"
diff --git a/wikipedia/res/layout/item_history_entry.xml 
b/wikipedia/res/layout/item_history_entry.xml
index 1b6a197..afec2dd 100644
--- a/wikipedia/res/layout/item_history_entry.xml
+++ b/wikipedia/res/layout/item_history_entry.xml
@@ -17,12 +17,14 @@
             android:layout_height="wrap_content"
             android:orientation="horizontal"
             >
-        <ImageView android:layout_width="16dp" android:layout_height="16dp"
+        <ImageView android:layout_width="16dp"
+                   android:layout_height="16dp"
                    android:id="@+id/history_source"
                    android:layout_gravity="center_vertical"
                    android:layout_marginLeft="8dp"
                    android:layout_marginStart="8dp"
-                />
+                   android:contentDescription="@null"
+                   />
         <ImageView
                 android:id="@+id/history_thumbnail"
                 android:layout_height="32dp"
@@ -31,6 +33,7 @@
                 android:layout_gravity="center_vertical"
                 android:src="@drawable/ic_pageimage_placeholder"
                 android:background="@android:color/transparent"
+                android:contentDescription="@null"
                 />
 
         <TextView
diff --git a/wikipedia/res/layout/item_saved_page_entry.xml 
b/wikipedia/res/layout/item_saved_page_entry.xml
index 84b1beb..f8a47f6 100644
--- a/wikipedia/res/layout/item_saved_page_entry.xml
+++ b/wikipedia/res/layout/item_saved_page_entry.xml
@@ -17,11 +17,13 @@
             android:layout_height="wrap_content"
             android:orientation="horizontal"
             >
-        <ImageView android:layout_width="16dp" android:layout_height="16dp"
+        <ImageView android:layout_width="16dp"
+                   android:layout_height="16dp"
                    android:id="@+id/saved_page_source"
                    android:layout_gravity="center_vertical"
                    android:layout_marginLeft="8dp"
                    android:layout_marginStart="8dp"
+                   android:contentDescription="@null"
                 />
         <ImageView
                 android:id="@+id/saved_page_thumbnail"
diff --git a/wikipedia/res/layout/item_search_recent.xml 
b/wikipedia/res/layout/item_search_recent.xml
index ab40214..db195ab 100644
--- a/wikipedia/res/layout/item_search_recent.xml
+++ b/wikipedia/res/layout/item_search_recent.xml
@@ -4,7 +4,7 @@
     android:orientation="vertical"
     android:layout_width="match_parent"
     android:layout_height="match_parent">
-    <TextView xmlns:android="http://schemas.android.com/apk/res/android";
+    <TextView
         style="?android:textAppearanceMedium"
         android:id="@+id/text1"
         android:layout_width="wrap_content"
diff --git a/wikipedia/res/values-qq/strings.xml 
b/wikipedia/res/values-qq/strings.xml
index 398fd84..5ef76b5 100644
--- a/wikipedia/res/values-qq/strings.xml
+++ b/wikipedia/res/values-qq/strings.xml
@@ -411,4 +411,6 @@
   <string name="share_snippet_button">Button on share snippet preview to share 
as image card.</string>
   <string name="share_normal_button">Button on share snippet preview to share 
as plain text.</string>
   <string name="snippet_share_preview_image_desc">Content description for the 
share a fact preview image. This string is only used for screen 
readers.</string>
+  <string name="cc_logo">Content description of Creative Commons license logo 
icon shown before an edit is submitted.</string>
+  <string name="captcha_image">Content description of the actual captcha image 
the user has to recognize to proceed.</string>
 </resources>
diff --git a/wikipedia/res/values/strings.xml b/wikipedia/res/values/strings.xml
index 9e37f57..735304a 100644
--- a/wikipedia/res/values/strings.xml
+++ b/wikipedia/res/values/strings.xml
@@ -297,5 +297,7 @@
     <string name="share_snippet_button">Share as image</string>
     <string name="share_normal_button">Share as text</string>
     <string name="snippet_share_preview_image_desc">Preview image</string>
+    <string name="cc_logo">Creative Commons license</string>
+    <string name="captcha_image">Captcha image</string>
 
 </resources>
diff --git 
a/wikipedia/src/main/java/org/wikipedia/views/DisableableDrawerLayout.java 
b/wikipedia/src/main/java/org/wikipedia/views/DisableableDrawerLayout.java
index 2848992..503aa84 100644
--- a/wikipedia/src/main/java/org/wikipedia/views/DisableableDrawerLayout.java
+++ b/wikipedia/src/main/java/org/wikipedia/views/DisableableDrawerLayout.java
@@ -1,5 +1,6 @@
 package org.wikipedia.views;
 
+import android.annotation.SuppressLint;
 import android.content.Context;
 import android.support.v4.view.GravityCompat;
 import android.support.v4.view.ViewCompat;
@@ -58,6 +59,7 @@
                     int absGravity = 
GravityCompat.getAbsoluteGravity(((LayoutParams)pullOutView.getLayoutParams()).gravity,
                                                                       
ViewCompat.getLayoutDirection(pullOutView));
                     // Determine whether to modify the left or right dragger, 
based on RTL/LTR orientation
+                    @SuppressLint("RtlHardcoded")
                     Field mDragger = (absGravity & 
Gravity.HORIZONTAL_GRAVITY_MASK) == Gravity.LEFT
                             ? 
DisableableDrawerLayout.this.getClass().getSuperclass().getSuperclass().getDeclaredField("mLeftDragger")
                             : 
DisableableDrawerLayout.this.getClass().getSuperclass().getSuperclass().getDeclaredField("mRightDragger");
diff --git a/wikipedia/src/main/java/org/wikipedia/views/FlowLayout.java 
b/wikipedia/src/main/java/org/wikipedia/views/FlowLayout.java
index a678067..5552356 100644
--- a/wikipedia/src/main/java/org/wikipedia/views/FlowLayout.java
+++ b/wikipedia/src/main/java/org/wikipedia/views/FlowLayout.java
@@ -8,6 +8,8 @@
 import android.view.View;
 import android.view.ViewGroup;
 
+import org.wikipedia.BuildConfig;
+
 import java.util.ArrayList;
 import java.util.List;
 
@@ -34,7 +36,9 @@
 
     @Override
     protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
-        assert (MeasureSpec.getMode(widthMeasureSpec) != 
MeasureSpec.UNSPECIFIED);
+        if (BuildConfig.DEBUG && MeasureSpec.getMode(widthMeasureSpec) == 
MeasureSpec.UNSPECIFIED) {
+            throw new AssertionError();
+        }
 
         int width = MeasureSpec.getSize(widthMeasureSpec) - getPaddingLeft() - 
getPaddingRight();
         int height = MeasureSpec.getSize(heightMeasureSpec) - getPaddingTop() 
- getPaddingBottom();

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0ac2c5704a4516f63ba8006be918f6bb2388e3af
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: BearND <bsitzm...@wikimedia.org>

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

Reply via email to