1
0
mirror of https://github.com/wasabeef/glide-transformations.git synced 2025-08-10 05:49:37 +08:00

For Glide 4.5.0 (#112)

This commit is contained in:
Daichi Furiya 2018-01-26 17:08:27 +09:00 committed by GitHub
parent 43f38cc4b3
commit 51f7b515fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
37 changed files with 235 additions and 237 deletions

View File

@ -1,6 +1,19 @@
Change Log Change Log
========== ==========
Version 3.1.0 *(2018-01-26)*
----------------------------
Update:
- Compile & Target SDK Version 25 -> 27
- Build Tools 26.0.1 -> 27.0.3
- Support Library 25.3.1 -> 27.0.2
- Glide 4.0.0 -> 4.5.0
Bug Fix:
- [Implement equals() and hashCode() methods #105](https://github.com/wasabeef/glide-transformations/pull/105)
- Use RenderScript#releaseAllContexts
Version 3.0.1 *(2017-09-08)* Version 3.0.1 *(2017-09-08)*
---------------------------- ----------------------------

View File

@ -32,9 +32,9 @@ repositories {
} }
dependencies { dependencies {
compile 'jp.wasabeef:glide-transformations:3.0.1' implementation 'jp.wasabeef:glide-transformations:3.1.0'
// If you want to use the GPU Filters // If you want to use the GPU Filters
compile 'jp.co.cyberagent.android.gpuimage:gpuimage-library:1.4.1' implementation 'jp.co.cyberagent.android.gpuimage:gpuimage-library:1.4.1'
} }
``` ```
@ -122,7 +122,7 @@ Thanks
License License
------- -------
Copyright 2017 Wasabeef Copyright 2018 Wasabeef
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -3,15 +3,17 @@
buildscript { buildscript {
repositories { repositories {
jcenter() jcenter()
google()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:2.3.3' classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.novoda:bintray-release:0.3.4' classpath 'com.novoda:bintray-release:0.8.0'
} }
} }
allprojects { allprojects {
repositories { repositories {
google()
jcenter() jcenter()
mavenCentral() mavenCentral()
} }

View File

@ -52,10 +52,11 @@ def getKeyAliasPasswordProperty() {
} }
dependencies { dependencies {
compile project(':transformations') implementation project(':transformations')
compile "com.github.bumptech.glide:glide:${GLIDE_VERSION}" implementation "com.github.bumptech.glide:glide:${GLIDE_VERSION}"
annotationProcessor "com.github.bumptech.glide:compiler:${GLIDE_VERSION}" annotationProcessor "com.github.bumptech.glide:compiler:${GLIDE_VERSION}"
compile "jp.co.cyberagent.android.gpuimage:gpuimage-library:${GPUIMAGE_VERSION}" implementation "jp.co.cyberagent.android.gpuimage:gpuimage-library:${GPUIMAGE_VERSION}"
compile "com.android.support:appcompat-v7:${SUPPORT_PACKAGE_VERSION}" implementation "com.android.support:appcompat-v7:${SUPPORT_PACKAGE_VERSION}"
compile "com.android.support:recyclerview-v7:${SUPPORT_PACKAGE_VERSION}" implementation "com.android.support:recyclerview-v7:${SUPPORT_PACKAGE_VERSION}"
implementation 'com.android.support.constraint:constraint-layout:1.1.0-beta4'
} }

View File

@ -2,7 +2,7 @@ package jp.wasabeef.example.glide;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -15,7 +15,7 @@ public class MainActivity extends AppCompatActivity {
setContentView(R.layout.activity_main); setContentView(R.layout.activity_main);
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.list); RecyclerView recyclerView = (RecyclerView) findViewById(R.id.list);
recyclerView.setLayoutManager(new GridLayoutManager(this, 2)); recyclerView.setLayoutManager(new LinearLayoutManager(this));
List<Type> dataSet = new ArrayList<>(); List<Type> dataSet = new ArrayList<>();
dataSet.add(Type.Mask); dataSet.add(Type.Mask);

View File

@ -1,11 +1,9 @@
package jp.wasabeef.example.glide; package jp.wasabeef.example.glide;
import android.content.Context; import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.PointF; import android.graphics.PointF;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.util.DisplayMetrics;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -14,7 +12,6 @@ import android.widget.TextView;
import com.bumptech.glide.Glide; import com.bumptech.glide.Glide;
import com.bumptech.glide.load.MultiTransformation; import com.bumptech.glide.load.MultiTransformation;
import com.bumptech.glide.load.resource.bitmap.CenterCrop; import com.bumptech.glide.load.resource.bitmap.CenterCrop;
import com.bumptech.glide.request.RequestOptions;
import java.util.List; import java.util.List;
import jp.wasabeef.glide.transformations.BlurTransformation; import jp.wasabeef.glide.transformations.BlurTransformation;
import jp.wasabeef.glide.transformations.ColorFilterTransformation; import jp.wasabeef.glide.transformations.ColorFilterTransformation;
@ -37,7 +34,6 @@ import jp.wasabeef.glide.transformations.gpu.ToonFilterTransformation;
import jp.wasabeef.glide.transformations.gpu.VignetteFilterTransformation; import jp.wasabeef.glide.transformations.gpu.VignetteFilterTransformation;
import static com.bumptech.glide.request.RequestOptions.bitmapTransform; import static com.bumptech.glide.request.RequestOptions.bitmapTransform;
import static com.bumptech.glide.request.RequestOptions.centerCropTransform;
import static com.bumptech.glide.request.RequestOptions.overrideOf; import static com.bumptech.glide.request.RequestOptions.overrideOf;
/** /**
@ -83,25 +79,26 @@ public class MainAdapter extends RecyclerView.Adapter<MainAdapter.ViewHolder> {
} }
@Override public void onBindViewHolder(MainAdapter.ViewHolder holder, int position) { @Override public void onBindViewHolder(MainAdapter.ViewHolder holder, int position) {
DisplayMetrics metrics = context.getResources().getDisplayMetrics();
switch (dataSet.get(position)) { switch (dataSet.get(position)) {
case Mask: { case Mask: {
int width = Utils.dip2px(context, 133.33f); int width = Utils.dip2px(context, 266.66f);
int height = Utils.dip2px(context, 126.33f); int height = Utils.dip2px(context, 252.66f);
Glide.with(context) Glide.with(context)
.load(R.drawable.check) .load(R.drawable.check)
.apply(overrideOf(width, height)) .apply(overrideOf(width, height))
.apply(bitmapTransform(new MultiTransformation<>(new CenterCrop(), new MaskTransformation(R.drawable.mask_starfish)))) .apply(bitmapTransform(new MultiTransformation<>(new CenterCrop(),
new MaskTransformation(R.drawable.mask_starfish))))
.into(holder.image); .into(holder.image);
break; break;
} }
case NinePatchMask: { case NinePatchMask: {
int width = Utils.dip2px(context, 150.0f); int width = Utils.dip2px(context, 300.0f);
int height = Utils.dip2px(context, 100.0f); int height = Utils.dip2px(context, 200.0f);
Glide.with(context) Glide.with(context)
.load(R.drawable.check) .load(R.drawable.check)
.apply(overrideOf(width, height)) .apply(overrideOf(width, height))
.apply(bitmapTransform(new MultiTransformation<>(new CenterCrop(), new MaskTransformation(R.drawable.mask_chat_right)))) .apply(bitmapTransform(new MultiTransformation<>(new CenterCrop(),
new MaskTransformation(R.drawable.mask_chat_right))))
.into(holder.image); .into(holder.image);
break; break;
} }
@ -117,7 +114,7 @@ public class MainAdapter extends RecyclerView.Adapter<MainAdapter.ViewHolder> {
Glide.with(context) Glide.with(context)
.load(R.drawable.demo) .load(R.drawable.demo)
.apply(bitmapTransform( .apply(bitmapTransform(
new CropTransformation(Utils.dip2px(context, 300), Utils.dip2px(context, 100)))) new CropTransformation(Utils.dip2px(context, 300), Utils.dip2px(context, 100), CropType.CENTER)))
.into(holder.image); .into(holder.image);
break; break;
case CropBottom: case CropBottom:

View File

@ -1,7 +1,7 @@
package jp.wasabeef.example.glide; package jp.wasabeef.example.glide;
/** /**
* Copyright (C) 2017 Wasabeef * Copyright (C) 2018 Wasabeef
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -1,15 +1,23 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="#CC000000"
tools:context=".MainActivity"
> >
<android.support.v7.widget.RecyclerView <android.support.v7.widget.RecyclerView
android:id="@+id/list" android:id="@+id/list"
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="0dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
/> />
</android.support.constraint.ConstraintLayout>
</RelativeLayout>

View File

@ -1,26 +1,37 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="5dp"
> >
<ImageView <ImageView
android:id="@+id/image" android:id="@+id/image"
android:layout_width="wrap_content" android:layout_width="250dp"
android:layout_height="wrap_content" android:layout_height="250dp"
android:layout_centerInParent="true" android:layout_marginBottom="8dp"
android:contentDescription="@null" android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:cropToPadding="false"
android:scaleType="fitCenter"
app:layout_constraintBottom_toTopOf="@+id/title"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
/> />
<TextView <TextView
android:id="@+id/title" android:id="@+id/title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/image" android:layout_marginBottom="8dp"
android:layout_centerHorizontal="true" android:layout_marginEnd="8dp"
android:layout_marginTop="5dp" android:layout_marginStart="8dp"
android:textColor="@android:color/white" android:text="title"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
/> />
</android.support.constraint.ConstraintLayout>
</RelativeLayout>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
</resources>

View File

@ -3,6 +3,9 @@
<!-- Base application theme. --> <!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. --> <!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style> </style>
</resources> </resources>

View File

@ -1,10 +1,10 @@
VERSION_NAME=3.0.1 VERSION_NAME=3.1.0
GROUP=jp.wasabeef GROUP=jp.wasabeef
ARTIFACT_ID=glide-transformations ARTIFACT_ID=glide-transformations
COMPILE_SDK_VERSION=25 COMPILE_SDK_VERSION=27
BUILD_TOOLS_VERSION=26.0.1 BUILD_TOOLS_VERSION=27.0.3
TARGET_SDK_VERSION=25 TARGET_SDK_VERSION=27
MIN_SDK_VERSION=14 MIN_SDK_VERSION=14
POM_DESCRIPTION=which provides simple Tranformations to Glide POM_DESCRIPTION=which provides simple Tranformations to Glide
@ -21,6 +21,6 @@ POM_DEVELOPER_EMAIL=dadadada.chop@gmail.com
POM_DEVELOPER_URL=wasabeef.jp POM_DEVELOPER_URL=wasabeef.jp
ISSUE_URL=https://github.com/wasabeef/glide-transformations/issues ISSUE_URL=https://github.com/wasabeef/glide-transformations/issues
SUPPORT_PACKAGE_VERSION=25.3.1 SUPPORT_PACKAGE_VERSION=27.0.2
GLIDE_VERSION=4.0.0 GLIDE_VERSION=4.5.0
GPUIMAGE_VERSION=1.4.1 GPUIMAGE_VERSION=1.4.1

View File

@ -1,6 +1,6 @@
#Tue Mar 21 11:51:07 PDT 2017 #Thu Jan 25 11:48:25 JST 2018
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-4.3-all.zip

View File

@ -16,9 +16,9 @@ android {
} }
dependencies { dependencies {
compile "com.github.bumptech.glide:glide:${GLIDE_VERSION}" implementation "com.github.bumptech.glide:glide:${GLIDE_VERSION}"
annotationProcessor "com.github.bumptech.glide:compiler:${GLIDE_VERSION}" annotationProcessor "com.github.bumptech.glide:compiler:${GLIDE_VERSION}"
provided "jp.co.cyberagent.android.gpuimage:gpuimage-library:${GPUIMAGE_VERSION}" compileOnly "jp.co.cyberagent.android.gpuimage:gpuimage-library:${GPUIMAGE_VERSION}"
} }
publish { publish {

View File

@ -1,7 +1,7 @@
package jp.wasabeef.glide.transformations; package jp.wasabeef.glide.transformations;
/** /**
* Copyright (C) 2017 Wasabeef * Copyright (C) 2018 Wasabeef
* Copyright 2014 Google, Inc. All rights reserved. * Copyright 2014 Google, Inc. All rights reserved.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -59,9 +59,7 @@ public abstract class BitmapTransformation implements Transformation<Bitmap> {
@Override public abstract void updateDiskCacheKey(MessageDigest messageDigest); @Override public abstract void updateDiskCacheKey(MessageDigest messageDigest);
@Override @Override public abstract boolean equals(Object o);
public abstract boolean equals(Object o);
@Override @Override public abstract int hashCode();
public abstract int hashCode();
} }

View File

@ -1,7 +1,7 @@
package jp.wasabeef.glide.transformations; package jp.wasabeef.glide.transformations;
/** /**
* Copyright (C) 2017 Wasabeef * Copyright (C) 2018 Wasabeef
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -31,7 +31,8 @@ import jp.wasabeef.glide.transformations.internal.RSBlur;
public class BlurTransformation extends BitmapTransformation { public class BlurTransformation extends BitmapTransformation {
private static final int VERSION = 1; private static final int VERSION = 1;
private static final String ID = "jp.wasabeef.glide.transformations.BlurTransformation." + VERSION; private static final String ID =
"jp.wasabeef.glide.transformations.BlurTransformation." + VERSION;
private static final byte[] ID_BYTES = ID.getBytes(CHARSET); private static final byte[] ID_BYTES = ID.getBytes(CHARSET);
private static int MAX_RADIUS = 25; private static int MAX_RADIUS = 25;
@ -86,18 +87,15 @@ public class BlurTransformation extends BitmapTransformation {
return "BlurTransformation(radius=" + radius + ", sampling=" + sampling + ")"; return "BlurTransformation(radius=" + radius + ", sampling=" + sampling + ")";
} }
@Override @Override public boolean equals(Object o) {
public boolean equals(Object o) {
return o instanceof BlurTransformation; return o instanceof BlurTransformation;
} }
@Override @Override public int hashCode() {
public int hashCode() {
return ID.hashCode(); return ID.hashCode();
} }
@Override @Override public void updateDiskCacheKey(MessageDigest messageDigest) {
public void updateDiskCacheKey(MessageDigest messageDigest) {
messageDigest.update(ID_BYTES); messageDigest.update(ID_BYTES);
} }
} }

View File

@ -1,7 +1,7 @@
package jp.wasabeef.glide.transformations; package jp.wasabeef.glide.transformations;
/** /**
* Copyright (C) 2017 Wasabeef * Copyright (C) 2018 Wasabeef
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -29,7 +29,8 @@ import java.security.MessageDigest;
public class ColorFilterTransformation extends BitmapTransformation { public class ColorFilterTransformation extends BitmapTransformation {
private static final int VERSION = 1; private static final int VERSION = 1;
private static final String ID = "jp.wasabeef.glide.transformations.ColorFilterTransformation." + VERSION; private static final String ID =
"jp.wasabeef.glide.transformations.ColorFilterTransformation." + VERSION;
private static final byte[] ID_BYTES = ID.getBytes(CHARSET); private static final byte[] ID_BYTES = ID.getBytes(CHARSET);
private int color; private int color;
@ -60,18 +61,15 @@ public class ColorFilterTransformation extends BitmapTransformation {
return "ColorFilterTransformation(color=" + color + ")"; return "ColorFilterTransformation(color=" + color + ")";
} }
@Override @Override public boolean equals(Object o) {
public boolean equals(Object o) {
return o instanceof ColorFilterTransformation; return o instanceof ColorFilterTransformation;
} }
@Override @Override public int hashCode() {
public int hashCode() {
return ID.hashCode(); return ID.hashCode();
} }
@Override @Override public void updateDiskCacheKey(MessageDigest messageDigest) {
public void updateDiskCacheKey(MessageDigest messageDigest) {
messageDigest.update(ID_BYTES); messageDigest.update(ID_BYTES);
} }
} }

View File

@ -1,7 +1,7 @@
package jp.wasabeef.glide.transformations; package jp.wasabeef.glide.transformations;
/** /**
* Copyright (C) 2017 Wasabeef * Copyright (C) 2018 Wasabeef
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -31,7 +31,8 @@ import java.security.MessageDigest;
public class CropCircleTransformation extends BitmapTransformation { public class CropCircleTransformation extends BitmapTransformation {
private static final int VERSION = 1; private static final int VERSION = 1;
private static final String ID = "jp.wasabeef.glide.transformations.CropCircleTransformation." + VERSION; private static final String ID =
"jp.wasabeef.glide.transformations.CropCircleTransformation." + VERSION;
private static final byte[] ID_BYTES = ID.getBytes(CHARSET); private static final byte[] ID_BYTES = ID.getBytes(CHARSET);
@Override protected Bitmap transform(@NonNull Context context, @NonNull BitmapPool pool, @Override protected Bitmap transform(@NonNull Context context, @NonNull BitmapPool pool,
@ -43,18 +44,15 @@ public class CropCircleTransformation extends BitmapTransformation {
return "CropCircleTransformation()"; return "CropCircleTransformation()";
} }
@Override @Override public boolean equals(Object o) {
public boolean equals(Object o) {
return o instanceof CropCircleTransformation; return o instanceof CropCircleTransformation;
} }
@Override @Override public int hashCode() {
public int hashCode() {
return ID.hashCode(); return ID.hashCode();
} }
@Override @Override public void updateDiskCacheKey(MessageDigest messageDigest) {
public void updateDiskCacheKey(MessageDigest messageDigest) {
messageDigest.update(ID_BYTES); messageDigest.update(ID_BYTES);
} }
} }

View File

@ -1,7 +1,7 @@
package jp.wasabeef.glide.transformations; package jp.wasabeef.glide.transformations;
/** /**
* Copyright (C) 2017 Wasabeef * Copyright (C) 2018 Wasabeef
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -26,7 +26,8 @@ import java.security.MessageDigest;
public class CropSquareTransformation extends BitmapTransformation { public class CropSquareTransformation extends BitmapTransformation {
private static final int VERSION = 1; private static final int VERSION = 1;
private static final String ID = "jp.wasabeef.glide.transformations.CropSquareTransformation." + VERSION; private static final String ID =
"jp.wasabeef.glide.transformations.CropSquareTransformation." + VERSION;
private static final byte[] ID_BYTES = ID.getBytes(CHARSET); private static final byte[] ID_BYTES = ID.getBytes(CHARSET);
private int size; private int size;
@ -41,18 +42,15 @@ public class CropSquareTransformation extends BitmapTransformation {
return "CropSquareTransformation(size=" + size + ")"; return "CropSquareTransformation(size=" + size + ")";
} }
@Override @Override public boolean equals(Object o) {
public boolean equals(Object o) {
return o instanceof CropSquareTransformation; return o instanceof CropSquareTransformation;
} }
@Override @Override public int hashCode() {
public int hashCode() {
return ID.hashCode(); return ID.hashCode();
} }
@Override @Override public void updateDiskCacheKey(MessageDigest messageDigest) {
public void updateDiskCacheKey(MessageDigest messageDigest) {
messageDigest.update(ID_BYTES); messageDigest.update(ID_BYTES);
} }
} }

View File

@ -1,7 +1,7 @@
package jp.wasabeef.glide.transformations; package jp.wasabeef.glide.transformations;
/** /**
* Copyright (C) 2017 Wasabeef * Copyright (C) 2018 Wasabeef
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -84,18 +84,15 @@ public class CropTransformation extends BitmapTransformation {
+ ")"; + ")";
} }
@Override @Override public boolean equals(Object o) {
public boolean equals(Object o) {
return o instanceof CropTransformation; return o instanceof CropTransformation;
} }
@Override @Override public int hashCode() {
public int hashCode() {
return ID.hashCode(); return ID.hashCode();
} }
@Override @Override public void updateDiskCacheKey(MessageDigest messageDigest) {
public void updateDiskCacheKey(MessageDigest messageDigest) {
messageDigest.update(ID_BYTES); messageDigest.update(ID_BYTES);
} }
@ -111,5 +108,4 @@ public class CropTransformation extends BitmapTransformation {
return 0; return 0;
} }
} }
} }

View File

@ -1,7 +1,7 @@
package jp.wasabeef.glide.transformations; package jp.wasabeef.glide.transformations;
/** /**
* Copyright (C) 2017 Wasabeef * Copyright (C) 2018 Wasabeef
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -29,7 +29,8 @@ import java.security.MessageDigest;
public class GrayscaleTransformation extends BitmapTransformation { public class GrayscaleTransformation extends BitmapTransformation {
private static final int VERSION = 1; private static final int VERSION = 1;
private static final String ID = "jp.wasabeef.glide.transformations.GrayscaleTransformation." + VERSION; private static final String ID =
"jp.wasabeef.glide.transformations.GrayscaleTransformation." + VERSION;
private static final byte[] ID_BYTES = ID.getBytes(CHARSET); private static final byte[] ID_BYTES = ID.getBytes(CHARSET);
@Override protected Bitmap transform(@NonNull Context context, @NonNull BitmapPool pool, @Override protected Bitmap transform(@NonNull Context context, @NonNull BitmapPool pool,
@ -55,18 +56,15 @@ public class GrayscaleTransformation extends BitmapTransformation {
return "GrayscaleTransformation()"; return "GrayscaleTransformation()";
} }
@Override @Override public boolean equals(Object o) {
public boolean equals(Object o) {
return o instanceof GrayscaleTransformation; return o instanceof GrayscaleTransformation;
} }
@Override @Override public int hashCode() {
public int hashCode() {
return ID.hashCode(); return ID.hashCode();
} }
@Override @Override public void updateDiskCacheKey(MessageDigest messageDigest) {
public void updateDiskCacheKey(MessageDigest messageDigest) {
messageDigest.update(ID_BYTES); messageDigest.update(ID_BYTES);
} }
} }

View File

@ -1,7 +1,7 @@
package jp.wasabeef.glide.transformations; package jp.wasabeef.glide.transformations;
/** /**
* Copyright (C) 2017 Wasabeef * Copyright (C) 2018 Wasabeef
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -31,7 +31,8 @@ import jp.wasabeef.glide.transformations.internal.Utils;
public class MaskTransformation extends BitmapTransformation { public class MaskTransformation extends BitmapTransformation {
private static final int VERSION = 1; private static final int VERSION = 1;
private static final String ID = "jp.wasabeef.glide.transformations.MaskTransformation." + VERSION; private static final String ID =
"jp.wasabeef.glide.transformations.MaskTransformation." + VERSION;
private static final byte[] ID_BYTES = ID.getBytes(CHARSET); private static final byte[] ID_BYTES = ID.getBytes(CHARSET);
private static Paint paint = new Paint(); private static Paint paint = new Paint();
@ -72,18 +73,15 @@ public class MaskTransformation extends BitmapTransformation {
return "MaskTransformation(maskId=" + maskId + ")"; return "MaskTransformation(maskId=" + maskId + ")";
} }
@Override @Override public boolean equals(Object o) {
public boolean equals(Object o) {
return o instanceof MaskTransformation; return o instanceof MaskTransformation;
} }
@Override @Override public int hashCode() {
public int hashCode() {
return ID.hashCode(); return ID.hashCode();
} }
@Override @Override public void updateDiskCacheKey(MessageDigest messageDigest) {
public void updateDiskCacheKey(MessageDigest messageDigest) {
messageDigest.update(ID_BYTES); messageDigest.update(ID_BYTES);
} }
} }

View File

@ -1,7 +1,7 @@
package jp.wasabeef.glide.transformations; package jp.wasabeef.glide.transformations;
/** /**
* Copyright (C) 2017 Wasabeef * Copyright (C) 2018 Wasabeef
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -131,8 +131,8 @@ public class RoundedCornersTransformation extends BitmapTransformation {
} }
private void drawTopLeftRoundRect(Canvas canvas, Paint paint, float right, float bottom) { private void drawTopLeftRoundRect(Canvas canvas, Paint paint, float right, float bottom) {
canvas.drawRoundRect(new RectF(margin, margin, margin + diameter, margin + diameter), canvas.drawRoundRect(new RectF(margin, margin, margin + diameter, margin + diameter), radius,
radius, radius, paint); radius, paint);
canvas.drawRect(new RectF(margin, margin + radius, margin + radius, bottom), paint); canvas.drawRect(new RectF(margin, margin + radius, margin + radius, bottom), paint);
canvas.drawRect(new RectF(margin + radius, margin, right, bottom), paint); canvas.drawRect(new RectF(margin + radius, margin, right, bottom), paint);
} }
@ -145,8 +145,8 @@ public class RoundedCornersTransformation extends BitmapTransformation {
} }
private void drawBottomLeftRoundRect(Canvas canvas, Paint paint, float right, float bottom) { private void drawBottomLeftRoundRect(Canvas canvas, Paint paint, float right, float bottom) {
canvas.drawRoundRect(new RectF(margin, bottom - diameter, margin + diameter, bottom), canvas.drawRoundRect(new RectF(margin, bottom - diameter, margin + diameter, bottom), radius,
radius, radius, paint); radius, paint);
canvas.drawRect(new RectF(margin, margin, margin + diameter, bottom - radius), paint); canvas.drawRect(new RectF(margin, margin, margin + diameter, bottom - radius), paint);
canvas.drawRect(new RectF(margin + radius, margin, right, bottom), paint); canvas.drawRect(new RectF(margin + radius, margin, right, bottom), paint);
} }
@ -177,16 +177,14 @@ public class RoundedCornersTransformation extends BitmapTransformation {
} }
private void drawRightRoundRect(Canvas canvas, Paint paint, float right, float bottom) { private void drawRightRoundRect(Canvas canvas, Paint paint, float right, float bottom) {
canvas.drawRoundRect(new RectF(right - diameter, margin, right, bottom), radius, radius, canvas.drawRoundRect(new RectF(right - diameter, margin, right, bottom), radius, radius, paint);
paint);
canvas.drawRect(new RectF(margin, margin, right - radius, bottom), paint); canvas.drawRect(new RectF(margin, margin, right - radius, bottom), paint);
} }
private void drawOtherTopLeftRoundRect(Canvas canvas, Paint paint, float right, float bottom) { private void drawOtherTopLeftRoundRect(Canvas canvas, Paint paint, float right, float bottom) {
canvas.drawRoundRect(new RectF(margin, bottom - diameter, right, bottom), radius, radius, canvas.drawRoundRect(new RectF(margin, bottom - diameter, right, bottom), radius, radius,
paint); paint);
canvas.drawRoundRect(new RectF(right - diameter, margin, right, bottom), radius, radius, canvas.drawRoundRect(new RectF(right - diameter, margin, right, bottom), radius, radius, paint);
paint);
canvas.drawRect(new RectF(margin, margin, right - radius, bottom - radius), paint); canvas.drawRect(new RectF(margin, margin, right - radius, bottom - radius), paint);
} }
@ -201,8 +199,7 @@ public class RoundedCornersTransformation extends BitmapTransformation {
private void drawOtherBottomLeftRoundRect(Canvas canvas, Paint paint, float right, float bottom) { private void drawOtherBottomLeftRoundRect(Canvas canvas, Paint paint, float right, float bottom) {
canvas.drawRoundRect(new RectF(margin, margin, right, margin + diameter), radius, radius, canvas.drawRoundRect(new RectF(margin, margin, right, margin + diameter), radius, radius,
paint); paint);
canvas.drawRoundRect(new RectF(right - diameter, margin, right, bottom), radius, radius, canvas.drawRoundRect(new RectF(right - diameter, margin, right, bottom), radius, radius, paint);
paint);
canvas.drawRect(new RectF(margin, margin + radius, right - radius, bottom), paint); canvas.drawRect(new RectF(margin, margin + radius, right - radius, bottom), paint);
} }
@ -217,8 +214,8 @@ public class RoundedCornersTransformation extends BitmapTransformation {
private void drawDiagonalFromTopLeftRoundRect(Canvas canvas, Paint paint, float right, private void drawDiagonalFromTopLeftRoundRect(Canvas canvas, Paint paint, float right,
float bottom) { float bottom) {
canvas.drawRoundRect(new RectF(margin, margin, margin + diameter, margin + diameter), canvas.drawRoundRect(new RectF(margin, margin, margin + diameter, margin + diameter), radius,
radius, radius, paint); radius, paint);
canvas.drawRoundRect(new RectF(right - diameter, bottom - diameter, right, bottom), radius, canvas.drawRoundRect(new RectF(right - diameter, bottom - diameter, right, bottom), radius,
radius, paint); radius, paint);
canvas.drawRect(new RectF(margin, margin + radius, right - diameter, bottom), paint); canvas.drawRect(new RectF(margin, margin + radius, right - diameter, bottom), paint);
@ -229,8 +226,8 @@ public class RoundedCornersTransformation extends BitmapTransformation {
float bottom) { float bottom) {
canvas.drawRoundRect(new RectF(right - diameter, margin, right, margin + diameter), radius, canvas.drawRoundRect(new RectF(right - diameter, margin, right, margin + diameter), radius,
radius, paint); radius, paint);
canvas.drawRoundRect(new RectF(margin, bottom - diameter, margin + diameter, bottom), canvas.drawRoundRect(new RectF(margin, bottom - diameter, margin + diameter, bottom), radius,
radius, radius, paint); radius, paint);
canvas.drawRect(new RectF(margin, margin, right - radius, bottom - radius), paint); canvas.drawRect(new RectF(margin, margin, right - radius, bottom - radius), paint);
canvas.drawRect(new RectF(margin + radius, margin + radius, right, bottom), paint); canvas.drawRect(new RectF(margin + radius, margin + radius, right, bottom), paint);
} }
@ -240,18 +237,15 @@ public class RoundedCornersTransformation extends BitmapTransformation {
+ diameter + ", cornerType=" + cornerType.name() + ")"; + diameter + ", cornerType=" + cornerType.name() + ")";
} }
@Override @Override public boolean equals(Object o) {
public boolean equals(Object o) {
return o instanceof RoundedCornersTransformation; return o instanceof RoundedCornersTransformation;
} }
@Override @Override public int hashCode() {
public int hashCode() {
return ID.hashCode(); return ID.hashCode();
} }
@Override @Override public void updateDiskCacheKey(MessageDigest messageDigest) {
public void updateDiskCacheKey(MessageDigest messageDigest) {
messageDigest.update(ID_BYTES); messageDigest.update(ID_BYTES);
} }
} }

View File

@ -1,7 +1,7 @@
package jp.wasabeef.glide.transformations.gpu; package jp.wasabeef.glide.transformations.gpu;
/** /**
* Copyright (C) 2017 Wasabeef * Copyright (C) 2018 Wasabeef
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -25,7 +25,8 @@ import jp.co.cyberagent.android.gpuimage.GPUImageBrightnessFilter;
public class BrightnessFilterTransformation extends GPUFilterTransformation { public class BrightnessFilterTransformation extends GPUFilterTransformation {
private static final int VERSION = 1; private static final int VERSION = 1;
private static final String ID = "jp.wasabeef.glide.transformations.gpu.BrightnessFilterTransformation." + VERSION; private static final String ID =
"jp.wasabeef.glide.transformations.gpu.BrightnessFilterTransformation." + VERSION;
private static final byte[] ID_BYTES = ID.getBytes(CHARSET); private static final byte[] ID_BYTES = ID.getBytes(CHARSET);
private float brightness; private float brightness;
@ -45,18 +46,15 @@ public class BrightnessFilterTransformation extends GPUFilterTransformation {
return "BrightnessFilterTransformation(brightness=" + brightness + ")"; return "BrightnessFilterTransformation(brightness=" + brightness + ")";
} }
@Override @Override public boolean equals(Object o) {
public boolean equals(Object o) {
return o instanceof BrightnessFilterTransformation; return o instanceof BrightnessFilterTransformation;
} }
@Override @Override public int hashCode() {
public int hashCode() {
return ID.hashCode(); return ID.hashCode();
} }
@Override @Override public void updateDiskCacheKey(MessageDigest messageDigest) {
public void updateDiskCacheKey(MessageDigest messageDigest) {
messageDigest.update(ID_BYTES); messageDigest.update(ID_BYTES);
} }
} }

View File

@ -1,7 +1,7 @@
package jp.wasabeef.glide.transformations.gpu; package jp.wasabeef.glide.transformations.gpu;
/** /**
* Copyright (C) 2017 Wasabeef * Copyright (C) 2018 Wasabeef
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -25,7 +25,8 @@ import jp.co.cyberagent.android.gpuimage.GPUImageContrastFilter;
public class ContrastFilterTransformation extends GPUFilterTransformation { public class ContrastFilterTransformation extends GPUFilterTransformation {
private static final int VERSION = 1; private static final int VERSION = 1;
private static final String ID = "jp.wasabeef.glide.transformations.gpu.ContrastFilterTransformation." + VERSION; private static final String ID =
"jp.wasabeef.glide.transformations.gpu.ContrastFilterTransformation." + VERSION;
private static final byte[] ID_BYTES = ID.getBytes(CHARSET); private static final byte[] ID_BYTES = ID.getBytes(CHARSET);
private float contrast; private float contrast;
@ -45,18 +46,15 @@ public class ContrastFilterTransformation extends GPUFilterTransformation {
return "ContrastFilterTransformation(contrast=" + contrast + ")"; return "ContrastFilterTransformation(contrast=" + contrast + ")";
} }
@Override @Override public boolean equals(Object o) {
public boolean equals(Object o) {
return o instanceof ContrastFilterTransformation; return o instanceof ContrastFilterTransformation;
} }
@Override @Override public int hashCode() {
public int hashCode() {
return ID.hashCode(); return ID.hashCode();
} }
@Override @Override public void updateDiskCacheKey(MessageDigest messageDigest) {
public void updateDiskCacheKey(MessageDigest messageDigest) {
messageDigest.update(ID_BYTES); messageDigest.update(ID_BYTES);
} }
} }

View File

@ -1,7 +1,7 @@
package jp.wasabeef.glide.transformations.gpu; package jp.wasabeef.glide.transformations.gpu;
/** /**
* Copyright (C) 2017 Wasabeef * Copyright (C) 2018 Wasabeef
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -28,7 +28,8 @@ import jp.wasabeef.glide.transformations.BitmapTransformation;
public class GPUFilterTransformation extends BitmapTransformation { public class GPUFilterTransformation extends BitmapTransformation {
private static final int VERSION = 1; private static final int VERSION = 1;
private static final String ID = "jp.wasabeef.glide.transformations.gpu.GPUFilterTransformation." + VERSION; private static final String ID =
"jp.wasabeef.glide.transformations.gpu.GPUFilterTransformation." + VERSION;
private static final byte[] ID_BYTES = ID.getBytes(CHARSET); private static final byte[] ID_BYTES = ID.getBytes(CHARSET);
private GPUImageFilter gpuImageFilter; private GPUImageFilter gpuImageFilter;
@ -54,18 +55,15 @@ public class GPUFilterTransformation extends BitmapTransformation {
return (T) gpuImageFilter; return (T) gpuImageFilter;
} }
@Override @Override public boolean equals(Object o) {
public boolean equals(Object o) {
return o instanceof GPUFilterTransformation; return o instanceof GPUFilterTransformation;
} }
@Override @Override public int hashCode() {
public int hashCode() {
return ID.hashCode(); return ID.hashCode();
} }
@Override @Override public void updateDiskCacheKey(MessageDigest messageDigest) {
public void updateDiskCacheKey(MessageDigest messageDigest) {
messageDigest.update(ID_BYTES); messageDigest.update(ID_BYTES);
} }
} }

View File

@ -1,7 +1,7 @@
package jp.wasabeef.glide.transformations.gpu; package jp.wasabeef.glide.transformations.gpu;
/** /**
* Copyright (C) 2017 Wasabeef * Copyright (C) 2018 Wasabeef
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -25,7 +25,8 @@ import jp.co.cyberagent.android.gpuimage.GPUImageColorInvertFilter;
public class InvertFilterTransformation extends GPUFilterTransformation { public class InvertFilterTransformation extends GPUFilterTransformation {
private static final int VERSION = 1; private static final int VERSION = 1;
private static final String ID = "jp.wasabeef.glide.transformations.gpu.InvertFilterTransformation." + VERSION; private static final String ID =
"jp.wasabeef.glide.transformations.gpu.InvertFilterTransformation." + VERSION;
private static final byte[] ID_BYTES = ID.getBytes(CHARSET); private static final byte[] ID_BYTES = ID.getBytes(CHARSET);
public InvertFilterTransformation() { public InvertFilterTransformation() {
@ -36,18 +37,15 @@ public class InvertFilterTransformation extends GPUFilterTransformation {
return "InvertFilterTransformation()"; return "InvertFilterTransformation()";
} }
@Override @Override public boolean equals(Object o) {
public boolean equals(Object o) {
return o instanceof InvertFilterTransformation; return o instanceof InvertFilterTransformation;
} }
@Override @Override public int hashCode() {
public int hashCode() {
return ID.hashCode(); return ID.hashCode();
} }
@Override @Override public void updateDiskCacheKey(MessageDigest messageDigest) {
public void updateDiskCacheKey(MessageDigest messageDigest) {
messageDigest.update(ID_BYTES); messageDigest.update(ID_BYTES);
} }
} }

View File

@ -1,7 +1,7 @@
package jp.wasabeef.glide.transformations.gpu; package jp.wasabeef.glide.transformations.gpu;
/** /**
* Copyright (C) 2017 Wasabeef * Copyright (C) 2018 Wasabeef
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -28,7 +28,8 @@ import jp.co.cyberagent.android.gpuimage.GPUImageKuwaharaFilter;
public class KuwaharaFilterTransformation extends GPUFilterTransformation { public class KuwaharaFilterTransformation extends GPUFilterTransformation {
private static final int VERSION = 1; private static final int VERSION = 1;
private static final String ID = "jp.wasabeef.glide.transformations.gpu.KuwaharaFilterTransformation." + VERSION; private static final String ID =
"jp.wasabeef.glide.transformations.gpu.KuwaharaFilterTransformation." + VERSION;
private static final byte[] ID_BYTES = ID.getBytes(CHARSET); private static final byte[] ID_BYTES = ID.getBytes(CHARSET);
private int radius; private int radius;
@ -48,18 +49,15 @@ public class KuwaharaFilterTransformation extends GPUFilterTransformation {
return "KuwaharaFilterTransformation(radius=" + radius + ")"; return "KuwaharaFilterTransformation(radius=" + radius + ")";
} }
@Override @Override public boolean equals(Object o) {
public boolean equals(Object o) {
return o instanceof KuwaharaFilterTransformation; return o instanceof KuwaharaFilterTransformation;
} }
@Override @Override public int hashCode() {
public int hashCode() {
return ID.hashCode(); return ID.hashCode();
} }
@Override @Override public void updateDiskCacheKey(MessageDigest messageDigest) {
public void updateDiskCacheKey(MessageDigest messageDigest) {
messageDigest.update(ID_BYTES); messageDigest.update(ID_BYTES);
} }
} }

View File

@ -1,7 +1,7 @@
package jp.wasabeef.glide.transformations.gpu; package jp.wasabeef.glide.transformations.gpu;
/** /**
* Copyright (C) 2017 Wasabeef * Copyright (C) 2018 Wasabeef
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -27,7 +27,8 @@ import jp.co.cyberagent.android.gpuimage.GPUImagePixelationFilter;
public class PixelationFilterTransformation extends GPUFilterTransformation { public class PixelationFilterTransformation extends GPUFilterTransformation {
private static final int VERSION = 1; private static final int VERSION = 1;
private static final String ID = "jp.wasabeef.glide.transformations.gpu.PixelationFilterTransformation." + VERSION; private static final String ID =
"jp.wasabeef.glide.transformations.gpu.PixelationFilterTransformation." + VERSION;
private static final byte[] ID_BYTES = ID.getBytes(CHARSET); private static final byte[] ID_BYTES = ID.getBytes(CHARSET);
private float pixel; private float pixel;
@ -47,18 +48,15 @@ public class PixelationFilterTransformation extends GPUFilterTransformation {
return "PixelationFilterTransformation(pixel=" + pixel + ")"; return "PixelationFilterTransformation(pixel=" + pixel + ")";
} }
@Override @Override public boolean equals(Object o) {
public boolean equals(Object o) {
return o instanceof PixelationFilterTransformation; return o instanceof PixelationFilterTransformation;
} }
@Override @Override public int hashCode() {
public int hashCode() {
return ID.hashCode(); return ID.hashCode();
} }
@Override @Override public void updateDiskCacheKey(MessageDigest messageDigest) {
public void updateDiskCacheKey(MessageDigest messageDigest) {
messageDigest.update(ID_BYTES); messageDigest.update(ID_BYTES);
} }
} }

View File

@ -1,7 +1,7 @@
package jp.wasabeef.glide.transformations.gpu; package jp.wasabeef.glide.transformations.gpu;
/** /**
* Copyright (C) 2017 Wasabeef * Copyright (C) 2018 Wasabeef
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -27,7 +27,8 @@ import jp.co.cyberagent.android.gpuimage.GPUImageSepiaFilter;
public class SepiaFilterTransformation extends GPUFilterTransformation { public class SepiaFilterTransformation extends GPUFilterTransformation {
private static final int VERSION = 1; private static final int VERSION = 1;
private static final String ID = "jp.wasabeef.glide.transformations.gpu.SepiaFilterTransformation." + VERSION; private static final String ID =
"jp.wasabeef.glide.transformations.gpu.SepiaFilterTransformation." + VERSION;
private static final byte[] ID_BYTES = ID.getBytes(CHARSET); private static final byte[] ID_BYTES = ID.getBytes(CHARSET);
private float intensity; private float intensity;
@ -47,18 +48,15 @@ public class SepiaFilterTransformation extends GPUFilterTransformation {
return "SepiaFilterTransformation(intensity=" + intensity + ")"; return "SepiaFilterTransformation(intensity=" + intensity + ")";
} }
@Override @Override public boolean equals(Object o) {
public boolean equals(Object o) {
return o instanceof SepiaFilterTransformation; return o instanceof SepiaFilterTransformation;
} }
@Override @Override public int hashCode() {
public int hashCode() {
return ID.hashCode(); return ID.hashCode();
} }
@Override @Override public void updateDiskCacheKey(MessageDigest messageDigest) {
public void updateDiskCacheKey(MessageDigest messageDigest) {
messageDigest.update(ID_BYTES); messageDigest.update(ID_BYTES);
} }
} }

View File

@ -1,7 +1,7 @@
package jp.wasabeef.glide.transformations.gpu; package jp.wasabeef.glide.transformations.gpu;
/** /**
* Copyright (C) 2017 Wasabeef * Copyright (C) 2018 Wasabeef
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -22,7 +22,8 @@ import jp.co.cyberagent.android.gpuimage.GPUImageSketchFilter;
public class SketchFilterTransformation extends GPUFilterTransformation { public class SketchFilterTransformation extends GPUFilterTransformation {
private static final int VERSION = 1; private static final int VERSION = 1;
private static final String ID = "jp.wasabeef.glide.transformations.gpu.SketchFilterTransformation." + VERSION; private static final String ID =
"jp.wasabeef.glide.transformations.gpu.SketchFilterTransformation." + VERSION;
private static final byte[] ID_BYTES = ID.getBytes(CHARSET); private static final byte[] ID_BYTES = ID.getBytes(CHARSET);
public SketchFilterTransformation() { public SketchFilterTransformation() {
@ -33,18 +34,15 @@ public class SketchFilterTransformation extends GPUFilterTransformation {
return "SketchFilterTransformation()"; return "SketchFilterTransformation()";
} }
@Override @Override public boolean equals(Object o) {
public boolean equals(Object o) {
return o instanceof SketchFilterTransformation; return o instanceof SketchFilterTransformation;
} }
@Override @Override public int hashCode() {
public int hashCode() {
return ID.hashCode(); return ID.hashCode();
} }
@Override @Override public void updateDiskCacheKey(MessageDigest messageDigest) {
public void updateDiskCacheKey(MessageDigest messageDigest) {
messageDigest.update(ID_BYTES); messageDigest.update(ID_BYTES);
} }
} }

View File

@ -1,7 +1,7 @@
package jp.wasabeef.glide.transformations.gpu; package jp.wasabeef.glide.transformations.gpu;
/** /**
* Copyright (C) 2017 Wasabeef * Copyright (C) 2018 Wasabeef
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -26,7 +26,8 @@ import jp.co.cyberagent.android.gpuimage.GPUImageSwirlFilter;
public class SwirlFilterTransformation extends GPUFilterTransformation { public class SwirlFilterTransformation extends GPUFilterTransformation {
private static final int VERSION = 1; private static final int VERSION = 1;
private static final String ID = "jp.wasabeef.glide.transformations.gpu.SwirlFilterTransformation." + VERSION; private static final String ID =
"jp.wasabeef.glide.transformations.gpu.SwirlFilterTransformation." + VERSION;
private static final byte[] ID_BYTES = ID.getBytes(CHARSET); private static final byte[] ID_BYTES = ID.getBytes(CHARSET);
private float radius; private float radius;
@ -54,22 +55,19 @@ public class SwirlFilterTransformation extends GPUFilterTransformation {
} }
@Override public String toString() { @Override public String toString() {
return "SwirlFilterTransformation(radius=" + radius + return "SwirlFilterTransformation(radius=" + radius + ",angle=" + angle + ",center="
",angle=" + angle + ",center=" + center.toString() + ")"; + center.toString() + ")";
} }
@Override @Override public boolean equals(Object o) {
public boolean equals(Object o) {
return o instanceof SwirlFilterTransformation; return o instanceof SwirlFilterTransformation;
} }
@Override @Override public int hashCode() {
public int hashCode() {
return ID.hashCode(); return ID.hashCode();
} }
@Override @Override public void updateDiskCacheKey(MessageDigest messageDigest) {
public void updateDiskCacheKey(MessageDigest messageDigest) {
messageDigest.update(ID_BYTES); messageDigest.update(ID_BYTES);
} }
} }

View File

@ -1,7 +1,7 @@
package jp.wasabeef.glide.transformations.gpu; package jp.wasabeef.glide.transformations.gpu;
/** /**
* Copyright (C) 2017 Wasabeef * Copyright (C) 2018 Wasabeef
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -27,7 +27,8 @@ import jp.co.cyberagent.android.gpuimage.GPUImageToonFilter;
public class ToonFilterTransformation extends GPUFilterTransformation { public class ToonFilterTransformation extends GPUFilterTransformation {
private static final int VERSION = 1; private static final int VERSION = 1;
private static final String ID = "jp.wasabeef.glide.transformations.gpu.ToonFilterTransformation." + VERSION; private static final String ID =
"jp.wasabeef.glide.transformations.gpu.ToonFilterTransformation." + VERSION;
private static final byte[] ID_BYTES = ID.getBytes(CHARSET); private static final byte[] ID_BYTES = ID.getBytes(CHARSET);
private float threshold; private float threshold;
@ -47,22 +48,19 @@ public class ToonFilterTransformation extends GPUFilterTransformation {
} }
@Override public String toString() { @Override public String toString() {
return "ToonFilterTransformation(threshold=" + threshold + return "ToonFilterTransformation(threshold=" + threshold + ",quantizationLevels="
",quantizationLevels=" + quantizationLevels + ")"; + quantizationLevels + ")";
} }
@Override @Override public boolean equals(Object o) {
public boolean equals(Object o) {
return o instanceof ToonFilterTransformation; return o instanceof ToonFilterTransformation;
} }
@Override @Override public int hashCode() {
public int hashCode() {
return ID.hashCode(); return ID.hashCode();
} }
@Override @Override public void updateDiskCacheKey(MessageDigest messageDigest) {
public void updateDiskCacheKey(MessageDigest messageDigest) {
messageDigest.update(ID_BYTES); messageDigest.update(ID_BYTES);
} }
} }

View File

@ -1,7 +1,7 @@
package jp.wasabeef.glide.transformations.gpu; package jp.wasabeef.glide.transformations.gpu;
/** /**
* Copyright (C) 2017 Wasabeef * Copyright (C) 2018 Wasabeef
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -29,7 +29,8 @@ import jp.co.cyberagent.android.gpuimage.GPUImageVignetteFilter;
public class VignetteFilterTransformation extends GPUFilterTransformation { public class VignetteFilterTransformation extends GPUFilterTransformation {
private static final int VERSION = 1; private static final int VERSION = 1;
private static final String ID = "jp.wasabeef.glide.transformations.gpu.VignetteFilterTransformation." + VERSION; private static final String ID =
"jp.wasabeef.glide.transformations.gpu.VignetteFilterTransformation." + VERSION;
private static final byte[] ID_BYTES = ID.getBytes(CHARSET); private static final byte[] ID_BYTES = ID.getBytes(CHARSET);
private PointF center; private PointF center;
@ -55,23 +56,19 @@ public class VignetteFilterTransformation extends GPUFilterTransformation {
} }
@Override public String toString() { @Override public String toString() {
return "VignetteFilterTransformation(center=" + center.toString() + return "VignetteFilterTransformation(center=" + center.toString() + ",color=" + Arrays.toString(
",color=" + Arrays.toString(vignetteColor) + vignetteColor) + ",start=" + vignetteStart + ",end=" + vignetteEnd + ")";
",start=" + vignetteStart + ",end=" + vignetteEnd + ")";
} }
@Override @Override public boolean equals(Object o) {
public boolean equals(Object o) {
return o instanceof VignetteFilterTransformation; return o instanceof VignetteFilterTransformation;
} }
@Override @Override public int hashCode() {
public int hashCode() {
return ID.hashCode(); return ID.hashCode();
} }
@Override @Override public void updateDiskCacheKey(MessageDigest messageDigest) {
public void updateDiskCacheKey(MessageDigest messageDigest) {
messageDigest.update(ID_BYTES); messageDigest.update(ID_BYTES);
} }
} }

View File

@ -3,7 +3,7 @@ package jp.wasabeef.glide.transformations.internal;
import android.graphics.Bitmap; import android.graphics.Bitmap;
/** /**
* Copyright (C) 2017 Wasabeef * Copyright (C) 2018 Wasabeef
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -11,7 +11,7 @@ import android.renderscript.RenderScript;
import android.renderscript.ScriptIntrinsicBlur; import android.renderscript.ScriptIntrinsicBlur;
/** /**
* Copyright (C) 2017 Wasabeef * Copyright (C) 2018 Wasabeef
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -48,7 +48,11 @@ public class RSBlur {
output.copyTo(bitmap); output.copyTo(bitmap);
} finally { } finally {
if (rs != null) { if (rs != null) {
rs.destroy(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
RenderScript.releaseAllContexts();
} else {
rs.destroy();
}
} }
if (input != null) { if (input != null) {
input.destroy(); input.destroy();

View File

@ -5,7 +5,7 @@ import android.graphics.drawable.Drawable;
import android.os.Build; import android.os.Build;
/** /**
* Copyright (C) 2017 Wasabeef * Copyright (C) 2018 Wasabeef
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.