Backed out changeset dacdf390c694 (bug 1403728) for failing android-lint. r=backout on a CLOSED TREE
authorSebastian Hengst <archaeopteryx@coole-files.de>
Thu, 05 Oct 2017 20:27:14 +0200
changeset 427458 715a43e874c25d90887582a5e6f5069a8e7a5463
parent 427457 fa7c801e20316e850d9f17cd979bf2fbe764a001
child 427459 eb855465eb9c99727c286a9173166a60844c73ab
push id97
push userfmarier@mozilla.com
push dateSat, 14 Oct 2017 01:12:59 +0000
reviewersbackout
bugs1403728
milestone58.0a1
backs outdacdf390c6947e636dda22afdbd085d6fbb24bcf
Backed out changeset dacdf390c694 (bug 1403728) for failing android-lint. r=backout on a CLOSED TREE
mobile/android/base/java/org/mozilla/gecko/tabs/TabsListLayout.java
--- a/mobile/android/base/java/org/mozilla/gecko/tabs/TabsListLayout.java
+++ b/mobile/android/base/java/org/mozilla/gecko/tabs/TabsListLayout.java
@@ -26,31 +26,40 @@ public class TabsListLayout extends Tabs
 
     public TabsListLayout(Context context, AttributeSet attrs) {
         super(context, attrs, R.layout.tabs_list_item_view);
 
         setHasFixedSize(true);
 
         setLayoutManager(new LinearLayoutManager(context));
 
+        setPadding();
+
         final int dragDirections = ItemTouchHelper.UP | ItemTouchHelper.DOWN;
         // A TouchHelper handler for drag and drop and swipe to close.
         final TabsTouchHelperCallback callback = new TabsTouchHelperCallback(this, dragDirections, this) {
             @Override
             protected float alphaForItemSwipeDx(float dX, int distanceToAlphaMin) {
                 return Math.max(0.1f,
                         Math.min(1f, 1f - 2f * Math.abs(dX) / distanceToAlphaMin));
             }
         };
         final ItemTouchHelper touchHelper = new ItemTouchHelper(callback);
         touchHelper.attachToRecyclerView(this);
 
         setItemAnimator(new TabsListLayoutAnimator(ANIMATION_DURATION));
     }
 
+    private void setPadding() {
+        final float scale = getResources().getDisplayMetrics().density;
+        final float sizeInDp = getResources().getDimensionPixelSize(R.dimen.tab_panel_list_item_top_padding);
+        final int dpAsPixels = (int) (sizeInDp * scale);
+        super.setPadding(0, dpAsPixels, 0, dpAsPixels);
+    }
+
     @Override
     public void closeAll() {
         final int childCount = getChildCount();
 
         // Just close the panel if there are no tabs to close.
         if (childCount == 0) {
             autoHidePanel();
             return;