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:com.dycody.android.idealnote.BaseActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    prefs = getSharedPreferences(Constants.PREFS_NAME, MODE_MULTI_PROCESS);
    // Force menu overflow icon
    try {/*from w  w w  .  j  a  v a2  s. c  om*/
        ViewConfiguration config = ViewConfiguration.get(this.getApplicationContext());
        Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey");
        if (menuKeyField != null) {
            menuKeyField.setAccessible(true);
            menuKeyField.setBoolean(config, false);
        }
    } catch (Exception e) {
        Log.d(Constants.TAG, "Just a little issue in physical menu button management", e);
    }
    super.onCreate(savedInstanceState);
}

From source file:com.apptentive.android.sdk.util.image.PreviewImageView.java

public PreviewImageView(Context context, AttributeSet attrs) {
    super(context, attrs);
    super.setScaleType(ScaleType.MATRIX);
    scaleGestureDetector = new ScaleGestureDetector(context, this);
    gestureDetector = new GestureDetectorCompat(context, new PreviewGestureListener());
    touchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
    super.setScaleType(ScaleType.MATRIX);
    this.setOnTouchListener(this);
}

From source file:com.appeaser.sublimepickerlibrary.datepicker.DayPickerViewPager.java

public DayPickerViewPager(Context context, AttributeSet attrs) {
    super(context, attrs);
    TOUCH_SLOP_SQUARED = ViewConfiguration.get(context).getScaledTouchSlop()
            * ViewConfiguration.get(context).getScaledTouchSlop();
    MONTH_SCROLL_THRESHOLD = context.getResources().getDimensionPixelSize(R.dimen.sp_month_scroll_threshold);
}

From source file:com.evilduck.animtest.DraggedPanelLayout.java

public DraggedPanelLayout(Context context) {
    super(context);

    bottomPanelPeekHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 100,
            getResources().getDisplayMetrics());
    parallaxFactor = PARALLAX_FACTOR;// ww  w.  j a v  a  2s  .  com

    if (!isInEditMode()) {
        shadowDrawable = getResources().getDrawable(R.drawable.shadow_np);
        willDrawShadow = true;
    }

    touchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();
}

From source file:com.android2.calculator3.view.CalculatorPadView.java

private void setup() {
    ViewConfiguration vc = ViewConfiguration.get(getContext());
    mMinimumFlingVelocity = vc.getScaledMinimumFlingVelocity();
    mMaximumFlingVelocity = vc.getScaledMaximumFlingVelocity();
    mTouchSlop = vc.getScaledTouchSlop();
    mOffset = getResources().getDimensionPixelSize(R.dimen.pad_page_margin);
    mOverlayMargin = getResources().getDimensionPixelSize(R.dimen.shadow_margin);
    getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
        @Override//ww  w . j a v  a2 s.c  o m
        public void onGlobalLayout() {
            if (android.os.Build.VERSION.SDK_INT >= 16) {
                getViewTreeObserver().removeOnGlobalLayoutListener(this);
            } else {
                getViewTreeObserver().removeGlobalOnLayoutListener(this);
            }
            initializeLayout(getState());
        }
    });
}

From source file:com.dragon.lib.IndicatorView.java

public IndicatorView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    if (isInEditMode()) {
        return;/*  w ww .  j a v  a2  s .co  m*/
    }

    autoStart();
    init(attrs, defStyle);
    final ViewConfiguration viewConfiguration = ViewConfiguration.get(getContext());
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(viewConfiguration);
}

From source file:com.amitupadhyay.aboutexample.ui.widget.BottomSheet.java

public BottomSheet(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    final ViewConfiguration viewConfiguration = ViewConfiguration.get(context);
    MIN_FLING_VELOCITY = viewConfiguration.getScaledMinimumFlingVelocity();
}

From source file:com.android.yijiang.kzx.widget.betterpickers.widget.UnderlinePageIndicatorPicker.java

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

    mColorUnderline = getResources().getColor(R.color.dialog_text_color_holo_dark);

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.BetterPickersDialogFragment, defStyle, 0);
    mColorUnderline = a.getColor(R.styleable.BetterPickersDialogFragment_bpKeyboardIndicatorColor,
            mColorUnderline);// www . j  a  v a2  s  . c om

    rectPaint = new Paint();
    rectPaint.setAntiAlias(true);
    rectPaint.setStyle(Style.FILL);

    a.recycle();

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

From source file:com.douban.rexxar.view.NestedWebView.java

public NestedWebView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    mChildHelper = new NestedScrollingChildHelper(this);
    setNestedScrollingEnabled(true);//from w  w w. ja  va 2s  .c o  m
    final ViewConfiguration configuration = ViewConfiguration.get(getContext());
    mTouchSlop = configuration.getScaledTouchSlop();

    WebSettings webSettings = getSettings();
    webSettings.setJavaScriptEnabled(true);
    // 
    addJavascriptInterface(new NestScrollHelper(), "Android_NestScrollHelper");
    // ?
    setOverScrollMode(OVER_SCROLL_NEVER);
    mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
    mScroller = new OverScroller(getContext());
}

From source file:com.arthurpitman.common.SlidingPanel.java

/**
 * Performs shared initialization of the {@code SlidingPanel}.
 *//*  ww  w. j  a v  a  2s  .com*/
private final void initializeView() {
    scroller = new Scroller(getContext());
    final ViewConfiguration configuration = ViewConfiguration.get(getContext());
    touchSlop = configuration.getScaledTouchSlop();
    minimumflingVelocity = configuration.getScaledMinimumFlingVelocity() * 4;
}