-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: create Utils with MainExecutor, MainHandler
- Loading branch information
Showing
2 changed files
with
29 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.captureprotection; | ||
|
||
import android.os.Handler; | ||
import android.os.Looper; | ||
import android.os.Message; | ||
import androidx.annotation.NonNull; | ||
import java.util.concurrent.Executor; | ||
|
||
public class Utils { | ||
public static final class MainExecutor implements Executor { | ||
static final Executor INSTANCE = new MainExecutor(); | ||
private final Handler handler = new Handler(Looper.getMainLooper()); | ||
|
||
@Override | ||
public void execute(Runnable r) { | ||
handler.post(r); | ||
} | ||
} | ||
|
||
public static final class MainHandler { | ||
static final Handler INSTANCE = new Handler(Looper.getMainLooper(), new Handler.Callback() { | ||
@Override | ||
public boolean handleMessage(@NonNull Message msg) { | ||
return false; | ||
} | ||
}); | ||
} | ||
} |