@Override protected void onLooperPrepared() { super.onLooperPrepared(); storage.mObserver.onChange(false); } }.start();
@Override protected void onLooperPrepared() { super.onLooperPrepared(); // in a perfect world I could change a value in the storage an it will call the // listener. But this is andorid and testing is hard. Even harder with threading. // The hardest thing here is the Isolated context, and the dependency to the Looper // to get the change from the content provider. // // tl;dr the ContentObserver does not work in a ProviderTestCase2 so I call the // listener myself instead of changing data. // // wasted hours so far: 12 // userStorage.put("the", "change"); userStorage.mObserver.onChange(false, uri); } }.start();
@Override protected void onLooperPrepared() { super.onLooperPrepared(); looperRegisteredOn[0] = Looper.myLooper(); userStorage.registerOnTrayPreferenceChangeListener(listener); if (otherListener != null) { userStorage.registerOnTrayPreferenceChangeListener(otherListener); } registerLatch.countDown(); } }.start();
@Override protected void onLooperPrepared() { super.onLooperPrepared(); mObserver = new TrayContentObserver(new Handler(getLooper())); // register observer final Uri observingUri = mTrayUri.builder() .setType(getType()) .setModule(getModuleName()) .build(); mContext.getContentResolver() .registerContentObserver(observingUri, true, mObserver); mRegisteredContentObserver = true; } };
@Override protected void onLooperPrepared() { super.onLooperPrepared(); this.mWorkerHandler = new Handler(); mProcessorHandler.sendEmptyMessage(MSG_WORKER_READY); } }
@Override protected void onLooperPrepared() { super.onLooperPrepared(); setUncaughtExceptionHandler(new UncaughtExceptionHandler() { @Override public void uncaughtException(Thread t, Throwable e) { LogUtil.wtf(TAG, e); t.interrupt(); } }); }
@Override protected void onLooperPrepared() { super.onLooperPrepared(); this.workHandler = new Handler(getLooper(), this); }
@Override protected void onLooperPrepared() { super.onLooperPrepared(); mHandler = new Handler() { @Override
@Override protected void onLooperPrepared() { super.onLooperPrepared(); // Get a reference to worker thread's handler after looper is prepared workerHandler = new Handler(getLooper()) { @Override public void handleMessage(Message msg) { super.handleMessage(msg); switch (msg.what) { case Constants.TASK_START: { MessageQueueData messageQueueData = (MessageQueueData) msg.obj; CurveOptions options = computePoints(messageQueueData.getCurveOptions(), messageQueueData.getProjection()); Message message = Message.obtain(null, Constants.TASK_COMPLETE, options); /* Sends message back to Ui thread*/ uiThreadCallback.get().publishToUiThread(message); break; } } } }; }
@Override protected void onLooperPrepared() { super.onLooperPrepared(); handler = new SafeHandler(getLooper()); }
@Override protected void onLooperPrepared() { super.onLooperPrepared(); mWorkerHandler = new Handler(getLooper(), msg -> { switch (msg.what) { case GET_ID: getRequest((ItemSubscription) msg.obj); break; case SET_ID: putRequest((ItemModification) msg.obj); break; } return true; }); }
@Override protected void onLooperPrepared() { super.onLooperPrepared(); mWorkerHandler = new Handler(getLooper(), msg -> { if (msg.what == 12) { Command cmd = (Command) msg.obj; synchronized (mHandlers) { for (ICommandHandler mHandler : mHandlers) { try { if (mHandler.handleCommand(cmd)) { break; } } catch (Throwable t) { cmd.failed(t.getLocalizedMessage()); break; } } } } return true; }); }
@Override protected void onLooperPrepared() { super.onLooperPrepared(); mObserver = new TrayContentObserver(new Handler(getLooper())); // register observer final Uri observingUri = mTrayUri.builder() .setType(getType()) .setModule(getModuleName()) .build(); mContext.getContentResolver() .registerContentObserver(observingUri, true, mObserver); mRegisteredContentObserver = true; } };