├── .gitignore ├── .idea ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── dictionaries │ └── .xml ├── gradle.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml └── vcs.xml ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── riso │ │ └── popimager │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── riso │ │ │ └── popimager │ │ │ └── PopImageActivity.java │ └── res │ │ ├── layout │ │ └── activity_pop_image.xml │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ ├── btn.png │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ └── ic_launcher.png │ │ ├── raw │ │ ├── xinpop_n.mp3 │ │ └── xinpop_p.mp3 │ │ ├── values-w820dp │ │ └── dimens.xml │ │ └── values │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── riso │ └── popimager │ └── ExampleUnitTest.java ├── build.gradle ├── demo.gif ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── popimagelibs ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── riso │ │ └── popimagelibs │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── riso │ │ │ └── popimagelibs │ │ │ └── PopImage.java │ └── res │ │ ├── drawable │ │ ├── baozha21.png │ │ ├── baozha22.png │ │ ├── baozha23.png │ │ ├── baozha24.png │ │ ├── baozha25.png │ │ ├── zhendonghua_baozha.xml │ │ └── zhendonghua_baozha1.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ ├── onexin01.png │ │ ├── onexin02.png │ │ ├── onexin03.png │ │ ├── onexin04.png │ │ ├── onexin05.png │ │ ├── onexin06.png │ │ ├── xin01.png │ │ ├── xin02.png │ │ ├── xin03.png │ │ ├── xin04.png │ │ ├── xin05.png │ │ ├── xin06.png │ │ ├── xin08.png │ │ ├── xin09.png │ │ ├── xin10.png │ │ ├── xin11.png │ │ └── xin12.png │ │ ├── raw │ │ ├── xinpop_n.mp3 │ │ └── xinpop_p.mp3 │ │ └── values │ │ └── strings.xml │ └── test │ └── java │ └── com │ └── riso │ └── popimagelibs │ └── ExampleUnitTest.java ├── settings.gradle └── unnamed.patch /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/dictionaries/.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 19 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | Android 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 62 | 63 | 64 | 65 | 66 | 1.8 67 | 68 | 73 | 74 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PopImage 2 | 让View,添加发射桃心的功能,有中奖几率以及事件监听 3 | 4 | ![image](https://github.com/wanglicong/PopImage/blob/master/demo.gif) 5 | 6 | 7 | ### 使用方法: 8 | 9 | # 步骤 1: 10 | 将这几行代码复制到 app里的gradl文件dependencies 行 的>>上<<面 11 | 12 | allprojects { 13 | repositories { 14 | maven { url 'https://jitpack.io' } 15 | } 16 | } 17 | 将这一行代码复制到 app里的gradl文件dependencies { 的>>里<<面 18 | 19 | compile 'com.github.wanglicong:PopImage:-SNAPSHOT' 20 | 21 | 22 | 23 | # 步骤2: 24 | 找到最 外层 的RelativeLayout布局 和 需要 设置 特效的 View ; 25 | 26 | 例如: 27 | 28 | RelativeLayout relativeLayout= (RelativeLayout) findViewById(R.id.activity_main); 29 | Button btn=(Button)findViewById(R.id.btn); 30 | //创建吐心对象 31 | popImage = new PopImage(relativeLayout, btn); 32 | 33 | 34 | 好了可以运行查看基本效果了 35 | 36 | 37 | 38 | ### 更多 可选 设置 ================================= 39 | 40 | popImage.setAnimSpeed(500); //设置子弹的速度 默认400 41 | popImage.setColseSound(true); //设置声音 true关闭 false打开 42 | popImage.setLOCATION(1f); //设置出现的位置 范围(0.0f~1.0f) 43 | popImage.setOffset(0.1f);//设置上下偏移 默认是0.1f 44 | popImage.setScaleAnimOrSize(1.3f);//设置按钮的缩放倍数 默认1.3f 45 | popImage.setWin(10);//设置中奖几率 默认是3; 公式1/? 46 | //设置监听 47 | popImage.setOnPopListener(new PopImage.OnPopListener() { 48 | @Override 49 | public void win() { //中奖监听 50 | Toast.makeText(PopImageActivity.this,"中奖",Toast.LENGTH_SHORT).show(); 51 | } 52 | 53 | @Override 54 | public void noWin() { //没中间监听 55 | } 56 | 57 | @Override 58 | public void txOnTouch(View view, MotionEvent motionEvent) { 59 | // iv = (ImageView) findViewById(R.id.iv)的触摸事件 60 | } 61 | }); 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 25 5 | buildToolsVersion "25.0.0" 6 | defaultConfig { 7 | applicationId "com.riso.popimager" 8 | minSdkVersion 14 9 | targetSdkVersion 25 10 | versionCode 1 11 | versionName "1.0" 12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(include: ['*.jar'], dir: 'libs') 24 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 25 | exclude group: 'com.android.support', module: 'support-annotations' 26 | }) 27 | testCompile 'junit:junit:4.12' 28 | compile project(':popimagelibs') 29 | } 30 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in G:\Users\Riso\AppData\Local\Android\sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/riso/popimager/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.riso.popimager; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.riso.popimager", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/java/com/riso/popimager/PopImageActivity.java: -------------------------------------------------------------------------------- 1 | package com.riso.popimager; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | import android.view.View; 6 | import android.widget.ImageView; 7 | import android.widget.RelativeLayout; 8 | 9 | import com.riso.popimagelibs.PopImage; 10 | 11 | public class PopImageActivity extends Activity { 12 | 13 | private ImageView iv; 14 | private PopImage popImage; 15 | 16 | @Override 17 | protected void onCreate(Bundle savedInstanceState) { 18 | super.onCreate(savedInstanceState); 19 | //需要 外层RelativeLayout 20 | RelativeLayout rootView = (RelativeLayout) View.inflate(this, R.layout.activity_pop_image, null); 21 | //设置ContentView 22 | setContentView(rootView); 23 | //找控件 24 | iv = (ImageView) findViewById(R.id.iv); 25 | //一行代码搞定 26 | popImage = new PopImage(rootView, iv); 27 | 28 | 29 | 30 | 31 | //更多 可选 设置 ====== ======== =================== 32 | /* popImage.setAnimSpeed(500); //设置 子弹 的速度 33 | popImage.setColseSound(true); //设置声音 关闭 34 | popImage.setLOCATION(1f); //设置 出现的 位置 左边 35 | //设置监听 36 | popImage.setOnPopListener(new PopImage.OnPopListener() { 37 | @Override 38 | public void win() { 39 | Toast.makeText(PopImageActivity.this,"中奖",Toast.LENGTH_SHORT).show(); 40 | } 41 | 42 | @Override 43 | public void noWin() { 44 | 45 | } 46 | 47 | @Override 48 | public void txOnTouch(View view, MotionEvent motionEvent) { 49 | // iv = (ImageView) findViewById(R.id.iv)的触摸事件 50 | } 51 | });*/ 52 | 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_pop_image.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 17 | 18 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglicong/PopImage/4dbc14583927c26be65e3f12b498f8ea0f8a3e80/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglicong/PopImage/4dbc14583927c26be65e3f12b498f8ea0f8a3e80/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglicong/PopImage/4dbc14583927c26be65e3f12b498f8ea0f8a3e80/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/btn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglicong/PopImage/4dbc14583927c26be65e3f12b498f8ea0f8a3e80/app/src/main/res/mipmap-xxhdpi/btn.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglicong/PopImage/4dbc14583927c26be65e3f12b498f8ea0f8a3e80/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglicong/PopImage/4dbc14583927c26be65e3f12b498f8ea0f8a3e80/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/raw/xinpop_n.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglicong/PopImage/4dbc14583927c26be65e3f12b498f8ea0f8a3e80/app/src/main/res/raw/xinpop_n.mp3 -------------------------------------------------------------------------------- /app/src/main/res/raw/xinpop_p.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglicong/PopImage/4dbc14583927c26be65e3f12b498f8ea0f8a3e80/app/src/main/res/raw/xinpop_p.mp3 -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | PopImager 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/test/java/com/riso/popimager/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.riso.popimager; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:2.2.2' 9 | 10 | // NOTE: Do not place your application dependencies here; they belong 11 | // in the individual module build.gradle files 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | jcenter() 18 | } 19 | } 20 | 21 | task clean(type: Delete) { 22 | delete rootProject.buildDir 23 | } 24 | -------------------------------------------------------------------------------- /demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglicong/PopImage/4dbc14583927c26be65e3f12b498f8ea0f8a3e80/demo.gif -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglicong/PopImage/4dbc14583927c26be65e3f12b498f8ea0f8a3e80/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Dec 28 10:00:20 PST 2015 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-2.14.1-all.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /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 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 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 Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /popimagelibs/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /popimagelibs/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 25 5 | buildToolsVersion "25.0.0" 6 | 7 | defaultConfig { 8 | minSdkVersion 14 9 | targetSdkVersion 25 10 | versionCode 1 11 | versionName "1.0" 12 | 13 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 14 | 15 | } 16 | buildTypes { 17 | release { 18 | minifyEnabled false 19 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 20 | } 21 | } 22 | } 23 | 24 | dependencies { 25 | compile fileTree(dir: 'libs', include: ['*.jar']) 26 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 27 | exclude group: 'com.android.support', module: 'support-annotations' 28 | }) 29 | compile 'com.android.support:appcompat-v7:25.0.0' 30 | testCompile 'junit:junit:4.12' 31 | } 32 | -------------------------------------------------------------------------------- /popimagelibs/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in G:\Users\Riso\AppData\Local\Android\sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /popimagelibs/src/androidTest/java/com/riso/popimagelibs/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.riso.popimagelibs; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.riso.popimagelibs.test", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /popimagelibs/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /popimagelibs/src/main/java/com/riso/popimagelibs/PopImage.java: -------------------------------------------------------------------------------- 1 | package com.riso.popimagelibs; 2 | 3 | import android.content.Context; 4 | import android.graphics.drawable.AnimationDrawable; 5 | import android.media.MediaPlayer; 6 | import android.os.Handler; 7 | import android.os.Message; 8 | import android.view.MotionEvent; 9 | import android.view.View; 10 | import android.view.animation.Animation; 11 | import android.view.animation.ScaleAnimation; 12 | import android.view.animation.TranslateAnimation; 13 | import android.widget.ImageView; 14 | import android.widget.RelativeLayout; 15 | 16 | import java.util.ArrayList; 17 | import java.util.Random; 18 | 19 | /** 20 | * Created by 王黎聪 on 2014/12/2. 21 | */ 22 | 23 | public class PopImage implements View.OnTouchListener { 24 | 25 | private OnPopListener onPopListener; //接口回调 监听 26 | private Random random; // 随机动画 27 | private RelativeLayout rootView; //根布局 28 | private View txView; //需要添加特效的控件 29 | private Context context; //上下文 30 | private int rlWidth, rlHeight; //rootView的宽和高 31 | private float viewZoom=1.3f; // 特效View 要方法的倍数 32 | private ScaleAnimation viewZoomAnim;// 特效View的放大动画 33 | private int winSize=3;// 中奖的几率 34 | private int animSpeed=400;// 桃心飘逸的速度 35 | private ImageView targIV; // 要展示 目标的ImageView 36 | private ArrayList al_bullet; //放子弹的集合 37 | private ArrayList al_targImages; //目标ImageView 的图片集合 38 | private int bulletCount; //发射的次数 39 | private int nextX; //targImage下一次位置的x坐标 40 | private int nextY; //targImage下一次位置的y坐标 41 | private TranslateAnimation translateAnimBullet;//射击的动画 42 | private float LOCATION; //发射的位置 43 | private float offset=0.1f; //设置偏移 44 | private boolean targIsShow; //判断图片是否在显示 45 | 46 | private int index; //targImage 显示的第几张图片 47 | private MediaPlayer soundPop_n; //没中奖的声音 48 | private MediaPlayer soundPop_p; //中奖的声音 49 | private boolean iscloseSound; //是否关闭声音 50 | 51 | private AnimationDrawable animBaozha; //没中奖的帧动画 52 | private AnimationDrawable animBaozha1; //中奖的帧动画 53 | 54 | 55 | /** 56 | * 构造器 57 | * @param rootView 根布局(目前只支持RelativeLayout) 58 | * @param txView 需要设置特效的View 59 | */ 60 | public PopImage(RelativeLayout rootView, View txView) { 61 | //初始化 62 | this.rootView = rootView; 63 | this.txView = txView; 64 | this.context = rootView.getContext(); 65 | //获取rootView 的宽和高 66 | rlWidth = rootView.getResources().getDisplayMetrics().widthPixels; 67 | rlHeight = rootView.getResources().getDisplayMetrics().heightPixels; 68 | if (rlWidth<150||rlHeight<150){ 69 | throw new RuntimeException("您的rootView的宽和高必须大于150px >>建议最外层使用全屏的RelativeLayout"); 70 | } 71 | //初始化数据 72 | initData(); 73 | //设置特效的View的变大动画 74 | setScaleAnimOrSize(viewZoom); 75 | //设置触摸事件 76 | txView.setOnTouchListener(this); 77 | } 78 | 79 | /** 80 | * 设置特效View的放大动画,或大小.默认有动画 81 | * @param zoomToUp 最好在0.5~1.5之间,>>如果设置为0将取消动画效果 82 | */ 83 | public void setScaleAnimOrSize(float zoomToUp) { 84 | if (zoomToUp<=0){ 85 | viewZoomAnim=null; 86 | }else{ 87 | if (zoomToUp>2)zoomToUp=2; 88 | viewZoomAnim = new ScaleAnimation(1, zoomToUp, 1, zoomToUp, Animation.RELATIVE_TO_SELF,0.5f, Animation.RELATIVE_TO_SELF,0.5f); 89 | viewZoomAnim.setDuration(80); 90 | viewZoomAnim.setFillAfter(false); 91 | } 92 | } 93 | 94 | /** 95 | * 设置pop 的 事件监听 96 | * @param onPopListener 事件监听 97 | */ 98 | public void setOnPopListener(OnPopListener onPopListener){ 99 | this.onPopListener=onPopListener; 100 | } 101 | 102 | /** 103 | * 设置子弹的速度 104 | * @param animSpeed 设置子弹的速度 默认 400 , 不能小于 100 105 | */ 106 | public void setAnimSpeed(int animSpeed){ 107 | if (animSpeed<100) animSpeed=100; 108 | this.animSpeed=animSpeed; 109 | } 110 | 111 | /** 112 | * 设置发射的起始方向 113 | * @param location 0.5->>是中间 1->>是右边 0->>是左边 114 | */ 115 | public void setLOCATION(float location){ 116 | location*=-1f; 117 | if (location>0) location=0; 118 | if (location<-1) location=-1; 119 | LOCATION=location; 120 | } 121 | 122 | /** 123 | * //设置开始关闭声音 124 | * @param iscloseSound true 代表关闭 false 代表打开 125 | */ 126 | public void setColseSound(boolean iscloseSound){ 127 | this.iscloseSound=iscloseSound; 128 | } 129 | 130 | /** 131 | * 设置中奖几率 132 | * @param win 1是100%中奖 数值越大中奖几率 越小 公式 1/win 中奖几率 133 | */ 134 | public void setWin(int win){ 135 | if (win<=0) win=1; 136 | winSize=win; 137 | } 138 | 139 | /** 140 | * 设置上下偏差 141 | * @param offset 默认是0.1f ,如果有偏差 请设置 0f尝试 142 | */ 143 | public void setOffset(float offset){ 144 | if(offset<0) offset=0; 145 | this.offset=offset; 146 | } 147 | 148 | //添加子弹 149 | private void addBullet() { 150 | 151 | if (!targIsShow){ 152 | targIsShow=true; 153 | bulletCount=0; 154 | //添加目标tagView 155 | targIV.setImageResource(al_targImages.get(bulletCount)); 156 | int xinSize=rlWidth/10; 157 | rootView.addView(targIV,xinSize,xinSize); // ??? 158 | //设置位置 159 | nextX = random.nextInt(rlWidth); 160 | nextY = random.nextInt(rlWidth); 161 | if (nextX>rlWidth/2){ 162 | nextX-=xinSize; 163 | } 164 | targIV.setX(nextX); 165 | targIV.setY(nextY); 166 | }else{ 167 | //添加子弹 168 | addBullets(); 169 | } 170 | } 171 | 172 | private void addBullets() { 173 | if (bulletCount>=6) return; 174 | //设置子弹的大小 175 | int xinSize=rlWidth/12; 176 | final ImageView imageView = al_bullet.get(bulletCount++); 177 | //添加ImageView 178 | rootView.addView(imageView,xinSize,xinSize); 179 | //设置子弹的起始位置 180 | imageView.setX(rlWidth); 181 | imageView.setY(rlHeight); 182 | 183 | //获取屏幕位置的比例值 184 | float nx=(float)(1.0f-(nextX*1.0/rlWidth))*-1f; 185 | float ny=(float)(1.0f-(nextY*1.0/rlHeight))*-1f; 186 | ny+=ny*offset; 187 | 188 | //创建动画 189 | translateAnimBullet = new TranslateAnimation(Animation.RELATIVE_TO_PARENT,LOCATION, Animation.RELATIVE_TO_PARENT, nx, Animation.RELATIVE_TO_PARENT, 0, Animation.RELATIVE_TO_PARENT, ny); 190 | translateAnimBullet.setDuration(animSpeed); 191 | translateAnimBullet.setFillAfter(true); 192 | translateAnimBullet.setAnimationListener(new Animation.AnimationListener() { 193 | @Override 194 | public void onAnimationStart(Animation animation) { 195 | 196 | } 197 | @Override 198 | public void onAnimationEnd(Animation animation) { 199 | index++; 200 | 201 | if (imageView.equals(al_bullet.get(al_bullet.size()-1))){ 202 | rootView.removeView(imageView); 203 | if(random.nextInt(winSize)==winSize/2){ 204 | targIV.setImageDrawable(animBaozha1); 205 | if (!iscloseSound) soundPop_p.start(); //播放声音 206 | animBaozha1.start(); 207 | if (onPopListener!=null) onPopListener.win(); 208 | }else{ 209 | targIV.setImageDrawable(animBaozha); 210 | if (!iscloseSound) soundPop_n.start(); //播放声音 211 | animBaozha.start(); 212 | if (onPopListener!=null) onPopListener.noWin(); 213 | } 214 | 215 | handler.sendEmptyMessageDelayed(1,380); 216 | 217 | }else{ 218 | targIV.setImageResource(al_targImages.get(index)); 219 | rootView.removeView(imageView); 220 | } 221 | } 222 | @Override 223 | public void onAnimationRepeat(Animation animation) { 224 | 225 | } 226 | }); 227 | imageView.startAnimation(translateAnimBullet); 228 | } 229 | 230 | 231 | //初始化数据 232 | private void initData() { 233 | //创建随机对象 234 | random = new Random(); 235 | //创建目标ImageView 236 | targIV = new ImageView(context); 237 | 238 | //创建 桃心的集合 bullet 239 | al_bullet = new ArrayList<>(); 240 | ImageView iv1 = new ImageView(context); 241 | ImageView iv2 = new ImageView(context); 242 | ImageView iv3 = new ImageView(context); 243 | ImageView iv4 = new ImageView(context); 244 | ImageView iv5 = new ImageView(context); 245 | ImageView iv6 = new ImageView(context); 246 | iv1.setImageResource(R.mipmap.onexin01); 247 | iv2.setImageResource(R.mipmap.onexin02); 248 | iv3.setImageResource(R.mipmap.onexin03); 249 | iv4.setImageResource(R.mipmap.onexin04); 250 | iv5.setImageResource(R.mipmap.onexin05); 251 | iv6.setImageResource(R.mipmap.onexin06); 252 | al_bullet.add(iv1); 253 | al_bullet.add(iv2); 254 | al_bullet.add(iv3); 255 | al_bullet.add(iv4); 256 | al_bullet.add(iv5); 257 | al_bullet.add(iv6); 258 | //创建 目标的 图片集合 259 | al_targImages = new ArrayList<>(); 260 | al_targImages.add(R.mipmap.xin01); 261 | al_targImages.add(R.mipmap.xin02); 262 | al_targImages.add(R.mipmap.xin03); 263 | al_targImages.add(R.mipmap.xin04); 264 | al_targImages.add(R.mipmap.xin05); 265 | al_targImages.add(R.mipmap.xin06); 266 | 267 | //初始化爆炸效果 268 | animBaozha = (AnimationDrawable)context.getResources().getDrawable(R.drawable.zhendonghua_baozha); 269 | //初始化爆炸效果 270 | animBaozha1 = (AnimationDrawable)context.getResources().getDrawable(R.drawable.zhendonghua_baozha1); 271 | //创建音效 272 | soundPop_n = MediaPlayer.create(context, R.raw.xinpop_n); 273 | soundPop_p = MediaPlayer.create(context, R.raw.xinpop_p); 274 | 275 | } 276 | 277 | private Handler handler=new Handler(){ 278 | @Override 279 | public void handleMessage(Message msg) { 280 | super.handleMessage(msg); 281 | if (msg.what==1){ 282 | index=0; 283 | rootView.removeView(targIV); 284 | targIsShow=false; 285 | } 286 | } 287 | }; 288 | 289 | 290 | public static interface OnPopListener{ 291 | /** 292 | * 中间后触发的方法回调 293 | */ 294 | void win(); 295 | /** 296 | * 没有中奖的方法回调 297 | */ 298 | void noWin(); 299 | /** 300 | * 特效 按钮 按下的 方法回调 301 | */ 302 | void txOnTouch(View view, MotionEvent motionEvent); 303 | 304 | } 305 | 306 | 307 | //重写触摸事件 308 | @Override 309 | public boolean onTouch(View view, MotionEvent motionEvent) { 310 | if (onPopListener!=null) onPopListener.txOnTouch(view, motionEvent); 311 | switch (motionEvent.getAction()) { 312 | case MotionEvent.ACTION_DOWN: 313 | if(viewZoomAnim!=null){ 314 | view.startAnimation(viewZoomAnim); 315 | } 316 | addBullet(); 317 | break; 318 | case MotionEvent.ACTION_UP: 319 | break; 320 | } 321 | return false; 322 | } 323 | } 324 | -------------------------------------------------------------------------------- /popimagelibs/src/main/res/drawable/baozha21.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglicong/PopImage/4dbc14583927c26be65e3f12b498f8ea0f8a3e80/popimagelibs/src/main/res/drawable/baozha21.png -------------------------------------------------------------------------------- /popimagelibs/src/main/res/drawable/baozha22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglicong/PopImage/4dbc14583927c26be65e3f12b498f8ea0f8a3e80/popimagelibs/src/main/res/drawable/baozha22.png -------------------------------------------------------------------------------- /popimagelibs/src/main/res/drawable/baozha23.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglicong/PopImage/4dbc14583927c26be65e3f12b498f8ea0f8a3e80/popimagelibs/src/main/res/drawable/baozha23.png -------------------------------------------------------------------------------- /popimagelibs/src/main/res/drawable/baozha24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglicong/PopImage/4dbc14583927c26be65e3f12b498f8ea0f8a3e80/popimagelibs/src/main/res/drawable/baozha24.png -------------------------------------------------------------------------------- /popimagelibs/src/main/res/drawable/baozha25.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglicong/PopImage/4dbc14583927c26be65e3f12b498f8ea0f8a3e80/popimagelibs/src/main/res/drawable/baozha25.png -------------------------------------------------------------------------------- /popimagelibs/src/main/res/drawable/zhendonghua_baozha.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /popimagelibs/src/main/res/drawable/zhendonghua_baozha1.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /popimagelibs/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglicong/PopImage/4dbc14583927c26be65e3f12b498f8ea0f8a3e80/popimagelibs/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /popimagelibs/src/main/res/mipmap-hdpi/onexin01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglicong/PopImage/4dbc14583927c26be65e3f12b498f8ea0f8a3e80/popimagelibs/src/main/res/mipmap-hdpi/onexin01.png -------------------------------------------------------------------------------- /popimagelibs/src/main/res/mipmap-hdpi/onexin02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglicong/PopImage/4dbc14583927c26be65e3f12b498f8ea0f8a3e80/popimagelibs/src/main/res/mipmap-hdpi/onexin02.png -------------------------------------------------------------------------------- /popimagelibs/src/main/res/mipmap-hdpi/onexin03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglicong/PopImage/4dbc14583927c26be65e3f12b498f8ea0f8a3e80/popimagelibs/src/main/res/mipmap-hdpi/onexin03.png -------------------------------------------------------------------------------- /popimagelibs/src/main/res/mipmap-hdpi/onexin04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglicong/PopImage/4dbc14583927c26be65e3f12b498f8ea0f8a3e80/popimagelibs/src/main/res/mipmap-hdpi/onexin04.png -------------------------------------------------------------------------------- /popimagelibs/src/main/res/mipmap-hdpi/onexin05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglicong/PopImage/4dbc14583927c26be65e3f12b498f8ea0f8a3e80/popimagelibs/src/main/res/mipmap-hdpi/onexin05.png -------------------------------------------------------------------------------- /popimagelibs/src/main/res/mipmap-hdpi/onexin06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglicong/PopImage/4dbc14583927c26be65e3f12b498f8ea0f8a3e80/popimagelibs/src/main/res/mipmap-hdpi/onexin06.png -------------------------------------------------------------------------------- /popimagelibs/src/main/res/mipmap-hdpi/xin01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglicong/PopImage/4dbc14583927c26be65e3f12b498f8ea0f8a3e80/popimagelibs/src/main/res/mipmap-hdpi/xin01.png -------------------------------------------------------------------------------- /popimagelibs/src/main/res/mipmap-hdpi/xin02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglicong/PopImage/4dbc14583927c26be65e3f12b498f8ea0f8a3e80/popimagelibs/src/main/res/mipmap-hdpi/xin02.png -------------------------------------------------------------------------------- /popimagelibs/src/main/res/mipmap-hdpi/xin03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglicong/PopImage/4dbc14583927c26be65e3f12b498f8ea0f8a3e80/popimagelibs/src/main/res/mipmap-hdpi/xin03.png -------------------------------------------------------------------------------- /popimagelibs/src/main/res/mipmap-hdpi/xin04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglicong/PopImage/4dbc14583927c26be65e3f12b498f8ea0f8a3e80/popimagelibs/src/main/res/mipmap-hdpi/xin04.png -------------------------------------------------------------------------------- /popimagelibs/src/main/res/mipmap-hdpi/xin05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglicong/PopImage/4dbc14583927c26be65e3f12b498f8ea0f8a3e80/popimagelibs/src/main/res/mipmap-hdpi/xin05.png -------------------------------------------------------------------------------- /popimagelibs/src/main/res/mipmap-hdpi/xin06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglicong/PopImage/4dbc14583927c26be65e3f12b498f8ea0f8a3e80/popimagelibs/src/main/res/mipmap-hdpi/xin06.png -------------------------------------------------------------------------------- /popimagelibs/src/main/res/mipmap-hdpi/xin08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglicong/PopImage/4dbc14583927c26be65e3f12b498f8ea0f8a3e80/popimagelibs/src/main/res/mipmap-hdpi/xin08.png -------------------------------------------------------------------------------- /popimagelibs/src/main/res/mipmap-hdpi/xin09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglicong/PopImage/4dbc14583927c26be65e3f12b498f8ea0f8a3e80/popimagelibs/src/main/res/mipmap-hdpi/xin09.png -------------------------------------------------------------------------------- /popimagelibs/src/main/res/mipmap-hdpi/xin10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglicong/PopImage/4dbc14583927c26be65e3f12b498f8ea0f8a3e80/popimagelibs/src/main/res/mipmap-hdpi/xin10.png -------------------------------------------------------------------------------- /popimagelibs/src/main/res/mipmap-hdpi/xin11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglicong/PopImage/4dbc14583927c26be65e3f12b498f8ea0f8a3e80/popimagelibs/src/main/res/mipmap-hdpi/xin11.png -------------------------------------------------------------------------------- /popimagelibs/src/main/res/mipmap-hdpi/xin12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglicong/PopImage/4dbc14583927c26be65e3f12b498f8ea0f8a3e80/popimagelibs/src/main/res/mipmap-hdpi/xin12.png -------------------------------------------------------------------------------- /popimagelibs/src/main/res/raw/xinpop_n.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglicong/PopImage/4dbc14583927c26be65e3f12b498f8ea0f8a3e80/popimagelibs/src/main/res/raw/xinpop_n.mp3 -------------------------------------------------------------------------------- /popimagelibs/src/main/res/raw/xinpop_p.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wanglicong/PopImage/4dbc14583927c26be65e3f12b498f8ea0f8a3e80/popimagelibs/src/main/res/raw/xinpop_p.mp3 -------------------------------------------------------------------------------- /popimagelibs/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | PopImageLibs 3 | 4 | -------------------------------------------------------------------------------- /popimagelibs/src/test/java/com/riso/popimagelibs/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.riso.popimagelibs; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':popimagelibs' 2 | -------------------------------------------------------------------------------- /unnamed.patch: -------------------------------------------------------------------------------- 1 | Index: app/src/main/java/com/riso/popimager/PopImageActivity.java 2 | IDEA additional info: 3 | Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP 4 | <+>UTF-8 5 | =================================================================== 6 | --- app/src/main/java/com/riso/popimager/PopImageActivity.java (revision ) 7 | +++ app/src/main/java/com/riso/popimager/PopImageActivity.java (revision ) 8 | @@ -0,0 +1,52 @@ 9 | +package com.riso.popimager; 10 | + 11 | +import android.app.Activity; 12 | +import android.os.Bundle; 13 | +import android.view.MotionEvent; 14 | +import android.view.View; 15 | +import android.widget.ImageView; 16 | +import android.widget.RelativeLayout; 17 | +import android.widget.Toast; 18 | + 19 | +public class PopImageActivity extends Activity { 20 | + 21 | + private ImageView iv; 22 | + private PopImage popImage; 23 | + 24 | + @Override 25 | + protected void onCreate(Bundle savedInstanceState) { 26 | + super.onCreate(savedInstanceState); 27 | + //需要 外层RelativeLayout 28 | + RelativeLayout rootView = (RelativeLayout) View.inflate(this, R.layout.activity_pop_image, null); 29 | + //设置ContentView 30 | + setContentView(rootView); 31 | + //找控件 32 | + iv = (ImageView) findViewById(R.id.iv); 33 | + //一行代码搞定 34 | + popImage = new PopImage(rootView, iv); 35 | + 36 | + 37 | + //更多 可选 设置 ================================= 38 | + /* popImage.setAnimSpeed(500); //设置 子弹 的速度 39 | + popImage.setColseSound(true); //设置声音 关闭 40 | + popImage.setLOCATION(1f); //设置 出现的 位置 左边 41 | + //设置监听 42 | + popImage.setOnPopListener(new PopImage.OnPopListener() { 43 | + @Override 44 | + public void win() { 45 | + Toast.makeText(PopImageActivity.this,"中奖",Toast.LENGTH_SHORT).show(); 46 | + } 47 | + 48 | + @Override 49 | + public void noWin() { 50 | + 51 | + } 52 | + 53 | + @Override 54 | + public void txOnTouch(View view, MotionEvent motionEvent) { 55 | + 56 | + } 57 | + });*/ 58 | + 59 | + } 60 | +} 61 | --------------------------------------------------------------------------------