| 9 | import java.util.concurrent.Executors; |
| 10 | |
| 11 | public class Init { |
| 12 | |
| 13 | private final ExecutorService executor; |
| 14 | private final Handler handler; |
| 15 | private Application app; |
| 16 | |
| 17 | private static class Loader { |
| 18 | static volatile Init INSTANCE = new Init(); |
| 19 | } |
| 20 | |
| 21 | public static Init get() { |
| 22 | return Loader.INSTANCE; |
| 23 | } |
| 24 | |
| 25 | public Init() { |
| 26 | this.handler = new Handler(Looper.getMainLooper()); |
| 27 | this.executor = Executors.newFixedThreadPool(5); |
| 28 | } |
| 29 | |
| 30 | public static Application context() { |
| 31 | return get().app; |
| 32 | } |
| 33 | |
| 34 | public static void init(Context context) { |
| 35 | get().app = ((Application) context); |
| 36 | Proxy.init(); |
| 37 | } |
| 38 | |
| 39 | public static void execute(Runnable runnable) { |
| 40 | get().executor.execute(runnable); |
| 41 | } |
| 42 | |
| 43 | public static void post(Runnable runnable) { |
| 44 | get().handler.post(runnable); |
| 45 | } |
| 46 | |
| 47 | public static void post(Runnable runnable, int delay) { |
| 48 | get().handler.postDelayed(runnable, delay); |
| 49 | } |
| 50 | } |
nothing calls this directly
no outgoing calls
no test coverage detected