Skip to content

Latest commit

 

History

History
97 lines (78 loc) · 3.74 KB

README_4.md

File metadata and controls

97 lines (78 loc) · 3.74 KB

LoadingDialog -> 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.colorAccent))
    • .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.

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 LoadingDialog(getSupportFragmentManager())
    .setDialogCanvas(getResources().getDrawable(R.drawable.rounded_corner_2))
    ...
    .show();

Animation Dialog Show You can change dialog animation.

Code :

new LoadingDialog(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 :