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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SectionHeader.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.snippets; 5 package org.chromium.chrome.browser.ntp.snippets;
6 6
7 import org.chromium.chrome.browser.ntp.cards.NewTabPageItem; 7 import org.chromium.chrome.browser.ntp.cards.ItemViewType;
8 import org.chromium.chrome.browser.ntp.cards.Leaf;
8 import org.chromium.chrome.browser.ntp.cards.NewTabPageViewHolder; 9 import org.chromium.chrome.browser.ntp.cards.NewTabPageViewHolder;
9 10
10 /** 11 /**
11 * Represents the data for a header of a group of snippets 12 * Represents the data for a header of a group of snippets
12 */ 13 */
13 public class SectionHeader implements NewTabPageItem { 14 public class SectionHeader extends Leaf {
14 /** Whether the header should be shown. */ 15 /** Whether the header should be shown. */
15 private final boolean mVisible; 16 private final boolean mVisible;
16 17
17 /** The header text to be shown. */ 18 /** The header text to be shown. */
18 private final String mHeaderText; 19 private final String mHeaderText;
19 20
20 public SectionHeader(String headerText) { 21 public SectionHeader(String headerText) {
21 // TODO(mvanouwerkerk): Configure mVisible in the constructor when we ha ve a global status 22 // TODO(mvanouwerkerk): Configure mVisible in the constructor when we ha ve a global status
22 // section without a visible header. 23 // section without a visible header.
23 mVisible = true; 24 mVisible = true;
24 25
25 this.mHeaderText = headerText; 26 this.mHeaderText = headerText;
26 } 27 }
27 28
28 @Override 29 @Override
29 public int getType() { 30 @ItemViewType
30 return NewTabPageItem.VIEW_TYPE_HEADER; 31 public int getItemViewType() {
32 return ItemViewType.HEADER;
31 } 33 }
32 34
33 public boolean isVisible() { 35 public boolean isVisible() {
34 return mVisible; 36 return mVisible;
35 } 37 }
36 38
37 public String getHeaderText() { 39 public String getHeaderText() {
38 return mHeaderText; 40 return mHeaderText;
39 } 41 }
40 42
41 @Override 43 @Override
42 public void onBindViewHolder(NewTabPageViewHolder holder) { 44 protected void onBindViewHolder(NewTabPageViewHolder holder) {
43 assert holder instanceof SectionHeaderViewHolder; 45 assert holder instanceof SectionHeaderViewHolder;
44 ((SectionHeaderViewHolder) holder).onBindViewHolder(this); 46 ((SectionHeaderViewHolder) holder).onBindViewHolder(this);
45 } 47 }
46 } 48 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698