android.support.v7.app.AppCompatActivity.dispatchTouchEvent()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(5.7k)|赞(0)|评价(0)|浏览(102)

本文整理了Java中android.support.v7.app.AppCompatActivity.dispatchTouchEvent()方法的一些代码示例,展示了AppCompatActivity.dispatchTouchEvent()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AppCompatActivity.dispatchTouchEvent()方法的具体详情如下:
包路径:android.support.v7.app.AppCompatActivity
类名称:AppCompatActivity
方法名:dispatchTouchEvent

AppCompatActivity.dispatchTouchEvent介绍

暂无

代码示例

代码示例来源:origin: k9mail/k-9

@Override
public boolean dispatchTouchEvent(MotionEvent event) {
  mBase.preDispatchTouchEvent(event);
  return super.dispatchTouchEvent(event);
}

代码示例来源:origin: nisrulz/sensey

@Override
public boolean dispatchTouchEvent(MotionEvent event) {
  // Setup onTouchEvent for detecting type of touch gesture
  Sensey.getInstance().setupDispatchTouchEvent(event);
  return super.dispatchTouchEvent(event);
}

代码示例来源:origin: JZ-Darkal/AndroidHttpCapture

/**
 * 点击屏幕关闭键盘
 */
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
  Boolean shouldDispatchTouchEvent = false;
  if (ev.getAction() == MotionEvent.ACTION_DOWN) {
    View v = getCurrentFocus();
    if (isShouldHideInput(v, ev)) {
      InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
      if (imm != null && v != null) {
        if (isKeyboardOpen) {
          shouldDispatchTouchEvent = true;
        }
        imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
      }
    }
    return shouldDispatchTouchEvent || super.dispatchTouchEvent(ev);
  }
  // 必不可少,否则所有的组件都不会有TouchEvent了
  return getWindow().superDispatchTouchEvent(ev) || onTouchEvent(ev);
}

代码示例来源:origin: Hitomis/ActivitySwitcher

@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
  activitySwitcher.processTouchEvent(ev);
  return super.dispatchTouchEvent(ev);
}

代码示例来源:origin: leibing8912/HumanBody

@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
  // 获取屏幕被点击点的坐标
  touchScreenPos[0] = ev.getX();
  touchScreenPos[1] = ev.getY();
  return super.dispatchTouchEvent(ev);
}

代码示例来源:origin: myxh/CoolShopping

@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
  Log.d(TAG, "dispatchTouchEvent: "+this.getClass().getSimpleName());
  return super.dispatchTouchEvent(ev);
}

代码示例来源:origin: Simon-Leeeeeeeee/SLWidget

@Override
public boolean dispatchTouchEvent(MotionEvent event) {
  if (mSwipeBackHelper != null) {
    mSwipeBackHelper.dispatchTouchEvent(event);
  }
  return super.dispatchTouchEvent(event);
}

代码示例来源:origin: mingjunli/GithubApp

@Override
public boolean dispatchTouchEvent(MotionEvent event) {
  if (isImmersiveModeEnabled) {
    gestureDetector.onTouchEvent(event);
  }
  return super.dispatchTouchEvent(event);
}

代码示例来源:origin: andob/emojilike-android

@Override
public boolean dispatchTouchEvent(MotionEvent event)
{
  boolean shouldCallSuper=emojiLikeTouchDetector.dispatchTouchEvent(event);
  if (shouldCallSuper)
    return super.dispatchTouchEvent(event);
  return false;
}

代码示例来源:origin: developer-shivam/ChanelView

@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
  if (toFantasticScroll) {
    detector.onTouchEvent(ev);
  }
  return super.dispatchTouchEvent(ev);
}

代码示例来源:origin: Calsign/APDE

@Override
public boolean dispatchTouchEvent(MotionEvent event) {
  /*
   * See comments for isTouchObscured above.
   */
  
  isTouchObscured = (event.getFlags() & MotionEvent.FLAG_WINDOW_IS_OBSCURED) != 0;
  return super.dispatchTouchEvent(event);
}

代码示例来源:origin: Instabug/Instabug-Android

@Override
  public boolean dispatchTouchEvent(MotionEvent ev) {
    //To allow instabug to track user steps
    // and also add touches to screen recording
    InstabugTrackingDelegate.notifyActivityGotTouchEvent(ev, this);
    return super.dispatchTouchEvent(ev);
  }
}

代码示例来源:origin: geniusgithub/AndroidDialer

@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
  if (ev.getAction() == MotionEvent.ACTION_DOWN) {
    TouchPointManager.getInstance().setPoint((int) ev.getRawX(), (int) ev.getRawY());
  }
  return super.dispatchTouchEvent(ev);
}

代码示例来源:origin: OhMyLob/Paper-Launcher

@Override
public boolean dispatchTouchEvent(MotionEvent event) {
  if (event.getAction() == MotionEvent.ACTION_DOWN) {
    if (mBottomSheetBehavior.getState() == BottomSheetBehaviorV2.STATE_EXPANDED) {
      Rect outRect = new Rect();
      mBottomSheetView.getGlobalVisibleRect(outRect);
      if (!outRect.contains((int) event.getRawX(), (int) event.getRawY())) {
        mBottomSheetBehavior.setState(BottomSheetBehaviorV2.STATE_COLLAPSED);
      }
    }
  }
  return super.dispatchTouchEvent(event);
}

代码示例来源:origin: Rukey7/IjkPlayerView

@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
  View view = getCurrentFocus();
  if (_isHideSoftInput(view, (int) ev.getX(), (int) ev.getY())) {
    _closeSoftInput();
    return true;
  }
  return super.dispatchTouchEvent(ev);
}

代码示例来源:origin: Rukey7/IjkPlayerView

@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
  View view = getCurrentFocus();
  if (_isHideSoftInput(view, (int) ev.getX(), (int) ev.getY())) {
    _closeSoftInput();
    return true;
  }
  return super.dispatchTouchEvent(ev);
}

代码示例来源:origin: huxq17/SwipeCardsView

@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
  if (ev.getAction() == MotionEvent.ACTION_DOWN) {
    View view = getCurrentFocus();
    if (view != null && mBase != null && mBase.isHideInput(view, ev)) {
      mBase.HideSoftInput(view.getWindowToken());
    }
  }
  return super.dispatchTouchEvent(ev);
}

代码示例来源:origin: 736008081/frameAndroid

@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
  if (ev.getAction() == MotionEvent.ACTION_DOWN) {
    // 获得当前得到焦点的View,一般情况下就是EditText(特殊情况就是轨迹求或者实体案件会移动焦点)
    View v = getCurrentFocus();
    if (isShouldHideInput(v, ev)) {
      hideSoftInput(v.getWindowToken());
    }
  }
  return super.dispatchTouchEvent(ev);
}

代码示例来源:origin: FussenYu/SearchView

@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
  if (ev.getAction() == MotionEvent.ACTION_DOWN) {
    View v = getCurrentFocus();
    if (isShouldHideKeyboard(v, ev)) {
      hideKeyboard(v.getWindowToken());
    }
  }
  return super.dispatchTouchEvent(ev);
}

代码示例来源:origin: itsMelo/BuzzerBeater

@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
  if (ev.getAction() == MotionEvent.ACTION_DOWN) {
    // 获得当前得到焦点的View,一般情况下就是EditText(特殊情况就是轨迹求或者实体案件会移动焦点)
    View v = getCurrentFocus();
    if (isShouldHideInput(v, ev)) {
      hideSoftInput(v.getWindowToken());
    }
  }
  return super.dispatchTouchEvent(ev);
}

相关文章

微信公众号

最新文章

更多

AppCompatActivity类方法