Пример #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();
 }