|
@@ -54,6 +54,11 @@ public class PopWindowUtil {
|
|
|
private static PopupWindow mPopupWindow;
|
|
|
private static FrameLayout dialog_view;
|
|
|
|
|
|
+ private static PopupWindow recordPopupWindow;
|
|
|
+ private static FrameLayout record_view;
|
|
|
+
|
|
|
+ private static PopupWindow eventPopupWindow;
|
|
|
+ private static FrameLayout event_view;
|
|
|
|
|
|
private static void initPresenter() {
|
|
|
if (mPresenter == null) {
|
|
@@ -243,12 +248,15 @@ public class PopWindowUtil {
|
|
|
|
|
|
public static void showRecordStatusWindow(Activity context, View parent, RecordResultBean bean, UserRecordBean.UserRead userread, PopupRecordStatusListener listener) {
|
|
|
initPresenter();
|
|
|
- if (checkWindowShoing()) {
|
|
|
- return;
|
|
|
+ if (recordPopupWindow != null) {
|
|
|
+ recordPopupWindow = null;
|
|
|
}
|
|
|
- dialog_view = (FrameLayout) LayoutInflater.from(context).inflate(R.layout.popupwindow_record_status, null);
|
|
|
- dialog_view.setFocusable(true);
|
|
|
- dialog_view.setOnKeyListener(new View.OnKeyListener() {
|
|
|
+ if (record_view != null) {
|
|
|
+ record_view = null;
|
|
|
+ }
|
|
|
+ record_view = (FrameLayout) LayoutInflater.from(context).inflate(R.layout.popupwindow_record_status, null);
|
|
|
+ record_view.setFocusable(true);
|
|
|
+ record_view.setOnKeyListener(new View.OnKeyListener() {
|
|
|
@Override
|
|
|
public boolean onKey(View v, int keyCode, KeyEvent event) {
|
|
|
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
|
@@ -257,18 +265,29 @@ public class PopWindowUtil {
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
- ImageView back = dialog_view.findViewById(R.id.popupwindow_record_status_close);
|
|
|
+ ImageView back = record_view.findViewById(R.id.popupwindow_record_status_close);
|
|
|
setClickListener(back, o -> {
|
|
|
- mPopupWindow.dismiss();
|
|
|
+ recordPopupWindow.dismiss();
|
|
|
+ });
|
|
|
+ mPresenter.initRecordStatusWindow(context, record_view, bean, userread, listener);
|
|
|
+ recordPopupWindow = new PopupWindow(record_view, FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);
|
|
|
+ recordPopupWindow.setFocusable(false);
|
|
|
+ recordPopupWindow.showAtLocation(parent, Gravity.CENTER, 0, 0);
|
|
|
+ recordPopupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
|
|
|
+ @Override
|
|
|
+ public void onDismiss() {
|
|
|
+ record_view.removeAllViews();
|
|
|
+ record_view = null;
|
|
|
+ recordPopupWindow = null;
|
|
|
+ }
|
|
|
});
|
|
|
- mPresenter.initRecordStatusWindow(context, dialog_view, bean, userread, listener);
|
|
|
- newPopupWindow(parent, false);
|
|
|
}
|
|
|
|
|
|
|
|
|
public static void showMyOrderWindow(Activity context, View parent) {
|
|
|
initPresenter();
|
|
|
if (checkWindowShoing()) {
|
|
|
+ mPopupWindow.dismiss();
|
|
|
return;
|
|
|
}
|
|
|
dialog_view = (FrameLayout) LayoutInflater.from(context).inflate(R.layout.popupwindow_myorder, null);
|
|
@@ -344,28 +363,35 @@ public class PopWindowUtil {
|
|
|
*/
|
|
|
public static void webviewEventsWindow(Context context, View parent, PopUtilClickListener listener, boolean needwindow) {
|
|
|
initPresenter();
|
|
|
- if (checkWindowShoing()) {
|
|
|
- return;
|
|
|
- }
|
|
|
if (!needwindow) {
|
|
|
listener.clickSubmit(null);
|
|
|
return;
|
|
|
}
|
|
|
- dialog_view = (FrameLayout) LayoutInflater.from(context).inflate(R.layout.popupwindow_webs_events, null);
|
|
|
- dialog_view.setFocusable(true);
|
|
|
- ImageView img = dialog_view.findViewById(R.id.popupwindow_webs_events_img);
|
|
|
+ event_view = (FrameLayout) LayoutInflater.from(context).inflate(R.layout.popupwindow_webs_events, null);
|
|
|
+ event_view.setFocusable(true);
|
|
|
+ ImageView img = event_view.findViewById(R.id.popupwindow_webs_events_img);
|
|
|
GlideUtils.loadImageSizeKipMemoryCache(context, "http://reader-apk.ai160.com/reader-apk/res/event_img.png", img);
|
|
|
- ImageView close = dialog_view.findViewById(R.id.popupwindow_webs_events_close);
|
|
|
+ ImageView close = event_view.findViewById(R.id.popupwindow_webs_events_close);
|
|
|
setClickListener(img, o -> {
|
|
|
- mPopupWindow.dismiss();
|
|
|
+ eventPopupWindow.dismiss();
|
|
|
listener.clickSubmit(null);
|
|
|
});
|
|
|
|
|
|
setClickListener(close, o -> {
|
|
|
- mPopupWindow.dismiss();
|
|
|
+ eventPopupWindow.dismiss();
|
|
|
listener.clickCancel();
|
|
|
});
|
|
|
- newPopupWindow(parent, true);
|
|
|
+ eventPopupWindow = new PopupWindow(event_view, FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);
|
|
|
+ eventPopupWindow.setFocusable(true);
|
|
|
+ eventPopupWindow.showAtLocation(parent, Gravity.CENTER, 0, 0);
|
|
|
+ eventPopupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
|
|
|
+ @Override
|
|
|
+ public void onDismiss() {
|
|
|
+ event_view.removeAllViews();
|
|
|
+ event_view = null;
|
|
|
+ eventPopupWindow = null;
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
|