1.1.8 updated

This commit is contained in:
PranshulGG committed 2024-07-13 22:28:51 +05:30
1 parent b78c0acee1
commit 1d9eafc7ad
11 files changed
+437 -150

No files matched your search

@@ -89,6 +89,7 @@ public class MainActivity extends AppCompatActivity {
AndroidInterface androidInterface = new AndroidInterface(this);
webview.addJavascriptInterface(androidInterface, "AndroidInterface");
webview.addJavascriptInterface(new ShowToastInterface(this), "ToastAndroidShow");
webview.setBackgroundColor(getResources().getColor(R.color.diffDefault));
@@ -181,6 +182,25 @@ public class MainActivity extends AppCompatActivity {
}
public class ShowToastInterface {
private final Context mContext;
public ShowToastInterface(Context context) {
this.mContext = context;
}
@JavascriptInterface
public void ShowToast(final String text, final String time) {
int duration = Toast.LENGTH_SHORT;
if (time.equals("long")) {
duration = Toast.LENGTH_LONG;
} else if(time.equals("short")){
duration = Toast.LENGTH_SHORT;
}
Toast.makeText(mContext, text, duration).show();
}
}
public class AndroidInterface {
private MainActivity mActivity;