OLD | NEW |
---|---|
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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
80 import org.chromium.chrome.browser.tab.Tab; | 80 import org.chromium.chrome.browser.tab.Tab; |
81 import org.chromium.chrome.browser.toolbar.ActionModeController; | 81 import org.chromium.chrome.browser.toolbar.ActionModeController; |
82 import org.chromium.chrome.browser.toolbar.ActionModeController.ActionBarDelegat e; | 82 import org.chromium.chrome.browser.toolbar.ActionModeController.ActionBarDelegat e; |
83 import org.chromium.chrome.browser.toolbar.ToolbarActionModeCallback; | 83 import org.chromium.chrome.browser.toolbar.ToolbarActionModeCallback; |
84 import org.chromium.chrome.browser.toolbar.ToolbarDataProvider; | 84 import org.chromium.chrome.browser.toolbar.ToolbarDataProvider; |
85 import org.chromium.chrome.browser.toolbar.ToolbarPhone; | 85 import org.chromium.chrome.browser.toolbar.ToolbarPhone; |
86 import org.chromium.chrome.browser.util.ColorUtils; | 86 import org.chromium.chrome.browser.util.ColorUtils; |
87 import org.chromium.chrome.browser.util.FeatureUtilities; | 87 import org.chromium.chrome.browser.util.FeatureUtilities; |
88 import org.chromium.chrome.browser.util.KeyNavigationUtil; | 88 import org.chromium.chrome.browser.util.KeyNavigationUtil; |
89 import org.chromium.chrome.browser.util.ViewUtils; | 89 import org.chromium.chrome.browser.util.ViewUtils; |
90 import org.chromium.chrome.browser.widget.BottomSheet; | |
90 import org.chromium.chrome.browser.widget.TintedImageButton; | 91 import org.chromium.chrome.browser.widget.TintedImageButton; |
91 import org.chromium.chrome.browser.widget.animation.AnimatorProperties; | 92 import org.chromium.chrome.browser.widget.animation.AnimatorProperties; |
92 import org.chromium.chrome.browser.widget.animation.CancelAwareAnimatorListener; | 93 import org.chromium.chrome.browser.widget.animation.CancelAwareAnimatorListener; |
93 import org.chromium.components.security_state.ConnectionSecurityLevel; | 94 import org.chromium.components.security_state.ConnectionSecurityLevel; |
94 import org.chromium.content_public.browser.LoadUrlParams; | 95 import org.chromium.content_public.browser.LoadUrlParams; |
95 import org.chromium.content_public.browser.WebContents; | 96 import org.chromium.content_public.browser.WebContents; |
96 import org.chromium.ui.UiUtils; | 97 import org.chromium.ui.UiUtils; |
97 import org.chromium.ui.base.DeviceFormFactor; | 98 import org.chromium.ui.base.DeviceFormFactor; |
98 import org.chromium.ui.base.PageTransition; | 99 import org.chromium.ui.base.PageTransition; |
99 import org.chromium.ui.base.WindowAndroid; | 100 import org.chromium.ui.base.WindowAndroid; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
145 CollectionUtil.newHashSet("file", "javascript", "data"); | 146 CollectionUtil.newHashSet("file", "javascript", "data"); |
146 | 147 |
147 protected ImageView mNavigationButton; | 148 protected ImageView mNavigationButton; |
148 protected TintedImageButton mSecurityButton; | 149 protected TintedImageButton mSecurityButton; |
149 protected TextView mVerboseStatusTextView; | 150 protected TextView mVerboseStatusTextView; |
150 protected TintedImageButton mDeleteButton; | 151 protected TintedImageButton mDeleteButton; |
151 protected TintedImageButton mMicButton; | 152 protected TintedImageButton mMicButton; |
152 protected UrlBar mUrlBar; | 153 protected UrlBar mUrlBar; |
153 private ActionModeController mActionModeController; | 154 private ActionModeController mActionModeController; |
154 | 155 |
156 /** A handle to the bottom sheet for chrome home. */ | |
157 private BottomSheet mBottomSheet; | |
158 | |
155 private AutocompleteController mAutocomplete; | 159 private AutocompleteController mAutocomplete; |
156 | 160 |
157 protected ToolbarDataProvider mToolbarDataProvider; | 161 protected ToolbarDataProvider mToolbarDataProvider; |
158 private UrlFocusChangeListener mUrlFocusChangeListener; | 162 private UrlFocusChangeListener mUrlFocusChangeListener; |
159 | 163 |
160 protected boolean mNativeInitialized; | 164 protected boolean mNativeInitialized; |
161 | 165 |
162 private final List<Runnable> mDeferredNativeRunnables = new ArrayList<Runnab le>(); | 166 private final List<Runnable> mDeferredNativeRunnables = new ArrayList<Runnab le>(); |
163 | 167 |
164 // The type of the navigation button currently showing. | 168 // The type of the navigation button currently showing. |
(...skipping 17 matching lines...) Expand all Loading... | |
182 private boolean mIgnoreOmniboxItemSelection = true; | 186 private boolean mIgnoreOmniboxItemSelection = true; |
183 | 187 |
184 private String mOriginalUrl = ""; | 188 private String mOriginalUrl = ""; |
185 | 189 |
186 private WindowAndroid mWindowAndroid; | 190 private WindowAndroid mWindowAndroid; |
187 private WindowDelegate mWindowDelegate; | 191 private WindowDelegate mWindowDelegate; |
188 | 192 |
189 private Runnable mRequestSuggestions; | 193 private Runnable mRequestSuggestions; |
190 | 194 |
191 private ViewGroup mOmniboxResultsContainer; | 195 private ViewGroup mOmniboxResultsContainer; |
196 private View mFadingView; | |
192 private ObjectAnimator mFadeInOmniboxBackgroundAnimator; | 197 private ObjectAnimator mFadeInOmniboxBackgroundAnimator; |
193 private ObjectAnimator mFadeOutOmniboxBackgroundAnimator; | 198 private ObjectAnimator mFadeOutOmniboxBackgroundAnimator; |
194 private Animator mOmniboxBackgroundAnimator; | 199 private Animator mOmniboxBackgroundAnimator; |
195 | 200 |
196 private boolean mSuggestionsShown; | 201 private boolean mSuggestionsShown; |
197 private boolean mUrlHasFocus; | 202 private boolean mUrlHasFocus; |
198 protected boolean mUrlFocusChangeInProgress; | 203 protected boolean mUrlFocusChangeInProgress; |
199 private boolean mUrlFocusedFromFakebox; | 204 private boolean mUrlFocusedFromFakebox; |
200 private boolean mUrlFocusedWithoutAnimations; | 205 private boolean mUrlFocusedWithoutAnimations; |
201 | 206 |
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1073 | 1078 |
1074 /** | 1079 /** |
1075 * Handle and run any necessary animations that are triggered off focusing t he UrlBar. | 1080 * Handle and run any necessary animations that are triggered off focusing t he UrlBar. |
1076 * @param hasFocus Whether focus was gained. | 1081 * @param hasFocus Whether focus was gained. |
1077 */ | 1082 */ |
1078 protected void handleUrlFocusAnimation(boolean hasFocus) { | 1083 protected void handleUrlFocusAnimation(boolean hasFocus) { |
1079 if (hasFocus) mUrlFocusedWithoutAnimations = false; | 1084 if (hasFocus) mUrlFocusedWithoutAnimations = false; |
1080 if (mUrlFocusChangeListener != null) mUrlFocusChangeListener.onUrlFocusC hange(hasFocus); | 1085 if (mUrlFocusChangeListener != null) mUrlFocusChangeListener.onUrlFocusC hange(hasFocus); |
1081 | 1086 |
1082 updateOmniboxResultsContainer(); | 1087 updateOmniboxResultsContainer(); |
1083 if (hasFocus) updateOmniboxResultsContainerBackground(true); | 1088 if (hasFocus) updateFadingBackgroundView(true); |
1084 } | 1089 } |
1085 | 1090 |
1086 /** | 1091 /** |
1087 * Make a zero suggest request if native is loaded, the URL bar has focus, a nd the | 1092 * Make a zero suggest request if native is loaded, the URL bar has focus, a nd the |
1088 * current tab is not incognito. | 1093 * current tab is not incognito. |
1089 */ | 1094 */ |
1090 private void startZeroSuggest() { | 1095 private void startZeroSuggest() { |
1091 // Reset "edited" state in the omnibox if zero suggest is triggered -- n ew edits | 1096 // Reset "edited" state in the omnibox if zero suggest is triggered -- n ew edits |
1092 // now count as a new session. | 1097 // now count as a new session. |
1093 mHasStartedNewOmniboxEditSession = false; | 1098 mHasStartedNewOmniboxEditSession = false; |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1204 | 1209 |
1205 mUrlBar.setOnFocusChangeListener(new View.OnFocusChangeListener() { | 1210 mUrlBar.setOnFocusChangeListener(new View.OnFocusChangeListener() { |
1206 @Override | 1211 @Override |
1207 public void onFocusChange(View v, final boolean hasFocus) { | 1212 public void onFocusChange(View v, final boolean hasFocus) { |
1208 onUrlFocusChange(hasFocus); | 1213 onUrlFocusChange(hasFocus); |
1209 } | 1214 } |
1210 }); | 1215 }); |
1211 } | 1216 } |
1212 | 1217 |
1213 @Override | 1218 @Override |
1219 public void setBottomSheet(BottomSheet sheet) { | |
1220 mBottomSheet = sheet; | |
1221 } | |
1222 | |
1223 @Override | |
1214 public void setMenuButtonHelper(AppMenuButtonHelper helper) { } | 1224 public void setMenuButtonHelper(AppMenuButtonHelper helper) { } |
1215 | 1225 |
1216 @Override | 1226 @Override |
1217 public View getMenuAnchor() { | 1227 public View getMenuAnchor() { |
1218 return null; | 1228 return null; |
1219 } | 1229 } |
1220 | 1230 |
1221 /** | 1231 /** |
1222 * Sets the URL focus change listner that will be notified when the URL gain s or loses focus. | 1232 * Sets the URL focus change listner that will be notified when the URL gain s or loses focus. |
1223 * @param listener The listener to be registered. | 1233 * @param listener The listener to be registered. |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1570 }); | 1580 }); |
1571 } | 1581 } |
1572 }; | 1582 }; |
1573 getRootView().findViewById(R.id.control_container) | 1583 getRootView().findViewById(R.id.control_container) |
1574 .addOnLayoutChangeListener(suggestionListResizer); | 1584 .addOnLayoutChangeListener(suggestionListResizer); |
1575 | 1585 |
1576 mSuggestionList = new OmniboxSuggestionsList(getContext()); | 1586 mSuggestionList = new OmniboxSuggestionsList(getContext()); |
1577 | 1587 |
1578 // Ensure the results container is initialized and add the suggestion li st to it. | 1588 // Ensure the results container is initialized and add the suggestion li st to it. |
1579 initOmniboxResultsContainer(); | 1589 initOmniboxResultsContainer(); |
1580 mOmniboxResultsContainer.addView(mSuggestionList); | 1590 mOmniboxResultsContainer.addView(mSuggestionList, 0); |
Ted C
2017/01/25 19:27:02
why 0? isn't mSuggestionList now the only child o
mdjones
2017/01/26 00:34:39
Originally I had the shadow as a child of the cont
mdjones
2017/01/26 00:49:32
Also both cases still have at least one view that
| |
1581 | 1591 |
1582 // Start with visibility GONE to ensure that show() is called. http://cr bug.com/517438 | 1592 // Start with visibility GONE to ensure that show() is called. http://cr bug.com/517438 |
1583 mSuggestionList.setVisibility(GONE); | 1593 mSuggestionList.setVisibility(GONE); |
1584 mSuggestionList.setAdapter(mSuggestionListAdapter); | 1594 mSuggestionList.setAdapter(mSuggestionListAdapter); |
1585 mSuggestionList.setClipToPadding(false); | 1595 mSuggestionList.setClipToPadding(false); |
1586 mSuggestionListAdapter.setSuggestionDelegate(new OmniboxSuggestionDelega te() { | 1596 mSuggestionListAdapter.setSuggestionDelegate(new OmniboxSuggestionDelega te() { |
1587 @Override | 1597 @Override |
1588 public void onSelection(OmniboxSuggestion suggestion, int position) { | 1598 public void onSelection(OmniboxSuggestion suggestion, int position) { |
1589 mSuggestionSelectionInProgress = true; | 1599 mSuggestionSelectionInProgress = true; |
1590 String suggestionMatchUrl = updateSuggestionUrlIfNeeded( | 1600 String suggestionMatchUrl = updateSuggestionUrlIfNeeded( |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1915 if (currentTab != null && currentTab.getWebContents() != null) { | 1925 if (currentTab != null && currentTab.getWebContents() != null) { |
1916 Activity activity = currentTab.getWindowAndroid().getActivity(). get(); | 1926 Activity activity = currentTab.getWindowAndroid().getActivity(). get(); |
1917 if (activity != null) { | 1927 if (activity != null) { |
1918 WebsiteSettingsPopup.show( | 1928 WebsiteSettingsPopup.show( |
1919 activity, currentTab, null, WebsiteSettingsPopup.OPE NED_FROM_TOOLBAR); | 1929 activity, currentTab, null, WebsiteSettingsPopup.OPE NED_FROM_TOOLBAR); |
1920 } | 1930 } |
1921 } | 1931 } |
1922 } else if (v == mMicButton) { | 1932 } else if (v == mMicButton) { |
1923 RecordUserAction.record("MobileOmniboxVoiceSearch"); | 1933 RecordUserAction.record("MobileOmniboxVoiceSearch"); |
1924 startVoiceRecognition(); | 1934 startVoiceRecognition(); |
1925 } else if (v == mOmniboxResultsContainer) { | 1935 } else if (v == mFadingView) { |
1926 // This will only be triggered when no suggestion items are selected in the container. | 1936 // This will only be triggered when no suggestion items are selected in the container. |
1927 setUrlBarFocus(false); | 1937 setUrlBarFocus(false); |
1928 updateOmniboxResultsContainerBackground(false); | 1938 updateFadingBackgroundView(false); |
1929 } | 1939 } |
1930 } | 1940 } |
1931 | 1941 |
1932 @Override | 1942 @Override |
1933 public void onSuggestionsReceived(List<OmniboxSuggestion> newSuggestions, | 1943 public void onSuggestionsReceived(List<OmniboxSuggestion> newSuggestions, |
1934 String inlineAutocompleteText) { | 1944 String inlineAutocompleteText) { |
1935 // This is a callback from a listener that is set up by onNativeLibraryR eady, | 1945 // This is a callback from a listener that is set up by onNativeLibraryR eady, |
1936 // so can only be called once the native side is set up. | 1946 // so can only be called once the native side is set up. |
1937 assert mNativeInitialized : "Suggestions received before native side int ialialized"; | 1947 assert mNativeInitialized : "Suggestions received before native side int ialialized"; |
1938 | 1948 |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2226 */ | 2236 */ |
2227 @Override | 2237 @Override |
2228 public Tab getCurrentTab() { | 2238 public Tab getCurrentTab() { |
2229 if (mToolbarDataProvider == null) return null; | 2239 if (mToolbarDataProvider == null) return null; |
2230 return mToolbarDataProvider.getTab(); | 2240 return mToolbarDataProvider.getTab(); |
2231 } | 2241 } |
2232 | 2242 |
2233 private void initOmniboxResultsContainer() { | 2243 private void initOmniboxResultsContainer() { |
2234 if (mOmniboxResultsContainer != null) return; | 2244 if (mOmniboxResultsContainer != null) return; |
2235 | 2245 |
2236 ViewStub overlayStub = | 2246 // Use the omnibox results container in the bottom sheet if it exists. |
2237 (ViewStub) getRootView().findViewById(R.id.omnibox_results_conta iner_stub); | 2247 int omniboxResultsContainerId = R.id.omnibox_results_container_stub; |
2248 if (mBottomSheet != null) { | |
mdjones
2017/01/24 01:51:50
It probably seems weird to go through the trouble
| |
2249 omniboxResultsContainerId = R.id.bottom_omnibox_results_container_st ub; | |
2250 } | |
2251 | |
2252 ViewStub overlayStub = (ViewStub) getRootView().findViewById(omniboxResu ltsContainerId); | |
2238 mOmniboxResultsContainer = (ViewGroup) overlayStub.inflate(); | 2253 mOmniboxResultsContainer = (ViewGroup) overlayStub.inflate(); |
2239 mOmniboxResultsContainer.setBackgroundColor(CONTENT_OVERLAY_COLOR); | |
2240 mOmniboxResultsContainer.setOnClickListener(this); | 2254 mOmniboxResultsContainer.setOnClickListener(this); |
Ted C
2017/01/25 19:27:02
I ton' think we need this anymore right?
mdjones
2017/01/26 00:34:39
Done.
| |
2255 | |
2256 mFadingView = getRootView().findViewById(R.id.fading_focus_target); | |
2257 mFadingView.setBackgroundColor(CONTENT_OVERLAY_COLOR); | |
Ted C
2017/01/25 19:27:02
should we just set this in XML at this point? loo
mdjones
2017/01/26 00:34:39
Done.
| |
2241 } | 2258 } |
2242 | 2259 |
2243 private void updateOmniboxResultsContainer() { | 2260 private void updateOmniboxResultsContainer() { |
2244 if (mSuggestionsShown || mUrlHasFocus) { | 2261 if (mSuggestionsShown || mUrlHasFocus) { |
2245 initOmniboxResultsContainer(); | 2262 initOmniboxResultsContainer(); |
2246 updateOmniboxResultsContainerVisibility(true); | 2263 updateOmniboxResultsContainerVisibility(true); |
2247 } else if (mOmniboxResultsContainer != null) { | 2264 } else if (mOmniboxResultsContainer != null) { |
2248 updateOmniboxResultsContainerBackground(false); | 2265 updateFadingBackgroundView(false); |
2249 } | 2266 } |
2250 } | 2267 } |
2251 | 2268 |
2252 private void updateOmniboxResultsContainerVisibility(boolean visible) { | 2269 private void updateOmniboxResultsContainerVisibility(boolean visible) { |
2253 boolean currentlyVisible = mOmniboxResultsContainer.getVisibility() == V ISIBLE; | 2270 boolean currentlyVisible = mOmniboxResultsContainer.getVisibility() == V ISIBLE; |
2254 if (currentlyVisible == visible) return; | 2271 if (currentlyVisible == visible) return; |
2255 | 2272 |
2256 ChromeActivity activity = (ChromeActivity) mWindowAndroid.getActivity(). get(); | 2273 ChromeActivity activity = (ChromeActivity) mWindowAndroid.getActivity(). get(); |
2257 | 2274 |
2258 if (visible) { | 2275 if (visible) { |
2259 mOmniboxResultsContainer.setVisibility(VISIBLE); | 2276 mOmniboxResultsContainer.setVisibility(VISIBLE); |
2260 if (activity != null) activity.addViewObscuringAllTabs(mOmniboxResul tsContainer); | 2277 if (activity != null) activity.addViewObscuringAllTabs(mOmniboxResul tsContainer); |
2261 } else { | 2278 } else { |
2262 mOmniboxResultsContainer.setVisibility(INVISIBLE); | 2279 mOmniboxResultsContainer.setVisibility(INVISIBLE); |
2263 if (activity != null) activity.removeViewObscuringAllTabs(mOmniboxRe sultsContainer); | 2280 if (activity != null) activity.removeViewObscuringAllTabs(mOmniboxRe sultsContainer); |
2264 } | 2281 } |
2265 } | 2282 } |
2266 | 2283 |
2267 /** | 2284 /** |
2268 * Set the background of the omnibox results container. | 2285 * Update the fading background view that shows when the omnibox is focused. |
2269 * @param visible Whether the background should be made visible. | 2286 * @param visible Whether the background should be made visible. |
2270 */ | 2287 */ |
2271 private void updateOmniboxResultsContainerBackground(boolean visible) { | 2288 private void updateFadingBackgroundView(boolean visible) { |
2272 if (getToolbarDataProvider() == null) return; | 2289 if (getToolbarDataProvider() == null) return; |
2273 | 2290 |
2274 NewTabPage ntp = getToolbarDataProvider().getNewTabPageForCurrentTab(); | 2291 NewTabPage ntp = getToolbarDataProvider().getNewTabPageForCurrentTab(); |
2275 boolean locationBarShownInNTP = ntp != null && ntp.isLocationBarShownInN TP(); | 2292 boolean locationBarShownInNTP = ntp != null && ntp.isLocationBarShownInN TP(); |
2276 if (visible) { | 2293 if (visible) { |
2277 if (locationBarShownInNTP) { | 2294 if (locationBarShownInNTP) { |
2278 mOmniboxResultsContainer.getBackground().setAlpha(0); | 2295 mFadingView.getBackground().setAlpha(0); |
Ted C
2017/01/25 19:27:02
since this doesn't trigger the fadeIn, it isn't ge
mdjones
2017/01/26 00:34:39
Done.
| |
2279 } else { | 2296 } else { |
2280 fadeInOmniboxResultsContainerBackground(); | 2297 fadeInOmniboxResultsContainerBackground(); |
2281 } | 2298 } |
2282 } else { | 2299 } else { |
2283 if (locationBarShownInNTP) { | 2300 if (locationBarShownInNTP) { |
2284 updateOmniboxResultsContainerVisibility(false); | 2301 updateOmniboxResultsContainerVisibility(false); |
Ted C
2017/01/25 19:27:02
I think we need to figure out how the omnibox resu
mdjones
2017/01/26 00:34:39
I agree, but I don't think this is something to do
| |
2285 } else { | |
2286 fadeOutOmniboxResultsContainerBackground(); | |
2287 } | 2302 } |
2303 fadeOutOmniboxResultsContainerBackground(); | |
Ted C
2017/01/25 19:27:02
I think this was in an else to avoid flickering on
mdjones
2017/01/26 00:34:39
Fixed.
| |
2288 } | 2304 } |
2289 } | 2305 } |
2290 | 2306 |
2291 /** | 2307 /** |
2292 * Trigger a fade in of the omnibox results background. | 2308 * Trigger a fade in of the omnibox results background. |
2293 */ | 2309 */ |
2294 protected void fadeInOmniboxResultsContainerBackground() { | 2310 protected void fadeInOmniboxResultsContainerBackground() { |
2295 if (mFadeInOmniboxBackgroundAnimator == null) { | 2311 if (mFadeInOmniboxBackgroundAnimator == null) { |
2312 mFadingView.setOnClickListener(this); | |
Ted C
2017/01/25 19:27:02
I think you can just have the onclick listener set
mdjones
2017/01/26 00:34:39
Moved up to where mFadingView is first acquired.
| |
2313 | |
2296 mFadeInOmniboxBackgroundAnimator = ObjectAnimator.ofInt( | 2314 mFadeInOmniboxBackgroundAnimator = ObjectAnimator.ofInt( |
2297 getRootView().findViewById(R.id.omnibox_results_container).g etBackground(), | 2315 mFadingView.getBackground(), AnimatorProperties.DRAWABLE_ALP HA_PROPERTY, 0, |
2298 AnimatorProperties.DRAWABLE_ALPHA_PROPERTY, 0, 255); | 2316 255); |
2299 mFadeInOmniboxBackgroundAnimator.setDuration(OMNIBOX_CONTAINER_BACKG ROUND_FADE_MS); | 2317 mFadeInOmniboxBackgroundAnimator.setDuration(OMNIBOX_CONTAINER_BACKG ROUND_FADE_MS); |
2300 mFadeInOmniboxBackgroundAnimator.setInterpolator( | 2318 mFadeInOmniboxBackgroundAnimator.setInterpolator( |
2301 BakedBezierInterpolator.FADE_IN_CURVE); | 2319 BakedBezierInterpolator.FADE_IN_CURVE); |
2320 | |
2321 mFadeInOmniboxBackgroundAnimator.addListener(new CancelAwareAnimator Listener() { | |
2322 @Override | |
2323 public void onStart(Animator animator) { | |
2324 mFadingView.setVisibility(View.VISIBLE); | |
2325 } | |
2326 }); | |
2302 } | 2327 } |
2303 runOmniboxResultsFadeAnimation(mFadeInOmniboxBackgroundAnimator); | 2328 runOmniboxResultsFadeAnimation(mFadeInOmniboxBackgroundAnimator); |
2304 } | 2329 } |
2305 | 2330 |
2306 private void fadeOutOmniboxResultsContainerBackground() { | 2331 private void fadeOutOmniboxResultsContainerBackground() { |
2307 if (mFadeOutOmniboxBackgroundAnimator == null) { | 2332 if (mFadeOutOmniboxBackgroundAnimator == null) { |
2308 mFadeOutOmniboxBackgroundAnimator = ObjectAnimator.ofInt( | 2333 mFadeOutOmniboxBackgroundAnimator = ObjectAnimator.ofInt( |
2309 getRootView().findViewById(R.id.omnibox_results_container).g etBackground(), | 2334 mFadingView.getBackground(), AnimatorProperties.DRAWABLE_ALP HA_PROPERTY, 255, |
2310 AnimatorProperties.DRAWABLE_ALPHA_PROPERTY, 255, 0); | 2335 0); |
2311 mFadeOutOmniboxBackgroundAnimator.setDuration(OMNIBOX_CONTAINER_BACK GROUND_FADE_MS); | 2336 mFadeOutOmniboxBackgroundAnimator.setDuration(OMNIBOX_CONTAINER_BACK GROUND_FADE_MS); |
2312 mFadeOutOmniboxBackgroundAnimator.setInterpolator( | 2337 mFadeOutOmniboxBackgroundAnimator.setInterpolator( |
2313 BakedBezierInterpolator.FADE_OUT_CURVE); | 2338 BakedBezierInterpolator.FADE_OUT_CURVE); |
2314 mFadeOutOmniboxBackgroundAnimator.addListener(new CancelAwareAnimato rListener() { | 2339 mFadeOutOmniboxBackgroundAnimator.addListener(new CancelAwareAnimato rListener() { |
2315 @Override | 2340 @Override |
2316 public void onEnd(Animator animator) { | 2341 public void onEnd(Animator animator) { |
2317 updateOmniboxResultsContainerVisibility(false); | 2342 updateOmniboxResultsContainerVisibility(false); |
2343 mFadingView.setVisibility(View.GONE); | |
2318 } | 2344 } |
2319 }); | 2345 }); |
2320 } | 2346 } |
2321 runOmniboxResultsFadeAnimation(mFadeOutOmniboxBackgroundAnimator); | 2347 runOmniboxResultsFadeAnimation(mFadeOutOmniboxBackgroundAnimator); |
2322 } | 2348 } |
2323 | 2349 |
2324 private void runOmniboxResultsFadeAnimation(Animator fadeAnimation) { | 2350 private void runOmniboxResultsFadeAnimation(Animator fadeAnimation) { |
2325 if (mOmniboxBackgroundAnimator == fadeAnimation | 2351 if (mOmniboxBackgroundAnimator == fadeAnimation |
2326 && mOmniboxBackgroundAnimator.isRunning()) { | 2352 && mOmniboxBackgroundAnimator.isRunning()) { |
2327 return; | 2353 return; |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2503 public View getContainerView() { | 2529 public View getContainerView() { |
2504 return this; | 2530 return this; |
2505 } | 2531 } |
2506 | 2532 |
2507 @Override | 2533 @Override |
2508 public void setTitleToPageTitle() { } | 2534 public void setTitleToPageTitle() { } |
2509 | 2535 |
2510 @Override | 2536 @Override |
2511 public void setShowTitle(boolean showTitle) { } | 2537 public void setShowTitle(boolean showTitle) { } |
2512 } | 2538 } |
OLD | NEW |