智慧城市 v1.2.1版本的 MD5 值为:d4aeacb5153a2710d0b6882be5dd2b15
以下内容为反编译后的 RongCallKit.java 源代码,内容仅作参考
package io.rong.callkit;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;
import io.rong.calllib.RongCallClient;
import io.rong.calllib.RongCallCommon;
import io.rong.calllib.RongCallMissedListener;
import io.rong.calllib.RongCallSession;
import io.rong.imkit.utils.PermissionCheckUtil;
import io.rong.imkit.utils.RouteUtils;
import io.rong.imlib.RongIMClient;
import io.rong.imlib.model.Conversation;
import java.util.ArrayList;
public class RongCallKit {
private static RongCallCustomerHandlerListener customerHandlerListener;
private static GlideCallKitImageEngine kitImageEngine = new GlideCallKitImageEngine();
private static GroupMembersProvider mGroupMembersProvider;
public enum CallMediaType {
CALL_MEDIA_TYPE_AUDIO,
CALL_MEDIA_TYPE_VIDEO
}
public interface GroupMembersProvider {
ArrayList<String> getMemberList(String str, OnGroupMembersResult onGroupMembersResult);
}
public interface ICallUsersProvider {
void onGotUserList(ArrayList<String> arrayList);
}
public interface OnGroupMembersResult {
void onGotMemberList(ArrayList<String> arrayList);
}
public static String getVersion() {
return "5.1.7.1";
}
public static void startSingleCall(Context context, String str, CallMediaType callMediaType) {
if (checkEnvironment(context, callMediaType)) {
Intent intent = new Intent(callMediaType.equals(CallMediaType.CALL_MEDIA_TYPE_AUDIO) ? RongVoIPIntent.RONG_INTENT_ACTION_VOIP_SINGLEAUDIO : RongVoIPIntent.RONG_INTENT_ACTION_VOIP_SINGLEVIDEO);
intent.putExtra("conversationType", Conversation.ConversationType.PRIVATE.getName().toLowerCase());
intent.putExtra(RouteUtils.TARGET_ID, str);
intent.putExtra(BaseCallActivity.EXTRA_BUNDLE_KEY_CALLACTION, RongCallAction.ACTION_OUTGOING_CALL.getName());
intent.setPackage(context.getPackageName());
intent.setFlags(268435456);
context.startActivity(intent);
}
}
public static void startMultiCall(Context context, Conversation.ConversationType conversationType, String str, CallMediaType callMediaType, ArrayList<String> arrayList) {
if (checkEnvironment(context, callMediaType)) {
Intent intent = new Intent(callMediaType.equals(CallMediaType.CALL_MEDIA_TYPE_AUDIO) ? RongVoIPIntent.RONG_INTENT_ACTION_VOIP_MULTIAUDIO : RongVoIPIntent.RONG_INTENT_ACTION_VOIP_MULTIVIDEO);
arrayList.add(RongIMClient.getInstance().getCurrentUserId());
intent.putExtra("conversationType", conversationType.getName().toLowerCase());
intent.putExtra(RouteUtils.TARGET_ID, str);
intent.putExtra(BaseCallActivity.EXTRA_BUNDLE_KEY_CALLACTION, RongCallAction.ACTION_OUTGOING_CALL.getName());
intent.setPackage(context.getPackageName());
intent.putStringArrayListExtra("invitedUsers", arrayList);
intent.setFlags(268435456);
context.startActivity(intent);
}
}
public static ICallUsersProvider startMultiCall(final Context context, final Conversation.ConversationType conversationType, final String str, final CallMediaType callMediaType) {
return new ICallUsersProvider() {
@Override
public void onGotUserList(ArrayList<String> arrayList) {
Intent intent = new Intent(CallMediaType.this.equals(CallMediaType.CALL_MEDIA_TYPE_AUDIO) ? RongVoIPIntent.RONG_INTENT_ACTION_VOIP_MULTIAUDIO : RongVoIPIntent.RONG_INTENT_ACTION_VOIP_MULTIVIDEO);
arrayList.add(RongIMClient.getInstance().getCurrentUserId());
intent.putExtra("conversationType", conversationType.getName().toLowerCase());
intent.putExtra(RouteUtils.TARGET_ID, str);
intent.putExtra(BaseCallActivity.EXTRA_BUNDLE_KEY_CALLACTION, RongCallAction.ACTION_OUTGOING_CALL.getName());
intent.setPackage(context.getPackageName());
intent.putStringArrayListExtra("invitedUsers", arrayList);
intent.setFlags(268435456);
context.startActivity(intent);
}
};
}
public static void startMultiCall(Context context, ArrayList<String> arrayList, ArrayList<String> arrayList2, CallMediaType callMediaType) {
Intent intent = new Intent(callMediaType.equals(CallMediaType.CALL_MEDIA_TYPE_AUDIO) ? RongVoIPIntent.RONG_INTENT_ACTION_VOIP_MULTIAUDIO : RongVoIPIntent.RONG_INTENT_ACTION_VOIP_MULTIVIDEO);
arrayList.add(RongIMClient.getInstance().getCurrentUserId());
intent.putExtra("conversationType", Conversation.ConversationType.NONE.getName().toLowerCase());
intent.putExtra(BaseCallActivity.EXTRA_BUNDLE_KEY_CALLACTION, RongCallAction.ACTION_OUTGOING_CALL.getName());
intent.putStringArrayListExtra("invitedUsers", arrayList);
intent.putStringArrayListExtra("observerUsers", arrayList2);
intent.setPackage(context.getPackageName());
intent.setFlags(268435456);
context.startActivity(intent);
}
public static void startMultiCall(Context context, ArrayList<String> arrayList, CallMediaType callMediaType) {
Intent intent = new Intent(callMediaType.equals(CallMediaType.CALL_MEDIA_TYPE_AUDIO) ? RongVoIPIntent.RONG_INTENT_ACTION_VOIP_MULTIAUDIO : RongVoIPIntent.RONG_INTENT_ACTION_VOIP_MULTIVIDEO);
arrayList.add(RongIMClient.getInstance().getCurrentUserId());
intent.putExtra("conversationType", Conversation.ConversationType.NONE.getName().toLowerCase());
intent.putExtra(BaseCallActivity.EXTRA_BUNDLE_KEY_CALLACTION, RongCallAction.ACTION_OUTGOING_CALL.getName());
intent.putStringArrayListExtra("invitedUsers", arrayList);
intent.setPackage(context.getPackageName());
intent.setFlags(268435456);
context.startActivity(intent);
}
private static boolean checkEnvironment(Context context, CallMediaType callMediaType) {
String[] strArr;
if (context instanceof Activity) {
if (callMediaType.equals(CallMediaType.CALL_MEDIA_TYPE_AUDIO)) {
strArr = new String[]{"android.permission.RECORD_AUDIO"};
} else {
strArr = new String[]{"android.permission.CAMERA", "android.permission.RECORD_AUDIO"};
}
if (!PermissionCheckUtil.requestPermissions((Activity) context, strArr)) {
return false;
}
}
if (isInVoipCall(context)) {
return false;
}
if (RongIMClient.getInstance().getCurrentConnectionStatus().equals(RongIMClient.ConnectionStatusListener.ConnectionStatus.CONNECTED)) {
return true;
}
Toast.makeText(context, context.getResources().getString(R.string.rc_voip_call_network_error), 0).show();
return false;
}
public static boolean isInVoipCall(Context context) {
String string;
RongCallSession callSession = RongCallClient.getInstance().getCallSession();
if (callSession == null || callSession.getStartTime() <= 0) {
return false;
}
if (callSession.getMediaType() == RongCallCommon.CallMediaType.AUDIO) {
string = context.getResources().getString(R.string.rc_voip_call_audio_start_fail);
} else {
string = context.getResources().getString(R.string.rc_voip_call_video_start_fail);
}
Toast.makeText(context, string, 0).show();
return true;
}
public static void setGroupMemberProvider(GroupMembersProvider groupMembersProvider) {
mGroupMembersProvider = groupMembersProvider;
}
public static GroupMembersProvider getGroupMemberProvider() {
return mGroupMembersProvider;
}
public static void setCustomerHandlerListener(RongCallCustomerHandlerListener rongCallCustomerHandlerListener) {
customerHandlerListener = rongCallCustomerHandlerListener;
}
public static RongCallCustomerHandlerListener getCustomerHandlerListener() {
return customerHandlerListener;
}
public static void setRongCallMissedListener(RongCallMissedListener rongCallMissedListener) {
RongCallModule.setMissedCallListener(rongCallMissedListener);
}
public static void ignoreIncomingCall(boolean z) {
RongCallModule.ignoreIncomingCall(z);
}
public static void setMainPageActivityClass(String[] strArr) {
RongCallModule.setMainPageActivity(strArr);
}
public static void setKitImageEngine(GlideCallKitImageEngine glideCallKitImageEngine) {
kitImageEngine = glideCallKitImageEngine;
}
public static GlideCallKitImageEngine getKitImageEngine() {
return kitImageEngine;
}
public static GroupMembersProvider getmGroupMembersProvider() {
return mGroupMembersProvider;
}
}