Index: chrome/android/java/src/org/chromium/chrome/browser/widget/selection/SelectableListLayout.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/widget/selection/SelectableListLayout.java b/chrome/android/java/src/org/chromium/chrome/browser/widget/selection/SelectableListLayout.java |
index b2d8c807e800c318831cfc2ad14f831abfe9148e..89a815ee0be2eb2e68026513f8d836d3eea6ff97 100644 |
--- a/chrome/android/java/src/org/chromium/chrome/browser/widget/selection/SelectableListLayout.java |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/widget/selection/SelectableListLayout.java |
@@ -25,7 +25,6 @@ import android.view.LayoutInflater; |
import android.view.View; |
import android.view.ViewStub; |
import android.widget.FrameLayout; |
-import android.widget.RelativeLayout; |
import android.widget.TextView; |
import org.chromium.base.ApiCompatibilityUtils; |
@@ -55,7 +54,7 @@ import javax.annotation.Nullable; |
* @param <E> The type of the selectable items this layout holds. |
*/ |
public class SelectableListLayout<E> |
- extends RelativeLayout implements DisplayStyleObserver, SelectionObserver<E> { |
+ extends FrameLayout implements DisplayStyleObserver, SelectionObserver<E> { |
/** |
* @param res Resources used to retrieve drawables and dimensions. |
* @return The default list item lateral margin size in pixels. This value should be used in |
@@ -318,6 +317,13 @@ public class SelectableListLayout<E> |
*/ |
public Toolbar detachToolbarView() { |
removeView(mToolbar); |
+ |
+ // The top margin for the content and shadow needs to be removed now that the toolbar |
+ // has been removed. |
+ View content = findViewById(R.id.list_content); |
+ ((MarginLayoutParams) content.getLayoutParams()).topMargin = 0; |
+ ((MarginLayoutParams) mToolbarShadow.getLayoutParams()).topMargin = 0; |
+ |
return mToolbar; |
} |
@@ -359,8 +365,8 @@ public class SelectableListLayout<E> |
private void setToolbarShadowVisibility() { |
if (mToolbarPermanentlyHidden || mToolbar == null || mRecyclerView == null) return; |
- boolean showShadow = mRecyclerView.computeVerticalScrollOffset() != 0 |
- || mToolbar.isSearching() || mToolbar.getSelectionDelegate().isSelectionEnabled(); |
+ boolean showShadow = mRecyclerView.canScrollVertically(-1) || mToolbar.isSearching() |
+ || mToolbar.getSelectionDelegate().isSelectionEnabled(); |
mToolbarShadow.setVisibility(showShadow ? View.VISIBLE : View.GONE); |
} |