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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/searchwidget/SearchActivityLocationBarLayout.java

Issue 2816733003: 🔍 Update how shared preferences are handled by the widget (Closed)
Patch Set: Ugh eclipse 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 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.searchwidget; 5 package org.chromium.chrome.browser.searchwidget;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 import android.os.Handler; 8 import android.os.Handler;
9 import android.util.AttributeSet; 9 import android.util.AttributeSet;
10 import android.view.View; 10 import android.view.View;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 68
69 @Override 69 @Override
70 public void onNativeLibraryReady() { 70 public void onNativeLibraryReady() {
71 super.onNativeLibraryReady(); 71 super.onNativeLibraryReady();
72 setAutocompleteProfile(Profile.getLastUsedProfile().getOriginalProfile() ); 72 setAutocompleteProfile(Profile.getLastUsedProfile().getOriginalProfile() );
73 setShowCachedZeroSuggestResults(true); 73 setShowCachedZeroSuggestResults(true);
74 } 74 }
75 75
76 /** Called when the SearchActivity has finished initialization. */ 76 /** Called when the SearchActivity has finished initialization. */
77 void onDeferredStartup(boolean isVoiceSearchIntent) { 77 void onDeferredStartup(boolean isVoiceSearchIntent) {
78 SearchWidgetProvider.updateCachedVoiceSearchAvailability(isVoiceSearchEn abled());
78 if (isVoiceSearchIntent && mUrlBar.isFocused()) onUrlFocusChange(true); 79 if (isVoiceSearchIntent && mUrlBar.isFocused()) onUrlFocusChange(true);
79 } 80 }
80 81
81 /** Begins a new query. */ 82 /** Begins a new query. */
82 void beginQuery(boolean isVoiceSearchIntent) { 83 void beginQuery(boolean isVoiceSearchIntent) {
83 if (isVoiceSearchIntent) { 84 if (isVoiceSearchEnabled() && isVoiceSearchIntent) {
84 startVoiceRecognition(); 85 startVoiceRecognition();
85 } else { 86 } else {
86 focusTextBox(); 87 focusTextBox();
87 } 88 }
88 } 89 }
89 90
90 private void focusTextBox() { 91 private void focusTextBox() {
91 if (mNativeInitialized) onUrlFocusChange(true); 92 if (mNativeInitialized) onUrlFocusChange(true);
92 93
93 mUrlBar.setIgnoreTextChangesForAutocomplete(true); 94 mUrlBar.setIgnoreTextChangesForAutocomplete(true);
94 mUrlBar.setUrl("", null); 95 mUrlBar.setUrl("", null);
95 mUrlBar.setIgnoreTextChangesForAutocomplete(false); 96 mUrlBar.setIgnoreTextChangesForAutocomplete(false);
96 97
97 mUrlBar.setCursorVisible(true); 98 mUrlBar.setCursorVisible(true);
98 mUrlBar.setSelection(0, mUrlBar.getText().length()); 99 mUrlBar.setSelection(0, mUrlBar.getText().length());
99 new Handler().post(new Runnable() { 100 new Handler().post(new Runnable() {
100 @Override 101 @Override
101 public void run() { 102 public void run() {
102 UiUtils.showKeyboard(mUrlBar); 103 UiUtils.showKeyboard(mUrlBar);
103 } 104 }
104 }); 105 });
105 } 106 }
106 } 107 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698