/*
* Copyright (C) 2013 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.xtec.locki.widget.swipeBackLayout;
import android.content.Context;
import android.support.v4.view.MotionEventCompat;
import android.support.v4.view.VelocityTrackerCompat;
import android.support.v4.view.ViewCompat;
import android.support.v4.widget.ScrollerCompat;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.animation.Interpolator;
import java.util.Arrays;
/**
* ViewDragHelper is a utility class for writing custom ViewGroups. It offers a
* number of useful operations and state tracking for allowing a user to drag
* and reposition views within their parent ViewGroup.
*/
public class ViewDragHelper {
private static final String TAG = "ViewDragHelper";
/**
* A null/invalid pointer ID.
*/
public static final int INVALID_POINTER = -1;
/**
* A view is not currently being dragged or animating as a result of a
* fling/snap.
*/
public static final int STATE_IDLE = 0;
/**
* A view is currently being dragged. The position is currently changing as
* a result of user input or simulated user input.
*/
public static final int STATE_DRAGGING = 1;
/**
* A view is currently settling into place as a result of a fling or
* predefined non-interactive motion.
*/
public static final int STATE_SETTLING = 2;
/**
* Edge flag indicating that the left edge should be affected.
*/
public static final int EDGE_LEFT = 1 << 0;
/**
* Edge flag indicating that the right edge should be affected.
*/
public static final int EDGE_RIGHT = 1 << 1;
/**
* Edge flag indicating that the top edge should be affected.
*/
public static final int EDGE_TOP = 1 << 2;
/**
* Edge flag indicating that the bottom edge should be affected.
*/
public static final int EDGE_BOTTOM = 1 << 3;
/**
* Edge flag set indicating all edges should be affected.
*/
public static final int EDGE_ALL = EDGE_LEFT | EDGE_TOP | EDGE_RIGHT | EDGE_BOTTOM;
/**
* Indicates that a check should occur along the horizontal axis
*/
public static final int DIRECTION_HORIZONTAL = 1 << 0;
/**
* Indicates that a check should occur along the vertical axis
*/
public static final int DIRECTION_VERTICAL = 1 << 1;
/**
* Indicates that a check should occur along all axes
*/
public static final int DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL;
public static final int EDGE_SIZE = 20; // dp
private static final int BASE_SETTLE_DURATION = 256; // ms
private static final int MAX_SETTLE_DURATION = 600; // ms
// Current drag state; idle, dragging or settling
private int mDragState;
// Distance to travel before a drag may begin
private int mTouchSlop;
// Last known position/pointer tracking
private int mActivePointerId = INVALID_POINTER;
private float[] mInitialMotionX;
private float[] mInitialMotionY;
private float[] mLastMotionX;
private float[] mLastMotionY;
private int[] mInitialEdgeTouched;
private int[] mEdgeDragsInProgress;
private int[] mEdgeDragsLocked;
private int mPointersDown;
private VelocityTracker mVelocityTracker;
private float mMaxVelocity;
private float mMinVelocity;
private int mEdgeSize;
private int mTrackingEdges;
private ScrollerCompat mScroller;
private final Callback mCallback;
private View mCapturedView;
private boolean mReleaseInProgress;
private final ViewGroup mParentView;
/**
* A Callback is used as a communication channel with the ViewDragHelper
* back to the parent view using it. <code>on*</code>methods are invoked on
* siginficant events and several accessor methods are expected to provide
* the ViewDragHelper with more information about the state of the parent
* view upon request. The callback also makes decisions governing the range
* and draggability of child views.
*/
public static abstract class Callback {
/**
* Called when the drag state changes. See the <code>STATE_*</code>
* constants for more information.
*
* @param state The new drag state
* @see #STATE_IDLE
* @see #STATE_DRAGGING
* @see #STATE_SETTLING
*/
public void onViewDragStateChanged(int state) {
}
/**
* Called when the captured view's position changes as the result of a
* drag or settle.
*
* @param changedView View whose position changed
* @param left New X coordinate of the left edge of the view
* @param top New Y coordinate of the top edge of the view
* @param dx Change in X position from the last call
* @param dy Change in Y position from the last call
*/
public void onViewPositionChanged(View changedView, int left, int top, int dx, int dy) {
}
/**
* Called when a child view is captured for dragging or settling. The ID
* of the pointer currently dragging the captured view is supplied. If
* activePointerId is identified as {@link #INVALID_POINTER} the capture
* is programmatic instead of pointer-initiated.
*
* @param capturedChild Child view that was captured
* @param activePointerId Pointer id tracking the child capture
*/
public void onViewCaptured(View capturedChild, int activePointerId) {
}
/**
* Called when the child view is no longer being actively dragged. The
* fling velocity is also supplied, if relevant. The velocity values may
* be clamped to system minimums or maximums.
* <p>
* Calling code may decide to fling or otherwise release the view to let
* it settle into place. It should do so using
* {@link #settleCapturedViewAt(int, int)} or
* {@link #flingCapturedView(int, int, int, int)}. If the Callback
* invokes one of these methods, the ViewDragHelper will enter
* {@link #STATE_SETTLING} and the view capture will not fully end until
* it comes to a complete stop. If neither of these methods is invoked
* before <code>onViewReleased</code> returns, the view will stop in
* place and the ViewDragHelper will return to {@link #STATE_IDLE}.
* </p>
*
* @param releasedChild The captured child view now being released
* @param xvel X velocity of the pointer as it left the screen in pixels
* per second.
* @param yvel Y velocity of the pointer as it left the screen in pixels
* per second.
*/
public void onViewReleased(View releasedChild, float xvel, float yvel) {
}
/**
* Called when one of the subscribed edges in the parent view has been
* touched by the user while no child view is currently captured.
*
* @param edgeFlags A combination of edge flags describing the edge(s)
* currently touched
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
基于java开发的指纹解锁APP,软件支持指纹解锁+手势解锁+数字密码解锁+源码,适合毕业设计、课程设计、项目开发。项目源码已经过严格测试,可以放心参考并在此基础上延申使用~ 基于java开发的指纹解锁APP,软件支持指纹解锁+手势解锁+数字密码解锁+源码,适合毕业设计、课程设计、项目开发。项目源码已经过严格测试,可以放心参考并在此基础上延申使用~ 基于java开发的指纹解锁APP,软件支持指纹解锁+手势解锁+数字密码解锁+源码,适合毕业设计、课程设计、项目开发。项目源码已经过严格测试,可以放心参考并在此基础上延申使用~ 基于java开发的指纹解锁APP,软件支持指纹解锁+手势解锁+数字密码解锁+源码,适合毕业设计、课程设计、项目开发。项目源码已经过严格测试,可以放心参考并在此基础上延申使用~ 基于java开发的指纹解锁APP,软件支持指纹解锁+手势解锁+数字密码解锁+源码,适合毕业设计、课程设计、项目开发。项目源码已经过严格测试,可以放心参考并在此基础上延申使用~
资源推荐
资源详情
资源评论
收起资源包目录
基于java开发的指纹解锁APP,软件支持指纹解锁+手势解锁+数字密码解锁+源码(毕业设计&课程设计&项目开发) (193个子文件)
gradlew.bat 2KB
.gitignore 826B
.gitignore 7B
build.gradle 3KB
build.gradle 552B
settings.gradle 15B
gradlew 5KB
gradle-wrapper.jar 52KB
ViewDragHelper.java 61KB
MainActivity.java 23KB
ACache.java 21KB
LockPatternView.java 21KB
SwipeBackLayout.java 21KB
MultiStateView.java 17KB
LockService.java 17KB
UnlockByNumberActivity.java 13KB
StatusbarUtil.java 12KB
SwitchView.java 11KB
Topbar.java 10KB
UnlockByGestureActivity.java 10KB
GestureDrawline.java 9KB
FastDialog.java 9KB
UIUtils.java 9KB
PlanDetailActivity.java 8KB
PlanListAdapter.java 8KB
PayPwdEditText.java 8KB
PreferenceUtils.java 7KB
BaseActivity.java 7KB
CreateGestureActivity.java 6KB
DialogActivity.java 6KB
UnlockByFingerprintActivity.java 6KB
BlurredView.java 6KB
LockPatternIndicator.java 6KB
AppUtil.java 6KB
CreateGestureActivityNew.java 6KB
TimePlanActivity.java 5KB
VerifyIdentityActivity.java 5KB
LockPatternUtil.java 5KB
BrowseApplicationInfoAdapter.java 5KB
Utils.java 4KB
DateUtils.java 4KB
GesturePoint.java 3KB
PlanInfoModel.java 3KB
GestureContentView.java 3KB
CreateNumberPwdActivity.java 3KB
LockIndicator.java 3KB
SafeguardActivity.java 3KB
Constant.java 2KB
BlurBitmapUtil.java 2KB
T.java 2KB
NumberKeyboardAdapter.java 2KB
DensityUtil.java 2KB
SwipeBackActivityHelper.java 2KB
AppInfo.java 2KB
L.java 1KB
BitmapUtil.java 1KB
RoundImageView.java 1KB
SwipeBackActivity.java 1KB
SwipeBackPreferenceActivity.java 1KB
RxBus.java 960B
ExampleInstrumentedTest.java 732B
DeviceManager.java 516B
LockActivity.java 480B
SwipeBackActivityBase.java 441B
MyApplication.java 422B
ExampleUnitTest.java 392B
UnlockSuccess.java 376B
locki.jks 2KB
run2.jpg 350KB
run1.jpg 314KB
ic_man_new.jpg 125KB
ic_wukong.jpg 48KB
run3.jpg 43KB
ic_leon.jpg 19KB
ic_monkey_king.png 260KB
ic_notice_upgrade.png 30KB
user_logo.png 26KB
ic_arc_menu.png 25KB
ic_launcher_round.png 14KB
gesture_node_pressed.png 13KB
gesture_node_wrong.png 13KB
yiqihao_logo.png 12KB
ic_launcher.png 10KB
ic_launcher_round.png 10KB
gesture_node_normal.png 9KB
ic_launcher.png 8KB
fingerprint_iv.png 7KB
ic_launcher_round.png 6KB
ic_launcher.png 5KB
ic_launcher_round.png 4KB
ic_launcher.png 3KB
shadow_bottom.png 3KB
shadow_right.png 3KB
shadow_left.png 3KB
ic_launcher_round.png 2KB
ic_launcher.png 2KB
ic_back_white.png 1KB
lock_pattern_node_normal.png 1KB
lock_pattern_node_pressed.png 1KB
dividing_ine.png 1003B
共 193 条
- 1
- 2
资源评论
梦回阑珊
- 粉丝: 5092
- 资源: 1666
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于Jupyter扩展的jupylet-cn项目中文翻译设计源码
- 基于Java语言的校园跳蚤市场后台管理系统设计源码
- 基于Jupyter Notebook的PYTHON项目——周某年度最骄傲之作:零挂科挑战成功设计源码
- 基于Html与Java的综合技术,打造电脑商城网站设计源码
- 基于Java语言的前后端分离投票系统设计源码
- 基于Python全栈技术的B2C在线教育商城天宫设计源码
- ubuntu20.04安装教程-ubuntu20.04安装指南:涵盖物理机和虚拟环境下的详细流程
- 基于Java注解的Emqx消息监听器设计源码及后台访问控制API
- 基于Java语言的dormitory-backend学生宿舍管理系统设计源码
- 基于Dart语言的Flutter框架设计源码镜像仓库
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功