1
0
Эх сурвалжийг харах

0.0.46.beta10 ready
- 现在要使用 MaterialYou 主题需要 android.material 框架,MaterialYou 主题内的组件将逐步替换为 android.material 的官方组件和相关样式;
- 尝试性提供了 FLOATING_ACTIVITY 模式在后台 Service 中启动的可能;

kongzue 2 жил өмнө
parent
commit
d27ef4f7e8
33 өөрчлөгдсөн 171 нэмэгдсэн , 68 устгасан
  1. 7 0
      DialogX/src/main/java/com/kongzue/dialogx/dialogs/MessageDialog.java
  2. 11 5
      DialogX/src/main/java/com/kongzue/dialogx/interfaces/BaseDialog.java
  3. 1 0
      DialogXMaterialYou/build.gradle
  4. 0 2
      DialogXMaterialYou/src/main/java/com/kongzue/dialogxmaterialyou/style/MaterialYouStyle.java
  5. 1 1
      DialogXMaterialYou/src/main/res/drawable/rect_dialogx_material_you_bkg_light.xml
  6. 1 1
      DialogXMaterialYou/src/main/res/drawable/rect_dialogx_material_you_bkg_night.xml
  7. 1 1
      DialogXMaterialYou/src/main/res/drawable/rect_dialogx_material_you_bottom_bkg_light.xml
  8. 1 1
      DialogXMaterialYou/src/main/res/drawable/rect_dialogx_material_you_bottom_bkg_night.xml
  9. 1 1
      DialogXMaterialYou/src/main/res/drawable/rect_dialogx_material_you_button_light_forword.xml
  10. 1 1
      DialogXMaterialYou/src/main/res/drawable/rect_dialogx_material_you_button_night_forword.xml
  11. 1 1
      DialogXMaterialYou/src/main/res/drawable/rect_dialogx_material_you_popmenu_bkg.xml
  12. 1 1
      DialogXMaterialYou/src/main/res/drawable/rect_dialogx_material_you_popmenu_bkg_night.xml
  13. 1 1
      DialogXMaterialYou/src/main/res/drawable/rect_dialogx_material_you_popnotification_bkg.xml
  14. 1 1
      DialogXMaterialYou/src/main/res/drawable/rect_dialogx_material_you_popnotification_bkg_night.xml
  15. 1 1
      DialogXMaterialYou/src/main/res/drawable/rect_dialogx_material_you_poptip_bkg.xml
  16. 1 1
      DialogXMaterialYou/src/main/res/drawable/rect_dialogx_material_you_poptip_bkg_night.xml
  17. 4 3
      DialogXMaterialYou/src/main/res/layout/layout_dialogx_bottom_material_you.xml
  18. 4 3
      DialogXMaterialYou/src/main/res/layout/layout_dialogx_bottom_material_you_dark.xml
  19. 25 18
      DialogXMaterialYou/src/main/res/layout/layout_dialogx_material_you.xml
  20. 26 19
      DialogXMaterialYou/src/main/res/layout/layout_dialogx_material_you_dark.xml
  21. 1 0
      DialogXMaterialYou/src/main/res/layout/layout_dialogx_popmenu_material_you.xml
  22. 1 0
      DialogXMaterialYou/src/main/res/layout/layout_dialogx_popmenu_material_you_dark.xml
  23. 1 0
      DialogXMaterialYou/src/main/res/layout/layout_dialogx_popnotification_material_you.xml
  24. 1 0
      DialogXMaterialYou/src/main/res/layout/layout_dialogx_popnotification_material_you_dark.xml
  25. 2 1
      DialogXMaterialYou/src/main/res/layout/layout_dialogx_poptip_material_you.xml
  26. 2 1
      DialogXMaterialYou/src/main/res/layout/layout_dialogx_poptip_material_you_dark.xml
  27. 1 1
      DialogXMaterialYou/src/main/res/values/colors.xml
  28. 12 0
      DialogXMaterialYou/src/main/res/values/styles.xml
  29. 7 1
      app/src/main/AndroidManifest.xml
  30. 8 0
      app/src/main/java/com/kongzue/dialogxdemo/App.java
  31. 44 0
      app/src/main/java/com/kongzue/dialogxdemo/service/TestBackgroundService.java
  32. 0 1
      app/src/main/res/values/styles.xml
  33. 1 1
      gradle.properties

+ 7 - 0
DialogX/src/main/java/com/kongzue/dialogx/dialogs/MessageDialog.java

@@ -494,10 +494,17 @@ public class MessageDialog extends BaseDialog {
             }
             
             bkg.setMaxWidth(getMaxWidth());
+            View inputBoxView = boxRoot.findViewWithTag("dialogx_editbox");
             if (me instanceof InputDialog) {
+                if (inputBoxView != null) {
+                    inputBoxView.setVisibility(View.VISIBLE);
+                }
                 txtInput.setVisibility(View.VISIBLE);
                 boxRoot.bindFocusView(txtInput);
             } else {
+                if (inputBoxView != null) {
+                    inputBoxView.setVisibility(View.GONE);
+                }
                 txtInput.setVisibility(View.GONE);
             }
             boxRoot.setClickable(true);

+ 11 - 5
DialogX/src/main/java/com/kongzue/dialogx/interfaces/BaseDialog.java

@@ -1,5 +1,7 @@
 package com.kongzue.dialogx.interfaces;
 
+import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
+
 import android.app.Activity;
 import android.content.Context;
 import android.content.Intent;
@@ -197,13 +199,16 @@ public abstract class BaseDialog {
                         dialogXFloatingWindowActivity.showDialogX(baseDialog.dialogKey());
                         return;
                     }
-                    Intent intent = new Intent(getTopActivity(), DialogXFloatingWindowActivity.class);
+                    Intent intent = new Intent(getContext(), DialogXFloatingWindowActivity.class);
+                    if (getTopActivity() == null) {
+                        intent.addFlags(FLAG_ACTIVITY_NEW_TASK);
+                    }
                     intent.putExtra("dialogXKey", baseDialog.dialogKey());
-                    intent.putExtra("fromActivityUiStatus", getTopActivity().getWindow().getDecorView().getSystemUiVisibility());
-                    intent.putExtra("from", getTopActivity().hashCode());
-                    getTopActivity().startActivity(intent);
+                    intent.putExtra("fromActivityUiStatus", getTopActivity() == null ? 0 : getTopActivity().getWindow().getDecorView().getSystemUiVisibility());
+                    intent.putExtra("from", getContext().hashCode());
+                    getContext().startActivity(intent);
                     int version = Integer.valueOf(Build.VERSION.SDK_INT);
-                    if (version > 5) {
+                    if (version > 5 && getTopActivity() != null) {
                         getTopActivity().overridePendingTransition(0, 0);
                     }
                     break;
@@ -596,6 +601,7 @@ public abstract class BaseDialog {
         preShow = true;
         dismissAnimFlag = false;
         if (getTopActivity() == null) {
+            //尝试重新获取 activity
             init(null);
             if (getTopActivity() == null) {
                 error("DialogX 未初始化。\n请检查是否在启动对话框前进行初始化操作,使用以下代码进行初始化:\nDialogX.init(context);\n\n另外建议您前往查看 DialogX 的文档进行使用:https://github.com/kongzue/DialogX");

+ 1 - 0
DialogXMaterialYou/build.gradle

@@ -28,5 +28,6 @@ android {
 
 dependencies {
     implementation project(path: ':DialogX')
+    implementation 'com.google.android.material:material:1.3.0+'
     compileOnly project(path: ':DialogXInterface')
 }

+ 0 - 2
DialogXMaterialYou/src/main/java/com/kongzue/dialogxmaterialyou/style/MaterialYouStyle.java

@@ -19,8 +19,6 @@ import com.kongzue.dialogxmaterialyou.R;
 public class MaterialYouStyle extends DialogXStyle {
     
     public static MaterialYouStyle style() {
-        DialogX.titleTextInfo = new TextInfo().setBold(false);
-        DialogX.buttonTextInfo = new TextInfo().setBold(false);
         return new MaterialYouStyle();
     }
     

+ 1 - 1
DialogXMaterialYou/src/main/res/drawable/rect_dialogx_material_you_bkg_light.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <shape xmlns:android="http://schemas.android.com/apk/res/android"
     android:shape="rectangle">
-    <solid android:color="@color/dialogxMaterialYouBkgLight"/>
+    <solid android:color="?attr/colorSurface"/>
     <corners android:radius="27dp" />
 </shape>

+ 1 - 1
DialogXMaterialYou/src/main/res/drawable/rect_dialogx_material_you_bkg_night.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <shape xmlns:android="http://schemas.android.com/apk/res/android"
     android:shape="rectangle">
-    <solid android:color="@color/dialogxMaterialYouBkgDark"/>
+    <solid android:color="?attr/colorSurface"/>
     <corners android:radius="27dp" />
 </shape>

+ 1 - 1
DialogXMaterialYou/src/main/res/drawable/rect_dialogx_material_you_bottom_bkg_light.xml

@@ -3,7 +3,7 @@
     android:shape="rectangle">
     <!--left to right-->
     <solid
-        android:color="@color/dialogxMaterialYouBkgLight"/>
+        android:color="?attr/colorSurface"/>
 
     <corners
         android:topRightRadius="27dp"

+ 1 - 1
DialogXMaterialYou/src/main/res/drawable/rect_dialogx_material_you_bottom_bkg_night.xml

@@ -3,7 +3,7 @@
     android:shape="rectangle">
     <!--left to right-->
     <solid
-        android:color="@color/dialogxMaterialYouBkgDark"/>
+        android:color="?attr/colorSurface"/>
 
     <corners
         android:topRightRadius="27dp"

+ 1 - 1
DialogXMaterialYou/src/main/res/drawable/rect_dialogx_material_you_button_light_forword.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <shape xmlns:android="http://schemas.android.com/apk/res/android"
     android:shape="rectangle">
-    <solid android:color="@color/dialogxMaterialYouBkgLight"/>
+    <solid android:color="?attr/colorSurface"/>
     <corners android:radius="99dp" />
 </shape>

+ 1 - 1
DialogXMaterialYou/src/main/res/drawable/rect_dialogx_material_you_button_night_forword.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <shape xmlns:android="http://schemas.android.com/apk/res/android"
     android:shape="rectangle">
-    <solid android:color="@color/dialogxMaterialYouBkgDark"/>
+    <solid android:color="?attr/colorSurface"/>
     <corners android:radius="99dp" />
 </shape>

+ 1 - 1
DialogXMaterialYou/src/main/res/drawable/rect_dialogx_material_you_popmenu_bkg.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <shape xmlns:android="http://schemas.android.com/apk/res/android"
     android:shape="rectangle">
-    <solid android:color="@color/dialogxMaterialYouBkgLight"/>
+    <solid android:color="?attr/colorSurface"/>
     <corners android:radius="5dp" />
 </shape>

+ 1 - 1
DialogXMaterialYou/src/main/res/drawable/rect_dialogx_material_you_popmenu_bkg_night.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <shape xmlns:android="http://schemas.android.com/apk/res/android"
     android:shape="rectangle">
-    <solid android:color="@color/dialogxMaterialYouBkgDark"/>
+    <solid android:color="?attr/colorSurface"/>
     <corners android:radius="5dp" />
 </shape>

+ 1 - 1
DialogXMaterialYou/src/main/res/drawable/rect_dialogx_material_you_popnotification_bkg.xml

@@ -3,7 +3,7 @@
     android:shape="rectangle">
     <!--left to right-->
     <solid
-        android:color="@color/dialogxMaterialYouBkgLight"/>
+        android:color="?attr/colorSurface"/>
 
     <corners
         android:radius="25dp"/>

+ 1 - 1
DialogXMaterialYou/src/main/res/drawable/rect_dialogx_material_you_popnotification_bkg_night.xml

@@ -3,7 +3,7 @@
     android:shape="rectangle">
     <!--left to right-->
     <solid
-        android:color="@color/dialogxMaterialDarkDialogBkgColor"/>
+        android:color="?attr/colorSurface"/>
 
     <corners
         android:radius="25dp"/>

+ 1 - 1
DialogXMaterialYou/src/main/res/drawable/rect_dialogx_material_you_poptip_bkg.xml

@@ -3,7 +3,7 @@
     android:shape="rectangle">
     <!--left to right-->
     <solid
-        android:color="@color/dialogxMaterialYouBkgLight"/>
+        android:color="?attr/colorSurface"/>
 
     <corners
         android:radius="99dp"/>

+ 1 - 1
DialogXMaterialYou/src/main/res/drawable/rect_dialogx_material_you_poptip_bkg_night.xml

@@ -3,7 +3,7 @@
     android:shape="rectangle">
     <!--left to right-->
     <solid
-        android:color="@color/dialogxMaterialDarkDialogBkgColor"/>
+        android:color="?attr/colorSurface"/>
 
     <corners
         android:radius="99dp"/>

+ 4 - 3
DialogXMaterialYou/src/main/res/layout/layout_dialogx_bottom_material_you.xml

@@ -5,6 +5,7 @@
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:background="@color/black20"
+    android:theme="@style/DialogXCompatThemeLight"
     android:orientation="vertical">
 
     <RelativeLayout
@@ -111,7 +112,7 @@
                         android:paddingLeft="15dp"
                         android:paddingRight="15dp"
                         android:text="Other"
-                        android:textColor="@color/colorAccent"
+                        android:textColor="?attr/colorPrimary"
                         android:textSize="15dp"
                         android:visibility="gone" />
 
@@ -133,7 +134,7 @@
                         android:paddingRight="15dp"
                         android:tag="cancel"
                         android:text="Cancel"
-                        android:textColor="@color/colorAccent"
+                        android:textColor="?attr/colorPrimary"
                         android:textSize="15dp" />
 
                     <TextView
@@ -148,7 +149,7 @@
                         android:paddingLeft="15dp"
                         android:paddingRight="15dp"
                         android:text="OK"
-                        android:textColor="@color/colorAccent"
+                        android:textColor="?attr/colorPrimary"
                         android:textSize="15dp" />
 
                 </LinearLayout>

+ 4 - 3
DialogXMaterialYou/src/main/res/layout/layout_dialogx_bottom_material_you_dark.xml

@@ -3,6 +3,7 @@
     android:id="@+id/box_root"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
+    android:theme="@style/DialogXCompatThemeNight"
     android:background="@color/black40"
     android:orientation="vertical">
 
@@ -111,7 +112,7 @@
                         android:paddingLeft="15dp"
                         android:paddingRight="15dp"
                         android:text="Other"
-                        android:textColor="@color/colorAccent"
+                        android:textColor="?attr/colorOnSurface"
                         android:textSize="15dp"
                         android:visibility="gone" />
 
@@ -133,7 +134,7 @@
                         android:paddingRight="15dp"
                         android:tag="cancel"
                         android:text="Cancel"
-                        android:textColor="@color/colorAccent"
+                        android:textColor="?attr/colorOnSurface"
                         android:textSize="15dp" />
 
                     <TextView
@@ -148,7 +149,7 @@
                         android:paddingLeft="15dp"
                         android:paddingRight="15dp"
                         android:text="OK"
-                        android:textColor="@color/colorAccent"
+                        android:textColor="?attr/colorOnSurface"
                         android:textSize="15dp" />
 
                 </LinearLayout>

+ 25 - 18
DialogXMaterialYou/src/main/res/layout/layout_dialogx_material_you.xml

@@ -4,6 +4,7 @@
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:background="@color/black20"
+    android:theme="@style/DialogXCompatThemeLight"
     android:orientation="vertical">
 
     <RelativeLayout
@@ -17,6 +18,7 @@
             android:layout_centerInParent="true"
             android:layout_marginLeft="35dp"
             android:layout_marginRight="35dp"
+
             android:background="@drawable/rect_dialogx_material_you_bkg_light"
             android:elevation="27dp">
 
@@ -32,6 +34,7 @@
                     android:layout_height="wrap_content"
                     android:layout_gravity="center_horizontal"
                     android:gravity="center_vertical"
+                    android:textAppearance="?attr/textAppearanceHeadline2"
                     android:paddingLeft="20dp"
                     android:paddingTop="18dp"
                     android:paddingRight="20dp"
@@ -68,23 +71,27 @@
                             android:layout_height="wrap_content"
                             android:visibility="gone" />
 
-                        <EditText
-                            android:id="@+id/txt_input"
+                        <com.google.android.material.textfield.TextInputLayout
                             android:layout_width="match_parent"
                             android:layout_height="wrap_content"
-                            android:layout_gravity="center_horizontal"
-                            android:layout_marginLeft="20dp"
-                            android:layout_marginTop="10dp"
-                            android:layout_marginRight="20dp"
-                            android:inputType="text"
-                            android:maxLines="1"
-                            android:paddingTop="10dp"
-                            android:paddingBottom="10dp"
-                            android:scrollbars="vertical"
-                            android:text=""
-                            android:textColor="@color/black90"
-                            android:textSize="18dp"
-                            android:theme="@style/DialogXCompatThemeLight" />
+                            android:tag="dialogx_editbox">
+
+                            <EditText
+                                android:id="@+id/txt_input"
+                                android:layout_width="match_parent"
+                                android:layout_height="wrap_content"
+                                android:padding="10dp"
+                                android:layout_marginLeft="20dp"
+                                android:layout_marginTop="10dp"
+                                android:layout_marginRight="20dp"
+                                android:layout_gravity="center_horizontal"
+                                android:inputType="text"
+                                android:maxLines="1"
+                                android:scrollbars="vertical"
+                                android:textColor="@color/black90"
+                                android:textSize="18dp" />
+
+                        </com.google.android.material.textfield.TextInputLayout>
 
                     </LinearLayout>
 
@@ -113,7 +120,7 @@
                         android:paddingLeft="15dp"
                         android:paddingRight="15dp"
                         android:text="Other"
-                        android:textColor="@color/colorAccent"
+                        android:textColor="?attr/colorPrimary"
                         android:textSize="15dp"
                         android:visibility="gone" />
 
@@ -133,7 +140,7 @@
                         android:paddingLeft="15dp"
                         android:paddingRight="15dp"
                         android:text="Cancel"
-                        android:textColor="@color/colorAccent"
+                        android:textColor="?attr/colorPrimary"
                         android:textSize="15dp" />
 
                     <TextView
@@ -146,7 +153,7 @@
                         android:paddingLeft="15dp"
                         android:paddingRight="15dp"
                         android:text="OK"
-                        android:textColor="@color/colorAccent"
+                        android:textColor="?attr/colorPrimary"
                         android:textSize="15dp" />
 
                 </LinearLayout>

+ 26 - 19
DialogXMaterialYou/src/main/res/layout/layout_dialogx_material_you_dark.xml

@@ -4,7 +4,8 @@
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:background="@color/black40"
-    android:orientation="vertical">
+    android:orientation="vertical"
+    android:theme="@style/DialogXCompatThemeNight">
 
     <RelativeLayout
         android:layout_width="match_parent"
@@ -68,23 +69,29 @@
                             android:layout_height="wrap_content"
                             android:visibility="gone" />
 
-                        <EditText
-                            android:id="@+id/txt_input"
+
+                        <com.google.android.material.textfield.TextInputLayout
                             android:layout_width="match_parent"
                             android:layout_height="wrap_content"
-                            android:layout_gravity="center_horizontal"
-                            android:layout_marginLeft="20dp"
-                            android:layout_marginTop="10dp"
-                            android:layout_marginRight="20dp"
-                            android:inputType="text"
-                            android:maxLines="1"
-                            android:paddingTop="10dp"
-                            android:paddingBottom="10dp"
-                            android:scrollbars="vertical"
-                            android:text=""
-                            android:textColor="@color/white"
-                            android:textSize="18dp"
-                            android:theme="@style/DialogXCompatThemeDark" />
+                            android:tag="dialogx_editbox">
+
+                            <EditText
+                                android:id="@+id/txt_input"
+                                android:layout_width="match_parent"
+                                android:layout_height="wrap_content"
+                                android:layout_gravity="center_horizontal"
+                                android:layout_marginLeft="20dp"
+                                android:layout_marginTop="10dp"
+                                android:layout_marginRight="20dp"
+                                android:inputType="text"
+                                android:maxLines="1"
+                                android:padding="10dp"
+                                android:scrollbars="vertical"
+                                android:text=""
+                                android:textColor="@color/white"
+                                android:textSize="18dp" />
+
+                        </com.google.android.material.textfield.TextInputLayout>
 
                     </LinearLayout>
 
@@ -113,7 +120,7 @@
                         android:paddingLeft="15dp"
                         android:paddingRight="15dp"
                         android:text="Other"
-                        android:textColor="@color/colorAccent"
+                        android:textColor="?attr/colorOnSurface"
                         android:textSize="15dp"
                         android:visibility="gone" />
 
@@ -133,7 +140,7 @@
                         android:paddingLeft="15dp"
                         android:paddingRight="15dp"
                         android:text="Cancel"
-                        android:textColor="@color/colorAccent"
+                        android:textColor="?attr/colorOnSurface"
                         android:textSize="15dp" />
 
                     <TextView
@@ -146,7 +153,7 @@
                         android:paddingLeft="15dp"
                         android:paddingRight="15dp"
                         android:text="OK"
-                        android:textColor="@color/colorAccent"
+                        android:textColor="?attr/colorOnSurface"
                         android:textSize="15dp" />
 
                 </LinearLayout>

+ 1 - 0
DialogXMaterialYou/src/main/res/layout/layout_dialogx_popmenu_material_you.xml

@@ -5,6 +5,7 @@
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:background="@color/black20"
+    android:theme="@style/DialogXCompatThemeLight"
     android:orientation="vertical"
     app:autoSafeArea="false"
     app:baseFocusable="true">

+ 1 - 0
DialogXMaterialYou/src/main/res/layout/layout_dialogx_popmenu_material_you_dark.xml

@@ -6,6 +6,7 @@
     android:layout_height="match_parent"
     android:background="@color/black20"
     android:orientation="vertical"
+    android:theme="@style/DialogXCompatThemeNight"
     app:autoSafeArea="false"
     app:baseFocusable="true">
 

+ 1 - 0
DialogXMaterialYou/src/main/res/layout/layout_dialogx_popnotification_material_you.xml

@@ -5,6 +5,7 @@
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:orientation="vertical"
+    android:theme="@style/DialogXCompatThemeLight"
     app:baseFocusable="false">
 
     <com.kongzue.dialogx.util.views.MaxLinearLayout

+ 1 - 0
DialogXMaterialYou/src/main/res/layout/layout_dialogx_popnotification_material_you_dark.xml

@@ -4,6 +4,7 @@
     android:id="@+id/box_root"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
+    android:theme="@style/DialogXCompatThemeNight"
     android:orientation="vertical"
     app:baseFocusable="false">
 

+ 2 - 1
DialogXMaterialYou/src/main/res/layout/layout_dialogx_poptip_material_you.xml

@@ -3,6 +3,7 @@
     xmlns:app="http://schemas.android.com/apk/res-auto"
     android:id="@+id/box_root"
     android:layout_width="match_parent"
+    android:theme="@style/DialogXCompatThemeLight"
     android:layout_height="match_parent"
     android:orientation="vertical"
     app:baseFocusable="false">
@@ -56,7 +57,7 @@
             android:id="@+id/txt_dialogx_button"
             android:layout_width="wrap_content"
             android:layout_height="match_parent"
-            android:layout_marginLeft="-15dp"
+            android:layout_marginLeft="-10dp"
             android:layout_marginTop="5dp"
             android:layout_marginRight="5dp"
             android:layout_marginBottom="5dp"

+ 2 - 1
DialogXMaterialYou/src/main/res/layout/layout_dialogx_poptip_material_you_dark.xml

@@ -4,6 +4,7 @@
     android:id="@+id/box_root"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
+    android:theme="@style/DialogXCompatThemeNight"
     android:orientation="vertical"
     app:baseFocusable="false">
 
@@ -56,7 +57,7 @@
             android:id="@+id/txt_dialogx_button"
             android:layout_width="wrap_content"
             android:layout_height="match_parent"
-            android:layout_marginLeft="-15dp"
+            android:layout_marginLeft="-10dp"
             android:layout_marginTop="5dp"
             android:layout_marginRight="5dp"
             android:layout_marginBottom="5dp"

+ 1 - 1
DialogXMaterialYou/src/main/res/values/colors.xml

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
-    <color name="dialogxMaterialYouBkgLight">#F9F9FB</color>
+    <color name="dialogxMaterialYouBkgLight">#F2F6FC</color>
     <color name="dialogxMaterialYouBkgDark">#2E3032</color>
 </resources>

+ 12 - 0
DialogXMaterialYou/src/main/res/values/styles.xml

@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+    <style name="DialogXCompatThemeLight" parent="Theme.MaterialComponents.DayNight.NoActionBar">
+        <item name="colorPrimary">@color/colorAccent</item>
+        <item name="colorSurface">@color/dialogxMaterialYouBkgLight</item>
+    </style>
+    <style name="DialogXCompatThemeNight" parent="Theme.MaterialComponents.NoActionBar">
+        <item name="colorPrimarySurface">@color/white</item>
+        <item name="colorSurface">@color/dialogxMaterialYouBkgDark</item>
+    </style>
+</resources>

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

@@ -13,13 +13,17 @@
         android:roundIcon="@mipmap/ic_launcher_round"
         android:supportsRtl="true"
         android:theme="@style/AppTheme">
+
         <activity
             android:name=".activity.AppCompatActivityTest"
+            android:exported="false"
             android:theme="@style/AppCompatTheme"
             android:windowSoftInputMode="adjustResize" />
+
         <activity
             android:name=".activity.MainActivity"
-            android:configChanges="orientation|keyboardHidden|screenSize|uiMode|screenLayout|smallestScreenSize|layoutDirection">
+            android:configChanges="orientation|keyboardHidden|screenSize|uiMode|screenLayout|smallestScreenSize|layoutDirection"
+            android:exported="true">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
 
@@ -34,6 +38,8 @@
             android:theme="@style/DialogXFloatingWindow"
             android:windowSoftInputMode="adjustResize" />
 
+        <service android:name=".service.TestBackgroundService" />
+
     </application>
 
 </manifest>

+ 8 - 0
app/src/main/java/com/kongzue/dialogxdemo/App.java

@@ -1,8 +1,11 @@
 package com.kongzue.dialogxdemo;
 
+import android.content.Intent;
+
 import com.kongzue.baseframework.BaseApp;
 import com.kongzue.dialogx.DialogX;
 import com.kongzue.dialogx.style.MaterialStyle;
+import com.kongzue.dialogxdemo.service.TestBackgroundService;
 
 /**
  * @author: Kongzue
@@ -20,5 +23,10 @@ public class App extends BaseApp<App> {
         DialogX.globalStyle = new MaterialStyle();
         DialogX.globalTheme = DialogX.THEME.AUTO;
         DialogX.onlyOnePopTip = false;
+    
+        //以下代码用于测试后台 Service 启动对话框
+//        DialogX.implIMPLMode = DialogX.IMPL_MODE.FLOATING_ACTIVITY;
+//        Intent serviceStartIntent = new Intent(this, TestBackgroundService.class);
+//        startService(serviceStartIntent);
     }
 }

+ 44 - 0
app/src/main/java/com/kongzue/dialogxdemo/service/TestBackgroundService.java

@@ -0,0 +1,44 @@
+package com.kongzue.dialogxdemo.service;
+
+import android.app.Service;
+import android.content.Intent;
+import android.os.IBinder;
+import android.util.Log;
+
+import androidx.annotation.Nullable;
+
+import com.kongzue.dialogx.dialogs.MessageDialog;
+import com.kongzue.dialogxdemo.activity.MainActivity;
+
+/**
+ * 测试从 Service 中启动
+ *
+ * @author: Kongzue
+ * @github: https://github.com/kongzue/
+ * @homepage: http://kongzue.com/
+ * @mail: myzcxhh@live.cn
+ * @createTime: 2022/8/25 18:18
+ */
+public class TestBackgroundService extends Service {
+    @Nullable
+    @Override
+    public IBinder onBind(Intent intent) {
+        return null;
+    }
+    
+    @Override
+    public int onStartCommand(Intent intent, int flags, int startId) {
+        Log.i(">>>", "TestService#onStartCommand: ");
+        MainActivity mainActivity = MainActivity.getActivity(MainActivity.class);
+        if (mainActivity != null) {
+            mainActivity.finish();
+        }
+        try {
+            Thread.sleep(1500);
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
+        MessageDialog.show("Title", "Message", "OK");
+        return super.onStartCommand(intent, flags, startId);
+    }
+}

+ 0 - 1
app/src/main/res/values/styles.xml

@@ -21,5 +21,4 @@
         <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
         <item name="colorAccent">@color/colorAccent</item>
     </style>
-
 </resources>

+ 1 - 1
gradle.properties

@@ -19,5 +19,5 @@ android.useAndroidX=true
 # Automatically convert third-party libraries to use AndroidX
 android.enableJetifier=true
 
-BUILD_VERSION=0.0.46.beta9
+BUILD_VERSION=0.0.46.beta10
 BUILD_VERSION_INT=45