Skip to content

Commit 6a848a5

Browse files
Added option to set font weight for title and content and updated version to 20.6.15
1 parent c75f6e9 commit 6a848a5

5 files changed

Lines changed: 35 additions & 7 deletions

File tree

README.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55

66
<img src="https://raw.githubusercontent.com/TutorialsAndroid/KAlertDialog/refs/heads/master/art/banner.png" align="center"/>
77

8-
New version released 20.5.15 on 19-05-2026
8+
New version released 20.6.15 on 20-05-2026
99
## Changelogs
10+
- Added option to set font weight for title and content
1011
- Updated progressx library to latest version
1112
- Added support for custom button drawables
1213
- Upgrade Gradle Wrapper to 9.4.1 and Android Gradle Plugin to 9.2.1.
@@ -47,6 +48,7 @@ AlertDialog for Android, a beautiful and material alert dialog to use in your an
4748
- Materialistic alert dialog
4849
- Auto dark mode
4950
- Change font style
51+
- Change font weight
5052
- Change text color
5153
- Change button color and background
5254
- Change button text color
@@ -79,7 +81,7 @@ Add it in your root build.gradle at the end of repositories:
7981
Step 2. On your root build.gradle, add mavenCentral() to the allprojects section. On your module build.gradle, add
8082

8183
dependencies {
82-
implementation 'io.github.tutorialsandroid:kalertdialog:20.5.15'
84+
implementation 'io.github.tutorialsandroid:kalertdialog:20.6.15'
8385
implementation 'io.github.tutorialsandroid:progressx:7.0.5' //required for kalertdialog lib
8486
}
8587

@@ -90,7 +92,7 @@ Starting from the latest versions of **KAlertDialog** and **ProgressX**, this li
9092
If you are using:
9193

9294
```gradle
93-
implementation 'io.github.tutorialsandroid:kalertdialog:20.5.15'
95+
implementation 'io.github.tutorialsandroid:kalertdialog:20.6.15'
9496
implementation 'io.github.tutorialsandroid:progressx:7.0.5'
9597
````
9698
@@ -135,7 +137,7 @@ compileSdk 36
135137
you may see an error like this:
136138

137139
```txt
138-
Dependency 'io.github.tutorialsandroid:kalertdialog:20.5.15' requires libraries and applications
140+
Dependency 'io.github.tutorialsandroid:kalertdialog:20.6.15' requires libraries and applications
139141
that depend on it to compile against version 37 or later of the Android APIs.
140142
141143
:app is currently compiled against android-36.1.
@@ -370,6 +372,11 @@ To Change the color of title and content
370372
.setTitleColor(R.color.yourColorName)
371373
.setContentColor(R.color.yourColorName)
372374

375+
To Change the font weight of title and content
376+
377+
.setTitleFontWeight(Typeface.BOLD)
378+
.setContentFontWeight(Typeface.ITALIC)
379+
373380
To Change the content textAlignment
374381

375382
//Text alignment start

library/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apply plugin: 'maven-publish'
33

44
ext {
55
PUBLISH_GROUP_ID = 'io.github.tutorialsandroid'
6-
PUBLISH_VERSION = '20.5.15'
6+
PUBLISH_VERSION = '20.6.15'
77
PUBLISH_ARTIFACT_ID = 'kalertdialog'
88
PUBLISH_DESCRIPTION = 'AlertDialog for Android, a beautiful and material alert dialog to use in your android app.'
99
PUBLISH_URL = 'https://github.com/tutorialsandroid/KAlertDialog'

library/src/main/java/com/developer/kalert/KAlertDialog.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ public class KAlertDialog extends AlertDialog implements View.OnClickListener {
6969
private String titleFontAssets, contentFontAssets, confirmButtonFontAssets, cancelButtonFontAssets;
7070
private int displayType;
7171
private int titleFont = 0, contentFont = 0, confirmButtonFont = 0, cancelButtonFont = 0;
72+
private int titleFontWeight = Typeface.NORMAL;
73+
private int contentFontWeight = Typeface.NORMAL;
7274
private int titleColor = 0, contentColor = 0,
7375
confirmTextColor = android.R.color.white, cancelTextColor = android.R.color.white;
7476
private int drawableColor = 0;
@@ -317,6 +319,7 @@ public KAlertDialog setTitleText(String text) {
317319
} else {
318320
mTitleTextView.setText(Html.fromHtml(mTitleText));
319321
}
322+
mTitleTextView.setTypeface(mTitleTextView.getTypeface(), titleFontWeight);
320323
} else {
321324
showTitleText(false);
322325
}
@@ -463,6 +466,7 @@ public KAlertDialog setContentText(String text) {
463466
} else {
464467
mContentTextView.setText(Html.fromHtml(mContentText));
465468
}
469+
mContentTextView.setTypeface(mContentTextView.getTypeface(), contentFontWeight);
466470
} else {
467471
showContentText(false);
468472
}
@@ -613,6 +617,22 @@ public KAlertDialog setContentFont(int font) {
613617
return this;
614618
}
615619

620+
public KAlertDialog setTitleFontWeight(int fontWeight) {
621+
this.titleFontWeight = fontWeight;
622+
if (mTitleTextView != null) {
623+
mTitleTextView.setTypeface(mTitleTextView.getTypeface(), fontWeight);
624+
}
625+
return this;
626+
}
627+
628+
public KAlertDialog setContentFontWeight(int fontWeight) {
629+
this.contentFontWeight = fontWeight;
630+
if (mContentTextView != null) {
631+
mContentTextView.setTypeface(mContentTextView.getTypeface(), fontWeight);
632+
}
633+
return this;
634+
}
635+
616636
public KAlertDialog setTitleFontAssets(String path) {
617637
this.titleFontAssets = path;
618638
return this;

sample/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ android {
88
applicationId "com.developer.kalert.alert"
99
minSdkVersion 23
1010
targetSdkVersion 37
11-
versionCode 44
12-
versionName "20.5.15"
11+
versionCode 45
12+
versionName "20.6.15"
1313
}
1414

1515
compileOptions {

sample/src/main/java/com/developer/kalert/alert/SampleActivity.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.developer.kalert.alert;
22

3+
import android.graphics.Typeface;
34
import android.os.Bundle;
45
import android.os.CountDownTimer;
56
import android.view.Gravity;

0 commit comments

Comments
 (0)