Skip to content

Commit bc1e741

Browse files
committed
feat(datePicker): Pre finalising DatePickerSDialog.
2 parents 5f6419f + f3c1e69 commit bc1e741

38 files changed

+386
-189
lines changed

.idea/compiler.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/gradle.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/migrations.xml

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CHANGELOG.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# SDialog Changelog
22

3+
## 4.5
4+
> (Jan 5, 2025)
5+
6+
### New Features & Improvements
7+
8+
- Add new `BiometricSDialog` for fingerprint security.
9+
- Improvement in biometric engine.
10+
11+
**Full Changelog**: [4.3...4.4](https://github.com/smith8h/SDialogs/compare/4.4...4.5)
12+
313
## 4.4
414
> (Sep 12, 2023)
515
@@ -109,4 +119,4 @@
109119
## 1.0
110120
> (Dec 7, 2022)
111121
112-
- First release.
122+
- First release.

README.md

Lines changed: 65 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
![Builds and tests](https://github.com/smith8h/SDialogs/actions/workflows/build.yml/badge.svg)
44
[![JitPack release](https://jitpack.io/v/smith8h/SDialogs.svg)](https://jitpack.io/#smith8h/SDialogs)
55
![Latest release](https://img.shields.io/github/v/release/smith8h/SDialogs?include_prereleases&label=latest%20release)
6-
![Stable Version](https://img.shields.io/badge/stable_version-4.4-blue)
76
![Stability](https://img.shields.io/badge/stability-stable-green.svg)
7+
![Monthly download statistics](https://jitpack.io/v/smith8h/SDialogs/month.svg)
88
![minSDK](https://img.shields.io/badge/minSDK-21-f39f37)
99
![repo size](https://img.shields.io/github/repo-size/smith8h/sdialogs)
1010

11+
[//]: # (![Stable Version](https://img.shields.io/badge/stable_version-4.4-blue))
12+
1113
</br>
1214

1315
Beautiful custom Android dialogs (Alert, MultiSelect, CheckBox, SingleSelect, RadioButton, Menu, Loading, Progress, Input, and Custom)
@@ -18,6 +20,7 @@ Beautiful custom Android dialogs (Alert, MultiSelect, CheckBox, SingleSelect, Ra
1820
- [Changelog](https://github.com/smith8h/SDialogs/blob/main/CHANGELOG.md)
1921
- [How to implement (Documentation)](#documentation)
2022
- [AlertSDialog](#alertsdialog)
23+
- [BiometricSDialog](#biometricsdialog)
2124
- [CustomSDialog](#customsdialog)
2225
- [InputSDialog](#inputsdialog)
2326
- [MenuSDialog](#menusdialog)
@@ -51,7 +54,7 @@ allprojects {
5154
```gradle
5255
dependencies {
5356
...
54-
implementation 'com.github.smith8h:SDialogs:4.4'
57+
implementation 'com.github.smith8h:SDialogs:4.5'
5558
}
5659
```
5760

@@ -65,7 +68,7 @@ All these SDialogs using an algorithm to calculate and extract colors lighter/da
6568
## AlertSDialog
6669

6770
<p align="center">
68-
<img src="https://te.legra.ph/file/29a07cd23e39721c24002.jpg" style="width: 50%;" />
71+
<img src="https://te.legra.ph/file/29a07cd23e39721c24002.jpg" style="width: 50%;" alt=""/>
6972
</p>
7073
Create new instance of AlertSDialog:
7174

@@ -101,6 +104,47 @@ Table of methods:
101104
- `getBackgroundColor()` get accent color.
102105
- `getTextColor()` get accent color.
103106

107+
## BiometricSDialog
108+
109+
<p align="center">
110+
<img src="https://silabotov.ru/img/8eac71e0-5915-422c-a25a-7471657f8474.jpg" style="width: 50%;" alt=""/>
111+
</p>
112+
Create new instance of BiometricSDialog:
113+
114+
```java
115+
BiometricSDialog sdialog = new BiometricSDialog(context);
116+
```
117+
118+
Table of methods:
119+
120+
**Setters**
121+
122+
- `setNegativeButtonText("Button Text");` (Optional) cancel button text.
123+
- `setNegativeButtonText(R.string.text);` (Optional) cancel button text.
124+
- `setPositiveButton("Button Text", clickcallback);` (Optional) the code here in java8, to use java7 or below syntax see in [CallBacks](#callbacks).
125+
- `setPositiveButton(R.string.text, clickcallback);` (Optional) the code here in java8, to use java7 or below syntax see in [CallBacks](#callbacks).
126+
- `setIconResource(icon)` (optional) add icon from res.
127+
- `setIconDrawable(icon)` (optional) add icon from a Drawable.
128+
- `setIconBitmap(icon)` (optional) add icon from bitmap.
129+
- `setTitle("Title");` set title as string text.
130+
- `setTitle(R.string.title);` set title as string resource.
131+
- `setText(text);` accepts span text | int string res | string text...
132+
- `setErrorText(text);` accepts span text | int string res | string text...
133+
- `setSuccessText(text);` accepts span text | int string res | string text...
134+
- `setMaxFailureCount(3);` set max failure to ignore dialog (default is 3).
135+
- `setAccentColor(int color/string hex color);` Default color is 0xFFA7B4C5/#FFA7B4C5 you can access it by `SDialog.COLOR_DEFAULT`.
136+
- `setTheme(SDialog.THEME_SYSTEM);` or `THEME_LIGHT / THEME_DARK`.
137+
- `setOnBiometricAuthCallback(biometricAuthCallback);` (Optional).
138+
- `show(); / show(1200);` to show always or for a duration of time (auto hide).
139+
- `dismiss(); / dismiss(500);` to hide it immediately or after duration of time (auto dismiss).
140+
141+
**Getters**
142+
143+
- `getAccentColor()` get accent color.
144+
- `getTitleColor()` get accent color.
145+
- `getBackgroundColor()` get accent color.
146+
- `getTextColor()` get accent color.
147+
104148
## CustomSDialog
105149

106150
Create new instance of CustomSDialog and set a view as dialog view:
@@ -544,6 +588,24 @@ CallBacks used in SDialogs:
544588
// use isLiked
545589
}
546590
};
591+
592+
// onBiometricAuthCallback
593+
OnBiometricAuthCallback biometricAuthCallback = new OnBiometricAuthCallback() {
594+
@Override
595+
public void onSuccess() {
596+
// auth succeed
597+
}
598+
599+
@Override
600+
public void onFailure() {
601+
// auth failed
602+
}
603+
604+
@Override
605+
public void onError() {
606+
// auth error
607+
}
608+
};
547609
```
548610

549611
# Used By

SDialogs/build.gradle

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,18 @@ plugins {
33
id 'maven-publish'
44
}
55

6+
var versonCode = 6
7+
var versonName = "4.5.0"
8+
var gropId = "smith.lib"
9+
var artifctId = "sdialogs"
10+
611
android {
712
namespace 'smith.lib.alerts.dialog'
8-
9-
compileSdk 33
13+
compileSdk 35
1014

1115
defaultConfig {
1216
minSdk 23
13-
targetSdk 33
14-
versionCode 5
15-
versionName '4.4'
17+
targetSdk 35
1618
multiDexEnabled true
1719
}
1820

@@ -29,6 +31,7 @@ android {
2931

3032
buildFeatures {
3133
viewBinding true
34+
buildConfig = true
3235
}
3336

3437
publishing {
@@ -40,18 +43,18 @@ android {
4043
}
4144

4245
dependencies {
43-
implementation('androidx.appcompat:appcompat:1.6.1')
44-
implementation('com.google.android.material:material:1.9.0')
46+
implementation('androidx.appcompat:appcompat:1.7.0')
47+
implementation('com.google.android.material:material:1.12.0')
4548
}
4649

4750
afterEvaluate {
4851
publishing {
4952
publications {
5053
release(MavenPublication) {
5154
from components.release
52-
groupId "smith.lib"
53-
artifactId "sdialogs"
54-
version '4.4'
55+
groupId gropId
56+
artifactId artifctId
57+
version versonCode
5558
}
5659
}
5760
}

SDialogs/src/main/java/smith/lib/alerts/dialog/AlertSDialog.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import androidx.annotation.DrawableRes;
2828
import androidx.annotation.GravityInt;
2929
import androidx.annotation.StringRes;
30-
import smith.lib.alerts.dialog.callbacks.OnClickCallBack;
30+
import smith.lib.alerts.dialog.callbacks.OnClickCallback;
3131

3232
/**
3333
* The beautiful and coolest class of SDialog lib.
@@ -54,9 +54,9 @@ public AlertSDialog(Context context) {
5454
* Declare displayed positive button text and its functionality.
5555
*
5656
* @param text String represent the text of positive button (e.g. "OK")
57-
* @param callback Click callback using {@link OnClickCallBack}
57+
* @param callback Click callback using {@link OnClickCallback}
5858
*/
59-
public void setPositiveButton(String text, OnClickCallBack callback) {
59+
public void setPositiveButton(String text, OnClickCallback callback) {
6060
b.holder.setVisibility(View.VISIBLE);
6161
b.positive.setVisibility(View.VISIBLE);
6262
b.positive.setText(text);
@@ -70,9 +70,9 @@ public void setPositiveButton(String text, OnClickCallBack callback) {
7070
* Declare displayed negative button text and its functionality.
7171
*
7272
* @param text String represent the text of negative button (e.g. "CANCEL")
73-
* @param callback Click callback using {@link OnClickCallBack}
73+
* @param callback Click callback using {@link OnClickCallback}
7474
*/
75-
public void setNegativeButton(String text, OnClickCallBack callback) {
75+
public void setNegativeButton(String text, OnClickCallback callback) {
7676
b.holder.setVisibility(View.VISIBLE);
7777
b.negative.setVisibility(View.VISIBLE);
7878
b.negative.setText(text);
@@ -86,9 +86,9 @@ public void setNegativeButton(String text, OnClickCallBack callback) {
8686
* Declare displayed neutral button text and its functionality.
8787
*
8888
* @param text String represent the text of neutral button (e.g. "HIDE")
89-
* @param callback Click callback using {@link OnClickCallBack}
89+
* @param callback Click callback using {@link OnClickCallback}
9090
*/
91-
public void setNeutralButton(String text, OnClickCallBack callback) {
91+
public void setNeutralButton(String text, OnClickCallback callback) {
9292
b.holder.setVisibility(View.VISIBLE);
9393
b.neutral.setVisibility(View.VISIBLE);
9494
b.neutral.setText(text);

SDialogs/src/main/java/smith/lib/alerts/dialog/BiometricSDialog.java

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@
2626
import android.os.Handler;
2727
import android.view.View;
2828
import androidx.annotation.*;
29-
import smith.lib.alerts.dialog.callbacks.*;
29+
import smith.lib.alerts.dialog.callbacks.OnBiometricAuthCallback;
30+
import smith.lib.alerts.dialog.callbacks.OnClickCallback;
31+
import smith.lib.alerts.dialog.callbacks.OnDismissCallback;
3032
import smith.lib.alerts.dialog.utils.SBiometricAuth;
3133

3234
/**
@@ -38,7 +40,7 @@
3840
@SuppressWarnings({"unused"})
3941
public class BiometricSDialog extends SDialog {
4042

41-
private OnBiometricAuthCallBack callBack;
43+
private OnBiometricAuthCallback callBack;
4244
private SBiometricAuth auth;
4345
private String text, errorText, successText;
4446

@@ -63,20 +65,44 @@ public void setNegativeButtonText(String text) {
6365
b.negative.setOnClickListener(v -> dismiss());
6466
}
6567

68+
/**
69+
* Declare displayed negative button text and its functionality.
70+
*
71+
* @param text a string represents the text of negative button (e.g. "R.string.cancel")
72+
*/
73+
public void setNegativeButtonText(@StringRes int text) {
74+
b.negative.setText(text);
75+
b.negative.setOnClickListener(v -> dismiss());
76+
}
77+
6678
/**
6779
* Declare displayed positive button text and its functionality.
6880
*
6981
* @param text a string represents the text of positive button (e.g. "<b>Use Password</b>").
70-
* @param clickCallBack A click callback triggered when clicking positive button using {@link OnClickCallBack}.
82+
* @param clickCallBack A click callback triggered when clicking positive button using {@link OnClickCallback}.
7183
*/
72-
public void setPositiveButton(String text, OnClickCallBack clickCallBack) {
84+
public void setPositiveButton(String text, OnClickCallback clickCallBack) {
7385
b.positive.setText(text);
7486
b.positive.setOnClickListener(v -> {
7587
clickCallBack.onClick();
7688
dismiss();
7789
});
7890
}
7991

92+
/**
93+
* Declare displayed positive button text and its functionality.
94+
*
95+
* @param text a string represents the text of positive button (e.g. R.string.password).
96+
* @param clickCallback A click callback triggered when clicking positive button using {@link OnClickCallback}.
97+
*/
98+
public void setPositiveButton(@StringRes int text, OnClickCallback clickCallback) {
99+
b.positive.setText(text);
100+
b.positive.setOnClickListener(v -> {
101+
clickCallback.onClick();
102+
dismiss();
103+
});
104+
}
105+
80106
/**
81107
* Set icon for the current SDialog.
82108
*
@@ -191,10 +217,10 @@ public void setMaxFailureCount(int maxFailureCount) {
191217

192218
/**
193219
* Set the callback to interact with biometric authentication response when needed, using
194-
* {@link OnBiometricAuthCallBack}.
195-
* @param callBack the callback using {@link OnBiometricAuthCallBack}.
220+
* {@link OnBiometricAuthCallback}.
221+
* @param callBack the callback using {@link OnBiometricAuthCallback}.
196222
*/
197-
public void setOnBiometricAuthCallBack(OnBiometricAuthCallBack callBack) {
223+
public void setOnBiometricAuthCallback(OnBiometricAuthCallback callBack) {
198224
this.callBack = callBack;
199225
}
200226

@@ -227,7 +253,7 @@ public int getTextColor() {
227253
}
228254

229255
@Override
230-
public void setOnDismissCallBack(OnDismissCallBack callback) {
256+
public void setOnDismissCallback(OnDismissCallback callback) {
231257
this.dismissCallback = callback;
232258
alertdialog.setOnDismissListener(dialog -> {
233259
if (auth != null) auth.cancelSignal();
@@ -281,7 +307,7 @@ private void update() {
281307

282308
private void initAuth() {
283309
auth = new SBiometricAuth(context);
284-
auth.setCallBack(new OnBiometricAuthCallBack() {
310+
auth.setCallback(new OnBiometricAuthCallback() {
285311
@Override
286312
public void onFailure() {
287313
updateIcon(0xFFEB6D64, 0x47FF7D5F);

SDialogs/src/main/java/smith/lib/alerts/dialog/CustomSDialog.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
import androidx.annotation.LayoutRes;
2626
import androidx.annotation.NonNull;
27-
import smith.lib.alerts.dialog.callbacks.OnBindCustomViewCallBack;
27+
import smith.lib.alerts.dialog.callbacks.OnBindCustomViewCallback;
2828

2929
/**
3030
* The fully customizable class of SDialog lib.
@@ -63,9 +63,9 @@ public CustomSDialog(Context context, @LayoutRes int layout) {
6363

6464
/**
6565
* Set the callback to interact with the dialog onBindingView of the SDialog.
66-
* @param callback On bind view callback using {@link OnBindCustomViewCallBack}
66+
* @param callback On bind view callback using {@link OnBindCustomViewCallback}
6767
*/
68-
public void setOnBindViewCallBack(@NonNull OnBindCustomViewCallBack callback) {
68+
public void setOnBindViewCallback(@NonNull OnBindCustomViewCallback callback) {
6969
callback.onBindCustomView(view);
7070
}
7171

0 commit comments

Comments
 (0)