diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index ae388c2..385c6f5 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -11,7 +11,10 @@
diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml
new file mode 100644
index 0000000..568bea1
--- /dev/null
+++ b/.idea/kotlinc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SJDialog/.gitignore b/SJDialog/.gitignore
new file mode 100644
index 0000000..42afabf
--- /dev/null
+++ b/SJDialog/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/SJDialog/BasicDialogDoc.md b/SJDialog/BasicDialogDoc.md
new file mode 100644
index 0000000..170d04e
--- /dev/null
+++ b/SJDialog/BasicDialogDoc.md
@@ -0,0 +1,147 @@
+# BasicDialog Documentation
+Create dialog example
+```java
+BasicDialog dialog = new BasicDialog();
+dialog.Builder(context)
+ .setTitle("Title")
+ .setLeftButtonText("button1")
+ .setRightButtonText("button2")
+ .onButtonClick(() -> {
+ // Do something
+ })
+ .show();
+```
+
+## Builder
+Apply the default theme to a dialog
+```java
+dialog.Builder(context)
+```
+
+
+Apply the app theme to a dialog **(only works with material3 theme)**
+```java
+dialog.Builder(context,true)
+```
+Apply the custom theme to a dialog **(only works with material3 theme)**
+```java
+dialog.Builder(context,theme)
+```
+## Old Dialog theme
+By default dialog colors will be set to material3 dynamic colors. With this method you can set the dialog color for the background and buttons to the older non-dynamic colors
+```java
+dialog.setOldTheme();
+```
+
+## Add onClick Listener
+onClickListener for right button. The left button is for dismissing dialog
+```java
+dialog.onButtonClick(new DialogButtonEvent() {
+ @Override
+ public void onButtonClick() {
+ // Do something
+ }
+});
+
+//or
+
+dialog.onButtonClick(() -> {
+ // Do something
+});
+```
+onClickListener for left and right button
+```java
+dialog.onButtonClick(new DialogButtonEvents() {
+ @Override
+ public void onLeftButtonClick() {
+ // Do something
+ }
+
+ @Override
+ public void onRightButtonClick() {
+ // Do something
+ }
+});
+```
+
+## All BasicDialog Methods
+```java
+//Create dialog
+dialog.Builder(context);
+
+//Usin the old dialog theme
+dialog.setOldTheme();
+
+//Set title
+dialog.setTitle("Title");
+//Set message
+dialog.setMessage("Message");
+//Set title text alignment
+dialog.setTitleAlignment(TextAlignment);
+//Set message text alignment
+dialog.setMessageAlignment(TextAlignment);
+//Set left button text
+dialog.setLeftButtonText("Text");
+//Set right button text
+dialog.setRightButtonText("Text");
+
+//Set text color
+dialog.setTextColor(color);
+//Set title text color
+dialog.setTitleTextColor(color);
+//Set message text color
+dialog.setMessageTextColor(color);
+
+//Set buttons color
+dialog.setButtonsColor(color);
+//Set left button color
+dialog.setLeftButtonColor(color);
+//Set right button color
+dialog.setRightButtonColor(color);
+
+//Set buttons text color
+dialog.setButtonsTextColor(color);
+//Set text color for left button
+dialog.setLeftButtonTextColor(color);
+//Set text color for right button
+dialog.setRightButtonTextColor(color);
+
+//Set buttons background resource
+dialog.setButtonsBackgroundResource(drawable);
+//Set left button background resource
+dialog.setLeftButtonBackgroundResource(drawable);
+//Set right button background resource
+dialog.setRightButtonBackgroundResource(drawable);
+
+//Set dialog color
+dialog.setDialogBackgroundColor(color);
+//Set dialog background resource
+dialog.setDialogBackgroundResource(drawable);
+
+//Set maximum dialog width. Default is 600dp
+dialog.setMaxDialogWidth(width);
+
+//Get maximum dialog width
+int dialogWidth = dialog.getMaxDialogWidth();
+
+//Get left button
+Button leftButton = dialog.getLeftButton();
+//Get right button
+Button rightButton = dialog.getRightButton();
+
+//Set dialog animations
+dialog.setDialogAnimations(styleRes);
+
+//Enable or disable swipe down to dismiss dialog.
+//By default is set to true
+dialog.swipeToDismiss(boolean);
+
+//Set dialog onTouchListener.
+//This method will overide swipe down to dismiss action
+dialog.setOnTouchListener(onTouchListener);
+
+//Shew dialog
+dialog.show();
+//Dismiss dialog
+dialog.dismiss();
+```
diff --git a/SJDialog/CustomViewDialogDoc.md b/SJDialog/CustomViewDialogDoc.md
new file mode 100644
index 0000000..040a57f
--- /dev/null
+++ b/SJDialog/CustomViewDialogDoc.md
@@ -0,0 +1,200 @@
+# CustomViewDialog Documentation
+## Examples
+#### Add button example
+```java
+Button button1 = new Button(this);
+button1.setText("Button");
+
+CustomViewDialog customViewDialog = new CustomViewDialog();
+customViewDialog.Builder(this)
+ .setTitle("Title")
+ .addCustomView(button1)
+ .show();
+```
+
+#### Add EditText example
+```java
+EditText editText = new EditText(this);
+editText.setHint("add text");
+
+CustomViewDialog customViewDialog = new CustomViewDialog();
+customViewDialog.Builder(this)
+ .setTitle("Title")
+ .dialogWithTwoButtons()
+ .addCustomView(editText)
+ .onButtonClick(() -> {
+ String text = editText.getText().toString();
+ // Do something
+ })
+ .show();
+```
+
+#### Add custom xml layout example
+```java
+View view = LayoutInflater.from(this).inflate(R.layout.custon_layout,null);
+
+CustomViewDialog customViewDialog = new CustomViewDialog();
+customViewDialog.Builder(this)
+ .setTitle("Title")
+ .dialogWithTwoButtons()
+ .addCustomView(view)
+ .show();
+
+```
+
+## Builder
+Apply the default theme to a dialog
+```java
+customViewDialog.Builder(context)
+```
+
+Apply the app theme to a dialog **(only works with material3 theme)**
+```java
+customViewDialog.Builder(context,true)
+```
+Apply the custom theme to a dialog **(only works with material3 theme)**
+```java
+customViewDialog.Builder(context,theme)
+```
+## Dialog with two buttons
+```java
+customViewDialog.dialogWithTwoButtons();
+```
+## Old Dialog theme
+By default dialog colors will be set to material3 dynamic colors. With this method you can set the dialog color for the background and buttons to the older non-dynamic colors
+```java
+customViewDialog.setOldTheme();
+```
+
+## Add View
+```java
+customViewDialog.addCustomView(view);
+```
+
+## Add onClick Listener
+onClickListener for the right button if the dialog has [two buttons](#dialog-with-two-buttons), the left button is for dismissing dialog. If the dialog has only one button, onClickListener will be set to that button.
+```java
+customViewDialog.onButtonClick(new DialogButtonEvent() {
+ @Override
+ public void onButtonClick() {
+ // Do something
+ }
+});
+
+//or
+
+customViewDialog.onButtonClick(() -> {
+ // Do something
+});
+```
+onClickListener for left and right button (only works when dialog has [two buttons](#dialog-with-two-buttons))
+```java
+customViewDialog.onButtonClick(new DialogButtonEvents() {
+ @Override
+ public void onLeftButtonClick() {
+ // Do something
+ }
+
+ @Override
+ public void onRightButtonClick() {
+ // Do something
+ }
+});
+```
+## All CustomViewDialog Methods
+```java
+//Create dialog
+customViewDialog.Builder(context);
+
+//Create dialog width two buttons
+customViewDialog.dialogWithTwoButtons();
+
+//Usin the old dialog theme
+customViewDialog.setOldTheme();
+
+//Set title
+customViewDialog.setTitle("Title");
+//Set message
+customViewDialog.setMessage("Message");
+
+//Set title text alignment
+customViewDialog.setTitleAlignment(TextAlignment);
+//Set message text alignment
+customViewDialog.setMessageAlignment(TextAlignment);
+
+//Set text color
+customViewDialog.setTextColor(color);
+//Set title text color
+customViewDialog.setTitleTextColor(color);
+//Set message text color
+customViewDialog.setMessageTextColor(color);
+
+//Set button text (one button dialog)
+customViewDialog.setButtonText("Text");
+//Set left button text
+customViewDialog.setLeftButtonText("Text");
+//Set right button text
+customViewDialog.setRightButtonText("Text");
+
+//Set buttons color
+customViewDialog.setButtonsColor(color);
+//Set button color (one button dialog)
+customViewDialog.setButtonColor(color);
+//Set left button color
+customViewDialog.setLeftButtonColor(color);
+//Set right button color
+customViewDialog.setRightButtonColor(color);
+
+//Set buttons text color
+customViewDialog.setButtonsTextColor(color);
+//Set text color a button (one button dialog)
+customViewDialog.setButtonTextColor(color);
+//Set text color for left button
+customViewDialog.setLeftButtonTextColor(color);
+//Set text color for right button
+customViewDialog.setRightButtonTextColor(color);
+
+//Set buttons background resource
+customViewDialog.setButtonsBackgroundResource(drawable);
+//Set button background resource (one button dialog)
+customViewDialog.setButtonBackgroundResource(drawable);
+//Set left button background resource
+customViewDialog.setLeftButtonBackgroundResource(drawable);
+//Set right button background resource
+customViewDialog.setRightButtonBackgroundResource(drawable);
+
+//Set dialog color
+customViewDialog.setDialogBackgroundColor(color);
+//Set dialog background resource
+customViewDialog.setDialogBackgroundResource(drawable);
+
+//Add Custom view
+customViewDialog.addCustomView(view);
+
+//Set maximum dialog width. Default is 600dp
+customViewDialog.setMaxDialogWidth(width);
+
+//Get maximum dialog width
+int dialogWidth = customViewDialog.getMaxDialogWidth();
+
+//Get left button
+Button leftButton = customViewDialog.getLeftButton();
+//Get right button
+Button rightButton = customViewDialog.getRightButton();
+
+//Set dialog animations
+customViewDialog.setDialogAnimations(styleRes);
+
+//Enable or disable swipe down to dismiss dialog.
+//By default is set to true
+dialog.swipeToDismiss(boolean);
+
+//Set dialog onTouchListener.
+//This method will overide swipe down to dismiss action
+dialog.setOnTouchListener(onTouchListener);
+
+//Shew dialog
+customViewDialog.show();
+//Dismiss dialog
+customViewDialog.dismiss();
+```
diff --git a/SJDialog/ListDialogDoc.md b/SJDialog/ListDialogDoc.md
new file mode 100644
index 0000000..233a1c7
--- /dev/null
+++ b/SJDialog/ListDialogDoc.md
@@ -0,0 +1,428 @@
+# ListDialog Documentation
+## Examples
+#### List of String array
+```java
+String[] strings = {"item1","item2","item3"};
+
+ListDialog listDialog = new ListDialog();
+listDialog.Builder(this)
+ .setItems(strings,(position, value) -> {
+ // Do something
+ })
+ .show();
+```
+
+#### List of Objects
+```java
+class ExampleObject{
+ String value;
+
+ public ExampleObject(String value) {
+ this.value = value;
+ }
+}
+```
+
+```java
+ExampleObject[] objects = {new ExampleObject("object1"),new ExampleObject("object2"),new ExampleObject("object3")};
+
+ListDialog listDialog = new ListDialog();
+listDialog.Builder(this)
+ .setItems(
+ objects,
+ obj -> obj.value, // get value from object
+ (position, value) -> {
+ // Do something
+ })
+ .show();
+```
+
+#### ArrayList of Objects with two values
+```java
+class ExampleObject{
+ String value1;
+ String value2;
+
+ public ExampleObject(String value1, String value2) {
+ this.value1 = value1;
+ this.value2 = value2;
+ }
+}
+```
+```java
+ArrayList arrayList = new ArrayList<>();
+arrayList.add(new ExampleObject("object1","value1"));
+arrayList.add(new ExampleObject("object2","value2"));
+arrayList.add(new ExampleObject("object3","value3"));
+
+ListDialog listDialog = new ListDialog();
+listDialog.Builder(this)
+ .setItems(
+ arrayList,
+ new ListItemValues() {
+ @Override
+ public String getValue1(ExampleObject obj) {
+ return obj.value1;
+ }
+
+ @Override
+ public String getValue2(ExampleObject obj) {
+ return obj.value2;
+ }
+ },
+ (position, value) -> {
+ // Do something
+ })
+ .show();
+```
+
+#### Selecting multiple items in a list
+```java
+ArrayList stringArrayList = new ArrayList<>();
+stringArrayList.add("item1");
+stringArrayList.add("item2");
+stringArrayList.add("item3");
+
+ListDialog listDialog = new ListDialog();
+listDialog.Builder(this)
+ .dialogWithTwoButtons()
+ .setSelectableList()
+ .setItems(stringArrayList,obj -> obj)
+ .onButtonClick(() -> {
+ ArrayList selectedItems = listDialog.getSelectedItems();
+ // Do something
+ })
+ .show();
+```
+
+## Builder
+Apply the default theme to a dialog
+```java
+listDialog.Builder(context)
+```
+
+Apply the app theme to a dialog **(only works with material3 theme)**
+```java
+listDialog.Builder(context,true)
+```
+Apply the custom theme to a dialog **(only works with material3 theme)**
+```java
+listDialog.Builder(context,theme)
+```
+## Dialog with two buttons
+```java
+listDialog.dialogWithTwoButtons();
+```
+## Old Dialog theme
+By default dialog colors will be set to material3 dynamic colors. With this method you can set the dialog color for the background and buttons to the older non-dynamic colors
+```java
+listDialog.setOldTheme();
+```
+
+## Select multiple items in a list
+```java
+listDialog.setSelectableList();
+```
+## Add items in a list
+You can add item in a list by setting [ReciclerView Adapter](#set-reciclerview-adapter), using [setItems()](#setitems) method or using [setImageItems()](#setimageitems) method for list with icons.
+### Set ReciclerView Adapter
+```java
+listDialog.setAdapter(recyclerViewAdapter);
+```
+### setItems
+This method uses [DefaultListAdapter](/SJDialog/src/main/java/com/sjapps/library/customdialog/adapter/DefaultListAdapter.java) for array of Strings or [DefaultListAdapterGeneric](/SJDialog/src/main/java/com/sjapps/library/customdialog/adapter/DefaultListAdapterGeneric.java) for array of Objects or ArrayList.
+
+#### Array of Strings
+You need to use [setSelectableList()](#select-multiple-items-in-a-list) firstly or add [onListItemClick](#array-of-strings-and-onlistitemclick)
+```java
+listDialog.setItems(strings);
+```
+#### Array of Strings and onListItemClick
+```java
+listDialog.setItems(strings,(position, value) -> {
+ // Do something
+});
+```
+#### Array of Objects
+You need to use [setSelectableList()](#select-multiple-items-in-a-list) firstly or add [onListItemClick](#array-of-objects-and-onlistitemclick)
+```java
+listDialog.setItems(objects, new ListItemValue() {
+ @Override
+ public String getValue(ExampleObject obj) {
+ return obj.value; // get value of an Object
+ }
+});
+
+//or
+
+listDialog.setItems(objects,obj -> obj.value);
+```
+#### Array of Objects and onListItemClick
+```java
+listDialog.setItems(objects,obj -> obj.value,(position, obj) -> {
+ // Do something
+});
+```
+#### Array of Objects with two values
+You need to use [setSelectableList()](#select-multiple-items-in-a-list) firstly or add [onListItemClick](#array-of-objects-with-two-values-and-onlistitemclick)
+```java
+listDialog.setItems(objects, new ListItemValues() {
+ @Override
+ public String getValue1(ExampleObject obj) {
+ return obj.value1;
+ }
+
+ @Override
+ public String getValue2(ExampleObject obj) {
+ return obj.value2;
+ }
+});
+```
+#### Array of Objects with two values and onListItemClick
+```java
+listDialog.setItems(objects, new ListItemValues() {
+ @Override
+ public String getValue1(ExampleObject obj) {
+ return obj.value1;
+ }
+
+ @Override
+ public String getValue2(ExampleObject obj) {
+ return obj.value2;
+ }
+ },(position, obj) -> {
+ // Do something
+});
+```
+#### ArrayList
+You need to use [setSelectableList()](#select-multiple-items-in-a-list) firstly or add [onListItemClick](#arraylist-and-onlistitemclick)
+```java
+listDialog.setItems(arrayList,obj -> obj.value);
+```
+#### ArrayList and onListItemClick
+```java
+listDialog.setItems(arrayList,obj -> obj.value,(position, obj) -> {
+ // Do something
+});
+```
+#### ArrayList with two values
+You need to use [setSelectableList()](#select-multiple-items-in-a-list) firstly or add [onListItemClick](#arraylist-with-two-values-and-onlistitemclick)
+```java
+listDialog.setItems(arrayList, new ListItemValues() {
+ @Override
+ public String getValue1(ExampleObject obj) {
+ return obj.value1;
+ }
+
+ @Override
+ public String getValue2(ExampleObject obj) {
+ return obj.value2;
+ }
+});
+```
+#### ArrayList with two values and onListItemClick
+```java
+listDialog.setItems(arrayList, new ListItemValues() {
+ @Override
+ public String getValue1(ExampleObject obj) {
+ return obj.value1;
+ }
+
+ @Override
+ public String getValue2(ExampleObject obj) {
+ return obj.value2;
+ }
+ },(position, obj) -> {
+ // Do something
+});
+```
+### setImageItems
+Creating ArrayList of [ImageListItem](/SJDialog/src/main/java/com/sjapps/library/customdialog/ImageListItem.java)
+```java
+ArrayList listItems = new ArrayList<>();
+listItems.add(new ImageListItem("item1", drawable1));
+// or adding data of type Object
+listItems.add(new ImageListItem("item2", drawable2,data));
+```
+#### ArrayList of ImageListItem
+You need to use [setSelectableList()](#select-multiple-items-in-a-list) firstly or add [onListItemClick](#arraylist-of-two-imagelistitem-and-onlistitemclick)
+```java
+listDialog.setImageItems(listItems);
+```
+#### ArrayList of ImageListItem and onListItemClick
+```java
+listDialog.setImageItems(listItems, (position, obj) -> {
+ // Do something
+});
+```
+## Set RecyclerView LayoutManager
+```java
+listDialog.setLayoutManager(layoutManager);
+```
+
+## Add onClick Listener
+onClickListener for the right button if the dialog has [two buttons](#dialog-with-two-buttons), the left button is for dismissing dialog. If the dialog has only one button, onClickListener will be set to that button.
+```java
+listDialog.onButtonClick(new DialogButtonEvent() {
+ @Override
+ public void onButtonClick() {
+ // Do something
+ }
+});
+
+//or
+
+listDialog.onButtonClick(() -> {
+ // Do something
+});
+```
+onClickListener for left and right button (only works when dialog has [two buttons](#dialog-with-two-buttons))
+```java
+listDialog.onButtonClick(new DialogButtonEvents() {
+ @Override
+ public void onLeftButtonClick() {
+ // Do something
+ }
+ @Override
+ public void onRightButtonClick() {
+ // Do something
+ }
+});
+```
+## All ListDialog Methods
+```java
+//Create dialog
+listDialog.Builder(context);
+
+//Create dialog width two buttons
+listDialog.dialogWithTwoButtons();
+
+//Usin the old dialog theme
+listDialog.setOldTheme();
+
+//Set title
+listDialog.setTitle("Title");
+
+//Set message
+listDialog.setMessage("Message");
+
+//Set title text alignment
+listDialog.setTitleAlignment(TextAlignment);
+//Set message text alignment
+listDialog.setMessageAlignment(TextAlignment);
+
+//Set text color
+listDialog.setTextColor(color);
+//Set title text color
+listDialog.setTitleTextColor(color);
+//Set message text color
+listDialog.setMessageTextColor(color);
+
+//Set button text (one button dialog)
+listDialog.setButtonText("Text");
+//Set left button text
+listDialog.setLeftButtonText("Text");
+//Set right button text
+listDialog.setRightButtonText("Text");
+
+//Set buttons color
+listDialog.setButtonsColor(color);
+//Set button color (one button dialog)
+listDialog.setButtonColor(color);
+//Set left button color
+listDialog.setLeftButtonColor(color);
+//Set right button color
+listDialog.setRightButtonColor(color);
+
+//Set buttons text color
+listDialog.setButtonsTextColor(color);
+//Set text color a button (one button dialog)
+listDialog.setButtonTextColor(color);
+//Set text color for left button
+listDialog.setLeftButtonTextColor(color);
+//Set text color for right button
+listDialog.setRightButtonTextColor(color);
+
+//Set buttons background resource
+listDialog.setButtonsBackgroundResource(drawable);
+//Set button background resource (one button dialog)
+listDialog.setButtonBackgroundResource(drawable);
+//Set left button background resource
+listDialog.setLeftButtonBackgroundResource(drawable);
+//Set right button background resource
+listDialog.setRightButtonBackgroundResource(drawable);
+
+//Set dialog color
+listDialog.setDialogBackgroundColor(color);
+//Set dialog background resource
+listDialog.setDialogBackgroundResource(drawable);
+
+//Selecting multiple items in a list
+listDialog.setSelectableList();
+
+//Set text color of an items in a list
+listDialog.setListItemTextColor(color);
+//Set a background resource for items in a list
+listDialog.setListItemBackgroundResource(drawable);
+//Set a background resource for selected items in a list
+listDialog.setListItemSelectedBackgroundResource(drawable);
+//Set a background resource of a list
+listDialog.setListBackgroundResource(drawable);
+
+//Get list item background resource
+int ItemBgRes = listDialog.getListItemBgRes();
+//Get list item selected background resource
+int ItemBgResSelected = listDialog.getListItemBgResSelected();
+
+//set RecyclerView Adapter
+listDialog.setAdapter(recyclerViewAdapter);
+//Set Layout Manager
+listDialog.setLayoutManager(layoutManager);
+
+//Add items in a list
+listDialog.setItems(strings);
+listDialog.setItems(strings, listItemClick);
+listDialog.setItems(objects, listItemValue);
+listDialog.setItems(objects, listItemValue, listItemClickObj);
+listDialog.setItems(objects, listItemValues);
+listDialog.setItems(objects, listItemValues, listItemClickObj);
+listDialog.setItems(arrayList, listItemValue);
+listDialog.setItems(arrayList, listItemValue, listItemClickObj);
+listDialog.setItems(arrayList, listItemValues);
+listDialog.setItems(arrayList, listItemValues, listItemClickObj);
+listDialog.setImageItems(listItems);
+listDialog.setImageItems(listItems, listItemClickObj);
+
+//Hide 'List is empty' text
+listDialog.hideEmptyListText();
+//Change empty list text
+listDialog.setEmptyListText("text");
+
+//Set maximum dialog width. Default is 600dp
+listDialog.setMaxDialogWidth(width);
+
+//Get maximum dialog width
+int dialogWidth = listDialog.getMaxDialogWidth();
+
+//Get left button
+Button leftButton = listDialog.getLeftButton();
+
+//Get right button
+Button rightButton = listDialog.getRightButton();
+
+//Set dialog animations
+listDialog.setDialogAnimations(styleRes);
+
+//Enable or disable swipe down to dismiss dialog.
+//By default is set to true
+dialog.swipeToDismiss(boolean);
+
+//Set dialog onTouchListener.
+//This method will overide swipe down to dismiss action
+dialog.setOnTouchListener(onTouchListener);
+
+//Shew dialog
+listDialog.show();
+//Dismiss dialog
+listDialog.dismiss();
+```
diff --git a/SJDialog/MessageDialogDoc.md b/SJDialog/MessageDialogDoc.md
new file mode 100644
index 0000000..5be6a2a
--- /dev/null
+++ b/SJDialog/MessageDialogDoc.md
@@ -0,0 +1,112 @@
+# MessageDialog Documentation
+Message dialog example
+```java
+MessageDialog messageDialog = new MessageDialog();
+messageDialog.Builder(context)
+ .setTitle("Title")
+ .setMessage("Message")
+ .show();
+```
+
+## Builder
+Apply the default theme to a dialog
+```java
+messageDialog.Builder(context)
+```
+
+Apply the app theme to a dialog **(only works with material3 theme)**
+```java
+messageDialog.Builder(context,true)
+```
+Apply the custom theme to a dialog **(only works with material3 theme)**
+```java
+messageDialog.Builder(context,theme)
+```
+## Old Dialog theme
+By default dialog colors will be set to material3 dynamic colors. With this method you can set the dialog color for the background and buttons to the older non-dynamic colors
+```java
+messageDialog.setOldTheme();
+```
+
+## Add onClick Listener
+```java
+messageDialog.onButtonClick(new DialogButtonEvent() {
+ @Override
+ public void onButtonClick() {
+ // Do something
+ }
+});
+
+//or
+
+messageDialog.onButtonClick(() -> {
+ // Do something
+});
+```
+## All MessageDialog Methods
+```java
+//Create dialog
+messageDialog.Builder(context);
+
+//Usin the old dialog theme
+messageDialog.setOldTheme();
+
+//Set title
+messageDialog.setTitle("Title");
+//Set message
+messageDialog.setMessage("Message");
+
+//Set title text alignment
+messageDialog.setTitleAlignment(TextAlignment);
+//Set message text alignment
+messageDialog.setMessageAlignment(TextAlignment);
+
+//Set button text
+messageDialog.setButtonText("Text");
+
+//Set text color
+messageDialog.setTextColor(color);
+//Set title text color
+messageDialog.setTitleTextColor(color);
+//Set message text color
+messageDialog.setMessageTextColor(color);
+
+//Set button color
+messageDialog.setButtonColor(color);
+
+//Set button text color
+messageDialog.setButtonTextColor(color);
+
+//Set button background resource
+messageDialog.setButtonBackgroundResource(drawable);
+
+//Set dialog color
+messageDialog.setDialogBackgroundColor(color);
+//Set dialog background resource
+messageDialog.setDialogBackgroundResource(drawable);
+
+//Set maximum dialog width. Default is 600dp
+messageDialog.setMaxDialogWidth(width);
+
+//Get maximum dialog width
+int dialogWidth = messageDialog.getMaxDialogWidth();
+
+//Get button
+Button Button = messageDialog.getButton();
+
+//Set dialog animations
+messageDialog.setDialogAnimations(styleRes);
+
+//Enable or disable swipe down to dismiss dialog.
+//By default is set to true
+dialog.swipeToDismiss(boolean);
+
+//Set dialog onTouchListener.
+//This method will overide swipe down to dismiss action
+dialog.setOnTouchListener(onTouchListener);
+
+//Shew dialog
+messageDialog.show();
+//Dismiss dialog
+messageDialog.dismiss();
+```
diff --git a/SJDialog/build.gradle b/SJDialog/build.gradle
new file mode 100644
index 0000000..b9da45f
--- /dev/null
+++ b/SJDialog/build.gradle
@@ -0,0 +1,39 @@
+plugins {
+ id 'com.android.library'
+}
+
+android {
+ compileSdk 31
+
+ defaultConfig {
+ minSdk 23
+ versionCode 20
+ versionName "1.6"
+
+ buildConfigField 'int', 'VERSION_CODE', "${versionCode}"
+ buildConfigField 'String', 'VERSION_NAME', "\"${versionName}\""
+
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+ consumerProguardFiles "consumer-rules.pro"
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_9
+ targetCompatibility JavaVersion.VERSION_1_9
+ }
+}
+
+dependencies {
+
+ implementation 'androidx.appcompat:appcompat:1.4.2'
+ implementation 'com.google.android.material:material:1.6.1'
+ testImplementation 'junit:junit:4.+'
+ androidTestImplementation 'androidx.test.ext:junit:1.1.3'
+ androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
+}
diff --git a/SJDialog/consumer-rules.pro b/SJDialog/consumer-rules.pro
new file mode 100644
index 0000000..e69de29
diff --git a/SJDialog/images/BasicDialog day-night.png b/SJDialog/images/BasicDialog day-night.png
new file mode 100644
index 0000000..00180e3
Binary files /dev/null and b/SJDialog/images/BasicDialog day-night.png differ
diff --git a/SJDialog/images/BasicDialog example 1.png b/SJDialog/images/BasicDialog example 1.png
new file mode 100644
index 0000000..2de2b1b
Binary files /dev/null and b/SJDialog/images/BasicDialog example 1.png differ
diff --git a/SJDialog/images/BasicDialog oldTheme.png b/SJDialog/images/BasicDialog oldTheme.png
new file mode 100644
index 0000000..2b75454
Binary files /dev/null and b/SJDialog/images/BasicDialog oldTheme.png differ
diff --git a/SJDialog/images/CustomViewDialog day-night.png b/SJDialog/images/CustomViewDialog day-night.png
new file mode 100644
index 0000000..0275af4
Binary files /dev/null and b/SJDialog/images/CustomViewDialog day-night.png differ
diff --git a/SJDialog/images/CustomViewDialog example 1.png b/SJDialog/images/CustomViewDialog example 1.png
new file mode 100644
index 0000000..0be8953
Binary files /dev/null and b/SJDialog/images/CustomViewDialog example 1.png differ
diff --git a/SJDialog/images/CustomViewDialog example 2.png b/SJDialog/images/CustomViewDialog example 2.png
new file mode 100644
index 0000000..b9bb1a8
Binary files /dev/null and b/SJDialog/images/CustomViewDialog example 2.png differ
diff --git a/SJDialog/images/CustomViewDialog example 3.png b/SJDialog/images/CustomViewDialog example 3.png
new file mode 100644
index 0000000..2c3140e
Binary files /dev/null and b/SJDialog/images/CustomViewDialog example 3.png differ
diff --git a/SJDialog/images/CustomViewDialog oldTheme.png b/SJDialog/images/CustomViewDialog oldTheme.png
new file mode 100644
index 0000000..431de53
Binary files /dev/null and b/SJDialog/images/CustomViewDialog oldTheme.png differ
diff --git a/SJDialog/images/ListDialog day-night.png b/SJDialog/images/ListDialog day-night.png
new file mode 100644
index 0000000..4b04f17
Binary files /dev/null and b/SJDialog/images/ListDialog day-night.png differ
diff --git a/SJDialog/images/ListDialog example 1.png b/SJDialog/images/ListDialog example 1.png
new file mode 100644
index 0000000..14c104a
Binary files /dev/null and b/SJDialog/images/ListDialog example 1.png differ
diff --git a/SJDialog/images/ListDialog example 2.png b/SJDialog/images/ListDialog example 2.png
new file mode 100644
index 0000000..237e20a
Binary files /dev/null and b/SJDialog/images/ListDialog example 2.png differ
diff --git a/SJDialog/images/ListDialog example 3.png b/SJDialog/images/ListDialog example 3.png
new file mode 100644
index 0000000..2acac3d
Binary files /dev/null and b/SJDialog/images/ListDialog example 3.png differ
diff --git a/SJDialog/images/ListDialog example 4.png b/SJDialog/images/ListDialog example 4.png
new file mode 100644
index 0000000..38a6943
Binary files /dev/null and b/SJDialog/images/ListDialog example 4.png differ
diff --git a/SJDialog/images/ListDialog oldTheme.png b/SJDialog/images/ListDialog oldTheme.png
new file mode 100644
index 0000000..c31707d
Binary files /dev/null and b/SJDialog/images/ListDialog oldTheme.png differ
diff --git a/SJDialog/images/MessageDialog day-night.png b/SJDialog/images/MessageDialog day-night.png
new file mode 100644
index 0000000..5bf0194
Binary files /dev/null and b/SJDialog/images/MessageDialog day-night.png differ
diff --git a/SJDialog/images/MessageDialog error_day-night.png b/SJDialog/images/MessageDialog error_day-night.png
new file mode 100644
index 0000000..f775ff9
Binary files /dev/null and b/SJDialog/images/MessageDialog error_day-night.png differ
diff --git a/SJDialog/images/MessageDialog error_oldTheme.png b/SJDialog/images/MessageDialog error_oldTheme.png
new file mode 100644
index 0000000..dccc1d4
Binary files /dev/null and b/SJDialog/images/MessageDialog error_oldTheme.png differ
diff --git a/SJDialog/images/MessageDialog example.png b/SJDialog/images/MessageDialog example.png
new file mode 100644
index 0000000..76fa94b
Binary files /dev/null and b/SJDialog/images/MessageDialog example.png differ
diff --git a/SJDialog/images/MessageDialog oldTheme.png b/SJDialog/images/MessageDialog oldTheme.png
new file mode 100644
index 0000000..ca1ebd1
Binary files /dev/null and b/SJDialog/images/MessageDialog oldTheme.png differ
diff --git a/SJDialog/proguard-rules.pro b/SJDialog/proguard-rules.pro
new file mode 100644
index 0000000..481bb43
--- /dev/null
+++ b/SJDialog/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
\ No newline at end of file
diff --git a/SJDialog/src/androidTest/java/com/sjapps/library/ExampleInstrumentedTest.java b/SJDialog/src/androidTest/java/com/sjapps/library/ExampleInstrumentedTest.java
new file mode 100644
index 0000000..60f6181
--- /dev/null
+++ b/SJDialog/src/androidTest/java/com/sjapps/library/ExampleInstrumentedTest.java
@@ -0,0 +1,26 @@
+package com.sjapps.library;
+
+import android.content.Context;
+
+import androidx.test.platform.app.InstrumentationRegistry;
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static org.junit.Assert.*;
+
+/**
+ * Instrumented test, which will execute on an Android device.
+ *
+ * @see Testing documentation
+ */
+@RunWith(AndroidJUnit4.class)
+public class ExampleInstrumentedTest {
+ @Test
+ public void useAppContext() {
+ // Context of the app under test.
+ Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
+ assertEquals("com.sjapps.library.test", appContext.getPackageName());
+ }
+}
\ No newline at end of file
diff --git a/SJDialog/src/main/AndroidManifest.xml b/SJDialog/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..c5a6f90
--- /dev/null
+++ b/SJDialog/src/main/AndroidManifest.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/SJDialog/src/main/java/com/sjapps/library/customdialog/BasicDialog.java b/SJDialog/src/main/java/com/sjapps/library/customdialog/BasicDialog.java
new file mode 100644
index 0000000..717cac4
--- /dev/null
+++ b/SJDialog/src/main/java/com/sjapps/library/customdialog/BasicDialog.java
@@ -0,0 +1,437 @@
+package com.sjapps.library.customdialog;
+
+import android.content.Context;
+import android.view.View;
+import android.widget.Button;
+import android.widget.TextView;
+
+import androidx.annotation.ColorInt;
+import androidx.annotation.DrawableRes;
+import androidx.annotation.StyleRes;
+
+import com.sjapps.library.R;
+/**@since 1.6*/
+@SuppressWarnings("unused")
+public class BasicDialog extends SJDialog{
+ @Deprecated
+ public static final String LONG_TYPE = "long";
+ @Deprecated
+ public static final String SHORT_TYPE = "short";
+
+ private boolean isDeleteDialog;
+
+ public BasicDialog(){
+ twoButtons = true;
+ }
+ /** @since 1.4*/
+ public BasicDialog Short(Context context, String Title){
+ return Short(context,Title,null);
+ }
+ /** @since 1.0*/
+ public BasicDialog Short(Context context, String Title, String Btn1Txt, String Btn2Txt){
+ return Builder(context,Title,null,Btn1Txt,Btn2Txt);
+ }
+ /** @since 1.0*/
+ public BasicDialog Short(Context context, String Title, String Btn2Txt){
+ return Short(context,Title,null,Btn2Txt);
+ }
+ /** @since 1.4*/
+ public BasicDialog Long(Context context, String Title, String Message){
+ return Long(context,Title,Message,null);
+ }
+ /** @since 1.0*/
+ public BasicDialog Long(Context context, String Title, String Text, String Btn1Txt, String Btn2Txt){
+ return Builder(context,Title,Text,Btn1Txt,Btn2Txt);
+ }
+ /** @since 1.0*/
+ public BasicDialog Long(Context context, String Title, String Text, String Btn2Txt){
+ return Long(context,Title,Text,null,Btn2Txt);
+ }
+ /** @since 1.0*/
+ public BasicDialog Delete(Context context, String Title){
+ return Builder(context,Title,null,null,null).deleteAttributes();
+ }
+ /** @since 1.0*/
+ public BasicDialog Delete(Context context){
+ return Builder(context).deleteAttributes();
+ }
+
+ public BasicDialog Delete(Context context, int theme){
+ return Builder(context,theme).deleteAttributes();
+ }
+
+ public BasicDialog Delete(Context context, boolean useAppTheme){
+ return Builder(context,useAppTheme).deleteAttributes();
+ }
+
+ private BasicDialog deleteAttributes(){
+ isDeleteDialog = true;
+ return setTitle("Delete?")
+ .setRightButtonColor(MATERIAL3_RED_BUTTON)
+ .setRightButtonText("Delete");
+ }
+ /**
+ * @deprecated Use {@link BasicDialog#Builder(Context)}
+ * */
+ @Deprecated(since = "1.6")
+ public BasicDialog DialogBuilder(Context context){
+ return Builder(context);
+ }
+ /**
+ * @deprecated Use {@link BasicDialog#Builder(Context, boolean)}
+ * @since 1.6
+ */
+ @Deprecated
+ public BasicDialog DialogBuilder(Context context, boolean useAppTheme){
+ return Builder(context, useAppTheme);
+ }
+ /**
+ * @deprecated Use {@link BasicDialog#Builder(Context, int)}
+ */
+ @Deprecated(since = "1.6")
+ public BasicDialog DialogBuilder(Context context, int theme){
+ return Builder(context,theme);
+ }
+
+ /**
+ * @deprecated Dialog type is automatic. Use {@link BasicDialog#Builder(Context)}
+ * @since 1.3
+ */
+ @Deprecated(since = "1.4")
+ public BasicDialog DialogBuilder(Context context, String dialogType){
+ return Builder(context);
+ }
+ /**
+ * @deprecated Use {@link BasicDialog#Builder(Context, String, String, String, String)}
+ * @since 1.0
+ */
+ @Deprecated(since = "1.6")
+ public BasicDialog DialogBuilder(Context context, String Title, String Text, String Btn1Txt, String Btn2Txt){
+ return Builder(context,Title,Text,Btn1Txt,Btn2Txt);
+ }
+ public BasicDialog Builder(Context context){
+ super.Builder(context,R.layout.basic_dialog);
+ return this;
+ }
+ public BasicDialog Builder(Context context, boolean useAppTheme){
+ super.Builder(context,R.layout.basic_dialog,useAppTheme);
+ return this;
+ }
+ public BasicDialog Builder(Context context,@StyleRes int theme){
+ super.Builder(context,R.layout.basic_dialog,theme,false);
+ return this;
+ }
+ public BasicDialog Builder(Context context, String Title, String Text, String Btn1Txt, String Btn2Txt){
+ super.Builder(context,R.layout.basic_dialog);
+ TextView TitleTv = dialog.findViewById(R.id.titleText);
+ if (Btn1Txt == null) {
+ button1.setOnClickListener(v -> dialog.dismiss());
+ }else button1.setText(Btn1Txt);
+ if (Btn2Txt != null) {
+ button2.setText(Btn2Txt);
+ }
+ if (Text != null){
+ setMessage(Text);
+ }
+ if (Title == null){
+ return this;
+ }
+ TitleTv.setText(Title);
+ return this;
+ }
+ /**
+ * Set a dialog type.
+ * @param dialogType type of a dialog. Supported types: {@link #SHORT_TYPE} and {@link #LONG_TYPE}
+ * @return current class
+ * @deprecated Old method, not in use. Remove this.
+ * @since 1.4
+ * */
+ @Deprecated
+ public BasicDialog setDialogType(String dialogType){
+ //Nothing here!!
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.5*/
+ @Override
+ public BasicDialog setOldTheme(){
+ super.setOldTheme();
+ if (isDeleteDialog)
+ super.setRightButtonColor(RED_BUTTON);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.3*/
+ @Override
+ public BasicDialog setTitle(String title){
+ super.setTitle(title);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.3*/
+ @Override
+ public BasicDialog setMessage(String message){
+ super.setMessage(message);
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ * @since 1.6
+ * */
+ @Override
+ public BasicDialog setTitleAlignment(int textAlignment) {
+ super.setTitleAlignment(textAlignment);
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ * @since 1.6
+ * */
+ @Override
+ public BasicDialog setMessageAlignment(int textAlignment) {
+ super.setMessageAlignment(textAlignment);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.6*/
+ @Override
+ public BasicDialog setTextColor(int color) {
+ super.setTextColor(color);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.6*/
+ @Override
+ public BasicDialog setTitleTextColor(int color) {
+ super.setTitleTextColor(color);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.6*/
+ @Override
+ public BasicDialog setMessageTextColor(int color) {
+ super.setMessageTextColor(color);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.4*/
+ @Override
+ public BasicDialog setLeftButtonText(String text){
+ super.setLeftButtonText(text);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.4*/
+ @Override
+ public BasicDialog setRightButtonText(String text){
+ super.setRightButtonText(text);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.4*/
+ @Override
+ public BasicDialog setButtonsTextColor(@ColorInt int color){
+ super.setButtonsTextColor(color);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.4*/
+ @Override
+ public BasicDialog setLeftButtonTextColor(@ColorInt int color){
+ super.setLeftButtonTextColor(color);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.4*/
+ @Override
+ public BasicDialog setRightButtonTextColor(@ColorInt int color){
+ super.setRightButtonTextColor(color);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.4*/
+ @Override
+ public BasicDialog setButtonsColor(@ColorInt int color){
+ super.setButtonsColor(color);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.4*/
+ @Override
+ public BasicDialog setLeftButtonColor(@ColorInt int color){
+ super.setLeftButtonColor(color);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.4*/
+ @Override
+ public BasicDialog setRightButtonColor(@ColorInt int color){
+ super.setRightButtonColor(color);
+ return this;
+ }
+
+ @Override
+ public BasicDialog setButtonsColor(@ButtonColor String color){
+ super.setButtonsColor(color);
+ return this;
+ }
+
+ @Override
+ public BasicDialog setLeftButtonColor(@ButtonColor String color){
+ super.setLeftButtonColor(color);
+ return this;
+ }
+
+ @Override
+ public BasicDialog setRightButtonColor(@ButtonColor String color){
+ super.setRightButtonColor(color);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.6*/
+ @Override
+ public BasicDialog setDialogBackgroundColor(int color) {
+ super.setDialogBackgroundColor(color);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.3*/
+ @Override
+ public BasicDialog setDialogBackgroundResource(@DrawableRes int drawable){
+ super.setDialogBackgroundResource(drawable);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.3*/
+ @Override
+ public BasicDialog setButtonsBackgroundResource(@DrawableRes int drawable){
+ super.setButtonsBackgroundResource(drawable);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.3*/
+ @Override
+ public BasicDialog setLeftButtonBackgroundResource(@DrawableRes int drawable){
+ super.setLeftButtonBackgroundResource(drawable);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.3*/
+ @Override
+ public BasicDialog setRightButtonBackgroundResource(@DrawableRes int drawable){
+ super.setRightButtonBackgroundResource(drawable);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.0*/
+ @Override
+ public BasicDialog onButtonClick(DialogButtonEvent dialogButtonEvent){
+ super.onButtonClick(dialogButtonEvent);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.0*/
+ @Override
+ public BasicDialog onButtonClick(DialogButtonEvents dialogButtonEvents) {
+ super.onButtonClick(dialogButtonEvents);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.3*/
+ @Override
+ public BasicDialog show() {
+ super.show();
+ return this;
+ }
+
+ @Override
+ protected int setButtonsRootLayoutID() {
+ return R.id.buttons;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.4*/
+ @Override
+ public BasicDialog setMaxDialogWidth(int maxDialogWidth) {
+ super.setMaxDialogWidth(maxDialogWidth);
+ return this;
+
+ }
+
+ /**{@inheritDoc}
+ * @since 1.6*/
+ @Override
+ public BasicDialog setOnTouchListener(View.OnTouchListener onTouchListener) {
+ super.setOnTouchListener(onTouchListener);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.6*/
+ @Override
+ public BasicDialog swipeToDismiss(boolean isSwipeToDismiss) {
+ super.swipeToDismiss(isSwipeToDismiss);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.5*/
+ @Override
+ public BasicDialog setDialogAnimations(int styleRes) {
+ super.setDialogAnimations(styleRes);
+ return this;
+ }
+
+ @Override
+ protected void setButtons() {
+ setButton1(R.id.btn1);
+ setButton2(R.id.btn2);
+ }
+
+ @Override
+ public Button getLeftButton() {
+ return super.getLeftButton();
+ }
+
+ @Override
+ public Button getRightButton() {
+ return super.getRightButton();
+ }
+
+ /**@since 1.6*/
+ @Override
+ public TextView getTitleTextView() {
+ return super.getTitleTextView();
+ }
+
+ /**@since 1.6*/
+ @Override
+ public TextView getMessageTextView() {
+ return super.getMessageTextView();
+ }
+}
+
diff --git a/SJDialog/src/main/java/com/sjapps/library/customdialog/CustomViewDialog.java b/SJDialog/src/main/java/com/sjapps/library/customdialog/CustomViewDialog.java
new file mode 100644
index 0000000..439d679
--- /dev/null
+++ b/SJDialog/src/main/java/com/sjapps/library/customdialog/CustomViewDialog.java
@@ -0,0 +1,393 @@
+package com.sjapps.library.customdialog;
+
+import android.content.Context;
+import android.view.View;
+import android.widget.Button;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import androidx.annotation.ColorInt;
+import androidx.annotation.DrawableRes;
+import androidx.annotation.StyleRes;
+
+import com.sjapps.library.R;
+/**@since 1.5*/
+@SuppressWarnings("unused")
+public class CustomViewDialog extends SJDialog{
+
+ private LinearLayout rootView;
+
+ public CustomViewDialog(){
+
+ }
+
+ public CustomViewDialog Builder(Context context){
+ return Builder(context,false);
+ }
+
+ public CustomViewDialog Builder(Context context,@StyleRes int theme){
+ super.Builder(context,R.layout.custom_view_dialog,theme, false);
+ rootView = dialog.findViewById(R.id.customViewRoot);
+ onLeftButtonClick(dialog::dismiss);
+ return this;
+ }
+
+ public CustomViewDialog Builder(Context context,boolean useAppTheme){
+ super.Builder(context,R.layout.custom_view_dialog,useAppTheme);
+ rootView = dialog.findViewById(R.id.customViewRoot);
+ onLeftButtonClick(dialog::dismiss);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.5*/
+ @Override
+ public CustomViewDialog setOldTheme(){
+ super.setOldTheme();
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.5*/
+ @Override
+ public CustomViewDialog setTitle(String title){
+ super.setTitle(title);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.5*/
+ @Override
+ public CustomViewDialog setMessage(String message) {
+ super.setMessage(message);
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ * @since 1.6
+ * */
+ @Override
+ public CustomViewDialog setTitleAlignment(int textAlignment) {
+ super.setTitleAlignment(textAlignment);
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ * @since 1.6
+ * */
+ @Override
+ public CustomViewDialog setMessageAlignment(int textAlignment) {
+ super.setMessageAlignment(textAlignment);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.5*/
+ @Override
+ public CustomViewDialog setTextColor(int color) {
+ super.setTextColor(color);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.6*/
+ @Override
+ public CustomViewDialog setTitleTextColor(int color) {
+ super.setTitleTextColor(color);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.6*/
+ @Override
+ public CustomViewDialog setMessageTextColor(int color) {
+ super.setMessageTextColor(color);
+ return this;
+ }
+
+ /**
+ * Set a button text.
+ * @param text button text
+ * @return current class
+ * @since 1.5
+ * */
+ public CustomViewDialog setButtonText(String text){
+ return setLeftButtonText(text);
+ }
+
+ /**{@inheritDoc}
+ * @since 1.5*/
+ @Override
+ public CustomViewDialog setLeftButtonText(String text){
+ super.setLeftButtonText(text);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.5*/
+ @Override
+ public CustomViewDialog setRightButtonText(String text){
+ super.setRightButtonText(text);
+ return this;
+ }
+
+ /**
+ * Set button text color.
+ * @param color Color to use for tinting this drawable
+ * @return current class
+ * @since 1.5
+ * */
+ public CustomViewDialog setButtonTextColor(@ColorInt int color){
+ return setLeftButtonTextColor(color);
+ }
+
+ /**{@inheritDoc}
+ * @since 1.5*/
+ @Override
+ public CustomViewDialog setButtonsTextColor(@ColorInt int color){
+ super.setButtonsTextColor(color);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.5*/
+ @Override
+ public CustomViewDialog setLeftButtonTextColor(@ColorInt int color){
+ super.setLeftButtonTextColor(color);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.5*/
+ @Override
+ public CustomViewDialog setRightButtonTextColor(@ColorInt int color){
+ super.setRightButtonTextColor(color);
+ return this;
+ }
+
+ /**
+ * Set button color.
+ * @param color Color to use for tinting this drawable
+ * @return current class
+ * @since 1.5
+ * */
+ public CustomViewDialog setButtonColor(@ColorInt int color){
+ return setLeftButtonColor(color);
+ }
+
+ /**{@inheritDoc}
+ * @since 1.5*/
+ @Override
+ public CustomViewDialog setButtonsColor(@ColorInt int color){
+ super.setButtonsColor(color);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.5*/
+ @Override
+ public CustomViewDialog setLeftButtonColor(@ColorInt int color){
+ super.setLeftButtonColor(color);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.5*/
+ @Override
+ public CustomViewDialog setRightButtonColor(@ColorInt int color){
+ super.setRightButtonColor(color);
+ return this;
+ }
+
+ @Override
+ public CustomViewDialog setButtonColor(@ButtonColor String color) {
+ super.setButtonColor(color);
+ return this;
+ }
+
+ @Override
+ public CustomViewDialog setButtonsColor(@ButtonColor String color){
+ super.setButtonsColor(color);
+ return this;
+ }
+
+ @Override
+ public CustomViewDialog setLeftButtonColor(@ButtonColor String color){
+ super.setLeftButtonColor(color);
+ return this;
+ }
+
+ @Override
+ public CustomViewDialog setRightButtonColor(@ButtonColor String color){
+ super.setRightButtonColor(color);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.6*/
+ @Override
+ public CustomViewDialog setDialogBackgroundColor(int color) {
+ super.setDialogBackgroundColor(color);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.5*/
+ @Override
+ public CustomViewDialog setDialogBackgroundResource(@DrawableRes int drawable){
+ super.setDialogBackgroundResource(drawable);
+ return this;
+ }
+
+ /**
+ * Set background resource for button.
+ * @param drawable resource id
+ * @return current class
+ * @since 1.5
+ * */
+ public CustomViewDialog setButtonBackgroundResource(@DrawableRes int drawable){
+ return setLeftButtonBackgroundResource(drawable);
+ }
+
+ /**{@inheritDoc}
+ * @since 1.5*/
+ @Override
+ public CustomViewDialog setButtonsBackgroundResource(@DrawableRes int drawable){
+ super.setButtonsBackgroundResource(drawable);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.5*/
+ @Override
+ public CustomViewDialog setLeftButtonBackgroundResource(@DrawableRes int drawable){
+ super.setLeftButtonBackgroundResource(drawable);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.5*/
+ @Override
+ public CustomViewDialog setRightButtonBackgroundResource(@DrawableRes int drawable){
+ super.setRightButtonBackgroundResource(drawable);
+ return this;
+ }
+
+ /**
+ * Set onClick listener for a button
+ *
+ * @param dialogButtonEvent dialog button event
+ * @return current class
+ * @since 1.5
+ */
+ @Override
+ public CustomViewDialog onButtonClick(DialogButtonEvent dialogButtonEvent){
+ if (twoButtons)
+ super.onButtonClick(dialogButtonEvent);
+ else
+ super.onLeftButtonClick(dialogButtonEvent);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.5*/
+ @Override
+ public CustomViewDialog onButtonClick(DialogButtonEvents dialogButtonEvents) {
+ super.onButtonClick(dialogButtonEvents);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.5*/
+ @Override
+ public CustomViewDialog show() {
+ super.show();
+ return this;
+ }
+
+ @Override
+ protected int setButtonsRootLayoutID() {
+ return R.id.buttons;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.5*/
+ @Override
+ public CustomViewDialog setMaxDialogWidth(int maxDialogWidth) {
+ super.setMaxDialogWidth(maxDialogWidth);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.5*/
+ @Override
+ public CustomViewDialog setDialogAnimations(int styleRes) {
+ super.setDialogAnimations(styleRes);
+ return this;
+ }
+
+ @Override
+ protected void setButtons() {
+ setButton1(R.id.btn1);
+ setButton2(R.id.btn2);
+ }
+
+ @Override
+ public Button getLeftButton() {
+ return super.getLeftButton();
+ }
+
+ @Override
+ public Button getRightButton() {
+ return super.getRightButton();
+ }
+
+ /**@since 1.6*/
+ @Override
+ public TextView getTitleTextView() {
+ return super.getTitleTextView();
+ }
+
+ /**@since 1.6*/
+ @Override
+ public TextView getMessageTextView() {
+ return super.getMessageTextView();
+ }
+
+ /**{@inheritDoc}
+ * @since 1.5*/
+ @Override
+ public CustomViewDialog dialogWithTwoButtons() {
+ super.dialogWithTwoButtons();
+ setButton2Visibility(View.VISIBLE);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.6*/
+ @Override
+ public CustomViewDialog setOnTouchListener(View.OnTouchListener onTouchListener) {
+ super.setOnTouchListener(onTouchListener);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.6*/
+ @Override
+ public CustomViewDialog swipeToDismiss(boolean isSwipeToDismiss) {
+ super.swipeToDismiss(isSwipeToDismiss);
+ return this;
+ }
+
+ @Override
+ public void setButton2Visibility(int visibility) {
+ super.setButton2Visibility(visibility);
+ }
+
+ public CustomViewDialog addCustomView(View view){
+ rootView.addView(view);
+ return this;
+ }
+}
diff --git a/SJDialog/src/main/java/com/sjapps/library/customdialog/DialogButtonEvent.java b/SJDialog/src/main/java/com/sjapps/library/customdialog/DialogButtonEvent.java
new file mode 100644
index 0000000..484bf56
--- /dev/null
+++ b/SJDialog/src/main/java/com/sjapps/library/customdialog/DialogButtonEvent.java
@@ -0,0 +1,5 @@
+package com.sjapps.library.customdialog;
+
+public interface DialogButtonEvent {
+ void onButtonClick();
+}
diff --git a/SJDialog/src/main/java/com/sjapps/library/customdialog/DialogButtonEvents.java b/SJDialog/src/main/java/com/sjapps/library/customdialog/DialogButtonEvents.java
new file mode 100644
index 0000000..b423d7e
--- /dev/null
+++ b/SJDialog/src/main/java/com/sjapps/library/customdialog/DialogButtonEvents.java
@@ -0,0 +1,7 @@
+package com.sjapps.library.customdialog;
+
+public interface DialogButtonEvents {
+ void onLeftButtonClick();
+ void onRightButtonClick();
+}
+
diff --git a/SJDialog/src/main/java/com/sjapps/library/customdialog/ImageListItem.java b/SJDialog/src/main/java/com/sjapps/library/customdialog/ImageListItem.java
new file mode 100644
index 0000000..4066546
--- /dev/null
+++ b/SJDialog/src/main/java/com/sjapps/library/customdialog/ImageListItem.java
@@ -0,0 +1,57 @@
+package com.sjapps.library.customdialog;
+
+import android.graphics.drawable.Drawable;
+
+public class ImageListItem {
+
+ private String name;
+ private Drawable image;
+ private Object data;
+
+ public ImageListItem() {
+ }
+
+ public ImageListItem(String name, Drawable image) {
+ this.name = name;
+ this.image = image;
+ }
+
+ public ImageListItem(String name, Drawable image, Object data) {
+ this.name = name;
+ this.image = image;
+ this.data = data;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Drawable getImage() {
+ return image;
+ }
+
+ public void setImage(Drawable image) {
+ this.image = image;
+ }
+
+ public Object getData() {
+ return data;
+ }
+
+ public void setData(Object data) {
+ this.data = data;
+ }
+
+ @Override
+ public String toString() {
+ return "ImageListItem{" +
+ "name='" + name + '\'' +
+ ", image=" + image +
+ ", data=" + data +
+ '}';
+ }
+}
diff --git a/SJDialog/src/main/java/com/sjapps/library/customdialog/ListDialog.java b/SJDialog/src/main/java/com/sjapps/library/customdialog/ListDialog.java
new file mode 100644
index 0000000..0be8d42
--- /dev/null
+++ b/SJDialog/src/main/java/com/sjapps/library/customdialog/ListDialog.java
@@ -0,0 +1,931 @@
+package com.sjapps.library.customdialog;
+
+import android.content.Context;
+import android.view.View;
+import android.widget.Button;
+import android.widget.TextView;
+
+import androidx.annotation.ColorInt;
+import androidx.annotation.DrawableRes;
+import androidx.annotation.Nullable;
+import androidx.annotation.StyleRes;
+import androidx.recyclerview.widget.GridLayoutManager;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.sjapps.library.R;
+import com.sjapps.library.customdialog.adapter.DefaultImageListAdapter;
+import com.sjapps.library.customdialog.adapter.DefaultListAdapter;
+import com.sjapps.library.customdialog.adapter.DefaultListAdapterGeneric;
+import com.sjapps.library.customdialog.list.events.ListItemClick;
+import com.sjapps.library.customdialog.list.events.ListItemClickObj;
+
+import java.util.ArrayList;
+/**@since 1.5*/
+@SuppressWarnings({"unused", "unchecked","UnusedReturnValue"})
+public class ListDialog extends SJDialog {
+
+ RecyclerView listRV;
+ boolean isSelectableList = false;
+ boolean hideEmptyListTxt = false;
+ boolean hasAdapter = false;
+ boolean waitForLayoutManager = false;
+
+ private @DrawableRes int listItemBgRes = R.drawable.ripple_list;
+ private @DrawableRes int listItemBgResSelected = R.drawable.ripple_list_selected;
+ private @ColorInt int listItemBgColor = -1;
+ private @ColorInt int listItemBgColorSelected = -1;
+ private int listItemTextColor = 1;
+ private RecyclerView.LayoutManager layoutManager = null;
+
+ RecyclerView.Adapter> adapter;
+ ArrayList> selectedItems = new ArrayList<>();
+ TextView emptyListTxt;
+
+ public ListDialog() {
+
+ }
+
+ public ListDialog Builder(Context context) {
+ return Builder(context, false);
+ }
+
+ public ListDialog Builder(Context context, @StyleRes int theme) {
+ super.Builder(context, R.layout.list_dialog, theme, false);
+ listRV = dialog.findViewById(R.id.list);
+ onLeftButtonClick(dialog::dismiss);
+ emptyListTxt = dialog.findViewById(R.id.emptyListTxt);
+ return this;
+ }
+
+ public ListDialog Builder(Context context, boolean useAppTheme) {
+ super.Builder(context, R.layout.list_dialog, useAppTheme);
+ listRV = dialog.findViewById(R.id.list);
+ onLeftButtonClick(dialog::dismiss);
+ emptyListTxt = dialog.findViewById(R.id.emptyListTxt);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.5*/
+ @Override
+ public ListDialog setOldTheme() {
+ super.setOldTheme();
+ setListOldColor();
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.5*/
+ @Override
+ public ListDialog setTitle(String title) {
+ super.setTitle(title);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.5*/
+ @Override
+ public ListDialog setMessage(String message) {
+ super.setMessage(message);
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ * @since 1.6
+ * */
+ @Override
+ public ListDialog setTitleAlignment(int textAlignment) {
+ super.setTitleAlignment(textAlignment);
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ * @since 1.6
+ * */
+ @Override
+ public ListDialog setMessageAlignment(int textAlignment) {
+ super.setMessageAlignment(textAlignment);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.6*/
+ @Override
+ public ListDialog setTextColor(int color) {
+ super.setTextColor(color);
+ setListItemTextColor(color);
+ setEmptyListTxtColor(color);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.6*/
+ @Override
+ public ListDialog setTitleTextColor(int color) {
+ super.setTitleTextColor(color);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.6*/
+ @Override
+ public ListDialog setMessageTextColor(int color) {
+ super.setMessageTextColor(color);
+ return this;
+ }
+
+ /**
+ * Set a button text.
+ *
+ * @param text button text
+ * @return current class
+ * @since 1.5
+ */
+ public ListDialog setButtonText(String text) {
+ return setLeftButtonText(text);
+ }
+
+ /**{@inheritDoc}
+ * @since 1.5*/
+ @Override
+ public ListDialog setLeftButtonText(String text) {
+ super.setLeftButtonText(text);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.5*/
+ @Override
+ public ListDialog setRightButtonText(String text) {
+ super.setRightButtonText(text);
+ return this;
+ }
+
+ /**
+ * Set button text color.
+ *
+ * @param color Color to use for tinting this drawable
+ * @return current class
+ * @since 1.5
+ */
+ public ListDialog setButtonTextColor(@ColorInt int color) {
+ return setLeftButtonTextColor(color);
+ }
+
+ /**{@inheritDoc}
+ * @since 1.5*/
+ @Override
+ public ListDialog setButtonsTextColor(@ColorInt int color) {
+ super.setButtonsTextColor(color);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.5*/
+ @Override
+ public ListDialog setLeftButtonTextColor(@ColorInt int color) {
+ super.setLeftButtonTextColor(color);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.5*/
+ @Override
+ public ListDialog setRightButtonTextColor(@ColorInt int color) {
+ super.setRightButtonTextColor(color);
+ return this;
+ }
+
+ /**
+ * Set button color.
+ *
+ * @param color Color to use for tinting this drawable
+ * @return current class
+ * @since 1.5
+ */
+ public ListDialog setButtonColor(@ColorInt int color) {
+ return setLeftButtonColor(color);
+ }
+
+ /**{@inheritDoc}
+ * @since 1.5*/
+ @Override
+ public ListDialog setButtonsColor(@ColorInt int color) {
+ super.setButtonsColor(color);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.5*/
+ @Override
+ public ListDialog setLeftButtonColor(@ColorInt int color) {
+ super.setLeftButtonColor(color);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.5*/
+ @Override
+ public ListDialog setRightButtonColor(@ColorInt int color) {
+ super.setRightButtonColor(color);
+ return this;
+ }
+
+ @Override
+ public ListDialog setButtonColor(@ButtonColor String color) {
+ super.setButtonColor(color);
+ return this;
+ }
+
+ @Override
+ public ListDialog setButtonsColor(@ButtonColor String color) {
+ super.setButtonsColor(color);
+ return this;
+ }
+
+ @Override
+ public ListDialog setLeftButtonColor(@ButtonColor String color) {
+ super.setLeftButtonColor(color);
+ return this;
+ }
+
+ @Override
+ public ListDialog setRightButtonColor(@ButtonColor String color) {
+ super.setRightButtonColor(color);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.6*/
+ @Override
+ public ListDialog setDialogBackgroundColor(int color) {
+ super.setDialogBackgroundColor(color);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.5*/
+ @Override
+ public ListDialog setDialogBackgroundResource(@DrawableRes int drawable) {
+ super.setDialogBackgroundResource(drawable);
+ return this;
+ }
+
+ /**
+ * Set background resource for button.
+ *
+ * @param drawable resource id
+ * @return current class
+ * @since 1.5
+ */
+ public ListDialog setButtonBackgroundResource(@DrawableRes int drawable) {
+ return setLeftButtonBackgroundResource(drawable);
+ }
+
+ /**{@inheritDoc}
+ * @since 1.5*/
+ @Override
+ public ListDialog setButtonsBackgroundResource(@DrawableRes int drawable) {
+ super.setButtonsBackgroundResource(drawable);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.5*/
+ @Override
+ public ListDialog setLeftButtonBackgroundResource(@DrawableRes int drawable) {
+ super.setLeftButtonBackgroundResource(drawable);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.5*/
+ @Override
+ public ListDialog setRightButtonBackgroundResource(@DrawableRes int drawable) {
+ super.setRightButtonBackgroundResource(drawable);
+ return this;
+ }
+
+ /**
+ * Set onClick listener for a button
+ *
+ * @param dialogButtonEvent dialog button event
+ * @return current class
+ * @since 1.5
+ */
+ @Override
+ public ListDialog onButtonClick(DialogButtonEvent dialogButtonEvent) {
+ if (twoButtons)
+ super.onButtonClick(dialogButtonEvent);
+ else
+ super.onLeftButtonClick(dialogButtonEvent);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.5*/
+ @Override
+ public ListDialog onButtonClick(DialogButtonEvents dialogButtonEvents) {
+ super.onButtonClick(dialogButtonEvents);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.5*/
+ @Override
+ public ListDialog show() {
+ if (layoutManager == null)
+ layoutManager = new LinearLayoutManager(context);
+ if (!waitForLayoutManager)
+ listRV.setLayoutManager(layoutManager);
+
+ listRV.setAdapter(adapter);
+ if (adapter == null)
+ checkListsSize(0);
+
+ super.show();
+
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.5*/
+ @Override
+ public ListDialog setMaxDialogWidth(int maxDialogWidth) {
+ super.setMaxDialogWidth(maxDialogWidth);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.5*/
+ @Override
+ public ListDialog setDialogAnimations(int styleRes) {
+ super.setDialogAnimations(styleRes);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.5*/
+ @Override
+ public ListDialog dialogWithTwoButtons() {
+ super.dialogWithTwoButtons();
+ setButton2Visibility(View.VISIBLE);
+ return this;
+ }
+
+ @Override
+ public void setButton2Visibility(int visibility) {
+ super.setButton2Visibility(visibility);
+ }
+
+ private void setListOldColor() {
+ listItemBgRes = R.drawable.ripple_list_old;
+ listItemBgResSelected = R.drawable.ripple_list_selected_old;
+ }
+
+ /**
+ * Set background resource for a list
+ *
+ * @param drawable drawable resource
+ * @return current class
+ * @since 1.5
+ */
+ public ListDialog setListBackgroundResource(@DrawableRes int drawable) {
+ listRV.setBackgroundResource(drawable);
+ return this;
+ }
+
+ /**
+ * Set background resource for a item in a list
+ *
+ * @param drawable drawable resource
+ * @return current class
+ * @since 1.5
+ */
+ public ListDialog setListItemBackgroundResource(@DrawableRes int drawable) {
+ listItemBgRes = drawable;
+ return this;
+ }
+
+ /**
+ * Set background resource for a selected item in a list
+ *
+ * @param drawable drawable resource
+ * @return current class
+ * @since 1.5
+ */
+ public ListDialog setListItemSelectedBackgroundResource(@DrawableRes int drawable) {
+ listItemBgResSelected = drawable;
+ return this;
+ }
+
+ /**
+ * Set background color for a item in a list
+ *
+ * @param color {@link ColorInt}
+ * @return current class
+ * @since 1.6
+ */
+ public ListDialog setListItemBackgroundColor(@ColorInt int color) {
+ listItemBgColor = color;
+ return this;
+ }
+
+ /**
+ * Set background color for a selected item in a list
+ *
+ * @param color {@link ColorInt}
+ * @return current class
+ * @since 1.6
+ */
+ public ListDialog setListItemSelectedBackgroundColor(@ColorInt int color) {
+ listItemBgColorSelected = color;
+ return this;
+ }
+
+ /**
+ * Set text color for item in a list
+ *
+ * @param listItemTextColor color for a text
+ * @return current class
+ * @since 1.6
+ */
+ public ListDialog setListItemTextColor(int listItemTextColor) {
+ this.listItemTextColor = listItemTextColor;
+ return this;
+ }
+
+ private void setEmptyListTxtColor(int color) {
+ emptyListTxt.setTextColor(color);
+ }
+
+ /**
+ * Hide {@link #emptyListTxt} when list is empty
+ * @since 1.6
+ * @return current class
+ */
+ public ListDialog hideEmptyListText() {
+ hideEmptyListTxt = true;
+ return this;
+ }
+
+ /**
+ * Set text to display when list is empty
+ * @param text Text
+ * @since 1.6
+ * @return current class
+ */
+ public ListDialog setEmptyListText(String text){
+ emptyListTxt.setText(text);
+ return this;
+ }
+
+ /**
+ * Get a dialog list
+ *
+ * @return dialog list
+ * @since 1.5
+ */
+ public RecyclerView getRecycleView() {
+ return listRV;
+ }
+
+ @Override
+ protected int setButtonsRootLayoutID() {
+ return R.id.buttons;
+ }
+
+ @Override
+ protected void setButtons() {
+ setButton1(R.id.btn1);
+ setButton2(R.id.btn2);
+ }
+
+ @Override
+ public Button getLeftButton() {
+ return super.getLeftButton();
+ }
+
+ @Override
+ public Button getRightButton() {
+ return super.getRightButton();
+ }
+
+ /**@since 1.6*/
+ @Override
+ public TextView getTitleTextView() {
+ return super.getTitleTextView();
+ }
+
+ /**@since 1.6*/
+ @Override
+ public TextView getMessageTextView() {
+ return super.getMessageTextView();
+ }
+
+ /**
+ * Set items for a list
+ *
+ * @param listOfItems Array of {@link String}
+ * @return current class
+ * @since 1.5
+ */
+ public ListDialog setItems(String[] listOfItems) {
+ return setItems(listOfItems, (ListItemClick) null);
+ }
+
+
+ /**
+ * Set items for a list and ListItemClick event
+ *
+ * @param listOfItems Array of {@link String}
+ * @param itemClick ListItemClick event
+ * @return current class
+ * @since 1.5
+ */
+ public ListDialog setItems(String[] listOfItems, @Nullable ListItemClick itemClick) {
+
+ if (hasAdapter)
+ throw tooManyAdapters;
+
+ if (!isSelectableList && itemClick == null)
+ throw nullListItemClick(ListItemClick.class);
+
+ checkListsSize(listOfItems.length);
+
+ adapter = new DefaultListAdapter(listOfItems,
+ isSelectableList,
+ itemClick,
+ (ArrayList) selectedItems,
+ listItemBgRes,
+ listItemBgResSelected,
+ listItemTextColor,
+ listItemBgColor,
+ listItemBgColorSelected);
+ hasAdapter = true;
+ return this;
+ }
+
+ /**
+ * Set items for a list and String value of an object for use in a list
+ *
+ * @param objArray Array of {@link Object}
+ * @param value {@link ListItemValue} for getting String value of an object
+ * @param Type of an Object
+ * @return current class
+ * @since 1.5
+ */
+ public ListDialog setItems(T[] objArray, ListItemValue value) {
+ return setItems(objArray, value, null);
+ }
+
+ /**
+ * Set items for a list and String values of an object for use in a list
+ *
+ * @param objArray Array of {@link Object}
+ * @param values {@link ListItemValues} for getting String values of an object. {@link ListItemValues#getValue1(Object)}
+ * for first value and {@link ListItemValues#getValue1(Object)} for second value
+ * @param Type of an Object
+ * @return current class
+ * @since 1.5
+ */
+ public ListDialog setItems(T[] objArray, ListItemValues values) {
+ return setItems(objArray, values, null);
+ }
+
+
+ /**
+ * Set items for a list and String value of an object for use in a list
+ *
+ * @param arrayList {@link ArrayList} of {@link Object}
+ * @param value {@link ListItemValue} for getting String value of an object
+ * @param Type of an Object
+ * @return current class
+ * @since 1.5
+ */
+ public ListDialog setItems(ArrayList arrayList, ListItemValue value) {
+ return setItems(arrayList, value, null);
+ }
+
+
+ /**
+ * Set items for a list and String values of an object for use in a list
+ *
+ * @param arrayList {@link ArrayList} of {@link Object}
+ * @param values {@link ListItemValues} for getting String values of an object. {@link ListItemValues#getValue1(Object)}
+ * for first value and {@link ListItemValues#getValue1(Object)} for second value
+ * @param Type of an Object
+ * @return current class
+ * @since 1.5
+ */
+ public ListDialog setItems(ArrayList arrayList, ListItemValues values) {
+ return setItems(arrayList, values, null);
+ }
+
+
+ /**
+ * Set items for a list, String value of an object for use in a list and ListItemClick event
+ *
+ * @param objArray Array of {@link Object}
+ * @param value {@link ListItemValue} for getting String value of an object
+ * @param itemClick ListItemClick event
+ * @param Type of an Object
+ * @return current class
+ * @since 1.5
+ */
+ public ListDialog setItems(T[] objArray, ListItemValue value, @Nullable ListItemClickObj itemClick) {
+
+ if (hasAdapter)
+ throw tooManyAdapters;
+
+ if (!isSelectableList && itemClick == null)
+ throw nullListItemClick(ListItemClickObj.class);
+
+ checkListsSize(objArray.length);
+
+ adapter = new DefaultListAdapterGeneric<>(objArray,
+ value,
+ isSelectableList,
+ itemClick,
+ (ArrayList) selectedItems,
+ listItemBgRes,
+ listItemBgResSelected,
+ listItemTextColor,
+ listItemBgColor,
+ listItemBgColorSelected);
+ hasAdapter = true;
+ return this;
+ }
+
+ /**
+ * Set items for a list, String values of an object for use in a list and ListItemClick event
+ *
+ * @param objArray Array of {@link Object}
+ * @param values {@link ListItemValues} for getting String values of an object. {@link ListItemValues#getValue1(Object)}
+ * for first value and {@link ListItemValues#getValue1(Object)} for second value
+ * @param itemClick ListItemClick event
+ * @param Type of an Object
+ * @return current class
+ * @since 1.5
+ */
+ public ListDialog setItems(T[] objArray, ListItemValues values, @Nullable ListItemClickObj itemClick) {
+
+ if (hasAdapter)
+ throw tooManyAdapters;
+
+ if (!isSelectableList && itemClick == null)
+ throw nullListItemClick(ListItemClickObj.class);
+
+ checkListsSize(objArray.length);
+
+ adapter = new DefaultListAdapterGeneric<>(objArray,
+ values,
+ isSelectableList,
+ itemClick,
+ (ArrayList) selectedItems,
+ listItemBgRes,
+ listItemBgResSelected,
+ listItemTextColor,
+ listItemBgColor,
+ listItemBgColorSelected);
+ hasAdapter = true;
+ return this;
+
+ }
+
+
+ /**
+ * Set items for a list, String value of an object for use in a list and ListItemClick event
+ *
+ * @param arrayList {@link ArrayList} of {@link Object}
+ * @param value {@link ListItemValue} for getting String value of an object
+ * @param itemClick ListItemClick event
+ * @param Type of an Object
+ * @return current class
+ * @since 1.5
+ */
+ public ListDialog setItems(ArrayList arrayList, ListItemValue value, @Nullable ListItemClickObj itemClick) {
+
+ if (hasAdapter)
+ throw tooManyAdapters;
+
+ if (!isSelectableList && itemClick == null)
+ throw nullListItemClick(ListItemClickObj.class);
+
+ checkListsSize(arrayList.size());
+
+ adapter = new DefaultListAdapterGeneric<>(arrayList,
+ value,
+ isSelectableList,
+ itemClick,
+ (ArrayList) selectedItems,
+ listItemBgRes,
+ listItemBgResSelected,
+ listItemTextColor,
+ listItemBgColor,
+ listItemBgColorSelected);
+ hasAdapter = true;
+ return this;
+ }
+
+ /**
+ * Set items for a list, String values of an object for use in a list and ListItemClick event
+ *
+ * @param arrayList {@link ArrayList} of {@link Object}
+ * @param values {@link ListItemValues} for getting String values of an object. {@link ListItemValues#getValue1(Object)}
+ * for first value and {@link ListItemValues#getValue1(Object)} for second value
+ * @param itemClick ListItemClick event
+ * @param Type of an Object
+ * @return current class
+ * @since 1.5
+ */
+ public ListDialog setItems(ArrayList arrayList, ListItemValues values, @Nullable ListItemClickObj itemClick) {
+
+ if (hasAdapter)
+ throw tooManyAdapters;
+
+ if (!isSelectableList && itemClick == null)
+ throw nullListItemClick(ListItemClickObj.class);
+
+ checkListsSize(arrayList.size());
+
+ adapter = new DefaultListAdapterGeneric<>(arrayList,
+ values,
+ isSelectableList,
+ itemClick,
+ (ArrayList) selectedItems,
+ listItemBgRes,
+ listItemBgResSelected,
+ listItemTextColor,
+ listItemBgColor,
+ listItemBgColorSelected);
+ hasAdapter = true;
+ return this;
+ }
+
+ /**
+ * Set image items for a list
+ * @param arrayList {@link ArrayList} of {@link ImageListItem}
+ * @return current class
+ * @since 1.6
+ */
+ public ListDialog setImageItems(ArrayList arrayList) {
+ return setImageItems(arrayList, null);
+ }
+
+ /**
+ * Set image items for a list and ListItemClick event
+ * @param arrayList {@link ArrayList} of {@link ImageListItem}
+ * @param itemClick ListItemClick event
+ * @return current class
+ * @since 1.6
+ */
+ public ListDialog setImageItems(ArrayList arrayList, @Nullable ListItemClickObj itemClick) {
+
+ if (hasAdapter)
+ throw tooManyAdapters;
+
+ if (!isSelectableList && itemClick == null)
+ throw nullListItemClick(ListItemClickObj.class);
+
+ checkListsSize(arrayList.size());
+
+ adapter = new DefaultImageListAdapter(arrayList,
+ isSelectableList,
+ itemClick,
+ (ArrayList) selectedItems,
+ listItemBgRes,
+ listItemBgResSelected,
+ listItemTextColor,
+ listItemBgColor,
+ listItemBgColorSelected);
+
+ hasAdapter = true;
+ waitForLayoutManager = true;
+ listRV.post(() -> {
+ int maxItemCount = listRV.getWidth() / functions.dpToPixels(context,80);
+ if (maxItemCount == 0)
+ maxItemCount = 1;
+ setLayoutManager(new GridLayoutManager(context, arrayList.size()!=0 ? Math.min(maxItemCount, arrayList.size()):1));
+ listRV.setLayoutManager(layoutManager);
+ waitForLayoutManager = false;
+ });
+
+ return this;
+ }
+
+ /**
+ * Set a list adapter
+ *
+ * @param adapter RecycleView {@link RecyclerView.Adapter adapter}
+ * @return current class
+ * @since 1.5
+ */
+ public ListDialog setAdapter(RecyclerView.Adapter> adapter) {
+ if (hasAdapter)
+ throw tooManyAdapters;
+ this.adapter = adapter;
+ hasAdapter = true;
+ return this;
+ }
+
+ /**
+ * @param layoutManager {@link RecyclerView.LayoutManager LayoutManager }
+ * @return current class
+ * @since 1.6
+ */
+ public ListDialog setLayoutManager(RecyclerView.LayoutManager layoutManager) {
+ this.layoutManager = layoutManager;
+ return this;
+ }
+
+ /**
+ * Get a list adapter
+ *
+ * @return current class
+ * @since 1.5
+ */
+ public RecyclerView.Adapter> getListAdapter() {
+ return adapter;
+ }
+
+
+ /**
+ * @return Background resource for views in RecycleView
+ * @since 1.5
+ */
+ public int getListItemBgRes() {
+ return listItemBgRes;
+ }
+
+ /**
+ * @return Background resource for selected views in RecycleView
+ * @since 1.5
+ */
+ public int getListItemBgResSelected() {
+ return listItemBgResSelected;
+ }
+
+ /**
+ * Create list with multi selectable items. Use {@link #getSelectedItems()} fet getting selected items
+ *
+ * @return current class
+ * @since 1.5
+ */
+ public ListDialog setSelectableList() {
+ isSelectableList = true;
+ return this;
+ }
+
+ public boolean isSelectableList() {
+ return isSelectableList;
+ }
+
+ @Override
+ public ListDialog setOnTouchListener(View.OnTouchListener onTouchListener) {
+ super.setOnTouchListener(onTouchListener);
+ return this;
+ }
+
+ @Override
+ public ListDialog swipeToDismiss(boolean isSwipeToDismiss) {
+ super.swipeToDismiss(isSwipeToDismiss);
+ return this;
+ }
+
+ /**
+ * Get selected items in a list
+ *
+ * @return ArrayList of selected items in a list
+ * @since 1.5
+ */
+ public ArrayList getSelectedItems() {
+ return (ArrayList) selectedItems;
+ }
+
+ void checkListsSize(int size) {
+
+ if (hideEmptyListTxt) {
+ emptyListTxt.setVisibility(View.GONE);
+ return;
+ }
+ emptyListTxt.setVisibility((size > 0) ? View.GONE : View.VISIBLE);
+
+
+ }
+
+ @SuppressWarnings("rawtypes")
+ private NullPointerException nullListItemClick(Class className) {
+ return new NullPointerException(
+ String.format("%s is null. Set %s event or use setSelectableList() for selecting multiple item in a list",
+ className.getSimpleName(),
+ className.getSimpleName())
+ );
+
+ }
+
+ private final UnsupportedOperationException tooManyAdapters = new UnsupportedOperationException("Too many Adapters for RecyclerView");
+}
diff --git a/SJDialog/src/main/java/com/sjapps/library/customdialog/ListItemImageValue.java b/SJDialog/src/main/java/com/sjapps/library/customdialog/ListItemImageValue.java
new file mode 100644
index 0000000..79e121f
--- /dev/null
+++ b/SJDialog/src/main/java/com/sjapps/library/customdialog/ListItemImageValue.java
@@ -0,0 +1,19 @@
+package com.sjapps.library.customdialog;
+
+import android.graphics.drawable.Drawable;
+
+public interface ListItemImageValue {
+ /**
+ * Get String value of an Object for using in a list
+ * @param obj Current Object for getting first String value of it
+ * @return String value
+ */
+ String getTitle(T obj);
+
+ /**
+ * Get Drawable value of an Object for use in a list item
+ * @param obj Current Object for getting second String value of it
+ * @return Drawable
+ */
+ Drawable getImage(T obj);
+}
diff --git a/SJDialog/src/main/java/com/sjapps/library/customdialog/ListItemValue.java b/SJDialog/src/main/java/com/sjapps/library/customdialog/ListItemValue.java
new file mode 100644
index 0000000..5d437ef
--- /dev/null
+++ b/SJDialog/src/main/java/com/sjapps/library/customdialog/ListItemValue.java
@@ -0,0 +1,10 @@
+package com.sjapps.library.customdialog;
+
+public interface ListItemValue {
+ /**
+ * Get String value of an Object for using in a list
+ * @param obj Current Object for getting String value of it
+ * @return String value
+ */
+ String getValue(T obj);
+}
diff --git a/SJDialog/src/main/java/com/sjapps/library/customdialog/ListItemValues.java b/SJDialog/src/main/java/com/sjapps/library/customdialog/ListItemValues.java
new file mode 100644
index 0000000..74780bf
--- /dev/null
+++ b/SJDialog/src/main/java/com/sjapps/library/customdialog/ListItemValues.java
@@ -0,0 +1,17 @@
+package com.sjapps.library.customdialog;
+
+public interface ListItemValues {
+ /**
+ * Get String value of an Object for use in the first value of a list item
+ * @param obj Current Object for getting first String value of it
+ * @return String value
+ */
+ String getValue1(T obj);
+
+ /**
+ * Get String value of an Object for use in the second value of a list item
+ * @param obj Current Object for getting second String value of it
+ * @return String value
+ */
+ String getValue2(T obj);
+}
diff --git a/SJDialog/src/main/java/com/sjapps/library/customdialog/MessageDialog.java b/SJDialog/src/main/java/com/sjapps/library/customdialog/MessageDialog.java
new file mode 100644
index 0000000..8dc7c2f
--- /dev/null
+++ b/SJDialog/src/main/java/com/sjapps/library/customdialog/MessageDialog.java
@@ -0,0 +1,270 @@
+package com.sjapps.library.customdialog;
+
+import android.content.Context;
+import android.view.View;
+import android.widget.Button;
+import android.widget.TextView;
+
+import androidx.annotation.ColorInt;
+import androidx.annotation.DrawableRes;
+import androidx.annotation.StyleRes;
+
+import com.sjapps.library.R;
+/**@since 1.3*/
+@SuppressWarnings("unused")
+public class MessageDialog extends SJDialog{
+
+ private boolean isErrorDialog;
+
+ public MessageDialog(){
+ onlyOneButton = true;
+ }
+
+ public MessageDialog Builder(Context context){
+ super.Builder(context,R.layout.message_dialog);
+ onButtonClick(() -> dialog.dismiss());
+ return this;
+ }
+ public MessageDialog Builder(Context context,@StyleRes int theme){
+ super.Builder(context,R.layout.message_dialog,theme, false);
+ onButtonClick(() -> dialog.dismiss());
+ return this;
+ }
+ public MessageDialog Builder(Context context,boolean useAppTheme){
+ super.Builder(context,R.layout.message_dialog,useAppTheme);
+ onButtonClick(() -> dialog.dismiss());
+ return this;
+ }
+ public MessageDialog ErrorDialogBuilder(Context context){
+ return Builder(context).errorDialogAttributes();
+ }
+ public MessageDialog ErrorDialogBuilder(Context context,@StyleRes int theme){
+ return Builder(context,theme).errorDialogAttributes();
+ }
+ public MessageDialog ErrorDialogBuilder(Context context,boolean useAppTheme){
+ return Builder(context,useAppTheme).errorDialogAttributes();
+ }
+
+ private MessageDialog errorDialogAttributes(){
+ isErrorDialog = true;
+ return setDialogBackgroundResource(R.drawable.dialog_background_material3_red)
+ .setTextColor(context.getResources().getColor(R.color.SJDialog_ErrorTextColor, context.getTheme()))
+ .setButtonColor(MATERIAL3_RED_BUTTON)
+ .setTitle("Error");
+ }
+
+ /**{@inheritDoc}
+ * @since 1.5*/
+ @Override
+ public MessageDialog setOldTheme(){
+ super.setOldTheme();
+ if (isErrorDialog) {
+ setDialogBackgroundResource(R.drawable.dialog_background_red);
+ setTextColor(defaultOldColorWhite);
+ setButtonColor(defaultOldColorWhite);
+ setButtonTextColor(defaultOldColorBlack);
+ }
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.3*/
+ @Override
+ public MessageDialog setTitle(String title){
+ super.setTitle(title);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.3*/
+ @Override
+ public MessageDialog setMessage(String message) {
+ super.setMessage(message);
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ * @since 1.6
+ * */
+ @Override
+ public MessageDialog setTitleAlignment(int textAlignment) {
+ super.setTitleAlignment(textAlignment);
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ * @since 1.6
+ * */
+ @Override
+ public MessageDialog setMessageAlignment(int textAlignment) {
+ super.setMessageAlignment(textAlignment);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.6*/
+ @Override
+ public MessageDialog setTextColor(int color) {
+ super.setTextColor(color);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.6*/
+ @Override
+ public MessageDialog setTitleTextColor(int color) {
+ super.setTitleTextColor(color);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.6*/
+ @Override
+ public MessageDialog setMessageTextColor(int color) {
+ super.setMessageTextColor(color);
+ return this;
+ }
+
+ /**
+ * Set a button text.
+ * @param text button text
+ * @return current class
+ * @since 1.4
+ * */
+ public MessageDialog setButtonText(String text){
+ super.setLeftButtonText(text);
+ return this;
+ }
+
+ /**
+ * Set button text color.
+ * @param color Color to use for tinting this drawable
+ * @return current class
+ * @since 1.4
+ * */
+ public MessageDialog setButtonTextColor(@ColorInt int color){
+ super.setLeftButtonTextColor(color);
+ return this;
+ }
+
+ /**
+ * Set button color.
+ * @param color Color to use for tinting this drawable
+ * @return current class
+ * @since 1.4
+ * */
+ public MessageDialog setButtonColor(@ColorInt int color){
+ super.setLeftButtonColor(color);
+ return this;
+ }
+
+ @Override
+ public MessageDialog setButtonColor(@ButtonColor String color){
+ super.setButtonColor(color);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.6*/
+ @Override
+ public MessageDialog setDialogBackgroundColor(int color) {
+ super.setDialogBackgroundColor(color);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.3*/
+ @Override
+ public MessageDialog setDialogBackgroundResource(@DrawableRes int drawable){
+ super.setDialogBackgroundResource(drawable);
+ return this;
+ }
+
+ /**
+ * Set background resource for button.
+ * @param drawable resource id
+ * @return current class
+ * @since 1.3
+ * */
+ public MessageDialog setButtonBackgroundResource(@DrawableRes int drawable){
+ super.setLeftButtonBackgroundResource(drawable);
+ return this;
+ }
+
+ /**
+ * Set onClick listener for a button
+ * @param dialogButtonEvent dialog button events
+ * @return current class
+ * */
+ @Override
+ public MessageDialog onButtonClick(DialogButtonEvent dialogButtonEvent){
+ super.onLeftButtonClick(dialogButtonEvent);
+ return this;
+ }
+
+ @Override
+ protected void setButtons() {
+ setButton1(R.id.btn);
+ }
+
+ public Button getButton() {
+ return super.getLeftButton();
+ }
+
+ /**@since 1.6*/
+ @Override
+ public TextView getTitleTextView() {
+ return super.getTitleTextView();
+ }
+
+ /**@since 1.6*/
+ @Override
+ public TextView getMessageTextView() {
+ return super.getMessageTextView();
+ }
+
+ /**{@inheritDoc}
+ * @since 1.4*/
+ @Override
+ public MessageDialog setMaxDialogWidth(int maxDialogWidth){
+ super.setMaxDialogWidth(maxDialogWidth);
+ return this;
+ }
+
+ @Override
+ public MessageDialog setDialogAnimations(int styleRes) {
+ super.setDialogAnimations(styleRes);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.3*/
+ @Override
+ public MessageDialog show(){
+ super.show();
+ return this;
+ }
+
+ @Override
+ protected int setButtonsRootLayoutID() {
+ return R.id.buttonRoot;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.6*/
+ @Override
+ public MessageDialog setOnTouchListener(View.OnTouchListener onTouchListener) {
+ super.setOnTouchListener(onTouchListener);
+ return this;
+ }
+
+ /**{@inheritDoc}
+ * @since 1.6*/
+ @Override
+ public MessageDialog swipeToDismiss(boolean isSwipeToDismiss) {
+ super.swipeToDismiss(isSwipeToDismiss);
+ return this;
+ }
+}
diff --git a/SJDialog/src/main/java/com/sjapps/library/customdialog/SJDialog.java b/SJDialog/src/main/java/com/sjapps/library/customdialog/SJDialog.java
new file mode 100644
index 0000000..947e33c
--- /dev/null
+++ b/SJDialog/src/main/java/com/sjapps/library/customdialog/SJDialog.java
@@ -0,0 +1,744 @@
+package com.sjapps.library.customdialog;
+
+import android.annotation.SuppressLint;
+import android.app.Dialog;
+import android.content.Context;
+import android.graphics.Color;
+import android.graphics.drawable.ColorDrawable;
+import android.view.ContextThemeWrapper;
+import android.view.Gravity;
+import android.view.LayoutInflater;
+import android.view.View;
+
+import android.widget.Button;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import androidx.annotation.ColorInt;
+import androidx.annotation.DrawableRes;
+import androidx.annotation.IdRes;
+import androidx.annotation.IntDef;
+import androidx.annotation.LayoutRes;
+import androidx.annotation.StringDef;
+import androidx.annotation.StyleRes;
+
+import com.sjapps.library.R;
+
+@SuppressWarnings({"unused", "UnusedReturnValue"})
+public abstract class SJDialog {
+
+ public static final String RED_BUTTON = "RedBtn";
+ public static final String MATERIAL3_RED_BUTTON = "Material3RedBtn";
+ public static final String OLD_BUTTON_COLOR = "OldBtnColor";
+ /** Sets text alignment to {@link View#TEXT_ALIGNMENT_VIEW_START}
+ * @since 1.6
+ * */
+ public static final int TEXT_ALIGNMENT_LEFT = View.TEXT_ALIGNMENT_VIEW_START;
+ /** Sets text alignment to {@link View#TEXT_ALIGNMENT_VIEW_END}
+ * @since 1.6
+ * */
+ public static final int TEXT_ALIGNMENT_RIGHT = View.TEXT_ALIGNMENT_VIEW_END;
+ /** Sets text alignment to {@link View#TEXT_ALIGNMENT_CENTER}
+ * @since 1.6
+ * */
+ public static final int TEXT_ALIGNMENT_CENTER = View.TEXT_ALIGNMENT_CENTER;
+
+ private @LayoutRes int Btn1Resource = R.layout.button_template;
+ private @LayoutRes int Btn2Resource = R.layout.button_template;
+
+ @ColorInt int defaultOldThemeTextColor;
+ @ColorInt int defaultOldColorWhite = 0xFFE5E5E5;
+ @ColorInt int defaultOldColorBlack = 0xFF333333;
+
+ private final int defaultTheme = R.style.Theme_SJDialog;
+ private int newTheme = -1;
+ private boolean usesDefaultTheme = true;
+ private boolean isSwipeToDismiss = true;
+ private boolean isDefaultOnTouchListener = true;
+ private View.OnTouchListener dialogOnTouchListener = null;
+
+ public Dialog dialog;
+ protected Button button1, button2;
+ private LinearLayout background;
+ private int maxDialogWidth = 600;
+ Context context;
+
+ DialogButtonEvent dialogButtonEvent;
+ DialogButtonEvents dialogButtonEvents;
+
+ @StringDef({RED_BUTTON, MATERIAL3_RED_BUTTON, OLD_BUTTON_COLOR})
+ public @interface ButtonColor {
+ }
+
+ @IntDef({TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_RIGHT, TEXT_ALIGNMENT_CENTER})
+ public @interface TextAlignment {
+ }
+
+ protected boolean onlyOneButton = false;
+ protected boolean twoButtons = false;
+ private boolean leftBtnOnClick = false;
+
+ protected SJDialog Builder(Context context, @LayoutRes int layoutResID) {
+ Builder(context, layoutResID, defaultTheme, false);
+ return this;
+ }
+
+ protected SJDialog Builder(Context context, @LayoutRes int layoutResID, boolean useAppTheme) {
+ Builder(context, layoutResID, defaultTheme, useAppTheme);
+ return this;
+ }
+
+ protected SJDialog Builder(Context context, @LayoutRes int layoutResID, @StyleRes int theme, boolean useAppTheme) {
+ this.context = context;
+ defaultOldThemeTextColor = context.getResources().getColor(R.color.SJDialog_OldThemeTextColor, context.getTheme());
+ dialog = useAppTheme ?
+ new Dialog(new ContextThemeWrapper(context, context.getTheme())) :
+ new Dialog(new ContextThemeWrapper(context, theme));
+ setContentView(layoutResID);
+ setDialogSize();
+ dialog.getWindow().getAttributes().gravity = Gravity.BOTTOM;
+ dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
+ dialog.getWindow().getAttributes().windowAnimations = R.style.SJDialogAnimation;
+ background = dialog.findViewById(R.id.dialogBackground);
+ setButtons();
+ if (theme != defaultTheme || useAppTheme) {
+ usesDefaultTheme = false;
+ newTheme = !useAppTheme ? theme : -1;
+ regenerateButtons();
+ }
+ return this;
+ }
+
+ protected void setDialogSize() {
+ if (context == null)
+ throw new NullPointerException("context is null");
+ if (dialog == null) {
+ throw new NullPointerException("dialog is null");
+ }
+ functions.SetDialogSize(context, dialog, maxDialogWidth);
+ }
+
+
+ /**
+ * By default dialog colors will be set to material3 dynamic colors.
+ * With this method you can set the dialog color for the background
+ * and buttons to the older non-dynamic colors
+ *
+ * @return current class
+ * @since 1.5
+ */
+ protected SJDialog setOldTheme() {
+ setButtonsColor(OLD_BUTTON_COLOR);
+ setDialogBackgroundResource(R.drawable.dialog_background_old);
+ setTextColor(defaultOldThemeTextColor);
+ return this;
+ }
+
+ /**
+ * Set a dialog title.
+ *
+ * @param title title of a dialog
+ * @return current class
+ * @since 1.3
+ */
+ protected SJDialog setTitle(String title) {
+ TextView TitleTv = getTitleTextView();
+ TitleTv.setText(title);
+ return this;
+ }
+
+ /**
+ * Set a dialog message.
+ *
+ * @param message message of a dialog
+ * @return current class
+ * @since 1.3
+ */
+ protected SJDialog setMessage(String message) {
+ TextView msg = getMessageTextView();
+ msg.setText(message);
+ msg.setVisibility(View.VISIBLE);
+ return this;
+ }
+
+ /**
+ * Set the text alignment for Title TextView. Default is set to {@link SJDialog#TEXT_ALIGNMENT_CENTER}
+ * @param textAlignment The text alignment to set. Supported types: {@link SJDialog#TEXT_ALIGNMENT_LEFT}, {@link SJDialog#TEXT_ALIGNMENT_RIGHT} and {@link SJDialog#TEXT_ALIGNMENT_CENTER}
+ * @return current class
+ * @since 1.6
+ * */
+ protected SJDialog setTitleAlignment(@TextAlignment int textAlignment){
+ TextView title = getTitleTextView();
+ title.setGravity(Gravity.RIGHT);
+ title.setTextAlignment(textAlignment);
+
+ return this;
+ }
+
+ /**
+ * Set the text alignment for Message TextView. Default is set to {@link SJDialog#TEXT_ALIGNMENT_LEFT}
+ * @param textAlignment The text alignment to set. Supported types: {@link SJDialog#TEXT_ALIGNMENT_LEFT}, {@link SJDialog#TEXT_ALIGNMENT_RIGHT} and {@link SJDialog#TEXT_ALIGNMENT_CENTER}
+ * @return current class
+ * @since 1.6
+ * */
+ protected SJDialog setMessageAlignment(@TextAlignment int textAlignment){
+ TextView msg = getMessageTextView();
+ msg.setTextAlignment(textAlignment);
+ return this;
+ }
+
+ /**
+ * Set text color.
+ *
+ * @param color Color to use for tinting this drawable
+ * @return current class
+ * @since 1.6
+ */
+ protected SJDialog setTextColor(@ColorInt int color) {
+ setTitleTextColor(color);
+ setMessageTextColor(color);
+ return this;
+ }
+
+ /**
+ * Set title text color.
+ *
+ * @param color Color to use for tinting this drawable
+ * @return current class
+ * @since 1.6
+ */
+ protected SJDialog setTitleTextColor(@ColorInt int color) {
+ getTitleTextView().setTextColor(color);
+ return this;
+ }
+
+ /**
+ * Set message text color.
+ *
+ * @param color Color to use for tinting this drawable
+ * @return current class
+ * @since 1.6
+ */
+ protected SJDialog setMessageTextColor(@ColorInt int color) {
+ getMessageTextView().setTextColor(color);
+ return this;
+ }
+
+ /**
+ * Set a text to left button.
+ *
+ * @param text button text
+ * @return current class
+ * @since 1.4
+ */
+ protected SJDialog setLeftButtonText(String text) {
+ button1.setText(text);
+ return this;
+ }
+
+ /**
+ * Set a text to right button.
+ *
+ * @param text button text
+ * @return current class
+ * @since 1.4
+ */
+ protected SJDialog setRightButtonText(String text) {
+ if (!twoButtons)
+ throw OneButtonException();
+ button2.setText(text);
+ return this;
+ }
+
+ /**
+ * Set text color for all buttons.
+ *
+ * @param color Color to use for tinting this drawable
+ * @return current class
+ * @since 1.4
+ */
+ protected SJDialog setButtonsTextColor(@ColorInt int color) {
+ button1.setTextColor(color);
+ if (twoButtons)
+ button2.setTextColor(color);
+ return this;
+ }
+
+ /**
+ * Set text color for left button.
+ *
+ * @param color Color to use for tinting this drawable
+ * @return current class
+ * @since 1.4
+ */
+ protected SJDialog setLeftButtonTextColor(@ColorInt int color) {
+ button1.setTextColor(color);
+ return this;
+ }
+
+ /**
+ * Set text color for right button.
+ *
+ * @param color Color to use for tinting this drawable
+ * @return current class
+ * @since 1.4
+ */
+ protected SJDialog setRightButtonTextColor(@ColorInt int color) {
+ if (!twoButtons)
+ throw OneButtonException();
+ button2.setTextColor(color);
+ return this;
+ }
+
+ /**
+ * Set background color for all buttons.
+ *
+ * @param color Color to use for tinting buttons
+ * @return current class
+ * @since 1.4
+ */
+ protected SJDialog setButtonsColor(@ColorInt int color) {
+ checkButtonResource(0);
+ button1.getBackground().setTint(color);
+ if (twoButtons) {
+ checkButtonResource(1);
+ button2.getBackground().setTint(color);
+ }
+ return this;
+ }
+
+ /**
+ * Set background color for left button.
+ *
+ * @param color Color to use for tinting this drawable
+ * @return current class
+ * @since 1.4
+ */
+ protected SJDialog setLeftButtonColor(@ColorInt int color) {
+ checkButtonResource(0);
+ button1.getBackground().setTint(color);
+ return this;
+ }
+
+ /**
+ * Set background color for right button.
+ *
+ * @param color Color to use for tinting this drawable
+ * @return current class
+ * @since 1.4
+ */
+ protected SJDialog setRightButtonColor(@ColorInt int color) {
+ if (!twoButtons)
+ throw OneButtonException();
+
+ checkButtonResource(1);
+ button2.getBackground().setTint(color);
+ return this;
+ }
+
+ protected SJDialog setButtonColor(@ButtonColor String color) {
+ checkButtonResource(0);
+ setLeftButtonColor(color);
+ return this;
+ }
+
+ protected SJDialog setButtonsColor(@ButtonColor String color) {
+ setLeftButtonColor(color);
+ if (twoButtons)
+ setRightButtonColor(color);
+
+ return this;
+ }
+
+ protected SJDialog setLeftButtonColor(@ButtonColor String color) {
+ checkButtonResource(0);
+ switch (color) {
+ case RED_BUTTON:
+ setLeftButtonBackgroundResource(R.drawable.ripple_button_red);
+ setLeftButtonTextColor(Color.WHITE);
+ break;
+ case MATERIAL3_RED_BUTTON:
+ setLeftButtonBackgroundResource(R.drawable.ripple_button_material3_red);
+ setLeftButtonTextColor(context.getResources().getColor(R.color.md_theme_onError, context.getTheme()));
+ break;
+ case OLD_BUTTON_COLOR:
+ setLeftButtonBackgroundResource(R.drawable.ripple_button_old);
+ setLeftButtonTextColor(Color.WHITE);
+ break;
+ default:
+ throw new IllegalArgumentException(color + " is not a valid argument");
+ }
+ return this;
+ }
+
+ protected SJDialog setRightButtonColor(@ButtonColor String color) {
+ if (!twoButtons)
+ throw OneButtonException();
+ checkButtonResource(1);
+ switch (color) {
+ case RED_BUTTON:
+ setRightButtonBackgroundResource(R.drawable.ripple_button_red);
+ setRightButtonTextColor(Color.WHITE);
+ break;
+ case MATERIAL3_RED_BUTTON:
+ setRightButtonBackgroundResource(R.drawable.ripple_button_material3_red);
+ setRightButtonTextColor(context.getResources().getColor(R.color.md_theme_onError, context.getTheme()));
+ break;
+ case OLD_BUTTON_COLOR:
+ setRightButtonBackgroundResource(R.drawable.ripple_button_old);
+ setRightButtonTextColor(Color.WHITE);
+
+ break;
+ default:
+ throw new IllegalArgumentException(color + " is not a valid argument");
+ }
+ return this;
+ }
+
+
+ /**
+ * Change dialog color
+ * @param color {@link ColorInt}
+ * @return current class
+ * @since 1.6
+ */
+ protected SJDialog setDialogBackgroundColor(@ColorInt int color){
+ background.getBackground().mutate().setTint(color);
+ return this;
+ }
+
+ /**
+ * Set background resource for dialog.
+ *
+ * @param drawable resource id
+ * @return current class
+ * @since 1.3
+ */
+ protected SJDialog setDialogBackgroundResource(@DrawableRes int drawable) {
+ background.setBackgroundResource(drawable);
+ return this;
+ }
+
+ /**
+ * Set background resource for all buttons.
+ *
+ * @param drawable resource id
+ * @return current class
+ * @since 1.3
+ */
+ protected SJDialog setButtonsBackgroundResource(@DrawableRes int drawable) {
+ checkButtonResource(0);
+ button1.setBackgroundResource(drawable);
+ if (twoButtons) {
+ checkButtonResource(1);
+ button2.setBackgroundResource(drawable);
+ }
+ return this;
+ }
+
+ /**
+ * Set background resource for left button.
+ *
+ * @param drawable resource id
+ * @return current class
+ * @since 1.3
+ */
+ protected SJDialog setLeftButtonBackgroundResource(@DrawableRes int drawable) {
+ checkButtonResource(0);
+ button1.setBackgroundResource(drawable);
+ return this;
+ }
+
+ /**
+ * Set background resource for right button.
+ *
+ * @param drawable resource id
+ * @return current class
+ * @since 1.3
+ */
+ protected SJDialog setRightButtonBackgroundResource(@DrawableRes int drawable) {
+ if (!twoButtons)
+ throw OneButtonException();
+
+ checkButtonResource(1);
+ button2.setBackgroundResource(drawable);
+ return this;
+ }
+
+ /**
+ * Set onClick listener for right button
+ *
+ * @param dialogButtonEvent dialog button events
+ * @return current class
+ * @since 1.0
+ */
+ protected SJDialog onButtonClick(DialogButtonEvent dialogButtonEvent) {
+ leftBtnOnClick = false;
+ this.dialogButtonEvent = dialogButtonEvent;
+
+ return this;
+ }
+
+ /**
+ * Set onClick listener for both buttons
+ *
+ * @param dialogButtonEvents dialog button events
+ * @return current class
+ * @since 1.0
+ */
+ protected SJDialog onButtonClick(DialogButtonEvents dialogButtonEvents) {
+ this.dialogButtonEvents = dialogButtonEvents;
+
+ return this;
+ }
+
+ /**
+ * Set onClick listener for left button
+ *
+ * @param dialogButtonEvent dialog button event
+ * @return current class
+ */
+ protected SJDialog onLeftButtonClick(DialogButtonEvent dialogButtonEvent) {
+ leftBtnOnClick = true;
+ this.dialogButtonEvent = dialogButtonEvent;
+
+ return this;
+ }
+
+ /**
+ * Creating dialog with two buttons. Use this method before changing buttons attributes
+ * @since 1.5
+ */
+ protected SJDialog dialogWithTwoButtons() {
+ twoButtons = true;
+ return this;
+ }
+
+ /**
+ * show dialog
+ * @since 1.3
+ */
+ protected SJDialog show() {
+ setDialogTouchListener();
+ addOnClickListener();
+ dialog.show();
+ return this;
+ }
+
+ private void addOnClickListener() {
+ if (dialogButtonEvents == null && dialogButtonEvent == null)
+ return;
+
+ if (dialogButtonEvents != null) {
+ button1.setOnClickListener(v -> dialogButtonEvents.onLeftButtonClick());
+ button2.setOnClickListener(v -> dialogButtonEvents.onRightButtonClick());
+ return;
+ }
+
+ if (!twoButtons) {
+ button1.setOnClickListener(v -> dialogButtonEvent.onButtonClick());
+ return;
+ }
+
+ if (leftBtnOnClick) {
+ button1.setOnClickListener(v -> dialogButtonEvent.onButtonClick());
+ return;
+ }
+
+ button1.setOnClickListener(v -> dismiss());
+ button2.setOnClickListener(v -> dialogButtonEvent.onButtonClick());
+ }
+
+ /**
+ * dismiss dialog
+ * @since 1.3
+ */
+ public void dismiss() {
+ dialog.dismiss();
+ }
+
+ private void setContentView(@LayoutRes int layoutResID) {
+ dialog.setContentView(layoutResID);
+ }
+
+ protected void setButton1(@IdRes int id) {
+ this.button1 = dialog.findViewById(id);
+ }
+
+ protected void setButton2(@IdRes int id) {
+ this.button2 = dialog.findViewById(id);
+ }
+
+ protected abstract @IdRes int setButtonsRootLayoutID();
+
+ protected abstract void setButtons();
+
+
+ private void regenerateButtons() {
+ LinearLayout buttons = dialog.findViewById(setButtonsRootLayoutID());
+ regenerateLeftBtn(buttons);
+ if (onlyOneButton) {
+ return;
+ }
+ regenerateRightBtn(buttons);
+ }
+
+ @SuppressLint("SetTextI18n")
+ private void regenerateLeftBtn(LinearLayout buttons) {
+ if (buttons == null)
+ buttons = dialog.findViewById(setButtonsRootLayoutID());
+
+ String txt = button1.getText().toString();
+ buttons.removeView(button1);
+ button1 = (Button) LayoutInflater
+ .from(newTheme != -1 ? new ContextThemeWrapper(context, newTheme) : context)
+ .inflate(Btn1Resource,buttons,false);
+ button1.setText(txt);
+ buttons.addView(button1, 0);
+ }
+
+ @SuppressLint("SetTextI18n")
+ private void regenerateRightBtn(LinearLayout buttons) {
+ if (buttons == null)
+ buttons = dialog.findViewById(setButtonsRootLayoutID());
+
+ int btn2Visibility = button2.getVisibility();
+ String txt = button2.getText().toString();
+ buttons.removeView(button2);
+ button2 = (Button) LayoutInflater
+ .from(newTheme != -1 ? new ContextThemeWrapper(context, newTheme) : context)
+ .inflate(Btn2Resource,buttons,false);
+ button2.setVisibility(btn2Visibility);
+ LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) button2.getLayoutParams();
+ params.setMarginStart(functions.dpToPixels(context,10));
+ button2.setLayoutParams(params);
+ button2.setText(txt);
+ buttons.addView(button2, 1);
+ }
+
+ private void checkButtonResource(int i) {
+ if (usesDefaultTheme)
+ return;
+
+ if (i == 0) {
+ if (Btn1Resource == R.layout.button_template) {
+ Btn1Resource = R.layout.button_template_1;
+ regenerateLeftBtn(null);
+ }
+ return;
+ }
+ if (i == 1) {
+ if (Btn2Resource == R.layout.button_template) {
+ Btn2Resource = R.layout.button_template_1;
+ regenerateRightBtn(null);
+ }
+ }
+ }
+
+ protected void setButton2Visibility(int visibility) {
+ button2.setVisibility(visibility);
+ }
+
+ protected TextView getTitleTextView() {
+ return dialog.findViewById(R.id.titleText);
+ }
+
+ protected TextView getMessageTextView() {
+ return dialog.findViewById(R.id.messageTxt);
+ }
+
+ protected Button getLeftButton() {
+ return button1;
+ }
+
+ protected Button getRightButton() {
+ return button2;
+ }
+
+ public int getMaxDialogWidth() {
+ return this.maxDialogWidth;
+ }
+
+ /**
+ * Set the maximum width for dialog
+ *
+ * @param maxDialogWidth set value for {@link #maxDialogWidth}. Default is 600dp
+ * @return current class
+ * @since 1.4
+ */
+ protected SJDialog setMaxDialogWidth(int maxDialogWidth) {
+ this.maxDialogWidth = maxDialogWidth;
+ setDialogSize();
+ return this;
+ }
+
+
+ /**
+ * Set animation for a dialog
+ *
+ * @param styleRes style resource
+ * @return current class
+ * @since 1.5
+ */
+ protected SJDialog setDialogAnimations(@StyleRes int styleRes) {
+ dialog.getWindow().getAttributes().windowAnimations = styleRes;
+ return this;
+ }
+
+ /**
+ * Enable or disable swipe down to dismiss dialog. Default is set to true
+ *
+ * @param isSwipeToDismiss Enable or disable swipe action
+ * @return current class
+ * @since 1.6
+ */
+ protected SJDialog swipeToDismiss(boolean isSwipeToDismiss){
+ this.isSwipeToDismiss = isSwipeToDismiss;
+ return this;
+ }
+
+ /**
+ * Set dialog OnTouchListener. by default is set to {@link SwipeDismissTouchListener}.
+ * If this method is used, swipe to dismiss will not work.
+ *
+ * @param onTouchListener onTouchListener for dialog view
+ * @return current class
+ * @since 1.6
+ */
+ protected SJDialog setOnTouchListener(View.OnTouchListener onTouchListener) {
+ dialogOnTouchListener = onTouchListener;
+ isDefaultOnTouchListener = false;
+ return this;
+ }
+
+ private void setDialogTouchListener() {
+
+ if (isDefaultOnTouchListener)
+ dialogOnTouchListener = new SwipeDismissTouchListener(
+ dialog.getWindow().getDecorView(),
+ new SwipeDismissTouchListener.DismissCallbacks() {
+ @Override
+ public boolean canDismiss() {
+ return isSwipeToDismiss;
+ }
+
+ @Override
+ public void onDismiss(View view) {
+ dialog.dismiss();
+ }
+ }
+ );
+
+ dialog.getWindow().getDecorView().setOnTouchListener(dialogOnTouchListener);
+ }
+
+ private OneButtonException OneButtonException() {
+ return new OneButtonException("Trying to access right button when dialog has only one button. Use 'dialogWithTwoButtons()' to fix the problem.");
+ }
+}
+
+class OneButtonException extends RuntimeException {
+ public OneButtonException(String message) {
+ super(message);
+ }
+}
diff --git a/SJDialog/src/main/java/com/sjapps/library/customdialog/SetupDialog.java b/SJDialog/src/main/java/com/sjapps/library/customdialog/SetupDialog.java
new file mode 100644
index 0000000..c0fe490
--- /dev/null
+++ b/SJDialog/src/main/java/com/sjapps/library/customdialog/SetupDialog.java
@@ -0,0 +1,9 @@
+package com.sjapps.library.customdialog;
+/**
+ * by SlaVcE
+ * Setting up custom dialog.
+ * @deprecated SetupDialog is renamed to BasicDialog. Use {@link BasicDialog} instead.
+ * @since 1.0
+ */
+@Deprecated(since = "1.6")
+public class SetupDialog extends BasicDialog{ }
diff --git a/SJDialog/src/main/java/com/sjapps/library/customdialog/SwipeDismissTouchListener.java b/SJDialog/src/main/java/com/sjapps/library/customdialog/SwipeDismissTouchListener.java
new file mode 100644
index 0000000..af14862
--- /dev/null
+++ b/SJDialog/src/main/java/com/sjapps/library/customdialog/SwipeDismissTouchListener.java
@@ -0,0 +1,216 @@
+package com.sjapps.library.customdialog;
+
+import android.animation.Animator;
+import android.animation.AnimatorListenerAdapter;
+import android.animation.ValueAnimator;
+import android.annotation.SuppressLint;
+import android.view.MotionEvent;
+import android.view.VelocityTracker;
+import android.view.View;
+import android.view.ViewConfiguration;
+import android.view.ViewGroup;
+
+
+public class SwipeDismissTouchListener implements View.OnTouchListener {
+ private final int mSlop;
+ private final long mAnimationTime;
+
+ // Fixed properties
+ private final View mView;
+ private final DismissCallbacks mCallbacks;
+ private int mViewHeight = 1; // 1 and not 0 to prevent dividing by zero
+
+ // Transient properties
+ private float mDownX;
+ private float mDownY;
+ private boolean mSwiping;
+ private int mSwipingSlop;
+ private VelocityTracker mVelocityTracker;
+ private float mTranslationY;
+
+ /**
+ * The callback interface used by {@link SwipeDismissTouchListener} to inform its client
+ * about a successful dismissal of the view for which it was created.
+ */
+ public interface DismissCallbacks {
+ /**
+ * Called to determine whether the view can be dismissed.
+ */
+ boolean canDismiss();
+
+ /**
+ * Called when the user has indicated they she would like to dismiss the view.
+ *
+ * @param view The originating {@link android.view.View} to be dismissed.
+ */
+ void onDismiss(View view);
+ }
+
+ /**
+ * Constructs a new swipe-to-dismiss touch listener for the given view.
+ *
+ * @param view The view to make dismissable.
+ * @param callbacks The callback to trigger when the user has indicated that would like to
+ * dismiss this view.
+ */
+ public SwipeDismissTouchListener(View view, DismissCallbacks callbacks) {
+ ViewConfiguration vc = ViewConfiguration.get(view.getContext());
+ mSlop = vc.getScaledTouchSlop();
+ mAnimationTime = view.getContext().getResources().getInteger(android.R.integer.config_shortAnimTime);
+ mView = view;
+ mCallbacks = callbacks;
+ }
+ @SuppressLint("ClickableViewAccessibility")
+ @Override
+ public boolean onTouch(View view, MotionEvent motionEvent) {
+ // offset because the view is translated during swipe
+ motionEvent.offsetLocation(0, mTranslationY);
+
+ boolean returnTrue = false;
+
+ if (mViewHeight < 2) {
+ mViewHeight = mView.getHeight();
+ }
+
+ switch (motionEvent.getActionMasked()) {
+ case MotionEvent.ACTION_DOWN: {
+ // TODO: ensure this is a finger, and set a flag
+ mDownX = motionEvent.getRawX();
+ mDownY = motionEvent.getRawY();
+ if (mCallbacks.canDismiss()) {
+ mVelocityTracker = VelocityTracker.obtain();
+ mVelocityTracker.addMovement(motionEvent);
+ }
+ return true;
+ }
+
+ case MotionEvent.ACTION_UP: {
+ if (mVelocityTracker == null) {
+ break;
+ }
+
+ float deltaY = motionEvent.getRawY() - mDownY;
+ mVelocityTracker.addMovement(motionEvent);
+ mVelocityTracker.computeCurrentVelocity(1000);
+
+ boolean dismiss = false;
+ boolean dismissDown = false;
+ if (deltaY > (float) mViewHeight / 2 && mSwiping) {
+ dismiss = true;
+ dismissDown = deltaY > 0;
+ returnTrue = true;
+ } else if (Math.abs(deltaY) > 0){
+ returnTrue = true;
+ }
+ if (dismiss) {
+ // dismiss
+ mView.animate()
+ .translationY(dismissDown ? mViewHeight : 0)
+ .alpha(0)
+ .setDuration(mAnimationTime)
+ .setListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ performDismiss();
+ }
+ });
+
+ } else if (mSwiping) {
+ // cancel
+
+ mView.animate()
+ .translationY(0)
+ .alpha(1)
+ .setDuration(mAnimationTime)
+ .setListener(null);
+ }
+ mVelocityTracker.recycle();
+ mVelocityTracker = null;
+ mTranslationY = 0;
+ mDownX = 0;
+ mDownY = 0;
+ mSwiping = false;
+ break;
+ }
+
+ case MotionEvent.ACTION_CANCEL: {
+ if (mVelocityTracker == null) {
+ break;
+ }
+ mView.animate()
+ .translationY(0)
+ .alpha(1)
+ .setDuration(mAnimationTime)
+ .setListener(null);
+ mVelocityTracker.recycle();
+ mVelocityTracker = null;
+ mTranslationY = 0;
+ mDownX = 0;
+ mDownY = 0;
+ mSwiping = false;
+ break;
+ }
+
+ case MotionEvent.ACTION_MOVE: {
+ if (mVelocityTracker == null) {
+ break;
+ }
+ mVelocityTracker.addMovement(motionEvent);
+ float deltaX = motionEvent.getRawX() - mDownX;
+ float deltaY = motionEvent.getRawY() - mDownY;
+ if (Math.abs(deltaY) > mSlop && Math.abs(deltaX) < Math.abs(deltaY) / 2) {
+ mSwiping = true;
+ mSwipingSlop = (deltaY > 0 ? mSlop : 0);
+ mView.getParent().requestDisallowInterceptTouchEvent(true);
+
+
+ MotionEvent cancelEvent = MotionEvent.obtain(motionEvent);
+ cancelEvent.setAction(MotionEvent.ACTION_CANCEL | (motionEvent.getActionIndex() << MotionEvent.ACTION_POINTER_INDEX_SHIFT));
+ mView.onTouchEvent(cancelEvent);
+ cancelEvent.recycle();
+ }
+
+ if (mSwiping) {
+ mTranslationY = deltaY;
+ if (deltaY - mSwipingSlop < 0)
+ mView.setTranslationY(0);
+ else mView.setTranslationY(deltaY - mSwipingSlop);
+ return true;
+ }
+ break;
+ }
+
+ }
+ return returnTrue;
+ }
+
+ private void performDismiss() {
+ // Animate the dismissed view to zero-height and then fire the dismiss callback.
+ // This triggers layout on each animation frame; in the future we may want to do something
+ // smarter and more performant.
+
+ final ViewGroup.LayoutParams lp = mView.getLayoutParams();
+ final int originalHeight = mView.getHeight();
+
+ ValueAnimator animator = ValueAnimator.ofInt(originalHeight, 1).setDuration(mAnimationTime);
+
+ animator.addListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ mCallbacks.onDismiss(mView);
+ // Reset view presentation
+ mView.setAlpha(1f);
+ mView.setTranslationX(0);
+ lp.height = originalHeight;
+ mView.setLayoutParams(lp);
+ }
+ });
+
+ animator.addUpdateListener(valueAnimator -> {
+ lp.height = (Integer) valueAnimator.getAnimatedValue();
+ mView.setLayoutParams(lp);
+ });
+
+ animator.start();
+ }
+}
diff --git a/SJDialog/src/main/java/com/sjapps/library/customdialog/adapter/DefaultImageListAdapter.java b/SJDialog/src/main/java/com/sjapps/library/customdialog/adapter/DefaultImageListAdapter.java
new file mode 100644
index 0000000..0456f1a
--- /dev/null
+++ b/SJDialog/src/main/java/com/sjapps/library/customdialog/adapter/DefaultImageListAdapter.java
@@ -0,0 +1,162 @@
+package com.sjapps.library.customdialog.adapter;
+
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.sjapps.library.R;
+import com.sjapps.library.customdialog.ImageListItem;
+import com.sjapps.library.customdialog.list.events.ListItemClickObj;
+
+import java.util.ArrayList;
+
+public class DefaultImageListAdapter extends RecyclerView.Adapter {
+
+ public ArrayList arrayListItems;
+
+ boolean isSelectable;
+
+ int itemBgRes;
+ int itemBgResSelected;
+ int listItemBgColor;
+ int listItemBgColorSelected;
+ int textColor;
+
+ ListItemClickObj itemClick;
+ ArrayList selectedItems;
+
+
+ public static class ViewHolder extends RecyclerView.ViewHolder {
+ TextView valTxt;
+ ImageView imageView;
+
+ public ViewHolder(@NonNull View itemView) {
+ super(itemView);
+ valTxt = itemView.findViewById(R.id.value1Txt);
+ imageView = itemView.findViewById(R.id.imageView);
+ }
+
+ public TextView getTxt() {
+ return valTxt;
+ }
+
+ public ImageView getImageView() {
+ return imageView;
+ }
+
+ public View getView() {
+ return itemView.findViewById(R.id.layoutItem);
+ }
+
+ }
+
+ public DefaultImageListAdapter(ArrayList arrayList,
+ boolean isSelectable,
+ @Nullable ListItemClickObj itemClick,
+ ArrayList selectedItems,
+ int itemBgRes,
+ int itemBgResSelected,
+ int textColor,
+ int listItemBgColor,
+ int listItemBgColorSelected) {
+ this.itemClick = itemClick;
+ this.isSelectable = isSelectable;
+ this.selectedItems = selectedItems;
+ this.itemBgRes = itemBgRes;
+ this.itemBgResSelected = itemBgResSelected;
+ this.textColor = textColor;
+ this.arrayListItems = arrayList;
+ this.listItemBgColor = listItemBgColor;
+ this.listItemBgColorSelected = listItemBgColorSelected;
+ }
+
+
+ @NonNull
+ @Override
+ public DefaultImageListAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.default_image_list_item, parent, false);
+ return new DefaultImageListAdapter.ViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
+ setValues(holder, position);
+ setBackground(holder, position);
+
+ if (textColor != 1) {
+ holder.getTxt().setTextColor(textColor);
+ }
+
+ if (isSelectable) {
+ holder.getView().setOnClickListener(v ->
+ checkSelected(holder, arrayListItems.get(position))
+ );
+
+ return;
+ }
+
+ holder.getView().setOnClickListener(v -> itemClick.onClick(position, arrayListItems.get(position)));
+
+ }
+
+ private void setBackground(@NonNull ViewHolder holder, int position) {
+ if (!isSelectable) {
+ setItemResource(holder, itemBgRes);
+ return;
+ }
+
+ if (selectedItems.contains(arrayListItems.get(position))) {
+ setItemResource(holder, itemBgResSelected);
+ setItemColor(holder,listItemBgColorSelected);
+ }
+ else {
+ setItemResource(holder, itemBgRes);
+ setItemColor(holder,listItemBgColor);
+ }
+ }
+
+ private void setValues(@NonNull ViewHolder holder, int position) {
+ holder.getTxt().setText(arrayListItems.get(position).getName());
+ holder.getImageView().setImageDrawable(arrayListItems.get(position).getImage());
+
+ }
+
+ private void checkSelected(@NonNull ViewHolder holder,ImageListItem obj) {
+ if (!selectedItems.contains(obj))
+ selectItem(holder, obj);
+ else deselectItem(holder, obj);
+ }
+
+ private void selectItem(@NonNull ViewHolder holder,ImageListItem obj) {
+ selectedItems.add(obj);
+ setItemResource(holder, itemBgResSelected);
+ setItemColor(holder,listItemBgColorSelected);
+ }
+
+ private void deselectItem(@NonNull ViewHolder holder,ImageListItem obj) {
+ selectedItems.remove(obj);
+ setItemResource(holder, itemBgRes);
+ setItemColor(holder,listItemBgColor);
+ }
+
+ private void setItemResource(@NonNull ViewHolder holder, int drawable) {
+ holder.getView().setBackgroundResource(drawable);
+ }
+
+ private void setItemColor(@NonNull ViewHolder holder, int color){
+ if (color == -1)
+ return;
+ holder.getView().getBackground().mutate().setTint(color);
+ }
+
+ @Override
+ public int getItemCount() {
+ return arrayListItems.size();
+ }
+}
diff --git a/SJDialog/src/main/java/com/sjapps/library/customdialog/adapter/DefaultListAdapter.java b/SJDialog/src/main/java/com/sjapps/library/customdialog/adapter/DefaultListAdapter.java
new file mode 100644
index 0000000..c0526b6
--- /dev/null
+++ b/SJDialog/src/main/java/com/sjapps/library/customdialog/adapter/DefaultListAdapter.java
@@ -0,0 +1,112 @@
+package com.sjapps.library.customdialog.adapter;
+
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import androidx.annotation.NonNull;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.sjapps.library.R;
+import com.sjapps.library.customdialog.list.events.ListItemClick;
+
+import java.util.ArrayList;
+
+public class DefaultListAdapter extends RecyclerView.Adapter {
+
+ String[] items;
+ boolean isSelectable;
+ ListItemClick itemClick;
+ ArrayList selectedItems;
+ int itemBgRes;
+ int itemBgResSelected;
+ int listItemBgColor;
+ int listItemBgColorSelected;
+ int textColor;
+
+
+ public DefaultListAdapter(String[] items,
+ boolean isSelectable,
+ ListItemClick itemClick,
+ ArrayList selectedItems,
+ int itemBgRes,
+ int itemBgResSelected,
+ int textColor,
+ int listItemBgColor,
+ int listItemBgColorSelected) {
+ this.items = items;
+ this.isSelectable = isSelectable;
+ this.itemClick = itemClick;
+ this.selectedItems = selectedItems;
+ this.itemBgRes = itemBgRes;
+ this.itemBgResSelected = itemBgResSelected;
+ this.textColor = textColor;
+ this.listItemBgColor = listItemBgColor;
+ this.listItemBgColorSelected = listItemBgColorSelected;
+
+ }
+
+ @NonNull
+ @Override
+ public DefaultListAdapterGeneric.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.default_list_item,parent,false);
+ return new DefaultListAdapterGeneric.ViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull DefaultListAdapterGeneric.ViewHolder holder, int position) {
+ holder.getVal1Txt().setText(items[position]);
+
+ if (selectedItems.contains(items[position])) {
+ setItemResource(holder, itemBgResSelected);
+ setItemColor(holder,listItemBgColorSelected);
+ }
+ else {
+ setItemResource(holder, itemBgRes);
+ setItemColor(holder,listItemBgColor);
+ }
+ if (textColor != 1)
+ holder.getVal1Txt().setTextColor(textColor);
+
+ if (isSelectable) {
+ holder.getView().setOnClickListener(v -> {
+ if (!selectedItems.contains(items[position]))
+ selectItem(holder,position);
+ else deselectItem(holder, position);
+ });
+ return;
+ }
+
+ holder.getView().setOnClickListener(v -> itemClick.onClick(position,items[position]));
+
+ }
+
+ private void selectItem(@NonNull DefaultListAdapterGeneric.ViewHolder holder, int position){
+ selectedItems.add(items[position]);
+ setItemResource(holder,itemBgResSelected);
+ setItemColor(holder,listItemBgColorSelected);
+
+ }
+
+ private void deselectItem(@NonNull DefaultListAdapterGeneric.ViewHolder holder, int position){
+ selectedItems.remove(items[position]);
+ setItemResource(holder,itemBgRes);
+ setItemColor(holder,listItemBgColor);
+ }
+
+ private void setItemResource(@NonNull DefaultListAdapterGeneric.ViewHolder holder, int drawable){
+ holder.getView().setBackgroundResource(drawable);
+ }
+
+ private void setItemColor(@NonNull DefaultListAdapterGeneric.ViewHolder holder, int color){
+ if (color == -1)
+ return;
+ holder.getView().getBackground().mutate().setTint(color);
+ }
+
+ @Override
+ public int getItemCount() {
+ return items.length;
+ }
+
+}
diff --git a/SJDialog/src/main/java/com/sjapps/library/customdialog/adapter/DefaultListAdapterGeneric.java b/SJDialog/src/main/java/com/sjapps/library/customdialog/adapter/DefaultListAdapterGeneric.java
new file mode 100644
index 0000000..fd9c9da
--- /dev/null
+++ b/SJDialog/src/main/java/com/sjapps/library/customdialog/adapter/DefaultListAdapterGeneric.java
@@ -0,0 +1,290 @@
+package com.sjapps.library.customdialog.adapter;
+
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.sjapps.library.R;
+import com.sjapps.library.customdialog.ListItemValue;
+import com.sjapps.library.customdialog.ListItemValues;
+import com.sjapps.library.customdialog.list.events.ListItemClickObj;
+
+import java.util.ArrayList;
+
+public class DefaultListAdapterGeneric extends RecyclerView.Adapter {
+
+ public ArrayList arrayListItems;
+ public T[] listObj;
+
+ private ListItemValue value;
+ private ListItemValues values;
+
+ boolean isArrList;
+ boolean isObjArr;
+ boolean hasTwoVal;
+ boolean isSelectable;
+
+ int itemBgRes;
+ int itemBgResSelected;
+ int listItemBgColor;
+ int listItemBgColorSelected;
+ int textColor;
+
+ ListItemClickObj itemClick;
+ ArrayList selectedItems;
+
+
+ public static class ViewHolder extends RecyclerView.ViewHolder{
+ TextView val1Txt;
+ TextView val2Txt;
+
+ public ViewHolder(@NonNull View itemView) {
+ super(itemView);
+ val1Txt = itemView.findViewById(R.id.value1Txt);
+ val2Txt = itemView.findViewById(R.id.value2Txt);
+ }
+
+ public TextView getVal1Txt() {
+ return val1Txt;
+ }
+
+ public TextView getVal2Txt() {
+ return val2Txt;
+ }
+
+ public View getView(){
+ return itemView.findViewById(R.id.layoutItem);
+ }
+
+ }
+
+ public DefaultListAdapterGeneric(T[] objArray,
+ ListItemValue value,
+ boolean isSelectable,
+ @Nullable ListItemClickObj itemClick,
+ ArrayList selectedItems,
+ int itemBgRes,
+ int itemBgResSelected,
+ int textColor,
+ int listItemBgColor,
+ int listItemBgColorSelected){
+ this.value = value;
+ this.itemClick = itemClick;
+ this.isSelectable = isSelectable;
+ this.selectedItems = selectedItems;
+ this.itemBgRes = itemBgRes;
+ this.itemBgResSelected = itemBgResSelected;
+ this.textColor = textColor;
+ this.listItemBgColor = listItemBgColor;
+ this.listItemBgColorSelected = listItemBgColorSelected;
+ ObjArrayAdapter(objArray);
+ }
+
+ public DefaultListAdapterGeneric(T[] objArray,
+ ListItemValues values,
+ boolean isSelectable,
+ @Nullable ListItemClickObj itemClick,
+ ArrayList selectedItems,
+ int itemBgRes,
+ int itemBgResSelected,
+ int textColor,
+ int listItemBgColor,
+ int listItemBgColorSelected){
+ this.values = values;
+ this.itemClick = itemClick;
+ hasTwoVal = true;
+ this.isSelectable = isSelectable;
+ this.selectedItems = selectedItems;
+ this.itemBgRes = itemBgRes;
+ this.itemBgResSelected = itemBgResSelected;
+ this.textColor = textColor;
+ this.listItemBgColor = listItemBgColor;
+ this.listItemBgColorSelected = listItemBgColorSelected;
+ ObjArrayAdapter(objArray);
+ }
+
+ public DefaultListAdapterGeneric(ArrayList arrayList,
+ ListItemValue value,
+ boolean isSelectable,
+ @Nullable ListItemClickObj itemClick,
+ ArrayList selectedItems,
+ int itemBgRes,
+ int itemBgResSelected,
+ int textColor,
+ int listItemBgColor,
+ int listItemBgColorSelected){
+ this.value = value;
+ this.itemClick = itemClick;
+ this.isSelectable = isSelectable;
+ this.selectedItems = selectedItems;
+ this.itemBgRes = itemBgRes;
+ this.itemBgResSelected = itemBgResSelected;
+ this.textColor = textColor;
+ this.listItemBgColor = listItemBgColor;
+ this.listItemBgColorSelected = listItemBgColorSelected;
+ ArrayListAdapter(arrayList);
+ }
+
+ public DefaultListAdapterGeneric(ArrayList arrayList,
+ ListItemValues values,
+ boolean isSelectable,
+ @Nullable ListItemClickObj itemClick,
+ ArrayList selectedItems,
+ int itemBgRes,
+ int itemBgResSelected,
+ int textColor,
+ int listItemBgColor,
+ int listItemBgColorSelected){
+ this.values = values;
+ this.itemClick = itemClick;
+ hasTwoVal = true;
+ this.isSelectable = isSelectable;
+ this.selectedItems = selectedItems;
+ this.itemBgRes = itemBgRes;
+ this.itemBgResSelected = itemBgResSelected;
+ this.textColor = textColor;
+ this.listItemBgColor = listItemBgColor;
+ this.listItemBgColorSelected = listItemBgColorSelected;
+ ArrayListAdapter(arrayList);
+ }
+
+ private void ObjArrayAdapter(T[] objArray){
+ this.listObj = objArray;
+ isObjArr = true;
+
+ }
+
+ private void ArrayListAdapter(ArrayList arrayList){
+ this.arrayListItems = arrayList;
+ isArrList = true;
+ }
+
+ @NonNull
+ @Override
+ public DefaultListAdapterGeneric.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.default_list_item,parent,false);
+ return new ViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull DefaultListAdapterGeneric.ViewHolder holder, int position) {
+ setValues(holder,position);
+ setBackground(holder,position);
+
+ if (textColor != 1){
+ holder.getVal1Txt().setTextColor(textColor);
+ holder.getVal2Txt().setTextColor(textColor);
+ }
+
+ if (isSelectable){
+ holder.getView().setOnClickListener(v -> {
+ if (isArrList)
+ checkSelected(holder, arrayListItems.get(position));
+ else if (isObjArr)
+ checkSelected(holder, listObj[position]);
+ });
+
+ return;
+ }
+
+ if (isArrList)
+ holder.getView().setOnClickListener(v -> itemClick.onClick(position,arrayListItems.get(position)));
+
+ if (isObjArr)
+ holder.getView().setOnClickListener(v -> itemClick.onClick(position,listObj[position]));
+
+ }
+
+ private void setBackground(@NonNull DefaultListAdapterGeneric.ViewHolder holder, int position) {
+ if (!isSelectable) {
+ setItemResource(holder,itemBgRes);
+ return;
+ }
+ if (isArrList) {
+ if (selectedItems.contains(arrayListItems.get(position))) {
+ setItemResource(holder, itemBgResSelected);
+ setItemColor(holder,listItemBgColorSelected);
+ }
+ else {
+ setItemResource(holder, itemBgRes);
+ setItemColor(holder,listItemBgColor);
+ }
+ return;
+ }
+ if (isObjArr)
+ if (selectedItems.contains(listObj[position])) {
+ setItemResource(holder, itemBgResSelected);
+ setItemColor(holder,listItemBgColorSelected);
+ }
+ else {
+ setItemResource(holder, itemBgRes);
+ setItemColor(holder,listItemBgColor);
+ }
+ }
+
+ private void setValues(@NonNull DefaultListAdapterGeneric.ViewHolder holder, int position){
+ if (isArrList){
+ if (!hasTwoVal) {
+ holder.getVal1Txt().setText(value.getValue(arrayListItems.get(position)));
+ return;
+ }
+ holder.getVal1Txt().setText(values.getValue1(arrayListItems.get(position)));
+ holder.getVal2Txt().setText(values.getValue2(arrayListItems.get(position)));
+ holder.getVal2Txt().setVisibility(View.VISIBLE);
+ return;
+ }
+ if (isObjArr) {
+ if (!hasTwoVal) {
+ holder.getVal1Txt().setText(value.getValue(listObj[position]));
+ return;
+ }
+ holder.getVal1Txt().setText(values.getValue1(listObj[position]));
+ holder.getVal2Txt().setText(values.getValue2(listObj[position]));
+ holder.getVal2Txt().setVisibility(View.VISIBLE);
+ }
+ }
+
+ private void checkSelected(@NonNull DefaultListAdapterGeneric.ViewHolder holder, T obj){
+ if (!selectedItems.contains(obj))
+ selectItem(holder,obj);
+ else deselectItem(holder,obj);
+ }
+
+ private void selectItem(@NonNull DefaultListAdapterGeneric.ViewHolder holder, T obj){
+ selectedItems.add(obj);
+ setItemResource(holder, itemBgResSelected);
+ setItemColor(holder,listItemBgColorSelected);
+
+ }
+
+ private void deselectItem(@NonNull DefaultListAdapterGeneric.ViewHolder holder, T obj){
+ selectedItems.remove(obj);
+ setItemResource(holder,itemBgRes);
+ setItemColor(holder,listItemBgColor);
+
+ }
+
+ private void setItemResource(@NonNull DefaultListAdapterGeneric.ViewHolder holder, int drawable){
+ holder.getView().setBackgroundResource(drawable);
+ }
+
+ private void setItemColor(@NonNull DefaultListAdapterGeneric.ViewHolder holder, int color){
+ if (color == -1)
+ return;
+ holder.getView().getBackground().mutate().setTint(color);
+ }
+
+ @Override
+ public int getItemCount() {
+ if (isArrList)
+ return arrayListItems.size();
+ if (isObjArr)
+ return listObj.length;
+ return 0;
+ }
+}
diff --git a/SJDialog/src/main/java/com/sjapps/library/customdialog/functions.java b/SJDialog/src/main/java/com/sjapps/library/customdialog/functions.java
new file mode 100644
index 0000000..ceb278a
--- /dev/null
+++ b/SJDialog/src/main/java/com/sjapps/library/customdialog/functions.java
@@ -0,0 +1,31 @@
+package com.sjapps.library.customdialog;
+
+import android.app.Dialog;
+import android.content.Context;
+import android.content.res.Configuration;
+import android.content.res.Resources;
+import android.util.Log;
+import android.util.TypedValue;
+import android.view.ViewGroup;
+
+import androidx.annotation.NonNull;
+
+import com.sjapps.library.R;
+
+public class functions {
+ public static void SetDialogSize(@NonNull Context context, Dialog dialog, int maxWidth){
+ Configuration configuration = context.getResources().getConfiguration();
+ int width = ViewGroup.LayoutParams.MATCH_PARENT;
+ int height = ViewGroup.LayoutParams.WRAP_CONTENT;
+
+ if (configuration.screenWidthDp > maxWidth)
+ width = dpToPixels(context,maxWidth);
+
+ dialog.getWindow().setLayout(width, height);
+
+ }
+ public static int dpToPixels(@NonNull Context context, float dp) {
+ Resources r = context.getResources();
+ return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, r.getDisplayMetrics());
+ }
+}
diff --git a/SJDialog/src/main/java/com/sjapps/library/customdialog/list/events/ListItemClick.java b/SJDialog/src/main/java/com/sjapps/library/customdialog/list/events/ListItemClick.java
new file mode 100644
index 0000000..43f2c47
--- /dev/null
+++ b/SJDialog/src/main/java/com/sjapps/library/customdialog/list/events/ListItemClick.java
@@ -0,0 +1,5 @@
+package com.sjapps.library.customdialog.list.events;
+
+public interface ListItemClick {
+ void onClick(int position, String value);
+}
diff --git a/SJDialog/src/main/java/com/sjapps/library/customdialog/list/events/ListItemClickObj.java b/SJDialog/src/main/java/com/sjapps/library/customdialog/list/events/ListItemClickObj.java
new file mode 100644
index 0000000..5c38355
--- /dev/null
+++ b/SJDialog/src/main/java/com/sjapps/library/customdialog/list/events/ListItemClickObj.java
@@ -0,0 +1,5 @@
+package com.sjapps.library.customdialog.list.events;
+
+public interface ListItemClickObj {
+ void onClick(int position, T obj);
+}
diff --git a/SJDialog/src/main/res/anim/slide_in.xml b/SJDialog/src/main/res/anim/slide_in.xml
new file mode 100644
index 0000000..97f2515
--- /dev/null
+++ b/SJDialog/src/main/res/anim/slide_in.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SJDialog/src/main/res/anim/slide_out.xml b/SJDialog/src/main/res/anim/slide_out.xml
new file mode 100644
index 0000000..dc2c40d
--- /dev/null
+++ b/SJDialog/src/main/res/anim/slide_out.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SJDialog/src/main/res/drawable/dialog_background.xml b/SJDialog/src/main/res/drawable/dialog_background.xml
new file mode 100644
index 0000000..aa579df
--- /dev/null
+++ b/SJDialog/src/main/res/drawable/dialog_background.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SJDialog/src/main/res/drawable/dialog_background_material3_red.xml b/SJDialog/src/main/res/drawable/dialog_background_material3_red.xml
new file mode 100644
index 0000000..a82d7b0
--- /dev/null
+++ b/SJDialog/src/main/res/drawable/dialog_background_material3_red.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SJDialog/src/main/res/drawable/dialog_background_old.xml b/SJDialog/src/main/res/drawable/dialog_background_old.xml
new file mode 100644
index 0000000..0812011
--- /dev/null
+++ b/SJDialog/src/main/res/drawable/dialog_background_old.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SJDialog/src/main/res/drawable/dialog_background_red.xml b/SJDialog/src/main/res/drawable/dialog_background_red.xml
new file mode 100644
index 0000000..c3b617d
--- /dev/null
+++ b/SJDialog/src/main/res/drawable/dialog_background_red.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SJDialog/src/main/res/drawable/ripple_button.xml b/SJDialog/src/main/res/drawable/ripple_button.xml
new file mode 100644
index 0000000..535fe85
--- /dev/null
+++ b/SJDialog/src/main/res/drawable/ripple_button.xml
@@ -0,0 +1,14 @@
+
+
+ -
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SJDialog/src/main/res/drawable/ripple_button_material3_red.xml b/SJDialog/src/main/res/drawable/ripple_button_material3_red.xml
new file mode 100644
index 0000000..846ed5a
--- /dev/null
+++ b/SJDialog/src/main/res/drawable/ripple_button_material3_red.xml
@@ -0,0 +1,14 @@
+
+
+ -
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SJDialog/src/main/res/drawable/ripple_button_old.xml b/SJDialog/src/main/res/drawable/ripple_button_old.xml
new file mode 100644
index 0000000..6ecd2a7
--- /dev/null
+++ b/SJDialog/src/main/res/drawable/ripple_button_old.xml
@@ -0,0 +1,14 @@
+
+
+ -
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SJDialog/src/main/res/drawable/ripple_button_red.xml b/SJDialog/src/main/res/drawable/ripple_button_red.xml
new file mode 100644
index 0000000..e799e3b
--- /dev/null
+++ b/SJDialog/src/main/res/drawable/ripple_button_red.xml
@@ -0,0 +1,14 @@
+
+
+ -
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SJDialog/src/main/res/drawable/ripple_list.xml b/SJDialog/src/main/res/drawable/ripple_list.xml
new file mode 100644
index 0000000..18b9d7e
--- /dev/null
+++ b/SJDialog/src/main/res/drawable/ripple_list.xml
@@ -0,0 +1,14 @@
+
+
+ -
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SJDialog/src/main/res/drawable/ripple_list_old.xml b/SJDialog/src/main/res/drawable/ripple_list_old.xml
new file mode 100644
index 0000000..5ae90de
--- /dev/null
+++ b/SJDialog/src/main/res/drawable/ripple_list_old.xml
@@ -0,0 +1,14 @@
+
+
+ -
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SJDialog/src/main/res/drawable/ripple_list_selected.xml b/SJDialog/src/main/res/drawable/ripple_list_selected.xml
new file mode 100644
index 0000000..b87b794
--- /dev/null
+++ b/SJDialog/src/main/res/drawable/ripple_list_selected.xml
@@ -0,0 +1,14 @@
+
+
+ -
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SJDialog/src/main/res/drawable/ripple_list_selected_old.xml b/SJDialog/src/main/res/drawable/ripple_list_selected_old.xml
new file mode 100644
index 0000000..affa5af
--- /dev/null
+++ b/SJDialog/src/main/res/drawable/ripple_list_selected_old.xml
@@ -0,0 +1,14 @@
+
+
+ -
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SJDialog/src/main/res/font/koho.ttf b/SJDialog/src/main/res/font/koho.ttf
new file mode 100644
index 0000000..78e04aa
Binary files /dev/null and b/SJDialog/src/main/res/font/koho.ttf differ
diff --git a/SJDialog/src/main/res/font/koho_bold.ttf b/SJDialog/src/main/res/font/koho_bold.ttf
new file mode 100644
index 0000000..a0123f5
Binary files /dev/null and b/SJDialog/src/main/res/font/koho_bold.ttf differ
diff --git a/SJDialog/src/main/res/font/koho_italic.ttf b/SJDialog/src/main/res/font/koho_italic.ttf
new file mode 100644
index 0000000..e6cf346
Binary files /dev/null and b/SJDialog/src/main/res/font/koho_italic.ttf differ
diff --git a/SJDialog/src/main/res/layout/basic_dialog.xml b/SJDialog/src/main/res/layout/basic_dialog.xml
new file mode 100644
index 0000000..b581a7f
--- /dev/null
+++ b/SJDialog/src/main/res/layout/basic_dialog.xml
@@ -0,0 +1,92 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SJDialog/src/main/res/layout/button_template.xml b/SJDialog/src/main/res/layout/button_template.xml
new file mode 100644
index 0000000..d0099ce
--- /dev/null
+++ b/SJDialog/src/main/res/layout/button_template.xml
@@ -0,0 +1,14 @@
+
+
\ No newline at end of file
diff --git a/SJDialog/src/main/res/layout/button_template_1.xml b/SJDialog/src/main/res/layout/button_template_1.xml
new file mode 100644
index 0000000..a75ef37
--- /dev/null
+++ b/SJDialog/src/main/res/layout/button_template_1.xml
@@ -0,0 +1,15 @@
+
+
\ No newline at end of file
diff --git a/SJDialog/src/main/res/layout/custom_view_dialog.xml b/SJDialog/src/main/res/layout/custom_view_dialog.xml
new file mode 100644
index 0000000..1d8a6de
--- /dev/null
+++ b/SJDialog/src/main/res/layout/custom_view_dialog.xml
@@ -0,0 +1,107 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SJDialog/src/main/res/layout/default_image_list_item.xml b/SJDialog/src/main/res/layout/default_image_list_item.xml
new file mode 100644
index 0000000..03938fe
--- /dev/null
+++ b/SJDialog/src/main/res/layout/default_image_list_item.xml
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SJDialog/src/main/res/layout/default_list_item.xml b/SJDialog/src/main/res/layout/default_list_item.xml
new file mode 100644
index 0000000..2096c5f
--- /dev/null
+++ b/SJDialog/src/main/res/layout/default_list_item.xml
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SJDialog/src/main/res/layout/list_dialog.xml b/SJDialog/src/main/res/layout/list_dialog.xml
new file mode 100644
index 0000000..a7fb9b5
--- /dev/null
+++ b/SJDialog/src/main/res/layout/list_dialog.xml
@@ -0,0 +1,110 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SJDialog/src/main/res/layout/message_dialog.xml b/SJDialog/src/main/res/layout/message_dialog.xml
new file mode 100644
index 0000000..e7c54b6
--- /dev/null
+++ b/SJDialog/src/main/res/layout/message_dialog.xml
@@ -0,0 +1,72 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SJDialog/src/main/res/values-night/colors.xml b/SJDialog/src/main/res/values-night/colors.xml
new file mode 100644
index 0000000..237cd36
--- /dev/null
+++ b/SJDialog/src/main/res/values-night/colors.xml
@@ -0,0 +1,48 @@
+
+ #B2C5FF
+ #002A79
+ #003EA9
+ #DAE2FF
+ #C1C6DD
+ #2A3042
+ #414659
+ #DCE1F9
+ #C0C1FF
+ #1200AA
+ #2510E1
+ #E1E0FF
+ #FFB4A9
+ #930006
+ #680003
+ #FFDAD4
+ #1B1B1F
+ #E3E1E6
+ #1B1B1F
+ #E3E1E6
+ #44464E
+ #C6C6D0
+ #8F909A
+ #1B1B1F
+ #E3E1E6
+ #0053DC
+ #000000
+ #0053DC
+
+ #0060F4
+ #BA1B1B
+ #625FCD
+
+
+ #9C4146
+ #FFFFFF
+ #FFDADB
+ #400008
+
+ #333333
+ #4a4a4a
+ #0060f4
+ #BA1B1B
+
+ #E5E5E5
+ #FFDAD4
+
\ No newline at end of file
diff --git a/SJDialog/src/main/res/values-night/themes.xml b/SJDialog/src/main/res/values-night/themes.xml
new file mode 100644
index 0000000..d1f9bf2
--- /dev/null
+++ b/SJDialog/src/main/res/values-night/themes.xml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SJDialog/src/main/res/values/colors.xml b/SJDialog/src/main/res/values/colors.xml
new file mode 100644
index 0000000..fcb31d8
--- /dev/null
+++ b/SJDialog/src/main/res/values/colors.xml
@@ -0,0 +1,49 @@
+
+ #0053DC
+ #FFFFFF
+ #DAE2FF
+ #00174D
+ #585E71
+ #FFFFFF
+ #DCE1F9
+ #151B2C
+ #433EF7
+ #FFFFFF
+ #E1E0FF
+ #07006D
+ #BA1B1B
+ #FFDAD4
+ #FFFFFF
+ #410001
+ #FEFBFF
+ #1B1B1F
+ #FEFBFF
+ #1B1B1F
+ #E2E2EC
+ #44464E
+ #75767F
+ #F2F0F5
+ #303033
+ #B2C5FF
+ #000000
+ #B2C5FF
+
+ #0060F4
+ #BA1B1B
+ #625FCD
+
+
+ #9C4146
+ #FFFFFF
+ #FFDADB
+ #400008
+
+ #E5E5E5
+ #D5D5D5
+ #0060f4
+ #BA1B1B
+ #930006
+
+ #333333
+ #410001
+
\ No newline at end of file
diff --git a/SJDialog/src/main/res/values/styles.xml b/SJDialog/src/main/res/values/styles.xml
new file mode 100644
index 0000000..2ae15e6
--- /dev/null
+++ b/SJDialog/src/main/res/values/styles.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SJDialog/src/main/res/values/themes.xml b/SJDialog/src/main/res/values/themes.xml
new file mode 100644
index 0000000..c163b3a
--- /dev/null
+++ b/SJDialog/src/main/res/values/themes.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/SJDialog/src/test/java/com/sjapps/library/ExampleUnitTest.java b/SJDialog/src/test/java/com/sjapps/library/ExampleUnitTest.java
new file mode 100644
index 0000000..4c438e1
--- /dev/null
+++ b/SJDialog/src/test/java/com/sjapps/library/ExampleUnitTest.java
@@ -0,0 +1,17 @@
+package com.sjapps.library;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * Example local unit test, which will execute on the development machine (host).
+ *
+ * @see Testing documentation
+ */
+public class ExampleUnitTest {
+ @Test
+ public void addition_isCorrect() {
+ assertEquals(4, 2 + 2);
+ }
+}
\ No newline at end of file
diff --git a/aestheticdialogs/.gitignore b/aestheticdialogs/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/aestheticdialogs/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/aestheticdialogs/build.gradle b/aestheticdialogs/build.gradle
new file mode 100644
index 0000000..703a2bc
--- /dev/null
+++ b/aestheticdialogs/build.gradle
@@ -0,0 +1,46 @@
+apply plugin: 'com.android.library'
+apply plugin: 'kotlin-android'
+apply plugin: 'kotlin-android-extensions'
+apply plugin: 'kotlin-kapt'
+
+android {
+ compileSdkVersion 29
+ buildToolsVersion "29.0.3"
+
+
+ defaultConfig {
+ minSdkVersion 14
+ targetSdkVersion 29
+ versionCode 1
+ versionName "1.3.6"
+
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+ consumerProguardFiles 'consumer-rules.pro'
+ vectorDrawables.useSupportLibrary = true
+ multiDexEnabled true
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility = '1.8'
+ targetCompatibility = '1.8'
+ }
+}
+
+dependencies {
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
+
+ implementation 'androidx.appcompat:appcompat:1.2.0'
+ implementation 'androidx.cardview:cardview:1.0.0'
+ testImplementation 'junit:junit:4.13'
+ androidTestImplementation 'androidx.test.ext:junit:1.1.2'
+ androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
+ implementation "androidx.core:core-ktx:1.3.2"
+ implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
+}
diff --git a/aestheticdialogs/consumer-rules.pro b/aestheticdialogs/consumer-rules.pro
new file mode 100644
index 0000000..e69de29
diff --git a/aestheticdialogs/proguard-rules.pro b/aestheticdialogs/proguard-rules.pro
new file mode 100644
index 0000000..f1b4245
--- /dev/null
+++ b/aestheticdialogs/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
diff --git a/aestheticdialogs/src/androidTest/java/com/thecode/aestheticdialogs/ExampleInstrumentedTest.kt b/aestheticdialogs/src/androidTest/java/com/thecode/aestheticdialogs/ExampleInstrumentedTest.kt
new file mode 100644
index 0000000..920bc05
--- /dev/null
+++ b/aestheticdialogs/src/androidTest/java/com/thecode/aestheticdialogs/ExampleInstrumentedTest.kt
@@ -0,0 +1,24 @@
+package com.thecode.aestheticdialogs
+
+import androidx.test.platform.app.InstrumentationRegistry
+import androidx.test.ext.junit.runners.AndroidJUnit4
+
+import org.junit.Test
+import org.junit.runner.RunWith
+
+import org.junit.Assert.*
+
+/**
+ * Instrumented test, which will execute on an Android device.
+ *
+ * See [testing documentation](http://d.android.com/tools/testing).
+ */
+@RunWith(AndroidJUnit4::class)
+class ExampleInstrumentedTest {
+ @Test
+ fun useAppContext() {
+ // Context of the app under test.
+ val appContext = InstrumentationRegistry.getInstrumentation().targetContext
+ assertEquals("com.thecode.aestheticdialogs", appContext.packageName)
+ }
+}
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/AndroidManifest.xml b/aestheticdialogs/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..78aa1c3
--- /dev/null
+++ b/aestheticdialogs/src/main/AndroidManifest.xml
@@ -0,0 +1,2 @@
+
diff --git a/aestheticdialogs/src/main/java/com/thecode/aestheticdialogs/AestheticDialog.kt b/aestheticdialogs/src/main/java/com/thecode/aestheticdialogs/AestheticDialog.kt
new file mode 100644
index 0000000..755de0e
--- /dev/null
+++ b/aestheticdialogs/src/main/java/com/thecode/aestheticdialogs/AestheticDialog.kt
@@ -0,0 +1,620 @@
+package com.thecode.aestheticdialogs
+
+import android.app.Activity
+import android.graphics.Color
+import android.graphics.drawable.ColorDrawable
+import android.os.Handler
+import android.view.Gravity
+import android.view.View
+import android.view.WindowManager
+import androidx.annotation.Keep
+import androidx.annotation.NonNull
+import androidx.appcompat.app.AlertDialog
+import androidx.appcompat.widget.AppCompatButton
+import androidx.appcompat.widget.AppCompatImageView
+import androidx.appcompat.widget.AppCompatTextView
+import androidx.appcompat.widget.LinearLayoutCompat
+import androidx.core.content.ContextCompat
+import kotlinx.android.synthetic.main.dialog_connectify_error.view.*
+import kotlinx.android.synthetic.main.dialog_connectify_success.view.*
+import kotlinx.android.synthetic.main.dialog_emoji.view.*
+import kotlinx.android.synthetic.main.dialog_emotion.view.*
+import kotlinx.android.synthetic.main.dialog_flash.view.*
+import kotlinx.android.synthetic.main.dialog_flat.view.*
+import kotlinx.android.synthetic.main.dialog_rainbow.view.*
+import kotlinx.android.synthetic.main.dialog_toaster.view.*
+import java.text.SimpleDateFormat
+import java.util.*
+
+
+/**
+ * Aesthetic Dialog class
+ * Use Builder to create a new instance.
+ *
+ * @author Gabriel The Code
+ */
+
+@Keep
+class AestheticDialog {
+
+ class Builder(
+ //Necessary parameters
+ @NonNull private val activity: Activity,
+ @NonNull private val dialogStyle: DialogStyle,
+ @NonNull private val dialogType: DialogType) {
+
+ lateinit var alertDialog: AlertDialog
+ private val dialogBuilder: AlertDialog.Builder = AlertDialog.Builder(activity)
+
+ private var title: String = "Title"
+ private var message: String = "Message"
+ // Optional features
+ private var isDarkMode: Boolean = false
+ private var isCancelable: Boolean = true
+ private var duration: Int = 0
+ private var gravity: Int = Gravity.NO_GRAVITY
+ private var animation: DialogAnimation = DialogAnimation.DEFAULT
+ private lateinit var layoutView: View
+ private var onClickListener: OnDialogClickListener = object : OnDialogClickListener {
+ override fun onClick(dialog: Builder) {
+ dialog.dismiss()
+ }
+ }
+
+
+ /**
+ * Set dialog title text
+ *
+ * @param title
+ * @return this, for chaining.
+ */
+ @NonNull
+ fun setTitle(@NonNull title: String): Builder {
+ this.title = title
+ return this
+ }
+
+ /**
+ * Set dialog message text
+ *
+ * @param message
+ * @return this, for chaining.
+ */
+ @NonNull
+ fun setMessage(@NonNull message: String): Builder {
+ this.message = message
+ return this
+ }
+
+ /**
+ * Set dialog mode. Defined by default to false
+ *
+ * @param isDarkMode
+ * @return this, for chaining.
+ */
+ @NonNull
+ fun setDarkMode(@NonNull isDarkMode: Boolean): Builder {
+ this.isDarkMode = isDarkMode
+ return this
+ }
+
+ /**
+ * Set an OnClickListener to the dialog
+ *
+ * @param onDialogClickListener interface for callback event on click of button.
+ * @return this, for chaining.
+ */
+ @NonNull
+ fun setOnClickListener(onDialogClickListener: OnDialogClickListener): Builder {
+ this.onClickListener = onDialogClickListener
+ return this
+ }
+
+ /**
+ * Define if the dialog is cancelable
+ *
+ * @param isCancelable
+ * @return this, for chaining.
+ */
+ @NonNull
+ fun setCancelable(isCancelable: Boolean): Builder {
+ this.isCancelable = isCancelable
+ return this
+ }
+
+ /**
+ * Define the display duration of the dialog
+ *
+ * @param duration in milliseconds
+ * @return this, for chaining.
+ */
+ @NonNull
+ fun setDuration(duration: Int): Builder {
+ if (duration != 0) {
+ this.duration = duration
+ Handler().postDelayed({
+ this.dismiss()
+ }, duration.toLong())
+ }
+ return this
+ }
+
+ /**
+ * Set the gravity of the dialog
+ *
+ * @param gravity in milliseconds
+ * @return this, for chaining.
+ */
+ @NonNull
+ fun setGravity(gravity: Int): Builder {
+ this.gravity = gravity
+ return this
+ }
+
+ /**
+ * Set the animation of the dialog
+ *
+ * @param animation in milliseconds
+ * @return this, for chaining.
+ */
+ @NonNull
+ fun setAnimation(animation: DialogAnimation): Builder {
+ this.animation = animation
+ return this
+ }
+
+ /**
+ * Dismiss the dialog
+ *
+ * @return Aesthetic Dialog instance.
+ */
+ @NonNull
+ fun dismiss(): AestheticDialog {
+ if (alertDialog.isShowing) {
+ alertDialog.dismiss()
+ }
+ return AestheticDialog()
+ }
+
+
+ /**
+ * Choose the dialog animation according to the parameter
+ *
+ */
+ @NonNull
+ private fun chooseAnimation() {
+ when (animation) {
+ DialogAnimation.ZOOM -> {
+ alertDialog.window?.attributes?.windowAnimations = R.style.DialogAnimationZoom
+ }
+ DialogAnimation.FADE -> {
+ alertDialog.window?.attributes?.windowAnimations = R.style.DialogAnimationFade
+ }
+ DialogAnimation.CARD -> {
+ alertDialog.window?.attributes?.windowAnimations = R.style.DialogAnimationCard
+ }
+ DialogAnimation.SHRINK -> {
+ alertDialog.window?.attributes?.windowAnimations = R.style.DialogAnimationShrink
+ }
+ DialogAnimation.SWIPE_LEFT -> {
+ alertDialog.window?.attributes?.windowAnimations = R.style.DialogAnimationSwipeLeft
+ }
+ DialogAnimation.SWIPE_RIGHT -> {
+ alertDialog.window?.attributes?.windowAnimations = R.style.DialogAnimationSwipeRight
+ }
+ DialogAnimation.IN_OUT -> {
+ alertDialog.window?.attributes?.windowAnimations = R.style.DialogAnimationInOut
+ }
+ DialogAnimation.SPIN -> {
+ alertDialog.window?.attributes?.windowAnimations = R.style.DialogAnimationSpin
+ }
+ DialogAnimation.SPLIT -> {
+ alertDialog.window?.attributes?.windowAnimations = R.style.DialogAnimationSplit
+ }
+ DialogAnimation.DIAGONAL -> {
+ alertDialog.window?.attributes?.windowAnimations = R.style.DialogAnimationDiagonal
+ }
+ DialogAnimation.WINDMILL -> {
+ alertDialog.window?.attributes?.windowAnimations = R.style.DialogAnimationWindMill
+ }
+ DialogAnimation.SLIDE_UP -> {
+ alertDialog.window?.attributes?.windowAnimations = R.style.DialogAnimationSlideUp
+ }
+ DialogAnimation.SLIDE_DOWN -> {
+ alertDialog.window?.attributes?.windowAnimations = R.style.DialogAnimationSlideDown
+ }
+ DialogAnimation.SLIDE_LEFT -> {
+ alertDialog.window?.attributes?.windowAnimations = R.style.DialogAnimationSlideLeft
+ }
+ DialogAnimation.SLIDE_RIGHT -> {
+ alertDialog.window?.attributes?.windowAnimations = R.style.DialogAnimationSlideRight
+ }
+ DialogAnimation.DEFAULT ->{
+ alertDialog.window?.attributes?.windowAnimations = R.style.DialogAnimation
+ }
+ }
+ }
+
+
+ /**
+ * Displays the dialog according to the parameters of the Builder
+ *
+ * @return Aesthetic Dialog instance.
+ */
+ @NonNull
+ fun show(): AestheticDialog {
+
+ when (dialogStyle) {
+ DialogStyle.EMOJI -> {
+ layoutView = activity.layoutInflater.inflate(R.layout.dialog_emoji, null)
+ val layoutDialog = layoutView.dialog_layout_emoji
+ val imgClose: AppCompatImageView = layoutView.image_close_emoji
+ val icon: AppCompatImageView = layoutView.dialog_icon_emoji
+ val textTitle: AppCompatTextView = layoutView.text_title_emoji
+ val textMessage: AppCompatTextView = layoutView.text_message_emoji
+ textMessage.text = message
+ textTitle.text = title
+
+ if (dialogType == DialogType.SUCCESS) {
+ textTitle.setTextColor(ContextCompat.getColor(activity, R.color.dialog_success))
+ icon.setImageResource(R.drawable.thumbs_up_sign)
+ } else {
+ textTitle.setTextColor(ContextCompat.getColor(activity, R.color.dialog_error))
+ icon.setImageResource(R.drawable.man_shrugging)
+ }
+
+ if (isDarkMode) {
+ textMessage.setTextColor(ContextCompat.getColor(activity, R.color.md_white_1000))
+ layoutDialog.setBackgroundColor(ContextCompat.getColor(activity, R.color.dark_background))
+ }
+ dialogBuilder.setView(layoutView)
+ alertDialog = dialogBuilder.create()
+ alertDialog.window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
+ alertDialog.window?.setGravity(Gravity.TOP)
+ this.chooseAnimation()
+ alertDialog.show()
+ val height = activity.resources.getDimensionPixelSize(R.dimen.popup_height_emoji_dialog)
+ alertDialog.window?.setLayout(WindowManager.LayoutParams.WRAP_CONTENT, height)
+
+ imgClose.setOnClickListener { onClickListener.onClick(this) }
+
+ }
+
+
+ DialogStyle.DRAKE -> {
+ layoutView = if (dialogType == DialogType.SUCCESS) {
+ activity.layoutInflater.inflate(R.layout.dialog_drake_success, null)
+ } else {
+ activity.layoutInflater.inflate(R.layout.dialog_drake_error, null)
+ }
+ dialogBuilder.setView(layoutView)
+ alertDialog = dialogBuilder.create()
+ alertDialog.window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
+ alertDialog.window?.setGravity(Gravity.CENTER)
+ this.chooseAnimation()
+ alertDialog.show()
+ val height = activity.resources.getDimensionPixelSize(R.dimen.popup_height_drake)
+ alertDialog.window?.setLayout(WindowManager.LayoutParams.WRAP_CONTENT, height)
+ }
+
+ DialogStyle.TOASTER -> {
+ if (isDarkMode) {
+ layoutView = activity.layoutInflater.inflate(R.layout.dialog_toaster, null)
+ val layoutDialog = layoutView.dialog_layout_toaster
+ layoutDialog.setBackgroundColor(ContextCompat.getColor(activity, R.color.dark_background))
+ val imgClose: AppCompatImageView = layoutView.image_close_toaster
+ val icon: AppCompatImageView = layoutView.dialog_icon_toaster
+ val textTitle: AppCompatTextView = layoutView.text_title_toaster
+ val textMessage: AppCompatTextView = layoutView.text_message_toaster
+ textMessage.setTextColor(ContextCompat.getColor(activity, R.color.md_white_1000))
+ val verticalView = layoutView.vertical_view_toaster
+ textMessage.text = message
+ textTitle.text = title
+ when (dialogType) {
+ DialogType.ERROR -> {
+ textTitle.setTextColor(ContextCompat.getColor(activity, R.color.dialog_error))
+ verticalView.setBackgroundColor(ContextCompat.getColor(activity, R.color.dialog_error))
+ icon.setImageResource(R.drawable.ic_error_red_24dp)
+ }
+ DialogType.SUCCESS -> {
+ textTitle.setTextColor(ContextCompat.getColor(activity, R.color.dialog_success))
+ verticalView.setBackgroundColor(ContextCompat.getColor(activity, R.color.dialog_success))
+ icon.setImageResource(R.drawable.ic_check_circle_green_24dp)
+ }
+ DialogType.WARNING -> {
+ textTitle.setTextColor(ContextCompat.getColor(activity, R.color.dialog_warning))
+ verticalView.setBackgroundColor(ContextCompat.getColor(activity, R.color.dialog_warning))
+ icon.setImageResource(R.drawable.ic_warning_orange_24dp)
+ }
+ DialogType.INFO -> {
+ textTitle.setTextColor(ContextCompat.getColor(activity, R.color.dialog_info))
+ verticalView.setBackgroundColor(ContextCompat.getColor(activity, R.color.dialog_info))
+ icon.setImageResource(R.drawable.ic_info_blue_24dp)
+ }
+ }
+ dialogBuilder.setView(layoutView)
+ alertDialog = dialogBuilder.create()
+ alertDialog.window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
+ alertDialog.window?.setGravity(Gravity.TOP)
+ this.chooseAnimation()
+ alertDialog.show()
+ val height = activity.resources.getDimensionPixelSize(R.dimen.popup_height_toaster)
+ alertDialog.window?.setLayout(WindowManager.LayoutParams.WRAP_CONTENT, height)
+ imgClose.setOnClickListener { onClickListener.onClick(this) }
+
+ } else {
+
+ val dialogBuilder: AlertDialog.Builder = AlertDialog.Builder(activity)
+ layoutView = activity.layoutInflater.inflate(R.layout.dialog_toaster, null)
+ val imgClose: AppCompatImageView = layoutView.image_close_toaster
+ val icon: AppCompatImageView = layoutView.dialog_icon_toaster
+ val textTitle: AppCompatTextView = layoutView.text_title_toaster
+ val textMessage: AppCompatTextView = layoutView.text_message_toaster
+ val verticalView = layoutView.vertical_view_toaster
+ textMessage.text = message
+ textTitle.text = title
+ when (dialogType) {
+ DialogType.ERROR -> {
+ verticalView.setBackgroundColor(ContextCompat.getColor(activity, R.color.dialog_error))
+ icon.setImageResource(R.drawable.ic_error_red_24dp)
+ }
+ DialogType.SUCCESS -> {
+ verticalView.setBackgroundColor(ContextCompat.getColor(activity, R.color.dialog_success))
+ icon.setImageResource(R.drawable.ic_check_circle_green_24dp)
+ }
+ DialogType.WARNING -> {
+ verticalView.setBackgroundColor(ContextCompat.getColor(activity, R.color.dialog_warning))
+ icon.setImageResource(R.drawable.ic_warning_orange_24dp)
+ }
+ DialogType.INFO -> {
+ verticalView.setBackgroundColor(ContextCompat.getColor(activity, R.color.dialog_info))
+ icon.setImageResource(R.drawable.ic_info_blue_24dp)
+ }
+ }
+ dialogBuilder.setView(layoutView)
+ alertDialog = dialogBuilder.create()
+ alertDialog.window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
+ alertDialog.window?.setGravity(Gravity.TOP)
+ this.chooseAnimation()
+ alertDialog.show()
+ val height = activity.resources.getDimensionPixelSize(R.dimen.popup_height_toaster)
+ alertDialog.window?.setLayout(WindowManager.LayoutParams.WRAP_CONTENT, height)
+ imgClose.setOnClickListener { onClickListener.onClick(this) }
+ }
+
+ }
+
+ DialogStyle.RAINBOW -> {
+ layoutView = activity.layoutInflater.inflate(R.layout.dialog_rainbow, null)
+ val icon: AppCompatImageView = layoutView.dialog_icon_rainbow
+ val layoutDialog = layoutView.dialog_layout_rainbow
+ when (dialogType) {
+ DialogType.ERROR -> {
+ layoutDialog.setBackgroundColor(ContextCompat.getColor(activity, R.color.dialog_error))
+ icon.setImageResource(R.drawable.ic_error_red_24dp)
+ }
+ DialogType.SUCCESS -> {
+ layoutDialog.setBackgroundColor(ContextCompat.getColor(activity, R.color.dialog_success))
+ icon.setImageResource(R.drawable.ic_check_circle_green_24dp)
+ }
+ DialogType.WARNING -> {
+ layoutDialog.setBackgroundColor(ContextCompat.getColor(activity, R.color.dialog_warning))
+ icon.setImageResource(R.drawable.ic_warning_orange_24dp)
+ }
+ DialogType.INFO -> {
+ layoutDialog.setBackgroundColor(ContextCompat.getColor(activity, R.color.dialog_info))
+ icon.setImageResource(R.drawable.ic_info_blue_24dp)
+ }
+ }
+ val imgClose: AppCompatImageView = layoutView.image_close_rainbow
+ val textTitle: AppCompatTextView = layoutView.text_title_rainbow
+ val textMessage: AppCompatTextView = layoutView.text_message_rainbow
+ textMessage.text = message
+ textTitle.text = title
+ dialogBuilder.setView(layoutView)
+ alertDialog = dialogBuilder.create()
+ alertDialog.window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
+ alertDialog.window?.setGravity(Gravity.TOP)
+ this.chooseAnimation()
+ alertDialog.show()
+ val height = activity.resources.getDimensionPixelSize(R.dimen.popup_height_emoji_dialog)
+ alertDialog.window?.setLayout(WindowManager.LayoutParams.WRAP_CONTENT, height)
+ imgClose.setOnClickListener { onClickListener.onClick(this) }
+ }
+
+ DialogStyle.CONNECTIFY -> {
+ val imgClose: AppCompatImageView
+ val textTitle: AppCompatTextView
+ val textMessage: AppCompatTextView
+ val layoutDialog: LinearLayoutCompat
+ if (dialogType == DialogType.SUCCESS) {
+ layoutView = activity.layoutInflater.inflate(R.layout.dialog_connectify_success, null)
+ layoutDialog = layoutView.dialog_layout_connectify_success
+ imgClose = layoutView.image_close_connectify_success
+ textTitle = layoutView.text_title_connectify_success
+ textMessage = layoutView.text_message_connectify_success
+ } else {
+ layoutView = activity.layoutInflater.inflate(R.layout.dialog_connectify_error, null)
+ layoutDialog = layoutView.dialog_layout_connectify_error
+ imgClose = layoutView.image_close_connectify_error
+ textTitle = layoutView.text_title_connectify_error
+ textMessage = layoutView.text_message_connectify_error
+ }
+
+ textTitle.text = title
+ textMessage.text = message
+
+ if (isDarkMode) {
+ layoutDialog.setBackgroundColor(ContextCompat.getColor(activity, R.color.dark_background))
+ textMessage.setTextColor(ContextCompat.getColor(activity, R.color.md_white_1000))
+ }
+ dialogBuilder.setView(layoutView)
+ alertDialog = dialogBuilder.create()
+ alertDialog.window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
+ alertDialog.window?.setGravity(Gravity.TOP)
+ this.chooseAnimation()
+ alertDialog.show()
+ alertDialog.window?.setLayout(WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT)
+ imgClose.setOnClickListener { onClickListener.onClick(this) }
+ }
+
+
+ DialogStyle.FLASH -> {
+ layoutView = activity.layoutInflater.inflate(R.layout.dialog_flash, null)
+ val btnOk: AppCompatButton = layoutView.btn_action_flash
+ val textTitle: AppCompatTextView = layoutView.dialog_title_flash
+ val textMessage: AppCompatTextView = layoutView.dialog_message_flash
+ val dialogFrame = layoutView.dialog_frame_flash
+ val icon: AppCompatImageView = layoutView.img_icon_flash
+ if (dialogType == DialogType.SUCCESS) {
+ dialogFrame.setBackgroundResource(R.drawable.rounded_green_gradient_bg)
+ icon.setImageResource(R.drawable.circle_validation_success)
+ } else {
+ dialogFrame.setBackgroundResource(R.drawable.rounded_red_gradient_bg)
+ icon.setImageResource(R.drawable.circle_validation_error)
+ }
+ textMessage.text = message
+ textTitle.text = title
+ dialogBuilder.setView(layoutView)
+ alertDialog = dialogBuilder.create()
+ alertDialog.window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
+ alertDialog.window?.setGravity(Gravity.CENTER)
+ this.chooseAnimation()
+ alertDialog.show()
+ val height = activity.resources.getDimensionPixelSize(R.dimen.popup_height)
+ val width = activity.resources.getDimensionPixelSize(R.dimen.popup_height)
+ alertDialog.window?.setLayout(width, height)
+ btnOk.setOnClickListener { onClickListener.onClick(this) }
+ }
+
+ DialogStyle.EMOTION -> {
+ layoutView = activity.layoutInflater.inflate(R.layout.dialog_emotion, null)
+ val icon: AppCompatImageView = layoutView.img_icon_emotion
+ val layoutDialog = layoutView.dialog_layout_emotion
+ val textTitle: AppCompatTextView = layoutView.dialog_title_emotion
+ val textMessage: AppCompatTextView = layoutView.dialog_message_emotion
+ val textHour: AppCompatTextView = layoutView.dialog_hour_emotion
+ if (dialogType == DialogType.SUCCESS) {
+ icon.setImageResource(R.drawable.smiley_success)
+ layoutDialog.setBackgroundResource(R.drawable.background_emotion_success)
+ } else {
+ icon.setImageResource(R.drawable.smiley_error)
+ layoutDialog.setBackgroundResource(R.drawable.background_emotion_error)
+ }
+ val sdf = SimpleDateFormat("HH:mm")
+ val hour = sdf.format(Calendar.getInstance().time)
+ textMessage.text = message
+ textTitle.text = title
+ textHour.text = hour
+ dialogBuilder.setView(layoutView)
+ alertDialog = dialogBuilder.create()
+ alertDialog.window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
+ alertDialog.window?.setGravity(Gravity.CENTER)
+ this.chooseAnimation()
+ alertDialog.show()
+ val height = activity.resources.getDimensionPixelSize(R.dimen.popup_height_emotion)
+ alertDialog.window?.setLayout(WindowManager.LayoutParams.WRAP_CONTENT, height)
+ }
+
+ DialogStyle.FLAT -> {
+ if (isDarkMode) {
+ layoutView = activity.layoutInflater.inflate(R.layout.dialog_flat, null)
+ val btnOk: AppCompatButton = layoutView.btn_action_flat
+ val textTitle: AppCompatTextView = layoutView.dialog_title_flat
+ val textMessage: AppCompatTextView = layoutView.dialog_message_flat
+ val icon: AppCompatImageView = layoutView.dialog_icon_flat
+ val layoutDialog: LinearLayoutCompat = layoutView.dialog_layout_flat
+ val frameLayout = layoutView.dialog_frame_flat
+ when (dialogType) {
+ DialogType.ERROR -> {
+ icon.setImageResource(R.drawable.ic_error_red_24dp)
+ btnOk.setBackgroundResource(R.drawable.btn_red_selector)
+ frameLayout.setBackgroundResource(R.drawable.rounded_rect_red)
+ }
+ DialogType.SUCCESS -> {
+ icon.setImageResource(R.drawable.ic_check_circle_green_24dp)
+ btnOk.setBackgroundResource(R.drawable.btn_green_selector)
+ frameLayout.setBackgroundResource(R.drawable.rounded_rect_green)
+ }
+ DialogType.WARNING -> {
+ icon.setImageResource(R.drawable.ic_warning_orange_24dp)
+ btnOk.setBackgroundResource(R.drawable.btn_yellow_selector)
+ frameLayout.setBackgroundResource(R.drawable.rounded_rect_yellow)
+ }
+ DialogType.INFO -> {
+ icon.setImageResource(R.drawable.ic_info_blue_24dp)
+ btnOk.setBackgroundResource(R.drawable.btn_blue_selector)
+ frameLayout.setBackgroundResource(R.drawable.rounded_rect_blue)
+ }
+ }
+ layoutDialog.setBackgroundResource(R.drawable.rounded_dark_bg)
+ textTitle.setTextColor(ContextCompat.getColor(activity, R.color.md_white_1000))
+ textMessage.setTextColor(ContextCompat.getColor(activity, R.color.md_white_1000))
+ textMessage.text = message
+ textTitle.text = title
+ dialogBuilder.setView(layoutView)
+ alertDialog = dialogBuilder.create()
+ alertDialog.window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
+ alertDialog.window?.setGravity(Gravity.CENTER)
+ this.chooseAnimation()
+ alertDialog.show()
+ val height = activity.resources.getDimensionPixelSize(R.dimen.popup_height)
+ val width = activity.resources.getDimensionPixelSize(R.dimen.popup_height)
+ alertDialog.window?.setLayout(width, height)
+ btnOk.setOnClickListener { onClickListener.onClick(this) }
+
+ } else {
+ layoutView = activity.layoutInflater.inflate(R.layout.dialog_flat, null)
+ val btnOk: AppCompatButton = layoutView.btn_action_flat
+ val textTitle: AppCompatTextView = layoutView.dialog_title_flat
+ val textMessage: AppCompatTextView = layoutView.dialog_message_flat
+ val icon: AppCompatImageView = layoutView.dialog_icon_flat
+ val layoutDialog: LinearLayoutCompat = layoutView.dialog_layout_flat
+ val frameLayout = layoutView.dialog_frame_flat
+ when (dialogType) {
+ DialogType.ERROR -> {
+ icon.setImageResource(R.drawable.ic_error_red_24dp)
+ btnOk.setBackgroundResource(R.drawable.btn_red_selector)
+ frameLayout.setBackgroundResource(R.drawable.rounded_rect_red)
+ }
+ DialogType.SUCCESS -> {
+ icon.setImageResource(R.drawable.ic_check_circle_green_24dp)
+ btnOk.setBackgroundResource(R.drawable.btn_green_selector)
+ frameLayout.setBackgroundResource(R.drawable.rounded_rect_green)
+ }
+ DialogType.WARNING -> {
+ icon.setImageResource(R.drawable.ic_warning_orange_24dp)
+ btnOk.setBackgroundResource(R.drawable.btn_yellow_selector)
+ frameLayout.setBackgroundResource(R.drawable.rounded_rect_yellow)
+ }
+ DialogType.INFO -> {
+ icon.setImageResource(R.drawable.ic_info_blue_24dp)
+ btnOk.setBackgroundResource(R.drawable.btn_blue_selector)
+ frameLayout.setBackgroundResource(R.drawable.rounded_rect_blue)
+ }
+ }
+ layoutDialog.setBackgroundResource(R.drawable.rounded_white_bg)
+ textMessage.text = message
+ textTitle.text = title
+ dialogBuilder.setView(layoutView)
+ alertDialog = dialogBuilder.create()
+ alertDialog.window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
+ alertDialog.window?.setGravity(Gravity.CENTER)
+ this.chooseAnimation()
+ alertDialog.show()
+ val height = activity.resources.getDimensionPixelSize(R.dimen.popup_height)
+ val width = activity.resources.getDimensionPixelSize(R.dimen.popup_height)
+ alertDialog.window?.setLayout(width, height)
+ btnOk.setOnClickListener { onClickListener.onClick(this) }
+ }
+ }
+ }
+
+ alertDialog.setCancelable(isCancelable)
+ if (gravity != Gravity.NO_GRAVITY) {
+ alertDialog.window?.setGravity(gravity)
+ }
+ return AestheticDialog()
+ }
+ }
+}
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/java/com/thecode/aestheticdialogs/DialogAnimation.kt b/aestheticdialogs/src/main/java/com/thecode/aestheticdialogs/DialogAnimation.kt
new file mode 100644
index 0000000..2e68057
--- /dev/null
+++ b/aestheticdialogs/src/main/java/com/thecode/aestheticdialogs/DialogAnimation.kt
@@ -0,0 +1,6 @@
+package com.thecode.aestheticdialogs
+
+
+enum class DialogAnimation {
+ DEFAULT, SLIDE_UP, SLIDE_DOWN, SLIDE_LEFT, SLIDE_RIGHT, SWIPE_LEFT, SWIPE_RIGHT, IN_OUT, CARD, SHRINK, SPLIT , DIAGONAL , SPIN , WINDMILL , FADE , ZOOM
+}
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/java/com/thecode/aestheticdialogs/DialogStyle.kt b/aestheticdialogs/src/main/java/com/thecode/aestheticdialogs/DialogStyle.kt
new file mode 100644
index 0000000..66905e3
--- /dev/null
+++ b/aestheticdialogs/src/main/java/com/thecode/aestheticdialogs/DialogStyle.kt
@@ -0,0 +1,6 @@
+package com.thecode.aestheticdialogs
+
+
+enum class DialogStyle {
+ EMOJI, DRAKE, TOASTER, CONNECTIFY, FLAT, RAINBOW, FLASH, EMOTION
+}
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/java/com/thecode/aestheticdialogs/DialogType.kt b/aestheticdialogs/src/main/java/com/thecode/aestheticdialogs/DialogType.kt
new file mode 100644
index 0000000..0964010
--- /dev/null
+++ b/aestheticdialogs/src/main/java/com/thecode/aestheticdialogs/DialogType.kt
@@ -0,0 +1,6 @@
+package com.thecode.aestheticdialogs
+
+
+enum class DialogType {
+ SUCCESS, ERROR, WARNING, INFO
+}
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/java/com/thecode/aestheticdialogs/OnDialogClickListener.kt b/aestheticdialogs/src/main/java/com/thecode/aestheticdialogs/OnDialogClickListener.kt
new file mode 100644
index 0000000..36f1ba4
--- /dev/null
+++ b/aestheticdialogs/src/main/java/com/thecode/aestheticdialogs/OnDialogClickListener.kt
@@ -0,0 +1,6 @@
+package com.thecode.aestheticdialogs
+
+
+interface OnDialogClickListener {
+ fun onClick(dialog: AestheticDialog.Builder)
+}
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/anim/animate_card_enter.xml b/aestheticdialogs/src/main/res/anim/animate_card_enter.xml
new file mode 100644
index 0000000..08d116f
--- /dev/null
+++ b/aestheticdialogs/src/main/res/anim/animate_card_enter.xml
@@ -0,0 +1,6 @@
+
+
diff --git a/aestheticdialogs/src/main/res/anim/animate_card_exit.xml b/aestheticdialogs/src/main/res/anim/animate_card_exit.xml
new file mode 100644
index 0000000..3f15a8f
--- /dev/null
+++ b/aestheticdialogs/src/main/res/anim/animate_card_exit.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
diff --git a/aestheticdialogs/src/main/res/anim/animate_diagonal_right_enter.xml b/aestheticdialogs/src/main/res/anim/animate_diagonal_right_enter.xml
new file mode 100644
index 0000000..9a761d4
--- /dev/null
+++ b/aestheticdialogs/src/main/res/anim/animate_diagonal_right_enter.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/anim/animate_diagonal_right_exit.xml b/aestheticdialogs/src/main/res/anim/animate_diagonal_right_exit.xml
new file mode 100644
index 0000000..31f44c8
--- /dev/null
+++ b/aestheticdialogs/src/main/res/anim/animate_diagonal_right_exit.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/anim/animate_fade_enter.xml b/aestheticdialogs/src/main/res/anim/animate_fade_enter.xml
new file mode 100644
index 0000000..cb7bd98
--- /dev/null
+++ b/aestheticdialogs/src/main/res/anim/animate_fade_enter.xml
@@ -0,0 +1,5 @@
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/anim/animate_fade_exit.xml b/aestheticdialogs/src/main/res/anim/animate_fade_exit.xml
new file mode 100644
index 0000000..eb1eb8d
--- /dev/null
+++ b/aestheticdialogs/src/main/res/anim/animate_fade_exit.xml
@@ -0,0 +1,6 @@
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/anim/animate_in_out_enter.xml b/aestheticdialogs/src/main/res/anim/animate_in_out_enter.xml
new file mode 100644
index 0000000..7cf051f
--- /dev/null
+++ b/aestheticdialogs/src/main/res/anim/animate_in_out_enter.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/anim/animate_in_out_exit.xml b/aestheticdialogs/src/main/res/anim/animate_in_out_exit.xml
new file mode 100644
index 0000000..71b0d81
--- /dev/null
+++ b/aestheticdialogs/src/main/res/anim/animate_in_out_exit.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/anim/animate_shrink_enter.xml b/aestheticdialogs/src/main/res/anim/animate_shrink_enter.xml
new file mode 100644
index 0000000..001bb5e
--- /dev/null
+++ b/aestheticdialogs/src/main/res/anim/animate_shrink_enter.xml
@@ -0,0 +1,9 @@
+
+
diff --git a/aestheticdialogs/src/main/res/anim/animate_shrink_exit.xml b/aestheticdialogs/src/main/res/anim/animate_shrink_exit.xml
new file mode 100644
index 0000000..c87935f
--- /dev/null
+++ b/aestheticdialogs/src/main/res/anim/animate_shrink_exit.xml
@@ -0,0 +1,9 @@
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/anim/animate_slide_down_enter.xml b/aestheticdialogs/src/main/res/anim/animate_slide_down_enter.xml
new file mode 100644
index 0000000..fff98ff
--- /dev/null
+++ b/aestheticdialogs/src/main/res/anim/animate_slide_down_enter.xml
@@ -0,0 +1,8 @@
+
+
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/anim/animate_slide_down_exit.xml b/aestheticdialogs/src/main/res/anim/animate_slide_down_exit.xml
new file mode 100644
index 0000000..19f1854
--- /dev/null
+++ b/aestheticdialogs/src/main/res/anim/animate_slide_down_exit.xml
@@ -0,0 +1,7 @@
+
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/anim/animate_slide_in_left.xml b/aestheticdialogs/src/main/res/anim/animate_slide_in_left.xml
new file mode 100644
index 0000000..aad8f63
--- /dev/null
+++ b/aestheticdialogs/src/main/res/anim/animate_slide_in_left.xml
@@ -0,0 +1,7 @@
+
+
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/anim/animate_slide_left_enter.xml b/aestheticdialogs/src/main/res/anim/animate_slide_left_enter.xml
new file mode 100644
index 0000000..297dec7
--- /dev/null
+++ b/aestheticdialogs/src/main/res/anim/animate_slide_left_enter.xml
@@ -0,0 +1,7 @@
+
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/anim/animate_slide_left_exit.xml b/aestheticdialogs/src/main/res/anim/animate_slide_left_exit.xml
new file mode 100644
index 0000000..b7b8501
--- /dev/null
+++ b/aestheticdialogs/src/main/res/anim/animate_slide_left_exit.xml
@@ -0,0 +1,7 @@
+
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/anim/animate_slide_out_right.xml b/aestheticdialogs/src/main/res/anim/animate_slide_out_right.xml
new file mode 100644
index 0000000..59e999d
--- /dev/null
+++ b/aestheticdialogs/src/main/res/anim/animate_slide_out_right.xml
@@ -0,0 +1,7 @@
+
+
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/anim/animate_slide_up_enter.xml b/aestheticdialogs/src/main/res/anim/animate_slide_up_enter.xml
new file mode 100644
index 0000000..df9b6a6
--- /dev/null
+++ b/aestheticdialogs/src/main/res/anim/animate_slide_up_enter.xml
@@ -0,0 +1,6 @@
+
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/anim/animate_slide_up_exit.xml b/aestheticdialogs/src/main/res/anim/animate_slide_up_exit.xml
new file mode 100644
index 0000000..e36d087
--- /dev/null
+++ b/aestheticdialogs/src/main/res/anim/animate_slide_up_exit.xml
@@ -0,0 +1,9 @@
+
+
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/anim/animate_spin_enter.xml b/aestheticdialogs/src/main/res/anim/animate_spin_enter.xml
new file mode 100644
index 0000000..78fa7b6
--- /dev/null
+++ b/aestheticdialogs/src/main/res/anim/animate_spin_enter.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/anim/animate_spin_exit.xml b/aestheticdialogs/src/main/res/anim/animate_spin_exit.xml
new file mode 100644
index 0000000..9a81df3
--- /dev/null
+++ b/aestheticdialogs/src/main/res/anim/animate_spin_exit.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/anim/animate_split_enter.xml b/aestheticdialogs/src/main/res/anim/animate_split_enter.xml
new file mode 100644
index 0000000..7b0ea70
--- /dev/null
+++ b/aestheticdialogs/src/main/res/anim/animate_split_enter.xml
@@ -0,0 +1,10 @@
+
+
+
+
diff --git a/aestheticdialogs/src/main/res/anim/animate_split_exit.xml b/aestheticdialogs/src/main/res/anim/animate_split_exit.xml
new file mode 100644
index 0000000..9b40487
--- /dev/null
+++ b/aestheticdialogs/src/main/res/anim/animate_split_exit.xml
@@ -0,0 +1,10 @@
+
+
+
+
diff --git a/aestheticdialogs/src/main/res/anim/animate_swipe_left_enter.xml b/aestheticdialogs/src/main/res/anim/animate_swipe_left_enter.xml
new file mode 100644
index 0000000..06d3c6f
--- /dev/null
+++ b/aestheticdialogs/src/main/res/anim/animate_swipe_left_enter.xml
@@ -0,0 +1,12 @@
+
+
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/anim/animate_swipe_left_exit.xml b/aestheticdialogs/src/main/res/anim/animate_swipe_left_exit.xml
new file mode 100644
index 0000000..121f773
--- /dev/null
+++ b/aestheticdialogs/src/main/res/anim/animate_swipe_left_exit.xml
@@ -0,0 +1,12 @@
+
+
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/anim/animate_swipe_right_enter.xml b/aestheticdialogs/src/main/res/anim/animate_swipe_right_enter.xml
new file mode 100644
index 0000000..e1c4c28
--- /dev/null
+++ b/aestheticdialogs/src/main/res/anim/animate_swipe_right_enter.xml
@@ -0,0 +1,12 @@
+
+
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/anim/animate_swipe_right_exit.xml b/aestheticdialogs/src/main/res/anim/animate_swipe_right_exit.xml
new file mode 100644
index 0000000..00678b7
--- /dev/null
+++ b/aestheticdialogs/src/main/res/anim/animate_swipe_right_exit.xml
@@ -0,0 +1,12 @@
+
+
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/anim/animate_windmill_enter.xml b/aestheticdialogs/src/main/res/anim/animate_windmill_enter.xml
new file mode 100644
index 0000000..17edafa
--- /dev/null
+++ b/aestheticdialogs/src/main/res/anim/animate_windmill_enter.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/anim/animate_windmill_exit.xml b/aestheticdialogs/src/main/res/anim/animate_windmill_exit.xml
new file mode 100644
index 0000000..cd0a9f9
--- /dev/null
+++ b/aestheticdialogs/src/main/res/anim/animate_windmill_exit.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/anim/animate_zoom_enter.xml b/aestheticdialogs/src/main/res/anim/animate_zoom_enter.xml
new file mode 100644
index 0000000..d6b3668
--- /dev/null
+++ b/aestheticdialogs/src/main/res/anim/animate_zoom_enter.xml
@@ -0,0 +1,8 @@
+
+
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/anim/animate_zoom_exit.xml b/aestheticdialogs/src/main/res/anim/animate_zoom_exit.xml
new file mode 100644
index 0000000..02008bb
--- /dev/null
+++ b/aestheticdialogs/src/main/res/anim/animate_zoom_exit.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/drawable/background_emotion_error.png b/aestheticdialogs/src/main/res/drawable/background_emotion_error.png
new file mode 100644
index 0000000..edeb7fc
Binary files /dev/null and b/aestheticdialogs/src/main/res/drawable/background_emotion_error.png differ
diff --git a/aestheticdialogs/src/main/res/drawable/background_emotion_success.png b/aestheticdialogs/src/main/res/drawable/background_emotion_success.png
new file mode 100644
index 0000000..626831a
Binary files /dev/null and b/aestheticdialogs/src/main/res/drawable/background_emotion_success.png differ
diff --git a/aestheticdialogs/src/main/res/drawable/btn_blue_normal.xml b/aestheticdialogs/src/main/res/drawable/btn_blue_normal.xml
new file mode 100644
index 0000000..f532d24
--- /dev/null
+++ b/aestheticdialogs/src/main/res/drawable/btn_blue_normal.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/drawable/btn_blue_pressed.xml b/aestheticdialogs/src/main/res/drawable/btn_blue_pressed.xml
new file mode 100644
index 0000000..84d420f
--- /dev/null
+++ b/aestheticdialogs/src/main/res/drawable/btn_blue_pressed.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/drawable/btn_blue_selector.xml b/aestheticdialogs/src/main/res/drawable/btn_blue_selector.xml
new file mode 100644
index 0000000..c3fc2b1
--- /dev/null
+++ b/aestheticdialogs/src/main/res/drawable/btn_blue_selector.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/drawable/btn_green_normal.xml b/aestheticdialogs/src/main/res/drawable/btn_green_normal.xml
new file mode 100644
index 0000000..4bcec00
--- /dev/null
+++ b/aestheticdialogs/src/main/res/drawable/btn_green_normal.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/drawable/btn_green_pressed.xml b/aestheticdialogs/src/main/res/drawable/btn_green_pressed.xml
new file mode 100644
index 0000000..1ae9b19
--- /dev/null
+++ b/aestheticdialogs/src/main/res/drawable/btn_green_pressed.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/drawable/btn_green_selector.xml b/aestheticdialogs/src/main/res/drawable/btn_green_selector.xml
new file mode 100644
index 0000000..4ecfa5c
--- /dev/null
+++ b/aestheticdialogs/src/main/res/drawable/btn_green_selector.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/drawable/btn_red_normal.xml b/aestheticdialogs/src/main/res/drawable/btn_red_normal.xml
new file mode 100644
index 0000000..8c7357e
--- /dev/null
+++ b/aestheticdialogs/src/main/res/drawable/btn_red_normal.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/drawable/btn_red_pressed.xml b/aestheticdialogs/src/main/res/drawable/btn_red_pressed.xml
new file mode 100644
index 0000000..dcdc3cd
--- /dev/null
+++ b/aestheticdialogs/src/main/res/drawable/btn_red_pressed.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/drawable/btn_red_selector.xml b/aestheticdialogs/src/main/res/drawable/btn_red_selector.xml
new file mode 100644
index 0000000..1e096ef
--- /dev/null
+++ b/aestheticdialogs/src/main/res/drawable/btn_red_selector.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/drawable/btn_yellow_normal.xml b/aestheticdialogs/src/main/res/drawable/btn_yellow_normal.xml
new file mode 100644
index 0000000..610e5f9
--- /dev/null
+++ b/aestheticdialogs/src/main/res/drawable/btn_yellow_normal.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/drawable/btn_yellow_pressed.xml b/aestheticdialogs/src/main/res/drawable/btn_yellow_pressed.xml
new file mode 100644
index 0000000..813e8cc
--- /dev/null
+++ b/aestheticdialogs/src/main/res/drawable/btn_yellow_pressed.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/drawable/btn_yellow_selector.xml b/aestheticdialogs/src/main/res/drawable/btn_yellow_selector.xml
new file mode 100644
index 0000000..44efac5
--- /dev/null
+++ b/aestheticdialogs/src/main/res/drawable/btn_yellow_selector.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/drawable/circle_validation_error.png b/aestheticdialogs/src/main/res/drawable/circle_validation_error.png
new file mode 100644
index 0000000..7b6b01c
Binary files /dev/null and b/aestheticdialogs/src/main/res/drawable/circle_validation_error.png differ
diff --git a/aestheticdialogs/src/main/res/drawable/circle_validation_success.png b/aestheticdialogs/src/main/res/drawable/circle_validation_success.png
new file mode 100644
index 0000000..f09aebc
Binary files /dev/null and b/aestheticdialogs/src/main/res/drawable/circle_validation_success.png differ
diff --git a/aestheticdialogs/src/main/res/drawable/drake_error.png b/aestheticdialogs/src/main/res/drawable/drake_error.png
new file mode 100644
index 0000000..f70b7f6
Binary files /dev/null and b/aestheticdialogs/src/main/res/drawable/drake_error.png differ
diff --git a/aestheticdialogs/src/main/res/drawable/drake_success.png b/aestheticdialogs/src/main/res/drawable/drake_success.png
new file mode 100644
index 0000000..c5c7e64
Binary files /dev/null and b/aestheticdialogs/src/main/res/drawable/drake_success.png differ
diff --git a/aestheticdialogs/src/main/res/drawable/ic_cancel.xml b/aestheticdialogs/src/main/res/drawable/ic_cancel.xml
new file mode 100644
index 0000000..b3a42f2
--- /dev/null
+++ b/aestheticdialogs/src/main/res/drawable/ic_cancel.xml
@@ -0,0 +1,12 @@
+
+
+
+
diff --git a/aestheticdialogs/src/main/res/drawable/ic_check_circle_green_24dp.xml b/aestheticdialogs/src/main/res/drawable/ic_check_circle_green_24dp.xml
new file mode 100644
index 0000000..50203fb
--- /dev/null
+++ b/aestheticdialogs/src/main/res/drawable/ic_check_circle_green_24dp.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
diff --git a/aestheticdialogs/src/main/res/drawable/ic_close_gray_24dp.xml b/aestheticdialogs/src/main/res/drawable/ic_close_gray_24dp.xml
new file mode 100644
index 0000000..b24b9c7
--- /dev/null
+++ b/aestheticdialogs/src/main/res/drawable/ic_close_gray_24dp.xml
@@ -0,0 +1,5 @@
+
+
+
diff --git a/aestheticdialogs/src/main/res/drawable/ic_error_red_24dp.xml b/aestheticdialogs/src/main/res/drawable/ic_error_red_24dp.xml
new file mode 100644
index 0000000..2cc9e64
--- /dev/null
+++ b/aestheticdialogs/src/main/res/drawable/ic_error_red_24dp.xml
@@ -0,0 +1,5 @@
+
+
+
diff --git a/aestheticdialogs/src/main/res/drawable/ic_info_blue_24dp.xml b/aestheticdialogs/src/main/res/drawable/ic_info_blue_24dp.xml
new file mode 100644
index 0000000..392b48d
--- /dev/null
+++ b/aestheticdialogs/src/main/res/drawable/ic_info_blue_24dp.xml
@@ -0,0 +1,5 @@
+
+
+
diff --git a/aestheticdialogs/src/main/res/drawable/ic_signal_wifi_off_white_24dp.xml b/aestheticdialogs/src/main/res/drawable/ic_signal_wifi_off_white_24dp.xml
new file mode 100644
index 0000000..d822afb
--- /dev/null
+++ b/aestheticdialogs/src/main/res/drawable/ic_signal_wifi_off_white_24dp.xml
@@ -0,0 +1,5 @@
+
+
+
diff --git a/aestheticdialogs/src/main/res/drawable/ic_tick.xml b/aestheticdialogs/src/main/res/drawable/ic_tick.xml
new file mode 100644
index 0000000..c6f0b01
--- /dev/null
+++ b/aestheticdialogs/src/main/res/drawable/ic_tick.xml
@@ -0,0 +1,12 @@
+
+
+
+
diff --git a/aestheticdialogs/src/main/res/drawable/ic_warning_orange_24dp.xml b/aestheticdialogs/src/main/res/drawable/ic_warning_orange_24dp.xml
new file mode 100644
index 0000000..a257b4b
--- /dev/null
+++ b/aestheticdialogs/src/main/res/drawable/ic_warning_orange_24dp.xml
@@ -0,0 +1,5 @@
+
+
+
diff --git a/aestheticdialogs/src/main/res/drawable/ic_wifi_white_24dp.xml b/aestheticdialogs/src/main/res/drawable/ic_wifi_white_24dp.xml
new file mode 100644
index 0000000..aff45f3
--- /dev/null
+++ b/aestheticdialogs/src/main/res/drawable/ic_wifi_white_24dp.xml
@@ -0,0 +1,5 @@
+
+
+
diff --git a/aestheticdialogs/src/main/res/drawable/linear_green_gradient_connectify.xml b/aestheticdialogs/src/main/res/drawable/linear_green_gradient_connectify.xml
new file mode 100644
index 0000000..0dc9a45
--- /dev/null
+++ b/aestheticdialogs/src/main/res/drawable/linear_green_gradient_connectify.xml
@@ -0,0 +1,8 @@
+
+
+
+
diff --git a/aestheticdialogs/src/main/res/drawable/linear_red_gradient_connectify.xml b/aestheticdialogs/src/main/res/drawable/linear_red_gradient_connectify.xml
new file mode 100644
index 0000000..8fb27f8
--- /dev/null
+++ b/aestheticdialogs/src/main/res/drawable/linear_red_gradient_connectify.xml
@@ -0,0 +1,7 @@
+
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/drawable/man_shrugging.png b/aestheticdialogs/src/main/res/drawable/man_shrugging.png
new file mode 100644
index 0000000..1ab3dfa
Binary files /dev/null and b/aestheticdialogs/src/main/res/drawable/man_shrugging.png differ
diff --git a/aestheticdialogs/src/main/res/drawable/rounded_border_white.xml b/aestheticdialogs/src/main/res/drawable/rounded_border_white.xml
new file mode 100644
index 0000000..0b83940
--- /dev/null
+++ b/aestheticdialogs/src/main/res/drawable/rounded_border_white.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
diff --git a/aestheticdialogs/src/main/res/drawable/rounded_dark_bg.xml b/aestheticdialogs/src/main/res/drawable/rounded_dark_bg.xml
new file mode 100644
index 0000000..ab29501
--- /dev/null
+++ b/aestheticdialogs/src/main/res/drawable/rounded_dark_bg.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/drawable/rounded_green_gradient_bg.xml b/aestheticdialogs/src/main/res/drawable/rounded_green_gradient_bg.xml
new file mode 100644
index 0000000..97007ac
--- /dev/null
+++ b/aestheticdialogs/src/main/res/drawable/rounded_green_gradient_bg.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/drawable/rounded_green_gradient_bg_connectify.xml b/aestheticdialogs/src/main/res/drawable/rounded_green_gradient_bg_connectify.xml
new file mode 100644
index 0000000..870b31b
--- /dev/null
+++ b/aestheticdialogs/src/main/res/drawable/rounded_green_gradient_bg_connectify.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
diff --git a/aestheticdialogs/src/main/res/drawable/rounded_rect_blue.xml b/aestheticdialogs/src/main/res/drawable/rounded_rect_blue.xml
new file mode 100644
index 0000000..9827ce7
--- /dev/null
+++ b/aestheticdialogs/src/main/res/drawable/rounded_rect_blue.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/drawable/rounded_rect_green.xml b/aestheticdialogs/src/main/res/drawable/rounded_rect_green.xml
new file mode 100644
index 0000000..8a36bb7
--- /dev/null
+++ b/aestheticdialogs/src/main/res/drawable/rounded_rect_green.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/drawable/rounded_rect_red.xml b/aestheticdialogs/src/main/res/drawable/rounded_rect_red.xml
new file mode 100644
index 0000000..95733d0
--- /dev/null
+++ b/aestheticdialogs/src/main/res/drawable/rounded_rect_red.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/drawable/rounded_rect_yellow.xml b/aestheticdialogs/src/main/res/drawable/rounded_rect_yellow.xml
new file mode 100644
index 0000000..b648546
--- /dev/null
+++ b/aestheticdialogs/src/main/res/drawable/rounded_rect_yellow.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/drawable/rounded_red_gradient_bg.xml b/aestheticdialogs/src/main/res/drawable/rounded_red_gradient_bg.xml
new file mode 100644
index 0000000..59dce57
--- /dev/null
+++ b/aestheticdialogs/src/main/res/drawable/rounded_red_gradient_bg.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/drawable/rounded_red_gradient_bg_connectify.xml b/aestheticdialogs/src/main/res/drawable/rounded_red_gradient_bg_connectify.xml
new file mode 100644
index 0000000..02d46fb
--- /dev/null
+++ b/aestheticdialogs/src/main/res/drawable/rounded_red_gradient_bg_connectify.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
diff --git a/aestheticdialogs/src/main/res/drawable/rounded_white_bg.xml b/aestheticdialogs/src/main/res/drawable/rounded_white_bg.xml
new file mode 100644
index 0000000..8066287
--- /dev/null
+++ b/aestheticdialogs/src/main/res/drawable/rounded_white_bg.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/drawable/smiley_error.png b/aestheticdialogs/src/main/res/drawable/smiley_error.png
new file mode 100644
index 0000000..aa56075
Binary files /dev/null and b/aestheticdialogs/src/main/res/drawable/smiley_error.png differ
diff --git a/aestheticdialogs/src/main/res/drawable/smiley_success.png b/aestheticdialogs/src/main/res/drawable/smiley_success.png
new file mode 100644
index 0000000..f83de12
Binary files /dev/null and b/aestheticdialogs/src/main/res/drawable/smiley_success.png differ
diff --git a/aestheticdialogs/src/main/res/drawable/thumbs_up_sign.png b/aestheticdialogs/src/main/res/drawable/thumbs_up_sign.png
new file mode 100644
index 0000000..ebe91c9
Binary files /dev/null and b/aestheticdialogs/src/main/res/drawable/thumbs_up_sign.png differ
diff --git a/aestheticdialogs/src/main/res/font/koho.ttf b/aestheticdialogs/src/main/res/font/koho.ttf
new file mode 100644
index 0000000..78e04aa
Binary files /dev/null and b/aestheticdialogs/src/main/res/font/koho.ttf differ
diff --git a/aestheticdialogs/src/main/res/font/koho_bold.ttf b/aestheticdialogs/src/main/res/font/koho_bold.ttf
new file mode 100644
index 0000000..a0123f5
Binary files /dev/null and b/aestheticdialogs/src/main/res/font/koho_bold.ttf differ
diff --git a/aestheticdialogs/src/main/res/font/koho_italic.ttf b/aestheticdialogs/src/main/res/font/koho_italic.ttf
new file mode 100644
index 0000000..e6cf346
Binary files /dev/null and b/aestheticdialogs/src/main/res/font/koho_italic.ttf differ
diff --git a/aestheticdialogs/src/main/res/layout/dialog_connectify_error.xml b/aestheticdialogs/src/main/res/layout/dialog_connectify_error.xml
new file mode 100644
index 0000000..8917dec
--- /dev/null
+++ b/aestheticdialogs/src/main/res/layout/dialog_connectify_error.xml
@@ -0,0 +1,95 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/layout/dialog_connectify_success.xml b/aestheticdialogs/src/main/res/layout/dialog_connectify_success.xml
new file mode 100644
index 0000000..82f9e9e
--- /dev/null
+++ b/aestheticdialogs/src/main/res/layout/dialog_connectify_success.xml
@@ -0,0 +1,93 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/layout/dialog_drake_error.xml b/aestheticdialogs/src/main/res/layout/dialog_drake_error.xml
new file mode 100644
index 0000000..1b20170
--- /dev/null
+++ b/aestheticdialogs/src/main/res/layout/dialog_drake_error.xml
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/aestheticdialogs/src/main/res/layout/dialog_drake_success.xml b/aestheticdialogs/src/main/res/layout/dialog_drake_success.xml
new file mode 100644
index 0000000..6632386
--- /dev/null
+++ b/aestheticdialogs/src/main/res/layout/dialog_drake_success.xml
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/layout/dialog_emoji.xml b/aestheticdialogs/src/main/res/layout/dialog_emoji.xml
new file mode 100644
index 0000000..fcefbc8
--- /dev/null
+++ b/aestheticdialogs/src/main/res/layout/dialog_emoji.xml
@@ -0,0 +1,62 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/layout/dialog_emotion.xml b/aestheticdialogs/src/main/res/layout/dialog_emotion.xml
new file mode 100644
index 0000000..0162e26
--- /dev/null
+++ b/aestheticdialogs/src/main/res/layout/dialog_emotion.xml
@@ -0,0 +1,73 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/layout/dialog_flash.xml b/aestheticdialogs/src/main/res/layout/dialog_flash.xml
new file mode 100644
index 0000000..fef546e
--- /dev/null
+++ b/aestheticdialogs/src/main/res/layout/dialog_flash.xml
@@ -0,0 +1,66 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/aestheticdialogs/src/main/res/layout/dialog_flat.xml b/aestheticdialogs/src/main/res/layout/dialog_flat.xml
new file mode 100644
index 0000000..9033a31
--- /dev/null
+++ b/aestheticdialogs/src/main/res/layout/dialog_flat.xml
@@ -0,0 +1,66 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/aestheticdialogs/src/main/res/layout/dialog_rainbow.xml b/aestheticdialogs/src/main/res/layout/dialog_rainbow.xml
new file mode 100644
index 0000000..28f181d
--- /dev/null
+++ b/aestheticdialogs/src/main/res/layout/dialog_rainbow.xml
@@ -0,0 +1,67 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/layout/dialog_toaster.xml b/aestheticdialogs/src/main/res/layout/dialog_toaster.xml
new file mode 100644
index 0000000..ca78e56
--- /dev/null
+++ b/aestheticdialogs/src/main/res/layout/dialog_toaster.xml
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/values/colors.xml b/aestheticdialogs/src/main/res/values/colors.xml
new file mode 100644
index 0000000..a181442
--- /dev/null
+++ b/aestheticdialogs/src/main/res/values/colors.xml
@@ -0,0 +1,16 @@
+
+
+ #FFFFFF
+ #607D8B
+ #E53935
+ #F9A825
+ #1565C0
+ #43A047
+ #48D865
+ #FF6B5F
+ #3086EB
+ #FFC122
+ #EB1F5D
+ #61C730
+ #2F3032
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/main/res/values/dimens.xml b/aestheticdialogs/src/main/res/values/dimens.xml
new file mode 100644
index 0000000..6e04413
--- /dev/null
+++ b/aestheticdialogs/src/main/res/values/dimens.xml
@@ -0,0 +1,24 @@
+
+
+ 18sp
+ 10sp
+ 10dp
+ 30dp
+ 50dp
+
+ 16dp
+ 10dp
+ 30dp
+
+ 300dp
+ 310dp
+
+ 100dp
+
+ 200dp
+ 350dp
+ 100dp
+ 120dp
+ 350dp
+
+
diff --git a/aestheticdialogs/src/main/res/values/integers.xml b/aestheticdialogs/src/main/res/values/integers.xml
new file mode 100644
index 0000000..e406a7a
--- /dev/null
+++ b/aestheticdialogs/src/main/res/values/integers.xml
@@ -0,0 +1,4 @@
+
+
+ 200
+
diff --git a/aestheticdialogs/src/main/res/values/strings.xml b/aestheticdialogs/src/main/res/values/strings.xml
new file mode 100644
index 0000000..90bb307
--- /dev/null
+++ b/aestheticdialogs/src/main/res/values/strings.xml
@@ -0,0 +1,5 @@
+
+ AestheticDialogs
+ error
+ success
+
diff --git a/aestheticdialogs/src/main/res/values/styles.xml b/aestheticdialogs/src/main/res/values/styles.xml
new file mode 100644
index 0000000..5c49fad
--- /dev/null
+++ b/aestheticdialogs/src/main/res/values/styles.xml
@@ -0,0 +1,85 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/aestheticdialogs/src/test/java/com/thecode/aestheticdialogs/ExampleUnitTest.kt b/aestheticdialogs/src/test/java/com/thecode/aestheticdialogs/ExampleUnitTest.kt
new file mode 100644
index 0000000..fe780a1
--- /dev/null
+++ b/aestheticdialogs/src/test/java/com/thecode/aestheticdialogs/ExampleUnitTest.kt
@@ -0,0 +1,17 @@
+package com.thecode.aestheticdialogs
+
+import org.junit.Test
+
+import org.junit.Assert.*
+
+/**
+ * Example local unit test, which will execute on the development machine (host).
+ *
+ * See [testing documentation](http://d.android.com/tools/testing).
+ */
+class ExampleUnitTest {
+ @Test
+ fun addition_isCorrect() {
+ assertEquals(4, 2 + 2)
+ }
+}
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index a52bcb5..e6ac9ac 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -48,11 +48,11 @@ android {
classpath 'com.google.gms:google-services:4.3.15'
}
}
+
buildFeatures {
viewBinding true
}
-
}
dependencies {
@@ -92,10 +92,7 @@ dependencies {
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.github.ome450901:SimpleRatingBar:1.5.1'
implementation 'com.cepheuen.elegant-number-button:lib:1.0.2'
- implementation 'com.github.slavce14:SJ-Dialog:1.6'
implementation 'com.saadahmedev.popup-dialog:popup-dialog:1.0.2'
- implementation 'com.github.gabriel-TheCode:AestheticDialogs:1.3.6'
- implementation 'io.github.pilgr:paperdb:2.7.2'
implementation 'com.github.techinessoverloaded:progress-dialog:1.5.1'
implementation 'androidx.browser:browser:1.5.0'
@@ -110,4 +107,7 @@ dependencies {
// ADD the API-only library to all variants
implementation 'com.google.firebase:firebase-appdistribution:16.0.0-beta08'
-}
\ No newline at end of file
+ implementation(project(':aestheticdialogs'))
+ implementation(project(':SJDialog'))
+
+}
diff --git a/app/src/main/java/com/capstone/foodify/Activity/AccountAndProfileActivity.java b/app/src/main/java/com/capstone/foodify/Activity/AccountAndProfileActivity.java
index 7b20aff..615a6c9 100644
--- a/app/src/main/java/com/capstone/foodify/Activity/AccountAndProfileActivity.java
+++ b/app/src/main/java/com/capstone/foodify/Activity/AccountAndProfileActivity.java
@@ -54,7 +54,6 @@ import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Locale;
-import io.paperdb.Paper;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@@ -108,9 +107,6 @@ public class AccountAndProfileActivity extends AppCompatActivity {
//Initialize Firebase Auth
mAuth = FirebaseAuth.getInstance();
- //Paper Init
- Paper.init(this);
-
//Show notification about email verify for user
showNotificationEmailVerify();
diff --git a/app/src/main/java/com/capstone/foodify/Activity/FoodDetailActivity.java b/app/src/main/java/com/capstone/foodify/Activity/FoodDetailActivity.java
index 29631a3..57d2e11 100644
--- a/app/src/main/java/com/capstone/foodify/Activity/FoodDetailActivity.java
+++ b/app/src/main/java/com/capstone/foodify/Activity/FoodDetailActivity.java
@@ -1,7 +1,6 @@
package com.capstone.foodify.Activity;
import android.annotation.SuppressLint;
-import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
@@ -39,11 +38,11 @@ import com.capstone.foodify.Adapter.CommentAdapter;
import com.capstone.foodify.Common;
import com.capstone.foodify.Model.Basket;
import com.capstone.foodify.Model.Category;
+import com.capstone.foodify.Model.Comment;
import com.capstone.foodify.Model.Food;
import com.capstone.foodify.Model.Image;
import com.capstone.foodify.Model.Response.Comments;
import com.capstone.foodify.Model.Response.CustomResponse;
-import com.capstone.foodify.Model.Comment;
import com.capstone.foodify.R;
import com.denzcoskun.imageslider.ImageSlider;
import com.denzcoskun.imageslider.constants.ScaleTypes;
@@ -54,10 +53,7 @@ import com.mcdev.quantitizerlibrary.AnimationStyle;
import com.mcdev.quantitizerlibrary.HorizontalQuantitizer;
import com.mcdev.quantitizerlibrary.QuantitizerListener;
import com.sjapps.library.customdialog.BasicDialog;
-import com.sjapps.library.customdialog.DialogButtonEvent;
import com.sjapps.library.customdialog.DialogButtonEvents;
-import com.thecode.aestheticdialogs.AestheticDialog;
-import com.thecode.aestheticdialogs.DialogAnimation;
import com.thecode.aestheticdialogs.DialogStyle;
import com.thecode.aestheticdialogs.DialogType;
import com.willy.ratingbar.RotationRatingBar;
diff --git a/app/src/main/java/com/capstone/foodify/Activity/MainActivity.java b/app/src/main/java/com/capstone/foodify/Activity/MainActivity.java
index 57ee42f..e4402fb 100644
--- a/app/src/main/java/com/capstone/foodify/Activity/MainActivity.java
+++ b/app/src/main/java/com/capstone/foodify/Activity/MainActivity.java
@@ -6,7 +6,6 @@ import android.app.job.JobInfo;
import android.app.job.JobScheduler;
import android.content.ComponentName;
import android.content.Context;
-import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentSender;
import android.content.SharedPreferences;
@@ -23,6 +22,7 @@ import android.provider.Settings;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
+import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
@@ -76,7 +76,6 @@ import com.techiness.progressdialoglibrary.ProgressDialog;
import java.util.Arrays;
import java.util.List;
-import io.paperdb.Paper;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@@ -108,9 +107,6 @@ public class MainActivity extends AppCompatActivity {
public void onStart() {
super.onStart();
- //Get user from Paper
-// user = Paper.book().read("user");
-
// Check if user is signed in (non-null) and update UI accordingly.
user = mAuth.getCurrentUser();
@@ -224,15 +220,12 @@ public class MainActivity extends AppCompatActivity {
});
}
- //Paper Init
- Paper.init(this);
-
initComponent();
bottomNavigation();
startPowerSaverIntent(this);
- checkNotificationPermission();
+ checkNotificationPermission(this);
startRefreshTokenService();
getLocation();
@@ -394,9 +387,10 @@ public class MainActivity extends AppCompatActivity {
}
});
}
- private void checkNotificationPermission(){
- if(!NotificationManagerCompat.from(this).areNotificationsEnabled()){
- showDialogPermission("Hãy bật quyền thông báo trên thiết bị của bạn để chúng thôi có thể cung cấp thông tin cho bạn một cách nhanh nhất!");
+ private void checkNotificationPermission(Context context){
+ if(!NotificationManagerCompat.from(context).areNotificationsEnabled()){
+ showDialogPermission("Hãy bật quyền thông báo trên thiết bị của bạn để chúng thôi có thể cung cấp thông tin cho bạn một cách nhanh nhất!", this, "Notification",
+ "skipNotificationCheck");
}
}
@@ -427,33 +421,35 @@ public class MainActivity extends AppCompatActivity {
if(grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED){
getLocation();
} else {
- showDialogPermission("Hãy cho ứng dụng truy cập vào vị trí của bạn để trải nghiệm tốt hơn!");
+ showDialogPermission("Hãy cho ứng dụng truy cập vào vị trí của bạn để trải nghiệm tốt hơn!", this, "Location", "skipLocationCheck");
}
}
}
- private void showDialogPermission(String message) {
- AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ private void showDialogPermission(String message, Context context, String name, String key) {
+ SharedPreferences settings = getSharedPreferences(name, Context.MODE_PRIVATE);
+ boolean skipMessage = settings.getBoolean(key, false);
+ if (!skipMessage) {
+ final SharedPreferences.Editor editor = settings.edit();
+ final AppCompatCheckBox dontShowAgain = new AppCompatCheckBox(context);
+ dontShowAgain.setText("Không hiện hộp thoại này nữa!");
+ dontShowAgain.setButtonTintList(ColorStateList.valueOf(getResources().getColor(R.color.primaryColor, null)));
+ dontShowAgain.setOnCheckedChangeListener((buttonView, isChecked) -> {
+ editor.putBoolean(key, isChecked);
+ editor.apply();
+ });
- builder.setMessage(message)
- .setCancelable(false)
- .setPositiveButton("Ok", new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- openSettings();
- dialog.cancel();
- }
- })
- .setNegativeButton("Để sau", new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- dialog.cancel();
- }
- });
+ AlertDialog alertDialog = new AlertDialog.Builder(context)
+ .setTitle("Thông báo")
+ .setMessage(message)
+ .setView(dontShowAgain)
+ .setPositiveButton("Đi đến cài đặt", (dialog, which) -> openSettings())
+ .setNegativeButton("Đóng", null)
+ .show();
- AlertDialog alertDialog = builder.create();
- alertDialog.setTitle("Thông báo!");
- alertDialog.show();
+ TextView textView = (TextView) alertDialog.findViewById(android.R.id.message);
+ textView.setTypeface(Common.setFontKoho(getAssets()));
+ }
}
private void openSettings() {
diff --git a/app/src/main/java/com/capstone/foodify/Activity/OrderDetailActivity.java b/app/src/main/java/com/capstone/foodify/Activity/OrderDetailActivity.java
index c44d724..4cd6092 100644
--- a/app/src/main/java/com/capstone/foodify/Activity/OrderDetailActivity.java
+++ b/app/src/main/java/com/capstone/foodify/Activity/OrderDetailActivity.java
@@ -1,11 +1,5 @@
package com.capstone.foodify.Activity;
-import androidx.annotation.IntRange;
-import androidx.annotation.NonNull;
-import androidx.appcompat.app.AppCompatActivity;
-import androidx.recyclerview.widget.LinearLayoutManager;
-import androidx.recyclerview.widget.RecyclerView;
-
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
@@ -18,14 +12,19 @@ import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
+import androidx.annotation.IntRange;
+import androidx.annotation.NonNull;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
import com.capstone.foodify.API.FoodApiToken;
+import com.capstone.foodify.Adapter.OrderDetailAdapter;
import com.capstone.foodify.Common;
import com.capstone.foodify.Model.Basket;
import com.capstone.foodify.Model.Order;
import com.capstone.foodify.Model.OrderDetail;
-import com.capstone.foodify.Adapter.OrderDetailAdapter;
import com.capstone.foodify.Model.Response.CustomResponse;
-import com.capstone.foodify.Model.User;
import com.capstone.foodify.R;
import com.sjapps.library.customdialog.BasicDialog;
import com.sjapps.library.customdialog.DialogButtonEvents;
@@ -34,8 +33,6 @@ import com.thecode.aestheticdialogs.DialogStyle;
import com.thecode.aestheticdialogs.DialogType;
import com.thecode.aestheticdialogs.OnDialogClickListener;
-import java.time.LocalDateTime;
-import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
diff --git a/app/src/main/java/com/capstone/foodify/Activity/SignInActivity.java b/app/src/main/java/com/capstone/foodify/Activity/SignInActivity.java
index 81c9883..ae9d7ce 100644
--- a/app/src/main/java/com/capstone/foodify/Activity/SignInActivity.java
+++ b/app/src/main/java/com/capstone/foodify/Activity/SignInActivity.java
@@ -32,7 +32,6 @@ import com.google.firebase.auth.SignInMethodQueryResult;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import io.paperdb.Paper;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@@ -55,9 +54,6 @@ public class SignInActivity extends AppCompatActivity {
FirebaseApp.initializeApp(SignInActivity.this);
setContentView(R.layout.activity_sign_in);
- //Init Paper
- Paper.init(this);
-
if(Common.CURRENT_USER != null)
startActivity(new Intent(this, MainActivity.class));
@@ -193,8 +189,6 @@ public class SignInActivity extends AppCompatActivity {
// Sign in success, update UI with the signed-in user's information
FirebaseUser user = mAuth.getCurrentUser();
- //Save user
-// Paper.book().write("user", user);
user.getIdToken(true)
.addOnCompleteListener(new OnCompleteListener() {
diff --git a/app/src/main/java/com/capstone/foodify/Adapter/AddressAdapter.java b/app/src/main/java/com/capstone/foodify/Adapter/AddressAdapter.java
index 060ad8a..be5a187 100644
--- a/app/src/main/java/com/capstone/foodify/Adapter/AddressAdapter.java
+++ b/app/src/main/java/com/capstone/foodify/Adapter/AddressAdapter.java
@@ -4,24 +4,15 @@ import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
-import android.widget.AdapterView;
-import android.widget.Button;
-import android.widget.EditText;
import android.widget.ImageView;
-import android.widget.Spinner;
import android.widget.TextView;
import androidx.annotation.NonNull;
-import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.recyclerview.widget.RecyclerView;
import com.capstone.foodify.Activity.AddressManagerActivity;
-import com.capstone.foodify.Common;
import com.capstone.foodify.Model.Address;
import com.capstone.foodify.R;
-import com.google.android.material.textfield.TextInputLayout;
-import com.sjapps.library.customdialog.CustomViewDialog;
-import com.sjapps.library.customdialog.DialogButtonEvents;
import java.util.List;
diff --git a/app/src/main/java/com/capstone/foodify/Fragment/ProfileFragment.java b/app/src/main/java/com/capstone/foodify/Fragment/ProfileFragment.java
index f723c3d..b3a761a 100644
--- a/app/src/main/java/com/capstone/foodify/Fragment/ProfileFragment.java
+++ b/app/src/main/java/com/capstone/foodify/Fragment/ProfileFragment.java
@@ -11,7 +11,6 @@ import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
-import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import com.capstone.foodify.Activity.AccountAndProfileActivity;
@@ -21,9 +20,6 @@ import com.capstone.foodify.Activity.MainActivity;
import com.capstone.foodify.Activity.OrderActivity;
import com.capstone.foodify.Common;
import com.capstone.foodify.R;
-import com.google.android.gms.tasks.OnCompleteListener;
-import com.google.android.gms.tasks.Task;
-import com.google.firebase.appdistribution.FirebaseAppDistribution;
import com.google.firebase.auth.FirebaseAuth;
import com.makeramen.roundedimageview.RoundedImageView;
import com.saadahmedsoft.popupdialog.PopupDialog;
@@ -31,8 +27,6 @@ import com.saadahmedsoft.popupdialog.Styles;
import com.saadahmedsoft.popupdialog.listener.OnDialogButtonClickListener;
import com.squareup.picasso.Picasso;
-import io.paperdb.Paper;
-
public class ProfileFragment extends Fragment {
private static final String TAG = "ProfileFragment";
LinearLayout account_and_profile, manage_address, favorite_food, order_history, feed_back, log_out;
@@ -116,9 +110,6 @@ public class ProfileFragment extends Fragment {
public void onPositiveClicked(Dialog dialog) {
FirebaseAuth.getInstance().signOut();
- //Delete user from local storage
-// Paper.book().delete("user");
-
Common.TOKEN = null;
Common.CURRENT_USER = null;
dialog.dismiss();
diff --git a/app/src/main/res/font/opensans.ttf b/app/src/main/res/font/opensans.ttf
deleted file mode 100644
index ba6db9b..0000000
Binary files a/app/src/main/res/font/opensans.ttf and /dev/null differ
diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml
index 257ef84..89b3ad9 100644
--- a/app/src/main/res/values/themes.xml
+++ b/app/src/main/res/values/themes.xml
@@ -12,6 +12,9 @@
- true
- @color/grayLight
- @style/MyDatePickerDialogTheme
+ - @style/KohoViewStyle
+ - @font/koho
+ - false
+
+
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index 954ca80..a5352d2 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,8 +1,11 @@
buildscript {
+ ext.kotlin_version = '1.6.20'
dependencies {
classpath 'com.google.gms:google-services:4.3.15'
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
plugins {
id 'com.android.application' version '7.4.2' apply false
id 'com.android.library' version '7.4.2' apply false
diff --git a/popupDialog/.gitignore b/popupDialog/.gitignore
new file mode 100644
index 0000000..42afabf
--- /dev/null
+++ b/popupDialog/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/popupDialog/build.gradle b/popupDialog/build.gradle
new file mode 100644
index 0000000..d640c7c
--- /dev/null
+++ b/popupDialog/build.gradle
@@ -0,0 +1,112 @@
+plugins {
+ id 'com.android.library'
+ id 'maven-publish'
+ id 'signing'
+}
+
+android {
+ namespace 'com.saadahmedsoft.popupdialog'
+ compileSdk 33
+
+ defaultConfig {
+ minSdk 21
+ targetSdk 33
+
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+ consumerProguardFiles "consumer-rules.pro"
+ }
+
+ publishing {
+ singleVariant("release") {
+ // if you don't want sources/javadoc, remove these lines
+ withSourcesJar()
+ withJavadocJar()
+ }
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+}
+
+task sourceJar(type: Jar) {
+ from android.sourceSets.main.java.srcDirs
+ classifier "sources"
+}
+
+def artifactVersion = "1.0.2"
+
+publishing {
+ publications {
+ maven(MavenPublication) {
+ groupId 'com.saadahmedev.popup-dialog'
+ artifactId 'popup-dialog'
+ version artifactVersion
+ artifact(sourceJar)
+ artifact("$buildDir/outputs/aar/popupDialog-release.aar")
+
+ pom {
+ name = 'Android Popup Dialog'
+ description = 'A custom android popup dialog library which provides you a lot of popup dialog with and without animation'
+ url = 'https://github.com/saadahmedscse/Android-Popup-Dialog'
+
+ withXml {
+ def node = asNode().appendNode('dependencies').appendNode('dependency')
+ node.appendNode('groupId', 'com.airbnb.android')
+ node.appendNode('artifactId', 'lottie')
+ node.appendNode('version', '5.2.0')
+ node.appendNode('scope', 'compile')
+ }
+
+ licenses {
+ license {
+ name = 'The Apache License, Version 2.0'
+ url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
+ }
+ }
+ developers {
+ developer {
+ id = 'saadahmedscse'
+ name = 'Saad Ahmed'
+ email = 'saadahmedscse@gmail.com'
+ }
+ }
+ scm {
+ connection = 'scm:git:git://github.com/saadahmedscse/Android-Popup-Dialog.git'
+ developerConnection = 'scm:git:ssh://github.com:saadahmedscse/Android-Popup-Dialog.git'
+ url = 'https://github.com/saadahmedscse/Android-Popup-Dialog'
+ }
+ }
+ }
+ }
+ repositories {
+ maven {
+ def releaseUrl = "https://s01.oss.sonatype.org/content/repositories/releases/"
+ def snapshotUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
+ url = artifactVersion.endsWith('SNAPSHOT') ? snapshotUrl : releaseUrl
+
+ credentials {
+ username("username")
+ password("password")
+ }
+ }
+ }
+}
+
+dependencies {
+ implementation 'androidx.appcompat:appcompat:1.5.1'
+ implementation 'com.google.android.material:material:1.6.1'
+
+ implementation "com.airbnb.android:lottie:5.2.0"
+}
+
+signing {
+ sign configurations.archives
+}
\ No newline at end of file
diff --git a/popupDialog/consumer-rules.pro b/popupDialog/consumer-rules.pro
new file mode 100644
index 0000000..e69de29
diff --git a/popupDialog/demos/dialog_alert.gif b/popupDialog/demos/dialog_alert.gif
new file mode 100644
index 0000000..dd27c8c
Binary files /dev/null and b/popupDialog/demos/dialog_alert.gif differ
diff --git a/popupDialog/demos/dialog_android_default.png b/popupDialog/demos/dialog_android_default.png
new file mode 100644
index 0000000..8511b12
Binary files /dev/null and b/popupDialog/demos/dialog_android_default.png differ
diff --git a/popupDialog/demos/dialog_failed.gif b/popupDialog/demos/dialog_failed.gif
new file mode 100644
index 0000000..ea42268
Binary files /dev/null and b/popupDialog/demos/dialog_failed.gif differ
diff --git a/popupDialog/demos/dialog_ios.png b/popupDialog/demos/dialog_ios.png
new file mode 100644
index 0000000..5a2407f
Binary files /dev/null and b/popupDialog/demos/dialog_ios.png differ
diff --git a/popupDialog/demos/dialog_lottie_animation.gif b/popupDialog/demos/dialog_lottie_animation.gif
new file mode 100644
index 0000000..394cef7
Binary files /dev/null and b/popupDialog/demos/dialog_lottie_animation.gif differ
diff --git a/popupDialog/demos/dialog_progress.gif b/popupDialog/demos/dialog_progress.gif
new file mode 100644
index 0000000..617e0d9
Binary files /dev/null and b/popupDialog/demos/dialog_progress.gif differ
diff --git a/popupDialog/demos/dialog_standard.png b/popupDialog/demos/dialog_standard.png
new file mode 100644
index 0000000..ba2d85d
Binary files /dev/null and b/popupDialog/demos/dialog_standard.png differ
diff --git a/popupDialog/demos/dialog_success.gif b/popupDialog/demos/dialog_success.gif
new file mode 100644
index 0000000..17f4ccb
Binary files /dev/null and b/popupDialog/demos/dialog_success.gif differ
diff --git a/popupDialog/proguard-rules.pro b/popupDialog/proguard-rules.pro
new file mode 100644
index 0000000..481bb43
--- /dev/null
+++ b/popupDialog/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
\ No newline at end of file
diff --git a/popupDialog/secring.gpg b/popupDialog/secring.gpg
new file mode 100644
index 0000000..d0fe5e0
Binary files /dev/null and b/popupDialog/secring.gpg differ
diff --git a/popupDialog/src/main/AndroidManifest.xml b/popupDialog/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..a5918e6
--- /dev/null
+++ b/popupDialog/src/main/AndroidManifest.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/popupDialog/src/main/java/com/saadahmedsoft/popupdialog/CreateDialog.java b/popupDialog/src/main/java/com/saadahmedsoft/popupdialog/CreateDialog.java
new file mode 100644
index 0000000..0d858f6
--- /dev/null
+++ b/popupDialog/src/main/java/com/saadahmedsoft/popupdialog/CreateDialog.java
@@ -0,0 +1,634 @@
+/*
+ * Copyright 2022 Saad Ahmed
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.saadahmedsoft.popupdialog;
+
+import android.annotation.SuppressLint;
+import android.app.Dialog;
+import android.content.Context;
+import android.graphics.Color;
+import android.graphics.PorterDuff;
+import android.graphics.drawable.ColorDrawable;
+import android.os.Handler;
+import android.widget.ImageView;
+import android.widget.ProgressBar;
+import android.widget.TextView;
+
+import androidx.annotation.ColorInt;
+import androidx.annotation.ColorRes;
+import androidx.annotation.DrawableRes;
+import androidx.annotation.LayoutRes;
+import androidx.annotation.Nullable;
+import androidx.annotation.RawRes;
+import androidx.appcompat.app.AlertDialog;
+import androidx.constraintlayout.widget.ConstraintLayout;
+import androidx.core.content.ContextCompat;
+
+import com.airbnb.lottie.LottieAnimationView;
+import com.saadahmedsoft.popupdialog.listener.OnDialogButtonClickListener;
+
+public class CreateDialog {
+
+ /**
+ * Create Dialog class.
+ * Created by Saad Ahmed on 17-May-2022.
+ * A class which creates many kind of dialogs which you can modify easily.
+ */
+
+ @SuppressLint("StaticFieldLeak")
+ private static CreateDialog instance = null;
+ private final Context context;
+ private final Styles style;
+ private final Dialog dialog;
+ private String heading, description, positiveButtonText, negativeButtonText, dismissButtonText, lottieFile;
+ private boolean cancelable = true;
+ @ColorInt
+ @Nullable
+ private Integer tint;
+ @Nullable
+ private Integer lottieRepeatCount;
+ @Nullable
+ private Float lottieAnimationSpeed;
+ @Nullable
+ private Long progressDialogTimeout;
+ @RawRes
+ @Nullable
+ private Integer lottieRaw;
+ @ColorRes
+ @Nullable
+ private Integer positiveButtonTextColor, negativeButtonTextColor, dismissButtonTextColor, headingTextColor, descriptionTextColor, iconTint;
+ @DrawableRes
+ @Nullable
+ private Integer icon, dialogBackground, positiveButtonBackground, negativeButtonBackground, dismissButtonBackground;
+
+ /**
+ * Private constructor of create dialog class
+ * @param context is required for some use cases
+ * @param style is required to create the dialog
+ * @param dialog is required to modify it
+ */
+
+ private CreateDialog(Context context, Styles style, Dialog dialog) {
+ this.context = context;
+ this.style = style;
+ this.dialog = dialog;
+ }
+
+ /**
+ * Static function to get instance of create dialog class
+ * @param context is required to create instance of create dialog class
+ * @param style is required to create the dialog
+ * @param dialog is required to modify it later
+ * @return instance of create dialog class
+ */
+
+ public static CreateDialog getInstance(Context context, Styles style, Dialog dialog) {
+ if (instance == null) {
+ instance = new CreateDialog(context, style, dialog);
+ }
+ return instance;
+ }
+
+ /**
+ * Heading will be shown as dialog heading
+ * @param heading is not required. The dialog heading will be blank if the heading become null
+ * @return instance of create dialog class
+ */
+
+ public CreateDialog setHeading(String heading) {
+ this.heading = heading;
+ return instance;
+ }
+
+ /**
+ * Description will be shown as dialog description
+ * @param description is not required. The dialog description will be blank if the description become null
+ * @return instance of create dialog class
+ */
+
+ public CreateDialog setDescription(String description) {
+ this.description = description;
+ return instance;
+ }
+
+ /**
+ * This String will be shown as positive button text
+ * @param positiveButtonText is not required. If it become null then the default value "Submit" will be shown as positive button text
+ * @return instance of create dialog class
+ */
+
+ public CreateDialog setPositiveButtonText(String positiveButtonText) {
+ this.positiveButtonText = positiveButtonText;
+ return instance;
+ }
+
+ /**
+ * This String will be shown as negative button text
+ * @param negativeButtonText is not required. If it become null then the default value "Cancel" will be shown as negative button text
+ * @return instance of create dialog class
+ */
+
+ public CreateDialog setNegativeButtonText(String negativeButtonText) {
+ this.negativeButtonText = negativeButtonText;
+ return instance;
+ }
+
+ /**
+ * This String will be shown as dismiss button text
+ * @param dismissButtonText is not required. If it become null then the default value "Dismiss" will be shown as dismiss button text
+ * @return instance of create dialog class
+ */
+
+ public CreateDialog setDismissButtonText(String dismissButtonText) {
+ this.dismissButtonText = dismissButtonText;
+ return instance;
+ }
+
+ /**
+ * This color will be shown as positive button text color
+ * @param color is not required. If it become null then the default color "#FFFFFF" will be shown as positive button text color
+ * @return instance of create dialog class
+ */
+
+ public CreateDialog setPositiveButtonTextColor(@ColorRes int color) {
+ this.positiveButtonTextColor = color;
+ return instance;
+ }
+
+ /**
+ * This color will be shown as negative button text color
+ * @param color is not required. If it become null then the default color "#FFFFFF" will be shown as negative button text color
+ * @return instance of create dialog class
+ */
+
+ public CreateDialog setNegativeButtonTextColor(@ColorRes int color) {
+ this.negativeButtonTextColor = color;
+ return instance;
+ }
+
+ /**
+ * This color will be shown as dismiss button text color
+ * @param color is not required. If it become null then the default color "#202020" will be shown as dismiss button text color
+ * @return instance of create dialog class
+ */
+
+ public CreateDialog setDismissButtonTextColor(@ColorRes int color) {
+ this.dismissButtonTextColor = color;
+ return instance;
+ }
+
+ /**
+ * This background will be shown as positive button background
+ * @param background is not required. If it become null then the default background "bg_blue_10" will be shown as positive button background
+ * @return instance of create dialog class
+ */
+
+ public CreateDialog setPositiveButtonBackground(@DrawableRes int background) {
+ this.positiveButtonBackground = background;
+ return instance;
+ }
+
+ /**
+ * This background will be shown as negative button background
+ * @param background is not required. If it become null then the default background "bg_light_grey_10" will be shown as negative button background
+ * @return instance of create dialog class
+ */
+
+ public CreateDialog setNegativeButtonBackground(@DrawableRes int background) {
+ this.negativeButtonBackground = background;
+ return instance;
+ }
+
+ /**
+ * This background will be shown as dismiss button background
+ * @param background is not required. If it become null then the default background "bg_dark_grey_10" will be shown as dismiss button background
+ * @return instance of create dialog class
+ */
+
+ public CreateDialog setDismissButtonBackground(@DrawableRes int background) {
+ this.dismissButtonBackground = background;
+ return instance;
+ }
+
+ /**
+ * This icon will be shown as standard dialog icon
+ * @param icon is required. If it become null then the default icon "ic_home" will be shown as standard dialog icon
+ * @return instance of create dialog class
+ */
+
+ public CreateDialog setPopupDialogIcon(@DrawableRes int icon) {
+ this.icon = icon;
+ return instance;
+ }
+
+ /**
+ * This icon tint will be shown as standard dialog icon color
+ * @param iconTint is required. If it become null then the default color "#000000" will be shown as standard dialog icon color
+ * @return instance of create dialog class
+ */
+
+ public CreateDialog setPopupDialogIconTint(@ColorRes int iconTint) {
+ this.iconTint = iconTint;
+ return instance;
+ }
+
+ /**
+ * This cancelable is a boolean defines the is is cancelable or not while touching outside
+ * @param cancelable is not required. If it become null then the default value "true" will be defined as cancelable
+ * @return instance of create dialog class
+ */
+
+ public CreateDialog setCancelable(boolean cancelable) {
+ this.cancelable = cancelable;
+ this.dialog.setCancelable(cancelable);
+ return instance;
+ }
+
+ /**
+ * This color will be shown as heading text color
+ * @param color is not required. If it become null then the default color "#202020" will be shown as heading text color
+ * @return instance of create dialog class
+ */
+
+ public CreateDialog setHeadingTextColor(@ColorRes int color) {
+ this.headingTextColor = color;
+ return instance;
+ }
+
+ /**
+ * This color will be shown as description text color
+ * @param color is not required. If it become null then the default color "#202020" will be shown as description text color
+ * @return instance of create dialog class
+ */
+
+ public CreateDialog setDescriptionTextColor(@ColorRes int color) {
+ this.descriptionTextColor = color;
+ return instance;
+ }
+
+ /**
+ * This background will be shown as the dialog parent layout background
+ * @param background is not required. If it become null then the default background "bg_white_10" will be shown as dialog parent layout background
+ * @return instance of create dialog class
+ */
+
+ public CreateDialog setDialogBackground(@DrawableRes int background) {
+ this.dialogBackground = background;
+ return instance;
+ }
+
+ /**
+ * This color will be shown as the progress dialog tint
+ * @param tint is not required. If it become null then the default color "#215C5C" will be shown as progress dialog tint
+ * @return instance of create dialog class
+ */
+
+ public CreateDialog setProgressDialogTint(@ColorInt int tint) {
+ this.tint = tint;
+ return instance;
+ }
+
+ /**
+ * Dialog will be closed after the timeout
+ * @param seconds is not required. If it become null then the dialog will not close automatically
+ * @return instance of create dialog class
+ */
+
+ public CreateDialog setTimeout(long seconds) {
+ new Handler().postDelayed(dialog::dismiss, seconds * 1000);
+ return instance;
+ }
+
+ /**
+ * This asset name will be the lottie animation name in asset folder
+ * @param assetName or rawRes is required. If it become null then the lottie animation progress bar will not show
+ * @return instance of create dialog class
+ */
+
+ public CreateDialog setLottieAssetName(String assetName) {
+ this.lottieFile = assetName;
+ return instance;
+ }
+
+ /**
+ * This rawRes will be the lottie animation resource in raw folder
+ * @param rawRes or assetName is required. If it become null then the lottie animation progress bar will not show
+ * @return instance of create dialog class
+ */
+
+ public CreateDialog setLottieRawRes(@RawRes int rawRes) {
+ this.lottieRaw = rawRes;
+ return instance;
+ }
+
+ /**
+ * This repeatCount will define how many times will the animation become repeated
+ * @param repeatCount is not required. If it become null then the lottie animation will be played only once
+ * @return instance of create dialog class
+ */
+
+ public CreateDialog setLottieRepeatCount(int repeatCount) {
+ this.lottieRepeatCount = repeatCount;
+ return instance;
+ }
+
+ /**
+ * This speed will define how much speed of the animation animate will be
+ * @param speed is not required. If it become null then the lottie animation will animate with it's default speed
+ * @return instance of create dialog class
+ */
+
+ public CreateDialog setLottieAnimationSpeed(float speed) {
+ this.lottieAnimationSpeed = speed;
+ return instance;
+ }
+
+ /**
+ * This timeout defines how much time will the dialog be visible
+ * @param seconds is not required. If it become null then the progress of lottie progress dialog will not close by itself
+ * @return instance of create dialog class
+ */
+
+ public CreateDialog setLottieDialogTimeout(long seconds) {
+ this.progressDialogTimeout = seconds;
+ return instance;
+ }
+
+ /**
+ * This function will show the progress dialogs [Styles.PROGRESS or Styles.LOTTIE_ANIMATION]
+ */
+
+ public void showDialog() {
+ switch (style) {
+ case PROGRESS: {
+ showProgressDialog(R.layout.dialog_progress);
+ break;
+ }
+ case LOTTIE_ANIMATION: {
+ showProgressDialog(R.layout.dialog_lottie);
+ break;
+ }
+ }
+ }
+
+ /**
+ * This function will show the popup dialogs [Styles.SUCCESS or Styles.IOS or Styles.STANDARD etc.]
+ * @param listener is required to get the callback on positive or negative or dismiss button clicked
+ */
+
+ public void showDialog(OnDialogButtonClickListener listener) {
+ switch (style) {
+ case ANDROID_DEFAULT: {
+ showAlertDialog(listener);
+ break;
+ }
+ case IOS: {
+ dialogStyleOne(R.layout.dialog_ios, listener);
+ show();
+ break;
+ }
+ case STANDARD: {
+ dialogStyleTwo(R.layout.dialog_standard, listener);
+ show();
+ break;
+ }
+ case SUCCESS: {
+ dialogStyleThree(Styles.SUCCESS, listener);
+ show();
+ break;
+ }
+ case FAILED: {
+ dialogStyleThree(Styles.FAILED, listener);
+ show();
+ break;
+ }
+ case ALERT: {
+ dialogStyleThree(Styles.ALERT, listener);
+ show();
+ break;
+ }
+ }
+ }
+
+ /**
+ * This is a private function will show the dialog it it's not showing
+ */
+
+ private void show() {
+ if (!dialog.isShowing()) {
+ instance = null;
+ dialog.show();
+ }
+ }
+
+ /**
+ * This is a type function of progress dialogs only. e.g: Default of Lottie
+ * @param layout is required for the dialog content view
+ */
+
+ private void showProgressDialog(@LayoutRes int layout) {
+ setContentView(layout);
+ if (tint != null && style == Styles.PROGRESS) {
+ ProgressBar progressBar = dialog.findViewById(R.id.progress_bar);
+ progressBar.getIndeterminateDrawable().setColorFilter(tint, PorterDuff.Mode.SRC_IN);
+ }
+ if (style == Styles.LOTTIE_ANIMATION) {
+ LottieAnimationView lottieAnimation = dialog.findViewById(R.id.lottie_animation_view);
+ if (lottieFile != null) {
+ lottieAnimation.setAnimation(lottieFile);
+ }
+ if (lottieRaw != null) {
+ lottieAnimation.setAnimation(lottieRaw);
+ }
+ if (lottieRepeatCount != null) {
+ lottieAnimation.setRepeatMode(lottieRepeatCount);
+ }
+ if (lottieAnimationSpeed != null) {
+ lottieAnimation.setSpeed(lottieAnimationSpeed);
+ }
+ }
+ if (progressDialogTimeout != null) {
+ new Handler().postDelayed(dialog::dismiss, progressDialogTimeout);
+ }
+ dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
+ show();
+ }
+
+ /**
+ * This function will show the android default alert dialog
+ * @param listener is required to get the callback on positive or negative button clicked
+ */
+
+ private void showAlertDialog(OnDialogButtonClickListener listener) {
+ AlertDialog.Builder alertDialog = new AlertDialog.Builder(context)
+ .setTitle(heading)
+ .setMessage(description)
+ .setPositiveButton(positiveButtonText == null ? "Submit" : positiveButtonText, (dialogInterface, i) -> listener.onPositiveClicked(dialog))
+ .setNegativeButton(negativeButtonText == null ? "Cancel" : negativeButtonText, ((dialogInterface, i) -> listener.onNegativeClicked(dialog)));
+ alertDialog.setCancelable(cancelable);
+ alertDialog.show();
+ }
+
+ /**
+ * This a type function of popup dialogs without any kind of icon
+ * @param layout is required for the dialog content view
+ * @param listener is required to get the callback on positive or negative or dismiss button clicked
+ */
+
+ private void dialogStyleOne(@LayoutRes int layout, OnDialogButtonClickListener listener) {
+ setContentView(layout);
+ TextView heading, description, btnNegative, btnPositive;
+ ConstraintLayout root;
+
+ root = dialog.findViewById(R.id.root_layout);
+ heading = dialog.findViewById(R.id.tv_heading);
+ description = dialog.findViewById(R.id.tv_description);
+ btnNegative = dialog.findViewById(R.id.btn_negative);
+ btnPositive = dialog.findViewById(R.id.btn_positive);
+
+ if (this.heading != null) {
+ heading.setText(this.heading);
+ }
+ if (this.description != null) {
+ description.setText(this.description);
+ }
+ if (dialogBackground != null) {
+ root.setBackgroundResource(dialogBackground);
+ }
+ if (positiveButtonText != null) {
+ btnPositive.setText(positiveButtonText);
+ }
+ if (negativeButtonText != null) {
+ btnNegative.setText(negativeButtonText);
+ }
+ if (positiveButtonTextColor != null) {
+ btnPositive.setTextColor(ContextCompat.getColor(context, positiveButtonTextColor));
+ }
+ if (negativeButtonTextColor != null) {
+ btnNegative.setTextColor(ContextCompat.getColor(context, negativeButtonTextColor));
+ }
+ if (positiveButtonBackground != null) {
+ btnPositive.setBackgroundResource(positiveButtonBackground);
+ }
+ if (negativeButtonBackground != null) {
+ btnNegative.setBackgroundResource(negativeButtonBackground);
+ }
+ if (headingTextColor != null) {
+ heading.setTextColor(ContextCompat.getColor(context, headingTextColor));
+ }
+ if (descriptionTextColor != null) {
+ description.setTextColor(ContextCompat.getColor(context, descriptionTextColor));
+ }
+
+ btnPositive.setOnClickListener(view -> listener.onPositiveClicked(dialog));
+ btnNegative.setOnClickListener(view -> listener.onNegativeClicked(dialog));
+
+ dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
+ }
+
+ /**
+ * This a type function of popup dialogs with any kind of icon
+ * @param layout is required for the dialog content view
+ * @param listener is required to get the callback on positive or negative or dismiss button clicked
+ */
+
+ private void dialogStyleTwo(@LayoutRes int layout, OnDialogButtonClickListener listener) {
+ dialogStyleOne(layout, listener);
+ ImageView icon = dialog.findViewById(R.id.iv_icon);
+
+ if (this.icon != null) {
+ icon.setImageResource(this.icon);
+ }
+ if (this.iconTint != null) {
+ icon.setColorFilter(ContextCompat.getColor(context, iconTint), android.graphics.PorterDuff.Mode.SRC_IN);
+ }
+ }
+
+ /**
+ * This a type function of popup dialogs with lottie animation icon
+ * @param style is to create the dialog
+ * @param listener is required to get the callback on positive or negative or dismiss button clicked
+ */
+
+ private void dialogStyleThree(Styles style, OnDialogButtonClickListener listener) {
+ setContentView(R.layout.dialog_success_failed_alert);
+
+ LottieAnimationView icon = dialog.findViewById(R.id.lottie_icon);
+ ConstraintLayout root = dialog.findViewById(R.id.root_layout);
+ TextView heading, description, btnDismiss;
+ heading = dialog.findViewById(R.id.tv_heading);
+ description = dialog.findViewById(R.id.tv_description);
+ btnDismiss = dialog.findViewById(R.id.btn_dismiss);
+
+ btnDismiss.setOnClickListener(view -> listener.onDismissClicked(dialog));
+
+ if (this.heading != null) {
+ heading.setText(this.heading);
+ }
+ if (this.description != null) {
+ description.setText(this.description);
+ }
+ if (dialogBackground != null) {
+ root.setBackgroundResource(dialogBackground);
+ }
+ if (dismissButtonText != null) {
+ btnDismiss.setText(dismissButtonText);
+ }
+ if (dismissButtonTextColor != null) {
+ btnDismiss.setTextColor(ContextCompat.getColor(context, dismissButtonTextColor));
+ }
+ if (headingTextColor != null) {
+ heading.setTextColor(ContextCompat.getColor(context, headingTextColor));
+ }
+ if (descriptionTextColor != null) {
+ description.setTextColor(ContextCompat.getColor(context, descriptionTextColor));
+ }
+
+ switch (style) {
+ case SUCCESS: {
+ icon.setAnimation(R.raw.success);
+ btnDismiss.setBackgroundResource(R.drawable.ripple_bg_dark_grey_10);
+ break;
+ }
+ case FAILED: {
+ icon.setAnimation(R.raw.failed);
+ btnDismiss.setBackgroundResource(R.drawable.ripple_bg_red_10);
+ break;
+ }
+ case ALERT: {
+ icon.setAnimation(R.raw.warning);
+ if (dismissButtonTextColor == null) btnDismiss.setTextColor(ContextCompat.getColor(context, R.color.colorDarkGrey));
+ btnDismiss.setBackgroundResource(R.drawable.ripple_bg_yellow_10);
+ break;
+ }
+ }
+
+ if (dismissButtonBackground != null) {
+ btnDismiss.setBackgroundResource(dismissButtonBackground);
+ }
+
+ dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
+ }
+
+ /**
+ * This function will set the layout content to the dialog
+ * @param layout is required to set the content view in dialog
+ */
+
+ private void setContentView(@LayoutRes int layout) {
+ dialog.setContentView(layout);
+ }
+}
diff --git a/popupDialog/src/main/java/com/saadahmedsoft/popupdialog/PopupDialog.java b/popupDialog/src/main/java/com/saadahmedsoft/popupdialog/PopupDialog.java
new file mode 100644
index 0000000..d220944
--- /dev/null
+++ b/popupDialog/src/main/java/com/saadahmedsoft/popupdialog/PopupDialog.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2022 Saad Ahmed
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.saadahmedsoft.popupdialog;
+
+import android.annotation.SuppressLint;
+import android.app.Dialog;
+import android.content.Context;
+
+import androidx.annotation.Nullable;
+
+public class PopupDialog {
+
+ /**
+ * Popup Dialog class.
+ * Created by Saad Ahmed on 17-May-2022.
+ * Github: https://github.com/saadahmedscse/Android-Popup-Dialog
+ * A custom android popup dialog library which provides you a lot of popup dialog and progress dialog with and without animation
+ */
+
+ @Nullable
+ private final Dialog dialog;
+ private final Context context;
+ @SuppressLint("StaticFieldLeak")
+ private static PopupDialog instance = null;
+
+ /**
+ * Private constructor of popup dialog
+ * @param context is required to create instance of dialog
+ */
+
+ private PopupDialog(Context context) {
+ this.context = context;
+ dialog = new Dialog(context);
+ }
+
+ /**
+ * Static function to get instance of popup dialog class
+ * @param context is required to create instance of popup dialog class
+ * @return instance of popup dialog class
+ */
+
+ public static PopupDialog getInstance(Context context) {
+ if (instance == null) {
+ instance = new PopupDialog(context);
+ }
+ return instance;
+ }
+
+ /**
+ * setStyle function will set the style which you want
+ * @param style is required to create instance of create dialog class
+ * @return instance of create dialog class
+ */
+
+ public CreateDialog setStyle(Styles style) {
+ instance = null;
+ return CreateDialog.getInstance(context, style, dialog);
+ }
+
+ /**
+ * Dismiss the dialog if it is showing
+ */
+
+ public void dismissDialog() {
+ if (dialog != null && dialog.isShowing()) {
+ dialog.dismiss();
+ }
+ }
+}
diff --git a/popupDialog/src/main/java/com/saadahmedsoft/popupdialog/Styles.java b/popupDialog/src/main/java/com/saadahmedsoft/popupdialog/Styles.java
new file mode 100644
index 0000000..3b76918
--- /dev/null
+++ b/popupDialog/src/main/java/com/saadahmedsoft/popupdialog/Styles.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2022 Saad Ahmed
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.saadahmedsoft.popupdialog;
+
+/**
+ * Dialog Style Enum.
+ * Created by Saad Ahmed on 17-Oct-2022.
+ * This enum will give user's a lot of styles to be implemented
+ */
+
+public enum Styles {
+ PROGRESS, IOS, ANDROID_DEFAULT, STANDARD, LOTTIE_ANIMATION, SUCCESS, FAILED, ALERT
+}
diff --git a/popupDialog/src/main/java/com/saadahmedsoft/popupdialog/listener/OnDialogButtonClickListener.java b/popupDialog/src/main/java/com/saadahmedsoft/popupdialog/listener/OnDialogButtonClickListener.java
new file mode 100644
index 0000000..ef4d610
--- /dev/null
+++ b/popupDialog/src/main/java/com/saadahmedsoft/popupdialog/listener/OnDialogButtonClickListener.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2022 Saad Ahmed
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.saadahmedsoft.popupdialog.listener;
+
+import android.app.Dialog;
+
+/**
+ * Dialog Button Click Callback Class.
+ * Created by Saad Ahmed on 17-Oct-2022.
+ * This abstract class will give user's a callback of dialog button click
+ */
+
+public abstract class OnDialogButtonClickListener {
+ public void onPositiveClicked(Dialog dialog) {
+ dismiss(dialog);
+ }
+ public void onNegativeClicked(Dialog dialog) {
+ dismiss(dialog);
+ }
+ public void onDismissClicked(Dialog dialog) {
+ dialog.dismiss();
+ }
+
+ /**
+ * Dismiss the dialog by default on method call using super keyword
+ * @param dialog is required to check if nonnull and isShowing
+ */
+
+ private void dismiss(Dialog dialog) {
+ if (dialog != null && dialog.isShowing()) {
+ dialog.dismiss();
+ }
+ }
+}
diff --git a/popupDialog/src/main/res/drawable/bg_blue_10.xml b/popupDialog/src/main/res/drawable/bg_blue_10.xml
new file mode 100644
index 0000000..b5b99bb
--- /dev/null
+++ b/popupDialog/src/main/res/drawable/bg_blue_10.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/popupDialog/src/main/res/drawable/bg_dark_grey_10.xml b/popupDialog/src/main/res/drawable/bg_dark_grey_10.xml
new file mode 100644
index 0000000..747b86f
--- /dev/null
+++ b/popupDialog/src/main/res/drawable/bg_dark_grey_10.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/popupDialog/src/main/res/drawable/bg_light_grey_10.xml b/popupDialog/src/main/res/drawable/bg_light_grey_10.xml
new file mode 100644
index 0000000..5350340
--- /dev/null
+++ b/popupDialog/src/main/res/drawable/bg_light_grey_10.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/popupDialog/src/main/res/drawable/bg_red_10.xml b/popupDialog/src/main/res/drawable/bg_red_10.xml
new file mode 100644
index 0000000..1e95f19
--- /dev/null
+++ b/popupDialog/src/main/res/drawable/bg_red_10.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/popupDialog/src/main/res/drawable/bg_white_10.xml b/popupDialog/src/main/res/drawable/bg_white_10.xml
new file mode 100644
index 0000000..c5df582
--- /dev/null
+++ b/popupDialog/src/main/res/drawable/bg_white_10.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/popupDialog/src/main/res/drawable/bg_yellow_10.xml b/popupDialog/src/main/res/drawable/bg_yellow_10.xml
new file mode 100644
index 0000000..f7d5775
--- /dev/null
+++ b/popupDialog/src/main/res/drawable/bg_yellow_10.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/popupDialog/src/main/res/drawable/ic_home.png b/popupDialog/src/main/res/drawable/ic_home.png
new file mode 100644
index 0000000..6ca2f97
Binary files /dev/null and b/popupDialog/src/main/res/drawable/ic_home.png differ
diff --git a/popupDialog/src/main/res/drawable/ripple_bg_blue_10.xml b/popupDialog/src/main/res/drawable/ripple_bg_blue_10.xml
new file mode 100644
index 0000000..9c32643
--- /dev/null
+++ b/popupDialog/src/main/res/drawable/ripple_bg_blue_10.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/popupDialog/src/main/res/drawable/ripple_bg_dark_grey_10.xml b/popupDialog/src/main/res/drawable/ripple_bg_dark_grey_10.xml
new file mode 100644
index 0000000..b3fba7c
--- /dev/null
+++ b/popupDialog/src/main/res/drawable/ripple_bg_dark_grey_10.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/popupDialog/src/main/res/drawable/ripple_bg_light_grey_10.xml b/popupDialog/src/main/res/drawable/ripple_bg_light_grey_10.xml
new file mode 100644
index 0000000..72bd66d
--- /dev/null
+++ b/popupDialog/src/main/res/drawable/ripple_bg_light_grey_10.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/popupDialog/src/main/res/drawable/ripple_bg_red_10.xml b/popupDialog/src/main/res/drawable/ripple_bg_red_10.xml
new file mode 100644
index 0000000..6958e3c
--- /dev/null
+++ b/popupDialog/src/main/res/drawable/ripple_bg_red_10.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/popupDialog/src/main/res/drawable/ripple_bg_white_10.xml b/popupDialog/src/main/res/drawable/ripple_bg_white_10.xml
new file mode 100644
index 0000000..7b60691
--- /dev/null
+++ b/popupDialog/src/main/res/drawable/ripple_bg_white_10.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/popupDialog/src/main/res/drawable/ripple_bg_yellow_10.xml b/popupDialog/src/main/res/drawable/ripple_bg_yellow_10.xml
new file mode 100644
index 0000000..b4d6445
--- /dev/null
+++ b/popupDialog/src/main/res/drawable/ripple_bg_yellow_10.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/popupDialog/src/main/res/font/bold.ttf b/popupDialog/src/main/res/font/bold.ttf
new file mode 100644
index 0000000..43da14d
Binary files /dev/null and b/popupDialog/src/main/res/font/bold.ttf differ
diff --git a/popupDialog/src/main/res/font/koho.ttf b/popupDialog/src/main/res/font/koho.ttf
new file mode 100644
index 0000000..78e04aa
Binary files /dev/null and b/popupDialog/src/main/res/font/koho.ttf differ
diff --git a/popupDialog/src/main/res/font/koho_bold.ttf b/popupDialog/src/main/res/font/koho_bold.ttf
new file mode 100644
index 0000000..a0123f5
Binary files /dev/null and b/popupDialog/src/main/res/font/koho_bold.ttf differ
diff --git a/popupDialog/src/main/res/font/koho_italic.ttf b/popupDialog/src/main/res/font/koho_italic.ttf
new file mode 100644
index 0000000..e6cf346
Binary files /dev/null and b/popupDialog/src/main/res/font/koho_italic.ttf differ
diff --git a/popupDialog/src/main/res/font/medium.ttf b/popupDialog/src/main/res/font/medium.ttf
new file mode 100644
index 0000000..ac0f908
Binary files /dev/null and b/popupDialog/src/main/res/font/medium.ttf differ
diff --git a/popupDialog/src/main/res/font/regular.ttf b/popupDialog/src/main/res/font/regular.ttf
new file mode 100644
index 0000000..ddf4bfa
Binary files /dev/null and b/popupDialog/src/main/res/font/regular.ttf differ
diff --git a/popupDialog/src/main/res/layout/dialog_ios.xml b/popupDialog/src/main/res/layout/dialog_ios.xml
new file mode 100644
index 0000000..023e70b
--- /dev/null
+++ b/popupDialog/src/main/res/layout/dialog_ios.xml
@@ -0,0 +1,84 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/popupDialog/src/main/res/layout/dialog_lottie.xml b/popupDialog/src/main/res/layout/dialog_lottie.xml
new file mode 100644
index 0000000..be64a93
--- /dev/null
+++ b/popupDialog/src/main/res/layout/dialog_lottie.xml
@@ -0,0 +1,8 @@
+
+
\ No newline at end of file
diff --git a/popupDialog/src/main/res/layout/dialog_progress.xml b/popupDialog/src/main/res/layout/dialog_progress.xml
new file mode 100644
index 0000000..767476a
--- /dev/null
+++ b/popupDialog/src/main/res/layout/dialog_progress.xml
@@ -0,0 +1,5 @@
+
+
\ No newline at end of file
diff --git a/popupDialog/src/main/res/layout/dialog_standard.xml b/popupDialog/src/main/res/layout/dialog_standard.xml
new file mode 100644
index 0000000..c79a7b6
--- /dev/null
+++ b/popupDialog/src/main/res/layout/dialog_standard.xml
@@ -0,0 +1,86 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/popupDialog/src/main/res/layout/dialog_success_failed_alert.xml b/popupDialog/src/main/res/layout/dialog_success_failed_alert.xml
new file mode 100644
index 0000000..f6025af
--- /dev/null
+++ b/popupDialog/src/main/res/layout/dialog_success_failed_alert.xml
@@ -0,0 +1,58 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/popupDialog/src/main/res/raw/failed.json b/popupDialog/src/main/res/raw/failed.json
new file mode 100644
index 0000000..48ca35f
--- /dev/null
+++ b/popupDialog/src/main/res/raw/failed.json
@@ -0,0 +1 @@
+{"v":"5.5.7","meta":{"g":"LottieFiles AE 0.1.21","a":"Keikhosrow HN","k":"","d":"Vatandar","tc":""},"fr":60,"ip":0,"op":81,"w":128,"h":128,"nm":"Error","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Error Icon","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[63,64,0],"ix":2},"a":{"a":0,"k":[48,48,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[13,13],[-33.141,-33.313]],"c":false},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"tm","s":{"a":1,"k":[{"i":{"x":[0.11],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":-1.953,"s":[100]},{"t":32.080078125,"s":[0]}],"ix":1},"e":{"a":1,"k":[{"i":{"x":[0.11],"y":[1]},"o":{"x":[0.333],"y":[0]},"t":6.055,"s":[100]},{"t":40.087890625,"s":[56]}],"ix":2},"o":{"a":0,"k":0,"ix":3},"m":1,"ix":2,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim","hd":false},{"ty":"st","c":{"a":0,"k":[1,0.16862745098,0.16862745098,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":6,"ix":5},"lc":2,"lj":2,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[48.5,48.5],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Line 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[-13,13],[13,-13]],"c":false},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"tm","s":{"a":1,"k":[{"i":{"x":[0.11],"y":[1]},"o":{"x":[0.13],"y":[0]},"t":32.08,"s":[100]},{"t":76.125,"s":[0]}],"ix":1},"e":{"a":0,"k":100,"ix":2},"o":{"a":0,"k":0,"ix":3},"m":1,"ix":2,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim","hd":false},{"ty":"st","c":{"a":0,"k":[1,0.16862745098,0.16862745098,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":5,"ix":5},"lc":2,"lj":2,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[48.5,48.5],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Line 2","np":3,"cix":2,"bm":0,"ix":2,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[25.571,0],[0,-25.572],[-25.572,0],[0,25.571]],"o":[[-25.572,0],[0,25.571],[25.571,0],[0,-25.572]],"v":[[0,-46.5],[-46.5,0],[0,46.5],[46.5,0]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[1,0.16862745098,0.16862745098,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":6,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[48,48],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Circle","np":2,"cix":2,"bm":0,"ix":3,"mn":"ADBE Vector Group","hd":false}],"ip":-48,"op":84,"st":-48,"bm":0}],"markers":[]}
\ No newline at end of file
diff --git a/popupDialog/src/main/res/raw/success.json b/popupDialog/src/main/res/raw/success.json
new file mode 100644
index 0000000..dfe9a1a
--- /dev/null
+++ b/popupDialog/src/main/res/raw/success.json
@@ -0,0 +1 @@
+{"v":"5.7.5","fr":60,"ip":0,"op":90,"w":64,"h":64,"nm":"check","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"check","sr":1,"ks":{"o":{"a":0,"k":100},"r":{"a":0,"k":0},"p":{"a":0,"k":[32,32,0]},"a":{"a":0,"k":[0,0,0]},"s":{"a":0,"k":[33.333,33.333,100]}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ks":{"a":0,"k":{"i":[[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0]],"v":[[9.25,-6],[-2.75,6],[-9.25,-0.5]],"c":false}},"nm":"Path 1","hd":false},{"ty":"tm","s":{"a":1,"k":[{"i":{"x":[0.461],"y":[1]},"o":{"x":[0.466],"y":[0]},"t":44,"s":[100]},{"t":90,"s":[0]}]},"e":{"a":0,"k":100},"o":{"a":0,"k":0},"m":1,"nm":"Trim Paths 1","hd":false},{"ty":"st","c":{"a":0,"k":[0.119997918606,0.750781238079,0.458097785711,1]},"o":{"a":0,"k":100},"w":{"a":0,"k":3},"lc":2,"lj":2,"bm":0,"nm":"Stroke 1","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0]},"a":{"a":0,"k":[0,0]},"s":{"a":0,"k":[350,350]},"r":{"a":0,"k":0},"o":{"a":0,"k":100},"sk":{"a":0,"k":0},"sa":{"a":0,"k":0},"nm":"Transform"}],"nm":"check","bm":0,"hd":false}],"ip":0,"op":90,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"circle","sr":1,"ks":{"o":{"a":0,"k":100},"r":{"a":0,"k":0},"p":{"a":0,"k":[32,32,0]},"a":{"a":0,"k":[0,0,0]},"s":{"a":0,"k":[33.333,33.333,100]}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[53,53]},"p":{"a":0,"k":[0,0]},"nm":"Ellipse Path 1","hd":false},{"ty":"tm","s":{"a":0,"k":0},"e":{"a":1,"k":[{"i":{"x":[0.34],"y":[1]},"o":{"x":[0.66],"y":[0]},"t":0,"s":[0]},{"t":77,"s":[100]}]},"o":{"a":1,"k":[{"i":{"x":[0.34],"y":[1]},"o":{"x":[0.66],"y":[0]},"t":0,"s":[-360]},{"t":77,"s":[0]}]},"m":1,"nm":"Trim Paths 1","hd":false},{"ty":"st","c":{"a":0,"k":[0.119997918606,0.750781238079,0.458097785711,1]},"o":{"a":0,"k":100},"w":{"a":0,"k":3},"lc":2,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0]},"a":{"a":0,"k":[0,0]},"s":{"a":0,"k":[300,300]},"r":{"a":0,"k":0},"o":{"a":0,"k":100},"sk":{"a":0,"k":0},"sa":{"a":0,"k":0},"nm":"Transform"}],"nm":"circle","bm":0,"hd":false}],"ip":0,"op":90,"st":0,"bm":0}],"markers":[]}
\ No newline at end of file
diff --git a/popupDialog/src/main/res/raw/warning.json b/popupDialog/src/main/res/raw/warning.json
new file mode 100644
index 0000000..a75246e
--- /dev/null
+++ b/popupDialog/src/main/res/raw/warning.json
@@ -0,0 +1 @@
+{"v":"4.8.0","meta":{"g":"LottieFiles AE ","a":"","k":"","d":"","tc":""},"fr":30,"ip":0,"op":150,"w":512,"h":512,"nm":"Comp 1","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Shape Layer 6","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[256,362,0],"ix":2},"a":{"a":0,"k":[-0.5,-34,0],"ix":1},"s":{"a":0,"k":[100,18.269,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[-0.5,-125],[-0.5,57]],"c":false},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[1,0.717647075653,0,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":34,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[0.049412001815,0.35867100136,0.741175991881,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Shape 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"tm","s":{"a":0,"k":0,"ix":1},"e":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":13,"s":[0]},{"t":16,"s":[100]}],"ix":2},"o":{"a":0,"k":0,"ix":3},"m":1,"ix":2,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim","hd":false}],"ip":0,"op":150,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"Shape Layer 5","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[256.5,256,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[-0.5,-125],[-0.5,57]],"c":false},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[1,0.717647075653,0,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":34,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[0.049412001815,0.35867100136,0.741175991881,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Shape 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"tm","s":{"a":0,"k":0,"ix":1},"e":{"a":1,"k":[{"i":{"x":[0.7],"y":[0.445]},"o":{"x":[0.523],"y":[0.081]},"t":3,"s":[0]},{"t":12,"s":[100]}],"ix":2},"o":{"a":0,"k":0,"ix":3},"m":1,"ix":2,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim","hd":false}],"ip":0,"op":150,"st":0,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"Shape Layer 1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.651],"y":[-0.002]},"t":0,"s":[360]},{"t":29,"s":[0]}],"ix":10},"p":{"a":0,"k":[256,255.999,0],"ix":2},"a":{"a":0,"k":[9.5,8.499,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[447,447],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"tm","s":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[100]},{"t":29,"s":[0]}],"ix":1},"e":{"a":0,"k":100,"ix":2},"o":{"a":0,"k":146,"ix":3},"m":1,"ix":2,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim","hd":false},{"ty":"st","c":{"a":0,"k":[1,0.717647075653,0,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":34,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[9.5,8.5],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":4,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":150,"st":0,"bm":0}],"markers":[]}
\ No newline at end of file
diff --git a/popupDialog/src/main/res/values/colors.xml b/popupDialog/src/main/res/values/colors.xml
new file mode 100644
index 0000000..2da1e6f
--- /dev/null
+++ b/popupDialog/src/main/res/values/colors.xml
@@ -0,0 +1,21 @@
+
+
+ #FFFFFF
+ #000000
+ #777777
+ #E6E6E6
+ #202020
+
+ #215C5C
+ #FFFFFF
+ #5E5E5E
+ #000000
+ #00000000
+
+ #226DFF
+ #00FF7F
+ #7500FF7F
+ #FF9246
+ #FFEE4D
+ #FF1616
+
\ No newline at end of file
diff --git a/popupDialog/src/main/res/values/strings.xml b/popupDialog/src/main/res/values/strings.xml
new file mode 100644
index 0000000..e27b467
--- /dev/null
+++ b/popupDialog/src/main/res/values/strings.xml
@@ -0,0 +1,6 @@
+
+
+ Submit
+ Cancel
+ Dismiss
+
\ No newline at end of file
diff --git a/settings.gradle b/settings.gradle
index fd51f10..d517b63 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -16,3 +16,6 @@ dependencyResolutionManagement {
}
rootProject.name = "Foodify"
include ':app'
+include ':aestheticdialogs'
+include ':SJDialog'
+include ':popupDialog'