diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index ded4c2c0f..8b793787a 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -157,6 +157,9 @@
+
diff --git a/common/src/main/java/com/yunbao/common/CommonAppConfig.java b/common/src/main/java/com/yunbao/common/CommonAppConfig.java
index 6b1a7119d..46fc66581 100644
--- a/common/src/main/java/com/yunbao/common/CommonAppConfig.java
+++ b/common/src/main/java/com/yunbao/common/CommonAppConfig.java
@@ -37,6 +37,7 @@ public class CommonAppConfig {
public static final boolean IS_UPLOAD_ERROR_LOG = getMetaDataBoolean("IS_UPLOAD_ERROR_LOG");
//是否为插件包模式
public static final boolean IS_PLUGIN_MODEL = getMetaDataBoolean("IS_PLUGIN_MODEL");
+ public static final String BUILD_TIME = getMetaDataString("BUILD_TIME");
//外部sd卡
public static final String DCMI_PATH = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM).getAbsolutePath();
diff --git a/common/src/main/java/com/yunbao/common/dialog/DebugDialog.java b/common/src/main/java/com/yunbao/common/dialog/DebugDialog.java
index 6ad00a421..bde2acfbd 100644
--- a/common/src/main/java/com/yunbao/common/dialog/DebugDialog.java
+++ b/common/src/main/java/com/yunbao/common/dialog/DebugDialog.java
@@ -15,6 +15,7 @@ import com.lzf.easyfloat.EasyFloat;
import com.lzf.easyfloat.enums.ShowPattern;
import com.lzf.easyfloat.interfaces.OnPermissionResult;
import com.lzf.easyfloat.permission.PermissionUtils;
+import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.adapter.DebugDialogAdapter;
import com.yunbao.common.utils.AppManager;
import com.yunbao.common.utils.ToastUtil;
@@ -138,7 +139,7 @@ public class DebugDialog {
EasyFloat.updateFloat("debug");
}
});
- params.put("debug弹窗", textView);
+ params.put("发包时间:"+ CommonAppConfig.BUILD_TIME, textView);
adapter.setParamMap(params);
EasyFloat.with(mContext)
diff --git a/common/src/main/java/com/yunbao/common/manager/OpenAdManager.java b/common/src/main/java/com/yunbao/common/manager/OpenAdManager.java
index b90621a4a..1e5f1d7d3 100644
--- a/common/src/main/java/com/yunbao/common/manager/OpenAdManager.java
+++ b/common/src/main/java/com/yunbao/common/manager/OpenAdManager.java
@@ -83,7 +83,6 @@ public class OpenAdManager {
LiveNetManager.get(context).activityPopup(new HttpCallback>() {
@Override
public void onSuccess(List data) {
- data.clear();
if (data == null || data.isEmpty()) {
Log.i(TAG, "onSuccess: 没有数据");
list = new ArrayList<>();
diff --git a/common/src/main/java/com/yunbao/common/views/APKUpdateCustomPopup.java b/common/src/main/java/com/yunbao/common/views/APKUpdateCustomPopup.java
index f860e2203..7747bfa9b 100644
--- a/common/src/main/java/com/yunbao/common/views/APKUpdateCustomPopup.java
+++ b/common/src/main/java/com/yunbao/common/views/APKUpdateCustomPopup.java
@@ -2,6 +2,7 @@ package com.yunbao.common.views;
import android.app.Activity;
import android.content.Context;
+import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
@@ -44,6 +45,7 @@ public class APKUpdateCustomPopup extends CenterPopupView {
private ProgressBar progressBar;
private Activity mContext;
private boolean mInside;
+ private DialogInterface.OnDismissListener onDismissListener;
public APKUpdateCustomPopup(@NonNull Activity context, boolean inside) {
super(context);
@@ -57,6 +59,11 @@ public class APKUpdateCustomPopup extends CenterPopupView {
return R.layout.apk_update_custom_popup;
}
+ public APKUpdateCustomPopup setOnDismissListener(DialogInterface.OnDismissListener onDismissListener) {
+ this.onDismissListener = onDismissListener;
+ return this;
+ }
+
// 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑
@Override
protected void onCreate() {
@@ -69,6 +76,14 @@ public class APKUpdateCustomPopup extends CenterPopupView {
}
+ @Override
+ protected void onDismiss() {
+ super.onDismiss();
+ if (onDismissListener != null) {
+ onDismissListener.onDismiss(null);
+ }
+ }
+
private void initView() {
if (!mInside) {
if (CommonAppConfig.IS_GOOGLE_PLAY == 0 && APKManager.get().getAPKGoogleIsUp() == 1) {
diff --git a/config.gradle b/config.gradle
index 14d48a2a1..fe92cbdd4 100644
--- a/config.gradle
+++ b/config.gradle
@@ -13,6 +13,8 @@ ext {
// 测试
serverHost : "https://ceshi.yaoulive.com",
+ buildTime : new Date().format("MM-dd HH:mm", TimeZone.getTimeZone("GMT+8")),
+
//百度语音识别
baiduAppId : "23774720",
diff --git a/main/src/main/java/com/yunbao/main/activity/MainActivity.java b/main/src/main/java/com/yunbao/main/activity/MainActivity.java
index ab940bbfb..ad4ebd3f5 100644
--- a/main/src/main/java/com/yunbao/main/activity/MainActivity.java
+++ b/main/src/main/java/com/yunbao/main/activity/MainActivity.java
@@ -12,6 +12,7 @@ import android.app.NotificationChannel;
import android.app.PendingIntent;
import android.content.ClipData;
import android.content.Context;
+import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
@@ -551,7 +552,6 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
//获取指导员账号
ConversationIMListManager.get(this).getUserInstructor(this);
checkVersion();
- OpenAdManager.getInstance().show(OpenAdManager.TYPE_HOME, false);
}
/**
@@ -848,7 +848,15 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
if (!APKManager.get().getApkVerNew()) {
new XPopup.Builder(mContext).isDestroyOnDismiss(true).dismissOnBackPressed(false) // 按返回键是否关闭弹窗,默认为true
.dismissOnTouchOutside(false) // 点击外部是否关闭弹窗,默认为true
- .asCustom(new APKUpdateCustomPopup(mContext, false)).show();
+ .asCustom(
+ new APKUpdateCustomPopup(mContext, false)
+ .setOnDismissListener(new DialogInterface.OnDismissListener() {
+ @Override
+ public void onDismiss(DialogInterface dialogInterface) {
+ requestBonus();
+ }
+ })
+ ).show();
}
} else {
requestBonus();
@@ -858,6 +866,10 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
});
}
+ private void initAdOpenWindows() {
+ OpenAdManager.getInstance().show(OpenAdManager.TYPE_HOME, false);
+ }
+
/**
* 填写邀请码
*/
@@ -888,14 +900,21 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
* 签到奖励
*/
SigninDialog fragment;
+ boolean isRequestBonus = false;
private void requestBonus() {
fragment = new SigninDialog();
MainHttpUtil.requestNewBonus(new HttpCallback() {
@Override
- public void onSuccess(int code, String msg, String[] info) {
+ public void onError() {
+ super.onError();
+ isRequestBonus = true;
+ }
+ @Override
+ public void onSuccess(int code, String msg, String[] info) {
+ isRequestBonus = true;
if (info.length > 0) {
JSONObject obj = JSON.parseObject(info[0]);
if (code == 0) {
@@ -904,14 +923,24 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
bundle.putString("send_exp", obj.getString("send_exp"));
bundle.putString("sign_day", obj.getString("sign_day"));
fragment.setArguments(bundle);
+ fragment.setOnDismissListener(new DialogInterface.OnDismissListener() {
+ @Override
+ public void onDismiss(DialogInterface dialogInterface) {
+ initAdOpenWindows();
+ }
+ });
if (!getSupportFragmentManager().isStateSaved()) {
fragment.show(getSupportFragmentManager(), "SigninDialog");
}
+ } else {
+ initAdOpenWindows();
}
if (obj != null && obj.containsKey("msg_zdy_send") && obj.containsKey("msg_zdy_send_text")) {
Log.e("MainActivity333", info[0]);
NoviceInstructorManager.get(mContext).getNetNoviceInstructor(info[0]);
}
+ } else {
+ initAdOpenWindows();
}
}
});
@@ -945,7 +974,9 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
NoviceInstructorManager.get(mContext).getNoviceInstructor();
NoviceInstructorManager.get(mContext).checktHomeZdyPop();
initAnchorRecommendBanner();
- OpenAdManager.getInstance().show(OpenAdManager.TYPE_HOME, false);
+ if (isRequestBonus) {
+ initAdOpenWindows();
+ }
}
/**
diff --git a/main/src/main/java/com/yunbao/main/dialog/SigninDialog.java b/main/src/main/java/com/yunbao/main/dialog/SigninDialog.java
index 219ede7e6..85c3969fb 100644
--- a/main/src/main/java/com/yunbao/main/dialog/SigninDialog.java
+++ b/main/src/main/java/com/yunbao/main/dialog/SigninDialog.java
@@ -3,6 +3,7 @@ package com.yunbao.main.dialog;
import static com.yunbao.common.utils.RouteUtil.PATH_REWARD;
import android.annotation.SuppressLint;
+import android.content.DialogInterface;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
@@ -20,12 +21,18 @@ import com.yunbao.main.R;
public class SigninDialog extends AbsDialogFragment {
TextView gold, sign_day;
+ private DialogInterface.OnDismissListener onDismissListener;
@Override
protected int getLayoutId() {
return R.layout.signin_dialog;
}
+ public SigninDialog setOnDismissListener(DialogInterface.OnDismissListener onDismissListener) {
+ this.onDismissListener = onDismissListener;
+ return this;
+ }
+
@Override
protected int getDialogStyle() {
return R.style.dialog;
@@ -58,7 +65,7 @@ public class SigninDialog extends AbsDialogFragment {
goto_sign.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
- ARouter.getInstance().build(PATH_REWARD).withString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&m=task&a=index" + "&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken()+ "&isZh=" + (WordUtil.isNewZh() ? "1" : "0")).navigation();
+ ARouter.getInstance().build(PATH_REWARD).withString("url", CommonAppConfig.HOST + "/index.php?g=Appapi&m=task&a=index" + "&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&isZh=" + (WordUtil.isNewZh() ? "1" : "0")).navigation();
dismiss();
}
@@ -79,4 +86,12 @@ public class SigninDialog extends AbsDialogFragment {
sign_day.setText(String.format(getString(R.string.this_month), bundle.getString("sign_day")));
}
+
+ @Override
+ public void onDismiss(DialogInterface dialog) {
+ super.onDismiss(dialog);
+ if (onDismissListener != null) {
+ onDismissListener.onDismiss(dialog);
+ }
+ }
}