首次提交信息
1
modulemain/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
||||
64
modulemain/build.gradle
Normal file
@@ -0,0 +1,64 @@
|
||||
plugins {
|
||||
alias(libs.plugins.android.library)
|
||||
alias(libs.plugins.kotlin.android)
|
||||
}
|
||||
|
||||
android {
|
||||
namespace 'com.xscm.modulemain'
|
||||
compileSdk 35
|
||||
|
||||
defaultConfig {
|
||||
minSdk 24
|
||||
targetSdk 35
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
javaCompileOptions {
|
||||
annotationProcessorOptions {
|
||||
arguments = [
|
||||
AROUTER_MODULE_NAME: project.getName()
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_17
|
||||
targetCompatibility JavaVersion.VERSION_17
|
||||
}
|
||||
dataBinding {
|
||||
enabled = true
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = '17'
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation libs.appcompat
|
||||
implementation libs.material
|
||||
implementation libs.activity
|
||||
implementation libs.constraintlayout
|
||||
implementation project(':modulevoice')
|
||||
implementation project(':modulecircle')
|
||||
implementation project(':modulevocal')
|
||||
implementation project(':modulenews')
|
||||
implementation project(':moduleroom')
|
||||
|
||||
testImplementation libs.junit
|
||||
androidTestImplementation libs.ext.junit
|
||||
androidTestImplementation libs.espresso.core
|
||||
|
||||
implementation project(':moduleUtil')
|
||||
implementation (libs.arouter.api.v150)
|
||||
//annotationProcessor
|
||||
annotationProcessor libs.arouter.compiler
|
||||
}
|
||||
apply plugin: 'com.alibaba.arouter' // ⚠️ 添加这一行
|
||||
21
modulemain/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.xscm.modulemain;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ExampleInstrumentedTest {
|
||||
@Test
|
||||
public void useAppContext() {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
assertEquals("com.xscm.modulemain", appContext.getPackageName());
|
||||
}
|
||||
}
|
||||
16
modulemain/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<application
|
||||
>
|
||||
|
||||
<activity
|
||||
android:name=".activity.MainActivity"
|
||||
android:configChanges="fontScale"
|
||||
android:exported="true"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait">
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -0,0 +1,801 @@
|
||||
package com.xscm.modulemain.activity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageInfo;
|
||||
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 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.xscm.modulemain.R;
|
||||
import com.xscm.modulemain.contacts.HomeContacts;
|
||||
import com.xscm.modulemain.databinding.ActivityMainBinding;
|
||||
import com.xscm.modulemain.presenter.HomePresenter;
|
||||
import com.xscm.moduleutil.activity.BaseMvpActivity;
|
||||
import com.xscm.moduleutil.adapter.AppUpdateDialog;
|
||||
import com.xscm.moduleutil.base.AppStateManager;
|
||||
import com.xscm.moduleutil.base.CommonAppContext;
|
||||
import com.xscm.moduleutil.base.RoomManager;
|
||||
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.bean.room.RoomOnline;
|
||||
import com.xscm.moduleutil.bean.room.RoomOnlineBean;
|
||||
import com.xscm.moduleutil.dialog.FirstChargeDialog;
|
||||
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.logger.Logger;
|
||||
import com.tencent.imsdk.v2.V2TIMManager;
|
||||
import com.tencent.imsdk.v2.V2TIMValueCallback;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
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 {
|
||||
private static int index = -1;
|
||||
|
||||
public static boolean isShortsShowing() {
|
||||
return index == 1;
|
||||
}
|
||||
|
||||
public String giftBagUrl;
|
||||
|
||||
private Fragment[] fragments;
|
||||
private AppUpdateDialog appUpdateDialog;
|
||||
|
||||
private boolean isMediaSelected = false;
|
||||
private String unselectedMediaUrl = ""; // 从服务器获取
|
||||
private String selectedMediaUrl = ""; // 从服务器获取
|
||||
|
||||
// 添加其他 tab 的图标 URL
|
||||
private String unselectedTrendUrl = "";
|
||||
private String selectedTrendUrl = "";
|
||||
private String unselectedNewsUrl = "";
|
||||
private String selectedNewsUrl = "";
|
||||
private String unselectedMeUrl = "";
|
||||
private String selectedMeUrl = "";
|
||||
|
||||
// 添加文字颜色变量
|
||||
private int selectedTextColor = 0; // 选中文字颜色 (从服务器获取)
|
||||
private int unselectedTextColor = 0; // 未选中文字颜色 (从服务器获取)
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
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);
|
||||
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();
|
||||
|
||||
fragments = new Fragment[]{
|
||||
VoiceFragment.newInstance(), // 声播
|
||||
CircleFragment.newInstance(), // 语圈
|
||||
NewsFragment.newInstance(), //消息
|
||||
VocalRangeFragment.newInstance() // 我的
|
||||
};
|
||||
FragmentUtils.add(getSupportFragmentManager(), fragments, R.id.frame_layout, 0);
|
||||
MvpPre.initData();
|
||||
MvpPre.userFiles();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (requestCode == 100) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
if (Settings.canDrawOverlays(this)) {
|
||||
ToastUtils.showShort("已获得悬浮窗权限");
|
||||
// showPiaoPingMessage("测试飘屏", 3000);
|
||||
} else {
|
||||
ToastUtils.showShort("未获得悬浮窗权限,功能无法使用");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onUserInfoEvent(String event) {
|
||||
MvpPre.address_ip(event);
|
||||
}
|
||||
|
||||
@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));
|
||||
}
|
||||
|
||||
private void checkTab(int tab) {
|
||||
if (tab >= 0) {
|
||||
selectShow(tab);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
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 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();
|
||||
// EventBus.getDefault().register(this);
|
||||
mBinding.rlMedia.setOnClickListener(this);
|
||||
mBinding.rlTrend.setOnClickListener(this);
|
||||
// mBinding.rlParty.setOnClickListener(this);
|
||||
mBinding.rlNews.setOnClickListener(this);
|
||||
mBinding.rlMe.setOnClickListener(this);
|
||||
mBinding.ivGuanbi.setOnClickListener(this);
|
||||
mBinding.riv.setOnClickListener(this);
|
||||
mBinding.ivShouchl.setOnClickListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initCompleted() {
|
||||
// 初始化显示派对Tab
|
||||
reset();
|
||||
mBinding.rlMedia.setSelected(true);
|
||||
FragmentUtils.showHide(0, fragments);
|
||||
index = 0;
|
||||
isMediaSelected = true; // 确保设置为选中状态
|
||||
selectedTextColor = ColorManager.getInstance().getPrimaryColorInt();
|
||||
unselectedTextColor = Color.parseColor("#000000");
|
||||
updateAllTabUI(); // 这会同时更新图标和文字颜色
|
||||
}
|
||||
|
||||
@Override
|
||||
protected HomePresenter bindPresenter() {
|
||||
return new HomePresenter(this, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showLoadings() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disLoadings() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
int id = view.getId();
|
||||
if (id == R.id.rl_media) {
|
||||
selectShow(0);
|
||||
} else if (id == R.id.rl_trend) {
|
||||
selectShow(1);
|
||||
} else if (id == R.id.rl_news) {
|
||||
selectShow(2);
|
||||
} else if (id == R.id.rl_me) {
|
||||
selectShow(3);
|
||||
//C0101我的界面
|
||||
// AppLogUtil.reportAppLog(AppLogEvent.C0101);
|
||||
} else if (id == R.id.iv_guanbi) {
|
||||
mBinding.ll.setVisibility(View.INVISIBLE);
|
||||
CommonAppContext.getInstance().isShow = false;
|
||||
CommonAppContext.getInstance().isPlaying = false;
|
||||
EventBus.getDefault().post(new RoomOutEvent());
|
||||
} else if (id == R.id.riv) {
|
||||
String roomId = CommonAppContext.getInstance().playId;
|
||||
if (!TextUtils.isEmpty(roomId)) {
|
||||
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();
|
||||
|
||||
// }
|
||||
}
|
||||
|
||||
// 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
|
||||
public void quitSuccess(String roomId) {
|
||||
// RtcManager.getInstance().leaveChannel(roomId);
|
||||
// RtcManager.getInstance().setAudioUrl(null);
|
||||
// EMqttService.cleanSubscribeRoom(roomId);
|
||||
// BaseApplication.getInstance().isPlaying = false;
|
||||
// BaseApplication.getInstance().isShow = false;
|
||||
// RtcManager.getInstance().removeRtcEventListener();
|
||||
}
|
||||
|
||||
|
||||
private void reset() {
|
||||
mBinding.rlMedia.setSelected(false);
|
||||
mBinding.rlTrend.setSelected(false);
|
||||
// mBinding.rlParty.setSelected(false);
|
||||
mBinding.rlNews.setSelected(false);
|
||||
mBinding.rlMe.setSelected(false);
|
||||
|
||||
}
|
||||
|
||||
private void selectShow(int postion) {
|
||||
if (postion == index) {
|
||||
if (postion == 1) {
|
||||
// EventBus.getDefault().post(new RefreshShortsEvent());
|
||||
} else if (postion == 2) {
|
||||
// EventBus.getDefault().post(new NewsTabReEvent());
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
reset();
|
||||
index = postion;
|
||||
switch (postion) {
|
||||
case 0:
|
||||
mBinding.rlMedia.setSelected(true);
|
||||
isMediaSelected = true;
|
||||
break;
|
||||
case 1:
|
||||
mBinding.rlTrend.setSelected(true);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
mBinding.rlNews.setSelected(true);
|
||||
break;
|
||||
case 3:
|
||||
mBinding.rlMe.setSelected(true);
|
||||
break;
|
||||
}
|
||||
// 更新所有图标状态
|
||||
updateMediaIcon();
|
||||
updateTrendIcon();
|
||||
updateNewsIcon();
|
||||
updateMeIcon();
|
||||
// 更新文字颜色
|
||||
updateTabTextColors();
|
||||
FragmentUtils.showHide(postion, fragments);
|
||||
}
|
||||
|
||||
private void updateMediaIcon() {
|
||||
String imageUrl = (index == 0) ? selectedMediaUrl : unselectedMediaUrl;
|
||||
if (!TextUtils.isEmpty(imageUrl)) {
|
||||
Glide.with(this)
|
||||
.load(imageUrl)
|
||||
.placeholder(com.xscm.moduleutil.R.mipmap.tab_main_media_unselected) // 默认图标
|
||||
.into(mBinding.imSy);
|
||||
} else {
|
||||
// 如果没有网络图标,使用默认的选中/未选中状态
|
||||
int resId = (index == 0) ?
|
||||
com.xscm.moduleutil.R.mipmap.tab_main_media_selected :
|
||||
com.xscm.moduleutil.R.mipmap.tab_main_media_unselected;
|
||||
mBinding.imTrend.setImageResource(resId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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;
|
||||
// }
|
||||
|
||||
MvpPre.loginIm();
|
||||
Logger.i("MainActivity", "onResume");
|
||||
// Beta.checkAppUpgrade(false, false);
|
||||
MvpPre.appUpdate();
|
||||
MvpPre.signSwitch();
|
||||
refreshUnread();
|
||||
boolean b = CommonAppContext.getInstance().isPlaying;
|
||||
if (b) {
|
||||
ImageLoader.loadHead(MainActivity.this, mBinding.riv, CommonAppContext.getInstance().playCover);
|
||||
mBinding.riv.postDelayed(mRivAnimationTask, 1000);
|
||||
mBinding.ll.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mBinding.ll.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
||||
|
||||
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() + "");//获取首充是否需要展示
|
||||
|
||||
// mBinding.ivShouchl.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onEvent(UnreadCountEvent event) {
|
||||
if (event.getALong() == 0) {
|
||||
mBinding.tvMessage.setVisibility(View.GONE);
|
||||
mBinding.tvMessage.setText("0");
|
||||
} else if (event.getALong() > 0) {
|
||||
mBinding.tvMessage.setText(String.valueOf(event.getALong()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
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 = () -> {
|
||||
Animation rivRotateAnimation = AnimationUtils.loadAnimation(MainActivity.this, com.xscm.moduleutil.R.anim.rotate_anim);
|
||||
mBinding.riv.startAnimation(rivRotateAnimation);
|
||||
};
|
||||
|
||||
private void refreshUnread() {
|
||||
MvpPre.userNews();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void appUpdate(AppUpdateModel appUpdateModel) {
|
||||
if (appUpdateModel.getCode() > getCurrentVersionCode(this)) {
|
||||
if (appUpdateDialog == null) {
|
||||
appUpdateDialog = new AppUpdateDialog(this);
|
||||
appUpdateDialog.setAppUpdateModel(appUpdateModel);
|
||||
if (appUpdateModel.getIs_force().equals("1") || getCurrentVersionCode(this) - appUpdateModel.getCode() >= 2) {
|
||||
appUpdateDialog.setCanceledOnTouchOutside(false);
|
||||
}
|
||||
}
|
||||
appUpdateDialog.show();
|
||||
}
|
||||
}
|
||||
|
||||
public static int getCurrentVersionCode(Context context) {
|
||||
try {
|
||||
PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
|
||||
return packageInfo.versionCode;
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
Log.e("MainActivity", "Package name not found", e);
|
||||
return -1; // 如果出错,返回-1或其他适当的错误码
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRandomHotRoom(String roomId) {
|
||||
if (!TextUtils.isEmpty(roomId)) {
|
||||
// ARouter.getInstance().build(ARouteConstants.LIVE_ROOM).withString("form", "首页").withString("roomId", roomId).navigation();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUnReadCount(int unreadMessageCount) {
|
||||
if (unreadMessageCount == 0) {
|
||||
mBinding.tvMessage.setVisibility(View.GONE);
|
||||
mBinding.tvMessage.setText("0");
|
||||
} else {
|
||||
mBinding.tvMessage.setVisibility(View.VISIBLE);
|
||||
mBinding.tvMessage.setText(String.valueOf(unreadMessageCount));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 启动获取一次用户信息
|
||||
*/
|
||||
// @Override
|
||||
// public void UserFilesSuccess(UserBean userBean) {
|
||||
// MyApplication.getInstance().setUser(userBean);
|
||||
// }
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
EventBus.getDefault().unregister(this);
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void myInfoSuccess(FirstChargeBean data) {
|
||||
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();
|
||||
|
||||
// 语圈 tab 图标
|
||||
selectedTrendUrl = themeBean.getFind_sel();
|
||||
unselectedTrendUrl = themeBean.getFind_nor();
|
||||
|
||||
// 消息 tab 图标
|
||||
selectedNewsUrl = themeBean.getMsg_sel();
|
||||
unselectedNewsUrl = themeBean.getMsg_nor();
|
||||
|
||||
// 我的 tab 图标
|
||||
selectedMeUrl = themeBean.getMine_sel();
|
||||
unselectedMeUrl = themeBean.getMine_nor();
|
||||
// 获取文字颜色
|
||||
try {
|
||||
if (themeBean.getBtn_text_color() != null && !themeBean.getBtn_text_color().isEmpty()) {
|
||||
selectedTextColor = Color.parseColor(themeBean.getBtn_text_color());
|
||||
}
|
||||
unselectedTextColor = Color.parseColor("#000000");
|
||||
} catch (Exception e) {
|
||||
// 使用默认颜色
|
||||
selectedTextColor = ColorManager.getInstance().getPrimaryColorInt();
|
||||
unselectedTextColor = Color.parseColor("#000000");
|
||||
}
|
||||
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) {
|
||||
BackgroundManager.getInstance().setBackgroundUrl(themeBean.getApp_bg());
|
||||
loadNetworkBackground();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@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,"");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void updateAllTabUI() {
|
||||
index = 0;
|
||||
// 更新图标
|
||||
updateMediaIcon();
|
||||
updateTrendIcon();
|
||||
updateNewsIcon();
|
||||
updateMeIcon();
|
||||
|
||||
// 更新文字
|
||||
updateTabTextColors();
|
||||
}
|
||||
|
||||
private void updateTrendIcon() {
|
||||
String imageUrl = (index == 1) ? selectedTrendUrl : unselectedTrendUrl;
|
||||
|
||||
if (!TextUtils.isEmpty(imageUrl)) {
|
||||
Glide.with(this)
|
||||
.load(imageUrl)
|
||||
.placeholder(com.xscm.moduleutil.R.mipmap.icon_me_trend_unselect)
|
||||
.into(mBinding.imTrend);
|
||||
} else {
|
||||
// 如果没有网络图标,使用默认的选中/未选中状态
|
||||
int resId = (index == 1) ?
|
||||
com.xscm.moduleutil.R.mipmap.icon_me_trend_select :
|
||||
com.xscm.moduleutil.R.mipmap.icon_me_trend_unselect;
|
||||
mBinding.imTrend.setImageResource(resId);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateNewsIcon() {
|
||||
String imageUrl = (index == 2) ? selectedNewsUrl : unselectedNewsUrl;
|
||||
|
||||
if (!TextUtils.isEmpty(imageUrl)) {
|
||||
Glide.with(this)
|
||||
.load(imageUrl)
|
||||
.placeholder(com.xscm.moduleutil.R.mipmap.icon_news_un_select)
|
||||
.into(mBinding.ivNews);
|
||||
} else {
|
||||
// 如果没有网络图标,使用默认的选中/未选中状态
|
||||
int resId = (index == 2) ?
|
||||
com.xscm.moduleutil.R.mipmap.icon_news_select :
|
||||
com.xscm.moduleutil.R.mipmap.icon_news_un_select;
|
||||
mBinding.ivNews.setImageResource(resId);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateMeIcon() {
|
||||
String imageUrl = (index == 3) ? selectedMeUrl : unselectedMeUrl;
|
||||
|
||||
if (!TextUtils.isEmpty(imageUrl)) {
|
||||
Glide.with(this)
|
||||
.load(imageUrl)
|
||||
.placeholder(com.xscm.moduleutil.R.mipmap.icon_my_un_select)
|
||||
.into(mBinding.imMe);
|
||||
} else {
|
||||
// 如果没有网络图标,使用默认的选中/未选中状态
|
||||
int resId = (index == 3) ?
|
||||
com.xscm.moduleutil.R.mipmap.icon_my_select :
|
||||
com.xscm.moduleutil.R.mipmap.icon_my_un_select;
|
||||
mBinding.imMe.setImageResource(resId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void updateTabTextColors() {
|
||||
// 更新声播 tab 文字颜色
|
||||
if (selectedTextColor != 0 && unselectedTextColor != 0) {
|
||||
int mediaTextColor = (index == 0) ? selectedTextColor : unselectedTextColor;
|
||||
mBinding.tvMedia.setTextColor(mediaTextColor);
|
||||
}
|
||||
|
||||
// 更新语圈 tab 文字颜色
|
||||
if (selectedTextColor != 0 && unselectedTextColor != 0) {
|
||||
int trendTextColor = (index == 1) ? selectedTextColor : unselectedTextColor;
|
||||
mBinding.tvTrend.setTextColor(trendTextColor);
|
||||
}
|
||||
|
||||
// 更新消息 tab 文字颜色
|
||||
if (selectedTextColor != 0 && unselectedTextColor != 0) {
|
||||
int newsTextColor = (index == 2) ? selectedTextColor : unselectedTextColor;
|
||||
mBinding.tvNews.setTextColor(newsTextColor);
|
||||
}
|
||||
|
||||
// 更新我的 tab 文字颜色
|
||||
if (selectedTextColor != 0 && unselectedTextColor != 0) {
|
||||
int meTextColor = (index == 3) ? selectedTextColor : unselectedTextColor;
|
||||
mBinding.tvMe.setTextColor(meTextColor);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// @Override
|
||||
// protected void onPause() {
|
||||
// super.onPause();
|
||||
// moveTaskToBack(true);
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.xscm.modulemain.contacts;
|
||||
|
||||
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.room.RoomOnline;
|
||||
|
||||
|
||||
public final class HomeContacts {
|
||||
|
||||
|
||||
public interface View extends IView<Activity> {
|
||||
|
||||
|
||||
void appUpdate(AppUpdateModel appUpdateModel);
|
||||
|
||||
void setRandomHotRoom(String roomId);
|
||||
|
||||
void setUnReadCount(int unreadMessageCount);
|
||||
|
||||
// void UserFilesSuccess(UserBean userBean);
|
||||
|
||||
void quitSuccess(String roomId);
|
||||
void myInfoSuccess(FirstChargeBean data);
|
||||
|
||||
void getThemeData(ThemeBean themeBean);
|
||||
|
||||
void getRoomOnline(RoomOnline onlineBean);
|
||||
|
||||
}
|
||||
|
||||
public interface IHomePre extends IPresenter {
|
||||
void initData();
|
||||
|
||||
void loginIm();
|
||||
|
||||
void quitRoom(String roomId);
|
||||
|
||||
void appUpdate();
|
||||
|
||||
void randomHotRoom();
|
||||
|
||||
void userNews();
|
||||
|
||||
void signSwitch();
|
||||
|
||||
void userFiles();
|
||||
|
||||
void address_ip(String ip);
|
||||
|
||||
void getMyInfo(String userId);
|
||||
|
||||
void getThemeData();//主题接口
|
||||
|
||||
void getRoomOnline(String roomId, String page, String page_limit);//在线列表
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,400 @@
|
||||
package com.xscm.modulemain.presenter;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.PowerManager;
|
||||
import android.provider.Settings;
|
||||
|
||||
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.room.RoomOnline;
|
||||
import com.xscm.moduleutil.http.BaseObserver;
|
||||
import com.xscm.moduleutil.presenter.BasePresenter;
|
||||
import com.xscm.moduleutil.utils.SpUtil;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
public class HomePresenter extends BasePresenter<HomeContacts.View> implements HomeContacts.IHomePre {
|
||||
|
||||
HomeContacts.View mView;
|
||||
|
||||
public HomePresenter(HomeContacts.View view, Context context) {
|
||||
super(view, context);
|
||||
mView=view;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void appUpdate() {
|
||||
api.appUpdate(new BaseObserver<AppUpdateModel>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(AppUpdateModel appUpdataModel) {
|
||||
if (MvpRef==null){
|
||||
MvpRef=new WeakReference<>(mView);
|
||||
}
|
||||
MvpRef.get().appUpdate(appUpdataModel);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomHotRoom() {
|
||||
// NewApi.getInstance().getRandomRecommendRoom(new com.qpyy.libcommon.api.BaseObserver<RandomRecommendRoomResp>() {
|
||||
// @Override
|
||||
// public void onSubscribe(Disposable d) {
|
||||
// addDisposable(d);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNext(RandomRecommendRoomResp randomRecommendRoomResp) {
|
||||
// if (randomRecommendRoomResp != null && !TextUtils.isEmpty(randomRecommendRoomResp.getRoom_id()) && !"0".equals(randomRecommendRoomResp.getRoom_id())) {
|
||||
// MvpRef.get().setRandomHotRoom(randomRecommendRoomResp.getRoom_id());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onComplete() {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
@Override
|
||||
public void userNews() {
|
||||
// NewApi.getInstance().getMessageCount(new com.qpyy.libcommon.api.BaseObserver<UserMsgCountResp>() {
|
||||
// @Override
|
||||
// public void onSubscribe(Disposable d) {
|
||||
// addDisposable(d);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNext(UserMsgCountResp userMsgCountResp) {
|
||||
// int unreadMessageCount = EMClient.getInstance().chatManager().getUnreadMessageCount() + userMsgCountResp.getUnReadCount();
|
||||
// MvpRef.get().setUnReadCount(unreadMessageCount);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onComplete() {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
@Override
|
||||
public void signSwitch() {
|
||||
// getApi().signSwitch(new BaseObserver<SignSwitchModel>() {
|
||||
// @Override
|
||||
// public void onSubscribe(Disposable d) {
|
||||
// addDisposable(d);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNext(SignSwitchModel signSwitchModel) {
|
||||
// MyApplication.getInstance().labor = signSwitchModel.getLabor() == 1;
|
||||
// MyApplication.getInstance().chat_min_level = signSwitchModel.getChat_min_level();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onComplete() {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
@Override
|
||||
public void userFiles() {
|
||||
// getApi().userFiles(new BaseObserver<UserBean>() {
|
||||
// @Override
|
||||
// public void onSubscribe(Disposable d) {
|
||||
// addDisposable(d);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNext(UserBean userBean) {
|
||||
// MvpRef.get().UserFilesSuccess(userBean);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onComplete() {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
@Override
|
||||
public void address_ip(String ip) {
|
||||
api.address_ip(ip, new BaseObserver<String>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(String s) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
// GrabMarblesManager.INSTANCE.setToken(SpUtils.getToken());
|
||||
// GrabMarblesManager.INSTANCE.setUserId(SpUtils.getUserId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loginIm() {
|
||||
UserBean user = SpUtil.getUserBean();
|
||||
EventBus.getDefault().post(user);
|
||||
|
||||
// boolean connected = EMClient.getInstance().isConnected();
|
||||
// if (NetworkUtils.isConnected() && !connected) {
|
||||
// UserBean user = MyApplication.getInstance().getUser();
|
||||
// if (TextUtils.isEmpty(user.getEmchat_username()) || TextUtils.isEmpty(user.getEmchat_password())) {
|
||||
// ToastUtils.showShort("无环信账号或密码,请重新登录");
|
||||
// MyApplication.getInstance().reLogin();
|
||||
// return;
|
||||
// }
|
||||
// EMClient.getInstance().login(user.getEmchat_username(), user.getEmchat_password(), new EMCallBack() {
|
||||
// @Override
|
||||
// public void onSuccess() {
|
||||
// EChartHelper.getInstance().setCurrentUserName(user.getEmchat_username());
|
||||
// EChartHelper.getInstance().getUserProfileManager().updateCurrentUserNickName(user.getNickname());
|
||||
// EChartHelper.getInstance().getUserProfileManager().setCurrentUserAvatar(user.getHead_picture());
|
||||
// EMClient.getInstance().groupManager().loadAllGroups();
|
||||
// EMClient.getInstance().chatManager().loadAllConversations();
|
||||
// EMClient.getInstance().pushManager().asyncUpdatePushNickname(user.getEmchat_username(), new EMCallBack() {
|
||||
// @Override
|
||||
// public void onSuccess() {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onError(int i, String s) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onProgress(int i, String s) {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onError(int i, String s) {
|
||||
//// ToastUtils.showShort("登录失败:" + i + " " + s);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onProgress(int i, String s) {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void quitRoom(String roomId) {
|
||||
// MvpRef.get().showLoadings();
|
||||
// NewApi.getInstance().quit(roomId, new com.qpyy.libcommon.api.BaseObserver<String>() {
|
||||
// @Override
|
||||
// public void onSubscribe(Disposable d) {
|
||||
// addDisposable(d);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNext(String s) {
|
||||
// MvpRef.get().quitSuccess(roomId);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onComplete() {
|
||||
//
|
||||
//// MvpRef.get().disLoadings();
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.M)
|
||||
private boolean isIgnoringBatteryOptimizations() {
|
||||
boolean isIgnoring = false;
|
||||
PowerManager powerManager = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
|
||||
if (powerManager != null) {
|
||||
isIgnoring = powerManager.isIgnoringBatteryOptimizations(mContext.getPackageName());
|
||||
}
|
||||
return isIgnoring;
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.M)
|
||||
public void requestIgnoreBatteryOptimizations() {
|
||||
Intent intent = new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);
|
||||
intent.setData(Uri.parse("package:" + mContext.getPackageName()));
|
||||
mContext.startActivity(intent);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 跳转到指定应用的首页
|
||||
*/
|
||||
private void showActivity(@NonNull String packageName) {
|
||||
Intent intent = mContext.getPackageManager().getLaunchIntentForPackage(packageName);
|
||||
mContext.startActivity(intent);
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到指定应用的指定页面
|
||||
*/
|
||||
private void showActivity(@NonNull String packageName, @NonNull String activityDir) {
|
||||
Intent intent = new Intent();
|
||||
intent.setComponent(new ComponentName(packageName, activityDir));
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
mContext.startActivity(intent);
|
||||
}
|
||||
|
||||
|
||||
private void goXiaomiSetting() {
|
||||
showActivity("com.miui.securitycenter",
|
||||
"com.miui.permcenter.autostart.AutoStartManagementActivity");
|
||||
}
|
||||
|
||||
private void goHuaweiSetting() {
|
||||
try {
|
||||
showActivity("com.huawei.systemmanager",
|
||||
"com.huawei.systemmanager.startupmgr.ui.StartupNormalAppListActivity");
|
||||
} catch (Exception e) {
|
||||
showActivity("com.huawei.systemmanager",
|
||||
"com.huawei.systemmanager.optimize.bootstart.BootStartActivity");
|
||||
}
|
||||
}
|
||||
|
||||
private void goOPPOSetting() {
|
||||
try {
|
||||
showActivity("com.coloros.phonemanager");
|
||||
} catch (Exception e1) {
|
||||
try {
|
||||
showActivity("com.oppo.safe");
|
||||
} catch (Exception e2) {
|
||||
try {
|
||||
showActivity("com.coloros.oppoguardelf");
|
||||
} catch (Exception e3) {
|
||||
showActivity("com.coloros.safecenter");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void goVIVOSetting() {
|
||||
showActivity("com.iqoo.secure");
|
||||
}
|
||||
|
||||
private void goMeizuSetting() {
|
||||
showActivity("com.meizu.safe");
|
||||
}
|
||||
|
||||
private void goSamsungSetting() {
|
||||
try {
|
||||
showActivity("com.samsung.android.sm_cn");
|
||||
} catch (Exception e) {
|
||||
showActivity("com.samsung.android.sm");
|
||||
}
|
||||
}
|
||||
|
||||
private void goLetvSetting() {
|
||||
showActivity("com.letv.android.letvsafe",
|
||||
"com.letv.android.letvsafe.AutobootManageActivity");
|
||||
}
|
||||
|
||||
private void goSmartisanSetting() {
|
||||
showActivity("com.smartisanos.security");
|
||||
}
|
||||
|
||||
public void delayPreloadImage() {
|
||||
// ThreadUtils.runOnUiThreadDelayed(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// ImageUtils.preloadImgConstants();
|
||||
// }
|
||||
// }, 6 * 1000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getMyInfo(String userId) {
|
||||
api.firstCharge( userId,new BaseObserver<FirstChargeBean>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(FirstChargeBean myInfoResp) {
|
||||
if (MvpRef==null){
|
||||
MvpRef = new WeakReference<>(mView);
|
||||
}
|
||||
MvpRef.get().myInfoSuccess(myInfoResp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getThemeData() {
|
||||
api.getThemeData(new BaseObserver<ThemeBean>() {
|
||||
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
170
modulemain/src/main/res/drawable/ic_launcher_background.xml
Normal file
@@ -0,0 +1,170 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path
|
||||
android:fillColor="#3DDC84"
|
||||
android:pathData="M0,0h108v108h-108z" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M9,0L9,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,0L19,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,0L29,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,0L39,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,0L49,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,0L59,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,0L69,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,0L79,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M89,0L89,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M99,0L99,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,9L108,9"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,19L108,19"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,29L108,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,39L108,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,49L108,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,59L108,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,69L108,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,79L108,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,89L108,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,99L108,99"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,29L89,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,39L89,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,49L89,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,59L89,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,69L89,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,79L89,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,19L29,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,19L39,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,19L49,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,19L59,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,19L69,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,19L79,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
</vector>
|
||||
30
modulemain/src/main/res/drawable/ic_launcher_foreground.xml
Normal file
@@ -0,0 +1,30 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="85.84757"
|
||||
android:endY="92.4963"
|
||||
android:startX="42.9492"
|
||||
android:startY="49.59793"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#44000000"
|
||||
android:offset="0.0" />
|
||||
<item
|
||||
android:color="#00000000"
|
||||
android:offset="1.0" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillType="nonZero"
|
||||
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
|
||||
android:strokeWidth="1"
|
||||
android:strokeColor="#00000000" />
|
||||
</vector>
|
||||
232
modulemain/src/main/res/layout/activity_main.xml
Normal file
@@ -0,0 +1,232 @@
|
||||
<?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">
|
||||
<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: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">
|
||||
|
||||
<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" />
|
||||
|
||||
<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" />
|
||||
</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">
|
||||
|
||||
<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" />
|
||||
|
||||
<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" />
|
||||
</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">
|
||||
|
||||
<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" />
|
||||
|
||||
|
||||
</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" />
|
||||
|
||||
</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">
|
||||
|
||||
<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" />
|
||||
|
||||
<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" />
|
||||
</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">
|
||||
|
||||
<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" />
|
||||
|
||||
<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"/>
|
||||
|
||||
<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" />
|
||||
</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" />
|
||||
</RelativeLayout>
|
||||
|
||||
</layout>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
BIN
modulemain/src/main/res/mipmap-hdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
modulemain/src/main/res/mipmap-hdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
modulemain/src/main/res/mipmap-mdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 982 B |
BIN
modulemain/src/main/res/mipmap-mdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
modulemain/src/main/res/mipmap-xhdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
modulemain/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
modulemain/src/main/res/mipmap-xxhdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
modulemain/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
BIN
modulemain/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
modulemain/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 7.6 KiB |
8
modulemain/src/main/res/values-en-rUs/strings.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="MissingTranslation">
|
||||
|
||||
<string name="main_tab1">Voice broadcasting</string>
|
||||
<string name="main_tab2">Language circle</string>
|
||||
<string name="main_tab3">news</string>
|
||||
<string name="main_tab4">vocal range</string>
|
||||
|
||||
</resources>
|
||||
3
modulemain/src/main/res/values-land/dimens.xml
Normal file
@@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<dimen name="fab_margin">48dp</dimen>
|
||||
</resources>
|
||||
16
modulemain/src/main/res/values-night/themes.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.QxLive" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||
<!-- Primary brand color. -->
|
||||
<item name="colorPrimary">@color/purple_200</item>
|
||||
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||
<item name="colorOnPrimary">@color/black</item>
|
||||
<!-- Secondary brand color. -->
|
||||
<item name="colorSecondary">@color/teal_200</item>
|
||||
<item name="colorSecondaryVariant">@color/teal_200</item>
|
||||
<item name="colorOnSecondary">@color/black</item>
|
||||
<!-- Status bar color. -->
|
||||
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
|
||||
<!-- Customize your theme here. -->
|
||||
</style>
|
||||
</resources>
|
||||
3
modulemain/src/main/res/values-w1240dp/dimens.xml
Normal file
@@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<dimen name="fab_margin">200dp</dimen>
|
||||
</resources>
|
||||
3
modulemain/src/main/res/values-w600dp/dimens.xml
Normal file
@@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<dimen name="fab_margin">48dp</dimen>
|
||||
</resources>
|
||||
6
modulemain/src/main/res/values-w820dp/dimens.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<resources>
|
||||
<!-- Example customization of dimensions originally defined in res/values/dimens.xml
|
||||
(such as screen margins) for screens with more than 820dp of available width. This
|
||||
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
|
||||
<dimen name="activity_horizontal_margin">64dp</dimen>
|
||||
</resources>
|
||||
6
modulemain/src/main/res/values-zh-rCN/strings.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<resources>
|
||||
<string name="main_tab1">首页</string>
|
||||
<string name="main_tab2">广场</string>
|
||||
<string name="main_tab3">消息</string>
|
||||
<string name="main_tab4">我的</string>
|
||||
</resources>
|
||||
10
modulemain/src/main/res/values/colors.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="purple_200">#FFBB86FC</color>
|
||||
<color name="purple_500">#FF6200EE</color>
|
||||
<color name="purple_700">#FF3700B3</color>
|
||||
<color name="teal_200">#FF03DAC5</color>
|
||||
<color name="teal_700">#FF018786</color>
|
||||
<color name="black">#FF000000</color>
|
||||
<color name="white">#FFFFFFFF</color>
|
||||
</resources>
|
||||
8
modulemain/src/main/res/values/dimens.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<resources>
|
||||
<!-- Default screen margins, per the Android Design guidelines. -->
|
||||
<dimen name="activity_horizontal_margin">16dp</dimen>
|
||||
<dimen name="activity_vertical_margin">16dp</dimen>
|
||||
<dimen name="appbar_padding">16dp</dimen>
|
||||
<dimen name="fab_margin">16dp</dimen>
|
||||
<dimen name="appbar_padding_top">8dp</dimen>
|
||||
</resources>
|
||||
6
modulemain/src/main/res/values/strings.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<resources>
|
||||
<string name="main_tab1">首页</string>
|
||||
<string name="main_tab2">广场</string>
|
||||
<string name="main_tab3">消息</string>
|
||||
<string name="main_tab4">我的</string>
|
||||
</resources>
|
||||
25
modulemain/src/main/res/values/themes.xml
Normal file
@@ -0,0 +1,25 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.QxLive" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||
<!-- Primary brand color. -->
|
||||
<item name="colorPrimary">@color/purple_500</item>
|
||||
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||
<item name="colorOnPrimary">@color/white</item>
|
||||
<!-- Secondary brand color. -->
|
||||
<item name="colorSecondary">@color/teal_200</item>
|
||||
<item name="colorSecondaryVariant">@color/teal_700</item>
|
||||
<item name="colorOnSecondary">@color/black</item>
|
||||
<!-- Status bar color. -->
|
||||
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
|
||||
<!-- Customize your theme here. -->
|
||||
</style>
|
||||
|
||||
<style name="Theme.QxLive.NoActionBar">
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="windowNoTitle">true</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.QxLive.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
|
||||
|
||||
<style name="Theme.QxLive.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
|
||||
</resources>
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.xscm.modulemain;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
public class ExampleUnitTest {
|
||||
@Test
|
||||
public void addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2);
|
||||
}
|
||||
}
|
||||