Example usage for android.view ViewConfiguration get

List of usage examples for android.view ViewConfiguration get

Introduction

In this page you can find the example usage for android.view ViewConfiguration get.

Prototype

public static ViewConfiguration get(Context context) 

Source Link

Document

Returns a configuration for the specified context.

Usage

From source file:ch.tutti.android.bottomsheet.ResolverDrawerLayout.java

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

    final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ResolverDrawerLayout, defStyleAttr,
            0);/*w  w w.  ja  v  a  2 s .c o  m*/
    mMaxWidth = a.getDimensionPixelSize(R.styleable.ResolverDrawerLayout_android_maxWidth, -1);
    mMaxCollapsedHeight = a.getDimensionPixelSize(R.styleable.ResolverDrawerLayout_maxCollapsedHeight, 0);
    mMaxCollapsedHeightSmall = a.getDimensionPixelSize(R.styleable.ResolverDrawerLayout_maxCollapsedHeightSmall,
            mMaxCollapsedHeight);
    a.recycle();

    mScroller = new OverScroller(context,
            AnimationUtils.loadInterpolator(context, android.R.interpolator.decelerate_quint));
    mVelocityTracker = VelocityTracker.obtain();

    final ViewConfiguration vc = ViewConfiguration.get(context);
    mTouchSlop = vc.getScaledTouchSlop();
    mMinFlingVelocity = vc.getScaledMinimumFlingVelocity();
}

From source file:com.borax12.materialdaterangepicker.single.time.RadialPickerLayout.java

public RadialPickerLayout(Context context, AttributeSet attrs) {
    super(context, attrs);

    setOnTouchListener(this);
    ViewConfiguration vc = ViewConfiguration.get(context);
    TOUCH_SLOP = vc.getScaledTouchSlop();
    TAP_TIMEOUT = ViewConfiguration.getTapTimeout();
    mDoingMove = false;//from w ww. jav a  2s.  c o m

    mCircleView = new CircleView(context);
    addView(mCircleView);

    mAmPmCirclesView = new AmPmCirclesView(context);
    addView(mAmPmCirclesView);

    mHourRadialSelectorView = new RadialSelectorView(context);
    addView(mHourRadialSelectorView);
    mMinuteRadialSelectorView = new RadialSelectorView(context);
    addView(mMinuteRadialSelectorView);
    mSecondRadialSelectorView = new RadialSelectorView(context);
    addView(mSecondRadialSelectorView);

    mHourRadialTextsView = new RadialTextsView(context);
    addView(mHourRadialTextsView);
    mMinuteRadialTextsView = new RadialTextsView(context);
    addView(mMinuteRadialTextsView);
    mSecondRadialTextsView = new RadialTextsView(context);
    addView(mSecondRadialTextsView);

    // Prepare mapping to snap touchable degrees to selectable degrees.
    preparePrefer30sMap();

    mLastValueSelected = null;

    mInputEnabled = true;

    mGrayBox = new View(context);
    mGrayBox.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));
    mGrayBox.setBackgroundColor(ContextCompat.getColor(context, R.color.mdtp_transparent_black));
    mGrayBox.setVisibility(View.INVISIBLE);
    addView(mGrayBox);

    mAccessibilityManager = (AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE);

    mTimeInitialized = false;
}

From source file:com.example.zhangyipeng.swipelibrary.SwipeListViewTouchListener2.java

/**
 * Constructor//  ww w.j a va2  s  .c  om
 *
 * @param swipeListView  SwipeListView
 * @param swipeFrontView front view Identifier
 * @param swipeBackView  back view Identifier
 */
public SwipeListViewTouchListener2(SwipeListView2 swipeListView, int swipeFrontView, int swipeBackView) {
    this.swipeFrontView = swipeFrontView;
    this.swipeBackView = swipeBackView;
    ViewConfiguration vc = ViewConfiguration.get(swipeListView.getContext());
    slop = vc.getScaledTouchSlop();
    minFlingVelocity = vc.getScaledMinimumFlingVelocity();
    maxFlingVelocity = vc.getScaledMaximumFlingVelocity();
    configShortAnimationTime = swipeListView.getContext().getResources()
            .getInteger(android.R.integer.config_shortAnimTime);
    animationTime = configShortAnimationTime;
    this.swipeListView = swipeListView;
}

From source file:com.goka.flickableview.ImageViewTouchBase.java

protected void init(Context context, AttributeSet attrs, int defStyle) {
    ViewConfiguration configuration = ViewConfiguration.get(context);
    mMinFlingVelocity = configuration.getScaledMinimumFlingVelocity();
    mMaxFlingVelocity = configuration.getScaledMaximumFlingVelocity();
    mDefaultAnimationDuration = getResources().getInteger(android.R.integer.config_shortAnimTime);
    setScaleType(ScaleType.MATRIX);// w w w. j  a  v  a2s.  c om
}

From source file:com.gitstudy.rili.liarbry.CalendarLayout.java

public CalendarLayout(Context context, AttributeSet attrs) {
    super(context, attrs);
    setOrientation(LinearLayout.VERTICAL);
    TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.CalendarLayout);
    mContentViewId = array.getResourceId(R.styleable.CalendarLayout_calendar_content_view_id, 0);
    mDefaultStatus = array.getInt(R.styleable.CalendarLayout_default_status, STATUS_EXPAND);
    mCalendarShowMode = array.getInt(R.styleable.CalendarLayout_calendar_show_mode,
            CALENDAR_SHOW_MODE_BOTH_MONTH_WEEK_VIEW);
    mGestureMode = array.getInt(R.styleable.CalendarLayout_gesture_mode, GESTURE_MODE_DEFAULT);
    array.recycle();/*from ww  w. j  av  a  2 s  .co m*/
    mVelocityTracker = VelocityTracker.obtain();
    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = configuration.getScaledTouchSlop();
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
}

From source file:com.android.datetimepicker.time.RadialPickerLayout.java

public RadialPickerLayout(Context context, AttributeSet attrs) {
    super(context, attrs);

    setOnTouchListener(this);
    ViewConfiguration vc = ViewConfiguration.get(context);
    TOUCH_SLOP = vc.getScaledTouchSlop();
    TAP_TIMEOUT = ViewConfiguration.getTapTimeout();
    mDoingMove = false;//from  w ww. j  av a  2 s  .  c  om

    mCircleView = new CircleView(context);
    addView(mCircleView);

    mAmPmCirclesView = new AmPmCirclesView(context);
    addView(mAmPmCirclesView);

    mHourRadialTextsView = new RadialTextsView(context);
    addView(mHourRadialTextsView);
    mMinuteRadialTextsView = new RadialTextsView(context);
    addView(mMinuteRadialTextsView);

    mHourRadialSelectorView = new RadialSelectorView(context);
    addView(mHourRadialSelectorView);
    mMinuteRadialSelectorView = new RadialSelectorView(context);
    addView(mMinuteRadialSelectorView);

    // Prepare mapping to snap touchable degrees to selectable degrees.
    preparePrefer30sMap();

    mLastValueSelected = -1;

    mInputEnabled = true;
    mGrayBox = new View(context);
    mGrayBox.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));
    mGrayBox.setBackgroundColor(getResources().getColor(R.color.transparent_black));
    mGrayBox.setVisibility(View.INVISIBLE);
    addView(mGrayBox);

    mAccessibilityManager = (AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE);

    mTimeInitialized = false;

    installAccessibilityDelegate();
}

From source file:com.bairutai.openwidget.CirclePageIndicator.java

@SuppressWarnings("deprecation")
public CirclePageIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (isInEditMode())
        return;//from www  . j a  v a2s . c  o  m

    //Load defaults from resources
    final Resources res = getResources();
    final int defaultPageColor = res.getColor(R.color.white);
    final int defaultFillColor = res.getColor(R.color.orange);
    final int defaultStrokeColor = res.getColor(R.color.baihui);
    final int defaultOrientation = 0;
    final float defaultStrokeWidth = 1;
    final float defaultRadius = 10;
    final boolean defaultCentered = true;
    final boolean defaultSnap = false;

    //Retrieve styles attributes
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CirclePageIndicator, defStyle, 0);

    mCentered = a.getBoolean(R.styleable.CirclePageIndicator_centered, defaultCentered);
    mOrientation = a.getInt(R.styleable.CirclePageIndicator_android_orientation, defaultOrientation);
    mPaintPageFill.setStyle(Style.FILL);
    mPaintPageFill.setColor(a.getColor(R.styleable.CirclePageIndicator_pageColor, defaultPageColor));
    mPaintStroke.setStyle(Style.STROKE);
    mPaintStroke.setColor(a.getColor(R.styleable.CirclePageIndicator_strokeColor, defaultStrokeColor));
    mPaintStroke
            .setStrokeWidth(a.getDimension(R.styleable.CirclePageIndicator_strokeWidth, defaultStrokeWidth));
    mPaintFill.setStyle(Style.FILL);
    mPaintFill.setColor(a.getColor(R.styleable.CirclePageIndicator_fillColor, defaultFillColor));
    mRadius = a.getDimension(R.styleable.CirclePageIndicator_radius, defaultRadius);
    mSnap = a.getBoolean(R.styleable.CirclePageIndicator_snap, defaultSnap);

    Drawable background = a.getDrawable(R.styleable.CirclePageIndicator_android_background);
    if (background != null) {
        setBackgroundDrawable(background);
    }

    a.recycle();

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
}

From source file:com.adkdevelopment.e_contact.utils.UnderlinePageIndicator.java

@TargetApi(Build.VERSION_CODES.M)
public UnderlinePageIndicator(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (isInEditMode())
        return;// w ww  . ja v a  2s .  co  m

    final Resources res = getResources();

    //Load defaults from resources
    final boolean defaultFades = res.getBoolean(R.bool.default_underline_indicator_fades);
    final int defaultFadeDelay = res.getInteger(R.integer.default_underline_indicator_fade_delay);
    final int defaultFadeLength = res.getInteger(R.integer.default_underline_indicator_fade_length);

    int defaultSelectedColor;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        defaultSelectedColor = res.getColor(R.color.white, context.getTheme());
    } else {
        //noinspection deprecation
        defaultSelectedColor = res.getColor(R.color.white);
    }

    //Retrieve styles attributes
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.UnderlinePageIndicator, defStyle, 0);

    setFades(a.getBoolean(R.styleable.UnderlinePageIndicator_fades, defaultFades));
    setSelectedColor(a.getColor(R.styleable.UnderlinePageIndicator_selectedColor, defaultSelectedColor));
    setFadeDelay(a.getInteger(R.styleable.UnderlinePageIndicator_fadeDelay, defaultFadeDelay));
    setFadeLength(a.getInteger(R.styleable.UnderlinePageIndicator_fadeLength, defaultFadeLength));

    mCornerRadius = a.getDimension(R.styleable.UnderlinePageIndicator_vpi_corner_radius, 0);

    Drawable background = a.getDrawable(R.styleable.UnderlinePageIndicator_android_background);
    if (background != null) {
        setBackground(background);
    }

    a.recycle();

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
}

From source file:com.example.zhangyipeng.swipelibrary.SwipeRecycleViewTouchListener.java

/**
 * Constructor/*from ww w  .ja  v  a2  s . c o m*/
 *
 * @param swipeRecycleView  SwipeListView
 * @param swipeFrontView front view Identifier
 * @param swipeBackView  back view Identifier
 */
public SwipeRecycleViewTouchListener(SwipeRecycleView swipeRecycleView, int swipeFrontView, int swipeBackView) {
    this.swipeFrontView = swipeFrontView;
    this.swipeBackView = swipeBackView;
    ViewConfiguration vc = ViewConfiguration.get(swipeRecycleView.getContext());
    slop = vc.getScaledTouchSlop();
    minFlingVelocity = vc.getScaledMinimumFlingVelocity();
    maxFlingVelocity = vc.getScaledMaximumFlingVelocity();
    configShortAnimationTime = swipeRecycleView.getContext().getResources()
            .getInteger(android.R.integer.config_shortAnimTime);
    animationTime = configShortAnimationTime;
    this.swipeRecycleView = swipeRecycleView;
}

From source file:com.fortysevendeg.swipelistview.SwipeRecyclerTouchListener.java

/**
 * Constructor//from  w  w w. jav  a 2 s  . c  om
 *
 * @param swipeRecyclerView  SwipeListView
 * @param swipeFrontView front view Identifier
 * @param swipeBackView  back view Identifier
 */
public SwipeRecyclerTouchListener(SwipeRecyclerView swipeRecyclerView, int swipeFrontView, int swipeBackView) {
    this.swipeFrontView = swipeFrontView;
    this.swipeBackView = swipeBackView;
    ViewConfiguration vc = ViewConfiguration.get(swipeRecyclerView.getContext());
    slop = vc.getScaledTouchSlop();
    minFlingVelocity = vc.getScaledMinimumFlingVelocity();
    maxFlingVelocity = vc.getScaledMaximumFlingVelocity();
    configShortAnimationTime = swipeRecyclerView.getContext().getResources()
            .getInteger(android.R.integer.config_shortAnimTime);
    animationTime = configShortAnimationTime;
    this.swipeRecyclerView = swipeRecyclerView;
}