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

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

Issue 2548013002: Remove redundant field initialization in Java code. (Closed)
Patch Set: rebase Created 4 years 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.support.annotation.ColorRes; 8 import android.support.annotation.ColorRes;
9 import android.util.AttributeSet; 9 import android.util.AttributeSet;
10 import android.view.View; 10 import android.view.View;
11 import android.widget.ImageView; 11 import android.widget.ImageView;
12 12
13 import org.chromium.base.ApiCompatibilityUtils; 13 import org.chromium.base.ApiCompatibilityUtils;
14 import org.chromium.chrome.R; 14 import org.chromium.chrome.R;
15 import org.chromium.third_party.android.swiperefresh.MaterialProgressDrawable; 15 import org.chromium.third_party.android.swiperefresh.MaterialProgressDrawable;
16 16
17 /** 17 /**
18 * Displays an indeterminate circular spinner, similar to {@link android.widget. ProgressBar} in 18 * Displays an indeterminate circular spinner, similar to {@link android.widget. ProgressBar} in
19 * Lollipop+. This class allows to backport the Material style to pre-L OS versi ons. 19 * Lollipop+. This class allows to backport the Material style to pre-L OS versi ons.
20 * 20 *
21 * It stays invisible for the first 500ms when shown, to avoid showing a spinner when content 21 * It stays invisible for the first 500ms when shown, to avoid showing a spinner when content
22 * can load very quickly. 22 * can load very quickly.
23 */ 23 */
24 public class ProgressIndicatorView extends ImageView { 24 public class ProgressIndicatorView extends ImageView {
25 private static final int SHOW_DELAY_MS = 500; 25 private static final int SHOW_DELAY_MS = 500;
26 private final Runnable mShowSpinnerRunnable; 26 private final Runnable mShowSpinnerRunnable;
27 27
28 private final MaterialProgressDrawable mProgressDrawable; 28 private final MaterialProgressDrawable mProgressDrawable;
29 private boolean mPostedCallback = false; 29 private boolean mPostedCallback;
30 30
31 /** 31 /**
32 * Constructor for use in layout files. 32 * Constructor for use in layout files.
33 */ 33 */
34 public ProgressIndicatorView(Context context, AttributeSet attrs) { 34 public ProgressIndicatorView(Context context, AttributeSet attrs) {
35 super(context, attrs); 35 super(context, attrs);
36 36
37 mShowSpinnerRunnable = new Runnable() { 37 mShowSpinnerRunnable = new Runnable() {
38 @Override 38 @Override
39 public void run() { 39 public void run() {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 mPostedCallback = true; 86 mPostedCallback = true;
87 // We don't want to show the spinner every time we load content if it lo ads quickly; instead 87 // We don't want to show the spinner every time we load content if it lo ads quickly; instead
88 // only start showing the spinner if loading the content has taken longe r than 500ms 88 // only start showing the spinner if loading the content has taken longe r than 500ms
89 postDelayed(mShowSpinnerRunnable, SHOW_DELAY_MS); 89 postDelayed(mShowSpinnerRunnable, SHOW_DELAY_MS);
90 } 90 }
91 91
92 private int getColorAsInt(@ColorRes int colorId) { 92 private int getColorAsInt(@ColorRes int colorId) {
93 return ApiCompatibilityUtils.getColor(getResources(), colorId); 93 return ApiCompatibilityUtils.getColor(getResources(), colorId);
94 } 94 }
95 } 95 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698