當前位置: 首頁>>代碼示例>>Java>>正文


Java EdgeEffectCompat類代碼示例

本文整理匯總了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);
	}
}
 
開發者ID:fengshihao,項目名稱:WebPager,代碼行數:27,代碼來源:CustomViewPager.java

示例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);
}
 
開發者ID:mkulesh,項目名稱:microMathematics,代碼行數:21,代碼來源:TwoDScrollView.java

示例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);
}
 
開發者ID:cuilitang,項目名稱:CuiMarket,代碼行數:23,代碼來源:PagerTab.java

示例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();
}
 
開發者ID:weexteam,項目名稱:weex-analyzer-android,代碼行數:21,代碼來源:Viewport.java

示例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);
  }
}
 
開發者ID:smuyyh,項目名稱:SprintNBA,代碼行數:27,代碼來源:VerticalViewPager.java

示例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);
    }
}
 
開發者ID:jecelyin,項目名稱:920-text-editor-v2,代碼行數:20,代碼來源:TabViewPager.java

示例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);
}
 
開發者ID:lujianzhao,項目名稱:AndroidBase,代碼行數:17,代碼來源:LazyViewPager.java

示例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);
  }
}
 
開發者ID:ChiangC,項目名稱:FMTech,代碼行數:25,代碼來源:RecyclerView.java

示例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);
  }
}
 
開發者ID:ChiangC,項目名稱:FMTech,代碼行數:23,代碼來源:ViewPager.java

示例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);
	}
}
 
開發者ID:ShawnDongAi,項目名稱:MultiTreeListView,代碼行數:17,代碼來源:HorizontalListView.java

示例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();
}
 
開發者ID:Popati,項目名稱:Android-BluetoothSPPLibrary-master,代碼行數:21,代碼來源:Viewport.java

示例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);
}
 
開發者ID:IanGClifton,項目名稱:auid2,代碼行數:28,代碼來源:HorizontalIconView.java

示例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);
}
 
開發者ID:asm-products,項目名稱:nexus-gallery,代碼行數:19,代碼來源:ImageShow.java

示例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);
    }
}
 
開發者ID:gzsll,項目名稱:TLint,代碼行數:27,代碼來源:VerticalViewPager.java


注:本文中的android.support.v4.widget.EdgeEffectCompat類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。