Android Open Source - Geoclock Lockable Scroll View






From Project

Back to project page Geoclock.

License

The source code is released under:

GNU General Public License

If you think the Android project Geoclock 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 maurizi.geoclock;
/*from  w  ww. j  a  v  a  2s  .c  om*/
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.ScrollView;

/**
 * Adapted from http://stackoverflow.com/a/5763815
 */
public class LockableScrollView extends ScrollView {

  // true if we can scroll (not locked)
  // false if we cannot scroll (locked)
  private boolean mScrollable = true;

  public void setScrollingEnabled(boolean enabled) {
    mScrollable = enabled;
  }

  public LockableScrollView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
  }

  public LockableScrollView(Context context, AttributeSet attrs) {
    super(context, attrs);
  }

  public LockableScrollView(Context context) {
    super(context);
  }

  @Override
  public boolean onTouchEvent(MotionEvent ev) {
    switch (ev.getAction()) {
      case MotionEvent.ACTION_DOWN:
        return mScrollable && super.onTouchEvent(ev);
      default:
        return super.onTouchEvent(ev);
    }
  }

  @Override
  public boolean onInterceptTouchEvent(MotionEvent ev) {
    return mScrollable && super.onInterceptTouchEvent(ev);
  }

}




Java Source Code List

maurizi.geoclock.AbstractGeoAlarmReceiver.java
maurizi.geoclock.AlarmManagerReceiver.java
maurizi.geoclock.BootReceiver.java
maurizi.geoclock.GeoAlarmFragment.java
maurizi.geoclock.GeoAlarm.java
maurizi.geoclock.GeofenceReceiver.java
maurizi.geoclock.LockableScrollView.java
maurizi.geoclock.MapActivity.java
maurizi.geoclock.NavigationDrawerFragment.java
maurizi.geoclock.ToastLocationClientHandler.java