Преглед изворни кода

可以正常显示自定义表盘

liuzhenxing1118 пре 2 година
родитељ
комит
5977604c33

+ 4 - 1
.idea/misc.xml

@@ -97,9 +97,12 @@
         <entry key="app/src/main/res/layout/view_select_face.xml" value="0.19300911854103345" />
         <entry key="app/src/main/res/layout/view_sliding_drawer.xml" value="0.21920289855072464" />
         <entry key="app/src/main/res/layout/watchface_1.xml" value="0.1889564336372847" />
+        <entry key="app/src/main/res/layout/watchface_2.xml" value="0.3151041666666667" />
+        <entry key="app/src/main/res/layout/watchface_3.xml" value="0.3151041666666667" />
+        <entry key="app/src/main/res/layout/watchface_4.xml" value="0.3151041666666667" />
         <entry key="app/src/main/res/layout/watchface_5.xml" value="0.1889564336372847" />
         <entry key="app/src/main/res/layout/watchface_6.xml" value="0.1889564336372847" />
-        <entry key="app/src/main/res/layout/watchface_7.xml" value="0.625" />
+        <entry key="app/src/main/res/layout/watchface_7.xml" value="0.5045871559633027" />
         <entry key="app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml" value="0.1555" />
       </map>
     </option>

+ 9 - 4
app/src/main/java/com/xplora/xplauncher/activity/FaceSelectActivity.java

@@ -262,10 +262,15 @@ public class FaceSelectActivity extends BaseActivity implements Listener.Content
 
     private void gotoPhoto() {
         //跳转相册
-        Intent intent = new Intent(Intent.ACTION_PICK);
-        intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, false);
-        intent.setType("image/*");
-        startActivityForResult(intent, 1011);
+        //该应用的包名
+        String pkg = "com.xplora.photos";
+        //应用的主activity类
+        String cls = "com.xplora.photos.MainActivity";
+        ComponentName componet = new ComponentName(pkg, cls);
+
+        Intent i = new Intent();
+        i.setComponent(componet);
+        startActivityForResult(i, 1011);
     }
 
     @Override

+ 1 - 1
app/src/main/java/com/xplora/xplauncher/data/WatchFaceManager.java

@@ -164,7 +164,7 @@ public class WatchFaceManager {
     public static String getCustomFaceName(Context context) {
         String currentFaceName = getWatchFaceName(context);
         //自定义图片表盘,图片保存路径一定包含
-        if (currentFaceName.contains("sdcard"))
+        if (currentFaceName.contains("storage/emulated"))
             return currentFaceName;
         else
             return "";

+ 2 - 0
app/src/main/res/layout/watchface_1.xml

@@ -7,6 +7,8 @@
         android:id="@+id/mFaceBGImage"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
+        android:layout_centerInParent="true"
+        android:scaleType="centerCrop"
         />
 
     <LinearLayout

+ 2 - 0
app/src/main/res/layout/watchface_2.xml

@@ -7,6 +7,8 @@
         android:id="@+id/mFaceBGImage"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
+        android:layout_centerInParent="true"
+        android:scaleType="centerCrop"
         />
 
     <RelativeLayout

+ 2 - 0
app/src/main/res/layout/watchface_3.xml

@@ -7,6 +7,8 @@
         android:id="@+id/mFaceBGImage"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
+        android:layout_centerInParent="true"
+        android:scaleType="centerCrop"
         />
 
     <TextView

+ 2 - 0
app/src/main/res/layout/watchface_4.xml

@@ -7,6 +7,8 @@
         android:id="@+id/mFaceBGImage"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
+        android:layout_centerInParent="true"
+        android:scaleType="centerCrop"
         />
 
     <TextView

+ 2 - 0
app/src/main/res/layout/watchface_5.xml

@@ -7,6 +7,8 @@
         android:id="@+id/mFaceBGImage"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
+        android:layout_centerInParent="true"
+        android:scaleType="centerCrop"
         />
 
     <RelativeLayout

+ 2 - 0
app/src/main/res/layout/watchface_6.xml

@@ -7,6 +7,8 @@
         android:id="@+id/mFaceBGImage"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
+        android:layout_centerInParent="true"
+        android:scaleType="centerCrop"
         />
 
     <LinearLayout

+ 2 - 0
app/src/main/res/layout/watchface_7.xml

@@ -7,6 +7,8 @@
         android:id="@+id/mFaceBGImage"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
+        android:layout_centerInParent="true"
+        android:scaleType="centerCrop"
         />
 
     <LinearLayout