mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-01 08:16:49 +00:00
Moving various common executors to a single location
Change-Id: I44bca49b8adb6fa22c3b48d10f674e42c28d792c
This commit is contained in:
@@ -15,14 +15,13 @@
|
||||
*/
|
||||
package com.android.launcher3.util;
|
||||
|
||||
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.os.HandlerThread;
|
||||
import android.os.IBinder;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.os.Process;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
|
||||
/**
|
||||
@@ -30,25 +29,15 @@ import android.view.inputmethod.InputMethodManager;
|
||||
*/
|
||||
public class UiThreadHelper {
|
||||
|
||||
private static HandlerThread sHandlerThread;
|
||||
private static Handler sHandler;
|
||||
|
||||
private static final int MSG_HIDE_KEYBOARD = 1;
|
||||
private static final int MSG_SET_ORIENTATION = 2;
|
||||
private static final int MSG_RUN_COMMAND = 3;
|
||||
|
||||
public static Looper getBackgroundLooper() {
|
||||
if (sHandlerThread == null) {
|
||||
sHandlerThread =
|
||||
new HandlerThread("UiThreadHelper", Process.THREAD_PRIORITY_FOREGROUND);
|
||||
sHandlerThread.start();
|
||||
}
|
||||
return sHandlerThread.getLooper();
|
||||
}
|
||||
|
||||
private static Handler getHandler(Context context) {
|
||||
if (sHandler == null) {
|
||||
sHandler = new Handler(getBackgroundLooper(),
|
||||
sHandler = new Handler(UI_HELPER_EXECUTOR.getLooper(),
|
||||
new UiCallbacks(context.getApplicationContext()));
|
||||
}
|
||||
return sHandler;
|
||||
|
||||
Reference in New Issue
Block a user