项目:AndelaTrackChallenge
文件:Easel.java
/**
* Tint the edge effect when you reach the end of a scroll view. API 21+ only
*
* @param scrollableView the scrollable view,such as a {@link android.widget.ScrollView}
* @param color the color
* @return true if it worked,false if it did not
*/
@TargetApi(21)
public static boolean tintEdgeEffect(@NonNull View scrollableView,@ColorInt int color) {
//http://stackoverflow.com/questions/27104521/android-lollipop-scrollview-edge-effect-color
boolean outcome = false;
final String[] edgeGlows = {"mEdgeGlowTop","mEdgeGlowBottom","mEdgeGlowLeft","mEdgeGlowRight"};
for (String edgeGlow : edgeGlows) {
Class<?> clazz = scrollableView.getClass();
while (clazz != null) {
try {
final Field edgeGlowField = clazz.getDeclaredField(edgeGlow);
edgeGlowField.setAccessible(true);
final EdgeEffect edgeEffect = (EdgeEffect) edgeGlowField.get(scrollableView);
edgeEffect.setColor(color);
outcome = true;
break;
} catch (Exception e) {
clazz = clazz.getSuperclass();
}
}
}
return outcome;
}
项目:OmniSnitch
文件:horizontallistView.java
public horizontallistView(Context context,AttributeSet attrs) {
super(context,attrs);
mEdgeGlowLeft = new EdgeEffect(context);
mEdgeGlowRight = new EdgeEffect(context);
mGestureDetector = new GestureDetector(context,mGestureListener);
bindGestureDetector();
initView();
retrieveXmlConfiguration(context,attrs);
setwillNotDraw(false);
// If the OS version is high enough then set the friction on the fling
// tracker */
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
HoneycombPlus.setFriction(mFlingTracker,FLING_FRICTION);
}
ViewConfiguration vc = ViewConfiguration.get(context);
mSlop = vc.getScaledTouchSlop();
}
项目:airgram
文件:AndroidUtilities.java
public static void setListViewEdgeEffectColor(AbsListView listView,int color) {
if (Build.VERSION.SDK_INT >= 21) {
try {
Field field = AbsListView.class.getDeclaredField("mEdgeGlowTop");
field.setAccessible(true);
EdgeEffect mEdgeGlowTop = (EdgeEffect) field.get(listView);
if (mEdgeGlowTop != null) {
mEdgeGlowTop.setColor(color);
}
field = AbsListView.class.getDeclaredField("mEdgeGlowBottom");
field.setAccessible(true);
EdgeEffect mEdgeGlowBottom = (EdgeEffect) field.get(listView);
if (mEdgeGlowBottom != null) {
mEdgeGlowBottom.setColor(color);
}
} catch (Exception e) {
FileLog.e("tmessages",e);
}
}
}
public static void setListViewEdgeEffectColor(AbsListView listView,int color) {
if (Build.VERSION.SDK_INT >= 21) {
try {
Field field = AbsListView.class.getDeclaredField("mEdgeGlowTop");
field.setAccessible(true);
EdgeEffect mEdgeGlowTop = (EdgeEffect) field.get(listView);
if (mEdgeGlowTop != null) {
mEdgeGlowTop.setColor(color);
}
field = AbsListView.class.getDeclaredField("mEdgeGlowBottom");
field.setAccessible(true);
EdgeEffect mEdgeGlowBottom = (EdgeEffect) field.get(listView);
if (mEdgeGlowBottom != null) {
mEdgeGlowBottom.setColor(color);
}
} catch (Exception e) {
e.printstacktrace();
}
}
}
项目:PlusGram
文件:AndroidUtilities.java
public static void setListViewEdgeEffectColor(AbsListView listView,e);
}
}
}
/**
* Constructor
*
* @param context The context
* @param attrs The attrs
* @param defStyleAttr The default attr
*/
public FmScroller(Context context,AttributeSet attrs,int defStyleAttr) {
super(context,attrs,defStyleAttr);
final ViewConfiguration configuration = ViewConfiguration.get(context);
setFocusable(false);
// Drawing must be enabled in order to support EdgeEffect
setwillNotDraw(/* willNotDraw = */false);
mEdgeGlowBottom = new EdgeEffect(context);
mScroller = new Scroller(context,INTERPOLATOR);
mTouchSlop = configuration.getScaledTouchSlop();
mMinimumVeLocity = configuration.getScaledMinimumFlingVeLocity();
mMaximumVeLocity = configuration.getScaledMaximumFlingVeLocity();
final TypedArray attributeArray = context.obtainStyledAttributes(new int[] {
android.R.attr.actionBarSize
});
mActionBarSize = attributeArray.getDimensionPixelSize(0,0);
attributeArray.recycle();
}
项目:euphoria-vk-client
文件:AndroidUtils.java
public static void setEdgeEffectColor(EdgeEffect edgeEffect,int color) {
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
edgeEffect.setColor(color);
return;
}
Field edgeField = EdgeEffect.class.getDeclaredField("mEdge");
Field glowField = EdgeEffect.class.getDeclaredField("mGlow");
edgeField.setAccessible(true);
glowField.setAccessible(true);
Drawable mEdge = (Drawable) edgeField.get(edgeEffect);
Drawable mGlow = (Drawable) glowField.get(edgeEffect);
mEdge.setColorFilter(color,PorterDuff.Mode.SRC_IN);
mGlow.setColorFilter(color,PorterDuff.Mode.SRC_IN);
mEdge.setCallback(null); // free up any references
mGlow.setCallback(null); // free up any references
} catch (Exception ignored) {
}
}
项目:yelo-android
文件:AndroidUtilities.java
public static void setListViewEdgeEffectColor(AbsListView listView,int color) {
if (Build.VERSION.SDK_INT >= 21) {
try {
Field field = AbsListView.class.getDeclaredField("mEdgeGlowTop");
field.setAccessible(true);
EdgeEffect mEdgeGlowTop = (EdgeEffect) field.get(listView);
if (mEdgeGlowTop != null) {
mEdgeGlowTop.setColor(color);
}
field = AbsListView.class.getDeclaredField("mEdgeGlowBottom");
field.setAccessible(true);
EdgeEffect mEdgeGlowBottom = (EdgeEffect) field.get(listView);
if (mEdgeGlowBottom != null) {
mEdgeGlowBottom.setColor(color);
}
} catch (Exception e) {
e.printstacktrace();
}
}
}
项目:Dashchan
文件:PhotoViewPager.java
public PhotoViewPager(Context context,Adapter adapter) {
super(context);
setwillNotDraw(false);
float density = ResourceUtils.obtainDensity(context);
flingdistance = (int) (24 * density);
ViewConfiguration configuration = ViewConfiguration.get(context);
minimumVeLocity = (int) (MIN_FLING_VELociTY * density);
maximumVeLocity = configuration.getScaledMaximumFlingVeLocity();
touchSlop = configuration.getScaledTouchSlop();
scroller = new OverScroller(context);
edgeEffect = new EdgeEffect(context);
this.adapter = adapter;
for (int i = 0; i < 3; i++) {
View view = adapter.onCreateView(this);
super.addView(view,-1,generateDefaultLayoutParams());
photoViews.add(adapter.getPhotoView(view));
}
}
项目:GitHub
文件:FreeFlowContainer.java
/**
* Controls whether the edge glows are enabled or not
*/
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;
}
}
项目:airgram
文件:RecyclerView.java
void applyEdgeEffectColor(EdgeEffectCompat edgeEffectCompat) {
if (Build.VERSION.SDK_INT >= 21 && glowColor != 0) {
try {
Field field = EdgeEffectCompat.class.getDeclaredField("mEdgeEffect");
field.setAccessible(true);
EdgeEffect edgeEffect = (EdgeEffect) field.get(edgeEffectCompat);
if (edgeEffect != null) {
edgeEffect.setColor(glowColor);
}
} catch (Exception e) {
FileLog.e("tmessages",e);
}
}
}
项目:PlusGram
文件:RecyclerView.java
void applyEdgeEffectColor(EdgeEffectCompat edgeEffectCompat) {
if (Build.VERSION.SDK_INT >= 21 && glowColor != 0) {
try {
Field field = EdgeEffectCompat.class.getDeclaredField("mEdgeEffect");
field.setAccessible(true);
EdgeEffect edgeEffect = (EdgeEffect) field.get(edgeEffectCompat);
if (edgeEffect != null) {
edgeEffect.setColor(glowColor);
}
} catch (Exception e) {
FileLog.e("tmessages",e);
}
}
}
项目:PlusGram
文件:Glow.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private static void setEdgeGlowColor(Object edgeEffect,@ColorInt int color) {
if (edgeEffect instanceof EdgeEffectCompat) {
// EdgeEffectCompat
try {
edgeEffect = EDGE_EFFECT_COMPAT_FIELD_EDGE_EFFECT.get(edgeEffect);
} catch (illegalaccessexception e) {
if (BuildConfig.DEBUG) e.printstacktrace();
return;
}
}
if (edgeEffect == null) return;
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
// EdgeGlow below Android 4 then old EdgeEffect
try {
final Drawable mEdge = (Drawable) EDGE_GLOW_FIELD_EDGE.get(edgeEffect);
final Drawable mGlow = (Drawable) EDGE_GLOW_FIELD_GLOW.get(edgeEffect);
mEdge.setColorFilter(color,PorterDuff.Mode.SRC_IN);
mGlow.setColorFilter(color,PorterDuff.Mode.SRC_IN);
mEdge.setCallback(null); // free up any references
mGlow.setCallback(null); // free up any references
} catch (Exception ex) {
if (BuildConfig.DEBUG) ex.printstacktrace();
}
} else {
// EdgeEffect
((EdgeEffect) edgeEffect).setColor(color);
}
}
项目:MusicX-music-player
文件:EdgeGlowUtil.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private static void setEffectColor(Object edgeEffect,@ColorInt int color) {
invalidateEdgeEffectFields();
if (edgeEffect instanceof EdgeEffectCompat) {
// EdgeEffectCompat
try {
EDGE_EFFECT_COMPAT_FIELD_EDGE_EFFECT.setAccessible(true);
edgeEffect = EDGE_EFFECT_COMPAT_FIELD_EDGE_EFFECT.get(edgeEffect);
} catch (illegalaccessexception e) {
e.printstacktrace();
return;
}
}
if (edgeEffect == null)
return;
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
// EdgeGlow
try {
EDGE_GLOW_FIELD_EDGE.setAccessible(true);
final Drawable mEdge = (Drawable) EDGE_GLOW_FIELD_EDGE.get(edgeEffect);
EDGE_GLOW_FIELD_GLOW.setAccessible(true);
final Drawable mGlow = (Drawable) EDGE_GLOW_FIELD_GLOW.get(edgeEffect);
mEdge.setColorFilter(color,PorterDuff.Mode.SRC_IN);
mEdge.setCallback(null); // free up any references
mGlow.setCallback(null); // free up any references
} catch (Exception ex) {
ex.printstacktrace();
}
} else {
// EdgeEffect
((EdgeEffect) edgeEffect).setColor(color);
}
}
项目:JZAndroidChart
文件:Chart.java
protected void setupEdgeEffect(Context context) {
// Sets up edge effects
mEdgeEffectLeft = new EdgeEffect(context);
mEdgeEffectTop = new EdgeEffect(context);
mEdgeEffectRight = new EdgeEffect(context);
mEdgeEffectBottom = new EdgeEffect(context);
}
项目:Travel-Mate
文件:FlipViewPager.java
private void init() {
ViewConfiguration configuration = ViewConfiguration.get(getContext());
mScroller = new Scroller(getContext(),new LinearInterpolator());
mTouchSlop = configuration.getScaledPagingTouchSlop();
mMinimumVeLocity = configuration.getScaledMinimumFlingVeLocity();
mMaximumVeLocity = configuration.getScaledMaximumFlingVeLocity();
mLeftEdgeEffect = new EdgeEffect(getContext());
mRightEdgeEffect = new EdgeEffect(getContext());
mShadePaint.setColor(Color.BLACK);
mShinePaint.setColor(Color.WHITE);
}
项目:app-theme-engine-master
文件:EdgeGlowUtil.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private static void setEdgeGlowColor(@NonNull EdgeEffectCompat edgeEffect,@ColorInt int color) throws Exception {
Field field = EdgeEffectCompat.class.getDeclaredField("mEdgeEffect");
field.setAccessible(true);
EdgeEffect effect = (EdgeEffect) field.get(edgeEffect);
if (effect != null)
effect.setColor(color);
}
项目:euphoria-vk-client
文件:AndroidUtils.java
public static void setEdgeGlowColor(AbsListView listView,int color) {
try {
Class<?> clazz = AbsListView.class;
Field fEdgeGlowTop = clazz.getDeclaredField("mEdgeGlowTop");
Field fEdgeGlowBottom = clazz.getDeclaredField("mEdgeGlowBottom");
fEdgeGlowTop.setAccessible(true);
fEdgeGlowBottom.setAccessible(true);
setEdgeEffectColor((EdgeEffect) fEdgeGlowTop.get(listView),color);
setEdgeEffectColor((EdgeEffect) fEdgeGlowBottom.get(listView),color);
} catch (Throwable ignored) {
}
}
项目:CustomEQView
文件:HorizontalPicker.java
private void drawEdgeEffect(Canvas canvas,EdgeEffect edgeEffect,int degrees) {
if (canvas == null || edgeEffect == null || (degrees != 90 && degrees != 270)) {
return;
}
if(!edgeEffect.isFinished()) {
final int restoreCount = canvas.getSaveCount();
final int width = getWidth();
final int height = getHeight();
canvas.rotate(degrees);
if (degrees == 270) {
canvas.translate(-height,Math.max(0,getScrollX()));
} else { // 90
canvas.translate(0,-(Math.max(getScrollRange(),getScaleX()) + width));
}
edgeEffect.setSize(height,width);
if(edgeEffect.draw(canvas)) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
postInvalidateOnAnimation();
} else {
postInvalidate();
}
}
canvas.restoretoCount(restoreCount);
}
}
项目:CustomEQView
文件: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 {
leftEdgeEffect = null;
rightEdgeEffect = null;
}
super.setoverScrollMode(overScrollMode);
}
项目:SimpleFlickrSearch
文件:FlipViewPager.java
private void init() {
ViewConfiguration configuration = ViewConfiguration.get(getContext());
mScroller = new Scroller(getContext(),new LinearInterpolator());
mTouchSlop = configuration.getScaledPagingTouchSlop();
mMinimumVeLocity = configuration.getScaledMinimumFlingVeLocity();
mMaximumVeLocity = configuration.getScaledMaximumFlingVeLocity();
mLeftEdgeEffect = new EdgeEffect(getContext());
mRightEdgeEffect = new EdgeEffect(getContext());
mShadePaint.setColor(Color.BLACK);
mShinePaint.setColor(Color.WHITE);
}
项目:Android-SDK-Demo
文件:SdkCenteredViewPager.java
void initViewPager()
{
setwillNotDraw( false );
setDescendantFocusability( FOCUS_AFTER_DESCENDANTS );
setFocusable( true );
final Context context = getContext();
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 );
setAccessibilityDelegate( new MyAccessibilityDelegate() );
if ( this.getImportantForAccessibility()
== View.IMPORTANT_FOR_ACCESSIBILITY_AUTO )
{
setImportantForAccessibility( View.IMPORTANT_FOR_ACCESSIBILITY_YES );
}
}
项目:app-theme-engine
文件:EdgeGlowUtil.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private static void setEffectColor(Object edgeEffect,PorterDuff.Mode.SRC_IN);
mEdge.setCallback(null); // free up any references
mGlow.setCallback(null); // free up any references
} catch (Exception ex) {
ex.printstacktrace();
}
} else {
// EdgeEffect
((EdgeEffect) edgeEffect).setColor(color);
}
}
项目:MyAndroidDemo
文件:HorizontalPicker.java
private void drawEdgeEffect(Canvas canvas,width);
if(edgeEffect.draw(canvas)) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
postInvalidateOnAnimation();
} else {
postInvalidate();
}
}
canvas.restoretoCount(restoreCount);
}
}
项目:MyAndroidDemo
文件: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 {
leftEdgeEffect = null;
rightEdgeEffect = null;
}
super.setoverScrollMode(overScrollMode);
}
项目:Superuser-UI
文件:EdgeGlowUtil.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private static void setEffectColor(Object edgeEffect,PorterDuff.Mode.SRC_IN);
mEdge.setCallback(null); // free up any references
mGlow.setCallback(null); // free up any references
} catch (Exception ex) {
ex.printstacktrace();
}
} else {
// EdgeEffect
((EdgeEffect) edgeEffect).setColor(color);
}
}
项目:Android-Vertically-Scrollable-Calendar-Prototype
文件:VerticalViewPager.java
void initViewPager() {
setwillNotDraw(false);
setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
setFocusable(true);
final Context context = getContext();
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();
mTopEdge = new EdgeEffect(context);
mBottomEdge = new EdgeEffect(context);
mFlingdistance = (int) (MIN_disTANCE_FOR_FLING * density);
mCloseEnough = (int) (CLOSE_ENOUGH * density);
mDefaultGutterSize = (int) (DEFAULT_GUTTER_SIZE * density);
ViewCompat.setAccessibilityDelegate(this,new MyAccessibilityDelegate());
if (ViewCompat.getImportantForAccessibility(this)
== ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
ViewCompat.setImportantForAccessibility(this,ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);
}
}
项目:mc_backup
文件:OverscrollEdgeEffect.java
private EdgeEffect getEdgeForAxisAndSide(final Axis axis,final float side) {
if (axis == Axis.Y) {
if (side < 0) {
return mEdges[TOP];
} else {
return mEdges[BottOM];
}
} else {
if (side < 0) {
return mEdges[LEFT];
} else {
return mEdges[RIGHT];
}
}
}
项目:mc_backup
文件:OverscrollEdgeEffect.java
@Override
public void setVeLocity(final float veLocity,final Axis axis) {
final EdgeEffect edge = getEdgeForAxisAndSide(axis,veLocity);
// If we're showing overscroll already,start fading it out.
if (!edge.isFinished()) {
edge.onRelease();
} else {
// Otherwise,show an absorb effect
edge.onAbsorb((int)veLocity);
}
invalidate();
}
项目:mc_backup
文件:OverscrollEdgeEffect.java
@Override
public void setdistance(final float distance,final Axis axis) {
// The first overscroll event often has zero distance. Throw it out
if (distance == 0.0f) {
return;
}
final EdgeEffect edge = getEdgeForAxisAndSide(axis,(int)distance);
edge.onPull(distance / (axis == Axis.X ? mView.getWidth() : mView.getHeight()));
invalidate();
}
项目:mc_backup
文件:OverscrollEdgeEffect.java
private static boolean draw(final EdgeEffect edge,final Canvas canvas,final float translateX,final float translateY,final float rotation) {
final int state = canvas.save();
canvas.translate(translateX,translateY);
canvas.rotate(rotation);
boolean invalidate = edge.draw(canvas);
canvas.restoretoCount(state);
return invalidate;
}
项目:Hentoid
文件:Helper.java
@SuppressLint("NewApi")
public static void changeEdgeEffect(Context cxt,View list,int glowColor,int lineColor) {
if (Helper.isAtLeastAPI(Build.VERSION_CODES.LOLLIPOP)) {
EdgeEffect edgeEffectTop = new EdgeEffect(cxt);
edgeEffectTop.setColor(glowColor);
EdgeEffect edgeEffectBottom = new EdgeEffect(cxt);
edgeEffectBottom.setColor(glowColor);
try {
Field f1 = AbsListView.class.getDeclaredField("mEdgeGlowTop");
f1.setAccessible(true);
f1.set(list,edgeEffectTop);
Field f2 = AbsListView.class.getDeclaredField("mEdgeGlowBottom");
f2.setAccessible(true);
f2.set(list,edgeEffectBottom);
} catch (Exception e) {
e.printstacktrace();
}
} else {
// Android < 5.0 - OverScroll Glow
int glowDrawableId = cxt.getResources().getIdentifier("overscroll_glow","drawable","android");
Drawable androidGlow = ContextCompat.getDrawable(cxt,glowDrawableId);
androidGlow.setColorFilter(ContextCompat.getColor(cxt,glowColor),PorterDuff.Mode.SRC_ATOP);
// Android < 5.0 - OverScroll Edge Line
final int edgeDrawableId = cxt.getResources().getIdentifier("overscroll_edge","android");
final Drawable overScrollEdge = ContextCompat.getDrawable(cxt,edgeDrawableId);
overScrollEdge.setColorFilter(ContextCompat.getColor(cxt,lineColor),PorterDuff.Mode.SRC_ATOP);
}
}
项目:staggeredgridview
文件:StaggeredGridView.java
public StaggeredGridView(Context context,int defStyle) {
super(context,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);
}
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);
}
项目:staggeredgridview
文件:StaggeredGridView.java
@Override public void computeScroll() {
if (scroller.computeScrollOffset()) {
final int y = scroller.getCurrY();
final int dy = (int) (y - lastTouchY);
lastTouchY = y;
final boolean stopped = !trackMotionScroll(dy,false);
if (!stopped && !scroller.isFinished()) {
postInvalidateOnAnimation();
} else {
if (stopped) {
final int overScrollMode = getoverScrollMode();
if (overScrollMode != OVER_SCROLL_NEVER) {
final EdgeEffect edge;
if (dy > 0) {
edge = topEdge;
} else {
edge = bottomEdge;
}
edge.onAbsorb(Math.abs((int) scroller.getCurrVeLocity()));
postInvalidateOnAnimation();
}
scroller.abortAnimation();
}
touchMode = TOUCH_MODE_IDLE;
}
}
}
项目:UltimateAndroid
文件:FreeFlowContainer.java
/**
* Controls whether the edge glows are enabled or not
*/
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;
}
}
项目:muzei
文件:PanView.java
public PanView(Context context,int defStyle) {
super(context,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);
}
项目:wear-notify-for-reddit
文件:PanView.java
public PanView(Context 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);
}
项目:chromium_webview
文件:OverScrollGlow.java
public OverScrollGlow(View host) {
mHostView = host;
Context context = host.getContext();
mEdgeGlowTop = new EdgeEffect(context);
mEdgeGlowBottom = new EdgeEffect(context);
mEdgeGlowLeft = new EdgeEffect(context);
mEdgeGlowRight = new EdgeEffect(context);
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。