liuzhenxing1118 5 hónapja
szülő
commit
7133266b8c

+ 7 - 19
app/src/main/AndroidManifest.xml

@@ -14,9 +14,10 @@
         android:supportsRtl="true"
         android:theme="@style/Theme.skphone"
         >
-
         <activity
             android:name=".activity.ContactActivity"
+            android:label="@string/app_contact"
+            android:icon="@drawable/app_contact"
             android:exported="true"
             android:configChanges="keyboardHidden|orientation|screenSize"
             android:launchMode="singleInstance">
@@ -25,16 +26,12 @@
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.LAUNCHER" />
             </intent-filter>
-            <meta-data
-                android:name="android.app.icon"
-                android:resource="@drawable/app_contact" />
-            <meta-data
-                android:name="android.app.label"
-                android:resource="@string/app_contact" />
         </activity>
 
         <activity
             android:name=".activity.RecentActivity"
+            android:label="@string/app_recent"
+            android:icon="@drawable/app_recent"
             android:exported="true"
             android:configChanges="keyboardHidden|orientation|screenSize"
             android:launchMode="singleInstance">
@@ -43,16 +40,12 @@
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.LAUNCHER" />
             </intent-filter>
-            <meta-data
-                android:name="android.app.icon"
-                android:resource="@drawable/app_recent" />
-            <meta-data
-                android:name="android.app.label"
-                android:resource="@string/app_recent" />
         </activity>
 
         <activity
             android:name=".activity.DialActivity"
+            android:label="@string/app_dial"
+            android:icon="@drawable/app_dial"
             android:exported="true"
             android:configChanges="keyboardHidden|orientation|screenSize"
             android:launchMode="singleInstance">
@@ -61,13 +54,8 @@
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.LAUNCHER" />
             </intent-filter>
-            <meta-data
-                android:name="android.app.icon"
-                android:resource="@drawable/app_dial" />
-            <meta-data
-                android:name="android.app.label"
-                android:resource="@string/app_dial" />
         </activity>
+
         <activity
             android:name=".activity.CallActivity"
             android:exported="true"

+ 3 - 1
app/src/main/java/com/sikey/skphone/activity/BaseActionActivity.java

@@ -5,6 +5,7 @@ import android.content.Intent;
 import android.net.Uri;
 import android.util.Log;
 
+import com.google.gson.Gson;
 import com.sikey.skphone.ContactApplication;
 import com.sikey.skphone.R;
 import com.sikey.skphone.model.BaseModel;
@@ -14,9 +15,10 @@ import com.sikey.skphone.utils.ToolsUtils;
 public class BaseActionActivity extends BaseActivity {
 
     public void showCall(int type, BaseModel model) {
+        Gson gson = new Gson();
         Intent intent = new Intent(this, CallActivity.class);
         intent.putExtra(Constant.INTENT_VIEW_TYPE, type);
-        intent.putExtra(Constant.INTENT_VIEW_VALUE, model);
+        intent.putExtra(Constant.INTENT_VIEW_VALUE, gson.toJson(model));
         startActivity(intent);
     }
 

+ 12 - 4
app/src/main/java/com/sikey/skphone/activity/CallActivity.java

@@ -3,14 +3,17 @@ package com.sikey.skphone.activity;
 import android.annotation.SuppressLint;
 import android.os.Bundle;
 import android.view.View;
+import android.widget.ImageView;
 import android.widget.LinearLayout;
 import android.widget.TextView;
 
+import com.google.gson.Gson;
 import com.sikey.skphone.R;
 import com.sikey.skphone.model.BaseModel;
 import com.sikey.skphone.model.ContactBean;
 import com.sikey.skphone.model.RecentBean;
 import com.sikey.skphone.utils.Constant;
+import com.sikey.skphone.utils.ToolsUtils;
 
 public class CallActivity extends BaseActionActivity {
     private int mType = 0;
@@ -26,23 +29,28 @@ public class CallActivity extends BaseActionActivity {
     }
 
     private void initData() {
+        Gson gson = new Gson();
         mType = getIntent().getIntExtra(Constant.INTENT_VIEW_TYPE, 0);
-        BaseModel model = (BaseModel) getIntent().getSerializableExtra(Constant.INTENT_VIEW_VALUE);
+        String value = getIntent().getStringExtra(Constant.INTENT_VIEW_VALUE);
         if (mType == 0) {
-            mContactModel = (ContactBean)model;
+            mContactModel = gson.fromJson(value, ContactBean.class);
         } else {
-            mRecentModel = (RecentBean) model;
+            mRecentModel = gson.fromJson(value, RecentBean.class);
+            mContactModel = mRecentModel.contactBean;
         }
     }
 
     @SuppressLint("SetTextI18n")
     private void initView() {
+        ImageView headImage = findViewById(R.id.headImage);
         TextView nameTv = findViewById(R.id.nameTv);
         TextView hintTv = findViewById(R.id.hintTv);
         LinearLayout videoLayout = findViewById(R.id.videoLayout);
         LinearLayout callLayout = findViewById(R.id.callLayout);
 
-        if (mType == 0) {
+        //如果联系人 || 通话记录匹配到联系人
+        if (mType == 0 || (mType == 1 && mContactModel != null)) {
+            ToolsUtils.setImageView(headImage, mContactModel.profilePath, 0, R.drawable.default_contact);
             nameTv.setText(mContactModel.name);
             hintTv.setText(mContactModel.countryPN +" " + mContactModel.phoneNumber);
             videoLayout.setVisibility(mContactModel.isVideo > 0 ? View.VISIBLE : View.GONE);

+ 0 - 2
app/src/main/java/com/sikey/skphone/activity/DialActivity.java

@@ -1,7 +1,5 @@
 package com.sikey.skphone.activity;
 
-import com.sikey.skphone.model.RecentBean;
-
 public class DialActivity extends BaseInputActivity {
 
     @Override

BIN
app/src/main/res/drawable/default_contact.png


+ 21 - 8
app/src/main/res/layout/activity_call.xml

@@ -2,24 +2,34 @@
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    android:background="#000000"
-    >
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:background="#000000">
 
     <LinearLayout
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_marginTop="25dp"
+        android:layout_marginTop="10dp"
         android:gravity="center"
         android:orientation="vertical">
+
+        <com.makeramen.roundedimageview.RoundedImageView
+            android:id="@+id/headImage"
+            android:layout_width="75dp"
+            android:layout_height="75dp"
+            app:riv_oval="true"
+            app:riv_corner_radius="28dp"
+            android:scaleType="centerCrop"
+            android:src="@drawable/default_contact"
+            />
+
         <TextView
             android:id="@+id/nameTv"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:textAlignment="center"
             android:textColor="@color/white"
-            android:textSize="20sp"
+            android:textSize="17sp"
             android:textStyle="bold"
-            android:text="ssssssaa"
             />
         <TextView
             android:id="@+id/hintTv"
@@ -29,7 +39,6 @@
             android:textAlignment="center"
             android:textColor="#74777D"
             android:textSize="17sp"
-            android:text="543543543534"
             />
     </LinearLayout>
 
@@ -60,7 +69,9 @@
                 android:text="@string/video_call"
                 android:textAlignment="center"
                 android:textColor="#FFFFFF"
-                android:textSize="15sp" />
+                android:textSize="15sp"
+                android:visibility="gone"
+                />
         </LinearLayout>
 
         <LinearLayout
@@ -83,7 +94,9 @@
                 android:text="@string/call"
                 android:textAlignment="center"
                 android:textColor="#FFFFFF"
-                android:textSize="15sp" />
+                android:textSize="15sp"
+                android:visibility="gone"
+                />
         </LinearLayout>
 
     </LinearLayout>

+ 174 - 167
app/src/main/res/layout/activity_input_code.xml

@@ -1,191 +1,198 @@
 <?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    android:orientation="vertical"
     android:background="@color/black"
-    android:layout_marginStart="5dp"
-    android:layout_marginEnd="5dp"
     >
 
-    <TextView
-        android:id="@+id/text"
+    <LinearLayout
         android:layout_width="match_parent"
-        android:layout_height="32dp"
+        android:layout_height="match_parent"
         android:layout_marginStart="5dp"
         android:layout_marginEnd="5dp"
-        android:layout_marginTop="10dp"
-        android:gravity="center"
-        android:maxLines="1"
-        android:ellipsize="middle"
-        android:textFontWeight="500"
-        android:textColor="@color/white"
-        android:textSize="17sp"
-        />
-
-    <LinearLayout
-        android:id="@+id/mLine1Layout"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="5dp"
-        android:orientation="horizontal"
-        android:layout_weight="1"
+        android:orientation="vertical"
         >
-        <Button
-            android:id="@+id/button1"
-            android:layout_width="50dp"
-            android:layout_height="wrap_content"
-            android:background="@drawable/bg_gray"
-            android:layout_weight="1"
-            android:textSize="15sp"
-            android:textColor="@color/white"
-            android:text="1"
-            android:tag="1" />
-        <Button
-            android:id="@+id/button2"
-            android:layout_width="50dp"
-            android:layout_height="wrap_content"
-            android:layout_marginStart="3dp"
-            android:layout_marginEnd="3dp"
-            android:background="@drawable/bg_gray"
-            android:layout_weight="1"
-            android:textSize="15sp"
-            android:textColor="@color/white"
-            android:text="2"
-            android:tag="2" />
-        <Button
-            android:id="@+id/button3"
-            android:layout_width="50dp"
-            android:layout_height="wrap_content"
-            android:background="@drawable/bg_gray"
-            android:layout_weight="1"
-            android:textSize="15sp"
-            android:textColor="@color/white"
-            android:text="3"
-            android:tag="3" />
-    </LinearLayout>
 
-    <LinearLayout
-        android:id="@+id/mLine2Layout"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="3dp"
-        android:orientation="horizontal"
-        android:layout_weight="1"
-        >
-        <Button
-            android:id="@+id/button4"
-            android:layout_width="50dp"
-            android:layout_height="wrap_content"
-            android:background="@drawable/bg_gray"
-            android:layout_weight="1"
-            android:textSize="15sp"
-            android:textColor="@color/white"
-            android:text="4"
-            android:tag="4" />
-        <Button
-            android:id="@+id/button5"
-            android:layout_width="50dp"
-            android:layout_height="wrap_content"
-            android:layout_marginStart="3dp"
-            android:layout_marginEnd="3dp"
-            android:background="@drawable/bg_gray"
-            android:layout_weight="1"
-            android:textSize="15sp"
-            android:textColor="@color/white"
-            android:text="5"
-            android:tag="5" />
-        <Button
-            android:id="@+id/button6"
-            android:layout_width="50dp"
-            android:layout_height="wrap_content"
-            android:background="@drawable/bg_gray"
-            android:layout_weight="1"
-            android:textSize="15sp"
+        <TextView
+            android:id="@+id/text"
+            android:layout_width="match_parent"
+            android:layout_height="32dp"
+            android:layout_marginStart="5dp"
+            android:layout_marginEnd="5dp"
+            android:layout_marginTop="10dp"
+            android:gravity="center"
+            android:maxLines="1"
+            android:ellipsize="middle"
+            android:textFontWeight="500"
             android:textColor="@color/white"
-            android:text="6"
-            android:tag="6" />
-    </LinearLayout>
+            android:textSize="17sp"
+            />
 
-    <LinearLayout
-        android:id="@+id/mLine3Layout"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="3dp"
-        android:orientation="horizontal"
-        android:layout_weight="1"
-        >
-        <Button
-            android:id="@+id/button7"
-            android:layout_width="50dp"
+        <LinearLayout
+            android:id="@+id/mLine1Layout"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:background="@drawable/bg_gray"
+            android:layout_marginTop="5dp"
+            android:orientation="horizontal"
             android:layout_weight="1"
-            android:textSize="15sp"
-            android:textColor="@color/white"
-            android:text="7"
-            android:tag="7" />
-        <Button
-            android:id="@+id/button8"
-            android:layout_width="50dp"
+            >
+            <Button
+                android:id="@+id/button1"
+                android:layout_width="50dp"
+                android:layout_height="wrap_content"
+                android:background="@drawable/bg_gray"
+                android:layout_weight="1"
+                android:textSize="15sp"
+                android:textColor="@color/white"
+                android:text="1"
+                android:tag="1" />
+            <Button
+                android:id="@+id/button2"
+                android:layout_width="50dp"
+                android:layout_height="wrap_content"
+                android:layout_marginStart="3dp"
+                android:layout_marginEnd="3dp"
+                android:background="@drawable/bg_gray"
+                android:layout_weight="1"
+                android:textSize="15sp"
+                android:textColor="@color/white"
+                android:text="2"
+                android:tag="2" />
+            <Button
+                android:id="@+id/button3"
+                android:layout_width="50dp"
+                android:layout_height="wrap_content"
+                android:background="@drawable/bg_gray"
+                android:layout_weight="1"
+                android:textSize="15sp"
+                android:textColor="@color/white"
+                android:text="3"
+                android:tag="3" />
+        </LinearLayout>
+
+        <LinearLayout
+            android:id="@+id/mLine2Layout"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:layout_marginStart="3dp"
-            android:layout_marginEnd="3dp"
-            android:background="@drawable/bg_gray"
+            android:layout_marginTop="3dp"
+            android:orientation="horizontal"
             android:layout_weight="1"
-            android:textSize="15sp"
-            android:textColor="@color/white"
-            android:text="8"
-            android:tag="8" />
-        <Button
-            android:id="@+id/button9"
-            android:layout_width="50dp"
+            >
+            <Button
+                android:id="@+id/button4"
+                android:layout_width="50dp"
+                android:layout_height="wrap_content"
+                android:background="@drawable/bg_gray"
+                android:layout_weight="1"
+                android:textSize="15sp"
+                android:textColor="@color/white"
+                android:text="4"
+                android:tag="4" />
+            <Button
+                android:id="@+id/button5"
+                android:layout_width="50dp"
+                android:layout_height="wrap_content"
+                android:layout_marginStart="3dp"
+                android:layout_marginEnd="3dp"
+                android:background="@drawable/bg_gray"
+                android:layout_weight="1"
+                android:textSize="15sp"
+                android:textColor="@color/white"
+                android:text="5"
+                android:tag="5" />
+            <Button
+                android:id="@+id/button6"
+                android:layout_width="50dp"
+                android:layout_height="wrap_content"
+                android:background="@drawable/bg_gray"
+                android:layout_weight="1"
+                android:textSize="15sp"
+                android:textColor="@color/white"
+                android:text="6"
+                android:tag="6" />
+        </LinearLayout>
+
+        <LinearLayout
+            android:id="@+id/mLine3Layout"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:background="@drawable/bg_gray"
+            android:layout_marginTop="3dp"
+            android:orientation="horizontal"
             android:layout_weight="1"
-            android:textSize="15sp"
-            android:textColor="@color/white"
-            android:text="9"
-            android:tag="9" />
-    </LinearLayout>
+            >
+            <Button
+                android:id="@+id/button7"
+                android:layout_width="50dp"
+                android:layout_height="wrap_content"
+                android:background="@drawable/bg_gray"
+                android:layout_weight="1"
+                android:textSize="15sp"
+                android:textColor="@color/white"
+                android:text="7"
+                android:tag="7" />
+            <Button
+                android:id="@+id/button8"
+                android:layout_width="50dp"
+                android:layout_height="wrap_content"
+                android:layout_marginStart="3dp"
+                android:layout_marginEnd="3dp"
+                android:background="@drawable/bg_gray"
+                android:layout_weight="1"
+                android:textSize="15sp"
+                android:textColor="@color/white"
+                android:text="8"
+                android:tag="8" />
+            <Button
+                android:id="@+id/button9"
+                android:layout_width="50dp"
+                android:layout_height="wrap_content"
+                android:background="@drawable/bg_gray"
+                android:layout_weight="1"
+                android:textSize="15sp"
+                android:textColor="@color/white"
+                android:text="9"
+                android:tag="9" />
+        </LinearLayout>
 
-    <LinearLayout
-        android:id="@+id/mLine4Layout"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="3dp"
-        android:orientation="horizontal"
-        android:layout_weight="1"
-        android:layout_marginBottom="10dp"
-        >
-        <ImageButton
-            android:id="@+id/buttonOK"
-            android:layout_width="50dp"
-            android:layout_height="match_parent"
-            android:background="@drawable/bg_gray"
-            android:src="@drawable/ic_call_2"
-            android:layout_weight="1"
-            android:tag="101" />
-        <Button
-            android:id="@+id/button0"
-            android:layout_width="50dp"
+        <LinearLayout
+            android:id="@+id/mLine4Layout"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:layout_marginStart="3dp"
-            android:layout_marginEnd="3dp"
-            android:background="@drawable/bg_gray"
+            android:layout_marginTop="3dp"
+            android:orientation="horizontal"
             android:layout_weight="1"
-            android:textSize="15sp"
-            android:textColor="@color/white"
-            android:text="0"
-            android:tag="0" />
-        <ImageButton
-            android:id="@+id/buttonBack"
-            android:layout_width="50dp"
-            android:layout_height="match_parent"
-            android:background="@drawable/bg_gray"
-            android:src="@drawable/input_delete"
-            android:layout_weight="1"
-            android:tag="100" />
+            android:layout_marginBottom="10dp"
+            >
+            <ImageButton
+                android:id="@+id/buttonOK"
+                android:layout_width="50dp"
+                android:layout_height="match_parent"
+                android:background="@drawable/bg_gray"
+                android:src="@drawable/ic_call_2"
+                android:layout_weight="1"
+                android:tag="101" />
+            <Button
+                android:id="@+id/button0"
+                android:layout_width="50dp"
+                android:layout_height="wrap_content"
+                android:layout_marginStart="3dp"
+                android:layout_marginEnd="3dp"
+                android:background="@drawable/bg_gray"
+                android:layout_weight="1"
+                android:textSize="15sp"
+                android:textColor="@color/white"
+                android:text="0"
+                android:tag="0" />
+            <ImageButton
+                android:id="@+id/buttonBack"
+                android:layout_width="50dp"
+                android:layout_height="match_parent"
+                android:background="@drawable/bg_gray"
+                android:src="@drawable/input_delete"
+                android:layout_weight="1"
+                android:tag="100" />
+        </LinearLayout>
+
     </LinearLayout>
 
-</LinearLayout>
+</RelativeLayout>

+ 0 - 16
app/src/main/res/values-night/themes.xml

@@ -1,16 +0,0 @@
-<resources xmlns:tools="http://schemas.android.com/tools">
-    <!-- Base application theme. -->
-    <style name="Theme.skphone" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
-        <!-- Primary brand color. -->
-        <item name="colorPrimary">@color/purple_200</item>
-        <item name="colorPrimaryVariant">@color/purple_700</item>
-        <item name="colorOnPrimary">@color/black</item>
-        <!-- Secondary brand color. -->
-        <item name="colorSecondary">@color/teal_200</item>
-        <item name="colorSecondaryVariant">@color/teal_200</item>
-        <item name="colorOnSecondary">@color/black</item>
-        <!-- Status bar color. -->
-        <item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
-        <!-- Customize your theme here. -->
-    </style>
-</resources>

+ 9 - 14
app/src/main/res/values/themes.xml

@@ -1,16 +1,11 @@
 <resources xmlns:tools="http://schemas.android.com/tools">
-    <!-- Base application theme. -->
-    <style name="Theme.skphone" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
-        <!-- Primary brand color. -->
-        <item name="colorPrimary">@color/purple_500</item>
-        <item name="colorPrimaryVariant">@color/purple_700</item>
-        <item name="colorOnPrimary">@color/white</item>
-        <!-- Secondary brand color. -->
-        <item name="colorSecondary">@color/teal_200</item>
-        <item name="colorSecondaryVariant">@color/teal_700</item>
-        <item name="colorOnSecondary">@color/black</item>
-        <!-- Status bar color. -->
-        <item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
-        <!-- Customize your theme here. -->
-    </style>
+<!-- Base application theme. -->
+<style name="Theme.skphone" parent="android:Theme.Material">
+    <item name="android:windowBackground">@color/black</item>
+    <item name="android:windowIsTranslucent">false</item>
+    <item name="android:windowShowWallpaper">false</item>
+    <item name="android:colorBackgroundCacheHint">@null</item>
+    <item name="android:windowSwipeToDismiss">true</item>
+    <item name="android:statusBarColor">@android:color/transparent</item>
+</style>
 </resources>