* 优化默认Dialog样式的显示细节

pull/27/head
Jenly 4 years ago
parent 2d56132692
commit 5c1c0c1ad6
  1. 12
      app-dialog/src/main/java/com/king/app/dialog/AppDialog.java
  2. 10
      app-dialog/src/main/java/com/king/app/dialog/AppDialogConfig.java
  3. 8
      app-dialog/src/main/java/com/king/app/dialog/fragment/AppDialogFragment.java
  4. 6
      app-dialog/src/main/res/layout/app_dialog.xml
  5. 2
      app-dialog/src/main/res/values/colors.xml
  6. 2
      app-dialog/src/main/res/values/dimens.xml
  7. BIN
      app/release/app-release.apk
  8. 2
      app/release/output.json
  9. 9
      app/src/main/res/layout/dialog.xml
  10. 1
      app/src/main/res/layout/dialog_custom.xml

@ -53,14 +53,10 @@ public enum AppDialog {
btnDialogCancel.setOnClickListener(config.getOnClickCancel() != null ? config.getOnClickCancel() : mOnClickDismissDialog); btnDialogCancel.setOnClickListener(config.getOnClickCancel() != null ? config.getOnClickCancel() : mOnClickDismissDialog);
btnDialogCancel.setVisibility(config.isHideCancel() ? View.GONE : View.VISIBLE); btnDialogCancel.setVisibility(config.isHideCancel() ? View.GONE : View.VISIBLE);
try{ //不强制要求要有中间的线
//不强制要求要有中间的线 View line = view.findViewById(config.getLineId());
View line = view.findViewById(R.id.line); if(line != null){
if(line != null){ line.setVisibility(config.isHideCancel() ? View.GONE : View.VISIBLE);
line.setVisibility(config.isHideCancel() ? View.GONE : View.VISIBLE);
}
}catch (Exception e){
} }
Button btnDialogOK = view.findViewById(config.getOkId()); Button btnDialogOK = view.findViewById(config.getOkId());

@ -36,7 +36,7 @@ public class AppDialogConfig {
/** /**
* 按钮中间分割线ID * 按钮中间分割线ID
*/ */
private @IdRes int line = R.id.line; private @IdRes int lineId = R.id.line;
/** /**
* 标题文本 * 标题文本
*/ */
@ -113,12 +113,12 @@ public class AppDialogConfig {
return this; return this;
} }
public @IdRes int getLine() { public @IdRes int getLineId() {
return line; return lineId;
} }
public AppDialogConfig setLine(@IdRes int line) { public AppDialogConfig setLineId(@IdRes int lineId) {
this.line = line; this.lineId = lineId;
return this; return this;
} }

@ -46,12 +46,10 @@ public class AppDialogFragment extends BaseDialogFragment {
btnDialogCancel.setOnClickListener(config.getOnClickCancel() != null ? config.getOnClickCancel() : getOnClickDismiss()); btnDialogCancel.setOnClickListener(config.getOnClickCancel() != null ? config.getOnClickCancel() : getOnClickDismiss());
btnDialogCancel.setVisibility(config.isHideCancel() ? View.GONE : View.VISIBLE); btnDialogCancel.setVisibility(config.isHideCancel() ? View.GONE : View.VISIBLE);
try{ //不强制要求要有中间的线
//不强制要求要有中间的线 View line = rootView.findViewById(config.getLineId());
View line = rootView.findViewById(R.id.line); if(line != null){
line.setVisibility(config.isHideCancel() ? View.GONE : View.VISIBLE); line.setVisibility(config.isHideCancel() ? View.GONE : View.VISIBLE);
}catch (Exception e){
} }
Button btnDialogOK = rootView.findViewById(config.getOkId()); Button btnDialogOK = rootView.findViewById(config.getOkId());

@ -11,8 +11,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center" android:gravity="center"
android:minHeight="40dp" android:padding="10dp"
android:padding="6dp"
android:lines="1" android:lines="1"
android:textSize="@dimen/app_dialog_title_text_size" android:textSize="@dimen/app_dialog_title_text_size"
android:textColor="@color/app_dialog_title_color" android:textColor="@color/app_dialog_title_color"
@ -24,9 +23,8 @@
android:padding="10dp" android:padding="10dp"
android:textSize="@dimen/app_dialog_content_text_size" android:textSize="@dimen/app_dialog_content_text_size"
android:textColor="@color/app_dialog_content_color" android:textColor="@color/app_dialog_content_color"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp" android:layout_marginBottom="16dp"
android:lineSpacingMultiplier="1" /> android:lineSpacingMultiplier="1.2" />
<include layout="@layout/app_dialog_line_h"/> <include layout="@layout/app_dialog_line_h"/>
<LinearLayout <LinearLayout
android:orientation="horizontal" android:orientation="horizontal"

@ -8,6 +8,6 @@
<color name="app_dialog_button_normal_color">#333333</color> <color name="app_dialog_button_normal_color">#333333</color>
<color name="app_dialog_button_pressed_color">@color/colorAccent</color> <color name="app_dialog_button_pressed_color">@color/colorAccent</color>
<color name="app_dialog_line_color">#d2d2d2</color> <color name="app_dialog_line_color">#f2f2f2</color>
</resources> </resources>

@ -6,5 +6,5 @@
<dimen name="app_dialog_title_text_size">16sp</dimen> <dimen name="app_dialog_title_text_size">16sp</dimen>
<dimen name="app_dialog_content_text_size">16sp</dimen> <dimen name="app_dialog_content_text_size">16sp</dimen>
<dimen name="app_dialog_button_text_size">18sp</dimen> <dimen name="app_dialog_button_text_size">16sp</dimen>
</resources> </resources>

Binary file not shown.

@ -1 +1 @@
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":14,"versionName":"1.0.8-androidx","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}] [{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":16,"versionName":"1.0.9-androidx","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]

@ -11,8 +11,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center" android:gravity="center"
android:minHeight="40dp" android:padding="10dp"
android:padding="6dp"
android:lines="1" android:lines="1"
android:textSize="16sp" android:textSize="16sp"
android:background="@drawable/dialog_title_bg" android:background="@drawable/dialog_title_bg"
@ -22,8 +21,10 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="10dp" android:padding="10dp"
android:layout_marginBottom="6dp" android:textSize="@dimen/app_dialog_content_text_size"
android:lineSpacingMultiplier="1" /> android:textColor="@color/app_dialog_content_color"
android:layout_marginBottom="16dp"
android:lineSpacingMultiplier="1.2" />
<include layout="@layout/app_dialog_line_h"/> <include layout="@layout/app_dialog_line_h"/>
<LinearLayout <LinearLayout
android:orientation="horizontal" android:orientation="horizontal"

@ -11,7 +11,6 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center" android:gravity="center"
android:minHeight="40dp"
android:padding="6dp" android:padding="6dp"
android:lines="1" android:lines="1"
android:textSize="16sp" android:textSize="16sp"

Loading…
Cancel
Save