├── example ├── .gitignore ├── src │ └── main │ │ ├── res │ │ ├── values │ │ │ ├── strings.xml │ │ │ ├── dimens.xml │ │ │ ├── colors.xml │ │ │ └── styles.xml │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ └── layout │ │ │ └── activity_main.xml │ │ ├── java │ │ └── com │ │ │ └── dyhdyh │ │ │ └── support │ │ │ └── glide │ │ │ └── example │ │ │ ├── SimpleGlideModule.java │ │ │ └── MainActivity.java │ │ └── AndroidManifest.xml ├── proguard-rules.pro └── build.gradle ├── glide-plus ├── .gitignore ├── src │ └── main │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── com │ │ └── dyhdyh │ │ └── support │ │ └── glide │ │ ├── transformations │ │ ├── CircleTransformation.java │ │ ├── BitmapCircleTransformation.java │ │ └── ImageWrapperTransformation.java │ │ ├── resource │ │ ├── gifbitmap │ │ │ ├── ImageWrapperFileToStreamDecoder.java │ │ │ ├── ImageWrapperResource.java │ │ │ ├── ImageWrapper.java │ │ │ ├── ImageWrapperDrawableTranscoder.java │ │ │ ├── ImageWrapperStreamResourceDecoder.java │ │ │ └── ImageWrapperResourceDecoder.java │ │ └── decoder │ │ │ └── StreamByteArrayResourceDecoder.java │ │ ├── animator │ │ ├── DrawableCrossFadeAnimator.java │ │ └── DrawableScaleBounceAnimator.java │ │ ├── gif │ │ ├── transform │ │ │ ├── GifDrawableCircleTransform.java │ │ │ └── OverrideSizeTransform.java │ │ └── resource │ │ │ ├── GifResourceDecoder.java │ │ │ └── GifDrawableResource.java │ │ └── GlidePlus.java ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── screenshot ├── screenshot.gif ├── example-compared.jpg ├── example-download.png ├── example-compared-small.jpg └── example-compared-small.png ├── gradle.properties ├── .gitignore ├── LICENSE ├── config.gradle ├── README.md ├── gradlew.bat └── gradlew /example/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /glide-plus/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':example', ':glide-plus' 2 | -------------------------------------------------------------------------------- /screenshot/screenshot.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiandanin/GlidePlus/HEAD/screenshot/screenshot.gif -------------------------------------------------------------------------------- /screenshot/example-compared.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiandanin/GlidePlus/HEAD/screenshot/example-compared.jpg -------------------------------------------------------------------------------- /screenshot/example-download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiandanin/GlidePlus/HEAD/screenshot/example-download.png -------------------------------------------------------------------------------- /example/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | glide-support 3 | 4 | -------------------------------------------------------------------------------- /screenshot/example-compared-small.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiandanin/GlidePlus/HEAD/screenshot/example-compared-small.jpg -------------------------------------------------------------------------------- /screenshot/example-compared-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiandanin/GlidePlus/HEAD/screenshot/example-compared-small.png -------------------------------------------------------------------------------- /example/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiandanin/GlidePlus/HEAD/example/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiandanin/GlidePlus/HEAD/example/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiandanin/GlidePlus/HEAD/example/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiandanin/GlidePlus/HEAD/example/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiandanin/GlidePlus/HEAD/example/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiandanin/GlidePlus/HEAD/example/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiandanin/GlidePlus/HEAD/example/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiandanin/GlidePlus/HEAD/example/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiandanin/GlidePlus/HEAD/example/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiandanin/GlidePlus/HEAD/example/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 150dp 4 | 32dp 5 | -------------------------------------------------------------------------------- /example/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /glide-plus/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /glide-plus/src/main/java/com/dyhdyh/support/glide/transformations/CircleTransformation.java: -------------------------------------------------------------------------------- 1 | package com.dyhdyh.support.glide.transformations; 2 | 3 | import android.content.Context; 4 | 5 | import com.dyhdyh.support.glide.gif.transform.GifDrawableCircleTransform; 6 | 7 | /** 8 | * gif圆形 bitmap圆形 9 | * author dengyuhan 10 | * created 2017/7/13 14:49 11 | */ 12 | public class CircleTransformation extends ImageWrapperTransformation { 13 | 14 | public CircleTransformation(Context context) { 15 | super(new GifDrawableCircleTransform(), new BitmapCircleTransformation(context)); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /example/src/main/java/com/dyhdyh/support/glide/example/SimpleGlideModule.java: -------------------------------------------------------------------------------- 1 | package com.dyhdyh.support.glide.example; 2 | 3 | import android.content.Context; 4 | 5 | import com.bumptech.glide.Glide; 6 | import com.bumptech.glide.GlideBuilder; 7 | import com.bumptech.glide.load.DecodeFormat; 8 | import com.bumptech.glide.module.GlideModule; 9 | 10 | /** 11 | * author dengyuhan 12 | * created 2017/7/14 14:58 13 | */ 14 | public class SimpleGlideModule implements GlideModule { 15 | @Override 16 | public void applyOptions(Context context, GlideBuilder builder) { 17 | builder.setDecodeFormat(DecodeFormat.PREFER_ARGB_8888); 18 | } 19 | 20 | @Override 21 | public void registerComponents(Context context, Glide glide) { 22 | // nothing to do here 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /glide-plus/src/main/java/com/dyhdyh/support/glide/resource/gifbitmap/ImageWrapperFileToStreamDecoder.java: -------------------------------------------------------------------------------- 1 | package com.dyhdyh.support.glide.resource.gifbitmap; 2 | 3 | import android.content.Context; 4 | 5 | import com.bumptech.glide.load.ResourceDecoder; 6 | import com.bumptech.glide.load.resource.file.FileToStreamDecoder; 7 | 8 | import java.io.InputStream; 9 | 10 | /** 11 | * author dengyuhan 12 | * created 2017/7/13 15:21 13 | */ 14 | public class ImageWrapperFileToStreamDecoder extends FileToStreamDecoder { 15 | public ImageWrapperFileToStreamDecoder(Context context) { 16 | this(new ImageWrapperStreamResourceDecoder(context)); 17 | } 18 | 19 | public ImageWrapperFileToStreamDecoder(ResourceDecoder streamDecoder) { 20 | super(streamDecoder); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /glide-plus/src/main/java/com/dyhdyh/support/glide/animator/DrawableCrossFadeAnimator.java: -------------------------------------------------------------------------------- 1 | package com.dyhdyh.support.glide.animator; 2 | 3 | import android.animation.ObjectAnimator; 4 | import android.view.View; 5 | 6 | import com.bumptech.glide.request.animation.ViewPropertyAnimation; 7 | 8 | /** 9 | * 淡入淡出动画 10 | * author dengyuhan 11 | * created 2017/3/30 17:31 12 | */ 13 | public class DrawableCrossFadeAnimator implements ViewPropertyAnimation.Animator { 14 | 15 | private final int duration; 16 | private static final int DEFAULT_DURATION_MS = 300; 17 | 18 | 19 | public DrawableCrossFadeAnimator() { 20 | this(DEFAULT_DURATION_MS); 21 | } 22 | 23 | public DrawableCrossFadeAnimator(int duration) { 24 | this.duration = duration; 25 | } 26 | 27 | @Override 28 | public void animate(View view) { 29 | ObjectAnimator.ofFloat(view, "alpha", 0f, 1f).setDuration(duration).start(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the ART/Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | out/ 15 | 16 | # Gradle files 17 | .gradle/ 18 | build/ 19 | 20 | # Local configuration file (sdk path, etc) 21 | local.properties 22 | 23 | # Proguard folder generated by Eclipse 24 | proguard/ 25 | 26 | # Log Files 27 | *.log 28 | 29 | # Android Studio Navigation editor temp files 30 | .navigation/ 31 | 32 | # Android Studio captures folder 33 | captures/ 34 | 35 | # Intellij 36 | *.iml 37 | .idea/workspace.xml 38 | .idea/tasks.xml 39 | .idea/gradle.xml 40 | .idea/dictionaries 41 | .idea/libraries 42 | 43 | # Keystore files 44 | *.jks 45 | 46 | # External native build folder generated in Android Studio 2.2 and later 47 | .externalNativeBuild 48 | 49 | # Google Services (e.g. APIs or Firebase) 50 | google-services.json 51 | 52 | # Freeline 53 | freeline.py 54 | freeline/ 55 | freeline_project_description.json 56 | -------------------------------------------------------------------------------- /example/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/dengyuhan/Library/dev/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 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | -------------------------------------------------------------------------------- /glide-plus/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/dengyuhan/Library/dev/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 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | -------------------------------------------------------------------------------- /glide-plus/src/main/java/com/dyhdyh/support/glide/gif/transform/GifDrawableCircleTransform.java: -------------------------------------------------------------------------------- 1 | package com.dyhdyh.support.glide.gif.transform; 2 | 3 | import android.graphics.Bitmap; 4 | import android.graphics.BitmapShader; 5 | import android.graphics.Canvas; 6 | import android.graphics.Paint; 7 | 8 | /** 9 | * 用于pl.droidsonroids.gif.Gifdrawable的圆形Transform 10 | * author dengyuhan 11 | * created 2017/7/12 16:10 12 | */ 13 | public class GifDrawableCircleTransform extends OverrideSizeTransform { 14 | 15 | @Override 16 | public void onDraw(Canvas canvas, Paint paint, Bitmap buffer, int outWidth, int outHeight) { 17 | int width = buffer.getWidth(); 18 | int height = buffer.getHeight(); 19 | 20 | int size = Math.min(width, height); 21 | 22 | BitmapShader shader = new BitmapShader(buffer, BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP); 23 | paint.setShader(shader); 24 | paint.setAntiAlias(true); 25 | 26 | float r = size / 2f; 27 | 28 | canvas.drawCircle(width / 2f, height / 2f, r, paint); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /example/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 dengyuhan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /config.gradle: -------------------------------------------------------------------------------- 1 | ext { 2 | android = 3 | [ 4 | versionCode : 4, 5 | versionName : "1.0.3", 6 | 7 | compileSdkVersion: 25, 8 | buildToolsVersion: "25.0.2", 9 | minSdkVersion : 14, 10 | targetSdkVersion : 25, 11 | supportVersion : "25.3.0", 12 | ] 13 | 14 | jcenter = 15 | [ 16 | //项目名称 17 | name : "GlidePlus", 18 | groupId : "com.dyhdyh.support", 19 | //项目地址 20 | siteUrl : "https://github.com/dengyuhan/GlidePlus", 21 | //项目git地址 22 | gitUrl : "https://github.com/dengyuhan/GlidePlus.git", 23 | //项目描述 24 | description: "Glide增强版,强化对GIF的支持", 25 | //开发者的一些基本信息 26 | authorId : "dengyuhan", 27 | authorName : "dengyuhan", 28 | authorEmail: "22309946@qq.com", 29 | ] 30 | 31 | 32 | } 33 | -------------------------------------------------------------------------------- /example/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion rootProject.ext.android.compileSdkVersion 5 | buildToolsVersion rootProject.ext.android.buildToolsVersion 6 | 7 | defaultConfig { 8 | applicationId "com.dyhdyh.support.glide.example" 9 | minSdkVersion rootProject.ext.android.minSdkVersion 10 | targetSdkVersion rootProject.ext.android.targetSdkVersion 11 | versionCode rootProject.ext.android.targetSdkVersion 12 | versionName rootProject.ext.android.versionName 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 | compile 'com.android.support:appcompat-v7:25.3.1' 25 | compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0' 26 | compile 'com.github.chrisbanes:PhotoView:2.0.0' 27 | compile project(':glide-plus') 28 | compile 'com.android.support:recyclerview-v7:25.3.1' 29 | } 30 | -------------------------------------------------------------------------------- /glide-plus/src/main/java/com/dyhdyh/support/glide/gif/resource/GifResourceDecoder.java: -------------------------------------------------------------------------------- 1 | package com.dyhdyh.support.glide.gif.resource; 2 | 3 | import com.bumptech.glide.load.ResourceDecoder; 4 | import com.bumptech.glide.load.engine.Resource; 5 | import com.dyhdyh.support.glide.resource.decoder.StreamByteArrayResourceDecoder; 6 | 7 | import java.io.IOException; 8 | import java.io.InputStream; 9 | 10 | import pl.droidsonroids.gif.GifDrawable; 11 | 12 | /** 13 | * author dengyuhan 14 | * created 2017/7/13 12:07 15 | */ 16 | public class GifResourceDecoder implements ResourceDecoder { 17 | 18 | private StreamByteArrayResourceDecoder mByteDecoder = new StreamByteArrayResourceDecoder(); 19 | 20 | @Override 21 | public Resource decode(InputStream source, int width, int height) throws IOException { 22 | byte[] bytes = mByteDecoder.decode(source, width, height).get(); 23 | GifDrawable gifDrawable = new GifDrawable(bytes); 24 | gifDrawable.setLoopCount(0); 25 | return new GifDrawableResource(gifDrawable, bytes); 26 | } 27 | 28 | @Override 29 | public String getId() { 30 | return getClass().getName(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /glide-plus/src/main/java/com/dyhdyh/support/glide/gif/transform/OverrideSizeTransform.java: -------------------------------------------------------------------------------- 1 | package com.dyhdyh.support.glide.gif.transform; 2 | 3 | import android.graphics.Bitmap; 4 | import android.graphics.Canvas; 5 | import android.graphics.Paint; 6 | import android.graphics.Rect; 7 | 8 | import pl.droidsonroids.gif.transforms.Transform; 9 | 10 | /** 11 | * author dengyuhan 12 | * created 2017/7/13 14:24 13 | */ 14 | public abstract class OverrideSizeTransform implements Transform { 15 | public static final int ORIGINAL_WIDTH = 0; 16 | public static final int ORIGINAL_HEIGHT = 0; 17 | 18 | private int mOutWidth = ORIGINAL_WIDTH; 19 | private int mOutHeight = ORIGINAL_HEIGHT; 20 | 21 | @Override 22 | public void onBoundsChange(Rect bounds) { 23 | 24 | } 25 | 26 | @Override 27 | public void onDraw(Canvas canvas, Paint paint, Bitmap buffer) { 28 | this.onDraw(canvas, paint, buffer, mOutWidth, mOutHeight); 29 | } 30 | 31 | public OverrideSizeTransform setDrawSize(int outWidth, int outHeight) { 32 | this.mOutWidth = outWidth; 33 | this.mOutHeight = outHeight; 34 | return this; 35 | } 36 | 37 | public abstract void onDraw(Canvas canvas, Paint paint, Bitmap buffer, int outWidth, int outHeight); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /glide-plus/src/main/java/com/dyhdyh/support/glide/resource/gifbitmap/ImageWrapperResource.java: -------------------------------------------------------------------------------- 1 | package com.dyhdyh.support.glide.resource.gifbitmap; 2 | 3 | import android.graphics.Bitmap; 4 | 5 | import com.bumptech.glide.load.engine.Resource; 6 | 7 | import pl.droidsonroids.gif.GifDrawable; 8 | 9 | /** 10 | * A resource that wraps an {@link ImageWrapper}. 11 | */ 12 | public class ImageWrapperResource implements Resource { 13 | private final ImageWrapper data; 14 | 15 | public ImageWrapperResource(ImageWrapper data) { 16 | if (data == null) { 17 | throw new NullPointerException("Data must not be null"); 18 | } 19 | this.data = data; 20 | } 21 | 22 | @Override 23 | public ImageWrapper get() { 24 | return data; 25 | } 26 | 27 | @Override 28 | public int getSize() { 29 | return data.getSize(); 30 | } 31 | 32 | @Override 33 | public void recycle() { 34 | Resource bitmapResource = data.getBitmapResource(); 35 | if (bitmapResource != null) { 36 | bitmapResource.recycle(); 37 | } 38 | Resource gifDataResource = data.getGifResource(); 39 | if (gifDataResource != null) { 40 | gifDataResource.recycle(); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /glide-plus/src/main/java/com/dyhdyh/support/glide/animator/DrawableScaleBounceAnimator.java: -------------------------------------------------------------------------------- 1 | package com.dyhdyh.support.glide.animator; 2 | 3 | import android.animation.ObjectAnimator; 4 | import android.animation.PropertyValuesHolder; 5 | import android.view.View; 6 | import android.view.animation.BounceInterpolator; 7 | 8 | import com.bumptech.glide.request.animation.ViewPropertyAnimation; 9 | 10 | /** 11 | * 缩放弹性动画 12 | * author dengyuhan 13 | * created 2017/3/30 17:31 14 | */ 15 | public class DrawableScaleBounceAnimator implements ViewPropertyAnimation.Animator { 16 | 17 | private final int duration; 18 | private static final int DEFAULT_DURATION_MS = 800; 19 | 20 | 21 | public DrawableScaleBounceAnimator() { 22 | this(DEFAULT_DURATION_MS); 23 | } 24 | 25 | public DrawableScaleBounceAnimator(int duration) { 26 | this.duration = duration; 27 | } 28 | 29 | @Override 30 | public void animate(View view) { 31 | ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(view, 32 | PropertyValuesHolder.ofFloat("scaleX", 0f, 1f), 33 | PropertyValuesHolder.ofFloat("scaleY", 0f, 1f)) 34 | .setDuration(duration); 35 | animator.setInterpolator(new BounceInterpolator()); 36 | animator.start(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /example/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | 13 | 14 | 21 | 22 | 28 | 29 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /glide-plus/src/main/java/com/dyhdyh/support/glide/resource/gifbitmap/ImageWrapper.java: -------------------------------------------------------------------------------- 1 | package com.dyhdyh.support.glide.resource.gifbitmap; 2 | 3 | import android.graphics.Bitmap; 4 | 5 | import com.bumptech.glide.load.engine.Resource; 6 | 7 | import pl.droidsonroids.gif.GifDrawable; 8 | 9 | /** 10 | * author dengyuhan 11 | * created 2017/7/12 15:25 12 | */ 13 | public class ImageWrapper { 14 | private final Resource gifResource; 15 | private final Resource bitmapResource; 16 | 17 | public ImageWrapper(Resource bitmapResource, Resource gifResource) { 18 | if (bitmapResource != null && gifResource != null) { 19 | throw new IllegalArgumentException("Can only contain either a bitmap resource or a gif resource, not both"); 20 | } else if (bitmapResource == null && gifResource == null) { 21 | throw new IllegalArgumentException("Must contain either a bitmap resource or a gif resource"); 22 | } else { 23 | this.bitmapResource = bitmapResource; 24 | this.gifResource = gifResource; 25 | } 26 | } 27 | 28 | public int getSize() { 29 | return this.bitmapResource != null ? this.bitmapResource.getSize() : this.gifResource.getSize(); 30 | } 31 | 32 | public Resource getBitmapResource() { 33 | return this.bitmapResource; 34 | } 35 | 36 | public Resource getGifResource() { 37 | return this.gifResource; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /glide-plus/src/main/java/com/dyhdyh/support/glide/gif/resource/GifDrawableResource.java: -------------------------------------------------------------------------------- 1 | package com.dyhdyh.support.glide.gif.resource; 2 | 3 | import com.bumptech.glide.load.engine.Resource; 4 | 5 | import pl.droidsonroids.gif.GifDrawable; 6 | import pl.droidsonroids.gif.transforms.Transform; 7 | 8 | /** 9 | * author dengyuhan 10 | * created 2017/7/13 14:58 11 | */ 12 | public class GifDrawableResource implements Resource { 13 | private GifDrawable drawable; 14 | private byte[] data; 15 | private Transform gifTransform; 16 | 17 | public GifDrawableResource(GifDrawable gifDrawable, byte[] data) { 18 | this.drawable = gifDrawable; 19 | this.data = data; 20 | } 21 | 22 | @Override 23 | public GifDrawable get() { 24 | try { 25 | GifDrawable newDrawable = new GifDrawable(data); 26 | newDrawable.setLoopCount(drawable.getLoopCount()); 27 | newDrawable.setTransform(gifTransform); 28 | return newDrawable; 29 | } catch (Exception e) { 30 | e.printStackTrace(); 31 | return drawable; 32 | } 33 | } 34 | 35 | public void setGifTransform(Transform gifTransform) { 36 | this.gifTransform = gifTransform; 37 | } 38 | 39 | @Override 40 | public int getSize() { 41 | return (int) drawable.getInputSourceByteCount(); 42 | } 43 | 44 | @Override 45 | public void recycle() { 46 | drawable.stop(); 47 | drawable.recycle(); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /glide-plus/src/main/java/com/dyhdyh/support/glide/resource/decoder/StreamByteArrayResourceDecoder.java: -------------------------------------------------------------------------------- 1 | package com.dyhdyh.support.glide.resource.decoder; 2 | 3 | import android.util.Log; 4 | 5 | import com.bumptech.glide.load.ResourceDecoder; 6 | import com.bumptech.glide.load.engine.Resource; 7 | import com.bumptech.glide.load.resource.bytes.BytesResource; 8 | 9 | import java.io.ByteArrayOutputStream; 10 | import java.io.IOException; 11 | import java.io.InputStream; 12 | 13 | /** 14 | * author dengyuhan 15 | * created 2017/7/13 15:02 16 | */ 17 | public class StreamByteArrayResourceDecoder implements ResourceDecoder { 18 | private final String TAG = "StreamByteDecoder"; 19 | 20 | @Override 21 | public Resource decode(InputStream source, int width, int height) throws IOException { 22 | return new BytesResource(inputStreamToBytes(source)); 23 | } 24 | 25 | private byte[] inputStreamToBytes(InputStream is) { 26 | final int bufferSize = 16384; 27 | ByteArrayOutputStream buffer = new ByteArrayOutputStream(bufferSize); 28 | try { 29 | int nRead; 30 | byte[] data = new byte[bufferSize]; 31 | while ((nRead = is.read(data)) != -1) { 32 | buffer.write(data, 0, nRead); 33 | } 34 | buffer.flush(); 35 | } catch (IOException e) { 36 | Log.w(TAG, "Error reading data from stream", e); 37 | } 38 | //TODO the returned byte[] may be partial if an IOException was thrown from read 39 | return buffer.toByteArray(); 40 | } 41 | 42 | @Override 43 | public String getId() { 44 | return getClass().getName(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### 本项目已过时,Glide4.0后对GIF已经有很好的支持 2 | 3 |
4 |
5 | 基于[glide](https://github.com/bumptech/glide)与 6 | [android-gif-drawable](https://github.com/koral--/android-gif-drawable)对Glide处理Gif进行加强 7 | 8 | ## __示例apk__ 9 | ![](screenshot/example-download.png) 10 | 11 | ## __快速开始__ 12 | #### Gradle 13 | ``` 14 | compile 'com.dyhdyh.support:glide-plus:1.0.1' 15 | compile 'com.github.bumptech.glide:glide:3.7.0' 16 | ``` 17 | 18 | #### 示例 19 | ``` 20 | GlidePlus.with(this) 21 | .gifPlus()//开启gif增强 22 | .circle()//圆形 23 | //.crossFade()//淡入淡出(默认开启) 24 | //.transform(new ImageWrapperCircleTransformation()) 25 | //.animate(new DrawableScaleBounceAnimator()) 26 | .glide() 27 | .load(url) 28 | .placeholder(R.mipmap.placeholder) 29 | .error(R.mipmap.error) 30 | .into(iv); 31 | ``` 32 | 33 | ## __效果__ 34 | ![](screenshot/screenshot.gif) 35 | 36 | ## __对比图__ 37 | ![](screenshot/example-compared-small.png) 38 | 39 | ## __在RecyclerView中使用的注意事项__ 40 | 1.重写Adapter中`onViewDetachedFromWindow`与`onViewAttachedToWindow`,在Item出屏的时候暂停播放gif,进屏的时候再播放gif,这样可以节省一些性能。 41 | 42 | ``` 43 | @Override 44 | public void onViewDetachedFromWindow(ViewHolder holder) { 45 | Drawable drawable = holder.iv.getDrawable(); 46 | if (drawable instanceof pl.droidsonroids.gif.GifDrawable){ 47 | ((pl.droidsonroids.gif.GifDrawable) drawable).pause(); 48 | } 49 | } 50 | 51 | @Override 52 | public void onViewAttachedToWindow(ViewHolder holder) { 53 | Drawable drawable = holder.iv.getDrawable(); 54 | if (drawable instanceof pl.droidsonroids.gif.GifDrawable){ 55 | ((pl.droidsonroids.gif.GifDrawable) drawable).start(); 56 | } 57 | } 58 | ``` 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /glide-plus/src/main/java/com/dyhdyh/support/glide/resource/gifbitmap/ImageWrapperDrawableTranscoder.java: -------------------------------------------------------------------------------- 1 | package com.dyhdyh.support.glide.resource.gifbitmap; 2 | 3 | import android.content.Context; 4 | import android.graphics.Bitmap; 5 | import android.graphics.drawable.Drawable; 6 | 7 | import com.bumptech.glide.load.engine.Resource; 8 | import com.bumptech.glide.load.resource.bitmap.GlideBitmapDrawable; 9 | import com.bumptech.glide.load.resource.transcode.GlideBitmapDrawableTranscoder; 10 | import com.bumptech.glide.load.resource.transcode.ResourceTranscoder; 11 | 12 | /** 13 | * An com.bumptech.glide.load.resource.transcode.ResourceTranscoder that can transcode either an 14 | * {@link Bitmap} or an pl.droidsonroids.gif.GifDrawable into an 15 | * {@link android.graphics.drawable.Drawable}. 16 | */ 17 | public class ImageWrapperDrawableTranscoder implements ResourceTranscoder { 18 | private final ResourceTranscoder bitmapDrawableResourceTranscoder; 19 | 20 | public ImageWrapperDrawableTranscoder(Context context) { 21 | this(new GlideBitmapDrawableTranscoder(context)); 22 | } 23 | 24 | public ImageWrapperDrawableTranscoder( 25 | ResourceTranscoder bitmapDrawableResourceTranscoder) { 26 | this.bitmapDrawableResourceTranscoder = bitmapDrawableResourceTranscoder; 27 | } 28 | 29 | @SuppressWarnings("unchecked") 30 | @Override 31 | public Resource transcode(Resource toTranscode) { 32 | ImageWrapper gifBitmap = toTranscode.get(); 33 | Resource bitmapResource = gifBitmap.getBitmapResource(); 34 | 35 | final Resource result; 36 | if (bitmapResource != null) { 37 | result = bitmapDrawableResourceTranscoder.transcode(bitmapResource); 38 | } else { 39 | result = gifBitmap.getGifResource(); 40 | } 41 | // This is unchecked but always safe, anything that extends a Drawable can be safely cast to a Drawable. 42 | return (Resource) result; 43 | } 44 | 45 | @Override 46 | public String getId() { 47 | return getClass().getName(); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /glide-plus/src/main/java/com/dyhdyh/support/glide/resource/gifbitmap/ImageWrapperStreamResourceDecoder.java: -------------------------------------------------------------------------------- 1 | package com.dyhdyh.support.glide.resource.gifbitmap; 2 | 3 | import android.content.Context; 4 | 5 | import com.bumptech.glide.Glide; 6 | import com.bumptech.glide.load.ResourceDecoder; 7 | import com.bumptech.glide.load.engine.Resource; 8 | import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool; 9 | import com.bumptech.glide.load.model.ImageVideoWrapper; 10 | import com.bumptech.glide.load.resource.bitmap.FileDescriptorBitmapDecoder; 11 | import com.bumptech.glide.load.resource.bitmap.ImageVideoBitmapDecoder; 12 | import com.bumptech.glide.load.resource.bitmap.StreamBitmapDecoder; 13 | import com.dyhdyh.support.glide.gif.resource.GifResourceDecoder; 14 | 15 | import java.io.IOException; 16 | import java.io.InputStream; 17 | 18 | /** 19 | * A com.bumptech.glide.load.ResourceDecoder that can decode an 20 | * {@link ImageWrapper} from {@link InputStream} data. 21 | */ 22 | public class ImageWrapperStreamResourceDecoder implements ResourceDecoder { 23 | private final ResourceDecoder gifBitmapDecoder; 24 | 25 | public ImageWrapperStreamResourceDecoder(Context context) { 26 | StreamBitmapDecoder streamBitmapDecoder = new StreamBitmapDecoder(context); 27 | FileDescriptorBitmapDecoder fileDescriptorBitmapDecoder = new FileDescriptorBitmapDecoder(context); 28 | ImageVideoBitmapDecoder imageVideoBitmapDecoder = new ImageVideoBitmapDecoder(streamBitmapDecoder, fileDescriptorBitmapDecoder); 29 | GifResourceDecoder gifResourceDecoder = new GifResourceDecoder(); 30 | BitmapPool bitmapPool = Glide.get(context).getBitmapPool(); 31 | this.gifBitmapDecoder = new ImageWrapperResourceDecoder(imageVideoBitmapDecoder, gifResourceDecoder, bitmapPool); 32 | } 33 | 34 | public ImageWrapperStreamResourceDecoder( 35 | ResourceDecoder gifBitmapDecoder) { 36 | this.gifBitmapDecoder = gifBitmapDecoder; 37 | } 38 | 39 | @Override 40 | public Resource decode(InputStream source, int width, int height) throws IOException { 41 | return gifBitmapDecoder.decode(new ImageVideoWrapper(source, null), width, height); 42 | } 43 | 44 | @Override 45 | public String getId() { 46 | return gifBitmapDecoder.getId(); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /glide-plus/src/main/java/com/dyhdyh/support/glide/transformations/BitmapCircleTransformation.java: -------------------------------------------------------------------------------- 1 | package com.dyhdyh.support.glide.transformations; 2 | 3 | import android.content.Context; 4 | import android.graphics.Bitmap; 5 | import android.graphics.BitmapShader; 6 | import android.graphics.Canvas; 7 | import android.graphics.Matrix; 8 | import android.graphics.Paint; 9 | 10 | import com.bumptech.glide.Glide; 11 | import com.bumptech.glide.load.Transformation; 12 | import com.bumptech.glide.load.engine.Resource; 13 | import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool; 14 | import com.bumptech.glide.load.resource.bitmap.BitmapResource; 15 | 16 | /** 17 | * bitmap圆形 18 | * author dengyuhan 19 | * created 2017/7/13 14:51 20 | */ 21 | public class BitmapCircleTransformation implements Transformation { 22 | 23 | private BitmapPool mBitmapPool; 24 | 25 | public BitmapCircleTransformation(Context context) { 26 | this(Glide.get(context).getBitmapPool()); 27 | } 28 | 29 | public BitmapCircleTransformation(BitmapPool pool) { 30 | this.mBitmapPool = pool; 31 | } 32 | 33 | @Override 34 | public Resource transform(Resource resource, int outWidth, int outHeight) { 35 | Bitmap source = resource.get(); 36 | int size = Math.min(source.getWidth(), source.getHeight()); 37 | 38 | int width = (source.getWidth() - size) / 2; 39 | int height = (source.getHeight() - size) / 2; 40 | 41 | Bitmap bitmap = mBitmapPool.get(size, size, Bitmap.Config.ARGB_8888); 42 | if (bitmap == null) { 43 | bitmap = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888); 44 | } 45 | 46 | Canvas canvas = new Canvas(bitmap); 47 | Paint paint = new Paint(); 48 | BitmapShader shader = 49 | new BitmapShader(source, BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP); 50 | if (width != 0 || height != 0) { 51 | Matrix matrix = new Matrix(); 52 | matrix.setTranslate(-width, -height); 53 | shader.setLocalMatrix(matrix); 54 | } 55 | paint.setShader(shader); 56 | paint.setAntiAlias(true); 57 | 58 | float r = size / 2f; 59 | canvas.drawCircle(r, r, r, paint); 60 | 61 | return BitmapResource.obtain(bitmap, mBitmapPool); 62 | } 63 | 64 | @Override 65 | public String getId() { 66 | return getClass().getName(); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /glide-plus/src/main/java/com/dyhdyh/support/glide/transformations/ImageWrapperTransformation.java: -------------------------------------------------------------------------------- 1 | package com.dyhdyh.support.glide.transformations; 2 | 3 | import android.graphics.Bitmap; 4 | 5 | import com.bumptech.glide.load.Transformation; 6 | import com.bumptech.glide.load.engine.Resource; 7 | import com.dyhdyh.support.glide.gif.resource.GifDrawableResource; 8 | import com.dyhdyh.support.glide.gif.transform.OverrideSizeTransform; 9 | import com.dyhdyh.support.glide.resource.gifbitmap.ImageWrapper; 10 | import com.dyhdyh.support.glide.resource.gifbitmap.ImageWrapperResource; 11 | 12 | import pl.droidsonroids.gif.GifDrawable; 13 | import pl.droidsonroids.gif.transforms.Transform; 14 | 15 | /** 16 | * 包装gif bitmap支持glide的Transformation 17 | * author dengyuhan 18 | * created 2017/7/13 14:38 19 | */ 20 | public abstract class ImageWrapperTransformation implements Transformation { 21 | private Transform mGifTransform; 22 | private Transformation mBitmapTransformation; 23 | 24 | public ImageWrapperTransformation(Transform gifTransform, Transformation bitmapTransformation) { 25 | this.mGifTransform = gifTransform; 26 | this.mBitmapTransformation = bitmapTransformation; 27 | } 28 | 29 | @Override 30 | public Resource transform(Resource resource, int outWidth, int outHeight) { 31 | ImageWrapper gifBitmapWrapper = resource.get(); 32 | Resource bitmapResource = gifBitmapWrapper.getBitmapResource(); 33 | if (bitmapResource != null) { 34 | Resource transform = mBitmapTransformation.transform(bitmapResource, outWidth, outHeight); 35 | return new ImageWrapperResource(new ImageWrapper(transform, gifBitmapWrapper.getGifResource())); 36 | } 37 | 38 | Resource gifResource = gifBitmapWrapper.getGifResource(); 39 | if (gifResource != null) { 40 | if (mGifTransform instanceof OverrideSizeTransform) { 41 | ((OverrideSizeTransform) mGifTransform).setDrawSize(outWidth, outHeight); 42 | } 43 | if (gifResource instanceof GifDrawableResource){ 44 | ((GifDrawableResource) gifResource).setGifTransform(mGifTransform); 45 | }else{ 46 | gifResource.get().setTransform(mGifTransform); 47 | } 48 | } 49 | return resource; 50 | } 51 | 52 | @Override 53 | public String getId() { 54 | return getClass().getName(); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /example/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 14 | 15 |