use of android.support.v4.view.GestureDetectorCompat in project LanSoEditor_advance by LanSoSdk.
the class CameraProgressBar method init.
private void init(Context context, AttributeSet attrs) {
mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
if (attrs != null) {
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CameraProgressBar);
innerColor = a.getColor(R.styleable.CameraProgressBar_innerColor, innerColor);
outerColor = a.getColor(R.styleable.CameraProgressBar_outerColor, outerColor);
progressColor = a.getColor(R.styleable.CameraProgressBar_progressColor, progressColor);
innerRadio = a.getDimensionPixelOffset(R.styleable.CameraProgressBar_innerRadio, innerRadio);
progressWidth = a.getDimensionPixelOffset(R.styleable.CameraProgressBar_progressWidth, progressWidth);
progress = a.getInt(R.styleable.CameraProgressBar_progress, progress);
scale = a.getFloat(R.styleable.CameraProgressBar_scale, scale);
isLongScale = a.getBoolean(R.styleable.CameraProgressBar_isLongScale, isLongScale);
maxProgress = a.getInt(R.styleable.CameraProgressBar_maxProgress, maxProgress);
a.recycle();
}
backgroundPaint = new Paint();
backgroundPaint.setAntiAlias(true);
backgroundPaint.setColor(backgroundColor);
progressPaint = new Paint();
progressPaint.setAntiAlias(true);
progressPaint.setStrokeWidth(progressWidth);
progressPaint.setStyle(Paint.Style.STROKE);
innerPaint = new Paint();
innerPaint.setAntiAlias(true);
innerPaint.setStrokeWidth(innerRadio);
innerPaint.setStyle(Paint.Style.STROKE);
sweepAngle = ((float) progress / maxProgress) * 360;
mDetector = new GestureDetectorCompat(context, new GestureDetector.SimpleOnGestureListener() {
@Override
public boolean onSingleTapConfirmed(MotionEvent e) {
isLongClick = false;
if (CameraProgressBar.this.listener != null) {
CameraProgressBar.this.listener.onClick(CameraProgressBar.this);
}
return super.onSingleTapConfirmed(e);
}
@Override
public void onLongPress(MotionEvent e) {
isLongClick = true;
postInvalidate();
mLastY = e.getY();
// if (CameraProgressBar.this.listener != null) {
// CameraProgressBar.this.listener.onLongClick(CameraProgressBar.this);
// }
}
});
mDetector.setIsLongpressEnabled(true);
}
use of android.support.v4.view.GestureDetectorCompat in project EffectiveAndroid by rallat.
the class TopArticleListActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
layoutManager.scrollToPosition(0);
recyclerView.setLayoutManager(layoutManager);
// allows for optimizations if all items are of the same size:
recyclerView.setHasFixedSize(true);
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.addOnItemTouchListener(this);
gestureDetector = new GestureDetectorCompat(this, new RecyclerViewDemoOnGestureListener());
presenter = createPresenter();
presenter.create();
}
use of android.support.v4.view.GestureDetectorCompat in project EffectiveAndroid by rallat.
the class TopImagesListActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
recyclerView.setLayoutManager(new GridLayoutManager(this, 2));
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.addOnItemTouchListener(this);
gestureDetector = new GestureDetectorCompat(this, new RecyclerViewDemoOnGestureListener());
presenter = createPresenter();
presenter.create();
}
Aggregations