コード例 #1
0
  @Override
  public void onPageFinished(WebView view, String url) {
    EBrowserView target = (EBrowserView) view;
    if (url.startsWith("http")) {
      EBrowserWindow bWindow = target.getBrowserWindow();
      WWidgetData wgt = bWindow.getWidget();
      if (1 == wgt.m_webapp) {
        bWindow.hiddenProgress();
      }
    }
    String oUrl = view.getOriginalUrl();
    if (!mReferenceUrl.equals(url) || target.beDestroy() || !url.equals(oUrl)) {
      return;
    }
    ESystemInfo info = ESystemInfo.getIntence();

    int versionA = Build.VERSION.SDK_INT;

    if (!target.isWebApp()) { // 4.3及4.3以下手机
      if (!info.mScaled) {
        float nowScale = 1.0f;

        if (versionA <= 18) {
          nowScale = target.getScale();
        }

        info.mDefaultFontSize = (int) (info.mDefaultFontSize / nowScale);
        info.mScaled = true;
      }

      target.setDefaultFontSize(info.mDefaultFontSize);
    }

    if (!info.mFinished) {
      ((EBrowserActivity) target.getContext()).setContentViewVisible();
    }

    info.mFinished = true;
    target.loadUrl(EUExScript.F_UEX_SCRIPT);
    target.onPageFinished(target, url);

    EBrowserWindow win = target.getBrowserWindow();
    WWidgetData wgt = win.getWidget();

    if (wgt.m_appdebug == 1) {
      String debugUrlString =
          "http://" + wgt.m_logServerIp + ":30060/target/target-script-min.js#anonymous";
      String weinreString =
          "javascript:var x = document.createElement(\"SCRIPT\");x.setAttribute('src',\""
              + debugUrlString
              + "\""
              + ");document.body.appendChild(x);";
      target.loadUrl(weinreString);
    }

    CookieSyncManager.getInstance().sync();
  }
コード例 #2
0
 private boolean onTracker(int velocityX, int velocityY) {
   boolean trigger = false;
   if (isSupportSwipeCallback) {
     final int absY = (velocityY < 0) ? -velocityY : velocityY;
     final int absX = (velocityX < 0) ? -velocityX : velocityX;
     int rate = ESystemInfo.getIntence().mSwipeRate;
     if ((velocityX > rate) && (absX > absY)) {
       mBrwView.loadUrl(EUExScript.F_UEX_SCRIPT_SWIPE_RIGHT);
       trigger = true;
     } else if ((velocityX < -rate) && (absX > absY)) {
       mBrwView.loadUrl(EUExScript.F_UEX_SCRIPT_SWIPE_LEFT);
       trigger = true;
     }
   }
   return trigger;
 }