Search in sources :

Example 1 with Handler

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);
}
Also used : TypedArray(android.content.res.TypedArray) Handler(android.os.Handler) GestureDetector(android.view.GestureDetector) Paint(android.graphics.Paint) MotionEvent(android.view.MotionEvent)

Example 2 with Handler

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);
}
Also used : Handler(android.os.Handler) BitmonetOAuthStatusListener(com.bitmonet.BitmonetOAuthStatusListener)

Example 3 with Handler

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));
    }
}
Also used : StrictMode(android.os.StrictMode) HandlerThread(android.os.HandlerThread) Query(com.bumptech.glide.samples.flickr.api.Query) SearchQuery(com.bumptech.glide.samples.flickr.api.SearchQuery) RecentQuery(com.bumptech.glide.samples.flickr.api.RecentQuery) Handler(android.os.Handler) Resources(android.content.res.Resources) ViewPager(android.support.v4.view.ViewPager)

Example 4 with Handler

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);
}
Also used : Handler(android.os.Handler) Toolbar(android.support.v7.widget.Toolbar)

Example 5 with Handler

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();
}
Also used : Handler(android.os.Handler)

Aggregations

Handler (android.os.Handler)1843 Message (android.os.Message)253 View (android.view.View)201 Intent (android.content.Intent)165 HandlerThread (android.os.HandlerThread)135 MediumTest (android.test.suitebuilder.annotation.MediumTest)116 TextView (android.widget.TextView)114 ArrayList (java.util.ArrayList)95 Test (org.junit.Test)80 Context (android.content.Context)67 RemoteException (android.os.RemoteException)63 IOException (java.io.IOException)61 IntentFilter (android.content.IntentFilter)57 ComponentName (android.content.ComponentName)56 ImageView (android.widget.ImageView)55 RecyclerView (android.support.v7.widget.RecyclerView)52 Bundle (android.os.Bundle)51 Looper (android.os.Looper)51 File (java.io.File)45 HashMap (java.util.HashMap)44