├── .gitignore ├── .gradle └── 2.4 │ └── taskArtifacts │ ├── cache.properties │ ├── cache.properties.lock │ ├── fileHashes.bin │ ├── fileSnapshots.bin │ ├── outputFileStates.bin │ └── taskArtifacts.bin ├── .idea ├── .name ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── gradle.xml ├── misc.xml ├── modules.xml ├── vcs.xml └── workspace.xml ├── README.md ├── app ├── .gitignore ├── app.iml ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── explosionfield │ │ └── azz │ │ └── com │ │ └── azexplosionfield │ │ └── ApplicationTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── explosionfield │ │ │ └── azz │ │ │ └── com │ │ │ └── azexplosionfield │ │ │ ├── MainActivity.java │ │ │ ├── explosion │ │ │ ├── ExplosionAnimator.java │ │ │ ├── ExplosionField.java │ │ │ └── Particle.java │ │ │ └── utils │ │ │ └── Utils.java │ └── res │ │ ├── assets │ │ └── azexplosion_white_bg.gif │ │ ├── drawable │ │ ├── azz.png │ │ ├── baidu_map.png │ │ ├── bao1.jpg │ │ ├── changba.png │ │ ├── gaode_map.png │ │ ├── iqiyi.png │ │ ├── jd.png │ │ ├── lm.png │ │ ├── p1.webp │ │ ├── p2.webp │ │ ├── p3.webp │ │ ├── p4.webp │ │ ├── p5.webp │ │ ├── p6.webp │ │ ├── qq.png │ │ ├── qq_music.png │ │ ├── qzone.png │ │ ├── tb.png │ │ ├── vx.png │ │ └── wb.png │ │ ├── layout │ │ ├── activity_main.xml │ │ ├── activity_main_1.xml │ │ └── activity_main_az.xml │ │ ├── menu │ │ └── menu_main.xml │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ │ ├── values-w820dp │ │ └── dimens.xml │ │ └── values │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── explosionfield │ └── azz │ └── com │ └── azexplosionfield │ └── ExampleUnitTest.java ├── build.gradle ├── build └── intermediates │ ├── dex-cache │ └── cache.xml │ └── gradle_project_sync_data.bin ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── local.properties └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | /local.properties 3 | /.idea/workspace.xml 4 | /.idea/libraries 5 | .DS_Store 6 | /build 7 | /captures 8 | -------------------------------------------------------------------------------- /.gradle/2.4/taskArtifacts/cache.properties: -------------------------------------------------------------------------------- 1 | #Thu Nov 19 11:18:35 CST 2015 2 | -------------------------------------------------------------------------------- /.gradle/2.4/taskArtifacts/cache.properties.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oubowu/AZExplosion/e7dd7406fd2b701cfab7c27fd21f3e3d6dd21bdc/.gradle/2.4/taskArtifacts/cache.properties.lock -------------------------------------------------------------------------------- /.gradle/2.4/taskArtifacts/fileHashes.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oubowu/AZExplosion/e7dd7406fd2b701cfab7c27fd21f3e3d6dd21bdc/.gradle/2.4/taskArtifacts/fileHashes.bin -------------------------------------------------------------------------------- /.gradle/2.4/taskArtifacts/fileSnapshots.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oubowu/AZExplosion/e7dd7406fd2b701cfab7c27fd21f3e3d6dd21bdc/.gradle/2.4/taskArtifacts/fileSnapshots.bin -------------------------------------------------------------------------------- /.gradle/2.4/taskArtifacts/outputFileStates.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oubowu/AZExplosion/e7dd7406fd2b701cfab7c27fd21f3e3d6dd21bdc/.gradle/2.4/taskArtifacts/outputFileStates.bin -------------------------------------------------------------------------------- /.gradle/2.4/taskArtifacts/taskArtifacts.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oubowu/AZExplosion/e7dd7406fd2b701cfab7c27fd21f3e3d6dd21bdc/.gradle/2.4/taskArtifacts/taskArtifacts.bin -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | AZExplosionField -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.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 | Android 39 | 40 | 41 | Android Lint 42 | 43 | 44 | C/C++ 45 | 46 | 47 | Class structureJava 48 | 49 | 50 | Control flow issuesJava 51 | 52 | 53 | Error handlingJava 54 | 55 | 56 | General 57 | 58 | 59 | Groovy 60 | 61 | 62 | HTML 63 | 64 | 65 | ImportsJava 66 | 67 | 68 | Internationalization issues 69 | 70 | 71 | Internationalization issuesJava 72 | 73 | 74 | J2ME issuesJava 75 | 76 | 77 | JSON 78 | 79 | 80 | Java 81 | 82 | 83 | JavaFX 84 | 85 | 86 | Javadoc issuesJava 87 | 88 | 89 | Manifest 90 | 91 | 92 | OtherGroovy 93 | 94 | 95 | Portability issuesJava 96 | 97 | 98 | Potentially confusing code constructsGroovy 99 | 100 | 101 | Probable bugsJava 102 | 103 | 104 | Properties Files 105 | 106 | 107 | Properties FilesJava 108 | 109 | 110 | RELAX NG 111 | 112 | 113 | Resource management issuesJava 114 | 115 | 116 | TestNG 117 | 118 | 119 | Threading issuesJava 120 | 121 | 122 | Unused codeC/C++ 123 | 124 | 125 | Validity issuesGroovy 126 | 127 | 128 | XML 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 150 | 151 | 152 | 153 | 154 | 155 | 160 | 161 | 162 | 163 | 164 | 165 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/workspace.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 32 | 33 | 34 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 127 | 128 | 152 | 1236 | 1241 | 1550 | 1553 | 1554 | 1555 | 1569 | 1570 | 1571 | 1576 | 1577 | 1578 | 1579 | 1580 | 1581 | 1582 | 1583 | 1584 | 1587 | 1588 | 1589 | 1590 | 1591 | 1592 | 1593 | 1594 | 1595 | 1596 | 1597 | 1598 | 1599 | 1600 | 1601 | 1602 | 1603 | 1604 | 1605 | 1606 | 1607 | 1608 | 1609 | 1610 | 1611 | 1612 | 1613 | 1614 | 1615 | 1618 | 1619 | 1622 | 1623 | 1624 | 1625 | 1628 | 1629 | 1632 | 1633 | 1636 | 1637 | 1638 | 1639 | 1642 | 1643 | 1646 | 1647 | 1650 | 1651 | 1654 | 1655 | 1656 | 1657 | 1660 | 1661 | 1664 | 1665 | 1668 | 1669 | 1672 | 1673 | 1674 | 1675 | 1678 | 1679 | 1682 | 1683 | 1686 | 1687 | 1688 | 1689 | 1692 | 1693 | 1696 | 1697 | 1698 | 1699 | 1700 | 1701 | 1702 | 1703 | 1704 | 1705 | 1708 | 1709 | 1710 | 1711 | 1714 | 1715 | 1718 | 1719 | 1720 | 1721 | 1724 | 1725 | 1728 | 1729 | 1732 | 1733 | 1734 | 1735 | 1738 | 1739 | 1742 | 1743 | 1746 | 1747 | 1750 | 1751 | 1752 | 1753 | 1756 | 1757 | 1760 | 1761 | 1764 | 1765 | 1768 | 1769 | 1772 | 1773 | 1774 | 1775 | 1778 | 1779 | 1782 | 1783 | 1786 | 1787 | 1790 | 1791 | 1794 | 1795 | 1798 | 1799 | 1800 | 1801 | 1802 | 1803 | 1804 | 1805 | 1806 | 1807 | 1808 | 1809 | 1810 | 1811 | 1812 | 1813 | 1814 | 1815 | 1816 | 1817 | 1818 | 1819 | 1820 | 1821 | 1822 | 1823 | 1824 | 1825 | 1826 | 1827 | 1828 | 1857 | 1858 | 1859 | 1888 | 1889 | 1890 | 1903 | 1904 | 1905 | 1906 | 1920 | 1921 | 1922 | 1923 | 1924 | 1925 | 1926 | 1927 | 1928 | 1929 | 1930 | 1937 | 1938 | 1939 | 1940 | 1958 | 1965 | 1966 | 1967 | 1996 | 1997 | 1998 | 1999 | 2000 | 2008 | 2009 | 2011 | 2012 | localhost 2013 | 5050 2014 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 2023 | 1447981417776 2024 | 2027 | 2028 | 1448072436719 2029 | 2033 | 2034 | 1448076404505 2035 | 2039 | 2042 | 2043 | 2044 | 2045 | 2046 | 2047 | 2048 | 2049 | 2050 | 2051 | 2052 | 2053 | 2054 | 2055 | 2056 | 2057 | 2058 | 2059 | 2060 | 2061 | 2062 | 2063 | 2064 | 2065 | 2066 | 2067 | 2068 | 2069 | 2070 | 2071 | 2072 | 2073 | 2074 | 2075 | 2076 | 2077 | 2080 | 2083 | 2084 | 2085 | 2087 | 2088 | 2089 | 2090 | 2092 | 2093 | 2094 | 2096 | 2097 | 2098 | 2099 | 2100 | 2101 | 2102 | 2103 | 2104 | 2105 | 2106 | 2107 | 2108 | 2109 | 2110 | 2111 | 2112 | 2113 | 2114 | 2115 | 2116 | 2117 | 2118 | 2119 | 2120 | 2121 | 2122 | 2123 | 2124 | 2125 | 2126 | 2127 | 2128 | 2129 | 2130 | 2131 | 2132 | 2133 | 2134 | 2135 | 2136 | 2137 | 2138 | 2139 | 2140 | 2141 | 2142 | 2143 | 2144 | 2145 | 2146 | 2147 | 2148 | 2149 | 2150 | 2151 | 2152 | 2153 | 2154 | 2155 | 2156 | 2157 | 2158 | 2159 | 2160 | 2161 | 2162 | 2163 | 2164 | 2165 | 2166 | 2167 | 2168 | 2169 | 2170 | 2171 | 2172 | 2173 | 2174 | 2175 | 2176 | 2177 | 2178 | 2179 | 2180 | 2181 | 2182 | 2183 | 2184 | 2185 | 2186 | 2187 | 2188 | 2189 | 2190 | 2191 | 2192 | 2193 | 2194 | 2195 | 2196 | 2197 | 2198 | 2199 | 2200 | 2201 | 2202 | 2203 | 2204 | 2205 | 2206 | 2207 | 2208 | 2209 | 2210 | 2211 | 2212 | 2213 | 2214 | 2215 | 2216 | 2217 | 2218 | 2219 | 2220 | 2221 | 2222 | 2223 | 2224 | 2225 | 2226 | 2227 | 2228 | 2229 | 2230 | 2231 | 2232 | 2233 | 2234 | 2235 | 2236 | 2237 | 2238 | 2239 | 2240 | 2241 | 2242 | 2243 | 2244 | 2245 | 2246 | 2247 | 2248 | 2249 | 2250 | 2251 | 2252 | 2253 | 2254 | 2255 | 2256 | 2257 | 2258 | 2259 | 2260 | 2261 | 2262 | 2263 | 2264 | 2265 | 2266 | 2267 | 2268 | 2269 | 2270 | 2271 | 2272 | 2273 | 2274 | 2275 | 2276 | 2277 | 2278 | 2279 | 2280 | 2281 | 2282 | 2283 | 2284 | 2285 | 2286 | 2287 | 2288 | 2289 | 2290 | 2291 | 2292 | 2293 | 2294 | 2295 | 2296 | 2297 | 2298 | 2299 | 2300 | 2301 | 2302 | 2303 | 2304 | 2305 | 2306 | 2307 | 2308 | 2309 | 2310 | 2311 | 2312 | 2313 | 2314 | 2315 | 2316 | 2317 | 2318 | 2319 | 2320 | 2321 | 2322 | 2323 | 2324 | 2325 | 2326 | 2327 | 2328 | 2329 | 2330 | 2331 | 2332 | 2333 | 2334 | 2335 | 2336 | 2337 | 2338 | 2339 | 2340 | 2341 | 2342 | 2343 | 2344 | 2345 | 2346 | 2347 | 2348 | 2349 | 2350 | 2351 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AZExplosion 2 | 模仿ExplosionField的粒子爆炸效果 3 | 4 | 博客教程地址:http://blog.csdn.net/xieyupeng520/article/details/49951835 5 | 6 | ![](https://github.com/Xieyupeng520/AZExplosion/blob/master/app/src/main/res/assets/azexplosion_white_bg.gif) 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/app.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 23 5 | defaultConfig { 6 | applicationId "explosionfield.azz.com.azexplosionfield" 7 | minSdkVersion 19 8 | targetSdkVersion 23 9 | versionCode 1 10 | versionName "1.0" 11 | } 12 | buildTypes { 13 | release { 14 | minifyEnabled false 15 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 16 | } 17 | } 18 | productFlavors { 19 | } 20 | buildToolsVersion '19.1.0' 21 | } 22 | 23 | dependencies { 24 | compile fileTree(dir: 'libs', include: ['*.jar']) 25 | testCompile 'junit:junit:4.12' 26 | compile 'com.android.support:appcompat-v7:23.0.0' 27 | } 28 | -------------------------------------------------------------------------------- /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 /Users/jiuzhoudianqi/Development/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/explosionfield/azz/com/azexplosionfield/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package explosionfield.azz.com.azexplosionfield; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/java/explosionfield/azz/com/azexplosionfield/MainActivity.java: -------------------------------------------------------------------------------- 1 | package explosionfield.azz.com.azexplosionfield; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | 6 | import explosionfield.azz.com.azexplosionfield.explosion.ExplosionField; 7 | 8 | public class MainActivity extends Activity { 9 | @Override 10 | protected void onCreate(Bundle savedInstanceState) { 11 | super.onCreate(savedInstanceState); 12 | setContentView(R.layout.activity_main_az); 13 | 14 | ExplosionField explosionField = new ExplosionField(this); 15 | 16 | explosionField.addListener(findViewById(R.id.root)); 17 | } 18 | 19 | 20 | } 21 | -------------------------------------------------------------------------------- /app/src/main/java/explosionfield/azz/com/azexplosionfield/explosion/ExplosionAnimator.java: -------------------------------------------------------------------------------- 1 | package explosionfield.azz.com.azexplosionfield.explosion; 2 | 3 | import android.animation.ValueAnimator; 4 | import android.graphics.Bitmap; 5 | import android.graphics.Canvas; 6 | import android.graphics.Color; 7 | import android.graphics.Paint; 8 | import android.graphics.Point; 9 | import android.graphics.Rect; 10 | import android.view.View; 11 | 12 | /** 13 | * Created by azz on 15/11/19. 14 | */ 15 | public class ExplosionAnimator extends ValueAnimator{ 16 | public static final int DEFAULT_DURATION = 1500; 17 | private Particle[][] mParticles; 18 | private Paint mPaint; 19 | private View mContainer; 20 | 21 | public ExplosionAnimator(View view, Bitmap bitmap, Rect bound) { 22 | 23 | mPaint = new Paint(); 24 | mContainer = view; 25 | 26 | setFloatValues(0.0f, 1.0f); 27 | setDuration(DEFAULT_DURATION); 28 | 29 | mParticles = generateParticles(bitmap, bound); 30 | } 31 | 32 | private Particle[][] generateParticles(Bitmap bitmap, Rect bound) { 33 | int w = bound.width(); 34 | int h = bound.height(); 35 | 36 | int partW_Count = w / Particle.PART_WH; //横向个数 37 | int partH_Count = h / Particle.PART_WH; //竖向个数 38 | 39 | int bitmap_part_w = bitmap.getWidth() / partW_Count; 40 | int bitmap_part_h = bitmap.getHeight() / partH_Count; 41 | 42 | Particle[][] particles = new Particle[partH_Count][partW_Count]; 43 | Point point = null; 44 | for (int row = 0; row < partH_Count; row ++) { //行 45 | for (int column = 0; column < partW_Count; column ++) { //列 46 | //取得当前粒子所在位置的颜色 47 | int color = bitmap.getPixel(column * bitmap_part_w, row * bitmap_part_h); 48 | 49 | point = new Point(column, row); //x是列,y是行 50 | 51 | particles[row][column] = Particle.generateParticle(color, bound, point); 52 | } 53 | } 54 | 55 | return particles; 56 | } 57 | 58 | public void draw(Canvas canvas) { 59 | if(!isStarted()) { //动画结束时停止 60 | return; 61 | } 62 | for (Particle[] particle : mParticles) { 63 | for (Particle p : particle) { 64 | p.advance((Float) getAnimatedValue()); 65 | mPaint.setColor(p.color); 66 | // mPaint.setAlpha((int) (255 * p.alpha)); //只是这样设置,透明色会显示为黑色 67 | mPaint.setAlpha((int) (Color.alpha(p.color) * p.alpha)); //这样透明颜色就不是黑色了 68 | canvas.drawCircle(p.cx, p.cy, p.radius, mPaint); 69 | } 70 | } 71 | 72 | mContainer.invalidate(); 73 | } 74 | 75 | @Override 76 | public void start() { 77 | super.start(); 78 | mContainer.invalidate(); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /app/src/main/java/explosionfield/azz/com/azexplosionfield/explosion/ExplosionField.java: -------------------------------------------------------------------------------- 1 | package explosionfield.azz.com.azexplosionfield.explosion; 2 | 3 | import android.animation.Animator; 4 | import android.animation.AnimatorListenerAdapter; 5 | import android.app.Activity; 6 | import android.content.Context; 7 | import android.graphics.Bitmap; 8 | import android.graphics.Canvas; 9 | import android.graphics.Rect; 10 | import android.util.AttributeSet; 11 | import android.view.View; 12 | import android.view.ViewGroup; 13 | import android.view.Window; 14 | 15 | import java.util.ArrayList; 16 | 17 | import explosionfield.azz.com.azexplosionfield.utils.Utils; 18 | 19 | /** 20 | * Created by azz on 15/11/19. 21 | */ 22 | public class ExplosionField extends View{ 23 | private static final String TAG = "ExplosionField"; 24 | private static final Canvas mCanvas = new Canvas(); 25 | private ArrayList explosionAnimators; 26 | private View.OnClickListener onClickListener; 27 | 28 | public ExplosionField(Context context) { 29 | super(context); 30 | init(); 31 | } 32 | 33 | public ExplosionField(Context context, AttributeSet attrs) { 34 | super(context, attrs); 35 | init(); 36 | } 37 | private void init() { 38 | explosionAnimators = new ArrayList(); 39 | 40 | attach2Activity((Activity) getContext()); 41 | } 42 | @Override 43 | protected void onDraw(Canvas canvas) { 44 | super.onDraw(canvas); 45 | for (ExplosionAnimator animator : explosionAnimators) { 46 | animator.draw(canvas); 47 | } 48 | } 49 | 50 | /** 51 | * 爆破 52 | * @param view 使得该view爆破 53 | */ 54 | public void explode(final View view) { 55 | Rect rect = new Rect(); 56 | view.getGlobalVisibleRect(rect); //得到view相对于整个屏幕的坐标 57 | rect.offset(0, -Utils.dp2px(25)); //去掉状态栏高度 58 | 59 | final ExplosionAnimator animator = new ExplosionAnimator(this, createBitmapFromView(view), rect); 60 | explosionAnimators.add(animator); 61 | 62 | animator.addListener(new AnimatorListenerAdapter() { 63 | @Override 64 | public void onAnimationStart(Animator animation) { 65 | view.animate().alpha(0f).setDuration(150).start(); 66 | } 67 | 68 | @Override 69 | public void onAnimationEnd(Animator animation) { 70 | view.animate().alpha(1f).setDuration(150).start(); 71 | 72 | //动画结束时从动画集中移除 73 | explosionAnimators.remove(animation); 74 | animation = null; 75 | } 76 | }); 77 | animator.start(); 78 | } 79 | 80 | private Bitmap createBitmapFromView(View view) { 81 | /* 82 | * 为什么屏蔽以下代码段? 83 | * 如果ImageView直接得到位图,那么当它设置背景(backgroud)时,不会读取到背景颜色 84 | */ 85 | // if (view instanceof ImageView) { 86 | // Drawable drawable = ((ImageView)view).getDrawable(); 87 | // if (drawable != null && drawable instanceof BitmapDrawable) { 88 | // return ((BitmapDrawable) drawable).getBitmap(); 89 | // } 90 | // } 91 | 92 | //view.clearFocus(); //不同焦点状态显示的可能不同——(azz:不同就不同有什么关系?) 93 | 94 | Bitmap bitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888); 95 | 96 | if (bitmap != null) { 97 | synchronized (mCanvas) { 98 | mCanvas.setBitmap(bitmap); 99 | view.draw(mCanvas); 100 | mCanvas.setBitmap(null); //清除引用 101 | } 102 | } 103 | return bitmap; 104 | } 105 | 106 | /** 107 | * 给Activity加上全屏覆盖的ExplosionField 108 | */ 109 | private void attach2Activity(Activity activity) { 110 | ViewGroup rootView = (ViewGroup) activity.findViewById(Window.ID_ANDROID_CONTENT); 111 | 112 | ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams( 113 | ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); 114 | rootView.addView(this, lp); 115 | } 116 | 117 | 118 | /** 119 | * 希望谁有破碎效果,就给谁加Listener 120 | * @param view 可以是ViewGroup 121 | */ 122 | public void addListener(View view) { 123 | if (view instanceof ViewGroup) { 124 | ViewGroup viewGroup = (ViewGroup) view; 125 | int count = viewGroup.getChildCount(); 126 | for (int i = 0 ; i < count; i++) { 127 | addListener(viewGroup.getChildAt(i)); 128 | } 129 | } else { 130 | view.setClickable(true); 131 | view.setOnClickListener(getOnClickListener()); 132 | } 133 | } 134 | 135 | 136 | private OnClickListener getOnClickListener() { 137 | if (null == onClickListener) { 138 | 139 | onClickListener = new View.OnClickListener() { 140 | @Override 141 | public void onClick(View v) { 142 | ExplosionField.this.explode(v); 143 | 144 | // view.setOnClickListener(null); // 用过一次就不需要了 145 | } 146 | }; 147 | } 148 | 149 | return onClickListener; 150 | } 151 | } 152 | -------------------------------------------------------------------------------- /app/src/main/java/explosionfield/azz/com/azexplosionfield/explosion/Particle.java: -------------------------------------------------------------------------------- 1 | package explosionfield.azz.com.azexplosionfield.explosion; 2 | 3 | import android.graphics.Point; 4 | import android.graphics.Rect; 5 | 6 | import java.util.Random; 7 | 8 | /** 9 | * Created by azz on 15/11/19. 10 | * 爆破粒子 11 | */ 12 | public class Particle { 13 | 14 | public static final int PART_WH = 8; //默认小球宽高 15 | 16 | //原本的值(不可变) 17 | // float originCX; 18 | // float originCY; 19 | // float originRadius; 20 | 21 | //实际的值(可变) 22 | float cx; //center x of circle 23 | float cy; //center y of circle 24 | float radius; 25 | 26 | int color; 27 | float alpha; 28 | 29 | static Random random = new Random(); 30 | 31 | Rect mBound; 32 | 33 | public static Particle generateParticle(int color, Rect bound, Point point) { 34 | int row = point.y; //行是高 35 | int column = point.x; //列是宽 36 | 37 | Particle particle = new Particle(); 38 | particle.mBound = bound; 39 | particle.color = color; 40 | particle.alpha = 1f; 41 | 42 | particle.radius = PART_WH; 43 | particle.cx = bound.left + PART_WH * column; 44 | particle.cy = bound.top + PART_WH * row; 45 | 46 | return particle; 47 | } 48 | 49 | public void advance(float factor) { 50 | cx = cx + factor * random.nextInt(mBound.width()) * (random.nextFloat() - 0.5f); 51 | cy = cy + factor * random.nextInt(mBound.height() / 2); 52 | 53 | radius = radius - factor * random.nextInt(2); 54 | 55 | alpha = (1f - factor) * (1 + random.nextFloat()); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /app/src/main/java/explosionfield/azz/com/azexplosionfield/utils/Utils.java: -------------------------------------------------------------------------------- 1 | package explosionfield.azz.com.azexplosionfield.utils; 2 | 3 | import android.content.res.Resources; 4 | 5 | /** 6 | * Created by azz on 15/11/19. 7 | */ 8 | public class Utils { 9 | /** 10 | * 密度 11 | */ 12 | public static final float DENSITY = Resources.getSystem().getDisplayMetrics().density; 13 | 14 | public static int dp2px(int dp) { 15 | return Math.round(dp * DENSITY); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /app/src/main/res/assets/azexplosion_white_bg.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oubowu/AZExplosion/e7dd7406fd2b701cfab7c27fd21f3e3d6dd21bdc/app/src/main/res/assets/azexplosion_white_bg.gif -------------------------------------------------------------------------------- /app/src/main/res/drawable/azz.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oubowu/AZExplosion/e7dd7406fd2b701cfab7c27fd21f3e3d6dd21bdc/app/src/main/res/drawable/azz.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/baidu_map.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oubowu/AZExplosion/e7dd7406fd2b701cfab7c27fd21f3e3d6dd21bdc/app/src/main/res/drawable/baidu_map.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/bao1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oubowu/AZExplosion/e7dd7406fd2b701cfab7c27fd21f3e3d6dd21bdc/app/src/main/res/drawable/bao1.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/changba.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oubowu/AZExplosion/e7dd7406fd2b701cfab7c27fd21f3e3d6dd21bdc/app/src/main/res/drawable/changba.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/gaode_map.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oubowu/AZExplosion/e7dd7406fd2b701cfab7c27fd21f3e3d6dd21bdc/app/src/main/res/drawable/gaode_map.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/iqiyi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oubowu/AZExplosion/e7dd7406fd2b701cfab7c27fd21f3e3d6dd21bdc/app/src/main/res/drawable/iqiyi.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/jd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oubowu/AZExplosion/e7dd7406fd2b701cfab7c27fd21f3e3d6dd21bdc/app/src/main/res/drawable/jd.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/lm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oubowu/AZExplosion/e7dd7406fd2b701cfab7c27fd21f3e3d6dd21bdc/app/src/main/res/drawable/lm.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/p1.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oubowu/AZExplosion/e7dd7406fd2b701cfab7c27fd21f3e3d6dd21bdc/app/src/main/res/drawable/p1.webp -------------------------------------------------------------------------------- /app/src/main/res/drawable/p2.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oubowu/AZExplosion/e7dd7406fd2b701cfab7c27fd21f3e3d6dd21bdc/app/src/main/res/drawable/p2.webp -------------------------------------------------------------------------------- /app/src/main/res/drawable/p3.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oubowu/AZExplosion/e7dd7406fd2b701cfab7c27fd21f3e3d6dd21bdc/app/src/main/res/drawable/p3.webp -------------------------------------------------------------------------------- /app/src/main/res/drawable/p4.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oubowu/AZExplosion/e7dd7406fd2b701cfab7c27fd21f3e3d6dd21bdc/app/src/main/res/drawable/p4.webp -------------------------------------------------------------------------------- /app/src/main/res/drawable/p5.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oubowu/AZExplosion/e7dd7406fd2b701cfab7c27fd21f3e3d6dd21bdc/app/src/main/res/drawable/p5.webp -------------------------------------------------------------------------------- /app/src/main/res/drawable/p6.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oubowu/AZExplosion/e7dd7406fd2b701cfab7c27fd21f3e3d6dd21bdc/app/src/main/res/drawable/p6.webp -------------------------------------------------------------------------------- /app/src/main/res/drawable/qq.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oubowu/AZExplosion/e7dd7406fd2b701cfab7c27fd21f3e3d6dd21bdc/app/src/main/res/drawable/qq.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/qq_music.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oubowu/AZExplosion/e7dd7406fd2b701cfab7c27fd21f3e3d6dd21bdc/app/src/main/res/drawable/qq_music.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/qzone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oubowu/AZExplosion/e7dd7406fd2b701cfab7c27fd21f3e3d6dd21bdc/app/src/main/res/drawable/qzone.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/tb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oubowu/AZExplosion/e7dd7406fd2b701cfab7c27fd21f3e3d6dd21bdc/app/src/main/res/drawable/tb.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/vx.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oubowu/AZExplosion/e7dd7406fd2b701cfab7c27fd21f3e3d6dd21bdc/app/src/main/res/drawable/vx.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/wb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oubowu/AZExplosion/e7dd7406fd2b701cfab7c27fd21f3e3d6dd21bdc/app/src/main/res/drawable/wb.png -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 14 | 15 | 21 | 22 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main_1.xml: -------------------------------------------------------------------------------- 1 | 11 | 12 | 18 | 19 | 26 | 27 | 28 | 34 | 35 | 40 | 41 | 42 | 43 | 49 | 50 | 57 | 58 | 64 | 65 | 71 | 72 | 73 | 74 | 78 | 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main_az.xml: -------------------------------------------------------------------------------- 1 | 12 | 19 | 20 | 26 | 27 | 32 | 33 | 34 | 40 | 41 | 46 | 51 | 52 | 53 | 54 | 60 | 61 | 66 | 67 | 68 | 74 | 75 | 80 | 85 | 86 | 87 | 88 | 95 | 96 | 102 | 103 | 110 | 111 | 117 | 118 | 119 | 120 | 121 | 127 | 128 | 129 | 135 | 136 | 142 | 143 | 144 | 145 | 146 | 153 | 159 | 167 | 175 | 176 | 177 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_main.xml: -------------------------------------------------------------------------------- 1 | 4 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oubowu/AZExplosion/e7dd7406fd2b701cfab7c27fd21f3e3d6dd21bdc/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oubowu/AZExplosion/e7dd7406fd2b701cfab7c27fd21f3e3d6dd21bdc/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oubowu/AZExplosion/e7dd7406fd2b701cfab7c27fd21f3e3d6dd21bdc/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oubowu/AZExplosion/e7dd7406fd2b701cfab7c27fd21f3e3d6dd21bdc/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 36dp 4 | 36dp 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | AZExplosionField 3 | 4 | Hello world! 5 | Settings 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/test/java/explosionfield/azz/com/azexplosionfield/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package explosionfield.azz.com.azexplosionfield; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * To work on unit tests, switch the Test Artifact in the Build Variants view. 9 | */ 10 | public class ExampleUnitTest { 11 | @Test 12 | public void addition_isCorrect() throws Exception { 13 | assertEquals(4, 2 + 2); 14 | } 15 | } -------------------------------------------------------------------------------- /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:1.3.0' 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 | -------------------------------------------------------------------------------- /build/intermediates/dex-cache/cache.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | 11 | 16 | 17 | 18 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /build/intermediates/gradle_project_sync_data.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oubowu/AZExplosion/e7dd7406fd2b701cfab7c27fd21f3e3d6dd21bdc/build/intermediates/gradle_project_sync_data.bin -------------------------------------------------------------------------------- /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 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oubowu/AZExplosion/e7dd7406fd2b701cfab7c27fd21f3e3d6dd21bdc/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu Nov 19 11:18:27 CST 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.4-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 | # For Cygwin, ensure paths are in UNIX format before anything is touched. 46 | if $cygwin ; then 47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 48 | fi 49 | 50 | # Attempt to set APP_HOME 51 | # Resolve links: $0 may be a link 52 | PRG="$0" 53 | # Need this for relative symlinks. 54 | while [ -h "$PRG" ] ; do 55 | ls=`ls -ld "$PRG"` 56 | link=`expr "$ls" : '.*-> \(.*\)$'` 57 | if expr "$link" : '/.*' > /dev/null; then 58 | PRG="$link" 59 | else 60 | PRG=`dirname "$PRG"`"/$link" 61 | fi 62 | done 63 | SAVED="`pwd`" 64 | cd "`dirname \"$PRG\"`/" >&- 65 | APP_HOME="`pwd -P`" 66 | cd "$SAVED" >&- 67 | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 69 | 70 | # Determine the Java command to use to start the JVM. 71 | if [ -n "$JAVA_HOME" ] ; then 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 73 | # IBM's JDK on AIX uses strange locations for the executables 74 | JAVACMD="$JAVA_HOME/jre/sh/java" 75 | else 76 | JAVACMD="$JAVA_HOME/bin/java" 77 | fi 78 | if [ ! -x "$JAVACMD" ] ; then 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 80 | 81 | Please set the JAVA_HOME variable in your environment to match the 82 | location of your Java installation." 83 | fi 84 | else 85 | JAVACMD="java" 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 87 | 88 | Please set the JAVA_HOME variable in your environment to match the 89 | location of your Java installation." 90 | fi 91 | 92 | # Increase the maximum file descriptors if we can. 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 94 | MAX_FD_LIMIT=`ulimit -H -n` 95 | if [ $? -eq 0 ] ; then 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 97 | MAX_FD="$MAX_FD_LIMIT" 98 | fi 99 | ulimit -n $MAX_FD 100 | if [ $? -ne 0 ] ; then 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" 102 | fi 103 | else 104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 105 | fi 106 | fi 107 | 108 | # For Darwin, add options to specify how the application appears in the dock 109 | if $darwin; then 110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 111 | fi 112 | 113 | # For Cygwin, switch paths to Windows format before running java 114 | if $cygwin ; then 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 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 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 158 | function splitJvmOpts() { 159 | JVM_OPTS=("$@") 160 | } 161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 163 | 164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 165 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /local.properties: -------------------------------------------------------------------------------- 1 | ## This file is automatically generated by Android Studio. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must *NOT* be checked into Version Control Systems, 5 | # as it contains information specific to your local configuration. 6 | # 7 | # Location of the SDK. This is only used by Gradle. 8 | # For customization when using a Version Control System, please read the 9 | # header note. 10 | #Fri Nov 20 20:20:16 HKT 2015 11 | sdk.dir=/Users/AZZ/Library/Android/sdk 12 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | --------------------------------------------------------------------------------