本文整理匯總了Java中android.support.v4.widget.EdgeEffectCompat類的典型用法代碼示例。如果您正苦於以下問題:Java EdgeEffectCompat類的具體用法?Java EdgeEffectCompat怎麽用?Java EdgeEffectCompat使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
EdgeEffectCompat類屬於android.support.v4.widget包,在下文中一共展示了EdgeEffectCompat類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initViewPager
import android.support.v4.widget.EdgeEffectCompat; //導入依賴的package包/類
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 = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
mMinimumVelocity = (int) (MIN_FLING_VELOCITY * density);
mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
mLeftEdge = new EdgeEffectCompat(context);
mRightEdge = new EdgeEffectCompat(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);
}
}
示例2: prepare
import android.support.v4.widget.EdgeEffectCompat; //導入依賴的package包/類
private void prepare(AttributeSet attrs)
{
setFocusable(true);
setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
setWillNotDraw(false);
mScroller = new Scroller(getContext());
mScaleGestureDetector = new ScaleGestureDetector(getContext(), mScaleListener);
mGestureDetector = new GestureDetectorCompat(getContext(), mGestureListener);
if (attrs != null)
{
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.CustomViewExtension, 0, 0);
autoScrollMargins = a.getDimensionPixelSize(R.styleable.CustomViewExtension_autoScrollMargins, 0);
a.recycle();
}
mEdgeGlowLeft = new EdgeEffectCompat(getContext());
mEdgeGlowTop = new EdgeEffectCompat(getContext());
mEdgeGlowRight = new EdgeEffectCompat(getContext());
mEdgeGlowBottom = new EdgeEffectCompat(getContext());
setWillNotDraw(false);
}
示例3: init
import android.support.v4.widget.EdgeEffectCompat; //導入依賴的package包/類
/** 初始化一些常量 */
private void init() {
//把一個值從dip轉換成px
mIndicatorHeight = UIUtils.dip2px(mIndicatorHeight);
mDividerPadding = UIUtils.dip2px(mDividerPadding);
mTabPadding = UIUtils.dip2px(mTabPadding);
mDividerWidth = UIUtils.dip2px(mDividerWidth);
mTabTextSize = UIUtils.dip2px(mTabTextSize);
//創建一個scroller
mScroller = ScrollerCompat.create(mActivity);
//獲取一個係統關於View的常量配置類
final ViewConfiguration configuration = ViewConfiguration.get(mActivity);
//獲取滑動的最小距離
mTouchSlop = configuration.getScaledTouchSlop();
//獲取fling的最小速度
mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
//獲取fling的最大速度
mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
mLeftEdge = new EdgeEffectCompat(mActivity);
mRightEdge = new EdgeEffectCompat(mActivity);
}
示例4: Viewport
import android.support.v4.widget.EdgeEffectCompat; //導入依賴的package包/類
/**
* creates the viewport
*
* @param graphView graphview
*/
Viewport(ChartView graphView) {
mScroller = new OverScroller(graphView.getContext());
mEdgeEffectTop = new EdgeEffectCompat(graphView.getContext());
mEdgeEffectBottom = new EdgeEffectCompat(graphView.getContext());
mEdgeEffectLeft = new EdgeEffectCompat(graphView.getContext());
mEdgeEffectRight = new EdgeEffectCompat(graphView.getContext());
mGestureDetector = new GestureDetector(graphView.getContext(), mGestureListener);
mScaleGestureDetector = new ScaleGestureDetector(graphView.getContext(), mScaleGestureListener);
mGraphView = graphView;
mXAxisBoundsStatus = AxisBoundsStatus.INITIAL;
mYAxisBoundsStatus = AxisBoundsStatus.INITIAL;
mBackgroundColor = Color.TRANSPARENT;
mPaint = new Paint();
}
示例5: initViewPager
import android.support.v4.widget.EdgeEffectCompat; //導入依賴的package包/類
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 = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
mMinimumVelocity = (int) (MIN_FLING_VELOCITY * density);
mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
mTopEdge = new EdgeEffectCompat(context);
mBottomEdge = new EdgeEffectCompat(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);
}
}
示例6: initViewPager
import android.support.v4.widget.EdgeEffectCompat; //導入依賴的package包/類
void initViewPager() {
setWillNotDraw(false);
setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
setFocusable(true);
final Context context = getContext();
mScroller = new Scroller(context, sInterpolator);
final float density = context.getResources().getDisplayMetrics().density;
mLeftEdge = new EdgeEffectCompat(context);
mRightEdge = new EdgeEffectCompat(context);
ViewCompat.setAccessibilityDelegate(this, new MyAccessibilityDelegate());
if (ViewCompat.getImportantForAccessibility(this)
== ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
ViewCompat.setImportantForAccessibility(this,
ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);
}
}
示例7: updateGlowSize
import android.support.v4.widget.EdgeEffectCompat; //導入依賴的package包/類
private static void updateGlowSize(RecyclerView rv, EdgeEffectCompat glow, int dir) {
int width = rv.getMeasuredWidth();
int height = rv.getMeasuredHeight();
if (getClipToPadding(rv)) {
width -= rv.getPaddingLeft() + rv.getPaddingRight();
height -= rv.getPaddingTop() + rv.getPaddingBottom();
}
width = Math.max(0, width);
height = Math.max(0, height);
if (dir == EDGE_LEFT || dir == EDGE_RIGHT) {
int t = width;
width = height;
height = t;
}
glow.setSize(width, height);
}
開發者ID:fabricethilaw,項目名稱:expandable-recyclerview-with-gridlayout,代碼行數:21,代碼來源:BaseEdgeEffectDecorator.java
示例8: initViewPager
import android.support.v4.widget.EdgeEffectCompat; //導入依賴的package包/類
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);
mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
mLeftEdge = new EdgeEffectCompat(context);
mRightEdge = new EdgeEffectCompat(context);
final float density = context.getResources().getDisplayMetrics().density;
mFlingDistance = (int) (MIN_DISTANCE_FOR_FLING * density);
}
示例9: resetTouch
import android.support.v4.widget.EdgeEffectCompat; //導入依賴的package包/類
private void resetTouch()
{
if (this.mVelocityTracker != null) {
this.mVelocityTracker.clear();
}
stopNestedScroll();
EdgeEffectCompat localEdgeEffectCompat = this.mLeftGlow;
boolean bool = false;
if (localEdgeEffectCompat != null) {
bool = this.mLeftGlow.onRelease();
}
if (this.mTopGlow != null) {
bool |= this.mTopGlow.onRelease();
}
if (this.mRightGlow != null) {
bool |= this.mRightGlow.onRelease();
}
if (this.mBottomGlow != null) {
bool |= this.mBottomGlow.onRelease();
}
if (bool) {
ViewCompat.postInvalidateOnAnimation(this);
}
}
示例10: initViewPager
import android.support.v4.widget.EdgeEffectCompat; //導入依賴的package包/類
private void initViewPager()
{
setWillNotDraw(false);
setDescendantFocusability(262144);
setFocusable(true);
Context localContext = getContext();
this.mScroller = new Scroller(localContext, sInterpolator);
ViewConfiguration localViewConfiguration = ViewConfiguration.get(localContext);
float f = localContext.getResources().getDisplayMetrics().density;
this.mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(localViewConfiguration);
this.mMinimumVelocity = ((int)(400.0F * f));
this.mMaximumVelocity = localViewConfiguration.getScaledMaximumFlingVelocity();
this.mLeftEdge = new EdgeEffectCompat(localContext);
this.mRightEdge = new EdgeEffectCompat(localContext);
this.mFlingDistance = ((int)(25.0F * f));
this.mCloseEnough = ((int)(2.0F * f));
this.mDefaultGutterSize = ((int)(16.0F * f));
ViewCompat.setAccessibilityDelegate(this, new MyAccessibilityDelegate());
if (ViewCompat.getImportantForAccessibility(this) == 0) {
ViewCompat.setImportantForAccessibility(this, 1);
}
}
示例11: HorizontalListView
import android.support.v4.widget.EdgeEffectCompat; //導入依賴的package包/類
public HorizontalListView(Context context, AttributeSet attrs) {
super(context, attrs);
mEdgeGlowLeft = new EdgeEffectCompat(context);
mEdgeGlowRight = new EdgeEffectCompat(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);
}
}
示例12: Viewport
import android.support.v4.widget.EdgeEffectCompat; //導入依賴的package包/類
/**
* creates the viewport
*
* @param graphView graphview
*/
Viewport(GraphView graphView) {
mScroller = new OverScroller(graphView.getContext());
mEdgeEffectTop = new EdgeEffectCompat(graphView.getContext());
mEdgeEffectBottom = new EdgeEffectCompat(graphView.getContext());
mEdgeEffectLeft = new EdgeEffectCompat(graphView.getContext());
mEdgeEffectRight = new EdgeEffectCompat(graphView.getContext());
mGestureDetector = new GestureDetector(graphView.getContext(), mGestureListener);
mScaleGestureDetector = new ScaleGestureDetector(graphView.getContext(), mScaleGestureListener);
mGraphView = graphView;
mXAxisBoundsStatus = AxisBoundsStatus.INITIAL;
mYAxisBoundsStatus = AxisBoundsStatus.INITIAL;
mBackgroundColor = Color.TRANSPARENT;
mPaint = new Paint();
}
示例13: init
import android.support.v4.widget.EdgeEffectCompat; //導入依賴的package包/類
/**
* Perform one-time initialization
*
* @param context Context to load Resources and ViewConfiguration data
*/
private void init(Context context) {
final Resources res = context.getResources();
mIconSize = res.getDimensionPixelSize(R.dimen.icon_size);
mIconSpacing = res.getDimensionPixelSize(R.dimen.icon_spacing);
// Cache ViewConfiguration values
final ViewConfiguration config = ViewConfiguration.get(context);
mTouchSlop = config.getScaledTouchSlop();
mMinimumVelocity = config.getScaledMinimumFlingVelocity();
mMaximumVelocity = config.getScaledMaximumFlingVelocity();
mOverflingDistance = config.getScaledOverflingDistance();
mOverscrollDistance = config.getScaledOverscrollDistance();
// Verify this View will be drawn
setWillNotDraw(false);
// Other setup
mEdgeEffectLeft = new EdgeEffectCompat(context);
mEdgeEffectRight = new EdgeEffectCompat(context);
mScroller = new OverScroller(context);
setFocusable(true);
}
示例14: setupImageShow
import android.support.v4.widget.EdgeEffectCompat; //導入依賴的package包/類
private void setupImageShow(Context context) {
Resources res = context.getResources();
mTextSize = res.getDimensionPixelSize(R.dimen.photoeditor_text_size);
mTextPadding = res.getDimensionPixelSize(R.dimen.photoeditor_text_padding);
mOriginalTextMargin = res.getDimensionPixelSize(R.dimen.photoeditor_original_text_margin);
mOriginalTextSize = res.getDimensionPixelSize(R.dimen.photoeditor_original_text_size);
mBackgroundColor = res.getColor(R.color.background_screen);
mOriginalText = res.getString(R.string.original_picture_text);
mShadow = (NinePatchDrawable) res.getDrawable(R.drawable.geometry_shadow);
setupGestureDetector(context);
mActivity = (FilterShowActivity) context;
if (sMask == null) {
Bitmap mask = BitmapFactory.decodeResource(res, R.drawable.spot_mask);
sMask = convertToAlphaMask(mask);
}
mEdgeEffect = new EdgeEffectCompat(context);
mEdgeSize = res.getDimensionPixelSize(R.dimen.edge_glow_size);
}
示例15: initViewPager
import android.support.v4.widget.EdgeEffectCompat; //導入依賴的package包/類
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 = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
mMinimumVelocity = (int) (MIN_FLING_VELOCITY * density);
mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
mTopEdge = new EdgeEffectCompat(context);
mBottomEdge = new EdgeEffectCompat(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);
}
}