Skip to content

Commit

Permalink
Release v1.1.0. Add support for background images.
Browse files Browse the repository at this point in the history
  • Loading branch information
paolorotolo committed May 27, 2018
1 parent 520031d commit ad21c2c
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
/build
/captures
.externalNativeBuild
/.idea/
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Add JitPack in your **root *build.gradle*** at the end of repositories:

```
dependencies {
compile 'com.github.2coffees1team:GlideToVectorYou:v1.0'
implementation 'com.github.2coffees1team:GlideToVectorYou:v1.1.0'
}
```

Expand Down Expand Up @@ -90,8 +90,16 @@ Again, for example, you could apply a custom transition or crop the image:
.into(imageView);
```

## Set SVG as background
If you need to load a .svg image as **backgroud** of a generic view, just call:

```java
GlideToVectorYou.justLoadImageAsBackground(activity, IMAGE_URI, view)
```


## Licence
This library is shared under **Apache License 2.0**.

### Made with ♥ by 2 Coffees 1 Tea(m).
We're Glid.. ehm... Glad to help you :D
We're Glid.. ehm... Glad to help you :D
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ dependencies {
implementation 'com.android.support:appcompat-v7:27.1.1'


implementation 'com.github.bumptech.glide:glide:4.6.1'
implementation 'com.github.bumptech.glide:glide:4.7.1'
}
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.2.31'
ext.kotlin_version = '1.2.41'
repositories {
google()
jcenter()
Expand Down
10 changes: 5 additions & 5 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
defaultConfig {
minSdkVersion 19
targetSdkVersion 27
versionCode 1
versionName "1.0"
versionCode 2
versionName "1.1.0"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

Expand All @@ -28,9 +28,9 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation 'com.caverock:androidsvg:1.2.1'
implementation 'com.github.bumptech.glide:glide:4.6.1'
implementation 'com.github.bumptech.glide:glide:4.7.1'

implementation 'com.github.bumptech.glide:annotations:4.6.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.6.1'
implementation 'com.github.bumptech.glide:annotations:4.7.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'

}
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
package com.github.twocoffeesoneteam.glidetovectoryou;

import android.app.Activity;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.PictureDrawable;
import android.net.Uri;
import android.support.annotation.NonNull;
import android.view.View;
import android.widget.ImageView;

import com.bumptech.glide.RequestBuilder;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.request.target.SimpleTarget;
import com.bumptech.glide.request.transition.Transition;

public class GlideToVectorYou {

Expand Down Expand Up @@ -64,6 +69,15 @@ public static void justLoadImage(Activity activity, Uri uri, ImageView imageView
.listener(new SvgSoftwareLayerSetter()).load(uri).into(imageView);
}

public static void justLoadImageAsBackground(Activity activity, Uri uri, final View view) {
GlideApp.with(activity).load(uri).into(new SimpleTarget<Drawable>() {
@Override
public void onResourceReady(@NonNull Drawable resource, Transition<? super Drawable> transition) {
view.setBackground(resource);
}
});
}

public RequestBuilder<PictureDrawable> getRequestBuilder() {
return requestBuilder;
}
Expand Down

0 comments on commit ad21c2c

Please sign in to comment.