2020-04-02 10:43:40 +08:00
|
|
|
|
package com.yizhuan.erban;
|
|
|
|
|
|
|
|
|
|
import android.Manifest;
|
|
|
|
|
import android.animation.ObjectAnimator;
|
|
|
|
|
import android.annotation.SuppressLint;
|
|
|
|
|
import android.app.Activity;
|
|
|
|
|
import android.content.Context;
|
|
|
|
|
import android.content.DialogInterface;
|
|
|
|
|
import android.content.Intent;
|
|
|
|
|
import android.graphics.Color;
|
|
|
|
|
import android.os.Bundle;
|
|
|
|
|
import android.text.TextUtils;
|
|
|
|
|
import android.util.Log;
|
|
|
|
|
import android.util.LongSparseArray;
|
|
|
|
|
import android.view.KeyEvent;
|
|
|
|
|
import android.view.View;
|
|
|
|
|
import android.view.animation.LinearInterpolator;
|
2020-04-28 15:08:58 +08:00
|
|
|
|
import android.widget.LinearLayout;
|
2020-04-26 21:36:02 +08:00
|
|
|
|
import android.widget.TextView;
|
2020-04-02 10:43:40 +08:00
|
|
|
|
|
2020-05-05 17:06:10 +08:00
|
|
|
|
import androidx.fragment.app.Fragment;
|
|
|
|
|
import androidx.fragment.app.FragmentManager;
|
|
|
|
|
import androidx.fragment.app.FragmentTransaction;
|
|
|
|
|
|
2020-04-02 10:43:40 +08:00
|
|
|
|
import com.mcxiaoke.packer.helper.PackerNg;
|
|
|
|
|
import com.microquation.linkedme.android.LinkedME;
|
|
|
|
|
import com.netease.nim.uikit.api.NimUIKit;
|
|
|
|
|
import com.netease.nim.uikit.api.model.contact.ContactEventListener;
|
|
|
|
|
import com.netease.nim.uikit.api.model.session.SessionCustomization;
|
|
|
|
|
import com.netease.nim.uikit.api.model.session.SessionEventListener;
|
|
|
|
|
import com.netease.nim.uikit.business.session.actions.BaseAction;
|
|
|
|
|
import com.netease.nim.uikit.business.session.actions.ImageAction;
|
|
|
|
|
import com.netease.nim.uikit.common.util.log.LogUtil;
|
|
|
|
|
import com.netease.nim.uikit.common.util.string.StringUtil;
|
|
|
|
|
import com.netease.nim.uikit.impl.cache.NimUserInfoCache;
|
|
|
|
|
import com.netease.nimlib.sdk.NIMClient;
|
|
|
|
|
import com.netease.nimlib.sdk.RequestCallbackWrapper;
|
|
|
|
|
import com.netease.nimlib.sdk.chatroom.model.ChatRoomKickOutEvent;
|
|
|
|
|
import com.netease.nimlib.sdk.msg.constant.SessionTypeEnum;
|
|
|
|
|
import com.netease.nimlib.sdk.msg.model.IMMessage;
|
|
|
|
|
import com.netease.nimlib.sdk.msg.model.RecentContact;
|
|
|
|
|
import com.netease.nimlib.sdk.team.TeamService;
|
|
|
|
|
import com.netease.nimlib.sdk.team.constant.TeamMessageNotifyTypeEnum;
|
|
|
|
|
import com.netease.nimlib.sdk.team.model.Team;
|
|
|
|
|
import com.netease.nimlib.sdk.uinfo.model.NimUserInfo;
|
|
|
|
|
import com.orhanobut.logger.Logger;
|
|
|
|
|
import com.qiyukf.unicorn.api.Unicorn;
|
|
|
|
|
import com.tencent.bugly.crashreport.CrashReport;
|
|
|
|
|
import com.tongdaxing.erban.upgrade.AppUpgradeHelper;
|
|
|
|
|
import com.trello.rxlifecycle2.android.ActivityEvent;
|
|
|
|
|
import com.yizhuan.erban.application.ActivityStackManager;
|
|
|
|
|
import com.yizhuan.erban.avroom.activity.AVRoomActivity;
|
|
|
|
|
import com.yizhuan.erban.avroom.ktv.KtvMusicManager;
|
|
|
|
|
import com.yizhuan.erban.base.BaseMvpActivity;
|
|
|
|
|
import com.yizhuan.erban.common.widget.CircleImageView;
|
|
|
|
|
import com.yizhuan.erban.common.widget.DragLayout;
|
|
|
|
|
import com.yizhuan.erban.common.widget.FloatingLiveMiniView;
|
|
|
|
|
import com.yizhuan.erban.community.dynamic.view.DynamicDetailActivity;
|
|
|
|
|
import com.yizhuan.erban.community.holder.DynamicSysHolder;
|
|
|
|
|
import com.yizhuan.erban.community.im.WorldDynamicShareViewHolder;
|
|
|
|
|
import com.yizhuan.erban.community.publish.view.PublishActivity;
|
2020-04-08 10:39:44 +08:00
|
|
|
|
import com.yizhuan.erban.community.square.SquareFragment;
|
2020-04-02 10:43:40 +08:00
|
|
|
|
import com.yizhuan.erban.decoration.view.widgets.ShowCarGuideDialog;
|
|
|
|
|
import com.yizhuan.erban.family.view.activity.FamilyHomeActivity;
|
|
|
|
|
import com.yizhuan.erban.guide.GuideActivity;
|
|
|
|
|
import com.yizhuan.erban.home.dialog.RecommendRoomForNewerDialog;
|
2020-04-07 19:36:32 +08:00
|
|
|
|
import com.yizhuan.erban.home.fragment.CommunityNoticeAct;
|
2020-04-03 19:21:36 +08:00
|
|
|
|
import com.yizhuan.erban.home.fragment.ContactsListFragment;
|
2020-04-02 10:43:40 +08:00
|
|
|
|
import com.yizhuan.erban.home.fragment.GameHomeFragment;
|
|
|
|
|
import com.yizhuan.erban.home.fragment.MeFragment;
|
|
|
|
|
import com.yizhuan.erban.home.fragment.RankingFragment;
|
|
|
|
|
import com.yizhuan.erban.home.presenter.MainPresenter;
|
|
|
|
|
import com.yizhuan.erban.home.view.IMainView;
|
|
|
|
|
import com.yizhuan.erban.luckymoney.viewholder.LuckyMoneyMsgViewHolder;
|
|
|
|
|
import com.yizhuan.erban.luckymoney.viewholder.LuckyMoneyTipsViewHolder;
|
2020-04-07 16:41:24 +08:00
|
|
|
|
import com.yizhuan.erban.main.helper.NoticationsUiHelper;
|
2020-04-02 10:43:40 +08:00
|
|
|
|
import com.yizhuan.erban.miniworld.activity.MiniWorldGuestPageActivity;
|
|
|
|
|
import com.yizhuan.erban.module.Extras;
|
|
|
|
|
import com.yizhuan.erban.module_hall.HallDataManager;
|
|
|
|
|
import com.yizhuan.erban.module_hall.secretcode.PwdCodeMgr;
|
|
|
|
|
import com.yizhuan.erban.public_chat_hall.msg.viewholder.MsgViewHolderAitMe;
|
2020-04-07 16:41:24 +08:00
|
|
|
|
import com.yizhuan.erban.quick_pass.QuickPassLoginAct;
|
2020-04-02 10:43:40 +08:00
|
|
|
|
import com.yizhuan.erban.radish.signin.SignDialogTimeManager;
|
|
|
|
|
import com.yizhuan.erban.service.DaemonService;
|
|
|
|
|
import com.yizhuan.erban.share.viewholder.InAppSharingMsgViewHolder;
|
|
|
|
|
import com.yizhuan.erban.ui.im.RouterHandler;
|
|
|
|
|
import com.yizhuan.erban.ui.im.actions.GiftAction;
|
|
|
|
|
import com.yizhuan.erban.ui.im.avtivity.NimP2PMessageActivity;
|
|
|
|
|
import com.yizhuan.erban.ui.im.chat.MsgViewHolderAudioParty;
|
|
|
|
|
import com.yizhuan.erban.ui.im.chat.MsgViewHolderContent;
|
|
|
|
|
import com.yizhuan.erban.ui.im.chat.MsgViewHolderGift;
|
|
|
|
|
import com.yizhuan.erban.ui.im.chat.MsgViewHolderLevel;
|
|
|
|
|
import com.yizhuan.erban.ui.im.chat.MsgViewHolderLottery;
|
|
|
|
|
import com.yizhuan.erban.ui.im.chat.MsgViewHolderOnline;
|
|
|
|
|
import com.yizhuan.erban.ui.im.chat.MsgViewHolderRedPacket;
|
|
|
|
|
import com.yizhuan.erban.ui.im.chat.MsgViewHolderText;
|
|
|
|
|
import com.yizhuan.erban.ui.im.chat.SignInNoticeMsgViewHolder;
|
2020-04-07 16:41:24 +08:00
|
|
|
|
import com.yizhuan.erban.ui.im.chat.SysMsgV2ViewHolder;
|
2020-04-02 10:43:40 +08:00
|
|
|
|
import com.yizhuan.erban.ui.im.chat.SysMsgViewHolder;
|
|
|
|
|
import com.yizhuan.erban.ui.login.BinderPhoneActivity;
|
|
|
|
|
import com.yizhuan.erban.ui.patriarch.help.LimitEnterRoomHelper;
|
|
|
|
|
import com.yizhuan.erban.ui.patriarch.help.PmDialogShowMrg;
|
|
|
|
|
import com.yizhuan.erban.ui.user.UserInfoActivity;
|
|
|
|
|
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
|
|
|
|
|
import com.yizhuan.erban.ui.utils.ImageLoadUtilsV2;
|
|
|
|
|
import com.yizhuan.erban.ui.webview.CommonWebViewActivity;
|
|
|
|
|
import com.yizhuan.erban.ui.widget.LevelUpDialog;
|
|
|
|
|
import com.yizhuan.erban.ui.widget.LivingIconView;
|
|
|
|
|
import com.yizhuan.erban.ui.widget.MainTabLayout;
|
|
|
|
|
import com.yizhuan.erban.ui.widget.RecallDialog;
|
|
|
|
|
import com.yizhuan.erban.ui.widget.RedPacketDialog;
|
|
|
|
|
import com.yizhuan.erban.utils.CleanLeakUtils;
|
|
|
|
|
import com.yizhuan.xchat_android_core.Constants;
|
|
|
|
|
import com.yizhuan.xchat_android_core.UriProvider;
|
|
|
|
|
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
|
|
|
|
import com.yizhuan.xchat_android_core.auth.event.KickOutEvent;
|
|
|
|
|
import com.yizhuan.xchat_android_core.auth.event.LoginEvent;
|
|
|
|
|
import com.yizhuan.xchat_android_core.auth.event.LogoutEvent;
|
|
|
|
|
import com.yizhuan.xchat_android_core.channel_page.bean.ChannelPageInfo;
|
|
|
|
|
import com.yizhuan.xchat_android_core.channel_page.model.ChannelPageModel;
|
|
|
|
|
import com.yizhuan.xchat_android_core.community.attachment.DynamicSysAttachment;
|
2020-04-24 13:02:56 +08:00
|
|
|
|
import com.yizhuan.xchat_android_core.community.event.SquareTaskEvent;
|
2020-04-02 10:43:40 +08:00
|
|
|
|
import com.yizhuan.xchat_android_core.community.event.UnReadCountEvent;
|
|
|
|
|
import com.yizhuan.xchat_android_core.community.im.WorldDynamicAttachment;
|
|
|
|
|
import com.yizhuan.xchat_android_core.customer_server.event.CustomerServerMsgEvent;
|
|
|
|
|
import com.yizhuan.xchat_android_core.home.model.HomeModel;
|
|
|
|
|
import com.yizhuan.xchat_android_core.im.custom.bean.AssistantAttachment;
|
|
|
|
|
import com.yizhuan.xchat_android_core.im.custom.bean.CarAttachment;
|
|
|
|
|
import com.yizhuan.xchat_android_core.im.custom.bean.CarveUpGoldThirdLevelAttachment;
|
|
|
|
|
import com.yizhuan.xchat_android_core.im.custom.bean.GiftAttachment;
|
|
|
|
|
import com.yizhuan.xchat_android_core.im.custom.bean.InAppSharingFamilyAttachment;
|
|
|
|
|
import com.yizhuan.xchat_android_core.im.custom.bean.InAppSharingMiniWorldAttachment;
|
|
|
|
|
import com.yizhuan.xchat_android_core.im.custom.bean.InAppSharingRoomAttachment;
|
|
|
|
|
import com.yizhuan.xchat_android_core.im.custom.bean.InAppSharingTeamAttachment;
|
|
|
|
|
import com.yizhuan.xchat_android_core.im.custom.bean.LevelUpAttachment;
|
|
|
|
|
import com.yizhuan.xchat_android_core.im.custom.bean.LotteryAttachment;
|
|
|
|
|
import com.yizhuan.xchat_android_core.im.custom.bean.LuckyMoneyAttachment;
|
|
|
|
|
import com.yizhuan.xchat_android_core.im.custom.bean.LuckyMoneyTipsAttachment;
|
|
|
|
|
import com.yizhuan.xchat_android_core.im.custom.bean.NobleAttachment;
|
|
|
|
|
import com.yizhuan.xchat_android_core.im.custom.bean.NoticeAttachment;
|
|
|
|
|
import com.yizhuan.xchat_android_core.im.custom.bean.OpenRoomNotiAttachment;
|
|
|
|
|
import com.yizhuan.xchat_android_core.im.custom.bean.OpenSignInAttachment;
|
|
|
|
|
import com.yizhuan.xchat_android_core.im.custom.bean.RedPacketAttachment;
|
|
|
|
|
import com.yizhuan.xchat_android_core.im.custom.bean.SysMsgAttachment;
|
2020-04-07 16:41:24 +08:00
|
|
|
|
import com.yizhuan.xchat_android_core.im.custom.bean.SysMsgV2Attachment;
|
2020-04-02 10:43:40 +08:00
|
|
|
|
import com.yizhuan.xchat_android_core.level.event.CharmLevelUpEvent;
|
|
|
|
|
import com.yizhuan.xchat_android_core.level.event.LevelUpEvent;
|
|
|
|
|
import com.yizhuan.xchat_android_core.linked.bean.LinkedInfo;
|
|
|
|
|
import com.yizhuan.xchat_android_core.linked.event.LinkMeInfoUpdateEvent;
|
|
|
|
|
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
|
|
|
|
|
import com.yizhuan.xchat_android_core.manager.IMBroadcastManager;
|
|
|
|
|
import com.yizhuan.xchat_android_core.manager.IMMessageManager;
|
|
|
|
|
import com.yizhuan.xchat_android_core.manager.RoomEvent;
|
|
|
|
|
import com.yizhuan.xchat_android_core.manager.RtcEngineManager;
|
|
|
|
|
import com.yizhuan.xchat_android_core.market_verify.MarketVerifyModel;
|
|
|
|
|
import com.yizhuan.xchat_android_core.market_verify.event.MarketVerifyUpdateEvent;
|
|
|
|
|
import com.yizhuan.xchat_android_core.miniworld.bean.OpenAudioPartyAttachment;
|
|
|
|
|
import com.yizhuan.xchat_android_core.patriarch.event.CloseMinRoomEvent;
|
|
|
|
|
import com.yizhuan.xchat_android_core.patriarch.event.ImPushMsgPmLimitTimeEvent;
|
|
|
|
|
import com.yizhuan.xchat_android_core.patriarch.event.PmDismissAllLimitDialogEvent;
|
|
|
|
|
import com.yizhuan.xchat_android_core.public_chat_hall.attachment.AitMeAttachment;
|
|
|
|
|
import com.yizhuan.xchat_android_core.recall.RecallModel;
|
|
|
|
|
import com.yizhuan.xchat_android_core.recall.bean.CheckLostUserInfo;
|
|
|
|
|
import com.yizhuan.xchat_android_core.recall.event.CheckLostUserEvent;
|
|
|
|
|
import com.yizhuan.xchat_android_core.redPacket.bean.RedPacketInfoV2;
|
|
|
|
|
import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
|
|
|
|
|
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
|
|
|
|
|
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
|
|
|
|
|
import com.yizhuan.xchat_android_core.user.UserModel;
|
|
|
|
|
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
|
|
|
|
|
import com.yizhuan.xchat_android_core.user.bean.UserRecommendRoomInfo;
|
|
|
|
|
import com.yizhuan.xchat_android_core.user.event.CurrentUserInfoCompleteEvent;
|
|
|
|
|
import com.yizhuan.xchat_android_core.user.event.LoadLoginUserInfoEvent;
|
|
|
|
|
import com.yizhuan.xchat_android_core.user.event.LoginUserInfoUpdateEvent;
|
|
|
|
|
import com.yizhuan.xchat_android_core.user.event.NeedBindPhoneEvent;
|
|
|
|
|
import com.yizhuan.xchat_android_core.user.event.NeedCompleteInfoEvent;
|
|
|
|
|
import com.yizhuan.xchat_android_core.utils.SharedPreferenceUtils;
|
|
|
|
|
import com.yizhuan.xchat_android_library.base.factory.CreatePresenter;
|
|
|
|
|
import com.yizhuan.xchat_android_library.threadmgr.ThreadPoolManager;
|
|
|
|
|
import com.yizhuan.xchat_android_library.utils.JavaUtil;
|
|
|
|
|
import com.yizhuan.xchat_android_library.utils.codec.DESUtils;
|
|
|
|
|
import com.yizhuan.xchat_android_library.utils.pref.CommonPref;
|
|
|
|
|
|
|
|
|
|
import org.greenrobot.eventbus.EventBus;
|
|
|
|
|
import org.greenrobot.eventbus.Subscribe;
|
|
|
|
|
import org.greenrobot.eventbus.ThreadMode;
|
|
|
|
|
|
|
|
|
|
import java.lang.ref.WeakReference;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
|
|
|
|
import io.reactivex.Single;
|
|
|
|
|
import io.reactivex.SingleObserver;
|
|
|
|
|
import io.reactivex.SingleSource;
|
|
|
|
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
|
|
|
|
import io.reactivex.disposables.Disposable;
|
|
|
|
|
import io.reactivex.functions.BiConsumer;
|
|
|
|
|
import io.reactivex.functions.Consumer;
|
|
|
|
|
import io.reactivex.functions.Function;
|
|
|
|
|
|
|
|
|
|
import static com.yizhuan.xchat_android_core.Constants.SHOW_CAR_GUIDE;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @author Administrator
|
|
|
|
|
*/
|
|
|
|
|
@CreatePresenter(MainPresenter.class)
|
|
|
|
|
public class MainActivity extends BaseMvpActivity<IMainView, MainPresenter>
|
2020-04-28 15:08:58 +08:00
|
|
|
|
implements MainTabLayout.OnTabClickListener, IMainView , View.OnClickListener {
|
2020-04-02 10:43:40 +08:00
|
|
|
|
|
|
|
|
|
private static final String TAG = "MainActivity";
|
|
|
|
|
|
|
|
|
|
private static final String EXTRA_APP_QUIT = "APP_QUIT";
|
|
|
|
|
public static final String MSG_TAB = "msgTab";
|
|
|
|
|
|
|
|
|
|
private DragLayout avatarLayout;
|
2020-04-26 21:36:02 +08:00
|
|
|
|
private TextView tvName;//最小化窗口名称
|
|
|
|
|
private TextView tvId;//最小化窗口ID
|
2020-04-02 10:43:40 +08:00
|
|
|
|
private CircleImageView avatarImage;
|
2020-04-28 15:08:58 +08:00
|
|
|
|
private LinearLayout llDragInfo;
|
2020-04-02 10:43:40 +08:00
|
|
|
|
private LivingIconView userLivingView;
|
|
|
|
|
private View viewClose;
|
|
|
|
|
|
|
|
|
|
private FloatingLiveMiniView floatingLiveMiniView;
|
|
|
|
|
|
|
|
|
|
private MainTabLayout mMainTabLayout;
|
|
|
|
|
private int mCurrentMainPosition = MainTabLayout.MAIN_TAB_POS_GAME;
|
|
|
|
|
/**
|
|
|
|
|
* 是否需要预加载home,by lvzebiao v3.1.2
|
|
|
|
|
* 因为首页标签添加帧动画,防止,第一次点击标签过于卡顿
|
|
|
|
|
*/
|
|
|
|
|
private final static boolean PRELOAD_HOME = false;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 保存登录的次数
|
|
|
|
|
*/
|
|
|
|
|
private LongSparseArray<Integer> loginCountMap = new LongSparseArray<>(1);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 房间最小化动画,换成属性动画,原先的补间动画影响了activity的生命周期
|
|
|
|
|
*/
|
|
|
|
|
private ObjectAnimator roomMinAnim;
|
|
|
|
|
/**
|
|
|
|
|
* 管理限制进房
|
|
|
|
|
*/
|
|
|
|
|
private LimitEnterRoomHelper limitEnterRoomHelper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void start(Context context) {
|
|
|
|
|
start(context, null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void start(Context context, Intent extras) {
|
|
|
|
|
Intent intent = new Intent();
|
|
|
|
|
intent.setClass(context, MainActivity.class);
|
|
|
|
|
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
|
|
|
|
if (extras != null) {
|
|
|
|
|
intent.putExtras(extras);
|
|
|
|
|
}
|
|
|
|
|
context.startActivity(intent);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void onSaveInstanceState(Bundle outState) {
|
|
|
|
|
super.onSaveInstanceState(outState);
|
|
|
|
|
outState.putInt(Constants.KEY_MAIN_POSITION, mCurrentMainPosition);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void onRestoreInstanceState(Bundle savedInstanceState) {
|
|
|
|
|
super.onRestoreInstanceState(savedInstanceState);
|
|
|
|
|
if (savedInstanceState != null) {
|
|
|
|
|
mCurrentMainPosition = savedInstanceState.getInt(Constants.KEY_MAIN_POSITION);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
|
|
super.onCreate(savedInstanceState);
|
2020-04-07 16:41:24 +08:00
|
|
|
|
|
|
|
|
|
NimMiddleActivity.firstEnter = false;
|
|
|
|
|
|
2020-04-02 10:43:40 +08:00
|
|
|
|
if (savedInstanceState != null) {
|
|
|
|
|
mCurrentMainPosition = savedInstanceState.getInt(Constants.KEY_MAIN_POSITION);
|
|
|
|
|
}
|
|
|
|
|
Log.e(TAG, "onCreate: " + DESUtils.DESAndBase64("112030"));
|
|
|
|
|
setContentView(R.layout.activity_main);
|
|
|
|
|
//自动登录
|
|
|
|
|
AuthModel.get().autoLogin().subscribe(new SingleObserver<String>() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onSubscribe(Disposable d) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(String s) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onError(Throwable e) {
|
|
|
|
|
onNeedLogin();
|
|
|
|
|
toast(e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
initTitleBar(getString(R.string.app_name));
|
|
|
|
|
initView();
|
|
|
|
|
startGuild();
|
|
|
|
|
initMaterialView();
|
|
|
|
|
permission();
|
|
|
|
|
onParseIntent();
|
|
|
|
|
updateDatas();
|
|
|
|
|
updateRoomState();
|
|
|
|
|
initP2PSessionCustomization();
|
|
|
|
|
initTeamSessionCustomization();
|
|
|
|
|
EventBus.getDefault().register(this);
|
|
|
|
|
otherModelInit();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void otherModelInit() {
|
|
|
|
|
PwdCodeMgr.get().onCreateInit();
|
|
|
|
|
//初始化线程池
|
|
|
|
|
ThreadPoolManager.instance().init();
|
|
|
|
|
IMBroadcastManager.get().onCreate();
|
|
|
|
|
ImageLoadUtilsV2.init(context);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void onReceiveChatRoomEvent(RoomEvent roomEvent) {
|
|
|
|
|
super.onReceiveChatRoomEvent(roomEvent);
|
|
|
|
|
if (roomEvent == null || roomEvent.getEvent() == RoomEvent.NONE) return;
|
|
|
|
|
int event = roomEvent.getEvent();
|
|
|
|
|
if (event == RoomEvent.ENTER_ROOM) {
|
|
|
|
|
onEnter(AvRoomDataManager.get().mCurrentRoomInfo);
|
|
|
|
|
} else if (event == RoomEvent.KICK_OUT_ROOM) {
|
|
|
|
|
|
|
|
|
|
ChatRoomKickOutEvent reason = roomEvent.getReason();
|
|
|
|
|
if (reason == null) return;
|
|
|
|
|
//加入黑名单,踢出房间回调
|
|
|
|
|
ChatRoomKickOutEvent.ChatRoomKickOutReason reasonReason = reason.getReason();
|
|
|
|
|
StatisticManager.Instance().onEvent(StatisticsProtocol.Event.USER_KICKED_EVENT,"用户被踢");
|
|
|
|
|
if (reasonReason == ChatRoomKickOutEvent.ChatRoomKickOutReason.BE_BLACKLISTED
|
|
|
|
|
|| reasonReason == ChatRoomKickOutEvent.ChatRoomKickOutReason.KICK_OUT_BY_MANAGER
|
|
|
|
|
|| reasonReason == ChatRoomKickOutEvent.ChatRoomKickOutReason.KICK_OUT_BY_CONFLICT_LOGIN
|
|
|
|
|
|| reasonReason == ChatRoomKickOutEvent.ChatRoomKickOutReason.CHAT_ROOM_INVALID) {
|
|
|
|
|
exitRoom(AvRoomDataManager.get().mCurrentRoomInfo);
|
|
|
|
|
}
|
|
|
|
|
} else if (event == RoomEvent.ROOM_EXIT) {
|
|
|
|
|
exitRoom(roomEvent.getRoomInfo());
|
|
|
|
|
} else if (event == RoomEvent.ROOM_CHAT_RECONNECTION) {
|
|
|
|
|
updateRoomState();
|
|
|
|
|
} else if (event == RoomEvent.MY_SELF_KICK_OUT_ROOM_BY_S_ADMIN) {
|
|
|
|
|
toast(R.string.kick_out_room_by_s_admin);
|
|
|
|
|
StatisticManager.Instance().onEvent(StatisticsProtocol.Event.USER_KICKED_EVENT,"用户被踢");
|
|
|
|
|
getMvpPresenter().exitRoom();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void closeOpenRoomAnimation() {
|
|
|
|
|
stopRoomMinAnim();
|
|
|
|
|
avatarLayout.setVisibility(View.GONE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void initP2PSessionCustomization() {
|
|
|
|
|
SessionCustomization sessionCustomization = new SessionCustomization();
|
|
|
|
|
ArrayList<BaseAction> actions = new ArrayList<>();
|
|
|
|
|
actions.add(new ImageAction());
|
2020-04-24 13:02:56 +08:00
|
|
|
|
// actions.add(new DecorationAction());
|
|
|
|
|
// actions.add(new ChatterBoxAction());
|
2020-04-02 10:43:40 +08:00
|
|
|
|
actions.add(new GiftAction());
|
|
|
|
|
sessionCustomization.actions = actions;
|
|
|
|
|
sessionCustomization.withSticker = true;
|
|
|
|
|
NimUIKit.setCommonP2PSessionCustomization(sessionCustomization);
|
|
|
|
|
|
|
|
|
|
// 语音派对
|
|
|
|
|
NimUIKit.registerMsgItemViewHolder(OpenAudioPartyAttachment.class, MsgViewHolderAudioParty.class);
|
|
|
|
|
|
|
|
|
|
NimUIKit.registerMsgItemViewHolder(OpenRoomNotiAttachment.class, MsgViewHolderOnline.class);
|
|
|
|
|
NimUIKit.registerMsgItemViewHolder(GiftAttachment.class, MsgViewHolderGift.class);
|
|
|
|
|
NimUIKit.registerMsgItemViewHolder(NoticeAttachment.class, MsgViewHolderContent.class);
|
|
|
|
|
NimUIKit.registerMsgItemViewHolder(RedPacketAttachment.class, MsgViewHolderRedPacket.class);
|
|
|
|
|
NimUIKit.registerMsgItemViewHolder(LotteryAttachment.class, MsgViewHolderLottery.class);
|
|
|
|
|
NimUIKit.registerMsgItemViewHolder(NobleAttachment.class, MsgViewHolderText.class);
|
|
|
|
|
NimUIKit.registerMsgItemViewHolder(CarAttachment.class, MsgViewHolderText.class);
|
|
|
|
|
NimUIKit.registerMsgItemViewHolder(AssistantAttachment.class, MsgViewHolderText.class);
|
|
|
|
|
NimUIKit.registerMsgItemViewHolder(InAppSharingRoomAttachment.class, InAppSharingMsgViewHolder.class);
|
|
|
|
|
NimUIKit.registerMsgItemViewHolder(InAppSharingFamilyAttachment.class, InAppSharingMsgViewHolder.class);
|
|
|
|
|
NimUIKit.registerMsgItemViewHolder(InAppSharingMiniWorldAttachment.class, InAppSharingMsgViewHolder.class);
|
|
|
|
|
NimUIKit.registerMsgItemViewHolder(InAppSharingTeamAttachment.class, InAppSharingMsgViewHolder.class);
|
|
|
|
|
NimUIKit.registerMsgItemViewHolder(SysMsgAttachment.class, SysMsgViewHolder.class);
|
2020-04-07 16:41:24 +08:00
|
|
|
|
//V2系统消息,废弃23 V1
|
|
|
|
|
NimUIKit.registerMsgItemViewHolder(SysMsgV2Attachment.class, SysMsgV2ViewHolder.class);
|
2020-04-02 10:43:40 +08:00
|
|
|
|
NimUIKit.registerMsgItemViewHolder(LevelUpAttachment.class, MsgViewHolderLevel.class);
|
|
|
|
|
NimUIKit.registerMsgItemViewHolder(AitMeAttachment.class, MsgViewHolderAitMe.class);
|
|
|
|
|
// 声音瓶子
|
2020-04-24 13:02:56 +08:00
|
|
|
|
// NimUIKit.registerMsgItemViewHolder(SysMsgVoiceAttachment.class, SysMsgVoiceViewHolder.class);
|
|
|
|
|
// NimUIKit.registerMsgItemViewHolder(VoiceBottleSayHiAttachment.class, MsgViewHolderVoiceBottleSayHi.class);
|
|
|
|
|
// NimUIKit.registerMsgItemViewHolder(VoiceBottleShakeHeartAttachment.class, MsgViewHolderText.class);
|
2020-04-02 10:43:40 +08:00
|
|
|
|
// 师徒关系-师父看到的任务
|
2020-04-24 13:02:56 +08:00
|
|
|
|
// NimUIKit.registerMsgItemViewHolder(MentoringMasterMissionOneAttachment.class, MasterMissionOneViewHolder.class);
|
|
|
|
|
// NimUIKit.registerMsgItemViewHolder(MentoringMasterMissionTwoAttachment.class, MasterMissionTwoViewHolder.class);
|
|
|
|
|
// NimUIKit.registerMsgItemViewHolder(MentoringMasterMissionThreeAttachment.class, MasterMissionThreeViewHolder.class);
|
|
|
|
|
// NimUIKit.registerMsgItemViewHolder(MentoringMasterMissionFourAttachment.class, MasterMissionFourViewHolder.class);
|
|
|
|
|
// NimUIKit.registerMsgItemViewHolder(MentoringSharingRoomAttachment.class, MentoringSharingRoomViewHolder.class);
|
2020-04-02 10:43:40 +08:00
|
|
|
|
// 师徒关系-徒弟看到的任务
|
2020-04-24 13:02:56 +08:00
|
|
|
|
// NimUIKit.registerMsgItemViewHolder(MentoringApprenticeMissionOneAttachment.class, ApprenticeMissionOneViewHolder.class);
|
|
|
|
|
// NimUIKit.registerMsgItemViewHolder(MentoringApprenticeMissionTwoAttachment.class, ApprenticeMissionTwoViewHolder.class);
|
|
|
|
|
// NimUIKit.registerMsgItemViewHolder(MentoringApprenticeMissionThreeAttachment.class, ApprenticeMissionThreeViewHolder.class);
|
|
|
|
|
// NimUIKit.registerMsgItemViewHolder(MentoringApprenticeMissionFourAttachment.class, ApprenticeMissionFourViewHolder.class);
|
2020-04-02 10:43:40 +08:00
|
|
|
|
// 师徒关系-提示消息
|
2020-04-24 13:02:56 +08:00
|
|
|
|
// NimUIKit.registerMsgItemViewHolder(MentoringMissionTipsAttachment.class, MentoringTipsViewHolder.class);
|
|
|
|
|
// NimUIKit.registerMsgItemViewHolder(ImGameAttachment.class, MsgViewHolderGame.class);
|
|
|
|
|
// NimUIKit.registerMsgItemViewHolder(ImTipAttachment.class, MsgViewHolderTip.class);
|
2020-04-02 10:43:40 +08:00
|
|
|
|
//模厅模块
|
|
|
|
|
HallDataManager.get().mainNimOnCreate();
|
|
|
|
|
//签到
|
|
|
|
|
NimUIKit.registerMsgItemViewHolder(OpenSignInAttachment.class, SignInNoticeMsgViewHolder.class);
|
|
|
|
|
//瓜分金币 三级
|
|
|
|
|
NimUIKit.registerMsgItemViewHolder(CarveUpGoldThirdLevelAttachment.class, MsgViewHolderText.class);
|
|
|
|
|
// 话匣子
|
2020-04-24 13:02:56 +08:00
|
|
|
|
// NimUIKit.registerMsgItemViewHolder(ChatterBoxAttachment.class, MVHChatterBoxStart.class);
|
|
|
|
|
// NimUIKit.registerMsgItemViewHolder(DiceThrowAttachment.class, MVHDiceThrow.class);
|
|
|
|
|
// NimUIKit.registerMsgItemViewHolder(ChatterBoxInitAttachment.class, MVHChatterBoxInit.class);
|
2020-04-02 10:43:40 +08:00
|
|
|
|
|
|
|
|
|
// 社区动态
|
|
|
|
|
NimUIKit.registerMsgItemViewHolder(DynamicSysAttachment.class, DynamicSysHolder.class); // 动态审核, 违规删除
|
|
|
|
|
//世界动态分享
|
|
|
|
|
NimUIKit.registerMsgItemViewHolder(WorldDynamicAttachment.class, WorldDynamicShareViewHolder.class);
|
|
|
|
|
|
|
|
|
|
NimUIKit.setSessionListener(listener);
|
|
|
|
|
NimUIKit.setContactEventListener(listener1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void initTeamSessionCustomization() {
|
|
|
|
|
SessionCustomization sessionCustomization = new SessionCustomization();
|
|
|
|
|
ArrayList<BaseAction> actions = new ArrayList<>();
|
|
|
|
|
actions.add(new ImageAction());
|
|
|
|
|
sessionCustomization.actions = actions;
|
|
|
|
|
sessionCustomization.withSticker = true;
|
|
|
|
|
NimUIKit.setCommonTeamSessionCustomization(sessionCustomization);
|
|
|
|
|
|
|
|
|
|
NimUIKit.registerMsgItemViewHolder(LuckyMoneyAttachment.class, LuckyMoneyMsgViewHolder.class);
|
|
|
|
|
NimUIKit.registerMsgItemViewHolder(InAppSharingRoomAttachment.class, InAppSharingMsgViewHolder.class);
|
|
|
|
|
NimUIKit.registerMsgItemViewHolder(InAppSharingFamilyAttachment.class, InAppSharingMsgViewHolder.class);
|
|
|
|
|
NimUIKit.registerMsgItemViewHolder(InAppSharingMiniWorldAttachment.class, InAppSharingMsgViewHolder.class);
|
|
|
|
|
NimUIKit.registerMsgItemViewHolder(InAppSharingTeamAttachment.class, InAppSharingMsgViewHolder.class);
|
|
|
|
|
NimUIKit.registerMsgItemViewHolder(LuckyMoneyTipsAttachment.class, LuckyMoneyTipsViewHolder.class);
|
|
|
|
|
|
|
|
|
|
NimUIKit.setSessionListener(listener);
|
|
|
|
|
NimUIKit.setContactEventListener(listener1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private ContactEventListener listener1 = new ContactEventListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onItemClick(Context context, String account) {
|
|
|
|
|
NimP2PMessageActivity.start(context, account);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onItemLongClick(Context context, String account) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onAvatarClick(Context context, String account) {
|
|
|
|
|
UserInfoActivity.Companion.start(MainActivity.this, Long.valueOf(account));
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
private SessionEventListener listener = new SessionEventListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onAvatarClicked(Context context, IMMessage message) {
|
|
|
|
|
switch (message.getSessionType()) {
|
|
|
|
|
case Team:
|
|
|
|
|
UserInfoActivity.Companion.start(MainActivity.this, Long.valueOf(message.getFromAccount()));
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
case P2P:
|
|
|
|
|
UserInfoActivity.Companion.start(MainActivity.this, Long.valueOf(message.getFromAccount()));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onAvatarLongClicked(Context context, IMMessage message) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void onResume() {
|
|
|
|
|
super.onResume();
|
|
|
|
|
LinkedME.getInstance().setImmediate(true);
|
|
|
|
|
if (avatarLayout.getVisibility() == View.VISIBLE) {
|
|
|
|
|
userLivingView.start();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void onPause() {
|
|
|
|
|
super.onPause();
|
|
|
|
|
if (avatarLayout.getVisibility() == View.VISIBLE) {
|
|
|
|
|
userLivingView.stop();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void initView() {
|
|
|
|
|
mMainTabLayout = findViewById(R.id.main_tab_layout);
|
|
|
|
|
avatarLayout = findViewById(R.id.avatar_image_layout);
|
2020-04-26 21:36:02 +08:00
|
|
|
|
tvName = findViewById(R.id.tv_name);
|
|
|
|
|
tvId = findViewById(R.id.tv_id);
|
|
|
|
|
|
2020-04-02 10:43:40 +08:00
|
|
|
|
avatarImage = findViewById(R.id.avatar_image);
|
|
|
|
|
userLivingView = findViewById(R.id.liv_user);
|
|
|
|
|
viewClose = findViewById(R.id.view_close);
|
2020-04-28 15:08:58 +08:00
|
|
|
|
llDragInfo = findViewById(R.id.ll_drag_info);
|
2020-04-02 10:43:40 +08:00
|
|
|
|
// floatingLiveMiniView = findViewById(R.id.floating_view);
|
|
|
|
|
|
|
|
|
|
userLivingView.setColor(Color.WHITE);
|
|
|
|
|
mMainTabLayout.setOnTabClickListener(this);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void updateDatas() {
|
|
|
|
|
if ("baidutg".equals(PackerNg.getChannel(this))) {
|
|
|
|
|
mMainTabLayout.select(MainTabLayout.MAIN_TAB_POS_HOME);
|
|
|
|
|
} else {
|
|
|
|
|
mMainTabLayout.select(mCurrentMainPosition);
|
|
|
|
|
}
|
|
|
|
|
handleNimIntent();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void onNewIntent(Intent intent) {
|
2020-04-26 21:36:02 +08:00
|
|
|
|
super.onNewIntent(intent);
|
2020-04-02 10:43:40 +08:00
|
|
|
|
setIntent(intent);
|
|
|
|
|
//这里退出登录,实际上mainActivity是没有销毁的,当从linkme 调起来时候这里需要检查一下登录状态。
|
|
|
|
|
if (TextUtils.isEmpty(AuthModel.get().getTicket())) {
|
|
|
|
|
onNeedLogin();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
onParseIntent();
|
|
|
|
|
handleNimIntent();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private long startTime;
|
|
|
|
|
private boolean shown;
|
|
|
|
|
|
|
|
|
|
private void onParseIntent() {
|
|
|
|
|
Intent intent = getIntent();
|
|
|
|
|
if (intent.hasExtra(EXTRA_APP_QUIT)) {
|
|
|
|
|
onLogout();
|
|
|
|
|
} else if (intent.hasExtra(Extras.EXTRA_JUMP_P2P)) {
|
|
|
|
|
Intent data = intent.getParcelableExtra(Extras.EXTRA_DATA);
|
|
|
|
|
String account = data.getStringExtra(Extras.EXTRA_ACCOUNT);
|
|
|
|
|
if (!TextUtils.isEmpty(account)) {
|
|
|
|
|
NimP2PMessageActivity.start(this, account);
|
|
|
|
|
}
|
|
|
|
|
} else if (intent.hasExtra("url") && intent.hasExtra("type")) {
|
|
|
|
|
startTime = System.currentTimeMillis();
|
|
|
|
|
} else if (intent.hasExtra("gameTab") && intent.getBooleanExtra("gameTab", false)) {
|
|
|
|
|
if (mMainTabLayout != null) {
|
|
|
|
|
mMainTabLayout.select(MainTabLayout.MAIN_TAB_POS_GAME);
|
|
|
|
|
}
|
|
|
|
|
} else if (intent.hasExtra(MSG_TAB) && intent.getBooleanExtra(MSG_TAB, false)) {
|
|
|
|
|
if (mMainTabLayout != null) {
|
|
|
|
|
mMainTabLayout.select(MainTabLayout.MAIN_TAB_POS_MSG);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void initMaterialView() {
|
|
|
|
|
avatarLayout.setVisibility(View.GONE);
|
2020-04-28 15:08:58 +08:00
|
|
|
|
avatarImage.setOnClickListener(this);
|
|
|
|
|
llDragInfo.setOnClickListener(this);
|
|
|
|
|
viewClose.setOnClickListener(this);
|
2020-04-02 10:43:40 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void permission() {
|
|
|
|
|
checkPermission(() -> {
|
|
|
|
|
}, R.string.ask_again,
|
|
|
|
|
Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
|
|
|
|
Manifest.permission.READ_EXTERNAL_STORAGE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void onDestroy() {
|
|
|
|
|
CleanLeakUtils.fixInputMethodManagerLeak(MainActivity.this);
|
|
|
|
|
super.onDestroy();
|
|
|
|
|
listener = null;
|
|
|
|
|
listener1 = null;
|
|
|
|
|
NimUIKit.setSessionListener(null);
|
|
|
|
|
NimUIKit.setContactEventListener(null);
|
|
|
|
|
|
|
|
|
|
EventBus.getDefault().unregister(this);
|
|
|
|
|
stopRoomMinAnim();
|
|
|
|
|
if (limitEnterRoomHelper != null) {
|
|
|
|
|
limitEnterRoomHelper.release();
|
|
|
|
|
}
|
|
|
|
|
IMBroadcastManager.get().onDestroy();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 双击返回键退出
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
|
|
|
|
|
|
|
|
|
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
|
|
|
|
/**
|
|
|
|
|
* 防止华为机型未加入白名单时按返回键回到桌面再锁屏后几秒钟进程被杀
|
|
|
|
|
*/
|
|
|
|
|
try {
|
|
|
|
|
Intent launcherIntent = new Intent(Intent.ACTION_MAIN);
|
|
|
|
|
launcherIntent.addCategory(Intent.CATEGORY_HOME);
|
|
|
|
|
startActivity(launcherIntent);
|
|
|
|
|
} catch (Throwable e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
moveTaskToBack(false);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
return super.onKeyDown(keyCode, event);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return super.onKeyDown(keyCode, event);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onBackPressed() {
|
|
|
|
|
try {
|
|
|
|
|
moveTaskToBack(false);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
|
|
|
|
public void onLinkMeInfoUpdateEvent(LinkMeInfoUpdateEvent event) {
|
|
|
|
|
LinkedInfo linkedInfo = event.getLinkedInfo();
|
|
|
|
|
if (linkedInfo == null || linkedInfo.getType() == null) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LogUtil.print("linkedme跳转");
|
|
|
|
|
handleChannelPageInfo(true)
|
|
|
|
|
.doOnError(throwable -> {
|
|
|
|
|
// 跳转
|
|
|
|
|
if (!StringUtil.isEmpty(linkedInfo.getRoomUid()) && linkedInfo.getType().equals("2")) {
|
|
|
|
|
AVRoomActivity.start(this, Long.valueOf(linkedInfo.getRoomUid()));
|
|
|
|
|
} else if (!StringUtil.isEmpty(linkedInfo.getFamilyId()) && linkedInfo.getType().equals("4")) {
|
|
|
|
|
FamilyHomeActivity.start(this, linkedInfo.getFamilyId());
|
|
|
|
|
} else if (!TextUtils.isEmpty(linkedInfo.getUrl()) && linkedInfo.getType().equals("3")) {
|
|
|
|
|
CommonWebViewActivity.start(context, UriProvider.getLinkUrl(linkedInfo.getUrl()));
|
|
|
|
|
} else if (!TextUtils.isEmpty(linkedInfo.getWorldId()) && linkedInfo.getType().equals("5")) {
|
|
|
|
|
MiniWorldGuestPageActivity.start(context, linkedInfo.getWorldId());
|
|
|
|
|
} else if (linkedInfo.getType().equals("6") && !TextUtils.isEmpty(linkedInfo.getWorldId()) &&
|
|
|
|
|
!TextUtils.isEmpty(linkedInfo.getDynamicId())) {
|
|
|
|
|
DynamicDetailActivity.start(context, JavaUtil.str2long(linkedInfo.getDynamicId()),
|
|
|
|
|
JavaUtil.str2long(linkedInfo.getWorldId()), 6);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.subscribe();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
|
|
|
|
public void onLoginEvent(LoginEvent event) {
|
|
|
|
|
onLogin(AuthModel.get().getCurrentUid());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 检查是否绑定手机
|
|
|
|
|
*/
|
|
|
|
|
private void checkBindPhone() {
|
|
|
|
|
BinderPhoneActivity.start(context, true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
|
|
|
|
public void onLogoutEvent(LogoutEvent event) {
|
|
|
|
|
onLogout();
|
|
|
|
|
PwdCodeMgr.get().onLogout();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@SuppressLint("CheckResult")
|
|
|
|
|
public void onLogin(long uid) {
|
|
|
|
|
Logger.e(TAG, "onLogin Success ~~~~");
|
|
|
|
|
CrashReport.setUserId(this, uid + "");
|
|
|
|
|
|
|
|
|
|
Log.i("checkLostUser", "onLogin");
|
|
|
|
|
checkLostUser(uid);
|
|
|
|
|
|
|
|
|
|
//登录完成后检查更新
|
|
|
|
|
AppUpgradeHelper.checkAppUpgrade(this);
|
|
|
|
|
|
|
|
|
|
//登录成功查询未读信息数量
|
|
|
|
|
mMainTabLayout.setmUnReadDynamicCount(0);
|
|
|
|
|
int unreadCount = IMMessageManager.get().queryUnreadMsg() + Unicorn.getUnreadCount();
|
|
|
|
|
mMainTabLayout.setMsgNum(unreadCount);
|
|
|
|
|
// 如果需要跳转,在这里实现
|
|
|
|
|
if (!shown &&
|
|
|
|
|
(System.currentTimeMillis() - startTime) <= 2000 &&
|
|
|
|
|
getIntent().hasExtra("url") && getIntent().hasExtra("type")) {
|
|
|
|
|
shown = true;
|
|
|
|
|
|
|
|
|
|
LogUtil.print("点击了闪屏");
|
|
|
|
|
handleChannelPageInfo(true)
|
|
|
|
|
.doOnError(throwable -> {
|
|
|
|
|
//如果没有渠道页,就按原来的逻辑即可
|
|
|
|
|
int type = getIntent().getIntExtra("type", 0);
|
|
|
|
|
String url = getIntent().getStringExtra("url");
|
|
|
|
|
if (type == 3) {
|
|
|
|
|
Intent intent = new Intent(context, CommonWebViewActivity.class);
|
|
|
|
|
intent.putExtra("url", url);
|
|
|
|
|
startActivity(intent);
|
|
|
|
|
} else if (type == 2) {
|
|
|
|
|
AVRoomActivity.start(context, Long.valueOf(url));
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.subscribe();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 互动消息未读数量
|
|
|
|
|
HomeModel.get().getUnreadCount(AuthModel.get().getCurrentUid())
|
|
|
|
|
.compose(bindToLifecycle())
|
|
|
|
|
.subscribe(new BiConsumer<Integer, Throwable>() {
|
|
|
|
|
@Override
|
|
|
|
|
public void accept(Integer integer, Throwable throwable) throws Exception {
|
|
|
|
|
if (integer != null) {
|
|
|
|
|
EventBus.getDefault().post(new UnReadCountEvent(integer));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2020-04-07 16:41:24 +08:00
|
|
|
|
openCommunityNotice();
|
2020-04-02 10:43:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
|
|
|
|
public void onLoadLoginUserInfoEvent(LoadLoginUserInfoEvent event) {
|
2020-04-28 15:08:58 +08:00
|
|
|
|
//签到弹窗
|
|
|
|
|
// handleSign();
|
2020-04-02 10:43:40 +08:00
|
|
|
|
firstLoadedUserInfo();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void handleSign() {
|
|
|
|
|
//检查是否需要弹 签到框
|
|
|
|
|
//如果是新用户,因为有资料未完善,所以先不弹签到框
|
|
|
|
|
UserInfo loginUserInfo = UserModel.get().getCacheLoginUserInfo();
|
|
|
|
|
if (loginUserInfo == null) {
|
|
|
|
|
//弹出去绑定用户
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (!TextUtils.isEmpty(loginUserInfo.getNick()) && !TextUtils.isEmpty(loginUserInfo.getAvatar())) {
|
|
|
|
|
//noinspection ResultOfMethodCallIgnored
|
|
|
|
|
SignDialogTimeManager.checkSignDialog(this, false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void onLogout() {
|
|
|
|
|
Logger.e(TAG, "onLogout Success ~~~~");
|
|
|
|
|
getMvpPresenter().exitRoom();
|
2020-04-07 16:41:24 +08:00
|
|
|
|
// LoginActivity.start(MainActivity.this);
|
|
|
|
|
QuickPassLoginAct.start(MainActivity.this);
|
2020-04-02 10:43:40 +08:00
|
|
|
|
PmDialogShowMrg.get().onLogout();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void onNeedLogin() {
|
2020-04-07 16:41:24 +08:00
|
|
|
|
NimMiddleActivity.openCommunity = false;
|
|
|
|
|
QuickPassLoginAct.start(MainActivity.this);
|
2020-04-02 10:43:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
|
|
|
|
public void onKickedOutEvent(KickOutEvent event) {
|
|
|
|
|
toast("您已被踢下线,若非正常行为,请及时修改密码");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
|
|
|
|
public void onReceiveRecentContactChanged(List<RecentContact> imMessages) {
|
|
|
|
|
|
|
|
|
|
int countIgnore = 0;
|
|
|
|
|
for (RecentContact recentContact : imMessages) {
|
|
|
|
|
|
|
|
|
|
if (recentContact.getSessionType() == SessionTypeEnum.Team) {
|
|
|
|
|
Team team = NIMClient.getService(TeamService.class).queryTeamBlock(recentContact.getContactId());
|
|
|
|
|
if (team != null && team.getMessageNotifyType() == TeamMessageNotifyTypeEnum.Mute) {
|
|
|
|
|
countIgnore += recentContact.getUnreadCount();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
int unreadCount = IMMessageManager.get().queryUnreadMsg() + Unicorn.getUnreadCount() - countIgnore;
|
|
|
|
|
mMainTabLayout.setMsgNum(unreadCount);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
|
|
|
|
public void onCustomerServerMsgEvent(CustomerServerMsgEvent event) {
|
|
|
|
|
int unreadCount = IMMessageManager.get().queryUnreadMsg() + event.unreadCount;
|
|
|
|
|
mMainTabLayout.setMsgNum(unreadCount);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
|
|
|
|
public void onNeedCompleteInfo(NeedCompleteInfoEvent event) {
|
|
|
|
|
getDialogManager().dismissDialog();
|
|
|
|
|
UIHelper.showAddInfoAct(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
|
|
|
|
public void onLoginUserInfoUpdateEvent(LoginUserInfoUpdateEvent event) {
|
|
|
|
|
int unreadCount = IMMessageManager.get().queryUnreadMsg() + Unicorn.getUnreadCount();
|
|
|
|
|
mMainTabLayout.setMsgNum(unreadCount);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
|
|
|
|
public void onReceiveNewPacket(final RedPacketInfoV2 redPacketInfo) {
|
|
|
|
|
CommonPref.instance(this).putBoolean("redPacketPoint", true);
|
|
|
|
|
if (redPacketInfo.isNeedAlert()) {
|
|
|
|
|
RedPacketDialog.start(this, redPacketInfo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
|
|
|
|
public void onReceiveLevelUpActivity(LevelUpEvent event) {
|
|
|
|
|
LevelUpDialog.start(this, event.getLevelName(), true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
|
|
|
|
public void onReceiveCharmLevelUpActivity(CharmLevelUpEvent event) {
|
|
|
|
|
LevelUpDialog.start(this, event.getLevelName(), false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@SuppressLint("CheckResult")
|
|
|
|
|
private void updateRoomState() {
|
|
|
|
|
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
|
|
|
|
if (roomInfo != null) {
|
|
|
|
|
UserModel.get().getUserInfo(roomInfo.getUid()).subscribe(new Consumer<UserInfo>() {
|
|
|
|
|
@Override
|
|
|
|
|
public void accept(UserInfo userInfo) throws Exception {
|
|
|
|
|
if (userInfo != null) {
|
2020-04-26 21:36:02 +08:00
|
|
|
|
displayAvatarLayout(userInfo.getAvatar(),userInfo.getNick(),userInfo.getErbanNo());
|
2020-04-02 10:43:40 +08:00
|
|
|
|
} else {
|
|
|
|
|
NimUserInfo nimUserInfo = NimUserInfoCache.getInstance().getUserInfo(roomInfo.getUid() + "");
|
|
|
|
|
if (nimUserInfo == null) {
|
|
|
|
|
NimUserInfoCache.getInstance().getUserInfoFromRemote(roomInfo.getUid() + "", new RequestCallbackWrapper<NimUserInfo>() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onResult(int i, NimUserInfo nimUserInfo, Throwable throwable) {
|
|
|
|
|
if (nimUserInfo != null) {
|
2020-04-26 21:36:02 +08:00
|
|
|
|
displayAvatarLayout(nimUserInfo.getAvatar(),userInfo.getNick(),userInfo.getUid());
|
2020-04-02 10:43:40 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} else {
|
2020-04-26 21:36:02 +08:00
|
|
|
|
displayAvatarLayout(nimUserInfo.getAvatar(),userInfo.getNick(),userInfo.getUid());
|
2020-04-02 10:43:40 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void startRoomMinAnim() {
|
|
|
|
|
roomMinAnim = ObjectAnimator.ofFloat(avatarImage, "rotation", 0f, 360f);
|
|
|
|
|
roomMinAnim.setDuration(10000);
|
|
|
|
|
roomMinAnim.setRepeatCount(-1);
|
|
|
|
|
roomMinAnim.setInterpolator(new LinearInterpolator());
|
|
|
|
|
roomMinAnim.start();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void stopRoomMinAnim() {
|
|
|
|
|
if (roomMinAnim != null) {
|
|
|
|
|
roomMinAnim.cancel();
|
|
|
|
|
roomMinAnim = null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-26 21:36:02 +08:00
|
|
|
|
@SuppressLint("SetTextI18n")
|
|
|
|
|
private void displayAvatarLayout(String avatar, String nickName, long uid) {
|
2020-04-02 10:43:40 +08:00
|
|
|
|
avatarLayout.clearAnimation();
|
|
|
|
|
avatarLayout.setVisibility(View.VISIBLE);
|
2020-04-26 21:36:02 +08:00
|
|
|
|
tvName.setText(nickName);
|
|
|
|
|
tvId.setText("ID:"+uid);
|
2020-04-02 10:43:40 +08:00
|
|
|
|
userLivingView.start();
|
|
|
|
|
stopRoomMinAnim();
|
|
|
|
|
startRoomMinAnim();
|
|
|
|
|
ImageLoadUtils.loadAvatar(MainActivity.this, avatar, avatarImage);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void onEnter(RoomInfo roomInfo) {
|
|
|
|
|
updateRoomState();
|
|
|
|
|
DaemonService.start(this, roomInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@SuppressLint("RestrictedApi")
|
|
|
|
|
@Override
|
|
|
|
|
public void onTabClick(int position) {
|
|
|
|
|
List<Fragment> fragments = getSupportFragmentManager().getFragments();
|
|
|
|
|
switchFragment(position);
|
|
|
|
|
if (position == MainTabLayout.MAIN_TAB_POS_HOME) {
|
|
|
|
|
//显示引导
|
|
|
|
|
// FragmentManager fragmentManager = getSupportFragmentManager();
|
|
|
|
|
// Fragment mainFragment = fragmentManager.findFragmentByTag(MainFragment.TAG);
|
|
|
|
|
// if (mainFragment != null && mainFragment instanceof MainFragment) {
|
|
|
|
|
// ((MainFragment) mainFragment).handleGuide();
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void switchFragment(int position) {
|
|
|
|
|
FragmentManager fragmentManager = getSupportFragmentManager();
|
|
|
|
|
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
|
|
|
|
|
//Fragment mainFragment = fragmentManager.findFragmentByTag(MainFragment.TAG);
|
2020-04-08 10:39:44 +08:00
|
|
|
|
Fragment attentionFragment = fragmentManager.findFragmentByTag(SquareFragment.TAG);
|
2020-04-03 19:21:36 +08:00
|
|
|
|
// Fragment msgFragment = fragmentManager.findFragmentByTag(MsgFragment.TAG);
|
|
|
|
|
Fragment contactFragment = fragmentManager.findFragmentByTag(ContactsListFragment.TAG);
|
2020-04-02 10:43:40 +08:00
|
|
|
|
Fragment meFragment = fragmentManager.findFragmentByTag(MeFragment.TAG);
|
|
|
|
|
Fragment rankingFragment = fragmentManager.findFragmentByTag(RankingFragment.TAG);
|
|
|
|
|
Fragment gameFragment = fragmentManager.findFragmentByTag(GameHomeFragment.TAG);
|
|
|
|
|
//先隐藏所有的
|
|
|
|
|
// if (mainFragment != null && mainFragment.isVisible()) {
|
|
|
|
|
// fragmentTransaction.hide(mainFragment);
|
|
|
|
|
// }
|
|
|
|
|
if (attentionFragment != null && attentionFragment.isVisible()) {
|
|
|
|
|
fragmentTransaction.hide(attentionFragment);
|
|
|
|
|
}
|
2020-04-03 19:21:36 +08:00
|
|
|
|
if (contactFragment != null && contactFragment.isVisible()) {
|
|
|
|
|
fragmentTransaction.hide(contactFragment);
|
2020-04-02 10:43:40 +08:00
|
|
|
|
}
|
|
|
|
|
if (meFragment != null && meFragment.isVisible()) {
|
|
|
|
|
fragmentTransaction.hide(meFragment);
|
|
|
|
|
}
|
|
|
|
|
if (rankingFragment != null && rankingFragment.isVisible()) {
|
|
|
|
|
fragmentTransaction.hide(rankingFragment);
|
|
|
|
|
}
|
|
|
|
|
if (gameFragment != null && gameFragment.isVisible()) {
|
|
|
|
|
fragmentTransaction.hide(gameFragment);
|
|
|
|
|
}
|
|
|
|
|
//预加载首页
|
|
|
|
|
// if (PRELOAD_HOME && mainFragment == null) {
|
|
|
|
|
// mainFragment = new MainFragment();
|
|
|
|
|
// fragmentTransaction.add(R.id.main_fragment, mainFragment, MainFragment.TAG);
|
|
|
|
|
// }
|
|
|
|
|
if (position == MainTabLayout.MAIN_TAB_POS_GAME) {
|
|
|
|
|
if (gameFragment == null) {
|
|
|
|
|
gameFragment = new GameHomeFragment();
|
|
|
|
|
fragmentTransaction.add(R.id.main_fragment, gameFragment, GameHomeFragment.TAG);
|
|
|
|
|
}
|
|
|
|
|
fragmentTransaction.show(gameFragment);
|
|
|
|
|
} else if (position == MainTabLayout.MAIN_TAB_POS_HOME) {
|
|
|
|
|
// if (mainFragment == null) {
|
|
|
|
|
// mainFragment = new MainFragment();
|
|
|
|
|
// fragmentTransaction.add(R.id.main_fragment, mainFragment, MainFragment.TAG);
|
|
|
|
|
// }
|
|
|
|
|
// fragmentTransaction.show(mainFragment);
|
|
|
|
|
} else if (position == MainTabLayout.MAIN_TAB_POS_ATTENTION) {
|
|
|
|
|
if (attentionFragment == null) {
|
2020-04-08 10:39:44 +08:00
|
|
|
|
attentionFragment = new SquareFragment();
|
|
|
|
|
fragmentTransaction.add(R.id.main_fragment, attentionFragment, SquareFragment.TAG);
|
2020-04-02 10:43:40 +08:00
|
|
|
|
}
|
|
|
|
|
fragmentTransaction.show(attentionFragment);
|
|
|
|
|
} else if (position == MainTabLayout.MAIN_TAB_POS_MSG) {
|
2020-04-03 19:21:36 +08:00
|
|
|
|
if (contactFragment == null) {
|
|
|
|
|
contactFragment = new ContactsListFragment();
|
|
|
|
|
fragmentTransaction.add(R.id.main_fragment, contactFragment, ContactsListFragment.TAG);
|
2020-04-02 10:43:40 +08:00
|
|
|
|
}
|
2020-04-03 19:21:36 +08:00
|
|
|
|
fragmentTransaction.show(contactFragment);
|
2020-04-02 10:43:40 +08:00
|
|
|
|
} else if (position == MainTabLayout.MAIN_TAB_POS_ME) {
|
|
|
|
|
if (meFragment == null) {
|
|
|
|
|
meFragment = new MeFragment();
|
|
|
|
|
fragmentTransaction.add(R.id.main_fragment, meFragment, MeFragment.TAG);
|
|
|
|
|
}
|
|
|
|
|
fragmentTransaction.show(meFragment);
|
|
|
|
|
}
|
|
|
|
|
if (!isDestroyed())
|
|
|
|
|
fragmentTransaction.commitAllowingStateLoss();
|
|
|
|
|
mCurrentMainPosition = position;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void exitRoom(RoomInfo roomInfo) {
|
|
|
|
|
closeOpenRoomAnimation();
|
|
|
|
|
//ktv退出的时候需要用到
|
|
|
|
|
if (RtcEngineManager.get().isOpenKtv() && roomInfo != null) {
|
|
|
|
|
KtvMusicManager.INSTANCE.deleteUserAllChooseMusic(roomInfo.getUid()).subscribe();
|
|
|
|
|
RtcEngineManager.get().closeKtvModel();
|
|
|
|
|
}
|
|
|
|
|
DaemonService.stop(MainActivity.this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void showCarGuide() {
|
|
|
|
|
boolean showCarGuide = CommonPref.instance(this).getBoolean(SHOW_CAR_GUIDE, true);
|
|
|
|
|
if (showCarGuide) {
|
|
|
|
|
ShowCarGuideDialog showCarGuideDialog = ShowCarGuideDialog.newInstance("https://img.erbanyy.com/Fi1Vhqkkc9dh3RIPgy3jjWBtyWNE?imageslim");
|
|
|
|
|
if (!isValid()) return;
|
|
|
|
|
showCarGuideDialog.show(getFragmentManager(), ShowCarGuideDialog.class.getSimpleName());
|
|
|
|
|
CommonPref.instance(this).putBoolean(SHOW_CAR_GUIDE, false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* lvzebiao at 2020/02/27
|
|
|
|
|
* 绑定手机号流程更改,完善资料完成后,访问少男少女的接口的逻辑依旧保留,但不算登录流程结束
|
|
|
|
|
* 登录流程结束,应该是完善资料-绑定手机号-最后获取最新的用户信息
|
|
|
|
|
* 并且发出事件{@link LoadLoginUserInfoEvent} 后,才算登录流程成功,并终止
|
|
|
|
|
*/
|
|
|
|
|
@SuppressLint("CheckResult")
|
|
|
|
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
|
|
|
|
public void onCurrentUserInfoCompleteEvent(CurrentUserInfoCompleteEvent event) {
|
|
|
|
|
//补全完信息后,获取导流房间数据
|
|
|
|
|
HomeModel.get().loadRecommendRoom(
|
|
|
|
|
String.valueOf(AuthModel.get().getCurrentUid())
|
|
|
|
|
)
|
|
|
|
|
.subscribe(new BiConsumer<UserRecommendRoomInfo, Throwable>() {
|
|
|
|
|
@Override
|
|
|
|
|
public void accept(UserRecommendRoomInfo userRecommendRoomInfo, Throwable throwable) throws Exception {
|
|
|
|
|
if (throwable != null) {
|
|
|
|
|
Logger.e(throwable.getMessage());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (userRecommendRoomInfo.getRecommendRoomUid() > 0) {
|
|
|
|
|
onRecommendRoomWhenCompleteUserInformation(userRecommendRoomInfo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//处理签到弹框 注释原因看上面备注
|
|
|
|
|
//handleSign();
|
|
|
|
|
//firstLoadedUserInfo();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 第一次完善用户信息时候,弹出推荐房间dialog
|
|
|
|
|
*
|
|
|
|
|
* @param userRecommendRoomInfo
|
|
|
|
|
*/
|
|
|
|
|
private void onRecommendRoomWhenCompleteUserInformation(UserRecommendRoomInfo userRecommendRoomInfo) {
|
|
|
|
|
RecommendRoomForNewerDialog dialog = new RecommendRoomForNewerDialog(this);
|
|
|
|
|
dialog.setActionListener(new RecommendRoomForNewerDialog.onActionListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onGoIntoRoom(DialogInterface dialogInterface) {
|
|
|
|
|
AVRoomActivity.start(MainActivity.this, userRecommendRoomInfo.getRecommendRoomUid());
|
|
|
|
|
dialogInterface.dismiss();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onCancel(DialogInterface dialogInterface) {
|
|
|
|
|
dialogInterface.dismiss();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
dialog.show();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
|
|
|
|
public void onMarketVerifyUpdateEvent(MarketVerifyUpdateEvent event) {
|
|
|
|
|
//审核包隐藏tab
|
|
|
|
|
if (MarketVerifyModel.get().isMarketChecking()) {
|
|
|
|
|
mMainTabLayout.showOrHideTab(MainTabLayout.MAIN_TAB_POS_ATTENTION, View.GONE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
|
|
|
|
public void onReceiveRecallStatus(CheckLostUserEvent event) {
|
|
|
|
|
//如果没有获取到当前登录用户的信息,不弹出提示
|
|
|
|
|
if (UserModel.get().getCacheLoginUserInfo() == null) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CheckLostUserInfo checkLostUserInfo = (CheckLostUserInfo) event.getData();
|
|
|
|
|
|
|
|
|
|
boolean goBackOnce = (boolean) SharedPreferenceUtils.get(RecallDialog.GO_BACK_ONCE, false);
|
|
|
|
|
|
|
|
|
|
if (!goBackOnce && !event.isFailed() && checkLostUserInfo.isLostUser() && !checkLostUserInfo.isClaimedAward())
|
|
|
|
|
RecallDialog.start(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void checkLostUser(long uid) {
|
|
|
|
|
RecallModel.get().checkLostUser(uid).subscribe();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void startGuild() {
|
|
|
|
|
GuideActivity.start(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean isShowGameTab() {
|
|
|
|
|
return mCurrentMainPosition == MainTabLayout.MAIN_TAB_POS_GAME;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean isShowMainTab() {
|
|
|
|
|
return mCurrentMainPosition == MainTabLayout.MAIN_TAB_POS_HOME;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean isShowMsgTab() {
|
|
|
|
|
return mCurrentMainPosition == MainTabLayout.MAIN_TAB_POS_MSG;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean isShowMeTab() {
|
|
|
|
|
return mCurrentMainPosition == MainTabLayout.MAIN_TAB_POS_ME;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 第一次加载到用户信息
|
|
|
|
|
*/
|
|
|
|
|
private void firstLoadedUserInfo() {
|
|
|
|
|
//青少年弹窗处理
|
|
|
|
|
PmDialogShowMrg.get().handle(new WeakReference<>(this));
|
|
|
|
|
|
|
|
|
|
//这里稍微晚点访问
|
|
|
|
|
Single.timer(400, TimeUnit.MILLISECONDS, AndroidSchedulers.mainThread())
|
2020-04-07 16:41:24 +08:00
|
|
|
|
.compose(bindUntilEvent(ActivityEvent.DESTROY))
|
2020-04-02 10:43:40 +08:00
|
|
|
|
.flatMap(new Function<Long, SingleSource<ChannelPageInfo>>() {
|
|
|
|
|
@Override
|
|
|
|
|
public SingleSource<ChannelPageInfo> apply(Long aLong) throws Exception {
|
|
|
|
|
return handleChannelPageInfo(false);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.subscribe();
|
2020-04-07 16:41:24 +08:00
|
|
|
|
|
|
|
|
|
//通知栏权限判断
|
|
|
|
|
NoticationsUiHelper.handle(this, getDialogManager());
|
|
|
|
|
|
2020-04-02 10:43:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public LimitEnterRoomHelper getLimitEnterRoomHelper() {
|
|
|
|
|
if (limitEnterRoomHelper == null) {
|
|
|
|
|
limitEnterRoomHelper = new LimitEnterRoomHelper();
|
|
|
|
|
}
|
|
|
|
|
return limitEnterRoomHelper;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
|
|
|
|
public void onImPushMsgPmLimitTimeEvent(ImPushMsgPmLimitTimeEvent event) {
|
|
|
|
|
//先判断Avroom存不存在,存在的话则不处理,avroom会处理
|
|
|
|
|
WeakReference<Activity> reference = ActivityStackManager.getInstance().getAvRoomActWeakRef();
|
|
|
|
|
if (reference != null && reference.get() != null) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
getLimitEnterRoomHelper().handleThisContext(this, event.getData(), true, this::handlePmExitRoom);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
|
|
|
|
public void onPmDismissAllLimitDialogEvent(PmDismissAllLimitDialogEvent event) {
|
|
|
|
|
if (limitEnterRoomHelper != null) {
|
|
|
|
|
limitEnterRoomHelper.dismissDialog();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
|
|
|
|
public void onUnReadCount(UnReadCountEvent event) {
|
|
|
|
|
mMainTabLayout.setmUnReadDynamicCount(event.getTotal());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
|
|
|
|
public void SquarePublish(SquareTaskEvent event) {
|
|
|
|
|
if (getDialogManager() != null) {
|
|
|
|
|
PublishActivity.start(getDialogManager());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void handlePmExitRoom() {
|
|
|
|
|
if (AvRoomDataManager.get().mCurrentRoomInfo != null) {
|
|
|
|
|
closeOpenRoomAnimation();
|
|
|
|
|
getMvpPresenter().exitRoom();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
|
|
|
|
public void onCloseMinRoomEvent(CloseMinRoomEvent event) {
|
|
|
|
|
//如果房间存在,就关闭
|
|
|
|
|
if (AvRoomDataManager.get().mCurrentRoomInfo != null) {
|
|
|
|
|
handlePmExitRoom();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 处理开房限制时长
|
|
|
|
|
*/
|
|
|
|
|
public void handleOpenRoomWhenPmLimit(String error) {
|
|
|
|
|
getLimitEnterRoomHelper().handleThisContext(this, error, false, this::handlePmExitRoom);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 云信通知栏跳转的处理
|
|
|
|
|
*/
|
|
|
|
|
private void handleNimIntent() {
|
2020-04-07 16:41:24 +08:00
|
|
|
|
openCommunityNotice();
|
|
|
|
|
|
2020-04-02 10:43:40 +08:00
|
|
|
|
Intent intent = getIntent();
|
|
|
|
|
if (intent == null) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
boolean isNimPush = intent.getBooleanExtra(NimMiddleActivity.EXTRA_IS_NIM_PUSH, false);
|
|
|
|
|
if (isNimPush && mMainTabLayout != null) {
|
|
|
|
|
mMainTabLayout.select(MainTabLayout.MAIN_TAB_POS_MSG);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-07 16:41:24 +08:00
|
|
|
|
/**
|
|
|
|
|
* 点击互动通知通知栏,重启进程打开互动通知页
|
|
|
|
|
*/
|
|
|
|
|
private void openCommunityNotice() {
|
|
|
|
|
if (NimMiddleActivity.delayOpenCommunity) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (NimMiddleActivity.openCommunity) {
|
|
|
|
|
NimMiddleActivity.openCommunity = false;
|
|
|
|
|
CommunityNoticeAct.start(this);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-02 10:43:40 +08:00
|
|
|
|
private Single<ChannelPageInfo> handleChannelPageInfo(boolean isSplashOrLinkedme) {
|
|
|
|
|
return ChannelPageModel.get().handleSplashOrLinkedmeJump(isSplashOrLinkedme)
|
|
|
|
|
.compose(bindUntilEvent(ActivityEvent.DESTROY))
|
|
|
|
|
.doOnSuccess(info -> channelPageInfoRoute(info, isSplashOrLinkedme))
|
|
|
|
|
.doOnError(throwable -> LogUtil.print(throwable.getMessage()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 处理渠道落地页
|
|
|
|
|
*/
|
|
|
|
|
private void channelPageInfoRoute(ChannelPageInfo info, boolean isSplashOrLinkedme) {
|
|
|
|
|
if (info == null) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (ChannelPageModel.get().isHasJumpChannelPage()) {
|
|
|
|
|
LogUtil.print("已经跳转过落地页了...");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
ChannelPageModel.get().setTureJumpChannelPage();
|
|
|
|
|
//如果是来自linkedme或者闪屏,则需要延迟下再启动
|
|
|
|
|
//普通访问,事先已经有延迟,则直接启动
|
|
|
|
|
long delay = isSplashOrLinkedme ? 300 : 10;
|
|
|
|
|
Single.timer(delay, TimeUnit.MILLISECONDS, AndroidSchedulers.mainThread())
|
|
|
|
|
.doOnSuccess(aLong ->
|
|
|
|
|
RouterHandler.handle(context, info.getRouteType(), info.getRouteValue()))
|
|
|
|
|
.subscribe();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
|
|
|
|
public void onNeedBindPhoneEvent(NeedBindPhoneEvent event) {
|
|
|
|
|
checkBindPhone();
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-24 13:02:56 +08:00
|
|
|
|
|
2020-04-28 15:08:58 +08:00
|
|
|
|
@Override
|
|
|
|
|
public void onClick(View v) {
|
|
|
|
|
switch (v.getId()){
|
|
|
|
|
case R.id.avatar_image:
|
|
|
|
|
case R.id.ll_drag_info:
|
|
|
|
|
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
|
|
|
|
if (roomInfo != null) {
|
|
|
|
|
if (AvRoomDataManager.get().isParty()) {
|
|
|
|
|
AVRoomActivity.start(MainActivity.this, true);
|
|
|
|
|
}else {
|
|
|
|
|
AVRoomActivity.start(MainActivity.this, roomInfo.getUid());
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
toast("-房间信息为空-");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case R.id.view_close:
|
|
|
|
|
StatisticManager.Instance().onEvent(StatisticsProtocol.Event.EVENT_ROOM_MINIMIZE_CLOSED,
|
|
|
|
|
"房间最小化关闭按钮");
|
|
|
|
|
MainActivity.this.getMvpPresenter().exitRoom();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-04-02 10:43:40 +08:00
|
|
|
|
}
|