MCPcopy Create free account
hub / github.com/afkT/DevUtils / init

Method init

lib/DevApp/src/main/java/dev/DevUtils.java:84–120  ·  view source on GitHub ↗

初始化开发工具库与全局上下文 应用启动时必须调用,传入 Activity、Application 等 Context 均可。 @param context Context

(final Context context)

Source from the content-addressed store, hash-verified

82 * @param context {@link Context}
83 */
84 public static void init(final Context context) {
85 if (context == null) return;
86
87 // 初始化全局 Context
88 initContext(context);
89 // 初始化全局 Application
90 initApplication(context);
91 // 注册 Activity 生命周期监听
92 getLifecycleAssist().registerActivityLifecycleCallbacks();
93
94 // =================
95 // = 初始化工具类相关 =
96 // =================
97
98 // 初始化 Record
99 FileRecordUtils.setRecordInsert(new AppRecordInsert(false));
100
101 // ============
102 // = Java Log =
103 // ============
104
105 // 设置 Java 模块日志信息在 logcat 输出
106 JCLogUtils.setPrint((logType, tag, message) -> {
107 switch (logType) {
108 case JCLogUtils.INFO:
109 LogPrintUtils.iTag(tag, message);
110 break;
111 case JCLogUtils.ERROR:
112 LogPrintUtils.eTag(tag, message);
113 break;
114 case JCLogUtils.DEBUG:
115 default:
116 LogPrintUtils.dTag(tag, message);
117 break;
118 }
119 });
120 }
121
122 /**
123 * 初始化全局 Context

Callers 15

onCreateMethod · 0.45
initKeyMethod · 0.45
encryptMethod · 0.45
decryptMethod · 0.45
initKeyMethod · 0.45
encryptMethod · 0.45
decryptMethod · 0.45
encryptMethod · 0.45
decryptMethod · 0.45
hmacTemplateMethod · 0.45
symmetricTemplateMethod · 0.45

Calls 9

initContextMethod · 0.95
initApplicationMethod · 0.95
getLifecycleAssistMethod · 0.95
setRecordInsertMethod · 0.95
setPrintMethod · 0.95
iTagMethod · 0.95
eTagMethod · 0.95
dTagMethod · 0.95

Tested by

no test coverage detected