Search in sources :

Example 66 with Handler

use of android.os.Handler in project platform_frameworks_base by android.

the class KeyboardView method onAttachedToWindow.

@Override
protected void onAttachedToWindow() {
    super.onAttachedToWindow();
    initGestureDetector();
    if (mHandler == null) {
        mHandler = new Handler() {

            @Override
            public void handleMessage(Message msg) {
                switch(msg.what) {
                    case MSG_SHOW_PREVIEW:
                        showKey(msg.arg1);
                        break;
                    case MSG_REMOVE_PREVIEW:
                        mPreviewText.setVisibility(INVISIBLE);
                        break;
                    case MSG_REPEAT:
                        if (repeatKey()) {
                            Message repeat = Message.obtain(this, MSG_REPEAT);
                            sendMessageDelayed(repeat, REPEAT_INTERVAL);
                        }
                        break;
                    case MSG_LONGPRESS:
                        openPopupIfRequired((MotionEvent) msg.obj);
                        break;
                }
            }
        };
    }
}
Also used : Message(android.os.Message) Handler(android.os.Handler) MotionEvent(android.view.MotionEvent)

Example 67 with Handler

use of android.os.Handler in project platform_frameworks_base by android.

the class CursorTreeAdapter method init.

private void init(Cursor cursor, Context context, boolean autoRequery) {
    mContext = context;
    mHandler = new Handler();
    mAutoRequery = autoRequery;
    mGroupCursorHelper = new MyCursorHelper(cursor);
    mChildrenCursorHelpers = new SparseArray<MyCursorHelper>();
}
Also used : Handler(android.os.Handler)

Example 68 with Handler

use of android.os.Handler in project platform_frameworks_base by android.

the class DigitalClock method onAttachedToWindow.

@Override
protected void onAttachedToWindow() {
    mTickerStopped = false;
    super.onAttachedToWindow();
    mFormatChangeObserver = new FormatChangeObserver();
    getContext().getContentResolver().registerContentObserver(Settings.System.CONTENT_URI, true, mFormatChangeObserver);
    setFormat();
    mHandler = new Handler();
    /**
         * requests a tick on the next hard-second boundary
         */
    mTicker = new Runnable() {

        public void run() {
            if (mTickerStopped)
                return;
            mCalendar.setTimeInMillis(System.currentTimeMillis());
            setText(DateFormat.format(mFormat, mCalendar));
            invalidate();
            long now = SystemClock.uptimeMillis();
            long next = now + (1000 - now % 1000);
            mHandler.postAtTime(mTicker, next);
        }
    };
    mTicker.run();
}
Also used : Handler(android.os.Handler)

Example 69 with Handler

use of android.os.Handler in project Conversations by siacs.

the class MemorizingTrustManager method init.

void init(Context m) {
    master = m;
    masterHandler = new Handler(m.getMainLooper());
    notificationManager = (NotificationManager) master.getSystemService(Context.NOTIFICATION_SERVICE);
    Application app;
    if (m instanceof Application) {
        app = (Application) m;
    } else if (m instanceof Service) {
        app = ((Service) m).getApplication();
    } else if (m instanceof Activity) {
        app = ((Activity) m).getApplication();
    } else
        throw new ClassCastException("MemorizingTrustManager context must be either Activity or Service!");
    File dir = app.getDir(KEYSTORE_DIR, Context.MODE_PRIVATE);
    keyStoreFile = new File(dir + File.separator + KEYSTORE_FILE);
    poshCacheDir = app.getFilesDir().getAbsolutePath() + "/posh_cache/";
    appKeyStore = loadAppKeyStore();
}
Also used : Handler(android.os.Handler) Service(android.app.Service) Activity(android.app.Activity) Application(android.app.Application) File(java.io.File)

Example 70 with Handler

use of android.os.Handler in project android-ripple-background by skyfishjy.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    final RippleBackground rippleBackground = (RippleBackground) findViewById(R.id.content);
    final Handler handler = new Handler();
    foundDevice = (ImageView) findViewById(R.id.foundDevice);
    ImageView button = (ImageView) findViewById(R.id.centerImage);
    button.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            rippleBackground.startRippleAnimation();
            handler.postDelayed(new Runnable() {

                @Override
                public void run() {
                    foundDevice();
                }
            }, 3000);
        }
    });
}
Also used : RippleBackground(com.skyfishjy.library.RippleBackground) Handler(android.os.Handler) ImageView(android.widget.ImageView) ImageView(android.widget.ImageView) View(android.view.View)

Aggregations

Handler (android.os.Handler)1906 Message (android.os.Message)254 View (android.view.View)207 Intent (android.content.Intent)174 HandlerThread (android.os.HandlerThread)156 TextView (android.widget.TextView)118 MediumTest (android.test.suitebuilder.annotation.MediumTest)116 ArrayList (java.util.ArrayList)97 Test (org.junit.Test)85 Context (android.content.Context)71 IntentFilter (android.content.IntentFilter)69 RemoteException (android.os.RemoteException)63 IOException (java.io.IOException)63 ComponentName (android.content.ComponentName)57 ImageView (android.widget.ImageView)57 Bundle (android.os.Bundle)56 RecyclerView (android.support.v7.widget.RecyclerView)54 Looper (android.os.Looper)53 File (java.io.File)46 ContentObserver (android.database.ContentObserver)44