FENGMI蜂蜜影视 原始JAR及配置
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

46 lines
1.1 KiB

package com.github.catvod.spider;
import android.app.Application;
import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.widget.Toast;
import com.github.catvod.crawler.SpiderDebug;
import com.github.catvod.utils.Trans;
public class Init {
private final Handler handler;
private Application app;
private static class Loader {
static volatile Init INSTANCE = new Init();
}
public static Init get() {
return Loader.INSTANCE;
}
public Init() {
this.handler = new Handler(Looper.getMainLooper());
}
public static Application context() {
return get().app;
}
public static void init(Context context) {
SpiderDebug.log("自定義爬蟲代碼載入成功!");
get().app = ((Application) context);
Trans.init();
}
public static void run(Runnable runnable) {
get().handler.post(runnable);
}
public static void show(String msg) {
get().handler.post(() -> Toast.makeText(context(), msg, Toast.LENGTH_SHORT).show());
}
}