1:羽声新版本
This commit is contained in:
@@ -36,7 +36,7 @@ android {
|
||||
enabled = true
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = '17'
|
||||
jvmTarget = '11'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,5 +60,7 @@ dependencies {
|
||||
implementation (libs.arouter.api.v150)
|
||||
//annotationProcessor
|
||||
annotationProcessor libs.arouter.compiler
|
||||
implementation libs.permissionx
|
||||
|
||||
}
|
||||
apply plugin: 'com.alibaba.arouter' // ⚠️ 添加这一行
|
||||
@@ -1,18 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
>
|
||||
<!-- 前台定位权限 -->
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> <!-- 后台定位权限(Android 10+) -->
|
||||
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>
|
||||
|
||||
<application>
|
||||
|
||||
<activity
|
||||
android:name=".activity.MainActivity"
|
||||
android:launchMode="singleTask"
|
||||
android:exported="true"
|
||||
/>
|
||||
android:name=".activity.MainActivity"
|
||||
android:configChanges="fontScale"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait">
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.xscm.modulemain.activity;
|
||||
|
||||
import android.Manifest;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
@@ -8,25 +9,33 @@ import android.content.pm.PackageManager;
|
||||
import android.graphics.Color;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.AnimationUtils;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.blankj.utilcode.util.FragmentUtils;
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.blankj.utilcode.util.ToastUtils;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.example.modulecircle.fragment.CircleFragment;
|
||||
import com.example.modulenews.fragment.NewsFragment;
|
||||
import com.example.modulevocal.fragment.VocalRangeFragment;
|
||||
import com.example.modulevoice.fragment.VoiceFragment;
|
||||
import com.permissionx.guolindev.PermissionX;
|
||||
import com.permissionx.guolindev.callback.RequestCallback;
|
||||
import com.stx.xhb.xbanner.XBanner;
|
||||
import com.xscm.modulemain.R;
|
||||
import com.xscm.modulemain.contacts.HomeContacts;
|
||||
import com.xscm.modulemain.databinding.ActivityMainBinding;
|
||||
@@ -34,19 +43,19 @@ import com.xscm.modulemain.presenter.HomePresenter;
|
||||
import com.xscm.moduleutil.activity.BaseMvpActivity;
|
||||
import com.xscm.moduleutil.adapter.AppUpdateDialog;
|
||||
import com.xscm.moduleutil.base.CommonAppContext;
|
||||
import com.xscm.moduleutil.bean.AppUpdateModel;
|
||||
import com.xscm.moduleutil.bean.FirstChargeBean;
|
||||
import com.xscm.moduleutil.bean.FirstChargeGiftBean;
|
||||
import com.xscm.moduleutil.bean.ThemeBean;
|
||||
import com.xscm.moduleutil.base.RoomManager;
|
||||
import com.xscm.moduleutil.bean.*;
|
||||
import com.xscm.moduleutil.bean.room.RoomOnline;
|
||||
import com.xscm.moduleutil.bean.room.RoomOnlineBean;
|
||||
import com.xscm.moduleutil.dialog.FirstChargeDialog;
|
||||
import com.xscm.moduleutil.dialog.HeavenGiftDialog;
|
||||
import com.xscm.moduleutil.dialog.NewPeopleDialog;
|
||||
import com.xscm.moduleutil.dialog.RechargeDialogFragment;
|
||||
import com.xscm.moduleutil.event.RoomOutEvent;
|
||||
import com.xscm.moduleutil.event.UnreadCountEvent;
|
||||
import com.xscm.moduleutil.utils.ARouteConstants;
|
||||
import com.xscm.moduleutil.utils.BackgroundManager;
|
||||
import com.xscm.moduleutil.utils.ColorManager;
|
||||
import com.xscm.moduleutil.utils.ImageLoader;
|
||||
import com.xscm.moduleutil.utils.SpUtil;
|
||||
import com.xscm.moduleutil.utils.*;
|
||||
import com.xscm.moduleutil.utils.location.LocationProvider;
|
||||
import com.xscm.moduleutil.utils.location.SystemLocationProvider;
|
||||
import com.xscm.moduleutil.utils.logger.Logger;
|
||||
import com.tencent.imsdk.v2.V2TIMManager;
|
||||
import com.tencent.imsdk.v2.V2TIMValueCallback;
|
||||
@@ -55,11 +64,14 @@ import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Route(path = ARouteConstants.ME)
|
||||
public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBinding> implements HomeContacts.View, View.OnClickListener {
|
||||
public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBinding>
|
||||
implements HomeContacts.View, View.OnClickListener, LocationProvider.LocationCallback {
|
||||
private static int index = -1;
|
||||
|
||||
public static boolean isShortsShowing() {
|
||||
@@ -92,13 +104,50 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
||||
return R.layout.activity_main;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
index = -1;
|
||||
// ServiceUtils.startService(EMqttService.class);
|
||||
checkTab(getIntent().getIntExtra("tab", -1));
|
||||
|
||||
|
||||
if (getOnBackPressedDispatcher() != null) {
|
||||
getOnBackPressedDispatcher().addCallback(this, new androidx.activity.OnBackPressedCallback(true) {
|
||||
@Override
|
||||
public void handleOnBackPressed() {
|
||||
// 拦截返回键,显示退出对话框而不是直接退出
|
||||
// 检查是否有正在播放的房间
|
||||
if (CommonAppContext.getInstance().isPlaying) {
|
||||
// 如果有正在播放的房间,直接退出应用
|
||||
// finish();
|
||||
// android.os.Process.killProcess(android.os.Process.myPid());
|
||||
// System.exit(0);
|
||||
// exitApp();
|
||||
|
||||
clearAllOtherTasksAndRestart();
|
||||
return;
|
||||
}
|
||||
|
||||
// 如果没有正在播放的房间,使用原来的逻辑
|
||||
if (!isExit) {
|
||||
isExit = true;
|
||||
ToastUtils.showShort("再按一次退出应用");
|
||||
// 延迟2秒重置标记
|
||||
mHandler.postDelayed(() -> isExit = false, 2000);
|
||||
} else {
|
||||
exitApp();
|
||||
// 退出应用
|
||||
// finishAll();
|
||||
// android.os.Process.killProcess(android.os.Process.myPid());
|
||||
// System.exit(0);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
MvpPre.getThemeData();
|
||||
@@ -113,8 +162,28 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
||||
MvpPre.initData();
|
||||
MvpPre.userFiles();
|
||||
|
||||
V2TIMManager.getConversationManager().getTotalUnreadMessageCount(new V2TIMValueCallback<Long>() {
|
||||
@Override
|
||||
public void onSuccess(Long aLong) {
|
||||
if (aLong == 0) {
|
||||
mBinding.tvMessage.setVisibility(View.GONE);
|
||||
mBinding.tvMessage.setText("0");
|
||||
} else {
|
||||
mBinding.tvMessage.setVisibility(View.VISIBLE);
|
||||
}
|
||||
mBinding.tvMessage.setText(String.valueOf(aLong));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
@@ -138,6 +207,22 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
// 处理新的intent
|
||||
setIntent(intent);
|
||||
|
||||
// 检查是否需要跳转到房间
|
||||
// if (shouldRestoreRoom()) {
|
||||
// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS)
|
||||
// .withString("form", "首页")
|
||||
// .withString("roomId", CommonAppContext.getInstance().playId)
|
||||
// .withFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP)
|
||||
// .navigation();
|
||||
//
|
||||
//// RoomManager.instance( CommonAppContext.getInstance()).joinRoomWithRoomId(CommonAppContext.getInstance().playId, true);
|
||||
// return;
|
||||
// }
|
||||
|
||||
// 处理tab切换
|
||||
checkTab(intent.getIntExtra("tab", -1));
|
||||
}
|
||||
|
||||
@@ -147,6 +232,82 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isExit = false; // 标记是否准备退出
|
||||
private Handler mHandler = new Handler();
|
||||
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
LogUtils.d("MainActivity", "onKeyDown called, keyCode: " + keyCode);
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||
// 检查是否有正在播放的房间
|
||||
if (CommonAppContext.getInstance().isPlaying) {
|
||||
// 如果有正在播放的房间,直接退出应用
|
||||
// finish();
|
||||
// android.os.Process.killProcess(android.os.Process.myPid());
|
||||
// System.exit(0);
|
||||
// exitApp();
|
||||
clearAllOtherTasksAndRestart();
|
||||
return true;
|
||||
}
|
||||
|
||||
// 如果没有正在播放的房间,使用原来的逻辑
|
||||
if (!isExit) {
|
||||
isExit = true;
|
||||
ToastUtils.showShort("再按一次退出应用");
|
||||
// 延迟2秒重置标记
|
||||
mHandler.postDelayed(() -> isExit = false, 2000);
|
||||
} else {
|
||||
// 退出应用
|
||||
exitApp();
|
||||
|
||||
}
|
||||
return true; // 消费事件
|
||||
}
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
|
||||
// 最推荐的方法
|
||||
private void clearAllOtherTasksAndRestart() {
|
||||
// Intent intent = new Intent(this, MainActivity.class);
|
||||
// intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
// intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
// intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
|
||||
// startActivity(intent);
|
||||
|
||||
// 可选:finish当前Activity
|
||||
// if (!isFinishing()) {
|
||||
// finish();
|
||||
// }
|
||||
|
||||
// 可选:如果上面的方法不够彻底,可以配合使用
|
||||
Runtime.getRuntime().gc(); // 建议垃圾回收
|
||||
}
|
||||
|
||||
/**
|
||||
* 优雅地退出应用,避免闪屏
|
||||
*/
|
||||
private void exitApp() {
|
||||
// 清理资源
|
||||
if (appUpdateDialog != null && appUpdateDialog.isShowing()) {
|
||||
appUpdateDialog.dismiss();
|
||||
appUpdateDialog = null;
|
||||
}
|
||||
|
||||
// 移除所有回调
|
||||
if (mHandler != null) {
|
||||
mHandler.removeCallbacksAndMessages(null);
|
||||
}
|
||||
|
||||
// 关闭所有Activity
|
||||
finishAffinity();
|
||||
|
||||
// 延迟杀死进程,确保界面完全关闭
|
||||
new Handler().postDelayed(() -> {
|
||||
android.os.Process.killProcess(android.os.Process.myPid());
|
||||
System.exit(0);
|
||||
}, 100);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
super.initView();
|
||||
@@ -158,7 +319,8 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
||||
mBinding.rlMe.setOnClickListener(this);
|
||||
mBinding.ivGuanbi.setOnClickListener(this);
|
||||
mBinding.riv.setOnClickListener(this);
|
||||
mBinding.ivShouchl.setOnClickListener(this);
|
||||
// mBinding.ivShouchl.setOnClickListener( this);
|
||||
requestGpsPermissions();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -166,11 +328,12 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
||||
// 初始化显示派对Tab
|
||||
reset();
|
||||
mBinding.rlMedia.setSelected(true);
|
||||
mBinding.llBottomBar.setBackgroundResource(com.xscm.moduleutil.R.drawable.home_bbar_xz);
|
||||
FragmentUtils.showHide(0, fragments);
|
||||
index = 0;
|
||||
isMediaSelected = true; // 确保设置为选中状态
|
||||
selectedTextColor = ColorManager.getInstance().getPrimaryColorInt();
|
||||
unselectedTextColor =Color.parseColor("#000000");
|
||||
unselectedTextColor = Color.parseColor("#6D6D6D");
|
||||
updateAllTabUI(); // 这会同时更新图标和文字颜色
|
||||
}
|
||||
|
||||
@@ -193,12 +356,19 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
||||
public void onClick(View view) {
|
||||
int id = view.getId();
|
||||
if (id == R.id.rl_media) {
|
||||
mBinding.llBottomBar.setBackgroundResource(com.xscm.moduleutil.R.drawable.home_bbar_xz);
|
||||
selectShow(0);
|
||||
} else if (id == R.id.rl_trend) {
|
||||
mBinding.llBottomBar.setBackgroundResource(com.xscm.moduleutil.R.drawable.home_bbar_yuan);
|
||||
|
||||
selectShow(1);
|
||||
} else if (id == R.id.rl_news) {
|
||||
mBinding.llBottomBar.setBackgroundResource(com.xscm.moduleutil.R.drawable.home_bbar_yuan);
|
||||
|
||||
selectShow(2);
|
||||
} else if (id == R.id.rl_me) {
|
||||
mBinding.llBottomBar.setBackgroundResource(com.xscm.moduleutil.R.drawable.home_bbar_yuan);
|
||||
|
||||
selectShow(3);
|
||||
//C0101我的界面
|
||||
// AppLogUtil.reportAppLog(AppLogEvent.C0101);
|
||||
@@ -206,53 +376,69 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
||||
mBinding.ll.setVisibility(View.INVISIBLE);
|
||||
CommonAppContext.getInstance().isShow = false;
|
||||
CommonAppContext.getInstance().isPlaying = false;
|
||||
// if (RoomActivity.sDestroied) {
|
||||
// MvpPre.quitRoom(CommonAppContext.getInstance().playId);
|
||||
// } else {
|
||||
CommonAppContext.getInstance().isRoomJoininj = false;
|
||||
EventBus.getDefault().post(new RoomOutEvent());
|
||||
// }
|
||||
} else if (id == R.id.riv) {
|
||||
String roomId = CommonAppContext.getInstance().playId;
|
||||
if (!TextUtils.isEmpty(roomId)) {
|
||||
ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("form", "首页").withString("roomId", roomId).navigation();
|
||||
RoomManager.getInstance().fetchRoomDataAndEnter(this, CommonAppContext.getInstance().playId, "");
|
||||
|
||||
// MvpPre.getRoomOnline(roomId, "1", "100");
|
||||
// AppStateManager stateManager = AppStateManager.getInstance();
|
||||
// if (stateManager.isRoomActivityActive()) {
|
||||
// // RoomActivity可用,直接回到该Activity
|
||||
// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT).withString("form", "首页").withString("roomId", roomId).navigation();
|
||||
//
|
||||
// } else {
|
||||
// RoomActivity不可用,重新创建
|
||||
// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("form", "首页").withString("roomId", roomId).navigation();
|
||||
|
||||
// }
|
||||
}
|
||||
} else if (id == R.id.iv_shouchl) {//首充
|
||||
FirstChargeDialog firstChargeDialog = new FirstChargeDialog(this);
|
||||
firstChargeDialog.show();
|
||||
firstChargeDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss(DialogInterface dialog) {
|
||||
//首充弹窗关闭后,弹首充
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
firstChargeDialog.setOnFirstChargeListener(new FirstChargeDialog.OnFirstChargeListener() {
|
||||
@Override
|
||||
public void onFirstChargeConfirmed(FirstChargeGiftBean giftBean, int type) {
|
||||
String s = null;
|
||||
if (type == 1) {
|
||||
s = giftBean.getGift_bag().get(0).getMoney();
|
||||
|
||||
} else if (type == 2) {
|
||||
s = giftBean.getGift_bag().get(1).getMoney();
|
||||
} else if (type == 3) {
|
||||
s = giftBean.getGift_bag().get(2).getMoney();
|
||||
}
|
||||
if (s == null) {
|
||||
ToastUtils.showShort("暂无礼物");
|
||||
return;
|
||||
}
|
||||
|
||||
RechargeDialogFragment.show(null, s, getSupportFragmentManager());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFirstChargeCancelled() {
|
||||
|
||||
}
|
||||
});
|
||||
// String roomId = CommonAppContext.getInstance().playId;
|
||||
// if (!TextUtils.isEmpty(roomId)) {
|
||||
//// RoomManager.instance( CommonAppContext.getInstance()).joinRoomWithRoomId(roomId, true);
|
||||
// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("form", "首页").withString("roomId", roomId).navigation();
|
||||
// }
|
||||
}
|
||||
// else if (id == R.id.iv_shouchl) {//首充
|
||||
// FirstChargeDialog firstChargeDialog = new FirstChargeDialog(this);
|
||||
// firstChargeDialog.show();
|
||||
// firstChargeDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
|
||||
// @Override
|
||||
// public void onDismiss(DialogInterface dialog) {
|
||||
// //首充弹窗关闭后,弹首充
|
||||
// dialog.dismiss();
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// firstChargeDialog.setOnFirstChargeListener(new FirstChargeDialog.OnFirstChargeListener() {
|
||||
// @Override
|
||||
// public void onFirstChargeConfirmed(FirstChargeGiftBean giftBean, int type) {
|
||||
// String s = null;
|
||||
// if (type == 1) {
|
||||
// s = giftBean.getGift_bag().get(0).getMoney();
|
||||
//
|
||||
// } else if (type == 2) {
|
||||
// s = giftBean.getGift_bag().get(1).getMoney();
|
||||
// } else if (type == 3) {
|
||||
// s = giftBean.getGift_bag().get(2).getMoney();
|
||||
// }
|
||||
// if (s == null) {
|
||||
// ToastUtils.showShort("暂无礼物");
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// RechargeDialogFragment.show(null, s, getSupportFragmentManager());
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onFirstChargeCancelled() {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -320,7 +506,7 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
||||
.load(imageUrl)
|
||||
.placeholder(com.xscm.moduleutil.R.mipmap.tab_main_media_unselected) // 默认图标
|
||||
.into(mBinding.imSy);
|
||||
}else {
|
||||
} else {
|
||||
// 如果没有网络图标,使用默认的选中/未选中状态
|
||||
int resId = (index == 0) ?
|
||||
com.xscm.moduleutil.R.mipmap.tab_main_media_selected :
|
||||
@@ -329,9 +515,31 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private boolean shouldRestoreRoom() {
|
||||
// 检查是否应该恢复房间:
|
||||
// 1. 应用有正在播放的房间
|
||||
// 2. 应用应该显示房间
|
||||
// 3. 应用是从后台恢复的(通过检查 CommonAppContext 状态)
|
||||
return CommonAppContext.getInstance().isPlaying
|
||||
&& CommonAppContext.getInstance().isShow;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
// 修改判断条件:不仅检查 isTaskRoot,还要检查是否是从后台恢复
|
||||
// if (shouldRestoreRoom()) {
|
||||
// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS)
|
||||
// .withString("form", "首页")
|
||||
// .withString("roomId", CommonAppContext.getInstance().playId)
|
||||
// .withFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
// .navigation();
|
||||
//// RoomManager.instance( CommonAppContext.getInstance()).joinRoomWithRoomId(CommonAppContext.getInstance().playId, true);
|
||||
// return;
|
||||
// }
|
||||
CommonAppContext.getInstance().upMqtt();
|
||||
MvpPre.loginIm();
|
||||
Logger.i("MainActivity", "onResume");
|
||||
// Beta.checkAppUpgrade(false, false);
|
||||
@@ -346,41 +554,63 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
||||
} else {
|
||||
mBinding.ll.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
if (CommonAppContext.getInstance().isPlaying && CommonAppContext.getInstance().isShow) {
|
||||
ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("form", "首页").withString("roomId", CommonAppContext.getInstance().playId).navigation();
|
||||
}
|
||||
|
||||
V2TIMManager.getConversationManager().getTotalUnreadMessageCount(new V2TIMValueCallback<Long>() {
|
||||
@Override
|
||||
public void onSuccess(Long aLong) {
|
||||
if (aLong == 0) {
|
||||
mBinding.tvMessage.setVisibility(View.GONE);
|
||||
mBinding.tvMessage.setText("0");
|
||||
} else {
|
||||
mBinding.tvMessage.setVisibility(View.VISIBLE);
|
||||
}
|
||||
mBinding.tvMessage.setText(String.valueOf(aLong));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
// MvpPre.getMyInfo(SpUtil.getUserId() + "");//获取首充是否需要展示
|
||||
|
||||
}
|
||||
});
|
||||
MvpPre.activitiesPermission();//获取悬浮框权限
|
||||
|
||||
MvpPre.getMyInfo(SpUtil.getUserId() + "");//获取首充是否需要展示
|
||||
}
|
||||
|
||||
// mBinding.ivShouchl.setVisibility(View.VISIBLE);
|
||||
private void requestGpsPermissions() {
|
||||
PermissionX.init(this)
|
||||
// 请求精确位置权限(包含GPS定位能力)
|
||||
.permissions(
|
||||
Manifest.permission.ACCESS_FINE_LOCATION
|
||||
)
|
||||
// 权限请求结果回调
|
||||
.request(new RequestCallback() {
|
||||
@Override
|
||||
public void onResult(boolean allGranted, List<String> grantedList, List<String> deniedList) {
|
||||
if (allGranted) {
|
||||
// Toast.makeText(MainActivity.this, "GPS权限已授予,可开始定位", Toast.LENGTH_SHORT).show();
|
||||
initLocation(); // 启动GPS定位逻辑
|
||||
} else {
|
||||
Toast.makeText(MainActivity.this, "GPS权限被拒绝,无法使用定位功能", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onEvent(UnreadCountEvent event) {
|
||||
if (event.getALong() == 0) {
|
||||
long aLong = event.getALong();
|
||||
long bLong = event.getBLong();
|
||||
if (aLong == 0 && bLong == 0) {
|
||||
mBinding.tvMessage.setVisibility(View.GONE);
|
||||
mBinding.tvMessage.setText("0");
|
||||
} else if (event.getALong() > 0) {
|
||||
mBinding.tvMessage.setText(String.valueOf(event.getALong()));
|
||||
} else {
|
||||
mBinding.tvMessage.setVisibility(View.VISIBLE);
|
||||
mBinding.tvMessage.setText(String.valueOf(event.getALong() + event.getBLong()));
|
||||
}
|
||||
|
||||
// if (event.getALong() == 0) {
|
||||
// if (event.getBLong()==0){
|
||||
// mBinding.tvMessage.setVisibility(View.GONE);
|
||||
// }else {
|
||||
// mBinding.tvMessage.setVisibility(View.VISIBLE);
|
||||
// mBinding.tvMessage.setText(String.valueOf(event.getBLong()));
|
||||
// }
|
||||
//// mBinding.tvMessage.setVisibility(View.GONE);
|
||||
//// mBinding.tvMessage.setText("0");
|
||||
// } else if (event.getALong() > 0) {
|
||||
// mBinding.tvMessage.setVisibility(View.VISIBLE);
|
||||
// if (event.getBLong()==0){
|
||||
// mBinding.tvMessage.setText(String.valueOf(event.getALong()));
|
||||
// }else {
|
||||
// mBinding.tvMessage.setText(String.valueOf(event.getALong()+event.getBLong()));
|
||||
// }
|
||||
//
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -388,12 +618,14 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
||||
super.onStop();
|
||||
// mBinding.riv.removeCallbacks(mRivAnimationTask);
|
||||
// mBinding.riv.clearAnimation();
|
||||
CommonAppContext.getInstance().onAppBackground();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
// LogUtils.d(BaseApplication.getInstance().getToken());
|
||||
CommonAppContext.getInstance().onAppForeground();
|
||||
}
|
||||
|
||||
private final Runnable mRivAnimationTask = () -> {
|
||||
@@ -420,6 +652,25 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private String city1;
|
||||
|
||||
@Override
|
||||
public void onLocationReceived(double latitude, double longitude, String city) {
|
||||
LogUtils.e("当前位置:" + city);
|
||||
city1 = city;
|
||||
EventBus.getDefault().post(city1);
|
||||
LogUtils.e("@@@1", "开始定位", "描述:", "当前位置" + city);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(String errorMessage) {
|
||||
|
||||
LogUtils.e("@@@1", "开始定位", "描述:", "失败");
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static int getCurrentVersionCode(Context context) {
|
||||
try {
|
||||
PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
|
||||
@@ -463,20 +714,20 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
||||
|
||||
@Override
|
||||
public void myInfoSuccess(FirstChargeBean data) {
|
||||
if (data != null) {
|
||||
if (data.getPermission() == 1) {
|
||||
mBinding.ivShouchl.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mBinding.ivShouchl.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
// if (data != null) {
|
||||
// if (data.getPermission() == 1) {
|
||||
// mBinding.ivShouchl.setVisibility(View.VISIBLE);
|
||||
// } else {
|
||||
// mBinding.ivShouchl.setVisibility(View.GONE);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getThemeData(ThemeBean themeBean) {
|
||||
if (themeBean != null){
|
||||
selectedMediaUrl=themeBean.getHome_sel();
|
||||
unselectedMediaUrl=themeBean.getHome_nor();
|
||||
if (themeBean != null) {
|
||||
selectedMediaUrl = themeBean.getHome_sel();
|
||||
unselectedMediaUrl = themeBean.getHome_nor();
|
||||
|
||||
// 语圈 tab 图标
|
||||
selectedTrendUrl = themeBean.getFind_sel();
|
||||
@@ -494,18 +745,18 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
||||
if (themeBean.getBtn_text_color() != null && !themeBean.getBtn_text_color().isEmpty()) {
|
||||
selectedTextColor = Color.parseColor(themeBean.getBtn_text_color());
|
||||
}
|
||||
unselectedTextColor = Color.parseColor("#000000");
|
||||
unselectedTextColor = Color.parseColor("#6D6D6D");
|
||||
} catch (Exception e) {
|
||||
// 使用默认颜色
|
||||
selectedTextColor = ColorManager.getInstance().getPrimaryColorInt();
|
||||
unselectedTextColor =Color.parseColor("#000000");
|
||||
unselectedTextColor = Color.parseColor("#6D6D6D");
|
||||
}
|
||||
Map<String, String> colorMap = new HashMap<>();
|
||||
colorMap.put("theme_color", themeBean.getTheme_color());
|
||||
colorMap.put("btn_text_color", themeBean.getBtn_text_color());
|
||||
// 更新 UI
|
||||
updateAllTabUI();
|
||||
if (themeBean.getApp_bg()!=null) {
|
||||
if (themeBean.getApp_bg() != null) {
|
||||
BackgroundManager.getInstance().setBackgroundUrl(themeBean.getApp_bg());
|
||||
loadNetworkBackground();
|
||||
}
|
||||
@@ -513,6 +764,216 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getRoomOnline(RoomOnline onlineBean) {
|
||||
if (onlineBean != null) {
|
||||
List<RoomOnlineBean> onlineBeans = onlineBean.getOff_pit();
|
||||
List<RoomOnlineBean> onlineList = onlineBean.getOn_pit();
|
||||
boolean isPlaying = false;
|
||||
if (onlineBeans != null) {
|
||||
for (RoomOnlineBean onlineBean1 : onlineBeans) {
|
||||
if (onlineBean1.getUser_id() == SpUtil.getUserId()) {
|
||||
// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("form", "首页").withString("roomId", CommonAppContext.getInstance().playId).navigation();
|
||||
isPlaying = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (onlineList != null) {
|
||||
for (RoomOnlineBean onlineBean1 : onlineList) {
|
||||
if (onlineBean1.getUser_id() == SpUtil.getUserId()) {
|
||||
// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("form", "首页").withString("roomId", CommonAppContext.getInstance().playId).navigation();
|
||||
isPlaying = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!isPlaying) {
|
||||
RoomManager.getInstance().fetchRoomDataAndEnter(this, CommonAppContext.getInstance().playId, "");
|
||||
// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP).withString("form", "首页").withString("roomId", CommonAppContext.getInstance().playId).navigation();
|
||||
|
||||
} else {
|
||||
// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("form", "首页").withString("roomId", CommonAppContext.getInstance().playId).navigation();
|
||||
RoomManager.getInstance().fetchRoomDataAndEnter(this, CommonAppContext.getInstance().playId, "");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activitiesPermissionSuccess(ActivitiesPermission activitiesPermission) {
|
||||
List<PermissionPicBean> list;
|
||||
if (activitiesPermission != null) {
|
||||
list = new ArrayList<>();
|
||||
if (activitiesPermission.getFirst_charge_permission() == 1) {
|
||||
PermissionPicBean bean = new PermissionPicBean();
|
||||
bean.setPicId(com.xscm.moduleutil.R.mipmap.shouchl);
|
||||
bean.setType(1);
|
||||
list.add(bean);
|
||||
// list.add(ResourcesCompat.getDrawable(getResources(), com.xscm.moduleutil.R.mipmap.shouchl, null));
|
||||
}
|
||||
|
||||
if (activitiesPermission.getDay_drop_permission() == 1) {
|
||||
PermissionPicBean bean = new PermissionPicBean();
|
||||
bean.setPicId(com.xscm.moduleutil.R.mipmap.tianjhl);
|
||||
bean.setType(2);
|
||||
list.add(bean);
|
||||
// list.add(ResourcesCompat.getDrawable(getResources(), com.xscm.moduleutil.R.mipmap.tianjhl, null));
|
||||
}
|
||||
|
||||
if (activitiesPermission.getN_people_permission() == 1) {
|
||||
PermissionPicBean bean = new PermissionPicBean();
|
||||
bean.setPicId(com.xscm.moduleutil.R.mipmap.xinrhl);
|
||||
bean.setType(3);
|
||||
list.add(bean);
|
||||
// list.add(ResourcesCompat.getDrawable(getResources(), com.xscm.moduleutil.R.mipmap.xinrhl, null));
|
||||
}
|
||||
|
||||
mBinding.banner.setBannerData(list);
|
||||
|
||||
mBinding.banner.loadImage(new XBanner.XBannerAdapter() {
|
||||
|
||||
@Override
|
||||
public void loadBanner(XBanner banner, Object model, View view, int position) {
|
||||
PermissionPicBean permissionPicBean = (PermissionPicBean) model;
|
||||
ImageView imageView = (ImageView) view;
|
||||
imageView.setImageResource(permissionPicBean.getPicId());
|
||||
}
|
||||
});
|
||||
mBinding.banner.setOnItemClickListener(new XBanner.OnItemClickListener() {
|
||||
|
||||
@Override
|
||||
public void onItemClick(XBanner banner, Object model, View view, int position) {
|
||||
PermissionPicBean bannerModel = (PermissionPicBean) model;
|
||||
if (bannerModel.getType() == 1) {//首充
|
||||
firstCharge();
|
||||
} else if (bannerModel.getType() == 2) {//天降
|
||||
heavenGiftDialog();
|
||||
} else if (bannerModel.getType() == 3) {//新人
|
||||
newPeople();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TODO: 2025/10/12 天降好礼
|
||||
private void heavenGiftDialog() {
|
||||
HeavenGiftDialog heavenGiftDialog = new HeavenGiftDialog(this);
|
||||
heavenGiftDialog.show();
|
||||
heavenGiftDialog.setOnFirstChargeListener(new HeavenGiftDialog.OnFirstChargeListener() {
|
||||
@Override
|
||||
public void onFirstChargeConfirmed(HeavenGiftBean giftBean, int type) {
|
||||
String giftId = "";
|
||||
String money = "";
|
||||
if (giftBean.getGift_list().size() != 0) {
|
||||
giftId = giftBean.getGift_bag_id() + "";
|
||||
money = giftBean.getMoney();
|
||||
}
|
||||
|
||||
RechargeDialogFragment.show(null, money, getSupportFragmentManager(), giftId, type + "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFirstChargeCancelled() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// TODO: 2025/10/12 新人好礼
|
||||
private void newPeople() {
|
||||
NewPeopleDialog newPeopleDialog = new NewPeopleDialog(this);
|
||||
newPeopleDialog.show();
|
||||
newPeopleDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss(DialogInterface dialog) {
|
||||
//新人弹窗关闭后,弹首充
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
newPeopleDialog.setOnFirstChargeListener(new NewPeopleDialog.OnFirstChargeListener() {
|
||||
@Override
|
||||
public void onFirstChargeConfirmed(FirstChargeGiftBean giftBean, int type) {
|
||||
// 初始化默认值
|
||||
String money = "";
|
||||
String giftBagId = "";
|
||||
List<FirstChargeGiftBean.GiftBag> giftBags = giftBean != null ? giftBean.getGift_bag() : null;
|
||||
|
||||
// 校验数据有效性
|
||||
if (giftBags == null || giftBags.isEmpty()) {
|
||||
ToastUtils.showShort("暂无礼物");
|
||||
return;
|
||||
}
|
||||
|
||||
// 计算索引(type从1开始对应索引0)
|
||||
int index = type - 1;
|
||||
|
||||
// 索引安全校验 + 数据获取
|
||||
if (index >= 0 && index < giftBags.size()) {
|
||||
FirstChargeGiftBean.GiftBag currentGift = giftBags.get(index);
|
||||
money = currentGift.getMoney();
|
||||
giftBagId = currentGift.getGift_bag_id();
|
||||
}
|
||||
|
||||
// 最终数据校验
|
||||
if (money == null) {
|
||||
ToastUtils.showShort("暂无礼物");
|
||||
return;
|
||||
}
|
||||
|
||||
// 显示对话框
|
||||
RechargeDialogFragment.show(null, money, getSupportFragmentManager(), giftBagId, "3");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFirstChargeCancelled() {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
// TODO: 2025/10/12 首充好礼
|
||||
private void firstCharge() {
|
||||
FirstChargeDialog firstChargeDialog = new FirstChargeDialog(this);
|
||||
firstChargeDialog.show();
|
||||
firstChargeDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss(DialogInterface dialog) {
|
||||
//首充弹窗关闭后,弹首充
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
firstChargeDialog.setOnFirstChargeListener(new FirstChargeDialog.OnFirstChargeListener() {
|
||||
@Override
|
||||
public void onFirstChargeConfirmed(FirstChargeGiftBean giftBean, int type) {
|
||||
String s = "";
|
||||
String gift_bag_id = "";
|
||||
if (giftBean.getGift_bag().size() != 0) {
|
||||
gift_bag_id = giftBean.getGift_bag().get(0).getGift_bag_id();
|
||||
s = giftBean.getGift_bag().get(0).getMoney();
|
||||
}
|
||||
if (s == null) {
|
||||
ToastUtils.showShort("暂无礼物");
|
||||
return;
|
||||
}
|
||||
|
||||
RechargeDialogFragment.show(null, s, getSupportFragmentManager(), gift_bag_id, "1");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFirstChargeCancelled() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void updateAllTabUI() {
|
||||
index = 0;
|
||||
// 更新图标
|
||||
@@ -604,10 +1065,35 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
||||
}
|
||||
|
||||
|
||||
|
||||
// @Override
|
||||
// @Override
|
||||
// protected void onPause() {
|
||||
// super.onPause();
|
||||
// moveTaskToBack(true);
|
||||
// }
|
||||
private SystemLocationProvider locationProvider;
|
||||
|
||||
private void initLocation() {
|
||||
// 在Activity或Fragment中调用
|
||||
|
||||
|
||||
locationProvider = new SystemLocationProvider();
|
||||
|
||||
// 请求一次性的位置信息
|
||||
locationProvider.getLastKnownLocation(this, this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
if (requestCode == 1001) {
|
||||
if (locationProvider == null) {
|
||||
locationProvider = new SystemLocationProvider();
|
||||
}
|
||||
locationProvider.getLastKnownLocation(this, this);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,9 +4,10 @@ import android.app.Activity;
|
||||
|
||||
import com.xscm.moduleutil.activity.IPresenter;
|
||||
import com.xscm.moduleutil.activity.IView;
|
||||
import com.xscm.moduleutil.bean.AppUpdateModel;
|
||||
import com.xscm.moduleutil.bean.FirstChargeBean;
|
||||
import com.xscm.moduleutil.bean.ThemeBean;
|
||||
import com.xscm.moduleutil.bean.*;
|
||||
import com.xscm.moduleutil.bean.room.RoomOnline;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public final class HomeContacts {
|
||||
@@ -27,6 +28,11 @@ public final class HomeContacts {
|
||||
void myInfoSuccess(FirstChargeBean data);
|
||||
|
||||
void getThemeData(ThemeBean themeBean);
|
||||
|
||||
void getRoomOnline(RoomOnline onlineBean);
|
||||
|
||||
void activitiesPermissionSuccess(ActivitiesPermission activitiesPermission);
|
||||
|
||||
}
|
||||
|
||||
public interface IHomePre extends IPresenter {
|
||||
@@ -52,5 +58,9 @@ public final class HomeContacts {
|
||||
|
||||
void getThemeData();//主题接口
|
||||
|
||||
void getRoomOnline(String roomId, String page, String page_limit);//在线列表
|
||||
|
||||
void activitiesPermission();//活动弹框权限
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,19 +12,20 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
import com.xscm.modulemain.contacts.HomeContacts;
|
||||
import com.xscm.moduleutil.bean.AppUpdateModel;
|
||||
import com.xscm.moduleutil.bean.FirstChargeBean;
|
||||
import com.xscm.moduleutil.bean.ThemeBean;
|
||||
import com.xscm.moduleutil.bean.UserBean;
|
||||
import com.xscm.moduleutil.bean.*;
|
||||
import com.xscm.moduleutil.bean.room.RoomOnline;
|
||||
import com.xscm.moduleutil.http.BaseObserver;
|
||||
import com.xscm.moduleutil.presenter.BasePresenter;
|
||||
import com.xscm.moduleutil.utils.GsonUtils;
|
||||
import com.xscm.moduleutil.utils.SpUtil;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class HomePresenter extends BasePresenter<HomeContacts.View> implements HomeContacts.IHomePre {
|
||||
|
||||
@@ -370,8 +371,49 @@ public class HomePresenter extends BasePresenter<HomeContacts.View> implements H
|
||||
|
||||
@Override
|
||||
public void onNext(ThemeBean themeBean) {
|
||||
if (MvpRef==null){
|
||||
MvpRef = new WeakReference<>(mView);
|
||||
}
|
||||
MvpRef.get().getThemeData(themeBean);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getRoomOnline(String roomId, String page, String page_limit) {
|
||||
api.getRoomOnline(roomId, page, page_limit, new BaseObserver<RoomOnline>() {
|
||||
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(RoomOnline roomOnlineBeans) {
|
||||
if (MvpRef==null){
|
||||
MvpRef=new WeakReference<>(mView);
|
||||
}
|
||||
MvpRef.get().getRoomOnline(roomOnlineBeans);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activitiesPermission() {
|
||||
api.activitiesPermission(new BaseObserver<ActivitiesPermission>() {
|
||||
@Override
|
||||
public void onSubscribe(@NotNull Disposable d) {
|
||||
addDisposable( d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NotNull ActivitiesPermission activitiesPermission) {
|
||||
if (MvpRef==null){
|
||||
MvpRef=new WeakReference<>(mView);
|
||||
}
|
||||
MvpRef.get().activitiesPermissionSuccess(activitiesPermission);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,232 +1,255 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:context=".activity.MainActivity">
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:context=".activity.MainActivity">
|
||||
|
||||
<data>
|
||||
|
||||
</data>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/frame_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clipChildren="false" />
|
||||
>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_60"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="@color/transparent"
|
||||
android:clipChildren="false"
|
||||
>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_bottom_bar"
|
||||
android:id="@+id/frame_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/home_bbar_yuan"
|
||||
android:orientation="horizontal">
|
||||
android:clipChildren="false"/>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_60"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="@color/transparent"
|
||||
android:clipChildren="false"
|
||||
>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_bottom_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/home_bbar_yuan"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/rl_media"
|
||||
android:layout_width="@dimen/dp_0"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
android:id="@+id/rl_media"
|
||||
android:layout_width="@dimen/dp_0"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/im_sy"
|
||||
android:layout_width="@dimen/dp_24"
|
||||
android:layout_height="@dimen/dp_24"
|
||||
android:gravity="center_horizontal"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/main_bottom_bar_icon_media" />
|
||||
android:id="@+id/im_sy"
|
||||
android:layout_width="@dimen/dp_24"
|
||||
android:layout_height="@dimen/dp_24"
|
||||
android:gravity="center_horizontal"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/main_bottom_bar_icon_media"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_media"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
android:text="@string/main_tab1"
|
||||
android:textColor="@drawable/text_color_two"
|
||||
android:textSize="@dimen/sp_10" />
|
||||
android:id="@+id/tv_media"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
android:text="@string/main_tab1"
|
||||
android:textColor="@drawable/text_color_two"
|
||||
android:textSize="@dimen/sp_10"/>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/rl_trend"
|
||||
android:layout_width="@dimen/dp_0"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
android:id="@+id/rl_trend"
|
||||
android:layout_width="@dimen/dp_0"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/im_trend"
|
||||
android:layout_width="@dimen/dp_24"
|
||||
android:layout_height="@dimen/dp_24"
|
||||
android:gravity="center_horizontal"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/main_bottom_bar_icon_tend" />
|
||||
android:id="@+id/im_trend"
|
||||
android:layout_width="@dimen/dp_24"
|
||||
android:layout_height="@dimen/dp_24"
|
||||
android:gravity="center_horizontal"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/main_bottom_bar_icon_tend"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_trend"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
android:text="@string/main_tab2"
|
||||
android:textColor="@drawable/text_color_two"
|
||||
android:textSize="@dimen/sp_10" />
|
||||
android:id="@+id/tv_trend"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
android:text="@string/main_tab2"
|
||||
android:textColor="@drawable/text_color_two"
|
||||
android:textSize="@dimen/sp_10"/>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/rl_news"
|
||||
android:layout_width="@dimen/dp_0"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
android:id="@+id/rl_news"
|
||||
android:layout_width="@dimen/dp_0"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="-3dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_news"
|
||||
android:layout_width="@dimen/dp_24"
|
||||
android:layout_height="@dimen/dp_24"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="3dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/main_bottom_bar_icon_news" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_message"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dp_10"
|
||||
android:layout_toRightOf="@+id/iv_news"
|
||||
android:background="@drawable/ease_bg_msg_count"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="@dimen/dp_5"
|
||||
android:paddingTop="1.5dp"
|
||||
android:paddingRight="@dimen/dp_5"
|
||||
android:paddingBottom="2dp"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_8"
|
||||
android:visibility="gone"
|
||||
tools:text="99+"
|
||||
tools:visibility="visible" />
|
||||
android:layout_marginTop="-3dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_news"
|
||||
android:layout_width="@dimen/dp_24"
|
||||
android:layout_height="@dimen/dp_24"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="3dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/main_bottom_bar_icon_news"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_message"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dp_10"
|
||||
android:layout_toRightOf="@+id/iv_news"
|
||||
android:background="@drawable/ease_bg_msg_count"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="@dimen/dp_5"
|
||||
android:paddingTop="1.5dp"
|
||||
android:paddingRight="@dimen/dp_5"
|
||||
android:paddingBottom="2dp"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_8"
|
||||
android:visibility="gone"
|
||||
tools:text="99+"
|
||||
tools:visibility="visible"/>
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_news"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/iv_news"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
android:text="@string/main_tab3"
|
||||
android:textColor="@drawable/text_color_two"
|
||||
android:textSize="@dimen/sp_10" />
|
||||
android:id="@+id/tv_news"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/iv_news"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
android:text="@string/main_tab3"
|
||||
android:textColor="@drawable/text_color_two"
|
||||
android:textSize="@dimen/sp_10"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/rl_me"
|
||||
android:layout_width="@dimen/dp_0"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
android:id="@+id/rl_me"
|
||||
android:layout_width="@dimen/dp_0"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/im_me"
|
||||
android:layout_width="@dimen/dp_24"
|
||||
android:layout_height="@dimen/dp_24"
|
||||
android:layout_centerInParent="true"
|
||||
android:gravity="center_horizontal"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/main_bottom_bar_icon_me" />
|
||||
android:id="@+id/im_me"
|
||||
android:layout_width="@dimen/dp_24"
|
||||
android:layout_height="@dimen/dp_24"
|
||||
android:layout_centerInParent="true"
|
||||
android:gravity="center_horizontal"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/main_bottom_bar_icon_me"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_me"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
android:text="@string/main_tab4"
|
||||
android:textColor="@drawable/text_color_two"
|
||||
android:textSize="@dimen/sp_10" />
|
||||
android:id="@+id/tv_me"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
android:text="@string/main_tab4"
|
||||
android:textColor="@drawable/text_color_two"
|
||||
android:textSize="@dimen/sp_10"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
|
||||
<com.xscm.moduleutil.widget.DropView
|
||||
android:id="@+id/ll"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_52"
|
||||
android:layout_marginBottom="@dimen/dp_100"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
android:id="@+id/ll"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_52"
|
||||
android:layout_marginBottom="@dimen/dp_100"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
<com.xscm.moduleutil.widget.GifAvatarOvalView
|
||||
android:id="@+id/riv"
|
||||
android:layout_width="@dimen/dp_45"
|
||||
android:layout_height="@dimen/dp_45"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_margin="@dimen/dp_4"
|
||||
android:src="@mipmap/default_avatar"
|
||||
app:gav_border_color="#FFF"
|
||||
app:gav_border_width="@dimen/dp_2"
|
||||
app:riv_border_color="#FFF"
|
||||
app:riv_border_width="@dimen/dp_2"
|
||||
app:riv_oval="true" />
|
||||
android:id="@+id/riv"
|
||||
android:layout_width="@dimen/dp_45"
|
||||
android:layout_height="@dimen/dp_45"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_margin="@dimen/dp_4"
|
||||
android:src="@mipmap/default_avatar"
|
||||
app:gav_border_color="#FFF"
|
||||
app:gav_border_width="@dimen/dp_2"
|
||||
app:riv_border_color="#FFF"
|
||||
app:riv_border_width="@dimen/dp_2"
|
||||
app:riv_oval="true"/>
|
||||
|
||||
<View
|
||||
android:layout_width="@dimen/dp_1"
|
||||
android:layout_height="@dimen/dp_20"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="@dimen/dp_7"
|
||||
android:layout_marginRight="@dimen/dp_7"
|
||||
android:background="#FFFFFFFF"
|
||||
android:visibility="visible"/>
|
||||
android:layout_width="@dimen/dp_1"
|
||||
android:layout_height="@dimen/dp_20"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="@dimen/dp_7"
|
||||
android:layout_marginRight="@dimen/dp_7"
|
||||
android:background="#FFFFFFFF"
|
||||
android:visibility="visible"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_guanbi"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginRight="@dimen/dp_14"
|
||||
android:src="@mipmap/icon_guanbi" />
|
||||
android:id="@+id/iv_guanbi"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginRight="@dimen/dp_14"
|
||||
android:src="@mipmap/icon_guanbi"/>
|
||||
</com.xscm.moduleutil.widget.DropView>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_shouchl"
|
||||
android:layout_width="@dimen/dp_57"
|
||||
android:layout_height="@dimen/dp_57"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginEnd="@dimen/dp_20"
|
||||
android:layout_marginBottom="@dimen/dp_100"
|
||||
android:src="@mipmap/shouchl" />
|
||||
|
||||
<!-- <ImageView-->
|
||||
<!-- android:id="@+id/iv_shouchl"-->
|
||||
<!-- android:layout_width="@dimen/dp_57"-->
|
||||
<!-- android:layout_height="@dimen/dp_57"-->
|
||||
<!-- android:layout_alignParentBottom="true"-->
|
||||
<!-- android:layout_alignParentEnd="true"-->
|
||||
<!-- android:layout_marginEnd="@dimen/dp_20"-->
|
||||
<!-- android:layout_marginBottom="@dimen/dp_100"-->
|
||||
<!-- android:src="@mipmap/shouchl"/>-->
|
||||
|
||||
<com.stx.xhb.xbanner.XBanner
|
||||
android:id="@+id/banner"
|
||||
android:layout_width="@dimen/dp_75"
|
||||
android:layout_height="@dimen/dp_85"
|
||||
android:scaleType="fitCenter"
|
||||
app:AutoPlayTime="3000"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
app:pageChangeDuration="3000"
|
||||
app:pointContainerPosition="BOTTOM"
|
||||
app:pointNormal="@mipmap/room_ic_banner_point_normal"
|
||||
app:pointSelect="@mipmap/room_ic_banner_point_select"
|
||||
app:pointTopBottomPadding="@dimen/dp_2"
|
||||
android:layout_marginEnd="@dimen/dp_20"
|
||||
android:layout_marginBottom="@dimen/dp_100"
|
||||
app:pointsPosition="CENTER"
|
||||
app:pointsVisibility="true"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
/>
|
||||
</RelativeLayout>
|
||||
|
||||
</layout>
|
||||
Reference in New Issue
Block a user