Java Code Examples for android.view.ViewConfiguration

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project android-joedayz, under directory /Proyectos/GreenDroid/src/greendroid/widget/.

Source file: PagedView.java

  32 
vote

private void initPagedView(){
  final Context context=getContext();
  mScroller=new Scroller(context,new DecelerateInterpolator());
  final ViewConfiguration conf=ViewConfiguration.get(context);
  mPagingTouchSlop=conf.getScaledTouchSlop() * 2;
  mMaximumVelocity=conf.getScaledMaximumFlingVelocity();
  final DisplayMetrics metrics=context.getResources().getDisplayMetrics();
  mMinimumVelocity=(int)(metrics.density * MINIMUM_PAGE_CHANGE_VELOCITY + 0.5f);
}
 

Example 2

From project Android-MapForgeFragment, under directory /library-common/src/com/jakewharton/android/mapsforge_fragment/.

Source file: MapView.java

  32 
vote

TouchEventHandler(Activity activity,MapView mapView){
  this.mapView=mapView;
  ViewConfiguration viewConfiguration=ViewConfiguration.get(activity);
  this.mapMoveDelta=viewConfiguration.getScaledTouchSlop();
  this.doubleTapDelta=viewConfiguration.getScaledDoubleTapSlop();
  this.doubleTapTimeout=ViewConfiguration.getDoubleTapTimeout();
  this.longPressTimeout=ViewConfiguration.getLongPressTimeout();
  this.longPressDetector=new LongPressDetector();
  this.longPressDetector.start();
}
 

Example 3

From project android-viewflow, under directory /viewflow/src/org/taptwo/android/widget/.

Source file: ViewFlow.java

  32 
vote

private void init(){
  mLoadedViews=new LinkedList<View>();
  mRecycledViews=new LinkedList<View>();
  mScroller=new Scroller(getContext());
  final ViewConfiguration configuration=ViewConfiguration.get(getContext());
  mTouchSlop=configuration.getScaledTouchSlop();
  mMaximumVelocity=configuration.getScaledMaximumFlingVelocity();
}
 

Example 4

From project AquaNotesTest, under directory /src/com/google/android/apps/iosched/ui/widget/.

Source file: Workspace.java

  32 
vote

/** 
 * Initializes various states for this workspace.
 */
private void initWorkspace(){
  mScroller=new Scroller(getContext());
  mCurrentScreen=mDefaultScreen;
  final ViewConfiguration configuration=ViewConfiguration.get(getContext());
  mTouchSlop=configuration.getScaledTouchSlop();
  mMaximumVelocity=configuration.getScaledMaximumFlingVelocity();
  mPagingTouchSlop=ReflectionUtils.callWithDefault(configuration,"getScaledPagingTouchSlop",mTouchSlop * 2);
}
 

Example 5

From project Backyard-Brains-Android-App, under directory /src/com/backyardbrains/view/.

Source file: TwoDimensionScaleGestureDetector.java

  32 
vote

public TwoDimensionScaleGestureDetector(Context context,OnScaleGestureListener listener){
  ViewConfiguration config=ViewConfiguration.get(context);
  mContext=context;
  mListener=listener;
  mEdgeSlop=config.getScaledEdgeSlop();
}
 

Example 6

From project CineShowTime-Android, under directory /Libraries/GreenDroid/src/greendroid/widget/.

Source file: PagedView.java

  32 
vote

private void initPagedView(){
  final Context context=getContext();
  mScroller=new Scroller(context,new DecelerateInterpolator());
  final ViewConfiguration conf=ViewConfiguration.get(context);
  mPagingTouchSlop=conf.getScaledTouchSlop() * 2;
  mMaximumVelocity=conf.getScaledMaximumFlingVelocity();
  final DisplayMetrics metrics=context.getResources().getDisplayMetrics();
  mMinimumVelocity=(int)(metrics.density * MINIMUM_PAGE_CHANGE_VELOCITY + 0.5f);
}
 

Example 7

From project conference-mobile-app, under directory /android-app/src/com/google/android/apps/iosched/ui/widget/.

Source file: Workspace.java

  32 
vote

/** 
 * Initializes various states for this workspace.
 */
private void initWorkspace(){
  mScroller=new Scroller(getContext());
  mCurrentScreen=mDefaultScreen;
  final ViewConfiguration configuration=ViewConfiguration.get(getContext());
  mTouchSlop=configuration.getScaledTouchSlop();
  mMaximumVelocity=configuration.getScaledMaximumFlingVelocity();
  mPagingTouchSlop=ReflectionUtils.callWithDefault(configuration,"getScaledPagingTouchSlop",mTouchSlop * 2);
}
 

Example 8

From project dcnyc10-android, under directory /android/src/com/lullabot/android/apps/iosched/ui/widget/.

Source file: Workspace.java

  32 
vote

/** 
 * Initializes various states for this workspace.
 */
private void initWorkspace(){
  mScroller=new Scroller(getContext());
  mCurrentScreen=mDefaultScreen;
  final ViewConfiguration configuration=ViewConfiguration.get(getContext());
  mTouchSlop=configuration.getScaledTouchSlop();
  mMaximumVelocity=configuration.getScaledMaximumFlingVelocity();
  mPagingTouchSlop=ReflectionUtils.callWithDefault(configuration,"getScaledPagingTouchSlop",mTouchSlop * 2);
}
 

Example 9

From project devoxx-france-android-in-fine, under directory /src/com/infine/android/devoxx/ui/widget/.

Source file: Workspace.java

  32 
vote

/** 
 * Initializes various states for this workspace.
 */
private void initWorkspace(){
  mScroller=new Scroller(getContext());
  mCurrentScreen=mDefaultScreen;
  final ViewConfiguration configuration=ViewConfiguration.get(getContext());
  mTouchSlop=configuration.getScaledTouchSlop();
  mMaximumVelocity=configuration.getScaledMaximumFlingVelocity();
  mPagingTouchSlop=ReflectionUtils.callWithDefault(configuration,"getScaledPagingTouchSlop",mTouchSlop * 2);
}
 

Example 10

From project gddsched2, under directory /trunk/android/src/com/google/android/apps/iosched2/ui/widget/.

Source file: Workspace.java

  32 
vote

/** 
 * Initializes various states for this workspace.
 */
private void initWorkspace(){
  mScroller=new Scroller(getContext());
  mCurrentScreen=mDefaultScreen;
  final ViewConfiguration configuration=ViewConfiguration.get(getContext());
  mTouchSlop=configuration.getScaledTouchSlop();
  mMaximumVelocity=configuration.getScaledMaximumFlingVelocity();
  mPagingTouchSlop=ReflectionUtils.callWithDefault(configuration,"getScaledPagingTouchSlop",mTouchSlop * 2);
}
 

Example 11

From project gobandroid, under directory /src/org/ligi/gobandroid_hd/ui/application/.

Source file: GobandroidFragmentActivity.java

  32 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  try {
    ViewConfiguration config=ViewConfiguration.get(this);
    Field menuKeyField=ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey");
    if (menuKeyField != null) {
      menuKeyField.setAccessible(true);
      menuKeyField.setBoolean(config,false);
    }
  }
 catch (  Exception ex) {
  }
  if ((this.getSupportActionBar() != null) && (this.getSupportActionBar().getCustomView() != null))   this.getSupportActionBar().getCustomView().setFocusable(false);
}
 

Example 12

From project GreenDroid, under directory /GreenDroid/src/greendroid/widget/.

Source file: PagedView.java

  32 
vote

private void initPagedView(){
  final Context context=getContext();
  mScroller=new Scroller(context,new DecelerateInterpolator());
  final ViewConfiguration conf=ViewConfiguration.get(context);
  mPagingTouchSlop=conf.getScaledTouchSlop() * 2;
  mMaximumVelocity=conf.getScaledMaximumFlingVelocity();
  final DisplayMetrics metrics=context.getResources().getDisplayMetrics();
  mMinimumVelocity=(int)(metrics.density * MINIMUM_PAGE_CHANGE_VELOCITY + 0.5f);
}
 

Example 13

From project Hax-Launcher, under directory /src/com/t3hh4xx0r/haxlauncher/.

Source file: PagedView.java

  32 
vote

/** 
 * Initializes various states for this workspace.
 */
protected void init(){
  mDirtyPageContent=new ArrayList<Boolean>();
  mDirtyPageContent.ensureCapacity(32);
  mScroller=new Scroller(getContext(),new ScrollInterpolator());
  mCurrentPage=0;
  mCenterPagesVertically=true;
  final ViewConfiguration configuration=ViewConfiguration.get(getContext());
  mTouchSlop=configuration.getScaledTouchSlop();
  mPagingTouchSlop=configuration.getScaledPagingTouchSlop();
  mMaximumVelocity=configuration.getScaledMaximumFlingVelocity();
  mDensity=getResources().getDisplayMetrics().density;
}
 

Example 14

From project HeLauncher, under directory /src/com/handlerexploit/launcher_reloaded/.

Source file: Workspace.java

  32 
vote

/** 
 * Initializes various states for this workspace.
 */
private void initWorkspace(){
  mScroller=new CustomScroller(getContext());
  mCurrentScreen=mDefaultScreen;
  Launcher.setScreen(mCurrentScreen);
  final ViewConfiguration configuration=ViewConfiguration.get(getContext());
  mTouchSlop=configuration.getScaledTouchSlop();
  mMaximumVelocity=configuration.getScaledMaximumFlingVelocity();
}
 

Example 15

From project iosched, under directory /android/src/com/google/android/apps/iosched/ui/widget/.

Source file: Workspace.java

  32 
vote

/** 
 * Initializes various states for this workspace.
 */
private void initWorkspace(){
  mScroller=new Scroller(getContext());
  mCurrentScreen=mDefaultScreen;
  final ViewConfiguration configuration=ViewConfiguration.get(getContext());
  mTouchSlop=configuration.getScaledTouchSlop();
  mMaximumVelocity=configuration.getScaledMaximumFlingVelocity();
  mPagingTouchSlop=ReflectionUtils.callWithDefault(configuration,"getScaledPagingTouchSlop",mTouchSlop * 2);
}
 

Example 16

From project iosched2011, under directory /android/src/com/google/android/apps/iosched/ui/widget/.

Source file: Workspace.java

  32 
vote

/** 
 * Initializes various states for this workspace.
 */
private void initWorkspace(){
  mScroller=new Scroller(getContext());
  mCurrentScreen=mDefaultScreen;
  final ViewConfiguration configuration=ViewConfiguration.get(getContext());
  mTouchSlop=configuration.getScaledTouchSlop();
  mMaximumVelocity=configuration.getScaledMaximumFlingVelocity();
  mPagingTouchSlop=ReflectionUtils.callWithDefault(configuration,"getScaledPagingTouchSlop",mTouchSlop * 2);
}
 

Example 17

From project iosched_2, under directory /android/src/com/google/android/apps/iosched/ui/widget/.

Source file: Workspace.java

  32 
vote

/** 
 * Initializes various states for this workspace.
 */
private void initWorkspace(){
  mScroller=new Scroller(getContext());
  mCurrentScreen=mDefaultScreen;
  final ViewConfiguration configuration=ViewConfiguration.get(getContext());
  mTouchSlop=configuration.getScaledTouchSlop();
  mMaximumVelocity=configuration.getScaledMaximumFlingVelocity();
  mPagingTouchSlop=ReflectionUtils.callWithDefault(configuration,"getScaledPagingTouchSlop",mTouchSlop * 2);
}
 

Example 18

From project iosched_3, under directory /android/src/com/google/android/apps/iosched/ui/widget/.

Source file: ShowHideMasterLayout.java

  32 
vote

@Override public boolean onFling(MotionEvent e1,MotionEvent e2,float velocityX,float velocityY){
  ViewConfiguration viewConfig=ViewConfiguration.get(getContext());
  float absVelocityX=Math.abs(velocityX);
  float absVelocityY=Math.abs(velocityY);
  if (mFlingToExposeMaster && !mMasterVisible && velocityX > 0 && absVelocityX >= absVelocityY && absVelocityX > viewConfig.getScaledMinimumFlingVelocity() && absVelocityX < viewConfig.getScaledMaximumFlingVelocity()) {
    showMaster(true,0);
    return true;
  }
  return super.onFling(e1,e2,velocityX,velocityY);
}
 

Example 19

From project iPhoroidUI, under directory /src/org/klab/iphoroid/widget/flowview/.

Source file: FlowView.java

  32 
vote

private void init(){
  mLoadedViews=new LinkedList<View>();
  mScroller=new Scroller(getContext());
  final ViewConfiguration configuration=ViewConfiguration.get(getContext());
  mTouchSlop=configuration.getScaledTouchSlop();
  mMaximumVelocity=configuration.getScaledMaximumFlingVelocity();
}
 

Example 20

From project OAK, under directory /oak-library/src/main/java/oak/util/.

Source file: ScaleGestureDetector.java

  32 
vote

public ScaleGestureDetector(Context context,OnScaleGestureListener listener){
  ViewConfiguration config=ViewConfiguration.get(context);
  mContext=context;
  mListener=listener;
  mEdgeSlop=config.getScaledEdgeSlop();
}
 

Example 21

From project platform_packages_apps_browser, under directory /src/com/android/browser/view/.

Source file: ScrollerView.java

  32 
vote

private void initScrollView(){
  mScroller=new OverScroller(getContext());
  setFocusable(true);
  setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
  setWillNotDraw(false);
  final ViewConfiguration configuration=ViewConfiguration.get(mContext);
  mTouchSlop=configuration.getScaledTouchSlop();
  mMinimumVelocity=configuration.getScaledMinimumFlingVelocity();
  mMaximumVelocity=configuration.getScaledMaximumFlingVelocity();
  mOverscrollDistance=configuration.getScaledOverscrollDistance();
  mOverflingDistance=configuration.getScaledOverflingDistance();
  mDownCoords=new PointF();
}
 

Example 22

From project platform_packages_apps_calendar, under directory /src/com/android/calendar/month/.

Source file: MonthByWeekAdapter.java

  32 
vote

public MonthByWeekAdapter(Context context,HashMap<String,Integer> params){
  super(context,params);
  if (params.containsKey(WEEK_PARAMS_IS_MINI)) {
    mIsMiniMonth=params.get(WEEK_PARAMS_IS_MINI) != 0;
  }
  mShowAgendaWithMonth=Utils.getConfigBool(context,R.bool.show_agenda_with_month);
  ViewConfiguration vc=ViewConfiguration.get(context);
  mOnDownDelay=ViewConfiguration.getTapTimeout();
  mMovedPixelToCancel=vc.getScaledTouchSlop();
  mTotalClickDelay=mOnDownDelay + mOnTapDelay;
}
 

Example 23

From project platform_packages_apps_launcher, under directory /src/com/android/launcher/.

Source file: Workspace.java

  32 
vote

/** 
 * Initializes various states for this workspace.
 */
private void initWorkspace(){
  mScroller=new Scroller(getContext());
  mCurrentScreen=mDefaultScreen;
  Launcher.setScreen(mCurrentScreen);
  mPaint=new Paint();
  mPaint.setDither(false);
  final ViewConfiguration configuration=ViewConfiguration.get(getContext());
  mTouchSlop=configuration.getScaledTouchSlop();
  mMaximumVelocity=configuration.getScaledMaximumFlingVelocity();
}
 

Example 24

From project ratebeer-for-Android, under directory /JakeWharton-ActionBarSherlock/library/src/android/support/v4/view/.

Source file: ViewPager.java

  32 
vote

void initViewPager(){
  setWillNotDraw(false);
  mScroller=new Scroller(getContext());
  final ViewConfiguration configuration=ViewConfiguration.get(getContext());
  mTouchSlop=ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
  mMinimumVelocity=configuration.getScaledMinimumFlingVelocity();
  mMaximumVelocity=configuration.getScaledMaximumFlingVelocity();
}
 

Example 25

From project ratebeerforandroid, under directory /JakeWharton-ActionBarSherlock/library/src/android/support/v4/view/.

Source file: ViewPager.java

  32 
vote

void initViewPager(){
  setWillNotDraw(false);
  mScroller=new Scroller(getContext());
  final ViewConfiguration configuration=ViewConfiguration.get(getContext());
  mTouchSlop=ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
  mMinimumVelocity=configuration.getScaledMinimumFlingVelocity();
  mMaximumVelocity=configuration.getScaledMaximumFlingVelocity();
}
 

Example 26

From project RA_Launcher, under directory /src/com/android/ra/launcher/.

Source file: Workspace.java

  32 
vote

/** 
 * Initializes various states for this workspace.
 */
private void initWorkspace(){
  Context context=getContext();
  mScrollInterpolator=new WorkspaceOvershootInterpolator();
  mScroller=new Scroller(context,mScrollInterpolator);
  mCurrentScreen=mDefaultScreen;
  Launcher.setScreen(mCurrentScreen);
  LauncherApplication app=(LauncherApplication)context.getApplicationContext();
  mIconCache=app.getIconCache();
  final ViewConfiguration configuration=ViewConfiguration.get(getContext());
  mTouchSlop=configuration.getScaledTouchSlop();
  mMaximumVelocity=configuration.getScaledMaximumFlingVelocity();
}
 

Example 27

From project RebeLauncher, under directory /src/com/dirtypepper/rebelauncher/.

Source file: Workspace.java

  32 
vote

/** 
 * Initializes various states for this workspace.
 */
private void initWorkspace(){
  mScroller=new CustomScroller(getContext(),new ElasticInterpolator(5f));
  mCurrentScreen=mDefaultScreen;
  Launcher.setScreen(mCurrentScreen);
  mPaint=new Paint();
  mPaint.setDither(false);
  final ViewConfiguration configuration=ViewConfiguration.get(getContext());
  mTouchSlop=configuration.getScaledTouchSlop();
  mMaximumVelocity=configuration.getScaledMaximumFlingVelocity();
  multiTouchController=new MultiTouchController<Object>(this,false);
  mDesktopRows=AlmostNexusSettingsHelper.getDesktopRows(getContext());
  mDesktopColumns=AlmostNexusSettingsHelper.getDesktopColumns(getContext());
  mDesktopCacheType=AlmostNexusSettingsHelper.getScreenCache(getContext());
}
 

Example 28

From project roman10-android-tutorial, under directory /pagedview/src/roman10/tutorial/ui/pagedview/.

Source file: PagedView.java

  32 
vote

private void initPagedView(){
  final Context context=getContext();
  mScroller=new Scroller(context,new DecelerateInterpolator());
  final ViewConfiguration conf=ViewConfiguration.get(context);
  mPagingTouchSlop=conf.getScaledTouchSlop() * 2;
  mMaximumVelocity=conf.getScaledMaximumFlingVelocity();
  final DisplayMetrics metrics=context.getResources().getDisplayMetrics();
  mMinimumVelocity=(int)(metrics.density * MINIMUM_PAGE_CHANGE_VELOCITY + 0.5f);
}
 

Example 29

From project Schedule, under directory /android/src/com/googlecode/android/widgets/DateSlider/.

Source file: ScrollLayout.java

  32 
vote

public ScrollLayout(Context context,AttributeSet attrs){
  super(context,attrs);
  mScroller=new Scroller(getContext());
  setGravity(Gravity.CENTER_VERTICAL);
  final ViewConfiguration configuration=ViewConfiguration.get(getContext());
  mMinimumVelocity=configuration.getScaledMinimumFlingVelocity();
  float density=getContext().getResources().getDisplayMetrics().density;
  mMaximumVelocity=(int)(4000 * 0.5f * density);
}
 

Example 30

From project simplefacebook, under directory /src/greendroid/widget/.

Source file: PagedView.java

  32 
vote

private void initPagedView(){
  final Context context=getContext();
  mScroller=new Scroller(context,new DecelerateInterpolator());
  final ViewConfiguration conf=ViewConfiguration.get(context);
  mPagingTouchSlop=conf.getScaledTouchSlop() * 2;
  mMaximumVelocity=conf.getScaledMaximumFlingVelocity();
  final DisplayMetrics metrics=context.getResources().getDisplayMetrics();
  mMinimumVelocity=(int)(metrics.density * MINIMUM_PAGE_CHANGE_VELOCITY + 0.5f);
  WebView wv=new WebView(context);
  initScale=wv.getScale();
  AQUtility.debug("seed scale",initScale);
}
 

Example 31

From project vlc-android, under directory /vlc-android/src/org/videolan/vlc/android/widget/.

Source file: FlingViewGroup.java

  32 
vote

public FlingViewGroup(Context context,AttributeSet attrs){
  super(context,attrs);
  this.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,ViewGroup.LayoutParams.FILL_PARENT));
  mScroller=new Scroller(context);
  ViewConfiguration config=ViewConfiguration.get(getContext());
  mTouchSlop=config.getScaledTouchSlop();
  mMaximumVelocity=config.getScaledMaximumFlingVelocity();
}
 

Example 32

From project android-pulltorefresh, under directory /library/src/com/handmark/pulltorefresh/library/.

Source file: PullToRefreshBase.java

  31 
vote

@SuppressWarnings("deprecation") private void init(Context context,AttributeSet attrs){
  setOrientation(LinearLayout.VERTICAL);
  ViewConfiguration config=ViewConfiguration.get(context);
  mTouchSlop=config.getScaledTouchSlop();
  TypedArray a=context.obtainStyledAttributes(attrs,R.styleable.PullToRefresh);
  if (a.hasValue(R.styleable.PullToRefresh_ptrMode)) {
    mMode=Mode.mapIntToMode(a.getInteger(R.styleable.PullToRefresh_ptrMode,0));
  }
  mRefreshableView=createRefreshableView(context,attrs);
  addRefreshableView(context,mRefreshableView);
  mHeaderLayout=createLoadingLayout(context,Mode.PULL_DOWN_TO_REFRESH,a);
  mFooterLayout=createLoadingLayout(context,Mode.PULL_UP_TO_REFRESH,a);
  if (a.hasValue(R.styleable.PullToRefresh_ptrHeaderBackground)) {
    Drawable background=a.getDrawable(R.styleable.PullToRefresh_ptrHeaderBackground);
    if (null != background) {
      setBackgroundDrawable(background);
    }
  }
  if (a.hasValue(R.styleable.PullToRefresh_ptrAdapterViewBackground)) {
    Drawable background=a.getDrawable(R.styleable.PullToRefresh_ptrAdapterViewBackground);
    if (null != background) {
      mRefreshableView.setBackgroundDrawable(background);
    }
  }
  if (a.hasValue(R.styleable.PullToRefresh_ptrOverScroll)) {
    mOverScrollEnabled=a.getBoolean(R.styleable.PullToRefresh_ptrOverScroll,true);
  }
  handleStyledAttributes(a);
  a.recycle();
  updateUIForMode();
}
 

Example 33

From project android_7, under directory /src/org/immopoly/android/widget/.

Source file: ViewPager.java

  31 
vote

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);
}
 

Example 34

From project Barcamp-Bangalore-Android-App, under directory /slidingmenu/library/src/com/slidingmenu/lib/.

Source file: CustomViewAbove.java

  31 
vote

void initCustomViewPager(){
  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();
  setAdapter(new CustomPagerAdapter());
  setTransparentWindow();
  final float density=context.getResources().getDisplayMetrics().density;
  mFlingDistance=(int)(MIN_DISTANCE_FOR_FLING * density);
}
 

Example 35

From project BreizhCamp-android, under directory /src/org/breizhjug/breizhcamp/view/.

Source file: CustomGallery.java

  31 
vote

/** 
 * Initializes various states for this workspace.
 */
private void initWorkspace(){
  mScrollInterpolator=new WorkspaceOvershootInterpolator();
  scroller=new Scroller(getContext(),mScrollInterpolator);
  currentScreen=defaultScreen;
  paint=new Paint();
  paint.setDither(false);
  final ViewConfiguration configuration=ViewConfiguration.get(getContext());
  touchSlop=configuration.getScaledTouchSlop();
  TAB_INDICATOR_HEIGHT=getResources().getDimension(R.dimen.gallery_indicator_height);
  tabPaint=new Paint();
  tabPaint.setColor(Color.parseColor("#BBBBBB"));
  tabPaint.setStyle(Paint.Style.FILL_AND_STROKE);
  selectedTabPaint=new Paint();
  selectedTabPaint.setColor(Color.WHITE);
  selectedTabPaint.setStyle(Paint.Style.FILL_AND_STROKE);
}
 

Example 36

From project DateSlider, under directory /src/com/googlecode/android/widgets/DateSlider/.

Source file: ScrollLayout.java

  31 
vote

public ScrollLayout(Context context,AttributeSet attrs){
  super(context,attrs);
  this.setWillNotDraw(false);
  rightShadow=getContext().getResources().getDrawable(R.drawable.right_shadow);
  leftShadow=getContext().getResources().getDrawable(R.drawable.left_shadow);
  mScroller=new Scroller(getContext());
  setGravity(Gravity.CENTER_VERTICAL);
  setOrientation(HORIZONTAL);
  final ViewConfiguration configuration=ViewConfiguration.get(getContext());
  mMinimumVelocity=configuration.getScaledMinimumFlingVelocity();
  float density=getContext().getResources().getDisplayMetrics().density;
  mMaximumVelocity=(int)(4000 * 0.5f * density);
  TypedArray a=context.obtainStyledAttributes(attrs,R.styleable.ScrollLayout,0,0);
  String className=a.getNonResourceString(R.styleable.ScrollLayout_labelerClass);
  if (className == null) {
    throw new RuntimeException("Must specify labeler class at " + a.getPositionDescription());
  }
  String labelerFormat=a.getString(R.styleable.ScrollLayout_labelerFormat);
  if (labelerFormat == null) {
    throw new RuntimeException("Must specify labelerFormat at " + a.getPositionDescription());
  }
  try {
    Class<?> klazz=Class.forName(className);
    Constructor<?> ctor=klazz.getConstructor(String.class);
    mLabeler=(Labeler)ctor.newInstance(labelerFormat);
  }
 catch (  Exception e) {
    throw new RuntimeException("Failed to construct labeler at " + a.getPositionDescription(),e);
  }
  objWidth=a.getDimensionPixelSize(R.styleable.ScrollLayout_childWidth,mLabeler.getPreferredViewWidth(context));
  objHeight=a.getDimensionPixelSize(R.styleable.ScrollLayout_childHeight,mLabeler.getPreferredViewHeight(context));
  a.recycle();
}
 

Example 37

From project dreamDroid, under directory /libraries/VPI/src/com/viewpagerindicator/.

Source file: CirclePageIndicator.java

  31 
vote

public CirclePageIndicator(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  if (isInEditMode())   return;
  final Resources res=getResources();
  final int defaultPageColor=res.getColor(R.color.default_circle_indicator_page_color);
  final int defaultFillColor=res.getColor(R.color.default_circle_indicator_fill_color);
  final int defaultOrientation=res.getInteger(R.integer.default_circle_indicator_orientation);
  final int defaultStrokeColor=res.getColor(R.color.default_circle_indicator_stroke_color);
  final float defaultStrokeWidth=res.getDimension(R.dimen.default_circle_indicator_stroke_width);
  final float defaultRadius=res.getDimension(R.dimen.default_circle_indicator_radius);
  final boolean defaultCentered=res.getBoolean(R.bool.default_circle_indicator_centered);
  final boolean defaultSnap=res.getBoolean(R.bool.default_circle_indicator_snap);
  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);
  a.recycle();
  final ViewConfiguration configuration=ViewConfiguration.get(context);
  mTouchSlop=ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
}
 

Example 38

From project droidkit, under directory /src/org/droidkit/widget/.

Source file: HandyPagedView.java

  31 
vote

private void initPagedView(){
  setWillNotCacheDrawing(true);
  setWillNotDraw(false);
  mPageIndicatorView=null;
  mPreventInvalidate=false;
  mParentScrollview=null;
  mContainerViews=new ArrayList<FrameLayout>(3);
  mVisibleViews=new AdapterViewInfo[3];
  mRecycledViews=null;
  mAdapter=null;
  mCurrentPage=0;
  mIsBeingDragged=false;
  mIsBeingScrolled=false;
  mVelocityTracker=null;
  mAutoScroll=false;
  mAutoScrollInterval=400;
  mInfiniteLoop=false;
  mStopAutoScrollingOnTouch=false;
  mPageChangedListener=null;
  mInnerView=new LinearLayout(getContext());
  mInnerView.setOrientation(LinearLayout.HORIZONTAL);
  for (int i=0; i < 3; i++) {
    mContainerViews.add(new FrameLayout(getContext()));
    mInnerView.addView(mContainerViews.get(i));
  }
  addView(mInnerView);
  mScroller=new Scroller(getContext());
  final ViewConfiguration configuration=ViewConfiguration.get(getContext());
  mTouchSlop=configuration.getScaledTouchSlop();
  mMinVelocity=configuration.getScaledMinimumFlingVelocity();
  mMaxVelocity=configuration.getScaledMaximumFlingVelocity();
}
 

Example 39

From project finch, under directory /libs/JakeWharton-Android-ViewPagerIndicator-f09acb0/library/src/com/viewpagerindicator/.

Source file: CirclePageIndicator.java

  31 
vote

public CirclePageIndicator(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  final Resources res=getResources();
  final int defaultPageColor=res.getColor(R.color.default_circle_indicator_page_color);
  final int defaultFillColor=res.getColor(R.color.default_circle_indicator_fill_color);
  final int defaultOrientation=res.getInteger(R.integer.default_circle_indicator_orientation);
  final int defaultStrokeColor=res.getColor(R.color.default_circle_indicator_stroke_color);
  final float defaultStrokeWidth=res.getDimension(R.dimen.default_circle_indicator_stroke_width);
  final float defaultRadius=res.getDimension(R.dimen.default_circle_indicator_radius);
  final boolean defaultCentered=res.getBoolean(R.bool.default_circle_indicator_centered);
  final boolean defaultSnap=res.getBoolean(R.bool.default_circle_indicator_snap);
  TypedArray a=context.obtainStyledAttributes(attrs,R.styleable.CirclePageIndicator,defStyle,R.style.Widget_CirclePageIndicator);
  mCentered=a.getBoolean(R.styleable.CirclePageIndicator_centered,defaultCentered);
  mOrientation=a.getInt(R.styleable.CirclePageIndicator_orientation,defaultOrientation);
  mPaintPageFill=new Paint(Paint.ANTI_ALIAS_FLAG);
  mPaintPageFill.setStyle(Style.FILL);
  mPaintPageFill.setColor(a.getColor(R.styleable.CirclePageIndicator_pageColor,defaultPageColor));
  mPaintStroke=new Paint(Paint.ANTI_ALIAS_FLAG);
  mPaintStroke.setStyle(Style.STROKE);
  mPaintStroke.setColor(a.getColor(R.styleable.CirclePageIndicator_strokeColor,defaultStrokeColor));
  mPaintStroke.setStrokeWidth(a.getDimension(R.styleable.CirclePageIndicator_strokeWidth,defaultStrokeWidth));
  mPaintFill=new Paint(Paint.ANTI_ALIAS_FLAG);
  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);
  a.recycle();
  final ViewConfiguration configuration=ViewConfiguration.get(context);
  mTouchSlop=ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
}
 

Example 40

From project FlipDroid, under directory /app/src/com/goal98/flipdroid2/activity/.

Source file: ContentPagedActivity.java

  31 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  setTheme(R.style.Theme_Sherlock);
  super.onCreate(savedInstanceState);
  final ViewConfiguration configuration=ViewConfiguration.get(this);
  mTouchSlop=ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
  GestureUtil.minDelta=mTouchSlop;
  getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_TITLE);
  getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  setContentView(R.layout.contentloaded);
  pageIndexView=(PageIndexView)findViewById(R.id.pageIndex);
  body=(RelativeLayout)findViewById(R.id.body);
  inflater=LayoutInflater.from(this);
  sinaWeiboHelper=new SinaWeiboHelper(this);
  article=ArticleHolder.getInstance().get();
  if (article == null)   finish();
  getSupportActionBar().setTitle(article.getAuthor());
  loadedArticleView=new ContentPagerView(this,article);
  RelativeLayout.LayoutParams layoutParams=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.FILL_PARENT,RelativeLayout.LayoutParams.FILL_PARENT);
  loadedArticleView.setPadding(0,10,0,0);
  layoutParams.addRule(RelativeLayout.BELOW,R.id.topbar);
  layoutParams.addRule(RelativeLayout.ABOVE,R.id.pageIndex);
  body.addView(loadedArticleView,layoutParams);
}
 

Example 41

From project friendica-for-android, under directory /libpulltorefresh/src/com/handmark/pulltorefresh/library/.

Source file: PullToRefreshBase.java

  31 
vote

private void init(Context context,AttributeSet attrs){
  setOrientation(LinearLayout.VERTICAL);
  ViewConfiguration config=ViewConfiguration.get(context);
  mTouchSlop=config.getScaledTouchSlop();
  TypedArray a=context.obtainStyledAttributes(attrs,R.styleable.PullToRefresh);
  handleStyledAttributes(a);
  if (a.hasValue(R.styleable.PullToRefresh_ptrMode)) {
    mMode=Mode.mapIntToMode(a.getInteger(R.styleable.PullToRefresh_ptrMode,0));
  }
  mRefreshableView=createRefreshableView(context,attrs);
  addRefreshableView(context,mRefreshableView);
  mHeaderLayout=new LoadingLayout(context,Mode.PULL_DOWN_TO_REFRESH,a);
  mFooterLayout=new LoadingLayout(context,Mode.PULL_UP_TO_REFRESH,a);
  updateUIForMode();
  if (a.hasValue(R.styleable.PullToRefresh_ptrHeaderBackground)) {
    Drawable background=a.getDrawable(R.styleable.PullToRefresh_ptrHeaderBackground);
    if (null != background) {
      setBackgroundDrawable(background);
    }
  }
  if (a.hasValue(R.styleable.PullToRefresh_ptrAdapterViewBackground)) {
    Drawable background=a.getDrawable(R.styleable.PullToRefresh_ptrAdapterViewBackground);
    if (null != background) {
      mRefreshableView.setBackgroundDrawable(background);
    }
  }
  a.recycle();
  a=null;
}
 

Example 42

From project HSR-Timetable, under directory /ViewpagerLibrary/src/com/viewpagerindicator/.

Source file: CirclePageIndicator.java

  31 
vote

public CirclePageIndicator(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  if (isInEditMode())   return;
  final Resources res=getResources();
  final int defaultPageColor=res.getColor(R.color.default_circle_indicator_page_color);
  final int defaultFillColor=res.getColor(R.color.default_circle_indicator_fill_color);
  final int defaultOrientation=res.getInteger(R.integer.default_circle_indicator_orientation);
  final int defaultStrokeColor=res.getColor(R.color.default_circle_indicator_stroke_color);
  final float defaultStrokeWidth=res.getDimension(R.dimen.default_circle_indicator_stroke_width);
  final float defaultRadius=res.getDimension(R.dimen.default_circle_indicator_radius);
  final boolean defaultCentered=res.getBoolean(R.bool.default_circle_indicator_centered);
  final boolean defaultSnap=res.getBoolean(R.bool.default_circle_indicator_snap);
  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);
  a.recycle();
  final ViewConfiguration configuration=ViewConfiguration.get(context);
  mTouchSlop=ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
}
 

Example 43

From project liquidroid, under directory /src/com/viewpagerindicator/.

Source file: CirclePageIndicator.java

  31 
vote

public CirclePageIndicator(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  if (isInEditMode())   return;
  final Resources res=getResources();
  final int defaultPageColor=res.getColor(R.color.default_circle_indicator_page_color);
  final int defaultFillColor=res.getColor(R.color.default_circle_indicator_fill_color);
  final int defaultOrientation=res.getInteger(R.integer.default_circle_indicator_orientation);
  final int defaultStrokeColor=res.getColor(R.color.default_circle_indicator_stroke_color);
  final float defaultStrokeWidth=res.getDimension(R.dimen.default_circle_indicator_stroke_width);
  final float defaultRadius=res.getDimension(R.dimen.default_circle_indicator_radius);
  final boolean defaultCentered=res.getBoolean(R.bool.default_circle_indicator_centered);
  final boolean defaultSnap=res.getBoolean(R.bool.default_circle_indicator_snap);
  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);
  a.recycle();
  final ViewConfiguration configuration=ViewConfiguration.get(context);
  mTouchSlop=ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
}
 

Example 44

From project packages_apps_Calendar, under directory /src/com/android/calendar/month/.

Source file: MonthByWeekFragment.java

  31 
vote

@Override public void onAttach(Activity activity){
  super.onAttach(activity);
  mTZUpdater.run();
  if (mAdapter != null) {
    mAdapter.setSelectedDay(mSelectedDay);
  }
  mGestureDetector=new GestureDetector(activity,new MonthGestureListener());
  ViewConfiguration viewConfig=ViewConfiguration.get(activity);
  mMinimumTwoMonthFlingVelocity=viewConfig.getScaledMaximumFlingVelocity() / 2;
  if (mScale == 0) {
    Resources res=activity.getResources();
    mScale=res.getDisplayMetrics().density;
    mShowDetailsInMonth=res.getBoolean(R.bool.show_details_in_month);
    if (mScale != 1) {
      SPACING_WEEK_NUMBER*=mScale;
    }
  }
}
 

Example 45

From project platform_frameworks_support, under directory /v4/java/android/support/v4/view/.

Source file: ViewPager.java

  31 
vote

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);
  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);
  }
}
 

Example 46

From project SeriesGuide, under directory /ViewPagerIndicator/src/com/viewpagerindicator/.

Source file: CirclePageIndicator.java

  31 
vote

public CirclePageIndicator(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  if (isInEditMode())   return;
  final Resources res=getResources();
  final int defaultPageColor=res.getColor(R.color.default_circle_indicator_page_color);
  final int defaultFillColor=res.getColor(R.color.default_circle_indicator_fill_color);
  final int defaultOrientation=res.getInteger(R.integer.default_circle_indicator_orientation);
  final int defaultStrokeColor=res.getColor(R.color.default_circle_indicator_stroke_color);
  final float defaultStrokeWidth=res.getDimension(R.dimen.default_circle_indicator_stroke_width);
  final float defaultRadius=res.getDimension(R.dimen.default_circle_indicator_radius);
  final boolean defaultCentered=res.getBoolean(R.bool.default_circle_indicator_centered);
  final boolean defaultSnap=res.getBoolean(R.bool.default_circle_indicator_snap);
  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);
}
 

Example 47

From project Something-Awful-Android, under directory /application/src/com/ferg/awfulapp/widget/.

Source file: AwfulViewPager.java

  31 
vote

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);
}
 

Example 48

From project Synodroid, under directory /src/com/bigpupdev/synodroid/utils/.

Source file: CirclePageIndicator.java

  31 
vote

public CirclePageIndicator(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  if (isInEditMode())   return;
  final Resources res=getResources();
  final int defaultPageColor=res.getColor(R.color.default_circle_indicator_page_color);
  final int defaultFillColor=res.getColor(R.color.default_circle_indicator_fill_color);
  final int defaultOrientation=res.getInteger(R.integer.default_circle_indicator_orientation);
  final int defaultStrokeColor=res.getColor(R.color.default_circle_indicator_stroke_color);
  final float defaultStrokeWidth=res.getDimension(R.dimen.default_circle_indicator_stroke_width);
  final float defaultRadius=res.getDimension(R.dimen.default_circle_indicator_radius);
  final boolean defaultCentered=res.getBoolean(R.bool.default_circle_indicator_centered);
  final boolean defaultSnap=res.getBoolean(R.bool.default_circle_indicator_snap);
  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);
  a.recycle();
  final ViewConfiguration configuration=ViewConfiguration.get(context);
  mTouchSlop=ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
}
 

Example 49

From project TL-android-app, under directory /ViewPagerIndicator/src/com/viewpagerindicator/.

Source file: CirclePageIndicator.java

  31 
vote

public CirclePageIndicator(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  final Resources res=getResources();
  final int defaultFillColor=res.getColor(R.color.default_circle_indicator_fill_color);
  final int defaultOrientation=res.getInteger(R.integer.default_circle_indicator_orientation);
  final int defaultStrokeColor=res.getColor(R.color.default_circle_indicator_stroke_color);
  final float defaultStrokeWidth=res.getDimension(R.dimen.default_circle_indicator_stroke_width);
  final float defaultRadius=res.getDimension(R.dimen.default_circle_indicator_radius);
  final boolean defaultCentered=res.getBoolean(R.bool.default_circle_indicator_centered);
  final boolean defaultSnap=res.getBoolean(R.bool.default_circle_indicator_snap);
  TypedArray a=context.obtainStyledAttributes(attrs,R.styleable.CirclePageIndicator,defStyle,R.style.Widget_CirclePageIndicator);
  mCentered=a.getBoolean(R.styleable.CirclePageIndicator_centered,defaultCentered);
  mOrientation=a.getInt(R.styleable.CirclePageIndicator_orientation,defaultOrientation);
  mPaintStroke=new Paint(Paint.ANTI_ALIAS_FLAG);
  mPaintStroke.setStyle(Style.STROKE);
  mPaintStroke.setColor(a.getColor(R.styleable.CirclePageIndicator_strokeColor,defaultStrokeColor));
  mPaintStroke.setStrokeWidth(a.getDimension(R.styleable.CirclePageIndicator_strokeWidth,defaultStrokeWidth));
  mPaintFill=new Paint(Paint.ANTI_ALIAS_FLAG);
  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);
  a.recycle();
  final ViewConfiguration configuration=ViewConfiguration.get(context);
  mTouchSlop=ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
}
 

Example 50

From project twidere, under directory /src/com/handmark/pulltorefresh/library/.

Source file: PullToRefreshBase.java

  31 
vote

private void init(final Context context,final AttributeSet attrs){
  setOrientation(LinearLayout.VERTICAL);
  final ViewConfiguration config=ViewConfiguration.get(context);
  mTouchSlop=config.getScaledTouchSlop();
  TypedArray a=context.obtainStyledAttributes(attrs,R.styleable.PullToRefresh);
  handleStyledAttributes(a);
  if (a.hasValue(R.styleable.PullToRefresh_ptrMode)) {
    mMode=Mode.mapIntToMode(a.getInteger(R.styleable.PullToRefresh_ptrMode,0));
  }
  mRefreshableView=createRefreshableView(context,attrs);
  addRefreshableView(context,mRefreshableView);
  mHeaderLayout=new LoadingLayout(context,Mode.PULL_DOWN_TO_REFRESH,a);
  mFooterLayout=new LoadingLayout(context,Mode.PULL_UP_TO_REFRESH,a);
  updateUIForMode();
  if (a.hasValue(R.styleable.PullToRefresh_ptrHeaderBackground)) {
    final Drawable background=a.getDrawable(R.styleable.PullToRefresh_ptrHeaderBackground);
    if (null != background) {
      setBackgroundDrawable(background);
    }
  }
  if (a.hasValue(R.styleable.PullToRefresh_ptrAdapterViewBackground)) {
    final Drawable background=a.getDrawable(R.styleable.PullToRefresh_ptrAdapterViewBackground);
    if (null != background) {
      mRefreshableView.setBackgroundDrawable(background);
    }
  }
  a.recycle();
  a=null;
}
 

Example 51

From project uberdust-android, under directory /LibProjects/ViewPagerIndicator/src/com/viewpagerindicator/.

Source file: CirclePageIndicator.java

  31 
vote

public CirclePageIndicator(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  final Resources res=getResources();
  final int defaultPageColor=res.getColor(R.color.default_circle_indicator_page_color);
  final int defaultFillColor=res.getColor(R.color.default_circle_indicator_fill_color);
  final int defaultOrientation=res.getInteger(R.integer.default_circle_indicator_orientation);
  final int defaultStrokeColor=res.getColor(R.color.default_circle_indicator_stroke_color);
  final float defaultStrokeWidth=res.getDimension(R.dimen.default_circle_indicator_stroke_width);
  final float defaultRadius=res.getDimension(R.dimen.default_circle_indicator_radius);
  final boolean defaultCentered=res.getBoolean(R.bool.default_circle_indicator_centered);
  final boolean defaultSnap=res.getBoolean(R.bool.default_circle_indicator_snap);
  TypedArray a=context.obtainStyledAttributes(attrs,R.styleable.CirclePageIndicator,defStyle,R.style.Widget_CirclePageIndicator);
  mCentered=a.getBoolean(R.styleable.CirclePageIndicator_centered,defaultCentered);
  mOrientation=a.getInt(R.styleable.CirclePageIndicator_orientation,defaultOrientation);
  mPaintPageFill=new Paint(Paint.ANTI_ALIAS_FLAG);
  mPaintPageFill.setStyle(Style.FILL);
  mPaintPageFill.setColor(a.getColor(R.styleable.CirclePageIndicator_pageColor,defaultPageColor));
  mPaintStroke=new Paint(Paint.ANTI_ALIAS_FLAG);
  mPaintStroke.setStyle(Style.STROKE);
  mPaintStroke.setColor(a.getColor(R.styleable.CirclePageIndicator_strokeColor,defaultStrokeColor));
  mPaintStroke.setStrokeWidth(a.getDimension(R.styleable.CirclePageIndicator_strokeWidth,defaultStrokeWidth));
  mPaintFill=new Paint(Paint.ANTI_ALIAS_FLAG);
  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);
  a.recycle();
  final ViewConfiguration configuration=ViewConfiguration.get(context);
  mTouchSlop=ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
}
 

Example 52

From project Ushahidi_Android, under directory /Libraries/abs/src/android/support/v4/view/.

Source file: ViewPager.java

  31 
vote

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);
}
 

Example 53

From project vanilla, under directory /src/android/support/v4/view/.

Source file: ViewPager.java

  31 
vote

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);
  if (Build.VERSION.SDK_INT >= 8) {
    mTouchSlop=CompatFroyo.getScaledPagingTouchSlop(configuration);
  }
 else {
    mTouchSlop=configuration.getScaledTouchSlop();
  }
  mMinimumVelocity=configuration.getScaledMinimumFlingVelocity();
  mMaximumVelocity=configuration.getScaledMaximumFlingVelocity();
  if (Build.VERSION.SDK_INT >= 14) {
    mLeftEdge=new EdgeEffectCompat(context);
    mRightEdge=new EdgeEffectCompat(context);
  }
  final float density=context.getResources().getDisplayMetrics().density;
  mFlingDistance=(int)(MIN_DISTANCE_FOR_FLING * density);
}
 

Example 54

From project Yaaic, under directory /libs/ViewPagerIndicator/src/com/viewpagerindicator/.

Source file: CirclePageIndicator.java

  31 
vote

public CirclePageIndicator(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  if (isInEditMode())   return;
  final Resources res=getResources();
  final int defaultPageColor=res.getColor(R.color.default_circle_indicator_page_color);
  final int defaultFillColor=res.getColor(R.color.default_circle_indicator_fill_color);
  final int defaultOrientation=res.getInteger(R.integer.default_circle_indicator_orientation);
  final int defaultStrokeColor=res.getColor(R.color.default_circle_indicator_stroke_color);
  final float defaultStrokeWidth=res.getDimension(R.dimen.default_circle_indicator_stroke_width);
  final float defaultRadius=res.getDimension(R.dimen.default_circle_indicator_radius);
  final boolean defaultCentered=res.getBoolean(R.bool.default_circle_indicator_centered);
  final boolean defaultSnap=res.getBoolean(R.bool.default_circle_indicator_snap);
  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);
  a.recycle();
  final ViewConfiguration configuration=ViewConfiguration.get(context);
  mTouchSlop=ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
}
 

Example 55

From project 4308Cirrus, under directory /Extras/actionbarsherlock/src/com/actionbarsherlock/internal/view/menu/.

Source file: ActionMenuPresenter.java

  29 
vote

public static boolean reserveOverflow(Context context){
  TypedArray a=context.getTheme().obtainStyledAttributes(R.styleable.SherlockTheme);
  boolean result=a.getBoolean(R.styleable.SherlockTheme_absForceOverflow,false);
  a.recycle();
  if (result) {
    return true;
  }
  if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
    return (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB);
  }
 else {
    return !ViewConfiguration.get(context).hasPermanentMenuKey();
  }
}
 

Example 56

From project and-bible, under directory /AndBible/src/net/bible/android/view/activity/page/.

Source file: BibleGestureListener.java

  29 
vote

public BibleGestureListener(MainBibleActivity mainBibleActivity){
  super();
  this.mainBibleActivity=mainBibleActivity;
  scaledMinimumDistance=CommonUtils.convertDipsToPx(DISTANCE_DIP);
  minScaledVelocity=ViewConfiguration.get(mainBibleActivity).getScaledMinimumFlingVelocity();
  minScaledVelocity=(int)(minScaledVelocity * 0.66);
}
 

Example 57

From project Android-automation, under directory /Tmts_Java/src/com/taobao/tmts/framework/utils/.

Source file: ClickUtils.java

  29 
vote

/** 
 * Long clicks a given coordinate on the screen
 * @param x the x coordinate
 * @param y the y coordinate
 * @throws InterruptedException 
 */
public static void clickLongOnScreen(Instrumentation instrumentation,float x,float y) throws InterruptedException {
  long downTime=SystemClock.uptimeMillis();
  long eventTime=SystemClock.uptimeMillis();
  MotionEvent event=MotionEvent.obtain(downTime,eventTime,MotionEvent.ACTION_DOWN,x,y,0);
  try {
    instrumentation.sendPointerSync(event);
  }
 catch (  SecurityException e) {
    Assert.assertTrue("Click can not be completed! Something is in the way e.g. the keyboard.",false);
  }
  instrumentation.waitForIdleSync();
  eventTime=SystemClock.uptimeMillis();
  event=MotionEvent.obtain(downTime,eventTime,MotionEvent.ACTION_MOVE,x + ViewConfiguration.getTouchSlop() / 2,y + ViewConfiguration.getTouchSlop() / 2,0);
  instrumentation.sendPointerSync(event);
  instrumentation.waitForIdleSync();
  Thread.sleep((int)(ViewConfiguration.getLongPressTimeout() * 1.5f));
  eventTime=SystemClock.uptimeMillis();
  event=MotionEvent.obtain(downTime,eventTime,MotionEvent.ACTION_UP,x,y,0);
  instrumentation.sendPointerSync(event);
  instrumentation.waitForIdleSync();
}
 

Example 58

From project AndroidDevWeekendDub-BookLibrary, under directory /src/org/curiouscreature/android/shelves/view/.

Source file: ShelvesView.java

  29 
vote

@Override public void setPressed(boolean pressed){
  super.setPressed(pressed);
  final Drawable current=getSelector().getCurrent();
  if (current instanceof TransitionDrawable) {
    if (pressed) {
      ((TransitionDrawable)current).startTransition(ViewConfiguration.getLongPressTimeout());
    }
 else {
      ((TransitionDrawable)current).resetTransition();
    }
  }
}
 

Example 59

From project android_packages_apps_cmparts, under directory /src/com/cyanogenmod/cmparts/widgets/.

Source file: TouchInterceptor.java

  29 
vote

public TouchInterceptor(Context context,AttributeSet attrs){
  super(context,attrs);
  mTouchSlop=ViewConfiguration.get(context).getScaledTouchSlop();
  Resources res=getResources();
  mItemHeightNormal=res.getDimensionPixelSize(R.dimen.normal_height);
  mItemHeightHalf=mItemHeightNormal / 2;
  mItemHeightExpanded=res.getDimensionPixelSize(R.dimen.expanded_height);
}
 

Example 60

From project android_packages_apps_CMSettings, under directory /src/com/cyanogenmod/settings/widgets/.

Source file: TouchInterceptor.java

  29 
vote

public TouchInterceptor(Context context,AttributeSet attrs){
  super(context,attrs);
  mTouchSlop=ViewConfiguration.get(context).getScaledTouchSlop();
  Resources res=getResources();
  mItemHeightNormal=res.getDimensionPixelSize(R.dimen.normal_height);
  mItemHeightHalf=mItemHeightNormal / 2;
  mItemHeightExpanded=res.getDimensionPixelSize(R.dimen.expanded_height);
}
 

Example 61

From project android_packages_apps_phone, under directory /src/com/android/phone/.

Source file: InCallScreen.java

  29 
vote

public boolean onTouch(View v,MotionEvent event){
  if (VDBG)   log("onTouch(View " + v + ")...");
  if ((v == mTouchLockIcon) || (v == mTouchLockOverlay)) {
    if (!isTouchLocked()) {
      return false;
    }
    if (v == mTouchLockIcon) {
      if (event.getAction() == MotionEvent.ACTION_DOWN) {
        long now=SystemClock.uptimeMillis();
        if (VDBG)         log("- touch lock icon: handling a DOWN event, t = " + now);
        if (now < mTouchLockLastTouchTime + ViewConfiguration.getDoubleTapTimeout()) {
          if (VDBG)           log("==> touch lock icon: DOUBLE-TAP!");
          enableTouchLock(false);
          resetTouchLockTimer();
          PhoneApp.getInstance().pokeUserActivity();
        }
      }
 else       if (event.getAction() == MotionEvent.ACTION_UP) {
        mTouchLockLastTouchTime=SystemClock.uptimeMillis();
      }
      return true;
    }
 else {
      return true;
    }
  }
 else {
    Log.w(LOG_TAG,"onTouch: event from unexpected View: " + v);
    return false;
  }
}
 

Example 62

From project android_packages_apps_SalvageParts, under directory /src/com/salvagemod/salvageparts/widgets/.

Source file: TouchInterceptor.java

  29 
vote

public TouchInterceptor(Context context,AttributeSet attrs){
  super(context,attrs);
  mTouchSlop=ViewConfiguration.get(context).getScaledTouchSlop();
  Resources res=getResources();
  mItemHeightNormal=res.getDimensionPixelSize(R.dimen.normal_height);
  mItemHeightHalf=mItemHeightNormal / 2;
  mItemHeightExpanded=res.getDimensionPixelSize(R.dimen.expanded_height);
}
 

Example 63

From project Book-Catalogue, under directory /src/com/eleybourn/bookcatalogue/.

Source file: TouchListView.java

  29 
vote

public TouchListView(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  mTouchSlop=ViewConfiguration.get(context).getScaledTouchSlop();
  if (attrs != null) {
    TypedArray a=getContext().obtainStyledAttributes(attrs,R.styleable.TouchListView,0,0);
    mItemHeightNormal=a.getDimensionPixelSize(R.styleable.TouchListView_normal_height,0);
    mItemHeightExpanded=a.getDimensionPixelSize(R.styleable.TouchListView_expanded_height,mItemHeightNormal);
    grabberId=a.getResourceId(R.styleable.TouchListView_grabber,-1);
    dragndropBackgroundColor=a.getColor(R.styleable.TouchListView_dragndrop_background,0x00000000);
    mRemoveMode=a.getInt(R.styleable.TouchListView_remove_mode,-1);
    a.recycle();
  }
}
 

Example 64

From project Cafe, under directory /testservice/src/com/baidu/cafe/remote/.

Source file: UILib.java

  29 
vote

/** 
 * simulate key pad using key code
 * @param keyCode the code to be simulated
 * @param longPress true if need to press long, else false
 */
private void keypad(int keyCode,boolean longPress){
switch (EVENT_SENDER) {
case USE_INSTRUMENTATION:
    if (longPress) {
      mInstrumentation.sendKeySync(KeyEvent.changeFlags(new KeyEvent(KeyEvent.ACTION_DOWN,keyCode),KeyEvent.FLAG_LONG_PRESS));
    }
 else {
      mInstrumentation.sendKeyDownUpSync(keyCode);
    }
  break;
case USE_MONKEY:
new MonkeyNetwork().key(MonkeyNetwork.DOWN,keyCode);
if (longPress) {
SystemClock.sleep((int)(ViewConfiguration.getLongPressTimeout() * 1.5f));
}
new MonkeyNetwork().key(MonkeyNetwork.UP,keyCode);
break;
}
}
 

Example 65

From project CalendarView_1, under directory /src/org/kazzz/view/calendar/.

Source file: CalendarView.java

  29 
vote

/** 
 * ????????????????????????????
 * @param currentX ????????
 * @param velocityX X?????????
 * @param currentY ????????
 * @param velocityY Y?????????
 */
private boolean flickOrTaptoDate(float currentX,float velocityX,float currentY,float velocityY){
  int minimumFlingVelocity=ViewConfiguration.getMinimumFlingVelocity();
  velocityX=Math.abs(velocityX);
  velocityY=Math.abs(velocityY);
  if (velocityX < minimumFlingVelocity && velocityY < minimumFlingVelocity) {
    MonthlyCalendarView currentView=(MonthlyCalendarView)viewFlipper.getCurrentView();
    if (currentView != null) {
      boolean result=currentView.performClick();
      performSelectionCalendar(currentView);
      return result;
    }
  }
 else {
    int direction=(velocityY >= velocityX) ? DIRECTION_VERTICAL : DIRECTION_HORIZONTAL;
    boolean showNext=(direction == DIRECTION_VERTICAL) ? (currentY < lastTouchY) : (currentX < lastTouchX);
    calendar.add(Calendar.MONTH,showNext ? 1 : -1);
    if (showNext) {
      showNextMonth(direction);
    }
 else {
      showPreviousMonth(direction);
    }
  }
  return true;
}
 

Example 66

From project CHMI, under directory /src/it/sephiroth/android/library/imagezoom/.

Source file: ImageViewTouch.java

  29 
vote

@Override protected void init(){
  super.init();
  mTouchSlop=ViewConfiguration.getTouchSlop();
  mGestureListener=new GestureListener();
  mZoomPlusClickListener=new OnZoomPlusClickListener();
  mZoomMinusClickListener=new OnZoomMinusClickListener();
  mGestureDetector=new GestureDetector(getContext(),mGestureListener);
  mCurrentScaleFactor=1f;
  mDoubleTapDirection=1;
}
 

Example 67

From project cornerstone, under directory /frameworks/base/policy/src/com/android/internal/policy/impl/.

Source file: PhoneWindowManager.java

  29 
vote

private void interceptPowerKeyDown(boolean handled){
  mPowerKeyHandled=handled;
  if (!handled) {
    mHandler.postDelayed(mPowerLongPress,ViewConfiguration.getGlobalActionKeyTimeout());
  }
}
 

Example 68

From project COSsettings, under directory /src/com/cyanogenmod/cmparts/widgets/.

Source file: TouchInterceptor.java

  29 
vote

public TouchInterceptor(Context context,AttributeSet attrs){
  super(context,attrs);
  mTouchSlop=ViewConfiguration.get(context).getScaledTouchSlop();
  Resources res=getResources();
  mItemHeightNormal=res.getDimensionPixelSize(R.dimen.normal_height);
  mItemHeightHalf=mItemHeightNormal / 2;
  mItemHeightExpanded=res.getDimensionPixelSize(R.dimen.expanded_height);
}
 

Example 69

From project cow, under directory /libs/ActionBarSherlock/library/src/com/actionbarsherlock/internal/view/menu/.

Source file: ActionMenuPresenter.java

  29 
vote

public static boolean reserveOverflow(Context context){
  TypedArray a=context.getTheme().obtainStyledAttributes(R.styleable.SherlockTheme);
  boolean result=a.getBoolean(R.styleable.SherlockTheme_absForceOverflow,false);
  a.recycle();
  if (result) {
    return true;
  }
  if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
    return (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB);
  }
 else {
    return !ViewConfiguration.get(context).hasPermanentMenuKey();
  }
}
 

Example 70

From project creamed_glacier_app_settings, under directory /src/com/android/settings/cyanogenmod/.

Source file: TouchInterceptor.java

  29 
vote

public TouchInterceptor(Context context,AttributeSet attrs){
  super(context,attrs);
  mTouchSlop=ViewConfiguration.get(context).getScaledTouchSlop();
  Resources res=getResources();
  mItemHeightNormal=res.getDimensionPixelSize(R.dimen.normal_height);
  mItemHeightHalf=mItemHeightNormal / 2;
  mItemHeightExpanded=res.getDimensionPixelSize(R.dimen.expanded_height);
}
 

Example 71

From project danbooru-gallery-android, under directory /src/it/sephiroth/android/library/imagezoom/.

Source file: ImageViewTouch.java

  29 
vote

@Override protected void init(){
  super.init();
  mTouchSlop=ViewConfiguration.getTouchSlop();
  mGestureListener=new GestureListener();
  mScaleListener=new ScaleListener();
  mScaleDetector=new ScaleGestureDetector(getContext(),mScaleListener);
  mGestureDetector=new GestureDetector(getContext(),mGestureListener,null,true);
  mCurrentScaleFactor=1f;
}
 

Example 72

From project dccsched, under directory /src/com/underhilllabs/dccsched/ui/.

Source file: ScheduleActivity.java

  29 
vote

public FlingableTabHost(Context context,AttributeSet attrs){
  super(context,attrs);
  mRightInAnimation=AnimationUtils.loadAnimation(context,R.anim.slide_right_in);
  mRightOutAnimation=AnimationUtils.loadAnimation(context,R.anim.slide_right_out);
  mLeftInAnimation=AnimationUtils.loadAnimation(context,R.anim.slide_left_in);
  mLeftOutAnimation=AnimationUtils.loadAnimation(context,R.anim.slide_left_out);
  final int minScaledFlingVelocity=ViewConfiguration.get(context).getScaledMinimumFlingVelocity() * 10;
  mGestureDetector=new GestureDetector(new GestureDetector.SimpleOnGestureListener(){
    @Override public boolean onFling(    MotionEvent e1,    MotionEvent e2,    float velocityX,    float velocityY){
      int tabCount=getTabWidget().getTabCount();
      int currentTab=getCurrentTab();
      if (Math.abs(velocityX) > minScaledFlingVelocity && Math.abs(velocityY) < minScaledFlingVelocity) {
        final boolean right=velocityX < 0;
        final int newTab=MathUtils.constrain(currentTab + (right ? 1 : -1),0,tabCount - 1);
        if (newTab != currentTab) {
          View currentView=getCurrentView();
          setCurrentTab(newTab);
          View newView=getCurrentView();
          newView.startAnimation(right ? mRightInAnimation : mLeftInAnimation);
          currentView.startAnimation(right ? mRightOutAnimation : mLeftOutAnimation);
        }
      }
      return super.onFling(e1,e2,velocityX,velocityY);
    }
  }
);
}
 

Example 73

From project dmix, under directory /MPDroid/src/com/namelessdev/mpdroid/views/.

Source file: TouchInterceptor.java

  29 
vote

public TouchInterceptor(Context context,AttributeSet attrs){
  super(context,attrs);
  mRemoveMode=-1;
  mTouchSlop=ViewConfiguration.get(context).getScaledTouchSlop();
  Resources res=getResources();
  mItemHeightNormal=res.getDimensionPixelSize(R.dimen.normal_height);
  mItemHeightHalf=mItemHeightNormal / 2;
  mItemHeightExpanded=res.getDimensionPixelSize(R.dimen.expanded_height);
}
 

Example 74

From project droid-comic-viewer, under directory /src/net/robotmedia/acv/ui/widget/.

Source file: SuperImageView.java

  29 
vote

public void smoothScroll(MotionEvent motionEvent){
  if (mVelocityTracker == null) {
    mVelocityTracker=VelocityTracker.obtain();
  }
  mVelocityTracker.addMovement(motionEvent);
  final int action=motionEvent.getAction();
switch (action) {
case MotionEvent.ACTION_DOWN:
    abortScrollerAnimation();
  break;
case MotionEvent.ACTION_UP:
final VelocityTracker velocityTracker=mVelocityTracker;
velocityTracker.computeCurrentVelocity(1000);
int initialVelocityX=(int)velocityTracker.getXVelocity();
int initialVelocityY=(int)velocityTracker.getYVelocity();
int initialFilteredVelocityX=0;
int initialFilteredVelocityY=0;
if (Math.abs(initialVelocityX) > ViewConfiguration.getMinimumFlingVelocity()) {
initialFilteredVelocityX=-initialVelocityX;
}
if (Math.abs(initialVelocityY) > ViewConfiguration.getMinimumFlingVelocity()) {
initialFilteredVelocityY=-initialVelocityY;
}
if (initialFilteredVelocityX != 0 || initialFilteredVelocityY != 0) {
flingXY(initialFilteredVelocityX,initialFilteredVelocityY);
}
if (mVelocityTracker != null) {
mVelocityTracker.recycle();
mVelocityTracker=null;
}
break;
}
}
 

Example 75

From project ElectricSleep, under directory /src/com/androsz/electricsleepbeta/widget/calendar/.

Source file: MonthView.java

  29 
vote

@Override public boolean onKeyUp(int keyCode,KeyEvent event){
  final long duration=event.getEventTime() - event.getDownTime();
switch (keyCode) {
case KeyEvent.KEYCODE_DPAD_CENTER:
    if (mSelectionMode == SELECTION_HIDDEN) {
      break;
    }
  if (mSelectionMode == SELECTION_PRESSED) {
    mSelectionMode=SELECTION_SELECTED;
    mRedrawScreen=true;
    invalidate();
    break;
  }
if (duration < ViewConfiguration.getLongPressTimeout()) {
  final long millis=getSelectedTimeInMillis();
  reviewSleepIfNecessary(millis);
}
 else {
  mSelectionMode=SELECTION_LONGPRESS;
  mRedrawScreen=true;
  invalidate();
  performLongClick();
}
}
return super.onKeyUp(keyCode,event);
}
 

Example 76

From project flexymind-alpha, under directory /src/com/flexymind/alpha/customviews/.

Source file: PianoKeyboard.java

  29 
vote

public PianoKeyboard(Context context,AttributeSet attrs){
  super(context,attrs);
  parent=getRootView();
  parent.setOnTouchListener(this);
  mTouchSlop=ViewConfiguration.get(getContext()).getScaledTouchSlop();
}
 

Example 77

From project framework_base_policy, under directory /src/com/android/internal/policy/impl/.

Source file: PhoneWindowManager.java

  29 
vote

private void interceptPowerKeyDown(boolean handled){
  mPowerKeyHandled=handled;
  if (!handled) {
    mHandler.postDelayed(mPowerLongPress,ViewConfiguration.getGlobalActionKeyTimeout());
  }
}
 

Example 78

From project Gingerbread-Keyboard, under directory /src/com/android/inputmethod/latin/.

Source file: LatinKeyboard.java

  29 
vote

public SlidingLocaleDrawable(Drawable background,int width,int height){
  mBackground=background;
  setDefaultBounds(mBackground);
  mWidth=width;
  mHeight=height;
  mTextPaint=new TextPaint();
  mTextPaint.setTextSize(getTextSizeFromTheme(android.R.style.TextAppearance_Medium,18));
  mTextPaint.setColor(R.color.latinkeyboard_transparent);
  mTextPaint.setTextAlign(Align.CENTER);
  mTextPaint.setAlpha(OPACITY_FULLY_OPAQUE);
  mTextPaint.setAntiAlias(true);
  mMiddleX=(mWidth - mBackground.getIntrinsicWidth()) / 2;
  mLeftDrawable=mRes.getDrawable(R.drawable.sym_keyboard_feedback_language_arrows_left);
  mRightDrawable=mRes.getDrawable(R.drawable.sym_keyboard_feedback_language_arrows_right);
  mThreshold=ViewConfiguration.get(mContext).getScaledTouchSlop();
}
 

Example 79

From project iosched_1, under directory /src/com/google/android/apps/iosched/ui/.

Source file: ScheduleActivity.java

  29 
vote

public FlingableTabHost(Context context,AttributeSet attrs){
  super(context,attrs);
  mRightInAnimation=AnimationUtils.loadAnimation(context,R.anim.slide_right_in);
  mRightOutAnimation=AnimationUtils.loadAnimation(context,R.anim.slide_right_out);
  mLeftInAnimation=AnimationUtils.loadAnimation(context,R.anim.slide_left_in);
  mLeftOutAnimation=AnimationUtils.loadAnimation(context,R.anim.slide_left_out);
  final int minScaledFlingVelocity=ViewConfiguration.get(context).getScaledMinimumFlingVelocity() * 10;
  mGestureDetector=new GestureDetector(new GestureDetector.SimpleOnGestureListener(){
    @Override public boolean onFling(    MotionEvent e1,    MotionEvent e2,    float velocityX,    float velocityY){
      int tabCount=getTabWidget().getTabCount();
      int currentTab=getCurrentTab();
      if (Math.abs(velocityX) > minScaledFlingVelocity && Math.abs(velocityY) < minScaledFlingVelocity) {
        final boolean right=velocityX < 0;
        final int newTab=MathUtils.constrain(currentTab + (right ? 1 : -1),0,tabCount - 1);
        if (newTab != currentTab) {
          View currentView=getCurrentView();
          setCurrentTab(newTab);
          View newView=getCurrentView();
          newView.startAnimation(right ? mRightInAnimation : mLeftInAnimation);
          currentView.startAnimation(right ? mRightOutAnimation : mLeftOutAnimation);
        }
      }
      return super.onFling(e1,e2,velocityX,velocityY);
    }
  }
);
}
 

Example 80

From project Jota-Text-Editor, under directory /src/jp/sblo/pandora/jota/text/.

Source file: TextView.java

  29 
vote

public boolean onTouchEvent(MotionEvent event){
  if (isTextEditable()) {
switch (event.getAction() & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_DOWN:
      final int x=(int)event.getX();
    final int y=(int)event.getY();
  mMinTouchOffset=mMaxTouchOffset=getOffset(x,y);
long duration=SystemClock.uptimeMillis() - mPreviousTapUpTime;
if (duration <= ViewConfiguration.getDoubleTapTimeout()) {
final int deltaX=x - mPreviousTapPositionX;
final int deltaY=y - mPreviousTapPositionY;
final int distanceSquared=deltaX * deltaX + deltaY * deltaY;
final int doubleTapSlop=ViewConfiguration.get(getContext()).getScaledDoubleTapSlop();
final int slopSquared=doubleTapSlop * doubleTapSlop;
if (distanceSquared < slopSquared) {
  startTextSelectionMode();
  hide();
}
}
mPreviousTapPositionX=x;
mPreviousTapPositionY=y;
break;
case MotionEvent.ACTION_POINTER_DOWN:
case MotionEvent.ACTION_POINTER_UP:
break;
case MotionEvent.ACTION_UP:
mPreviousTapUpTime=SystemClock.uptimeMillis();
break;
}
}
return false;
}
 

Example 81

From project lullaby, under directory /src/net/sileht/lullaby/.

Source file: TouchInterceptor.java

  29 
vote

public TouchInterceptor(Context context,AttributeSet attrs){
  super(context,attrs);
  SharedPreferences pref=context.getSharedPreferences("Music",3);
  mRemoveMode=pref.getInt("deletemode",-1);
  mTouchSlop=ViewConfiguration.get(context).getScaledTouchSlop();
  Resources res=getResources();
  mItemHeightNormal=res.getDimensionPixelSize(R.dimen.normal_height);
  mItemHeightExpanded=res.getDimensionPixelSize(R.dimen.expanded_height);
}
 

Example 82

From project mp3tunes-android, under directory /src/com/mp3tunes/android/.

Source file: TouchInterceptor.java

  29 
vote

public TouchInterceptor(Context context,AttributeSet attrs){
  super(context,attrs);
  mContext=context;
  SharedPreferences pref=context.getSharedPreferences("Music",3);
  mRemoveMode=pref.getInt("deletemode",-1);
  mTouchSlop=ViewConfiguration.get(context).getScaledTouchSlop();
}
 

Example 83

From project packages_apps_BlackICEControl, under directory /src/com/blackice/control/widgets/.

Source file: TouchInterceptor.java

  29 
vote

public TouchInterceptor(Context context,AttributeSet attrs){
  super(context,attrs);
  mTouchSlop=ViewConfiguration.get(context).getScaledTouchSlop();
  Resources res=getResources();
  mItemHeightNormal=res.getDimensionPixelSize(R.dimen.normal_height);
  mItemHeightHalf=mItemHeightNormal / 2;
  mItemHeightExpanded=res.getDimensionPixelSize(R.dimen.expanded_height);
}
 

Example 84

From project packages_apps_God_Mode, under directory /src/com/t3hh4xx0r/god_mode/widgets/.

Source file: TouchInterceptor.java

  29 
vote

public TouchInterceptor(Context context,AttributeSet attrs){
  super(context,attrs);
  mTouchSlop=ViewConfiguration.get(context).getScaledTouchSlop();
  Resources res=getResources();
  mItemHeightNormal=res.getDimensionPixelSize(R.dimen.normal_height);
  mItemHeightHalf=mItemHeightNormal / 2;
  mItemHeightExpanded=res.getDimensionPixelSize(R.dimen.expanded_height);
}
 

Example 85

From project packages_apps_ROMControl, under directory /src/com/aokp/romcontrol/widgets/.

Source file: TouchInterceptor.java

  29 
vote

public TouchInterceptor(Context context,AttributeSet attrs){
  super(context,attrs);
  mTouchSlop=ViewConfiguration.get(context).getScaledTouchSlop();
  Resources res=getResources();
  mItemHeightNormal=res.getDimensionPixelSize(R.dimen.normal_height);
  mItemHeightHalf=mItemHeightNormal / 2;
  mItemHeightExpanded=res.getDimensionPixelSize(R.dimen.expanded_height);
}
 

Example 86

From project path_scroller, under directory /src/com/example/.

Source file: MyActivity.java

  29 
vote

private void initTextView(){
  stub=new Button(this);
  stub.setLayoutParams(new FrameLayout.LayoutParams(120,34));
  stub.setTextSize(14);
  stub.setText("0");
  stub.setTextColor(Color.WHITE);
  stub.setBackgroundColor(Color.argb(200,47,49,100));
  layout.addView(stub);
  animator=ObjectAnimator.ofFloat(stub,"alpha",1.0f,0.0f);
  animator.setStartDelay(ViewConfiguration.getScrollDefaultDelay() * 2);
  animator.setDuration(200);
}
 

Example 87

From project platform_packages_apps_contacts, under directory /src/com/android/contacts/activities/.

Source file: DialtactsActivity.java

  29 
vote

private void prepareSearchView(){
  final View searchViewLayout=getLayoutInflater().inflate(R.layout.dialtacts_custom_action_bar,null);
  mSearchView=(SearchView)searchViewLayout.findViewById(R.id.search_view);
  mSearchView.setOnQueryTextListener(mPhoneSearchQueryTextListener);
  mSearchView.setOnCloseListener(mPhoneSearchCloseListener);
  mSearchView.setIconifiedByDefault(true);
  mSearchView.setQueryHint(getString(R.string.hint_findContacts));
  mSearchView.setIconified(false);
  mSearchView.setOnQueryTextFocusChangeListener(new OnFocusChangeListener(){
    @Override public void onFocusChange(    View view,    boolean hasFocus){
      if (hasFocus) {
        showInputMethod(view.findFocus());
      }
    }
  }
);
  if (!ViewConfiguration.get(this).hasPermanentMenuKey()) {
    final View filterOptionView=searchViewLayout.findViewById(R.id.search_option);
    filterOptionView.setVisibility(View.VISIBLE);
    filterOptionView.setOnClickListener(mFilterOptionClickListener);
  }
  getActionBar().setCustomView(searchViewLayout,new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT));
}
 

Example 88

From project platform_packages_apps_CytownPhone, under directory /src/com/android/phone/.

Source file: InCallScreen.java

  29 
vote

public boolean onTouch(View v,MotionEvent event){
  if (VDBG)   log("onTouch(View " + v + ")...");
  if ((v == mTouchLockIcon) || (v == mTouchLockOverlay)) {
    if (!isTouchLocked()) {
      return false;
    }
    if (v == mTouchLockIcon) {
      if (event.getAction() == MotionEvent.ACTION_DOWN) {
        long now=SystemClock.uptimeMillis();
        if (VDBG)         log("- touch lock icon: handling a DOWN event, t = " + now);
        if (now < mTouchLockLastTouchTime + ViewConfiguration.getDoubleTapTimeout()) {
          if (VDBG)           log("==> touch lock icon: DOUBLE-TAP!");
          enableTouchLock(false);
          resetTouchLockTimer();
          PhoneApp.getInstance().pokeUserActivity();
        }
      }
 else       if (event.getAction() == MotionEvent.ACTION_UP) {
        mTouchLockLastTouchTime=SystemClock.uptimeMillis();
      }
      return true;
    }
 else {
      return true;
    }
  }
 else {
    Log.w(LOG_TAG,"onTouch: event from unexpected View: " + v);
    return false;
  }
}
 

Example 89

From project platform_packages_apps_music, under directory /src/com/android/music/.

Source file: TouchInterceptor.java

  29 
vote

public TouchInterceptor(Context context,AttributeSet attrs){
  super(context,attrs);
  SharedPreferences pref=context.getSharedPreferences("Music",3);
  mRemoveMode=pref.getInt("deletemode",-1);
  mTouchSlop=ViewConfiguration.get(context).getScaledTouchSlop();
  Resources res=getResources();
  mItemHeightNormal=res.getDimensionPixelSize(R.dimen.normal_height);
  mItemHeightHalf=mItemHeightNormal / 2;
  mItemHeightExpanded=res.getDimensionPixelSize(R.dimen.expanded_height);
}
 

Example 90

From project Saarang2013, under directory /src/com/views/.

Source file: MyListView.java

  29 
vote

/** 
 * Posts (and creates if necessary) a runnable that will when executed call the long click listener
 */
private void startLongPressCheck(){
  if (mLongPressRunnable == null) {
    mLongPressRunnable=new Runnable(){
      public void run(){
        if (mTouchState == TOUCH_STATE_CLICK) {
          final int index=getContainingChildIndex(mTouchStartX,mTouchStartY);
          if (index != INVALID_INDEX) {
            longClickChild(index);
          }
        }
      }
    }
;
  }
  postDelayed(mLongPressRunnable,ViewConfiguration.getLongPressTimeout());
}
 

Example 91

From project TodoBento, under directory /src/leoliang/tasks365/.

Source file: DraggableListView.java

  29 
vote

public DraggableListView(final Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  touchSlop=ViewConfiguration.get(context).getScaledTouchSlop();
  longPressDetector=new GestureDetector(getContext(),new SimpleOnGestureListener(){
    @Override public void onLongPress(    final MotionEvent e){
      int x=(int)e.getX();
      final int y=(int)e.getY();
      int itemnum=pointToPosition(x,y);
      if (itemnum == AdapterView.INVALID_POSITION) {
        return;
      }
      if (dragging != null) {
        dragging.stop();
        dragging=null;
      }
      final View item=getChildAt(itemnum - getFirstVisiblePosition());
      item.setPressed(false);
      dragging=new Dragging(getContext());
      dragging.start(y,((int)e.getRawY()) - y,item);
      draggingItemHoverPosition=itemnum;
      dragStartPosition=draggingItemHoverPosition;
      int height=getHeight();
      mUpperBound=Math.min(y - touchSlop,height / 3);
      mLowerBound=Math.max(y + touchSlop,height * 2 / 3);
    }
  }
);
  setOnItemLongClickListener(new OnItemLongClickListener(){
    @SuppressWarnings("unused") @Override public boolean onItemLongClick(    AdapterView<?> paramAdapterView,    View paramView,    int paramInt,    long paramLong){
      return true;
    }
  }
);
}
 

Example 92

From project tramhunter, under directory /android/TramHunter/src/com/andybotting/tramhunter/ui/.

Source file: TouchListView.java

  29 
vote

public TouchListView(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  mTouchSlop=ViewConfiguration.get(context).getScaledTouchSlop();
  if (attrs != null) {
    TypedArray a=getContext().obtainStyledAttributes(attrs,R.styleable.TouchListView,0,0);
    mItemHeightNormal=a.getDimensionPixelSize(R.styleable.TouchListView_normal_height,0);
    mItemHeightExpanded=a.getDimensionPixelSize(R.styleable.TouchListView_expanded_height,mItemHeightNormal);
    grabberId=a.getResourceId(R.styleable.TouchListView_grabber,-1);
    dragndropBackgroundColor=a.getColor(R.styleable.TouchListView_dragndrop_background,0x00000000);
    mRemoveMode=a.getInt(R.styleable.TouchListView_remove_mode,-1);
    a.recycle();
  }
}
 

Example 93

From project Wifileaks, under directory /WifiLeaks/ABS/library/src/com/actionbarsherlock/internal/view/menu/.

Source file: ActionMenuPresenter.java

  29 
vote

public static boolean reserveOverflow(Context context){
  TypedArray a=context.getTheme().obtainStyledAttributes(R.styleable.SherlockTheme);
  boolean result=a.getBoolean(R.styleable.SherlockTheme_absForceOverflow,false);
  a.recycle();
  if (result) {
    return true;
  }
  if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
    return (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB);
  }
 else {
    return !ViewConfiguration.get(context).hasPermanentMenuKey();
  }
}
 

Example 94

From project yammp, under directory /src/org/yammp/widget/.

Source file: TouchInterceptor.java

  29 
vote

public TouchInterceptor(Context context,AttributeSet attrs){
  super(context,attrs);
  mTouchSlop=ViewConfiguration.get(context).getScaledTouchSlop();
  Resources res=getResources();
  mItemHeightNormal=res.getDimensionPixelSize(R.dimen.normal_height);
  mItemHeightHalf=mItemHeightNormal / 2;
  mItemHeightExpanded=mItemHeightNormal * 2;
}
 

Example 95

From project Yeno-Checklist, under directory /src/com/yeno/checklist/view/.

Source file: TouchListView.java

  29 
vote

public TouchListView(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  mTouchSlop=ViewConfiguration.get(context).getScaledTouchSlop();
  if (attrs != null) {
    TypedArray a=getContext().obtainStyledAttributes(attrs,R.styleable.TouchListView,0,0);
    mItemHeightNormal=a.getDimensionPixelSize(R.styleable.TouchListView_normal_height,0);
    mItemHeightExpanded=a.getDimensionPixelSize(R.styleable.TouchListView_expanded_height,mItemHeightNormal);
    grabberId=a.getResourceId(R.styleable.TouchListView_grabber,-1);
    dragndropBackgroundColor=a.getColor(R.styleable.TouchListView_dragndrop_background,0x00000000);
    mRemoveMode=a.getInt(R.styleable.TouchListView_remove_mode,-1);
    a.recycle();
  }
}