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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/toolbar/TabSwitcherCallout.java

Issue 2779543005: Add support for highlighting menu items (Closed)
Patch Set: Debugged drawable issues Created 3 years, 8 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.toolbar; 5 package org.chromium.chrome.browser.toolbar;
6 6
7 import android.annotation.TargetApi; 7 import android.annotation.TargetApi;
8 import android.content.Context; 8 import android.content.Context;
9 import android.content.SharedPreferences; 9 import android.content.SharedPreferences;
10 import android.os.Build; 10 import android.os.Build;
(...skipping 16 matching lines...) Expand all
27 private static final float Y_OVERLAP_DP = 18.f; 27 private static final float Y_OVERLAP_DP = 18.f;
28 28
29 /** 29 /**
30 * Show the TabSwitcherCallout, if necessary. 30 * Show the TabSwitcherCallout, if necessary.
31 * @param context {@link Context} to draw resources from. 31 * @param context {@link Context} to draw resources from.
32 * @param tabSwitcherButton Button that triggers the tab switcher. 32 * @param tabSwitcherButton Button that triggers the tab switcher.
33 * @return {@link TextBubble} if one was shown, {@code null } otherwise. 33 * @return {@link TextBubble} if one was shown, {@code null } otherwise.
34 */ 34 */
35 @TargetApi(Build.VERSION_CODES.LOLLIPOP) 35 @TargetApi(Build.VERSION_CODES.LOLLIPOP)
36 public static TextBubble showIfNecessary(Context context, View tabSwitcherBu tton) { 36 public static TextBubble showIfNecessary(Context context, View tabSwitcherBu tton) {
37 if (!isTabSwitcherCalloutNecessary()) return null; 37 // if (!isTabSwitcherCalloutNecessary()) return null;
Ted C 2017/04/12 18:05:57 ?
David Trainor- moved to gerrit 2017/04/12 18:59:37 Doesn't everyone want to see the tab switcher call
38 setIsTabSwitcherCalloutNecessary(false); 38 setIsTabSwitcherCalloutNecessary(false);
39 39
40 ViewAnchoredTextBubble bubble = new ViewAnchoredTextBubble( 40 ViewAnchoredTextBubble bubble = new ViewAnchoredTextBubble(
41 context, tabSwitcherButton, R.string.tab_switcher_callout_body); 41 context, tabSwitcherButton, R.string.tab_switcher_callout_body);
42 bubble.setDismissOnTouchInteraction(true); 42 bubble.setDismissOnTouchInteraction(true);
43 bubble.setAutoDismissTimeout(TAB_SWITCHER_CALLOUT_DISMISS_MS); 43 // bubble.setAutoDismissTimeout(TAB_SWITCHER_CALLOUT_DISMISS_MS);
44 int yInsetPx = (int) (Y_OVERLAP_DP * context.getResources().getDisplayMe trics().density); 44 int yInsetPx = (int) (Y_OVERLAP_DP * context.getResources().getDisplayMe trics().density);
45 bubble.setInsetPx(0, yInsetPx, 0, yInsetPx); 45 bubble.setInsetPx(0, yInsetPx, 0, yInsetPx);
46 bubble.show(); 46 bubble.show();
47 return bubble; 47 return bubble;
48 } 48 }
49 49
50 /** @return Whether or not the tab switcher button callout needs to be shown . */ 50 /** @return Whether or not the tab switcher button callout needs to be shown . */
51 public static boolean isTabSwitcherCalloutNecessary() { 51 public static boolean isTabSwitcherCalloutNecessary() {
52 SharedPreferences prefs = ContextUtils.getAppSharedPreferences(); 52 SharedPreferences prefs = ContextUtils.getAppSharedPreferences();
53 return prefs.getBoolean(PREF_NEED_TO_SHOW_TAB_SWITCHER_CALLOUT, false); 53 return prefs.getBoolean(PREF_NEED_TO_SHOW_TAB_SWITCHER_CALLOUT, false);
54 } 54 }
55 55
56 /** Sets whether the tab switcher callout should be shown when the browser s tarts up. */ 56 /** Sets whether the tab switcher callout should be shown when the browser s tarts up. */
57 public static void setIsTabSwitcherCalloutNecessary(boolean shouldShow) { 57 public static void setIsTabSwitcherCalloutNecessary(boolean shouldShow) {
58 SharedPreferences prefs = ContextUtils.getAppSharedPreferences(); 58 SharedPreferences prefs = ContextUtils.getAppSharedPreferences();
59 prefs.edit().putBoolean(PREF_NEED_TO_SHOW_TAB_SWITCHER_CALLOUT, shouldSh ow).apply(); 59 prefs.edit().putBoolean(PREF_NEED_TO_SHOW_TAB_SWITCHER_CALLOUT, shouldSh ow).apply();
60 } 60 }
61 } 61 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698