Commit b850da15 by ydl

backup

parent 44eeea65
......@@ -10,7 +10,7 @@ ext {
"m-fm" : "0.0.30.00",
"m-user" : "0.0.60.20",
"m-home" : "0.0.22.18",
"m-im" : "0.0.18.10",
"m-im" : "0.0.18.11",
"m-dynamic" : "0.0.7.70",
"m-article" : "0.0.0.6",
......@@ -33,7 +33,7 @@ ext {
//-------------- 功能组件 --------------
//第一步
"ydl-platform" : "0.0.39.34",
"ydl-platform" : "0.0.39.39",
//第二步 若干
"ydl-webview" : "0.0.38.32",
......@@ -114,7 +114,7 @@ ext {
//-------------- 功能组件 --------------
//第一步
"ydl-platform" : "0.0.39.34",
"ydl-platform" : "0.0.39.39",
//第二步 若干
"ydl-webview" : "0.0.38.31",
......
......@@ -9,6 +9,7 @@ import com.netease.nimlib.sdk.Observer;
import com.netease.nimlib.sdk.avchat.AVChatManager;
import com.netease.nimlib.sdk.avchat.constant.AVChatControlCommand;
import com.netease.nimlib.sdk.avchat.model.AVChatData;
import com.ydl.ydlcommon.base.BaseActivityMgr;
import com.yidianling.avchatkit.activity.AVChatActivity;
import com.yidianling.avchatkit.common.log.ILogUtil;
import com.yidianling.avchatkit.common.log.LogUtil;
......@@ -178,13 +179,16 @@ public class AVChatKit {
String extra = data.getExtra();
Log.e("Extra", "Extra Message->" + extra);
if (PhoneCallStateObserver.getInstance().getPhoneCallState() != PhoneCallStateObserver.PhoneCallStateEnum.IDLE
|| AVChatProfile.getInstance().isAVChatting()
|| TeamAVChatProfile.sharedInstance().isTeamAVChatting()
|| AVChatManager.getInstance().getCurrentChatId() != 0) {
LogUtil.i(TAG, "reject incoming call data =" + data.toString() + " as local phone is not idle");
AVChatManager.getInstance().sendControlCommand(data.getChatId(), AVChatControlCommand.BUSY, null);
return;
}
if (BaseActivityMgr.INST.getTopActivity() instanceof AVChatActivity) {
// already open
return;
}
// 有网络来电打开AVChatActivity
AVChatProfile.getInstance().setAVChatting(true);
AVChatProfile.getInstance().launchActivity(data, userInfoProvider.getUserDisplayName(data.getAccount()), AVChatActivity.FROM_BROADCASTRECEIVER);
......
package com.ydl.ydlcommon.base;
import android.app.Activity;
import android.app.Application;
import android.os.Bundle;
import java.lang.ref.WeakReference;
/**
*
*/
public final class BaseActivityMgr implements Application.ActivityLifecycleCallbacks {
public static final BaseActivityMgr INST = new BaseActivityMgr();
private WeakReference<Activity> top;
private BaseActivityMgr() {
}
public void init(Application application) {
if (application == null) {
// do nothing
} else {
application.unregisterActivityLifecycleCallbacks(INST);
application.registerActivityLifecycleCallbacks(INST);
}
}
public Activity getTopActivity() {
return top != null ? top.get() : null;
}
@Override
public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
this.top = new WeakReference(activity);
}
@Override
public void onActivityStarted(Activity activity) {
this.top = new WeakReference(activity);
}
@Override
public void onActivityResumed(Activity activity) {
this.top = new WeakReference(activity);
}
@Override
public void onActivityPaused(Activity activity) {
}
@Override
public void onActivityStopped(Activity activity) {
}
@Override
public void onActivitySaveInstanceState(Activity activity, Bundle outState) {
}
@Override
public void onActivityDestroyed(Activity activity) {
}
}
......@@ -3,6 +3,7 @@ package com.ydl.ydlcommon.base.delegate
import android.app.Application
import android.content.Context
import com.ydl.ydlcommon.app.YdlRepository
import com.ydl.ydlcommon.base.BaseActivityMgr
import com.ydl.ydlcommon.base.config.GlobalConfig
import com.ydl.ydlcommon.base.config.IApp
import com.ydl.ydlcommon.base.config.IConfigModule
......@@ -22,6 +23,7 @@ class AppDelegate(context: Context) : IAppLifecycles,IApp{
private var mAppLifecycles: ArrayList<IAppLifecycles>? = ArrayList()
private val mActivityLifecycleForRxLifecycle = ActivityDelegate()
private val mActivityMgrLifecycle = BaseActivityMgr.INST
private var mGlobalConfig:GlobalConfig ?=null
init {
......@@ -56,6 +58,7 @@ class AppDelegate(context: Context) : IAppLifecycles,IApp{
//注册实现的 RxLifecycle 逻辑
mApplication!!.registerActivityLifecycleCallbacks(mActivityLifecycleForRxLifecycle)
mApplication!!.registerActivityLifecycleCallbacks(mActivityMgrLifecycle) //遵循单一功能原则,这个lifecycle单独用于管理获取顶部activity的功能
}
......@@ -76,6 +79,7 @@ class AppDelegate(context: Context) : IAppLifecycles,IApp{
}
override fun onTerminate(application: Application) {
mApplication!!.unregisterActivityLifecycleCallbacks(mActivityLifecycleForRxLifecycle)
mApplication!!.unregisterActivityLifecycleCallbacks(mActivityMgrLifecycle)
if (mAppLifecycles != null && mAppLifecycles!!.size > 0) {
for (lifecycle in mAppLifecycles!!) {
lifecycle.onTerminate(mApplication!!)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment