()
| 33 | } |
| 34 | |
| 35 | public static Application app() { |
| 36 | if (Ext.app == null) { |
| 37 | try { |
| 38 | // 仅在IDE进行布局预览时使用,真机或模拟器不使用MockApplication. |
| 39 | @SuppressLint("PrivateApi") |
| 40 | Class<?> renderActionClass = Class.forName("com.android.layoutlib.bridge.impl.RenderAction"); |
| 41 | Method method = renderActionClass.getDeclaredMethod("getCurrentContext"); |
| 42 | Context context = (Context) method.invoke(null); |
| 43 | Ext.app = new MockApplication(context); |
| 44 | } catch (Throwable ignored) { |
| 45 | throw new RuntimeException("please invoke x.Ext.init(app) on Application#onCreate()" |
| 46 | + " and register your Application in manifest."); |
| 47 | } |
| 48 | } |
| 49 | return Ext.app; |
| 50 | } |
| 51 | |
| 52 | public static TaskController task() { |
| 53 | return Ext.taskController; |
no test coverage detected