diff options
author | Michael Kolb <kolby@google.com> | 2012-06-04 17:44:55 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2012-06-04 17:44:55 -0700 |
commit | 80f6d0574a9655fac3bd219afcb1810d0f66a57f (patch) | |
tree | 41a0505b0d73443a1888e78ce7e07f7a415cb791 /src/com/android/browser/NavigationBarTablet.java | |
parent | c5261afa465cdb0f1970ba5fa6318e931cb28b0a (diff) | |
parent | 3c573ac4dbc0e9a117a9540c410911bab52dffa7 (diff) | |
download | packages_apps_Browser-80f6d0574a9655fac3bd219afcb1810d0f66a57f.zip packages_apps_Browser-80f6d0574a9655fac3bd219afcb1810d0f66a57f.tar.gz packages_apps_Browser-80f6d0574a9655fac3bd219afcb1810d0f66a57f.tar.bz2 |
am 3c573ac4: Merge "Enable voice search in omnibox" into jb-dev
* commit '3c573ac4dbc0e9a117a9540c410911bab52dffa7':
Enable voice search in omnibox
Diffstat (limited to 'src/com/android/browser/NavigationBarTablet.java')
-rw-r--r-- | src/com/android/browser/NavigationBarTablet.java | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/src/com/android/browser/NavigationBarTablet.java b/src/com/android/browser/NavigationBarTablet.java index 426174b..79c8de6 100644 --- a/src/com/android/browser/NavigationBarTablet.java +++ b/src/com/android/browser/NavigationBarTablet.java @@ -32,10 +32,9 @@ import android.widget.ImageButton; import android.widget.ImageView; import com.android.browser.UI.ComboViews; +import com.android.browser.UrlInputView.StateListener; -import java.util.List; - -public class NavigationBarTablet extends NavigationBarBase { +public class NavigationBarTablet extends NavigationBarBase implements StateListener { private Drawable mStopDrawable; private Drawable mReloadDrawable; @@ -51,6 +50,7 @@ public class NavigationBarTablet extends NavigationBarBase { private ImageView mStopButton; private View mAllButton; private View mClearButton; + private View mVoiceButton; private View mNavButtons; private Drawable mFocusDrawable; private Drawable mUnfocusDrawable; @@ -99,6 +99,7 @@ public class NavigationBarTablet extends NavigationBarBase { mStopButton = (ImageView) findViewById(R.id.stop); mSearchButton = (ImageView) findViewById(R.id.search); mClearButton = findViewById(R.id.clear); + mVoiceButton = findViewById(R.id.voice); mUrlContainer = findViewById(R.id.urlbar_focused); mBackButton.setOnClickListener(this); mForwardButton.setOnClickListener(this); @@ -107,7 +108,9 @@ public class NavigationBarTablet extends NavigationBarBase { mStopButton.setOnClickListener(this); mSearchButton.setOnClickListener(this); mClearButton.setOnClickListener(this); + mVoiceButton.setOnClickListener(this); mUrlInput.setContainer(mUrlContainer); + mUrlInput.setStateListener(this); } public void onConfigurationChanged(Configuration config) { @@ -176,6 +179,8 @@ public class NavigationBarTablet extends NavigationBarBase { stopOrRefresh(); } else if (mClearButton == v) { clearOrClose(); + } else if (mVoiceButton == v) { + mUiController.startVoiceRecognizer(); } else { super.onClick(v); } @@ -217,14 +222,12 @@ public class NavigationBarTablet extends NavigationBarBase { } mSearchButton.setVisibility(View.GONE); mStar.setVisibility(View.GONE); - mClearButton.setVisibility(View.VISIBLE); mUrlIcon.setImageResource(R.drawable.ic_search_holo_dark); } else { if (mHideNavButtons) { showNavButtons(); } showHideStar(mUiController.getCurrentTab()); - mClearButton.setVisibility(View.GONE); if (mTitleBar.useQuickControls()) { mSearchButton.setVisibility(View.GONE); } else { @@ -289,6 +292,7 @@ public class NavigationBarTablet extends NavigationBarBase { mAnimation.cancel(); } mNavButtons.setVisibility(View.VISIBLE); + mNavButtons.setTranslationX(0); if (!mBaseUi.blockFocusAnimations()) { int awidth = mNavButtons.getMeasuredWidth(); Animator anim1 = ObjectAnimator.ofFloat(mNavButtons, @@ -316,4 +320,23 @@ public class NavigationBarTablet extends NavigationBarBase { } } + @Override + public void onStateChanged(int state) { + switch(state) { + case STATE_NORMAL: + mClearButton.setVisibility(View.GONE); + mVoiceButton.setVisibility(View.GONE); + + break; + case STATE_HIGHLIGHTED: + mClearButton.setVisibility(View.GONE); + mVoiceButton.setVisibility(View.VISIBLE); + break; + case STATE_EDITED: + mClearButton.setVisibility(View.VISIBLE); + mVoiceButton.setVisibility(View.GONE); + break; + } + } + } |