赞
踩
地址:https://github.com/chyjack/harmony-mvp
封装了一个好用的鸿蒙上的mvp框架,包含了线程切换,Toast封装及一些原Android常用的函数
线程相关工具类:
-
- public class ThreadUtil {
-
- private volatile static ExecutorService mThreadPool;
- private volatile static EventHandler uiHandler;
-
- ...
-
-
- /**
- * 提供不依赖Activity Context的runOnUiThread方法
- */
- public static void runOnUiThread(Object token, Runnable runnable) {
- if (EventRunner.getMainEventRunner().isCurrentRunnerThread()) {
- runnable.run();
- } else {
- if (uiHandler == null) {
- synchronized (ThreadUtil.class) {
- if (uiHandler == null) {
- uiHandler = new EventHandler(EventRunner.getMainEventRunner());
- }
- }
- }
- uiHandler.postTask(runnable);
- addUiRunnab
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。