Android Open Source - Ocypode Lockable Scroll View From Project Back to project page Ocypode .
License The source code is released under:
MIT License
If you think the Android project Ocypode listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code package com.ocypode.component.view.scrollview;
/ * w w w . j a v a 2 s . c o m * /
import android.content.Context;
import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.ScrollView;
public class LockableScrollView extends ScrollView implements OnPageChangeListener{
private boolean isLocked = false;
private boolean mScrollInit = false;
private ScrollViewListener scrollViewListener = null;
public LockableScrollView(Context context, AttributeSet attrs) {
super (context, attrs);
}
public void setLock(boolean lock){
isLocked = lock;
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
if (isLocked){
return false;
}else {
return super.onInterceptTouchEvent(ev);
}
}
@Override
public void onPageScrollStateChanged(int state) {
checkStateScroll(state);
}
@Override
public void onPageScrolled(int arg0, float offSet, int arg2) {
if (offSet > 0 && mScrollInit) {
setLock(true);
}
}
@Override
public void onPageSelected(int arg0) {
}
private void checkStateScroll(int state){
if (state == 1){
mScrollInit = true;
}else if (state == 0){
mScrollInit = false;
setLock(false);
}
}
public void setScrollViewListener(ScrollViewListener scrollViewListener) {
this.scrollViewListener = scrollViewListener;
}
@Override
protected void onScrollChanged(int l, int t, int oldl, int oldt) {
super.onScrollChanged(l, t, oldl, oldt);
if (scrollViewListener != null) {
scrollViewListener.onScrollChanged(this , l, t, oldl, oldt);
}
}
public interface ScrollViewListener {
void onScrollChanged(LockableScrollView scrollView, int x, int y, int oldx, int oldy);
}
}
Java Source Code List com.ocypode.BuildConfig.java com.ocypode.BuildConfig.java com.ocypode.activity.IResultCallbackActivity.java com.ocypode.activity.robo.AbstractRoboActivity.java com.ocypode.activity.robo.AbstractRoboFragmentActivity.java com.ocypode.activity.robo.fragment.AbstractRoboFragment.java com.ocypode.bluetooth.BluetoothHelper.java com.ocypode.component.Typefaced.java com.ocypode.component.animation.AnimationCallbackListener.java com.ocypode.component.delegate.IStartActivityDelegate.java com.ocypode.component.delegate.StartActivityDelegate.java com.ocypode.component.delegate.adaptor.IStartActivityAdaptor.java com.ocypode.component.delegate.adaptor.StartActivityAdaptor.java com.ocypode.component.delegate.adaptor.StartFragmentAdaptor.java com.ocypode.component.view.button.TypefacedButton.java com.ocypode.component.view.dialog.AlertDialogBuilder.java com.ocypode.component.view.dialog.ProgressDialogBuilder.java com.ocypode.component.view.dialog.titledescription.TitleDescriptionArrayAdapter.java com.ocypode.component.view.dialog.titledescription.TitleDescriptionModel.java com.ocypode.component.view.edittext.TypefacedEditText.java com.ocypode.component.view.imageview.CircleImageView.java com.ocypode.component.view.listview.LockableListView.java com.ocypode.component.view.scrollview.LockableScrollView.java com.ocypode.component.view.textview.AutoResizeTextView.java com.ocypode.component.view.textview.TypefacedTextView.java com.ocypode.repository.AbstractRepository.java com.ocypode.utility.ICallback.java com.ocypode.utility.Logcat.java com.ocypode.utility.Utility.java com.ocypode.utility.bitmap.BitmapUtil.java com.ocypode.utility.formatter.CurrencyFormatter.java com.ocypode.utility.formatter.DateFormatter.java com.ocypode.utility.formatter.NumberFormatter.java com.ocypode.utility.validation.StringValidation.java com.ocypode.widgets.list.OCListView.java