├── .github ├── CODE_OF_CONDUCT.md └── CONTRIBUTING.md ├── .gitignore ├── .idea └── codeStyleSettings.xml ├── BUCK ├── LICENSE ├── README.md ├── build.gradle ├── gradle.properties ├── gradle ├── gradle-mvn-push.gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── lib └── support-annotations │ └── BUCK ├── sample ├── build.gradle └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── facebook │ │ └── shimmer │ │ └── sample │ │ └── MainActivity.kt │ └── res │ ├── drawable │ ├── background.jpg │ ├── fb_logo.png │ └── icon.png │ ├── layout │ └── main.xml │ └── values │ ├── colors.xml │ ├── strings.xml │ └── styles.xml ├── settings.gradle ├── shimmer.gif ├── shimmer ├── BUCK ├── build.gradle ├── gradle.properties └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── facebook │ │ └── shimmer │ │ ├── Shimmer.java │ │ ├── ShimmerDrawable.java │ │ └── ShimmerFrameLayout.java │ └── res │ └── values │ └── attrs.xml └── versions.gradle /.github/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # 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 make 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 within all project spaces, and it also applies when 49 | an individual is representing the project or its community in public spaces. 50 | Examples of representing a project or community include using an official 51 | project e-mail address, posting via an official social media account, or acting 52 | as an appointed representative at an online or offline event. Representation of 53 | a project may be 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 | 78 | -------------------------------------------------------------------------------- /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to shimmer-android 2 | We want to make contributing to this project as easy and transparent as 3 | possible. 4 | 5 | ## Our Development Process 6 | 7 | Our internal repository, which is copied to GitHub, is our source of truth, 8 | and development happens both directly in GitHub and internally. 9 | Internally, we might build tools around this library that we might move 10 | into the GitHub repository in the future, but we won't fork for internal changes. 11 | 12 | This repository has two modules: 13 | 14 | * in `shimmer/` you'll find the shimmer library code that provides all the 15 | functionality that you would use in your app. 16 | * in `sample/` you'll find an example app that utilizes the library. 17 | 18 | ## Development set up 19 | 20 | It is important that you first install the snapshot version of the shimmer 21 | library before you can start developing. To do so, you can simply run 22 | `./gradlew shimmer:installArchives`. This will install the snapshot artifact to 23 | your local repository so you can work on the latest and greatest version. 24 | 25 | ## Pull Requests 26 | We actively welcome your pull requests. 27 | 28 | 1. Fork the repo and create your branch from `main`. 29 | 2. If you've added code that should be tested, add tests 30 | 3. If you've changed APIs, update the documentation. 31 | 4. Ensure the test suite passes. 32 | 5. Make sure your code lints. 33 | 6. If you haven't already, complete the Contributor License Agreement ("CLA"). 34 | 35 | ## Contributor License Agreement ("CLA") 36 | In order to accept your pull request, we need you to submit a CLA. You only need 37 | to do this once to work on any of Facebook's open source projects. 38 | 39 | Complete your CLA here: 40 | 41 | ## Issues 42 | We use GitHub issues to track public bugs. Please ensure your description is 43 | clear and has sufficient instructions to be able to reproduce the issue. 44 | 45 | Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe 46 | disclosure of security bugs. In those cases, please go through the process 47 | outlined on that page and do not file a public issue. 48 | 49 | ## Coding Style 50 | * We use Google's Java formatter (https://github.com/google/google-java-format) 51 | with default settings. Please use it to format your changes. 52 | 53 | ## License 54 | By contributing to shimmer-android, you agree that your contributions will be licensed 55 | under its BSD license. 56 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .idea 3 | !.idea/codeStyleSettings.xml 4 | .gradle 5 | gen 6 | local.properties 7 | buck-* 8 | .buckd 9 | out 10 | build 11 | .DS_Store 12 | _site 13 | -------------------------------------------------------------------------------- /.idea/codeStyleSettings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 249 | 251 | -------------------------------------------------------------------------------- /BUCK: -------------------------------------------------------------------------------- 1 | load("//tools/build_defs/oss:shimmer_defs.bzl", "SHIMMER_TARGET", "fb_core_android_library") 2 | 3 | fb_core_android_library( 4 | name = "shimmer", 5 | visibility = ["PUBLIC"], 6 | deps = [ 7 | SHIMMER_TARGET, 8 | ], 9 | exported_deps = [ 10 | SHIMMER_TARGET, 11 | ], 12 | ) 13 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD License 2 | 3 | For Shimmer-android software 4 | 5 | Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 10 | * Redistributions of source code must retain the above copyright notice, this 11 | list of conditions and the following disclaimer. 12 | 13 | * Redistributions in binary form must reproduce the above copyright notice, 14 | this list of conditions and the following disclaimer in the documentation 15 | and/or other materials provided with the distribution. 16 | 17 | * Neither the name Meta nor the names of its contributors may be used to 18 | endorse or promote products derived from this software without specific 19 | prior written permission. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 22 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 23 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 24 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 25 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 27 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 28 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | Shimmer
3 | Shimmer for Android 4 |

5 | 6 | 7 | [Shimmer](http://facebook.github.io/shimmer-android) is an Android library that 8 | provides an easy way to add a shimmer effect to any view in your Android app. 9 | 10 | It is useful as an unobtrusive loading indicator, and was originally developed for Facebook Home. 11 | 12 | Find more examples and usage instructions over at: 13 | 14 | [facebook.github.io/shimmer-android](http://facebook.github.io/shimmer-android) 15 | 16 | ## License 17 | 18 | BSD License 19 | 20 | For Shimmer-android software 21 | 22 | Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved. 23 | 24 | Redistribution and use in source and binary forms, with or without modification, 25 | are permitted provided that the following conditions are met: 26 | 27 | * Redistributions of source code must retain the above copyright notice, this 28 | list of conditions and the following disclaimer. 29 | 30 | * Redistributions in binary form must reproduce the above copyright notice, 31 | this list of conditions and the following disclaimer in the documentation 32 | and/or other materials provided with the distribution. 33 | 34 | * Neither the name Meta nor the names of its contributors may be used to 35 | endorse or promote products derived from this software without specific 36 | prior written permission. 37 | 38 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 39 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 40 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 41 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 42 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 43 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 44 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 45 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 46 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 47 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | buildscript { 10 | apply from: rootProject.file('versions.gradle') 11 | repositories { 12 | mavenLocal() 13 | jcenter() 14 | google() 15 | } 16 | dependencies { 17 | classpath plugs.agp 18 | classpath plugs.kotlin 19 | } 20 | } 21 | 22 | allprojects { 23 | repositories { 24 | mavenLocal() 25 | jcenter() 26 | google() 27 | } 28 | } 29 | 30 | task clean(type: Delete) { 31 | delete rootProject.buildDir 32 | } 33 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | VERSION_NAME=0.6.0-SNAPSHOT 2 | GROUP=com.facebook.shimmer 3 | 4 | POM_DESCRIPTION=Shimmer effect for Android Views. 5 | POM_URL=http://facebook.github.io/shimmer-android 6 | 7 | POM_SCM_URL=https://github.com/facebook/shimmer-android.git 8 | POM_SCM_CONNECTION=scm:git@github.com:facebook/shimmer-android.git 9 | POM_SCM_DEV_CONNECTION=scm:git@github.com:facebook/shimmer-android.git 10 | 11 | POM_LICENCE_NAME=BSD 2-Clause License 12 | POM_LICENCE_URL=https://github.com/facebook/shimmer-android/blob/main/LICENSE 13 | POM_LICENCE_DIST=repo 14 | 15 | POM_DEVELOPER_ID=facebook 16 | POM_DEVELOPER_NAME=Facebook 17 | 18 | org.gradle.configureondemand=true 19 | 20 | android.useAndroidX=true 21 | android.enableJetifier=false 22 | -------------------------------------------------------------------------------- /gradle/gradle-mvn-push.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Chris Banes 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | apply plugin: 'maven' 18 | apply plugin: 'signing' 19 | 20 | def isReleaseBuild() { 21 | return !VERSION_NAME.contains("SNAPSHOT") 22 | } 23 | 24 | def getRepositoryUsername() { 25 | return findProperty('repositoryUsername') ? property('repositoryUsername') : "" 26 | } 27 | 28 | def getRepositoryPassword() { 29 | return findProperty('repositoryPassword') ? property('repositoryPassword') : "" 30 | } 31 | 32 | def configurePom(pom) { 33 | pom.groupId = GROUP 34 | pom.artifactId = POM_ARTIFACT_ID 35 | pom.version = VERSION_NAME 36 | 37 | pom.project { 38 | name POM_NAME 39 | packaging POM_PACKAGING 40 | description POM_DESCRIPTION 41 | url POM_URL 42 | 43 | scm { 44 | url POM_SCM_URL 45 | connection POM_SCM_CONNECTION 46 | developerConnection POM_SCM_DEV_CONNECTION 47 | } 48 | 49 | licenses { 50 | license { 51 | name POM_LICENCE_NAME 52 | url POM_LICENCE_URL 53 | distribution POM_LICENCE_DIST 54 | } 55 | } 56 | 57 | developers { 58 | developer { 59 | id POM_DEVELOPER_ID 60 | name POM_DEVELOPER_NAME 61 | } 62 | } 63 | } 64 | } 65 | 66 | afterEvaluate { project -> 67 | uploadArchives { 68 | repositories { 69 | mavenDeployer { 70 | beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } 71 | 72 | repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") { 73 | authentication(userName: getRepositoryUsername(), password: getRepositoryPassword()) 74 | } 75 | snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") { 76 | authentication(userName: getRepositoryUsername(), password: getRepositoryPassword()) 77 | } 78 | 79 | configurePom(pom) 80 | } 81 | } 82 | } 83 | 84 | task installArchives(type: Upload) { 85 | configuration = configurations.archives 86 | repositories { 87 | mavenDeployer { 88 | repository url: "file://${System.properties['user.home']}/.m2/repository" 89 | configurePom(pom) 90 | } 91 | } 92 | } 93 | 94 | signing { 95 | required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") } 96 | sign configurations.archives 97 | } 98 | 99 | task androidJavadocs(type: Javadoc) { 100 | source = android.sourceSets.main.java.srcDirs 101 | classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) 102 | if (JavaVersion.current().isJava8Compatible()) { 103 | options.addStringOption('Xdoclint:none', '-quiet') 104 | } 105 | } 106 | 107 | task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) { 108 | classifier = 'javadoc' 109 | from androidJavadocs.destinationDir 110 | } 111 | 112 | task androidSourcesJar(type: Jar) { 113 | classifier = 'sources' 114 | from android.sourceSets.main.java.sourceFiles 115 | } 116 | 117 | artifacts { 118 | archives androidSourcesJar 119 | archives androidJavadocsJar 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookarchive/shimmer-android/32b784bd9811588b4e18c4a613fdfa8ce384cd84/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Nov 03 21:30:45 KST 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.5-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 | -------------------------------------------------------------------------------- /lib/support-annotations/BUCK: -------------------------------------------------------------------------------- 1 | load("//tools/build_defs:fb_native_wrapper.bzl", "fb_native") 2 | load("//tools/build_defs/oss:shimmer_defs.bzl", "fb_core_android_library") 3 | 4 | fb_core_android_library( 5 | name = "support-annotations", 6 | visibility = ["PUBLIC"], 7 | exported_deps = [ 8 | ":support-annotations-prebuilt", 9 | ], 10 | ) 11 | 12 | fb_native.android_prebuilt_aar( 13 | name = "support-annotations-prebuilt", 14 | aar = ":support-annotations.aar", 15 | visibility = ["PUBLIC"], 16 | ) 17 | 18 | fb_native.remote_file( 19 | name = "support-annotations.aar", 20 | sha1 = "39ded76b5e1ce1c5b2688e1d25cdc20ecee32007", 21 | url = "mvn:com.android.support:support-annotations:aar:27.1.0", 22 | ) 23 | -------------------------------------------------------------------------------- /sample/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | plugins { 10 | id 'com.android.application' 11 | id 'kotlin-android' 12 | id 'kotlin-android-extensions' 13 | } 14 | 15 | android { 16 | compileSdkVersion versions.compileSdk 17 | 18 | defaultConfig { 19 | applicationId 'com.facebook.shimmer.sample' 20 | minSdkVersion versions.minSdk 21 | targetSdkVersion versions.targetSdk 22 | versionCode 1 23 | versionName '1.0' 24 | } 25 | 26 | compileOptions { 27 | sourceCompatibility JavaVersion.VERSION_1_8 28 | targetCompatibility JavaVersion.VERSION_1_8 29 | } 30 | 31 | kotlinOptions { 32 | jvmTarget = '1.8' 33 | } 34 | } 35 | 36 | dependencies { 37 | implementation deps.shimmer 38 | implementation deps.kotlinStdlib 39 | implementation deps.constraintLayout 40 | } 41 | -------------------------------------------------------------------------------- /sample/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /sample/src/main/java/com/facebook/shimmer/sample/MainActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | package com.facebook.shimmer.sample 10 | 11 | import android.animation.ValueAnimator 12 | import android.app.Activity 13 | import android.os.Bundle 14 | import android.view.View 15 | import android.widget.Button 16 | import android.widget.Toast 17 | import com.facebook.shimmer.Shimmer 18 | import com.facebook.shimmer.ShimmerFrameLayout 19 | import kotlinx.android.synthetic.main.main.* 20 | 21 | class MainActivity : Activity(), View.OnClickListener { 22 | private lateinit var shimmerViewContainer: ShimmerFrameLayout 23 | private lateinit var presetButtons: Array