Skip to content

Commit

Permalink
[superCall] 完善接听电话所需工具类
Browse files Browse the repository at this point in the history
  • Loading branch information
yangmingchuan committed Nov 17, 2020
1 parent 041df69 commit a95a456
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 208 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.maiya.leetcode.phone.interfaces

/**
* @ClassName: [ICanAddCallChangedListener]
* @Description:
*
* Created by admin at 2020-07-10
* @Email [email protected]
*/
interface ICanAddCallChangedListener {

fun onCanAddCallChanged(canAddCall: Boolean)

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.maiya.leetcode.phone.interfaces

import android.telecom.Call

/**
* @Author:fkq
* @Date: 2020-07-06 18:07
* @Description:
*/
interface IPhoneCallInterface {

fun onCallStateChanged(call: Call?, state: Int)

}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,31 +1,28 @@
package com.preface.megatron.tel.manager
package com.maiya.leetcode.phone.manager

import android.app.Activity
import android.content.Context
import android.content.Intent
import android.media.AudioManager
import android.os.Build
import android.support.annotation.RequiresApi
import android.telecom.Call
import android.telecom.TelecomManager
import android.telecom.VideoProfile
import android.text.TextUtils
import com.preface.megatron.tel.interfaces.ICanAddCallChangedListener
import com.preface.megatron.tel.interfaces.IPhoneCallInterface
import androidx.annotation.RequiresApi
import com.maiya.leetcode.MApplication
import com.maiya.leetcode.phone.interfaces.ICanAddCallChangedListener
import com.maiya.leetcode.phone.interfaces.IPhoneCallInterface
import com.maiya.leetcode.phone.utils.GlobalActivityLifecycleMonitor
import com.preface.megatron.tel.service.PhoneCallService
import com.preface.megatron.tel.view.PhoneCallActivity
import com.qsmy.business.App
import com.qsmy.business.app.base.activity_fragment.GlobalActivityLifecycleMonitor
import com.qsmy.lib.common.utils.Utils
import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.CopyOnWriteArraySet


/**
* @Author:fkq
* @Date: 2020-07-06 16:53
* @Description:
* 电话拨打管理
*/

class PhoneCallManager private constructor() {

private var audioManager: AudioManager? = null
Expand All @@ -46,7 +43,7 @@ class PhoneCallManager private constructor() {
}

init {
audioManager = App.getContext().getSystemService(Context.AUDIO_SERVICE) as? AudioManager
audioManager = MApplication().getSystemService(Context.AUDIO_SERVICE) as? AudioManager
}

fun hasDefaultCall(): Boolean = !mCallList.isNullOrEmpty()
Expand Down Expand Up @@ -82,7 +79,7 @@ class PhoneCallManager private constructor() {
}

val isForeground = GlobalActivityLifecycleMonitor.isAppOnForeground()
PhoneCallActivity.actionStart(App.getContext(), callId, isForeground)
PhoneCallActivity.actionStart(MApplication(), callId, isForeground)
}

@RequiresApi(Build.VERSION_CODES.M)
Expand All @@ -95,9 +92,6 @@ class PhoneCallManager private constructor() {
}

fun onCanAddCallChanged(canAddCall: Boolean) {
if (Utils.isEmpty(mICanAddCallChangedListener)) {
return
}
mICanAddCallChangedListener.forEach {
it?.onCanAddCallChanged(canAddCall)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ public class CustomNotifyManager {
public static final int STEP_COUNT_NOTIFY_ID = 100;
public static final String ACTION_NOTIFICATION_CLICK = "com.ACTION_NOTIFICATION_CLICK";
private static final String CHANNEL_ID = "channel_megatron_1";
private static final String CHANNEL_NAME = "荔枝铃声";
private static final String CHANNEL_NAME = "superCall";

private static final String CHANNEL_CONTENT = "荔枝铃声正在派发大量金币!";
private static final String CHANNEL_CONTENT = "SuperCall持续保护您的系统中...";

private static NotificationManager manager;
private static CustomNotifyManager instance;
Expand Down

0 comments on commit a95a456

Please sign in to comment.