move toast
This commit is contained in:
parent
9e5cdc7515
commit
e6aabd75b6
|
|
@ -5,7 +5,6 @@ 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;
|
||||
|
||||
|
|
@ -54,10 +53,6 @@ public class Init {
|
|||
get().handler.postDelayed(runnable, delay);
|
||||
}
|
||||
|
||||
public static void show(String msg) {
|
||||
get().handler.post(() -> Toast.makeText(context(), msg, Toast.LENGTH_LONG).show());
|
||||
}
|
||||
|
||||
public static Activity getActivity() throws Exception {
|
||||
Class<?> activityThreadClass = Class.forName("android.app.ActivityThread");
|
||||
Object activityThread = activityThreadClass.getMethod("currentActivityThread").invoke(null);
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import android.view.ViewGroup;
|
|||
import android.webkit.ValueCallback;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.github.catvod.spider.Init;
|
||||
|
||||
|
|
@ -155,6 +156,10 @@ public class Utils {
|
|||
else webView.loadUrl(script);
|
||||
}
|
||||
|
||||
public static void notify(String msg) {
|
||||
Init.run(() -> Toast.makeText(Init.context(), msg, Toast.LENGTH_LONG).show());
|
||||
}
|
||||
|
||||
public static void addView(View view, ViewGroup.LayoutParams params) {
|
||||
try {
|
||||
ViewGroup group = Init.getActivity().getWindow().getDecorView().findViewById(android.R.id.content);
|
||||
|
|
|
|||
Loading…
Reference in New Issue