package com.coresun.powerbank.ui.main.viewpager;
import android.annotation.SuppressLint;
import android.content.Context;
import android.database.DataSetObserver;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.SystemClock;
import android.support.v4.os.ParcelableCompat;
import android.support.v4.os.ParcelableCompatCreatorCallbacks;
import android.support.v4.view.MotionEventCompat;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.VelocityTrackerCompat;
import android.support.v4.view.ViewCompat;
import android.support.v4.view.ViewConfigurationCompat;
import android.support.v4.widget.EdgeEffectCompat;
import android.util.AttributeSet;
import android.util.Log;
import android.view.FocusFinder;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.SoundEffectConstants;
import android.view.VelocityTracker;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.accessibility.AccessibilityEvent;
import android.view.animation.Interpolator;
import android.widget.Scroller;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
/**
* Layout manager that allows the user to flip left and right
* through pages of data. You supply an implementation of a
* {@link android.support.v4.view.PagerAdapter} to generate the pages that the view shows.
*
* <p>Note this class is currently under early design and
* development. The API will likely change in later updates of
* the compatibility library, requiring changes to the source code
* of apps when they are compiled against the newer version.</p>
*/
public class NoPreloadViewPager extends ViewGroup {
private static final String TAG = "<span style=\"font-family:Arial, Helvetica, sans-serif;\">NoPreLoadViewPager</span>";
private static final boolean DEBUG = false;
private static final boolean USE_CACHE = false;
private static final int DEFAULT_OFFSCREEN_PAGES = 0;//默认是1
private static final int MAX_SETTLE_DURATION = 600; // ms
static class ItemInfo {
Object object;
int position;
boolean scrolling;
}
private static final Comparator<ItemInfo> COMPARATOR = new Comparator<ItemInfo>(){
@Override
public int compare(ItemInfo lhs, ItemInfo rhs) {
return lhs.position - rhs.position;
}};
private static final Interpolator sInterpolator = new Interpolator() {
public float getInterpolation(float t) {
// _o(t) = t * t * ((tension + 1) * t + tension)
// o(t) = _o(t - 1) + 1
t -= 1.0f;
return t * t * t + 1.0f;
}
};
private final ArrayList<ItemInfo> mItems = new ArrayList<ItemInfo>();
private PagerAdapter mAdapter;
private int mCurItem; // Index of currently displayed page.
private int mRestoredCurItem = -1;
private Parcelable mRestoredAdapterState = null;
private ClassLoader mRestoredClassLoader = null;
private Scroller mScroller;
private PagerObserver mObserver;
private int mPageMargin;
private Drawable mMarginDrawable;
private int mChildWidthMeasureSpec;
private int mChildHeightMeasureSpec;
private boolean mInLayout;
private boolean mScrollingCacheEnabled;
private boolean mPopulatePending;
private boolean mScrolling;
private int mOffscreenPageLimit = DEFAULT_OFFSCREEN_PAGES;
private boolean mIsBeingDragged;
private boolean mIsUnableToDrag;
private int mTouchSlop;
private float mInitialMotionX;
/**
* Position of the last motion event.
*/
private float mLastMotionX;
private float mLastMotionY;
/**
* ID of the active pointer. This is used to retain consistency during
* drags/flings if multiple pointers are used.
*/
private int mActivePointerId = INVALID_POINTER;
/**
* Sentinel value for no current active pointer.
* Used by {@link #mActivePointerId}.
*/
private static final int INVALID_POINTER = -1;
/**
* Determines speed during touch scrolling
*/
private VelocityTracker mVelocityTracker;
private int mMinimumVelocity;
private int mMaximumVelocity;
private float mBaseLineFlingVelocity;
private float mFlingVelocityInfluence;
private boolean mFakeDragging;
private long mFakeDragBeginTime;
private EdgeEffectCompat mLeftEdge;
private EdgeEffectCompat mRightEdge;
private boolean mFirstLayout = true;
private OnPageChangeListener mOnPageChangeListener;
/**
* Indicates that the pager is in an idle, settled state. The current page
* is fully in view and no animation is in progress.
*/
public static final int SCROLL_STATE_IDLE = 0;
/**
* Indicates that the pager is currently being dragged by the user.
*/
public static final int SCROLL_STATE_DRAGGING = 1;
/**
* Indicates that the pager is in the process of settling to a final position.
*/
public static final int SCROLL_STATE_SETTLING = 2;
private int mScrollState = SCROLL_STATE_IDLE;
/**
* Callback interface for responding to changing state of the selected page.
*/
public interface OnPageChangeListener {
/**
* This method will be invoked when the current page is scrolled, either as part
* of a programmatically initiated smooth scroll or a user initiated touch scroll.
*
* @param position Position index of the first page currently being displayed.
* Page position+1 will be visible if positionOffset is nonzero.
* @param positionOffset Value from [0, 1) indicating the offset from the page at position.
* @param positionOffsetPixels Value in pixels indicating the offset from position.
*/
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels);
/**
* This method will be invoked when a new page becomes selected. Animation is not
* necessarily complete.
*
* @param position Position index of the new selected page.
*/
public void onPageSelected(int position);
/**
* Called when the scroll state changes. Useful for discovering when the user
* begins dragging, when the pager is automatically settling to the current page,
* or when it is fully stopped/idle.
*
* @param state The new scroll state.
* @see android.support.v4.view.ViewPager#SCROLL_STATE_IDLE
* @see android.support.v4.view.ViewPager#SCROLL_STATE_DRAGGING
* @see android.support.v4.view.ViewPager#SCROLL_STATE_SETTLING
*/
public void onPageScrollStateChanged(int state);
}
/**
* Simple implementation of theinterface with stub
* implementations of each method. Extend this if you do not intend to override
* every method of
*/
public static class SimpleOnPageChangeListener implements OnPageChangeListener {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
// This space for rent
}
@Override
public void onPageSelected(int position) {
// This space for rent
}
@Override
public void onPageScrollStateChanged(int state) {
// This space for rent
}
}
public NoPreloadViewPager(Context context) {
super(context);
initViewPager();
}
public NoPreloadViewPager(Context context, AttributeSet attrs) {
super(context, attrs);
initViewPager();
}
void initViewPager() {
setWillNotDraw(false);
setDescendantFocusability(FOCUS_AFTER_DESCENDAN
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
【资源说明】 1、该资源包括项目的全部源码,下载可以直接使用! 2、本项目适合作为计算机、数学、电子信息等专业的课程设计、期末大作业和毕设项目,作为参考资料学习借鉴。 3、本资源作为“参考资料”如果需要实现其他功能,需要能看懂代码,并且热爱钻研,自行调试。 充电宝广告机(项目源码+说明).zip
资源推荐
资源详情
资源评论
收起资源包目录
充电宝广告机(项目源码+说明).zip (1535个子文件)
gradlew.bat 2KB
.gitignore 844B
.gitignore 7B
build.gradle 3KB
build.gradle 863B
settings.gradle 15B
gradlew 5KB
package.html 16KB
MediastreamerActivity.java.ignored 12KB
commons-compress-1.11.jar 416KB
volley.jar 200KB
gradle-wrapper.jar 52KB
gcm.jar 13KB
NoPreloadViewPager.java 64KB
MainActivity.java 31KB
JSONHelper.java 26KB
FileUtils.java 16KB
LogUtils.java 15KB
ZMTEntity.java 10KB
MainPresenter.java 10KB
MyWebSocket.java 6KB
HeartBeatService.java 5KB
ZMTData.java 4KB
NetWorkModule.java 3KB
WebSocketUtils.java 3KB
SharedPreferencesUtils.java 3KB
VolleyHttpUtil.java 3KB
NetWorkStateUtils.java 3KB
AppSocketManager.java 3KB
AndroidPermissionUtils.java 3KB
AdvApp.java 2KB
AppDataManager.java 2KB
CachePswBean.java 2KB
VideoPlayFragment.java 2KB
RxBus.java 2KB
AppModule.java 2KB
ServicePresenter.java 2KB
BaseActivity.java 2KB
AdvFragment.java 2KB
AppApiHelper.java 2KB
SampleCaughtExceptionHandler.java 2KB
SocketInfoBean.java 2KB
AdvBean.java 2KB
Constants.java 2KB
AdvTxt.java 2KB
CacheInterceptor.java 2KB
AppDbHelper.java 2KB
ImageViewFragment.java 1KB
CustomViewPager.java 1KB
UpdateResult.java 1KB
SplashActivity.java 1KB
WebSocketBackBean.java 1KB
ApiService.java 1KB
AdvResult.java 1KB
ToastUtils.java 1KB
EmptyControlVideo.java 1KB
SocketBean.java 1KB
LogInterceptor.java 1KB
MainMVPPresenter.java 1KB
AppSharePreferences.java 1KB
BasePresenter.java 1009B
NetWorkUtils.java 895B
ApiHelper.java 874B
Response.java 812B
Params.java 760B
ExampleInstrumentedTest.java 740B
AppComponent.java 731B
ActivityModule.java 717B
UpdateResponse.java 715B
ServiceModule.java 649B
AdvResponse.java 634B
StartUpReceiver.java 552B
ActivityComponent.java 552B
SocketPowerBean.java 548B
WebSocketServer.java 514B
DbOpenHelper.java 482B
ServiceComponent.java 457B
ExampleUnitTest.java 399B
BaseEnum.java 386B
DataManager.java 360B
MainView.java 316B
ApplicationContext.java 305B
PreferenceName.java 302B
DbName.java 293B
AdvBaseFragment.java 287B
PerActivity.java 286B
IService.java 278B
PerService.java 275B
MyWebSocketListener.java 268B
SocketRespInterface.java 259B
ServiceMvpPresenter.java 258B
SocketHelper.java 227B
DbHelper.java 211B
SharePreferenecesHelper.java 208B
MvpPresenter.java 196B
ChatDataObserver.java 152B
MvpView.java 146B
AdvJsonEntity.java 115B
shengzhong_logo.jpg 425KB
adv_test1.JPG 208KB
共 1535 条
- 1
- 2
- 3
- 4
- 5
- 6
- 16
资源评论
土豆片片
- 粉丝: 1802
- 资源: 5647
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 技术资料分享NES Specifications很好的技术资料.zip
- 技术资料分享MultiMediaCard Product Manual很好的技术资料.zip
- 技术资料分享MP2359很好的技术资料.zip
- 清泉2024 排位.pdf
- 技术资料分享MP2359 AN很好的技术资料.zip
- 技术资料分享MMC-System-Spec-v3.31很好的技术资料.zip
- 技术资料分享MMCSDTimming很好的技术资料.zip
- 技术资料分享MMC-FAT16-File-System-Specification-v1.0很好的技术资料.zip
- 技术资料分享MDk如何生成bin文件很好的技术资料.zip
- 技术资料分享Keil用户手册很好的技术资料.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功