├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── feature_request.md │ └── pull_request.md └── workflows │ ├── prepare_mkdocs.sh │ ├── publish_docs.yml │ ├── publish_to_bintray.yml │ └── validate_merge.yml ├── .gitignore ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── build.gradle.kts ├── buildSrc ├── build.gradle.kts └── src │ └── main │ └── java │ └── Constants.kt ├── deploy-bintray.gradle.kts ├── docs └── index.md ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── media ├── emoji.gif ├── lottie.gif ├── sample.gif └── stone.gif ├── mkdocs.yml ├── placeholder-recyclerview ├── .gitignore ├── build.gradle.kts ├── gradle.properties ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── com │ └── github │ └── guilhe │ └── views │ └── PlaceHolderRecyclerView.kt ├── sample ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── github │ │ └── guilhe │ │ └── sample │ │ ├── MainActivity.kt │ │ └── adapters │ │ ├── BaseAdapter.kt │ │ ├── EmojiAdapter.kt │ │ ├── Item.kt │ │ ├── LottieAdapter.kt │ │ ├── MahjongItemAdapter.kt │ │ ├── decorators │ │ └── ItemDecorator.kt │ │ └── placeholders │ │ ├── LottiePlaceHolderAdapter.kt │ │ ├── RotationPlaceHolderAdapter.kt │ │ └── ShimmerPlaceHolderAdapter.kt │ └── res │ ├── anim │ └── anim_rotation.xml │ ├── drawable-v24 │ └── ic_launcher_foreground.xml │ ├── drawable │ └── ic_launcher_background.xml │ ├── layout │ ├── activity_main.xml │ ├── emoji_item.xml │ ├── lottie_item.xml │ ├── mahjong_item.xml │ ├── placeholder_lottie.xml │ ├── placeholder_rotation.xml │ └── placeholder_shimmer.xml │ ├── mipmap-anydpi-v26 │ ├── ic_launcher.xml │ └── ic_launcher_round.xml │ ├── mipmap-hdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-mdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xxhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xxxhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── raw │ └── loading_bear.json │ └── values │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml └── settings.gradle.kts /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | custom: https://www.buymeacoffee.com/GuilhE 2 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: bug 6 | assignees: GuilhE 7 | 8 | --- 9 | 10 | ## Describe the bug 11 | A clear and concise description of what the bug is. 12 | 13 | ## To Reproduce 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | ## Expected behavior 21 | A clear and concise description of what you expected to happen. 22 | 23 | ## Screenshots 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | ## Details (please complete the following information): 27 | - Library version 28 | - Android version 29 | - Emulator/Device specs 30 | - Logs/Crash Reports/Stacktraces 31 | - Example Code/Link to repositories 32 | 33 | ## Additional context 34 | Add any other context about the problem here. -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | ## Is your feature request related to a problem? Please describe 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | ## Describe the solution you'd like 14 | A clear and concise description of what you want to happen. 15 | 16 | ## Describe alternatives you've considered 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | ## Additional context 20 | Add any other context or screenshots about the feature request here. -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/pull_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Pull Request 3 | about: Contribute to this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | ## Description 11 | A few sentences describing the overall goals of the pull request's commits. 12 | 13 | ## Related PRs/Issues 14 | List related PRs and Issues for this Pull Request. 15 | 16 | ## Todos 17 | - [ ] Tests 18 | - [ ] Documentation 19 | - [ ] Screenshots -------------------------------------------------------------------------------- /.github/workflows/prepare_mkdocs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # The website is built using MkDocs with the Material theme. 4 | # https://squidfunk.github.io/mkdocs-material/ 5 | # It requires Python to run. 6 | # Install the packages with the following command: 7 | # pip install mkdocs mkdocs-material 8 | 9 | set -ex 10 | 11 | # Generate the API docs 12 | ./gradlew dokkaDoc 13 | 14 | # Dokka filenames like `-http-url/index.md` don't work well with MkDocs tags. 15 | # Assign metadata to the file's first Markdown heading. 16 | # https://www.mkdocs.org/user-guide/writing-your-docs/#meta-data 17 | title_markdown_file() { 18 | TITLE_PATTERN="s/^[#]+ *(.*)/title: \1 - PlaceHolderRecyclerView/" 19 | echo "---" > "$1.fixed" 20 | cat $1 | sed -E "$TITLE_PATTERN" | grep "title: " | head -n 1 >> "$1.fixed" 21 | echo "---" >> "$1.fixed" 22 | echo >> "$1.fixed" 23 | cat $1 >> "$1.fixed" 24 | mv "$1.fixed" "$1" 25 | } 26 | 27 | set +x 28 | for MARKDOWN_FILE in $(find docs/1.x/ -name '*.md'); do 29 | echo $MARKDOWN_FILE 30 | title_markdown_file $MARKDOWN_FILE 31 | done 32 | set -x 33 | 34 | # Copy in special files that GitHub wants in the project root. 35 | cat README.md | grep -v 'project website' > docs/index.md 36 | cp CHANGELOG.md docs/changelog.md 37 | cp CONTRIBUTING.md docs/contributing.md 38 | cp CODE_OF_CONDUCT.md docs/conduct.md 39 | cp -r media docs/media 40 | -------------------------------------------------------------------------------- /.github/workflows/publish_docs.yml: -------------------------------------------------------------------------------- 1 | name: Publish docs via GitHub Pages 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | paths: 8 | - "README.md" 9 | - "CHANGELOG.md" 10 | - "mkdocs.yml" 11 | - ".github/workflows/publish_docs.yml" 12 | - ".github/workflows/prepare_mkdocs.sh" 13 | 14 | jobs: 15 | deploy: 16 | name: Generate API docs and deploy docs 17 | runs-on: ubuntu-latest 18 | steps: 19 | - name: Checkout Repo 20 | uses: actions/checkout@v2 21 | 22 | - name: Cache Gradle 23 | uses: actions/cache@v2 24 | with: 25 | path: ~/.gradle/caches 26 | key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} 27 | restore-keys: ${{ runner.os }}-gradle- 28 | 29 | - name: Prepare Docs 30 | run: sudo bash .github/workflows/prepare_mkdocs.sh 31 | 32 | - name: Deploy docs 33 | uses: mhausenblas/mkdocs-deploy-gh-pages@master 34 | env: 35 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 36 | -------------------------------------------------------------------------------- /.github/workflows/publish_to_bintray.yml: -------------------------------------------------------------------------------- 1 | name: Publish to Bintray 2 | on: 3 | release: 4 | types: [published] 5 | 6 | jobs: 7 | publish: 8 | runs-on: ubuntu-latest 9 | 10 | steps: 11 | - uses: actions/checkout@v1 12 | 13 | - name: Set up JDK 1.8 14 | uses: actions/setup-java@v1 15 | with: 16 | java-version: 1.8 17 | 18 | - name: Grant Permission to Execute 19 | run: chmod +x gradlew 20 | 21 | - name: Assembling Library 22 | run: ./gradlew assembleRelease 23 | 24 | - name: Uploading to Bintray 25 | env: 26 | bintrayUser: ${{ secrets.BINTRAY_USER }} 27 | bintrayApiKey: ${{ secrets.BINTRAY_API_KEY }} 28 | mavenUser: ${{ secrets.MAVEN_USER }} 29 | mavenToken: ${{ secrets.MAVEN_TOKEN }} 30 | run: ./gradlew bintrayUpload 31 | -------------------------------------------------------------------------------- /.github/workflows/validate_merge.yml: -------------------------------------------------------------------------------- 1 | name: Pre Merge Checks 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | paths: 8 | - "sample/**" 9 | - "buildSrc/**" 10 | - "gradle/**" 11 | - "placeholder-recyclerview/**" 12 | pull_request: 13 | branches: 14 | - '*' 15 | 16 | jobs: 17 | gradle: 18 | strategy: 19 | matrix: 20 | os: [ubuntu-latest, macos-latest, windows-latest] 21 | runs-on: ${{ matrix.os }} 22 | if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }} 23 | steps: 24 | - name: Checkout Repo 25 | uses: actions/checkout@v2 26 | 27 | - name: Validate Gradle Wrapper 28 | uses: gradle/wrapper-validation-action@v1 29 | 30 | - name: Cache Gradle Caches 31 | uses: actions/cache@v2 32 | with: 33 | path: ~/.gradle/caches/ 34 | key: cache-gradle-cache 35 | 36 | - name: Cache Gradle Wrapper 37 | uses: actions/cache@v2 38 | with: 39 | path: ~/.gradle/wrapper/ 40 | key: cache-gradle-wrapper 41 | 42 | - name: Run Gradle tasks 43 | run: ./gradlew build check publishToMavenLocal --continue 44 | 45 | - name: Stop Gradle 46 | run: ./gradlew --stop 47 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.gitignore.io/api/java,android,osx,intellij,gradle 3 | 4 | ### Android ### 5 | # Built application files 6 | *.apk 7 | *.ap_ 8 | 9 | # Files for the ART/Dalvik VM 10 | *.dex 11 | 12 | # Java class files 13 | *.class 14 | 15 | # Generated files 16 | bin/ 17 | gen/ 18 | out/ 19 | 20 | # Gradle files 21 | .gradle/ 22 | build/ 23 | 24 | # Local configuration file (sdk path, etc) 25 | local.properties 26 | 27 | # Proguard folder generated by Eclipse 28 | proguard/ 29 | 30 | # Log Files 31 | *.log 32 | 33 | # Android Studio Navigation editor temp files 34 | .navigation/ 35 | 36 | # Android Studio captures folder 37 | captures/ 38 | 39 | # Intellij 40 | *.iml 41 | .idea/ 42 | 43 | # Keystore files 44 | #*.jks 45 | 46 | # External native build folder generated in Android Studio 2.2 and later 47 | .externalNativeBuild 48 | 49 | # Google Services (e.g. APIs or Firebase) 50 | #google-services.json 51 | 52 | # Freeline 53 | freeline.py 54 | freeline/ 55 | freeline_project_description.json 56 | 57 | ### Android Patch ### 58 | gen-external-apklibs 59 | 60 | ### Intellij ### 61 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm 62 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 63 | 64 | # User-specific stuff: 65 | .idea/**/workspace.xml 66 | .idea/**/tasks.xml 67 | 68 | # Sensitive or high-churn files: 69 | .idea/**/dataSources/ 70 | .idea/**/dataSources.ids 71 | .idea/**/dataSources.xml 72 | .idea/**/dataSources.local.xml 73 | .idea/**/sqlDataSources.xml 74 | .idea/**/dynamic.xml 75 | .idea/**/uiDesigner.xml 76 | 77 | # Gradle: 78 | .idea/**/gradle.xml 79 | .idea/**/libraries 80 | 81 | # Mongo Explorer plugin: 82 | .idea/**/mongoSettings.xml 83 | 84 | ## File-based project format: 85 | *.iws 86 | 87 | ## Plugin-specific files: 88 | 89 | # IntelliJ 90 | /out/ 91 | 92 | # mpeltonen/sbt-idea plugin 93 | .idea_modules/ 94 | 95 | # JIRA plugin 96 | atlassian-ide-plugin.xml 97 | 98 | # Crashlytics plugin (for Android Studio and IntelliJ) 99 | com_crashlytics_export_strings.xml 100 | crashlytics.properties 101 | crashlytics-build.properties 102 | fabric.properties 103 | 104 | ### Intellij Patch ### 105 | # Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 106 | 107 | # *.iml 108 | # modules.xml 109 | # .idea/misc.xml 110 | # *.ipr 111 | 112 | ### Java ### 113 | # Compiled class file 114 | 115 | # Log file 116 | 117 | # BlueJ files 118 | *.ctxt 119 | 120 | # Mobile Tools for Java (J2ME) 121 | .mtj.tmp/ 122 | 123 | # Package Files # 124 | *.jar 125 | *.war 126 | *.ear 127 | *.zip 128 | *.tar.gz 129 | *.rar 130 | 131 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 132 | hs_err_pid* 133 | 134 | ### OSX ### 135 | *.DS_Store 136 | .AppleDouble 137 | .LSOverride 138 | 139 | # Icon must end with two \r 140 | Icon 141 | 142 | 143 | # Thumbnails 144 | ._* 145 | 146 | # Files that might appear in the root of a volume 147 | .DocumentRevisions-V100 148 | .fseventsd 149 | .Spotlight-V100 150 | .TemporaryItems 151 | .Trashes 152 | .VolumeIcon.icns 153 | .com.apple.timemachine.donotpresent 154 | 155 | # Directories potentially created on remote AFP share 156 | .AppleDB 157 | .AppleDesktop 158 | Network Trash Folder 159 | Temporary Items 160 | .apdisk 161 | 162 | ### Gradle ### 163 | .gradle 164 | /build/ 165 | 166 | # Ignore Gradle GUI config 167 | gradle-app.setting 168 | 169 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) 170 | !gradle-wrapper.jar 171 | 172 | # Cache of project 173 | .gradletasknamecache 174 | 175 | # # Work around https://youtrack.jetbrains.com/issue/IDEA-116898 176 | # gradle/wrapper/gradle-wrapper.properties 177 | 178 | # End of https://www.gitignore.io/api/java,android,osx,intellij,gradle 179 | /app/build/ 180 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## [1.1.0] 4 | 5 | - Added `var holdersItemDecoration` to configure placeholders item decoration when needed. 6 | - Renamed package from ...__view__.PlaceHolderRecyclerView to ...__views__.PlaceHolderRecyclerView 7 | 8 | --- 9 | 10 | ## [1.0.1] 11 | 12 | - Added check for current adapter before changing it. 13 | This is important in pagination situations where we could call `toggleHoldersAdapter(false)` thus making the list refresh and lose its scroll position. 14 | 15 | --- 16 | 17 | ## [1.0.0] 18 | 19 | First version released 20 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at . All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq 77 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | In an effort to keep the library small and stable, please keep contributions limited to bug fixes, documentation improvements, and test improvements. 4 | 5 | If you have a new feature idea, please [create an enhancement request](https://github.com/GuilhE/PlaceHolderRecyclerView/issues/new?assignees=&labels=enhancement&template=feature_request.md&title=) so it can be discussed or build it in an external library. 6 | 7 | If you’ve found a bug, please [create a bug report](https://github.com/GuilhE/PlaceHolderRecyclerView/issues/new?assignees=GuilhE&labels=bug&template=bug_report.md&title=) and contribute with a failing test case so we can study and fix it. 8 | 9 | If you would like to contribute code you can do so through GitHub by forking the repository and sending a pull request. 10 | 11 | When submitting code, please make every effort to follow existing conventions and style in order to keep the code as readable as possible. 12 | 13 | *Modified from OkHttp's [Contributing](https://square.github.io/okhttp/contributing/) section.* 14 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PlaceHolderRecyclerView 2 | [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-PlaceHolderRecyclerView-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/8193) 3 | 4 | <img src="media/stone.gif" /> <img src="media/lottie.gif" /> <img src="media/emoji.gif" /> 5 | 6 | A RecyclerView that can switch between items and placeholders. 7 | This libs doesn't force a placehoder type, the developer is responsible for creating one, checkout the sample module and see how simple it is. 8 | 9 | You can use the best beloved [Shimmer-Android](http://facebook.github.io/shimmer-android/), a [Lottie](https://airbnb.design/lottie/) animation or even [Property Animation](https://developer.android.com/guide/topics/resources/animation-resource). Use your imagination, it's your placeholder 😊 10 | 11 | # Installation 12 | 13 | PlaceHolderRecyclerView is distributed through [Maven Central](https://search.maven.org/artifact/com.github.guilhe/placeholder-recyclerview) and [Jitpack](https://jitpack.io/#GuilhE/PlaceHolderRecyclerView). 14 | 15 | ```groovy 16 | implementation 'com.github.guilhe:placeholder-recyclerview:${LATEST_VERSION}' 17 | ``` 18 | [![Maven Central](https://img.shields.io/maven-central/v/com.github.guilhe/placeholder-recyclerview.svg)](https://search.maven.org/search?q=g:com.github.guilhe%20AND%20placeholder-recyclerview) 19 | 20 | ## Usage 21 | 22 | ```xml 23 | <com.github.guilhe.views.PlaceHolderRecyclerView 24 | android:id="@+id/my_RecyclerView" 25 | android:layout_width="match_parent" 26 | android:layout_height="match_parent" /> 27 | ``` 28 | ```kotlin 29 | class MyItemsPlaceHolderAdapter : ..., PlaceHolderAdapter { ... } 30 | 31 | private val itemsAdapter = MyItemsAdapter() 32 | ... 33 | with(binding.myRecyclerView) { 34 | adapter = itemsAdapter 35 | holdersAdapter = MyItemsPlaceHolderAdapter() 36 | holdersItemDecoration = MyItemsDecoration() //if needed 37 | } 38 | ... 39 | viewModel.items.observe(this, { itemsAdapter.update(it) }) 40 | viewModel.isLoading.observe(this, { isLoading -> binding.myRecyclerView.toggleHoldersAdapter(isLoading) }) 41 | ``` 42 | 43 | <img src="media/sample.gif" /> 44 | 45 | Don't recognise those chinese characters? They're from an awesome game called [Mahjong](https://en.wikipedia.org/wiki/Mahjong) 46 | Lottie animation by [puput Santoso](https://lottiefiles.com/puput_santoso) 47 | 48 | 49 | ## Dependencies 50 | - [androidx.recyclerview:recyclerview](https://developer.android.com/jetpack/androidx/releases/recyclerview) 51 | 52 | ## Bugs and Feedback 53 | 54 | For bugs, questions and discussions please use the [Github Issues](https://github.com/GuilhE/PlaceHolderRecyclerView/issues). 55 | 56 | ## LICENSE 57 | 58 | Copyright (c) 2020-present GuilhE 59 | 60 | Licensed under the Apache License, Version 2.0 (the "License"); 61 | you may not use this file except in compliance with the License. 62 | You may obtain a copy of the License at 63 | 64 | <http://www.apache.org/licenses/LICENSE-2.0> 65 | 66 | Unless required by applicable law or agreed to in writing, software 67 | distributed under the License is distributed on an "AS IS" BASIS, 68 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 69 | See the License for the specific language governing permissions and 70 | limitations under the License. 71 | -------------------------------------------------------------------------------- /build.gradle.kts: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | google() 4 | jcenter() 5 | } 6 | 7 | dependencies { 8 | classpath(Libs.com_android_tools_build_gradle) 9 | classpath(Libs.org_jetbrains_kotlin_kotlin_gradle_plugin) 10 | classpath(Libs.com_jfrog_bintray_gradle_bintray_plugin) 11 | classpath(Libs.dokka_gradle_plugin) 12 | } 13 | } 14 | 15 | plugins { 16 | mavenPublish 17 | dokka 18 | } 19 | 20 | allprojects { 21 | repositories { 22 | google() 23 | jcenter() 24 | maven(url = "https://jitpack.io") 25 | } 26 | } 27 | 28 | task<Delete>("clean") { 29 | delete(rootProject.buildDir) 30 | } 31 | 32 | tasks.withType<Javadoc> { 33 | options { 34 | this as StandardJavadocDocletOptions 35 | addStringOption("Xdoclint:none", "-quiet") 36 | addStringOption("encoding", "UTF-8") 37 | } 38 | } 39 | 40 | //For Groovy build.gradle files 41 | project.extra.apply { 42 | set("minSdkVersion", AndroidConstants.minSdkVersion) 43 | set("targetSdkVersion", AndroidConstants.targetSdkVersion) 44 | set("compileSdkVersion", AndroidConstants.compileSdkVersions) 45 | set("buildToolsVersion", AndroidConstants.buildToolsVersion) 46 | } -------------------------------------------------------------------------------- /buildSrc/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | `kotlin-dsl` 3 | } 4 | repositories { 5 | mavenCentral() 6 | } -------------------------------------------------------------------------------- /buildSrc/src/main/java/Constants.kt: -------------------------------------------------------------------------------- 1 | import org.gradle.plugin.use.PluginDependenciesSpec 2 | import org.gradle.plugin.use.PluginDependencySpec 3 | 4 | object AndroidConstants { 5 | const val minSdkVersion = 23 6 | const val targetSdkVersion = 30 7 | const val compileSdkVersions = 30 8 | const val buildToolsVersion = "30.0.2" 9 | } 10 | 11 | object Versions { 12 | const val build_gradle_version = "4.1.0-alpha02" 13 | const val kotlin_gradle_plugin_version = "1.4.0" 14 | const val bintray_plugin_version = "1.8.5" 15 | 16 | const val bintray_version = "1.8.5" 17 | const val dokka_version = "1.4.0" 18 | 19 | const val kotlin_stdlib_version = "1.4.10" 20 | const val recyclerview_version = "1.1.0" 21 | } 22 | 23 | object Libs { 24 | const val com_jfrog_bintray = "com.jfrog.bintray.gradle" 25 | const val maven_publish = "maven-publish" 26 | const val org_jetbrains_dokka = "org.jetbrains.dokka" 27 | 28 | const val com_android_tools_build_gradle = "com.android.tools.build:gradle:${Versions.build_gradle_version}" 29 | const val org_jetbrains_kotlin_kotlin_gradle_plugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.kotlin_gradle_plugin_version}" 30 | const val com_jfrog_bintray_gradle_bintray_plugin = com_jfrog_bintray + ":gradle-bintray-plugin:${Versions.bintray_plugin_version}" 31 | const val dokka_gradle_plugin = org_jetbrains_dokka + ":dokka-gradle-plugin:${Versions.dokka_version}" 32 | 33 | const val kotlin = "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${Versions.kotlin_stdlib_version}" 34 | const val recyclerview = "androidx.recyclerview:recyclerview:${Versions.recyclerview_version}" 35 | } 36 | 37 | val PluginDependenciesSpec.mavenPublish: PluginDependencySpec 38 | inline get() = id(Libs.maven_publish) 39 | 40 | val PluginDependenciesSpec.dokka: PluginDependencySpec 41 | inline get() = id(Libs.org_jetbrains_dokka).version(Versions.dokka_version) 42 | 43 | val PluginDependenciesSpec.bintray: PluginDependencySpec 44 | inline get() = id(Libs.com_jfrog_bintray).version(Versions.bintray_version) -------------------------------------------------------------------------------- /deploy-bintray.gradle.kts: -------------------------------------------------------------------------------- 1 | import com.jfrog.bintray.gradle.BintrayExtension 2 | import com.jfrog.bintray.gradle.BintrayPlugin 3 | import java.io.FileInputStream 4 | import java.util.* 5 | 6 | buildscript { 7 | repositories { 8 | jcenter() 9 | } 10 | 11 | dependencies { 12 | classpath(Libs.com_jfrog_bintray_gradle_bintray_plugin) 13 | } 14 | } 15 | 16 | apply(plugin = Libs.maven_publish) 17 | plugins.apply(BintrayPlugin::class.java) //https://github.com/bintray/gradle-bintray-plugin/issues/301 18 | 19 | val bintrayRepo = properties["bintrayRepo"].toString() 20 | val libraryVersion = properties["libraryVersion"].toString() 21 | val libraryDescription = properties["libraryDescription"].toString() 22 | val siteUrl = properties["siteUrl"].toString() 23 | val gitUrl = properties["gitUrl"].toString() 24 | 25 | configure<BintrayExtension> { 26 | val bintrayName = properties["bintrayName"].toString() 27 | val mavenUser: String 28 | val mavenToken: String 29 | 30 | if (project.rootProject.file("local.properties").exists()) { 31 | val fis = FileInputStream(project.rootProject.file("local.properties")) 32 | val prop = Properties() 33 | prop.load(fis) 34 | user = prop.getProperty("bintray.user", "") 35 | key = prop.getProperty("bintray.apiKey", "") 36 | mavenUser = prop.getProperty("maven.user", "") 37 | mavenToken = prop.getProperty("maven.token", "") 38 | } else { 39 | user = System.getenv("bintrayUser") 40 | key = System.getenv("bintrayApiKey") 41 | mavenUser = System.getenv("mavenUser") ?: "" 42 | mavenToken = System.getenv("mavenToken") ?: "" 43 | } 44 | 45 | setPublications(bintrayRepo) 46 | override = true 47 | 48 | pkg.apply { 49 | repo = bintrayRepo 50 | name = bintrayName 51 | description = libraryDescription 52 | websiteUrl = siteUrl 53 | issueTrackerUrl = "$siteUrl/issues" 54 | vcsUrl = gitUrl 55 | setLicenses("Apache-2.0") 56 | publish = true 57 | publicDownloadNumbers = true 58 | version.apply { 59 | name = libraryVersion 60 | vcsTag = libraryVersion 61 | desc = libraryDescription 62 | released = Date().toString() 63 | if (mavenToken.isNotEmpty()) 64 | mavenCentralSync.apply { 65 | sync = true 66 | user = mavenUser 67 | password = mavenToken 68 | } 69 | } 70 | } 71 | } 72 | 73 | configure<PublishingExtension> { 74 | val artifact = properties["artifact"].toString() 75 | val publishedGroupId = properties["publishedGroupId"].toString() 76 | val libraryName = properties["libraryName"].toString() 77 | val developerId = properties["developerId"].toString() 78 | val developerName = properties["developerName"].toString() 79 | val developerEmail = properties["developerEmail"].toString() 80 | 81 | publications { 82 | create<MavenPublication>(bintrayRepo) { 83 | groupId = publishedGroupId 84 | artifactId = artifact 85 | version = libraryVersion 86 | 87 | artifact(tasks.getByName("sourcesJar")) 88 | artifact(tasks.getByName("dokkaJar")) 89 | artifact("$buildDir/outputs/aar/${artifactId}-release.aar") { 90 | builtBy(tasks.getByName("assemble")) 91 | } 92 | 93 | pom { 94 | packaging = "aar" 95 | name.set(libraryName) 96 | description.set(libraryDescription) 97 | url.set(siteUrl) 98 | scm { 99 | connection.set(gitUrl) 100 | developerConnection.set(connection.get()) 101 | url.set(siteUrl) 102 | } 103 | issueManagement { url.set("$siteUrl/issues") } 104 | licenses { 105 | license { 106 | name.set("The Apache Software License, Version 2.0") 107 | url.set("http://www.apache.org/licenses/LICENSE-2.0.txt") 108 | } 109 | } 110 | developers { 111 | developer { 112 | id.set(developerId) 113 | name.set(developerName) 114 | email.set(developerEmail) 115 | } 116 | } 117 | withXml { 118 | val dependenciesNode = asNode().appendNode("dependencies") 119 | configurations.getByName("implementation") { 120 | dependencies.forEach { 121 | val 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 | } -------------------------------------------------------------------------------- /docs/index.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /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 | # Kotlin code style for this project: "official" or "obsolete": 21 | kotlin.code.style=official 22 | 23 | publishedGroupId = com.github.guilhe 24 | bintrayRepo = android 25 | libraryName = PlaceHolderRecyclerView 26 | libraryDescription = A RecyclerView that can switch between items and placeholders 27 | 28 | siteUrl = https://guilhe.github.io/PlaceHolderRecyclerView/ 29 | gitUrl = https://github.com/GuilhE/PlaceHolderRecyclerView.git 30 | 31 | developerId = GuilhE 32 | developerName = Guilherme Delgado 33 | developerEmail = gdelgado@bliss.pt -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GuilhE/PlaceHolderRecyclerView/5b5b8ee3422fd62a7b0ecf08f4e763ad471af10d/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Sep 15 12:49:20 WEST 2020 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-6.2.1-all.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 | -------------------------------------------------------------------------------- /media/emoji.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GuilhE/PlaceHolderRecyclerView/5b5b8ee3422fd62a7b0ecf08f4e763ad471af10d/media/emoji.gif -------------------------------------------------------------------------------- /media/lottie.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GuilhE/PlaceHolderRecyclerView/5b5b8ee3422fd62a7b0ecf08f4e763ad471af10d/media/lottie.gif -------------------------------------------------------------------------------- /media/sample.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GuilhE/PlaceHolderRecyclerView/5b5b8ee3422fd62a7b0ecf08f4e763ad471af10d/media/sample.gif -------------------------------------------------------------------------------- /media/stone.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GuilhE/PlaceHolderRecyclerView/5b5b8ee3422fd62a7b0ecf08f4e763ad471af10d/media/stone.gif -------------------------------------------------------------------------------- /mkdocs.yml: -------------------------------------------------------------------------------- 1 | site_name: PlaceHolderRecyclerView 2 | repo_name: GuilhE/PlaceHolderRecyclerView 3 | repo_url: https://github.com/GuilhE/PlaceHolderRecyclerView 4 | site_author: GuilhE 5 | copyright: 'Copyright (c) 2020-present GuilhE' 6 | remote_branch: gh-pages 7 | 8 | theme: 9 | name: material 10 | palette: 11 | primary: 'white' 12 | accent: 'red' 13 | font: 14 | text: Open Sans 15 | code: Roboto Mono 16 | 17 | extra: 18 | manifest: manifest.webmanifest 19 | 20 | nav: 21 | - "Overview": index.md 22 | - "Changelog": changelog.md 23 | - "Contributing": contributing.md 24 | - "Code of Conduct": conduct.md 25 | 26 | markdown_extensions: 27 | - admonition 28 | - smarty 29 | - codehilite: 30 | guess_lang: false 31 | - footnotes 32 | - meta 33 | - toc: 34 | permalink: true 35 | - pymdownx.betterem: 36 | smart_enable: all 37 | - pymdownx.caret 38 | - pymdownx.inlinehilite 39 | - pymdownx.magiclink 40 | - pymdownx.smartsymbols 41 | - pymdownx.tabbed 42 | - pymdownx.superfences: 43 | custom_fences: 44 | - name: mermaid 45 | class: mermaid 46 | format: !!python/name:pymdownx.superfences.fence_div_format 47 | - tables 48 | 49 | plugins: 50 | - search -------------------------------------------------------------------------------- /placeholder-recyclerview/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /placeholder-recyclerview/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("com.android.library") 3 | kotlin("android") 4 | } 5 | 6 | android { 7 | compileSdkVersion(AndroidConstants.compileSdkVersions) 8 | 9 | defaultConfig { 10 | minSdkVersion(AndroidConstants.minSdkVersion) 11 | targetSdkVersion(AndroidConstants.targetSdkVersion) 12 | } 13 | 14 | compileOptions { 15 | sourceCompatibility = JavaVersion.VERSION_1_8 16 | targetCompatibility = JavaVersion.VERSION_1_8 17 | } 18 | } 19 | 20 | dependencies { 21 | implementation(Libs.recyclerview) 22 | } 23 | 24 | val sourcesJar by tasks.registering(Jar::class) { 25 | archiveClassifier.set("sources") 26 | from(android.sourceSets.getByName("main").java.srcDirs) 27 | } 28 | val dokkaDoc by tasks.registering(org.jetbrains.dokka.gradle.DokkaTask::class) { 29 | outputDirectory.set(buildDir.resolve("javadoc")) 30 | dokkaSourceSets { 31 | named("main") { 32 | noAndroidSdkLink.set(false) 33 | } 34 | } 35 | } 36 | val dokkaJar by tasks.registering(Jar::class) { 37 | group = JavaBasePlugin.DOCUMENTATION_GROUP 38 | description = "Assembles Kotlin docs with Dokka" 39 | archiveClassifier.set("javadoc") 40 | from(dokkaDoc) 41 | } 42 | apply(from = rootProject.file("deploy-bintray.gradle.kts")) -------------------------------------------------------------------------------- /placeholder-recyclerview/gradle.properties: -------------------------------------------------------------------------------- 1 | artifact = placeholder-recyclerview 2 | bintrayName = PlaceHolderRecyclerView 3 | libraryVersion = 1.1.0 -------------------------------------------------------------------------------- /placeholder-recyclerview/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /placeholder-recyclerview/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | <manifest package="com.github.guilhe.views.placeholderrecyclerview" /> -------------------------------------------------------------------------------- /placeholder-recyclerview/src/main/java/com/github/guilhe/views/PlaceHolderRecyclerView.kt: -------------------------------------------------------------------------------- 1 | package com.github.guilhe.views 2 | 3 | import android.content.Context 4 | import android.util.AttributeSet 5 | import androidx.recyclerview.widget.RecyclerView 6 | 7 | @Suppress("UNCHECKED_CAST", "MemberVisibilityCanBePrivate", "unused") 8 | class PlaceHolderRecyclerView @JvmOverloads constructor( 9 | context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 10 | ) : RecyclerView(context, attrs, defStyleAttr) { 11 | 12 | private lateinit var itemAdapter: Adapter<ViewHolder> 13 | lateinit var holdersAdapter: PlaceHolderAdapter 14 | var holdersItemDecoration: ItemDecoration? = null 15 | 16 | override fun setAdapter(adapter: Adapter<*>?) { 17 | super.setAdapter(adapter) 18 | if (adapter !is PlaceHolderAdapter) { 19 | itemAdapter = adapter as Adapter<ViewHolder> 20 | } 21 | } 22 | 23 | fun toggleHoldersAdapter(show: Boolean) { 24 | if (::holdersAdapter.isInitialized) { 25 | holdersItemDecoration?.let { if (show) addItemDecoration(it) else removeItemDecoration(it) } 26 | val temp = if (show) holdersAdapter as Adapter<ViewHolder> else itemAdapter 27 | if (temp != adapter) { 28 | adapter = temp 29 | } 30 | } 31 | } 32 | 33 | fun isHoldersAdapterVisible() = ::holdersAdapter.isInitialized && adapter == holdersAdapter 34 | } 35 | 36 | interface PlaceHolderAdapter -------------------------------------------------------------------------------- /sample/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /sample/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'kotlin-android' 3 | apply plugin: 'kotlin-android-extensions' 4 | apply plugin: 'kotlin-kapt' 5 | 6 | android { 7 | compileSdkVersion rootProject.ext.compileSdkVersion 8 | buildToolsVersion rootProject.ext.buildToolsVersion 9 | 10 | defaultConfig { 11 | applicationId "com.github.guilhe.placeholderrecyclerview.sample" 12 | minSdkVersion rootProject.ext.minSdkVersion 13 | targetSdkVersion rootProject.ext.targetSdkVersion 14 | versionCode 1 15 | versionName "1.0.0" 16 | } 17 | 18 | android.buildFeatures.dataBinding = true 19 | 20 | buildTypes { 21 | release { 22 | minifyEnabled false 23 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 24 | } 25 | } 26 | 27 | android { 28 | lintOptions { 29 | abortOnError false 30 | } 31 | } 32 | } 33 | 34 | dependencies { 35 | implementation project(':placeholder-recyclerview') 36 | 37 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.0" 38 | implementation 'com.google.android.material:material:1.2.1' 39 | implementation 'androidx.appcompat:appcompat:1.2.0' 40 | implementation 'androidx.constraintlayout:constraintlayout:2.0.2' 41 | implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.0-beta01' 42 | 43 | implementation 'com.facebook.shimmer:shimmer:0.5.0' 44 | implementation 'com.airbnb.android:lottie:3.4.0' 45 | } -------------------------------------------------------------------------------- /sample/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /sample/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <manifest xmlns:android="http://schemas.android.com/apk/res/android" 3 | package="com.github.guilhe.views.sample"> 4 | 5 | <application 6 | android:allowBackup="true" 7 | android:icon="@mipmap/ic_launcher" 8 | android:label="@string/app_name" 9 | android:roundIcon="@mipmap/ic_launcher_round" 10 | android:supportsRtl="true" 11 | android:theme="@style/AppTheme"> 12 | <activity android:name="com.github.guilhe.sample.MainActivity"> 13 | <intent-filter> 14 | <action android:name="android.intent.action.MAIN" /> 15 | 16 | <category android:name="android.intent.category.LAUNCHER" /> 17 | </intent-filter> 18 | </activity> 19 | </application> 20 | 21 | </manifest> -------------------------------------------------------------------------------- /sample/src/main/java/com/github/guilhe/sample/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.github.guilhe.sample 2 | 3 | import android.content.res.Resources 4 | import android.os.Bundle 5 | import android.view.ViewGroup 6 | import androidx.appcompat.app.AppCompatActivity 7 | import androidx.databinding.DataBindingUtil 8 | import androidx.lifecycle.lifecycleScope 9 | import androidx.recyclerview.widget.GridLayoutManager 10 | import androidx.transition.TransitionManager 11 | import com.github.guilhe.sample.adapters.* 12 | import com.github.guilhe.sample.adapters.decorators.MarginItemDecoration 13 | import com.github.guilhe.sample.adapters.placeholders.* 14 | import com.github.guilhe.views.sample.R 15 | import com.github.guilhe.views.sample.databinding.ActivityMainBinding 16 | import kotlinx.coroutines.delay 17 | import kotlinx.coroutines.launch 18 | import kotlin.math.ceil 19 | 20 | class MainActivity : AppCompatActivity() { 21 | 22 | private lateinit var binding: ActivityMainBinding 23 | private var loading = false 24 | 25 | override fun onCreate(savedInstanceState: Bundle?) { 26 | super.onCreate(savedInstanceState) 27 | binding = DataBindingUtil.setContentView(this, R.layout.activity_main) 28 | 29 | with(binding.mahjongPlaceHolderRecyclerView) { 30 | adapter = MahjongItemAdapter() 31 | holdersAdapter = ShimmerPlaceHolderAdapter() 32 | layoutManager = GridLayoutManager(context, 4) 33 | addItemDecoration(MarginItemDecoration(10.dpToPx())) 34 | } 35 | 36 | with(binding.lottiePlaceHolderRecyclerView) { 37 | adapter = LottieAdapter() 38 | holdersAdapter = LottiePlaceHolderAdapter() 39 | addItemDecoration(MarginItemDecoration(15.dpToPx())) 40 | } 41 | 42 | with(binding.emojiPlaceHolderRecyclerView) { 43 | adapter = EmojiAdapter(Item("🥴")) 44 | holdersAdapter = RotationPlaceHolderAdapter() 45 | addItemDecoration(MarginItemDecoration(15.dpToPx())) 46 | } 47 | 48 | binding.loadMaterialButton.setOnClickListener { 49 | if (!loading) { 50 | loading = true 51 | lifecycleScope.launch { 52 | toggle(true) 53 | delay(2500) 54 | toggle(false) 55 | loading = false 56 | } 57 | } 58 | } 59 | 60 | lifecycleScope.launchWhenResumed { binding.loadMaterialButton.performClick() } 61 | } 62 | 63 | private fun toggle(show: Boolean) { 64 | if (::binding.isInitialized) { 65 | if (!show) { 66 | TransitionManager.beginDelayedTransition(binding.root as ViewGroup) 67 | } 68 | binding.mahjongPlaceHolderRecyclerView.toggleHoldersAdapter(show) 69 | binding.lottiePlaceHolderRecyclerView.toggleHoldersAdapter(show) 70 | with(binding.emojiPlaceHolderRecyclerView) { 71 | toggleHoldersAdapter(show) 72 | if (!(isHoldersAdapterVisible() || show)) { 73 | (adapter as EmojiAdapter).reset() 74 | } 75 | } 76 | } 77 | } 78 | } 79 | 80 | fun Int.dpToPx(): Int = ceil((this * Resources.getSystem().displayMetrics.density).toDouble()).toInt() -------------------------------------------------------------------------------- /sample/src/main/java/com/github/guilhe/sample/adapters/BaseAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.github.guilhe.sample.adapters 2 | 3 | import androidx.databinding.ViewDataBinding 4 | import androidx.recyclerview.widget.RecyclerView 5 | 6 | abstract class BaseAdapter<T, ViewBinding : ViewDataBinding> : RecyclerView.Adapter<BaseViewHolder<ViewBinding>>() { 7 | 8 | protected var items = mutableListOf<T>() 9 | 10 | override fun getItemCount() = items.size 11 | 12 | protected fun getItem(position: Int): T? { 13 | if (items.isNotEmpty()) { 14 | return items[position] 15 | } 16 | return null 17 | } 18 | } 19 | 20 | abstract class BaseViewHolder<ViewBinding : ViewDataBinding>(val binding: ViewBinding) : RecyclerView.ViewHolder(binding.root) -------------------------------------------------------------------------------- /sample/src/main/java/com/github/guilhe/sample/adapters/EmojiAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.github.guilhe.sample.adapters 2 | 3 | import android.view.LayoutInflater 4 | import android.view.ViewGroup 5 | import com.github.guilhe.views.sample.databinding.EmojiItemBinding 6 | 7 | class EmojiAdapter(private val default: Item) : BaseAdapter<Item, EmojiItemBinding>() { 8 | 9 | init { 10 | setup() 11 | } 12 | 13 | private fun setup() { 14 | items.clear() 15 | for (i in 1..10) { 16 | items.add(Item(default.status)) 17 | } 18 | } 19 | 20 | fun reset() { 21 | setup() 22 | notifyDataSetChanged() 23 | } 24 | 25 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BaseViewHolder<EmojiItemBinding> = 26 | ItemViewHolder(EmojiItemBinding.inflate(LayoutInflater.from(parent.context), parent, false)) 27 | 28 | override fun onBindViewHolder(holder: BaseViewHolder<EmojiItemBinding>, position: Int) { 29 | getItem(position)?.let { 30 | holder.binding.item = it 31 | holder.binding.root.setOnClickListener { _ -> 32 | it.changeStatus() 33 | notifyItemChanged(holder.adapterPosition) 34 | } 35 | } 36 | } 37 | 38 | private class ItemViewHolder(binding: EmojiItemBinding) : BaseViewHolder<EmojiItemBinding>(binding) 39 | } -------------------------------------------------------------------------------- /sample/src/main/java/com/github/guilhe/sample/adapters/Item.kt: -------------------------------------------------------------------------------- 1 | package com.github.guilhe.sample.adapters 2 | 3 | data class Item(var status: String) { 4 | fun changeStatus() { 5 | status = when (status) { 6 | "🥴" -> "🤮" 7 | "🤮" -> "😅" 8 | else -> "😇" 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /sample/src/main/java/com/github/guilhe/sample/adapters/LottieAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.github.guilhe.sample.adapters 2 | 3 | import android.view.LayoutInflater 4 | import android.view.ViewGroup 5 | import com.github.guilhe.views.sample.databinding.LottieItemBinding 6 | 7 | class LottieAdapter() : BaseAdapter<String, LottieItemBinding>() { 8 | 9 | init { 10 | for (i in 1..10) { 11 | items.add("🍯") 12 | } 13 | } 14 | 15 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BaseViewHolder<LottieItemBinding> = 16 | ItemViewHolder(LottieItemBinding.inflate(LayoutInflater.from(parent.context), parent, false)) 17 | 18 | override fun onBindViewHolder(holder: BaseViewHolder<LottieItemBinding>, position: Int) { 19 | getItem(position)?.let { holder.binding.item = it } 20 | } 21 | 22 | private class ItemViewHolder(binding: LottieItemBinding) : BaseViewHolder<LottieItemBinding>(binding) 23 | } -------------------------------------------------------------------------------- /sample/src/main/java/com/github/guilhe/sample/adapters/MahjongItemAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.github.guilhe.sample.adapters 2 | 3 | import android.view.LayoutInflater 4 | import android.view.ViewGroup 5 | import com.github.guilhe.views.sample.databinding.MahjongItemBinding 6 | 7 | class MahjongItemAdapter : BaseAdapter<Item, MahjongItemBinding>() { 8 | 9 | init { 10 | items.addAll( 11 | listOf( 12 | Item("🀀"),Item("🀁"),Item("🀂"),Item("🀃"), 13 | Item("🀢"),Item("🀣"),Item("🀤"),Item("🀥"), 14 | Item("🀦"),Item("🀧"),Item("🀨"),Item("🀩"), 15 | Item("🀅"),Item("🀆"),Item("🀄︎"),Item(""), 16 | Item("🀐"),Item("🀙"),Item("🀇") 17 | ) 18 | ) 19 | } 20 | 21 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BaseViewHolder<MahjongItemBinding> = 22 | ItemViewHolder(MahjongItemBinding.inflate(LayoutInflater.from(parent.context), parent, false)) 23 | 24 | override fun onBindViewHolder(holder: BaseViewHolder<MahjongItemBinding>, position: Int) { 25 | getItem(holder.adapterPosition)?.let { holder.binding.item = it } 26 | } 27 | 28 | private class ItemViewHolder(binding: MahjongItemBinding) : BaseViewHolder<MahjongItemBinding>(binding) 29 | } -------------------------------------------------------------------------------- /sample/src/main/java/com/github/guilhe/sample/adapters/decorators/ItemDecorator.kt: -------------------------------------------------------------------------------- 1 | package com.github.guilhe.sample.adapters.decorators 2 | 3 | import android.graphics.Rect 4 | import android.view.View 5 | import androidx.recyclerview.widget.RecyclerView 6 | 7 | class MarginItemDecoration(private val margin: Int) : RecyclerView.ItemDecoration() { 8 | override fun getItemOffsets(outRect: Rect, view: View, parent: RecyclerView, state: RecyclerView.State) { 9 | with(outRect) { 10 | left = margin 11 | right = margin 12 | top = margin 13 | bottom = margin 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /sample/src/main/java/com/github/guilhe/sample/adapters/placeholders/LottiePlaceHolderAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.github.guilhe.sample.adapters.placeholders 2 | 3 | import android.view.LayoutInflater 4 | import android.view.ViewGroup 5 | import com.github.guilhe.sample.adapters.BaseAdapter 6 | import com.github.guilhe.sample.adapters.BaseViewHolder 7 | import com.github.guilhe.views.PlaceHolderAdapter 8 | import com.github.guilhe.views.sample.databinding.PlaceholderLottieBinding 9 | 10 | class LottiePlaceHolderAdapter : BaseAdapter<Int, PlaceholderLottieBinding>(), PlaceHolderAdapter { 11 | 12 | init { 13 | for (i in 1..10) { 14 | items.add(i) 15 | } 16 | } 17 | 18 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BaseViewHolder<PlaceholderLottieBinding> = 19 | PlaceHolderViewHolder(PlaceholderLottieBinding.inflate(LayoutInflater.from(parent.context), parent, false)) 20 | 21 | override fun onBindViewHolder(holder: BaseViewHolder<PlaceholderLottieBinding>, position: Int) {} 22 | 23 | private class PlaceHolderViewHolder(binding: PlaceholderLottieBinding) : BaseViewHolder<PlaceholderLottieBinding>(binding) 24 | } -------------------------------------------------------------------------------- /sample/src/main/java/com/github/guilhe/sample/adapters/placeholders/RotationPlaceHolderAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.github.guilhe.sample.adapters.placeholders 2 | 3 | import android.view.LayoutInflater 4 | import android.view.ViewGroup 5 | import android.view.animation.AnimationUtils 6 | import com.github.guilhe.sample.adapters.BaseAdapter 7 | import com.github.guilhe.sample.adapters.BaseViewHolder 8 | import com.github.guilhe.views.PlaceHolderAdapter 9 | import com.github.guilhe.views.sample.R 10 | import com.github.guilhe.views.sample.databinding.PlaceholderRotationBinding 11 | 12 | class RotationPlaceHolderAdapter : BaseAdapter<Int, PlaceholderRotationBinding>(), PlaceHolderAdapter { 13 | 14 | init { 15 | for(i in 1..10){ 16 | items.add(i) 17 | } 18 | } 19 | 20 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BaseViewHolder<PlaceholderRotationBinding> = 21 | PlaceHolderViewHolder(PlaceholderRotationBinding.inflate(LayoutInflater.from(parent.context), parent, false)) 22 | 23 | override fun onBindViewHolder(holder: BaseViewHolder<PlaceholderRotationBinding>, position: Int) { 24 | with(holder.binding.root) { startAnimation(AnimationUtils.loadAnimation(this.context, R.anim.anim_rotation)) } 25 | } 26 | 27 | private class PlaceHolderViewHolder(binding: PlaceholderRotationBinding) : BaseViewHolder<PlaceholderRotationBinding>(binding) 28 | } -------------------------------------------------------------------------------- /sample/src/main/java/com/github/guilhe/sample/adapters/placeholders/ShimmerPlaceHolderAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.github.guilhe.sample.adapters.placeholders 2 | 3 | import android.view.LayoutInflater 4 | import android.view.ViewGroup 5 | import com.github.guilhe.sample.adapters.BaseAdapter 6 | import com.github.guilhe.sample.adapters.BaseViewHolder 7 | import com.github.guilhe.views.PlaceHolderAdapter 8 | import com.github.guilhe.views.sample.databinding.PlaceholderShimmerBinding 9 | 10 | class ShimmerPlaceHolderAdapter : BaseAdapter<Int, PlaceholderShimmerBinding>(), PlaceHolderAdapter { 11 | 12 | init { 13 | for (i in 1..20) { 14 | items.add(i) 15 | } 16 | } 17 | 18 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BaseViewHolder<PlaceholderShimmerBinding> = 19 | PlaceHolderViewHolder(PlaceholderShimmerBinding.inflate(LayoutInflater.from(parent.context), parent, false)) 20 | 21 | override fun onBindViewHolder(holder: BaseViewHolder<PlaceholderShimmerBinding>, position: Int) {} 22 | 23 | private class PlaceHolderViewHolder(binding: PlaceholderShimmerBinding) : BaseViewHolder<PlaceholderShimmerBinding>(binding) 24 | } -------------------------------------------------------------------------------- /sample/src/main/res/anim/anim_rotation.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <set xmlns:android="http://schemas.android.com/apk/res/android" 3 | android:interpolator="@android:anim/cycle_interpolator"> 4 | <rotate 5 | android:duration="2500" 6 | android:fromDegrees="0" 7 | android:pivotX="50%" 8 | android:pivotY="50%" 9 | android:toDegrees="360" /> 10 | </set> -------------------------------------------------------------------------------- /sample/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | <vector xmlns:android="http://schemas.android.com/apk/res/android" 2 | xmlns:aapt="http://schemas.android.com/aapt" 3 | android:width="108dp" 4 | android:height="108dp" 5 | android:viewportWidth="108" 6 | android:viewportHeight="108"> 7 | <path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z"> 8 | <aapt:attr name="android:fillColor"> 9 | <gradient 10 | android:endX="85.84757" 11 | android:endY="92.4963" 12 | android:startX="42.9492" 13 | android:startY="49.59793" 14 | android:type="linear"> 15 | <item 16 | android:color="#44000000" 17 | android:offset="0.0" /> 18 | <item 19 | android:color="#00000000" 20 | android:offset="1.0" /> 21 | </gradient> 22 | </aapt:attr> 23 | </path> 24 | <path 25 | android:fillColor="#FFFFFF" 26 | android:fillType="nonZero" 27 | android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z" 28 | android:strokeWidth="1" 29 | android:strokeColor="#00000000" /> 30 | </vector> -------------------------------------------------------------------------------- /sample/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <vector xmlns:android="http://schemas.android.com/apk/res/android" 3 | android:width="108dp" 4 | android:height="108dp" 5 | android:viewportWidth="108" 6 | android:viewportHeight="108"> 7 | <path 8 | android:fillColor="#3DDC84" 9 | android:pathData="M0,0h108v108h-108z" /> 10 | <path 11 | android:fillColor="#00000000" 12 | android:pathData="M9,0L9,108" 13 | android:strokeWidth="0.8" 14 | android:strokeColor="#33FFFFFF" /> 15 | <path 16 | android:fillColor="#00000000" 17 | android:pathData="M19,0L19,108" 18 | android:strokeWidth="0.8" 19 | android:strokeColor="#33FFFFFF" /> 20 | <path 21 | android:fillColor="#00000000" 22 | android:pathData="M29,0L29,108" 23 | android:strokeWidth="0.8" 24 | android:strokeColor="#33FFFFFF" /> 25 | <path 26 | android:fillColor="#00000000" 27 | android:pathData="M39,0L39,108" 28 | android:strokeWidth="0.8" 29 | android:strokeColor="#33FFFFFF" /> 30 | <path 31 | android:fillColor="#00000000" 32 | android:pathData="M49,0L49,108" 33 | android:strokeWidth="0.8" 34 | android:strokeColor="#33FFFFFF" /> 35 | <path 36 | android:fillColor="#00000000" 37 | android:pathData="M59,0L59,108" 38 | android:strokeWidth="0.8" 39 | android:strokeColor="#33FFFFFF" /> 40 | <path 41 | android:fillColor="#00000000" 42 | android:pathData="M69,0L69,108" 43 | android:strokeWidth="0.8" 44 | android:strokeColor="#33FFFFFF" /> 45 | <path 46 | android:fillColor="#00000000" 47 | android:pathData="M79,0L79,108" 48 | android:strokeWidth="0.8" 49 | android:strokeColor="#33FFFFFF" /> 50 | <path 51 | android:fillColor="#00000000" 52 | android:pathData="M89,0L89,108" 53 | android:strokeWidth="0.8" 54 | android:strokeColor="#33FFFFFF" /> 55 | <path 56 | android:fillColor="#00000000" 57 | android:pathData="M99,0L99,108" 58 | android:strokeWidth="0.8" 59 | android:strokeColor="#33FFFFFF" /> 60 | <path 61 | android:fillColor="#00000000" 62 | android:pathData="M0,9L108,9" 63 | android:strokeWidth="0.8" 64 | android:strokeColor="#33FFFFFF" /> 65 | <path 66 | android:fillColor="#00000000" 67 | android:pathData="M0,19L108,19" 68 | android:strokeWidth="0.8" 69 | android:strokeColor="#33FFFFFF" /> 70 | <path 71 | android:fillColor="#00000000" 72 | android:pathData="M0,29L108,29" 73 | android:strokeWidth="0.8" 74 | android:strokeColor="#33FFFFFF" /> 75 | <path 76 | android:fillColor="#00000000" 77 | android:pathData="M0,39L108,39" 78 | android:strokeWidth="0.8" 79 | android:strokeColor="#33FFFFFF" /> 80 | <path 81 | android:fillColor="#00000000" 82 | android:pathData="M0,49L108,49" 83 | android:strokeWidth="0.8" 84 | android:strokeColor="#33FFFFFF" /> 85 | <path 86 | android:fillColor="#00000000" 87 | android:pathData="M0,59L108,59" 88 | android:strokeWidth="0.8" 89 | android:strokeColor="#33FFFFFF" /> 90 | <path 91 | android:fillColor="#00000000" 92 | android:pathData="M0,69L108,69" 93 | android:strokeWidth="0.8" 94 | android:strokeColor="#33FFFFFF" /> 95 | <path 96 | android:fillColor="#00000000" 97 | android:pathData="M0,79L108,79" 98 | android:strokeWidth="0.8" 99 | android:strokeColor="#33FFFFFF" /> 100 | <path 101 | android:fillColor="#00000000" 102 | android:pathData="M0,89L108,89" 103 | android:strokeWidth="0.8" 104 | android:strokeColor="#33FFFFFF" /> 105 | <path 106 | android:fillColor="#00000000" 107 | android:pathData="M0,99L108,99" 108 | android:strokeWidth="0.8" 109 | android:strokeColor="#33FFFFFF" /> 110 | <path 111 | android:fillColor="#00000000" 112 | android:pathData="M19,29L89,29" 113 | android:strokeWidth="0.8" 114 | android:strokeColor="#33FFFFFF" /> 115 | <path 116 | android:fillColor="#00000000" 117 | android:pathData="M19,39L89,39" 118 | android:strokeWidth="0.8" 119 | android:strokeColor="#33FFFFFF" /> 120 | <path 121 | android:fillColor="#00000000" 122 | android:pathData="M19,49L89,49" 123 | android:strokeWidth="0.8" 124 | android:strokeColor="#33FFFFFF" /> 125 | <path 126 | android:fillColor="#00000000" 127 | android:pathData="M19,59L89,59" 128 | android:strokeWidth="0.8" 129 | android:strokeColor="#33FFFFFF" /> 130 | <path 131 | android:fillColor="#00000000" 132 | android:pathData="M19,69L89,69" 133 | android:strokeWidth="0.8" 134 | android:strokeColor="#33FFFFFF" /> 135 | <path 136 | android:fillColor="#00000000" 137 | android:pathData="M19,79L89,79" 138 | android:strokeWidth="0.8" 139 | android:strokeColor="#33FFFFFF" /> 140 | <path 141 | android:fillColor="#00000000" 142 | android:pathData="M29,19L29,89" 143 | android:strokeWidth="0.8" 144 | android:strokeColor="#33FFFFFF" /> 145 | <path 146 | android:fillColor="#00000000" 147 | android:pathData="M39,19L39,89" 148 | android:strokeWidth="0.8" 149 | android:strokeColor="#33FFFFFF" /> 150 | <path 151 | android:fillColor="#00000000" 152 | android:pathData="M49,19L49,89" 153 | android:strokeWidth="0.8" 154 | android:strokeColor="#33FFFFFF" /> 155 | <path 156 | android:fillColor="#00000000" 157 | android:pathData="M59,19L59,89" 158 | android:strokeWidth="0.8" 159 | android:strokeColor="#33FFFFFF" /> 160 | <path 161 | android:fillColor="#00000000" 162 | android:pathData="M69,19L69,89" 163 | android:strokeWidth="0.8" 164 | android:strokeColor="#33FFFFFF" /> 165 | <path 166 | android:fillColor="#00000000" 167 | android:pathData="M79,19L79,89" 168 | android:strokeWidth="0.8" 169 | android:strokeColor="#33FFFFFF" /> 170 | </vector> 171 | -------------------------------------------------------------------------------- /sample/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <layout xmlns:android="http://schemas.android.com/apk/res/android" 3 | xmlns:app="http://schemas.android.com/apk/res-auto" 4 | xmlns:tools="http://schemas.android.com/tools"> 5 | 6 | <androidx.constraintlayout.widget.ConstraintLayout 7 | android:layout_width="match_parent" 8 | android:layout_height="match_parent" 9 | android:background="?attr/colorPrimaryDark"> 10 | 11 | <com.github.guilhe.views.PlaceHolderRecyclerView 12 | android:id="@+id/mahjong_PlaceHolderRecyclerView" 13 | android:layout_width="0dp" 14 | android:layout_height="0dp" 15 | android:padding="10dp" 16 | android:clipToPadding="false" 17 | app:layout_constraintBottom_toTopOf="@+id/lottie_PlaceHolderRecyclerView" 18 | app:layout_constraintEnd_toEndOf="parent" 19 | app:layout_constraintStart_toStartOf="parent" 20 | app:layout_constraintTop_toTopOf="parent" /> 21 | 22 | <com.github.guilhe.views.PlaceHolderRecyclerView 23 | android:id="@+id/lottie_PlaceHolderRecyclerView" 24 | android:layout_width="0dp" 25 | android:layout_height="100dp" 26 | android:orientation="horizontal" 27 | app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" 28 | app:layout_constraintBottom_toTopOf="@+id/emoji_PlaceHolderRecyclerView" 29 | app:layout_constraintEnd_toEndOf="parent" 30 | app:layout_constraintStart_toStartOf="parent" /> 31 | 32 | <com.github.guilhe.views.PlaceHolderRecyclerView 33 | android:id="@+id/emoji_PlaceHolderRecyclerView" 34 | android:layout_width="0dp" 35 | android:layout_height="110dp" 36 | android:orientation="horizontal" 37 | app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" 38 | app:layout_constraintBottom_toTopOf="@+id/load_MaterialButton" 39 | app:layout_constraintEnd_toEndOf="parent" 40 | app:layout_constraintStart_toStartOf="parent" /> 41 | 42 | <com.google.android.material.button.MaterialButton 43 | android:id="@+id/load_MaterialButton" 44 | android:layout_width="0dp" 45 | android:layout_height="60dp" 46 | android:layout_margin="10dp" 47 | android:text="LOAD" 48 | app:layout_constraintBottom_toBottomOf="parent" 49 | app:layout_constraintEnd_toEndOf="parent" 50 | app:layout_constraintStart_toStartOf="parent" 51 | tools:ignore="HardcodedText" /> 52 | 53 | </androidx.constraintlayout.widget.ConstraintLayout> 54 | </layout> -------------------------------------------------------------------------------- /sample/src/main/res/layout/emoji_item.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <layout xmlns:android="http://schemas.android.com/apk/res/android" 3 | xmlns:app="http://schemas.android.com/apk/res-auto" 4 | xmlns:tools="http://schemas.android.com/tools"> 5 | 6 | <data> 7 | 8 | <variable 9 | name="item" 10 | type="com.github.guilhe.sample.adapters.Item" /> 11 | </data> 12 | 13 | <com.google.android.material.card.MaterialCardView 14 | android:layout_width="@dimen/card_width" 15 | android:layout_height="@dimen/card_height" 16 | android:clickable="true" 17 | android:focusable="true" 18 | android:foreground="?attr/selectableItemBackground" 19 | app:cardBackgroundColor="?attr/colorSurface" 20 | app:cardCornerRadius="5dp" 21 | app:cardElevation="7dp"> 22 | 23 | <TextView 24 | android:layout_width="wrap_content" 25 | android:layout_height="wrap_content" 26 | android:layout_gravity="center" 27 | android:text="@{item.status}" 28 | android:textSize="36sp" 29 | tools:text="123" /> 30 | 31 | </com.google.android.material.card.MaterialCardView> 32 | </layout> -------------------------------------------------------------------------------- /sample/src/main/res/layout/lottie_item.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <layout xmlns:tools="http://schemas.android.com/tools" 3 | xmlns:android="http://schemas.android.com/apk/res/android" 4 | xmlns:app="http://schemas.android.com/apk/res-auto"> 5 | 6 | <data> 7 | <variable 8 | name="item" 9 | type="String" /> 10 | </data> 11 | 12 | <com.google.android.material.card.MaterialCardView 13 | android:layout_width="@dimen/card_width" 14 | android:layout_height="@dimen/card_height" 15 | android:clickable="true" 16 | android:focusable="true" 17 | android:foreground="?attr/selectableItemBackground" 18 | app:cardBackgroundColor="?attr/colorSurface" 19 | app:cardCornerRadius="5dp" 20 | app:cardElevation="7dp"> 21 | 22 | <TextView 23 | android:layout_width="wrap_content" 24 | android:layout_height="wrap_content" 25 | android:layout_gravity="center" 26 | android:textSize="36sp" 27 | android:text="@{item}" 28 | tools:ignore="HardcodedText" /> 29 | 30 | </com.google.android.material.card.MaterialCardView> 31 | </layout> -------------------------------------------------------------------------------- /sample/src/main/res/layout/mahjong_item.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <layout xmlns:android="http://schemas.android.com/apk/res/android" 3 | xmlns:app="http://schemas.android.com/apk/res-auto"> 4 | 5 | <data> 6 | 7 | <import type="android.view.View" /> 8 | 9 | <variable 10 | name="item" 11 | type="com.github.guilhe.sample.adapters.Item" /> 12 | </data> 13 | 14 | <com.google.android.material.card.MaterialCardView 15 | android:layout_width="@dimen/card_width" 16 | android:layout_height="@dimen/card_height" 17 | android:clickable="true" 18 | android:focusable="true" 19 | android:foreground="?attr/selectableItemBackground" 20 | android:visibility="@{item.status.isEmpty()?View.GONE:View.VISIBLE}" 21 | app:cardBackgroundColor="?attr/colorSurface" 22 | app:cardCornerRadius="5dp" 23 | app:cardElevation="7dp"> 24 | 25 | <TextView 26 | android:layout_width="wrap_content" 27 | android:layout_height="wrap_content" 28 | android:layout_gravity="center" 29 | android:layout_marginBottom="10dp" 30 | android:text="@{item.status}" 31 | android:textColor="?android:attr/textColorPrimary" 32 | android:textSize="55sp" /> 33 | 34 | </com.google.android.material.card.MaterialCardView> 35 | </layout> -------------------------------------------------------------------------------- /sample/src/main/res/layout/placeholder_lottie.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <layout xmlns:android="http://schemas.android.com/apk/res/android" 3 | xmlns:app="http://schemas.android.com/apk/res-auto"> 4 | 5 | <com.google.android.material.card.MaterialCardView 6 | android:layout_width="@dimen/card_width" 7 | android:layout_height="@dimen/card_height" 8 | app:cardBackgroundColor="?attr/colorSurface" 9 | app:cardCornerRadius="5dp"> 10 | 11 | <com.airbnb.lottie.LottieAnimationView 12 | android:layout_width="match_parent" 13 | android:layout_height="match_parent" 14 | app:lottie_scale="0.17" 15 | android:scaleType="center" 16 | app:lottie_autoPlay="true" 17 | app:lottie_loop="true" 18 | app:lottie_rawRes="@raw/loading_bear"/> 19 | 20 | </com.google.android.material.card.MaterialCardView> 21 | </layout> -------------------------------------------------------------------------------- /sample/src/main/res/layout/placeholder_rotation.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <layout xmlns:android="http://schemas.android.com/apk/res/android" 3 | xmlns:app="http://schemas.android.com/apk/res-auto" 4 | xmlns:tools="http://schemas.android.com/tools"> 5 | 6 | <com.google.android.material.card.MaterialCardView 7 | android:layout_width="@dimen/card_width" 8 | android:layout_height="@dimen/card_height" 9 | app:cardBackgroundColor="?attr/colorSurface" 10 | app:cardCornerRadius="5dp"> 11 | 12 | <TextView 13 | android:layout_width="wrap_content" 14 | android:layout_height="wrap_content" 15 | android:layout_gravity="center" 16 | android:textSize="36sp" 17 | android:text="🤢" 18 | tools:ignore="HardcodedText" /> 19 | 20 | </com.google.android.material.card.MaterialCardView> 21 | </layout> -------------------------------------------------------------------------------- /sample/src/main/res/layout/placeholder_shimmer.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <layout xmlns:android="http://schemas.android.com/apk/res/android" 3 | xmlns:app="http://schemas.android.com/apk/res-auto"> 4 | 5 | <com.facebook.shimmer.ShimmerFrameLayout 6 | android:layout_width="wrap_content" 7 | android:layout_height="wrap_content" 8 | app:shimmer_auto_start="true" 9 | app:shimmer_base_alpha=".2" 10 | app:shimmer_highlight_alpha=".4"> 11 | 12 | <com.google.android.material.card.MaterialCardView 13 | android:layout_width="@dimen/card_width" 14 | android:layout_height="@dimen/card_height" 15 | app:cardCornerRadius="5dp" /> 16 | 17 | </com.facebook.shimmer.ShimmerFrameLayout> 18 | </layout> -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> 3 | <background android:drawable="@drawable/ic_launcher_background" /> 4 | <foreground android:drawable="@drawable/ic_launcher_foreground" /> 5 | </adaptive-icon> -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> 3 | <background android:drawable="@drawable/ic_launcher_background" /> 4 | <foreground android:drawable="@drawable/ic_launcher_foreground" /> 5 | </adaptive-icon> -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GuilhE/PlaceHolderRecyclerView/5b5b8ee3422fd62a7b0ecf08f4e763ad471af10d/sample/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GuilhE/PlaceHolderRecyclerView/5b5b8ee3422fd62a7b0ecf08f4e763ad471af10d/sample/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GuilhE/PlaceHolderRecyclerView/5b5b8ee3422fd62a7b0ecf08f4e763ad471af10d/sample/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GuilhE/PlaceHolderRecyclerView/5b5b8ee3422fd62a7b0ecf08f4e763ad471af10d/sample/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GuilhE/PlaceHolderRecyclerView/5b5b8ee3422fd62a7b0ecf08f4e763ad471af10d/sample/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GuilhE/PlaceHolderRecyclerView/5b5b8ee3422fd62a7b0ecf08f4e763ad471af10d/sample/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GuilhE/PlaceHolderRecyclerView/5b5b8ee3422fd62a7b0ecf08f4e763ad471af10d/sample/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GuilhE/PlaceHolderRecyclerView/5b5b8ee3422fd62a7b0ecf08f4e763ad471af10d/sample/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GuilhE/PlaceHolderRecyclerView/5b5b8ee3422fd62a7b0ecf08f4e763ad471af10d/sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GuilhE/PlaceHolderRecyclerView/5b5b8ee3422fd62a7b0ecf08f4e763ad471af10d/sample/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sample/src/main/res/raw/loading_bear.json: -------------------------------------------------------------------------------- 1 | {"v":"5.5.7","meta":{"g":"LottieFiles AE 0.1.20","a":"","k":"","d":"","tc":""},"fr":25,"ip":0,"op":100,"w":1000,"h":1000,"nm":"loading_relax 3","ddd":1,"assets":[{"id":"image_0","w":65,"h":65,"u":"","p":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEEAAABBCAYAAACO98lFAAADh0lEQVR4Xu2bi3HVMBBF91YAHRAqIFTAowKgAkgFCRVAKiBUAKkgpAJIBSQVkHRAKhBzjeTxT5ZlyT/JmvEkM/azrKPV/rSCzNCUUgcRORaRpyLC//varYjci8gtgF8zfJ5gik6UUkci8lZfrwL7uBORH7wAEFD0FhWCUuqDiPAKHbhtoARyoYH8jUUjCgQ9+M8i8izWhzne86hhXAAIhhEEQSlFkefMzDX4JhvCOAPwPQT+KAhKKSo4dvwmpPOIv73hMgRAherdvCFoTU9F9cS7t2l/MFoqvCDotf9t2rEEv/0rgDOftwyGoJSi+L/3efmCz14CoJUa1AZB2BgAM/BrAFTczuaEsFEAZuCDJKIXwkZ0gGumnSCsELQV+OnqYSP3T/p8iU4I2g+gzV2bGRzLnObzYIs9bBDoB6zFERo78Obv7gAwkm21FgTtCl/F6nll7/kIgG5+rXVB4DJYKhaYmhmXxVEz6KpBSMQauECeA2DEW7YmhJSlwAy6JQ0lhEykwICoSUMVAvN5U2WEXCI69/0HAEwBFq2AoHOCf+b+koX7eweArkAJgaHnl4U/au7uS3faSEJOS8HALpeEgaDmnoaV9PecKTkkFij5si0CK0LIUR/UTCUh0Hv65IswkedvABwIIUelaOZwh1D4CGyZS8IOYZcEEzfsy2HXCf8jyF0SpEi+0jow8XiaiPPjO4zST8jZbS52sPcAigGUzizlGkq/5K6UgcDSuBe+C2rjzz8CYNlRmV7LMZJspde4R/d74zPr+/n1RKvWCzktiXIplMtBQ2CNz9qLsnxn2/Z8rbiruvlCJZFSTUIfsCLBah5o7kXmoCBb5TtNCDlIQ00KajrBiEbiG7OtbflOCFpJpph8feDBk66qeFvNEndsaTJTKdzi3L62naTpK+FLyWR2LoNO69C0KYnkGpzlvamX9fK4EOsXe0/HOCFsWFEOAmC1Dl2u1sYKvQcD8IKgJWILZx6u9VGgwQfEBi2HqmRoZ4rJ2TWaz14rYAsmvCFoiWD+gVKxlmwUHSEeBBt1onYUhIqLzUw1g64lpeKcxxJdFqAvpAyCoKWCQRdh8JoTxiUnYOwxwCqUYAgVqTAw6GlOVSDOklwuQ878qDOQXRIRDUJDeZrD4jwhHwqEAzcHxoviy9htEggNIAzGCMP85W1b+TDtO00bg7fimuqk/CTLIfbszPm+f0YqWFFCxJfbAAAAAElFTkSuQmCC","e":1},{"id":"image_1","w":65,"h":65,"u":"","p":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEEAAABBCAYAAACO98lFAAADiklEQVR4Xu2bi3HVMBBF91YAHRAqACrgUQFQAVABoQJIBYQKIBWEVACpgKQCSAekAjHXrDz+ybIs28+WrBlPMmM/yzpa7U8ryALNGHMQkaci8lBE+H9fuxGRPyJyA+DnAp8nmKMTY8yJiLzS63lkH7ci8p0XAAKavE0KwRjzVkR4xQ7cNVACOVcgf6eiMQkEHfwnEXk01Yd53nOvMM4BRMOIgmCMochzZpYafJMNYZwC+BYDfxQEYwwVHDt+GdP5hL+95jIEQIUa3IIhqKanonoQ3Nu8PxgtFUEQdO1/nXcs0W//AuA05C2DIRhjKP5vQl5+xGcvANBKDWqDIGwMgB34FQAqbm/zQtgoADvwQRLRC2EjOsA3014QTghqBX74etjI/Xd9vkQnBPUDaHPXZgbHMqf5PLhiDxcE+gFrcYTGDrz5u1sAjGRbrQVBXeHLqXpe2Xs+AKCbX2tdELgMjhULzM2My+KkGXTVICRiDXwgzwAw4i1bE0LKUmAH3ZKGEkImUmBB1KShCoH5vLkyQj4RXfr+HQCmAItWQNCc4O+lv+TI/b0GQFeghMDQ8/ORP2rp7kt32kpCTkvBwi6XhIVglp6GlfT3mCk5JBYohbItAitCyFEf1EwlIdB7+hiKMJHnrwEcCCFHpWjncIdQ+AhsmUvCDmGXBBs37Mth1wn/I8hdEqRIvtI6MPH4PhHnJ3QYpZ+Qs9tc7GDvARQDKM0s5RpKP+OulIXA0rgnoQtq48/fA2DZUZleyzGSbKXXuEf3a+MzG/r59USr6oWclkS5FMrloBBY47P2oqzQ2XY9Xyvuqm6+UEmkVJPQB6xIsNoHmnuROSjIVvlOE0IO0lCTgppOsKKR+MZsa1u+E4IqyRSTr3c8eNJVFe+qWeKOLU1mKoVbnNsXrpM0fSV8KZnMzmXQaR2aNiWRXIO3vDf1sl4eF2L9Yu/pGC8EVZRbrGscBMBpHbpcrY0Veg8GEARBJWILZx6u9CjQ4ANig5ZDVTLUmWJydo3ms9cKuIKJYAgqEcw/UCrWko2iI8SDYKNO1I6CUHGxmalm0HVMqTjjsUSfBegLKaMgqFQw6CIMXkvCuOAEjD0GWIUSDaEiFRYGPc25CsRZkstlyJkfdQaySyImg9BQnvawOE/IxwLhwO2B8aL4cuo2C4QGEAZjhGH/8rarfJj2naaNwVtxzXVSfpblMPXsLPm+f0XqWFGp7eQqAAAAAElFTkSuQmCC","e":1}],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Shape Layer 3","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":269,"ix":10},"p":{"a":0,"k":[494,517,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[70.995,-70.995,100],"ix":6}},"ao":0,"shapes":[{"d":1,"ty":"el","s":{"a":0,"k":[22,22],"ix":2},"p":{"a":0,"k":[372,74.5],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":0,"k":[0.979607795267,0.962704707127,0.962704707127,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"rp","c":{"a":0,"k":43,"ix":1},"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[-25]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":24,"s":[-10]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":49.5,"s":[5]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":73.5,"s":[18]},{"t":99,"s":[34]}],"ix":2},"m":1,"ix":4,"tr":{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":-6,"ix":4},"so":{"a":0,"k":0,"ix":5},"eo":{"a":0,"k":100,"ix":6},"nm":"Transform"},"nm":"Repeater 1","mn":"ADBE Vector Filter - Repeater","hd":false}],"ip":0,"op":250,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":3,"nm":"Null 3","sr":1,"ks":{"o":{"a":0,"k":0,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[500,500,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[117,117,100],"ix":6}},"ao":0,"ip":0,"op":250,"st":0,"bm":0},{"ddd":0,"ind":3,"ty":3,"nm":"Null 4","parent":5,"sr":1,"ks":{"o":{"a":0,"k":0,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[18.876,20.093,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[85.47,85.47,100],"ix":6}},"ao":0,"ip":0,"op":250,"st":0,"bm":0},{"ddd":0,"ind":5,"ty":4,"nm":"Layer 4 Outlines","parent":2,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":0.167,"y":0.167},"t":0,"s":[224.864,11.682,0],"to":[0,126.574,0],"ti":[126.574,0,0]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":24.749,"s":[-4.318,240.864,0],"to":[-126.574,0,0],"ti":[0,126.574,0]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"t":49.499,"s":[-233.5,11.682,0],"to":[0,-126.574,0],"ti":[-126.574,0,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.333,"y":0},"t":74.249,"s":[-4.318,-217.5,0],"to":[126.574,0,0],"ti":[0,-126.574,0]},{"t":99,"s":[224.864,11.682,0]}],"ix":2},"a":{"a":0,"k":[18.953,18.954,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,-10.33],[10.33,0],[0,10.33],[-10.329,0]],"o":[[0,10.33],[-10.329,0],[0,-10.33],[10.33,0]],"v":[[18.704,0],[-0.001,18.704],[-18.704,0],[-0.001,-18.704]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[18.953,18.954],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[81,81],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":250,"st":0,"bm":0},{"ddd":0,"ind":11,"ty":4,"nm":"Layer 6 Outlines","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":0,"s":[583.237,518.09,0],"to":[0.709,36.333,0],"ti":[57.332,-1.5,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.166},"t":25,"s":[499,605.59,0],"to":[-28.073,0.734,0],"ti":[1.094,68.99,0]},{"i":{"x":0.833,"y":0.84},"o":{"x":0.167,"y":0.166},"t":50,"s":[414.744,518.09,0],"to":[-0.853,-53.764,0],"ti":[-35.123,0.498,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.173},"t":74,"s":[498.994,435.59,0],"to":[53.621,-0.761,0],"ti":[2.674,-31.215,0]},{"t":100,"s":[582.987,518.09,0]}],"ix":2},"a":{"a":0,"k":[22.275,19.366,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-6.984,0.026],[0,0],[3.469,-6.061],[0,0],[3.515,6.035],[0,0]],"o":[[0,0],[6.983,-0.026],[0,0],[-3.469,6.061],[0,0],[-3.515,-6.034]],"v":[[-10.705,-19.01],[10.649,-19.09],[18.557,-5.512],[7.949,13.022],[-7.765,13.081],[-18.511,-5.373]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0,0,0,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[22.275,19.366],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":250,"st":0,"bm":0},{"ddd":0,"ind":12,"ty":4,"nm":"Layer 7 Outlines","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.833,"y":0.827},"o":{"x":0.167,"y":0.167},"t":0,"s":[559.001,522.232,0],"to":[0.626,26.211,0],"ti":[37.539,0.715,0]},{"i":{"x":0.833,"y":0.828},"o":{"x":0.167,"y":0.161},"t":25,"s":[496.755,586.5,0],"to":[-31.038,-0.592,0],"ti":[1.359,46.211,0]},{"i":{"x":0.833,"y":0.846},"o":{"x":0.167,"y":0.161},"t":50,"s":[426.755,521.636,0],"to":[-1.476,-50.19,0],"ti":[-25.09,-0.65,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.18},"t":74,"s":[496.755,454.732,0],"to":[36.663,0.95,0],"ti":[0.417,-32.125,0]},{"t":100,"s":[558.751,521.482,0]}],"ix":2},"a":{"a":0,"k":[69.338,60.212,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[49.487,0.061],[-19.923,50.942],[-26.829,-57.017]],"o":[[-49.487,-0.061],[19.923,-50.942],[26.829,57.017]],"v":[[-0.595,58.363],[-44.436,-13.223],[46.563,-15.396]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.67215683881,0.654232548732,0.654232548732,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[69.338,60.212],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":250,"st":0,"bm":0},{"ddd":0,"ind":14,"ty":4,"nm":"Layer 8 Outlines","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.833,"y":0.831},"o":{"x":0.167,"y":0.167},"t":0,"s":[604.806,474.5,0],"to":[-1.25,19.448,0],"ti":[33.02,-0.184,0]},{"i":{"x":0.833,"y":0.831},"o":{"x":0.167,"y":0.164},"t":25,"s":[558.306,522.186,0],"to":[-32.397,0.181,0],"ti":[0.697,21.895,0]},{"i":{"x":0.833,"y":0.84},"o":{"x":0.167,"y":0.165},"t":50,"s":[509.431,474.5,0],"to":[-0.622,-19.515,0],"ti":[-31.396,-0.716,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.173},"t":74,"s":[556.681,426.811,0],"to":[21.766,0.497,0],"ti":[0.375,-29.636,0]},{"t":100,"s":[604.806,474.5,0]}],"ix":2},"a":{"a":0,"k":[15.878,15.878,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,-7.388],[7.388,0],[0,7.388],[-7.388,0]],"o":[[0,7.388],[-7.388,0],[0,-7.388],[7.388,0]],"v":[[13.378,0],[0,13.378],[-13.378,0],[0,-13.378]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":1,"ix":5},"lc":1,"lj":1,"ml":10,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[0.01019598269,0.00976415148,0.00976415148,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[15.878,15.878],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":250,"st":0,"bm":0},{"ddd":0,"ind":15,"ty":4,"nm":"Layer 9 Outlines","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.833,"y":0.835},"o":{"x":0.167,"y":0.167},"t":0,"s":[481.242,474.5,0],"to":[-2.083,31.698,0],"ti":[22.157,0.073,0]},{"i":{"x":0.833,"y":0.828},"o":{"x":0.167,"y":0.168},"t":25,"s":[431.992,522.186,0],"to":[-18.177,-0.06,0],"ti":[0.307,33.375,0]},{"i":{"x":0.833,"y":0.842},"o":{"x":0.167,"y":0.161},"t":50,"s":[384.992,474.5,0],"to":[-0.28,-30.379,0],"ti":[-23.5,0.244,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.175},"t":74,"s":[433.617,426.686,0],"to":[19.749,-0.205,0],"ti":[0.5,-29.302,0]},{"t":100,"s":[480.992,474.5,0]}],"ix":2},"a":{"a":0,"k":[15.878,15.878,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,-7.388],[7.388,0],[0,7.388],[-7.388,0]],"o":[[0,7.388],[-7.388,0],[0,-7.388],[7.388,0]],"v":[[13.378,0],[0,13.378],[-13.378,0],[0,-13.378]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":1,"ix":5},"lc":1,"lj":1,"ml":10,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[0.01019598269,0.00976415148,0.00976415148,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[15.878,15.878],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":250,"st":0,"bm":0},{"ddd":0,"ind":18,"ty":4,"nm":"Layer 10 Outlines","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[499.333,509.161,0],"ix":2},"a":{"a":0,"k":[121.544,121.543,0],"ix":1},"s":{"a":0,"k":[118,118,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,-66.988],[66.988,0],[0,66.988],[-66.989,0]],"o":[[0,66.988],[-66.989,0],[0,-66.988],[66.988,0]],"v":[[121.294,0],[0.001,121.293],[-121.294,0],[0.001,-121.293]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.989019655714,0.944028906729,0.944028906729,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[121.544,121.543],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[104,104],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":250,"st":0,"bm":0},{"ddd":0,"ind":19,"ty":2,"nm":"Layer 2","refId":"image_0","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[586.798,392.218,0],"ix":2},"a":{"a":0,"k":[32.071,32.071,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"ip":0,"op":250,"st":0,"bm":0},{"ddd":0,"ind":20,"ty":2,"nm":"Layer 3","refId":"image_1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[409.434,392.218,0],"ix":2},"a":{"a":0,"k":[32.071,32.071,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"ip":0,"op":250,"st":0,"bm":0}],"markers":[]} -------------------------------------------------------------------------------- /sample/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <resources> 3 | <color name="orange">#f57f17</color> 4 | <color name="brick">#bc5010</color> 5 | <color name="ivory">#fff8e1</color> 6 | </resources> 7 | -------------------------------------------------------------------------------- /sample/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <resources> 3 | <dimen name="card_width">55dp</dimen> 4 | <dimen name="card_height">70dp</dimen> 5 | </resources> -------------------------------------------------------------------------------- /sample/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | <resources> 2 | <string name="app_name">sample</string> 3 | <string name="card_back">🂠</string> 4 | <string name="card_front">🃁</string> 5 | </resources> -------------------------------------------------------------------------------- /sample/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | <resources> 2 | <style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar"> 3 | <item name="colorPrimary">@color/orange</item> 4 | <item name="colorPrimaryDark">@color/brick</item> 5 | <item name="colorSurface">@color/ivory</item> 6 | <item name="android:textColorPrimary">@android:color/black</item> 7 | </style> 8 | </resources> -------------------------------------------------------------------------------- /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | rootProject.name="PlaceholderRecyclerView" 2 | include("placeholder-recyclerview", "sample") --------------------------------------------------------------------------------