コード例 #1
0
 /** callback from the suggestion dropdown copy text to input field and stay in edit mode */
 @Override
 public void onCopySuggestion(String text) {
   mUrlInput.setText(text, true);
   if (text != null) {
     mUrlInput.setSelection(text.length());
   }
 }
コード例 #2
0
 @Override
 protected void onFinishInflate() {
   super.onFinishInflate();
   mLockIcon = (ImageView) findViewById(R.id.lock);
   mFavicon = (ImageView) findViewById(R.id.favicon);
   mUrlInput = (UrlInputView) findViewById(R.id.url);
   mUrlInput.setUrlInputListener(this);
   mUrlInput.setOnFocusChangeListener(this);
   mUrlInput.setSelectAllOnFocus(true);
   mUrlInput.addQueryTextWatcher(this);
 }
コード例 #3
0
 @Override
 public void onFocusChange(View view, boolean hasFocus) {
   // if losing focus and not in touch mode, leave as is
   if (hasFocus || view.isInTouchMode() || mUrlInput.needsUpdate()) {
     setFocusState(hasFocus);
   }
   if (hasFocus) {
     mBaseUi.showTitleBar();
     mUrlInput.forceIme();
     if (mInVoiceMode) {
       mUrlInput.forceFilter();
     }
   } else if (!mUrlInput.needsUpdate()) {
     mUrlInput.dismissDropDown();
     mUrlInput.hideIME();
     if (mUrlInput.getText().length() == 0) {
       Tab currentTab = mUiController.getTabControl().getCurrentTab();
       if (currentTab != null) {
         setDisplayTitle(currentTab.getUrl());
       }
     }
     mBaseUi.suggestHideTitleBar();
   }
   mUrlInput.clearNeedsUpdate();
 }
コード例 #4
0
 /**
  * called from the Ui when the user wants to edit
  *
  * @param clearInput clear the input field
  */
 void startEditingUrl(boolean clearInput) {
   // editing takes preference of progress
   setVisibility(View.VISIBLE);
   if (mTitleBar.useQuickControls()) {
     mTitleBar.getProgressView().setVisibility(View.GONE);
   }
   if (!mUrlInput.hasFocus()) {
     mUrlInput.requestFocus();
   }
   if (clearInput) {
     mUrlInput.setText("");
   } else if (mInVoiceMode) {
     mUrlInput.showDropDown();
   }
 }
コード例 #5
0
 @Override
 public void onTextChanged(String newText) {
   if (mUrlInput.hasFocus()) {
     // clear voice mode when user types
     setInVoiceMode(false, null);
   }
 }
コード例 #6
0
 @Override
 public boolean dispatchKeyEventPreIme(KeyEvent evt) {
   if (evt.getKeyCode() == KeyEvent.KEYCODE_BACK) {
     // catch back key in order to do slightly more cleanup than usual
     mUrlInput.clearFocus();
     return true;
   }
   return super.dispatchKeyEventPreIme(evt);
 }
コード例 #7
0
 public void setTitleBar(TitleBar titleBar) {
   mTitleBar = titleBar;
   mBaseUi = mTitleBar.getUi();
   mUiController = mTitleBar.getUiController();
   mUrlInput.setController(mUiController);
 }
コード例 #8
0
 void registerDropdownChangeListener(DropdownChangeListener d) {
   mUrlInput.registerDropdownChangeListener(d);
 }
コード例 #9
0
 void clearCompletions() {
   mUrlInput.setSuggestedText(null);
 }
コード例 #10
0
 void setIncognitoMode(boolean incognito) {
   mUrlInput.setIncognitoMode(incognito);
 }
コード例 #11
0
 public void setInVoiceMode(boolean voicemode, List<String> voiceResults) {
   mInVoiceMode = voicemode;
   mUrlInput.setVoiceResults(voiceResults);
 }
コード例 #12
0
 void setDisplayTitle(String title) {
   if (!isEditingUrl()) {
     mUrlInput.setText(title, false);
   }
 }
コード例 #13
0
 void stopEditingUrl() {
   mUrlInput.clearFocus();
 }
コード例 #14
0
 public boolean isEditingUrl() {
   return mUrlInput.hasFocus();
 }