From 5a689d2d05ce686cbe9d8ef38c379836771f0c8f Mon Sep 17 00:00:00 2001 From: newt Date: Mon, 10 Aug 2015 10:07:35 -0700 Subject: [PATCH] Increase location disclosure snackbar duration. This snackbar used to show for 5 seconds, but now shows for 8 seconds since it has a fair amount of text. In accessibility mode, it shows for 15 seconds. BUG=515562 Review URL: https://codereview.chromium.org/1272703006 Cr-Commit-Position: refs/heads/master@{#342638} --- .../chrome/browser/omnibox/geo/GeolocationSnackbarController.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/geo/GeolocationSnackbarController.java b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/geo/GeolocationSnackbarController.java index fdcc7fc58a14..d8aa7c53209e 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/geo/GeolocationSnackbarController.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/geo/GeolocationSnackbarController.java @@ -15,6 +15,7 @@ import android.view.View; import org.chromium.base.BuildInfo; import org.chromium.chrome.R; +import org.chromium.chrome.browser.device.DeviceClassManager; import org.chromium.chrome.browser.preferences.MainPreferences; import org.chromium.chrome.browser.preferences.Preferences; import org.chromium.chrome.browser.preferences.PreferencesLauncher; @@ -41,7 +42,8 @@ import org.chromium.ui.text.SpanApplier.SpanInfo; public class GeolocationSnackbarController implements SnackbarController { private static final String GEOLOCATION_SNACKBAR_SHOWN_PREF = "geolocation_snackbar_shown"; - private static final int SNACKBAR_DURATION_MS = 5000; + private static final int SNACKBAR_DURATION_MS = 8000; + private static final int ACCESSIBILITY_SNACKBAR_DURATION_MS = 15000; private static Boolean sGeolocationSnackbarShown; @@ -78,10 +80,12 @@ public class GeolocationSnackbarController implements SnackbarController { SpannableString message = SpanApplier.applySpans(messageWithoutSpans, new SpanInfo("", "", robotoMediumSpan)); String settings = context.getResources().getString(R.string.preferences); + int durationMs = DeviceClassManager.isAccessibilityModeEnabled(view.getContext()) + ? ACCESSIBILITY_SNACKBAR_DURATION_MS : SNACKBAR_DURATION_MS; final Snackbar snackbar = Snackbar.make(message, new GeolocationSnackbarController()) .setAction(settings, view) .setSingleLine(false) - .setDuration(SNACKBAR_DURATION_MS); + .setDuration(durationMs); view.postDelayed(new Runnable() { @Override -- 2.11.4.GIT