liuzhenxing1118 hai 9 meses
pai
achega
1e32147f44

+ 8 - 0
.idea/misc.xml

@@ -3,6 +3,7 @@
   <component name="DesignSurface">
     <option name="filePathToZoomLevelMap">
       <map>
+        <entry key="app/src/main/res/layout/activity_juphoon_call.xml" value="0.3885416666666667" />
         <entry key="app/src/main/res/layout/activity_main.xml" value="0.18211752786220872" />
       </map>
     </option>
@@ -13,4 +14,11 @@
   <component name="ProjectType">
     <option name="id" value="Android" />
   </component>
+  <component name="SuppressABINotification">
+    <option name="modulesWithSuppressedNotConfigured">
+      <set>
+        <option value="XPVideo.app" />
+      </set>
+    </option>
+  </component>
 </project>

+ 1 - 162
app/src/main/java/com/xplora/xpvideo/MainActivity.java

@@ -1,34 +1,13 @@
 package com.xplora.xpvideo;
 
-import androidx.appcompat.app.AppCompatActivity;
 import androidx.core.content.ContextCompat;
-
 import android.Manifest;
 import android.app.Activity;
-import android.content.Context;
 import android.content.pm.PackageManager;
 import android.os.Build;
 import android.os.Bundle;
-import android.util.Log;
-
-import com.juphoon.cloud.JCCall;
-import com.juphoon.cloud.JCCallCallback;
-import com.juphoon.cloud.JCCallItem;
-import com.juphoon.cloud.JCClient;
-import com.juphoon.cloud.JCClientCallback;
-import com.juphoon.cloud.JCMediaDevice;
-import com.juphoon.cloud.JCMediaDeviceCallback;
-import com.juphoon.cloud.JCMediaDeviceVideoCanvas;
-import com.juphoon.cloud.LoginParam;
-import com.juphoon.cloud.MediaConfig;
 
-
-public class MainActivity extends Activity implements JCClientCallback, JCCallCallback, JCMediaDeviceCallback {
-    private static final String APP_KEY_JUPHOON = "99c9063b9f54482e1d586e08";
-    private static final String TAG = "losion / xpvideo / MainActivity";
-    private JCClient mClient = null;
-    private JCMediaDevice mMediaDevice = null;
-    private JCCall mCall = null;
+public class MainActivity extends Activity {
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
@@ -39,23 +18,6 @@ public class MainActivity extends Activity implements JCClientCallback, JCCallCa
         requestPermission();
     }
 
-    // 初始化函数
-    public boolean initJuphoon(Context context) {
-        // 登录类
-        mClient = JCClient.create(context, APP_KEY_JUPHOON, this, null);
-        mMediaDevice = JCMediaDevice.create(mClient,this);
-        mCall = JCCall.create(mClient, mMediaDevice, this);
-        mCall.updateMediaConfig(MediaConfig.generateByMode(MediaConfig.MODE_INTELLIGENT_HARDWARE_SMALL));
-        // 获取初始化状态(用来判断初始化状态)
-        return mClient.getState() == JCClient.STATE_IDLE;
-    }
-
-    public void loginJuphoon() {
-        LoginParam loginParam = new LoginParam();
-        // 发起登录
-        mClient.login("userID", "123456", loginParam);
-    }
-
     /*动态申请权限*/
     private void requestPermission() {
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
@@ -66,127 +28,4 @@ public class MainActivity extends Activity implements JCClientCallback, JCCallCa
             }
         }
     }
-
-    private void actionCall() {
-        // 发起语音呼叫
-        mCall.call("userID", true , new JCCall.CallParam("extraParam", "ticket"));
-    }
-
-    @Override
-    public void onLogin(boolean result, int reason) {
-        if (result) {// 登录成功
-
-        }
-        if (reason == JCClient.REASON_AUTH) {// 账号密码错误
-
-        }
-    }
-
-    @Override
-    public void onLogout(int reason) {
-
-    }
-
-    @Override
-    public void onClientStateChange(int state, int oldState) {
-        if (state == JCClient.STATE_IDLE) { // 未登录
-
-        } else if (state == JCClient.STATE_LOGINING) { // 正在登录
-
-        } else if (state == JCClient.STATE_LOGINED) { // 登录成功
-
-        } else if (state == JCClient.STATE_LOGOUTING) { // 登出中
-
-        }
-    }
-
-    @Override
-    public void onOnlineMessageSendResult(int operationId, boolean result) {
-
-    }
-
-    @Override
-    public void onOnlineMessageReceive(String userId, String content) {
-
-    }
-
-    @Override
-    public void onCallItemAdd(JCCallItem item) {
-
-    }
-
-    @Override
-    public void onCallItemRemove(JCCallItem item, int reason, String description) {
-
-    }
-
-    @Override
-    public void onCallItemUpdate(JCCallItem item, JCCallItem.ChangeParam changeParam) {
-
-    }
-
-    @Override
-    public void onMessageReceive(String type, String content, JCCallItem item) {
-
-    }
-
-    @Override
-    public void onMissedCallItem(JCCallItem item) {
-
-    }
-
-    @Override
-    public void onDtmfReceived(JCCallItem item, int value) {
-
-    }
-
-    @Override
-    public void onEarlyMediaReceived(JCCallItem item) {
-
-    }
-
-    @Override
-    public void onSipRingInfoReceived(JCCallItem item, String callSipType) {
-
-    }
-
-    @Override
-    public void onCameraUpdate() {
-
-    }
-
-    @Override
-    public void onAudioOutputTypeChange(int audioRouteType) {
-
-    }
-
-    @Override
-    public void onRenderReceived(JCMediaDeviceVideoCanvas canvas) {
-
-    }
-
-    @Override
-    public void onRenderStart(JCMediaDeviceVideoCanvas canvas) {
-
-    }
-
-    @Override
-    public void onVideoError(JCMediaDeviceVideoCanvas canvas) {
-
-    }
-
-    @Override
-    public void onAudioError(boolean background) {
-
-    }
-
-    @Override
-    public void onAudioResume() {
-
-    }
-
-    @Override
-    public void onNeedKeyFrame() {
-
-    }
 }

+ 163 - 0
app/src/main/java/com/xplora/xpvideo/VideoManager.java

@@ -0,0 +1,163 @@
+package com.xplora.xpvideo;
+
+import android.content.Context;
+import com.juphoon.cloud.JCCall;
+import com.juphoon.cloud.JCCallCallback;
+import com.juphoon.cloud.JCCallItem;
+import com.juphoon.cloud.JCClient;
+import com.juphoon.cloud.JCClientCallback;
+import com.juphoon.cloud.JCMediaDevice;
+import com.juphoon.cloud.JCMediaDeviceCallback;
+import com.juphoon.cloud.JCMediaDeviceVideoCanvas;
+import com.juphoon.cloud.LoginParam;
+import com.juphoon.cloud.MediaConfig;
+
+public class VideoManager implements JCClientCallback, JCCallCallback, JCMediaDeviceCallback {
+    private static final String APP_KEY_JUPHOON = "99c9063b9f54482e1d586e08";
+    private static final String TAG = "losion / xpvideo / MainActivity";
+    private JCClient mClient = null;
+    private JCMediaDevice mMediaDevice = null;
+    private JCCall mCall = null;
+
+    // 初始化函数
+    public boolean initJuphoon(Context context) {
+        // 登录类
+        mClient = JCClient.create(context, APP_KEY_JUPHOON, this, null);
+        mMediaDevice = JCMediaDevice.create(mClient,this);
+        mCall = JCCall.create(mClient, mMediaDevice, this);
+        mCall.updateMediaConfig(MediaConfig.generateByMode(MediaConfig.MODE_INTELLIGENT_HARDWARE_SMALL));
+        // 获取初始化状态(用来判断初始化状态)
+        return mClient.getState() == JCClient.STATE_IDLE;
+    }
+
+    public void loginJuphoon() {
+        LoginParam loginParam = new LoginParam();
+        // 发起登录
+        mClient.login("userID", "123456", loginParam);
+    }
+
+    private void actionCall(String userId) {
+        // 发起语音呼叫
+        mCall.call(userId, true , new JCCall.CallParam("extraParam", "ticket"));
+    }
+
+    @Override
+    public void onLogin(boolean result, int reason) {
+        if (result) {// 登录成功
+
+        }
+        if (reason == JCClient.REASON_AUTH) {// 账号密码错误
+
+        }
+    }
+
+    @Override
+    public void onLogout(int reason) {
+
+    }
+
+    @Override
+    public void onClientStateChange(int state, int oldState) {
+        if (state == JCClient.STATE_IDLE) { // 未登录
+
+        } else if (state == JCClient.STATE_LOGINING) { // 正在登录
+
+        } else if (state == JCClient.STATE_LOGINED) { // 登录成功
+
+        } else if (state == JCClient.STATE_LOGOUTING) { // 登出中
+
+        }
+    }
+
+    @Override
+    public void onOnlineMessageSendResult(int operationId, boolean result) {
+
+    }
+
+    @Override
+    public void onOnlineMessageReceive(String userId, String content) {
+
+    }
+
+    @Override
+    public void onCallItemAdd(JCCallItem item) {
+        if (mCall.getCallItems().size() > 0) {
+            String userId = item.getUserId();
+        }
+    }
+
+    @Override
+    public void onCallItemRemove(JCCallItem item, int reason, String description) {
+
+    }
+
+    @Override
+    public void onCallItemUpdate(JCCallItem item, JCCallItem.ChangeParam changeParam) {
+
+    }
+
+    @Override
+    public void onMessageReceive(String type, String content, JCCallItem item) {
+
+    }
+
+    @Override
+    public void onMissedCallItem(JCCallItem item) {
+
+    }
+
+    @Override
+    public void onDtmfReceived(JCCallItem item, int value) {
+
+    }
+
+    @Override
+    public void onEarlyMediaReceived(JCCallItem item) {
+
+    }
+
+    @Override
+    public void onSipRingInfoReceived(JCCallItem item, String callSipType) {
+
+    }
+
+    @Override
+    public void onCameraUpdate() {
+
+    }
+
+    @Override
+    public void onAudioOutputTypeChange(int audioRouteType) {
+
+    }
+
+    @Override
+    public void onRenderReceived(JCMediaDeviceVideoCanvas canvas) {
+
+    }
+
+    @Override
+    public void onRenderStart(JCMediaDeviceVideoCanvas canvas) {
+
+    }
+
+    @Override
+    public void onVideoError(JCMediaDeviceVideoCanvas canvas) {
+
+    }
+
+    @Override
+    public void onAudioError(boolean background) {
+
+    }
+
+    @Override
+    public void onAudioResume() {
+
+    }
+
+    @Override
+    public void onNeedKeyFrame() {
+
+    }
+}

BIN=BIN
app/src/main/res/drawable/answer.png


BIN=BIN
app/src/main/res/drawable/camera.png


BIN=BIN
app/src/main/res/drawable/default_avatar.png


BIN=BIN
app/src/main/res/drawable/hangup.png


+ 171 - 0
app/src/main/res/layout/activity_juphoon_call.xml

@@ -0,0 +1,171 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+
+    <RelativeLayout
+        android:id="@+id/rl_callmain"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent">
+
+
+        <RelativeLayout
+            android:id="@+id/invite_lyt"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:background="#00000000"
+            android:layout_marginTop="27dp">
+
+            <ImageView
+                android:id="@+id/icon"
+                android:background="@drawable/default_avatar"
+                android:layout_marginTop="40dp"
+                android:layout_width="20dp"
+                android:layout_height="20dp" />
+
+            <TextView
+                android:id="@+id/name"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_toRightOf="@+id/icon"
+                android:layout_alignTop="@+id/icon"
+                android:layout_marginLeft="20dp"
+                android:textColor="@color/white"
+                android:textSize="32sp"
+                android:textStyle="bold"/>
+
+            <TextView
+                android:id="@+id/desc"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_toRightOf="@+id/icon"
+                android:layout_alignBottom="@+id/icon"
+                android:layout_marginLeft="20dp"
+                android:textColor="@color/white"
+                android:textSize="14sp"
+                android:text="@string/invite"/>
+
+        </RelativeLayout>
+
+        <RelativeLayout
+            android:id="@+id/accepte_lyt"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:background="#00000000"
+            android:layout_marginTop="27dp">
+
+            <TextView
+                android:id="@+id/name2"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_centerHorizontal="true"
+                android:textColor="@color/white"
+                android:layout_marginTop="40dp"
+                android:textSize="32sp"
+                android:textStyle="bold"/>
+
+            <TextView
+                android:id="@+id/time"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_centerHorizontal="true"
+                android:layout_marginTop="5dp"
+                android:layout_below="@+id/name2"
+                android:textColor="@color/white"
+                android:textSize="14sp"/>
+            <TextView
+                android:id="@+id/tv_network"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_centerHorizontal="true"
+                android:layout_marginTop="5dp"
+                android:layout_below="@+id/time"
+                android:textColor="@color/white"
+                android:textSize="14sp"/>
+
+        </RelativeLayout>
+
+
+
+        <LinearLayout
+            android:id="@+id/lyt_wait_answer"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginBottom="90dp"
+            android:visibility="gone"
+            android:layout_alignParentBottom="true">
+
+
+            <RelativeLayout
+                android:id="@+id/rl_callcancel"
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:layout_weight="1">
+                <ImageView
+                    android:id="@+id/cancel"
+                    android:layout_width="68dp"
+                    android:layout_height="68dp"
+                    android:layout_centerHorizontal="true"
+                    android:onClick="onTerm"
+                    android:src="@drawable/hangup"/>
+            </RelativeLayout>
+            <RelativeLayout
+                android:id="@+id/rl_callanswer"
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:layout_weight="1">
+                <ImageView
+                    android:id="@+id/answer"
+                    android:layout_width="68dp"
+                    android:layout_height="68dp"
+                    android:onClick="onVideoAnswer"
+                    android:layout_centerHorizontal="true"
+                    android:src="@drawable/answer"/>
+            </RelativeLayout>
+
+
+        </LinearLayout>
+
+
+        <LinearLayout
+            android:id="@+id/lyt_calling"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginBottom="90dp"
+            android:layout_alignParentBottom="true">
+
+
+            <RelativeLayout
+                android:id="@+id/rl_callhangup"
+                android:layout_width="0dp"
+                android:layout_height="wrap_content"
+                android:layout_weight="1">
+                <ImageView
+                    android:id="@+id/hung_up"
+                    android:layout_width="68dp"
+                    android:layout_height="68dp"
+                    android:layout_centerHorizontal="true"
+                    android:onClick="onTerm"
+                    android:src="@drawable/hangup"/>
+                <RelativeLayout
+                    android:id="@+id/rl_callcamera"
+                    android:layout_width="match_parent"
+                    android:layout_height="68dp"
+                    android:layout_toRightOf="@+id/hung_up">
+                    <ImageView
+                        android:id="@+id/camera"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_centerInParent="true"
+                        android:onClick="onSwitchCamera"
+                        android:src="@drawable/camera"/>
+                </RelativeLayout>
+            </RelativeLayout>
+
+
+        </LinearLayout>
+    </RelativeLayout>
+
+
+</androidx.constraintlayout.widget.ConstraintLayout>

+ 2 - 0
app/src/main/res/values/strings.xml

@@ -1,3 +1,5 @@
 <resources>
     <string name="app_name">XPVideo</string>
+    <string name="invite">邀请你视频通话</string>
+    <string name="calling">正在呼叫中</string>
 </resources>