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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/readermode/ReaderModeBarControl.java

Issue 2883643002: Clean up ReaderMode OverlayPanel classes (Closed)
Patch Set: remove extra enum Created 3 years, 6 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
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package org.chromium.chrome.browser.compositor.bottombar.readermode;
6
7 import android.content.Context;
8 import android.view.View;
9 import android.view.ViewGroup;
10 import android.widget.TextView;
11
12 import org.chromium.chrome.R;
13 import org.chromium.chrome.browser.compositor.bottombar.OverlayPanel;
14 import org.chromium.chrome.browser.compositor.bottombar.OverlayPanelInflater;
15 import org.chromium.ui.resources.dynamics.DynamicResourceLoader;
16
17 /**
18 * Controls the Search Term View that is used as a dynamic resource.
19 */
20 public class ReaderModeBarControl extends OverlayPanelInflater {
21 /**
22 * The search term View.
23 */
24 private TextView mReaderText;
25
26 /**
27 * Track the last string that was displayed in the bar to avoid unnecessary re-draw.
28 */
29 private int mLastDisplayedStringId;
30
31 /**
32 * @param panel The panel.
33 * @param context The Android Context used to inflate the View.
34 * @param container The container View used to inflate the View.
35 * @param resourceLoader The resource loader that will handle the snapsho t capturing.
36 */
37 public ReaderModeBarControl(OverlayPanel panel,
38 Context context,
39 ViewGroup container,
40 DynamicResourceLoader resourceLoader) {
41 super(panel, R.layout.reader_mode_text_view, R.id.reader_mode_text_view,
42 context, container, resourceLoader);
43 invalidate();
44 }
45
46 /**
47 * Set the text in the reader mode panel.
48 * @param stringId The resource ID of the string to set the text to.
49 */
50 public void setBarText(int stringId) {
51 if (stringId == mLastDisplayedStringId) return;
52 mLastDisplayedStringId = stringId;
53
54 inflate();
55 mReaderText.setText(stringId);
56 invalidate();
57 }
58
59 @Override
60 protected void onFinishInflate() {
61 super.onFinishInflate();
62
63 View view = getView();
64 mReaderText = (TextView) view.findViewById(R.id.reader_mode_text);
65 }
66 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698