Skip to content

Commit

Permalink
release 0.0.5 to support glide 4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
zjupure committed Feb 6, 2018
1 parent 7ced94e commit 957de81
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 14 deletions.
6 changes: 4 additions & 2 deletions README.md
Expand Up @@ -13,14 +13,16 @@ Library is available in jcenter. If you are build with Gradle, just add the foll

```gradle
// webpdecoder
compile 'com.zlc.glide:webpdecoder:0.0.4'
// glide, 4.2.0-4.4.0
compile 'com.zlc.glide:webpdecoder:0.0.5'
// glide 4.2
compile 'com.github.bumptech.glide:glide:4.2.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.2.0'
```

Then you are free to use GlideWebpDecoder just like use other Glide integration library.

Notice: if you want to upgrade Glide version to 4.4, please use webpdecoder 0.0.4;

## Proguard

The library use native code to decode webp, so you should put the following lines to your `proguard.cfg` and keep the jni interface.
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Expand Up @@ -7,7 +7,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath "com.android.tools.build:gradle:${ANDROID_GRADLE_VERSION}"
classpath "org.kt3k.gradle.plugin:coveralls-gradle-plugin:${COVERALLS_GRADLE_VERSION}"
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.1'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
Expand Down
4 changes: 3 additions & 1 deletion gradle.properties
@@ -1,7 +1,7 @@
org.gradle.daemon=true
org.gradle.configureondemand=true

VERSION_NAME=0.0.4
VERSION_NAME=0.0.5
GROUP=com.zlc.glide

POM_DESCRIPTION=A fast and efficient image loading library for Android focused on smooth scrolling.
Expand All @@ -27,3 +27,5 @@ TARGET_SDK_VERSION=26
MIN_SDK_VERSION=14

org.gradle.jvmargs=-Xmx2048M

RELEASE_REPOSITORY_URL=E://repo
3 changes: 3 additions & 0 deletions release-bintray.gradle
Expand Up @@ -31,6 +31,9 @@ apply from: rootProject.file('scripts/android-maven-install.gradle')
// Upload to Bintray
apply from: rootProject.file('scripts/bintray.gradle')

// Upload to Maven
//apply from: rootProject.file('scripts/upload.gradle')

// Android tasks
apply from: rootProject.file('scripts/android-tasks.gradle')

Expand Down
2 changes: 1 addition & 1 deletion scripts/upload.gradle
Expand Up @@ -66,7 +66,7 @@ afterEvaluate { project ->
pom.artifactId = POM_ARTIFACT_ID
pom.version = VERSION_NAME

repository(url: getReleaseRepositoryUrl()) {
repository(url: uri(getReleaseRepositoryUrl())) {
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
}
snapshotRepository(url: getSnapshotRepositoryUrl()) {
Expand Down
2 changes: 1 addition & 1 deletion webp_decoder/build.gradle
@@ -1,7 +1,7 @@
apply plugin: 'com.android.library'

dependencies {
compile "com.android.support:support-annotations:${ANDROID_SUPPORT_VERSION}"
provided "com.android.support:support-annotations:${ANDROID_SUPPORT_VERSION}"
compile("com.github.bumptech.glide:glide:${GLIDE_VERSION}"){
exclude group:"com.android.support", module:"support-fragment"
}
Expand Down
Expand Up @@ -67,7 +67,7 @@ public WebpDecoder(GifDecoder.BitmapProvider provider, WebpImage webPImage, Byte
mTransparentFillPaint = new Paint(mBackgroundPaint);
mTransparentFillPaint.setColor(Color.TRANSPARENT);

mFrameBitmapCache = new LruCache<>(MAX_FRAME_BITMAP_SIZE);
mFrameBitmapCache = new LruCache<Integer, Bitmap>(MAX_FRAME_BITMAP_SIZE);

setData(new GifHeader(), rawData, sampleSize);
}
Expand Down
8 changes: 6 additions & 2 deletions webpsample/build.gradle
Expand Up @@ -2,11 +2,15 @@ apply plugin: 'com.android.application'

dependencies {

//compile "com.github.bumptech.glide:glide:${GLIDE_VERSION}"
compile("com.github.bumptech.glide:glide:${GLIDE_VERSION}"){
exclude group:"com.android.support"
}
annotationProcessor "com.github.bumptech.glide:compiler:${GLIDE_VERSION}"

compile(project(':webp_decoder'))
//compile 'com.zlc.glide:webpdecoder:0.0.3'
// compile('com.zlc.glide:webpdecoder:0.0.5'){
// exclude group: 'com.github.bumptech.glide'
// }

//compile(project(':framesequence'))

Expand Down
Expand Up @@ -57,6 +57,8 @@ public class MainActivity extends Activity {
private RecyclerView mRecyclerView;
private WebpImageAdapter mWebpAdapter;

private Menu mActionMenu;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand All @@ -68,7 +70,6 @@ protected void onCreate(Bundle savedInstanceState) {

List<String> imageList = new ArrayList<>();
imageList.addAll(Arrays.asList(ANIM_WEBP));
imageList.addAll(Arrays.asList(ANIM_GIF));

mWebpAdapter = new WebpImageAdapter(this, imageList);
mRecyclerView.setAdapter(mWebpAdapter);
Expand All @@ -83,6 +84,7 @@ protected void onStart() {
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main, menu);
mActionMenu = menu;
return super.onCreateOptionsMenu(menu);
}

Expand All @@ -91,10 +93,7 @@ public boolean onCreateOptionsMenu(Menu menu) {
public boolean onOptionsItemSelected(MenuItem item) {

int id = item.getItemId();
item.setChecked(!item.isChecked());
if (!item.isChecked()) {
return super.onOptionsItemSelected(item);
}
handleMenuItemCheck(item);

if (id == R.id.static_webp_action) {
mTextView.setText("static lossy webp");
Expand All @@ -105,9 +104,28 @@ public boolean onOptionsItemSelected(MenuItem item) {
} else if(id == R.id.animate_webp_action) {
mTextView.setText("animated webp");
mWebpAdapter.updateData(Arrays.asList(ANIM_WEBP));
} else if(id == R.id.animate_gif_action) {
mTextView.setText("animated gif");
mWebpAdapter.updateData(Arrays.asList(ANIM_GIF));
}

return true;
}


private void handleMenuItemCheck(MenuItem menuItem) {
if (mActionMenu == null) {
menuItem.setChecked(true);
return;
}

for (int i = 0; i < mActionMenu.size(); i++) {
MenuItem item = mActionMenu.getItem(i);
if (item.getItemId() == menuItem.getItemId()) {
item.setChecked(true);
} else {
item.setChecked(false);
}
}
}
}
5 changes: 5 additions & 0 deletions webpsample/src/main/res/menu/menu_main.xml
Expand Up @@ -19,5 +19,10 @@
android:checkable="true"
android:checked="true"
android:title="show animate webp"/>

<item
android:id="@+id/animate_gif_action"
android:checkable="true"
android:title="show animate gif" />
</group>
</menu>

0 comments on commit 957de81

Please sign in to comment.