getMinimumFlingVelocity ( )源码实例Demo

android.view.ViewConfiguration#getMinimumFlingVelocity ( )源码实例Demo

下面列出了android.view.ViewConfiguration#getMinimumFlingVelocity ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: StockChart-MPAndroidChart   文件: Utils.java
/**
 * initialize method, called inside the Chart.init() method.
 *
 * @param context
 */
@SuppressWarnings("deprecation")
public static void init(Context context) {

    if (context == null) {
        // noinspection deprecation
        mMinimumFlingVelocity = ViewConfiguration.getMinimumFlingVelocity();
        // noinspection deprecation
        mMaximumFlingVelocity = ViewConfiguration.getMaximumFlingVelocity();

        Log.e("MPChartLib-Utils"
                , "Utils.init(...) PROVIDED CONTEXT OBJECT IS NULL");

    } else {
        ViewConfiguration viewConfiguration = ViewConfiguration.get(context);
        mMinimumFlingVelocity = viewConfiguration.getScaledMinimumFlingVelocity();
        mMaximumFlingVelocity = viewConfiguration.getScaledMaximumFlingVelocity();

        Resources res = context.getResources();
        mMetrics = res.getDisplayMetrics();
    }
}
 
源代码2 项目: Ticket-Analysis   文件: Utils.java
/**
 * initialize method, called inside the Chart.init() method.
 *
 * @param context
 */
@SuppressWarnings("deprecation")
public static void init(Context context) {

    if (context == null) {
        // noinspection deprecation
        mMinimumFlingVelocity = ViewConfiguration.getMinimumFlingVelocity();
        // noinspection deprecation
        mMaximumFlingVelocity = ViewConfiguration.getMaximumFlingVelocity();

        Log.e("MPChartLib-Utils"
                , "Utils.init(...) PROVIDED CONTEXT OBJECT IS NULL");

    } else {
        ViewConfiguration viewConfiguration = ViewConfiguration.get(context);
        mMinimumFlingVelocity = viewConfiguration.getScaledMinimumFlingVelocity();
        mMaximumFlingVelocity = viewConfiguration.getScaledMaximumFlingVelocity();

        Resources res = context.getResources();
        mMetrics = res.getDisplayMetrics();
    }
}
 
源代码3 项目: android-kline   文件: Utils.java
/**
 * initialize method, called inside the Chart.init() method.
 *
 * @param context
 */
@SuppressWarnings("deprecation")
public static void init(Context context) {

    if (context == null) {
        // noinspection deprecation
        mMinimumFlingVelocity = ViewConfiguration.getMinimumFlingVelocity();
        // noinspection deprecation
        mMaximumFlingVelocity = ViewConfiguration.getMaximumFlingVelocity();

        Log.e("MPChartLib-Utils"
                , "Utils.init(...) PROVIDED CONTEXT OBJECT IS NULL");

    } else {
        ViewConfiguration viewConfiguration = ViewConfiguration.get(context);
        mMinimumFlingVelocity = viewConfiguration.getScaledMinimumFlingVelocity();
        mMaximumFlingVelocity = viewConfiguration.getScaledMaximumFlingVelocity();

        Resources res = context.getResources();
        mMetrics = res.getDisplayMetrics();
    }
}
 
源代码4 项目: iMoney   文件: Utils.java
/**
 * initialize method, called inside the Chart.init() method.
 * 
 * @param res
 */
@SuppressWarnings("deprecation")
public static void init(Context context) {

    if (context == null) {
        // noinspection deprecation
        mMinimumFlingVelocity = ViewConfiguration.getMinimumFlingVelocity();
        // noinspection deprecation
        mMaximumFlingVelocity = ViewConfiguration.getMaximumFlingVelocity();

        Log.e("MPAndroidChart, Utils.init(...)", "PROVIDED CONTEXT OBJECT IS NULL");

    } else {
        ViewConfiguration viewConfiguration = ViewConfiguration.get(context);
        mMinimumFlingVelocity = viewConfiguration.getScaledMinimumFlingVelocity();
        mMaximumFlingVelocity = viewConfiguration.getScaledMaximumFlingVelocity();

        Resources res = context.getResources();
        mMetrics = res.getDisplayMetrics();
    }
}
 
源代码5 项目: Stayfit   文件: Utils.java
/**
 * initialize method, called inside the Chart.init() method.
 *
 * @param context
 */
@SuppressWarnings("deprecation")
public static void init(Context context) {

    if (context == null) {
        // noinspection deprecation
        mMinimumFlingVelocity = ViewConfiguration.getMinimumFlingVelocity();
        // noinspection deprecation
        mMaximumFlingVelocity = ViewConfiguration.getMaximumFlingVelocity();

        Log.e("MPChartLib-Utils"
                , "Utils.init(...) PROVIDED CONTEXT OBJECT IS NULL");

    } else {
        ViewConfiguration viewConfiguration = ViewConfiguration.get(context);
        mMinimumFlingVelocity = viewConfiguration.getScaledMinimumFlingVelocity();
        mMaximumFlingVelocity = viewConfiguration.getScaledMaximumFlingVelocity();

        Resources res = context.getResources();
        mMetrics = res.getDisplayMetrics();
    }
}
 
源代码6 项目: NetKnight   文件: Utils.java
/**
 * initialize method, called inside the Chart.init() method.
 *
 * @param context
 */
@SuppressWarnings("deprecation")
public static void init(Context context) {

    if (context == null) {
        // noinspection deprecation
        mMinimumFlingVelocity = ViewConfiguration.getMinimumFlingVelocity();
        // noinspection deprecation
        mMaximumFlingVelocity = ViewConfiguration.getMaximumFlingVelocity();

        Log.e("MPChartLib-Utils"
                , "Utils.init(...) PROVIDED CONTEXT OBJECT IS NULL");

    } else {
        ViewConfiguration viewConfiguration = ViewConfiguration.get(context);
        mMinimumFlingVelocity = viewConfiguration.getScaledMinimumFlingVelocity();
        mMaximumFlingVelocity = viewConfiguration.getScaledMaximumFlingVelocity();

        Resources res = context.getResources();
        mMetrics = res.getDisplayMetrics();
    }
}
 
源代码7 项目: JNChartDemo   文件: Utils.java
/**
 * initialize method, called inside the Chart.init() method.
 *
 * @param context
 */
@SuppressWarnings("deprecation")
public static void init(Context context) {

    if (context == null) {
        // noinspection deprecation
        mMinimumFlingVelocity = ViewConfiguration.getMinimumFlingVelocity();
        // noinspection deprecation
        mMaximumFlingVelocity = ViewConfiguration.getMaximumFlingVelocity();

        Log.e("MPChartLib-Utils"
                , "Utils.init(...) PROVIDED CONTEXT OBJECT IS NULL");

    } else {
        ViewConfiguration viewConfiguration = ViewConfiguration.get(context);
        mMinimumFlingVelocity = viewConfiguration.getScaledMinimumFlingVelocity();
        mMaximumFlingVelocity = viewConfiguration.getScaledMaximumFlingVelocity();

        Resources res = context.getResources();
        mMetrics = res.getDisplayMetrics();
    }
}
 
源代码8 项目: Telegram-FOSS   文件: GestureDetector2.java
private void init(Context context) {
    if (mListener == null) {
        throw new NullPointerException("OnGestureListener must not be null");
    }
    mIsLongpressEnabled = true;

    int touchSlop, doubleTapSlop, doubleTapTouchSlop;
    if (context == null) {
        touchSlop = ViewConfiguration.getTouchSlop();
        doubleTapTouchSlop = touchSlop;
        doubleTapSlop = 100;
        mMinimumFlingVelocity = ViewConfiguration.getMinimumFlingVelocity();
        mMaximumFlingVelocity = ViewConfiguration.getMaximumFlingVelocity();
    } else {
        final ViewConfiguration configuration = ViewConfiguration.get(context);
        touchSlop = configuration.getScaledTouchSlop();
        doubleTapTouchSlop = configuration.getScaledTouchSlop();
        doubleTapSlop = configuration.getScaledDoubleTapSlop();
        mMinimumFlingVelocity = configuration.getScaledMinimumFlingVelocity();
        mMaximumFlingVelocity = configuration.getScaledMaximumFlingVelocity();
    }
    mTouchSlopSquare = touchSlop * touchSlop;
    mDoubleTapTouchSlopSquare = doubleTapTouchSlop * doubleTapTouchSlop;
    mDoubleTapSlopSquare = doubleTapSlop * doubleTapSlop;
}
 
源代码9 项目: Telegram   文件: GestureDetector2.java
private void init(Context context) {
    if (mListener == null) {
        throw new NullPointerException("OnGestureListener must not be null");
    }
    mIsLongpressEnabled = true;

    int touchSlop, doubleTapSlop, doubleTapTouchSlop;
    if (context == null) {
        touchSlop = ViewConfiguration.getTouchSlop();
        doubleTapTouchSlop = touchSlop;
        doubleTapSlop = 100;
        mMinimumFlingVelocity = ViewConfiguration.getMinimumFlingVelocity();
        mMaximumFlingVelocity = ViewConfiguration.getMaximumFlingVelocity();
    } else {
        final ViewConfiguration configuration = ViewConfiguration.get(context);
        touchSlop = configuration.getScaledTouchSlop();
        doubleTapTouchSlop = configuration.getScaledTouchSlop();
        doubleTapSlop = configuration.getScaledDoubleTapSlop();
        mMinimumFlingVelocity = configuration.getScaledMinimumFlingVelocity();
        mMaximumFlingVelocity = configuration.getScaledMaximumFlingVelocity();
    }
    mTouchSlopSquare = touchSlop * touchSlop;
    mDoubleTapTouchSlopSquare = doubleTapTouchSlop * doubleTapTouchSlop;
    mDoubleTapSlopSquare = doubleTapSlop * doubleTapSlop;
}
 
源代码10 项目: StockChart-MPAndroidChart   文件: Utils.java
/**
 * initialize method, called inside the Chart.init() method. backwards
 * compatibility - to not break existing code
 *
 * @param res
 */
@Deprecated
public static void init(Resources res) {

    mMetrics = res.getDisplayMetrics();

    // noinspection deprecation
    mMinimumFlingVelocity = ViewConfiguration.getMinimumFlingVelocity();
    // noinspection deprecation
    mMaximumFlingVelocity = ViewConfiguration.getMaximumFlingVelocity();
}
 
源代码11 项目: remoteyourcam-usb   文件: GestureDetector.java
public GestureDetector(Context context, GestureHandler gestureHandler) {
    this.gestureHandler = gestureHandler;
    DisplayMetrics metrics = context.getResources().getDisplayMetrics();
    pixelScaling = metrics.density;
    minimumFlingVelocity = ViewConfiguration.getMinimumFlingVelocity();
    maximumFlingVelocity = ViewConfiguration.getMaximumFlingVelocity();
}
 
源代码12 项目: Ticket-Analysis   文件: Utils.java
/**
 * initialize method, called inside the Chart.init() method. backwards
 * compatibility - to not break existing code
 *
 * @param res
 */
@Deprecated
public static void init(Resources res) {

    mMetrics = res.getDisplayMetrics();

    // noinspection deprecation
    mMinimumFlingVelocity = ViewConfiguration.getMinimumFlingVelocity();
    // noinspection deprecation
    mMaximumFlingVelocity = ViewConfiguration.getMaximumFlingVelocity();
}
 
源代码13 项目: android-kline   文件: Utils.java
/**
 * initialize method, called inside the Chart.init() method. backwards
 * compatibility - to not break existing code
 *
 * @param res
 */
@Deprecated
public static void init(Resources res) {

    mMetrics = res.getDisplayMetrics();

    // noinspection deprecation
    mMinimumFlingVelocity = ViewConfiguration.getMinimumFlingVelocity();
    // noinspection deprecation
    mMaximumFlingVelocity = ViewConfiguration.getMaximumFlingVelocity();
}
 
源代码14 项目: iMoney   文件: Utils.java
/**
 * initialize method, called inside the Chart.init() method. backwards
 * compatibility - to not break existing code
 *
 * @param res
 */
@Deprecated
public static void init(Resources res) {

    mMetrics = res.getDisplayMetrics();

    // noinspection deprecation
    mMinimumFlingVelocity = ViewConfiguration.getMinimumFlingVelocity();
    // noinspection deprecation
    mMaximumFlingVelocity = ViewConfiguration.getMaximumFlingVelocity();
}
 
源代码15 项目: Stayfit   文件: Utils.java
/**
 * initialize method, called inside the Chart.init() method. backwards
 * compatibility - to not break existing code
 *
 * @param res
 */
@Deprecated
public static void init(Resources res) {

    mMetrics = res.getDisplayMetrics();

    // noinspection deprecation
    mMinimumFlingVelocity = ViewConfiguration.getMinimumFlingVelocity();
    // noinspection deprecation
    mMaximumFlingVelocity = ViewConfiguration.getMaximumFlingVelocity();
}
 
源代码16 项目: NetKnight   文件: Utils.java
/**
 * initialize method, called inside the Chart.init() method. backwards
 * compatibility - to not break existing code
 *
 * @param res
 */
@Deprecated
public static void init(Resources res) {

    mMetrics = res.getDisplayMetrics();

    // noinspection deprecation
    mMinimumFlingVelocity = ViewConfiguration.getMinimumFlingVelocity();
    // noinspection deprecation
    mMaximumFlingVelocity = ViewConfiguration.getMaximumFlingVelocity();
}
 
源代码17 项目: JNChartDemo   文件: Utils.java
/**
 * initialize method, called inside the Chart.init() method. backwards
 * compatibility - to not break existing code
 *
 * @param res
 */
@Deprecated
public static void init(Resources res) {

    mMetrics = res.getDisplayMetrics();

    // noinspection deprecation
    mMinimumFlingVelocity = ViewConfiguration.getMinimumFlingVelocity();
    // noinspection deprecation
    mMaximumFlingVelocity = ViewConfiguration.getMaximumFlingVelocity();
}
 
源代码18 项目: remoteyourcam-usb   文件: GestureDetector.java
public GestureDetector(Context context, GestureHandler gestureHandler) {
    this.gestureHandler = gestureHandler;
    DisplayMetrics metrics = context.getResources().getDisplayMetrics();
    pixelScaling = metrics.density;
    minimumFlingVelocity = ViewConfiguration.getMinimumFlingVelocity();
    maximumFlingVelocity = ViewConfiguration.getMaximumFlingVelocity();
}
 
源代码19 项目: mytracks   文件: ChartView.java
@Override
public boolean onTouchEvent(MotionEvent event) {
  if (velocityTracker == null) {
    velocityTracker = VelocityTracker.obtain();
  }
  velocityTracker.addMovement(event);
  float x = event.getX();
  switch (event.getAction()) {
    case MotionEvent.ACTION_DOWN:
      // Stop the fling
      if (!scroller.isFinished()) {
        scroller.abortAnimation();
      }
      lastMotionEventX = x;
      break;
    case MotionEvent.ACTION_MOVE:
      if (lastMotionEventX == -1) {
        break;
      }
      // Scroll to follow the motion event
      int deltaX = (int) (lastMotionEventX - x);
      lastMotionEventX = x;
      if (deltaX < 0) {
        if (getScrollX() > 0) {
          scrollBy(deltaX);
        }
      } else if (deltaX > 0) {
        int availableToScroll = effectiveWidth * (zoomLevel - 1) - getScrollX();
        if (availableToScroll > 0) {
          scrollBy(Math.min(availableToScroll, deltaX));
        }
      }
      break;
    case MotionEvent.ACTION_UP:
      // Check if the y event is within markerHeight of the marker center
      if (Math.abs(event.getY() - topBorder - spacer - markerHeight / 2) < markerHeight) {
        int minDistance = Integer.MAX_VALUE;
        Waypoint nearestWaypoint = null;
        synchronized (waypoints) {
          for (int i = 0; i < waypoints.size(); i++) {
            Waypoint waypoint = waypoints.get(i);
            int distance = Math.abs(
                getX(getWaypointXValue(waypoint)) - (int) event.getX() - getScrollX());
            if (distance < minDistance) {
              minDistance = distance;
              nearestWaypoint = waypoint;
            }
          }
        }
        if (nearestWaypoint != null && minDistance < markerWidth) {
          Intent intent = IntentUtils.newIntent(getContext(), MarkerDetailActivity.class)
              .putExtra(MarkerDetailActivity.EXTRA_MARKER_ID, nearestWaypoint.getId());
          getContext().startActivity(intent);
          return true;
        }
      }

      VelocityTracker myVelocityTracker = velocityTracker;
      myVelocityTracker.computeCurrentVelocity(1000);
      int initialVelocity = (int) myVelocityTracker.getXVelocity();
      if (Math.abs(initialVelocity) > ViewConfiguration.getMinimumFlingVelocity()) {
        fling(-initialVelocity);
      }
      if (velocityTracker != null) {
        velocityTracker.recycle();
        velocityTracker = null;
      }
      break;
  }
  return true;
}