Android Open Source - infinitep Custom Scroll View






From Project

Back to project page infinitep.

License

The source code is released under:

Apache License

If you think the Android project infinitep 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 es.daconstenla.infinip.customcomponents.pieces.data;
/* w w w .ja v a2  s. c o  m*/
import android.content.Context;
import android.util.AttributeSet;
import android.view.GestureDetector;
import android.view.GestureDetector.SimpleOnGestureListener;
import android.view.MotionEvent;
import android.view.View;
import android.widget.ScrollView;

class CustomScrollView extends ScrollView {
    private GestureDetector gestureDetector;
    View.OnTouchListener gestureListener;

  public CustomScrollView(Context context, AttributeSet attrs) {
        super(context, attrs);
        gestureDetector = new GestureDetector(context,new YScrollDetector());
        setFadingEdgeLength(0);
  }
  
  @Override
  public boolean onTouchEvent(MotionEvent ev) {
      return super.onTouchEvent(ev);
  }
  
  @Override
  public boolean onInterceptTouchEvent(MotionEvent ev) {
      //Call super first because it does some hidden motion event handling
      boolean result = super.onInterceptTouchEvent(ev);
     //Now see if we are scrolling vertically with the custom gesture detector
     if (gestureDetector.onTouchEvent(ev)) {
          return result;
     } 
     //If not scrolling vertically (more y than x), don't hijack the event.
      else {
          return false;
     }
  }
  
  // Return false if we're scrolling in the x direction  
  class YScrollDetector extends SimpleOnGestureListener {
      @Override
      public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float     distanceY) {
        try {
            if (Math.abs(distanceY) > Math.abs(distanceX)) {
                return true;
            } else {
                return false;
            }
        } catch (Exception e) {
            // nothing
        }
        return false;
      }
  }
}




Java Source Code List

com.example.databasetest.FullscreenActivity.java
com.example.databasetest.util.SystemUiHiderBase.java
com.example.databasetest.util.SystemUiHiderHoneycomb.java
com.example.databasetest.util.SystemUiHider.java
com.example.datatest.MainActivity.java
com.example.datatest.database.InfinitepHelper.java
com.example.datatest.database.MovementRaw.java
com.example.datatest.database.MovementSummary.java
com.example.datatest.database.TableMovementRaw.java
com.example.datatest.database.TableMovementSummary.java
com.example.datatest.databaseTest.DatabaseTester.java
com.example.datatest.util.Utils.java
es.daconstenla.infinip.activity.CalendarActivity.java
es.daconstenla.infinip.activity.DayActivity.java
es.daconstenla.infinip.activity.MainActivity.java
es.daconstenla.infinip.activity.RangeActivity.java
es.daconstenla.infinip.activity.SettingsActivity.java
es.daconstenla.infinip.activity.SplashActivity.java
es.daconstenla.infinip.activity.SyncActivity.java
es.daconstenla.infinip.customcomponents.HorizontalGraph.java
es.daconstenla.infinip.customcomponents.InformationBox.java
es.daconstenla.infinip.customcomponents.MonthFragmentTest.java
es.daconstenla.infinip.customcomponents.MonthFragment.java
es.daconstenla.infinip.customcomponents.MonthView.java
es.daconstenla.infinip.customcomponents.MyFragmentMonthAdapter.java
es.daconstenla.infinip.customcomponents.events.OnSwipeTouchListener.java
es.daconstenla.infinip.customcomponents.pieces.ElementBackground.java
es.daconstenla.infinip.customcomponents.pieces.HorGraphBar.java
es.daconstenla.infinip.customcomponents.pieces.ItemCalendarDay.java
es.daconstenla.infinip.customcomponents.pieces.data.BarElementData.java
es.daconstenla.infinip.customcomponents.pieces.data.ColorMyCustom.java
es.daconstenla.infinip.customcomponents.pieces.data.CustomScrollView.java
es.daconstenla.infinip.customcomponents.pieces.data.ItemHorizontalBar.java
es.daconstenla.infinip.database.InfinitepHelper.java
es.daconstenla.infinip.database.MovementRaw.java
es.daconstenla.infinip.database.MovementSummary.java
es.daconstenla.infinip.database.TableMovementRaw.java
es.daconstenla.infinip.database.TableMovementSummary.java
es.daconstenla.infinip.database.utils.Utils.java
es.daconstenla.infinip.unused.AutoResizeTextView.java