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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarLayout.java

Issue 2652883002: Omnibox results show correctly for Chrome Home (Closed)
Patch Set: address comments Created 3 years, 10 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 2015 The Chromium Authors. All rights reserved. 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 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.omnibox; 5 package org.chromium.chrome.browser.omnibox;
6 6
7 import static org.chromium.chrome.browser.toolbar.ToolbarPhone.URL_FOCUS_CHANGE_ ANIMATION_DURATION_MS; 7 import static org.chromium.chrome.browser.toolbar.ToolbarPhone.URL_FOCUS_CHANGE_ ANIMATION_DURATION_MS;
8 8
9 import android.Manifest; 9 import android.Manifest;
10 import android.animation.Animator; 10 import android.animation.Animator;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 import org.chromium.chrome.browser.profiles.Profile; 73 import org.chromium.chrome.browser.profiles.Profile;
74 import org.chromium.chrome.browser.search_engines.TemplateUrlService; 74 import org.chromium.chrome.browser.search_engines.TemplateUrlService;
75 import org.chromium.chrome.browser.tab.Tab; 75 import org.chromium.chrome.browser.tab.Tab;
76 import org.chromium.chrome.browser.toolbar.ToolbarActionModeCallback; 76 import org.chromium.chrome.browser.toolbar.ToolbarActionModeCallback;
77 import org.chromium.chrome.browser.toolbar.ToolbarDataProvider; 77 import org.chromium.chrome.browser.toolbar.ToolbarDataProvider;
78 import org.chromium.chrome.browser.toolbar.ToolbarPhone; 78 import org.chromium.chrome.browser.toolbar.ToolbarPhone;
79 import org.chromium.chrome.browser.util.ColorUtils; 79 import org.chromium.chrome.browser.util.ColorUtils;
80 import org.chromium.chrome.browser.util.FeatureUtilities; 80 import org.chromium.chrome.browser.util.FeatureUtilities;
81 import org.chromium.chrome.browser.util.KeyNavigationUtil; 81 import org.chromium.chrome.browser.util.KeyNavigationUtil;
82 import org.chromium.chrome.browser.util.ViewUtils; 82 import org.chromium.chrome.browser.util.ViewUtils;
83 import org.chromium.chrome.browser.widget.BottomSheet;
83 import org.chromium.chrome.browser.widget.TintedImageButton; 84 import org.chromium.chrome.browser.widget.TintedImageButton;
84 import org.chromium.chrome.browser.widget.animation.AnimatorProperties;
85 import org.chromium.chrome.browser.widget.animation.CancelAwareAnimatorListener; 85 import org.chromium.chrome.browser.widget.animation.CancelAwareAnimatorListener;
86 import org.chromium.components.security_state.ConnectionSecurityLevel; 86 import org.chromium.components.security_state.ConnectionSecurityLevel;
87 import org.chromium.content_public.browser.LoadUrlParams; 87 import org.chromium.content_public.browser.LoadUrlParams;
88 import org.chromium.content_public.browser.WebContents; 88 import org.chromium.content_public.browser.WebContents;
89 import org.chromium.ui.UiUtils; 89 import org.chromium.ui.UiUtils;
90 import org.chromium.ui.base.DeviceFormFactor; 90 import org.chromium.ui.base.DeviceFormFactor;
91 import org.chromium.ui.base.PageTransition; 91 import org.chromium.ui.base.PageTransition;
92 import org.chromium.ui.base.WindowAndroid; 92 import org.chromium.ui.base.WindowAndroid;
93 import org.chromium.ui.interpolators.BakedBezierInterpolator; 93 import org.chromium.ui.interpolators.BakedBezierInterpolator;
94 94
(...skipping 18 matching lines...) Expand all
113 private static final int OMNIBOX_CONTAINER_BACKGROUND_FADE_MS = 250; 113 private static final int OMNIBOX_CONTAINER_BACKGROUND_FADE_MS = 250;
114 114
115 // Delay showing the geolocation snackbar when the omnibox is focused until the keyboard is 115 // Delay showing the geolocation snackbar when the omnibox is focused until the keyboard is
116 // hopefully visible. 116 // hopefully visible.
117 private static final int GEOLOCATION_SNACKBAR_SHOW_DELAY_MS = 750; 117 private static final int GEOLOCATION_SNACKBAR_SHOW_DELAY_MS = 750;
118 118
119 // The minimum confidence threshold that will result in navigating directly to a voice search 119 // The minimum confidence threshold that will result in navigating directly to a voice search
120 // response (as opposed to treating it like a typed string in the Omnibox). 120 // response (as opposed to treating it like a typed string in the Omnibox).
121 private static final float VOICE_SEARCH_CONFIDENCE_NAVIGATE_THRESHOLD = 0.9f ; 121 private static final float VOICE_SEARCH_CONFIDENCE_NAVIGATE_THRESHOLD = 0.9f ;
122 122
123 private static final int CONTENT_OVERLAY_COLOR = 0xA6000000;
124 private static final int OMNIBOX_RESULTS_BG_COLOR = 0xFFF5F5F6; 123 private static final int OMNIBOX_RESULTS_BG_COLOR = 0xFFF5F5F6;
125 private static final int OMNIBOX_INCOGNITO_RESULTS_BG_COLOR = 0xFF323232; 124 private static final int OMNIBOX_INCOGNITO_RESULTS_BG_COLOR = 0xFF323232;
126 125
127 /** 126 /**
128 * URI schemes that ContentView can handle. 127 * URI schemes that ContentView can handle.
129 * 128 *
130 * Copied from UrlUtilities.java. UrlUtilities uses a URI to check for sche mes, which 129 * Copied from UrlUtilities.java. UrlUtilities uses a URI to check for sche mes, which
131 * is more strict than Uri and causes the path stripping to fail. 130 * is more strict than Uri and causes the path stripping to fail.
132 * 131 *
133 * The following additions have been made: "chrome", "ftp". 132 * The following additions have been made: "chrome", "ftp".
134 */ 133 */
135 private static final HashSet<String> ACCEPTED_SCHEMES = CollectionUtil.newHa shSet( 134 private static final HashSet<String> ACCEPTED_SCHEMES = CollectionUtil.newHa shSet(
136 "about", "data", "file", "ftp", "http", "https", "inline", "javascri pt", "chrome"); 135 "about", "data", "file", "ftp", "http", "https", "inline", "javascri pt", "chrome");
137 private static final HashSet<String> UNSUPPORTED_SCHEMES_TO_SPLIT = 136 private static final HashSet<String> UNSUPPORTED_SCHEMES_TO_SPLIT =
138 CollectionUtil.newHashSet("file", "javascript", "data"); 137 CollectionUtil.newHashSet("file", "javascript", "data");
139 138
140 protected ImageView mNavigationButton; 139 protected ImageView mNavigationButton;
141 protected TintedImageButton mSecurityButton; 140 protected TintedImageButton mSecurityButton;
142 protected TextView mVerboseStatusTextView; 141 protected TextView mVerboseStatusTextView;
143 protected TintedImageButton mDeleteButton; 142 protected TintedImageButton mDeleteButton;
144 protected TintedImageButton mMicButton; 143 protected TintedImageButton mMicButton;
145 protected UrlBar mUrlBar; 144 protected UrlBar mUrlBar;
146 145
146 /** A handle to the bottom sheet for chrome home. */
147 private BottomSheet mBottomSheet;
148
147 private AutocompleteController mAutocomplete; 149 private AutocompleteController mAutocomplete;
148 150
149 protected ToolbarDataProvider mToolbarDataProvider; 151 protected ToolbarDataProvider mToolbarDataProvider;
150 private UrlFocusChangeListener mUrlFocusChangeListener; 152 private UrlFocusChangeListener mUrlFocusChangeListener;
151 153
152 protected boolean mNativeInitialized; 154 protected boolean mNativeInitialized;
153 155
154 private final List<Runnable> mDeferredNativeRunnables = new ArrayList<Runnab le>(); 156 private final List<Runnable> mDeferredNativeRunnables = new ArrayList<Runnab le>();
155 157
156 // The type of the navigation button currently showing. 158 // The type of the navigation button currently showing.
(...skipping 17 matching lines...) Expand all
174 private boolean mIgnoreOmniboxItemSelection = true; 176 private boolean mIgnoreOmniboxItemSelection = true;
175 177
176 private String mOriginalUrl = ""; 178 private String mOriginalUrl = "";
177 179
178 private WindowAndroid mWindowAndroid; 180 private WindowAndroid mWindowAndroid;
179 private WindowDelegate mWindowDelegate; 181 private WindowDelegate mWindowDelegate;
180 182
181 private Runnable mRequestSuggestions; 183 private Runnable mRequestSuggestions;
182 184
183 private ViewGroup mOmniboxResultsContainer; 185 private ViewGroup mOmniboxResultsContainer;
184 private ObjectAnimator mFadeInOmniboxBackgroundAnimator; 186 private View mFadingView;
185 private ObjectAnimator mFadeOutOmniboxBackgroundAnimator; 187 private ObjectAnimator mOverlayFadeInAnimator;
186 private Animator mOmniboxBackgroundAnimator; 188 private ObjectAnimator mOverlayFadeOutAnimator;
189 private Animator mOverlayAnimator;
187 190
188 private boolean mSuggestionsShown; 191 private boolean mSuggestionsShown;
189 private boolean mUrlHasFocus; 192 private boolean mUrlHasFocus;
190 protected boolean mUrlFocusChangeInProgress; 193 protected boolean mUrlFocusChangeInProgress;
191 private boolean mUrlFocusedFromFakebox; 194 private boolean mUrlFocusedFromFakebox;
192 private boolean mUrlFocusedWithoutAnimations; 195 private boolean mUrlFocusedWithoutAnimations;
193 196
194 private boolean mVoiceSearchEnabled; 197 private boolean mVoiceSearchEnabled;
195 198
196 // Set to true when the user has started typing new input in the omnibox, se t to false 199 // Set to true when the user has started typing new input in the omnibox, se t to false
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after
1034 1037
1035 /** 1038 /**
1036 * Handle and run any necessary animations that are triggered off focusing t he UrlBar. 1039 * Handle and run any necessary animations that are triggered off focusing t he UrlBar.
1037 * @param hasFocus Whether focus was gained. 1040 * @param hasFocus Whether focus was gained.
1038 */ 1041 */
1039 protected void handleUrlFocusAnimation(boolean hasFocus) { 1042 protected void handleUrlFocusAnimation(boolean hasFocus) {
1040 if (hasFocus) mUrlFocusedWithoutAnimations = false; 1043 if (hasFocus) mUrlFocusedWithoutAnimations = false;
1041 if (mUrlFocusChangeListener != null) mUrlFocusChangeListener.onUrlFocusC hange(hasFocus); 1044 if (mUrlFocusChangeListener != null) mUrlFocusChangeListener.onUrlFocusC hange(hasFocus);
1042 1045
1043 updateOmniboxResultsContainer(); 1046 updateOmniboxResultsContainer();
1044 if (hasFocus) updateOmniboxResultsContainerBackground(true); 1047 if (hasFocus) updateFadingBackgroundView(true);
1045 } 1048 }
1046 1049
1047 /** 1050 /**
1048 * Make a zero suggest request if native is loaded, the URL bar has focus, a nd the 1051 * Make a zero suggest request if native is loaded, the URL bar has focus, a nd the
1049 * current tab is not incognito. 1052 * current tab is not incognito.
1050 */ 1053 */
1051 private void startZeroSuggest() { 1054 private void startZeroSuggest() {
1052 // Reset "edited" state in the omnibox if zero suggest is triggered -- n ew edits 1055 // Reset "edited" state in the omnibox if zero suggest is triggered -- n ew edits
1053 // now count as a new session. 1056 // now count as a new session.
1054 mHasStartedNewOmniboxEditSession = false; 1057 mHasStartedNewOmniboxEditSession = false;
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1157 1160
1158 mUrlBar.setOnFocusChangeListener(new View.OnFocusChangeListener() { 1161 mUrlBar.setOnFocusChangeListener(new View.OnFocusChangeListener() {
1159 @Override 1162 @Override
1160 public void onFocusChange(View v, final boolean hasFocus) { 1163 public void onFocusChange(View v, final boolean hasFocus) {
1161 onUrlFocusChange(hasFocus); 1164 onUrlFocusChange(hasFocus);
1162 } 1165 }
1163 }); 1166 });
1164 } 1167 }
1165 1168
1166 @Override 1169 @Override
1170 public void setBottomSheet(BottomSheet sheet) {
1171 mBottomSheet = sheet;
1172 }
1173
1174 @Override
1167 public void setMenuButtonHelper(AppMenuButtonHelper helper) { } 1175 public void setMenuButtonHelper(AppMenuButtonHelper helper) { }
1168 1176
1169 @Override 1177 @Override
1170 public View getMenuAnchor() { 1178 public View getMenuAnchor() {
1171 return null; 1179 return null;
1172 } 1180 }
1173 1181
1174 /** 1182 /**
1175 * Sets the URL focus change listner that will be notified when the URL gain s or loses focus. 1183 * Sets the URL focus change listner that will be notified when the URL gain s or loses focus.
1176 * @param listener The listener to be registered. 1184 * @param listener The listener to be registered.
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
1872 if (currentTab != null && currentTab.getWebContents() != null) { 1880 if (currentTab != null && currentTab.getWebContents() != null) {
1873 Activity activity = currentTab.getWindowAndroid().getActivity(). get(); 1881 Activity activity = currentTab.getWindowAndroid().getActivity(). get();
1874 if (activity != null) { 1882 if (activity != null) {
1875 WebsiteSettingsPopup.show( 1883 WebsiteSettingsPopup.show(
1876 activity, currentTab, null, WebsiteSettingsPopup.OPE NED_FROM_TOOLBAR); 1884 activity, currentTab, null, WebsiteSettingsPopup.OPE NED_FROM_TOOLBAR);
1877 } 1885 }
1878 } 1886 }
1879 } else if (v == mMicButton) { 1887 } else if (v == mMicButton) {
1880 RecordUserAction.record("MobileOmniboxVoiceSearch"); 1888 RecordUserAction.record("MobileOmniboxVoiceSearch");
1881 startVoiceRecognition(); 1889 startVoiceRecognition();
1882 } else if (v == mOmniboxResultsContainer) { 1890 } else if (v == mFadingView) {
1883 // This will only be triggered when no suggestion items are selected in the container. 1891 // This will only be triggered when no suggestion items are selected in the container.
1884 setUrlBarFocus(false); 1892 setUrlBarFocus(false);
1885 updateOmniboxResultsContainerBackground(false); 1893 updateFadingBackgroundView(false);
1886 } 1894 }
1887 } 1895 }
1888 1896
1889 @Override 1897 @Override
1890 public void onSuggestionsReceived(List<OmniboxSuggestion> newSuggestions, 1898 public void onSuggestionsReceived(List<OmniboxSuggestion> newSuggestions,
1891 String inlineAutocompleteText) { 1899 String inlineAutocompleteText) {
1892 // This is a callback from a listener that is set up by onNativeLibraryR eady, 1900 // This is a callback from a listener that is set up by onNativeLibraryR eady,
1893 // so can only be called once the native side is set up. 1901 // so can only be called once the native side is set up.
1894 assert mNativeInitialized : "Suggestions received before native side int ialialized"; 1902 assert mNativeInitialized : "Suggestions received before native side int ialialized";
1895 1903
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
2182 */ 2190 */
2183 @Override 2191 @Override
2184 public Tab getCurrentTab() { 2192 public Tab getCurrentTab() {
2185 if (mToolbarDataProvider == null) return null; 2193 if (mToolbarDataProvider == null) return null;
2186 return mToolbarDataProvider.getTab(); 2194 return mToolbarDataProvider.getTab();
2187 } 2195 }
2188 2196
2189 private void initOmniboxResultsContainer() { 2197 private void initOmniboxResultsContainer() {
2190 if (mOmniboxResultsContainer != null) return; 2198 if (mOmniboxResultsContainer != null) return;
2191 2199
2192 ViewStub overlayStub = 2200 // Use the omnibox results container in the bottom sheet if it exists.
2193 (ViewStub) getRootView().findViewById(R.id.omnibox_results_conta iner_stub); 2201 int omniboxResultsContainerId = R.id.omnibox_results_container_stub;
2202 if (mBottomSheet != null) {
2203 omniboxResultsContainerId = R.id.bottom_omnibox_results_container_st ub;
2204 }
2205
2206 ViewStub overlayStub = (ViewStub) getRootView().findViewById(omniboxResu ltsContainerId);
2194 mOmniboxResultsContainer = (ViewGroup) overlayStub.inflate(); 2207 mOmniboxResultsContainer = (ViewGroup) overlayStub.inflate();
2195 mOmniboxResultsContainer.setBackgroundColor(CONTENT_OVERLAY_COLOR);
2196 mOmniboxResultsContainer.setOnClickListener(this);
2197 } 2208 }
2198 2209
2199 private void updateOmniboxResultsContainer() { 2210 private void updateOmniboxResultsContainer() {
2200 if (mSuggestionsShown || mUrlHasFocus) { 2211 if (mSuggestionsShown || mUrlHasFocus) {
2201 initOmniboxResultsContainer(); 2212 initOmniboxResultsContainer();
2202 updateOmniboxResultsContainerVisibility(true); 2213 updateOmniboxResultsContainerVisibility(true);
2203 } else if (mOmniboxResultsContainer != null) { 2214 } else if (mOmniboxResultsContainer != null) {
2204 updateOmniboxResultsContainerBackground(false); 2215 updateFadingBackgroundView(false);
2205 } 2216 }
2206 } 2217 }
2207 2218
2208 private void updateOmniboxResultsContainerVisibility(boolean visible) { 2219 private void updateOmniboxResultsContainerVisibility(boolean visible) {
2209 boolean currentlyVisible = mOmniboxResultsContainer.getVisibility() == V ISIBLE; 2220 boolean currentlyVisible = mOmniboxResultsContainer.getVisibility() == V ISIBLE;
2210 if (currentlyVisible == visible) return; 2221 if (currentlyVisible == visible) return;
2211 2222
2212 ChromeActivity activity = (ChromeActivity) mWindowAndroid.getActivity(). get(); 2223 ChromeActivity activity = (ChromeActivity) mWindowAndroid.getActivity(). get();
2213 2224
2214 if (visible) { 2225 if (visible) {
2215 mOmniboxResultsContainer.setVisibility(VISIBLE); 2226 mOmniboxResultsContainer.setVisibility(VISIBLE);
2216 if (activity != null) activity.addViewObscuringAllTabs(mOmniboxResul tsContainer); 2227 if (activity != null) activity.addViewObscuringAllTabs(mFadingView);
2217 } else { 2228 } else {
2218 mOmniboxResultsContainer.setVisibility(INVISIBLE); 2229 mOmniboxResultsContainer.setVisibility(INVISIBLE);
2219 if (activity != null) activity.removeViewObscuringAllTabs(mOmniboxRe sultsContainer); 2230 if (activity != null) activity.removeViewObscuringAllTabs(mFadingVie w);
2220 } 2231 }
2221 } 2232 }
2222 2233
2223 /** 2234 /**
2224 * Set the background of the omnibox results container. 2235 * Initialize the fading background for when the omnibox is focused.
2236 */
2237 private void initFadingOverlayView() {
2238 mFadingView = getRootView().findViewById(R.id.fading_focus_target);
2239 mFadingView.setAlpha(0.0f);
2240 mFadingView.setOnClickListener(this);
2241 }
2242
2243 /**
2244 * Update the fading background view that shows when the omnibox is focused.
2225 * @param visible Whether the background should be made visible. 2245 * @param visible Whether the background should be made visible.
2226 */ 2246 */
2227 private void updateOmniboxResultsContainerBackground(boolean visible) { 2247 private void updateFadingBackgroundView(boolean visible) {
2228 if (getToolbarDataProvider() == null) return; 2248 if (getToolbarDataProvider() == null) return;
2229 2249
2250 if (mFadingView == null) initFadingOverlayView();
2251
2230 NewTabPage ntp = getToolbarDataProvider().getNewTabPageForCurrentTab(); 2252 NewTabPage ntp = getToolbarDataProvider().getNewTabPageForCurrentTab();
2231 boolean locationBarShownInNTP = ntp != null && ntp.isLocationBarShownInN TP(); 2253 boolean locationBarShownInNTP = ntp != null && ntp.isLocationBarShownInN TP();
2232 if (visible) { 2254
2233 if (locationBarShownInNTP) { 2255 if (visible && !locationBarShownInNTP) {
2234 mOmniboxResultsContainer.getBackground().setAlpha(0); 2256 // If the location bar is shown in the NTP, the toolbar will eventua lly trigger a
2235 } else { 2257 // fade in.
2236 fadeInOmniboxResultsContainerBackground(); 2258 showFadingOverlay();
2237 }
2238 } else { 2259 } else {
2239 if (locationBarShownInNTP) { 2260 hideFadingOverlay(!locationBarShownInNTP);
2240 updateOmniboxResultsContainerVisibility(false);
2241 } else {
2242 fadeOutOmniboxResultsContainerBackground();
2243 }
2244 } 2261 }
2245 } 2262 }
2246 2263
2247 /** 2264 /**
2248 * Trigger a fade in of the omnibox results background. 2265 * Trigger a fade in of the omnibox results background creating a new animat ion if necessary.
2249 */ 2266 */
2250 protected void fadeInOmniboxResultsContainerBackground() { 2267 protected void showFadingOverlay() {
2251 if (mFadeInOmniboxBackgroundAnimator == null) { 2268 if (mOverlayFadeInAnimator == null) {
2252 mFadeInOmniboxBackgroundAnimator = ObjectAnimator.ofInt( 2269 mOverlayFadeInAnimator = ObjectAnimator.ofFloat(mFadingView, ALPHA, 1f);
2253 getRootView().findViewById(R.id.omnibox_results_container).g etBackground(), 2270 mOverlayFadeInAnimator.setDuration(OMNIBOX_CONTAINER_BACKGROUND_FADE _MS);
2254 AnimatorProperties.DRAWABLE_ALPHA_PROPERTY, 0, 255); 2271 mOverlayFadeInAnimator.setInterpolator(
2255 mFadeInOmniboxBackgroundAnimator.setDuration(OMNIBOX_CONTAINER_BACKG ROUND_FADE_MS);
2256 mFadeInOmniboxBackgroundAnimator.setInterpolator(
2257 BakedBezierInterpolator.FADE_IN_CURVE); 2272 BakedBezierInterpolator.FADE_IN_CURVE);
2258 } 2273 }
2259 runOmniboxResultsFadeAnimation(mFadeInOmniboxBackgroundAnimator); 2274
2275 mFadingView.setVisibility(View.VISIBLE);
2276 runFadeOverlayAnimation(mOverlayFadeInAnimator);
2260 } 2277 }
2261 2278
2262 private void fadeOutOmniboxResultsContainerBackground() { 2279 /**
2263 if (mFadeOutOmniboxBackgroundAnimator == null) { 2280 * Trigger a fade out of the omnibox results background creating a new anima tion if necessary.
2264 mFadeOutOmniboxBackgroundAnimator = ObjectAnimator.ofInt( 2281 */
2265 getRootView().findViewById(R.id.omnibox_results_container).g etBackground(), 2282 private void hideFadingOverlay(boolean fadeOut) {
2266 AnimatorProperties.DRAWABLE_ALPHA_PROPERTY, 255, 0); 2283 if (mOverlayFadeOutAnimator == null) {
2267 mFadeOutOmniboxBackgroundAnimator.setDuration(OMNIBOX_CONTAINER_BACK GROUND_FADE_MS); 2284 mOverlayFadeOutAnimator = ObjectAnimator.ofFloat(mFadingView, ALPHA, 0f);
2268 mFadeOutOmniboxBackgroundAnimator.setInterpolator( 2285 mOverlayFadeOutAnimator.setDuration(OMNIBOX_CONTAINER_BACKGROUND_FAD E_MS);
2269 BakedBezierInterpolator.FADE_OUT_CURVE); 2286 mOverlayFadeOutAnimator.setInterpolator(BakedBezierInterpolator.FADE _OUT_CURVE);
2270 mFadeOutOmniboxBackgroundAnimator.addListener(new CancelAwareAnimato rListener() { 2287 mOverlayFadeOutAnimator.addListener(new CancelAwareAnimatorListener( ) {
2271 @Override 2288 @Override
2272 public void onEnd(Animator animator) { 2289 public void onEnd(Animator animator) {
2273 updateOmniboxResultsContainerVisibility(false); 2290 mFadingView.setVisibility(View.GONE);
2291 onFadingOverlayHidden();
2274 } 2292 }
2275 }); 2293 });
2276 } 2294 }
2277 runOmniboxResultsFadeAnimation(mFadeOutOmniboxBackgroundAnimator); 2295
2296 runFadeOverlayAnimation(mOverlayFadeOutAnimator);
2297 if (!fadeOut) mOverlayFadeOutAnimator.end();
2278 } 2298 }
2279 2299
2280 private void runOmniboxResultsFadeAnimation(Animator fadeAnimation) { 2300 /**
2281 if (mOmniboxBackgroundAnimator == fadeAnimation 2301 * A notification that the fading overlay view is completely hidden.
2282 && mOmniboxBackgroundAnimator.isRunning()) { 2302 */
2303 private void onFadingOverlayHidden() {
2304 updateOmniboxResultsContainerVisibility(false);
2305 }
2306
2307 private void runFadeOverlayAnimation(Animator fadeAnimation) {
2308 if (mOverlayAnimator == fadeAnimation && mOverlayAnimator.isRunning()) {
2283 return; 2309 return;
2284 } else if (mOmniboxBackgroundAnimator != null) { 2310 } else if (mOverlayAnimator != null) {
2285 mOmniboxBackgroundAnimator.cancel(); 2311 mOverlayAnimator.cancel();
2286 } 2312 }
2287 mOmniboxBackgroundAnimator = fadeAnimation; 2313 mOverlayAnimator = fadeAnimation;
2288 mOmniboxBackgroundAnimator.start(); 2314 mOverlayAnimator.start();
2289 } 2315 }
2290 2316
2291 @Override 2317 @Override
2292 public boolean isVoiceSearchEnabled() { 2318 public boolean isVoiceSearchEnabled() {
2293 if (mToolbarDataProvider == null) return false; 2319 if (mToolbarDataProvider == null) return false;
2294 if (mToolbarDataProvider.isIncognito()) return false; 2320 if (mToolbarDataProvider.isIncognito()) return false;
2295 if (mWindowAndroid == null) return false; 2321 if (mWindowAndroid == null) return false;
2296 2322
2297 if (!mWindowAndroid.hasPermission(Manifest.permission.RECORD_AUDIO) 2323 if (!mWindowAndroid.hasPermission(Manifest.permission.RECORD_AUDIO)
2298 && !mWindowAndroid.canRequestPermission(Manifest.permission.RECO RD_AUDIO)) { 2324 && !mWindowAndroid.canRequestPermission(Manifest.permission.RECO RD_AUDIO)) {
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
2459 public View getContainerView() { 2485 public View getContainerView() {
2460 return this; 2486 return this;
2461 } 2487 }
2462 2488
2463 @Override 2489 @Override
2464 public void setTitleToPageTitle() { } 2490 public void setTitleToPageTitle() { }
2465 2491
2466 @Override 2492 @Override
2467 public void setShowTitle(boolean showTitle) { } 2493 public void setShowTitle(boolean showTitle) { }
2468 } 2494 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698