|
@@ -4,6 +4,9 @@ import android.app.Activity;
|
|
import android.app.Dialog;
|
|
import android.app.Dialog;
|
|
import android.content.Context;
|
|
import android.content.Context;
|
|
import android.graphics.Color;
|
|
import android.graphics.Color;
|
|
|
|
+import android.graphics.PointF;
|
|
|
|
+import android.net.Uri;
|
|
|
|
+import android.os.FileUtils;
|
|
import android.view.Display;
|
|
import android.view.Display;
|
|
import android.view.Gravity;
|
|
import android.view.Gravity;
|
|
import android.view.KeyEvent;
|
|
import android.view.KeyEvent;
|
|
@@ -16,9 +19,19 @@ import android.widget.ImageView;
|
|
import android.widget.PopupWindow;
|
|
import android.widget.PopupWindow;
|
|
import android.widget.TextView;
|
|
import android.widget.TextView;
|
|
|
|
|
|
|
|
+import com.bumptech.glide.Glide;
|
|
|
|
+import com.bumptech.glide.load.DataSource;
|
|
|
|
+import com.bumptech.glide.load.engine.GlideException;
|
|
|
|
+import com.bumptech.glide.request.RequestListener;
|
|
|
|
+import com.bumptech.glide.request.target.SimpleTarget;
|
|
|
|
+import com.bumptech.glide.request.target.Target;
|
|
|
|
+import com.davemorrissey.labs.subscaleview.ImageSource;
|
|
|
|
+import com.davemorrissey.labs.subscaleview.ImageViewState;
|
|
|
|
+import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView;
|
|
import com.edufound.reader.R;
|
|
import com.edufound.reader.R;
|
|
import com.edufound.reader.application.EApplication;
|
|
import com.edufound.reader.application.EApplication;
|
|
import com.edufound.reader.bean.ChannelCodeEnum;
|
|
import com.edufound.reader.bean.ChannelCodeEnum;
|
|
|
|
+import com.edufound.reader.bean.ModelBean;
|
|
import com.edufound.reader.bean.RecordResultBean;
|
|
import com.edufound.reader.bean.RecordResultBean;
|
|
import com.edufound.reader.bean.UserRecordBean;
|
|
import com.edufound.reader.bean.UserRecordBean;
|
|
import com.edufound.reader.cusview.GridRadioGroup;
|
|
import com.edufound.reader.cusview.GridRadioGroup;
|
|
@@ -27,29 +40,23 @@ import com.edufound.reader.listener.PopupRecordStatusListener;
|
|
import com.edufound.reader.miutil.MiSoundSDKUtil;
|
|
import com.edufound.reader.miutil.MiSoundSDKUtil;
|
|
import com.edufound.reader.presenter.PopWindowPresneter;
|
|
import com.edufound.reader.presenter.PopWindowPresneter;
|
|
import com.edufound.reader.util.Consts;
|
|
import com.edufound.reader.util.Consts;
|
|
|
|
+import com.edufound.reader.util.DataCleanManager;
|
|
import com.edufound.reader.util.DeviceUtil;
|
|
import com.edufound.reader.util.DeviceUtil;
|
|
import com.edufound.reader.util.DeviceUuidFactory;
|
|
import com.edufound.reader.util.DeviceUuidFactory;
|
|
|
|
+import com.edufound.reader.util.EfunboxUtil;
|
|
import com.edufound.reader.util.GlideUtils;
|
|
import com.edufound.reader.util.GlideUtils;
|
|
import com.edufound.reader.util.SizeUtils;
|
|
import com.edufound.reader.util.SizeUtils;
|
|
import com.jakewharton.rxbinding4.view.RxView;
|
|
import com.jakewharton.rxbinding4.view.RxView;
|
|
import com.orhanobut.logger.Logger;
|
|
import com.orhanobut.logger.Logger;
|
|
-import com.trello.rxlifecycle4.android.ActivityEvent;
|
|
|
|
|
|
|
|
-import java.util.List;
|
|
|
|
|
|
+import java.io.File;
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
import androidx.annotation.Nullable;
|
|
import androidx.annotation.Nullable;
|
|
import androidx.constraintlayout.widget.ConstraintLayout;
|
|
import androidx.constraintlayout.widget.ConstraintLayout;
|
|
|
|
+import androidx.recyclerview.widget.RecyclerView;
|
|
|
|
|
|
-import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
|
|
|
-import io.reactivex.rxjava3.annotations.NonNull;
|
|
|
|
-import io.reactivex.rxjava3.core.Observable;
|
|
|
|
-import io.reactivex.rxjava3.core.Observer;
|
|
|
|
import io.reactivex.rxjava3.functions.Consumer;
|
|
import io.reactivex.rxjava3.functions.Consumer;
|
|
-import io.reactivex.rxjava3.functions.Function;
|
|
|
|
-import kotlin.Unit;
|
|
|
|
-
|
|
|
|
-import static com.trello.rxlifecycle4.RxLifecycle.bindUntilEvent;
|
|
|
|
|
|
|
|
public class PopWindowUtil {
|
|
public class PopWindowUtil {
|
|
private static PopWindowPresneter mPresenter;
|
|
private static PopWindowPresneter mPresenter;
|
|
@@ -76,9 +83,12 @@ public class PopWindowUtil {
|
|
}
|
|
}
|
|
|
|
|
|
public static void hidePopupWindow() {
|
|
public static void hidePopupWindow() {
|
|
- if (mPopupWindow.isShowing()) {
|
|
|
|
|
|
+ if (mPopupWindow != null && mPopupWindow.isShowing()) {
|
|
mPopupWindow.dismiss();
|
|
mPopupWindow.dismiss();
|
|
}
|
|
}
|
|
|
|
+ if (recordPopupWindow != null && recordPopupWindow.isShowing()) {
|
|
|
|
+ recordPopupWindow.dismiss();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
public static void showExitAppWindow(Activity context, View parent) {
|
|
public static void showExitAppWindow(Activity context, View parent) {
|
|
@@ -86,6 +96,7 @@ public class PopWindowUtil {
|
|
if (checkWindowShoing()) {
|
|
if (checkWindowShoing()) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+ EfunboxUtil.initDesignSize(context);
|
|
dialog_view = (FrameLayout) LayoutInflater.from(context).inflate(R.layout.popupwindow_exit_app, null);
|
|
dialog_view = (FrameLayout) LayoutInflater.from(context).inflate(R.layout.popupwindow_exit_app, null);
|
|
dialog_view.setFocusable(true);
|
|
dialog_view.setFocusable(true);
|
|
ImageView image = dialog_view.findViewById(R.id.popupwindow_exit_app_image);
|
|
ImageView image = dialog_view.findViewById(R.id.popupwindow_exit_app_image);
|
|
@@ -114,6 +125,7 @@ public class PopWindowUtil {
|
|
if (checkWindowShoing()) {
|
|
if (checkWindowShoing()) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+ EfunboxUtil.initDesignSize(context);
|
|
dialog_view = (FrameLayout) LayoutInflater.from(context).inflate(R.layout.popupwindow_select_grade, null);
|
|
dialog_view = (FrameLayout) LayoutInflater.from(context).inflate(R.layout.popupwindow_select_grade, null);
|
|
dialog_view.setFocusable(true);
|
|
dialog_view.setFocusable(true);
|
|
FrameLayout btn_ok = dialog_view.findViewById(R.id.popupwindow_select_ok);
|
|
FrameLayout btn_ok = dialog_view.findViewById(R.id.popupwindow_select_ok);
|
|
@@ -187,6 +199,7 @@ public class PopWindowUtil {
|
|
if (checkWindowShoing()) {
|
|
if (checkWindowShoing()) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+ EfunboxUtil.initDesignSize(context);
|
|
dialog_view = (FrameLayout) LayoutInflater.from(context).inflate(R.layout.popupwindow_exit_login, null);
|
|
dialog_view = (FrameLayout) LayoutInflater.from(context).inflate(R.layout.popupwindow_exit_login, null);
|
|
dialog_view.setFocusable(true);
|
|
dialog_view.setFocusable(true);
|
|
ImageView image = dialog_view.findViewById(R.id.popupwindow_exit_login_image);
|
|
ImageView image = dialog_view.findViewById(R.id.popupwindow_exit_login_image);
|
|
@@ -209,6 +222,7 @@ public class PopWindowUtil {
|
|
if (checkWindowShoing()) {
|
|
if (checkWindowShoing()) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+ EfunboxUtil.initDesignSize(context);
|
|
dialog_view = (FrameLayout) LayoutInflater.from(context).inflate(R.layout.popupwindow_cancellation_account, null);
|
|
dialog_view = (FrameLayout) LayoutInflater.from(context).inflate(R.layout.popupwindow_cancellation_account, null);
|
|
dialog_view.setFocusable(true);
|
|
dialog_view.setFocusable(true);
|
|
FrameLayout exit = dialog_view.findViewById(R.id.popupwindow_cancellation_account_ok);
|
|
FrameLayout exit = dialog_view.findViewById(R.id.popupwindow_cancellation_account_ok);
|
|
@@ -230,6 +244,7 @@ public class PopWindowUtil {
|
|
if (checkWindowShoing()) {
|
|
if (checkWindowShoing()) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+ EfunboxUtil.initDesignSize(context);
|
|
dialog_view = (FrameLayout) LayoutInflater.from(context).inflate(R.layout.popupwindow_bind_wechat, null);
|
|
dialog_view = (FrameLayout) LayoutInflater.from(context).inflate(R.layout.popupwindow_bind_wechat, null);
|
|
dialog_view.setFocusable(true);
|
|
dialog_view.setFocusable(true);
|
|
ImageView back = dialog_view.findViewById(R.id.popupwindow_bindwechat_back);
|
|
ImageView back = dialog_view.findViewById(R.id.popupwindow_bindwechat_back);
|
|
@@ -256,6 +271,7 @@ public class PopWindowUtil {
|
|
if (record_view != null) {
|
|
if (record_view != null) {
|
|
record_view = null;
|
|
record_view = null;
|
|
}
|
|
}
|
|
|
|
+ EfunboxUtil.initDesignSize(context);
|
|
record_view = (FrameLayout) LayoutInflater.from(context).inflate(R.layout.popupwindow_record_status, null);
|
|
record_view = (FrameLayout) LayoutInflater.from(context).inflate(R.layout.popupwindow_record_status, null);
|
|
record_view.setFocusable(true);
|
|
record_view.setFocusable(true);
|
|
record_view.setOnKeyListener(new View.OnKeyListener() {
|
|
record_view.setOnKeyListener(new View.OnKeyListener() {
|
|
@@ -292,6 +308,7 @@ public class PopWindowUtil {
|
|
mPopupWindow.dismiss();
|
|
mPopupWindow.dismiss();
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+ EfunboxUtil.initDesignSize(context);
|
|
dialog_view = (FrameLayout) LayoutInflater.from(context).inflate(R.layout.popupwindow_myorder, null);
|
|
dialog_view = (FrameLayout) LayoutInflater.from(context).inflate(R.layout.popupwindow_myorder, null);
|
|
dialog_view.setFocusable(true);
|
|
dialog_view.setFocusable(true);
|
|
dialog_view.setOnKeyListener(new View.OnKeyListener() {
|
|
dialog_view.setOnKeyListener(new View.OnKeyListener() {
|
|
@@ -317,6 +334,7 @@ public class PopWindowUtil {
|
|
if (checkWindowShoing()) {
|
|
if (checkWindowShoing()) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+ EfunboxUtil.initDesignSize(context);
|
|
dialog_view = (FrameLayout) LayoutInflater.from(context).inflate(R.layout.popupwindow_record_remove, null);
|
|
dialog_view = (FrameLayout) LayoutInflater.from(context).inflate(R.layout.popupwindow_record_remove, null);
|
|
dialog_view.setFocusable(true);
|
|
dialog_view.setFocusable(true);
|
|
FrameLayout ok = dialog_view.findViewById(R.id.popupwindow_record_remove_ok);
|
|
FrameLayout ok = dialog_view.findViewById(R.id.popupwindow_record_remove_ok);
|
|
@@ -342,6 +360,7 @@ public class PopWindowUtil {
|
|
if (checkWindowShoing()) {
|
|
if (checkWindowShoing()) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+ EfunboxUtil.initDesignSize(context);
|
|
dialog_view = (FrameLayout) LayoutInflater.from(context).inflate(R.layout.popupwindow_registration_events, null);
|
|
dialog_view = (FrameLayout) LayoutInflater.from(context).inflate(R.layout.popupwindow_registration_events, null);
|
|
dialog_view.setFocusable(true);
|
|
dialog_view.setFocusable(true);
|
|
ImageView img = dialog_view.findViewById(R.id.popupwindow_registration_events_img);
|
|
ImageView img = dialog_view.findViewById(R.id.popupwindow_registration_events_img);
|
|
@@ -369,6 +388,7 @@ public class PopWindowUtil {
|
|
listener.clickSubmit(null);
|
|
listener.clickSubmit(null);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+ EfunboxUtil.initDesignSize(context);
|
|
dialog_view = (FrameLayout) LayoutInflater.from(context).inflate(R.layout.popupwindow_webs_events, null);
|
|
dialog_view = (FrameLayout) LayoutInflater.from(context).inflate(R.layout.popupwindow_webs_events, null);
|
|
dialog_view.setFocusable(true);
|
|
dialog_view.setFocusable(true);
|
|
ImageView img = dialog_view.findViewById(R.id.popupwindow_webs_events_img);
|
|
ImageView img = dialog_view.findViewById(R.id.popupwindow_webs_events_img);
|
|
@@ -403,6 +423,7 @@ public class PopWindowUtil {
|
|
mPopupWindow.dismiss();
|
|
mPopupWindow.dismiss();
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+ EfunboxUtil.initDesignSize(context);
|
|
dialog_view = (FrameLayout) LayoutInflater.from(context).inflate(R.layout.popupwindow_mi_sound_qrcode_layout, null);
|
|
dialog_view = (FrameLayout) LayoutInflater.from(context).inflate(R.layout.popupwindow_mi_sound_qrcode_layout, null);
|
|
dialog_view.setFocusable(true);
|
|
dialog_view.setFocusable(true);
|
|
dialog_view.setOnKeyListener(new View.OnKeyListener() {
|
|
dialog_view.setOnKeyListener(new View.OnKeyListener() {
|
|
@@ -455,6 +476,75 @@ public class PopWindowUtil {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 超长图popupwindow
|
|
|
|
+ */
|
|
|
|
+ public static void showLongSizeImg(Context context, String url, View parent) {
|
|
|
|
+ initPresenter();
|
|
|
|
+ if (checkWindowShoing()) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ EfunboxUtil.initDesignSize(context);
|
|
|
|
+ dialog_view = (FrameLayout) LayoutInflater.from(context).inflate(R.layout.popupwindow_show_rule, null);
|
|
|
|
+ dialog_view.setFocusable(true);
|
|
|
|
+ final File[] imgResource = new File[1];
|
|
|
|
+ SubsamplingScaleImageView imageView = (SubsamplingScaleImageView) dialog_view.findViewById(R.id.imageview);
|
|
|
|
+ imageView.setMinimumScaleType(SubsamplingScaleImageView.SCALE_TYPE_CUSTOM);
|
|
|
|
+ imageView.setMinScale(1.0F);
|
|
|
|
+ //下载图片保存到本地
|
|
|
|
+ GlideUtils.downloadImage(context, url, new RequestListener<File>() {
|
|
|
|
+ @Override
|
|
|
|
+ public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<File> target, boolean isFirstResource) {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public boolean onResourceReady(File resource, Object model, Target<File> target, DataSource dataSource, boolean isFirstResource) {
|
|
|
|
+ imgResource[0] = resource;
|
|
|
|
+ imageView.setImage(ImageSource.uri(Uri.fromFile(resource)), new ImageViewState(1.0F, new PointF(0, 0), 0));
|
|
|
|
+// Uri uri = Uri.fromFile(resource);
|
|
|
|
+// imageView.setImage(uri);
|
|
|
|
+
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ ImageView back = dialog_view.findViewById(R.id.popupwindow_show_rule_back);
|
|
|
|
+ setClickListener(back, o -> {
|
|
|
|
+ if (imgResource[0] != null) {
|
|
|
|
+ DataCleanManager.deleteFilesByDirectory(imgResource[0]);
|
|
|
|
+ }
|
|
|
|
+ mPopupWindow.dismiss();
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ newPopupWindow(parent, true);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 排行榜
|
|
|
|
+ * */
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 超长图popupwindow
|
|
|
|
+ */
|
|
|
|
+ public static void showRankListWindow(Context context, ModelBean.ReadUserList bean, View parent) {
|
|
|
|
+ initPresenter();
|
|
|
|
+ if (checkWindowShoing()) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ EfunboxUtil.initDesignSize(context);
|
|
|
|
+ dialog_view = (FrameLayout) LayoutInflater.from(context).inflate(R.layout.popupwindow_show_ranklist, null);
|
|
|
|
+ dialog_view.setFocusable(true);
|
|
|
|
+ mPresenter.rankListInit(context, dialog_view, bean.getId());
|
|
|
|
+ ImageView back = dialog_view.findViewById(R.id.popupwindow_ranklist_back);
|
|
|
|
+ setClickListener(back, o -> {
|
|
|
|
+ mPopupWindow.dismiss();
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ newPopupWindow(parent, true);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
private static void showDeviceInfo(Activity context) {
|
|
private static void showDeviceInfo(Activity context) {
|
|
StringBuffer buffer = new StringBuffer();
|
|
StringBuffer buffer = new StringBuffer();
|
|
buffer.append("\tchannel:\t" + "\t" + Consts.getUmengChannel() + "\n");
|
|
buffer.append("\tchannel:\t" + "\t" + Consts.getUmengChannel() + "\n");
|