├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── dependabot.yml └── workflows │ ├── checkLibraryBuildStatus.yml │ └── generateDocs.yml ├── .gitignore ├── .idea ├── .gitignore ├── .name ├── compiler.xml ├── gradle.xml ├── inspectionProfiles │ └── Project_Default.xml ├── jarRepositories.xml ├── misc.xml └── vcs.xml ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── app ├── .gitignore ├── build.gradle.kts ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── techiness │ │ └── progressdialogexample │ │ └── InstrumentedTestForLibrary.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── techiness │ │ │ └── progressdialogexample │ │ │ ├── KotlinActivity.kt │ │ │ └── MainActivity.java │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ └── ic_launcher_background.xml │ │ ├── layout │ │ ├── activity_kotlin.xml │ │ └── activity_main.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── themes.xml │ └── test │ └── java │ └── com │ └── techiness │ └── progressdialogexample │ └── ExampleUnitTest.java ├── build.gradle.kts ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── jitpack.yml ├── output ├── deter_percent.jpg ├── deter_percent_dark.jpg ├── deter_title.jpg ├── deter_title_dark.jpg ├── deter_with_negativebtn.jpg ├── deter_with_negativebtn_dark.jpg ├── deter_without_progress.jpg ├── deter_without_progress_dark.jpg ├── indeter.jpg ├── indeter_dark.jpg ├── indeter_with_negativebtn.jpg ├── indeter_with_negativebtn_dark.jpg ├── indeter_with_title.jpg └── indeter_with_title_dark.jpg ├── progressdialoglibrary ├── .gitignore ├── build.gradle.kts ├── consumer-rules.pro ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── techiness │ │ └── progressdialoglibrary │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── techiness │ │ │ └── progressdialoglibrary │ │ │ └── ProgressDialog.kt │ └── res │ │ ├── drawable │ │ ├── bg_dialog.xml │ │ └── bg_dialog_dark.xml │ │ ├── layout │ │ └── layout_progressdialog.xml │ │ └── values │ │ ├── colors.xml │ │ ├── public.xml │ │ └── strings.xml │ └── test │ └── java │ └── com │ └── techiness │ └── progressdialoglibrary │ └── ExampleUnitTest.java └── settings.gradle.kts /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: BUG 5 | labels: bug 6 | assignees: techinessoverloaded 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **Version of Library** 14 | Mention the version of ProgressDialog library in which the issue is occurring. 15 | 16 | **To Reproduce** 17 | Steps to reproduce the behavior: 18 | 1. Go to '...' 19 | 2. Click on '....' 20 | 3. Scroll down to '....' 21 | 4. See error 22 | 23 | **Expected behavior** 24 | A clear and concise description of what you expected to happen. 25 | 26 | **Screenshots** 27 | If applicable, add screenshots to help explain your problem. 28 | 29 | **Android Phone (please complete the following information):** 30 | - Device: [e.g. Pixel 6] 31 | - Version of Android OS: [e.g. Android 11] 32 | - Custom Skin on Android: If Applicable (Example OneUI) 33 | 34 | **Additional context** 35 | Add any other context about the problem here. 36 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: FEATURE REQUEST 5 | labels: enhancement 6 | assignees: techinessoverloaded 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "gradle" 4 | directory: "/" 5 | schedule: 6 | interval: "weekly" 7 | 8 | - package-ecosystem: "github-actions" 9 | directory: "/" 10 | schedule: 11 | interval: "weekly" 12 | -------------------------------------------------------------------------------- /.github/workflows/checkLibraryBuildStatus.yml: -------------------------------------------------------------------------------- 1 | name: ProgressDialog Library Build 2 | 3 | on: 4 | push: 5 | branches: [master] 6 | pull_request: 7 | branches: [master] 8 | # Allows you to run this workflow manually from the Actions tab 9 | workflow_dispatch: 10 | 11 | jobs: 12 | build: 13 | if: (${{ github.event_name == 'push' }} && startsWith(github.ref, 'refs/tags/1')) || (${{ github.event_name == 'pull_request' }} && ${{ github.actor != 'dependabot[bot]' }}) 14 | runs-on: ubuntu-latest 15 | steps: 16 | - uses: actions/checkout@v4 17 | - name: Set up JDK 11 18 | uses: actions/setup-java@v4.7.0 19 | with: 20 | java-version: 11 21 | distribution: adopt 22 | - name: Setup Gradle 23 | uses: gradle/actions/setup-gradle@v4 24 | with: 25 | gradle-version: 7.4.2 26 | - name: Build Library with Gradle 27 | run: gradle :progressdialoglibrary:clean :progressdialoglibrary:publishReleasePublicationToMavenLocal 28 | - name: Upload Output AAR file 29 | uses: actions/upload-artifact@v4 30 | with: 31 | name: progressdialoglibrary-release 32 | path: progressdialoglibrary/build/outputs/aar/progressdialoglibrary-release.aar 33 | -------------------------------------------------------------------------------- /.github/workflows/generateDocs.yml: -------------------------------------------------------------------------------- 1 | name: Generate Docs and Deploy to GH Pages 2 | 3 | on: 4 | release: 5 | types: [released] 6 | # Allows you to run this workflow manually from the Actions tab 7 | # workflow_dispatch: 8 | 9 | jobs: 10 | generate: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v4 14 | - name: Setup JDK 11 15 | uses: actions/setup-java@v4.7.0 16 | with: 17 | java-version: 11 18 | distribution: adopt 19 | - name: Setup Gradle 20 | uses: gradle/gradle-build-action@v3.5.0 21 | with: 22 | gradle-version: 7.4.2 23 | - name: Generate KDoc and JavaDoc 24 | if: ${{github.event_name == 'release'}} 25 | run: gradle :progressdialoglibrary:dokkaHtml :progressdialoglibrary:dokkaJavadoc 26 | - name: Format Version Tag Name 27 | uses: actions/github-script@v7.0.1 28 | id: format_version_tag 29 | with: 30 | script: | 31 | const tag = context.ref.substring(10) 32 | const no_v = tag.replace('v', '') 33 | core.setOutput('tag', tag) 34 | core.setOutput('no-v', no_v) 35 | - name: Deploy KDoc to GH Pages with Version 36 | uses: JamesIves/github-pages-deploy-action@v4.7.3 37 | with: 38 | token: ${{ secrets.GITHUB_TOKEN }} 39 | branch: gh-pages 40 | folder: progressdialoglibrary/build/dokka/html 41 | target-folder: kotlin/${{ steps.format_version_tag.outputs.no-v }}/ 42 | - name: Deploy KDoc to GH Pages as Latest 43 | uses: JamesIves/github-pages-deploy-action@v4.7.3 44 | with: 45 | token: ${{ secrets.GITHUB_TOKEN }} 46 | branch: gh-pages 47 | folder: progressdialoglibrary/build/dokka/html 48 | target-folder: kotlin/latest/ 49 | - name: Deploy JavaDoc to GH Pages with Version 50 | uses: JamesIves/github-pages-deploy-action@v4.7.3 51 | with: 52 | token: ${{ secrets.GITHUB_TOKEN }} 53 | branch: gh-pages 54 | folder: progressdialoglibrary/build/dokka/javadoc 55 | target-folder: java/${{ steps.format_version_tag.outputs.no-v }}/ 56 | - name: Deploy JavaDoc to GH Pages as Latest 57 | uses: JamesIves/github-pages-deploy-action@v4.7.3 58 | with: 59 | token: ${{ secrets.GITHUB_TOKEN }} 60 | branch: gh-pages 61 | folder: progressdialoglibrary/build/dokka/javadoc 62 | target-folder: java/latest/ 63 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /app/build 12 | /captures 13 | .externalNativeBuild 14 | .cxx 15 | github.properties 16 | local.properties 17 | *.hprof -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | ProgressDialogExample -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 20 | 21 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 36 | -------------------------------------------------------------------------------- /.idea/jarRepositories.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 14 | 15 | 19 | 20 | 24 | 25 | 29 | 30 | 34 | 35 | 39 | 40 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # ProgressDialog Library Contributing Guide 2 | 3 | **How you can contribute to this Project ?** 4 | 5 | - You can point out any issue which you faced while using this library. 6 | - You can suggest new features to be added to this library. 7 | - You can give pull requests with any reasonable changes or feature additions. 8 | - I haven't done JUnit testing for this library. You can help out with the same. 9 | - You can share about this library to your peer Android developers. 10 | 11 | **Guidelines to be followed while Contributing to this Project** 12 | 13 | - Make sure to follow the coding style which is used right now. 14 | - Don't forget to add Documentation comments to newly added **PUBLIC** methods/properties. 15 | - Make sure that the newly added code/modified code does not add bugs to the existing code. 16 | - Make sure that the code is optimized for performance and the best coding practices are used. 17 | - Ensure to make considerable changes/additions to the code before giving Pull Requests. 18 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ProgressDialog Library [![](https://jitpack.io/v/techinessoverloaded/progress-dialog.svg)](https://jitpack.io/#techinessoverloaded/progress-dialog/) [![](https://img.shields.io/github/v/release/techinessoverloaded/progress-dialog?color=green&label=Latest%20Release)](https://github.com/techinessoverloaded/progress-dialog/releases/latest) [![](https://jitpack.io/v/techinessoverloaded/progress-dialog/month.svg)](https://jitpack.io/#techinessoverloaded/progress-dialog) [![ProgressDialog Library Build Status](https://github.com/techinessoverloaded/progress-dialog/actions/workflows/checkLibraryBuildStatus.yml/badge.svg)](https://github.com/techinessoverloaded/progress-dialog/actions/workflows/checkLibraryBuildStatus.yml) [![Generate Docs and Deploy to GH Pages](https://github.com/techinessoverloaded/progress-dialog/actions/workflows/generateDocs.yml/badge.svg)](https://github.com/techinessoverloaded/progress-dialog/actions/workflows/generateDocs.yml) [![Dependabot](https://badgen.net/badge/Dependabot/enabled/green?icon=dependabot)](https://github.com/dependabot) 2 | 3 | 4 | An easily customisable ProgressDialog Library for Android API 24 and above provided by Techiness Overloaded (Developer name: Arunprasadh C). Quite Useful for showing progress during any operation. Has support for both Determinate and Indeterminate ProgressBar. Also supports Dark Theme. Has javadoc Documentation for all public Constructors, Attributes and Methods, making it easy to learn about the Library from Android Studio IDE. 5 | 6 | > [!NOTE] 7 | > It is highly recommended to use the Latest Release Version of the Library and it is strongly recommended NOT to use any Pre-release versions of the library as they are used for testing out changes and are not production-ready. It is readily observable that Pre-release versions have "a" or "rc" in their version code (Example: Version 1.4.0a4 or 1.4.4-rc1). It is strictly recommended not to use version 1.4.2 or 1.5.0 as the build artifacts are not properly published. You can instead prefer the latest version (1.5.1). 8 | 9 | **Usage examples available at** [Usage Examples](#steps-to-add-progressdialog-library-to-your-android-studio-project) 10 |
**Java Documentation of Class and Methods available at** [Java Documentation of Library](https://techinessoverloaded.github.io/progress-dialog/java/latest/com/techiness/progressdialoglibrary/ProgressDialog.html) 11 |
**Kotlin Documentation of Class and Methods available at** [Kotlin Documentation of Library](https://techinessoverloaded.github.io/progress-dialog/kotlin/latest/progressdialoglibrary/com.techiness.progressdialoglibrary/-progress-dialog/index.html) 12 |
You can find the Entire **Change Log at** [ProgressDialog Library Change Log](https://techinessoverloaded.github.io/progress-dialog/changelog.html) 13 |
See the [Contributing Guide](https://github.com/techinessoverloaded/progress-dialog/blob/master/CONTRIBUTING.md) to learn more about Contributing to this Project. 14 | 15 | ## Key Features 16 | - Highly Customisable. 17 | - Has support for Dark Theme. 18 | - Has support for AutoTheming from Android 11 (API Level 30). 19 | - Can be set in both Determinate and Indeterminate Mode. 20 | - Has support for Time Tracking in Determinate Mode. 21 | - Has support for Negative Button, Title, and ProgressView. 22 | - Desgined for usage in both Java and Kotlin Android Projects. 23 | - Clear Documentation is available. 24 | 25 | ## What's New in Version 1.5.1 (Feature Update) ? 26 | ### Features 27 | - Added Time Tracking feature for Determinate Mode ProgressDialog as suggested by [@vzool](https://github.com/vzool) in Issue [#13](https://github.com/techinessoverloaded/progress-dialog/issues/13). Time tracking can be enabled by passing `true` to the first parameter of `setOnShowListener` method. The time elapsed will be updated until the `progress` reaches `maxValue`. 28 | ### Bug Fixes 29 | - Fixed an Issue where unwanted views got displayed on the ProgressDialog, as pointed out by [@soenkegissel](https://github.com/soenkegissel) and [@mg2000](https://github.com/mg2000) in Issue [#16](https://github.com/techinessoverloaded/progress-dialog/issues/16). 30 | ### Maintenance 31 | - Merged Pull Requests [#11](https://github.com/techinessoverloaded/progress-dialog/pull/11), [#12](https://github.com/techinessoverloaded/progress-dialog/pull/12), [#14](https://github.com/techinessoverloaded/progress-dialog/pull/14), [#15](https://github.com/techinessoverloaded/progress-dialog/pull/15), [#17](https://github.com/techinessoverloaded/progress-dialog/pull/17) given by [@dependabot](https://github.com/dependabot) to update Material Version, Gradle Version, Gradle Build Action Version, ConstraintLayout Version and AppCompat Version. 32 | 33 | You can find the Entire **Change Log at** [ProgressDialog Library Change Log](https://techinessoverloaded.github.io/progress-dialog/changelog.html) 34 | 35 | ## Steps to add ProgressDialog Library to your Android Studio Project 36 | 37 | **Make Sure that you are using JDK Version 11**

38 | Include the following code in your Project-level Gradle Build file at the end of repositories: 39 | 40 | **Gradle Groovy DSL (If you have build.gradle file):** 41 | ```groovy 42 | allprojects { 43 | repositories { 44 | maven { url 'https://jitpack.io' } 45 | } 46 | } 47 | ``` 48 | 49 | **Gradle Kotlin DSL (If you have build.gradle.kts file):** 50 | ```kotlin 51 | allprojects { 52 | repositories { 53 | maven { url = uri("https://jitpack.io") } 54 | } 55 | } 56 | ``` 57 | 58 | Now, include the following dependency in your App-level Gradle Build file: 59 | > [!NOTE] 60 | > Current latest version is **1.5.1** 61 | 62 | **Gradle Groovy DSL (If you have build.gradle file):** 63 | ```groovy 64 | dependencies { 65 | implementation 'com.github.techinessoverloaded:progress-dialog:1.5.1' 66 | } 67 | ``` 68 | 69 | **Gradle Kotlin DSL (If you have build.gradle.kts file):** 70 | ```kotlin 71 | dependencies { 72 | implementation("com.github.techinessoverloaded:progress-dialog:1.5.1") 73 | } 74 | ``` 75 | 76 | #### Or you can also define the version as a String like this(You can copy either this code or the above one): 77 | **Gradle Groovy DSL (If you have build.gradle file):** 78 | ```groovy 79 | dependencies { 80 | def latest-version = "1.5.1" 81 | implementation "com.github.techinessoverloaded:progress-dialog:$latest-version" 82 | } 83 | ``` 84 | 85 | **Gradle Kotlin DSL (If you have build.gradle.kts file):** 86 | ```kotlin 87 | dependencies { 88 | val latest-version = "1.5.1" 89 | implementation("com.github.techinessoverloaded:progress-dialog:$latest-version") 90 | } 91 | ``` 92 | 93 | Now import ProgressDialog class in your Activity/Fragment: 94 | ```java 95 | import com.techiness.progressdialoglibrary.ProgressDialog; 96 | ``` 97 | 98 | ## Various Constructors available 99 | 100 | ### Simple Constructor 101 | #### Uses Light Theme by Default. 102 | > [!NOTE] 103 | > Theme can be changed after Instantiation using ```setTheme(int themeConstant)``` method. 104 | 105 | > [!IMPORTANT] 106 | > If you want to Instantiate ```ProgressDialog``` Class in a **Fragment**, use ```requireContext()``` method instead of ```this``` keyword for passing ```Context``` object. Similarly, for Instantiating ```ProgressDialog``` Class in **Inner Classes**, use ```YourActivity.this``` in **Java** or ```this@YourActivity``` in **Kotlin** instead of simple ```this``` keyword for passing ```Context``` object. 107 | 108 | #### Java Code: 109 | ```java 110 | ProgressDialog progressDialog = new ProgressDialog(this); //same as new ProgressDialog(this, ProgressDialog.THEME_LIGHT); 111 | ``` 112 | #### Kotlin Code: 113 | ```kotlin 114 | val progressDialog = ProgressDialog(this) //same as ProgressDialog(this, ProgressDialog.THEME_LIGHT) 115 | ``` 116 | 117 | ### Constructor for Alternate Theme 118 | #### This Constructor can be used for setting Dark Theme. 119 | #### Java Code: 120 | ```java 121 | ProgressDialog progressDialog = new ProgressDialog(this, ProgressDialog.THEME_DARK); 122 | ``` 123 | #### Kotlin Code: 124 | ```kotlin 125 | val progressDialog = ProgressDialog(this, ProgressDialog.THEME_DARK) 126 | ``` 127 | 128 | ### Constructor for Alternate Mode 129 | #### Default mode is Indeterminate mode. 130 | > [!NOTE] 131 | > Mode can be changed as and when necessary using in-built methods. 132 | #### Java Code: 133 | ```java 134 | ProgressDialog progressDialog = new ProgressDialog(ProgressDialog.MODE_DETERMINATE,this); // for instantiating with Determinate mode 135 | ``` 136 | ### Kotlin Code: 137 | ```kotlin 138 | val progressDialog = ProgressDialog(ProgressDialog.MODE_DETERMINATE,this) // for instantiating with Determinate mode 139 | ``` 140 | 141 | ### Constructor for Alternate Mode and Theme 142 | #### This constructor can be used to customise both Mode and Theme of ProgressDialog. 143 | #### Java Code: 144 | ```java 145 | ProgressDialog progressDialog = new ProgressDialog(ProgressDialog.MODE_DETERMINATE,this,ProgressDialog.THEME_DARK); 146 | ``` 147 | #### Kotlin Code: 148 | ```kotlin 149 | val progressDialog = ProgressDialog(ProgressDialog.MODE_DETERMINATE,this,ProgressDialog.THEME_DARK) 150 | ``` 151 | ## Simple Examples 152 | 153 | #### Note: These examples are for simple illustration of ProgressDialog Library. For completely knowing about the Library, refer to the JavaDoc/KDoc Documentation of the Library through Android Studio. 154 | 155 | ### How to use `ProgressDialog.THEME_FOLLOW_SYSTEM` with Constructor ? 156 | #### Java Code: 157 | ```java 158 | if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) //Check if Android API Level is greater than or equal to 30 159 | { 160 | AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_FOLLOW_SYSTEM); //This is optional. This will enable Android's Autotheming for the entire App 161 | ProgressDialog progressDialog = new ProgressDialog(this,ProgressDialog.THEME_FOLLOW_SYSTEM); // Enables AutoTheming for the ProgressDialog instance. 162 | } 163 | else //Autotheming not compatible 164 | { 165 | ProgressDialog progressDialog = new ProgressDialog(this,ProgressDialog.THEME_DARK); // or any other constructors mentioned above 166 | } 167 | ``` 168 | #### Kotlin Code: 169 | ```kotlin 170 | if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) //Check if Android API Level is greater than or equal to 30 171 | { 172 | AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_FOLLOW_SYSTEM) //This is optional. This will enable Android's Autotheming for the entire App 173 | val progressDialog = ProgressDialog(this,ProgressDialog.THEME_FOLLOW_SYSTEM) // Enables AutoTheming for the ProgressDialog instance. 174 | } 175 | else //Autotheming not compatible 176 | { 177 | val progressDialog = ProgressDialog(this,ProgressDialog.THEME_DARK) // or any other constructors mentioned above 178 | } 179 | ``` 180 | 181 | ### How to use `ProgressDialog.THEME_FOLLOW_SYSTEM` with `setTheme(int themeConstant)` method ? 182 | #### Java Code: 183 | ```java 184 | if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) //Check if Android API Level is greater than or equal to 30 185 | { 186 | AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_FOLLOW_SYSTEM); //This is optional. This will enable Android's Autotheming for the entire App 187 | progressDialog.setTheme(ProgressDialog.THEME_FOLLOW_SYSTEM); // Enables AutoTheming for the ProgressDialog instance. 188 | } 189 | else //Autotheming not compatible 190 | { 191 | progressDialog.setTheme(ProgressDialog.THEME_DARK); // or ProgressDialog.THEME_LIGHT 192 | } 193 | ``` 194 | #### Kotlin Code: 195 | ```kotlin 196 | if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) //Check if Android API Level is greater than or equal to 30 197 | { 198 | AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_FOLLOW_SYSTEM) //This is optional. This will enable Android's Autotheming for the entire App 199 | progressDialog.theme = ProgressDialog.THEME_FOLLOW_SYSTEM) // Enables AutoTheming for the ProgressDialog instance. 200 | } 201 | else //Autotheming not compatible 202 | { 203 | progressDialog.theme = ProgressDialog.THEME_DARK // or ProgressDialog.THEME_LIGHT 204 | } 205 | ``` 206 | 207 | ### Indeterminate ProgressDialog without Title (Light Theme) 208 | #### Java Code: 209 | ```java 210 | ProgressDialog progressDialog = new ProgressDialog(this); 211 | progressDialog.show(); 212 | ``` 213 | #### Kotlin Code: 214 | ```kotlin 215 | val progressDialog = ProgressDialog(this) 216 | progressDialog.show() 217 | ``` 218 | #### Output: 219 | 220 | 221 | ### Indeterminate ProgressDialog without Title (Dark Theme) 222 | #### Java Code: 223 | ```java 224 | progressDialog.setTheme(ProgressDialog.THEME_DARK); 225 | progressDialog.show(); 226 | ``` 227 | #### Kotlin Code: 228 | ```kotlin 229 | with(progressDialog) 230 | { 231 | theme = ProgressDialog.THEME_DARK 232 | show() 233 | } 234 | ``` 235 | #### Output: 236 | 237 | 238 | ### Determinate ProgressDialog without Title, without ProgressView, with Secondary Progress (Light Theme) 239 | #### Java Code: 240 | ```java 241 | progressDialog.setTheme(ProgressDialog.THEME_LIGHT); 242 | progressDialog.setMode(ProgressDialog.MODE_DETERMINATE); 243 | progressDialog.setProgress(65); 244 | progressDialog.setSecondaryProgress(80); 245 | progressDialog.hideProgressText(); 246 | progressDialog.show(); 247 | ``` 248 | #### Kotlin Code: 249 | ```kotlin 250 | with(progressDialog) 251 | { 252 | theme = ProgressDialog.THEME_LIGHT 253 | mode = ProgressDialog.MODE_DETERMINATE 254 | progress = 65 255 | secondaryProgress = 80 256 | hideProgressText() 257 | show() 258 | } 259 | ``` 260 | #### Output: 261 | 262 | 263 | ### Determinate ProgressDialog without Title, without ProgressView, with Secondary Progress (Dark Theme) 264 | #### Java Code: 265 | ```java 266 | progressDialog.setTheme(ProgressDialog.THEME_DARK); 267 | progressDialog.setMode(ProgressDialog.MODE_DETERMINATE); 268 | progressDialog.setProgress(65); 269 | progressDialog.setSecondaryProgress(80); 270 | progressDialog.hideProgressText(); 271 | progressDialog.show(); 272 | ``` 273 | #### Kotlin Code: 274 | ```kotlin 275 | with(progressDialog) 276 | { 277 | theme = ProgressDialog.THEME_DARK 278 | mode = ProgressDialog.MODE_DETERMINATE 279 | progress = 65 280 | secondaryProgress = 80 281 | hideProgressText() 282 | show() 283 | } 284 | ``` 285 | #### Output: 286 | 287 | 288 | ### Determinate ProgressDialog without Title, with ProgressView as Percentage (Light Theme) 289 | #### Java Code: 290 | ```java 291 | progressDialog.setTheme(ProgressDialog.THEME_LIGHT); 292 | progressDialog.setMode(ProgressDialog.MODE_DETERMINATE); 293 | progressDialog.setProgress(65); 294 | progressDialog.show(); 295 | ``` 296 | #### Kotlin Code: 297 | ```kotlin 298 | with(progressDialog) 299 | { 300 | theme = ProgressDialog.THEME_LIGHT 301 | mode = ProgressDialog.MODE_DETERMINATE 302 | setprogress = 65 303 | show() 304 | } 305 | ``` 306 | #### Output: 307 | 308 | 309 | ### Determinate ProgressDialog without Title, with ProgressView as Percentage (Dark Theme) 310 | #### Java Code: 311 | ```java 312 | progressDialog.setTheme(ProgressDialog.THEME_DARK); 313 | progressDialog.setMode(ProgressDialog.MODE_DETERMINATE); 314 | progressDialog.setProgress(65); 315 | progressDialog.show(); 316 | ``` 317 | #### Kotlin Code: 318 | ```kotlin 319 | with(progressDialog) 320 | { 321 | theme = ProgressDialog.THEME_DARK 322 | mode = ProgressDialog.MODE_DETERMINATE 323 | progress = 65 324 | show() 325 | } 326 | ``` 327 | #### Output: 328 | 329 | 330 | ### Indeterminate ProgressDialog with Title (Light Theme) 331 | #### Java Code: 332 | ```java 333 | progressDialog.setTheme(ProgressDialog.THEME_LIGHT); 334 | progressDialog.setMode(ProgressDialog.MODE_INDETERMINATE); 335 | progressDialog.setTitle("Indeterminate"); 336 | progressDialog.show(); 337 | ``` 338 | #### Kotlin Code: 339 | ```kotlin 340 | with(progressDialog) 341 | { 342 | theme = ProgressDialog.THEME_LIGHT 343 | mode = ProgressDialog.MODE_INDETERMINATE 344 | setTitle("Indeterminate") 345 | show() 346 | } 347 | ``` 348 | #### Output: 349 | 350 | 351 | ### Indeterminate ProgressDialog with Title (Dark Theme) 352 | #### Java Code: 353 | ```java 354 | progressDialog.setTheme(ProgressDialog.THEME_DARK); 355 | progressDialog.setMode(ProgressDialog.MODE_INDETERMINATE); 356 | progressDialog.setTitle("Indeterminate"); 357 | progressDialog.show(); 358 | ``` 359 | #### Kotlin Code: 360 | ```kotlin 361 | with(progressDialog) 362 | { 363 | theme = ProgressDialog.THEME_DARK 364 | mode = ProgressDialog.MODE_INDETERMINATE 365 | setTitle("Indeterminate") 366 | show() 367 | } 368 | ``` 369 | #### Output: 370 | 371 | 372 | ### Determinate ProgressDialog with Title, Secondary Progress and ProgressView as Fraction (Light Theme) 373 | #### Java Code: 374 | ```java 375 | progressDialog.setTheme(ProgressDialog.THEME_LIGHT); 376 | progressDialog.setMode(ProgressDialog.MODE_DETERMINATE); 377 | progressDialog.setTitle("Determinate"); 378 | progressDialog.setProgress(65); 379 | progressDialog.setSecondaryProgress(80); 380 | progressDialog.showProgressTextAsFraction(true); 381 | progressDialog.show(); 382 | ``` 383 | #### Kotlin Code: 384 | ```kotlin 385 | with(progressDialog) 386 | { 387 | theme = ProgressDialog.THEME_LIGHT 388 | mode = ProgressDialog.MODE_DETERMINATE 389 | setTitle("Determinate") 390 | progress = 65 391 | secondaryProgress = 80 392 | showProgressTextAsFraction(true) 393 | show() 394 | } 395 | ``` 396 | #### Output: 397 | 398 | 399 | ### Determinate ProgressDialog with Title, Secondary Progress and ProgressView as Fraction (Dark Theme) 400 | #### Java Code: 401 | ```java 402 | progressDialog.setTheme(ProgressDialog.THEME_DARK); 403 | progressDialog.setMode(ProgressDialog.MODE_DETERMINATE); 404 | progressDialog.setTitle("Determinate"); 405 | progressDialog.setProgress(65); 406 | progressDialog.setSecondaryProgress(80); 407 | progressDialog.showProgressTextAsFraction(true); 408 | progressDialog.show(); 409 | ``` 410 | #### Kotlin Code: 411 | ```kotlin 412 | with(progressDialog) 413 | { 414 | theme = ProgressDialog.THEME_DARK 415 | mode = ProgressDialog.MODE_DETERMINATE 416 | setTitle("Determinate") 417 | progress = 65 418 | secondaryProgress = 80 419 | showProgressTextAsFraction(true) 420 | show() 421 | } 422 | ``` 423 | #### Output: 424 | 425 | 426 | ### Indeterminate ProgressDialog with NegativeButton and Custom OnClickListener for NegativeButton (Light Theme) 427 | > [!NOTE] 428 | > Enabling NegativeButton will automatically enable TitleView. 429 | 430 | #### Java Code: 431 | ```java 432 | progressDialog.setTheme(ProgressDialog.THEME_LIGHT); 433 | progressDialog.setMode(ProgressDialog.MODE_INDETERMINATE); 434 | progressDialog.setNegativeButton("Dismiss","Indeterminate",v -> { 435 | Toast.makeText(this,"Custom OnClickListener for Indeterminate",Toast.LENGTH_LONG).show(); 436 | progressDialog.dismiss(); 437 | }); 438 | progressDialog.show(); 439 | ``` 440 | #### Kotlin Code: 441 | ```kotlin 442 | with(progressDialog) 443 | { 444 | theme = ProgressDialog.THEME_LIGHT 445 | mode = ProgressDialog.MODE_INDETERMINATE 446 | setNegativeButton("Dismiss", "Determinate") { 447 | Toast.makeText(this@KotlinActivity, "Custom OnClickListener for Indeterminate", Toast.LENGTH_LONG).show() 448 | dismiss() 449 | } 450 | show() 451 | } 452 | ``` 453 | #### Output: 454 | 455 | 456 | ### Indeterminate ProgressDialog with NegativeButton and Custom OnClickListener for NegativeButton (Dark Theme) 457 | > [!NOTE] 458 | > Enabling NegativeButton will automatically enable TitleView. 459 | 460 | #### Java Code: 461 | ```java 462 | progressDialog.setTheme(ProgressDialog.THEME_DARK); 463 | progressDialog.setMode(ProgressDialog.MODE_INDETERMINATE); 464 | progressDialog.setNegativeButton("Dismiss","Indeterminate",v -> { 465 | Toast.makeText(this,"Custom OnClickListener for Indeterminate",Toast.LENGTH_LONG).show(); 466 | progressDialog.dismiss(); 467 | }); 468 | progressDialog.show(); 469 | ``` 470 | #### Kotlin Code: 471 | ```kotlin 472 | with(progressDialog) 473 | { 474 | theme = ProgressDialog.THEME_DARK 475 | mode = ProgressDialog.MODE_INDETERMINATE 476 | setNegativeButton("Dismiss", "Determinate") { 477 | Toast.makeText(this@KotlinActivity, "Custom OnClickListener for Indeterminate", Toast.LENGTH_LONG).show() 478 | dismiss() 479 | } 480 | show() 481 | } 482 | ``` 483 | #### Output: 484 | 485 | 486 | ### Determinate ProgressDialog with NegativeButton and Default OnClickListener for NegativeButton (Light Theme) 487 | > [!NOTE] 488 | > Enabling NegativeButton will automatically enable TitleView. 489 | 490 | #### Java Code: 491 | ```java 492 | progressDialog.setTheme(ProgressDialog.THEME_LIGHT); 493 | progressDialog.setMode(ProgressDialog.MODE_DETERMINATE); 494 | progressDialog.setProgress(54); 495 | progressDialog.showProgressTextAsFraction(true); 496 | progressDialog.setNegativeButton("Cancel","Determinate",null); 497 | progressDialog.show(); 498 | ``` 499 | #### Kotlin Code: 500 | ```kotlin 501 | with(progressDialog) 502 | { 503 | theme = ProgressDialog.THEME_LIGHT 504 | mode = ProgressDialog.MODE_DETERMINATE 505 | progress = 54 506 | showProgressTextAsFraction(true) 507 | setNegativeButton("Cancel","Determinate",null) 508 | show() 509 | } 510 | ``` 511 | #### Output: 512 | 513 | 514 | ### Determinate ProgressDialog with NegativeButton and Default OnClickListener for NegativeButton (Dark Theme) 515 | ##### Note: Enabling NegativeButton will automatically enable TitleView. 516 | #### Java Code: 517 | ```java 518 | progressDialog.setTheme(ProgressDialog.THEME_DARK); 519 | progressDialog.setMode(ProgressDialog.MODE_DETERMINATE); 520 | progressDialog.setProgress(54); 521 | progressDialog.showProgressTextAsFraction(true); 522 | progressDialog.setNegativeButton("Cancel","Determinate",null); 523 | progressDialog.show(); 524 | ``` 525 | #### Kotlin Code: 526 | ```kotlin 527 | with(progressDialog) 528 | { 529 | theme = ProgressDialog.THEME_DARK 530 | mode = ProgressDialog.MODE_DETERMINATE 531 | progress = 54 532 | showProgressTextAsFraction(true) 533 | setNegativeButton("Cancel","Determinate",null) 534 | show() 535 | } 536 | ``` 537 | #### Output: 538 | 539 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /app/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("com.android.application") 3 | kotlin("android") 4 | } 5 | 6 | android { 7 | compileSdk = 32 8 | 9 | defaultConfig { 10 | applicationId = "com.techiness.progressdialogexample" 11 | minSdk = 24 12 | targetSdk = 32 13 | versionCode = 1 14 | versionName = "1.0" 15 | testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" 16 | } 17 | 18 | buildTypes { 19 | getByName("release") { 20 | isMinifyEnabled = false 21 | proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") 22 | } 23 | } 24 | compileOptions { 25 | sourceCompatibility = JavaVersion.VERSION_11 26 | targetCompatibility = JavaVersion.VERSION_11 27 | } 28 | kotlinOptions { 29 | jvmTarget = JavaVersion.VERSION_11.toString() 30 | } 31 | } 32 | 33 | dependencies { 34 | //implementation(project(":progressdialoglibrary")) 35 | val progressVersion = "1.5.1" 36 | implementation("androidx.appcompat:appcompat:1.7.0-alpha03") 37 | implementation("com.google.android.material:material:1.11.0") 38 | implementation("androidx.constraintlayout:constraintlayout:2.2.0") 39 | testImplementation("junit:junit:4.13.2") 40 | androidTestImplementation("androidx.test.ext:junit:1.2.1") 41 | androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1") 42 | implementation("com.github.techinessoverloaded:progress-dialog:$progressVersion") 43 | } 44 | repositories { 45 | mavenCentral() 46 | } -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle.kts.kts. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /app/src/androidTest/java/com/techiness/progressdialogexample/InstrumentedTestForLibrary.java: -------------------------------------------------------------------------------- 1 | package com.techiness.progressdialogexample; 2 | 3 | import android.content.Context; 4 | import androidx.test.platform.app.InstrumentationRegistry; 5 | import androidx.test.ext.junit.runners.AndroidJUnit4; 6 | import org.junit.Test; 7 | import org.junit.runner.RunWith; 8 | import static org.junit.Assert.*; 9 | 10 | import com.techiness.progressdialoglibrary.ProgressDialog; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class InstrumentedTestForLibrary 19 | { 20 | private final Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); 21 | private ProgressDialog progressDialog; 22 | 23 | @Test 24 | public void checkIfModeAndThemeAreSet1() 25 | { 26 | progressDialog = new ProgressDialog(appContext); 27 | assertEquals(progressDialog.getMode(), ProgressDialog.MODE_INDETERMINATE); 28 | assertEquals(progressDialog.getTheme(), ProgressDialog.THEME_LIGHT); 29 | } 30 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 15 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/java/com/techiness/progressdialogexample/KotlinActivity.kt: -------------------------------------------------------------------------------- 1 | package com.techiness.progressdialogexample 2 | 3 | import androidx.appcompat.app.AppCompatActivity 4 | import android.os.Bundle 5 | import android.widget.Toast 6 | import androidx.annotation.RestrictTo 7 | import com.techiness.progressdialoglibrary.ProgressDialog 8 | 9 | @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) 10 | class KotlinActivity : AppCompatActivity() { 11 | override fun onCreate(savedInstanceState: Bundle?) { 12 | super.onCreate(savedInstanceState) 13 | setContentView(R.layout.activity_kotlin) 14 | ProgressDialog(this).also { progressDialog -> 15 | progressDialog.setOnShowListener { 16 | Toast.makeText(this@KotlinActivity, "From Kotlin", Toast.LENGTH_LONG).show() 17 | } 18 | progressDialog.show() 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /app/src/main/java/com/techiness/progressdialogexample/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.techiness.progressdialogexample; 2 | 3 | import androidx.annotation.RestrictTo; 4 | import androidx.appcompat.app.AppCompatActivity; 5 | import androidx.appcompat.app.AppCompatDelegate; 6 | import androidx.appcompat.widget.SwitchCompat; 7 | import android.content.DialogInterface; 8 | import android.content.Intent; 9 | import android.os.Build; 10 | import android.os.Bundle; 11 | import android.os.Handler; 12 | import android.os.Looper; 13 | import android.widget.Button; 14 | import android.widget.Toast; 15 | import com.techiness.progressdialoglibrary.ProgressDialog; 16 | 17 | @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) 18 | public class MainActivity extends AppCompatActivity 19 | { 20 | ProgressDialog progressDialog; 21 | Button showDeterBut,showInDeterBut,showDeterTitleBut,showInDeterTitleBut,showDeterWithoutProgressBut,showDeterWithNegativeButton,showInDeterWithNegativeButton; 22 | SwitchCompat darkSwitch; 23 | @Override 24 | protected void onCreate(Bundle savedInstanceState) 25 | { 26 | super.onCreate(savedInstanceState); 27 | setContentView(R.layout.activity_main); 28 | bindViews(); 29 | if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) 30 | { 31 | AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM); 32 | progressDialog = new ProgressDialog(ProgressDialog.MODE_DETERMINATE,this,ProgressDialog.THEME_FOLLOW_SYSTEM); 33 | darkSwitch.setEnabled(false); 34 | } 35 | else 36 | { 37 | progressDialog = new ProgressDialog(MainActivity.this); 38 | progressDialog.setMode(ProgressDialog.MODE_DETERMINATE); 39 | } 40 | showDeterBut.setText(String.valueOf(progressDialog.getTheme())); 41 | progressDialog.setCancelable(true); 42 | setOnClickListeners(); 43 | } 44 | private void bindViews() 45 | { 46 | darkSwitch=findViewById(R.id.darkSwitch); 47 | showDeterBut=findViewById(R.id.showDeterBut); 48 | showInDeterBut=findViewById(R.id.showInDeterBut); 49 | showDeterTitleBut=findViewById(R.id.showDeterTitleBut); 50 | showInDeterTitleBut=findViewById(R.id.showInDeterTitleBut); 51 | showDeterWithoutProgressBut=findViewById(R.id.showDeterWithoutProgressBut); 52 | showDeterWithNegativeButton=findViewById(R.id.showDeterWithNegativeButton); 53 | showInDeterWithNegativeButton=findViewById(R.id.showInDeterWithNegativeButton); 54 | } 55 | private void setOnClickListeners() 56 | { 57 | darkSwitch.setOnCheckedChangeListener((buttonView, isChecked) -> { 58 | if(isChecked&&progressDialog.getTheme()!=ProgressDialog.THEME_DARK) 59 | { 60 | progressDialog.setTheme(ProgressDialog.THEME_DARK); 61 | } 62 | else 63 | { 64 | if(progressDialog.getTheme()!=ProgressDialog.THEME_LIGHT) 65 | { 66 | progressDialog.setTheme(ProgressDialog.THEME_LIGHT); 67 | } 68 | } 69 | }); 70 | showDeterBut.setOnClickListener(v->onClick(1)); 71 | showInDeterBut.setOnClickListener(v->onClick(2)); 72 | showDeterTitleBut.setOnClickListener(v->onClick(3)); 73 | showInDeterTitleBut.setOnClickListener(v->onClick(4)); 74 | showDeterWithoutProgressBut.setOnClickListener(v->onClick(5)); 75 | showDeterWithNegativeButton.setOnClickListener(v->onClick(6)); 76 | showInDeterWithNegativeButton.setOnClickListener(v->onClick(7)); 77 | } 78 | private void onClick(int requestCode) 79 | { 80 | switch(requestCode) 81 | { 82 | case 1: 83 | progressDialog.setMode(ProgressDialog.MODE_DETERMINATE); 84 | progressDialog.hideTitle(); 85 | progressDialog.setProgress(65); 86 | progressDialog.setSecondaryProgress(0); 87 | progressDialog.hideNegativeButton(); 88 | progressDialog.show(); 89 | break; 90 | case 2: 91 | progressDialog.setMode(ProgressDialog.MODE_INDETERMINATE); 92 | progressDialog.hideTitle(); 93 | progressDialog.show(); 94 | progressDialog.hideNegativeButton(); 95 | break; 96 | case 3: 97 | progressDialog.setMode(ProgressDialog.MODE_DETERMINATE); 98 | progressDialog.setTitle("Determinate"); 99 | progressDialog.showProgressTextAsFraction(true); 100 | progressDialog.hideNegativeButton(); 101 | progressDialog.setProgress(65); 102 | progressDialog.setSecondaryProgress(80); 103 | progressDialog.setCancelable(false); 104 | progressDialog.setOnShowListener(true, new DialogInterface.OnShowListener() { 105 | @Override 106 | public void onShow(DialogInterface dialog) 107 | { 108 | Toast.makeText(MainActivity.this,progressDialog.isCancelable()? "true": "false",Toast.LENGTH_LONG).show(); 109 | } 110 | }); 111 | progressDialog.show(); 112 | new Handler(Looper.getMainLooper()).postDelayed(new Runnable() { 113 | @Override 114 | public void run() 115 | { 116 | progressDialog.setProgress(100); 117 | progressDialog.dismiss(); 118 | } 119 | }, 50000); 120 | break; 121 | case 4: 122 | progressDialog.setMode(ProgressDialog.MODE_INDETERMINATE); 123 | progressDialog.setTitle("Indeterminate"); 124 | progressDialog.hideNegativeButton(); 125 | progressDialog.show(); 126 | break; 127 | case 5: 128 | progressDialog.setMode(ProgressDialog.MODE_DETERMINATE); 129 | progressDialog.hideProgressText(); 130 | progressDialog.setProgress(65); 131 | progressDialog.hideTitle(); 132 | progressDialog.show(); 133 | break; 134 | case 6: 135 | progressDialog.setMode(ProgressDialog.MODE_DETERMINATE); 136 | progressDialog.setProgress(54); 137 | progressDialog.setSecondaryProgress(0); 138 | progressDialog.showProgressTextAsFraction(true); 139 | progressDialog.setNegativeButton("Cancel","Determinate",null); 140 | progressDialog.setOnShowListener(true, new DialogInterface.OnShowListener() { 141 | @Override 142 | public void onShow(DialogInterface dialog) 143 | { 144 | Toast.makeText(MainActivity.this,"On Show",Toast.LENGTH_LONG).show(); 145 | } 146 | }); 147 | progressDialog.setOnDismissListener(new DialogInterface.OnDismissListener() { 148 | @Override 149 | public void onDismiss(DialogInterface dialog) { 150 | Toast.makeText(MainActivity.this, "On Dismiss",Toast.LENGTH_LONG).show(); 151 | } 152 | }); 153 | progressDialog.show(); 154 | break; 155 | case 7: 156 | progressDialog.setMode(ProgressDialog.MODE_INDETERMINATE); 157 | progressDialog.setNegativeButton("Go to next activity","Indeterminate",v -> { 158 | Toast.makeText(MainActivity.this,"Custom OnClickListener for Indeterminate",Toast.LENGTH_LONG).show(); 159 | progressDialog.dismiss(); 160 | Intent intent = new Intent(MainActivity.this,KotlinActivity.class); 161 | startActivity(intent); 162 | }); 163 | progressDialog.show(); 164 | break; 165 | default: 166 | break; 167 | } 168 | } 169 | } -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 15 | 18 | 21 | 22 | 23 | 24 | 30 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_kotlin.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 15 | 21 |