liuzhenxing1118 hai 5 meses
pai
achega
78ea2a71a0

+ 0 - 24
.idea/misc.xml

@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
-  <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>
-  </component>
-  <component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK">
-    <output url="file://$PROJECT_DIR$/build/classes" />
-  </component>
-  <component name="ProjectType">
-    <option name="id" value="Android" />
-  </component>
-  <component name="SuppressABINotification">
-    <option name="modulesWithSuppressedNotConfigured">
-      <set>
-        <option value="XPVideo.app" />
-      </set>
-    </option>
-  </component>
-</project>

+ 2 - 2
app/src/main/java/com/xplora/xpvideo/activity/BaseActivity.java

@@ -17,15 +17,14 @@ public class BaseActivity extends Activity {
     protected void onCreate(@Nullable Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         Log.d(TAG, "onCreate: ");
-
         if (Macros.DEBUG_FULLSCREEN) {
             setFullView();
             setHardKey();
         }
-
         onCreateBase();
         initDataBase();
         initViewBase();
+        refreshViewBase();
     }
 
     @Override
@@ -44,6 +43,7 @@ public class BaseActivity extends Activity {
     protected void onStartBase() { }
     protected void initDataBase() { }
     protected void initViewBase() { }
+    protected void refreshViewBase() {};
     protected void onDestroyBase() { }
 
     private void setFullView() {

+ 87 - 41
app/src/main/java/com/xplora/xpvideo/activity/MainActivity.java

@@ -9,6 +9,7 @@ import android.os.Bundle;
 import android.os.Handler;
 import android.util.Log;
 import android.view.View;
+import android.widget.Button;
 import android.widget.ImageButton;
 import android.widget.ImageView;
 import android.widget.RelativeLayout;
@@ -46,11 +47,14 @@ public class MainActivity extends BaseActivity implements Listener.VideoListener
     private RelativeLayout mVideoLayout = null;
     private RelativeLayout mLoadingLayout = null;
     private RelativeLayout mInfoLayout = null;
+    private RelativeLayout mNameLayout = null;
+    private RelativeLayout mBottomInLayout = null;
+    private RelativeLayout mBottomOutLayout = null;
+    private RelativeLayout mBottomIngLayout = null;
     //private ImageView mIconView = null;
     private TextView mNameText = null;
     private TextView mHintText = null;
-    private ImageButton mCancelBtn = null;
-    private ImageButton mAnswerBtn = null;
+    private TextView mTimeText = null;
 
     private Timer mTimeoutTimer = null;
     private Timer mTalkingTimer = null;
@@ -65,47 +69,16 @@ public class MainActivity extends BaseActivity implements Listener.VideoListener
     private ContactBean mContactBean = new ContactBean();
 
     @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        Log.d(TAG, "onCreate: ");
-        super.onCreate(savedInstanceState);
+    protected void onCreateBase() {
+        super.onCreateBase();
         setContentView(R.layout.activity_main);
         requestPermission();
-        initView();
-        initData();
         initVideoManager();
     }
 
-    private void initView() {
-        Log.d(TAG, "initView: ");
-        mVideoLayout = findViewById(R.id.layout_video);
-        mLoadingLayout = findViewById(R.id.layout_loading);
-        mInfoLayout = findViewById(R.id.layout_info);
-        //mIconView = findViewById(R.id.iconIv);
-        mNameText = findViewById(R.id.nameTv);
-        mHintText = findViewById(R.id.hintTv);
-        mCancelBtn = findViewById(R.id.cancelBtn);
-        mAnswerBtn = findViewById(R.id.answerBtn);
-        mVideoLayout.setOnClickListener(new View.OnClickListener() {
-            @Override
-            public void onClick(View v) {
-                refreshInfoLayout(0);
-            }
-        });
-        mCancelBtn.setOnClickListener(new View.OnClickListener() {
-            @Override
-            public void onClick(View v) {
-                mVideoManager.hangup();
-            }
-        });
-        mAnswerBtn.setOnClickListener(new View.OnClickListener() {
-            @Override
-            public void onClick(View v) {
-                mVideoManager.answer();
-            }
-        });
-    }
-
-    private void initData() {
+    @Override
+    protected void initDataBase() {
+        super.initDataBase();
         if (Macros.DEBUG) {
             mVideoType = 0;
             mTargetId = "3523b1d1-8543-43d9-92c9-df663a3f147d";
@@ -115,7 +88,57 @@ public class MainActivity extends BaseActivity implements Listener.VideoListener
         }
         Log.d(TAG, "initData: VideoType:" + mVideoType + " TargetId:" + mTargetId );
         mContactBean = new DatabaseUtils().loadContact(mTargetId);
+    }
+
+    @Override
+    protected void initViewBase() {
+        super.initViewBase();
+        mVideoLayout = findViewById(R.id.layout_videoing);
+        mLoadingLayout = findViewById(R.id.layout_loading);
+        mInfoLayout = findViewById(R.id.layout_info);
+        mNameLayout = findViewById(R.id.layout_name);
+        mBottomInLayout = findViewById(R.id.layout_bottom_in);
+        mBottomOutLayout = findViewById(R.id.layout_bottom_out);
+        mBottomIngLayout = findViewById(R.id.layout_bottom_ing);
+
+        //mIconView = findViewById(R.id.iconIv);
+        mNameText = findViewById(R.id.nameTv);
+        mHintText = findViewById(R.id.hintTv);
+        mTimeText = findViewById(R.id.timeTv);
+
+        ImageButton cancelInBtn = findViewById(R.id.cancelInBtn);
+        ImageButton cancelOutBtn = findViewById(R.id.cancelOutBtn);
+        ImageButton cancelIngBtn = findViewById(R.id.cancelIngBtn);
+        ImageButton answerInBtn = findViewById(R.id.answerInBtn);
+        ImageButton voiceIngBtn = findViewById(R.id.voiceIngBtn);
+        ImageButton voiceOutBtn = findViewById(R.id.voiceOutBtn);
 
+        mVideoLayout.setOnClickListener(v -> {
+            refreshInfoLayout(0);
+        });
+        cancelInBtn.setOnClickListener(v -> {
+            mVideoManager.hangup();
+        });
+        cancelOutBtn.setOnClickListener(v -> {
+            mVideoManager.hangup();
+        });
+        cancelIngBtn.setOnClickListener(v -> {
+            mVideoManager.hangup();
+        });
+        answerInBtn.setOnClickListener(v -> {
+            mVideoManager.answer();
+        });
+        voiceIngBtn.setOnClickListener(v -> {
+
+        });
+        voiceOutBtn.setOnClickListener(v -> {
+
+        });
+    }
+
+    @Override
+    protected void refreshViewBase() {
+        super.refreshViewBase();
         //ToolsUtils.setImageView(mIconView, mContactBean.profilePath, 0, R.drawable.default_avatar);
         mNameText.setText(mContactBean.name);
         mHintText.setText(mVideoType == 0 ? R.string.invite : R.string.calling);
@@ -131,6 +154,27 @@ public class MainActivity extends BaseActivity implements Listener.VideoListener
         }
     }
 
+    private void refreshView(int step) {
+        if (step == 1) {
+            mLoadingLayout.setVisibility(View.GONE);
+            mNameLayout.setVisibility(View.VISIBLE);
+            mBottomInLayout.setVisibility(View.GONE);
+            mBottomOutLayout.setVisibility(View.VISIBLE);
+            mBottomIngLayout.setVisibility(View.GONE);
+        } else if (step == 2) {
+            mLoadingLayout.setVisibility(View.GONE);
+            mNameLayout.setVisibility(View.VISIBLE);
+            mBottomInLayout.setVisibility(View.VISIBLE);
+            mBottomOutLayout.setVisibility(View.GONE);
+            mBottomIngLayout.setVisibility(View.GONE);
+        } else if (step == 10) {
+            mVideoLayout.setVisibility(View.VISIBLE);
+            mBottomInLayout.setVisibility(View.GONE);
+            mBottomOutLayout.setVisibility(View.GONE);
+            mBottomIngLayout.setVisibility(View.VISIBLE);
+        }
+    }
+
     @Override
     public void onLoginCallback(boolean isOK) {
         Log.d(TAG, "onLoginCallback: " + isOK);
@@ -177,10 +221,12 @@ public class MainActivity extends BaseActivity implements Listener.VideoListener
         int state = item.getState();
         if (state == JCCall.STATE_INIT || state == JCCall.STATE_PENDING) {
             if (item.getDirection() == JCCall.DIRECTION_OUT) {
-                mAnswerBtn.setVisibility(View.GONE);
+                refreshView(1);
+            } else {
+                refreshView( 2);
             }
         } else {
-            mAnswerBtn.setVisibility(View.GONE);
+            refreshView(10);
         }
     }
 
@@ -333,7 +379,7 @@ public class MainActivity extends BaseActivity implements Listener.VideoListener
         long minutes = count / 60;
         long second = count %= 60;
         String text = hours > 0 ? String.format("%02d:%02d:%02d", hours, minutes, second) : String.format("%02d:%02d", minutes, second);
-        mHintText.setText(text);
+        mTimeText.setText(text);
         refreshInfoLayout(1);
     }
 

+ 10 - 0
app/src/main/res/drawable/bg_time.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<shape
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+    <!-- 填充的颜色 -->
+    <solid android:color="#66435666" />
+
+    <!-- 圆角的半径 -->
+    <corners android:radius="20dp" />
+</shape>

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


+ 104 - 73
app/src/main/res/layout/activity_main.xml

@@ -6,9 +6,10 @@
     >
 
     <RelativeLayout
-        android:id="@+id/layout_video"
+        android:id="@+id/layout_videoing"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
+        android:visibility="gone"
         >
     </RelativeLayout>
 
@@ -16,7 +17,8 @@
         android:id="@+id/layout_loading"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
-        android:gravity="center">
+        android:gravity="center"
+        >
         <TextView
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
@@ -29,15 +31,28 @@
     <RelativeLayout
         android:id="@+id/layout_info"
         android:layout_width="match_parent"
-        android:layout_height="match_parent">
-
-        <LinearLayout
+        android:layout_height="match_parent"
+        android:visibility="gone"
+        >
+        <TextView
+            android:id="@+id/timeTv"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_centerHorizontal="true"
+            android:background="@drawable/bg_time"
+            android:layout_marginTop="5dp"
+            android:textAlignment="center"
+            android:textColor="@color/white"
+            android:textSize="17sp"
+            android:paddingStart="10dp"
+            android:paddingEnd="10dp"
+            />
+        <RelativeLayout
+            android:id="@+id/layout_name"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_marginTop="25dp"
-            android:gravity="center"
-            android:orientation="vertical">
-
+            android:gravity="center">
             <TextView
                 android:id="@+id/nameTv"
                 android:layout_width="match_parent"
@@ -46,92 +61,108 @@
                 android:textColor="@color/white"
                 android:textSize="20sp"
                 android:textStyle="bold" />
-
             <TextView
                 android:id="@+id/hintTv"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
+                android:layout_below="@+id/nameTv"
                 android:layout_marginTop="1dp"
                 android:textAlignment="center"
                 android:textColor="#74777D"
                 android:textSize="17sp" />
-        </LinearLayout>
+        </RelativeLayout>
 
         <RelativeLayout
+            android:id="@+id/layout_bottom_in"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_alignParentBottom="true"
-            android:layout_marginBottom="8dp">
-
+            android:gravity="center"
+            >
             <LinearLayout
-                android:id="@+id/layout_accept"
-                android:layout_width="match_parent"
+                android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:gravity="center"
-                android:visibility="gone">
-
-                <LinearLayout
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:orientation="vertical">
-
-                    <ImageButton
-                        android:id="@+id/cancelBtn"
-                        android:layout_width="52dp"
-                        android:layout_height="52dp"
-                        android:background="@drawable/hangup" />
-
-                    <TextView
-                        android:layout_width="match_parent"
-                        android:layout_height="wrap_content"
-                        android:text="@string/btn_refuse"
-                        android:textAlignment="center"
-                        android:textColor="#FFFFFF"
-                        android:textSize="15sp" />
-                </LinearLayout>
-
-                <LinearLayout
-                    android:layout_width="wrap_content"
+                android:layout_marginStart="25dp"
+                android:orientation="vertical">
+                <ImageButton
+                    android:id="@+id/cancelInBtn"
+                    android:layout_width="52dp"
+                    android:layout_height="52dp"
+                    android:background="@drawable/hangup" />
+                <TextView
+                    android:layout_width="match_parent"
                     android:layout_height="wrap_content"
-                    android:layout_marginStart="30dp"
-                    android:orientation="vertical">
-
-                    <ImageButton
-                        android:id="@+id/answerBtn"
-                        android:layout_width="52dp"
-                        android:layout_height="52dp"
-                        android:background="@drawable/answer" />
-
-                    <TextView
-                        android:layout_width="match_parent"
-                        android:layout_height="wrap_content"
-                        android:text="@string/btn_answer"
-                        android:textAlignment="center"
-                        android:textColor="#FFFFFF"
-                        android:textSize="15sp" />
-                </LinearLayout>
+                    android:text="@string/btn_refuse"
+                    android:textAlignment="center"
+                    android:textColor="#FFFFFF"
+                    android:textSize="15sp" />
             </LinearLayout>
-
-            <RelativeLayout
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content">
-
+            <LinearLayout
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_alignParentEnd="true"
+                android:layout_marginEnd="25dp"
+                android:orientation="vertical">
                 <ImageButton
-                    android:id="@+id/cancelBtn2"
+                    android:id="@+id/answerInBtn"
                     android:layout_width="52dp"
                     android:layout_height="52dp"
-                    android:layout_centerHorizontal="true"
-                    android:background="@drawable/hangup" />
+                    android:background="@drawable/answer" />
+                <TextView
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:text="@string/btn_answer"
+                    android:textAlignment="center"
+                    android:textColor="#FFFFFF"
+                    android:textSize="15sp" />
+            </LinearLayout>
+        </RelativeLayout>
 
-                <ImageButton
-                    android:id="@+id/cameraBtn"
-                    android:layout_width="45dp"
-                    android:layout_height="45dp"
-                    android:layout_alignParentEnd="true"
-                    android:layout_centerVertical="true"
-                    android:layout_marginEnd="10dp"
-                    android:background="@drawable/hangup" />
-            </RelativeLayout>
+        <RelativeLayout
+            android:id="@+id/layout_bottom_out"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_alignParentBottom="true"
+            android:layout_marginBottom="5dp"
+            >
+            <ImageButton
+                android:id="@+id/cancelOutBtn"
+                android:layout_width="52dp"
+                android:layout_height="52dp"
+                android:layout_centerHorizontal="true"
+                android:background="@drawable/hangup" />
+            <ImageButton
+                android:id="@+id/voiceOutBtn"
+                android:layout_width="45dp"
+                android:layout_height="45dp"
+                android:layout_centerVertical="true"
+                android:layout_alignParentEnd="true"
+                android:layout_marginEnd="10dp"
+                android:background="@drawable/ic_voice" />
+        </RelativeLayout>
+
+        <RelativeLayout
+            android:id="@+id/layout_bottom_ing"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_alignParentBottom="true"
+            android:layout_marginBottom="5dp"
+            >
+            <ImageButton
+                android:id="@+id/cancelIngBtn"
+                android:layout_width="52dp"
+                android:layout_height="52dp"
+                android:layout_centerHorizontal="true"
+                android:background="@drawable/hangup" />
+            <ImageButton
+                android:id="@+id/voiceIngBtn"
+                android:layout_width="45dp"
+                android:layout_height="45dp"
+                android:layout_centerVertical="true"
+                android:layout_alignParentEnd="true"
+                android:layout_marginEnd="10dp"
+                android:background="@drawable/ic_voice" />
         </RelativeLayout>
     </RelativeLayout>
+
 </RelativeLayout>