use of android.os.Handler in project photo-picker-plus-android by chute.
the class RippleView method init.
private void init(final Context context, final AttributeSet attrs) {
if (isInEditMode())
return;
final TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.RippleView);
rippleColor = typedArray.getColor(R.styleable.RippleView_rv_color, getResources().getColor(android.R.color.white));
rippleType = typedArray.getInt(R.styleable.RippleView_rv_type, 0);
hasToZoom = typedArray.getBoolean(R.styleable.RippleView_rv_zoom, false);
isCentered = typedArray.getBoolean(R.styleable.RippleView_rv_centered, false);
DURATION = typedArray.getInteger(R.styleable.RippleView_rv_rippleDuration, DURATION);
FRAME_RATE = typedArray.getInteger(R.styleable.RippleView_rv_framerate, FRAME_RATE);
PAINT_ALPHA = typedArray.getInteger(R.styleable.RippleView_rv_alpha, PAINT_ALPHA);
ripplePadding = typedArray.getDimensionPixelSize(R.styleable.RippleView_rv_ripplePadding, 0);
canvasHandler = new Handler();
zoomScale = typedArray.getFloat(R.styleable.RippleView_rv_zoomScale, 1.03f);
zoomDuration = typedArray.getInt(R.styleable.RippleView_rv_zoomDuration, 200);
paint = new Paint();
paint.setAntiAlias(true);
paint.setStyle(Paint.Style.FILL);
paint.setColor(rippleColor);
paint.setAlpha(PAINT_ALPHA);
this.setWillNotDraw(false);
gestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() {
@Override
public void onLongPress(MotionEvent event) {
super.onLongPress(event);
animateRipple(event);
sendClickEvent(true);
}
@Override
public boolean onSingleTapConfirmed(MotionEvent e) {
return true;
}
@Override
public boolean onSingleTapUp(MotionEvent e) {
return true;
}
});
this.setDrawingCacheEnabled(true);
this.setClickable(true);
}
use of android.os.Handler in project coinbase-bitmonet-sdk by coinbase.
the class OAuthHelperUtils method sendOAuthResponse.
private void sendOAuthResponse(final Context context, final boolean status) {
Handler applicationHandler = new Handler(context.getMainLooper());
Runnable applicationRunnable = new Runnable() {
@Override
public void run() {
((BitmonetOAuthStatusListener) context).walletOAuthStatusListener(status);
}
};
applicationHandler.post(applicationRunnable);
}
use of android.os.Handler in project glide by bumptech.
the class FlickrSearchActivity method onCreate.
/**
* Called when the activity is first created.
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectAll().penaltyLog().build());
backgroundThread = new HandlerThread("BackgroundThumbnailHandlerThread");
backgroundThread.start();
backgroundHandler = new Handler(backgroundThread.getLooper());
setContentView(R.layout.flickr_search_activity);
searching = findViewById(R.id.searching);
searchLoading = findViewById(R.id.search_loading);
searchTerm = (TextView) findViewById(R.id.search_term);
Resources res = getResources();
ViewPager pager = (ViewPager) findViewById(R.id.view_pager);
pager.setPageMargin(res.getDimensionPixelOffset(R.dimen.page_margin));
pager.setAdapter(new FlickrPagerAdapter(getSupportFragmentManager()));
Api.get(this).registerSearchListener(queryListener);
if (savedInstanceState != null) {
Query savedQuery = savedInstanceState.getParcelable(STATE_QUERY);
if (savedQuery != null) {
executeQuery(savedQuery);
}
} else {
executeQuery(RecentQuery.get());
}
int smallGridSize = res.getDimensionPixelSize(R.dimen.small_photo_side);
int mediumGridSize = res.getDimensionPixelSize(R.dimen.medium_photo_side);
int listHeightSize = res.getDimensionPixelSize(R.dimen.flickr_list_item_height);
int screenWidth = getScreenWidth();
if (savedInstanceState == null) {
// Weight values determined experimentally by measuring the number of incurred GCs while
// scrolling through the various photo grids/lists.
Glide.get(this).preFillBitmapPool(new PreFillType.Builder(smallGridSize).setWeight(1), new PreFillType.Builder(mediumGridSize).setWeight(1), new PreFillType.Builder(screenWidth / 2, listHeightSize).setWeight(6));
}
}
use of android.os.Handler in project Calligraphy by chrisjenx.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final Toolbar toolbar = findById(this, R.id.toolbar);
setSupportActionBar(toolbar);
// Inject pragmatically
getSupportFragmentManager().beginTransaction().replace(R.id.container, PlaceholderFragment.getInstance()).commit();
final Handler handler = new Handler(Looper.getMainLooper());
handler.postDelayed(new Runnable() {
@Override
public void run() {
// toolbar.setTitle("Calligraphy Added");
toolbar.setSubtitle("Added subtitle");
}
}, 1000);
handler.postDelayed(new Runnable() {
@Override
public void run() {
toolbar.setTitle(null);
toolbar.setSubtitle("Added subtitle");
}
}, 2000);
handler.postDelayed(new Runnable() {
@Override
public void run() {
toolbar.setTitle("Calligraphy added back");
toolbar.setSubtitle("Added subtitle");
}
}, 3000);
}
use of android.os.Handler in project android-betterpickers by code-troopers.
the class DayPickerView method init.
public void init(Context context) {
mHandler = new Handler();
setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
setDrawSelectorOnTop(false);
mContext = context;
setUpListView();
}
Aggregations