From f864271b8d6659357a3505b73c919c3152b58dfe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=EC=9D=91=EC=95=A0?=
<51151970+fascinate98@users.noreply.github.com>
Date: Tue, 4 Oct 2022 14:14:29 +0900
Subject: [PATCH] Update README.md
---
README.md | 111 ++++++++++++++++++++++++++++++++++++++++++++++++------
1 file changed, 99 insertions(+), 12 deletions(-)
diff --git a/README.md b/README.md
index 7ac85a9..1e1c740 100644
--- a/README.md
+++ b/README.md
@@ -12,8 +12,8 @@ You can setup Lottie animation in 2parts.
|NO|Explanation|Example|
|----|:----:|:----:|
-|**1. Icon in alert**||**loop**
**no loop** |
-|**2. Full Screen**| |**Lottie behind alert**
**Lottie cover alert** |
+|**1. Lottie Icon in alert**||**loop**
**no loop** |
+|**2. Full Screen Lottie**| |**Lottie behind alert**
**Lottie cover alert** |
## Using Gradle :rocket:
@@ -36,29 +36,32 @@ dependencies {
Check here [BASIC USAGE](https://github.com/pedant/sweet-alert-dialog)
-1. https://lottiefiles.com/ 에 접속합니다.
+1. Go https://lottiefiles.com/
-2. 원하는 lottie 검색
+2. Search Lottie animation you want.
-3. lottie json 파일 다운로드
+3. Download lottie json file.
-4. (옵션)다운로드한 파일 이름을 변경합니다.
+4. (option) Change the downloaded file name.
-5. res -> New -> Android Resource Directory 를 클릭합니다.
+5. Make res -> New -> Android Resource Directory
-6. Resource type -> raw 선택하여 raw폴더를 만듭니다.
+6. Make raw folder. (Resource type -> raw)
-7. 다운로드 받았던 json 파일을 raw폴더로 이동합니다.
+7. Move json file downloaded to raw folder.
-8. 코드 입력
+8. In your Code
+
+Make simple button for example.
In your xml file:
+
```xml
```
+
+**How to set lottie Icon in alert**
+
In your Activity file:
```kotlin
+//lottie icon in alert
+ button1.setOnClickListener {
+ //1. you have to set type SweetLottieAlertDialog.LOTTIE_ID_TYPE.
+ val lsd2 = SweetLottieAlertDialog(this, SweetLottieAlertDialog.LOTTIE_ID_TYPE)
+ //2. setLottieImagebyId(your_lottie_res, isLoop(boolean), listner)
+ lsd2.setLottieImagebyId(R.raw.lottie_cryingface, true, null)
+ lsd2.contentText = "Try Again!"
+ lsd2.show()
+ }
+```
+
+
+
+
+If you want set **listner**,
+
+```kotlin
+//lottie icon in alert
+button1.setOnClickListener {
+ val lsd2 = SweetLottieAlertDialog(this, SweetLottieAlertDialog.LOTTIE_ID_TYPE)
+ //isLoop is false!
+ lsd2.setLottieImagebyId(R.raw.ok_btn_lottie, false, object : Animator.AnimatorListener {
+
+ override fun onAnimationStart(animation: Animator) {
+
+ }
+
+ override fun onAnimationEnd(animation: Animator) {
+ //this will be executed when lottie animation end.
+ lsd2.dismissWithAnimation()
+ }
+
+ override fun onAnimationCancel(animation: Animator) {
+ }
+
+ override fun onAnimationRepeat(animation: Animator) {
+ }
+ })
+ lsd2.contentText = "Success!"
+ lsd2.setCancelable(true)
+ lsd2.setCanceledOnTouchOutside(true)
+ lsd2.show()
+ }
+```
+
+
+
+**How to set Full screen lottie**
+
+```kotlin
+//full screen - Lottie cover alert
button1.setOnClickListener {
val lsd = SweetLottieAlertDialog(this, SweetLottieAlertDialog.NORMAL_TYPE)
//text in alert
lsd.contentText = "Congratulation!"
- //set full screen lottie.
+ //set full screen lottie. It will cover your alert.
//setPopupLottieAnimation(your_lottie_res, isLoop(boolean), elevation);
lsd.setPopupLottieAnimation(R.raw.bg_lottie, false, 999f)
lsd.show()
}
```
+
-lottie will cover your alert. if you want lottie behind alert,
+ if you want **lottie behind alert**,
```kotlin
+//full screen - Lottie behind alert
button1.setOnClickListener {
val lsd = SweetLottieAlertDialog(this, SweetLottieAlertDialog.NORMAL_TYPE)
//text in alert
@@ -92,3 +151,31 @@ lottie will cover your alert. if you want lottie behind alert,
lsd.show()
}
```
+
+
+## License
+
+ The MIT License (MIT)
+
+ Copyright (c) 2014 Pedant(http://pedant.cn)
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+
+
+