jenkins-bot has submitted this change and it was merged.

Change subject: Make the status bar translucent
......................................................................


Make the status bar translucent

* Make the status translucent on API 19+. The navigation drawer is drawn
  between the status bar and the toolbar per mock. For a preview of the
  proposed toolbar coloring, change @color/actionbar_background to
  @color/preview_header_background.

  Status bar translucency was used over color to support API 19+ instead
  of 21+.

  Instead of setting android:fitsSystemWindows, status bar height
  offsets were added to the preexisting action bar offsets. This allows
  coloring of the dummy view, "StatusBarBlankView", on API 19 as well as
  sandwiching the navigation drawer between the status bar and dummy
  view per mock. There is some noticeable DRYness refactoring needed
  between the saved pages, history, and nearby Fragments but this was
  a preexisting condition.

  This patch moves the toolbar gradient initialization from PageActivity
  to SearchBarHideHandler which is a more appropriate place given the
  opacity changes made. The gradient was also expanded to include the
  status bar when translucent as it otherwise clashed with the status
  bar creating a weird, almost magnifying glass effect. It may benefit
  further from additional adjustments.

* Add StatusBarBlankView which encapsulates weird logic to set a minimum
  height matching the status bar instead of dumping it in PageActivity.
  It's just a contained, dumb View you don't have to worry about it
  much.

* Send window decor (status bar + toolbar) height across JavaScript
  bridge to apply the appropriate offset. The WebView is intentionally
  full screen, but has no knowledge of the status bar and toolbar. This
  value was previously hardcoded and not tied to the actual dimensions of
  the toolbar.

* Add ArgbEvaluatorCompat which fixes an alpha tweening bug not yet
  merged in NineOldAndroids.

Diffing notes:
* The Gerrit diffs of activity_page and fragment_page are terrible. I
  recommend diffing these files locally.
* No changes intended in SearchBarHideHandler.calculateScrollOpacity().

Bug: T110682

Change-Id: I26cc244311f44c59902afec1be0e62c9a60e4f48
---
M app/src/main/AndroidManifest.xml
M app/src/main/assets/bundle-test.js
M app/src/main/assets/bundle.js
M app/src/main/java/org/wikipedia/Utils.java
M app/src/main/java/org/wikipedia/history/HistoryFragment.java
M app/src/main/java/org/wikipedia/nearby/NearbyFragment.java
M app/src/main/java/org/wikipedia/page/PageActivity.java
M app/src/main/java/org/wikipedia/page/PageFragment.java
M app/src/main/java/org/wikipedia/page/ToCHandler.java
M app/src/main/java/org/wikipedia/page/leadimages/LeadImagesHandler.java
M app/src/main/java/org/wikipedia/page/tabs/TabsProvider.java
M app/src/main/java/org/wikipedia/savedpages/SavedPagesFragment.java
M app/src/main/java/org/wikipedia/search/SearchArticlesFragment.java
M app/src/main/java/org/wikipedia/search/SearchBarHideHandler.java
A app/src/main/java/org/wikipedia/util/ArgbEvaluatorCompat.java
M app/src/main/java/org/wikipedia/util/DimenUtil.java
A app/src/main/java/org/wikipedia/views/StatusBarBlankView.java
M app/src/main/res/drawable/splash_bg.xml
M app/src/main/res/layout/activity_page.xml
M app/src/main/res/layout/fragment_history.xml
M app/src/main/res/layout/fragment_nearby.xml
M app/src/main/res/layout/fragment_page.xml
M app/src/main/res/layout/fragment_saved_pages.xml
M app/src/main/res/layout/fragment_search.xml
M app/src/main/res/layout/inflate_header_nav_drawer.xml
M app/src/main/res/layout/item_tab_entry.xml
M app/src/main/res/values/colors.xml
M app/src/main/res/values/dimens.xml
M app/src/main/res/values/styles.xml
M www/js/main.js
M www/js/sections.js
M www/js/transformer.js
M www/js/transforms/collapseTables.js
33 files changed, 559 insertions(+), 321 deletions(-)

Approvals:
  Mholloway: Looks good to me, approved
  Dbrant: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 19d9642..5c4f65b 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -44,7 +44,7 @@
         <!-- Don't delete the meta-data field above -->
 
         <activity android:name=".page.PageActivity"
-                  android:theme="@style/NoTitle"
+                  android:theme="@style/PageTheme"
                   android:windowSoftInputMode="stateHidden"
                   android:configChanges="orientation|screenSize"
                   android:launchMode="singleTask">
diff --git a/app/src/main/assets/bundle-test.js 
b/app/src/main/assets/bundle-test.js
index 9344b9c..01a24cf 100644
--- a/app/src/main/assets/bundle-test.js
+++ b/app/src/main/assets/bundle-test.js
@@ -60,6 +60,7 @@
 };
 },{"./bridge":1}],3:[function(require,module,exports){
 var bridge = require( "./bridge" );
+var transformer = require("./transformer");
 
 bridge.registerListener( "requestImagesList", function( payload ) {
     var imageURLs = [];
@@ -107,7 +108,41 @@
     }
 } );
 
-},{"./bridge":1}],4:[function(require,module,exports){
+bridge.registerListener( "setDecorOffset", function( payload ) {
+    transformer.setDecorOffset(payload.offset);
+} );
+},{"./bridge":1,"./transformer":4}],4:[function(require,module,exports){
+function Transformer() {
+}
+
+var transforms = {};
+var decorOffset = 0; // The height of the toolbar and, when translucent, 
status bar in CSS pixels.
+
+Transformer.prototype.register = function( transform, fun ) {
+    if ( transform in transforms ) {
+        transforms[transform].push( fun );
+    } else {
+        transforms[transform] = [ fun ];
+    }
+};
+
+Transformer.prototype.transform = function( transform, element ) {
+    var functions = transforms[transform];
+    for ( var i = 0; i < functions.length; i++ ) {
+        element = functions[i](element);
+    }
+};
+
+Transformer.prototype.getDecorOffset = function() {
+    return decorOffset;
+};
+
+Transformer.prototype.setDecorOffset = function(offset) {
+    decorOffset = offset;
+};
+
+module.exports = new Transformer();
+},{}],5:[function(require,module,exports){
 /**
  * MIT LICENSCE
  * From: https://github.com/remy/polyfills
@@ -184,16 +219,16 @@
 
 })();
 
-},{}],5:[function(require,module,exports){
+},{}],6:[function(require,module,exports){
 var bridge = require("../js/bridge");
 bridge.registerListener( "injectScript", function( payload ) {
     require(payload.src);
 });
-},{"../js/bridge":1}],6:[function(require,module,exports){
+},{"../js/bridge":1}],7:[function(require,module,exports){
 var bridge = require("../js/bridge");
 console.log("Something!");
 bridge.registerListener( "ping", function( payload ) {
     bridge.sendMessage( "pong", payload );
 });
 
-},{"../js/bridge":1}]},{},[2,3,1,5,6,4])
\ No newline at end of file
+},{"../js/bridge":1}]},{},[2,3,1,6,7,5])
\ No newline at end of file
diff --git a/app/src/main/assets/bundle.js b/app/src/main/assets/bundle.js
index d2fbf2d..d91e474 100644
--- a/app/src/main/assets/bundle.js
+++ b/app/src/main/assets/bundle.js
@@ -239,6 +239,7 @@
 };
 },{"./bridge":2}],7:[function(require,module,exports){
 var bridge = require( "./bridge" );
+var transformer = require("./transformer");
 
 bridge.registerListener( "requestImagesList", function( payload ) {
     var imageURLs = [];
@@ -286,7 +287,10 @@
     }
 } );
 
-},{"./bridge":2}],8:[function(require,module,exports){
+bridge.registerListener( "setDecorOffset", function( payload ) {
+    transformer.setDecorOffset(payload.offset);
+} );
+},{"./bridge":2,"./transformer":12}],8:[function(require,module,exports){
 var bridge = require("./bridge");
 var loader = require("./loader");
 var utilities = require("./utilities");
@@ -620,7 +624,7 @@
         window.scrollTo( 0, 0 );
     } else {
         var el = document.getElementById( anchor );
-        var scrollY = el.offsetTop - 48;
+        var scrollY = el.offsetTop - transformer.getDecorOffset();
         window.scrollTo( 0, scrollY );
     }
 }
@@ -662,6 +666,7 @@
 }
 
 var transforms = {};
+var decorOffset = 0; // The height of the toolbar and, when translucent, 
status bar in CSS pixels.
 
 Transformer.prototype.register = function( transform, fun ) {
     if ( transform in transforms ) {
@@ -678,8 +683,15 @@
     }
 };
 
-module.exports = new Transformer();
+Transformer.prototype.getDecorOffset = function() {
+    return decorOffset;
+};
 
+Transformer.prototype.setDecorOffset = function(offset) {
+    decorOffset = offset;
+};
+
+module.exports = new Transformer();
 },{}],13:[function(require,module,exports){
 var transformer = require("../transformer");
 var night = require("../night");
@@ -818,7 +830,7 @@
         divBottom.style.display = 'none';
         //if they clicked the bottom div, then scroll back up to the top of 
the table.
         if (this === divBottom) {
-            window.scrollTo( 0, container.offsetTop - 48 );
+            window.scrollTo( 0, container.offsetTop - 
transformer.getDecorOffset() );
         }
     } else {
         tableFull.style.display = 'block';
@@ -1436,4 +1448,4 @@
     bridge.sendMessage( "pong", payload );
 });
 
-},{"../js/bridge":2}]},{},[2,7,24,12,13,14,15,16,17,18,19,20,21,22,23,1,3,4,5,6,8,9,10,11,25,26,27])
+},{"../js/bridge":2}]},{},[2,7,24,12,13,14,15,16,17,18,19,20,21,22,23,1,3,4,5,6,8,9,10,11,25,26,27])
\ No newline at end of file
diff --git a/app/src/main/java/org/wikipedia/Utils.java 
b/app/src/main/java/org/wikipedia/Utils.java
index 4f86175..118f588 100644
--- a/app/src/main/java/org/wikipedia/Utils.java
+++ b/app/src/main/java/org/wikipedia/Utils.java
@@ -10,6 +10,7 @@
 import android.content.res.TypedArray;
 import android.net.Uri;
 import android.os.Looper;
+import android.support.annotation.DimenRes;
 import android.support.annotation.NonNull;
 import android.support.v7.app.AlertDialog;
 import android.text.Html;
@@ -30,6 +31,7 @@
 import org.wikipedia.interlanguage.LanguageUtil;
 import org.wikipedia.settings.Prefs;
 import org.wikipedia.util.ApiUtil;
+import org.wikipedia.util.DimenUtil;
 import org.wikipedia.util.ShareUtils;
 
 import java.io.BufferedReader;
@@ -536,22 +538,60 @@
         return tv.resourceId;
     }
 
+    public static int getContentTopOffsetPx(Context context) {
+        return DimenUtil.roundedDpToPx(getContentTopOffset(context));
+    }
+
+    public static float getContentTopOffset(Context context) {
+        return getToolbarHeight(context) + 
getTranslucentStatusBarHeight(context);
+    }
+
+    public static int getTranslucentStatusBarHeightPx(Context context) {
+        return DimenUtil.roundedDpToPx(getTranslucentStatusBarHeight(context));
+    }
+
+    /** @return Height of status bar if translucency is enabled, zero 
otherwise. */
+    public static float getTranslucentStatusBarHeight(Context context) {
+        return isStatusBarTranslucent() ? getStatusBarHeight(context) : 0;
+    }
+
+    private static int getStatusBarHeightPx(Context context) {
+        return DimenUtil.roundedDpToPx(getStatusBarHeight(context));
+    }
+
+    private static float getStatusBarHeight(Context context) {
+        int id = getStatusBarId(context);
+        return id > 0 ? DimenUtil.getDimension(id) : 0;
+    }
+
+    private static float getToolbarHeight(Context context) {
+        return DimenUtil.roundedPxToDp(getToolbarHeightPx(context));
+    }
+
     /**
-     * Returns the height of the ActionBar in the current activity. The system 
controls the
-     * height of the ActionBar, which may be slightly different depending on 
screen orientation,
-     * and device version.
+     * Returns the height of the toolbar in the current activity. The system 
controls the height of
+     * the toolbar, which may be slightly different depending on screen 
orientation, and device
+     * version.
      * @param context Context used for retrieving the height attribute.
-     * @return Height of the ActionBar.
+     * @return Height of the toolbar.
      */
-    public static int getActionBarSize(Context context) {
+    private static int getToolbarHeightPx(Context context) {
         final TypedArray styledAttributes = 
context.getTheme().obtainStyledAttributes(new int[] {
                 android.support.v7.appcompat.R.attr.actionBarSize
         });
-        int size = (int)styledAttributes.getDimension(0, 0);
+        int size = styledAttributes.getDimensionPixelSize(0, 0);
         styledAttributes.recycle();
         return size;
     }
 
+    private static boolean isStatusBarTranslucent() {
+        return ApiUtil.hasKitKat();
+    }
+
+    @DimenRes private static int getStatusBarId(Context context) {
+        return context.getResources().getIdentifier("status_bar_height", 
"dimen", "android");
+    }
+
     /**
      * Returns the distribution channel for the app from AndroidManifest.xml
      * @return The channel (the empty string if not defined)
diff --git a/app/src/main/java/org/wikipedia/history/HistoryFragment.java 
b/app/src/main/java/org/wikipedia/history/HistoryFragment.java
index f00fd46..5eecf48 100644
--- a/app/src/main/java/org/wikipedia/history/HistoryFragment.java
+++ b/app/src/main/java/org/wikipedia/history/HistoryFragment.java
@@ -28,6 +28,7 @@
 
 import org.wikipedia.BackPressedHandler;
 import org.wikipedia.R;
+import org.wikipedia.Utils;
 import org.wikipedia.WikipediaApp;
 import org.wikipedia.page.PageActivity;
 import org.wikipedia.pageimages.PageImage;
@@ -62,6 +63,7 @@
     @Override
     public View onCreateView(LayoutInflater inflater, ViewGroup container, 
Bundle savedInstanceState) {
         View rootView = inflater.inflate(R.layout.fragment_history, container, 
false);
+        rootView.setPadding(0, Utils.getContentTopOffsetPx(getActivity()), 0, 
0);
 
         historyEntryList = (ListView) 
rootView.findViewById(R.id.history_entry_list);
         historyEmptyContainer = 
rootView.findViewById(R.id.history_empty_container);
diff --git a/app/src/main/java/org/wikipedia/nearby/NearbyFragment.java 
b/app/src/main/java/org/wikipedia/nearby/NearbyFragment.java
index 281c6b5..0c49e32 100644
--- a/app/src/main/java/org/wikipedia/nearby/NearbyFragment.java
+++ b/app/src/main/java/org/wikipedia/nearby/NearbyFragment.java
@@ -122,6 +122,7 @@
     @Override
     public View onCreateView(LayoutInflater inflater, ViewGroup container, 
Bundle savedInstanceState) {
         View rootView = inflater.inflate(R.layout.fragment_nearby, container, 
false);
+        rootView.setPadding(0, Utils.getContentTopOffsetPx(getActivity()), 0, 
0);
 
         nearbyList = (ListView) rootView.findViewById(R.id.nearby_list);
         nearbyEmptyContainer = 
rootView.findViewById(R.id.nearby_empty_container);
diff --git a/app/src/main/java/org/wikipedia/page/PageActivity.java 
b/app/src/main/java/org/wikipedia/page/PageActivity.java
index 73bb990..5103d8d 100644
--- a/app/src/main/java/org/wikipedia/page/PageActivity.java
+++ b/app/src/main/java/org/wikipedia/page/PageActivity.java
@@ -28,9 +28,7 @@
 import org.wikipedia.tooltip.ToolTipUtil;
 import org.wikipedia.util.ApiUtil;
 import org.wikipedia.util.FeedbackUtil;
-import org.wikipedia.util.GradientUtil;
 import org.wikipedia.util.log.L;
-import org.wikipedia.views.ViewUtil;
 import org.wikipedia.views.WikiDrawerLayout;
 import org.wikipedia.zero.WikipediaZeroHandler;
 import org.wikipedia.widgets.WidgetProviderFeaturedPage;
@@ -67,7 +65,6 @@
 import android.text.TextUtils;
 import android.text.format.DateUtils;
 import android.util.Log;
-import android.view.Gravity;
 import android.view.KeyEvent;
 import android.view.Menu;
 import android.view.MenuItem;
@@ -243,10 +240,6 @@
         getSupportActionBar().setTitle("");
 
         searchBarHideHandler = new SearchBarHideHandler(this, 
toolbarContainer);
-
-        // create a gradient for the toolbar
-        
ViewUtil.setBackgroundDrawable(findViewById(R.id.main_toolbar_gradient), 
GradientUtil
-                
.getCubicGradient(getResources().getColor(R.color.lead_gradient_start), 
Gravity.TOP));
 
         // TODO: remove this when we drop support for API 10
         boolean themeChanged = false;
diff --git a/app/src/main/java/org/wikipedia/page/PageFragment.java 
b/app/src/main/java/org/wikipedia/page/PageFragment.java
index 183c7a5..71175d9 100755
--- a/app/src/main/java/org/wikipedia/page/PageFragment.java
+++ b/app/src/main/java/org/wikipedia/page/PageFragment.java
@@ -235,7 +235,7 @@
 
         refreshView = (SwipeRefreshLayoutWithScroll) rootView
                 .findViewById(R.id.page_refresh_container);
-        int swipeOffset = Utils.getActionBarSize(getActivity()) + 
REFRESH_SPINNER_ADDITIONAL_OFFSET;
+        int swipeOffset = Utils.getContentTopOffsetPx(getActivity()) + 
REFRESH_SPINNER_ADDITIONAL_OFFSET;
         refreshView.setProgressViewOffset(false, -swipeOffset, swipeOffset);
         // if we want to give it a custom color:
         //refreshView.setProgressBackgroundColor(R.color.swipe_refresh_circle);
@@ -271,6 +271,7 @@
 
         bridge = new CommunicationBridge(webView, 
"file:///android_asset/index.html");
         setupMessageHandlers();
+        sendDecorOffsetMessage();
 
         linkHandler = new LinkHandler(getActivity(), bridge) {
             @Override
@@ -499,6 +500,7 @@
     @Override
     public void onConfigurationChanged(Configuration newConfig) {
         super.onConfigurationChanged(newConfig);
+        sendDecorOffsetMessage();
         // if the screen orientation changes, then re-layout the lead image 
container,
         // but only if we've finished fetching the page.
         if (!pageLoadStrategy.isLoading()) {
@@ -1102,6 +1104,16 @@
         }
     }
 
+    private void sendDecorOffsetMessage() {
+        JSONObject payload = new JSONObject();
+        try {
+            payload.put("offset", Utils.getContentTopOffset(getActivity()));
+        } catch (JSONException e) {
+            throw new RuntimeException(e);
+        }
+        bridge.sendMessage("setDecorOffset", payload);
+    }
+
     // TODO: don't assume host is PageActivity. Use Fragment callbacks pattern.
     private PageActivity getPageActivity() {
         return (PageActivity) getActivity();
diff --git a/app/src/main/java/org/wikipedia/page/ToCHandler.java 
b/app/src/main/java/org/wikipedia/page/ToCHandler.java
index 1ceb94b..dbe522f 100755
--- a/app/src/main/java/org/wikipedia/page/ToCHandler.java
+++ b/app/src/main/java/org/wikipedia/page/ToCHandler.java
@@ -57,6 +57,7 @@
         this.slidingPane = slidingPane;
 
         this.tocList = (ListView) slidingPane.findViewById(R.id.page_toc_list);
+        ((LinearLayout.LayoutParams) tocList.getLayoutParams()).setMargins(0, 
Utils.getContentTopOffsetPx(activity), 0, 0);
         this.tocProgress = (ProgressBar) 
slidingPane.findViewById(R.id.page_toc_in_progress);
 
         bridge.addListener("currentSectionResponse", new 
CommunicationBridge.JSEventListener() {
@@ -133,7 +134,6 @@
         try {
             payload.put("anchor", sectionAnchor);
         } catch (JSONException e) {
-            // This won't happen
             throw new RuntimeException(e);
         }
         bridge.sendMessage("scrollToSection", payload);
diff --git 
a/app/src/main/java/org/wikipedia/page/leadimages/LeadImagesHandler.java 
b/app/src/main/java/org/wikipedia/page/leadimages/LeadImagesHandler.java
index d7f43ae..bba378e 100755
--- a/app/src/main/java/org/wikipedia/page/leadimages/LeadImagesHandler.java
+++ b/app/src/main/java/org/wikipedia/page/leadimages/LeadImagesHandler.java
@@ -299,7 +299,7 @@
         int titleContainerHeight;
 
         if (isMainPage()) {
-            titleContainerHeight = (int) 
(Utils.getActionBarSize(getActivity()) / displayDensity);
+            titleContainerHeight = (int) 
(Utils.getContentTopOffsetPx(getActivity()) / displayDensity);
             hideLeadSection();
         } else if (!leadImagesEnabled) {
             // ok, we're not going to show lead images, so we need to make some
diff --git a/app/src/main/java/org/wikipedia/page/tabs/TabsProvider.java 
b/app/src/main/java/org/wikipedia/page/tabs/TabsProvider.java
index 80adf08..d14636d 100644
--- a/app/src/main/java/org/wikipedia/page/tabs/TabsProvider.java
+++ b/app/src/main/java/org/wikipedia/page/tabs/TabsProvider.java
@@ -201,20 +201,20 @@
         final float proportionHorz = 0.15f;
         final float proportionVert = 0.4f;
         final int heightOffset = 16;
-        int toolbarHeight = Utils.getActionBarSize(parentActivity);
+        int contentOffset = Utils.getContentTopOffsetPx(parentActivity);
         int maxHeight = (int) (pageContentView.getHeight() * proportionVert
                                + pageContentView.getHeight() * proportionHorz
-                               - toolbarHeight - heightOffset * 
displayDensity);
+                               - contentOffset - heightOffset * 
displayDensity);
         FrameLayout.LayoutParams params = new 
FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, maxHeight);
         float margin = pageContentView.getWidth() * proportionHorz / 2f;
         if (ApiUtil.hasHoneyComb()) {
             params.leftMargin = (int) margin;
             params.rightMargin = (int) margin;
-            params.topMargin = toolbarHeight;
+            params.topMargin = contentOffset;
         } else {
             // for 2.3, use padding instead of margin, for some reason.
-            tabListView.setPadding((int) margin, toolbarHeight, (int) margin, 
0);
-            params.height += toolbarHeight;
+            tabListView.setPadding((int) margin, contentOffset, (int) margin, 
0);
+            params.height += contentOffset;
             params.leftMargin = 0;
             params.rightMargin = 0;
             params.topMargin = 0;
diff --git a/app/src/main/java/org/wikipedia/savedpages/SavedPagesFragment.java 
b/app/src/main/java/org/wikipedia/savedpages/SavedPagesFragment.java
index d4da830..627c63c 100644
--- a/app/src/main/java/org/wikipedia/savedpages/SavedPagesFragment.java
+++ b/app/src/main/java/org/wikipedia/savedpages/SavedPagesFragment.java
@@ -33,6 +33,7 @@
 
 import org.wikipedia.BackPressedHandler;
 import org.wikipedia.R;
+import org.wikipedia.Utils;
 import org.wikipedia.WikipediaApp;
 import org.wikipedia.history.HistoryEntry;
 import org.wikipedia.page.PageActivity;
@@ -71,6 +72,7 @@
     @Override
     public View onCreateView(LayoutInflater inflater, ViewGroup container, 
Bundle savedInstanceState) {
         View rootView = inflater.inflate(R.layout.fragment_saved_pages, 
container, false);
+        rootView.setPadding(0, Utils.getContentTopOffsetPx(getActivity()), 0, 
0);
 
         savedPagesList = (ListView) 
rootView.findViewById(R.id.saved_pages_list);
         savedPagesEmptyContainer = 
rootView.findViewById(R.id.saved_pages_empty_container);
diff --git a/app/src/main/java/org/wikipedia/search/SearchArticlesFragment.java 
b/app/src/main/java/org/wikipedia/search/SearchArticlesFragment.java
index 4d4d897..d08097a 100644
--- a/app/src/main/java/org/wikipedia/search/SearchArticlesFragment.java
+++ b/app/src/main/java/org/wikipedia/search/SearchArticlesFragment.java
@@ -100,6 +100,7 @@
         View parentLayout = inflater.inflate(R.layout.fragment_search, 
container, false);
 
         searchContainerView = parentLayout.findViewById(R.id.search_container);
+        searchContainerView.setPadding(0, 
Utils.getContentTopOffsetPx(getActivity()), 0, 0);
         searchContainerView.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View view) {
diff --git a/app/src/main/java/org/wikipedia/search/SearchBarHideHandler.java 
b/app/src/main/java/org/wikipedia/search/SearchBarHideHandler.java
index 694d15d..c2da7d6 100644
--- a/app/src/main/java/org/wikipedia/search/SearchBarHideHandler.java
+++ b/app/src/main/java/org/wikipedia/search/SearchBarHideHandler.java
@@ -1,25 +1,26 @@
 package org.wikipedia.search;
 
 import android.app.Activity;
-import android.graphics.Color;
+import android.support.annotation.ColorInt;
+import android.view.Gravity;
 import android.view.View;
 
-import com.nineoldandroids.animation.ArgbEvaluator;
 import com.nineoldandroids.view.ViewHelper;
 
 import org.wikipedia.R;
 import org.wikipedia.ViewAnimations;
-import org.wikipedia.util.ApiUtil;
+import org.wikipedia.util.ArgbEvaluatorCompat;
+import org.wikipedia.util.GradientUtil;
 import org.wikipedia.views.ObservableWebView;
+import org.wikipedia.views.ViewUtil;
 
 public class SearchBarHideHandler implements 
ObservableWebView.OnScrollChangeListener, 
ObservableWebView.OnUpOrCancelMotionEventListener, 
ObservableWebView.OnDownMotionEventListener {
     private static final int HUMAN_SCROLL_THRESHOLD = 200;
     private static final int FULL_OPACITY = 255;
-    private final Activity parentActivity;
     private final View quickReturnView;
     private final float displayDensity;
     private final int toolbarColor;
-    private final ArgbEvaluator colorEvaluator;
+    private final ArgbEvaluatorCompat colorEvaluator;
 
     private ObservableWebView webview;
     private boolean fadeEnabled = false;
@@ -27,18 +28,20 @@
     private View toolbarBackground;
     private View toolbarGradient;
     private View toolbarShadow;
+    private View statusBar;
 
     public SearchBarHideHandler(Activity activity, View quickReturnView) {
-        this.parentActivity = activity;
         this.quickReturnView =  quickReturnView;
         this.displayDensity = 
quickReturnView.getResources().getDisplayMetrics().density;
 
         toolbarBackground = quickReturnView.findViewById(R.id.main_toolbar);
         toolbarShadow = quickReturnView.findViewById(R.id.main_toolbar_shadow);
-        toolbarGradient = 
quickReturnView.findViewById(R.id.main_toolbar_gradient);
+        toolbarGradient = quickReturnView;
+        initToolbarGradient();
 
-        colorEvaluator = new ArgbEvaluator();
+        colorEvaluator = new ArgbEvaluatorCompat();
         toolbarColor = 
activity.getResources().getColor(R.color.actionbar_background);
+        statusBar = quickReturnView.findViewById(R.id.empty_status_bar);
     }
 
     /**
@@ -86,21 +89,13 @@
 
     @Override
     public void onScrollChanged(int oldScrollY, int scrollY) {
-        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);
+        int opacity = calculateScrollOpacity(scrollY);
         toolbarBackground.getBackground().setAlpha(opacity);
         toolbarShadow.getBackground().setAlpha(opacity);
         toolbarGradient.getBackground().setAlpha(FULL_OPACITY - opacity);
-        if (ApiUtil.hasLollipop()) {
-            parentActivity.getWindow().setStatusBarColor(
-                    (int) colorEvaluator
-                            .evaluate((float) opacity / FULL_OPACITY, 
Color.BLACK, toolbarColor));
-        }
+
+        int color = calculateScrollStatusBarColorTween(opacity);
+        statusBar.setBackgroundColor(color);
         if (scrollY <= webview.getHeight()) {
             // For the first screenful, ensure it always exists.
             ViewAnimations.ensureTranslationY(quickReturnView, 0);
@@ -147,4 +142,28 @@
     public void onDownMotionEvent() {
         // Don't do anything for now
     }
+
+    private void initToolbarGradient() {
+        @ColorInt int baseColor = 
toolbarGradient.getResources().getColor(R.color.lead_gradient_start);
+        ViewUtil.setBackgroundDrawable(toolbarGradient,
+                GradientUtil.getCubicGradient(baseColor, Gravity.TOP));
+    }
+
+    /** @return Alpha value between 0 and 0xff. */
+    private int calculateScrollOpacity(int scrollY) {
+        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);
+        return opacity;
+    }
+
+    @ColorInt private int calculateScrollStatusBarColorTween(int opacity) {
+        final int alphaMask = 0xff000000;
+        return (int) colorEvaluator.evaluate((float) opacity / FULL_OPACITY,
+                toolbarColor & ~alphaMask, toolbarColor);
+    }
 }
diff --git a/app/src/main/java/org/wikipedia/util/ArgbEvaluatorCompat.java 
b/app/src/main/java/org/wikipedia/util/ArgbEvaluatorCompat.java
new file mode 100644
index 0000000..aba7488
--- /dev/null
+++ b/app/src/main/java/org/wikipedia/util/ArgbEvaluatorCompat.java
@@ -0,0 +1,33 @@
+package org.wikipedia.util;
+
+import com.nineoldandroids.animation.ArgbEvaluator;
+
+public class ArgbEvaluatorCompat extends ArgbEvaluator {
+    private static final int A_SHIFT = 24;
+    private static final int R_SHIFT = 16;
+    private static final int G_SHIFT = 8;
+    private static final int UINT8_MASK = 0xff;
+
+    @Override
+    // Fix arithmetic shift of alpha. TODO: remove when nineoldandroids 
updated. See
+    // * https://android.googlesource.com/platform/frameworks/base/+/9b55998
+    // * 
https://github.com/JakeWharton/NineOldAndroids/commit/c91cb488f56b73aa81546a9fd5039ee99167be54
+    public Object evaluate(float fraction, Object startValue, Object endValue) 
{
+        int startInt = (Integer) startValue;
+        int startA = (startInt >> A_SHIFT) & UINT8_MASK;
+        int startR = (startInt >> R_SHIFT) & UINT8_MASK;
+        int startG = (startInt >> G_SHIFT) & UINT8_MASK;
+        int startB = startInt & UINT8_MASK;
+
+        int endInt = (Integer) endValue;
+        int endA = (endInt >> A_SHIFT) & UINT8_MASK;
+        int endR = (endInt >> R_SHIFT) & UINT8_MASK;
+        int endG = (endInt >> G_SHIFT) & UINT8_MASK;
+        int endB = endInt & UINT8_MASK;
+
+        return ((startA + (int)(fraction * (endA - startA))) << A_SHIFT)
+                | ((startR + (int)(fraction * (endR - startR))) << R_SHIFT)
+                | ((startG + (int)(fraction * (endG - startG))) << G_SHIFT)
+                | ((startB + (int)(fraction * (endB - startB))));
+    }
+}
\ No newline at end of file
diff --git a/app/src/main/java/org/wikipedia/util/DimenUtil.java 
b/app/src/main/java/org/wikipedia/util/DimenUtil.java
index a571096..e7f1901 100644
--- a/app/src/main/java/org/wikipedia/util/DimenUtil.java
+++ b/app/src/main/java/org/wikipedia/util/DimenUtil.java
@@ -4,6 +4,7 @@
 import android.content.res.Resources;
 import android.graphics.Point;
 import android.os.Build;
+import android.support.annotation.DimenRes;
 import android.util.DisplayMetrics;
 import android.util.TypedValue;
 import android.view.Display;
@@ -29,8 +30,23 @@
         return getDisplayMetrics().density;
     }
 
+    /** @return Dimension in dp. */
+    public static float getDimension(@DimenRes int id) {
+        return TypedValue.complexToFloat(getValue(id).data);
+    }
+
+    private static TypedValue getValue(@DimenRes int id) {
+        TypedValue typedValue = new TypedValue();
+        getResources().getValue(id, typedValue, true);
+        return typedValue;
+    }
+
     private static DisplayMetrics getDisplayMetrics() {
-        return Resources.getSystem().getDisplayMetrics();
+        return getResources().getDisplayMetrics();
+    }
+
+    private static Resources getResources() {
+        return Resources.getSystem();
     }
 
     /**
diff --git a/app/src/main/java/org/wikipedia/views/StatusBarBlankView.java 
b/app/src/main/java/org/wikipedia/views/StatusBarBlankView.java
new file mode 100644
index 0000000..3612a36
--- /dev/null
+++ b/app/src/main/java/org/wikipedia/views/StatusBarBlankView.java
@@ -0,0 +1,52 @@
+package org.wikipedia.views;
+
+import android.annotation.TargetApi;
+import android.content.Context;
+import android.os.Build;
+import android.util.AttributeSet;
+import android.view.View;
+
+import org.wikipedia.Utils;
+
+/**
+ * Blank View that properly sizes itself to the same height as the translucent 
status bar for
+ * offsetting.
+ */
+public class StatusBarBlankView extends View {
+    public StatusBarBlankView(Context context) {
+        this(context, null);
+    }
+
+    public StatusBarBlankView(Context context, AttributeSet attrs) {
+        this(context, attrs, 0);
+    }
+
+    public StatusBarBlankView(Context context, AttributeSet attrs, int 
defStyleAttr) {
+        super(context, attrs, defStyleAttr);
+    }
+
+    @TargetApi(Build.VERSION_CODES.LOLLIPOP)
+    public StatusBarBlankView(Context context, AttributeSet attrs, int 
defStyleAttr, int defStyleRes) {
+        super(context, attrs, defStyleAttr, defStyleRes);
+    }
+
+    /**
+     * The super implementation uses {@link View#getDefaultSize} which 
defaults to maximum allowed
+     * size for wrap_content ({@link MeasureSpec#AT_MOST}). This 
implementation mimics
+     * {@link android.widget.FrameLayout}'s behavior except without children.
+     */
+    @Override
+    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+        setMeasuredDimension(resolveSizeAndState(getSuggestedMinimumWidth(), 
widthMeasureSpec, 0),
+                resolveSizeAndState(getSuggestedMinimumHeight(), 
heightMeasureSpec, 0));
+    }
+
+    @Override
+    protected int getSuggestedMinimumHeight() {
+        return Math.max(super.getSuggestedMinimumHeight(), 
getTranslucentStatusBarHeightPx());
+    }
+
+    private int getTranslucentStatusBarHeightPx() {
+        return Utils.getTranslucentStatusBarHeightPx(getContext());
+    }
+}
\ No newline at end of file
diff --git a/app/src/main/res/drawable/splash_bg.xml 
b/app/src/main/res/drawable/splash_bg.xml
index 57f520a..aeb694e 100644
--- a/app/src/main/res/drawable/splash_bg.xml
+++ b/app/src/main/res/drawable/splash_bg.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <layer-list xmlns:android="http://schemas.android.com/apk/res/android";>
-    <item android:drawable="@color/actionbar_background" />
+    <item android:drawable="@color/window_background" />
     <item>
         <!-- Use a bitmap element with centered gravity to prevent scaling. -->
         <bitmap
diff --git a/app/src/main/res/layout/activity_page.xml 
b/app/src/main/res/layout/activity_page.xml
index d62e1ed..93b854a 100644
--- a/app/src/main/res/layout/activity_page.xml
+++ b/app/src/main/res/layout/activity_page.xml
@@ -16,8 +16,7 @@
         <FrameLayout
             android:id="@+id/content_fragment_container"
             android:layout_width="match_parent"
-            android:layout_height="match_parent">
-        </FrameLayout>
+            android:layout_height="match_parent" />
 
         <!-- The tabs container -->
         <FrameLayout
@@ -43,129 +42,123 @@
             android:layout_height="match_parent"
             android:id="@+id/search_fragment"
             android:name="org.wikipedia.search.SearchArticlesFragment"
-            tools:layout="@layout/fragment_search"/>
+            tools:layout="@layout/fragment_search" />
 
-        <FrameLayout
+        <LinearLayout
             android:id="@+id/main_toolbar_container"
             android:layout_width="match_parent"
-            android:layout_height="80dp">
-            <LinearLayout
-                android:id="@+id/main_toolbar_gradient"
+            android:layout_height="wrap_content"
+            android:orientation="vertical">
+            <org.wikipedia.views.StatusBarBlankView
+                android:id="@+id/empty_status_bar"
                 android:layout_width="match_parent"
-                android:layout_height="match_parent"
-                android:orientation="vertical">
-            </LinearLayout>
-            <LinearLayout
+                android:layout_height="wrap_content" />
+            <FrameLayout
                 android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:orientation="vertical">
-                <FrameLayout
+                android:layout_height="wrap_content">
+                <android.support.v7.widget.Toolbar
+                    android:theme="@style/AppTheme.ToolbarTheme"
+                    android:id="@+id/main_toolbar"
+                    android:background="@color/main_toolbar_background"
                     android:layout_width="match_parent"
-                    android:layout_height="wrap_content">
-                    <android.support.v7.widget.Toolbar
-                        android:theme="@style/AppTheme.ToolbarTheme"
-                        android:id="@+id/main_toolbar"
-                        android:background="@color/main_toolbar_background"
+                    android:layout_height="?attr/actionBarSize">
+                    <FrameLayout
+                        android:id="@+id/main_toolbar_inner_container"
                         android:layout_width="match_parent"
-                        android:layout_height="?attr/actionBarSize">
-                        <FrameLayout
-                            android:id="@+id/main_toolbar_inner_container"
+                        android:layout_height="match_parent">
+                        <TextView
+                            android:id="@+id/main_search_bar_text"
                             android:layout_width="match_parent"
-                            android:layout_height="match_parent">
-                            <TextView
-                                android:id="@+id/main_search_bar_text"
-                                android:layout_width="match_parent"
+                            android:layout_height="36dp"
+                            android:layout_marginLeft="4dp"
+                            android:layout_marginRight="4dp"
+                            android:paddingLeft="6dp"
+                            android:paddingRight="6dp"
+                            android:gravity="center_vertical"
+                            android:text="@string/search_hint"
+                            android:textColor="@android:color/white"
+                            android:textSize="@dimen/searchTextSize"
+                            android:singleLine="true"
+                            android:ellipsize="end"
+                            
android:background="?attr/selectableItemBackgroundBorderless"
+                            android:shadowColor="@color/lead_text_shadow"
+                            android:shadowDx="1"
+                            android:shadowDy="1"
+                            android:shadowRadius="2"
+                            android:layout_gravity="center_vertical"
+                            android:drawableStart="@drawable/ic_search"
+                            android:drawableLeft="@drawable/ic_search"
+                            android:drawablePadding="6dp"/>
+                        <LinearLayout
+                            android:id="@+id/search_bar_enabled"
+                            android:layout_width="match_parent"
+                            android:layout_height="36dp"
+                            android:orientation="horizontal"
+                            android:layout_gravity="center_vertical"
+                            android:layout_marginLeft="4dp"
+                            android:layout_marginRight="4dp"
+                            style="@style/AppTheme.SearchViewStyle"
+                            android:visibility="gone">
+                            <org.wikipedia.views.CabSearchView
+                                android:id="@+id/main_search_view"
+                                android:layout_width="0dp"
                                 android:layout_height="36dp"
-                                android:layout_marginLeft="4dp"
-                                android:layout_marginRight="4dp"
-                                android:paddingLeft="6dp"
-                                android:paddingRight="6dp"
-                                android:gravity="center_vertical"
-                                android:text="@string/search_hint"
-                                android:textColor="@android:color/white"
-                                android:textSize="@dimen/searchTextSize"
-                                android:singleLine="true"
-                                android:ellipsize="end"
-                                
android:background="?attr/selectableItemBackgroundBorderless"
-                                android:shadowColor="@color/lead_text_shadow"
-                                android:shadowDx="1"
-                                android:shadowDy="1"
-                                android:shadowRadius="2"
+                                android:layout_weight="1"
                                 android:layout_gravity="center_vertical"
-                                android:drawableStart="@drawable/ic_search"
-                                android:drawableLeft="@drawable/ic_search"
-                                android:drawablePadding="6dp"/>
-                            <LinearLayout
-                                android:id="@+id/search_bar_enabled"
-                                android:layout_width="match_parent"
-                                android:layout_height="36dp"
-                                android:orientation="horizontal"
-                                android:layout_gravity="center_vertical"
-                                android:layout_marginLeft="4dp"
-                                android:layout_marginRight="4dp"
-                                style="@style/AppTheme.SearchViewStyle"
-                                android:visibility="gone">
-                                <org.wikipedia.views.CabSearchView
-                                    android:id="@+id/main_search_view"
-                                    android:layout_width="0dp"
-                                    android:layout_height="36dp"
-                                    android:layout_weight="1"
-                                    android:layout_gravity="center_vertical"
-                                    android:layout_marginLeft="8dp"
-                                    android:layout_marginRight="8dp"
-                                    android:layout_marginStart="8dp"
-                                    android:layout_marginEnd="8dp"
-                                    android:textSize="16sp"
-                                    android:focusable="true"
-                                    android:inputType="text"
-                                    
android:imeOptions="actionGo|flagNoExtractUi"
-                                    app:cabEnabled="false" />
-                                <FrameLayout
-                                    android:layout_width="wrap_content"
-                                    android:layout_height="wrap_content"
-                                    android:paddingTop="2dp"
-                                    android:paddingBottom="2dp"
-                                    android:paddingLeft="9dp"
-                                    android:paddingRight="9dp"
-                                    android:layout_marginRight="8dp"
-                                    android:layout_marginEnd="8dp"
-                                    
android:id="@+id/search_lang_button_container"
-                                    
android:background="?attr/actionBarItemBackground"
-                                    android:clickable="true">
-                                    <TextView
-                                        android:id="@+id/search_lang_button"
-                                        android:layout_width="30dp"
-                                        android:layout_height="30dp"
-                                        android:gravity="center"
-                                        android:clickable="false"
-                                        android:focusable="false"
-                                        
android:background="@drawable/lang_button_shape"
-                                        style="@style/AppTheme.ActionModeStyle"
-                                        
android:textColor="@android:color/white" />
-                                </FrameLayout>
-                            </LinearLayout>
-                        </FrameLayout>
-                    </android.support.v7.widget.Toolbar>
-                    <ProgressBar
-                        android:id="@+id/main_progressbar"
-                        android:layout_width="match_parent"
-                        android:layout_height="wrap_content"
-                        android:layout_marginTop="-7.5dp"
-                        android:layout_gravity="top"
-                        style="?android:attr/progressBarStyleHorizontal"/>
-                </FrameLayout>
-                <View
-                    android:id="@+id/main_toolbar_shadow"
+                                android:layout_marginLeft="8dp"
+                                android:layout_marginRight="8dp"
+                                android:layout_marginStart="8dp"
+                                android:layout_marginEnd="8dp"
+                                android:textSize="16sp"
+                                android:focusable="true"
+                                android:inputType="text"
+                                android:imeOptions="actionGo|flagNoExtractUi"
+                                app:cabEnabled="false" />
+                            <FrameLayout
+                                android:layout_width="wrap_content"
+                                android:layout_height="wrap_content"
+                                android:paddingTop="2dp"
+                                android:paddingBottom="2dp"
+                                android:paddingLeft="9dp"
+                                android:paddingRight="9dp"
+                                android:layout_marginRight="8dp"
+                                android:layout_marginEnd="8dp"
+                                android:id="@+id/search_lang_button_container"
+                                
android:background="?attr/actionBarItemBackground"
+                                android:clickable="true">
+                                <TextView
+                                    android:id="@+id/search_lang_button"
+                                    android:layout_width="30dp"
+                                    android:layout_height="30dp"
+                                    android:gravity="center"
+                                    android:clickable="false"
+                                    android:focusable="false"
+                                    
android:background="@drawable/lang_button_shape"
+                                    style="@style/AppTheme.ActionModeStyle"
+                                    android:textColor="@android:color/white" />
+                            </FrameLayout>
+                        </LinearLayout>
+                    </FrameLayout>
+                </android.support.v7.widget.Toolbar>
+                <ProgressBar
+                    android:id="@+id/main_progressbar"
                     android:layout_width="match_parent"
-                    android:layout_height="3dp"
-                    android:layout_gravity="bottom"
-                    android:background="@drawable/toolbar_bottom_shadow"
-                    />
-            </LinearLayout>
-        </FrameLayout>
+                    android:layout_height="wrap_content"
+                    android:layout_marginTop="-7.5dp"
+                    android:layout_gravity="top"
+                    style="?android:attr/progressBarStyleHorizontal" />
+            </FrameLayout>
+            <View
+                android:id="@+id/main_toolbar_shadow"
+                android:layout_width="match_parent"
+                android:layout_height="@dimen/shadow_thickness"
+                android:background="@drawable/toolbar_bottom_shadow"
+                />
+        </LinearLayout>
+
     </FrameLayout>
 
-    <!-- The navigation drawer -->
+    <!-- Override fitsSystemWindows for API 19. -->
     <android.support.design.widget.NavigationView
         android:id="@+id/navdrawer"
         android:layout_width="wrap_content"
@@ -175,6 +168,7 @@
         app:menu="@menu/menu_nav_drawer"
         app:itemTextColor="?attr/nav_item_color"
         app:itemIconTint="?attr/nav_item_color"
-        app:headerLayout="@layout/inflate_header_nav_drawer"/>
+        app:headerLayout="@layout/inflate_header_nav_drawer"
+        android:fitsSystemWindows="false" />
 
 </org.wikipedia.views.WikiDrawerLayout>
diff --git a/app/src/main/res/layout/fragment_history.xml 
b/app/src/main/res/layout/fragment_history.xml
index 6bf2264..08bbe2a 100644
--- a/app/src/main/res/layout/fragment_history.xml
+++ b/app/src/main/res/layout/fragment_history.xml
@@ -3,8 +3,7 @@
 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android";
               android:layout_width="match_parent"
               android:layout_height="match_parent"
-              android:background="?attr/window_background_color"
-              android:paddingTop="?attr/actionBarSize">
+              android:background="?attr/window_background_color">
     <LinearLayout
             android:id="@+id/history_empty_container"
             android:orientation="vertical"
diff --git a/app/src/main/res/layout/fragment_nearby.xml 
b/app/src/main/res/layout/fragment_nearby.xml
index fb15c0f..19c5796 100644
--- a/app/src/main/res/layout/fragment_nearby.xml
+++ b/app/src/main/res/layout/fragment_nearby.xml
@@ -1,10 +1,8 @@
 <?xml version="1.0" encoding="utf-8"?>
-
 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android";
              android:layout_width="match_parent"
              android:layout_height="match_parent"
-             android:background="?attr/page_background_color"
-             android:paddingTop="?attr/actionBarSize">
+             android:background="?attr/page_background_color">
 
     <LinearLayout
         android:id="@+id/nearby_empty_container"
diff --git a/app/src/main/res/layout/fragment_page.xml 
b/app/src/main/res/layout/fragment_page.xml
index ffe3c46..c5fd44a 100644
--- a/app/src/main/res/layout/fragment_page.xml
+++ b/app/src/main/res/layout/fragment_page.xml
@@ -18,167 +18,167 @@
             android:layout_width="match_parent"
             android:layout_height="match_parent">
 
-        <android.support.design.widget.CoordinatorLayout
-            android:id="@+id/page_contents_container"
-            android:layout_width="match_parent"
-            android:layout_height="match_parent">
-
-            <org.wikipedia.views.ObservableWebView
-                android:id="@+id/page_web_view"
+            <android.support.design.widget.CoordinatorLayout
+                android:id="@+id/page_contents_container"
                 android:layout_width="match_parent"
-                android:layout_height="match_parent"
-                />
+                android:layout_height="match_parent">
 
-            <!-- dummy LinearLayout container for 2.3 support.
-            Remove when we drop support for 2.3. -->
-            <LinearLayout
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content">
-                <FrameLayout
-                    android:id="@+id/page_image_container"
+                <org.wikipedia.views.ObservableWebView
+                    android:id="@+id/page_web_view"
+                    android:layout_width="match_parent"
+                    android:layout_height="match_parent"
+                    />
+
+                <!-- dummy LinearLayout container for 2.3 support.
+                Remove when we drop support for 2.3. -->
+                <LinearLayout
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content">
-                    <!-- dummy LinearLayout container for 2.3 support.
-                    Remove when we drop support for 2.3. -->
-                    <LinearLayout
+                    <FrameLayout
+                        android:id="@+id/page_image_container"
                         android:layout_width="match_parent"
-                        android:layout_height="match_parent">
-                        <org.wikipedia.page.leadimages.ImageViewWithFace
-                            android:id="@+id/page_image"
+                        android:layout_height="wrap_content">
+                        <!-- dummy LinearLayout container for 2.3 support.
+                        Remove when we drop support for 2.3. -->
+                        <LinearLayout
+                            android:layout_width="match_parent"
+                            android:layout_height="match_parent">
+                            <org.wikipedia.page.leadimages.ImageViewWithFace
+                                android:id="@+id/page_image"
+                                android:layout_width="match_parent"
+                                android:layout_height="match_parent"
+                                android:scaleType="centerCrop"
+                                android:visibility="invisible"/>
+                        </LinearLayout>
+                        <ImageView
+                            android:id="@+id/page_image_placeholder"
                             android:layout_width="match_parent"
                             android:layout_height="match_parent"
                             android:scaleType="centerCrop"
-                            android:visibility="invisible"/>
-                    </LinearLayout>
-                    <ImageView
-                        android:id="@+id/page_image_placeholder"
-                        android:layout_width="match_parent"
-                        android:layout_height="match_parent"
-                        android:scaleType="centerCrop"
-                        android:contentDescription="@null"/>
+                            android:contentDescription="@null"/>
+                        <LinearLayout
+                            android:id="@+id/page_title_container"
+                            android:layout_width="match_parent"
+                            android:layout_height="wrap_content"
+                            android:orientation="vertical"
+                            android:layout_gravity="bottom">
+                            <TextView
+                                android:id="@+id/page_title_text"
+                                android:layout_width="match_parent"
+                                android:layout_height="wrap_content"
+                                style="@style/RtlAwareTextView"
+                                android:paddingTop="16dp"
+                                
android:paddingRight="@dimen/activity_horizontal_margin"
+                                
android:paddingLeft="@dimen/activity_horizontal_margin"/>
+                            <TextView
+                                android:id="@+id/page_description_text"
+                                android:layout_width="match_parent"
+                                android:layout_height="wrap_content"
+                                style="@style/RtlAwareTextView"
+                                android:layout_gravity="bottom"
+                                android:visibility="invisible"
+                                android:textSize="@dimen/descriptionTextSize"
+                                android:paddingBottom="16dp"
+                                
android:paddingRight="@dimen/activity_horizontal_margin"
+                                
android:paddingLeft="@dimen/activity_horizontal_margin"/>
+                        </LinearLayout>
+                    </FrameLayout>
+                </LinearLayout>
+
+                <LinearLayout
+                    android:id="@+id/bottom_content_container"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_marginBottom="-400dp"
+                    android:layout_gravity="bottom"
+                    android:orientation="vertical"
+                    android:visibility="gone">
+
                     <LinearLayout
-                        android:id="@+id/page_title_container"
+                        android:id="@+id/read_more_container"
                         android:layout_width="match_parent"
                         android:layout_height="wrap_content"
                         android:orientation="vertical"
-                        android:layout_gravity="bottom">
+                        android:visibility="gone">
                         <TextView
-                            android:id="@+id/page_title_text"
                             android:layout_width="match_parent"
                             android:layout_height="wrap_content"
-                            style="@style/RtlAwareTextView"
-                            android:paddingTop="16dp"
+                            
android:textAppearance="?android:attr/textAppearanceLarge"
+                            
android:paddingLeft="@dimen/activity_horizontal_margin"
                             
android:paddingRight="@dimen/activity_horizontal_margin"
-                            
android:paddingLeft="@dimen/activity_horizontal_margin"/>
-                        <TextView
-                            android:id="@+id/page_description_text"
-                            android:layout_width="match_parent"
-                            android:layout_height="wrap_content"
-                            style="@style/RtlAwareTextView"
-                            android:layout_gravity="bottom"
-                            android:visibility="invisible"
-                            android:textSize="@dimen/descriptionTextSize"
                             android:paddingBottom="16dp"
-                            
android:paddingRight="@dimen/activity_horizontal_margin"
-                            
android:paddingLeft="@dimen/activity_horizontal_margin"/>
+                            android:fontFamily="serif"
+                            android:textSize="24sp"
+                            android:text="@string/read_more_section"/>
+                        <ListView
+                            android:id="@+id/read_more_list"
+                            android:layout_width="match_parent"
+                            android:layout_height="0dp"/>
                     </LinearLayout>
-                </FrameLayout>
-            </LinearLayout>
 
-            <LinearLayout
-                android:id="@+id/bottom_content_container"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_marginBottom="-400dp"
-                android:layout_gravity="bottom"
-                android:orientation="vertical"
-                android:visibility="gone">
-
-                <LinearLayout
-                    android:id="@+id/read_more_container"
-                    android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:orientation="vertical"
-                    android:visibility="gone">
-                    <TextView
+                    <LinearLayout
                         android:layout_width="match_parent"
                         android:layout_height="wrap_content"
-                        
android:textAppearance="?android:attr/textAppearanceLarge"
-                        android:paddingLeft="@dimen/activity_horizontal_margin"
-                        
android:paddingRight="@dimen/activity_horizontal_margin"
+                        android:orientation="vertical"
                         android:paddingBottom="16dp"
-                        android:fontFamily="serif"
-                        android:textSize="24sp"
-                        android:text="@string/read_more_section"/>
-                    <ListView
-                        android:id="@+id/read_more_list"
-                        android:layout_width="match_parent"
-                        android:layout_height="0dp"/>
+                        android:background="?attr/subtle_gray_color">
+                        <View
+                            android:layout_width="match_parent"
+                            android:layout_height="8dp"
+                            
android:background="@drawable/toolbar_bottom_shadow"/>
+
+                        <TextView
+                            android:id="@+id/page_external_link"
+                            android:layout_width="match_parent"
+                            android:layout_height="wrap_content"
+                            android:paddingTop="8dp"
+                            
android:paddingLeft="@dimen/activity_horizontal_margin"
+                            
android:paddingRight="@dimen/activity_horizontal_margin"
+                            style="?android:textAppearanceSmall"
+                            android:text="@string/page_view_in_browser"
+                            android:textColor="?attr/link_color"
+                            android:gravity="center"/>
+                        <TextView
+                            android:id="@+id/page_last_updated_text"
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"
+                            android:layout_gravity="center_horizontal"
+                            android:paddingTop="8dp"
+                            
android:paddingLeft="@dimen/activity_horizontal_margin"
+                            
android:paddingRight="@dimen/activity_horizontal_margin"
+                            style="?android:textAppearanceSmall"
+                            android:textIsSelectable="true"
+                            android:textColorLink="?attr/link_color"/>
+                        <TextView
+                            android:id="@+id/page_license_text"
+                            android:layout_width="match_parent"
+                            android:layout_height="wrap_content"
+                            android:paddingTop="8dp"
+                            
android:paddingLeft="@dimen/activity_horizontal_margin"
+                            
android:paddingRight="@dimen/activity_horizontal_margin"
+                            style="?android:textAppearanceSmall"
+                            android:textIsSelectable="true"
+                            android:textColorLink="?attr/link_color"
+                            android:gravity="center"/>
+                    </LinearLayout>
                 </LinearLayout>
 
-                <LinearLayout
-                    android:layout_width="match_parent"
+                <android.support.design.widget.FloatingActionButton
+                    android:id="@+id/floating_toc_button"
+                    android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
-                    android:orientation="vertical"
-                    android:paddingBottom="16dp"
-                    android:background="?attr/subtle_gray_color">
-                    <View
-                        android:layout_width="match_parent"
-                        android:layout_height="8dp"
-                        android:background="@drawable/toolbar_bottom_shadow"/>
+                    style="@style/FloatingActionButton"
+                    android:layout_gravity="bottom|end"
+                    android:src="@drawable/ic_toc"
+                    android:contentDescription="@string/menu_show_toc"
+                    app:fabSize="mini"
+                    app:elevation="4sp"
+                    app:borderWidth="0dp"
+                    app:backgroundTint="?attr/toc_button_color"
+                    app:layout_anchor="@id/bottom_content_container"
+                    app:layout_anchorGravity="bottom|right|end" />
 
-                    <TextView
-                        android:id="@+id/page_external_link"
-                        android:layout_width="match_parent"
-                        android:layout_height="wrap_content"
-                        android:paddingTop="8dp"
-                        android:paddingLeft="@dimen/activity_horizontal_margin"
-                        
android:paddingRight="@dimen/activity_horizontal_margin"
-                        style="?android:textAppearanceSmall"
-                        android:text="@string/page_view_in_browser"
-                        android:textColor="?attr/link_color"
-                        android:gravity="center"/>
-                    <TextView
-                        android:id="@+id/page_last_updated_text"
-                        android:layout_width="wrap_content"
-                        android:layout_height="wrap_content"
-                        android:layout_gravity="center_horizontal"
-                        android:paddingTop="8dp"
-                        android:paddingLeft="@dimen/activity_horizontal_margin"
-                        
android:paddingRight="@dimen/activity_horizontal_margin"
-                        style="?android:textAppearanceSmall"
-                        android:textIsSelectable="true"
-                        android:textColorLink="?attr/link_color"/>
-                    <TextView
-                        android:id="@+id/page_license_text"
-                        android:layout_width="match_parent"
-                        android:layout_height="wrap_content"
-                        android:paddingTop="8dp"
-                        android:paddingLeft="@dimen/activity_horizontal_margin"
-                        
android:paddingRight="@dimen/activity_horizontal_margin"
-                        style="?android:textAppearanceSmall"
-                        android:textIsSelectable="true"
-                        android:textColorLink="?attr/link_color"
-                        android:gravity="center"/>
-                </LinearLayout>
-            </LinearLayout>
-
-            <android.support.design.widget.FloatingActionButton
-                android:id="@+id/floating_toc_button"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                style="@style/FloatingActionButton"
-                android:layout_gravity="bottom|end"
-                android:src="@drawable/ic_toc"
-                android:contentDescription="@string/menu_show_toc"
-                app:fabSize="mini"
-                app:elevation="4sp"
-                app:borderWidth="0dp"
-                app:backgroundTint="?attr/toc_button_color"
-                app:layout_anchor="@id/bottom_content_container"
-                app:layout_anchorGravity="bottom|right|end" />
-
-        </android.support.design.widget.CoordinatorLayout>
+            </android.support.design.widget.CoordinatorLayout>
 
         </org.wikipedia.views.SwipeRefreshLayoutWithScroll>
 
@@ -204,7 +204,9 @@
                     android:orientation="horizontal"
                     >
 
-                <View android:layout_width="3dp" 
android:layout_height="match_parent" android:background="@drawable/toc_shadow" 
/>
+                <View android:layout_width="@dimen/shadow_thickness"
+                      android:layout_height="match_parent"
+                      android:background="@drawable/toc_shadow" />
 
                 <LinearLayout
                         android:layout_width="0dp"
@@ -218,7 +220,6 @@
                             android:id="@+id/page_toc_list"
                             android:layout_width="match_parent"
                             android:layout_height="match_parent"
-                            android:layout_marginTop="?attr/actionBarSize"
                             android:visibility="gone"
                             android:choiceMode="singleChoice"
                             />
diff --git a/app/src/main/res/layout/fragment_saved_pages.xml 
b/app/src/main/res/layout/fragment_saved_pages.xml
index a63fdea..58ea2d4 100644
--- a/app/src/main/res/layout/fragment_saved_pages.xml
+++ b/app/src/main/res/layout/fragment_saved_pages.xml
@@ -3,8 +3,7 @@
 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android";
               android:layout_width="match_parent"
               android:layout_height="match_parent"
-              android:background="?attr/window_background_color"
-              android:paddingTop="?attr/actionBarSize">
+              android:background="?attr/window_background_color">
     <LinearLayout
             android:id="@+id/saved_pages_empty_container"
             android:orientation="vertical"
diff --git a/app/src/main/res/layout/fragment_search.xml 
b/app/src/main/res/layout/fragment_search.xml
index dc93c09..658ef04 100644
--- a/app/src/main/res/layout/fragment_search.xml
+++ b/app/src/main/res/layout/fragment_search.xml
@@ -6,8 +6,7 @@
     android:id="@+id/search_container"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    android:background="?attr/search_background_color"
-    android:paddingTop="?attr/actionBarSize">
+    android:background="?attr/search_background_color">
 
     <fragment
         android:id="@+id/fragment_search_results"
diff --git a/app/src/main/res/layout/inflate_header_nav_drawer.xml 
b/app/src/main/res/layout/inflate_header_nav_drawer.xml
index cdf67c4..922191b 100644
--- a/app/src/main/res/layout/inflate_header_nav_drawer.xml
+++ b/app/src/main/res/layout/inflate_header_nav_drawer.xml
@@ -1,10 +1,17 @@
 <?xml version="1.0" encoding="utf-8"?>
-<FrameLayout
+<LinearLayout
     xmlns:android="http://schemas.android.com/apk/res/android";
     xmlns:tools="http://schemas.android.com/tools";
     android:layout_width="match_parent"
-    android:layout_height="150dp"
+    android:layout_height="wrap_content"
+    android:minHeight="@dimen/nav_drawer_header_height"
+    android:orientation="vertical"
     android:background="@color/blue_progressive">
+
+    <org.wikipedia.views.StatusBarBlankView
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content" />
+
     <ImageView
         android:layout_width="72dp"
         android:layout_height="72dp"
@@ -41,4 +48,4 @@
             android:contentDescription="@null" />
     </LinearLayout>
 
-</FrameLayout>
\ No newline at end of file
+</LinearLayout>
\ No newline at end of file
diff --git a/app/src/main/res/layout/item_tab_entry.xml 
b/app/src/main/res/layout/item_tab_entry.xml
index 18c3239..3a7b4ae 100644
--- a/app/src/main/res/layout/item_tab_entry.xml
+++ b/app/src/main/res/layout/item_tab_entry.xml
@@ -52,7 +52,7 @@
     <View
         android:id="@+id/tab_item_bottom_gradient"
         android:layout_width="match_parent"
-        android:layout_height="3dp"
+        android:layout_height="@dimen/shadow_thickness"
         android:layout_gravity="bottom"
         android:background="?attr/tab_shadow_drawable"/>
 </FrameLayout>
\ No newline at end of file
diff --git a/app/src/main/res/values/colors.xml 
b/app/src/main/res/values/colors.xml
index 66e6894..21adf77 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -21,7 +21,9 @@
     <color name="gray_disabled">#80606060</color>
     <color name="gray_highlight">#ff808080</color>
     <color name="page_info_heading">#555555</color>
-    <color name="actionbar_background">#ff303030</color>
+    <color name="window_background">#ff303030</color>
+    <!-- TODO: replace this color when changing the toolbar color. -->
+    <color name="actionbar_background">@color/window_background</color>
     <color name="actionbar_highlight">#ff808080</color>
     <color name="search_bar">#ff404040</color>
     <color name="search_text_hint">#ff808080</color>
@@ -31,7 +33,7 @@
     actionbar_background). This is because we'll be setting its opacity 
programmatically
     which, in certain API versions, seems to apply globally (i.e. other 
components that use
     the same color value get the same transparency). -->
-    <color name="main_toolbar_background">#ff313131</color>
+    <color name="main_toolbar_background">@color/actionbar_background</color>
 
     <color name="link_light">#ff347BFF</color>
     <color name="button_light">#ff777777</color>
diff --git a/app/src/main/res/values/dimens.xml 
b/app/src/main/res/values/dimens.xml
index e2f72c8..e3b66e0 100644
--- a/app/src/main/res/values/dimens.xml
+++ b/app/src/main/res/values/dimens.xml
@@ -56,4 +56,7 @@
 
     <dimen name="face_detection_nose_y_offset">-24dp</dimen>
 
+    <dimen name="nav_drawer_header_height">150dp</dimen>
+
+    <dimen name="shadow_thickness">3dp</dimen>
 </resources>
\ No newline at end of file
diff --git a/app/src/main/res/values/styles.xml 
b/app/src/main/res/values/styles.xml
index 64f028b..89ec49d 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -8,6 +8,10 @@
         <item name="android:windowBackground">@drawable/splash_bg</item>
     </style>
 
+    <style name="PageTheme" parent="NoTitle">
+        <item name="android:windowTranslucentStatus">true</item>
+    </style>
+
     <style name="NoTitle" parent="AppTheme">
         <item name="windowActionBar">false</item>
         <item name="windowNoTitle">true</item>
diff --git a/www/js/main.js b/www/js/main.js
index 9730eb9..b063b82 100644
--- a/www/js/main.js
+++ b/www/js/main.js
@@ -1,4 +1,5 @@
 var bridge = require( "./bridge" );
+var transformer = require("./transformer");
 
 bridge.registerListener( "requestImagesList", function( payload ) {
     var imageURLs = [];
@@ -45,3 +46,7 @@
         el.classList.remove("no-editing");
     }
 } );
+
+bridge.registerListener( "setDecorOffset", function( payload ) {
+    transformer.setDecorOffset(payload.offset);
+} );
\ No newline at end of file
diff --git a/www/js/sections.js b/www/js/sections.js
index b231200..0c45361 100644
--- a/www/js/sections.js
+++ b/www/js/sections.js
@@ -222,7 +222,7 @@
         window.scrollTo( 0, 0 );
     } else {
         var el = document.getElementById( anchor );
-        var scrollY = el.offsetTop - 48;
+        var scrollY = el.offsetTop - transformer.getDecorOffset();
         window.scrollTo( 0, scrollY );
     }
 }
diff --git a/www/js/transformer.js b/www/js/transformer.js
index fc709d3..e679980 100644
--- a/www/js/transformer.js
+++ b/www/js/transformer.js
@@ -2,6 +2,7 @@
 }
 
 var transforms = {};
+var decorOffset = 0; // The height of the toolbar and, when translucent, 
status bar in CSS pixels.
 
 Transformer.prototype.register = function( transform, fun ) {
     if ( transform in transforms ) {
@@ -18,4 +19,12 @@
     }
 };
 
-module.exports = new Transformer();
+Transformer.prototype.getDecorOffset = function() {
+    return decorOffset;
+};
+
+Transformer.prototype.setDecorOffset = function(offset) {
+    decorOffset = offset;
+};
+
+module.exports = new Transformer();
\ No newline at end of file
diff --git a/www/js/transforms/collapseTables.js 
b/www/js/transforms/collapseTables.js
index be044e2..d9a4e05 100644
--- a/www/js/transforms/collapseTables.js
+++ b/www/js/transforms/collapseTables.js
@@ -54,7 +54,7 @@
         divBottom.style.display = 'none';
         //if they clicked the bottom div, then scroll back up to the top of 
the table.
         if (this === divBottom) {
-            window.scrollTo( 0, container.offsetTop - 48 );
+            window.scrollTo( 0, container.offsetTop - 
transformer.getDecorOffset() );
         }
     } else {
         tableFull.style.display = 'block';

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I26cc244311f44c59902afec1be0e62c9a60e4f48
Gerrit-PatchSet: 11
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Niedzielski <[email protected]>
Gerrit-Reviewer: BearND <[email protected]>
Gerrit-Reviewer: Dbrant <[email protected]>
Gerrit-Reviewer: Mholloway <[email protected]>
Gerrit-Reviewer: Niedzielski <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to