82 添加签到延迟1分钟弹出。
This commit is contained in:
@@ -19,6 +19,7 @@ import android.media.projection.MediaProjection;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.SystemClock;
|
||||
import android.text.TextUtils;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.view.Display;
|
||||
@@ -124,7 +125,7 @@ public class AgoraManager {
|
||||
private Disposable disposableC;
|
||||
|
||||
// UI 刷新最小间隔(ms)
|
||||
private static final long SOUND_UI_INTERVAL = 200;
|
||||
private static final long SOUND_UI_INTERVAL = 120;
|
||||
|
||||
private final Handler uiHandler = new Handler(Looper.getMainLooper());
|
||||
private long lastDispatchTime = 0;
|
||||
@@ -563,9 +564,12 @@ public class AgoraManager {
|
||||
// 1️⃣ 构建局部 Map(声网线程私有)
|
||||
Map<String, Integer> localMap = new HashMap<>();
|
||||
for (AudioVolumeInfo info : speakers) {
|
||||
String userId = info.uid > 0
|
||||
? String.valueOf(info.uid)
|
||||
: String.valueOf(SpUtil.getUserId());
|
||||
String userId = "";
|
||||
if (info.uid == 0) {
|
||||
userId = SpUtil.getUserId()+"";
|
||||
}else {
|
||||
userId = String.valueOf(info.uid);
|
||||
}
|
||||
localMap.put(userId, info.volume);
|
||||
}
|
||||
|
||||
@@ -1011,6 +1015,7 @@ public class AgoraManager {
|
||||
// }
|
||||
// }
|
||||
public void addSoundLevelListener(SoundLevelUpdateListener listener) {
|
||||
LogUtils.e("AgoraManager", "addSoundLevelListener: " + listener +"============"+soundLevelUpdateListeners.size());
|
||||
if (soundLevelUpdateListeners != null) {
|
||||
soundLevelUpdateListeners.add(listener);
|
||||
}
|
||||
@@ -1022,10 +1027,24 @@ public class AgoraManager {
|
||||
}
|
||||
}
|
||||
|
||||
public void removeSoundLevelListenerAll() {
|
||||
if (soundLevelUpdateListeners != null)
|
||||
soundLevelUpdateListeners.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method searches for music based on a given keyword and page number.
|
||||
* It initializes the music content center if it's not already created.
|
||||
*
|
||||
* @param keyword The keyword to search for music
|
||||
* @param page The page number of the search results
|
||||
*/
|
||||
public void searchMusic(String keyword, int page) {
|
||||
// Check if musicContentCenter is initialized, if not create it
|
||||
if (musicContentCenter == null) {
|
||||
musicContentCenter = IAgoraMusicContentCenter.create(rtcEngine);
|
||||
}
|
||||
// Perform the music search with the keyword, page number and page size (20)
|
||||
musicContentCenter.searchMusic(keyword, page, 20);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,4 +5,6 @@ object CustomMsgCode {
|
||||
val CODE_TASK_APPRENTICE_JOIN_ROOM = 132
|
||||
val CODE_TASK_APPRENTICE_JOIN_ROOM_MSG = "您的师傅邀请您进入房间,您是否同意?"
|
||||
val CODE_TASK_APPRENTICE_JOIN_ROOM_MSG_REFUSE = "您的徒弟拒绝了您的邀请。"
|
||||
|
||||
val CODE_USER_SIGN_IN = "签到"
|
||||
}
|
||||
@@ -16,12 +16,14 @@ import com.scwang.smartrefresh.layout.header.ClassicsHeader
|
||||
import com.xscm.modulemain.activity.login.activity.ImproveInfoActivity
|
||||
import com.xscm.modulemain.activity.room.activity.RoomActivity
|
||||
import com.xscm.modulemain.dialog.InviteDialog
|
||||
import com.xscm.modulemain.dialog.SignInDialog
|
||||
import com.xscm.modulemain.manager.RoomManager
|
||||
import com.xscm.modulemain.utils.TimerManager
|
||||
import com.xscm.modulemain.widget.WheatLayoutSingManager
|
||||
import com.xscm.moduleutil.base.CommonAppContext
|
||||
import com.xscm.moduleutil.bean.IndexRecommendRoom
|
||||
import com.xscm.moduleutil.bean.RoomMessageEvent
|
||||
import com.xscm.moduleutil.bean.TasksSignStatus
|
||||
import com.xscm.moduleutil.dialog.ConfirmDialog
|
||||
import com.xscm.moduleutil.http.BaseObserver
|
||||
import com.xscm.moduleutil.http.RetrofitClient
|
||||
@@ -108,6 +110,39 @@ open class Application : CommonAppContext() {
|
||||
initImMsg()
|
||||
}
|
||||
|
||||
|
||||
fun userSignIn(){
|
||||
if (isKeepScreenOn)
|
||||
return
|
||||
TimerManager.scheduleTimer(CustomMsgCode.CODE_USER_SIGN_IN,60,TimeUnit.SECONDS, onTimeUp = {
|
||||
RetrofitClient.getInstance().tasksSignStatus(object : BaseObserver<TasksSignStatus>() {
|
||||
override fun onSubscribe(d: Disposable) {
|
||||
|
||||
}
|
||||
|
||||
override fun onNext(t: TasksSignStatus) {
|
||||
if (t.status == 1) {
|
||||
|
||||
} else {
|
||||
var activity:Activity? = null
|
||||
if (ActivityUtils.getTopActivity() != null){
|
||||
activity = ActivityUtils.getTopActivity()
|
||||
}
|
||||
if (activity == null)
|
||||
return
|
||||
|
||||
if (!activity.isFinishing && !activity.isDestroyed) {
|
||||
val signInDialog = SignInDialog(getContext())
|
||||
signInDialog.setOnCloseListener {
|
||||
null
|
||||
}
|
||||
signInDialog.show()
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 自定义 LeakCanary 配置(解决误报、优化检测规则)
|
||||
*/
|
||||
|
||||
@@ -206,6 +206,8 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
||||
MessageListenerSingleton.getInstance().ensureListenersAdded();
|
||||
CommonAppContext.getInstance().upMqtt();
|
||||
Application.Companion.getInstance().bgToForeground();
|
||||
//签到领取金币
|
||||
Application.Companion.getInstance().userSignIn();
|
||||
//delete downloaded old Apk
|
||||
ApkUtil.Companion.deleteOldApk(this, getExternalCacheDir().getAbsolutePath() + "/yusheng.apk");
|
||||
}
|
||||
|
||||
@@ -192,19 +192,20 @@ public class VoiceFragment extends BaseMvpFragment<VoicePresenter, FragmentVoice
|
||||
|
||||
@Override
|
||||
public void tasksSignStatus(TasksSignStatus tasksSignStatus) {
|
||||
if (tasksSignStatus.getStatus()==1){
|
||||
MvpPre.activitiesPermission();
|
||||
}else {
|
||||
SignInDialog signInDialog = new SignInDialog(getContext());
|
||||
signInDialog.setOnCloseListener(new Function0<Unit>() {
|
||||
@Override
|
||||
public Unit invoke() {
|
||||
MvpPre.activitiesPermission();
|
||||
return null;
|
||||
}
|
||||
});
|
||||
signInDialog.show();
|
||||
}
|
||||
MvpPre.activitiesPermission();
|
||||
// if (tasksSignStatus.getStatus()==1){
|
||||
// MvpPre.activitiesPermission();
|
||||
// }else {
|
||||
// SignInDialog signInDialog = new SignInDialog(getContext());
|
||||
// signInDialog.setOnCloseListener(new Function0<Unit>() {
|
||||
// @Override
|
||||
// public Unit invoke() {
|
||||
// MvpPre.activitiesPermission();
|
||||
// return null;
|
||||
// }
|
||||
// });
|
||||
// signInDialog.show();
|
||||
// }
|
||||
}
|
||||
|
||||
private void setDialog(){
|
||||
|
||||
@@ -129,7 +129,7 @@ android {
|
||||
|
||||
debug {
|
||||
debuggable true
|
||||
minifyEnabled true
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
signingConfig signingConfigs.debug
|
||||
|
||||
|
||||
Reference in New Issue
Block a user