コード例 #1
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();
 }
コード例 #2
0
ファイル: TitleBar.java プロジェクト: LeMaker/android-actions
  public void hideAutoLogin(boolean animate) {
    if (mUseQuickControls) {
      mBaseUi.hideTitleBar();
      mAutoLogin.setVisibility(View.GONE);
      mBaseUi.refreshWebView();
    } else {
      if (animate) {
        Animation anim = AnimationUtils.loadAnimation(getContext(), R.anim.autologin_exit);
        anim.setAnimationListener(
            new AnimationListener() {
              @Override
              public void onAnimationEnd(Animation a) {
                mAutoLogin.setVisibility(View.GONE);
                mBaseUi.refreshWebView();
              }

              @Override
              public void onAnimationStart(Animation a) {}

              @Override
              public void onAnimationRepeat(Animation a) {}
            });
        mAutoLogin.startAnimation(anim);
      } else if (mAutoLogin.getAnimation() == null) {
        mAutoLogin.setVisibility(View.GONE);
        mBaseUi.refreshWebView();
      }
    }
  }
コード例 #3
0
 @Override
 public void onDismiss() {
   final Tab currentTab = mBaseUi.getActiveTab();
   mBaseUi.hideTitleBar();
   post(
       new Runnable() {
         public void run() {
           clearFocus();
           if ((currentTab != null) && !mInVoiceMode) {
             setDisplayTitle(currentTab.getUrl());
           }
         }
       });
 }
コード例 #4
0
ファイル: TitleBar.java プロジェクト: LeMaker/android-actions
  /**
   * ***********************************
   *
   * <p>ActionsCode(author:hexibin, change_code)
   */
  @Override
  protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    super.onMeasure(widthMeasureSpec, heightMeasureSpec);
    // ActionsCode(hexibin, bugfix BUG00297099)
    if (mIsFixedTitleBar && mShowing) {
      int margin = getMeasuredHeight() - calculateEmbeddedHeight();
      mBaseUi.setContentViewMarginTop(-margin);
    } else {
      mBaseUi.setContentViewMarginTop(0);
    }

    // ActionsCode(hexibin, bugfix BUG00297099)
    if (!mShowing) {
      setMeasuredDimension(0, 0);
    }
  }
コード例 #5
0
ファイル: TitleBar.java プロジェクト: LeMaker/android-actions
 /** Update the progress, from 0 to 100. */
 public void setProgress(int newProgress) {
   if (newProgress >= PROGRESS_MAX) {
     mProgress.setProgress(PageProgressView.MAX_PROGRESS);
     mProgress.setVisibility(View.GONE);
     mInLoad = false;
     mNavBar.onProgressStopped();
     // check if needs to be hidden
     if (!isEditingUrl() && !wantsToBeVisible()) {
       if (mUseQuickControls) {
         hide();
       } else {
         mBaseUi.showTitleBarForDuration();
       }
     }
   } else {
     if (!mInLoad) {
       mProgress.setVisibility(View.VISIBLE);
       mInLoad = true;
       mNavBar.onProgressStarted();
     }
     mProgress.setProgress(newProgress * PageProgressView.MAX_PROGRESS / PROGRESS_MAX);
     if (mUseQuickControls && !isEditingUrl()) {
       // ActionsCode(hexibin, bugfix BUG00297099)
       // setShowProgressOnly(true);
     }
     if (!mShowing) {
       show();
     }
   }
 }
コード例 #6
0
ファイル: TitleBar.java プロジェクト: victoryckl/XBrowser
 @Override
 public void onAnimationEnd(Animator animation) {
   if (!mWasCanceled) {
     setTranslationY(0);
   }
   mBaseUi.setTitleGravity(Gravity.NO_GRAVITY);
 }
コード例 #7
0
 /** callback from suggestion dropdown user selected a suggestion */
 @Override
 public void onAction(String text, String extra, String source) {
   mUiController.getCurrentTopWebView().requestFocus();
   if (UrlInputView.TYPED.equals(source)) {
     String url = UrlUtils.smartUrlFilter(text, false);
     Tab t = mBaseUi.getActiveTab();
     // Only shortcut javascript URIs for now, as there is special
     // logic in UrlHandler for other schemas
     if (url != null && t != null && url.startsWith("javascript:")) {
       mUiController.loadUrl(t, url);
       setDisplayTitle(text);
       return;
     }
   }
   Intent i = new Intent();
   String action = null;
   if (UrlInputView.VOICE.equals(source)) {
     action = RecognizerResultsIntent.ACTION_VOICE_SEARCH_RESULTS;
     source = null;
   } else {
     action = Intent.ACTION_SEARCH;
   }
   i.setAction(action);
   i.putExtra(SearchManager.QUERY, text);
   if (extra != null) {
     i.putExtra(SearchManager.EXTRA_DATA_KEY, extra);
   }
   if (source != null) {
     Bundle appData = new Bundle();
     appData.putString(com.android.common.Search.SOURCE, source);
     i.putExtra(SearchManager.APP_DATA, appData);
   }
   mUiController.handleNewIntent(i);
   setDisplayTitle(text);
 }
コード例 #8
0
 @Override
 public void showCustomView(
     View view, int requestedOrientation, WebChromeClient.CustomViewCallback callback) {
   super.showCustomView(view, requestedOrientation, callback);
   mTitleBar.setTranslationY(
       -mActivity.getResources().getDimensionPixelSize(R.dimen.toolbar_height));
   if (mActionBar != null) mActionBar.hide();
 }
コード例 #9
0
  @Override
  public void onStart() {
    super.onStart();

    // before webview loaded
    showDialog(DIALOG_PROGRESS);
    getWindow().requestFeature(Window.FEATURE_PROGRESS);
  }
コード例 #10
0
ファイル: TitleBar.java プロジェクト: LeMaker/android-actions
 public WebView getCurrentWebView() {
   Tab t = mBaseUi.getActiveTab();
   if (t != null) {
     return t.getWebView();
   } else {
     return null;
   }
 }
コード例 #11
0
ファイル: TitleBar.java プロジェクト: LeMaker/android-actions
 private void setFixedTitleBar() {
   // If getParent() returns null, we are initializing
   ViewGroup parent = (ViewGroup) getParent();
   if (mIsFixedTitleBar && parent != null) return;
   mIsFixedTitleBar = true;
   setSkipTitleBarAnimations(true);
   show();
   setSkipTitleBarAnimations(false);
   if (parent != null) {
     parent.removeView(this);
   }
   if (mIsFixedTitleBar) {
     mBaseUi.addFixedTitleBar(this);
   } else {
     mContentView.addView(this, makeLayoutParams());
     mBaseUi.setContentViewMarginTop(0);
   }
 }
コード例 #12
0
ファイル: BottomBar.java プロジェクト: zst123/p201-packages
 private void setupBottomBar() {
   ViewGroup parent = (ViewGroup) getParent();
   show();
   if (parent != null) {
     parent.removeView(this);
   }
   mContentView.addView(this, makeLayoutParams());
   mBaseUi.setContentViewMarginBottom(0);
 }
コード例 #13
0
 @Override
 public void onProgressChanged(Tab tab) {
   super.onProgressChanged(tab);
   if (mComboView != null && !mComboView.isShowing()) {
     mActionBar = mActivity.getActionBar();
     setupActionBar();
     if (mActionBar != null) mActionBar.show();
     if (mNavBar != null) mNavBar.setVisibility(View.VISIBLE);
   }
 }
コード例 #14
0
 @Override
 public void setActiveTab(final Tab tab) {
   super.setActiveTab(tab);
   BrowserWebView view = (BrowserWebView) tab.getWebView();
   // TabControl.setCurrentTab has been called before this,
   // so the tab is guaranteed to have a webview
   if (view == null) {
     Log.e(LOGTAG, "active tab with no webview detected");
     return;
   }
   mTabBar.onSetActiveTab(tab);
 }
コード例 #15
0
ファイル: TitleBar.java プロジェクト: LeMaker/android-actions
 public void showAutoLogin(boolean animate) {
   if (mUseQuickControls) {
     mBaseUi.showTitleBar();
   }
   if (mAutoLogin == null) {
     inflateAutoLoginBar();
   }
   mAutoLogin.setVisibility(View.VISIBLE);
   if (animate) {
     mAutoLogin.startAnimation(AnimationUtils.loadAnimation(getContext(), R.anim.autologin_enter));
   }
 }
コード例 #16
0
 // Set the favicon in the title bar.
 @Override
 public void setFavicon(Tab tab) {
   super.setFavicon(tab);
   mTabBar.onFavicon(tab, tab.getFavicon());
   /*
           if (mActiveTab == tab) {
               int color = NavigationBarBase.getSiteIconColor(tab.getUrl());
               if (tab.hasFavicon()) {
                   color = ColorUtils.getDominantColorForBitmap(tab.getFavicon());
               }
               mActionBar.setBackgroundDrawable(new ColorDrawable(color));
           }
   */
 }
コード例 #17
0
ファイル: TitleBar.java プロジェクト: victoryckl/XBrowser
 void hide() {
   if (mUseQuickControls) {
     mParent.removeView(this);
   } else {
     if (!mSkipTitleBarAnimations) {
       cancelTitleBarAnimation(false);
       int visibleHeight = getVisibleTitleHeight();
       mTitleBarAnimator =
           ObjectAnimator.ofFloat(
               this, "translationY", getTranslationY(), (-getEmbeddedHeight() + visibleHeight));
       mTitleBarAnimator.addListener(mHideTileBarAnimatorListener);
       setupTitleBarAnimator(mTitleBarAnimator);
       mTitleBarAnimator.start();
     } else {
       mBaseUi.setTitleGravity(Gravity.NO_GRAVITY);
     }
   }
   mShowing = false;
 }
コード例 #18
0
ファイル: TitleBar.java プロジェクト: victoryckl/XBrowser
 void show() {
   if (mUseQuickControls) {
     mParent.addView(this);
   } else {
     if (!mSkipTitleBarAnimations) {
       cancelTitleBarAnimation(false);
       int visibleHeight = getVisibleTitleHeight();
       float startPos = (-getEmbeddedHeight() + visibleHeight);
       if (getTranslationY() != 0) {
         startPos = Math.max(startPos, getTranslationY());
       }
       mTitleBarAnimator = ObjectAnimator.ofFloat(this, "translationY", startPos, 0);
       setupTitleBarAnimator(mTitleBarAnimator);
       mTitleBarAnimator.start();
     }
     mBaseUi.setTitleGravity(Gravity.TOP);
   }
   mShowing = true;
 }
コード例 #19
0
 @Override
 protected void onPause() {
   webView.stopLoading();
   super.onPause();
 }
コード例 #20
0
 @Override
 public void showWeb(boolean animate) {
   super.showWeb(animate);
   hideComboView();
 }
コード例 #21
0
 @Override
 public void onResume() {
   super.onResume();
   mNavBar.clearCompletions();
 }
コード例 #22
0
 @Override
 public void removeTab(Tab tab) {
   super.removeTab(tab);
   mTabBar.onRemoveTab(tab);
 }
コード例 #23
0
ファイル: TitleBar.java プロジェクト: LeMaker/android-actions
 private int getVisibleTitleHeight() {
   Tab tab = mBaseUi.getActiveTab();
   WebView webview = tab != null ? tab.getWebView() : null;
   return webview != null ? webview.getVisibleTitleHeight() : 0;
 }
コード例 #24
0
 @Override
 public void editUrl(boolean clearInput, boolean forceIME) {
   super.editUrl(clearInput, forceIME);
 }
コード例 #25
0
 @Override
 public void setUrlTitle(Tab tab) {
   super.setUrlTitle(tab);
   mTabBar.onUrlAndTitle(tab, tab.getUrl(), tab.getTitle());
 }
コード例 #26
0
 public void setFavicon(Bitmap icon) {
   if (mFavicon == null) return;
   mFavicon.setImageDrawable(mBaseUi.getFaviconDrawable(icon));
 }
コード例 #27
0
 @Override
 public void onHideCustomView() {
   super.onHideCustomView();
   if (mActionBar != null) mActionBar.show();
   mTitleBar.setTranslationY(0);
 }