Skip to content

Commit 55b5bf5

Browse files
New Version v20.2.0
1 parent 4c10165 commit 55b5bf5

File tree

164 files changed

+3591
-2460
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

164 files changed

+3591
-2460
lines changed
Binary file not shown.
Binary file not shown.

.gradle/7.4/fileHashes/fileHashes.bin

800 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
1.1 KB
Binary file not shown.
Binary file not shown.

.gradle/file-system.probe

0 Bytes
Binary file not shown.

.idea/workspace.xml

+109-123
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

+42-28
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
![](https://github.com/TutorialsAndroid/KAlertDialog/blob/master/sample/src/main/res/mipmap-xxhdpi/ic_launcher.png)
22

3-
# New version released v20.1.0 on 13-10-2022
3+
# New version released v20.2.0 on 14-10-2022
44
## Changelogs
5-
- Auto dark mode
6-
- New Input field dialog
7-
- Dialog title alignment
8-
- Fixed crashing issue while using custom downloaded fonts
5+
- Added option to change button text color
6+
- Added option to tint vector drawable in dark mode
97
### Read the changes in README
108

119
Alert Dialog ![API](https://img.shields.io/badge/API-19%2B-brightgreen.svg?style=flat) [![Known Vulnerabilities](https://snyk.io/test/github/TutorialsAndroid/KAlertDialog/badge.svg?targetFile=library%2Fbuild.gradle)](https://snyk.io/test/github/TutorialsAndroid/KAlertDialog?targetFile=library%2Fbuild.gradle) [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-KAlertDiaog-blue.svg?style=flat)](https://android-arsenal.com/details/1/7588) [![License](https://img.shields.io/badge/License-Apache%202.0-green.svg)](https://opensource.org/licenses/Apache-2.0)
@@ -41,9 +39,12 @@ AlertDialog for Android, a beautiful and material alert dialog to use in your an
4139
- Change font style
4240
- Change text color
4341
- Change button color and background
42+
- Change button text color
43+
- Show vector drawable image with tint option in dark mode
4444
- Show Custom Image from URL in dialog (type: circleCrop, full-size)
4545
- Change the content text-alignment as you want
4646
- Change the title text alignment
47+
- Progress type dialog
4748
- Input field dialog
4849
- More features are coming soon
4950

@@ -67,7 +68,7 @@ Add it in your root build.gradle at the end of repositories:
6768
Step 2. Add the dependency
6869

6970
dependencies {
70-
implementation 'com.github.TutorialsAndroid:KAlertDialog:v20.1.0'
71+
implementation 'com.github.TutorialsAndroid:KAlertDialog:v20.2.0'
7172
}
7273

7374
## Usage
@@ -124,11 +125,11 @@ A title with gravity changed:
124125
![](https://github.com/TutorialsAndroid/KAlertDialog/blob/master/art/photo_2022-10-12_19-42-30.png)
125126

126127
new KAlertDialog(this, KAlertDialog.NORMAL_TYPE)
127-
.setTitleText("Lorem Ipsum")
128-
.setTitleTextGravity(Gravity.START) //you can specify your own gravity
129-
.setContentText("Lorem Ipsum is simply dummy text of the printing and typesetting industry.")
130-
.setConfirmText("Ok")
131-
.show();
128+
.setTitleText("Lorem Ipsum")
129+
.setTitleTextGravity(Gravity.START) //you can specify your own gravity
130+
.setContentText("Lorem Ipsum is simply dummy text of the printing and typesetting industry.")
131+
.setConfirmClickListener("OK", null)
132+
.show();
132133

133134
A error message:
134135

@@ -142,7 +143,7 @@ A warning message:
142143
new KAlertDialog(this, KAlertDialog.WARNING_TYPE)
143144
.setTitleText("Are you sure?")
144145
.setContentText("Won't be able to recover this file!")
145-
.setConfirmText("Yes,delete it!")
146+
.setConfirmClickListener("Yes,delete it!", null)
146147
.show();
147148

148149
A success message:
@@ -184,7 +185,7 @@ A message with a custom image URL
184185
.setTitleText("KAlertDialog")
185186
.setContentText("Here's a custom image.")
186187
.setURLImage("put your image url", displayType)
187-
.setConfirmText("OK")
188+
.setConfirmClickListener("OK", null)
188189
.show();
189190

190191
A dialog with input-field
@@ -194,8 +195,7 @@ A dialog with input-field
194195
KAlertDialog dialog = new KAlertDialog(this, KAlertDialog.INPUT_TYPE);
195196
dialog.setInputFieldHint("Write message");
196197
dialog.setTitleText("Edit Text");
197-
dialog.setConfirmText("OK");
198-
dialog.setConfirmClickListener(kAlertDialog -> {
198+
dialog.setConfirmClickListener("OK", kAlertDialog -> {
199199
kAlertDialog.dismissWithAnimation();
200200
kAlertDialog.getInputText(); //you get the input text by calling this
201201
Toast.makeText(this, kAlertDialog.getInputText(), Toast.LENGTH_SHORT).show();
@@ -211,8 +211,8 @@ To Hide Cancel And Confirm Button:
211211
.setTitleText("Sweet!")
212212
.setContentText("Here's a custom image.")
213213
.setCustomImage(R.drawable.custom_img)
214-
.setConfirmText("OK") //Do not call this if you don't want to show confirm button
215-
.setCancelText("CANCEL")//Do not call this if you don't want to show cancel button
214+
.showConfirmButton(false) //to hide the confirm button set it to true
215+
.showCancelButton(false) //to hide the cancel button set it to false
216216
.show();
217217

218218
To Change the font of only title:
@@ -226,7 +226,7 @@ To Change the font of only title:
226226
.setTitleText("Lorem Ipsum")
227227
.setTitleTTFFont("fonts/os.ttf")
228228
.setContentText("Lorem Ipsum is simply dummy text of the printing and typesetting industry.")
229-
.setConfirmText("Ok")
229+
.setConfirmClickListener("OK", null)
230230
.show();
231231

232232
To Change the font of only content:
@@ -240,7 +240,7 @@ To Change the font of only content:
240240
.setTitleText("Lorem Ipsum")
241241
.setContentText("Lorem Ipsum is simply dummy text of the printing and typesetting industry.")
242242
.setContentTTFFont("fonts/sf.ttf")
243-
.setConfirmText("Ok")
243+
.setConfirmClickListener("OK", null)
244244
.show();
245245

246246
To Change the color of title and content
@@ -263,8 +263,7 @@ Bind the listener to confirm button:
263263
new KAlertDialog(this, KAlertDialog.WARNING_TYPE, 0)
264264
.setTitleText("Are you sure?")
265265
.setContentText("Won't be able to recover this file!")
266-
.setConfirmText("Yes,delete it!")
267-
.setConfirmClickListener(new KAlertDialog.KAlertClickListener() {
266+
.setConfirmClickListener("Yes,delete it!",new KAlertDialog.KAlertClickListener() {
268267
@Override
269268
public void onClick(KAlertDialog sDialog) {
270269
sDialog.dismissWithAnimation();
@@ -277,10 +276,9 @@ Show the cancel button and bind listener to it:
277276
new KAlertDialog(this, KAlertDialog.WARNING_TYPE, 0)
278277
.setTitleText("Are you sure?")
279278
.setContentText("Won't be able to recover this file!")
280-
.setCancelText("No,cancel plx!")
281-
.setConfirmText("Yes,delete it!")
279+
.setConfirmClickListener("Yes,delete it!", null)
282280
.showCancelButton(true)
283-
.setCancelClickListener(new KAlertDialog.KAlertClickListener() {
281+
.setCancelClickListener("No,cancel plx!", new KAlertDialog.KAlertClickListener() {
284282
@Override
285283
public void onClick(KAlertDialog sDialog) {
286284
sDialog.cancel();
@@ -290,10 +288,26 @@ Show the cancel button and bind listener to it:
290288

291289
Customizing the alert dialog
292290

293-
.confirmButtonColor(R.color.colorPrimary) // you can change the color of confirm button
294-
.cancelButtonColor(R.color.colorAccent) // you can change the color of cancel button
295-
.setContentTextSize(50) // you can change the content text size
296-
.setTitleText("<h2>Title</h2><br><p>Description here</p>") //you can use html in title text
291+
//if your app is night mode then you can tint your vector drawable to specific color you want
292+
.setDrawableTintOnNightMode(true, R.color.white)
293+
294+
// you can change the color of confirm button
295+
.confirmButtonColor(R.color.colorPrimary)
296+
297+
// you can change the color of cancel button
298+
.cancelButtonColor(R.color.colorAccent)
299+
300+
//you can change the color of button text
301+
.setConfirmClickListener("OK", R.color.black, clickListener)
302+
303+
//you can change the color of button text
304+
.setCancelClickListener("CANCEL", R.color.black, clickListener)
305+
306+
// you can change the content text size
307+
.setContentTextSize(50)
308+
309+
//you can use html in title text and same in content text
310+
.setTitleText("<h2>Title</h2><br><p>Description here</p>")
297311

298312

299313
And if you want to change the button corners with color create a drawable file
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:wheel="http://schemas.android.com/apk/res-auto"
4+
xmlns:tools="http://schemas.android.com/tools"
5+
android:id="@+id/loading"
6+
android:layout_width="300dp"
7+
android:layout_height="wrap_content"
8+
android:gravity="center"
9+
android:layout_gravity="center"
10+
android:orientation="vertical"
11+
android:background="?attr/alertDialogDark"
12+
android:padding="10dp">
13+
14+
<RelativeLayout
15+
android:id="@+id/custom_image_frame"
16+
android:layout_width="wrap_content"
17+
android:layout_height="wrap_content"
18+
android:layout_marginTop="5dp">
19+
20+
<ImageView
21+
android:id="@+id/custom_image"
22+
android:layout_width="56dp"
23+
android:layout_height="56dp"
24+
android:visibility="gone"
25+
android:scaleType="fitCenter"
26+
tools:ignore="ContentDescription" />
27+
28+
<ImageView
29+
android:id="@+id/custom_big_image"
30+
android:layout_width="match_parent"
31+
android:layout_height="wrap_content"
32+
android:visibility="gone"
33+
android:scaleType="fitCenter"
34+
tools:ignore="ContentDescription" />
35+
36+
<com.developer.progressx.ProgressWheel
37+
android:id="@+id/image_loading"
38+
android:layout_width="56dp"
39+
android:layout_height="56dp"
40+
android:layout_alignParentTop="true"
41+
android:layout_centerInParent="true"
42+
wheel:matProg_barColor="?attr/alertDialogProgressColor"
43+
wheel:matProg_progressIndeterminate="true"
44+
android:visibility="gone"/>
45+
</RelativeLayout>
46+
47+
<FrameLayout
48+
android:id="@+id/error_frame"
49+
android:layout_width="56dp"
50+
android:layout_height="56dp"
51+
android:layout_marginTop="5dp"
52+
android:visibility="gone">
53+
<View
54+
android:layout_width="match_parent"
55+
android:layout_height="match_parent"
56+
android:background="@drawable/error_circle" />
57+
58+
<ImageView
59+
android:id="@+id/error_x"
60+
android:layout_width="match_parent"
61+
android:layout_height="match_parent"
62+
android:contentDescription="@string/app_name"
63+
android:src="@drawable/error_center_x"
64+
android:scaleType="center" />
65+
66+
</FrameLayout>
67+
68+
<FrameLayout
69+
android:id="@+id/success_frame"
70+
android:layout_width="56dp"
71+
android:layout_height="56dp"
72+
android:layout_marginTop="5dp"
73+
android:visibility="gone">
74+
75+
<View
76+
android:layout_width="match_parent"
77+
android:layout_height="match_parent"
78+
android:background="@drawable/success_bow" />
79+
80+
<View
81+
android:layout_width="match_parent"
82+
android:layout_height="match_parent"
83+
android:background="@drawable/success_circle" />
84+
85+
<ImageView
86+
android:id="@+id/success_x"
87+
android:layout_width="match_parent"
88+
android:layout_height="match_parent"
89+
android:contentDescription="@string/app_name"
90+
android:src="@drawable/ic_success_tick"
91+
android:scaleType="center" />
92+
93+
</FrameLayout>
94+
95+
<FrameLayout
96+
android:id="@+id/warning_frame"
97+
android:layout_width="56dp"
98+
android:layout_height="56dp"
99+
android:layout_marginTop="5dp"
100+
android:visibility="gone">
101+
102+
<View
103+
android:layout_width="match_parent"
104+
android:layout_height="match_parent"
105+
android:background="@drawable/warning_circle" />
106+
107+
<ImageView
108+
android:layout_width="match_parent"
109+
android:layout_height="match_parent"
110+
android:contentDescription="@string/app_name"
111+
android:src="@drawable/warning_sigh"
112+
android:scaleType="center" />
113+
</FrameLayout>
114+
115+
<FrameLayout
116+
android:id="@+id/progress_dialog"
117+
android:layout_width="wrap_content"
118+
android:layout_height="wrap_content"
119+
android:layout_marginTop="9dp"
120+
android:layout_gravity="center"
121+
android:orientation="vertical"
122+
android:visibility="gone">
123+
124+
<com.developer.progressx.ProgressWheel
125+
android:id="@+id/progressWheel"
126+
android:layout_width="80dp"
127+
android:layout_height="80dp"
128+
wheel:matProg_progressIndeterminate="true"
129+
android:layout_gravity="center" />
130+
</FrameLayout>
131+
132+
<TextView
133+
android:id="@+id/title_text"
134+
android:layout_width="wrap_content"
135+
android:layout_height="wrap_content"
136+
android:textSize="21sp"
137+
android:layout_marginTop="10dp"
138+
android:singleLine="true"
139+
android:visibility="gone"
140+
android:textColor="?attr/alertDialogTextColor"
141+
android:text="@string/dialog_default_title" />
142+
143+
<TextView
144+
android:id="@+id/content_text"
145+
android:layout_marginTop="10dp"
146+
android:layout_width="wrap_content"
147+
android:layout_height="wrap_content"
148+
android:textSize="18sp"
149+
android:visibility="gone"
150+
android:textColor="?attr/alertDialogContentTextColor"/>
151+
152+
<FrameLayout
153+
android:id="@+id/custom_view_container"
154+
android:layout_width="match_parent"
155+
android:layout_height="wrap_content"
156+
android:layout_marginTop="10dp"
157+
android:gravity="center"
158+
android:visibility="gone"
159+
tools:visibility="visible">
160+
161+
<com.google.android.material.textfield.TextInputLayout
162+
android:layout_width="match_parent"
163+
android:layout_height="wrap_content"
164+
android:textColorHint="?attr/alertDialogInputFieldHintColor">
165+
166+
<com.google.android.material.textfield.TextInputEditText
167+
android:id="@+id/edit_text"
168+
android:layout_width="match_parent"
169+
android:layout_height="wrap_content"/>
170+
</com.google.android.material.textfield.TextInputLayout>
171+
172+
</FrameLayout>
173+
174+
<LinearLayout
175+
android:layout_marginTop="10dp"
176+
android:layout_width="match_parent"
177+
android:layout_height="wrap_content"
178+
android:gravity="center">
179+
180+
<androidx.appcompat.widget.AppCompatButton
181+
style="@style/dialog_blue_button"
182+
android:id="@+id/cancel_button"
183+
android:text="@string/dialog_cancel"
184+
android:visibility="gone"
185+
android:layout_marginEnd="10dp" />
186+
187+
<androidx.appcompat.widget.AppCompatButton
188+
style="@style/dialog_blue_button"
189+
android:id="@+id/custom_confirm_button"
190+
android:visibility="gone"
191+
android:text="@string/dialog_ok"/>
192+
</LinearLayout>
193+
</LinearLayout>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<style name="dialog_blue_button" parent="android:Widget.Button">
4+
<item name="android:layout_width">wrap_content</item>
5+
<item name="android:layout_height">32dp</item>
6+
<item name="android:background">@drawable/button_background</item>
7+
<item name="android:textSize">16sp</item>
8+
<item name="android:paddingLeft">21dp</item>
9+
<item name="android:paddingRight">21dp</item>
10+
<item name="android:textColor">@color/button_text_color</item>
11+
</style>
12+
</resources>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

library/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#Wed Oct 12 19:27:41 IST 2022
1+
#Fri Oct 14 12:06:10 IST 2022
22
com.developer.kalert.library-pngs-0\:/drawable-xxhdpi/ic_success_tick.png=D\:\\Projects\\AndroidLibraries\\KAlertDialog-master\\library\\build\\intermediates\\packaged_res\\debug\\drawable-xxhdpi-v4\\ic_success_tick.png
33
com.developer.kalert.library-main-7\:/layout/alert_dialog.xml=D\:\\Projects\\AndroidLibraries\\KAlertDialog-master\\library\\build\\intermediates\\packaged_res\\debug\\layout\\alert_dialog.xml
44
com.developer.kalert.library-main-7\:/drawable/success_circle.xml=D\:\\Projects\\AndroidLibraries\\KAlertDialog-master\\library\\build\\intermediates\\packaged_res\\debug\\drawable\\success_circle.xml
@@ -17,6 +17,7 @@ com.developer.kalert.library-main-7\:/drawable/dialogdark.xml=D\:\\Projects\\And
1717
com.developer.kalert.library-main-7\:/anim/success_mask_layout.xml=D\:\\Projects\\AndroidLibraries\\KAlertDialog-master\\library\\build\\intermediates\\packaged_res\\debug\\anim\\success_mask_layout.xml
1818
com.developer.kalert.library-main-7\:/drawable/gray_button_background.xml=D\:\\Projects\\AndroidLibraries\\KAlertDialog-master\\library\\build\\intermediates\\packaged_res\\debug\\drawable\\gray_button_background.xml
1919
com.developer.kalert.library-pngs-0\:/drawable-xxxhdpi/ic_success_tick.png=D\:\\Projects\\AndroidLibraries\\KAlertDialog-master\\library\\build\\intermediates\\packaged_res\\debug\\drawable-xxxhdpi-v4\\ic_success_tick.png
20+
com.developer.kalert.library-main-7\:/layout-sw600dp/alert_dialog.xml=D\:\\Projects\\AndroidLibraries\\KAlertDialog-master\\library\\build\\intermediates\\packaged_res\\debug\\layout-sw600dp-v13\\alert_dialog.xml
2021
com.developer.kalert.library-pngs-0\:/drawable-ldpi/ic_success_tick.png=D\:\\Projects\\AndroidLibraries\\KAlertDialog-master\\library\\build\\intermediates\\packaged_res\\debug\\drawable-ldpi-v4\\ic_success_tick.png
2122
com.developer.kalert.library-main-7\:/anim/error_x_in.xml=D\:\\Projects\\AndroidLibraries\\KAlertDialog-master\\library\\build\\intermediates\\packaged_res\\debug\\anim\\error_x_in.xml
2223
com.developer.kalert.library-main-7\:/drawable/dialog_background.xml=D\:\\Projects\\AndroidLibraries\\KAlertDialog-master\\library\\build\\intermediates\\packaged_res\\debug\\drawable\\dialog_background.xml

0 commit comments

Comments
 (0)