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.Intent;
|
|
|
|
|
import android.graphics.Color;
|
|
|
|
|
import android.os.Bundle;
|
2020-08-04 20:41:55 +08:00
|
|
|
|
import android.os.Handler;
|
2020-04-02 10:43:40 +08:00
|
|
|
|
import android.text.TextUtils;
|
|
|
|
|
import android.util.Log;
|
|
|
|
|
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.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;
|
2020-05-12 12:31:13 +08:00
|
|
|
|
import com.trello.rxlifecycle3.android.ActivityEvent;
|
2020-04-02 10:43:40 +08:00
|
|
|
|
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.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.family.view.activity.FamilyHomeActivity;
|
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.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;
|
2020-09-11 17:16:21 +08:00
|
|
|
|
import com.yizhuan.erban.ui.im.chat.MsgViewHolderHello;
|
2020-04-02 10:43:40 +08:00
|
|
|
|
import com.yizhuan.erban.ui.im.chat.MsgViewHolderLevel;
|
|
|
|
|
import com.yizhuan.erban.ui.im.chat.MsgViewHolderLottery;
|
|
|
|
|
import com.yizhuan.erban.ui.im.chat.MsgViewHolderOnline;
|
2020-07-08 14:15:32 +08:00
|
|
|
|
import com.yizhuan.erban.ui.im.chat.MsgViewHolderRedPackage;
|
2020-04-02 10:43:40 +08:00
|
|
|
|
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;
|
2020-05-11 19:53:30 +08:00
|
|
|
|
import com.yizhuan.erban.ui.login.BindPhoneActivity;
|
2020-12-02 20:18:12 +08:00
|
|
|
|
import com.yizhuan.erban.ui.login.fragment.AddUserInfoFragment;
|
2021-01-05 11:51:57 +08:00
|
|
|
|
import com.yizhuan.erban.ui.patriarch.PatriarchModeDialog;
|
2020-04-02 10:43:40 +08:00
|
|
|
|
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;
|
2020-08-24 16:14:01 +08:00
|
|
|
|
import com.yizhuan.erban.utils.PushMessageHandler;
|
2020-04-02 10:43:40 +08:00
|
|
|
|
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;
|
2020-09-11 17:16:21 +08:00
|
|
|
|
import com.yizhuan.xchat_android_core.im.custom.bean.NewbieHelloAttachment;
|
2020-04-02 10:43:40 +08:00
|
|
|
|
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;
|
2020-07-08 14:15:32 +08:00
|
|
|
|
import com.yizhuan.xchat_android_core.im.custom.bean.RedPackageAttachment;
|
2020-04-02 10:43:40 +08:00
|
|
|
|
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;
|
2020-12-02 20:18:12 +08:00
|
|
|
|
import com.yizhuan.xchat_android_core.linked.LinkedModel;
|
2020-04-02 10:43:40 +08:00
|
|
|
|
import com.yizhuan.xchat_android_core.linked.bean.LinkedInfo;
|
|
|
|
|
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.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.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;
|
2020-12-02 20:18:12 +08:00
|
|
|
|
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
|
2020-04-02 10:43:40 +08:00
|
|
|
|
import com.yizhuan.xchat_android_library.base.factory.CreatePresenter;
|
|
|
|
|
import com.yizhuan.xchat_android_library.threadmgr.ThreadPoolManager;
|
2020-05-12 12:31:13 +08:00
|
|
|
|
import com.yizhuan.xchat_android_library.utils.AppMetaDataUtil;
|
2020-04-02 10:43:40 +08:00
|
|
|
|
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.SingleObserver;
|
|
|
|
|
import io.reactivex.disposables.Disposable;
|
|
|
|
|
|
2020-12-02 20:18:12 +08:00
|
|
|
|
import static com.yizhuan.xchat_android_core.channel_page.model.ChannelPageModel.KEY_FLAG_VALID_CHANNEL_PAGE;
|
2020-04-02 10:43:40 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @author Administrator
|
|
|
|
|
*/
|
|
|
|
|
@CreatePresenter(MainPresenter.class)
|
|
|
|
|
public class MainActivity extends BaseMvpActivity<IMainView, MainPresenter>
|
2020-12-02 20:18:12 +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 MainTabLayout mMainTabLayout;
|
2020-05-07 11:16:01 +08:00
|
|
|
|
private int mCurrentMainPosition = MainTabLayout.MAIN_TAB_POS_HOME;
|
2020-04-02 10:43:40 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 房间最小化动画,换成属性动画,原先的补间动画影响了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();
|
2020-05-11 10:29:04 +08:00
|
|
|
|
//引导页
|
2020-05-11 13:49:57 +08:00
|
|
|
|
// startGuild();
|
2020-04-02 10:43:40 +08:00
|
|
|
|
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();
|
2020-05-07 11:16:01 +08:00
|
|
|
|
StatisticManager.Instance().onEvent(StatisticsProtocol.Event.USER_KICKED_EVENT, "用户被踢");
|
2020-04-02 10:43:40 +08:00
|
|
|
|
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);
|
2020-05-07 11:16:01 +08:00
|
|
|
|
StatisticManager.Instance().onEvent(StatisticsProtocol.Event.USER_KICKED_EVENT, "用户被踢");
|
2020-04-02 10:43:40 +08:00
|
|
|
|
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);
|
2020-09-11 17:16:21 +08:00
|
|
|
|
NimUIKit.registerMsgItemViewHolder(NewbieHelloAttachment.class, MsgViewHolderHello.class);
|
2020-04-02 10:43:40 +08:00
|
|
|
|
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-07-08 14:15:32 +08:00
|
|
|
|
NimUIKit.registerMsgItemViewHolder(RedPackageAttachment.class, MsgViewHolderRedPackage.class);
|
2020-04-02 10:43:40 +08:00
|
|
|
|
// 声音瓶子
|
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);
|
2020-05-07 16:39:56 +08:00
|
|
|
|
//瓜分钻石 三级
|
2020-04-02 10:43:40 +08:00
|
|
|
|
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);
|
2020-07-31 19:43:17 +08:00
|
|
|
|
//邀请
|
|
|
|
|
// NimUIKit.registerMsgItemViewHolder(RoomInviteFansAttachment.class, LuckyMoneyTipsViewHolder.class);
|
2020-04-02 10:43:40 +08:00
|
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
if (avatarLayout.getVisibility() == View.VISIBLE) {
|
|
|
|
|
userLivingView.start();
|
|
|
|
|
}
|
2020-12-23 18:16:54 +08:00
|
|
|
|
//这里是为了处理APP后台运行的情况下点击分享房间等LinkedMe链接的情况
|
|
|
|
|
if (UserModel.get().getCacheLoginUserInfo() != null) {
|
|
|
|
|
handleLinkedJump();
|
|
|
|
|
}
|
2020-04-02 10:43:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@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);
|
|
|
|
|
|
2020-05-08 16:24:31 +08:00
|
|
|
|
|
2020-04-02 10:43:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void updateDatas() {
|
2020-05-12 12:31:13 +08:00
|
|
|
|
if ("baidutg".equals(AppMetaDataUtil.getChannelID())) {
|
2020-04-02 10:43:40 +08:00
|
|
|
|
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) {
|
2020-05-07 11:16:01 +08:00
|
|
|
|
mMainTabLayout.select(MainTabLayout.MAIN_TAB_POS_HOME);
|
2020-04-02 10:43:40 +08:00
|
|
|
|
}
|
|
|
|
|
} 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 onLoginEvent(LoginEvent event) {
|
|
|
|
|
onLogin(AuthModel.get().getCurrentUid());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 检查是否绑定手机
|
|
|
|
|
*/
|
|
|
|
|
private void checkBindPhone() {
|
2020-05-09 20:08:10 +08:00
|
|
|
|
// BinderPhoneActivity.start(context, true);
|
2020-05-11 19:53:30 +08:00
|
|
|
|
BindPhoneActivity.start(context);
|
2020-04-02 10:43:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@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");
|
|
|
|
|
|
|
|
|
|
//登录成功查询未读信息数量
|
|
|
|
|
mMainTabLayout.setmUnReadDynamicCount(0);
|
|
|
|
|
int unreadCount = IMMessageManager.get().queryUnreadMsg() + Unicorn.getUnreadCount();
|
|
|
|
|
mMainTabLayout.setMsgNum(unreadCount);
|
|
|
|
|
// 互动消息未读数量
|
|
|
|
|
HomeModel.get().getUnreadCount(AuthModel.get().getCurrentUid())
|
|
|
|
|
.compose(bindToLifecycle())
|
2020-12-02 20:18:12 +08:00
|
|
|
|
.subscribe((integer, throwable) -> {
|
|
|
|
|
if (integer != null) {
|
|
|
|
|
EventBus.getDefault().post(new UnReadCountEvent(integer));
|
2020-04-02 10:43:40 +08:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
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) {
|
2020-12-02 20:18:12 +08:00
|
|
|
|
UserModel.get().getUserInfo(roomInfo.getUid())
|
|
|
|
|
.subscribe(userInfo -> {
|
|
|
|
|
if (userInfo != null) {
|
|
|
|
|
displayAvatarLayout(userInfo.getAvatar(), roomInfo.getTitle(), userInfo.getErbanNo());
|
2020-04-02 10:43:40 +08:00
|
|
|
|
} else {
|
2020-12-02 20:18:12 +08:00
|
|
|
|
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) {
|
|
|
|
|
displayAvatarLayout(nimUserInfo.getAvatar(), roomInfo.getTitle(), userInfo.getUid());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
displayAvatarLayout(nimUserInfo.getAvatar(), roomInfo.getTitle(), userInfo.getUid());
|
|
|
|
|
}
|
2020-04-02 10:43:40 +08:00
|
|
|
|
}
|
2020-12-02 20:18:12 +08:00
|
|
|
|
});
|
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);
|
2020-05-07 11:16:01 +08:00
|
|
|
|
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) {
|
|
|
|
|
switchFragment(position);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void switchFragment(int position) {
|
|
|
|
|
FragmentManager fragmentManager = getSupportFragmentManager();
|
|
|
|
|
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
|
2020-05-07 11:16:01 +08:00
|
|
|
|
Fragment squareFragment = fragmentManager.findFragmentByTag(SquareFragment.TAG);
|
2020-04-03 19:21:36 +08:00
|
|
|
|
Fragment contactFragment = fragmentManager.findFragmentByTag(ContactsListFragment.TAG);
|
2020-04-02 10:43:40 +08:00
|
|
|
|
Fragment meFragment = fragmentManager.findFragmentByTag(MeFragment.TAG);
|
2020-05-07 11:16:01 +08:00
|
|
|
|
Fragment homeFragment = fragmentManager.findFragmentByTag(GameHomeFragment.TAG);
|
|
|
|
|
|
|
|
|
|
if (squareFragment != null && squareFragment.isVisible()) {
|
|
|
|
|
fragmentTransaction.hide(squareFragment);
|
2020-04-02 10:43:40 +08:00
|
|
|
|
}
|
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);
|
|
|
|
|
}
|
2020-05-07 11:16:01 +08:00
|
|
|
|
if (homeFragment != null && homeFragment.isVisible()) {
|
|
|
|
|
fragmentTransaction.hide(homeFragment);
|
2020-04-02 10:43:40 +08:00
|
|
|
|
}
|
2020-05-07 11:16:01 +08:00
|
|
|
|
|
|
|
|
|
if (position == MainTabLayout.MAIN_TAB_POS_HOME) {
|
|
|
|
|
if (homeFragment == null) {
|
|
|
|
|
homeFragment = new GameHomeFragment();
|
|
|
|
|
fragmentTransaction.add(R.id.main_fragment, homeFragment, GameHomeFragment.TAG);
|
2020-04-02 10:43:40 +08:00
|
|
|
|
}
|
2020-05-07 11:16:01 +08:00
|
|
|
|
fragmentTransaction.show(homeFragment);
|
|
|
|
|
} else if (position == MainTabLayout.MAIN_TAB_POS_SQUARE) {
|
|
|
|
|
if (squareFragment == null) {
|
2020-08-25 15:30:19 +08:00
|
|
|
|
StatisticManager.Instance().onEvent(StatisticsProtocol.Event.EVENT_SQUARE_DONG_TAI_CLICK, "点击广场动态页");
|
2020-05-07 11:16:01 +08:00
|
|
|
|
squareFragment = new SquareFragment();
|
|
|
|
|
fragmentTransaction.add(R.id.main_fragment, squareFragment, SquareFragment.TAG);
|
2020-04-02 10:43:40 +08:00
|
|
|
|
}
|
2020-05-07 11:16:01 +08:00
|
|
|
|
fragmentTransaction.show(squareFragment);
|
2020-04-02 10:43:40 +08:00
|
|
|
|
} else if (position == MainTabLayout.MAIN_TAB_POS_MSG) {
|
2020-04-03 19:21:36 +08:00
|
|
|
|
if (contactFragment == null) {
|
2020-08-25 15:30:19 +08:00
|
|
|
|
StatisticManager.Instance().onEvent(StatisticsProtocol.Event.EVENT_MESSAGE, "消息页");
|
2020-04-03 19:21:36 +08:00
|
|
|
|
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);
|
|
|
|
|
}
|
2020-05-07 11:16:01 +08:00
|
|
|
|
if (!isDestroyed()) fragmentTransaction.commitAllowingStateLoss();
|
2020-04-02 10:43:40 +08:00
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
|
|
|
|
public void onMarketVerifyUpdateEvent(MarketVerifyUpdateEvent event) {
|
|
|
|
|
//审核包隐藏tab
|
|
|
|
|
if (MarketVerifyModel.get().isMarketChecking()) {
|
2020-05-07 11:16:01 +08:00
|
|
|
|
mMainTabLayout.showOrHideTab(MainTabLayout.MAIN_TAB_POS_SQUARE, View.GONE);
|
2020-04-02 10:43:40 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean isShowMsgTab() {
|
|
|
|
|
return mCurrentMainPosition == MainTabLayout.MAIN_TAB_POS_MSG;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean isShowMeTab() {
|
|
|
|
|
return mCurrentMainPosition == MainTabLayout.MAIN_TAB_POS_ME;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 第一次加载到用户信息
|
2020-12-02 20:18:12 +08:00
|
|
|
|
* 跳转优先级 闪屏→linkedMe→渠道指定房间→邀请码
|
2020-04-02 10:43:40 +08:00
|
|
|
|
*/
|
|
|
|
|
private void firstLoadedUserInfo() {
|
|
|
|
|
//青少年弹窗处理
|
|
|
|
|
PmDialogShowMrg.get().handle(new WeakReference<>(this));
|
|
|
|
|
|
2020-04-07 16:41:24 +08:00
|
|
|
|
//通知栏权限判断
|
|
|
|
|
NoticationsUiHelper.handle(this, getDialogManager());
|
|
|
|
|
|
2020-12-02 20:18:12 +08:00
|
|
|
|
handleChannelPageInfo();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//闪屏→linkedme→渠道指定房间→邀请码
|
|
|
|
|
@SuppressLint("CheckResult")
|
|
|
|
|
private void handleChannelPageInfo() {
|
|
|
|
|
if (handleSplashJump()) return;
|
|
|
|
|
if (handleLinkedJump()) return;
|
|
|
|
|
|
2020-12-03 14:34:27 +08:00
|
|
|
|
//渠道落地页和邀请码跳转只需要完善资料后处理一次
|
2020-12-03 11:40:53 +08:00
|
|
|
|
String spKey = KEY_FLAG_VALID_CHANNEL_PAGE + AuthModel.get().getCurrentUid();
|
|
|
|
|
if ((boolean) SharedPreferenceUtils.get(spKey, true)) {
|
|
|
|
|
SharedPreferenceUtils.put(spKey, false);
|
2020-12-02 20:18:12 +08:00
|
|
|
|
ChannelPageModel.get().getChannelPage()
|
|
|
|
|
.delay(400, TimeUnit.MILLISECONDS)
|
|
|
|
|
.compose(RxHelper.handleSchedulers())
|
|
|
|
|
.compose(bindUntilEvent(ActivityEvent.DESTROY))
|
|
|
|
|
.subscribe(this::channelPageInfoRoute,
|
|
|
|
|
throwable -> checkInviteUserInRoom());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 检查邀请码跳转
|
|
|
|
|
*/
|
|
|
|
|
@SuppressLint("CheckResult")
|
|
|
|
|
private void checkInviteUserInRoom() {
|
|
|
|
|
if (!TextUtils.isEmpty(AddUserInfoFragment.INVITE_USER_CODE)) {
|
|
|
|
|
ChannelPageModel.get().checkInviteUserInRoom(AddUserInfoFragment.INVITE_USER_CODE)
|
|
|
|
|
.subscribe(inviteUserInfo -> {
|
|
|
|
|
if (inviteUserInfo.isInRoom()) {
|
|
|
|
|
AVRoomActivity.startForFromType(context,
|
|
|
|
|
inviteUserInfo.getRoomUid(),
|
|
|
|
|
AVRoomActivity.FROM_TYPE_USER,
|
|
|
|
|
inviteUserInfo.getInviteNick(),
|
|
|
|
|
String.valueOf(inviteUserInfo.getInviteUid()));
|
|
|
|
|
}
|
|
|
|
|
}, Throwable::printStackTrace);
|
2020-12-03 14:34:27 +08:00
|
|
|
|
AddUserInfoFragment.INVITE_USER_CODE = "";
|
2020-12-02 20:18:12 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 处理渠道落地页
|
|
|
|
|
*/
|
|
|
|
|
private void channelPageInfoRoute(ChannelPageInfo info) {
|
|
|
|
|
RouterHandler.handle(context, info.getRouteType(), info.getRouteValue());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return true 如果处理了跳转
|
|
|
|
|
*/
|
|
|
|
|
private boolean handleSplashJump() {
|
|
|
|
|
if (getIntent().hasExtra("url") && getIntent().hasExtra("type")) {
|
|
|
|
|
LogUtil.print("点击了闪屏");
|
|
|
|
|
//如果没有渠道页,就按原来的逻辑即可
|
|
|
|
|
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.parseLong(url));
|
|
|
|
|
} else {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2020-12-03 14:34:27 +08:00
|
|
|
|
return true;
|
2020-12-02 20:18:12 +08:00
|
|
|
|
}
|
2020-12-03 14:34:27 +08:00
|
|
|
|
return false;
|
2020-12-02 20:18:12 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return true 如果处理了跳转
|
|
|
|
|
*/
|
|
|
|
|
public boolean handleLinkedJump() {
|
|
|
|
|
LinkedInfo linkedInfo = LinkedModel.get().getLinkedInfo();
|
|
|
|
|
LinkedModel.get().setLinkedInfo(null);
|
|
|
|
|
|
|
|
|
|
if (linkedInfo == null || linkedInfo.getType() == null) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
LogUtil.print("linkedme跳转");
|
|
|
|
|
// 跳转
|
|
|
|
|
if (!StringUtil.isEmpty(linkedInfo.getRoomUid()) && linkedInfo.getType().equals("2")) {
|
|
|
|
|
AVRoomActivity.start(this, Long.parseLong(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);
|
|
|
|
|
} else {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
2020-04-02 10:43:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
2020-12-02 20:18:12 +08:00
|
|
|
|
|
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;
|
|
|
|
|
}
|
2020-08-24 16:14:01 +08:00
|
|
|
|
if (NimMiddleActivity.openCommunity) {
|
|
|
|
|
NimMiddleActivity.openCommunity = false;
|
2020-12-02 20:18:12 +08:00
|
|
|
|
if (NimMiddleActivity.skipType == 0) return;
|
2020-08-04 20:41:55 +08:00
|
|
|
|
new Handler().postDelayed(new Runnable() {
|
|
|
|
|
@Override
|
|
|
|
|
public void run() {
|
2020-12-02 20:18:12 +08:00
|
|
|
|
if (NimMiddleActivity.skipType == PushMessageHandler.PAYLOAD_SKIPTYPE_INVITE_FANS) {
|
|
|
|
|
AVRoomActivity.start(MainActivity.this, NimMiddleActivity.payloadUid);
|
|
|
|
|
} else if (NimMiddleActivity.skipType == PushMessageHandler.PAYLOAD_SKIPTYPE_PRIVATE_MSG) {
|
2020-08-20 15:03:53 +08:00
|
|
|
|
NimP2PMessageActivity.start(MainActivity.this, NimMiddleActivity.payloadUid + "");
|
|
|
|
|
}
|
2020-08-04 20:41:55 +08:00
|
|
|
|
}
|
|
|
|
|
}, 2000);
|
2020-08-24 16:14:01 +08:00
|
|
|
|
}
|
2020-04-07 16:41:24 +08:00
|
|
|
|
}
|
|
|
|
|
|
2020-04-02 10:43:40 +08:00
|
|
|
|
|
|
|
|
|
@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) {
|
2020-05-07 11:16:01 +08:00
|
|
|
|
switch (v.getId()) {
|
2020-04-28 15:08:58 +08:00
|
|
|
|
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);
|
2020-05-07 11:16:01 +08:00
|
|
|
|
} else {
|
2020-04-28 15:08:58 +08:00
|
|
|
|
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-05-08 16:24:31 +08:00
|
|
|
|
|
2020-04-02 10:43:40 +08:00
|
|
|
|
}
|