Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/SpacingItem.java

Issue 2396523002: Unify NewTabPageItem and ItemGroup into a single tree-structured interface. (Closed)
Patch Set: review Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.browser.ntp.cards; 5 package org.chromium.chrome.browser.ntp.cards;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 import android.view.View; 8 import android.view.View;
9 import android.view.ViewGroup; 9 import android.view.ViewGroup;
10 10
11 /** 11 /**
12 * Placeholder item to let the snippets flow to the top of the scroll list even when it does not 12 * Placeholder item to let the snippets flow to the top of the scroll list even when it does not
13 * contain enough of them. It is displayed as a dummy item with variable height that just occupies 13 * contain enough of them. It is displayed as a dummy item with variable height that just occupies
14 * the remaining space between the last item in the RecyclerView and the bottom of the screen. 14 * the remaining space between the last item in the RecyclerView and the bottom of the screen.
15 */ 15 */
16 public class SpacingItem extends SingleItemGroup { 16 public class SpacingItem extends Leaf {
17 private static class SpacingView extends View { 17 private static class SpacingView extends View {
18 public SpacingView(Context context) { 18 public SpacingView(Context context) {
19 super(context); 19 super(context);
20 } 20 }
21 21
22 @Override 22 @Override
23 protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 23 protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
24 setMeasuredDimension( 24 setMeasuredDimension(
25 0, ((NewTabPageRecyclerView) getParent()).calculateBottomSpa cing()); 25 0, ((NewTabPageRecyclerView) getParent()).calculateBottomSpa cing());
26 } 26 }
27 } 27 }
28 28
29 /** Creates the View object for displaying the variable spacing. */ 29 /** Creates the View object for displaying the variable spacing. */
30 public static View createView(ViewGroup parent) { 30 public static View createView(ViewGroup parent) {
31 return new SpacingView(parent.getContext()); 31 return new SpacingView(parent.getContext());
32 } 32 }
33 33
34 @Override 34 @Override
35 public int getType() { 35 @ItemViewType
36 return NewTabPageItem.VIEW_TYPE_SPACING; 36 protected int getItemViewType() {
37 return ItemViewType.SPACING;
37 } 38 }
38 39
39 @Override 40 @Override
40 public void onBindViewHolder(NewTabPageViewHolder holder) { 41 protected void onBindViewHolder(NewTabPageViewHolder holder) {
41 // Nothing to do. 42 // Nothing to do.
42 } 43 }
43 } 44 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698