Skip to content

Latest commit

 

History

History
153 lines (131 loc) · 5.68 KB

README_2.md

File metadata and controls

153 lines (131 loc) · 5.68 KB

InfoDialog -> Customize

You can change UI with this configuration.

1. Title

  • Change Text Title
    • .setTitle("ini title")
  • Change Text Title Size
    • .setTitleSize(21)
  • Change Text Title Color
    • .setTitleColor(getResources().getColor(R.color.colorPrimary))
    • .setTitleColor(Color.parseColor("#03DAC5"))
  • Change Text Title Alignment
    • .setTitleAlignment(View.TEXT_ALIGNMENT_TEXT_END)
      • Available Value :
        • View.TEXT_ALIGNMENT_TEXT_END
        • View.TEXT_ALIGNMENT_CENTER
        • View.TEXT_ALIGNMENT_TEXT_START
        • etc.

2. Content

  • Change Text Content
    • .setContent("ini content")
  • Change Text Content Size
    • .setContentSize(21)
  • Change Text Content Color
    • .setContentColor(getResources().getColor(R.color.colorPrimary))
    • .setContentColor(Color.parseColor("#03DAC5"))
  • Change Text Content Alignment
    • .setContentAlignment(View.TEXT_ALIGNMENT_TEXT_END)
      • Available Value :
        • View.TEXT_ALIGNMENT_TEXT_END
        • View.TEXT_ALIGNMENT_CENTER
        • View.TEXT_ALIGNMENT_TEXT_START
        • etc.

3. Button Ok

  • Change Text Button Ok
    • .setBtnOkTitle("Yuhuu")
  • Change Text Button Ok Color
    • .setBtnOkTitleColor(getResources().getColor(R.color.colorPrimary))
    • .setBtnOkTitleColor(Color.parseColor("#03DAC5"))
  • Change Icon Button Ok
    • .setOkIconLeft(R.drawable.ic_baseline_add_24)
    • .setOkIconTop(R.drawable.ic_baseline_add_24)
    • .setOkIconRight(R.drawable.ic_baseline_add_24)
    • .setOkIconBottom(R.drawable.ic_baseline_add_24)

4. Parent Button

  • Change Text Button Size
    • .setDialogType(DialogType.DialogError)
      • Available Value :
        • DialogType.DialogError -> RED
        • DialogType.DialogSuccess -> GREEN
        • DialogType.DialogWarning -> YELLOW
        • etc.
  • Change Text Button Size
    • .setButtonTextSize(21)
  • Change Style Button
    • .setButtonStyle(ButtonStyle.ButtonContained)
      • Available Value :
        • ButtonStyle.ButtonContained
        • ButtonStyle.ButtonOutlined
        • ButtonStyle.ButtonText
  • Change Gravity Parent Button
    • .setButtonGravity(Gravity.CENTER)
      • Available Value :
        • Gravity.CENTER
        • Gravity.END
        • Gravity.START
        • etc.
  • Change Button Background Color
    • .setButtonColor(getResources().getColor(R.color.colorPrimary)) or .setButtonColor(Color.parseColor("#03DAC5")) you can use this only if you use .setButtonStyle(ButtonStyle.ButtonContained)
  • Disable Text All Caps On Button
    • .setButtonAllCaps(false) default value is true.

Look At Orange Arrow. you can set shape/canvas from drawable to dialog with shape.xml-><shape></shape>. in my example i am using rounded_corner_2.xml.

XML :

<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle" >

    <corners
        android:bottomLeftRadius="0dp"
        android:bottomRightRadius="0dp"
        android:topLeftRadius="10dp"
        android:topRightRadius="10dp" />

    <solid android:color="@android:color/white" />

</shape>

Other Example:

  • Same Radius -> R.drawable.rounded_corner xml Preview
  • Different Radius -> R.drawable.rounded_corner_2 xml Preview
  • Dialog 3D -> R.drawable.rounded_layer xml Preview
  • Shadow Dialog -> R.drawable.dialog_shadow xml Preview

Code :

new InfoDialog(getSupportFragmentManager())
    .setDialogCanvas(getResources().getDrawable(R.drawable.rounded_corner_2))
    ...
    .show();

Animation Dialog Show You can change dialog animation.

Code :

new InfoDialog(getSupportFragmentManager())
    .setAnimationStyle(R.style.CustomDialogStyle)
    ...
    .show();

Here is the style

<resources>

    <!-- res->styles.xml -->
    <style name="CustomDialogStyle" parent="Theme.MaterialComponents.Light.Dialog">
        <item name="android:windowMinWidthMajor">80%</item>
        <item name="android:windowMinWidthMinor">80%</item>
        <item name="android:windowEnterAnimation">@anim/anim_in</item>
        <item name="android:windowExitAnimation">@anim/anim_out</item>
    </style>

</resources>

Style that i prepare for you

FullCode Preview :