Update jar
This commit is contained in:
parent
2973d1df74
commit
da3ffcf190
|
|
@ -4,28 +4,37 @@ import android.app.Application;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.github.catvod.crawler.SpiderDebug;
|
import com.github.catvod.crawler.SpiderDebug;
|
||||||
|
|
||||||
public class Init {
|
public class Init {
|
||||||
|
|
||||||
private final Handler mHandler;
|
private final Handler handler;
|
||||||
private Application mApp;
|
private Application app;
|
||||||
|
|
||||||
private static class Loader {
|
private static class Loader {
|
||||||
static volatile Init INSTANCE = new Init();
|
static volatile Init INSTANCE = new Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Init get() {
|
public static Init get() {
|
||||||
return Loader.INSTANCE;
|
return Loader.INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Init() {
|
public Init() {
|
||||||
this.mHandler = new Handler(Looper.getMainLooper());
|
this.handler = new Handler(Looper.getMainLooper());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Application context() {
|
||||||
|
return get().app;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void init(Context context) {
|
public static void init(Context context) {
|
||||||
SpiderDebug.log("自定義爬蟲代碼載入成功!");
|
SpiderDebug.log("自定義爬蟲代碼載入成功!");
|
||||||
get().mApp = ((Application) context);
|
get().app = ((Application) context);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void show(String msg) {
|
||||||
|
get().handler.post(() -> Toast.makeText(context(), msg, Toast.LENGTH_SHORT).show());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -1 +1 @@
|
||||||
02be344fd12b73ec6b396ecc73623457
|
56a445f21c898cc95f53b87f1ff16c0f
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue