Dbrant has uploaded a new change for review.

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

Change subject: Tweaks to gallery license icon and text.
......................................................................

Tweaks to gallery license icon and text.

- Align the license icon vertically with the description text.
- Default attribution to "fair use" when attribution metadata is empty.

- Enable the translucent search bar in 2.3, since we're now using
  getBackground().setAlpha(), which is allowed in 2.3.

Change-Id: If11bf5675e82e43fd5e54711554938287aefe54c
---
M wikipedia/res/layout/activity_gallery.xml
M wikipedia/res/values-qq/strings.xml
M wikipedia/res/values/strings.xml
M wikipedia/src/main/java/org/wikipedia/page/gallery/GalleryActivity.java
M wikipedia/src/main/java/org/wikipedia/search/SearchBarHideHandler.java
5 files changed, 28 insertions(+), 23 deletions(-)


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

diff --git a/wikipedia/res/layout/activity_gallery.xml 
b/wikipedia/res/layout/activity_gallery.xml
index dce3709..b7d584b 100644
--- a/wikipedia/res/layout/activity_gallery.xml
+++ b/wikipedia/res/layout/activity_gallery.xml
@@ -37,8 +37,6 @@
         android:layout_height="wrap_content"
         android:layout_gravity="bottom"
         android:orientation="vertical"
-        android:paddingLeft="@dimen/activity_horizontal_margin"
-        android:paddingRight="@dimen/activity_horizontal_margin"
         android:paddingBottom="32dp"
         android:paddingTop="64dp"
         android:background="@drawable/lead_title_gradient">
@@ -46,6 +44,8 @@
             android:id="@+id/gallery_description_text"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
+            android:paddingLeft="@dimen/activity_horizontal_margin"
+            android:paddingRight="@dimen/activity_horizontal_margin"
             android:maxHeight="128dp"
             android:scrollbarStyle="insideInset"
             android:scrollbars="vertical"
@@ -57,6 +57,8 @@
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_marginTop="8dp"
+            android:paddingLeft="10dp"
+            android:paddingRight="10dp"
             android:orientation="horizontal"
             android:gravity="center_vertical">
             <ImageView
diff --git a/wikipedia/res/values-qq/strings.xml 
b/wikipedia/res/values-qq/strings.xml
index aff3e10..f366028 100644
--- a/wikipedia/res/values-qq/strings.xml
+++ b/wikipedia/res/values-qq/strings.xml
@@ -362,4 +362,5 @@
   <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>
+  <string name="gallery_fair_use_license">Short name of the Fair Use license 
when applied to media that do not have attribution information.</string>
 </resources>
diff --git a/wikipedia/res/values/strings.xml b/wikipedia/res/values/strings.xml
index e6836d5..a6ff993 100644
--- a/wikipedia/res/values/strings.xml
+++ b/wikipedia/res/values/strings.xml
@@ -274,4 +274,5 @@
     <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>
+    <string name="gallery_fair_use_license">Fair use</string>
 </resources>
diff --git 
a/wikipedia/src/main/java/org/wikipedia/page/gallery/GalleryActivity.java 
b/wikipedia/src/main/java/org/wikipedia/page/gallery/GalleryActivity.java
index 7a28b96..b2b8ad1 100644
--- a/wikipedia/src/main/java/org/wikipedia/page/gallery/GalleryActivity.java
+++ b/wikipedia/src/main/java/org/wikipedia/page/gallery/GalleryActivity.java
@@ -485,7 +485,12 @@
             // and if there's no license name, then at least show usage terms.
             creditStr = item.getMetadata().get("UsageTerms");
         }
-        creditText.setText(creditStr.trim());
+        creditStr = creditStr.trim();
+        // if we couldn't find a attribution string, then default to Fair Use
+        if (TextUtils.isEmpty(creditStr)) {
+            creditStr = getString(R.string.gallery_fair_use_license);
+        }
+        creditText.setText(creditStr);
 
         infoContainer.setVisibility(View.VISIBLE);
     }
diff --git 
a/wikipedia/src/main/java/org/wikipedia/search/SearchBarHideHandler.java 
b/wikipedia/src/main/java/org/wikipedia/search/SearchBarHideHandler.java
index b97636d..19d1a5a 100644
--- a/wikipedia/src/main/java/org/wikipedia/search/SearchBarHideHandler.java
+++ b/wikipedia/src/main/java/org/wikipedia/search/SearchBarHideHandler.java
@@ -36,9 +36,7 @@
         toolbarBackground = quickReturnView.findViewById(R.id.main_toolbar);
         toolbarShadow = quickReturnView.findViewById(R.id.main_toolbar_shadow);
         toolbarGradient = 
quickReturnView.findViewById(R.id.main_toolbar_gradient);
-        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
-            toolbarGradient.setVisibility(View.GONE);
-        }
+
         colorEvaluator = new ArgbEvaluator();
         toolbarColor = 
activity.getResources().getColor(R.color.actionbar_background);
     }
@@ -88,22 +86,20 @@
 
     @Override
     public void onScrollChanged(int oldScrollY, int scrollY) {
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
-            // enable fading/translucent search bar only in API 11+
-            final int fadeHeight = 256;
-            int opacity = FULL_OPACITY;
-            if (fadeEnabled && !forceNoFade) {
-                opacity = scrollY * FULL_OPACITY / (int)(fadeHeight * 
displayDensity);
-            }
-            opacity = Math.max(0, opacity);
-            opacity = Math.min(FULL_OPACITY, opacity);
-            toolbarBackground.getBackground().setAlpha(opacity);
-            toolbarShadow.getBackground().setAlpha(opacity);
-            toolbarGradient.getBackground().setAlpha(FULL_OPACITY - opacity);
-            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
-                parentActivity.getWindow().setStatusBarColor(
-                        (int) colorEvaluator.evaluate((float)opacity / 
FULL_OPACITY, Color.BLACK, toolbarColor));
-            }
+        final int fadeHeight = 256;
+        int opacity = FULL_OPACITY;
+        if (fadeEnabled && !forceNoFade) {
+            opacity = scrollY * FULL_OPACITY / (int) (fadeHeight * 
displayDensity);
+        }
+        opacity = Math.max(0, opacity);
+        opacity = Math.min(FULL_OPACITY, opacity);
+        toolbarBackground.getBackground().setAlpha(opacity);
+        toolbarShadow.getBackground().setAlpha(opacity);
+        toolbarGradient.getBackground().setAlpha(FULL_OPACITY - opacity);
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+            parentActivity.getWindow().setStatusBarColor(
+                    (int) colorEvaluator
+                            .evaluate((float) opacity / FULL_OPACITY, 
Color.BLACK, toolbarColor));
         }
         if (scrollY <= webview.getHeight()) {
             // For the first screenful, ensure it always exists.
@@ -119,7 +115,7 @@
         } else {
             // scroll down!
             int scrollDelta = scrollY - oldScrollY;
-            if (scrollDelta > (int)(HUMAN_SCROLL_THRESHOLD * displayDensity)) {
+            if (scrollDelta > (int) (HUMAN_SCROLL_THRESHOLD * displayDensity)) 
{
                 // we've been scrolled programmatically, probably to go to
                 // a specific section, so keep the toolbar shown.
                 animMargin = 0;

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

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

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

Reply via email to