List of usage examples for android.view ViewConfiguration get
public static ViewConfiguration get(Context context)
From source file:android.support.design.widget.SheetBehavior.java
/** * Default constructor for inflating BottomSheetBehaviors from layout. * * @param context The {@link Context}./*ww w. ja v a2s . c om*/ * @param attrs The {@link AttributeSet}. */ public SheetBehavior(Context context, AttributeSet attrs) { super(context, attrs); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.SheetBehavior); setPeekHeight(a.getDimensionPixelSize(R.styleable.SheetBehavior_peekHeight, 0)); setHideable(a.getBoolean(R.styleable.SheetBehavior_hiddenEnable, false)); mSlideModel = a.getInt(R.styleable.SheetBehavior_slideMode, BOTTOM_SHEET); a.recycle(); ViewConfiguration configuration = ViewConfiguration.get(context); mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); }
From source file:com.devexweb.googlemapsapi.lib.BottomSheetBehaviorGoogleMapsLike.java
/** * Default constructor for inflating BottomSheetBehaviors from layout. * * @param context The {@link Context}./*from w ww.j a v a 2 s .c o m*/ * @param attrs The {@link AttributeSet}. */ public BottomSheetBehaviorGoogleMapsLike(Context context, AttributeSet attrs) { super(context, attrs); TypedArray a = context.obtainStyledAttributes(attrs, android.support.design.R.styleable.BottomSheetBehavior_Layout); setPeekHeight(a.getDimensionPixelSize( android.support.design.R.styleable.BottomSheetBehavior_Layout_behavior_peekHeight, 0)); setHideable(a.getBoolean(android.support.design.R.styleable.BottomSheetBehavior_Layout_behavior_hideable, false)); a.recycle(); /** * Getting the anchorPoint... */ mAnchorPoint = DEFAULT_ANCHOR_POINT; a = context.obtainStyledAttributes(attrs, R.styleable.CustomBottomSheetBehavior); if (attrs != null) mAnchorPoint = (int) a.getDimension(R.styleable.CustomBottomSheetBehavior_anchorPoint, 0); a.recycle(); ViewConfiguration configuration = ViewConfiguration.get(context); mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); }
From source file:com.example.pierrechanson.prototypebottomsheet.BottomSheetBehaviorGoogleMapsLike.java
/** * Default constructor for inflating BottomSheetBehaviors from layout. * * @param context The {@link Context}.//from ww w.j a va 2 s . c o m * @param attrs The {@link AttributeSet}. */ public BottomSheetBehaviorGoogleMapsLike(Context context, AttributeSet attrs) { super(context, attrs); TypedArray a = context.obtainStyledAttributes(attrs, android.support.design.R.styleable.BottomSheetBehavior_Params); setPeekHeight(a.getDimensionPixelSize( android.support.design.R.styleable.BottomSheetBehavior_Params_behavior_peekHeight, 0)); setHideable(a.getBoolean(android.support.design.R.styleable.BottomSheetBehavior_Params_behavior_hideable, false)); a.recycle(); /** * Getting the anchorPoint... */ mAnchorPoint = DEFAULT_ANCHOR_POINT; a = context.obtainStyledAttributes(attrs, R.styleable.CustomBottomSheetBehavior); if (attrs != null) mAnchorPoint = (int) a.getDimension(R.styleable.CustomBottomSheetBehavior_anchorPoint, 0); a.recycle(); ViewConfiguration configuration = ViewConfiguration.get(context); mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); }
From source file:com.geely.testbottomsheets.CustomBottomSheetBehavior.java
/** * Default constructor for inflating BottomSheetBehaviors from layout. * * @param context The {@link Context}./*w ww.j a v a 2s. c o m*/ * @param attrs The {@link AttributeSet}. */ public CustomBottomSheetBehavior(Context context, AttributeSet attrs) { super(context, attrs); TypedArray a = context.obtainStyledAttributes(attrs, android.support.design.R.styleable.BottomSheetBehavior_Params); setPeekHeight(a.getDimensionPixelSize( android.support.design.R.styleable.BottomSheetBehavior_Params_behavior_peekHeight, 0)); setHideable(a.getBoolean(android.support.design.R.styleable.BottomSheetBehavior_Params_behavior_hideable, false)); a.recycle(); /** * Getting the anchorPoint... */ mAnchorPoint = DEFAULT_ANCHOR_POINT; a = context.obtainStyledAttributes(attrs, R.styleable.CustomBottomSheetBehavior); if (attrs != null) mAnchorPoint = (int) a.getDimension(R.styleable.CustomBottomSheetBehavior_anchorPoint, 0); a.recycle(); ViewConfiguration configuration = ViewConfiguration.get(context); mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); }
From source file:com.hakerjack.experiments.CustomSwipeRefreshLayout.java
/** * Constructor that is called when inflating DoublePlaySwipeRefreshLayout from XML. * * @param context//from w ww .ja va 2 s. c om * @param attrs */ public CustomSwipeRefreshLayout(Context context, AttributeSet attrs) { super(context, attrs); mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop(); mMediumAnimationDuration = getResources().getInteger(android.R.integer.config_mediumAnimTime); setWillNotDraw(false); mDecelerateInterpolator = new DecelerateInterpolator(DECELERATE_INTERPOLATION_FACTOR); final TypedArray a = context.obtainStyledAttributes(attrs, LAYOUT_ATTRS); setEnabled(a.getBoolean(0, true)); a.recycle(); final DisplayMetrics metrics = getResources().getDisplayMetrics(); mSpinnerWidth = (int) (SPINNER_DIAMETER * metrics.density); mSpinnerHeight = (int) (SPINNER_DIAMETER * metrics.density); createProgressView(); ViewCompat.setChildrenDrawingOrderEnabled(this, true); // the absolute offset has to take into account that the circle starts at an offset mSpinnerFinalOffset = DEFAULT_SPINNER_TARGET * metrics.density; mTotalDragDistance = mSpinnerFinalOffset; mHideSpinnerDistance = HIDE_SPINNER_DISTANCE * metrics.density; }
From source file:com.aiga.events.android.views.NoScrollSwipeRefreshLayout.java
/** * Constructor that is called when inflating SwipeRefreshLayout from XML. * /*from w ww . j a v a 2s.com*/ * @param context * @param attrs */ public NoScrollSwipeRefreshLayout(Context context, AttributeSet attrs) { super(context, attrs); mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop(); mMediumAnimationDuration = getResources().getInteger(android.R.integer.config_mediumAnimTime); setWillNotDraw(false); mProgressBar = new SwipeProgressBar(this); final DisplayMetrics metrics = getResources().getDisplayMetrics(); mProgressBarHeight = (int) (metrics.density * PROGRESS_BAR_HEIGHT); mDecelerateInterpolator = new DecelerateInterpolator(DECELERATE_INTERPOLATION_FACTOR); mAccelerateInterpolator = new AccelerateInterpolator(ACCELERATE_INTERPOLATION_FACTOR); final TypedArray a = context.obtainStyledAttributes(attrs, LAYOUT_ATTRS); setEnabled(a.getBoolean(0, true)); a.recycle(); }
From source file:com.aviary.android.feather.sdk.widget.AviaryWorkspace.java
private void initWorkspace(Context context, AttributeSet attrs, int defStyle) { Theme theme = context.getTheme();//from w w w . j a va 2 s . c o m TypedArray a = theme.obtainStyledAttributes(attrs, R.styleable.AviaryWorkspace, defStyle, 0); mDefaultScreen = a.getInt(R.styleable.AviaryWorkspace_aviary_defaultScreen, 0); int overscrollMode = a.getInt(R.styleable.AviaryWorkspace_aviary_overscroll, 0); a.recycle(); setHapticFeedbackEnabled(false); mScrollInterpolator = new DecelerateInterpolator(1.0f); mScroller = new Scroller(context, mScrollInterpolator); mPreviousScreen = INVALID_SCREEN; final ViewConfiguration configuration = ViewConfiguration.get(getContext()); mTouchSlop = configuration.getScaledTouchSlop(); mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); mPaddingTop = getPaddingTop(); mPaddingBottom = getPaddingBottom(); mPaddingLeft = getPaddingLeft(); mPaddingRight = getPaddingRight(); setOverScroll(overscrollMode); }
From source file:com.android.music.MusicBrowserActivity.java
public void onCreateContinue(Bundle savedInstanceState) { MusicLogUtils.d(TAG, "onCreate"); ActionBar actionBar = getActionBar(); actionBar.hide();//from ww w .j a v a2 s .c om setVolumeControlStream(AudioManager.STREAM_MUSIC); PDebug.Start("MusicBrowserActivity.bindToService()"); mToken = MusicUtils.bindToService(this, this); PDebug.End("MusicBrowserActivity.bindToService()"); mMusicPlugin = Extensions.getPluginObject(getApplicationContext()); mHasMenukey = ViewConfiguration.get(this).hasPermanentMenuKey(); PDebug.Start("MusicBrowserActivity.dispatchCreate()"); mActivityManager = new LocalActivityManager(this, false); mActivityManager.dispatchCreate(savedInstanceState); PDebug.End("MusicBrowserActivity.dispatchCreate()"); mTabHost = getTabHost(); PDebug.Start("MusicBrowserActivity.initTab()"); initTab(); PDebug.End("MusicBrowserActivity.initTab()"); PDebug.Start("MusicBrowserActivity.setCurrentTab()"); mCurrentTab = MusicUtils.getIntPref(this, SAVE_TAB, ARTIST_INDEX); MusicLogUtils.d(TAG, "onCreate mCurrentTab: " + mCurrentTab); if ((mCurrentTab < 0) || (mCurrentTab >= mTabCount)) { mCurrentTab = ARTIST_INDEX; } /// M: reset the defalt tab value if (mCurrentTab == ARTIST_INDEX) { mTabHost.setCurrentTab(ALBUM_INDEX); } mTabHost.setOnTabChangedListener(this); PDebug.End("MusicBrowserActivity.setCurrentTab()"); PDebug.Start("MusicBrowserActivity.initPager()"); initPager(); PDebug.End("MusicBrowserActivity.initPager()"); PDebug.Start("MusicBrowserActivity.setAdapter()"); mViewPager = (ViewPager) findViewById(R.id.viewpage); mViewPager.setAdapter(new MusicPagerAdapter()); mViewPager.setOnPageChangeListener(this); //mViewPager.setOffscreenPageLimit(VIEW_PAGER_OFFSCREEN_PAGE_NUM); PDebug.End("MusicBrowserActivity.setAdapter()"); IntentFilter f = new IntentFilter(); f.addAction(MusicUtils.SDCARD_STATUS_UPDATE); registerReceiver(mSdcardstatustListener, f); createFakeMenu(); /// M: Init search button click listener in nowplaying. initSearchButton(); PDebug.End("MusicBrowserActivity.onCreate"); }
From source file:com.daycle.daycleapp.custom.swipelistview.itemmanipulation.swipedismiss.SwipeTouchListener.java
/** * Constructs a new {@code SwipeTouchListener} for the given {@link android.widget.AbsListView}. *//*from w w w . j a v a 2 s .co m*/ @SuppressWarnings("UnnecessaryFullyQualifiedName") protected SwipeTouchListener(@NonNull final ListViewWrapper listViewWrapper) { ViewConfiguration vc = ViewConfiguration.get(listViewWrapper.getListView().getContext()); mSlop = vc.getScaledTouchSlop(); mMinFlingVelocity = vc.getScaledMinimumFlingVelocity() * MIN_FLING_VELOCITY_FACTOR; mMaxFlingVelocity = vc.getScaledMaximumFlingVelocity(); mAnimationTime = listViewWrapper.getListView().getContext().getResources() .getInteger(android.R.integer.config_shortAnimTime); mListViewWrapper = listViewWrapper; }
From source file:com.android.calendar.month.SimpleDayPickerFragment.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); mContext = activity;/* w w w. j av a 2 s . c om*/ String tz = Time.getCurrentTimezone(); ViewConfiguration viewConfig = ViewConfiguration.get(activity); mMinimumFlingVelocity = viewConfig.getScaledMinimumFlingVelocity(); // Ensure we're in the correct time zone mSelectedDay.switchTimezone(tz); mSelectedDay.normalize(true); mFirstDayOfMonth.timezone = tz; mFirstDayOfMonth.normalize(true); mFirstVisibleDay.timezone = tz; mFirstVisibleDay.normalize(true); mTempTime.timezone = tz; Resources res = activity.getResources(); mSaturdayColor = res.getColor(R.color.month_saturday); mSundayColor = res.getColor(R.color.month_sunday); mFridayColor = res.getColor(R.color.month_friday); mDayNameColor = res.getColor(R.color.month_day_names_color); // Adjust sizes for screen density if (mScale == 0) { mScale = activity.getResources().getDisplayMetrics().density; if (mScale != 1) { WEEK_MIN_VISIBLE_HEIGHT *= mScale; BOTTOM_BUFFER *= mScale; LIST_TOP_OFFSET *= mScale; } } setUpAdapter(); setListAdapter(mAdapter); }