Browse Source

0.0.44.beta1

kongzue 3 years ago
parent
commit
fe97ab96f1

+ 2 - 0
.idea/misc.xml

@@ -41,6 +41,8 @@
         <entry key="..\:/WorkSpace/Android/DialogXDemo/DialogXIOSStyle/src/main/res/layout/layout_dialogx_bottom_ios.xml" value="0.5328205128205128" />
         <entry key="..\:/WorkSpace/Android/DialogXDemo/DialogXIOSStyle/src/main/res/layout/layout_dialogx_bottom_ios_dark.xml" value="0.5328205128205128" />
         <entry key="..\:/WorkSpace/Android/DialogXDemo/DialogXIOSStyle/src/main/res/layout/layout_dialogx_ios.xml" value="0.5328205128205128" />
+        <entry key="..\:/WorkSpace/Android/DialogXDemo/DialogXKongzueStyle/src/main/res/layout/layout_dialogx_poptip_kongzue.xml" value="0.362962962962963" />
+        <entry key="..\:/WorkSpace/Android/DialogXDemo/DialogXKongzueStyle/src/main/res/layout/layout_dialogx_poptip_kongzue_dark.xml" value="0.362962962962963" />
         <entry key="..\:/WorkSpace/Android/DialogXDemo/DialogXMIUIStyle/src/main/res/drawable/button_dialogx_miui_blue.xml" value="0.5487179487179488" />
         <entry key="..\:/WorkSpace/Android/DialogXDemo/DialogXMIUIStyle/src/main/res/drawable/button_dialogx_miui_center_light.xml" value="0.5487179487179488" />
         <entry key="..\:/WorkSpace/Android/DialogXDemo/DialogXMIUIStyle/src/main/res/drawable/button_dialogx_miui_center_night.xml" value="0.5487179487179488" />

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

@@ -11,6 +11,7 @@ import android.graphics.Typeface;
 import android.os.Build;
 import android.os.Handler;
 import android.os.Looper;
+import android.text.TextUtils;
 import android.util.Log;
 import android.util.TypedValue;
 import android.view.LayoutInflater;
@@ -341,7 +342,7 @@ public abstract class BaseDialog {
         return theme;
     }
     
-    protected void useTextInfo(TextView textView, TextInfo textInfo) {
+    public static void useTextInfo(TextView textView, TextInfo textInfo) {
         if (textInfo == null) return;
         if (textView == null) return;
         if (textInfo.getFontSize() > 0) {
@@ -353,6 +354,15 @@ public abstract class BaseDialog {
         if (textInfo.getGravity() != -1) {
             textView.setGravity(textInfo.getGravity());
         }
+        if (textInfo.isShowEllipsis()) {
+            textView.setEllipsize(TextUtils.TruncateAt.END);
+        }else{
+            textView.setEllipsize(null);
+        }
+        if (textInfo.getMaxLines() != -1) {
+            textView.setMaxLines(textInfo.getMaxLines());
+        }
+    
         textView.getPaint().setFakeBoldText(textInfo.isBold());
     }
     

+ 2 - 15
DialogX/src/main/java/com/kongzue/dialogx/util/BottomMenuArrayAdapter.java

@@ -1,12 +1,14 @@
 package com.kongzue.dialogx.util;
 
 import static com.kongzue.dialogx.interfaces.BaseDialog.isNull;
+import static com.kongzue.dialogx.interfaces.BaseDialog.useTextInfo;
 
 import android.content.Context;
 import android.content.res.ColorStateList;
 import android.graphics.Typeface;
 import android.graphics.drawable.StateListDrawable;
 import android.os.Build;
+import android.text.TextUtils;
 import android.util.Log;
 import android.util.TypedValue;
 import android.view.LayoutInflater;
@@ -192,19 +194,4 @@ public class BottomMenuArrayAdapter extends BaseAdapter {
         return convertView;
     }
     
-    protected void useTextInfo(TextView textView, TextInfo textInfo) {
-        if (textInfo == null) return;
-        if (textView == null) return;
-        if (textInfo.getFontSize() > 0) {
-            textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, textInfo.getFontSize());
-        }
-        if (textInfo.getFontColor() != 1) {
-            textView.setTextColor(textInfo.getFontColor());
-        }
-        if (textInfo.getGravity() != -1) {
-            textView.setGravity(textInfo.getGravity());
-        }
-        Typeface font = Typeface.create(Typeface.SANS_SERIF, textInfo.isBold() ? Typeface.BOLD : Typeface.NORMAL);
-        textView.setTypeface(font);
-    }
 }

+ 7 - 0
DialogX/src/main/java/com/kongzue/dialogx/util/PopMenuArrayAdapter.java

@@ -1,5 +1,7 @@
 package com.kongzue.dialogx.util;
 
+import static com.kongzue.dialogx.interfaces.BaseDialog.useTextInfo;
+
 import android.content.Context;
 import android.content.res.ColorStateList;
 import android.os.Build;
@@ -10,6 +12,7 @@ import android.widget.BaseAdapter;
 import android.widget.ImageView;
 import android.widget.TextView;
 
+import com.kongzue.dialogx.DialogX;
 import com.kongzue.dialogx.R;
 import com.kongzue.dialogx.dialogs.PopMenu;
 
@@ -69,6 +72,10 @@ public class PopMenuArrayAdapter extends BaseAdapter {
         }
         viewHolder.imgDialogxMenuIcon.setVisibility(View.GONE);
         viewHolder.txtDialogxMenuText.setText(menuList.get(position));
+        
+        if (DialogX.menuTextInfo != null) {
+            useTextInfo(viewHolder.txtDialogxMenuText, DialogX.menuTextInfo);
+        }
     
         int textColor = popMenu.isLightTheme() ? R.color.black90 : R.color.white90;
         viewHolder.txtDialogxMenuText.setTextColor(context.getResources().getColor(textColor));

+ 22 - 0
DialogX/src/main/java/com/kongzue/dialogx/util/TextInfo.java

@@ -13,6 +13,8 @@ public class TextInfo {
     private int gravity = -1;               //对齐方式,值为-1时使用默认样式,取值可使用Gravity.CENTER等对齐方式
     private int fontColor = 1;              //文字颜色,值为1时使用默认样式,取值可以用Color.rgb(r,g,b)等方式获取
     private boolean bold = false;           //是否粗体
+    private int maxLines = -1;              //最大行数
+    private boolean showEllipsis = false;   //显示省略号
     
     public int getFontSize() {
         return fontSize;
@@ -50,6 +52,24 @@ public class TextInfo {
         return this;
     }
     
+    public int getMaxLines() {
+        return maxLines;
+    }
+    
+    public TextInfo setMaxLines(int maxLines) {
+        this.maxLines = maxLines;
+        return this;
+    }
+    
+    public boolean isShowEllipsis() {
+        return showEllipsis;
+    }
+    
+    public TextInfo setShowEllipsis(boolean showEllipsis) {
+        this.showEllipsis = showEllipsis;
+        return this;
+    }
+    
     @Override
     public String toString() {
         return "TextInfo{" +
@@ -57,6 +77,8 @@ public class TextInfo {
                 ", gravity=" + gravity +
                 ", fontColor=" + fontColor +
                 ", bold=" + bold +
+                ", maxLines=" + maxLines +
+                ", showEllipsis=" + showEllipsis +
                 '}';
     }
 }

+ 1 - 6
DialogXKongzueStyle/src/main/res/layout/layout_dialogx_poptip_kongzue.xml

@@ -36,10 +36,10 @@
                 android:layout_height="wrap_content"
                 android:layout_marginLeft="20dp"
                 android:layout_marginRight="15dp"
-                android:layout_weight="1"
                 android:gravity="left|center_vertical"
                 android:singleLine="true"
                 android:text="Sure?"
+                android:layout_weight="1"
                 android:textColor="@color/black"
                 android:textSize="14dp" />
 
@@ -49,11 +49,6 @@
                 android:layout_height="wrap_content"
                 android:visibility="gone" />
 
-            <Space
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_weight="1" />
-
             <TextView
                 android:id="@+id/txt_dialogx_button"
                 android:layout_width="wrap_content"

+ 1 - 6
DialogXKongzueStyle/src/main/res/layout/layout_dialogx_poptip_kongzue_dark.xml

@@ -37,9 +37,9 @@
                 android:layout_marginLeft="20dp"
                 android:layout_marginRight="15dp"
                 android:gravity="left|center_vertical"
-                android:layout_weight="1"
                 android:singleLine="true"
                 android:text="Sure?"
+                android:layout_weight="1"
                 android:textColor="@color/white"
                 android:textSize="14dp" />
 
@@ -49,11 +49,6 @@
                 android:layout_height="wrap_content"
                 android:visibility="gone" />
 
-            <Space
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_weight="1" />
-
             <TextView
                 android:id="@+id/txt_dialogx_button"
                 android:layout_width="wrap_content"

BIN
app/release/app-release.apk


+ 2 - 2
app/release/output-metadata.json

@@ -10,8 +10,8 @@
     {
       "type": "SINGLE",
       "filters": [],
-      "versionCode": 42,
-      "versionName": "0.0.43.beta19",
+      "versionCode": 43,
+      "versionName": "0.0.43",
       "outputFile": "app-release.apk"
     }
   ]

+ 1 - 1
gradle.properties

@@ -18,5 +18,5 @@ android.useAndroidX=true
 # Automatically convert third-party libraries to use AndroidX
 android.enableJetifier=true
 
-BUILD_VERSION=0.0.43
+BUILD_VERSION=0.0.44.beta1
 BUILD_VERSION_INT=43