|
@@ -1,6 +1,7 @@
|
|
|
package com.cooleshow.institution.stu.ui.main;
|
|
|
|
|
|
import android.Manifest;
|
|
|
+import android.content.Intent;
|
|
|
import android.os.Bundle;
|
|
|
import android.text.TextUtils;
|
|
|
import android.view.KeyEvent;
|
|
@@ -8,13 +9,17 @@ import android.view.View;
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
import com.alibaba.android.arouter.facade.annotation.Route;
|
|
|
+import com.cooleshow.base.bean.RouteBean;
|
|
|
import com.cooleshow.base.common.BaseApplication;
|
|
|
+import com.cooleshow.base.constanst.Constants;
|
|
|
import com.cooleshow.base.constanst.LoginStatusConstants;
|
|
|
import com.cooleshow.base.constanst.StyleConfig;
|
|
|
import com.cooleshow.base.event.LoginStatusEvent;
|
|
|
import com.cooleshow.base.router.RouterPath;
|
|
|
import com.cooleshow.base.ui.activity.BaseActivity;
|
|
|
import com.cooleshow.base.ui.activity.BaseMVPActivity;
|
|
|
+import com.cooleshow.base.utils.GsonUtils;
|
|
|
+import com.cooleshow.base.utils.JumpUtils;
|
|
|
import com.cooleshow.base.utils.LogUtils;
|
|
|
import com.cooleshow.base.utils.ToastUtil;
|
|
|
import com.cooleshow.base.utils.helper.MidiFileHelper;
|
|
@@ -46,6 +51,8 @@ import androidx.annotation.Nullable;
|
|
|
import androidx.fragment.app.Fragment;
|
|
|
import cn.jpush.android.api.JPushInterface;
|
|
|
|
|
|
+import static com.cooleshow.base.constanst.Constants.MAIN_PAGE_SELECT_POTION_KEY;
|
|
|
+
|
|
|
/**
|
|
|
* Author by pq, Date on 2023/9/11.
|
|
|
*/
|
|
@@ -72,6 +79,7 @@ public class MainActivity extends BaseMVPActivity<ActivityInstitutionMainLayoutB
|
|
|
super.onCreate(savedInstanceState);
|
|
|
QMUIStatusBarHelper.setStatusBarDarkMode(this);
|
|
|
EventBus.getDefault().register(this);
|
|
|
+ parseIntent(getIntent());
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -99,6 +107,48 @@ public class MainActivity extends BaseMVPActivity<ActivityInstitutionMainLayoutB
|
|
|
IMCenter.getInstance().addUnReadMessageObserver(mUnReadMessageObserver);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ protected void onNewIntent(Intent intent) {
|
|
|
+ super.onNewIntent(intent);
|
|
|
+ parseIntent(intent);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void parseIntent(Intent intent) {
|
|
|
+ if (intent.hasExtra(Constants.MAIN_PAGE_SELECT_POTION_KEY)) {
|
|
|
+ //跳转选中某个tab
|
|
|
+ int selectPos = intent.getIntExtra(Constants.MAIN_PAGE_SELECT_POTION_KEY, 0);
|
|
|
+ if (selectPos >= mFragments.size()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ setPositionItem(selectPos);
|
|
|
+ if (intent.hasExtra(Constants.MAIN_PAGE_SELECT_CHILD_POTION_KEY)) {
|
|
|
+ if (selectPos == 1) {
|
|
|
+ if (mChatFragment != null) {
|
|
|
+ int childPos = intent.getIntExtra(Constants.MAIN_PAGE_SELECT_CHILD_POTION_KEY, 0);
|
|
|
+ mChatFragment.selectPos(childPos);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return;
|
|
|
+ }
|
|
|
+// String intentResult = PushIntentParseHelper.getIntentMemoFrom(intent);
|
|
|
+// LogUtils.i("pq", "intentResult:" + intentResult);
|
|
|
+// if (!TextUtils.isEmpty(intentResult)) {
|
|
|
+// if (TextUtils.equals(intentResult, PushIntentParseHelper.RONG_PUSH_ACTION_TAG)) {
|
|
|
+// //融云推送相关
|
|
|
+// //选中聊天
|
|
|
+// setPositionItem(2);
|
|
|
+// return;
|
|
|
+// }
|
|
|
+// try {
|
|
|
+// RouteBean routeBean = GsonUtils.fromJson(intentResult, RouteBean.class);
|
|
|
+// JumpUtils.jump(routeBean);
|
|
|
+// } catch (Exception e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// }
|
|
|
+// }
|
|
|
+ }
|
|
|
+
|
|
|
private void setStyleConfig() {
|
|
|
StyleConfig.isStudentStyle = false;
|
|
|
IMThemManager.getInstance().setEmptyDrawable(getResources().getDrawable(R.drawable.jg_icon_empty_content));
|
|
@@ -115,6 +165,18 @@ public class MainActivity extends BaseMVPActivity<ActivityInstitutionMainLayoutB
|
|
|
IMThemManager.getInstance().setAddPicDefaultImgRes(R.drawable.jg_tc_ic_update_photo);
|
|
|
}
|
|
|
|
|
|
+ public void setPositionItem(int position) {
|
|
|
+ if (position == 0) {
|
|
|
+ onTabClick(viewBinding.viewHome);
|
|
|
+ }
|
|
|
+ if (position == 1) {
|
|
|
+ onTabClick(viewBinding.viewChat);
|
|
|
+ }
|
|
|
+ if (position == 2) {
|
|
|
+ onTabClick(viewBinding.viewMine);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public void onTabClick(View view) {
|
|
|
int id = view.getId();
|
|
|
if (id == R.id.view_home) {
|