DO NOT MERGE Retroactive feedback
Incorporating feedback from ag/470934
Change-Id: I5338c2a9819b9c1c741f4bd97cef9cfef118c0e1
(cherry picked from commit 17ff6d32785b726b67fd3ac18e273651f15f59c0)
diff --git a/v17/leanback/res/values/strings.xml b/v17/leanback/res/values/strings.xml
index 38e5a0b..4cd08f2 100644
--- a/v17/leanback/res/values/strings.xml
+++ b/v17/leanback/res/values/strings.xml
@@ -18,7 +18,7 @@
<string name="orb_search_label">Search</string>
<string name="orb_search_action">Search Action</string>
<string name="lb_search_bar_hint">Search</string>
- <string name="lb_search_bar_hint_speech">Search to search</string>
+ <string name="lb_search_bar_hint_speech">Speak to search</string>
<string name="lb_search_bar_hint_with_title">Search %1$s</string>
<string name="lb_search_bar_hint_with_title_speech">Speak to search %1$s</string>
</resources>
\ No newline at end of file
diff --git a/v17/leanback/src/android/support/v17/leanback/widget/SearchBar.java b/v17/leanback/src/android/support/v17/leanback/widget/SearchBar.java
index acd6ff3..ae717ab 100644
--- a/v17/leanback/src/android/support/v17/leanback/widget/SearchBar.java
+++ b/v17/leanback/src/android/support/v17/leanback/widget/SearchBar.java
@@ -110,10 +110,12 @@
public SearchBar(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
+ Resources r = getResources();
LayoutInflater inflater = LayoutInflater.from(getContext());
inflater.inflate(R.layout.lb_search_bar, this, true);
+ mBarHeight = getResources().getDimensionPixelSize(R.dimen.lb_search_bar_height);
RelativeLayout.LayoutParams params = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
mBarHeight);
params.addRule(ALIGN_PARENT_TOP, RelativeLayout.TRUE);
@@ -126,14 +128,12 @@
(InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE);
mSpeechRecognizer = SpeechRecognizer.createSpeechRecognizer(context);
- Resources r = getResources();
+
mTextSpeechColor = r.getColor(R.color.lb_search_bar_text_speech_color);
mBackgroundSpeechAlpha = r.getInteger(R.integer.lb_search_bar_speech_mode_background_alpha);
mTextColor = r.getColor(R.color.lb_search_bar_text_color);
mBackgroundAlpha = r.getInteger(R.integer.lb_search_bar_text_mode_background_alpha);
-
- mBarHeight = getResources().getDimensionPixelSize(R.dimen.lb_search_bar_height);
}
@Override
@@ -342,12 +342,12 @@
return mBadgeDrawable;
}
- protected void hideNativeKeyboard() {
+ private void hideNativeKeyboard() {
mInputMethodManager.hideSoftInputFromWindow(mSearchTextEditor.getWindowToken(),
InputMethodManager.RESULT_UNCHANGED_SHOWN);
}
- protected void showNativeKeyboard() {
+ private void showNativeKeyboard() {
mHandler.post(new Runnable() {
@Override
public void run() {
@@ -365,7 +365,7 @@
/**
* This will update the hint for the search bar properly depending on state and provided title
*/
- protected void updateHint() {
+ private void updateHint() {
if (null == mSearchTextEditor) return;
String title = getResources().getString(R.string.lb_search_bar_hint);
@@ -381,7 +381,7 @@
mSearchTextEditor.setHint(title);
}
- protected void stopRecognition() {
+ private void stopRecognition() {
if (DEBUG) Log.v(TAG, "stopRecognition " + mListening);
mSpeechOrbView.showNotListening();
@@ -390,7 +390,7 @@
}
}
- protected void startRecognition() {
+ private void startRecognition() {
if (DEBUG) Log.v(TAG, "startRecognition " + mListening);
mSearchTextEditor.setText("");
@@ -494,7 +494,7 @@
mListening = true;
}
- protected void updateUi() {
+ private void updateUi() {
if (DEBUG) Log.v(TAG, String.format("Update UI %s %s",
isVoiceMode() ? "Voice" : "Text",
hasFocus() ? "Focused" : "Unfocused"));
@@ -509,11 +509,11 @@
updateHint();
}
- protected boolean isVoiceMode() {
+ private boolean isVoiceMode() {
return mSpeechOrbView.isFocused();
}
- protected void submitQuery() {
+ private void submitQuery() {
if (!TextUtils.isEmpty(mSearchQuery) && null != mSearchBarListener) {
mSearchBarListener.onSearchQuerySubmit(mSearchQuery);
}