|
@@ -25,6 +25,7 @@ import com.kongzue.dialogx.dialogs.CustomDialog;
|
|
|
import com.kongzue.dialogx.dialogs.FullScreenDialog;
|
|
|
import com.kongzue.dialogx.interfaces.DialogLifecycleCallback;
|
|
|
import com.kongzue.dialogx.interfaces.OnBindView;
|
|
|
+import com.kongzue.dialogx.util.views.DialogXBaseRelativeLayout;
|
|
|
import com.kongzue.dialogxdemo.R;
|
|
|
|
|
|
public class TestMainActivity extends AppCompatActivity {
|
|
@@ -34,60 +35,63 @@ public class TestMainActivity extends AppCompatActivity {
|
|
|
super.onCreate(savedInstanceState);
|
|
|
setContentView(R.layout.activity_main_test);
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
|
|
- getWindow().setStatusBarColor(ContextCompat.getColor(this,R.color.colorAccent));
|
|
|
+ getWindow().setStatusBarColor(ContextCompat.getColor(this, R.color.colorAccent));
|
|
|
}
|
|
|
+
|
|
|
+ DialogXBaseRelativeLayout.debugMode = true;
|
|
|
WindowCompat.setDecorFitsSystemWindows(getWindow(), false);
|
|
|
findViewById(R.id.btn_showDialog).setOnClickListener(view -> {
|
|
|
-// BottomDialog.show("标题", "这里是对话框内容。")
|
|
|
-// .setCancelButton("取消", (dialog, v) -> false)
|
|
|
-// .setOkButton("确定", (dialog, v) -> false);
|
|
|
-
|
|
|
- FullScreenDialog.show(new OnBindView<FullScreenDialog>(R.layout.layout_full_webview) {
|
|
|
- private TextView btnClose;
|
|
|
- private WebView webView;
|
|
|
- @Override
|
|
|
- public void onBind(final FullScreenDialog dialog, View v) {
|
|
|
- btnClose = v.findViewById(R.id.btn_close);
|
|
|
- webView = v.findViewById(R.id.webView);
|
|
|
-
|
|
|
- btnClose.setOnClickListener(new View.OnClickListener() {
|
|
|
- @Override
|
|
|
- public void onClick(View v) {
|
|
|
- dialog.dismiss();
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- WebSettings webSettings = webView.getSettings();
|
|
|
- webSettings.setJavaScriptEnabled(true);
|
|
|
- webSettings.setLoadWithOverviewMode(true);
|
|
|
- webSettings.setUseWideViewPort(true);
|
|
|
- webSettings.setSupportZoom(false);
|
|
|
- webSettings.setAllowFileAccess(true);
|
|
|
- webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
|
|
|
- webSettings.setLoadsImagesAutomatically(true);
|
|
|
- webSettings.setDefaultTextEncodingName("utf-8");
|
|
|
-
|
|
|
- webView.setWebViewClient(new WebViewClient() {
|
|
|
- @Override
|
|
|
- public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
|
|
- try {
|
|
|
- Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
|
|
- startActivity(intent);
|
|
|
- } catch (ActivityNotFoundException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- return true;
|
|
|
- }
|
|
|
|
|
|
- @Override
|
|
|
- public void onPageFinished(WebView view, String url) {
|
|
|
- super.onPageFinished(view, url);
|
|
|
- }
|
|
|
- });
|
|
|
+ BottomDialog.show("标题", "这里是对话框内容。")
|
|
|
+ .setCancelButton("取消", (dialog, v) -> false)
|
|
|
+ .setOkButton("确定", (dialog, v) -> false);
|
|
|
|
|
|
- webView.loadUrl("https://github.com/kongzue/DialogX");
|
|
|
- }
|
|
|
- });
|
|
|
+// FullScreenDialog.show(new OnBindView<FullScreenDialog>(R.layout.layout_full_webview) {
|
|
|
+// private TextView btnClose;
|
|
|
+// private WebView webView;
|
|
|
+// @Override
|
|
|
+// public void onBind(final FullScreenDialog dialog, View v) {
|
|
|
+// btnClose = v.findViewById(R.id.btn_close);
|
|
|
+// webView = v.findViewById(R.id.webView);
|
|
|
+//
|
|
|
+// btnClose.setOnClickListener(new View.OnClickListener() {
|
|
|
+// @Override
|
|
|
+// public void onClick(View v) {
|
|
|
+// dialog.dismiss();
|
|
|
+// }
|
|
|
+// });
|
|
|
+//
|
|
|
+// WebSettings webSettings = webView.getSettings();
|
|
|
+// webSettings.setJavaScriptEnabled(true);
|
|
|
+// webSettings.setLoadWithOverviewMode(true);
|
|
|
+// webSettings.setUseWideViewPort(true);
|
|
|
+// webSettings.setSupportZoom(false);
|
|
|
+// webSettings.setAllowFileAccess(true);
|
|
|
+// webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
|
|
|
+// webSettings.setLoadsImagesAutomatically(true);
|
|
|
+// webSettings.setDefaultTextEncodingName("utf-8");
|
|
|
+//
|
|
|
+// webView.setWebViewClient(new WebViewClient() {
|
|
|
+// @Override
|
|
|
+// public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
|
|
+// try {
|
|
|
+// Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
|
|
+// startActivity(intent);
|
|
|
+// } catch (ActivityNotFoundException e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// }
|
|
|
+// return true;
|
|
|
+// }
|
|
|
+//
|
|
|
+// @Override
|
|
|
+// public void onPageFinished(WebView view, String url) {
|
|
|
+// super.onPageFinished(view, url);
|
|
|
+// }
|
|
|
+// });
|
|
|
+//
|
|
|
+// webView.loadUrl("https://github.com/kongzue/DialogX");
|
|
|
+// }
|
|
|
+// });
|
|
|
});
|
|
|
}
|
|
|
}
|