调整弹窗逻辑

This commit is contained in:
zlzw 2024-05-28 15:02:15 +08:00
parent 225929c891
commit 8d5990c25b
10 changed files with 300 additions and 71 deletions

View File

@ -113,6 +113,7 @@ public class LauncherActivity extends AppCompatActivity implements View.OnClickL
res.updateConfiguration(config, res.getDisplayMetrics());
return res;
}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
getWindow().requestFeature(Window.FEATURE_ACTIVITY_TRANSITIONS);
@ -144,7 +145,11 @@ public class LauncherActivity extends AppCompatActivity implements View.OnClickL
}
};
mHandler.sendEmptyMessageDelayed(WHAT_GET_CONFIG, 1000);
try {
LogUtil.uploadErrorLog(AppContext.sInstance);
} catch (Exception e) {
e.printStackTrace();
}
SpUtil.getInstance().setBooleanValue("NOTIFICATION", NotificationManagerCompat.from(this).areNotificationsEnabled());
}

View File

@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.views.weight.ViewClicksAntiShake;
import java.text.ParseException;
import java.text.SimpleDateFormat;
@ -22,6 +23,8 @@ public class OpenAdModel extends BaseModel {
public static final int SHOW_ONE = 3;//3. 仅弹出一次
@SerializedName("id")
private int id;
@SerializedName("popup_name")
private String name;
@SerializedName("popup_location")
private int type = TYPE_HOME;
@SerializedName("activity_url")
@ -35,16 +38,17 @@ public class OpenAdModel extends BaseModel {
@SerializedName("popup_model")
private int model = MODEL_SQUARE;
@SerializedName("start_show_time")
private String startTime;//活动开始时间
private String startTime;//活动开始时间 1
@SerializedName("end_show_time")
private String endTime;//活动结束时间
private String endTime;//活动结束时间 5
@SerializedName("popup_permission")
private int permission;
@SerializedName("popup_frequency")
private int showModel = SHOW_DEF;//显示模式1杀死程序后弹出 2指定时间内本机时间 31. 仅弹出一次
@SerializedName("popup_frequency_time")
private String section = "0";// SHOW_DEF = 2
private String section = "0";// SHOW_DEF = 2 1
@SerializedName("popup_sort")
private int sort = 1;//弹框类型 1.图片 2.H5
public OpenAdModel() {
}
@ -66,6 +70,22 @@ public class OpenAdModel extends BaseModel {
return model;
}
public int getSort() {
return sort;
}
public void setSort(int sort) {
this.sort = sort;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getShowModel() {
return showModel;
}
@ -96,6 +116,7 @@ public class OpenAdModel extends BaseModel {
}
return url + "?t=" + System.currentTimeMillis() / 1000;
}
public String getOriginalUrl() {
return url;
}
@ -198,6 +219,7 @@ public class OpenAdModel extends BaseModel {
public String toString() {
return "OpenAdModel{" +
"id=" + id +
", name='" + name + '\'' +
", type=" + type +
", url='" + url + '\'' +
", imageUrl='" + imageUrl + '\'' +
@ -206,7 +228,10 @@ public class OpenAdModel extends BaseModel {
", model=" + model +
", startTime='" + startTime + '\'' +
", endTime='" + endTime + '\'' +
", permission='" + permission + '\'' +
", permission=" + permission +
", showModel=" + showModel +
", section='" + section + '\'' +
", sort=" + sort +
'}';
}
}

View File

@ -20,13 +20,14 @@ import com.yunbao.common.utils.AppManager;
import com.yunbao.common.utils.ToastUtil;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Timer;
import java.util.TimerTask;
public class DebugDialog {
RecyclerView recyclerView;
HashMap<String, View> params;
LinkedHashMap<String, View> params;
DebugDialogAdapter adapter;
private static DebugDialog debugDialog;
Context mContext;
@ -69,7 +70,7 @@ public class DebugDialog {
this.runnable = runnable;
if (params == null) {
Log.i("debug弹窗", "DebugDialog: 初始化参数");
params = new HashMap<>();
params = new LinkedHashMap<>();
}
init();
}
@ -102,6 +103,7 @@ public class DebugDialog {
}
public void show() {
if (recyclerView != null) return;
if (showPattern == ShowPattern.CURRENT_ACTIVITY) {
createView();
return;

View File

@ -1,7 +1,10 @@
package com.yunbao.common.dialog;
import android.app.Activity;
import android.content.Context;
import android.webkit.WebView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import androidx.annotation.NonNull;
@ -9,12 +12,18 @@ import com.lxj.xpopup.XPopup;
import com.yunbao.common.R;
import com.yunbao.common.activity.WebViewActivity;
import com.yunbao.common.bean.OpenAdModel;
import com.yunbao.common.event.JavascriptInterfaceEvent;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.JavascriptInterfaceUtils;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
public class OpenAdBottomDialogPopup extends AbsDialogPopupWindow {
private ImageView mImageView;
private ImageView mClose;
private LinearLayout contentLayout;
private OpenAdModel model;
private OnItemClickListener<OpenAdModel> mListener;
@ -27,6 +36,11 @@ public class OpenAdBottomDialogPopup extends AbsDialogPopupWindow {
@Override
public void buildDialog(XPopup.Builder builder) {
builder.animationDuration(0);
builder.hasShadowBg(true);
if(model.getSort()==2){
builder.dismissOnTouchOutside(false);
builder.dismissOnBackPressed(false);
}
}
@Override
@ -51,8 +65,47 @@ public class OpenAdBottomDialogPopup extends AbsDialogPopupWindow {
@Override
protected void onCreate() {
super.onCreate();
mImageView = findViewById(R.id.img);
contentLayout = findViewById(R.id.content_layout);
mClose = findViewById(R.id.close);
if (model.getSort() == 1) {
setImage();
} else {
setWeb();
}
mClose.setOnClickListener(v -> dismiss());
if (model.getShowTime() > 0) {
mClose.postDelayed(this::dismiss, model.getShowTime());
}
}
private void setWeb() {
WebView mWebView = new WebView(mContext);
mWebView.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));
mWebView.addJavascriptInterface(JavascriptInterfaceUtils.getInstance().setmContext((Activity) mContext, mWebView).setPageClose(true).setLiveZhuangBana(false), "androidObject");
mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); // 是否允许JS打开新窗口
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setDomStorageEnabled(true);
String appCachePath = mContext.getCacheDir().getAbsolutePath();
// mWebView.getSettings().setAppCachePath(appCachePath);
mWebView.getSettings().setAllowFileAccess(true);
mWebView.getSettings().setUseWideViewPort(true); // 关键点
mWebView.getSettings().setAllowFileAccess(true); // 允许访问文件
mWebView.setHorizontalScrollBarEnabled(false);
mWebView.setVerticalScrollBarEnabled(false);
String url=model.getUrl();
if(url.contains("?")){
url+="&uid="+ IMLoginManager.get(mContext).getUserInfo().getId()+"&token="+IMLoginManager.get(mContext).getUserInfo().getToken();
}else{
url+="?uid="+ IMLoginManager.get(mContext).getUserInfo().getId()+"&token="+IMLoginManager.get(mContext).getUserInfo().getToken();
}
mWebView.loadUrl(url);
contentLayout.addView(mWebView);
}
private void setImage() {
ImageView mImageView = new ImageView(mContext);
mImageView.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));
mImageView.setOnClickListener(v -> {
WebViewActivity.forward(mContext, model.getUrl(), model.getType() != OpenAdModel.TYPE_HOME);
if (mListener != null) {
@ -61,10 +114,12 @@ public class OpenAdBottomDialogPopup extends AbsDialogPopupWindow {
}
dismiss();
});
mClose.setOnClickListener(v -> dismiss());
ImgLoader.display(mContext, model.getImageUrl(), mImageView);
if (model.getShowTime() > 0) {
mClose.postDelayed(this::dismiss, model.getShowTime());
}
contentLayout.addView(mImageView);
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onJavascriptInterfaceEvent(JavascriptInterfaceEvent event) {
}
}

View File

@ -1,8 +1,13 @@
package com.yunbao.common.dialog;
import android.app.Activity;
import android.content.Context;
import android.graphics.Color;
import android.util.Log;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import androidx.annotation.NonNull;
import androidx.constraintlayout.widget.ConstraintLayout;
@ -11,14 +16,23 @@ import com.lxj.xpopup.XPopup;
import com.yunbao.common.R;
import com.yunbao.common.activity.WebViewActivity;
import com.yunbao.common.bean.OpenAdModel;
import com.yunbao.common.event.JavascriptInterfaceEvent;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.JavascriptInterfaceUtils;
import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.ScreenDimenUtil;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.util.Map;
public class OpenAdCenterDialogPopup extends AbsDialogFullScreenPopupWindow {
private ImageView mImageView;
private LinearLayout contentLayout;
private ImageView mClose;
private OpenAdModel model;
private OnItemClickListener<OpenAdModel> mListener;
@ -39,7 +53,8 @@ public class OpenAdCenterDialogPopup extends AbsDialogFullScreenPopupWindow {
@Override
public void buildDialog(XPopup.Builder builder) {
builder.hasShadowBg(false);
builder.hasShadowBg(true);
builder.shadowBgColor(Color.parseColor("#80000000"));
builder.animationDuration(0);
}
@ -62,9 +77,58 @@ public class OpenAdCenterDialogPopup extends AbsDialogFullScreenPopupWindow {
protected void onCreate() {
super.onCreate();
Log.e("-----弹窗-----", "onCreate: 创建弹窗");
mImageView = findViewById(R.id.img);
contentLayout = findViewById(R.id.content_layout);
mClose = findViewById(R.id.close);
if (model.getSort() == 1) {
setImage(model);
findViewById(R.id.layout).setOnClickListener(v -> dismiss());
} else {
setWeb(model);
}
mClose.setOnClickListener(v -> dismiss());
if (model.getShowTime() > 0) {
mClose.postDelayed(this::dismiss, model.getShowTime());
}
}
private void setWeb(OpenAdModel model) {
int width = ScreenDimenUtil.getInstance().getScreenWdith() - DpUtil.dp2px(20);
int height = (int) (width * 1.4);
if (model.getModel() == OpenAdModel.MODEL_SQUARE) {
height = (int) (width * 1.2);
}
WebView mWebView = new WebView(mContext);
mWebView.setLayoutParams(new LinearLayout.LayoutParams(width, height));
mWebView.addJavascriptInterface(JavascriptInterfaceUtils.getInstance().setmContext((Activity) mContext, mWebView).setPageClose(true).setLiveZhuangBana(false), "androidObject");
mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); // 是否允许JS打开新窗口
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setDomStorageEnabled(true);
String appCachePath = mContext.getCacheDir().getAbsolutePath();
// mWebView.getSettings().setAppCachePath(appCachePath);
mWebView.getSettings().setAllowFileAccess(true);
mWebView.getSettings().setUseWideViewPort(true); // 关键点
mWebView.getSettings().setAllowFileAccess(true); // 允许访问文件
mWebView.setHorizontalScrollBarEnabled(false);
mWebView.setVerticalScrollBarEnabled(false);
String url = model.getUrl();
if (url.contains("?")) {
url += "&uid=" + IMLoginManager.get(mContext).getUserInfo().getId() + "&token=" + IMLoginManager.get(mContext).getUserInfo().getToken();
} else {
url += "?uid=" + IMLoginManager.get(mContext).getUserInfo().getId() + "&token=" + IMLoginManager.get(mContext).getUserInfo().getToken();
}
Log.i("-----弹窗-----", "setWeb: "+url);
mWebView.loadUrl(url);
contentLayout.addView(mWebView);
}
private void setImage(OpenAdModel model) {
int width = ScreenDimenUtil.getInstance().getScreenWdith() - DpUtil.dp2px(20);
int height = (int) (width * 1.4);
if (model.getModel() == OpenAdModel.MODEL_SQUARE) {
height = (int) (width * 1.2);
}
mImageView = new ImageView(mContext);
mImageView.setLayoutParams(new LinearLayout.LayoutParams(width, height));
mImageView.setOnClickListener(v -> {
if ("home_page_banner_battle".equals(model.getOriginalUrl())) {
RouteUtil.forwardBattlePass();
@ -78,19 +142,12 @@ public class OpenAdCenterDialogPopup extends AbsDialogFullScreenPopupWindow {
}
dismiss();
});
mClose.setOnClickListener(v -> dismiss());
ImgLoader.display(mContext, model.getImageUrl(), mImageView);
int width = ScreenDimenUtil.getInstance().getScreenWdith() - DpUtil.dp2px(40);
int height = (int) (width * 1.4);
if (model.getModel() == OpenAdModel.MODEL_SQUARE) {
height = width;
}
ConstraintLayout.LayoutParams params = (ConstraintLayout.LayoutParams) mImageView.getLayoutParams();
params.width = width;
params.height = height;
mImageView.setLayoutParams(params);
if (model.getShowTime() > 0) {
mClose.postDelayed(this::dismiss, model.getShowTime());
contentLayout.addView(mImageView);
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onJavascriptInterfaceEvent(JavascriptInterfaceEvent event) {
}
}

View File

@ -7,19 +7,25 @@ import android.util.Log;
import com.yunbao.common.CommonAppContext;
import com.yunbao.common.bean.OpenAdModel;
import com.yunbao.common.dialog.DebugDialog;
import com.yunbao.common.dialog.OpenAdBottomDialogPopup;
import com.yunbao.common.dialog.OpenAdCenterDialogPopup;
import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.utils.AppManager;
import com.yunbao.common.utils.SpUtil;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
public class OpenAdManager {
public static final int TYPE_HOME = 1;
@ -28,21 +34,40 @@ public class OpenAdManager {
private Map<Integer, Boolean> showMap;
private List<OpenAdModel> list = null;
private Handler handler = new Handler(Looper.getMainLooper());
private Map<Integer, AdRunnable> runnableMap = new HashMap<>();
private Map<Integer, AdRunnable> runnableMap = new LinkedHashMap<>();
private Map<AdRunnable, Integer> waitRunnableMap = new LinkedHashMap<>();//等待运行的弹窗
private int showType;
private WeakReference<AdRunnable> runNowRunnable;
private static final boolean IS_QUEUE_SHOW = true;//是否按队列显示弹窗true就会等待上一个弹窗关闭后弹出false就按原逻辑顺序直接弹出
private OpenAdManager() {
showMap = new HashMap<>();
DebugDialog.getInstance(new DebugDialog.DebugDialogRunnable() {
@Override
public void run(DebugDialog dialog) {
dialog.show();
onItemClickListener = new OnItemClickListener<String>() {
@Override
public void onItemClick(String bean, int position) {
dialog.setParams(bean, "剩余:" + position);
}
};
}
});
init(false);
}
public void reset() {
public void close() {
dismiss();
runnableMap.clear();
showMap.clear();
list.clear();
}
public void reset() {
next();
}
private static final class MInstanceHolder {
static final OpenAdManager mInstance = new OpenAdManager();
}
@ -70,30 +95,38 @@ public class OpenAdManager {
list = new ArrayList<>();
return;
}
Collections.sort(data, new AdListComparator());
list = data;
if (isShow) {
if (showType == 0) {
show(TYPE_HOME, false);
} else {
show(showType, false);
}
}
}
@Override
public void onError(String error) {
System.err.println("弹框列表:" + error);
Log.e(TAG, "弹框列表:" + error);
}
});
}
private static long showTime = 0;
private OnItemClickListener<String> onItemClickListener;
public synchronized void show(int type, boolean isGuard) {
showType = type;
if (list == null) {
init(true);
return;
}
Log.i(TAG, "show: 调用显示 " + type + " " + isGuard);
if (System.currentTimeMillis() - showTime < 100) {
return;
}
showTime = System.currentTimeMillis();
showType = type;
for (OpenAdModel model : list) {
if (model.getType() == type) {
if (type == OpenAdModel.TYPE_LIVE && !model.userIsPermission(isGuard)) {
@ -122,13 +155,22 @@ public class OpenAdManager {
if (!isShow(model)) {
Log.i(TAG, "show: " + model);
if (IS_QUEUE_SHOW) {
waitRunnableMap.put(new AdRunnable(model), model.getDelayShowTime());
} else {
handler.postDelayed(new AdRunnable(model), model.getDelayShowTime());
}
} else {
Log.i(TAG, "notshow: " + model);
}
}
}
Log.i(TAG, "show: 循环完毕调用next");
if (IS_QUEUE_SHOW) {
onItemClickListener.onItemClick("接口返回需要展示的弹窗数:", waitRunnableMap.size());
next();
}
Log.i(TAG, "------------------------------");
}
@ -144,6 +186,9 @@ public class OpenAdManager {
}
}
runnableMap.clear();
if (runNowRunnable != null && runNowRunnable.get() != null) {
handler.removeCallbacks(runNowRunnable.get());
}
}
private synchronized boolean isShow(OpenAdModel type) {
@ -153,11 +198,26 @@ public class OpenAdManager {
return false;
}
void next() {
Log.i(TAG, "next: " + waitRunnableMap.size());
if (waitRunnableMap.isEmpty()) return;
AdRunnable next = waitRunnableMap.keySet().iterator().next();
Integer i = waitRunnableMap.get(next);
if (i == null) {
i = 0;
}
onItemClickListener.onItemClick("当前加载id:" + next.model.getId() + " " + next.model.getName() + " 延迟展示时间:" + i, (waitRunnableMap.size() - 1));
handler.postDelayed(next, i);
}
private class AdRunnable implements Runnable {
OpenAdModel model;
AdRunnable runnable;
public AdRunnable(OpenAdModel model) {
this.model = model;
this.runnable = this;
runNowRunnable = new WeakReference<>(this);
runnableMap.put(model.getId(), this);
}
@ -194,12 +254,34 @@ public class OpenAdManager {
showMap.remove(model.getId());
}
if (model.getModel() == OpenAdModel.MODEL_BOTTOM) {
new OpenAdBottomDialogPopup(CommonAppContext.getTopActivity(), model).setListener((bean, position) -> {
new OpenAdBottomDialogPopup(AppManager.getInstance().getLastActivity(), model).setListener((bean, position) -> {
Log.i(TAG, "run: 弹框回调:" + position);
if (IS_QUEUE_SHOW) {
waitRunnableMap.remove(runnable);
if (position == 0) {
next();
}
}
}).showDialog();
} else {
new OpenAdCenterDialogPopup(CommonAppContext.getTopActivity(), model).setListener((bean, position) -> {
new OpenAdCenterDialogPopup(AppManager.getInstance().getLastActivity(), model).setListener((bean, position) -> {
Log.i(TAG, "run: 弹框回调:" + position);
if (IS_QUEUE_SHOW) {
waitRunnableMap.remove(runnable);
if (position == 0) {
next();
}
}
}).showDialog();
}
}
}
private class AdListComparator implements Comparator<OpenAdModel> {
@Override
public int compare(OpenAdModel openAdModel, OpenAdModel t1) {
return openAdModel.getSort() - t1.getSort();
}
}
}

View File

@ -5,16 +5,19 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/img"
<LinearLayout
android:id="@+id/content_layout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:scaleType="fitXY"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:adjustViewBounds="true"
app:layout_constraintStart_toStartOf="parent"
app:srcCompat="@mipmap/background_gift_wall" />
app:srcCompat="@mipmap/background_gift_wall">
</LinearLayout>
<ImageView
android:id="@+id/close"
@ -22,7 +25,7 @@
android:layout_height="24dp"
android:layout_marginEnd="14dp"
android:layout_marginBottom="12dp"
app:layout_constraintBottom_toTopOf="@+id/img"
app:layout_constraintBottom_toTopOf="@+id/content_layout"
app:layout_constraintEnd_toEndOf="parent"
app:srcCompat="@mipmap/ic_open_ad_close" />

View File

@ -6,17 +6,20 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/img"
<LinearLayout
android:id="@+id/content_layout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:layout_marginBottom="12dp"
android:scaleType="fitCenter"
android:orientation="vertical"
app:layout_constraintBottom_toTopOf="@+id/close"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
app:layout_constraintStart_toStartOf="parent"
android:layout_marginBottom="12dp">
</LinearLayout>
<ImageView
android:id="@+id/close"
@ -24,8 +27,8 @@
android:layout_height="24dp"
android:layout_marginBottom="202dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/img"
app:layout_constraintStart_toStartOf="@+id/img"
app:layout_constraintEnd_toEndOf="@+id/content_layout"
app:layout_constraintStart_toStartOf="@+id/content_layout"
app:srcCompat="@mipmap/ic_open_ad_close" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -13,8 +13,6 @@ import android.app.PendingIntent;
import android.content.ClipData;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
@ -51,14 +49,12 @@ import com.tencent.imsdk.v2.V2TIMManager;
import com.tencent.imsdk.v2.V2TIMSDKConfig;
import com.tencent.imsdk.v2.V2TIMSDKListener;
import com.tencent.imsdk.v2.V2TIMUserFullInfo;
import com.yunbao.common.dialog.DebugDialog;
import com.yunbao.common.utils.MobclickAgent;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants;
import com.yunbao.common.activity.AbsActivity;
import com.yunbao.common.activity.WebViewActivity;
import com.yunbao.common.adapter.ViewPagerAdapter;
import com.yunbao.common.bean.AnchorRecommendItemModel;
import com.yunbao.common.bean.AnchorRecommendModel;
import com.yunbao.common.bean.AnchorStartLiveBean;
import com.yunbao.common.bean.ChatRemarksBean;
@ -223,7 +219,6 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
protected void main() {
ActivityCompat.postponeEnterTransition(this);
ConversationIMListManager.get(this);
OpenAdManager.getInstance();
//在请求一下这个接口给我后台版本号
CommonHttpUtil.getConfig(mContext, new CommonCallback<ConfigBean>() {
@Override
@ -362,6 +357,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
}
break;
}
OpenAdManager.getInstance().show(OpenAdManager.TYPE_HOME, false);
if (mTabButtonGroup.getCurPosition() != position) {
System.err.println("重连IM:" + IMLoginManager.isLogin(mContext));
if (!IMLoginManager.isLogin(mContext)) {
@ -555,6 +551,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
//获取指导员账号
ConversationIMListManager.get(this).getUserInstructor(this);
checkVersion();
OpenAdManager.getInstance().show(OpenAdManager.TYPE_HOME, false);
}
/**
@ -948,6 +945,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
NoviceInstructorManager.get(mContext).getNoviceInstructor();
NoviceInstructorManager.get(mContext).checktHomeZdyPop();
initAnchorRecommendBanner();
OpenAdManager.getInstance().reset();
}
/**
@ -1146,7 +1144,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
if (EasyFloat.isShow("LiveFloatView")) {
EasyFloat.dismiss("LiveFloatView", true);
}
OpenAdManager.getInstance().reset();
OpenAdManager.getInstance().close();
super.onBackPressed();
}
}

View File

@ -560,7 +560,6 @@ public class MainHomeLiveViewHolder extends AbsMainHomeChildViewHolder implement
@Override
public void onResume() {
super.onResume();
OpenAdManager.getInstance().show(OpenAdManager.TYPE_HOME, false);
}
@Override