예제 #1
0
    @Override
    public void run() {
      if (height != 0) {
        height = (int) (Utils.densityMultiplier * height); // javascript returns us in dp
        WebView webView = mWebView.get();
        if (webView != null) {
          Logger.i(
              tag,
              "HeightRunnable called with height="
                  + height
                  + " and current height is "
                  + webView.getHeight());

          int initHeight = webView.getMeasuredHeight();

          Logger.i("HeightAnim", "InitHeight = " + initHeight + " TargetHeight = " + height);

          if (initHeight == height) {
            return;
          } else if (initHeight > height) {
            collapse(webView, height);
          } else if (initHeight < height) {
            expand(webView, height);
          }
        }
      }
    }
예제 #2
0
 @JavascriptInterface
 public int getWebViewHeight() {
   if (notationWebView == null) {
     notationWebView = (WebView) findViewById(R.id.partitionHtml);
   }
   return notationWebView.getHeight();
 }
예제 #3
0
  @Override
  public boolean dispatchTouchEvent(MotionEvent e) {
    int scrollY = webview.getScrollY();
    if (scrollY == 0
        || (float) scrollY
            >= webview.getContentHeight() * getScale(webview) - webview.getHeight()) {
      setDisplayZoomControls(true);
    } else {
      setDisplayZoomControls(false);
    }

    super.dispatchTouchEvent(e);

    // getActionMasked since api-8
    switch (e.getAction() & MotionEvent.ACTION_MASK) {
      case MotionEvent.ACTION_CANCEL:
      case MotionEvent.ACTION_UP:
        scale = getScale(webview);
        break;
    }

    return mGestureDetector.onTouchEvent(e);
  }