Java Code Examples for android.view.GestureDetector

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 and-bible, under directory /AndBible/src/net/bible/android/view/activity/footnoteandref/.

Source file: FootnoteAndRefActivity.java

  21 
vote

/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  Log.i(TAG,"Displaying notes");
  setContentView(R.layout.notes);
  mWarning=(TextView)findViewById(R.id.warningText);
  mChapterNotesList=DataPipe.getInstance().popNotes();
  initialiseView();
  gestureDetector=new GestureDetector(new SwipeGestureListener(this));
}
 

Example 2

From project Android-GifStitch, under directory /src/com/phunkosis/gifstitch/views/.

Source file: GifView.java

  21 
vote

public void loadGif(String gifPath){
  BitmapFactory.Options o=new BitmapFactory.Options();
  o.inJustDecodeBounds=true;
  BitmapFactory.decodeFile(gifPath,o);
  this.mGestureDetector=new GestureDetector(mGestListener);
  this.mImageWidth=o.outWidth;
  this.mImageHeight=o.outHeight;
  Log.d(TAG,"Loading " + gifPath);
  this.loadUrl("file://" + gifPath);
  this.mGifPath=gifPath;
}
 

Example 3

From project android-thaiime, under directory /latinime/src/com/android/inputmethod/keyboard/.

Source file: LatinKeyboardView.java

  21 
vote

public LatinKeyboardView(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  mTouchScreenRegulator=new SuddenJumpingTouchEventHandler(getContext(),this);
  final Resources res=getResources();
  mConfigShowMiniKeyboardAtTouchedPoint=res.getBoolean(R.bool.config_show_mini_keyboard_at_touched_point);
  final float keyHysteresisDistance=res.getDimension(R.dimen.key_hysteresis_distance);
  mKeyDetector=new KeyDetector(keyHysteresisDistance);
  final boolean ignoreMultitouch=true;
  mGestureDetector=new GestureDetector(getContext(),new DoubleTapListener(),null,ignoreMultitouch);
  mGestureDetector.setIsLongpressEnabled(false);
  mHasDistinctMultitouch=context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT);
  mKeyRepeatInterval=res.getInteger(R.integer.config_key_repeat_interval);
  PointerTracker.init(mHasDistinctMultitouch,getContext());
}
 

Example 4

From project android-wheel, under directory /wheel/src/kankan/wheel/widget/.

Source file: WheelScroller.java

  21 
vote

/** 
 * Constructor
 * @param context the current context
 * @param listener the scrolling listener
 */
public WheelScroller(Context context,ScrollingListener listener){
  gestureDetector=new GestureDetector(context,gestureListener);
  gestureDetector.setIsLongpressEnabled(false);
  scroller=new Scroller(context);
  this.listener=listener;
  this.context=context;
}
 

Example 5

From project android-wheel-datetime-picker, under directory /src/kankan/wheel/widget/.

Source file: WheelScroller.java

  21 
vote

/** 
 * Constructor
 * @param context the current context
 * @param listener the scrolling listener
 */
public WheelScroller(Context context,ScrollingListener listener){
  gestureDetector=new GestureDetector(context,gestureListener);
  gestureDetector.setIsLongpressEnabled(false);
  scroller=new Scroller(context);
  this.listener=listener;
  this.context=context;
}
 

Example 6

From project android-wheel_1, under directory /wheel/src/kankan/wheel/widget/.

Source file: WheelScroller.java

  21 
vote

/** 
 * Constructor
 * @param context the current context
 * @param listener the scrolling listener
 */
public WheelScroller(Context context,ScrollingListener listener){
  gestureDetector=new GestureDetector(context,gestureListener);
  gestureDetector.setIsLongpressEnabled(false);
  scroller=new Scroller(context);
  this.listener=listener;
  this.context=context;
}
 

Example 7

From project android_ioio_combination_lock, under directory /src/kankan/wheel/widget/.

Source file: WheelScroller.java

  21 
vote

/** 
 * Constructor
 * @param context the current context
 * @param listener the scrolling listener
 */
public WheelScroller(Context context,ScrollingListener listener){
  gestureDetector=new GestureDetector(context,gestureListener);
  gestureDetector.setIsLongpressEnabled(false);
  scroller=new Scroller(context);
  this.listener=listener;
  this.context=context;
}
 

Example 8

From project android_packages_apps_Gallery, under directory /src/com/android/camera/.

Source file: GridViewSpecial.java

  21 
vote

private void init(Context context){
  setVerticalScrollBarEnabled(true);
  initializeScrollbars(context.obtainStyledAttributes(android.R.styleable.View));
  mGestureDetector=new GestureDetector(context,new MyGestureDetector());
  setFocusableInTouchMode(true);
  initCellSize();
}
 

Example 9

From project android_packages_apps_Gallery2, under directory /src/com/android/gallery3d/ui/.

Source file: GestureRecognizer.java

  21 
vote

public GestureRecognizer(Context context,Listener listener){
  mListener=listener;
  mGestureDetector=new GestureDetector(context,new MyGestureListener(),null,true);
  mScaleDetector=new ScaleGestureDetector(context,new MyScaleListener());
  mDownUpDetector=new DownUpDetector(new MyDownUpListener());
}
 

Example 10

From project android_packages_inputmethods_LatinIME, under directory /java/src/com/android/inputmethod/keyboard/.

Source file: LatinKeyboardView.java

  21 
vote

public LatinKeyboardView(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  mTouchScreenRegulator=new SuddenJumpingTouchEventHandler(getContext(),this);
  final Resources res=getResources();
  mConfigShowMiniKeyboardAtTouchedPoint=res.getBoolean(R.bool.config_show_mini_keyboard_at_touched_point);
  final float keyHysteresisDistance=res.getDimension(R.dimen.key_hysteresis_distance);
  mKeyDetector=new KeyDetector(keyHysteresisDistance);
  final boolean ignoreMultitouch=true;
  mGestureDetector=new GestureDetector(getContext(),new DoubleTapListener(),null,ignoreMultitouch);
  mGestureDetector.setIsLongpressEnabled(false);
  mHasDistinctMultitouch=context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT);
  mKeyRepeatInterval=res.getInteger(R.integer.config_key_repeat_interval);
  PointerTracker.init(mHasDistinctMultitouch,getContext());
}
 

Example 11

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

Source file: ImageViewTouch.java

  21 
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 12

From project CityBikes, under directory /src/net/homelinux/penecoptero/android/citybikes/app/.

Source file: MainActivity.java

  21 
vote

protected void applyMapViewLongPressListener(MapView mapView){
  final MapView finalMapView=mapView;
  final GestureDetector gd=new GestureDetector(new GestureDetector.SimpleOnGestureListener(){
    @Override public void onLongPress(    MotionEvent e){
      Projection astral=finalMapView.getProjection();
      GeoPoint center=astral.fromPixels((int)e.getX(),(int)e.getY());
      locator.lockCenter(center);
    }
    @Override public boolean onDoubleTap(    MotionEvent e){
      Projection astral=finalMapView.getProjection();
      GeoPoint center=astral.fromPixels((int)e.getX(),(int)e.getY());
      locator.lockCenter(center);
      return super.onDoubleTap(e);
    }
  }
);
  mapView.setOnTouchListener(new OnTouchListener(){
    @Override public boolean onTouch(    View v,    MotionEvent ev){
      return gd.onTouchEvent(ev);
    }
  }
);
}
 

Example 13

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

Source file: ImageViewTouch.java

  21 
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 14

From project droid-fu, under directory /src/main/java/com/github/droidfu/activities/.

Source file: BetterMapActivity.java

  21 
vote

protected void setMapGestureListener(MapGestureListener mapGestureListener){
  tapDetector=new GestureDetector(mapGestureListener);
  tapListener=new View.OnTouchListener(){
    public boolean onTouch(    View v,    MotionEvent event){
      if (tapDetector.onTouchEvent(event)) {
        return true;
      }
      return false;
    }
  }
;
  mapView.setOnTouchListener(tapListener);
}
 

Example 15

From project fanfoudroid, under directory /src/com/ch_linghu/fanfoudroid/ui/module/.

Source file: FlingGestureListener.java

  21 
vote

public FlingGestureListener(Activity activity,Widget.OnGestureListener listener,GestureDetector gDetector){
  if (gDetector == null) {
    gDetector=new GestureDetector(activity,this);
  }
  this.gDetector=gDetector;
  mListener=listener;
  this.activity=activity;
}
 

Example 16

From project GeekAlarm, under directory /android/src/kankan/wheel/widget/.

Source file: WheelScroller.java

  21 
vote

/** 
 * Constructor
 * @param context the current context
 * @param listener the scrolling listener
 */
public WheelScroller(Context context,ScrollingListener listener){
  gestureDetector=new GestureDetector(context,gestureListener);
  gestureDetector.setIsLongpressEnabled(false);
  scroller=new Scroller(context);
  this.listener=listener;
  this.context=context;
}
 

Example 17

From project ICS_LatinIME_QHD, under directory /java/src/com/android/inputmethod/keyboard/.

Source file: LatinKeyboardView.java

  21 
vote

public LatinKeyboardView(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  mTouchScreenRegulator=new SuddenJumpingTouchEventHandler(getContext(),this);
  final Resources res=getResources();
  mConfigShowMiniKeyboardAtTouchedPoint=res.getBoolean(R.bool.config_show_mini_keyboard_at_touched_point);
  final float keyHysteresisDistance=res.getDimension(R.dimen.key_hysteresis_distance);
  mKeyDetector=new KeyDetector(keyHysteresisDistance);
  final boolean ignoreMultitouch=true;
  mGestureDetector=new GestureDetector(getContext(),new DoubleTapListener(),null,ignoreMultitouch);
  mGestureDetector.setIsLongpressEnabled(false);
  mHasDistinctMultitouch=context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT);
  mKeyRepeatInterval=res.getInteger(R.integer.config_key_repeat_interval);
  PointerTracker.init(mHasDistinctMultitouch,getContext());
}
 

Example 18

From project liquidroid, under directory /src/liqui/droid/util/.

Source file: IndexableListView.java

  21 
vote

@Override public boolean onTouchEvent(MotionEvent ev){
  if (mScroller != null && mScroller.onTouchEvent(ev))   return true;
  if (mGestureDetector == null) {
    mGestureDetector=new GestureDetector(getContext(),new GestureDetector.SimpleOnGestureListener(){
      @Override public boolean onFling(      MotionEvent e1,      MotionEvent e2,      float velocityX,      float velocityY){
        if (mScroller != null)         mScroller.show();
        return super.onFling(e1,e2,velocityX,velocityY);
      }
    }
);
  }
  mGestureDetector.onTouchEvent(ev);
  return super.onTouchEvent(ev);
}
 

Example 19

From project mapdroid, under directory /src/au/id/tedp/mapdroid/.

Source file: OSMMapView.java

  21 
vote

public OSMMapView(Context context,AttributeSet attrs){
  super(context,attrs);
  visibleTiles=new ArrayList<Tile>(6);
  tileServer=new TileServer();
  tileSize=tileServer.getTileSize();
  motionHandler=new MotionHandler(this);
  gestureDetector=new GestureDetector(motionHandler);
  gestureDetector.setIsLongpressEnabled(false);
  handler=new MapViewHandler();
  messenger=new Messenger(handler);
}
 

Example 20

From project mediaphone, under directory /src/ac/robinson/mediaphone/view/.

Source file: HorizontalListView.java

  21 
vote

private void initView(){
  resetView();
  mScroller=new Scroller(getContext());
  mGestureDetector=new GestureDetector(getContext(),mGestureListener);
  mGestureDetector.setIsLongpressEnabled(false);
  setOnTouchListener(new FingerTracker());
  setOnItemSelectedListener(new SelectionTracker());
}
 

Example 21

From project OpenBike, under directory /src/fr/openbike/android/ui/.

Source file: MyLocationOverlay.java

  21 
vote

public MyLocationOverlay(Context context,MapView mapView){
  mMarker=BitmapFactory.decodeResource(context.getResources(),R.drawable.ic_maps_indicator_current_position);
  mShiftX=mMarker.getWidth() / 2;
  mShiftY=mMarker.getHeight() / 2;
  mGestureDetector=new GestureDetector(context,new ZoomOnGestureListener(mapView));
  paint.setAntiAlias(true);
}
 

Example 22

From project packages_apps_Camera_1, under directory /src/com/android/camera/.

Source file: VideoCamera.java

  21 
vote

private void initializeIndicatorControl(){
  mIndicatorControlContainer=(IndicatorControlContainer)findViewById(R.id.indicator_control);
  if (mIndicatorControlContainer == null)   return;
  loadCameraPreferences();
  final String[] SETTING_KEYS={CameraSettings.KEY_VIDEOCAMERA_FLASH_MODE,CameraSettings.KEY_WHITE_BALANCE,CameraSettings.KEY_VIDEO_EFFECT,CameraSettings.KEY_VIDEO_TIME_LAPSE_FRAME_INTERVAL,CameraSettings.KEY_VIDEO_QUALITY};
  final String[] OTHER_SETTING_KEYS={CameraSettings.KEY_RECORD_LOCATION};
  CameraPicker.setImageResourceId(R.drawable.ic_switch_video_facing_holo_light);
  mIndicatorControlContainer.initialize(this,mPreferenceGroup,mParameters.isZoomSupported(),SETTING_KEYS,OTHER_SETTING_KEYS);
  mIndicatorControlContainer.setListener(this);
  mPopupGestureDetector=new GestureDetector(this,new PopupGestureListener());
  if (effectsActive()) {
    mIndicatorControlContainer.overrideSettings(CameraSettings.KEY_VIDEO_QUALITY,Integer.toString(CamcorderProfile.QUALITY_480P));
  }
}
 

Example 23

From project packages_apps_Camera_2, under directory /src/com/android/camera/.

Source file: VideoCamera.java

  21 
vote

private void initializeIndicatorControl(){
  mIndicatorControlContainer=(IndicatorControlContainer)findViewById(R.id.indicator_control);
  if (mIndicatorControlContainer == null)   return;
  loadCameraPreferences();
  final String[] SETTING_KEYS={CameraSettings.KEY_VIDEOCAMERA_FLASH_MODE,CameraSettings.KEY_WHITE_BALANCE,CameraSettings.KEY_VIDEO_EFFECT,CameraSettings.KEY_VIDEO_TIME_LAPSE_FRAME_INTERVAL,CameraSettings.KEY_VIDEO_QUALITY};
  final String[] OTHER_SETTING_KEYS={CameraSettings.KEY_RECORD_LOCATION};
  CameraPicker.setImageResourceId(R.drawable.ic_switch_video_facing_holo_light);
  mIndicatorControlContainer.initialize(this,mPreferenceGroup,mParameters.isZoomSupported(),SETTING_KEYS,OTHER_SETTING_KEYS);
  mIndicatorControlContainer.setListener(this);
  mPopupGestureDetector=new GestureDetector(this,new PopupGestureListener());
  if (effectsActive()) {
    mIndicatorControlContainer.overrideSettings(CameraSettings.KEY_VIDEO_QUALITY,Integer.toString(CamcorderProfile.QUALITY_480P));
  }
}
 

Example 24

From project platform_packages_apps_Gallery, under directory /src/com/android/camera/.

Source file: GridViewSpecial.java

  21 
vote

private void init(Context context){
  setVerticalScrollBarEnabled(true);
  initializeScrollbars(context.obtainStyledAttributes(android.R.styleable.View));
  mGestureDetector=new GestureDetector(context,new MyGestureDetector());
  setFocusableInTouchMode(true);
  initCellSize();
}
 

Example 25

From project QuickSnap, under directory /Camera/src/com/lightbox/android/camera/activities/.

Source file: Camera.java

  21 
vote

private void initializeZoom(){
  if (!isZoomSupported())   return;
  mZoomMax=getMaxZoom();
  mSmoothZoomSupported=isSmoothZoomSupported();
  mGestureDetector=new GestureDetector(this,new ZoomGestureListener());
  mCameraDevice.setZoomChangeListener(mZoomListener);
}
 

Example 26

From project QuotaForAndroid, under directory /wheel/src/kankan/wheel/widget/.

Source file: WheelScroller.java

  21 
vote

/** 
 * Constructor
 * @param context the current context
 * @param listener the scrolling listener
 */
public WheelScroller(Context context,ScrollingListener listener){
  gestureDetector=new GestureDetector(context,gestureListener);
  gestureDetector.setIsLongpressEnabled(false);
  scroller=new Scroller(context);
  this.listener=listener;
  this.context=context;
}
 

Example 27

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

Source file: ActionButton.java

  21 
vote

public ActionButton(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  setHapticFeedbackEnabled(true);
  TypedArray a=context.obtainStyledAttributes(attrs,R.styleable.ActionButton,defStyle,0);
  mIdent=a.getInt(R.styleable.ActionButton_ident,mIdent);
  mOrientation=a.getInt(R.styleable.ActionButton_direction,ORIENTATION_HORIZONTAL);
  bgEmpty=context.getResources().getDrawable(R.drawable.lab_rab_empty_bg);
  a.recycle();
  mGestureListener=new ABGestureListener();
  mGestureDetector=new GestureDetector(context,mGestureListener);
  this.setOnLongClickListener(this);
}
 

Example 28

From project ToolkitForAndroid, under directory /src/main/java/com/apkits/android/widget/.

Source file: GalleryFlipper.java

  21 
vote

private void init(Context context){
  mContext=context;
  mAdapter=null;
  mViewCaches=new FlingGalleryView[3];
  mViewCaches[0]=new FlingGalleryView(0,this);
  mViewCaches[1]=new FlingGalleryView(1,this);
  mViewCaches[2]=new FlingGalleryView(2,this);
  mAnimation=new FlingGalleryAnimation();
  mGestureDetector=new GestureDetector(new FlingGestureDetector());
  mDecelerateInterpolater=AnimationUtils.loadInterpolator(mContext,android.R.anim.decelerate_interpolator);
}
 

Example 29

From project Wake-Me-At, under directory /src/uk/co/spookypeanut/wake_me_at/.

Source file: GetLocationMap.java

  21 
vote

public DestOverlay(Context context,double lat,double lon,double radius){
  oContext=context;
  mLat=lat;
  mLon=lon;
  mRadius=radius;
  gestureDetector=new GestureDetector(this);
  gestureDetector.setOnDoubleTapListener((OnDoubleTapListener)this);
}
 

Example 30

From project aksunai, under directory /src/org/androidnerds/app/aksunai/ui/.

Source file: ChatActivity.java

  20 
vote

@Override public void onCreate(Bundle appState){
  super.onCreate(appState);
  setContentView(R.layout.chat);
  slideLeftIn=AnimationUtils.loadAnimation(this,R.anim.slide_left_in);
  slideLeftOut=AnimationUtils.loadAnimation(this,R.anim.slide_left_out);
  slideRightIn=AnimationUtils.loadAnimation(this,R.anim.slide_right_in);
  slideRightOut=AnimationUtils.loadAnimation(this,R.anim.slide_right_out);
  mFlipper=(ViewFlipper)findViewById(R.id.chat_flipper);
  entry=(EditText)findViewById(R.id.ircedit);
  entry.setSingleLine();
  entry.setOnKeyListener(mKeyListener);
  Button btnSend=(Button)findViewById(R.id.btnSend);
  btnSend.setOnClickListener(mClickListener);
  gestureDetector=new GestureDetector(new MyGestureDetector());
  gestureListener=new View.OnTouchListener(){
    public boolean onTouch(    View v,    MotionEvent event){
      return gestureDetector.onTouchEvent(event);
    }
  }
;
  mFlipper.setOnTouchListener(gestureListener);
  mNotificationManager=(NotificationManager)getSystemService(NOTIFICATION_SERVICE);
}
 

Example 31

From project android-mapviewballoons, under directory /android-mapviewballoons/src/com/readystatesoftware/maps/.

Source file: TapControlledMapView.java

  20 
vote

private void setupGestures(){
  gd=new GestureDetector(this);
  gd.setOnDoubleTapListener(new OnDoubleTapListener(){
    @Override public boolean onSingleTapConfirmed(    MotionEvent e){
      if (singleTapListener != null) {
        return singleTapListener.onSingleTap(e);
      }
 else {
        return false;
      }
    }
    @Override public boolean onDoubleTap(    MotionEvent e){
      TapControlledMapView.this.getController().zoomInFixing((int)e.getX(),(int)e.getY());
      return false;
    }
    @Override public boolean onDoubleTapEvent(    MotionEvent e){
      return false;
    }
  }
);
}
 

Example 32

From project Android-Terminal-Emulator, under directory /libraries/emulatorview/src/jackpal/androidterm/emulatorview/.

Source file: EmulatorView.java

  20 
vote

/** 
 * Attach a  {@link TermSession} to this view.
 * @param session The {@link TermSession} this view will be displaying.
 */
public void attachSession(TermSession session){
  mTextRenderer=null;
  mCursorPaint=new Paint();
  mCursorPaint.setARGB(255,128,128,128);
  mForegroundPaint=new Paint();
  mBackgroundPaint=new Paint();
  mTopRow=0;
  mLeftColumn=0;
  mGestureDetector=new GestureDetector(this);
  setVerticalScrollBarEnabled(true);
  setFocusable(true);
  setFocusableInTouchMode(true);
  mTermSession=session;
  mKeyListener=new TermKeyListener(session);
  if (mDeferInit) {
    mDeferInit=false;
    mKnownSize=true;
    initialize();
  }
}
 

Example 33

From project android-tether, under directory /android-misc-widgets/src/org/miscwidgets/widget/.

Source file: Panel.java

  20 
vote

public Panel(Context context,AttributeSet attrs){
  super(context,attrs);
  TypedArray a=context.obtainStyledAttributes(attrs,R.styleable.Panel);
  mDuration=a.getInteger(R.styleable.Panel_animationDuration,750);
  mPosition=a.getInteger(R.styleable.Panel_position,BOTTOM);
  mLinearFlying=a.getBoolean(R.styleable.Panel_linearFlying,false);
  mWeight=a.getFraction(R.styleable.Panel_weight,0,1,0.0f);
  if (mWeight < 0 || mWeight > 1) {
    mWeight=0.0f;
    Log.w(TAG,a.getPositionDescription() + ": weight must be > 0 and <= 1");
  }
  mOpenedHandle=a.getDrawable(R.styleable.Panel_openedHandle);
  mClosedHandle=a.getDrawable(R.styleable.Panel_closedHandle);
  RuntimeException e=null;
  mHandleId=a.getResourceId(R.styleable.Panel_handle,0);
  if (mHandleId == 0) {
    e=new IllegalArgumentException(a.getPositionDescription() + ": The handle attribute is required and must refer to a valid child.");
  }
  mContentId=a.getResourceId(R.styleable.Panel_content,0);
  if (mContentId == 0) {
    e=new IllegalArgumentException(a.getPositionDescription() + ": The content attribute is required and must refer to a valid child.");
  }
  a.recycle();
  if (e != null) {
    throw e;
  }
  mOrientation=(mPosition == TOP || mPosition == BOTTOM) ? VERTICAL : HORIZONTAL;
  setOrientation(mOrientation);
  mState=State.READY;
  mGestureListener=new PanelOnGestureListener();
  mGestureDetector=new GestureDetector(mGestureListener);
  mGestureDetector.setIsLongpressEnabled(false);
  setBaselineAligned(false);
}
 

Example 34

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

Source file: ImmoscoutPlacesOverlay.java

  20 
vote

public ImmoscoutPlacesOverlay(Fragment fragment,MapView mapView,LayoutInflater inflator,boolean isPortfolio){
  super(boundCenter(fragment.getResources().getDrawable(R.drawable.map_marker_icon)));
  mMapView=mapView;
  this.isPortfolio=isPortfolio;
  mMapFragment=fragment;
  Resources resources=fragment.getResources();
  mapMarkerIcon=boundCenter(resources.getDrawable(R.drawable.map_marker_icon));
  mapMarkerIcon_new=boundCenter(resources.getDrawable(R.drawable.map_marker_icon_new));
  mapMarkerIcon_old=boundCenter(resources.getDrawable(R.drawable.map_marker_icon_old));
  mapMarkerIcon_owned=boundCenter(resources.getDrawable(R.drawable.map_marker_property_icon));
  mapMarkerIcon_cluster=boundCenter(resources.getDrawable(R.drawable.map_marker_icon_cluster));
  markerBounds=mapMarkerIcon.getBounds();
  MIN_INTERSECTION_AREA=(int)(markerBounds.width() * markerBounds.height() * MIN_INTERSECTION_AMOUNT);
  ClusterMarker.init(resources.getDisplayMetrics(),mapMarkerIcon.getIntrinsicHeight());
  gestureDetector=new GestureDetector(new GestureDetector.SimpleOnGestureListener(){
    public boolean onDoubleTap(    MotionEvent e){
      if (System.currentTimeMillis() - itemTapTime > 500)       mMapView.getController().zoomInFixing((int)e.getX(),(int)e.getY());
      return super.onDoubleTap(e);
    }
  }
);
}
 

Example 35

From project android_packages_apps_Gallery3D, under directory /src/com/cooliris/media/.

Source file: GridInputProcessor.java

  20 
vote

public GridInputProcessor(Context context,GridCamera camera,GridLayer layer,RenderView view,Pool<Vector3f> pool,DisplayItem[] displayItems){
  mPool=pool;
  mCamera=camera;
  mLayer=layer;
  mCurrentFocusSlot=Shared.INVALID;
  mCurrentSelectedSlot=Shared.INVALID;
  mCurrentScaleSlot=Shared.INVALID;
  mContext=context;
  mDisplayItems=displayItems;
  mGestureDetector=new GestureDetector(context,this);
  mScaleGestureDetector=new ScaleGestureDetector(context,this);
  mGestureDetector.setIsLongpressEnabled(true);
  mZoomGesture=false;
  mScale=1.0f;
  mSupportPanAndZoom=context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH);
{
    WindowManager windowManager=(WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
    mDisplay=windowManager.getDefaultDisplay();
  }
}
 

Example 36

From project BibleQuote-for-Android, under directory /src/com/BibleQuote/controls/.

Source file: ReaderWebView.java

  20 
vote

public ReaderWebView(Context mContext,AttributeSet attributeSet){
  super(mContext,attributeSet);
  WebSettings settings=getSettings();
  settings.setJavaScriptEnabled(true);
  settings.setNeedInitialFocus(false);
  settings.setBuiltInZoomControls(false);
  settings.setSupportZoom(false);
  setFocusable(true);
  setFocusableInTouchMode(true);
  setWebViewClient(new webClient());
  setWebChromeClient(new chromeClient());
  this.jsInterface=new JavaScriptInterface();
  addJavascriptInterface(this.jsInterface,"reader");
  setVerticalScrollbarOverlay(true);
  mGestureScanner=new GestureDetector(mContext,this);
  mGestureScanner.setIsLongpressEnabled(true);
  mGestureScanner.setOnDoubleTapListener(this);
}
 

Example 37

From project BookingRoom, under directory /src/org/androidaalto/bookingroom/view/.

Source file: WeekView.java

  20 
vote

/** 
 * Initializes all the parameters needed to draw this view.
 * @param context
 */
private void init(Context context){
  mContext=context;
  calculateScaleFonts();
  MeetingGeometry.setMinEventHeight(MIN_EVENT_HEIGHT);
  MeetingGeometry.setHourGap(HOUR_GAP);
  mResources=this.getContext().getResources();
  mGestureDetector=new GestureDetector(context,new GestureListener(this));
  initTimeAndDates();
  initNavigationButtons();
  initColors();
  initDayStrings();
  recalc();
  loadMeetings(mBaseDate);
  MeetingManager.addMeetingEventListener(this);
}
 

Example 38

From project daily-money, under directory /dailymoney/src/com/bottleworks/dailymoney/calculator2/.

Source file: PanelSwitcher.java

  20 
vote

public PanelSwitcher(Context context,AttributeSet attrs){
  super(context,attrs);
  mCurrentView=0;
  mGestureDetector=new GestureDetector(context,new GestureDetector.SimpleOnGestureListener(){
    public boolean onFling(    MotionEvent e1,    MotionEvent e2,    float velocityX,    float velocityY){
      int dx=(int)(e2.getX() - e1.getX());
      if (Math.abs(dx) > MAJOR_MOVE && Math.abs(velocityX) > Math.abs(velocityY)) {
        if (velocityX > 0) {
          moveRight();
        }
 else {
          moveLeft();
        }
        return true;
      }
 else {
        return false;
      }
    }
  }
);
}
 

Example 39

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

Source file: ScheduleActivity.java

  20 
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 40

From project FlickrCity, under directory /src/com/FlickrCity/FlickrCityAndroid/Activities/.

Source file: PhotoActivity.java

  20 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.photo);
  Bundle extras=getIntent().getExtras();
  if (extras != null) {
    newUrl=extras.getString(Constants.URL_KEY);
    owner=extras.getString(Constants.USERNAME_KEY);
    title=extras.getString(Constants.TITLE_KEY);
    flickrPhotoID=extras.getString(Constants.PHOTO_ID_KEY);
    urls_list=extras.getStringArrayList(Constants.URLS_LIST_KEY);
    current_position=extras.getInt(Constants.CURRENT_POSITION);
    mCity=extras.getString(Constants.CITY_NAME_KEY);
    geoTextInfo=extras.getString(Constants.CITY_GEO_INFO_KEY);
  }
  TextView citytext=(TextView)findViewById(R.id.textviewcityname_photo);
  citytext.setText(mCity);
  TextView text_view_lat_lon=(TextView)findViewById(R.id.text_view_lat_lon_photo);
  text_view_lat_lon.setText(geoTextInfo);
  iv=(ImageView)findViewById(R.id.picture_full_size);
  text_username=(TextView)findViewById(R.id.photo_username);
  text_title=(TextView)findViewById(R.id.photo_title);
  gestureDetector=new GestureDetector(new MyGestureDetector());
  ImageButton addToFavButton=(ImageButton)findViewById(R.id.addToFavoriteBtn);
  addToFavButton.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      addToFavorites();
    }
  }
);
  new BitmapDownloaderTask(PhotoActivity.this).execute(newUrl);
  text_username.setText("By: " + owner);
  if (!"".equals(title))   text_title.setText(title);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
  mSettings=PreferenceManager.getDefaultSharedPreferences(this);
}
 

Example 41

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

Source file: CandidateView.java

  20 
vote

/** 
 * Construct a CandidateView for showing suggested words for completion.
 * @param context
 * @param attrs
 */
public CandidateView(Context context,AttributeSet attrs){
  super(context,attrs);
  mSelectionHighlight=context.getResources().getDrawable(R.drawable.list_selector_background_pressed);
  LayoutInflater inflate=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  Resources res=context.getResources();
  mPreviewPopup=new PopupWindow(context);
  mPreviewText=(TextView)inflate.inflate(R.layout.candidate_preview,null);
  mPreviewPopup.setWindowLayoutMode(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
  mPreviewPopup.setContentView(mPreviewText);
  mPreviewPopup.setBackgroundDrawable(null);
  mPreviewPopup.setAnimationStyle(R.style.KeyPreviewAnimation);
  mColorNormal=res.getColor(R.color.candidate_normal);
  mColorRecommended=res.getColor(R.color.candidate_recommended);
  mColorOther=res.getColor(R.color.candidate_other);
  mDivider=res.getDrawable(R.drawable.keyboard_suggest_strip_divider);
  mAddToDictionaryHint=res.getString(R.string.hint_add_to_dictionary);
  mPaint=new Paint();
  mPaint.setColor(mColorNormal);
  mPaint.setAntiAlias(true);
  mPaint.setTextSize(mPreviewText.getTextSize());
  mPaint.setStrokeWidth(0);
  mPaint.setTextAlign(Align.CENTER);
  mDescent=(int)mPaint.descent();
  mMinTouchableWidth=(int)res.getDimension(R.dimen.candidate_min_touchable_width);
  mGestureDetector=new GestureDetector(new CandidateStripGestureListener(mMinTouchableWidth));
  setWillNotDraw(false);
  setHorizontalScrollBarEnabled(false);
  setVerticalScrollBarEnabled(false);
  scrollTo(0,getScrollY());
}
 

Example 42

From project Gmote, under directory /gmoteclient/src/org/gmote/client/android/.

Source file: RemoteDesktop.java

  20 
vote

@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  Log.d(DEBUG_TAG,"RemoteDesktop# oncreate");
  mUtil=new ActivityUtil();
  mUtil.onCreate(icicle,this);
  remoteInstance=Remote.getInstance();
  main=new BitmapView(this);
  tileCanvas=new Canvas();
  tileRect=new Rect();
  bmRect=new Rect();
  gestureDetector=new GestureDetector(gestureListener);
  gestureDetector.setIsLongpressEnabled(true);
  setContentView(main);
  new Thread(new PainterThread()).start();
  new Thread(new TilerThread()).start();
}
 

Example 43

From project GSM-Signal-Tracking-, under directory /gpstracker/src/nl/sogeti/android/gpstracker/actions/.

Source file: Statistics.java

  20 
vote

/** 
 * Called when the activity is first created.
 */
@Override protected void onCreate(Bundle load){
  super.onCreate(load);
  mUnits=new UnitsI18n(this,new UnitsI18n.UnitsChangeListener(){
    public void onUnitsChange(){
      drawTrackingStatistics();
    }
  }
);
  setContentView(R.layout.statistics);
  mCalculator=new StatisticsCalulator(this,mUnits);
  mViewFlipper=(ViewFlipper)findViewById(R.id.flipper);
  mSlideLeftIn=AnimationUtils.loadAnimation(this,R.anim.slide_left_in);
  mSlideLeftOut=AnimationUtils.loadAnimation(this,R.anim.slide_left_out);
  mSlideRightIn=AnimationUtils.loadAnimation(this,R.anim.slide_right_in);
  mSlideRightOut=AnimationUtils.loadAnimation(this,R.anim.slide_right_out);
  mGraphTimeSpeed=(GraphCanvas)mViewFlipper.getChildAt(0);
  mGraphDistanceSpeed=(GraphCanvas)mViewFlipper.getChildAt(1);
  mGraphTimeAltitude=(GraphCanvas)mViewFlipper.getChildAt(2);
  mGraphDistanceAltitude=(GraphCanvas)mViewFlipper.getChildAt(3);
  mGraphTimeSpeed.setType(GraphCanvas.TIMESPEEDGRAPH);
  mGraphDistanceSpeed.setType(GraphCanvas.DISTANCESPEEDGRAPH);
  mGraphTimeAltitude.setType(GraphCanvas.TIMEALTITUDEGRAPH);
  mGraphDistanceAltitude.setType(GraphCanvas.DISTANCEALTITUDEGRAPH);
  mGestureDetector=new GestureDetector(new MyGestureDetector());
  maxSpeedView=(TextView)findViewById(R.id.stat_maximumspeed);
  minAltitudeView=(TextView)findViewById(R.id.stat_minimalaltitide);
  maxAltitudeView=(TextView)findViewById(R.id.stat_maximumaltitude);
  overallavgSpeedView=(TextView)findViewById(R.id.stat_overallaveragespeed);
  avgSpeedView=(TextView)findViewById(R.id.stat_averagespeed);
  distanceView=(TextView)findViewById(R.id.stat_distance);
  starttimeView=(TextView)findViewById(R.id.stat_starttime);
  endtimeView=(TextView)findViewById(R.id.stat_endtime);
  waypointsView=(TextView)findViewById(R.id.stat_waypoints);
  if (load != null && load.containsKey(TRACKURI)) {
    mTrackUri=Uri.withAppendedPath(Tracks.CONTENT_URI,load.getString(TRACKURI));
  }
 else {
    mTrackUri=this.getIntent().getData();
  }
}
 

Example 44

From project HapiPodcastJ, under directory /src/info/xuluan/podcast/.

Source file: PodcastBaseActivity.java

  20 
vote

public void startInit(){
  log.debug("startInit()");
  mService=startService(new Intent(this,PodcastService.class));
  Intent bindIntent=new Intent(this,PodcastService.class);
  bindService(bindIntent,serviceConnection,Context.BIND_AUTO_CREATE);
  gestureDetector=new GestureDetector(new MyGestureDetector());
  gestureListener=new View.OnTouchListener(){
    public boolean onTouch(    View v,    MotionEvent event){
      if (gestureDetector.onTouchEvent(event)) {
        return true;
      }
      return false;
    }
  }
;
  getListView().setOnTouchListener(gestureListener);
}
 

Example 45

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

Source file: ScheduleActivity.java

  20 
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 46

From project Juggernaut_SystemUI, under directory /src/com/android/systemui/statusbar/.

Source file: LatestItemContainer.java

  20 
vote

public LatestItemContainer(final Context context,AttributeSet attrs){
  super(context,attrs);
  mGestureDetector=new GestureDetector(context,new GestureDetector.SimpleOnGestureListener(){
    @Override public boolean onFling(    MotionEvent e1,    MotionEvent e2,    float vX,    float vY){
      if (mSwipeCallback != null) {
        if (Math.abs(vX) > Math.abs(vY)) {
          int id;
          if (vX > 0) {
            id=R.anim.slide_out_right_basic;
          }
 else {
            id=R.anim.slide_out_left_basic;
          }
          Animation animation=AnimationUtils.loadAnimation(context,id);
          startAnimation(animation);
          mHandler.postDelayed(mSwipeCallback,animation.getDuration());
          return true;
        }
      }
      return false;
    }
  }
);
}
 

Example 47

From project kevoree-library, under directory /android/org.kevoree.library.android.osmdroid/src/main/java/org/osmdroid/views/.

Source file: MapView.java

  20 
vote

protected MapView(final Context context,final int tileSizePixels,final ResourceProxy resourceProxy,MapTileProviderBase tileProvider,final Handler tileRequestCompleteHandler,final AttributeSet attrs){
  super(context,attrs);
  mResourceProxy=resourceProxy;
  this.mController=new MapController(this);
  this.mScroller=new Scroller(context);
  TileSystem.setTileSize(tileSizePixels);
  if (tileProvider == null) {
    final ITileSource tileSource=getTileSourceFromAttributes(attrs);
    tileProvider=new MapTileProviderBasic(context,tileSource);
  }
  mTileRequestCompleteHandler=tileRequestCompleteHandler == null ? new SimpleInvalidationHandler(this) : tileRequestCompleteHandler;
  mTileProvider=tileProvider;
  mTileProvider.setTileRequestCompleteHandler(mTileRequestCompleteHandler);
  this.mMapOverlay=new TilesOverlay(mTileProvider,mResourceProxy);
  mOverlayManager=new OverlayManager(mMapOverlay);
  this.mZoomController=new ZoomButtonsController(this);
  this.mZoomController.setOnZoomListener(new MapViewZoomListener());
  mZoomInAnimation=new ScaleAnimation(1,2,1,2,Animation.RELATIVE_TO_SELF,0.5f,Animation.RELATIVE_TO_SELF,0.5f);
  mZoomOutAnimation=new ScaleAnimation(1,0.5f,1,0.5f,Animation.RELATIVE_TO_SELF,0.5f,Animation.RELATIVE_TO_SELF,0.5f);
  mZoomInAnimation.setDuration(ANIMATION_DURATION_SHORT);
  mZoomOutAnimation.setDuration(ANIMATION_DURATION_SHORT);
  mGestureDetector=new GestureDetector(context,new MapViewGestureDetectorListener());
  mGestureDetector.setOnDoubleTapListener(new MapViewDoubleClickListener());
}
 

Example 48

From project MIT-Mobile-for-Android, under directory /src/edu/mit/mitmobile2/.

Source file: SliderView.java

  20 
vote

/** 
 */
public SliderView(Context context,AttributeSet attributeSet){
  super(context,attributeSet);
  mContext=context;
  LayoutInflater inflator=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  inflator.inflate(R.layout.slider_view,this);
  setHorizontalScrollBarEnabled(false);
  mWidth=0;
  String layout_height=attributeSet.getAttributeValue("http://schemas.android.com/apk/res/android","layout_height");
  mHeight=AttributesParser.parseDimension(layout_height,mContext);
  ll_scroll=(LinearLayout)findViewById(R.id.ll_horscr);
  setHorizontalFadingEdgeEnabled(false);
  setSmoothScrollingEnabled(true);
  GestureDetector.OnGestureListener flingListener=new GestureDetector.SimpleOnGestureListener(){
    public boolean onFling(    MotionEvent e1,    MotionEvent e2,    float velocityX,    float velocityY){
      if ((VERTICAL_FAVOR_FACTOR * Math.abs(velocityY)) > Math.abs(velocityX)) {
        return false;
      }
      if (velocityX > 0) {
        if (mPosition > 0) {
          snapToPosition(mPosition - 1);
        }
        return true;
      }
      if (velocityX < 0) {
        if (mPosition < sliderInterfaces.size() - 1) {
          snapToPosition(mPosition + 1);
        }
        return true;
      }
      return false;
    }
  }
;
  mFlingDetector=new GestureDetector(mContext,flingListener);
  mUIHandler=new Handler();
  start();
}
 

Example 49

From project No-Pain-No-Game, under directory /src/edu/ucla/cs/nopainnogame/weightchart/.

Source file: ChartActivity.java

  20 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.chart);
  mDatabase=new Database(this);
  mDraw=new ChartDraw(ChartActivity.this,mDatabase,new GregorianCalendar());
  ((ChartView)findViewById(R.id.chart)).setChartDraw(mDraw);
  mGestureDetector=new GestureDetector(new GestureDetector.SimpleOnGestureListener(){
    @Override public boolean onScroll(    MotionEvent e1,    MotionEvent e2,    float distanceX,    float distanceY){
      if (distanceX != 0) {
        mDraw.mScrollX-=distanceX;
        invalidate();
      }
      return true;
    }
    @Override public boolean onSingleTapUp(    MotionEvent e){
      if (mToast != null) {
        mToast.cancel();
        mToast=null;
      }
      openOptionsMenu();
      return true;
    }
  }
);
  mGestureDetector.setIsLongpressEnabled(false);
  if (PreferenceManager.getDefaultSharedPreferences(this).getString("weight_unit",null) == null) {
    mHeightDialog=new HeightDialog(this){
      protected void done(){
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
        mToast=Toast.makeText(ChartActivity.this,R.string.tap_to_open_menu,Toast.LENGTH_LONG);
      }
    }
;
    showDialog(0);
  }
 else {
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
  }
}
 

Example 50

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

Source file: SwankyImageView.java

  20 
vote

private void initialize(AttributeSet attrs){
  mScaleDetector=new ScaleGestureDetector(getContext(),new ScaleListener());
  mTapSwipeDetector=new GestureDetector(getContext(),new TapSwipeListener());
  if (attrs != null) {
    int scaleType=attrs.getAttributeIntValue(ANDROID_SCHEMA,"scaleType",6);
    if (scaleType == 7) {
      isCenterInside=true;
    }
  }
  setScaleType(ScaleType.MATRIX);
  matrix.setTranslate(1f,1f);
  m=new float[9];
  Drawable d=getDrawable();
  setImageMatrix(matrix);
  if (d != null) {
    setImageBitmap(((BitmapDrawable)d).getBitmap());
  }
}
 

Example 51

From project openbicing, under directory /src/net/homelinux/penecoptero/android/openbicing/app/.

Source file: InfoLayer.java

  20 
vote

private void init(){
  gestureDetector=new GestureDetector(new MyGestureDetector());
  gestureListener=new View.OnTouchListener(){
    public boolean onTouch(    View v,    MotionEvent event){
      if (gestureDetector.onTouchEvent(event)) {
        return true;
      }
      return false;
    }
  }
;
  this.setOnTouchListener(gestureListener);
  green=R.drawable.alpha_green_gradient;
  yellow=R.drawable.alpha_yellow_gradient;
  red=R.drawable.alpha_red_gradient;
  inflater=(LayoutInflater)ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
 

Example 52

From project OpenTripPlanner-for-Android, under directory /src/org/miscwidgets/widget/.

Source file: Panel.java

  20 
vote

public Panel(Context context,AttributeSet attrs){
  super(context,attrs);
  TypedArray a=context.obtainStyledAttributes(attrs,R.styleable.Panel);
  mDuration=a.getInteger(R.styleable.Panel_animationDuration,750);
  mPosition=a.getInteger(R.styleable.Panel_position,BOTTOM);
  mLinearFlying=a.getBoolean(R.styleable.Panel_linearFlying,false);
  mWeight=a.getFraction(R.styleable.Panel_weight,0,1,0.0f);
  if (mWeight < 0 || mWeight > 1) {
    mWeight=0.0f;
    Log.w(TAG,a.getPositionDescription() + ": weight must be > 0 and <= 1");
  }
  mOpenedHandle=a.getDrawable(R.styleable.Panel_openedHandle);
  mClosedHandle=a.getDrawable(R.styleable.Panel_closedHandle);
  RuntimeException e=null;
  mHandleId=a.getResourceId(R.styleable.Panel_handle,0);
  if (mHandleId == 0) {
    e=new IllegalArgumentException(a.getPositionDescription() + ": The handle attribute is required and must refer to a valid child.");
  }
  mContentId=a.getResourceId(R.styleable.Panel_content,0);
  if (mContentId == 0) {
    e=new IllegalArgumentException(a.getPositionDescription() + ": The content attribute is required and must refer to a valid child.");
  }
  a.recycle();
  if (e != null) {
    throw e;
  }
  mOrientation=(mPosition == TOP || mPosition == BOTTOM) ? VERTICAL : HORIZONTAL;
  setOrientation(mOrientation);
  mState=State.READY;
  mGestureListener=new PanelOnGestureListener();
  mGestureDetector=new GestureDetector(mGestureListener);
  mGestureDetector.setIsLongpressEnabled(false);
  setBaselineAligned(false);
}
 

Example 53

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

Source file: MonthByWeekFragment.java

  20 
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 54

From project PinyinIME, under directory /src/com/android/inputmethod/pinyin/.

Source file: PinyinIME.java

  20 
vote

@Override public void onCreate(){
  mEnvironment=Environment.getInstance();
  if (mEnvironment.needDebug()) {
    Log.d(TAG,"onCreate.");
  }
  super.onCreate();
  startPinyinDecoderService();
  mImEn=new EnglishInputProcessor();
  Settings.getInstance(PreferenceManager.getDefaultSharedPreferences(getApplicationContext()));
  mInputModeSwitcher=new InputModeSwitcher(this);
  mChoiceNotifier=new ChoiceNotifier(this);
  mGestureListenerSkb=new OnGestureListener(false);
  mGestureListenerCandidates=new OnGestureListener(true);
  mGestureDetectorSkb=new GestureDetector(this,mGestureListenerSkb);
  mGestureDetectorCandidates=new GestureDetector(this,mGestureListenerCandidates);
  mEnvironment.onConfigurationChanged(getResources().getConfiguration(),this);
}
 

Example 55

From project platform_frameworks_ex, under directory /chips/src/com/android/ex/chips/.

Source file: RecipientEditTextView.java

  20 
vote

public RecipientEditTextView(Context context,AttributeSet attrs){
  super(context,attrs);
  if (sSelectedTextColor == -1) {
    sSelectedTextColor=context.getResources().getColor(android.R.color.white);
  }
  mAlternatesPopup=new ListPopupWindow(context);
  mAlternatesPopup.setOnDismissListener(this);
  mAddressPopup=new ListPopupWindow(context);
  mAddressPopup.setOnDismissListener(this);
  mCopyDialog=new Dialog(context);
  mAlternatesListener=new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> adapterView,    View view,    int position,    long rowId){
      mAlternatesPopup.setOnItemClickListener(null);
      setEnabled(true);
      replaceChip(mSelectedChip,((RecipientAlternatesAdapter)adapterView.getAdapter()).getRecipientEntry(position));
      Message delayed=Message.obtain(mHandler,DISMISS);
      delayed.obj=mAlternatesPopup;
      mHandler.sendMessageDelayed(delayed,DISMISS_DELAY);
      clearComposingText();
    }
  }
;
  setInputType(getInputType() | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
  setOnItemClickListener(this);
  setCustomSelectionActionModeCallback(this);
  mHandler=new Handler(){
    @Override public void handleMessage(    Message msg){
      if (msg.what == DISMISS) {
        ((ListPopupWindow)msg.obj).dismiss();
        return;
      }
      super.handleMessage(msg);
    }
  }
;
  mTextWatcher=new RecipientTextWatcher();
  addTextChangedListener(mTextWatcher);
  mGestureDetector=new GestureDetector(context,this);
}
 

Example 56

From project platform_packages_apps_calculator, under directory /src/com/android/calculator2/.

Source file: PanelSwitcher.java

  20 
vote

public PanelSwitcher(Context context,AttributeSet attrs){
  super(context,attrs);
  mCurrentView=0;
  mGestureDetector=new GestureDetector(context,new GestureDetector.SimpleOnGestureListener(){
    @Override public boolean onFling(    MotionEvent e1,    MotionEvent e2,    float velocityX,    float velocityY){
      int dx=(int)(e2.getX() - e1.getX());
      if (Math.abs(dx) > MAJOR_MOVE && Math.abs(velocityX) > Math.abs(velocityY)) {
        if (velocityX > 0) {
          moveRight();
        }
 else {
          moveLeft();
        }
        return true;
      }
 else {
        return false;
      }
    }
  }
);
}
 

Example 57

From project platform_packages_apps_VideoEditor, under directory /src/com/android/videoeditor/widgets/.

Source file: MediaItemView.java

  20 
vote

public MediaItemView(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  if (sAddTransitionDrawable == null) {
    sAddTransitionDrawable=getResources().getDrawable(R.drawable.add_transition_selector);
    sEmptyFrameDrawable=getResources().getDrawable(R.drawable.timeline_loading);
    sThumbnailCache=new ThumbnailCache(3 * 1024 * 1024);
  }
  final Display display=((WindowManager)context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
  final DisplayMetrics metrics=new DisplayMetrics();
  display.getMetrics(metrics);
  mScreenWidth=metrics.widthPixels;
  mGestureDetector=new GestureDetector(context,new MyGestureListener());
  mScrollListener=new MyScrollViewListener();
  final ProgressBar progressBar=ProgressBar.getProgressBar(context);
  final int layoutHeight=(int)(getResources().getDimension(R.dimen.media_layout_height) - getResources().getDimension(R.dimen.media_layout_padding));
  mGeneratingEffectProgressDestRect=new Rect(getPaddingLeft(),layoutHeight - progressBar.getHeight() - getPaddingBottom(),0,layoutHeight - getPaddingBottom());
  mGeneratingEffectProgress=-1;
  mLeftState=View.EMPTY_STATE_SET;
  mRightState=View.EMPTY_STATE_SET;
  mWantThumbnails=new ArrayList<Integer>();
  mPending=new HashSet<Integer>();
  mGeneration=sGenerationCounter++;
}
 

Example 58

From project Skiggle, under directory /src/com/android/skiggle/softkeyboard/.

Source file: CandidateView.java

  20 
vote

/** 
 * Construct a CandidateView for showing suggested words for completion.
 * @param context
 * @param attrs
 */
public CandidateView(Context context){
  super(context);
  mSelectionHighlight=context.getResources().getDrawable(android.R.drawable.list_selector_background);
  mSelectionHighlight.setState(new int[]{android.R.attr.state_enabled,android.R.attr.state_focused,android.R.attr.state_window_focused,android.R.attr.state_pressed});
  Resources r=context.getResources();
  setBackgroundColor(r.getColor(R.color.candidate_background));
  mColorNormal=r.getColor(R.color.candidate_normal);
  mColorRecommended=r.getColor(R.color.candidate_recommended);
  mColorOther=r.getColor(R.color.candidate_other);
  mVerticalPadding=r.getDimensionPixelSize(R.dimen.candidate_vertical_padding);
  mPaint=new Paint();
  mPaint.setColor(mColorNormal);
  mPaint.setAntiAlias(true);
  mPaint.setTextSize(r.getDimensionPixelSize(R.dimen.candidate_font_height));
  mPaint.setStrokeWidth(0);
  mGestureDetector=new GestureDetector(new GestureDetector.SimpleOnGestureListener(){
    @Override public boolean onScroll(    MotionEvent e1,    MotionEvent e2,    float distanceX,    float distanceY){
      mScrolled=true;
      int sx=getScrollX();
      sx+=distanceX;
      if (sx < 0) {
        sx=0;
      }
      if (sx + getWidth() > mTotalWidth) {
        sx-=distanceX;
      }
      mTargetScrollX=sx;
      scrollTo(sx,getScrollY());
      invalidate();
      return true;
    }
  }
);
  setHorizontalFadingEdgeEnabled(true);
  setWillNotDraw(false);
  setHorizontalScrollBarEnabled(false);
  setVerticalScrollBarEnabled(false);
}
 

Example 59

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

Source file: DraggableListView.java

  20 
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 60

From project Traktoid, under directory /Traktoid/src/com/florianmski/tracktoid/widgets/.

Source file: Panel.java

  20 
vote

public Panel(Context context,AttributeSet attrs){
  super(context,attrs);
  TypedArray a=context.obtainStyledAttributes(attrs,R.styleable.Panel);
  mDuration=a.getInteger(R.styleable.Panel_animationDuration,750);
  mPosition=a.getInteger(R.styleable.Panel_position,BOTTOM);
  mLinearFlying=a.getBoolean(R.styleable.Panel_linearFlying,false);
  mWeight=a.getFraction(R.styleable.Panel_weight,0,1,0.0f);
  if (mWeight < 0 || mWeight > 1) {
    mWeight=0.0f;
    Log.w(TAG,a.getPositionDescription() + ": weight must be > 0 and <= 1");
  }
  mOpenedHandle=a.getDrawable(R.styleable.Panel_openedHandle);
  mClosedHandle=a.getDrawable(R.styleable.Panel_closedHandle);
  RuntimeException e=null;
  mHandleId=a.getResourceId(R.styleable.Panel_handle,0);
  if (mHandleId == 0) {
    e=new IllegalArgumentException(a.getPositionDescription() + ": The handle attribute is required and must refer to a valid child.");
  }
  mContentId=a.getResourceId(R.styleable.Panel_content,0);
  if (mContentId == 0) {
    e=new IllegalArgumentException(a.getPositionDescription() + ": The content attribute is required and must refer to a valid child.");
  }
  a.recycle();
  if (e != null) {
    throw e;
  }
  mOrientation=(mPosition == TOP || mPosition == BOTTOM) ? VERTICAL : HORIZONTAL;
  setOrientation(mOrientation);
  mState=State.READY;
  mGestureListener=new PanelOnGestureListener();
  mGestureDetector=new GestureDetector(mGestureListener);
  mGestureDetector.setIsLongpressEnabled(false);
  setBaselineAligned(false);
}
 

Example 61

From project Ushahidi_Android, under directory /Core/src/com/ushahidi/android/app/ui/phone/.

Source file: ViewReportPhotoActivity.java

  20 
vote

private void initReport(int position){
  photos=photo.getPhotosByReportId(reportId);
  if (photos.size() == 0) {
    photos=photo.getPhotosByCheckinId(reportId);
  }
  if (view.imageSwitcher != null) {
    view.imageSwitcher.setFactory(this);
    view.imageSwitcher.setOnTouchListener(this);
  }
  gestureDetector=new GestureDetector(new GestureDetectorListener());
  if (photos != null && photos.size() > 0) {
    fileName=photos.get(position).getPhoto();
    setImage(view.imageSwitcher);
    int page=position;
    this.setTitle(page + 1);
  }
}