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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/infobar/ReaderModeInfoBar.java

Issue 2955053003: Line-wrap Reader Mode infobar if the text is too long (Closed)
Patch Set: rebase Created 3 years, 5 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
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarCompactLayout.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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.infobar; 5 package org.chromium.chrome.browser.infobar;
6 6
7 import android.util.TypedValue; 7 import android.util.TypedValue;
8 import android.view.Gravity; 8 import android.view.Gravity;
9 import android.view.View; 9 import android.view.View;
10 import android.widget.TextView; 10 import android.widget.TextView;
(...skipping 30 matching lines...) Expand all
41 41
42 @Override 42 @Override
43 protected boolean usesCompactLayout() { 43 protected boolean usesCompactLayout() {
44 return true; 44 return true;
45 } 45 }
46 46
47 @Override 47 @Override
48 protected void createCompactLayoutContent(InfoBarCompactLayout layout) { 48 protected void createCompactLayoutContent(InfoBarCompactLayout layout) {
49 TextView prompt = new TextView(getContext()); 49 TextView prompt = new TextView(getContext());
50 prompt.setText(R.string.reader_view_text); 50 prompt.setText(R.string.reader_view_text);
51 prompt.setSingleLine();
52 prompt.setTextSize(TypedValue.COMPLEX_UNIT_PX, 51 prompt.setTextSize(TypedValue.COMPLEX_UNIT_PX,
53 getContext().getResources().getDimension(R.dimen.infobar_text_si ze)); 52 getContext().getResources().getDimension(R.dimen.infobar_text_si ze));
54 prompt.setTextColor( 53 prompt.setTextColor(
55 ApiCompatibilityUtils.getColor(layout.getResources(), R.color.de fault_text_color)); 54 ApiCompatibilityUtils.getColor(layout.getResources(), R.color.de fault_text_color));
56 prompt.setGravity(Gravity.CENTER_VERTICAL); 55 prompt.setGravity(Gravity.CENTER_VERTICAL);
57 prompt.setOnClickListener(mNavigateListener); 56 prompt.setOnClickListener(mNavigateListener);
58 57
59 layout.findViewById(R.id.infobar_icon).setOnClickListener(mNavigateListe ner); 58 layout.findViewById(R.id.infobar_icon).setOnClickListener(mNavigateListe ner);
59 final int messagePadding = getContext().getResources().getDimensionPixel Offset(
60 R.dimen.reader_mode_infobar_text_padding);
61 prompt.setPadding(0, messagePadding, 0, messagePadding);
60 layout.addContent(prompt, 1f); 62 layout.addContent(prompt, 1f);
61 } 63 }
62 64
63 @Override 65 @Override
64 public void onCloseButtonClicked() { 66 public void onCloseButtonClicked() {
65 if (getReaderModeManager() != null) { 67 if (getReaderModeManager() != null) {
66 getReaderModeManager().onClosed(StateChangeReason.CLOSE_BUTTON); 68 getReaderModeManager().onClosed(StateChangeReason.CLOSE_BUTTON);
67 } 69 }
68 super.onCloseButtonClicked(); 70 super.onCloseButtonClicked();
69 } 71 }
(...skipping 21 matching lines...) Expand all
91 * @return An instance of the {@link ReaderModeInfoBar}. 93 * @return An instance of the {@link ReaderModeInfoBar}.
92 */ 94 */
93 @CalledByNative 95 @CalledByNative
94 private static ReaderModeInfoBar create() { 96 private static ReaderModeInfoBar create() {
95 return new ReaderModeInfoBar(); 97 return new ReaderModeInfoBar();
96 } 98 }
97 99
98 private static native void nativeCreate(Tab tab); 100 private static native void nativeCreate(Tab tab);
99 private native Tab nativeGetTab(long nativeReaderModeInfoBar); 101 private native Tab nativeGetTab(long nativeReaderModeInfoBar);
100 } 102 }
OLDNEW
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarCompactLayout.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698