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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/ProgressViewHolder.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.view.LayoutInflater; 7 import android.view.LayoutInflater;
8 8
9 import org.chromium.chrome.R; 9 import org.chromium.chrome.R;
10 10
11 /** 11 /**
12 * ViewHolder for an item of type {@link NewTabPageItem#VIEW_TYPE_PROGRESS}. 12 * ViewHolder for an item of type {@link ItemViewType#PROGRESS}.
13 * Adds a {@link ProgressIndicatorView} to the recycler view. 13 * Adds a {@link ProgressIndicatorView} to the recycler view.
14 */ 14 */
15 public class ProgressViewHolder extends NewTabPageViewHolder { 15 public class ProgressViewHolder extends NewTabPageViewHolder {
16 private final ProgressIndicatorView mProgressIndicator; 16 private final ProgressIndicatorView mProgressIndicator;
17 private ProgressItem mListItem; 17 private ProgressItem mListItem;
18 18
19 public ProgressViewHolder(final NewTabPageRecyclerView recyclerView) { 19 public ProgressViewHolder(final NewTabPageRecyclerView recyclerView) {
20 super(LayoutInflater.from(recyclerView.getContext()) 20 super(LayoutInflater.from(recyclerView.getContext())
21 .inflate(R.layout.new_tab_page_progress_indicator, recyc lerView, false)); 21 .inflate(R.layout.new_tab_page_progress_indicator, recyc lerView, false));
22 mProgressIndicator = (ProgressIndicatorView) itemView.findViewById(R.id. snippets_progress); 22 mProgressIndicator = (ProgressIndicatorView) itemView.findViewById(R.id. snippets_progress);
23 } 23 }
24 24
25 public void onBindViewHolder(ProgressItem item) { 25 public void onBindViewHolder(ProgressItem item) {
26 mListItem = item; 26 mListItem = item;
27 updateDisplay(); 27 updateDisplay();
28 } 28 }
29 29
30 public void updateDisplay() { 30 public void updateDisplay() {
31 if (mListItem.isVisible()) { 31 if (mListItem.isVisible()) {
32 mProgressIndicator.showDelayed(); 32 mProgressIndicator.showDelayed();
33 } else { 33 } else {
34 mProgressIndicator.hide(); 34 mProgressIndicator.hide();
35 } 35 }
36 } 36 }
37 } 37 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698