Example usage for android.widget EdgeEffect EdgeEffect

List of usage examples for android.widget EdgeEffect EdgeEffect

Introduction

In this page you can find the example usage for android.widget EdgeEffect EdgeEffect.

Prototype

public EdgeEffect(Context context) 

Source Link

Document

Construct a new EdgeEffect with a theme appropriate for the provided context.

Usage

From source file:com.emmaguy.todayilearned.PanView.java

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

    // Sets up interactions
    mGestureDetector = new GestureDetector(context, new ScrollFlingGestureListener());
    mScroller = new OverScroller(context);
    mEdgeEffectLeft = new EdgeEffect(context);
    mEdgeEffectTop = new EdgeEffect(context);
    mEdgeEffectRight = new EdgeEffect(context);
    mEdgeEffectBottom = new EdgeEffect(context);

    mDrawBlurredPaint = new Paint();
    mDrawBlurredPaint.setDither(true);//  w  w  w.j a  v a2  s  .c o  m
}

From source file:de.dmxcontrol.activity.ControlActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    super.onCreate(savedInstanceState);
    SWIPE_MIN_VELOCITY = this.getResources().getInteger(R.integer.swipe_min_velocity);
    SWIPE_MIN_DISTANCE = this.getResources().getInteger(R.integer.swipe_min_distance);
    //Change the EdgeEffectColor to our HighlightColor
    int glowDrawableId = this.getResources().getIdentifier("overscroll_glow", "drawable", "android");
    Drawable androidGlow = this.getResources().getDrawable(glowDrawableId);
    androidGlow.setColorFilter(this.getResources().getColor(R.color.btn_background_highlight),
            PorterDuff.Mode.SRC_IN);//  w  w w. jav  a 2s .  c  o m

    int edgeDrawableId = this.getResources().getIdentifier("overscroll_edge", "drawable", "android");
    Drawable androidEdge = this.getResources().getDrawable(edgeDrawableId);
    androidEdge.setColorFilter(this.getResources().getColor(R.color.btn_background_highlight),
            PorterDuff.Mode.SRC_IN);

    int scrollBarHDrawableId = this.getResources().getIdentifier("scrollbar_handle_horizontal", "drawable",
            "android");
    Drawable androidscrollBarH = this.getResources().getDrawable(scrollBarHDrawableId);
    androidscrollBarH.setColorFilter(this.getResources().getColor(R.color.btn_background_highlight),
            PorterDuff.Mode.SRC_IN);

    int scrollBarVDrawableId = this.getResources().getIdentifier("scrollbar_handle_vertical", "drawable",
            "android");
    Drawable androidscrollBarV = this.getResources().getDrawable(scrollBarVDrawableId);
    androidscrollBarV.setColorFilter(this.getResources().getColor(R.color.btn_background_highlight),
            PorterDuff.Mode.SRC_IN);

    setContentView(R.layout.root_screen_with_selector_drawer);
    gestureDetector = new GestureDetector(this, this);

    edgeEffect = new EdgeEffect(this);

    if (((DMXControlApplication) getApplication()).getJustStarted() && !DISABLE_SPLASH) {
        showDialog(DIALOG_SPLASH);
    }

    ad = new AboutDialogs(this);
}

From source file:com.comcast.freeflow.core.FreeFlowContainer.java

@Override
protected void init(Context context) {
    // usedViews = new HashMap<Object, FreeFlowItem>();
    // usedHeaderViews = new HashMap<Object, FreeFlowItem>();

    setWillNotDraw(false);//from   w  w w  .  ja v a  2  s.  c  o m

    viewpool = new ViewPool();
    frames = new HashMap<Object, FreeFlowItem>();

    ViewConfiguration configuration = ViewConfiguration.get(context);
    maxFlingVelocity = configuration.getScaledMaximumFlingVelocity();
    minFlingVelocity = configuration.getScaledMinimumFlingVelocity();
    overflingDistance = configuration.getScaledOverflingDistance();
    overscrollDistance = configuration.getScaledOverscrollDistance();

    touchSlop = configuration.getScaledTouchSlop();

    scroller = new OverScroller(context);
    mLeftEdge = new EdgeEffect(context);
    mRightEdge = new EdgeEffect(context);
    mTopEdge = new EdgeEffect(context);
    mBottomEdge = new EdgeEffect(context);

}

From source file:net.simonvt.staggeredgridview.StaggeredGridView.java

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

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.StaggeredGridView, defStyle, 0);

    colCount = a.getInt(R.styleable.StaggeredGridView_android_numColumns, 1);
    verticalItemMargin = a.getDimensionPixelSize(R.styleable.StaggeredGridView_verticalItemMargin, 0);
    horizontalItemMargin = a.getDimensionPixelSize(R.styleable.StaggeredGridView_horizontalItemMargin, 0);
    selector = a.getDrawable(R.styleable.StaggeredGridView_android_listChoiceBackgroundIndicator);
    if (selector != null) {
        selector.setCallback(this);
    }/*from   w  ww.  j  a  va 2  s  .c  o  m*/

    a.recycle();

    final ViewConfiguration vc = ViewConfiguration.get(context);
    touchSlop = vc.getScaledTouchSlop();
    maximumVelocity = vc.getScaledMaximumFlingVelocity();
    flingVelocity = vc.getScaledMinimumFlingVelocity();
    scroller = new Scroller(context);

    topEdge = new EdgeEffect(context);
    bottomEdge = new EdgeEffect(context);
    setWillNotDraw(false);
    setClipToPadding(false);
    setVerticalScrollBarEnabled(true);
}

From source file:com.microhealthllc.Slide.MultiShrinkScroller.java

/**
 * Create a new instance of MultiShrinkScroller.
 *
 * @param context//  w w  w  .java  2  s .c om
 * @param attrs
 * @param defStyleAttr
 */
public MultiShrinkScroller(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    setFocusable(false);
    setWillNotDraw(false);

    edgeGlowBottom = new EdgeEffect(context);
    edgeGlowTop = new EdgeEffect(context);
    scroller = new Scroller(context, INTERPOLATOR);
    touchSlop = configuration.getScaledTouchSlop();
    minimumVelocity = configuration.getScaledMinimumFlingVelocity();
    maximumVelocity = configuration.getScaledMaximumFlingVelocity();
    transparentStartHeight = (int) getResources().getDimension(R.dimen.sliding_starting_empty_height);
    toolbarElevation = getResources().getDimension(R.dimen.sliding_toolbar_elevation);
    isTwoPanel = getResources().getBoolean(R.bool.sliding_two_panel);
    paddedLayout = getResources().getBoolean(R.bool.padded_layout);
    maximumTitleMargin = (int) getResources().getDimension(R.dimen.sliding_title_initial_margin);

    dismissDistanceOnScroll = (int) getResources().getDimension(R.dimen.sliding_dismiss_distance_on_scroll);
    dismissDistanceOnRelease = (int) getResources().getDimension(R.dimen.sliding_dismiss_distance_on_release);
    snapToTopSlopHeight = (int) getResources().getDimension(R.dimen.sliding_snap_to_top_slop_height);

    final TypedValue photoRatio = new TypedValue();
    getResources().getValue(R.dimen.sliding_landscape_photo_ratio, photoRatio, true);
    landscapePhotoRatio = photoRatio.getFloat();

    final TypedArray attributeArray = context
            .obtainStyledAttributes(new int[] { android.R.attr.actionBarSize });
    actionBarSize = attributeArray.getDimensionPixelSize(0, 0);
    minimumHeaderHeight = actionBarSize;
    attributeArray.recycle();

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        textSizePathInterpolator = new PathInterpolator(X1, Y1, X2, Y2);
    } else {
        textSizePathInterpolator = null;
    }
}

From source file:com.klinker.android.sliding.MultiShrinkScroller.java

/**
 * Create a new instance of MultiShrinkScroller.
 * @param context//w  w w.j av a  2s. com
 * @param attrs
 * @param defStyleAttr
 */
public MultiShrinkScroller(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    setFocusable(false);
    setWillNotDraw(false);

    edgeGlowBottom = new EdgeEffect(context);
    edgeGlowTop = new EdgeEffect(context);
    scroller = new Scroller(context, INTERPOLATOR);
    touchSlop = configuration.getScaledTouchSlop();
    minimumVelocity = configuration.getScaledMinimumFlingVelocity();
    maximumVelocity = configuration.getScaledMaximumFlingVelocity();
    transparentStartHeight = (int) getResources().getDimension(R.dimen.sliding_starting_empty_height);
    toolbarElevation = getResources().getDimension(R.dimen.sliding_toolbar_elevation);
    isTwoPanel = getResources().getBoolean(R.bool.sliding_two_panel);
    maximumTitleMargin = (int) getResources().getDimension(R.dimen.sliding_title_initial_margin);

    dismissDistanceOnScroll = (int) getResources().getDimension(R.dimen.sliding_dismiss_distance_on_scroll);
    dismissDistanceOnRelease = (int) getResources().getDimension(R.dimen.sliding_dismiss_distance_on_release);
    snapToTopSlopHeight = (int) getResources().getDimension(R.dimen.sliding_snap_to_top_slop_height);

    final TypedValue photoRatio = new TypedValue();
    getResources().getValue(R.dimen.sliding_landscape_photo_ratio, photoRatio, true);
    landscapePhotoRatio = photoRatio.getFloat();

    final TypedArray attributeArray = context
            .obtainStyledAttributes(new int[] { android.R.attr.actionBarSize });
    actionBarSize = attributeArray.getDimensionPixelSize(0, 0);
    minimumHeaderHeight = actionBarSize;
    attributeArray.recycle();

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        textSizePathInterpolator = new PathInterpolator(X1, Y1, X2, Y2);
    } else {
        textSizePathInterpolator = null;
    }
}

From source file:com.android.internal.widget.ViewPager.java

public ViewPager(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
    super(context, attrs, defStyleAttr, defStyleRes);

    setWillNotDraw(false);/*from www.  j a v a  2 s .  c o  m*/
    setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
    setFocusable(true);

    mScroller = new Scroller(context, sInterpolator);
    final ViewConfiguration configuration = ViewConfiguration.get(context);
    final float density = context.getResources().getDisplayMetrics().density;

    mTouchSlop = configuration.getScaledPagingTouchSlop();
    mMinimumVelocity = (int) (MIN_FLING_VELOCITY * density);
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
    mLeftEdge = new EdgeEffect(context);
    mRightEdge = new EdgeEffect(context);

    mFlingDistance = (int) (MIN_DISTANCE_FOR_FLING * density);
    mCloseEnough = (int) (CLOSE_ENOUGH * density);
    mDefaultGutterSize = (int) (DEFAULT_GUTTER_SIZE * density);

    if (getImportantForAccessibility() == IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
        setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES);
    }
}

From source file:com.bitflake.counter.HorizontalPicker.java

@Override
public void setOverScrollMode(int overScrollMode) {
    if (overScrollMode != OVER_SCROLL_NEVER) {
        Context context = getContext();
        leftEdgeEffect = new EdgeEffect(context);
        rightEdgeEffect = new EdgeEffect(context);
    } else {/*from w  w w .  j  a  v  a 2s . co  m*/
        leftEdgeEffect = null;
        rightEdgeEffect = null;
    }

    super.setOverScrollMode(overScrollMode);
}

From source file:com.lab47billion.appchooser.HorizontalPicker.java

@Override
public void setOverScrollMode(int overScrollMode) {
    if (overScrollMode != OVER_SCROLL_NEVER) {
        Context context = getContext();
        mLeftEdgeEffect = new EdgeEffect(context);
        mRightEdgeEffect = new EdgeEffect(context);
    } else {/*from   ww w  .j  a v  a  2 s  .  com*/
        mLeftEdgeEffect = null;
        mRightEdgeEffect = null;
    }

    super.setOverScrollMode(overScrollMode);
}

From source file:com.marshalchen.common.uimodule.freeflow.core.FreeFlowContainer.java

/**
 * Controls whether the edge glows are enabled or not
 *///w w w  .j  av a2 s . c om
public void setEdgeEffectsEnabled(boolean val) {
    mEdgeEffectsEnabled = val;
    if (val) {
        Context context = getContext();
        setWillNotDraw(false);
        mLeftEdge = new EdgeEffect(context);
        mRightEdge = new EdgeEffect(context);
        mTopEdge = new EdgeEffect(context);
        mBottomEdge = new EdgeEffect(context);
    } else {
        setWillNotDraw(true);
        mLeftEdge = mRightEdge = mTopEdge = mBottomEdge = null;
    }
}