├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ └── issue_template.md ├── PULL_REQUEST_TEMPLATE.md └── workflows │ └── build.yml ├── .gitignore ├── .travis.yml ├── CNAME ├── CODE_OF_CONDUCT.md ├── LICENSE ├── README.md ├── build.gradle ├── dynamic-theme ├── build.gradle ├── maven.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── pranavpandey │ │ └── android │ │ └── dynamic │ │ └── theme │ │ ├── AppTheme.java │ │ ├── AppWidgetTheme.java │ │ ├── DynamicColors.java │ │ ├── DynamicPalette.java │ │ ├── Theme.java │ │ ├── ThemeContract.java │ │ ├── adapter │ │ └── DynamicThemeTypeAdapter.java │ │ ├── annotation │ │ └── Exclude.java │ │ ├── base │ │ ├── AccentTheme.java │ │ ├── AutoTheme.java │ │ ├── BackgroundAware.java │ │ ├── BackgroundTheme.java │ │ ├── BaseTheme.java │ │ ├── CodeTheme.java │ │ ├── CornerTheme.java │ │ ├── DynamicColor.java │ │ ├── ElevationTheme.java │ │ ├── ErrorTheme.java │ │ ├── FallbackTheme.java │ │ ├── PrimaryTheme.java │ │ ├── ResourceTheme.java │ │ ├── StringTheme.java │ │ ├── StrokeTheme.java │ │ ├── StyleTheme.java │ │ ├── SurfaceTheme.java │ │ ├── TextTheme.java │ │ ├── TranslucentTheme.java │ │ ├── TypeTheme.java │ │ └── WidgetTheme.java │ │ ├── receiver │ │ └── DynamicThemeReceiver.java │ │ ├── strategy │ │ └── ExcludeStrategy.java │ │ └── util │ │ ├── DynamicCodeUtils.java │ │ └── DynamicThemeUtils.java │ └── res │ ├── drawable-anydpi-v23 │ ├── adt_ic_palette.xml │ ├── adt_ic_presets.xml │ ├── adt_ic_style.xml │ └── adt_ic_theme.xml │ ├── drawable-hdpi-v21 │ ├── adt_ic_palette.png │ ├── adt_ic_style.png │ └── adt_ic_theme.png │ ├── drawable-hdpi │ ├── adt_ic_palette.png │ ├── adt_ic_presets.png │ ├── adt_ic_style.png │ └── adt_ic_theme.png │ ├── drawable-mdpi-v21 │ ├── adt_ic_palette.png │ ├── adt_ic_style.png │ └── adt_ic_theme.png │ ├── drawable-mdpi │ ├── adt_ic_palette.png │ ├── adt_ic_presets.png │ ├── adt_ic_style.png │ └── adt_ic_theme.png │ ├── drawable-xhdpi-v21 │ ├── adt_ic_palette.png │ ├── adt_ic_style.png │ └── adt_ic_theme.png │ ├── drawable-xhdpi │ ├── adt_ic_palette.png │ ├── adt_ic_presets.png │ ├── adt_ic_style.png │ └── adt_ic_theme.png │ ├── drawable-xxhdpi-v21 │ ├── adt_ic_palette.png │ ├── adt_ic_style.png │ └── adt_ic_theme.png │ ├── drawable-xxhdpi │ ├── adt_ic_palette.png │ ├── adt_ic_presets.png │ ├── adt_ic_style.png │ └── adt_ic_theme.png │ ├── drawable-xxxhdpi-v21 │ ├── adt_ic_palette.png │ ├── adt_ic_style.png │ └── adt_ic_theme.png │ ├── drawable-xxxhdpi │ ├── adt_ic_palette.png │ ├── adt_ic_presets.png │ ├── adt_ic_style.png │ └── adt_ic_theme.png │ ├── drawable │ └── adt_ic_app.xml │ └── values │ ├── attrs.xml │ ├── colors.xml │ └── integers.xml ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── graphics ├── apps │ └── pranavpandey-palettes.png ├── code.png ├── icon.png ├── icon.psd ├── legacy │ ├── icon.png │ └── icon.psd └── preview.png └── settings.gradle /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # Funding links 2 | 3 | github: pranavpandey 4 | open_collective: pranavpandeydev 5 | ko_fi: pranavpandey 6 | buy_me_a_coffee: pranavpandey 7 | patreon: pranavpandey 8 | custom: ['paypal.me/pranavpandeydev'] 9 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/issue_template.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Issue 3 | about: Create a issue to help us improve 4 | title: "Short description of the issue" 5 | --- 6 | 7 | **Description:** Full description of the issue. 8 | 9 | **Expected behavior:** Screenshots and/or description of the expected behavior. 10 | 11 | **Source code:** [OPTIONAL] The code snippet which is causing this issue. 12 | 13 | **Sample app and/or repro:** [OPTIONAL] A sample app or steps to reproduce the issue. You may attach a `zip` or `APK` file of the sample app or a link to the GitHub repository. 14 | 15 | **Android API version:** Android API version. `API 19` 16 | 17 | **Library version:** The Library version you are using. `1.0.0` 18 | 19 | **Device:** Device on which the bug was encountered. `Emulator or Brand Model` 20 | 21 | *Please make sure that you are using the [latest version](https://github.com/pranavpandey/dynamic-theme/releases) of the library and we also accept [pull requests](https://github.com/pranavpandey/dynamic-theme/pulls).* 22 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### Thanks for starting a pull request! 2 | 3 | ## Changes 4 | 5 | - 6 | - 7 | 8 | ## Testing 9 | 10 | Describe how you tested your changes. 11 | 12 | ## Issues 13 | 14 | [OPTIONAL] Link to GitHub issues it solves. `Resolve #1234` 15 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | 8 | jobs: 9 | build: 10 | runs-on: ubuntu-latest 11 | timeout-minutes: 60 12 | 13 | steps: 14 | - name: Checkout 15 | uses: actions/checkout@v3 16 | 17 | - name: Setup JDK 17 18 | uses: actions/setup-java@v3 19 | with: 20 | distribution: 'zulu' 21 | java-version: 17 22 | 23 | - name: Setup Gradle 24 | uses: gradle/gradle-build-action@v2 25 | 26 | - name: Build with Gradle 27 | run: | 28 | chmod +x gradlew 29 | ./gradlew build 30 | 31 | - name: Generate Javadoc 32 | if: github.ref_type == 'tag' 33 | run: ./gradlew generateJavadoc 34 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | 15 | # Gradle files 16 | .gradle/ 17 | build/ 18 | release/ 19 | 20 | # IntelliJ project files 21 | **.iml 22 | .idea 23 | 24 | # Android Studio captures folder 25 | captures/ 26 | 27 | # Local configuration file (sdk path, etc) 28 | local.properties 29 | 30 | # Proguard folder generated by Eclipse 31 | proguard/ 32 | 33 | # Log Files 34 | *.log 35 | 36 | # Misc 37 | .DS_Store -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: android 2 | jdk: oraclejdk17 3 | 4 | before_install: 5 | - mkdir "$ANDROID_HOME/licenses" || true 6 | - echo -e "\n24333f8a63b6825ea9c5514f83c2829b004d1fee" > "$ANDROID_HOME/licenses/android-sdk-license" 7 | - echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "$ANDROID_HOME/licenses/android-sdk-preview-license" 8 | 9 | android: 10 | components: 11 | - tools 12 | - platform-tools 13 | - build-tools-35.0.0 14 | - android-35 15 | - extra-android-support 16 | - extra-android-m2repository 17 | - extra-google-m2repository 18 | before_script: 19 | - chmod +x gradlew 20 | script: 21 | - ./gradlew build 22 | 23 | after_success: 24 | - ./gradlew generateJavadoc 25 | 26 | deploy: 27 | provider: pages 28 | token: $GITHUB_TOKEN 29 | edge: true 30 | keep_history: true 31 | local_dir: dynamic-theme/build/docs/javadoc/release 32 | on: 33 | branch: master 34 | tags: true 35 | -------------------------------------------------------------------------------- /CNAME: -------------------------------------------------------------------------------- 1 | pranavpandey.org -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | We as members, contributors, and leaders pledge to make participation in our 6 | community a harassment-free experience for everyone, regardless of age, body 7 | size, visible or invisible disability, ethnicity, sex characteristics, gender 8 | identity and expression, level of experience, education, socio-economic status, 9 | nationality, personal appearance, race, caste, color, religion, or sexual 10 | identity and orientation. 11 | 12 | We pledge to act and interact in ways that contribute to an open, welcoming, 13 | diverse, inclusive, and healthy community. 14 | 15 | ## Our Standards 16 | 17 | Examples of behavior that contributes to a positive environment for our 18 | community include: 19 | 20 | * Demonstrating empathy and kindness toward other people 21 | * Being respectful of differing opinions, viewpoints, and experiences 22 | * Giving and gracefully accepting constructive feedback 23 | * Accepting responsibility and apologizing to those affected by our mistakes, 24 | and learning from the experience 25 | * Focusing on what is best not just for us as individuals, but for the overall 26 | community 27 | 28 | Examples of unacceptable behavior include: 29 | 30 | * The use of sexualized language or imagery, and sexual attention or advances of 31 | any kind 32 | * Trolling, insulting or derogatory comments, and personal or political attacks 33 | * Public or private harassment 34 | * Publishing others' private information, such as a physical or email address, 35 | without their explicit permission 36 | * Other conduct which could reasonably be considered inappropriate in a 37 | professional setting 38 | 39 | ## Enforcement Responsibilities 40 | 41 | Community leaders are responsible for clarifying and enforcing our standards of 42 | acceptable behavior and will take appropriate and fair corrective action in 43 | response to any behavior that they deem inappropriate, threatening, offensive, 44 | or harmful. 45 | 46 | Community leaders have the right and responsibility to remove, edit, or reject 47 | comments, commits, code, wiki edits, issues, and other contributions that are 48 | not aligned to this Code of Conduct, and will communicate reasons for moderation 49 | decisions when appropriate. 50 | 51 | ## Scope 52 | 53 | This Code of Conduct applies within all community spaces, and also applies when 54 | an individual is officially representing the community in public spaces. 55 | Examples of representing our community include using an official e-mail address, 56 | posting via an official social media account, or acting as an appointed 57 | representative at an online or offline event. 58 | 59 | ## Enforcement 60 | 61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 62 | reported to the community leaders responsible for enforcement at 63 | support@pranavpandey.com. 64 | All complaints will be reviewed and investigated promptly and fairly. 65 | 66 | All community leaders are obligated to respect the privacy and security of the 67 | reporter of any incident. 68 | 69 | ## Enforcement Guidelines 70 | 71 | Community leaders will follow these Community Impact Guidelines in determining 72 | the consequences for any action they deem in violation of this Code of Conduct: 73 | 74 | ### 1. Correction 75 | 76 | **Community Impact**: Use of inappropriate language or other behavior deemed 77 | unprofessional or unwelcome in the community. 78 | 79 | **Consequence**: A private, written warning from community leaders, providing 80 | clarity around the nature of the violation and an explanation of why the 81 | behavior was inappropriate. A public apology may be requested. 82 | 83 | ### 2. Warning 84 | 85 | **Community Impact**: A violation through a single incident or series of 86 | actions. 87 | 88 | **Consequence**: A warning with consequences for continued behavior. No 89 | interaction with the people involved, including unsolicited interaction with 90 | those enforcing the Code of Conduct, for a specified period of time. This 91 | includes avoiding interactions in community spaces as well as external channels 92 | like social media. Violating these terms may lead to a temporary or permanent 93 | ban. 94 | 95 | ### 3. Temporary Ban 96 | 97 | **Community Impact**: A serious violation of community standards, including 98 | sustained inappropriate behavior. 99 | 100 | **Consequence**: A temporary ban from any sort of interaction or public 101 | communication with the community for a specified period of time. No public or 102 | private interaction with the people involved, including unsolicited interaction 103 | with those enforcing the Code of Conduct, is allowed during this period. 104 | Violating these terms may lead to a permanent ban. 105 | 106 | ### 4. Permanent Ban 107 | 108 | **Community Impact**: Demonstrating a pattern of violation of community 109 | standards, including sustained inappropriate behavior, harassment of an 110 | individual, or aggression toward or disparagement of classes of individuals. 111 | 112 | **Consequence**: A permanent ban from any sort of public interaction within the 113 | community. 114 | 115 | ## Attribution 116 | 117 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 118 | version 2.1, available at 119 | [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1]. 120 | 121 | Community Impact Guidelines were inspired by 122 | [Mozilla's code of conduct enforcement ladder][Mozilla CoC]. 123 | 124 | For answers to common questions about this code of conduct, see the FAQ at 125 | [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at 126 | [https://www.contributor-covenant.org/translations][translations]. 127 | 128 | [homepage]: https://www.contributor-covenant.org 129 | [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html 130 | [Mozilla CoC]: https://github.com/mozilla/diversity 131 | [FAQ]: https://www.contributor-covenant.org/faq 132 | [translations]: https://www.contributor-covenant.org/translations 133 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright 2019-2025 Pranav Pandey 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Dynamic Theme 4 | 5 | [![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg?)](https://www.apache.org/licenses/LICENSE-2.0.html) 6 | [![Release](https://img.shields.io/maven-central/v/com.pranavpandey.android/dynamic-theme)](https://search.maven.org/artifact/com.pranavpandey.android/dynamic-theme) 7 | 8 | **A text (JSON) based theme engine for Android 4.0 (API 14) and above.** 9 | 10 | > [!IMPORTANT] 11 | > It uses [AndroidX][androidx] so, first [migrate][androidx-migrate] your project to AndroidX. 12 |
Since v3.1.0, it is dependent on Java 8 due to the dependency on 13 | [Dynamic Utils][dynamic-utils]. 14 |
Since v4.5.1, it is targeting Java 17 to provide maximum compatibility. 15 |
Since v4.6.0, the minimum SDK is Android 4.4 (API 19) to comply with the latest policies. 16 |
Since v4.6.1, the minimum SDK is Android 5.0 (API 21) to comply with the latest policies. 17 | 18 |    19 | 20 | ``` 21 | { 22 | "backgroundColor": "#455A64", 23 | "tintBackgroundColor": "auto", 24 | "surfaceColor": "auto", 25 | "tintSurfaceColor": "auto", 26 | "primaryColor": "#FF455A64", 27 | "tintPrimaryColor": "auto", 28 | "primaryColorDark": "auto", 29 | "tintPrimaryColorDark": "auto", 30 | "accentColor": "#FFE6EE9C", 31 | "tintAccentColor": "auto", 32 | "accentColorDark": "auto", 33 | "tintAccentColorDark": "auto", 34 | "errorColor": "auto", 35 | "tintErrorColor": "auto", 36 | "textPrimaryColor": "auto", 37 | "textPrimaryColorInverse": "auto", 38 | "textSecondaryColor": "auto", 39 | "textSecondaryColorInverse": "auto", 40 | "fontScale": "auto", 41 | "cornerRadius": "auto", 42 | "backgroundAware": "auto", 43 | "contrast": "auto", 44 | "opacity": "auto", 45 | "elevation": "auto", 46 | "style": "auto" 47 | } 48 | ``` 49 | 50 | --- 51 | 52 | ## Contents 53 | 54 | - [Format](#format) 55 | - [Installation](#installation) 56 | - [Usage](#usage) 57 | - [Dependency](#dependency) 58 | - [Proguard](#proguard) 59 | - [Palettes](#palettes) 60 | - [License](#license) 61 | 62 | --- 63 | 64 | ## Format 65 | 66 | A dynamic theme can be represented as a `JSON`, `URL` or a `File` with `.theme` extension 67 | containing the JSON text. Use the Palettes app for Android to create or share dynamic themes 68 | in various formats. However, the most suitable way is to share it via a URL that can be imported 69 | easily on various platforms. 70 | 71 | ### JSON 72 | 73 | A `JSON` is the original format for the dynamic theme that provides cross-app functionality. 74 | 75 | ```json 76 | { 77 | "backgroundColor": "auto|color", 78 | "tintBackgroundColor": "auto|color", 79 | "surfaceColor": "auto|color", 80 | "tintSurfaceColor": "auto|color", 81 | "primaryColor": "auto|color", 82 | "tintPrimaryColor": "auto|color", 83 | "primaryColorDark": "auto|color", 84 | "tintPrimaryColorDark": "auto|color", 85 | "accentColor": "auto|color", 86 | "tintAccentColor": "auto|color", 87 | "accentColorDark": "auto|color", 88 | "tintAccentColorDark": "auto|color", 89 | "errorColor": "auto|color", 90 | "tintErrorColor": "auto|color", 91 | "textPrimaryColor": "auto|color", 92 | "textPrimaryColorInverse": "auto|color", 93 | "textSecondaryColor": "auto|color", 94 | "textSecondaryColorInverse": "auto|color", 95 | "fontScale": "auto|integer", 96 | "cornerRadius": "auto|system|integer", 97 | "backgroundAware": "auto|disable|enable", 98 | "contrast": "auto|integer", 99 | "opacity": "auto|integer", 100 | "elevation": "auto|disable|enable", 101 | "style": "auto|custom", 102 | "header": "auto|hide|show" 103 | } 104 | ``` 105 | 106 | ### URL 107 | 108 | A `URL` is the short representation of the theme `JSON` that can be shared on the platforms 109 | having a character limit like Twitter. This is the most suitable way to share a dynamic theme that 110 | can be imported easily in various apps or platforms. 111 | 112 | #### Mappings 113 | 114 | | JSON | URL | JSON | URL | 115 | |:---------------------|-----|:--------------------------|-----| 116 | | {,} | | "" | | 117 | | Split (Key) | - | Dark \| Inverse | Z | 118 | | backgroundColor | 0 | tintBackgroundColor | 1 | 119 | | surfaceColor | 2 | tintSurfaceColor | 3 | 120 | | primaryColor | 4 | tintPrimaryColor | 5 | 121 | | primaryColorDark | 4Z | tintPrimaryColorDark | 7 | 122 | | accentColor | 8 | tintAccentColor | 9 | 123 | | accentColorDark | 8Z | tintAccentColorDark | 11 | 124 | | errorColor | 21 | tintErrorColor | 22 | 125 | | textPrimaryColor | 12 | textPrimaryColorInverse | 12Z | 126 | | textSecondaryColor | 14 | textSecondaryColorInverse | 14Z | 127 | | fontScale | 16 | cornerRadius | 17 | 128 | | backgroundAware | 18 | contrast | 25 | 129 | | opacity | 20 | elevation | 26 | 130 | | style | 23 | header | 19 | 131 | 132 | #### Values 133 | 134 | | JSON | URL | JSON | URL | 135 | | :-------------| --- | :----- |-----| 136 | | Split (Value) | v | # | X | 137 | | auto | A | system | M | 138 | | disable | D | enable | E | 139 | | hide | H | show | S | 140 | 141 | ### Code 142 | 143 | A `QR code` representation of the theme `URL` to easily share themes across various platforms 144 | and devices. 145 | 146 | ### File 147 | 148 | A `File` with `.theme` extension containing the JSON text. Currently, it is possible to export 149 | or import a dynamic theme file on the Android (Java) platform. 150 | 151 | --- 152 | 153 | ## Installation 154 | 155 | It can be installed by adding the following dependency to your `build.gradle` file: 156 | 157 | ```groovy 158 | dependencies { 159 | // For AndroidX enabled projects. 160 | implementation 'com.pranavpandey.android:dynamic-theme:4.6.1' 161 | } 162 | ``` 163 | 164 | --- 165 | 166 | ## Usage 167 | 168 | It can be used in raw JSON format or can be implemented on the Android (Java) platform. 169 | 170 | > For a complete reference, please read the [documentation][documentation]. 171 | 172 | ### Android (Java) 173 | 174 | Just implement the [AppTheme][app theme] or [AppWidgetTheme][app widget theme] to create a 175 | dynamic theme. A possible implementation can be found [here][theme implementation]. 176 | 177 | ```java 178 | public class DynamicAppTheme implements AppTheme { 179 | 180 | ... 181 | 182 | @Override 183 | public @StyleRes int getThemeRes() { 184 | return themeRes; 185 | } 186 | 187 | @Override 188 | public @NonNull DynamicAppTheme setThemeRes(@StyleRes int themeRes) { 189 | this.themeRes = themeRes; 190 | 191 | return this; 192 | } 193 | 194 | ... 195 | 196 | @Override 197 | public @NonNull String toJsonString() { 198 | return new Gson().toJson(new DynamicAppTheme(this)); 199 | } 200 | 201 | @Override 202 | public @NonNull String toDynamicString() { 203 | return new GsonBuilder().setExclusionStrategies(new ExcludeStrategy()) 204 | .registerTypeAdapter(DynamicAppTheme.class, new DynamicThemeTypeAdapter<>()) 205 | .setPrettyPrinting().create().toJson(new DynamicAppTheme(this)); 206 | } 207 | } 208 | ``` 209 | 210 | ### Dependency 211 | 212 | It depends on the [dynamic-utils][dynamic-utils] to perform 213 | various internal operations. So, its functions can also be used to perform other useful operations. 214 | 215 | ### Proguard 216 | 217 | This library uses [Gson][gson] and has custom strategy to process the theme data. 218 | It will automatically apply the appropriate rules if proguard is enabled in the project. 219 | 220 | The following rules will be applied by this library: 221 | 222 | ```yml 223 | # Gson uses generic type information stored in a class file when working with fields. 224 | # Proguard removes such information by default, so configure it to keep all of it. 225 | -keepattributes Signature 226 | 227 | # For using Gson annotation. 228 | -keepattributes *Annotation* 229 | 230 | # Gson specific classes. 231 | -keep class sun.misc.Unsafe { *; } 232 | -keep class com.google.gson.** { *; } 233 | ``` 234 | 235 | --- 236 | 237 | 238 | 239 | ## Palettes 240 | 241 | [Palettes][palettes] is a universal manager for apps supporting the dynamic theme on Android. 242 | It provides some default configurations that can be extended to create custom ones. 243 | Let's give it a try to explore its other useful features. 244 | 245 | - A collection of theme presets that can be applied in the supported apps. 246 | - Extend them to create custom ones according to the requirement. 247 | - Preview them natively in the supported apps and widgets. 248 | - Experimental option to enable dark mode in devices that don't have a system setting. 249 | 250 | --- 251 | 252 | ## Author 253 | 254 | Pranav Pandey 255 | 256 | [![GitHub](https://img.shields.io/github/followers/pranavpandey?label=GitHub&style=social)](https://github.com/pranavpandey) 257 | [![Follow on Twitter](https://img.shields.io/twitter/follow/pranavpandeydev?label=Follow&style=social)](https://twitter.com/intent/follow?screen_name=pranavpandeydev) 258 | [![Donate via PayPal](https://img.shields.io/static/v1?label=Donate&message=PayPal&color=blue)](https://paypal.me/pranavpandeydev) 259 | 260 | --- 261 | 262 | ## License 263 | 264 | Copyright 2019-2025 Pranav Pandey 265 | 266 | Licensed under the Apache License, Version 2.0 (the "License"); 267 | you may not use this file except in compliance with the License. 268 | You may obtain a copy of the License at 269 | 270 | http://www.apache.org/licenses/LICENSE-2.0 271 | 272 | Unless required by applicable law or agreed to in writing, software 273 | distributed under the License is distributed on an "AS IS" BASIS, 274 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 275 | See the License for the specific language governing permissions and 276 | limitations under the License. 277 | 278 | 279 | [androidx]: https://developer.android.com/jetpack/androidx 280 | [androidx core]: https://developer.android.com/jetpack/androidx/releases/core 281 | [androidx-migrate]: https://developer.android.com/jetpack/androidx/migrate 282 | [documentation]: https://pranavpandey.github.io/dynamic-theme 283 | [app theme]: ./dynamic-theme/src/main/java/com/pranavpandey/android/dynamic/theme/AppTheme.java 284 | [app widget theme]: ./dynamic-theme/src/main/java/com/pranavpandey/android/dynamic/theme/AppWidgetTheme.java 285 | [theme implementation]: https://github.com/pranavpandey/dynamic-support/blob/master/dynamic-support/src/main/java/com/pranavpandey/android/dynamic/support/model/DynamicAppTheme.java 286 | [dynamic-utils]: https://github.com/pranavpandey/dynamic-utils 287 | [gson]: https://github.com/google/gson 288 | [palettes]: https://play.google.com/store/apps/details?id=com.pranavpandey.theme 289 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2025 Pranav Pandey 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | buildscript { 18 | ext.versions = [ 19 | 'compileSdk': 36, 20 | 'minSdk' : 21, 21 | 'targetSdk' : 36, 22 | 'buildTools': '36.0.0', 23 | 'dynamic' : '4.7.0', 24 | 'gson' : '2.11.0', 25 | 'kotlin' : '1.9.24', 26 | 'palette' : '1.0.0', 27 | 'zxing' : '3.3.3' 28 | ] 29 | 30 | repositories { 31 | mavenCentral() 32 | google() 33 | } 34 | 35 | dependencies { 36 | classpath 'com.android.tools.build:gradle:8.10.1' 37 | } 38 | } 39 | 40 | plugins { 41 | id("io.github.gradle-nexus.publish-plugin") version "2.0.0" 42 | } 43 | 44 | allprojects { 45 | repositories { 46 | mavenCentral() 47 | google() 48 | } 49 | } 50 | 51 | tasks.register('clean', Delete) { 52 | delete rootProject.layout.buildDirectory 53 | } 54 | 55 | ext { 56 | projectName = 'dynamic-theme' 57 | projectDesc = 'A text (JSON) based theme engine for Android.' 58 | versionDesc = 'A text (JSON) based theme engine for Android 4.0 (API 14) and above.' 59 | referenceTitle = 'Dynamic Theme API reference' 60 | 61 | siteUrl = 'https://github.com/pranavpandey/dynamic-theme' 62 | gitUrl = 'https://github.com/pranavpandey/dynamic-theme' 63 | issueUrl = 'https://github.com/pranavpandey/dynamic-theme/issues' 64 | githubUrl = 'pranavpandey/dynamic-theme' 65 | 66 | mavenRepo = 'android' 67 | mavenGroup = 'com.pranavpandey.android' 68 | mavenDir = 'com/pranavpandey/android' 69 | mavenArtifactId = 'dynamic-theme' 70 | mavenInceptionYear = '2019' 71 | mavenVersion = '4.6.1' 72 | mavenVersionCode = 22 73 | 74 | developerId = 'pranavpandey' 75 | developerName = 'Pranav Pandey' 76 | developerEmail = 'dynamic@pranavpandey.com' 77 | 78 | licenseName = 'The Apache Software License, Version 2.0' 79 | licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt' 80 | licenseDistribution = 'repo' 81 | allLicenses = ["Apache-2.0"] 82 | 83 | publication = 'local.properties' 84 | 85 | ext["signing.keyId"] = '' 86 | ext["signing.password"] = '' 87 | ext["signing.secretKeyRingFile"] = '' 88 | 89 | sonatypeUsername = '' 90 | sonatypePassword = '' 91 | sonatypeStagingProfileId = '' 92 | } 93 | 94 | apply plugin: 'io.github.gradle-nexus.publish-plugin' 95 | 96 | File publish = project.rootProject.file("${publication}") 97 | if (publish.exists()) { 98 | Properties properties = new Properties() 99 | new FileInputStream(publish).withCloseable { is -> properties.load(is) } 100 | properties.each { name, value -> ext[name] = value } 101 | } 102 | 103 | nexusPublishing { 104 | repositories { 105 | sonatype { 106 | username = sonatypeUsername 107 | password = sonatypePassword 108 | stagingProfileId = sonatypeStagingProfileId 109 | nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/")) 110 | snapshotRepositoryUrl.set( 111 | uri("https://central.sonatype.com/repository/maven-snapshots/")) 112 | } 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /dynamic-theme/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2024 Pranav Pandey 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | apply plugin: 'com.android.library' 18 | 19 | android { 20 | compileSdkVersion versions.compileSdk 21 | buildToolsVersion versions.buildTools 22 | namespace 'com.pranavpandey.android.dynamic.theme' 23 | 24 | defaultConfig { 25 | minSdkVersion versions.minSdk 26 | targetSdkVersion versions.targetSdk 27 | 28 | vectorDrawables.useSupportLibrary = true 29 | consumerProguardFiles 'proguard-rules.pro' 30 | } 31 | 32 | sourceSets { 33 | main.res.srcDirs 'res' 34 | } 35 | 36 | compileOptions { 37 | sourceCompatibility JavaVersion.VERSION_17 38 | targetCompatibility JavaVersion.VERSION_17 39 | } 40 | } 41 | 42 | dependencies { 43 | implementation(platform("org.jetbrains.kotlin:kotlin-bom:${versions.kotlin}")) 44 | 45 | api "com.pranavpandey.android:dynamic-utils:${versions.dynamic}" 46 | api "androidx.palette:palette:${versions.palette}" 47 | api "com.google.code.gson:gson:${versions.gson}" 48 | api "com.google.zxing:core:${versions.zxing}" 49 | } 50 | 51 | if (project.rootProject.file("${publication}").exists()) { 52 | apply from: 'maven.gradle' 53 | } 54 | 55 | tasks.register('generateJavadoc') { 56 | description "Generates Javadoc." 57 | } 58 | 59 | project.afterEvaluate { 60 | android.libraryVariants.configureEach { variant -> 61 | def task = project.tasks.create( 62 | "generate${variant.name.capitalize()}Javadoc", Javadoc) { 63 | title "${referenceTitle}

${versionDesc}

${mavenVersion}
" 64 | description "Generates Javadoc for $variant.name." 65 | destinationDir = new File(destinationDir, variant.baseName) 66 | 67 | source = variant.sourceSets.collect { 68 | it.java.sourceFiles 69 | }.inject { 70 | m, i -> m + i 71 | } 72 | doFirst { 73 | classpath = project.files(variant.javaCompileProvider.get().classpath.files, 74 | project.android.getBootClasspath()) 75 | } 76 | 77 | if (JavaVersion.current().isJava8Compatible()) { 78 | options.addStringOption('Xdoclint:none', '-quiet') 79 | } 80 | 81 | options.memberLevel = JavadocMemberLevel.PROTECTED 82 | exclude "**/R", "**/R.**", "**/R\$**", "**/BuildConfig*" 83 | 84 | options.windowTitle = "${referenceTitle}" 85 | options.links('http://docs.oracle.com/javase/8/docs/api', 86 | 'http://docs.oracle.com/javase/17/docs/api') 87 | options.links('https://developer.android.com/reference') 88 | options.linksOffline('https://developer.android.com/reference', 89 | 'https://developer.android.com/reference/androidx') 90 | options.links('https://javadoc.io/doc/com.google.code.gson/gson/latest') 91 | options.links("https://javadoc.io/doc/com.google.zxing/core/${versions.zxing}") 92 | options.links('https://pranavpandey.org/dynamic-utils') 93 | 94 | failOnError false 95 | } 96 | 97 | task.dependsOn "assemble${variant.name.capitalize()}" 98 | generateJavadoc.dependsOn task 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /dynamic-theme/maven.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2024 Pranav Pandey 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | apply plugin: 'maven-publish' 18 | apply plugin: 'signing' 19 | 20 | group = mavenGroup 21 | version = mavenVersion 22 | 23 | // Android libraries 24 | if (project.hasProperty("android")) { 25 | tasks.register('sourcesJar', Jar) { 26 | archiveClassifier.set("sources") 27 | from android.sourceSets.main.java.srcDirs 28 | } 29 | 30 | tasks.register('javadoc', Javadoc) { 31 | dependsOn "generateReleaseRFile" 32 | title "${referenceTitle}

${versionDesc}

${mavenVersion}
" 33 | failOnError = false 34 | 35 | source = android.sourceSets.main.java.sourceFiles 36 | doNotTrackState("Javadoc needs to be generated every time.") 37 | 38 | if (JavaVersion.current().isJava8Compatible()) { 39 | options.addStringOption('Xdoclint:none', '-quiet') 40 | } 41 | 42 | options.memberLevel = JavadocMemberLevel.PROTECTED 43 | exclude "**/R", "**/R.**", "**/R\$**", "**/BuildConfig*" 44 | 45 | options.windowTitle = "${referenceTitle}" 46 | options.links('http://docs.oracle.com/javase/8/docs/api', 47 | 'http://docs.oracle.com/javase/17/docs/api') 48 | options.links('https://developer.android.com/reference') 49 | options.linksOffline('https://developer.android.com/reference', 50 | 'https://developer.android.com/reference/androidx') 51 | options.links('https://javadoc.io/doc/com.google.code.gson/gson/latest') 52 | options.links("https://javadoc.io/doc/com.google.zxing/core/${versions.zxing}") 53 | options.links('https://pranavpandey.org/dynamic-utils') 54 | } 55 | } else { // Java libraries 56 | tasks.register('sourcesJar', Jar) { 57 | dependsOn classes 58 | 59 | archiveClassifier.set("sources") 60 | from sourceSets.main.allSource 61 | } 62 | } 63 | 64 | tasks.register('javadocJar', Jar) { 65 | dependsOn javadoc 66 | 67 | archiveClassifier.set("javadoc") 68 | from javadoc.destinationDir 69 | } 70 | 71 | artifacts { 72 | archives javadocJar 73 | archives sourcesJar 74 | } 75 | 76 | // Maven 77 | publishing { 78 | publications { 79 | library(MavenPublication) { 80 | groupId mavenGroup 81 | artifactId mavenArtifactId 82 | version mavenVersion 83 | 84 | artifact "$buildDir/outputs/aar/$mavenArtifactId-release.aar" 85 | artifact javadocJar 86 | artifact sourcesJar 87 | 88 | pom.withXml { 89 | // Project 90 | asNode().appendNode('name', projectName) 91 | asNode().appendNode('description', projectDesc) 92 | asNode().appendNode('url', siteUrl) 93 | asNode().appendNode('inceptionYear', mavenInceptionYear) 94 | 95 | // Licenses 96 | def license = asNode().appendNode('licenses').appendNode('license') 97 | license.appendNode('name', licenseName) 98 | license.appendNode('url', licenseUrl) 99 | license.appendNode('distribution', licenseDistribution) 100 | 101 | // Developers 102 | def developer = asNode().appendNode('developers').appendNode('developer') 103 | developer.appendNode('id', developerId) 104 | developer.appendNode('name', developerName) 105 | developer.appendNode('email', developerEmail) 106 | 107 | // SCM 108 | def scm = asNode().appendNode('scm') 109 | scm.appendNode('connection', "scm:git:${gitUrl}.git") 110 | scm.appendNode('developerConnection', gitUrl) 111 | scm.appendNode('url', siteUrl) 112 | 113 | // Dependencies 114 | def dependenciesNode = asNode()['dependencies'][0] 115 | if (dependenciesNode == null) { 116 | dependenciesNode = asNode().appendNode('dependencies') 117 | } 118 | 119 | // Add all that are 'compile' dependencies. 120 | configurations.api.allDependencies.each { 121 | def dependencyNode = dependenciesNode.appendNode('dependency') 122 | dependencyNode.appendNode('groupId', it.group) 123 | dependencyNode.appendNode('artifactId', it.name) 124 | dependencyNode.appendNode('version', it.version) 125 | } 126 | } 127 | } 128 | } 129 | } 130 | 131 | ext["signing.keyId"] = rootProject.ext["signing.keyId"] 132 | ext["signing.password"] = rootProject.ext["signing.password"] 133 | ext["signing.secretKeyRingFile"] = rootProject.ext["signing.secretKeyRingFile"] 134 | 135 | signing { 136 | sign publishing.publications 137 | } 138 | 139 | afterEvaluate { project -> 140 | // Fix javadoc generation. 141 | javadoc.classpath += files(android.libraryVariants.collect { variant -> 142 | variant.javaCompileProvider.get().classpath.files 143 | }) 144 | 145 | def pomTask = "generatePomFileForLibraryPublication" 146 | def dependencies = [javadocJar, sourcesJar, assembleRelease, pomTask] 147 | 148 | // Convenience task to prepare everything we need for releases. 149 | tasks.register('prepareArtifacts') { 150 | dependsOn dependencies 151 | } 152 | } 153 | -------------------------------------------------------------------------------- /dynamic-theme/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in ANDROID_HOME/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Gson uses generic type information stored in a class file when working with fields. 20 | # Proguard removes such information by default, so configure it to keep all of it. 21 | -keepattributes Signature 22 | 23 | # For using Gson annotation. 24 | -keepattributes *Annotation* 25 | 26 | # Gson specific classes. 27 | -keep class sun.misc.Unsafe { *; } 28 | -keep class com.google.gson.** { *; } 29 | -------------------------------------------------------------------------------- /dynamic-theme/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 34 | 35 | 36 | 37 | 41 | 42 | 43 | 44 | 48 | 49 | 50 | 51 | 55 | 56 | 57 | 58 | 62 | 63 | 64 | 65 | 69 | 70 | 71 | 72 | 75 | 76 | 77 | 78 | 81 | 82 | 83 | 84 | 87 | 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /dynamic-theme/src/main/java/com/pranavpandey/android/dynamic/theme/AppTheme.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2022 Pranav Pandey 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.pranavpandey.android.dynamic.theme; 18 | 19 | import android.graphics.Color; 20 | 21 | import androidx.annotation.ColorInt; 22 | import androidx.annotation.NonNull; 23 | 24 | import com.google.gson.Gson; 25 | import com.pranavpandey.android.dynamic.theme.base.AutoTheme; 26 | import com.pranavpandey.android.dynamic.theme.base.BackgroundAware; 27 | import com.pranavpandey.android.dynamic.theme.base.BaseTheme; 28 | import com.pranavpandey.android.dynamic.theme.base.CodeTheme; 29 | import com.pranavpandey.android.dynamic.theme.base.CornerTheme; 30 | import com.pranavpandey.android.dynamic.theme.base.DynamicColor; 31 | import com.pranavpandey.android.dynamic.theme.base.FallbackTheme; 32 | import com.pranavpandey.android.dynamic.theme.base.ResourceTheme; 33 | import com.pranavpandey.android.dynamic.theme.base.StringTheme; 34 | import com.pranavpandey.android.dynamic.theme.base.StrokeTheme; 35 | import com.pranavpandey.android.dynamic.theme.base.StyleTheme; 36 | import com.pranavpandey.android.dynamic.theme.base.TextTheme; 37 | import com.pranavpandey.android.dynamic.theme.base.TranslucentTheme; 38 | import com.pranavpandey.android.dynamic.theme.base.TypeTheme; 39 | import com.pranavpandey.android.dynamic.theme.util.DynamicThemeUtils; 40 | import com.pranavpandey.android.dynamic.util.DynamicColorUtils; 41 | 42 | /** 43 | * An abstract class to implement an app theme. 44 | * 45 | * @param The type of the dynamic theme. 46 | */ 47 | public abstract class AppTheme> implements BaseTheme, FallbackTheme, 48 | ResourceTheme, DynamicColor, TextTheme, AutoTheme, CornerTheme, 49 | BackgroundAware, StrokeTheme, TranslucentTheme, StyleTheme, TypeTheme, 50 | StringTheme, CodeTheme { 51 | 52 | @Override 53 | public boolean isDynamicColor() { 54 | return getBackgroundColor(false, false) == Theme.AUTO 55 | || getPrimaryColor(false, false) == Theme.AUTO 56 | || getAccentColor(false, false) == Theme.AUTO; 57 | } 58 | 59 | @Override 60 | public boolean isStroke() { 61 | return DynamicColorUtils.removeAlpha(getBackgroundColor()) 62 | == DynamicColorUtils.removeAlpha(getSurfaceColor()) 63 | && Color.alpha(getSurfaceColor()) < Theme.Opacity.STROKE; 64 | } 65 | 66 | @Override 67 | public @NonNull String getThemeData() { 68 | return DynamicThemeUtils.getThemeUrl(this); 69 | } 70 | 71 | @Override 72 | public @NonNull String getCodeData() { 73 | return getThemeData(); 74 | } 75 | 76 | @Override 77 | public @ColorInt int getCodeBackgroundColor() { 78 | return getBackgroundColor(); 79 | } 80 | 81 | @Override 82 | public @ColorInt int getCodeStrokeColor() { 83 | return getStrokeColor(); 84 | } 85 | 86 | @Override 87 | public @ColorInt int getCodeDataColor() { 88 | return getTintBackgroundColor(); 89 | } 90 | 91 | @Override 92 | public @ColorInt int getCodeFinderColor() { 93 | return getPrimaryColor(); 94 | } 95 | 96 | @Override 97 | public @ColorInt int getCodeOverlayColor() { 98 | return getAccentColor(); 99 | } 100 | 101 | @Override 102 | public float getCodeContrastRatio() { 103 | return Math.max(Theme.Code.CONTRAST_RATIO, getContrastRatio()); 104 | } 105 | 106 | @Override 107 | public @Theme.Code.Style int getCodeStyle() { 108 | return getCornerSize() < Theme.Corner.MIN_ROUND 109 | ? Theme.Code.Style.DEFAULT : getCornerSize() < Theme.Corner.MIN_OVAL 110 | ? Theme.Code.Style.ROUND : Theme.Code.Style.OVAL; 111 | } 112 | 113 | @Override 114 | public @NonNull String toJsonString() { 115 | return new Gson().toJson(this); 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /dynamic-theme/src/main/java/com/pranavpandey/android/dynamic/theme/AppWidgetTheme.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2022 Pranav Pandey 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.pranavpandey.android.dynamic.theme; 18 | 19 | import com.pranavpandey.android.dynamic.theme.base.WidgetTheme; 20 | 21 | /** 22 | * An abstract class to implement an app widget theme. 23 | * 24 | * @param The type of the dynamic theme. 25 | * @param The type of the app theme. 26 | */ 27 | public abstract class AppWidgetTheme, V extends AppTheme> 28 | extends AppTheme implements WidgetTheme { } 29 | -------------------------------------------------------------------------------- /dynamic-theme/src/main/java/com/pranavpandey/android/dynamic/theme/DynamicColors.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2022 Pranav Pandey 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.pranavpandey.android.dynamic.theme; 18 | 19 | import android.annotation.TargetApi; 20 | import android.app.WallpaperColors; 21 | import android.os.Build; 22 | import android.os.Parcel; 23 | import android.os.Parcelable; 24 | 25 | import androidx.annotation.ColorInt; 26 | import androidx.annotation.NonNull; 27 | import androidx.annotation.Nullable; 28 | import androidx.core.util.ObjectsCompat; 29 | 30 | import com.pranavpandey.android.dynamic.theme.base.DynamicColor; 31 | import com.pranavpandey.android.dynamic.util.DynamicColorUtils; 32 | 33 | import java.util.ArrayList; 34 | import java.util.HashMap; 35 | import java.util.Map; 36 | 37 | /** 38 | * A class to handle dynamic colors generation. 39 | */ 40 | public class DynamicColors implements Parcelable { 41 | 42 | /** 43 | * Factor to generate shades of a color. 44 | */ 45 | private static final float FACTOR = 0.8f; 46 | 47 | /** 48 | * Map to store the original colors. 49 | */ 50 | private final Map mOriginal; 51 | 52 | /** 53 | * Map to store the mutated (dark) colors. 54 | */ 55 | private final Map mDark; 56 | 57 | /** 58 | * Map to store the mutated (light) colors. 59 | */ 60 | private final Map mLight; 61 | 62 | /** 63 | * Constructor to initialize an object of this class. 64 | */ 65 | public DynamicColors() { 66 | this(new HashMap<>()); 67 | } 68 | 69 | /** 70 | * Constructor to initialize an object of this class. 71 | * 72 | * @param original The original colors to be handled. 73 | */ 74 | public DynamicColors(@NonNull Map original) { 75 | this.mOriginal = new HashMap<>(original); 76 | this.mDark = new HashMap<>(original); 77 | this.mLight = new HashMap<>(original); 78 | } 79 | 80 | /** 81 | * Read an object of this class from the parcel. 82 | * 83 | * @param in The parcel to read the values. 84 | */ 85 | public DynamicColors(@NonNull Parcel in) { 86 | this(); 87 | 88 | in.readMap(mOriginal, mOriginal.getClass().getClassLoader()); 89 | in.readMap(mDark, mDark.getClass().getClassLoader()); 90 | in.readMap(mLight, mDark.getClass().getClassLoader()); 91 | } 92 | 93 | /** 94 | * Parcelable creator to create from parcel. 95 | */ 96 | public static final Parcelable.Creator CREATOR = 97 | new Parcelable.Creator() { 98 | @Override 99 | public DynamicColors createFromParcel(Parcel in) { 100 | return new DynamicColors(in); 101 | } 102 | 103 | @Override 104 | public DynamicColors[] newArray(int size) { 105 | return new DynamicColors[size]; 106 | } 107 | }; 108 | 109 | @Override 110 | public int describeContents() { 111 | return hashCode(); 112 | } 113 | 114 | @Override 115 | public void writeToParcel(Parcel dest, int flags) { 116 | dest.writeMap(mOriginal); 117 | dest.writeMap(mDark); 118 | dest.writeMap(mLight); 119 | } 120 | 121 | /** 122 | * Get the map of original colors. 123 | * 124 | * @return The map of original colors. 125 | */ 126 | public @NonNull Map getOriginal() { 127 | return mOriginal; 128 | } 129 | 130 | /** 131 | * Get the map of mutated (dark) colors. 132 | * 133 | * @return The map of mutated (dark) colors. 134 | */ 135 | public @NonNull Map getDark() { 136 | return mDark; 137 | } 138 | 139 | /** 140 | * Get the map of mutated (light) colors. 141 | * 142 | * @return The map of mutated (light) colors. 143 | */ 144 | public @NonNull Map getLight() { 145 | return mLight; 146 | } 147 | 148 | /** 149 | * Get the color according to its type from the supplied map. 150 | * 151 | * @param colors The color map to be used. 152 | * @param colorType The type of the color. 153 | * @param fallback The fallback color if the request color type is not found. 154 | * 155 | * @return The color according to its type from the supplied map. 156 | */ 157 | public @ColorInt int get(@NonNull Map colors, 158 | @Theme.ColorType int colorType, @ColorInt int fallback) { 159 | final @ColorInt Integer color; 160 | if (colors.containsKey(colorType) && (color = colors.get(colorType)) != null) { 161 | return color != Theme.AUTO ? color : fallback; 162 | } 163 | 164 | return fallback; 165 | } 166 | 167 | /** 168 | * Get the original color according to its type. 169 | * 170 | * @param colorType The type of the color. 171 | * @param fallback The fallback color if the request color type is not found. 172 | * 173 | * @return The original color according to its type. 174 | */ 175 | public @ColorInt int getOriginal(@Theme.ColorType int colorType, @ColorInt int fallback) { 176 | return get(getOriginal(), colorType, fallback); 177 | } 178 | 179 | /** 180 | * Get the map of mutated colors according to the supplied theme. 181 | * 182 | * @param theme The dynamic theme to be used. 183 | * 184 | * @return The map of mutated colors according to the supplied theme. 185 | */ 186 | public @NonNull Map getMutated(@NonNull DynamicColor theme) { 187 | if (theme.isDarkTheme()) { 188 | return theme.isInverseTheme() ? mLight : mDark; 189 | } 190 | 191 | return theme.isInverseTheme() ? mDark : mLight; 192 | } 193 | 194 | /** 195 | * Get the mutated color according to its type. 196 | * 197 | * @param colorType The type of the color. 198 | * @param fallback The fallback color if the request color type is not found. 199 | * @param theme The dynamic theme to be used. 200 | * 201 | * @return The mutated color according to its type. 202 | */ 203 | public @ColorInt int getMutated(@Theme.ColorType int colorType, 204 | @ColorInt int fallback, @NonNull DynamicColor theme) { 205 | return get(getMutated(theme), colorType, fallback); 206 | } 207 | 208 | /** 209 | * Store the color according to its type in the supplied map. 210 | * 211 | * @param colors The map to store the color. 212 | * @param colorType The type of the color. 213 | * @param color The color to be stored. 214 | */ 215 | public void put(@NonNull Map colors, 216 | @Theme.ColorType int colorType, @ColorInt int color) { 217 | colors.put(colorType, color); 218 | } 219 | 220 | /** 221 | * Store the color according to its type in the original map. 222 | * 223 | * @param colorType The type of the color. 224 | * @param color The color to be stored. 225 | */ 226 | public void putOriginal(@Theme.ColorType int colorType, @ColorInt int color) { 227 | put(getOriginal(), colorType, color); 228 | } 229 | 230 | /** 231 | * Store the color according to its type in the mutated (dark) map. 232 | * 233 | * @param colorType The type of the color. 234 | * @param color The color to be stored. 235 | */ 236 | public void putDark(@Theme.ColorType int colorType, @ColorInt int color) { 237 | put(getDark(), colorType, color); 238 | } 239 | 240 | /** 241 | * Store the color according to its type in the mutated (light) map. 242 | * 243 | * @param colorType The type of the color. 244 | * @param color The color to be stored. 245 | */ 246 | public void putLight(@Theme.ColorType int colorType, @ColorInt int color) { 247 | put(getLight(), colorType, color); 248 | } 249 | 250 | /** 251 | * Store the colors in the supplied map. 252 | * 253 | * @param colors The map to store the colors. 254 | * @param newColors The colors to be stored. 255 | */ 256 | public void put(@NonNull Map colors, 257 | @Nullable Map newColors) { 258 | if (newColors == null) { 259 | return; 260 | } 261 | 262 | clear(); 263 | colors.putAll(newColors); 264 | } 265 | 266 | /** 267 | * Store the colors in the original map. 268 | * 269 | * @param colors The colors to be stored. 270 | */ 271 | public void putOriginal(@Nullable Map colors) { 272 | put(getOriginal(), colors); 273 | } 274 | 275 | /** 276 | * Store the colors in the mutated (dark) map. 277 | * 278 | * @param colors The colors to be stored. 279 | */ 280 | public void putDark(@Nullable Map colors) { 281 | put(getDark(), colors); 282 | } 283 | 284 | /** 285 | * Store the colors in the mutated (light) map. 286 | * 287 | * @param colors The colors to be stored. 288 | */ 289 | public void putLight(@Nullable Map colors) { 290 | put(getLight(), colors); 291 | } 292 | 293 | /** 294 | * Store the wallpaper colors in the supplied map. 295 | * 296 | * @param colors The map to store the colors. 297 | * @param newColors The wallpaper colors to be stored. 298 | */ 299 | @TargetApi(Build.VERSION_CODES.O_MR1) 300 | public void put(@NonNull Map colors, @Nullable WallpaperColors newColors) { 301 | if (newColors == null) { 302 | return; 303 | } 304 | 305 | clear(); 306 | 307 | colors.put(Theme.ColorType.ACCENT, newColors.getPrimaryColor().toArgb()); 308 | 309 | if (newColors.getSecondaryColor() != null) { 310 | colors.put(Theme.ColorType.PRIMARY, newColors.getSecondaryColor().toArgb()); 311 | } else { 312 | colors.put(Theme.ColorType.PRIMARY, newColors.getPrimaryColor().toArgb()); 313 | } 314 | 315 | if (newColors.getTertiaryColor() != null) { 316 | colors.put(Theme.ColorType.BACKGROUND, newColors.getTertiaryColor().toArgb()); 317 | } else { 318 | colors.put(Theme.ColorType.BACKGROUND, newColors.getPrimaryColor().toArgb()); 319 | } 320 | } 321 | 322 | /** 323 | * Store the wallpaper colors in the original map. 324 | * 325 | * @param colors The wallpaper colors to be stored. 326 | */ 327 | @TargetApi(Build.VERSION_CODES.O_MR1) 328 | public void putOriginal(@Nullable WallpaperColors colors) { 329 | put(getOriginal(), colors); 330 | } 331 | 332 | /** 333 | * Store the wallpaper colors in the mutated (dark) map. 334 | * 335 | * @param colors The wallpaper colors to be stored. 336 | */ 337 | @TargetApi(Build.VERSION_CODES.O_MR1) 338 | public void putDark(@Nullable WallpaperColors colors) { 339 | put(getDark(), colors); 340 | } 341 | 342 | /** 343 | * Store the wallpaper colors in the mutated (light) map. 344 | * 345 | * @param colors The wallpaper colors to be stored. 346 | */ 347 | @TargetApi(Build.VERSION_CODES.O_MR1) 348 | public void putLight(@Nullable WallpaperColors colors) { 349 | put(getLight(), colors); 350 | } 351 | 352 | /** 353 | * Mutate original colors for the supplied app theme. 354 | * 355 | * @param dark The map to store the mutated (dark) colors. 356 | * @param light The map to store the mutated (light) colors. 357 | * @param theme The dynamic theme to be used. 358 | */ 359 | public void mutate(@NonNull Map dark, 360 | @NonNull Map light, @NonNull DynamicColor theme) { 361 | dark.clear(); 362 | light.clear(); 363 | 364 | @ColorInt int background = getOriginal(Theme.ColorType.BACKGROUND, 365 | theme.getBackgroundColor()); 366 | @ColorInt int primary = getOriginal(Theme.ColorType.PRIMARY, theme.getPrimaryColor()); 367 | @ColorInt int accent = getOriginal(Theme.ColorType.ACCENT, theme.getAccentColor()); 368 | 369 | if (!getOriginal().containsKey(Theme.ColorType.PRIMARY)) { 370 | primary = background; 371 | } 372 | 373 | if (!getOriginal().containsKey(Theme.ColorType.ACCENT)) { 374 | accent = background; 375 | } 376 | 377 | put(dark, Theme.ColorType.BACKGROUND, 378 | DynamicColorUtils.getDarkerColor(background, FACTOR)); 379 | put(dark, Theme.ColorType.SURFACE, Theme.AUTO); 380 | put(dark, Theme.ColorType.PRIMARY, 381 | DynamicColorUtils.getDarkerColor(primary, FACTOR)); 382 | put(dark, Theme.ColorType.PRIMARY_DARK, Theme.AUTO); 383 | put(dark, Theme.ColorType.ACCENT, accent); 384 | put(dark, Theme.ColorType.ACCENT_DARK, Theme.AUTO); 385 | put(dark, Theme.ColorType.ERROR, Theme.AUTO); 386 | 387 | put(light, Theme.ColorType.BACKGROUND, 388 | DynamicColorUtils.getLighterColor(background, FACTOR)); 389 | put(light, Theme.ColorType.SURFACE, Theme.AUTO); 390 | put(light, Theme.ColorType.PRIMARY, 391 | DynamicColorUtils.getLighterColor(primary, FACTOR)); 392 | put(light, Theme.ColorType.PRIMARY_DARK, Theme.AUTO); 393 | put(light, Theme.ColorType.ACCENT, accent); 394 | put(light, Theme.ColorType.ACCENT_DARK, Theme.AUTO); 395 | put(light, Theme.ColorType.ERROR, Theme.AUTO); 396 | } 397 | 398 | /** 399 | * Mutate original colors for the supplied app theme. 400 | * 401 | * @param theme The dynamic theme to be used. 402 | */ 403 | public void mutate(@NonNull DynamicColor theme) { 404 | mutate(getDark(), getLight(), theme); 405 | } 406 | 407 | /** 408 | * Returns all the colors including original, light and dark. 409 | * 410 | * @return All the colors including original, dark and light. 411 | */ 412 | public @NonNull ArrayList getAll() { 413 | ArrayList colors = new ArrayList<>(); 414 | 415 | 416 | for (int color : getOriginal().values()) { 417 | if (color != Theme.AUTO && !colors.contains(color)) { 418 | colors.add(color); 419 | } 420 | } 421 | for (int color : getDark().values()) { 422 | if (color != Theme.AUTO && !colors.contains(color)) { 423 | colors.add(color); 424 | } 425 | } 426 | for (int color : getLight().values()) { 427 | if (color != Theme.AUTO && !colors.contains(color)) { 428 | colors.add(color); 429 | } 430 | } 431 | 432 | return colors; 433 | } 434 | 435 | /** 436 | * Clear original and mutated colors. 437 | */ 438 | public void clear() { 439 | getOriginal().clear(); 440 | getDark().clear(); 441 | getLight().clear(); 442 | } 443 | 444 | @Override 445 | public boolean equals(@Nullable Object obj) { 446 | if (!(obj instanceof DynamicColors)) { 447 | return super.equals(obj); 448 | } 449 | 450 | DynamicColors newColors = (DynamicColors) obj; 451 | return ObjectsCompat.equals(getOriginal(), newColors.getOriginal()) 452 | && ObjectsCompat.equals(getDark(), newColors.getDark()) 453 | && ObjectsCompat.equals(getLight(), newColors.getLight()); 454 | } 455 | 456 | @Override 457 | public @NonNull String toString() { 458 | return getOriginal().toString() + getDark().toString() + getLight().toString(); 459 | } 460 | } 461 | -------------------------------------------------------------------------------- /dynamic-theme/src/main/java/com/pranavpandey/android/dynamic/theme/DynamicPalette.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2022 Pranav Pandey 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.pranavpandey.android.dynamic.theme; 18 | 19 | import android.graphics.Color; 20 | 21 | /** 22 | * Default color palette from Material Design by Google. 23 | * 24 | * @see 25 | * Material color palette 26 | */ 27 | public class DynamicPalette { 28 | 29 | /** 30 | * Default material colors. 31 | */ 32 | public static final Integer[] MATERIAL_COLORS = 33 | new Integer[] { 34 | // Red 35 | Color.parseColor("#F44336"), 36 | // Pink 37 | Color.parseColor("#E91E63"), 38 | // Purple 39 | Color.parseColor("#9C27B0"), 40 | // Deep Purple 41 | Color.parseColor("#673AB7"), 42 | // Indigo 43 | Color.parseColor("#3F51B5"), 44 | // Blue 45 | Color.parseColor("#1E88E5"), 46 | // Light Blue 47 | Color.parseColor("#03A9F4"), 48 | // Cyan 49 | Color.parseColor("#00BCD4"), 50 | // Teal 51 | Color.parseColor("#009688"), 52 | // Green 53 | Color.parseColor("#43A047"), 54 | // Light Green 55 | Color.parseColor("#8BC34A"), 56 | // Lime 57 | Color.parseColor("#CDDC39"), 58 | // Yellow 59 | Color.parseColor("#FFEB3B"), 60 | // Amber 61 | Color.parseColor("#FFC107"), 62 | // Orange 63 | Color.parseColor("#FF9800"), 64 | // Deep Orange 65 | Color.parseColor("#F4511E"), 66 | // Brown 67 | Color.parseColor("#6D4C41"), 68 | // Gray 69 | Color.parseColor("#9E9E9E"), 70 | // Blue Gray 71 | Color.parseColor("#546E7A"), 72 | // White 73 | Color.parseColor("#F5F5F5"), 74 | // Black 75 | Color.parseColor("#191919") 76 | }; 77 | 78 | /** 79 | * Default material colors shades. 80 | */ 81 | public static final Integer[][] MATERIAL_COLORS_SHADES = 82 | new Integer[][] { 83 | // Red 84 | new Integer[] { 85 | Color.parseColor("#FFEBEE"), 86 | Color.parseColor("#FFCDD2"), 87 | Color.parseColor("#EF9A9A"), 88 | Color.parseColor("#E57373"), 89 | Color.parseColor("#EF5350"), 90 | Color.parseColor("#F44336"), 91 | Color.parseColor("#E53935"), 92 | Color.parseColor("#D32F2F"), 93 | Color.parseColor("#C62828"), 94 | Color.parseColor("#B71C1C"), 95 | Color.parseColor("#FF8A80"), 96 | Color.parseColor("#FF5252"), 97 | Color.parseColor("#FF1744"), 98 | Color.parseColor("#D50000") 99 | }, 100 | // Pink 101 | new Integer[] { 102 | Color.parseColor("#FCE4EC"), 103 | Color.parseColor("#F8BBD0"), 104 | Color.parseColor("#F48FB1"), 105 | Color.parseColor("#F06292"), 106 | Color.parseColor("#EC407A"), 107 | Color.parseColor("#E91E63"), 108 | Color.parseColor("#D81B60"), 109 | Color.parseColor("#C2185B"), 110 | Color.parseColor("#AD1457"), 111 | Color.parseColor("#880E4F"), 112 | Color.parseColor("#FF80AB"), 113 | Color.parseColor("#FF4081"), 114 | Color.parseColor("#F50057"), 115 | Color.parseColor("#C51162") 116 | }, 117 | // Purple 118 | new Integer[] { 119 | Color.parseColor("#F3E5F5"), 120 | Color.parseColor("#E1BEE7"), 121 | Color.parseColor("#CE93D8"), 122 | Color.parseColor("#BA68C8"), 123 | Color.parseColor("#AB47BC"), 124 | Color.parseColor("#9C27B0"), 125 | Color.parseColor("#8E24AA"), 126 | Color.parseColor("#7B1FA2"), 127 | Color.parseColor("#6A1B9A"), 128 | Color.parseColor("#4A148C"), 129 | Color.parseColor("#EA80FC"), 130 | Color.parseColor("#E040FB"), 131 | Color.parseColor("#D500F9"), 132 | Color.parseColor("#AA00FF") 133 | }, 134 | // Deep Purple 135 | new Integer[] { 136 | Color.parseColor("#EDE7F6"), 137 | Color.parseColor("#D1C4E9"), 138 | Color.parseColor("#B39DDB"), 139 | Color.parseColor("#9575CD"), 140 | Color.parseColor("#7E57C2"), 141 | Color.parseColor("#673AB7"), 142 | Color.parseColor("#5E35B1"), 143 | Color.parseColor("#512DA8"), 144 | Color.parseColor("#4527A0"), 145 | Color.parseColor("#311B92"), 146 | Color.parseColor("#B388FF"), 147 | Color.parseColor("#7C4dFF"), 148 | Color.parseColor("#651FFF"), 149 | Color.parseColor("#6200EA") 150 | }, 151 | // Indigo 152 | new Integer[] { 153 | Color.parseColor("#E8EAF6"), 154 | Color.parseColor("#C5CAE9"), 155 | Color.parseColor("#9FA8DA"), 156 | Color.parseColor("#7986CB"), 157 | Color.parseColor("#5C6BC0"), 158 | Color.parseColor("#3F51B5"), 159 | Color.parseColor("#3949AB"), 160 | Color.parseColor("#303F9F"), 161 | Color.parseColor("#283593"), 162 | Color.parseColor("#1A237E"), 163 | Color.parseColor("#8C9EFF"), 164 | Color.parseColor("#536DFE"), 165 | Color.parseColor("#3D5AFE"), 166 | Color.parseColor("#304FFE") 167 | }, 168 | // Blue 169 | new Integer[] { 170 | Color.parseColor("#E3F2FD"), 171 | Color.parseColor("#BBDEFB"), 172 | Color.parseColor("#90CAF9"), 173 | Color.parseColor("#64B5F6"), 174 | Color.parseColor("#42A5F5"), 175 | Color.parseColor("#2196F3"), 176 | Color.parseColor("#1E88E5"), 177 | Color.parseColor("#1976D2"), 178 | Color.parseColor("#1565C0"), 179 | Color.parseColor("#0D47A1"), 180 | Color.parseColor("#82B1FF"), 181 | Color.parseColor("#448AFF"), 182 | Color.parseColor("#2979FF"), 183 | Color.parseColor("#2962FF") 184 | }, 185 | // Light Blue 186 | new Integer[] { 187 | Color.parseColor("#E1F5FE"), 188 | Color.parseColor("#B3E5FC"), 189 | Color.parseColor("#81D4FA"), 190 | Color.parseColor("#4FC3F7"), 191 | Color.parseColor("#29B6F6"), 192 | Color.parseColor("#03A9F4"), 193 | Color.parseColor("#039BE5"), 194 | Color.parseColor("#0288D1"), 195 | Color.parseColor("#0277BD"), 196 | Color.parseColor("#01579B"), 197 | Color.parseColor("#80D8FF"), 198 | Color.parseColor("#40C4FF"), 199 | Color.parseColor("#00B0FF"), 200 | Color.parseColor("#0091EA") 201 | }, 202 | // Cyan 203 | new Integer[] { 204 | Color.parseColor("#E0F7FA"), 205 | Color.parseColor("#B2EBF2"), 206 | Color.parseColor("#80DEEA"), 207 | Color.parseColor("#4DD0E1"), 208 | Color.parseColor("#26C6DA"), 209 | Color.parseColor("#00BCD4"), 210 | Color.parseColor("#00ACC1"), 211 | Color.parseColor("#0097A7"), 212 | Color.parseColor("#00838F"), 213 | Color.parseColor("#006064"), 214 | Color.parseColor("#84FFFF"), 215 | Color.parseColor("#18FFFF"), 216 | Color.parseColor("#00E5FF"), 217 | Color.parseColor("#00B8D4") 218 | }, 219 | // Teal 220 | new Integer[] { 221 | Color.parseColor("#E0F2F1"), 222 | Color.parseColor("#B2DFDB"), 223 | Color.parseColor("#80CBC4"), 224 | Color.parseColor("#4DB6AC"), 225 | Color.parseColor("#26A69A"), 226 | Color.parseColor("#009688"), 227 | Color.parseColor("#00897B"), 228 | Color.parseColor("#00796B"), 229 | Color.parseColor("#00695C"), 230 | Color.parseColor("#004D40"), 231 | Color.parseColor("#A7ffEB"), 232 | Color.parseColor("#64ffDA"), 233 | Color.parseColor("#1DE9B6"), 234 | Color.parseColor("#00BFA5") 235 | }, 236 | // Green 237 | new Integer[] { 238 | Color.parseColor("#E8F5E9"), 239 | Color.parseColor("#C8E6C9"), 240 | Color.parseColor("#A5D6A7"), 241 | Color.parseColor("#81C784"), 242 | Color.parseColor("#66BB6A"), 243 | Color.parseColor("#4CAF50"), 244 | Color.parseColor("#43A047"), 245 | Color.parseColor("#388E3C"), 246 | Color.parseColor("#2E7D32"), 247 | Color.parseColor("#1B5E20"), 248 | Color.parseColor("#B9F6CA"), 249 | Color.parseColor("#69f0AE"), 250 | Color.parseColor("#00E676"), 251 | Color.parseColor("#00C853") 252 | }, 253 | // Light Green 254 | new Integer[] { 255 | Color.parseColor("#F1F8E9"), 256 | Color.parseColor("#DCEDC8"), 257 | Color.parseColor("#C5E1A5"), 258 | Color.parseColor("#AED581"), 259 | Color.parseColor("#9CCC65"), 260 | Color.parseColor("#8BC34A"), 261 | Color.parseColor("#7CB342"), 262 | Color.parseColor("#689F38"), 263 | Color.parseColor("#558B2F"), 264 | Color.parseColor("#33691E"), 265 | Color.parseColor("#CCFF90"), 266 | Color.parseColor("#B2FF59"), 267 | Color.parseColor("#76FF03"), 268 | Color.parseColor("#64DD17") 269 | }, 270 | // Lime 271 | new Integer[] { 272 | Color.parseColor("#F9FBE7"), 273 | Color.parseColor("#F0F4C3"), 274 | Color.parseColor("#E6EE9C"), 275 | Color.parseColor("#DCE775"), 276 | Color.parseColor("#D4E157"), 277 | Color.parseColor("#CDDC39"), 278 | Color.parseColor("#C0CA33"), 279 | Color.parseColor("#AFB42B"), 280 | Color.parseColor("#9E9D24"), 281 | Color.parseColor("#827717"), 282 | Color.parseColor("#F4FF81"), 283 | Color.parseColor("#EEFF41"), 284 | Color.parseColor("#C6FF00"), 285 | Color.parseColor("#AEEA00") 286 | }, 287 | // Yellow 288 | new Integer[] { 289 | Color.parseColor("#FFFDE7"), 290 | Color.parseColor("#FFF9C4"), 291 | Color.parseColor("#FFF59D"), 292 | Color.parseColor("#FFF176"), 293 | Color.parseColor("#FFEE58"), 294 | Color.parseColor("#FFEB3B"), 295 | Color.parseColor("#FDD835"), 296 | Color.parseColor("#FBC02D"), 297 | Color.parseColor("#F9A825"), 298 | Color.parseColor("#F57F17"), 299 | Color.parseColor("#FFFF8D"), 300 | Color.parseColor("#FFFF00"), 301 | Color.parseColor("#FFEA00"), 302 | Color.parseColor("#FFD600") 303 | }, 304 | // Amber 305 | new Integer[] { 306 | Color.parseColor("#FFF8E1"), 307 | Color.parseColor("#FFECB3"), 308 | Color.parseColor("#FFE082"), 309 | Color.parseColor("#FFD54F"), 310 | Color.parseColor("#FFCA28"), 311 | Color.parseColor("#FFC107"), 312 | Color.parseColor("#FFB300"), 313 | Color.parseColor("#FFA000"), 314 | Color.parseColor("#FF8F00"), 315 | Color.parseColor("#FF6F00"), 316 | Color.parseColor("#FFE57F"), 317 | Color.parseColor("#FFD740"), 318 | Color.parseColor("#FFC400"), 319 | Color.parseColor("#FFAB00") 320 | }, 321 | // Orange 322 | new Integer[] { 323 | Color.parseColor("#FFF3E0"), 324 | Color.parseColor("#FFE0B2"), 325 | Color.parseColor("#FFCC80"), 326 | Color.parseColor("#FFB74D"), 327 | Color.parseColor("#FFA726"), 328 | Color.parseColor("#FF9800"), 329 | Color.parseColor("#FB8C00"), 330 | Color.parseColor("#F57C00"), 331 | Color.parseColor("#EF6C00"), 332 | Color.parseColor("#E65100"), 333 | Color.parseColor("#FFD180"), 334 | Color.parseColor("#FFAB40"), 335 | Color.parseColor("#FF9100"), 336 | Color.parseColor("#FF6D00") 337 | }, 338 | // Deep Orange 339 | new Integer[] { 340 | Color.parseColor("#FBE9E7"), 341 | Color.parseColor("#FFCCBC"), 342 | Color.parseColor("#FFAB91"), 343 | Color.parseColor("#FF8A65"), 344 | Color.parseColor("#FF7043"), 345 | Color.parseColor("#FF5722"), 346 | Color.parseColor("#F4511E"), 347 | Color.parseColor("#E64A19"), 348 | Color.parseColor("#D84315"), 349 | Color.parseColor("#BF360C"), 350 | Color.parseColor("#FF9E80"), 351 | Color.parseColor("#FF6E40"), 352 | Color.parseColor("#FF3D00"), 353 | Color.parseColor("#DD2C00") 354 | }, 355 | // Brown 356 | new Integer[] { 357 | Color.parseColor("#EFEBE9"), 358 | Color.parseColor("#D7CCC8"), 359 | Color.parseColor("#BCAAA4"), 360 | Color.parseColor("#A1887F"), 361 | Color.parseColor("#8D6E63"), 362 | Color.parseColor("#795548"), 363 | Color.parseColor("#6D4C41"), 364 | Color.parseColor("#5D4037"), 365 | Color.parseColor("#4E342E"), 366 | Color.parseColor("#3E2723") 367 | }, 368 | // Gray 369 | new Integer[] { 370 | Color.parseColor("#FAFAFA"), 371 | Color.parseColor("#F5F5F5"), 372 | Color.parseColor("#EEEEEE"), 373 | Color.parseColor("#E0E0E0"), 374 | Color.parseColor("#BDBDBD"), 375 | Color.parseColor("#9E9E9E"), 376 | Color.parseColor("#757575"), 377 | Color.parseColor("#616161"), 378 | Color.parseColor("#424242"), 379 | Color.parseColor("#212121") 380 | }, 381 | // Blue Gray 382 | new Integer[] { 383 | Color.parseColor("#ECEFF1"), 384 | Color.parseColor("#CFD8DC"), 385 | Color.parseColor("#B0BEC5"), 386 | Color.parseColor("#90A4AE"), 387 | Color.parseColor("#78909C"), 388 | Color.parseColor("#607D8B"), 389 | Color.parseColor("#546E7A"), 390 | Color.parseColor("#455A64"), 391 | Color.parseColor("#37474F"), 392 | Color.parseColor("#263238") 393 | }, 394 | // White 395 | new Integer[] { 396 | Color.parseColor("#FFFFFF"), 397 | Color.parseColor("#F5F5F5"), 398 | Color.parseColor("#EEEEEE"), 399 | Color.parseColor("#E0E0E0"), 400 | Color.parseColor("#EAEAEA"), 401 | Color.parseColor("#BDBDBD") 402 | }, 403 | // Black 404 | new Integer[] { 405 | Color.parseColor("#757575"), 406 | Color.parseColor("#616161"), 407 | Color.parseColor("#424242"), 408 | Color.parseColor("#252525"), 409 | Color.parseColor("#191919"), 410 | Color.parseColor("#000000") 411 | } 412 | }; 413 | } 414 | -------------------------------------------------------------------------------- /dynamic-theme/src/main/java/com/pranavpandey/android/dynamic/theme/ThemeContract.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2022 Pranav Pandey 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.pranavpandey.android.dynamic.theme; 18 | 19 | import android.net.Uri; 20 | import android.provider.BaseColumns; 21 | 22 | import java.lang.annotation.Retention; 23 | import java.lang.annotation.RetentionPolicy; 24 | 25 | /** 26 | * Theme contract class to hold the database values. 27 | */ 28 | public class ThemeContract { 29 | 30 | /** 31 | * Permissions for the dynamic theme. 32 | */ 33 | public @interface Permission { 34 | 35 | /** 36 | * Permission to broadcast the dynamic theme events. 37 | */ 38 | String DYNAMIC_THEME = "com.pranavpandey.theme.permission.DYNAMIC_THEME"; 39 | 40 | /** 41 | * Permission to read the theme presets. 42 | */ 43 | String READ_THEME = "com.pranavpandey.theme.permission.READ_THEME"; 44 | 45 | /** 46 | * Permission to write the theme presets. 47 | */ 48 | String WRITE_THEME = "com.pranavpandey.theme.permission.WRITE_THEME"; 49 | } 50 | 51 | /** 52 | * Interface to hold the content provider match codes. 53 | */ 54 | @Retention(RetentionPolicy.SOURCE) 55 | public @interface Code { 56 | 57 | /** 58 | * Match code for some items in the Preset table. 59 | */ 60 | int DIR = 1; 61 | 62 | /** 63 | * Match code for an item in the Preset table. 64 | */ 65 | int ITEM = 2; 66 | } 67 | 68 | /** 69 | * Interface to hold the preset constants. 70 | */ 71 | public @interface Preset { 72 | 73 | /** 74 | * Table name for the presets data. 75 | */ 76 | String TABLE_NAME = "presets"; 77 | 78 | /** 79 | * Package name for the theme manager app. 80 | */ 81 | String AUTHORITY = "com.pranavpandey.theme"; 82 | 83 | /** 84 | * Content provider URI for the presets table. 85 | */ 86 | Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/" + TABLE_NAME); 87 | 88 | /** 89 | * Permissions required to read the presets. 90 | */ 91 | String[] READ_PERMISSIONS = new String[] { Permission.READ_THEME }; 92 | 93 | /** 94 | * Permissions required to receive the presets. 95 | */ 96 | String[] RECEIVER_PERMISSIONS = new String[] { Permission.DYNAMIC_THEME }; 97 | 98 | /** 99 | * Interface to hold the preset database columns. 100 | */ 101 | @interface Column { 102 | 103 | /** 104 | * Column name for the preset id. 105 | */ 106 | String _ID = BaseColumns._ID; 107 | 108 | /** 109 | * Column name for the preset author. 110 | */ 111 | String AUTHOR = "author"; 112 | 113 | /** 114 | * Column name for the preset title. 115 | */ 116 | String TITLE = "title"; 117 | 118 | /** 119 | * Column name for the preset theme string. 120 | */ 121 | String THEME = "theme"; 122 | 123 | /** 124 | * Column name for the preset parent theme string. 125 | */ 126 | String PARENT = "parent"; 127 | 128 | /** 129 | * Column name for the preset type. 130 | */ 131 | String TYPE = "type"; 132 | } 133 | 134 | /** 135 | * Interface to hold the theme preset type. 136 | */ 137 | @Retention(RetentionPolicy.SOURCE) 138 | @interface Type { 139 | 140 | /** 141 | * Constant for the no preset type. 142 | */ 143 | int ALL = -1; 144 | 145 | /** 146 | * Constant for the default preset type. 147 | */ 148 | int DEFAULT = 0; 149 | 150 | /** 151 | * Constant for the custom preset type. 152 | */ 153 | int CUSTOM = 1; 154 | 155 | /** 156 | * Constant for the minimum presets count. 157 | */ 158 | int COUNT_MIN = -1; 159 | 160 | /** 161 | * Constant for the maximum presets count. 162 | */ 163 | int COUNT_MAX = 500; 164 | 165 | /** 166 | * Constant for the default presets count. 167 | */ 168 | int COUNT_DEFAULT = 100; 169 | 170 | /** 171 | * String constant values for the theme presets. 172 | */ 173 | @Retention(RetentionPolicy.SOURCE) 174 | @interface ToString { 175 | 176 | /** 177 | * String constant for the no preset type. 178 | */ 179 | String ALL = "-1"; 180 | 181 | /** 182 | * String constant for the default preset type. 183 | */ 184 | String DEFAULT = "0"; 185 | 186 | /** 187 | * String constant for the custom preset type. 188 | */ 189 | String CUSTOM = "1"; 190 | } 191 | } 192 | } 193 | } 194 | -------------------------------------------------------------------------------- /dynamic-theme/src/main/java/com/pranavpandey/android/dynamic/theme/annotation/Exclude.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2022 Pranav Pandey 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.pranavpandey.android.dynamic.theme.annotation; 18 | 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | /** 25 | * A {@link com.google.gson.Gson} annotation to exclude the field from the JSON string. 26 | */ 27 | @Retention(RetentionPolicy.RUNTIME) 28 | @Target(ElementType.FIELD) 29 | public @interface Exclude { 30 | 31 | } 32 | -------------------------------------------------------------------------------- /dynamic-theme/src/main/java/com/pranavpandey/android/dynamic/theme/base/AccentTheme.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2022 Pranav Pandey 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.pranavpandey.android.dynamic.theme.base; 18 | 19 | import androidx.annotation.ColorInt; 20 | import androidx.annotation.NonNull; 21 | 22 | /** 23 | * A {@link BaseTheme} to implement the accent theme. 24 | * 25 | * @param The type of the dynamic theme. 26 | */ 27 | public interface AccentTheme> extends BaseTheme { 28 | 29 | /** 30 | * Returns the accent color used by this theme. 31 | * 32 | * @param resolve {@code true} to resolve the auto color. 33 | * @param inverse {@code true} to resolve the inverse color. 34 | * 35 | * @return The accent color used by this theme. 36 | */ 37 | @ColorInt int getAccentColor(boolean resolve, boolean inverse); 38 | 39 | /** 40 | * Returns the accent color used by this theme. 41 | * 42 | * @param resolve {@code true} to resolve the auto color. 43 | * 44 | * @return The accent color used by this theme. 45 | */ 46 | @ColorInt int getAccentColor(boolean resolve); 47 | 48 | /** 49 | * Returns the accent color used by this theme. 50 | * 51 | * @return The accent color used by this theme. 52 | */ 53 | @ColorInt int getAccentColor(); 54 | 55 | /** 56 | * Set the accent color used by this theme. 57 | * 58 | * @param accentColor The accent color to be set. 59 | * @param generateTint {@code true} to automatically generate the tint color also. 60 | * 61 | * @return The {@link T} object to allow for chaining of calls to set methods. 62 | * 63 | * @see #setTintAccentColor(int) 64 | */ 65 | @NonNull T setAccentColor(@ColorInt int accentColor, boolean generateTint); 66 | 67 | /** 68 | * Set the accent color used by this theme. 69 | *

It will automatically generate the tint color also. 70 | * 71 | * @param accentColor The accent color to be set. 72 | * 73 | * @return The {@link T} object to allow for chaining of calls to set methods. 74 | * 75 | * @see #setAccentColor(int, boolean) 76 | * @see #setTintAccentColor(int) 77 | */ 78 | @NonNull T setAccentColor(@ColorInt int accentColor); 79 | 80 | /** 81 | * Returns the dark accent color used by this theme. 82 | * 83 | * @param resolve {@code true} to resolve the auto color. 84 | * @param inverse {@code true} to resolve the inverse color. 85 | * 86 | * @return The dark accent color used by this theme. 87 | */ 88 | @ColorInt int getAccentColorDark(boolean resolve, boolean inverse); 89 | 90 | /** 91 | * Returns the dark accent color used by this theme. 92 | * 93 | * @param resolve {@code true} to resolve the auto color. 94 | * 95 | * @return The dark accent color used by this theme. 96 | */ 97 | @ColorInt int getAccentColorDark(boolean resolve); 98 | 99 | /** 100 | * Returns the dark accent color used by this theme. 101 | * 102 | * @return The dark accent color used by this theme. 103 | */ 104 | @ColorInt int getAccentColorDark(); 105 | 106 | /** 107 | * Set the dark accent color used by this theme. 108 | * 109 | * @param accentColorDark The dark accent color to be set. 110 | * @param generateTint {@code true} to automatically generate the tint color also. 111 | * 112 | * @return The {@link T} object to allow for chaining of calls to set methods. 113 | * 114 | * @see #setTintAccentColorDark(int) 115 | */ 116 | @NonNull T setAccentColorDark(@ColorInt int accentColorDark, boolean generateTint); 117 | 118 | /** 119 | * Set the dark accent color used by this theme. 120 | *

It will automatically generate the tint color also. 121 | * 122 | * @param accentColorDark The dark accent color to be set. 123 | * 124 | * @return The {@link T} object to allow for chaining of calls to set methods. 125 | * 126 | * @see #setAccentColorDark(int, boolean) 127 | * @see #setTintAccentColorDark(int) 128 | */ 129 | @NonNull T setAccentColorDark(@ColorInt int accentColorDark); 130 | 131 | /** 132 | * Returns the accent tint color used by this theme. 133 | * 134 | * @param resolve {@code true} to resolve the auto color. 135 | * @param inverse {@code true} to resolve the inverse color. 136 | * 137 | * @return The accent tint color used by this theme. 138 | */ 139 | @ColorInt int getTintAccentColor(boolean resolve, boolean inverse); 140 | 141 | /** 142 | * Returns the accent tint color used by this theme. 143 | * 144 | * @param resolve {@code true} to resolve the auto color. 145 | * 146 | * @return The accent tint color used by this theme. 147 | */ 148 | @ColorInt int getTintAccentColor(boolean resolve); 149 | 150 | /** 151 | * Returns the accent tint color used by this theme. 152 | * 153 | * @return The accent tint color used by this theme. 154 | */ 155 | @ColorInt int getTintAccentColor(); 156 | 157 | /** 158 | * Set the accent tint color used by this theme. 159 | * 160 | * @param tintAccentColor The accent tint color to be set. 161 | * 162 | * @return The {@link T} object to allow for chaining of calls to set methods. 163 | */ 164 | @NonNull T setTintAccentColor(@ColorInt int tintAccentColor); 165 | 166 | /** 167 | * Returns the dark accent tint color used by this theme. 168 | * 169 | * @param resolve {@code true} to resolve the auto color. 170 | * @param inverse {@code true} to resolve the inverse color. 171 | * 172 | * @return The dark accent tint color used by this theme. 173 | */ 174 | @ColorInt int getTintAccentColorDark(boolean resolve, boolean inverse); 175 | 176 | /** 177 | * Returns the dark accent tint color used by this theme. 178 | * 179 | * @param resolve {@code true} to resolve the auto color. 180 | * 181 | * @return The dark accent tint color used by this theme. 182 | */ 183 | @ColorInt int getTintAccentColorDark(boolean resolve); 184 | 185 | /** 186 | * Returns the dark accent tint color used by this theme. 187 | * 188 | * @return The dark accent tint color used by this theme. 189 | */ 190 | @ColorInt int getTintAccentColorDark(); 191 | 192 | /** 193 | * Set the dark accent tint color used by this theme. 194 | * 195 | * @param tintAccentColorDark The dark accent tint color to be set. 196 | * 197 | * @return The {@link T} object to allow for chaining of calls to set methods. 198 | */ 199 | @NonNull T setTintAccentColorDark(@ColorInt int tintAccentColorDark); 200 | } 201 | -------------------------------------------------------------------------------- /dynamic-theme/src/main/java/com/pranavpandey/android/dynamic/theme/base/AutoTheme.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2022 Pranav Pandey 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.pranavpandey.android.dynamic.theme.base; 18 | 19 | import androidx.annotation.NonNull; 20 | 21 | /** 22 | * A {@link BaseTheme} to implement the auto theme. 23 | * 24 | * @param The type of the dynamic theme. 25 | */ 26 | public interface AutoTheme> extends BaseTheme { 27 | 28 | /** 29 | * Auto generate tint or inverse colors according to the base colors. They can be set 30 | * individually by calling the appropriate methods. 31 | * 32 | * @param tint {@code true} to generate tint colors. 33 | * @param inverse {@code true} to generate inverse colors. 34 | * 35 | * @return The {@link T} object to allow for chaining of calls to set methods. 36 | */ 37 | @NonNull T autoGenerateColors(boolean tint, boolean inverse); 38 | 39 | /** 40 | * Auto generate tint or inverse colors according to the base colors. They can be set 41 | * individually by calling the appropriate methods. 42 | * 43 | * @return The {@link T} object to allow for chaining of calls to set methods. 44 | * 45 | * @see #autoGenerateColors(boolean, boolean) 46 | */ 47 | @NonNull T autoGenerateColors(); 48 | } 49 | -------------------------------------------------------------------------------- /dynamic-theme/src/main/java/com/pranavpandey/android/dynamic/theme/base/BackgroundAware.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2022 Pranav Pandey 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.pranavpandey.android.dynamic.theme.base; 18 | 19 | import androidx.annotation.NonNull; 20 | 21 | import com.pranavpandey.android.dynamic.theme.Theme; 22 | 23 | /** 24 | * A {@link BaseTheme} to implement the background aware theme. 25 | * 26 | * @param The type of the dynamic theme. 27 | */ 28 | public interface BackgroundAware> extends BaseTheme { 29 | 30 | /** 31 | * Returns the background aware functionality used by this theme. 32 | * 33 | * @param resolve {@code true} to resolve auto background aware. 34 | * 35 | * @return The background aware functionality used by this theme. 36 | */ 37 | @Theme.BackgroundAware int getBackgroundAware(boolean resolve); 38 | 39 | /** 40 | * Returns the background aware functionality used by this theme. 41 | * 42 | * @return The background aware functionality used by this theme. 43 | */ 44 | @Theme.BackgroundAware int getBackgroundAware(); 45 | 46 | /** 47 | * Checks whether the background aware functionality is enabled. 48 | * 49 | * @return {@code true} if the background aware functionality is enabled. 50 | */ 51 | boolean isBackgroundAware(); 52 | 53 | /** 54 | * Set the background aware functionality used by this theme. 55 | * 56 | * @param backgroundAware The background aware functionality to be set. 57 | * 58 | * @return The {@link T} object to allow for chaining of calls to set methods. 59 | */ 60 | @NonNull T setBackgroundAware(@Theme.BackgroundAware int backgroundAware); 61 | 62 | /** 63 | * Get the contrast value used by this theme. 64 | * 65 | * @param resolve {@code true} to resolve auto contrast. 66 | * 67 | * @return The contrast value used by this theme. 68 | */ 69 | int getContrast(boolean resolve); 70 | 71 | /** 72 | * Get the contrast value used by this theme. 73 | * 74 | * @return The contrast value used by this theme. 75 | */ 76 | int getContrast(); 77 | 78 | /** 79 | * Returns the contrast ratio for by this theme. 80 | * 81 | * @return The contrast ratio for by this theme. 82 | */ 83 | float getContrastRatio(); 84 | 85 | /** 86 | * Set the contrast value used by this theme. 87 | * 88 | * @param contrast The contrast value to be set. 89 | * 90 | * @return The {@link T} object to allow for chaining of calls to set methods. 91 | */ 92 | @NonNull T setContrast(int contrast); 93 | } 94 | -------------------------------------------------------------------------------- /dynamic-theme/src/main/java/com/pranavpandey/android/dynamic/theme/base/BackgroundTheme.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2022 Pranav Pandey 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.pranavpandey.android.dynamic.theme.base; 18 | 19 | import androidx.annotation.ColorInt; 20 | import androidx.annotation.NonNull; 21 | 22 | /** 23 | * A {@link BaseTheme} to implement the background theme. 24 | * 25 | * @param The type of the dynamic theme. 26 | */ 27 | public interface BackgroundTheme> extends BaseTheme { 28 | 29 | /** 30 | * Returns the background color used by this theme. 31 | * 32 | * @param resolve {@code true} to resolve the auto color. 33 | * @param inverse {@code true} to resolve the inverse color. 34 | * 35 | * @return The background color used by this theme. 36 | */ 37 | @ColorInt int getBackgroundColor(boolean resolve, boolean inverse); 38 | 39 | /** 40 | * Returns the background color used by this theme. 41 | * 42 | * @param resolve {@code true} to resolve the auto color. 43 | * 44 | * @return The background color used by this theme. 45 | */ 46 | @ColorInt int getBackgroundColor(boolean resolve); 47 | 48 | /** 49 | * Returns the background color used by this theme. 50 | * 51 | * @return The background color used by this theme. 52 | */ 53 | @ColorInt int getBackgroundColor(); 54 | 55 | /** 56 | * Set the background color used by this theme. 57 | * 58 | * @param backgroundColor The background color to be set. 59 | * @param generateTint {@code true} to automatically generate the tint color also. 60 | * 61 | * @return The {@link T} object to allow for chaining of calls to set methods. 62 | * 63 | * @see #setTintBackgroundColor(int) 64 | */ 65 | @NonNull T setBackgroundColor(@ColorInt int backgroundColor, boolean generateTint); 66 | 67 | /** 68 | * Set the background color used by this theme. 69 | *

It will automatically generate the tint color also. 70 | * 71 | * @param backgroundColor The background color to be set. 72 | * 73 | * @return The {@link T} object to allow for chaining of calls to set methods. 74 | * 75 | * @see #setBackgroundColor(int, boolean) 76 | * @see #setTintBackgroundColor(int) 77 | */ 78 | @NonNull T setBackgroundColor(@ColorInt int backgroundColor); 79 | 80 | /** 81 | * Returns the background tint color used by this theme. 82 | * 83 | * @param resolve {@code true} to resolve the auto color. 84 | * @param inverse {@code true} to resolve the inverse color. 85 | * 86 | * @return The background tint color used by this theme. 87 | */ 88 | @ColorInt int getTintBackgroundColor(boolean resolve, boolean inverse); 89 | 90 | /** 91 | * Returns the background tint color used by this theme. 92 | * 93 | * @param resolve {@code true} to resolve the auto color. 94 | * 95 | * @return The background tint color used by this theme. 96 | */ 97 | @ColorInt int getTintBackgroundColor(boolean resolve); 98 | 99 | /** 100 | * Returns the background tint color used by this theme. 101 | * 102 | * @return The background tint color used by this theme. 103 | */ 104 | @ColorInt int getTintBackgroundColor(); 105 | 106 | /** 107 | * Set the background tint color used by this theme. 108 | * 109 | * @param tintBackgroundColor The background tint color to be set. 110 | * 111 | * @return The {@link T} object to allow for chaining of calls to set methods. 112 | */ 113 | @NonNull T setTintBackgroundColor(@ColorInt int tintBackgroundColor); 114 | 115 | /** 116 | * Returns {@code true} if this theme is dark. 117 | * 118 | * @return {@code true} if this theme is dark. 119 | */ 120 | boolean isDarkTheme(); 121 | 122 | /** 123 | * Checks whether this theme is applied in the inverse mode. 124 | * 125 | * @return {@code true} if this theme is applied in the inverse mode. 126 | */ 127 | boolean isInverseTheme(); 128 | 129 | /** 130 | * Returns whether to show the dividers for this theme. 131 | * 132 | * @return {@code true} to show the dividers for this theme. 133 | */ 134 | boolean isShowDividers(); 135 | } 136 | -------------------------------------------------------------------------------- /dynamic-theme/src/main/java/com/pranavpandey/android/dynamic/theme/base/BaseTheme.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2022 Pranav Pandey 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.pranavpandey.android.dynamic.theme.base; 18 | 19 | import androidx.annotation.NonNull; 20 | 21 | /** 22 | * An interface to implement the base theme. 23 | * 24 | * @param The type of the dynamic theme. 25 | */ 26 | public interface BaseTheme> { 27 | 28 | /** 29 | * Returns whether this theme is host and can have child themes. 30 | * 31 | * @return {@code true} if this theme is host and can have child themes. 32 | */ 33 | boolean isHost(); 34 | 35 | /** 36 | * Sets whether this theme is host and can have child themes. 37 | * 38 | * @param host {@code true} to set the theme as host. 39 | * 40 | * @return The {@link T} object to allow for chaining of calls to set methods. 41 | */ 42 | @NonNull T setHost(boolean host); 43 | } 44 | -------------------------------------------------------------------------------- /dynamic-theme/src/main/java/com/pranavpandey/android/dynamic/theme/base/CodeTheme.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2022 Pranav Pandey 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.pranavpandey.android.dynamic.theme.base; 18 | 19 | import androidx.annotation.ColorInt; 20 | import androidx.annotation.NonNull; 21 | 22 | import com.pranavpandey.android.dynamic.theme.Theme; 23 | 24 | /** 25 | * A {@link BaseTheme} to implement the code theme. 26 | * 27 | * @param The type of the dynamic theme. 28 | */ 29 | public interface CodeTheme> extends StringTheme { 30 | 31 | /** 32 | * Returns the data for the theme code. 33 | * 34 | * @return The data for the theme code. 35 | */ 36 | @NonNull String getCodeData(); 37 | 38 | /** 39 | * Returns the color for the code background. 40 | * 41 | * @return The color for the code background. 42 | */ 43 | @ColorInt int getCodeBackgroundColor(); 44 | 45 | /** 46 | * Returns the color for the code stroke. 47 | * 48 | * @return The color for the code stroke. 49 | */ 50 | @ColorInt int getCodeStrokeColor(); 51 | 52 | /** 53 | * Returns the color for the code data. 54 | * 55 | * @return The color for the code data. 56 | */ 57 | @ColorInt int getCodeDataColor(); 58 | 59 | /** 60 | * Returns the color for the code finder. 61 | * 62 | * @return The color for the finder data. 63 | */ 64 | @ColorInt int getCodeFinderColor(); 65 | 66 | /** 67 | * Returns the color for the code overlay. 68 | * 69 | * @return The color for the code overlay. 70 | */ 71 | @ColorInt int getCodeOverlayColor(); 72 | 73 | /** 74 | * Returns the code contrast ratio for by this theme. 75 | * 76 | * @return The code contrast ratio for by this theme. 77 | */ 78 | float getCodeContrastRatio(); 79 | 80 | /** 81 | * Returns the style for the theme code. 82 | * 83 | * @return The style for the theme code. 84 | */ 85 | @Theme.Code.Style int getCodeStyle(); 86 | } 87 | -------------------------------------------------------------------------------- /dynamic-theme/src/main/java/com/pranavpandey/android/dynamic/theme/base/CornerTheme.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2022 Pranav Pandey 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.pranavpandey.android.dynamic.theme.base; 18 | 19 | import androidx.annotation.NonNull; 20 | 21 | /** 22 | * A {@link BaseTheme} to implement the corner theme. 23 | * 24 | * @param The type of the dynamic theme. 25 | */ 26 | public interface CornerTheme> extends BaseTheme { 27 | 28 | /** 29 | * Returns the corner size used by this theme in pixels. 30 | * 31 | * @param resolve {@code true} to resolve auto corner size. 32 | * 33 | * @return The corner size used by this theme in pixels. 34 | */ 35 | int getCornerRadius(boolean resolve); 36 | 37 | /** 38 | * Returns the corner size used by this theme in pixels. 39 | * 40 | * @return The corner size used by this theme in pixels. 41 | */ 42 | int getCornerRadius(); 43 | 44 | /** 45 | * Set the corner size used by this theme. 46 | * 47 | * @param cornerRadius The corner size to be set in pixels. 48 | * 49 | * @return The {@link T} object to allow for chaining of calls to set methods. 50 | */ 51 | @NonNull T setCornerRadius(int cornerRadius); 52 | 53 | /** 54 | * Returns the corner size used by this theme in dips. 55 | * 56 | * @param resolve {@code true} to resolve auto corner size in dips. 57 | * 58 | * @return The corner size used by this theme in dips. 59 | */ 60 | int getCornerSize(boolean resolve); 61 | 62 | /** 63 | * Returns the corner size used by this theme in dips. 64 | * 65 | * @return The corner size used by this theme in dips. 66 | */ 67 | int getCornerSize(); 68 | 69 | /** 70 | * Set the corner size used by this theme. 71 | * 72 | * @param cornerSize The corner size to be set in dips. 73 | * 74 | * @return The {@link T} object to allow for chaining of calls to set methods. 75 | */ 76 | @NonNull T setCornerSize(float cornerSize); 77 | } 78 | -------------------------------------------------------------------------------- /dynamic-theme/src/main/java/com/pranavpandey/android/dynamic/theme/base/DynamicColor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2022 Pranav Pandey 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.pranavpandey.android.dynamic.theme.base; 18 | 19 | import androidx.annotation.NonNull; 20 | 21 | import com.pranavpandey.android.dynamic.theme.DynamicColors; 22 | 23 | /** 24 | * A {@link BaseTheme} to implement the dynamic color theme. 25 | * 26 | * @param The type of the dynamic theme. 27 | */ 28 | public interface DynamicColor> extends BaseTheme, 29 | BackgroundTheme, SurfaceTheme, PrimaryTheme, AccentTheme, ErrorTheme { 30 | 31 | /** 32 | * Returns whether to the dynamic colors are used by this theme. 33 | * 34 | * @return {@code true} if the dynamic colors are used by this theme. 35 | */ 36 | boolean isDynamicColor(); 37 | 38 | /** 39 | * Return the dynamic colors used by the app. 40 | * 41 | * @return The dynamic colors used by the app. 42 | */ 43 | @NonNull DynamicColors getDynamicColors(); 44 | } 45 | -------------------------------------------------------------------------------- /dynamic-theme/src/main/java/com/pranavpandey/android/dynamic/theme/base/ElevationTheme.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2022 Pranav Pandey 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.pranavpandey.android.dynamic.theme.base; 18 | 19 | import androidx.annotation.NonNull; 20 | 21 | import com.pranavpandey.android.dynamic.theme.Theme; 22 | 23 | /** 24 | * A {@link BaseTheme} to implement the elevation theme. 25 | * 26 | * @param The type of the dynamic theme. 27 | */ 28 | public interface ElevationTheme> extends BaseTheme { 29 | 30 | /** 31 | * Returns the elevation functionality used by this theme. 32 | * 33 | * @param resolve {@code true} to resolve auto elevation. 34 | * 35 | * @return The elevation functionality used by this theme. 36 | */ 37 | @Theme.Elevation int getElevation(boolean resolve); 38 | 39 | /** 40 | * Returns the elevation functionality used by this theme. 41 | * 42 | * @return The elevation functionality used by this theme. 43 | */ 44 | @Theme.Elevation int getElevation(); 45 | 46 | /** 47 | * Checks whether the elevation functionality is enabled. 48 | * 49 | * @return {@code true} if the elevation functionality is enabled. 50 | */ 51 | boolean isElevation(); 52 | 53 | /** 54 | * Set the elevation functionality used by this theme. 55 | * 56 | * @param elevation The elevation functionality to be set. 57 | * 58 | * @return The {@link T} object to allow for chaining of calls to set methods. 59 | */ 60 | @NonNull T setElevation(@Theme.Elevation int elevation); 61 | } 62 | -------------------------------------------------------------------------------- /dynamic-theme/src/main/java/com/pranavpandey/android/dynamic/theme/base/ErrorTheme.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2022 Pranav Pandey 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.pranavpandey.android.dynamic.theme.base; 18 | 19 | import androidx.annotation.ColorInt; 20 | import androidx.annotation.NonNull; 21 | 22 | /** 23 | * A {@link BaseTheme} to implement the error theme. 24 | * 25 | * @param The type of the dynamic theme. 26 | */ 27 | public interface ErrorTheme> extends BaseTheme { 28 | 29 | /** 30 | * Returns the error color used by this theme. 31 | * 32 | * @param resolve {@code true} to resolve the auto color. 33 | * @param inverse {@code true} to resolve the inverse color. 34 | * 35 | * @return The error color used by this theme. 36 | */ 37 | @ColorInt int getErrorColor(boolean resolve, boolean inverse); 38 | 39 | /** 40 | * Returns the error color used by this theme. 41 | * 42 | * @param resolve {@code true} to resolve the auto color. 43 | * 44 | * @return The error color used by this theme. 45 | */ 46 | @ColorInt int getErrorColor(boolean resolve); 47 | 48 | /** 49 | * Returns the error color used by this theme. 50 | * 51 | * @return The error color used by this theme. 52 | */ 53 | @ColorInt int getErrorColor(); 54 | 55 | /** 56 | * Set the error color used by this theme. 57 | * 58 | * @param errorColor The error color to be set. 59 | * @param generateTint {@code true} to automatically generate the tint color also. 60 | * 61 | * @return The {@link T} object to allow for chaining of calls to set methods. 62 | * 63 | * @see #setTintErrorColor(int) 64 | */ 65 | @NonNull T setErrorColor(@ColorInt int errorColor, boolean generateTint); 66 | 67 | /** 68 | * Set the error color used by this theme. 69 | *

It will automatically generate the tint color also. 70 | * 71 | * @param errorColor The error color to be set. 72 | * 73 | * @return The {@link T} object to allow for chaining of calls to set methods. 74 | * 75 | * @see #setErrorColor(int, boolean) 76 | * @see #setTintErrorColor(int) 77 | */ 78 | @NonNull T setErrorColor(@ColorInt int errorColor); 79 | 80 | /** 81 | * Returns the error tint color used by this theme. 82 | * 83 | * @param resolve {@code true} to resolve the auto color. 84 | * @param inverse {@code true} to resolve the inverse color. 85 | * 86 | * @return The error tint color used by this theme. 87 | */ 88 | @ColorInt int getTintErrorColor(boolean resolve, boolean inverse); 89 | 90 | /** 91 | * Returns the error tint color used by this theme. 92 | * 93 | * @param resolve {@code true} to resolve the auto color. 94 | * 95 | * @return The error tint color used by this theme. 96 | */ 97 | @ColorInt int getTintErrorColor(boolean resolve); 98 | 99 | /** 100 | * Returns the error tint color used by this theme. 101 | * 102 | * @return The error tint color used by this theme. 103 | */ 104 | @ColorInt int getTintErrorColor(); 105 | 106 | /** 107 | * Set the error tint color used by this theme. 108 | * 109 | * @param tintErrorColor The error tint color to be set. 110 | * 111 | * @return The {@link T} object to allow for chaining of calls to set methods. 112 | */ 113 | @NonNull T setTintErrorColor(@ColorInt int tintErrorColor); 114 | } 115 | -------------------------------------------------------------------------------- /dynamic-theme/src/main/java/com/pranavpandey/android/dynamic/theme/base/FallbackTheme.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2022 Pranav Pandey 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.pranavpandey.android.dynamic.theme.base; 18 | 19 | import androidx.annotation.NonNull; 20 | 21 | /** 22 | * A {@link BaseTheme} to implement the fallback theme. 23 | * 24 | * @param The type of the dynamic theme. 25 | */ 26 | public interface FallbackTheme> { 27 | 28 | /** 29 | * Returns the fallback dynamic theme to resolve the runtime values like auto color. 30 | * 31 | * @param resolve {@code true} to resolve the current theme, 32 | * otherwise return the default theme. 33 | * 34 | * @return The fallback dynamic theme to resolve the runtime values. 35 | */ 36 | @NonNull T getThemeFallback(boolean resolve); 37 | } 38 | -------------------------------------------------------------------------------- /dynamic-theme/src/main/java/com/pranavpandey/android/dynamic/theme/base/PrimaryTheme.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2022 Pranav Pandey 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.pranavpandey.android.dynamic.theme.base; 18 | 19 | import androidx.annotation.ColorInt; 20 | import androidx.annotation.NonNull; 21 | 22 | /** 23 | * A {@link BaseTheme} to implement the type theme. 24 | * 25 | * @param The type of the dynamic theme. 26 | */ 27 | public interface PrimaryTheme> extends BaseTheme { 28 | 29 | /** 30 | * Returns the primary color used by this theme. 31 | * 32 | * @param resolve {@code true} to resolve the auto color. 33 | * @param inverse {@code true} to resolve the inverse color. 34 | * 35 | * @return The primary color used by this theme. 36 | */ 37 | @ColorInt int getPrimaryColor(boolean resolve, boolean inverse); 38 | 39 | /** 40 | * Returns the primary color used by this theme. 41 | * 42 | * @param resolve {@code true} to resolve the auto color. 43 | * 44 | * @return The primary color used by this theme. 45 | */ 46 | @ColorInt int getPrimaryColor(boolean resolve); 47 | 48 | /** 49 | * Returns the primary color used by this theme. 50 | * 51 | * @return The primary color used by this theme. 52 | */ 53 | @ColorInt int getPrimaryColor(); 54 | 55 | /** 56 | * Set the primary color used by this theme. 57 | * 58 | * @param primaryColor The primary color to be set. 59 | * @param generateTint {@code true} to automatically generate the tint color also. 60 | * 61 | * @return The {@link T} object to allow for chaining of calls to set methods. 62 | * 63 | * @see #setTintPrimaryColor(int) 64 | */ 65 | @NonNull T setPrimaryColor(@ColorInt int primaryColor, boolean generateTint); 66 | 67 | /** 68 | * Set the primary color used by this theme. 69 | *

It will automatically generate the tint color also. 70 | * 71 | * @param primaryColor The primary color to be set. 72 | * 73 | * @return The {@link T} object to allow for chaining of calls to set methods. 74 | * 75 | * @see #setPrimaryColor(int, boolean) 76 | * @see #setTintPrimaryColor(int) 77 | */ 78 | @NonNull T setPrimaryColor(@ColorInt int primaryColor); 79 | 80 | /** 81 | * Returns the dark primary color used by this theme. 82 | * 83 | * @param resolve {@code true} to resolve the auto color. 84 | * @param inverse {@code true} to resolve the inverse color. 85 | * 86 | * @return The dark primary color used by this theme. 87 | */ 88 | @ColorInt int getPrimaryColorDark(boolean resolve, boolean inverse); 89 | 90 | /** 91 | * Returns the dark primary color used by this theme. 92 | * 93 | * @param resolve {@code true} to resolve the auto color. 94 | * 95 | * @return The dark primary color used by this theme. 96 | */ 97 | @ColorInt int getPrimaryColorDark(boolean resolve); 98 | 99 | /** 100 | * Returns the dark primary color used by this theme. 101 | * 102 | * @return The dark primary color used by this theme. 103 | */ 104 | @ColorInt int getPrimaryColorDark(); 105 | 106 | /** 107 | * Set the dark primary color used by this theme. 108 | * 109 | * @param primaryColorDark The dark primary color to be set. 110 | * @param generateTint {@code true} to automatically generate the tint color also. 111 | * 112 | * @return The {@link T} object to allow for chaining of calls to set methods. 113 | * 114 | * @see #setTintPrimaryColorDark(int) 115 | */ 116 | @NonNull T setPrimaryColorDark(@ColorInt int primaryColorDark, boolean generateTint); 117 | 118 | /** 119 | * Set the dark primary color used by this theme. 120 | *

It will automatically generate the tint color also. 121 | * 122 | * @param primaryColorDark The dark primary color to be set. 123 | * 124 | * @return The {@link T} object to allow for chaining of calls to set methods. 125 | * 126 | * @see #setPrimaryColorDark(int, boolean) 127 | * @see #setTintPrimaryColorDark(int) 128 | */ 129 | @NonNull T setPrimaryColorDark(@ColorInt int primaryColorDark); 130 | 131 | /** 132 | * Returns the primary tint color used by this theme. 133 | * 134 | * @param resolve {@code true} to resolve the auto color. 135 | * @param inverse {@code true} to resolve the inverse color. 136 | * 137 | * @return The primary tint color used by this theme. 138 | */ 139 | @ColorInt int getTintPrimaryColor(boolean resolve, boolean inverse); 140 | 141 | /** 142 | * Returns the primary tint color used by this theme. 143 | * 144 | * @param resolve {@code true} to resolve the auto color. 145 | * 146 | * @return The primary tint color used by this theme. 147 | */ 148 | @ColorInt int getTintPrimaryColor(boolean resolve); 149 | 150 | /** 151 | * Returns the primary tint color used by this theme. 152 | * 153 | * @return The primary tint color used by this theme. 154 | */ 155 | @ColorInt int getTintPrimaryColor(); 156 | 157 | /** 158 | * Set the primary tint color used by this theme. 159 | * 160 | * @param tintPrimaryColor The primary tint color to be set. 161 | * 162 | * @return The {@link T} object to allow for chaining of calls to set methods. 163 | */ 164 | @NonNull T setTintPrimaryColor(@ColorInt int tintPrimaryColor); 165 | 166 | /** 167 | * Returns the dark primary tint color used by this theme. 168 | * 169 | * @param resolve {@code true} to resolve the auto color. 170 | * @param inverse {@code true} to resolve the inverse color. 171 | * 172 | * @return The dark primary tint color used by this theme. 173 | */ 174 | @ColorInt int getTintPrimaryColorDark(boolean resolve, boolean inverse); 175 | 176 | /** 177 | * Returns the dark primary tint color used by this theme. 178 | * 179 | * @param resolve {@code true} to resolve the auto color. 180 | * 181 | * @return The dark primary tint color used by this theme. 182 | */ 183 | @ColorInt int getTintPrimaryColorDark(boolean resolve); 184 | 185 | /** 186 | * Returns the dark primary tint color used by this theme. 187 | * 188 | * @return The dark primary tint color used by this theme. 189 | */ 190 | @ColorInt int getTintPrimaryColorDark(); 191 | 192 | /** 193 | * Set the dark primary tint color used by this theme. 194 | * 195 | * @param tintPrimaryColorDark The dark primary tint color to be set. 196 | * 197 | * @return The {@link T} object to allow for chaining of calls to set methods. 198 | */ 199 | @NonNull T setTintPrimaryColorDark(@ColorInt int tintPrimaryColorDark); 200 | } 201 | -------------------------------------------------------------------------------- /dynamic-theme/src/main/java/com/pranavpandey/android/dynamic/theme/base/ResourceTheme.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2022 Pranav Pandey 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.pranavpandey.android.dynamic.theme.base; 18 | 19 | import androidx.annotation.NonNull; 20 | import androidx.annotation.StyleRes; 21 | 22 | /** 23 | * A {@link BaseTheme} to implement the resource theme. 24 | * 25 | * @param The type of the dynamic theme. 26 | */ 27 | public interface ResourceTheme> extends BaseTheme { 28 | 29 | /** 30 | * Returns the theme resource used by this theme. 31 | * 32 | * @return The theme resource used by this theme. 33 | */ 34 | @StyleRes int getThemeRes(); 35 | 36 | /** 37 | * Set the theme resource used by this theme. 38 | * 39 | * @param themeRes The theme resource to be set. 40 | * 41 | * @return The {@link T} object to allow for chaining of calls to set methods. 42 | */ 43 | @NonNull T setThemeRes(@StyleRes int themeRes); 44 | } 45 | -------------------------------------------------------------------------------- /dynamic-theme/src/main/java/com/pranavpandey/android/dynamic/theme/base/StringTheme.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2022 Pranav Pandey 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.pranavpandey.android.dynamic.theme.base; 18 | 19 | import androidx.annotation.NonNull; 20 | 21 | /** 22 | * A {@link BaseTheme} to implement the string theme. 23 | * 24 | * @param The type of the dynamic theme. 25 | */ 26 | public interface StringTheme> extends BaseTheme { 27 | 28 | /** 29 | * Converts this theme into its JSON equivalent. 30 | * 31 | * @param resolve {@code true} to resolve the values. 32 | * @param inverse {@code true} to resolve the inverse values. 33 | * 34 | * @return The JSON equivalent of this theme. 35 | */ 36 | @NonNull String toJsonString(boolean resolve, boolean inverse); 37 | 38 | /** 39 | * Converts this theme into its JSON equivalent. 40 | * 41 | * @return The JSON equivalent of this theme. 42 | */ 43 | @NonNull String toJsonString(); 44 | 45 | /** 46 | * Convert this theme into a pretty JSON string. 47 | * 48 | * @return The converted JSON string. 49 | */ 50 | @NonNull String toDynamicString(); 51 | 52 | /** 53 | * Returns the sharable data for the theme. 54 | * 55 | * @return The sharable data for the theme. 56 | */ 57 | @NonNull String getThemeData(); 58 | } 59 | -------------------------------------------------------------------------------- /dynamic-theme/src/main/java/com/pranavpandey/android/dynamic/theme/base/StrokeTheme.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2022 Pranav Pandey 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.pranavpandey.android.dynamic.theme.base; 18 | 19 | import androidx.annotation.ColorInt; 20 | 21 | /** 22 | * A {@link BaseTheme} to implement the stroke theme. 23 | * 24 | * @param The type of the dynamic theme. 25 | */ 26 | public interface StrokeTheme> extends BaseTheme { 27 | 28 | /** 29 | * Returns whether the stroke is required for this theme. 30 | * 31 | * @return {@code true} if the stroke is required for this theme. 32 | */ 33 | boolean isStroke(); 34 | 35 | /** 36 | * Returns the stroke color used by this theme. 37 | * 38 | * @return The stroke color used by this theme. 39 | */ 40 | @ColorInt int getStrokeColor(); 41 | } 42 | -------------------------------------------------------------------------------- /dynamic-theme/src/main/java/com/pranavpandey/android/dynamic/theme/base/StyleTheme.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2022 Pranav Pandey 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.pranavpandey.android.dynamic.theme.base; 18 | 19 | import androidx.annotation.NonNull; 20 | 21 | import com.pranavpandey.android.dynamic.theme.Theme; 22 | 23 | /** 24 | * A {@link BaseTheme} to implement the style theme. 25 | * 26 | * @param The type of the dynamic theme. 27 | */ 28 | public interface StyleTheme> extends BaseTheme { 29 | 30 | /** 31 | * Get the style value used by this theme. 32 | * 33 | * @return The style value used by this theme. 34 | */ 35 | @Theme.Style int getStyle(); 36 | 37 | /** 38 | * Set the style value used by this theme. 39 | * 40 | * @param style The style value to be set. 41 | * 42 | * @return The {@link T} object to allow for chaining of calls to set methods. 43 | */ 44 | @NonNull T setStyle(@Theme.Style int style); 45 | } 46 | -------------------------------------------------------------------------------- /dynamic-theme/src/main/java/com/pranavpandey/android/dynamic/theme/base/SurfaceTheme.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2022 Pranav Pandey 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.pranavpandey.android.dynamic.theme.base; 18 | 19 | import androidx.annotation.ColorInt; 20 | import androidx.annotation.NonNull; 21 | 22 | /** 23 | * An {@link ElevationTheme} to implement the surface theme. 24 | * 25 | * @param The type of the dynamic theme. 26 | */ 27 | public interface SurfaceTheme> extends ElevationTheme { 28 | 29 | /** 30 | * Returns the surface color used by this theme. 31 | * 32 | * @param resolve {@code true} to resolve the auto color. 33 | * @param inverse {@code true} to resolve the inverse color. 34 | * 35 | * @return The surface color used by this theme. 36 | */ 37 | @ColorInt int getSurfaceColor(boolean resolve, boolean inverse); 38 | 39 | /** 40 | * Returns the surface color used by this theme. 41 | * 42 | * @param resolve {@code true} to resolve the auto color. 43 | * 44 | * @return The surface color used by this theme. 45 | */ 46 | @ColorInt int getSurfaceColor(boolean resolve); 47 | 48 | /** 49 | * Returns the surface color used by this theme. 50 | * 51 | * @return The surface color used by this theme. 52 | */ 53 | @ColorInt int getSurfaceColor(); 54 | 55 | /** 56 | * Set the surface color used by this theme. 57 | * 58 | * @param surfaceColor The surface color to be set. 59 | * @param generateTint {@code true} to automatically generate the tint color also. 60 | * 61 | * @return The {@link T} object to allow for chaining of calls to set methods. 62 | * 63 | * @see #setTintSurfaceColor(int) 64 | */ 65 | @NonNull T setSurfaceColor(@ColorInt int surfaceColor, boolean generateTint); 66 | 67 | /** 68 | * Set the surface color used by this theme. 69 | *

It will automatically generate the tint color also. 70 | * 71 | * @param surfaceColor The surface color to be set. 72 | * 73 | * @return The {@link T} object to allow for chaining of calls to set methods. 74 | * 75 | * @see #setSurfaceColor(int, boolean) 76 | * @see #setTintSurfaceColor(int) 77 | */ 78 | @NonNull T setSurfaceColor(@ColorInt int surfaceColor); 79 | 80 | /** 81 | * Returns the surface tint color used by this theme. 82 | * 83 | * @param resolve {@code true} to resolve the auto color. 84 | * @param inverse {@code true} to resolve the inverse color. 85 | * 86 | * @return The surface tint color used by this theme. 87 | */ 88 | @ColorInt int getTintSurfaceColor(boolean resolve, boolean inverse); 89 | 90 | /** 91 | * Returns the surface tint color used by this theme. 92 | * 93 | * @param resolve {@code true} to resolve the auto color. 94 | * 95 | * @return The surface tint color used by this theme. 96 | */ 97 | @ColorInt int getTintSurfaceColor(boolean resolve); 98 | 99 | /** 100 | * Returns the surface tint color used by this theme. 101 | * 102 | * @return The surface tint color used by this theme. 103 | */ 104 | @ColorInt int getTintSurfaceColor(); 105 | 106 | /** 107 | * Set the surface tint color used by this theme. 108 | * 109 | * @param tintSurfaceColor The surface tint color to be set. 110 | * 111 | * @return The {@link T} object to allow for chaining of calls to set methods. 112 | */ 113 | @NonNull T setTintSurfaceColor(@ColorInt int tintSurfaceColor); 114 | 115 | /** 116 | * Checks whether the background should be used as the surface. 117 | * 118 | * @return {@code true} if the background should be used as surface. 119 | */ 120 | boolean isBackgroundSurface(); 121 | } 122 | -------------------------------------------------------------------------------- /dynamic-theme/src/main/java/com/pranavpandey/android/dynamic/theme/base/TextTheme.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2022 Pranav Pandey 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.pranavpandey.android.dynamic.theme.base; 18 | 19 | import androidx.annotation.ColorInt; 20 | import androidx.annotation.NonNull; 21 | 22 | /** 23 | * A {@link BaseTheme} to implement the text theme. 24 | * 25 | * @param The type of the dynamic theme. 26 | */ 27 | public interface TextTheme> extends BaseTheme { 28 | 29 | /** 30 | * Returns the primary text color used by this theme. 31 | * 32 | * @param resolve {@code true} to resolve the auto color. 33 | * @param inverse {@code true} to resolve the inverse color. 34 | * 35 | * @return The primary text color used by this theme. 36 | */ 37 | @ColorInt int getTextPrimaryColor(boolean resolve, boolean inverse); 38 | 39 | /** 40 | * Returns the primary text color used by this theme. 41 | * 42 | * @param resolve {@code true} to resolve the auto color. 43 | * 44 | * @return The primary text color used by this theme. 45 | */ 46 | @ColorInt int getTextPrimaryColor(boolean resolve); 47 | 48 | /** 49 | * Returns the primary text color used by this theme. 50 | * 51 | * @return The primary text color used by this theme. 52 | */ 53 | @ColorInt int getTextPrimaryColor(); 54 | 55 | /** 56 | * Set the primary text color used by this theme. 57 | * 58 | * @param textPrimaryColor The primary text color to be set. 59 | * @param generateInverse {@code true} to automatically generate the inverse color also. 60 | * 61 | * @return The {@link T} object to allow for chaining of calls to set methods. 62 | * 63 | * @see #setTextPrimaryColorInverse(int) 64 | */ 65 | @NonNull T setTextPrimaryColor(@ColorInt int textPrimaryColor, boolean generateInverse); 66 | 67 | /** 68 | * Set the primary text color used by this theme. 69 | *

It will automatically generate the inverse color also. 70 | * 71 | * @param textPrimaryColor The primary text color to be set. 72 | * 73 | * @return The {@link T} object to allow for chaining of calls to set methods. 74 | * 75 | * @see #setTextPrimaryColor(int, boolean) 76 | * @see #setTextPrimaryColorInverse(int) 77 | */ 78 | @NonNull T setTextPrimaryColor(@ColorInt int textPrimaryColor); 79 | 80 | /** 81 | * Returns the secondary text color used by this theme. 82 | * 83 | * @param resolve {@code true} to resolve the auto color. 84 | * @param inverse {@code true} to resolve the inverse color. 85 | * 86 | * @return The secondary text color used by this theme. 87 | */ 88 | @ColorInt int getTextSecondaryColor(boolean resolve, boolean inverse); 89 | 90 | /** 91 | * Returns the secondary text color used by this theme. 92 | * 93 | * @param resolve {@code true} to resolve the auto color. 94 | * 95 | * @return The secondary text color used by this theme. 96 | */ 97 | @ColorInt int getTextSecondaryColor(boolean resolve); 98 | 99 | /** 100 | * Returns the secondary text color used by this theme. 101 | * 102 | * @return The secondary text color used by this theme. 103 | */ 104 | @ColorInt int getTextSecondaryColor(); 105 | 106 | /** 107 | * Set the secondary text color used by this theme. 108 | * 109 | * @param textSecondaryColor The secondary text color to be set. 110 | * @param generateInverse {@code true} to automatically generate the inverse color also. 111 | * 112 | * @return The {@link T} object to allow for chaining of calls to set methods. 113 | * 114 | * @see #setTextSecondaryColorInverse(int) 115 | */ 116 | @NonNull T setTextSecondaryColor(@ColorInt int textSecondaryColor, boolean generateInverse); 117 | 118 | /** 119 | * Set the secondary text color used by this theme. 120 | *

It will automatically generate the inverse color also. 121 | * 122 | * @param textSecondaryColor The secondary text color to be set. 123 | * 124 | * @return The {@link T} object to allow for chaining of calls to set methods. 125 | * 126 | * @see #setTextSecondaryColor(int, boolean) 127 | * @see #setTextSecondaryColorInverse(int) 128 | */ 129 | @NonNull T setTextSecondaryColor(@ColorInt int textSecondaryColor); 130 | 131 | /** 132 | * Returns the inverse color for the primary text color. 133 | * 134 | * @param resolve {@code true} to resolve the auto color. 135 | * @param inverse {@code true} to resolve the inverse color. 136 | * 137 | * @return The inverse color for the primary text color. 138 | */ 139 | @ColorInt int getTextPrimaryColorInverse(boolean resolve, boolean inverse); 140 | 141 | /** 142 | * Returns the inverse color for the primary text color. 143 | * 144 | * @param resolve {@code true} to resolve the auto color. 145 | * 146 | * @return The inverse color for the primary text color. 147 | */ 148 | @ColorInt int getTextPrimaryColorInverse(boolean resolve); 149 | 150 | /** 151 | * Returns the inverse color for the primary text color. 152 | * 153 | * @return The inverse color for the primary text color. 154 | */ 155 | @ColorInt int getTextPrimaryColorInverse(); 156 | 157 | /** 158 | * Set the primary text inverse color used by this theme. 159 | * 160 | * @param textPrimaryColorInverse The primary text inverse color to be set. 161 | * 162 | * @return The {@link T} object to allow for chaining of calls to set methods. 163 | */ 164 | @NonNull T setTextPrimaryColorInverse(int textPrimaryColorInverse); 165 | 166 | /** 167 | * Returns the inverse color for the secondary text color. 168 | * 169 | * @param resolve {@code true} to resolve the auto color. 170 | * @param inverse {@code true} to resolve the inverse color. 171 | * 172 | * @return The inverse color for the secondary text color. 173 | */ 174 | @ColorInt int getTextSecondaryColorInverse(boolean resolve, boolean inverse); 175 | 176 | /** 177 | * Returns the inverse color for the secondary text color. 178 | * 179 | * @param resolve {@code true} to resolve the auto color. 180 | * 181 | * @return The inverse color for the secondary text color. 182 | */ 183 | @ColorInt int getTextSecondaryColorInverse(boolean resolve); 184 | 185 | /** 186 | * Returns the inverse color for the secondary text color. 187 | * 188 | * @return The inverse color for the secondary text color. 189 | */ 190 | @ColorInt int getTextSecondaryColorInverse(); 191 | 192 | /** 193 | * Set the secondary text inverse color used by this theme. 194 | * 195 | * @param textSecondaryColorInverse The secondary text inverse color to be set. 196 | * 197 | * @return The {@link T} object to allow for chaining of calls to set methods. 198 | */ 199 | @NonNull T setTextSecondaryColorInverse(int textSecondaryColorInverse); 200 | 201 | /** 202 | * Returns the highlight color for this theme. 203 | * 204 | * @param contrastWithColor The contrast with color to be used. 205 | * 206 | * @return The highlight color for this theme. 207 | */ 208 | @ColorInt int getHighlightColor(@ColorInt int contrastWithColor); 209 | 210 | /** 211 | * Returns the highlight color for this theme. 212 | * 213 | * @return The highlight color for this theme. 214 | */ 215 | @ColorInt int getHighlightColor(); 216 | 217 | /** 218 | * Returns the font scaling factor used by this theme. 219 | * 220 | * @param resolve {@code true} to resolve the auto font scale. 221 | * 222 | * @return The font scaling factor (in percent) used by this theme. 223 | */ 224 | int getFontScale(boolean resolve); 225 | 226 | /** 227 | * Returns the font scaling factor used by this theme. 228 | * 229 | * @return The font scaling factor (in percent) used by this theme. 230 | */ 231 | int getFontScale(); 232 | 233 | /** 234 | * Returns the relative font scale after dividing it by 100. 235 | * 236 | * @return The relative font scale after dividing it by 100. 237 | */ 238 | float getFontScaleRelative(); 239 | 240 | /** 241 | * Set the font scaling factor used by this theme. 242 | * 243 | * @param fontScale The font scaling factor (in percent) to be set. 244 | * 245 | * @return The {@link T} object to allow for chaining of calls to set methods. 246 | */ 247 | @NonNull T setFontScale(int fontScale); 248 | 249 | /** 250 | * Checks whether the custom font scale is set. 251 | * 252 | * @return {@code true} if the custom font scale is set. 253 | */ 254 | boolean isFontScale(); 255 | } 256 | -------------------------------------------------------------------------------- /dynamic-theme/src/main/java/com/pranavpandey/android/dynamic/theme/base/TranslucentTheme.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2022 Pranav Pandey 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.pranavpandey.android.dynamic.theme.base; 18 | 19 | import androidx.annotation.NonNull; 20 | 21 | /** 22 | * A {@link BaseTheme} to implement the translucent theme. 23 | * 24 | * @param The type of the dynamic theme. 25 | */ 26 | public interface TranslucentTheme> extends BaseTheme { 27 | 28 | /** 29 | * Get the opacity value used by this theme. 30 | * 31 | * @param resolve {@code true} to resolve auto opacity. 32 | * 33 | * @return The opacity value used by this theme. 34 | */ 35 | int getOpacity(boolean resolve); 36 | 37 | /** 38 | * Get the opacity value used by this theme. 39 | * 40 | * @return The opacity value used by this theme. 41 | */ 42 | int getOpacity(); 43 | 44 | /** 45 | * Set the opacity value used by this theme. 46 | * 47 | * @param opacity The opacity value to be set. 48 | * 49 | * @return The {@link T} object to allow for chaining of calls to set methods. 50 | */ 51 | @NonNull T setOpacity(int opacity); 52 | 53 | /** 54 | * Returns the opacity after converting it into the float range. 55 | * 56 | * @return The opacity after converting it into the float range. 57 | */ 58 | float getAlpha(); 59 | 60 | /** 61 | * Checks whether this theme is translucent. 62 | * 63 | * @return {@code true} if this theme is translucent. 64 | */ 65 | boolean isTranslucent(); 66 | 67 | /** 68 | * Checks whether this theme has a translucent window. 69 | * 70 | * @return {@code true} if this theme has a translucent window. 71 | */ 72 | boolean isTranslucentWindow(); 73 | } 74 | -------------------------------------------------------------------------------- /dynamic-theme/src/main/java/com/pranavpandey/android/dynamic/theme/base/TypeTheme.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2022 Pranav Pandey 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.pranavpandey.android.dynamic.theme.base; 18 | 19 | import androidx.annotation.NonNull; 20 | 21 | import com.pranavpandey.android.dynamic.theme.Theme; 22 | 23 | /** 24 | * A {@link BaseTheme} to implement the type theme. 25 | * 26 | * @param The type of the dynamic theme. 27 | */ 28 | public interface TypeTheme> extends BaseTheme { 29 | 30 | /** 31 | * Get the type value used by this theme. 32 | * 33 | * @param resolve {@code true} to resolve theme style. 34 | * 35 | * @return The type value used by this theme. 36 | */ 37 | @Theme int getType(boolean resolve); 38 | 39 | /** 40 | * Get the type value used by this theme. 41 | * 42 | * @return The type value used by this theme. 43 | */ 44 | @Theme int getType(); 45 | 46 | /** 47 | * Set the type value used by this theme. 48 | * 49 | * @param type The type value to be set. 50 | * 51 | * @return The {@link T} object to allow for chaining of calls to set methods. 52 | */ 53 | @NonNull T setType(@Theme int type); 54 | } 55 | -------------------------------------------------------------------------------- /dynamic-theme/src/main/java/com/pranavpandey/android/dynamic/theme/base/WidgetTheme.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2022 Pranav Pandey 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.pranavpandey.android.dynamic.theme.base; 18 | 19 | import androidx.annotation.NonNull; 20 | 21 | import com.pranavpandey.android.dynamic.theme.Theme; 22 | 23 | /** 24 | * A {@link BaseTheme} to implement the widget theme. 25 | * 26 | * @param The type of the dynamic theme. 27 | * @param The type of the app theme. 28 | */ 29 | public interface WidgetTheme, 30 | V extends BaseTheme> extends BaseTheme { 31 | 32 | /** 33 | * Get the app widget id used by this theme. 34 | * 35 | * @return The app widget id used by this theme. 36 | */ 37 | int getWidgetId(); 38 | 39 | /** 40 | * Set the widget id used by this theme. 41 | * 42 | * @param widgetId The widget id to be set. 43 | * 44 | * @return The {@link T} object to allow for chaining of calls to set methods. 45 | */ 46 | @NonNull T setWidgetId(int widgetId); 47 | 48 | /** 49 | * Get the header state used by this theme. 50 | * 51 | * @return The header state used by this theme. 52 | */ 53 | @Theme.Visibility int getHeader(); 54 | 55 | /** 56 | * Returns the header state string used by this theme. 57 | * 58 | * @return The header state string used by this theme. 59 | */ 60 | @NonNull @Theme.Visibility.ToString String getHeaderString(); 61 | 62 | /** 63 | * Set the header state used by this theme. 64 | * 65 | * @param header The header state to be set. 66 | * 67 | * @return The {@link T} object to allow for chaining of calls to set methods. 68 | */ 69 | @NonNull T setHeader(@Theme.Visibility int header); 70 | 71 | /** 72 | * Set the header state used by this theme. 73 | * 74 | * @param header The header state to be set. 75 | * 76 | * @return The {@link T} object to allow for chaining of calls to set methods. 77 | */ 78 | @NonNull T setHeaderString(@NonNull @Theme.Visibility.ToString String header); 79 | } 80 | -------------------------------------------------------------------------------- /dynamic-theme/src/main/java/com/pranavpandey/android/dynamic/theme/receiver/DynamicThemeReceiver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2022 Pranav Pandey 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.pranavpandey.android.dynamic.theme.receiver; 18 | 19 | import android.appwidget.AppWidgetManager; 20 | import android.content.BroadcastReceiver; 21 | import android.content.Context; 22 | import android.content.Intent; 23 | 24 | import androidx.annotation.NonNull; 25 | import androidx.annotation.Nullable; 26 | 27 | import com.pranavpandey.android.dynamic.theme.Theme; 28 | 29 | /** 30 | * A {@link BroadcastReceiver} to receive the theme data. 31 | * 32 | *

Extend this broadcast receiver and declare it in the project's manifest to 33 | * receive the theme data. 34 | */ 35 | public abstract class DynamicThemeReceiver extends BroadcastReceiver { 36 | 37 | @Override 38 | public void onReceive(final @NonNull Context context, @Nullable Intent intent) { 39 | if (intent == null) { 40 | return; 41 | } 42 | 43 | if (Theme.Intent.ACTION.equals(intent.getAction())) { 44 | if (intent.hasExtra(Theme.Intent.EXTRA_THEME) 45 | || intent.hasExtra(Theme.Intent.EXTRA_DATA)) { 46 | onReceiveTheme(intent.getStringExtra(Theme.Intent.EXTRA_THEME), 47 | intent.getStringExtra(Theme.Intent.EXTRA_VALUE), 48 | intent.getStringExtra(Theme.Intent.EXTRA_DATA)); 49 | } 50 | } else if (Theme.Intent.ACTION_APP_WIDGET.equals(intent.getAction()) 51 | || intent.hasExtra(AppWidgetManager.EXTRA_APPWIDGET_ID)) { 52 | int appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, 53 | AppWidgetManager.INVALID_APPWIDGET_ID); 54 | 55 | if (appWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID) { 56 | onAppWidget(appWidgetId, intent.getStringExtra(Theme.Intent.EXTRA_PREFS), 57 | intent.getStringExtra(Theme.Intent.EXTRA_THEME)); 58 | } 59 | } 60 | } 61 | 62 | /** 63 | * This method will be called when a theme data is received by this receiver. 64 | * 65 | * @param theme The theme received by the receiver. 66 | * @param value The theme value received by the receiver. 67 | * @param data The theme data received by the receiver. 68 | */ 69 | protected abstract void onReceiveTheme(@Nullable @Theme.ToString String theme, 70 | @Nullable @Theme.ToString String value, @Nullable String data); 71 | 72 | /** 73 | * This method will be called when an app widget is added via pinning. 74 | * 75 | * @param appWidgetId The generated app widget id. 76 | * @param prefs The received shared preferences name. 77 | * @param theme The received widget theme or settings. 78 | */ 79 | protected void onAppWidget(int appWidgetId, 80 | @Nullable String prefs, @Nullable String theme) { } 81 | } 82 | -------------------------------------------------------------------------------- /dynamic-theme/src/main/java/com/pranavpandey/android/dynamic/theme/strategy/ExcludeStrategy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2022 Pranav Pandey 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.pranavpandey.android.dynamic.theme.strategy; 18 | 19 | import com.google.gson.ExclusionStrategy; 20 | import com.google.gson.FieldAttributes; 21 | import com.pranavpandey.android.dynamic.theme.annotation.Exclude; 22 | 23 | /** 24 | * A {@link com.google.gson.Gson} exclusion strategy to exclude the field from the JSON string. 25 | */ 26 | public class ExcludeStrategy implements ExclusionStrategy { 27 | 28 | @Override 29 | public boolean shouldSkipField(FieldAttributes f) { 30 | return f.getAnnotation(Exclude.class) != null; 31 | } 32 | 33 | @Override 34 | public boolean shouldSkipClass(Class clazz) { 35 | return false; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /dynamic-theme/src/main/res/drawable-anydpi-v23/adt_ic_palette.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 28 | 29 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /dynamic-theme/src/main/res/drawable-anydpi-v23/adt_ic_presets.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 24 | 25 | 28 | 29 | 32 | 33 | 36 | 37 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /dynamic-theme/src/main/res/drawable-anydpi-v23/adt_ic_style.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 24 | 25 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /dynamic-theme/src/main/res/drawable-anydpi-v23/adt_ic_theme.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 24 | 25 | 29 | 30 | 34 | 35 | 39 | 40 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /dynamic-theme/src/main/res/drawable-hdpi-v21/adt_ic_palette.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pranavpandey/dynamic-theme/3a838df269e37ce1afb395b152a5b98ecedf9718/dynamic-theme/src/main/res/drawable-hdpi-v21/adt_ic_palette.png -------------------------------------------------------------------------------- /dynamic-theme/src/main/res/drawable-hdpi-v21/adt_ic_style.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pranavpandey/dynamic-theme/3a838df269e37ce1afb395b152a5b98ecedf9718/dynamic-theme/src/main/res/drawable-hdpi-v21/adt_ic_style.png -------------------------------------------------------------------------------- /dynamic-theme/src/main/res/drawable-hdpi-v21/adt_ic_theme.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pranavpandey/dynamic-theme/3a838df269e37ce1afb395b152a5b98ecedf9718/dynamic-theme/src/main/res/drawable-hdpi-v21/adt_ic_theme.png -------------------------------------------------------------------------------- /dynamic-theme/src/main/res/drawable-hdpi/adt_ic_palette.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pranavpandey/dynamic-theme/3a838df269e37ce1afb395b152a5b98ecedf9718/dynamic-theme/src/main/res/drawable-hdpi/adt_ic_palette.png -------------------------------------------------------------------------------- /dynamic-theme/src/main/res/drawable-hdpi/adt_ic_presets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pranavpandey/dynamic-theme/3a838df269e37ce1afb395b152a5b98ecedf9718/dynamic-theme/src/main/res/drawable-hdpi/adt_ic_presets.png -------------------------------------------------------------------------------- /dynamic-theme/src/main/res/drawable-hdpi/adt_ic_style.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pranavpandey/dynamic-theme/3a838df269e37ce1afb395b152a5b98ecedf9718/dynamic-theme/src/main/res/drawable-hdpi/adt_ic_style.png -------------------------------------------------------------------------------- /dynamic-theme/src/main/res/drawable-hdpi/adt_ic_theme.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pranavpandey/dynamic-theme/3a838df269e37ce1afb395b152a5b98ecedf9718/dynamic-theme/src/main/res/drawable-hdpi/adt_ic_theme.png -------------------------------------------------------------------------------- /dynamic-theme/src/main/res/drawable-mdpi-v21/adt_ic_palette.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pranavpandey/dynamic-theme/3a838df269e37ce1afb395b152a5b98ecedf9718/dynamic-theme/src/main/res/drawable-mdpi-v21/adt_ic_palette.png -------------------------------------------------------------------------------- /dynamic-theme/src/main/res/drawable-mdpi-v21/adt_ic_style.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pranavpandey/dynamic-theme/3a838df269e37ce1afb395b152a5b98ecedf9718/dynamic-theme/src/main/res/drawable-mdpi-v21/adt_ic_style.png -------------------------------------------------------------------------------- /dynamic-theme/src/main/res/drawable-mdpi-v21/adt_ic_theme.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pranavpandey/dynamic-theme/3a838df269e37ce1afb395b152a5b98ecedf9718/dynamic-theme/src/main/res/drawable-mdpi-v21/adt_ic_theme.png -------------------------------------------------------------------------------- /dynamic-theme/src/main/res/drawable-mdpi/adt_ic_palette.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pranavpandey/dynamic-theme/3a838df269e37ce1afb395b152a5b98ecedf9718/dynamic-theme/src/main/res/drawable-mdpi/adt_ic_palette.png -------------------------------------------------------------------------------- /dynamic-theme/src/main/res/drawable-mdpi/adt_ic_presets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pranavpandey/dynamic-theme/3a838df269e37ce1afb395b152a5b98ecedf9718/dynamic-theme/src/main/res/drawable-mdpi/adt_ic_presets.png -------------------------------------------------------------------------------- /dynamic-theme/src/main/res/drawable-mdpi/adt_ic_style.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pranavpandey/dynamic-theme/3a838df269e37ce1afb395b152a5b98ecedf9718/dynamic-theme/src/main/res/drawable-mdpi/adt_ic_style.png -------------------------------------------------------------------------------- /dynamic-theme/src/main/res/drawable-mdpi/adt_ic_theme.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pranavpandey/dynamic-theme/3a838df269e37ce1afb395b152a5b98ecedf9718/dynamic-theme/src/main/res/drawable-mdpi/adt_ic_theme.png -------------------------------------------------------------------------------- /dynamic-theme/src/main/res/drawable-xhdpi-v21/adt_ic_palette.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pranavpandey/dynamic-theme/3a838df269e37ce1afb395b152a5b98ecedf9718/dynamic-theme/src/main/res/drawable-xhdpi-v21/adt_ic_palette.png -------------------------------------------------------------------------------- /dynamic-theme/src/main/res/drawable-xhdpi-v21/adt_ic_style.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pranavpandey/dynamic-theme/3a838df269e37ce1afb395b152a5b98ecedf9718/dynamic-theme/src/main/res/drawable-xhdpi-v21/adt_ic_style.png -------------------------------------------------------------------------------- /dynamic-theme/src/main/res/drawable-xhdpi-v21/adt_ic_theme.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pranavpandey/dynamic-theme/3a838df269e37ce1afb395b152a5b98ecedf9718/dynamic-theme/src/main/res/drawable-xhdpi-v21/adt_ic_theme.png -------------------------------------------------------------------------------- /dynamic-theme/src/main/res/drawable-xhdpi/adt_ic_palette.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pranavpandey/dynamic-theme/3a838df269e37ce1afb395b152a5b98ecedf9718/dynamic-theme/src/main/res/drawable-xhdpi/adt_ic_palette.png -------------------------------------------------------------------------------- /dynamic-theme/src/main/res/drawable-xhdpi/adt_ic_presets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pranavpandey/dynamic-theme/3a838df269e37ce1afb395b152a5b98ecedf9718/dynamic-theme/src/main/res/drawable-xhdpi/adt_ic_presets.png -------------------------------------------------------------------------------- /dynamic-theme/src/main/res/drawable-xhdpi/adt_ic_style.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pranavpandey/dynamic-theme/3a838df269e37ce1afb395b152a5b98ecedf9718/dynamic-theme/src/main/res/drawable-xhdpi/adt_ic_style.png -------------------------------------------------------------------------------- /dynamic-theme/src/main/res/drawable-xhdpi/adt_ic_theme.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pranavpandey/dynamic-theme/3a838df269e37ce1afb395b152a5b98ecedf9718/dynamic-theme/src/main/res/drawable-xhdpi/adt_ic_theme.png -------------------------------------------------------------------------------- /dynamic-theme/src/main/res/drawable-xxhdpi-v21/adt_ic_palette.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pranavpandey/dynamic-theme/3a838df269e37ce1afb395b152a5b98ecedf9718/dynamic-theme/src/main/res/drawable-xxhdpi-v21/adt_ic_palette.png -------------------------------------------------------------------------------- /dynamic-theme/src/main/res/drawable-xxhdpi-v21/adt_ic_style.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pranavpandey/dynamic-theme/3a838df269e37ce1afb395b152a5b98ecedf9718/dynamic-theme/src/main/res/drawable-xxhdpi-v21/adt_ic_style.png -------------------------------------------------------------------------------- /dynamic-theme/src/main/res/drawable-xxhdpi-v21/adt_ic_theme.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pranavpandey/dynamic-theme/3a838df269e37ce1afb395b152a5b98ecedf9718/dynamic-theme/src/main/res/drawable-xxhdpi-v21/adt_ic_theme.png -------------------------------------------------------------------------------- /dynamic-theme/src/main/res/drawable-xxhdpi/adt_ic_palette.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pranavpandey/dynamic-theme/3a838df269e37ce1afb395b152a5b98ecedf9718/dynamic-theme/src/main/res/drawable-xxhdpi/adt_ic_palette.png -------------------------------------------------------------------------------- /dynamic-theme/src/main/res/drawable-xxhdpi/adt_ic_presets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pranavpandey/dynamic-theme/3a838df269e37ce1afb395b152a5b98ecedf9718/dynamic-theme/src/main/res/drawable-xxhdpi/adt_ic_presets.png -------------------------------------------------------------------------------- /dynamic-theme/src/main/res/drawable-xxhdpi/adt_ic_style.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pranavpandey/dynamic-theme/3a838df269e37ce1afb395b152a5b98ecedf9718/dynamic-theme/src/main/res/drawable-xxhdpi/adt_ic_style.png -------------------------------------------------------------------------------- /dynamic-theme/src/main/res/drawable-xxhdpi/adt_ic_theme.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pranavpandey/dynamic-theme/3a838df269e37ce1afb395b152a5b98ecedf9718/dynamic-theme/src/main/res/drawable-xxhdpi/adt_ic_theme.png -------------------------------------------------------------------------------- /dynamic-theme/src/main/res/drawable-xxxhdpi-v21/adt_ic_palette.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pranavpandey/dynamic-theme/3a838df269e37ce1afb395b152a5b98ecedf9718/dynamic-theme/src/main/res/drawable-xxxhdpi-v21/adt_ic_palette.png -------------------------------------------------------------------------------- /dynamic-theme/src/main/res/drawable-xxxhdpi-v21/adt_ic_style.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pranavpandey/dynamic-theme/3a838df269e37ce1afb395b152a5b98ecedf9718/dynamic-theme/src/main/res/drawable-xxxhdpi-v21/adt_ic_style.png -------------------------------------------------------------------------------- /dynamic-theme/src/main/res/drawable-xxxhdpi-v21/adt_ic_theme.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pranavpandey/dynamic-theme/3a838df269e37ce1afb395b152a5b98ecedf9718/dynamic-theme/src/main/res/drawable-xxxhdpi-v21/adt_ic_theme.png -------------------------------------------------------------------------------- /dynamic-theme/src/main/res/drawable-xxxhdpi/adt_ic_palette.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pranavpandey/dynamic-theme/3a838df269e37ce1afb395b152a5b98ecedf9718/dynamic-theme/src/main/res/drawable-xxxhdpi/adt_ic_palette.png -------------------------------------------------------------------------------- /dynamic-theme/src/main/res/drawable-xxxhdpi/adt_ic_presets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pranavpandey/dynamic-theme/3a838df269e37ce1afb395b152a5b98ecedf9718/dynamic-theme/src/main/res/drawable-xxxhdpi/adt_ic_presets.png -------------------------------------------------------------------------------- /dynamic-theme/src/main/res/drawable-xxxhdpi/adt_ic_style.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pranavpandey/dynamic-theme/3a838df269e37ce1afb395b152a5b98ecedf9718/dynamic-theme/src/main/res/drawable-xxxhdpi/adt_ic_style.png -------------------------------------------------------------------------------- /dynamic-theme/src/main/res/drawable-xxxhdpi/adt_ic_theme.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pranavpandey/dynamic-theme/3a838df269e37ce1afb395b152a5b98ecedf9718/dynamic-theme/src/main/res/drawable-xxxhdpi/adt_ic_theme.png -------------------------------------------------------------------------------- /dynamic-theme/src/main/res/drawable/adt_ic_app.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 24 | 25 | 29 | 30 | 34 | 35 | 38 | 39 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /dynamic-theme/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | @android:color/black 22 | @android:color/white 23 | #E6FFFFFF 24 | @android:color/white 25 | 26 | 27 | #607D8B 28 | #CE93D8 29 | #E6EE9C 30 | 31 | 32 | #FFFFFF 33 | #000000 34 | 35 | 36 | -------------------------------------------------------------------------------- /dynamic-theme/src/main/res/values/integers.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | 0.1 22 | 0.2 23 | 0.4 24 | 0.6 25 | 0.8 26 | 27 | 28 | 100 29 | 50 30 | 150 31 | 1 32 | 33 | 34 | 2 35 | 0 36 | 28 37 | 8 38 | 16 39 | 28 40 | 2 41 | 42 | 43 | 45 44 | 0 45 | 100 46 | 50 47 | 5 48 | 49 | 50 | 255 51 | 0 52 | 255 53 | 235 54 | 175 55 | 150 56 | 1 57 | 58 | 59 | 480 60 | 16 61 | 2048 62 | 256 63 | 512 64 | 1024 65 | 66 | 67 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx1536m 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app's APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Automatically convert third-party libraries to use AndroidX 19 | android.enableJetifier=true 20 | android.nonTransitiveRClass=false 21 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pranavpandey/dynamic-theme/3a838df269e37ce1afb395b152a5b98ecedf9718/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jan 29 23:01:15 IST 2021 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /graphics/apps/pranavpandey-palettes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pranavpandey/dynamic-theme/3a838df269e37ce1afb395b152a5b98ecedf9718/graphics/apps/pranavpandey-palettes.png -------------------------------------------------------------------------------- /graphics/code.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pranavpandey/dynamic-theme/3a838df269e37ce1afb395b152a5b98ecedf9718/graphics/code.png -------------------------------------------------------------------------------- /graphics/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pranavpandey/dynamic-theme/3a838df269e37ce1afb395b152a5b98ecedf9718/graphics/icon.png -------------------------------------------------------------------------------- /graphics/icon.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pranavpandey/dynamic-theme/3a838df269e37ce1afb395b152a5b98ecedf9718/graphics/icon.psd -------------------------------------------------------------------------------- /graphics/legacy/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pranavpandey/dynamic-theme/3a838df269e37ce1afb395b152a5b98ecedf9718/graphics/legacy/icon.png -------------------------------------------------------------------------------- /graphics/legacy/icon.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pranavpandey/dynamic-theme/3a838df269e37ce1afb395b152a5b98ecedf9718/graphics/legacy/icon.psd -------------------------------------------------------------------------------- /graphics/preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pranavpandey/dynamic-theme/3a838df269e37ce1afb395b152a5b98ecedf9718/graphics/preview.png -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2022 Pranav Pandey 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | include ':dynamic-theme' 18 | --------------------------------------------------------------------------------