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

Change subject: Improve performance of page footer scrolling.
......................................................................

Improve performance of page footer scrolling.

Now using the more efficient setTranslationY() method instead of messing
around with LayoutParams and margins.

Change-Id: Ib417111d5de51387c6065d7f30a4caab96e3ccc1
---
M app/src/main/java/org/wikipedia/page/bottomcontent/BottomContentView.java
M app/src/main/res/layout/fragment_page.xml
2 files changed, 5 insertions(+), 10 deletions(-)


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

diff --git 
a/app/src/main/java/org/wikipedia/page/bottomcontent/BottomContentView.java 
b/app/src/main/java/org/wikipedia/page/bottomcontent/BottomContentView.java
index 7528702..d43dc68 100644
--- a/app/src/main/java/org/wikipedia/page/bottomcontent/BottomContentView.java
+++ b/app/src/main/java/org/wikipedia/page/bottomcontent/BottomContentView.java
@@ -4,7 +4,6 @@
 import android.graphics.Paint;
 import android.net.Uri;
 import android.support.annotation.NonNull;
-import android.support.design.widget.CoordinatorLayout;
 import android.text.TextUtils;
 import android.text.method.LinkMovementMethod;
 import android.util.AttributeSet;
@@ -204,18 +203,13 @@
         int contentHeight = (int)(webView.getContentHeight() * 
DimenUtil.getDensityScalar());
         int bottomOffset = contentHeight - scrollY - webView.getHeight();
         int bottomHeight = getHeight();
-        CoordinatorLayout.LayoutParams params = 
(CoordinatorLayout.LayoutParams) getLayoutParams();
         if (bottomOffset > bottomHeight) {
-            if (params.bottomMargin != -bottomHeight) {
-                params.bottomMargin = -bottomHeight;
-                params.topMargin = 0;
-                setLayoutParams(params);
+            setTranslationY(bottomHeight);
+            if (getVisibility() != View.INVISIBLE) {
                 setVisibility(View.INVISIBLE);
             }
         } else {
-            params.bottomMargin = -bottomOffset;
-            params.topMargin = -bottomHeight;
-            setLayoutParams(params);
+            setTranslationY(bottomOffset);
             if (getVisibility() != View.VISIBLE) {
                 setVisibility(View.VISIBLE);
             }
diff --git a/app/src/main/res/layout/fragment_page.xml 
b/app/src/main/res/layout/fragment_page.xml
index a70bf62..440f01d 100644
--- a/app/src/main/res/layout/fragment_page.xml
+++ b/app/src/main/res/layout/fragment_page.xml
@@ -38,7 +38,8 @@
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
                     android:orientation="vertical"
-                    android:layout_gravity="bottom"/>
+                    android:layout_gravity="bottom"
+                    android:layout_marginTop="-320dp"/>
 
                 <org.wikipedia.views.WikiPageErrorView
                     android:id="@+id/page_error"

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib417111d5de51387c6065d7f30a4caab96e3ccc1
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