liuzhenxing1118 vor 9 Monaten
Ursprung
Commit
09885257ae

+ 17 - 3
app/src/main/AndroidManifest.xml

@@ -1,7 +1,9 @@
 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:tools="http://schemas.android.com/tools"
-    package="com.xplora.xpvideo">
+    package="com.xplora.xpvideo"
+    android:sharedUserId="android.uid.system"
+    >
 
     <application
         android:allowBackup="true"
@@ -14,14 +16,26 @@
         android:theme="@style/Theme.XPVideo"
         tools:targetApi="31">
         <activity
-            android:name=".MainActivity"
+            android:name=".activity.MainActivity"
             android:exported="true">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
-
                 <category android:name="android.intent.category.LAUNCHER" />
             </intent-filter>
         </activity>
+
+<!--        <receiver-->
+<!--            android:name=".MyReceiver"-->
+<!--            android:enabled="true"-->
+<!--            android:exported="true"-->
+<!--            android:permission="TODO">-->
+<!--            &lt;!&ndash;设置优先级&ndash;&gt;-->
+<!--            <intent-filter android:priority="100">-->
+<!--                <action android:name="com.example.broadcasttest.MY_BROADCAST"/>-->
+<!--            </intent-filter>-->
+
+<!--        </receiver>-->
+
     </application>
 
 </manifest>

+ 0 - 11
app/src/main/java/com/xplora/xpvideo/ToolUtil.java

@@ -1,11 +0,0 @@
-package com.xplora.xpvideo;
-
-import android.content.Context;
-
-public class ToolUtil {
-
-    public static int dip2px(Context context, float dpValue) {
-        float scale = context.getResources().getDisplayMetrics().density;
-        return (int) (dpValue * scale + 0.5f);
-    }
-}

+ 17 - 0
app/src/main/java/com/xplora/xpvideo/VideoApplication.java

@@ -0,0 +1,17 @@
+package com.xplora.xpvideo;
+
+import android.content.Context;
+
+public class VideoApplication extends android.app.Application {
+    private static Context sContext;
+
+    @Override
+    public void onCreate() {
+        super.onCreate();
+        sContext = getApplicationContext();
+    }
+
+    public static Context getsContext() {
+        return sContext;
+    }
+}

+ 84 - 33
app/src/main/java/com/xplora/xpvideo/MainActivity.java → app/src/main/java/com/xplora/xpvideo/activity/MainActivity.java

@@ -1,32 +1,45 @@
-package com.xplora.xpvideo;
+package com.xplora.xpvideo.activity;
 
 import androidx.constraintlayout.widget.ConstraintLayout;
 import androidx.constraintlayout.widget.ConstraintSet;
 import androidx.core.content.ContextCompat;
 import android.Manifest;
 import android.app.Activity;
+import android.content.Intent;
 import android.content.pm.PackageManager;
 import android.os.Build;
 import android.os.Bundle;
+import android.util.Log;
 import android.view.MotionEvent;
 import android.view.View;
 import android.view.ViewGroup;
+import android.view.WindowManager;
+import android.widget.Button;
+import android.widget.ImageButton;
+import android.widget.LinearLayout;
+import android.widget.RelativeLayout;
 
 import com.juphoon.cloud.JCCall;
 import com.juphoon.cloud.JCCallItem;
 import com.juphoon.cloud.JCMediaDevice;
 import com.juphoon.cloud.JCMediaDeviceVideoCanvas;
+import com.xplora.xpvideo.R;
+import com.xplora.xpvideo.manager.DatabaseUtils;
+import com.xplora.xpvideo.manager.VideoManager;
+import com.xplora.xpvideo.model.ContactBean;
+import com.xplora.xpvideo.observer.Listener;
+import com.xplora.xpvideo.utils.Constant;
+import com.xplora.xpvideo.utils.ToolsUtils;
 
 import java.util.List;
 import java.util.Timer;
 
-public class MainActivity extends Activity {
-    public VideoManager mVideoManager = null;
-    private ConstraintLayout mContentView = null;
-    private View mVideoIn = null;
-    private View mVideoInCall = null;
-    private View mInvite = null;
-    private View mAccepte = null;
+public class MainActivity extends Activity implements Listener.VideoListener {
+    private RelativeLayout mContentView = null;
+    private RelativeLayout layoutWaitting = null;
+    private LinearLayout layoutInvite = null;
+    private LinearLayout layoutAccept = null;
+    private LinearLayout layoutIng = null;
     private JCMediaDeviceVideoCanvas mLocalCanvas = null;
     private JCMediaDeviceVideoCanvas mRemoteCanvas = null;
 
@@ -34,13 +47,24 @@ public class MainActivity extends Activity {
     private Timer mTimerTask = null;
     private Timer mCallInfoTimer = null;
 
+    private int mVideoType = 0;
+    private String mVideoId = "";
+    private ContactBean mContactBean = new ContactBean();
+
+    public VideoManager mVideoManager = new VideoManager();
+
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.activity_main);
 
-        // 获取设备权限
         requestPermission();
+        initView();
+
+        mVideoType = getIntent().getIntExtra(Constant.EXTRA_VIDEO_TYPE, 0);
+        mVideoId = getIntent().getStringExtra(Constant.EXTRA_VIDEO_ID);
+        mContactBean = new DatabaseUtils().loadContact(mVideoId);
+        mVideoManager.init(this, "sk_videoId");
     }
 
     /*动态申请权限*/
@@ -54,7 +78,28 @@ public class MainActivity extends Activity {
         }
     }
 
-    private void updateUI() {
+    private void initView() {
+        mContentView = findViewById(R.id.video_bg);
+        ImageButton acceptCancel = findViewById(R.id.acceptCancel);
+        ImageButton acceptAnswer = findViewById(R.id.acceptAnswer);
+    }
+
+    @Override
+    public void onLoginCallback(boolean isOK) {
+        if (isOK) {
+            if (mVideoType == 1) {
+                mVideoManager.call(mVideoId);
+            }
+        }
+    }
+
+    @Override
+    public void onCallItemAdd() {
+
+    }
+
+    @Override
+    public void onCallItemUpdate() {
         List<JCCallItem> callItems = mVideoManager.mCall.getCallItems();
         if (callItems.size() == 0) {
             stopCallInfoTimer();
@@ -68,10 +113,6 @@ public class MainActivity extends Activity {
                 return;
             }
             boolean needAnswer = item.getDirection() == JCCall.DIRECTION_IN && item.getState() == JCCall.STATE_PENDING;
-            mVideoIn.setVisibility(item.getVideo() && needAnswer ? View.VISIBLE : View.INVISIBLE);
-            mInvite.setVisibility(item.getVideo() && needAnswer ? View.VISIBLE : View.INVISIBLE);
-            mVideoInCall.setVisibility(item.getVideo() && !needAnswer ? View.VISIBLE : View.INVISIBLE);
-            mAccepte.setVisibility(item.getVideo() && !needAnswer ? View.VISIBLE : View.INVISIBLE);
             if (item.getVideo()) {
                 dealCanvas(item);
             } else {
@@ -81,6 +122,11 @@ public class MainActivity extends Activity {
         }
     }
 
+    @Override
+    public void onCallItemRemove() {
+        finish();
+    }
+
     private void dealCanvas(JCCallItem item) {
         boolean change = false; // 是否有视频窗口变化
         if (mLocalCanvas == null && item.getUploadVideoStreamSelf()) {
@@ -128,25 +174,6 @@ public class MainActivity extends Activity {
                 mContentView.removeView(mRemoteCanvas.getVideoView());
                 mContentView.addView(mRemoteCanvas.getVideoView(), 0);
                 mContentView.addView(mLocalCanvas.getVideoView(), 1);
-                ConstraintSet constraintSet = new ConstraintSet();
-                constraintSet.clone(mContentView);
-                constraintSet.constrainWidth(mLocalCanvas.getVideoView().getId(), ToolUtil.dip2px(this, 120f));
-                constraintSet.constrainHeight(mLocalCanvas.getVideoView().getId(), ToolUtil.dip2px(this, 160f));
-                constraintSet.connect(
-                        mLocalCanvas.getVideoView().getId(),
-                        ConstraintSet.START,
-                        ConstraintSet.PARENT_ID,
-                        ConstraintSet.START,
-                        ToolUtil.dip2px(this, 8f)
-                );
-                constraintSet.connect(
-                        mLocalCanvas.getVideoView().getId(),
-                        ConstraintSet.TOP,
-                        ConstraintSet.PARENT_ID,
-                        ConstraintSet.TOP,
-                        ToolUtil.dip2px(this, 24f)
-                );
-                constraintSet.applyTo(mContentView);
             } else if (mLocalCanvas != null) {
                 mContentView.removeView(mLocalCanvas.getVideoView());
                 mContentView.addView(
@@ -182,6 +209,30 @@ public class MainActivity extends Activity {
         }
     }
 
+    private void moveView(View view, Float rawX, Float rawY) {
+        ConstraintLayout.LayoutParams params = (ConstraintLayout.LayoutParams)view.getLayoutParams();
+        WindowManager wm = (WindowManager)this.getSystemService(WINDOW_SERVICE);
+        int width = wm.getDefaultDisplay().getWidth();
+        int height = wm.getDefaultDisplay().getHeight();
+        int viewwidth = ToolsUtils.dip2px(this, 128f);
+        int viewheight = ToolsUtils.dip2px(this, 184f);
+        if (rawX < viewwidth / 2) {
+            rawX = (float)(viewwidth / 2 + 8);
+        }
+        if (rawY < viewheight / 2) {
+            rawY = (float)(viewwidth / 2 + 24);
+        }
+        if (rawX > width - viewwidth / 2) {
+            rawX = (float)(width - viewwidth / 2);
+        }
+        if (rawY > height - viewheight / 2) {
+            rawY = (float)(height - viewheight / 2);
+        }
+        params.leftMargin = (int)(rawX - viewwidth / 2);
+        params.topMargin = (int)(rawY - viewheight / 2);
+        view.setLayoutParams(params);
+    }
+
     private void startCallInfoTimer() {
         if (mCallInfoTimer != null) {
             stopCallInfoTimer();

+ 48 - 0
app/src/main/java/com/xplora/xpvideo/manager/DatabaseUtils.java

@@ -0,0 +1,48 @@
+package com.xplora.xpvideo.manager;
+
+import android.annotation.SuppressLint;
+import android.database.Cursor;
+import android.net.Uri;
+import android.util.Log;
+
+import com.xplora.xpvideo.VideoApplication;
+import com.xplora.xpvideo.model.ContactBean;
+import com.xplora.xpvideo.utils.MetaData;
+import com.xplora.xpvideo.utils.ToolsUtils;
+
+import java.util.ArrayList;
+
+public class DatabaseUtils {
+    public String TAG = "losion / xpvideo :" + getClass().getSimpleName();
+    public DatabaseUtils() {}
+
+    @SuppressLint("Range")
+    public ContactBean loadContact(String userId) {
+        ArrayList<ContactBean> arrayList = new ArrayList<>();
+        Uri uri = Uri.parse(MetaData.DB_CONTACTS + "id" + "/" + userId);
+        Cursor cursor = VideoApplication.getsContext().getContentResolver().query(uri, null, null, null, null);
+        if (cursor == null) {
+            Log.d(TAG, "loadContact: cursor == null");
+            return null;
+        }
+        if (!cursor.moveToFirst()) {
+            Log.d(TAG, "loadContact: cursor.moveToFirst() false");
+            cursor.close();
+            return null;
+        }
+        ContactBean bean = new ContactBean();
+        bean._id = cursor.getLong(cursor.getColumnIndex("_id"));
+        bean.id = cursor.getString(cursor.getColumnIndex("id"));
+        bean.userId = cursor.getString(cursor.getColumnIndex("userId"));
+        bean.name = cursor.getString(cursor.getColumnIndex("name"));
+        bean.profile = cursor.getString(cursor.getColumnIndex("profile"));
+        bean.profilePath = cursor.getString(cursor.getColumnIndex("profilePath"));
+        bean.phoneNumber = cursor.getString(cursor.getColumnIndex("phoneNumber"));
+        bean.countryPN = cursor.getString(cursor.getColumnIndex("countryPN"));
+        bean.type = ToolsUtils.parseInt(cursor.getString(cursor.getColumnIndex("type")));
+        bean.rate = ToolsUtils.parseInt(cursor.getString(cursor.getColumnIndex("rate")));
+        bean.unRead = ToolsUtils.parseInt(cursor.getString(cursor.getColumnIndex("unRead")));
+        cursor.close();
+        return bean;
+    }
+}

+ 58 - 21
app/src/main/java/com/xplora/xpvideo/VideoManager.java → app/src/main/java/com/xplora/xpvideo/manager/VideoManager.java

@@ -1,6 +1,9 @@
-package com.xplora.xpvideo;
+package com.xplora.xpvideo.manager;
 
 import android.content.Context;
+import android.os.Handler;
+import android.util.Log;
+
 import com.juphoon.cloud.JCCall;
 import com.juphoon.cloud.JCCallCallback;
 import com.juphoon.cloud.JCCallItem;
@@ -11,16 +14,32 @@ import com.juphoon.cloud.JCMediaDeviceCallback;
 import com.juphoon.cloud.JCMediaDeviceVideoCanvas;
 import com.juphoon.cloud.LoginParam;
 import com.juphoon.cloud.MediaConfig;
+import com.xplora.xpvideo.observer.Listener;
 
 public class VideoManager implements JCClientCallback, JCCallCallback, JCMediaDeviceCallback {
+    private Listener.VideoListener mVideoListener = null;
     private static final String APP_KEY_JUPHOON = "99c9063b9f54482e1d586e08";
-    private static final String TAG = "losion / xpvideo / MainActivity";
+    private static final String TAG = "losion / xpvideo: ";
     private JCClient mClient = null;
     public JCMediaDevice mMediaDevice = null;
     public JCCall mCall = null;
+    private String mUserId = "";
+
+    public void init(Context context, String userId) {
+        Log.d(TAG, "init: ");
+        userId = "TK_QjZ0vC1tBa";
+        mVideoListener = (Listener.VideoListener)context;
+        mUserId = userId;
+
+        boolean isOK = initJuphoon(context);
+        if (isOK) {
+            loginJuphoon(userId);
+        }
+    }
 
     // 初始化函数
-    public boolean initJuphoon(Context context) {
+    private boolean initJuphoon(Context context) {
+        Log.d(TAG, "initJuphoon: ");
         // 登录类
         mClient = JCClient.create(context, APP_KEY_JUPHOON, this, null);
         mMediaDevice = JCMediaDevice.create(mClient,this);
@@ -30,15 +49,17 @@ public class VideoManager implements JCClientCallback, JCCallCallback, JCMediaDe
         return mClient.getState() == JCClient.STATE_IDLE;
     }
 
-    public void loginJuphoon() {
+    public void loginJuphoon(String userId) {
+        Log.d(TAG, "loginJuphoon: " + userId);
         LoginParam loginParam = new LoginParam();
         // 发起登录
-        mClient.login("userID", "123456", loginParam);
+        mClient.login(userId, "123456", loginParam);
     }
 
-    private void actionCall(String userId) {
+    public void call(String callId) {
         // 发起语音呼叫
-        mCall.call(userId, true , new JCCall.CallParam("extraParam", "ticket"));
+        callId = "f471b2a1-0e5e-4796-8949-7a4cfeac5df3";
+        mCall.call(callId, true , new JCCall.CallParam("extraParam", "ticket"));
     }
 
     public JCCallItem getActiveCall() {
@@ -51,29 +72,35 @@ public class VideoManager implements JCClientCallback, JCCallCallback, JCMediaDe
 
     @Override
     public void onLogin(boolean result, int reason) {
+        Log.d(TAG, "onLogin: " + result + " reason:" + reason);
         if (result) {// 登录成功
-
-        }
-        if (reason == JCClient.REASON_AUTH) {// 账号密码错误
-
+            if (mVideoListener != null) {
+                mVideoListener.onLoginCallback(true);
+            }
+        } else if (reason == JCClient.REASON_AUTH) {// 账号密码错误
+            if (mVideoListener != null) {
+                mVideoListener.onLoginCallback(false);
+            }
+        } else if (reason != JCClient.REASON_NONE && reason != JCClient.REASON_STATE_CANNOT_LOGIN) {
+            //重新登录
+            new Handler().postDelayed(new Runnable() {
+                @Override
+                public void run() {
+                    loginJuphoon(mUserId);
+                }
+            }, 5000);
         }
     }
 
     @Override
     public void onLogout(int reason) {
-
+        Log.d(TAG, "onLogout: " + 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) { // 登出中
-
+            loginJuphoon(this.mUserId);
         }
     }
 
@@ -89,19 +116,29 @@ public class VideoManager implements JCClientCallback, JCCallCallback, JCMediaDe
 
     @Override
     public void onCallItemAdd(JCCallItem item) {
+        Log.d(TAG, "onCallItemAdd");
         if (mCall.getCallItems().size() > 0) {
             String userId = item.getUserId();
+            if (mVideoListener != null) {
+                mVideoListener.onCallItemAdd();
+            }
         }
     }
 
     @Override
     public void onCallItemRemove(JCCallItem item, int reason, String description) {
-
+        Log.d(TAG, "onCallItemRemove");
+        if (mVideoListener != null) {
+            mVideoListener.onCallItemRemove();
+        }
     }
 
     @Override
     public void onCallItemUpdate(JCCallItem item, JCCallItem.ChangeParam changeParam) {
-
+        Log.d(TAG, "onCallItemUpdate");
+        if (mVideoListener != null) {
+            mVideoListener.onCallItemUpdate();
+        }
     }
 
     @Override

+ 6 - 0
app/src/main/java/com/xplora/xpvideo/model/BaseBean.java

@@ -0,0 +1,6 @@
+package com.xplora.xpvideo.model;
+
+import java.io.Serializable;
+
+public class BaseBean implements Serializable {
+}

+ 27 - 0
app/src/main/java/com/xplora/xpvideo/model/ContactBean.java

@@ -0,0 +1,27 @@
+package com.xplora.xpvideo.model;
+
+public class ContactBean extends BaseBean {
+    public long _id = 0;
+    public String id = "";
+    public String userId = "";
+    public String name = "";
+    public String profile = ""; //头像
+    public String profilePath = "";//头像本地路径
+    public String phoneNumber = "";
+    public String countryPN = "";
+    public int rate = 0;
+    public int unRead = 0;
+
+    // 1 : First guardian(SOS target)
+    // 2 : Second guardian
+    // 3 : General contact(Not member of XPLORA server)
+    // 4 : Friend
+    public int type = 0;
+
+    public String beanToString() {
+        return "_id:" + _id + " id:" + id + " type:" + type + " userId:" + userId +
+                " name:" + name + " profilePath:" + profilePath +
+                " countryPN:" + countryPN + " phoneNumber : " + phoneNumber +
+                " unRead:" + unRead;
+    }
+}

+ 11 - 0
app/src/main/java/com/xplora/xpvideo/observer/Listener.java

@@ -0,0 +1,11 @@
+package com.xplora.xpvideo.observer;
+
+public class Listener {
+    public interface VideoListener {
+        void onLoginCallback(boolean isOK);
+        void onCallItemAdd();
+        void onCallItemUpdate();
+        void onCallItemRemove();
+    }
+}
+

+ 24 - 0
app/src/main/java/com/xplora/xpvideo/observer/VideoReceiver.java

@@ -0,0 +1,24 @@
+package com.xplora.xpvideo.observer;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+
+public class VideoReceiver extends BroadcastReceiver {
+    @Override
+    public void onReceive(Context context, Intent intent) {
+
+        abortBroadcast();
+    }
+
+//    private void initReceiver() {
+//        myReceiver = new VideoReceiver();
+//        IntentFilter intentFilter = new IntentFilter();
+//        intentFilter.addAction("com.example.broadcasttest.MY_BROADCAST");
+//        registerReceiver(myReceiver,intentFilter);
+//    }
+//
+//    private  void releaseReciver() {
+//        unregisterReceiver(myReceiver);
+//    }
+}

+ 6 - 0
app/src/main/java/com/xplora/xpvideo/utils/Constant.java

@@ -0,0 +1,6 @@
+package com.xplora.xpvideo.utils;
+
+public class Constant {
+    public final static String EXTRA_VIDEO_TYPE = "ExtraVideoType";
+    public final static String EXTRA_VIDEO_ID = "ExtraVideoId";
+}

+ 7 - 0
app/src/main/java/com/xplora/xpvideo/utils/MetaData.java

@@ -0,0 +1,7 @@
+package com.xplora.xpvideo.utils;
+
+public class MetaData {
+    public final static String AUTHORITIES_CONTACTS = "content://com.xplora.WatchContactProvider";
+    public final static String AUTHORITIES_CHAT = "content://com.xplora.WatchChatProvider";
+    public final static String DB_CONTACTS = AUTHORITIES_CONTACTS + "/contact";
+}

+ 23 - 0
app/src/main/java/com/xplora/xpvideo/utils/ToolsUtils.java

@@ -0,0 +1,23 @@
+package com.xplora.xpvideo.utils;
+
+import android.content.Context;
+
+public class ToolsUtils {
+
+    public static int dip2px(Context context, float dpValue) {
+        float scale = context.getResources().getDisplayMetrics().density;
+        return (int) (dpValue * scale + 0.5f);
+    }
+
+    public static int parseInt(String s) {
+        if (s == null || s.isEmpty())
+            return 0;
+        return Integer.parseInt(s);
+    }
+
+    public static int parseInt(String s, int defaultValue) {
+        if (s.isEmpty())
+            return defaultValue;
+        return Integer.parseInt(s);
+    }
+}

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

@@ -1,171 +0,0 @@
-<?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>

+ 30 - 13
app/src/main/res/layout/activity_main.xml

@@ -1,18 +1,35 @@
 <?xml version="1.0" encoding="utf-8"?>
-<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
+<RelativeLayout 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"
-    tools:context=".MainActivity">
+    android:layout_height="match_parent">
 
-    <TextView
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:text="Hello World!"
-        app:layout_constraintBottom_toBottomOf="parent"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toTopOf="parent" />
+    <RelativeLayout
+        android:id="@+id/video_bg"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent">
 
-</androidx.constraintlayout.widget.ConstraintLayout>
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_alignParentBottom="true"
+            android:layout_marginBottom="20dp"
+            >
+
+            <ImageButton
+                android:id="@+id/acceptCancel"
+                android:layout_width="68dp"
+                android:layout_height="68dp"
+                android:src="@drawable/hangup"/>
+
+            <ImageButton
+                android:id="@+id/acceptAnswer"
+                android:layout_width="68dp"
+                android:layout_height="68dp"
+                android:src="@drawable/answer"/>
+
+        </LinearLayout>
+
+    </RelativeLayout>
+
+</RelativeLayout>