Ejemplo n.º 1
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);
 }
Ejemplo n.º 2
0
 private void onCloseTab(Tab tab) {
   if (tab != null) {
     if (tab == mUiController.getCurrentTab()) {
       mUiController.closeCurrentTab();
     } else {
       mUiController.closeTab(tab);
     }
   }
 }
Ejemplo n.º 3
0
 public void editUrl(boolean clearInput) {
   if (mUiController.isInCustomActionMode()) {
     mUiController.endActionMode();
   }
   showTitleBar();
   if ((getActiveTab() != null) && !getActiveTab().isSnapshot()) {
     mNavigationBar.startEditingUrl(clearInput);
   }
 }
Ejemplo n.º 4
0
 protected void attachTabToContentView(Tab tab) {
   if ((tab == null) || (tab.getWebView() == null)) {
     return;
   }
   View container = tab.getViewContainer();
   WebView mainView = tab.getWebView();
   // Attach the WebView to the container and then attach the
   // container to the content view.
   FrameLayout wrapper = (FrameLayout) container.findViewById(R.id.webview_wrapper);
   ViewGroup parent = (ViewGroup) mainView.getParent();
   if (parent != wrapper) {
     if (parent != null) {
       Log.w(LOGTAG, "mMainView already has a parent in" + " attachTabToContentView!");
       parent.removeView(mainView);
     }
     wrapper.addView(mainView);
   } else {
     Log.w(LOGTAG, "mMainView is already attached to wrapper in" + " attachTabToContentView!");
   }
   parent = (ViewGroup) container.getParent();
   if (parent != mContentView) {
     if (parent != null) {
       Log.w(LOGTAG, "mContainer already has a parent in" + " attachTabToContentView!");
       parent.removeView(container);
     }
     mContentView.addView(container, COVER_SCREEN_PARAMS);
   } else {
     Log.w(LOGTAG, "mContainer is already attached to content in" + " attachTabToContentView!");
   }
   mUiController.attachSubWindow(tab);
 }
Ejemplo n.º 5
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();
 }
Ejemplo n.º 6
0
 boolean canShowTitleBar() {
   return !isTitleBarShowing()
       && !isActivityPaused()
       && (getActiveTab() != null)
       && (getWebView() != null)
       && !mUiController.isInCustomActionMode();
 }
Ejemplo n.º 7
0
 private void EditNewButtonActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_EditNewButtonActionPerformed
   int row = jTable5.getSelectedRow();
   int value = Integer.parseInt("" + table.getValueAt(row, 0));
   inventory.GeneralMovie singleMovie = result.get(value);
   new EditTitleDialog(localUIC.getCurrentFrame(), false, singleMovie).setVisible(true);
 } // GEN-LAST:event_EditNewButtonActionPerformed
Ejemplo n.º 8
0
 @Override
 public void setActiveTab(final Tab tab) {
   mHandler.removeMessages(MSG_HIDE_TITLEBAR);
   if ((tab != mActiveTab) && (mActiveTab != null)) {
     removeTabFromContentView(mActiveTab);
     WebView web = mActiveTab.getWebView();
     if (web != null) {
       web.setOnTouchListener(null);
     }
   }
   mActiveTab = tab;
   WebView web = mActiveTab.getWebView();
   updateUrlBarAutoShowManagerTarget();
   attachTabToContentView(tab);
   setShouldShowErrorConsole(tab, mUiController.shouldShowErrorConsole());
   onTabDataChanged(tab);
   onProgressChanged(tab);
   mNavigationBar.setIncognitoMode(tab.isPrivateBrowsingEnabled());
   updateAutoLogin(tab, false);
   if (web != null
       && web.getVisibleTitleHeight() != mTitleBar.getEmbeddedHeight()
       && !mUseQuickControls) {
     showTitleBarForDuration();
   }
 }
Ejemplo n.º 9
0
 @Override
 public boolean onBackKey() {
   if (mCustomView != null) {
     mUiController.hideCustomView();
     return true;
   }
   return false;
 }
Ejemplo n.º 10
0
 private void removeTabFromContentView(Tab tab) {
   hideTitleBar();
   // Remove the container that contains the main WebView.
   WebView mainView = tab.getWebView();
   View container = tab.getViewContainer();
   if (mainView == null) {
     return;
   }
   // Remove the container from the content and then remove the
   // WebView from the container. This will trigger a focus change
   // needed by WebView.
   mainView.setEmbeddedTitleBar(null);
   FrameLayout wrapper = (FrameLayout) container.findViewById(R.id.webview_wrapper);
   wrapper.removeView(mainView);
   mContentView.removeView(container);
   mUiController.endActionMode();
   mUiController.removeSubWindow(tab);
   ErrorConsoleView errorConsole = tab.getErrorConsole(false);
   if (errorConsole != null) {
     mErrorConsoleContainer.removeView(errorConsole);
   }
 }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    ScrollView sv = new ScrollView(getActivity());
    TableLayout tl = new TableLayout(getActivity());
    sv.addView(tl);

    if (displayReportController == null) {
      return sv;
    }
    AdsenseReportsGenerateResponse response = displayReportController.getReportResponse();

    TableLayout.LayoutParams tableRowParams =
        new TableLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    tableRowParams.setMargins(10, 10, 10, 10);

    TableRow.LayoutParams tvParams =
        new TableRow.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    tvParams.setMargins(10, 10, 10, 10);

    List<Headers> headers = response.getHeaders();
    TableRow tr = new TableRow(getActivity());
    tl.addView(tr);

    for (Headers header : headers) {
      TextView tv = new TextView(getActivity());
      tv.setText(header.getName());
      tr.setLayoutParams(tableRowParams);
      tr.addView(tv);
    }
    if (response.getRows() != null && !response.getRows().isEmpty()) {
      for (List<String> row : response.getRows()) {
        TableRow trow = new TableRow(getActivity());
        tl.addView(trow);
        for (String cell : row) {
          TextView tv = new TextView(getActivity());
          tv.setText(cell);
          trow.addView(tv);
          tv.setLayoutParams(tvParams);
          tv.setPadding(15, 5, 15, 5);
          tv.setBackgroundColor(Color.WHITE);
        }
      }
    }
    return sv;
  }
Ejemplo n.º 12
0
  @Override
  public void onClick(View v) {
    if (!mBuilder.mIsShowing) {
      return;
    }

    if (mNewTab == v) {
      if (mUiController.getTabControl().canCreateNewTab()) {
        callBackNewTabAnim();
      } else {
        boolean isShow =
            mUi.isShowMaxTabsDialog(
                new AlertDialog.OnClickListener() {
                  public void onClick(DialogInterface d, int which) {
                    mUi.closeTheLeastUsedTab();
                    mUi.updateCheckPrompt();
                    callBackNewTabAnim();
                    mBuilder.mIsShowing = false;
                  }
                },
                new AlertDialog.OnClickListener() {
                  public void onClick(DialogInterface d, int which) {
                    mBuilder.mIsShowing = true;
                  }
                });
        if (!isShow) {
          mUi.closeTheLeastUsedTab();
          callBackNewTabAnim();
          mBuilder.mIsShowing = false;
          return;
        }
        mBuilder.mIsShowing = true;
        return;
      }
    } else if (mClearAllTab == v) {
      clearAllTabs();
    } else if (mFullScreen == v) {
      if (!mUi.mNavScreenShowing) {
        callBackFullScreenAnim();
      } else {
        mBuilder.mIsShowing = true;
        return;
      }
    }
    mBuilder.mIsShowing = false;
  }
Ejemplo n.º 13
0
 private void init() {
   LayoutInflater.from(getContext()).inflate(R.layout.nav_screen, this);
   setContentDescription(
       getContext().getResources().getString(R.string.accessibility_transition_navscreen));
   System.out.println("================= NavScreen init 11111111 ====================");
   // mApplication = (Browser) mActivity.getApplication();
   mNewTab = (ImageButton) findViewById(R.id.newtab);
   mClearAllTab = (ImageButton) findViewById(R.id.clearall);
   mFullScreen = (ImageButton) findViewById(R.id.fullscreen);
   mClearAllTab.setOnClickListener(this);
   mFullScreen.setOnClickListener(this);
   mNewTab.setOnClickListener(this);
   mTc = mUiController.getTabControl();
   mTabViews = new HashMap<Tab, View>(mTc.getTabCount());
   mBuilder = (NavTabViewPagerBuilder) findViewById(R.id.viewPagerBuilder);
   mBuilder.makeViewPager(mUi, mTc);
   mNeedsMenu = !ViewConfiguration.get(getContext()).hasPermanentMenuKey();
   changeIncogStyle(mTc.getIncogMode());
 }
Ejemplo n.º 14
0
 public BaseUi(Activity browser, UiController controller) {
   mActivity = browser;
   mUiController = controller;
   mTabControl = controller.getTabControl();
   Resources res = mActivity.getResources();
   mInputManager = (InputMethodManager) browser.getSystemService(Activity.INPUT_METHOD_SERVICE);
   mLockIconSecure = res.getDrawable(R.drawable.ic_secure_holo_dark);
   mLockIconMixed = res.getDrawable(R.drawable.ic_secure_partial_holo_dark);
   FrameLayout frameLayout =
       (FrameLayout) mActivity.getWindow().getDecorView().findViewById(android.R.id.content);
   LayoutInflater.from(mActivity).inflate(R.layout.custom_screen, frameLayout);
   mContentView = (FrameLayout) frameLayout.findViewById(R.id.main_content);
   mCustomViewContainer = (FrameLayout) frameLayout.findViewById(R.id.fullscreen_custom_content);
   mErrorConsoleContainer = (LinearLayout) frameLayout.findViewById(R.id.error_console);
   setFullscreen(BrowserSettings.getInstance().useFullscreen());
   mGenericFavicon = res.getDrawable(R.drawable.app_web_browser_sm);
   mTitleBar = new TitleBar(mActivity, mUiController, this, mContentView);
   mTitleBar.setProgress(100);
   mNavigationBar = mTitleBar.getNavigationBar();
   mUrlBarAutoShowManager = new UrlBarAutoShowManager(this);
 }
Ejemplo n.º 15
0
  private void initLayout(Context context) {
    LayoutInflater factory = LayoutInflater.from(context);
    factory.inflate(R.layout.bottom_bar, this);
    mBottomBar = (LinearLayout) findViewById(R.id.bottombar);
    mBottomBarBack = (ImageView) findViewById(R.id.back);
    mBottomBarForward = (ImageView) findViewById(R.id.forward);
    mBottomBarTabs = (ImageView) findViewById(R.id.tabs);
    mBottomBarBookmarks = (ImageView) findViewById(R.id.bookmarks);
    mBottomBarTabCount = (TextView) findViewById(R.id.tabcount);

    mBottomBarBack.setOnClickListener(
        new OnClickListener() {
          public void onClick(View arg0) {
            ((Controller) mUiController).onBackKey();
          }
        });
    mBottomBarBack.setOnLongClickListener(
        new OnLongClickListener() {
          @Override
          public boolean onLongClick(View arg0) {
            Toast.makeText(
                    mUiController.getActivity(),
                    mUiController.getActivity().getResources().getString(R.string.back),
                    0)
                .show();
            return false;
          }
        });
    mBottomBarForward.setOnClickListener(
        new OnClickListener() {
          public void onClick(View arg0) {
            if (mUiController != null && mUiController.getCurrentTab() != null) {
              mUiController.getCurrentTab().goForward();
            }
          }
        });
    mBottomBarForward.setOnLongClickListener(
        new OnLongClickListener() {
          @Override
          public boolean onLongClick(View arg0) {
            Toast.makeText(
                    mUiController.getActivity(),
                    mUiController.getActivity().getResources().getString(R.string.forward),
                    0)
                .show();
            return false;
          }
        });
    mBottomBarTabs.setOnClickListener(
        new OnClickListener() {
          public void onClick(View arg0) {
            ((PhoneUi) mBaseUi).toggleNavScreen();
          }
        });
    mBottomBarTabs.setOnLongClickListener(
        new OnLongClickListener() {
          @Override
          public boolean onLongClick(View arg0) {
            Toast.makeText(
                    mUiController.getActivity(),
                    mUiController.getActivity().getResources().getString(R.string.tabs),
                    0)
                .show();
            return false;
          }
        });
    mBottomBarBookmarks.setOnClickListener(
        new OnClickListener() {
          public void onClick(View arg0) {
            mUiController.bookmarksOrHistoryPicker(ComboViews.Bookmarks);
          }
        });
    mBottomBarBookmarks.setOnLongClickListener(
        new OnLongClickListener() {
          @Override
          public boolean onLongClick(View arg0) {
            Toast.makeText(
                    mUiController.getActivity(),
                    mUiController.getActivity().getResources().getString(R.string.bookmarks),
                    0)
                .show();
            return false;
          }
        });
    mBottomBarTabCount.setText(Integer.toString(mUiController.getTabControl().getTabCount()));
    mTabControl.setOnTabCountChangedListener(
        new TabControl.OnTabCountChangedListener() {
          public void onTabCountChanged() {
            mBottomBarTabCount.setText(Integer.toString(mTabControl.getTabCount()));
          }
        });
  }
Ejemplo n.º 16
0
 private void addNewTitleButtonActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_addNewTitleButtonActionPerformed
   new AddNewTitleDialog(localUIC.getCurrentFrame(), false).setVisible(true);
 } // GEN-LAST:event_addNewTitleButtonActionPerformed
Ejemplo n.º 17
0
 @Override
 public void showWeb(boolean animate) {
   mUiController.hideCustomView();
 }
Ejemplo n.º 18
0
  public void callBackFullScreenAnim() {
    // mApplication.setmThumbnailPosition(mBuilder.mCurrentConfigPosition);
    int endPosition = mUiController.getTabControl().getCurrentPosition() / 4;
    Browser application = (Browser) mActivity.getApplication();
    int startPosition = application.getmThumbnailPosition();
    AnimatorSet moveAnim = null;
    int animTime = getResources().getInteger(R.integer.config_shortAnimTime);
    if (endPosition >= mBuilder.getList().size()) endPosition = mBuilder.getList().size() - 1;
    if (endPosition < 0) endPosition = 0;
    int width = getWidth();
    if (endPosition == startPosition) {
      mUi.hideNavScreen(mUiController.getTabControl().getTabPosition(mUi.getActiveTab()), true);
    } else if (endPosition > startPosition) {
      ObjectAnimator oTran;
      ArrayList<Animator> animList = new ArrayList<Animator>();
      for (int i = startPosition; i <= endPosition; i++) {
        if (i != endPosition) {
          oTran =
              ObjectAnimator.ofFloat(
                  mBuilder.getList().get(i), "translationX", 0, -(i - startPosition + 1) * width);
          oTran.setStartDelay(DELAYTIME * (i - startPosition));
          oTran.setDuration(animTime * (i - startPosition + 1));
        } else {
          oTran =
              ObjectAnimator.ofFloat(
                  mBuilder.getList().get(i),
                  "translationX",
                  0,
                  -(endPosition - startPosition) * width);
          oTran.setStartDelay(DELAYTIME * (endPosition - startPosition));
          oTran.setDuration(animTime * (endPosition - startPosition));
        }
        animList.add(oTran);
      }
      moveAnim = new AnimatorSet();
      moveAnim.playTogether(animList);
    } else {
      ObjectAnimator oTran;
      ArrayList<Animator> animList = new ArrayList<Animator>();
      for (int i = startPosition; i >= endPosition; i--) {
        if (i != endPosition) {
          oTran =
              ObjectAnimator.ofFloat(
                  mBuilder.getList().get(i), "translationX", 0, (startPosition - i + 1) * width);
          oTran.setStartDelay(DELAYTIME * (startPosition - i));
          oTran.setDuration(animTime * (startPosition - i + 1));
        } else {
          oTran =
              ObjectAnimator.ofFloat(
                  mBuilder.getList().get(i),
                  "translationX",
                  0,
                  (startPosition - endPosition) * width);
          oTran.setStartDelay(DELAYTIME * (startPosition - endPosition));
          oTran.setDuration(animTime * (startPosition - endPosition));
        }
        animList.add(oTran);
      }
      moveAnim = new AnimatorSet();
      moveAnim.playTogether(animList);
    }
    if (moveAnim != null) {
      moveAnim.addListener(
          new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animation) {
              // TODO Auto-generated method stub
              mUi.hideNavScreen(
                  mUiController.getTabControl().getTabPosition(mUi.getActiveTab()),
                  true,
                  animation);
              super.onAnimationEnd(animation);
            }
          });
      moveAnim.start();
    }
  }
Ejemplo n.º 19
0
 /** Remove the sub window from the content view. */
 @Override
 public void removeSubWindow(View subviewContainer) {
   mContentView.removeView(subviewContainer);
   mUiController.endActionMode();
 }
Ejemplo n.º 20
0
 private void switchToTab(Tab tab) {
   if (tab != mUi.getActiveTab()) {
     mUiController.setActiveTab(tab);
   }
 }
Ejemplo n.º 21
0
 @Override
 public boolean onMenuItemClick(MenuItem item) {
   return mUiController.onOptionsItemSelected(item);
 }