コード例 #1
0
  @Override
  public boolean onFling(MotionEvent start, MotionEvent finish, float velocityX, float velocityY) {
    float gapX = start.getRawX() - finish.getRawX();
    float gapY = start.getRawY() - finish.getRawY();
    float distanceX = Math.abs(gapX);
    float distanceY = Math.abs(gapY);

    if (distanceY > distanceX) { // up downs
      if (gapY > 0) {
        // up
        System.out.println("Swipe up");
      } else {
        // down
        System.out.println("Swipe down");
        BaseActivity activity = (BaseActivity) getActivity();
        activity.showToolbar(0);
        activity.hideToolbar(2);
      }
    } else { // left right
      if (gapX > 0) {
        // left
        System.out.println("Swipe left");
      } else {
        // rights
        System.out.println("Swipe right");
      }
    }

    return false;
  }
コード例 #2
0
  @Override
  public void onPause() {
    super.onPause();

    if (this.webView != null) {
      boolean keepRunning =
          this.keepRunning; // || this.cordovaInterface.activityResultCallback != null;
      this.webView.handlePause(keepRunning);
    }
    BaseActivity activity = (BaseActivity) getActivity();
    activity.showToolbar(0);
  }
コード例 #3
0
  protected void init() {
    webView = makeWebView();
    createViews();
    if (!webView.isInitialized()) {
      webView.init(cordovaInterface, pluginEntries, preferences);
    }
    webView.getView().requestFocusFromTouch();
    cordovaInterface.onCordovaInit(webView.getPluginManager());
    // webView.clearCache();
    android.webkit.CookieManager.getInstance().removeAllCookie();

    // Wire the hardware volume controls to control media if desired.
    String volumePref = preferences.getString("DefaultVolumeStream", "");
    if ("media".equals(volumePref.toLowerCase(Locale.ENGLISH))) {
      getActivity().setVolumeControlStream(AudioManager.STREAM_MUSIC);
    }
    BaseActivity activity = (BaseActivity) getActivity();
    activity.hideToolbar(2);
    gestureDetector = new GestureDetector(webView.getContext(), this);
    webView.getView().setOnTouchListener(this);
  }