1
0
mirror of https://github.com/wasabeef/glide-transformations.git synced 2025-08-07 11:59:31 +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
==========
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)*
----------------------------

View File

@ -32,9 +32,9 @@ repositories {
}
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
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
-------
Copyright 2017 Wasabeef
Copyright 2018 Wasabeef
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.

View File

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

View File

@ -52,10 +52,11 @@ def getKeyAliasPasswordProperty() {
}
dependencies {
compile project(':transformations')
compile "com.github.bumptech.glide:glide:${GLIDE_VERSION}"
implementation project(':transformations')
implementation "com.github.bumptech.glide:glide:${GLIDE_VERSION}"
annotationProcessor "com.github.bumptech.glide:compiler:${GLIDE_VERSION}"
compile "jp.co.cyberagent.android.gpuimage:gpuimage-library:${GPUIMAGE_VERSION}"
compile "com.android.support:appcompat-v7:${SUPPORT_PACKAGE_VERSION}"
compile "com.android.support:recyclerview-v7:${SUPPORT_PACKAGE_VERSION}"
implementation "jp.co.cyberagent.android.gpuimage:gpuimage-library:${GPUIMAGE_VERSION}"
implementation "com.android.support:appcompat-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.support.v7.app.AppCompatActivity;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import java.util.ArrayList;
import java.util.List;
@ -15,7 +15,7 @@ public class MainActivity extends AppCompatActivity {
setContentView(R.layout.activity_main);
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.list);
recyclerView.setLayoutManager(new GridLayoutManager(this, 2));
recyclerView.setLayoutManager(new LinearLayoutManager(this));
List<Type> dataSet = new ArrayList<>();
dataSet.add(Type.Mask);

View File

@ -1,11 +1,9 @@
package jp.wasabeef.example.glide;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.PointF;
import android.support.v7.widget.RecyclerView;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -14,7 +12,6 @@ import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.MultiTransformation;
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
import com.bumptech.glide.request.RequestOptions;
import java.util.List;
import jp.wasabeef.glide.transformations.BlurTransformation;
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 static com.bumptech.glide.request.RequestOptions.bitmapTransform;
import static com.bumptech.glide.request.RequestOptions.centerCropTransform;
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) {
DisplayMetrics metrics = context.getResources().getDisplayMetrics();
switch (dataSet.get(position)) {
case Mask: {
int width = Utils.dip2px(context, 133.33f);
int height = Utils.dip2px(context, 126.33f);
int width = Utils.dip2px(context, 266.66f);
int height = Utils.dip2px(context, 252.66f);
Glide.with(context)
.load(R.drawable.check)
.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);
break;
}
case NinePatchMask: {
int width = Utils.dip2px(context, 150.0f);
int height = Utils.dip2px(context, 100.0f);
int width = Utils.dip2px(context, 300.0f);
int height = Utils.dip2px(context, 200.0f);
Glide.with(context)
.load(R.drawable.check)
.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);
break;
}
@ -117,7 +114,7 @@ public class MainAdapter extends RecyclerView.Adapter<MainAdapter.ViewHolder> {
Glide.with(context)
.load(R.drawable.demo)
.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);
break;
case CropBottom:

View File

@ -1,7 +1,7 @@
package jp.wasabeef.example.glide;
/**
* Copyright (C) 2017 Wasabeef
* Copyright (C) 2018 Wasabeef
*
* Licensed under the Apache License, Version 2.0 (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"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#CC000000"
tools:context=".MainActivity"
>
<android.support.v7.widget.RecyclerView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_width="0dp"
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"
/>
</RelativeLayout>
</android.support.constraint.ConstraintLayout>

View File

@ -1,26 +1,37 @@
<?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_height="wrap_content"
android:padding="5dp"
>
<ImageView
android:id="@+id/image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:contentDescription="@null"
android:layout_width="250dp"
android:layout_height="250dp"
android:layout_marginBottom="8dp"
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
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/image"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:textColor="@android:color/white"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:text="title"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
/>
</RelativeLayout>
</android.support.constraint.ConstraintLayout>

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. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>
</resources>

View File

@ -1,10 +1,10 @@
VERSION_NAME=3.0.1
VERSION_NAME=3.1.0
GROUP=jp.wasabeef
ARTIFACT_ID=glide-transformations
COMPILE_SDK_VERSION=25
BUILD_TOOLS_VERSION=26.0.1
TARGET_SDK_VERSION=25
COMPILE_SDK_VERSION=27
BUILD_TOOLS_VERSION=27.0.3
TARGET_SDK_VERSION=27
MIN_SDK_VERSION=14
POM_DESCRIPTION=which provides simple Tranformations to Glide
@ -21,6 +21,6 @@ POM_DEVELOPER_EMAIL=dadadada.chop@gmail.com
POM_DEVELOPER_URL=wasabeef.jp
ISSUE_URL=https://github.com/wasabeef/glide-transformations/issues
SUPPORT_PACKAGE_VERSION=25.3.1
GLIDE_VERSION=4.0.0
SUPPORT_PACKAGE_VERSION=27.0.2
GLIDE_VERSION=4.5.0
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
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
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 {
compile "com.github.bumptech.glide:glide:${GLIDE_VERSION}"
implementation "com.github.bumptech.glide:glide:${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 {

View File

@ -1,7 +1,7 @@
package jp.wasabeef.glide.transformations;
/**
* Copyright (C) 2017 Wasabeef
* Copyright (C) 2018 Wasabeef
* Copyright 2014 Google, Inc. All rights reserved.
*
* 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 boolean equals(Object o);
@Override public abstract boolean equals(Object o);
@Override
public abstract int hashCode();
@Override public abstract int hashCode();
}

View File

@ -1,7 +1,7 @@
package jp.wasabeef.glide.transformations;
/**
* Copyright (C) 2017 Wasabeef
* Copyright (C) 2018 Wasabeef
*
* Licensed under the Apache License, Version 2.0 (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 {
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 int MAX_RADIUS = 25;
@ -86,18 +87,15 @@ public class BlurTransformation extends BitmapTransformation {
return "BlurTransformation(radius=" + radius + ", sampling=" + sampling + ")";
}
@Override
public boolean equals(Object o) {
@Override public boolean equals(Object o) {
return o instanceof BlurTransformation;
}
@Override
public int hashCode() {
@Override public int hashCode() {
return ID.hashCode();
}
@Override
public void updateDiskCacheKey(MessageDigest messageDigest) {
@Override public void updateDiskCacheKey(MessageDigest messageDigest) {
messageDigest.update(ID_BYTES);
}
}

View File

@ -1,7 +1,7 @@
package jp.wasabeef.glide.transformations;
/**
* Copyright (C) 2017 Wasabeef
* Copyright (C) 2018 Wasabeef
*
* Licensed under the Apache License, Version 2.0 (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 {
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 int color;
@ -60,18 +61,15 @@ public class ColorFilterTransformation extends BitmapTransformation {
return "ColorFilterTransformation(color=" + color + ")";
}
@Override
public boolean equals(Object o) {
@Override public boolean equals(Object o) {
return o instanceof ColorFilterTransformation;
}
@Override
public int hashCode() {
@Override public int hashCode() {
return ID.hashCode();
}
@Override
public void updateDiskCacheKey(MessageDigest messageDigest) {
@Override public void updateDiskCacheKey(MessageDigest messageDigest) {
messageDigest.update(ID_BYTES);
}
}

View File

@ -1,7 +1,7 @@
package jp.wasabeef.glide.transformations;
/**
* Copyright (C) 2017 Wasabeef
* Copyright (C) 2018 Wasabeef
*
* Licensed under the Apache License, Version 2.0 (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 {
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);
@Override protected Bitmap transform(@NonNull Context context, @NonNull BitmapPool pool,
@ -43,18 +44,15 @@ public class CropCircleTransformation extends BitmapTransformation {
return "CropCircleTransformation()";
}
@Override
public boolean equals(Object o) {
@Override public boolean equals(Object o) {
return o instanceof CropCircleTransformation;
}
@Override
public int hashCode() {
@Override public int hashCode() {
return ID.hashCode();
}
@Override
public void updateDiskCacheKey(MessageDigest messageDigest) {
@Override public void updateDiskCacheKey(MessageDigest messageDigest) {
messageDigest.update(ID_BYTES);
}
}

View File

@ -1,7 +1,7 @@
package jp.wasabeef.glide.transformations;
/**
* Copyright (C) 2017 Wasabeef
* Copyright (C) 2018 Wasabeef
*
* Licensed under the Apache License, Version 2.0 (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 {
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 int size;
@ -41,18 +42,15 @@ public class CropSquareTransformation extends BitmapTransformation {
return "CropSquareTransformation(size=" + size + ")";
}
@Override
public boolean equals(Object o) {
@Override public boolean equals(Object o) {
return o instanceof CropSquareTransformation;
}
@Override
public int hashCode() {
@Override public int hashCode() {
return ID.hashCode();
}
@Override
public void updateDiskCacheKey(MessageDigest messageDigest) {
@Override public void updateDiskCacheKey(MessageDigest messageDigest) {
messageDigest.update(ID_BYTES);
}
}

View File

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

View File

@ -1,7 +1,7 @@
package jp.wasabeef.glide.transformations;
/**
* Copyright (C) 2017 Wasabeef
* Copyright (C) 2018 Wasabeef
*
* Licensed under the Apache License, Version 2.0 (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 {
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);
@Override protected Bitmap transform(@NonNull Context context, @NonNull BitmapPool pool,
@ -55,18 +56,15 @@ public class GrayscaleTransformation extends BitmapTransformation {
return "GrayscaleTransformation()";
}
@Override
public boolean equals(Object o) {
@Override public boolean equals(Object o) {
return o instanceof GrayscaleTransformation;
}
@Override
public int hashCode() {
@Override public int hashCode() {
return ID.hashCode();
}
@Override
public void updateDiskCacheKey(MessageDigest messageDigest) {
@Override public void updateDiskCacheKey(MessageDigest messageDigest) {
messageDigest.update(ID_BYTES);
}
}

View File

@ -1,7 +1,7 @@
package jp.wasabeef.glide.transformations;
/**
* Copyright (C) 2017 Wasabeef
* Copyright (C) 2018 Wasabeef
*
* Licensed under the Apache License, Version 2.0 (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 {
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 Paint paint = new Paint();
@ -72,18 +73,15 @@ public class MaskTransformation extends BitmapTransformation {
return "MaskTransformation(maskId=" + maskId + ")";
}
@Override
public boolean equals(Object o) {
@Override public boolean equals(Object o) {
return o instanceof MaskTransformation;
}
@Override
public int hashCode() {
@Override public int hashCode() {
return ID.hashCode();
}
@Override
public void updateDiskCacheKey(MessageDigest messageDigest) {
@Override public void updateDiskCacheKey(MessageDigest messageDigest) {
messageDigest.update(ID_BYTES);
}
}

View File

@ -1,7 +1,7 @@
package jp.wasabeef.glide.transformations;
/**
* Copyright (C) 2017 Wasabeef
* Copyright (C) 2018 Wasabeef
*
* Licensed under the Apache License, Version 2.0 (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) {
canvas.drawRoundRect(new RectF(margin, margin, margin + diameter, margin + diameter),
radius, radius, paint);
canvas.drawRoundRect(new RectF(margin, margin, margin + diameter, margin + diameter), radius,
radius, paint);
canvas.drawRect(new RectF(margin, margin + radius, margin + radius, 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) {
canvas.drawRoundRect(new RectF(margin, bottom - diameter, margin + diameter, bottom),
radius, radius, paint);
canvas.drawRoundRect(new RectF(margin, bottom - diameter, margin + diameter, bottom), radius,
radius, paint);
canvas.drawRect(new RectF(margin, margin, margin + diameter, bottom - radius), 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) {
canvas.drawRoundRect(new RectF(right - diameter, margin, right, bottom), radius, radius,
paint);
canvas.drawRoundRect(new RectF(right - diameter, margin, right, bottom), radius, radius, paint);
canvas.drawRect(new RectF(margin, margin, right - radius, bottom), paint);
}
private void drawOtherTopLeftRoundRect(Canvas canvas, Paint paint, float right, float bottom) {
canvas.drawRoundRect(new RectF(margin, bottom - diameter, right, bottom), radius, radius,
paint);
canvas.drawRoundRect(new RectF(right - diameter, margin, right, bottom), radius, radius,
paint);
canvas.drawRoundRect(new RectF(right - diameter, margin, right, bottom), radius, 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) {
canvas.drawRoundRect(new RectF(margin, margin, right, margin + diameter), radius, radius,
paint);
canvas.drawRoundRect(new RectF(right - diameter, margin, right, bottom), radius, radius,
paint);
canvas.drawRoundRect(new RectF(right - diameter, margin, right, bottom), radius, radius, 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,
float bottom) {
canvas.drawRoundRect(new RectF(margin, margin, margin + diameter, margin + diameter),
radius, radius, paint);
canvas.drawRoundRect(new RectF(margin, margin, margin + diameter, margin + diameter), radius,
radius, paint);
canvas.drawRoundRect(new RectF(right - diameter, bottom - diameter, right, bottom), radius,
radius, paint);
canvas.drawRect(new RectF(margin, margin + radius, right - diameter, bottom), paint);
@ -229,8 +226,8 @@ public class RoundedCornersTransformation extends BitmapTransformation {
float bottom) {
canvas.drawRoundRect(new RectF(right - diameter, margin, right, margin + diameter), radius,
radius, paint);
canvas.drawRoundRect(new RectF(margin, bottom - diameter, margin + diameter, bottom),
radius, radius, paint);
canvas.drawRoundRect(new RectF(margin, bottom - diameter, margin + diameter, bottom), radius,
radius, paint);
canvas.drawRect(new RectF(margin, margin, right - radius, bottom - radius), 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() + ")";
}
@Override
public boolean equals(Object o) {
@Override public boolean equals(Object o) {
return o instanceof RoundedCornersTransformation;
}
@Override
public int hashCode() {
@Override public int hashCode() {
return ID.hashCode();
}
@Override
public void updateDiskCacheKey(MessageDigest messageDigest) {
@Override public void updateDiskCacheKey(MessageDigest messageDigest) {
messageDigest.update(ID_BYTES);
}
}

View File

@ -1,7 +1,7 @@
package jp.wasabeef.glide.transformations.gpu;
/**
* Copyright (C) 2017 Wasabeef
* Copyright (C) 2018 Wasabeef
*
* Licensed under the Apache License, Version 2.0 (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 {
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 float brightness;
@ -45,18 +46,15 @@ public class BrightnessFilterTransformation extends GPUFilterTransformation {
return "BrightnessFilterTransformation(brightness=" + brightness + ")";
}
@Override
public boolean equals(Object o) {
@Override public boolean equals(Object o) {
return o instanceof BrightnessFilterTransformation;
}
@Override
public int hashCode() {
@Override public int hashCode() {
return ID.hashCode();
}
@Override
public void updateDiskCacheKey(MessageDigest messageDigest) {
@Override public void updateDiskCacheKey(MessageDigest messageDigest) {
messageDigest.update(ID_BYTES);
}
}

View File

@ -1,7 +1,7 @@
package jp.wasabeef.glide.transformations.gpu;
/**
* Copyright (C) 2017 Wasabeef
* Copyright (C) 2018 Wasabeef
*
* Licensed under the Apache License, Version 2.0 (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 {
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 float contrast;
@ -45,18 +46,15 @@ public class ContrastFilterTransformation extends GPUFilterTransformation {
return "ContrastFilterTransformation(contrast=" + contrast + ")";
}
@Override
public boolean equals(Object o) {
@Override public boolean equals(Object o) {
return o instanceof ContrastFilterTransformation;
}
@Override
public int hashCode() {
@Override public int hashCode() {
return ID.hashCode();
}
@Override
public void updateDiskCacheKey(MessageDigest messageDigest) {
@Override public void updateDiskCacheKey(MessageDigest messageDigest) {
messageDigest.update(ID_BYTES);
}
}

View File

@ -1,7 +1,7 @@
package jp.wasabeef.glide.transformations.gpu;
/**
* Copyright (C) 2017 Wasabeef
* Copyright (C) 2018 Wasabeef
*
* Licensed under the Apache License, Version 2.0 (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 {
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 GPUImageFilter gpuImageFilter;
@ -54,18 +55,15 @@ public class GPUFilterTransformation extends BitmapTransformation {
return (T) gpuImageFilter;
}
@Override
public boolean equals(Object o) {
@Override public boolean equals(Object o) {
return o instanceof GPUFilterTransformation;
}
@Override
public int hashCode() {
@Override public int hashCode() {
return ID.hashCode();
}
@Override
public void updateDiskCacheKey(MessageDigest messageDigest) {
@Override public void updateDiskCacheKey(MessageDigest messageDigest) {
messageDigest.update(ID_BYTES);
}
}

View File

@ -1,7 +1,7 @@
package jp.wasabeef.glide.transformations.gpu;
/**
* Copyright (C) 2017 Wasabeef
* Copyright (C) 2018 Wasabeef
*
* Licensed under the Apache License, Version 2.0 (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 {
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);
public InvertFilterTransformation() {
@ -36,18 +37,15 @@ public class InvertFilterTransformation extends GPUFilterTransformation {
return "InvertFilterTransformation()";
}
@Override
public boolean equals(Object o) {
@Override public boolean equals(Object o) {
return o instanceof InvertFilterTransformation;
}
@Override
public int hashCode() {
@Override public int hashCode() {
return ID.hashCode();
}
@Override
public void updateDiskCacheKey(MessageDigest messageDigest) {
@Override public void updateDiskCacheKey(MessageDigest messageDigest) {
messageDigest.update(ID_BYTES);
}
}

View File

@ -1,7 +1,7 @@
package jp.wasabeef.glide.transformations.gpu;
/**
* Copyright (C) 2017 Wasabeef
* Copyright (C) 2018 Wasabeef
*
* Licensed under the Apache License, Version 2.0 (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 {
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 int radius;
@ -48,18 +49,15 @@ public class KuwaharaFilterTransformation extends GPUFilterTransformation {
return "KuwaharaFilterTransformation(radius=" + radius + ")";
}
@Override
public boolean equals(Object o) {
@Override public boolean equals(Object o) {
return o instanceof KuwaharaFilterTransformation;
}
@Override
public int hashCode() {
@Override public int hashCode() {
return ID.hashCode();
}
@Override
public void updateDiskCacheKey(MessageDigest messageDigest) {
@Override public void updateDiskCacheKey(MessageDigest messageDigest) {
messageDigest.update(ID_BYTES);
}
}

View File

@ -1,7 +1,7 @@
package jp.wasabeef.glide.transformations.gpu;
/**
* Copyright (C) 2017 Wasabeef
* Copyright (C) 2018 Wasabeef
*
* Licensed under the Apache License, Version 2.0 (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 {
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 float pixel;
@ -47,18 +48,15 @@ public class PixelationFilterTransformation extends GPUFilterTransformation {
return "PixelationFilterTransformation(pixel=" + pixel + ")";
}
@Override
public boolean equals(Object o) {
@Override public boolean equals(Object o) {
return o instanceof PixelationFilterTransformation;
}
@Override
public int hashCode() {
@Override public int hashCode() {
return ID.hashCode();
}
@Override
public void updateDiskCacheKey(MessageDigest messageDigest) {
@Override public void updateDiskCacheKey(MessageDigest messageDigest) {
messageDigest.update(ID_BYTES);
}
}

View File

@ -1,7 +1,7 @@
package jp.wasabeef.glide.transformations.gpu;
/**
* Copyright (C) 2017 Wasabeef
* Copyright (C) 2018 Wasabeef
*
* Licensed under the Apache License, Version 2.0 (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 {
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 float intensity;
@ -47,18 +48,15 @@ public class SepiaFilterTransformation extends GPUFilterTransformation {
return "SepiaFilterTransformation(intensity=" + intensity + ")";
}
@Override
public boolean equals(Object o) {
@Override public boolean equals(Object o) {
return o instanceof SepiaFilterTransformation;
}
@Override
public int hashCode() {
@Override public int hashCode() {
return ID.hashCode();
}
@Override
public void updateDiskCacheKey(MessageDigest messageDigest) {
@Override public void updateDiskCacheKey(MessageDigest messageDigest) {
messageDigest.update(ID_BYTES);
}
}

View File

@ -1,7 +1,7 @@
package jp.wasabeef.glide.transformations.gpu;
/**
* Copyright (C) 2017 Wasabeef
* Copyright (C) 2018 Wasabeef
*
* Licensed under the Apache License, Version 2.0 (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 {
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);
public SketchFilterTransformation() {
@ -33,18 +34,15 @@ public class SketchFilterTransformation extends GPUFilterTransformation {
return "SketchFilterTransformation()";
}
@Override
public boolean equals(Object o) {
@Override public boolean equals(Object o) {
return o instanceof SketchFilterTransformation;
}
@Override
public int hashCode() {
@Override public int hashCode() {
return ID.hashCode();
}
@Override
public void updateDiskCacheKey(MessageDigest messageDigest) {
@Override public void updateDiskCacheKey(MessageDigest messageDigest) {
messageDigest.update(ID_BYTES);
}
}

View File

@ -1,7 +1,7 @@
package jp.wasabeef.glide.transformations.gpu;
/**
* Copyright (C) 2017 Wasabeef
* Copyright (C) 2018 Wasabeef
*
* Licensed under the Apache License, Version 2.0 (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 {
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 float radius;
@ -54,22 +55,19 @@ public class SwirlFilterTransformation extends GPUFilterTransformation {
}
@Override public String toString() {
return "SwirlFilterTransformation(radius=" + radius +
",angle=" + angle + ",center=" + center.toString() + ")";
return "SwirlFilterTransformation(radius=" + radius + ",angle=" + angle + ",center="
+ center.toString() + ")";
}
@Override
public boolean equals(Object o) {
@Override public boolean equals(Object o) {
return o instanceof SwirlFilterTransformation;
}
@Override
public int hashCode() {
@Override public int hashCode() {
return ID.hashCode();
}
@Override
public void updateDiskCacheKey(MessageDigest messageDigest) {
@Override public void updateDiskCacheKey(MessageDigest messageDigest) {
messageDigest.update(ID_BYTES);
}
}

View File

@ -1,7 +1,7 @@
package jp.wasabeef.glide.transformations.gpu;
/**
* Copyright (C) 2017 Wasabeef
* Copyright (C) 2018 Wasabeef
*
* Licensed under the Apache License, Version 2.0 (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 {
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 float threshold;
@ -47,22 +48,19 @@ public class ToonFilterTransformation extends GPUFilterTransformation {
}
@Override public String toString() {
return "ToonFilterTransformation(threshold=" + threshold +
",quantizationLevels=" + quantizationLevels + ")";
return "ToonFilterTransformation(threshold=" + threshold + ",quantizationLevels="
+ quantizationLevels + ")";
}
@Override
public boolean equals(Object o) {
@Override public boolean equals(Object o) {
return o instanceof ToonFilterTransformation;
}
@Override
public int hashCode() {
@Override public int hashCode() {
return ID.hashCode();
}
@Override
public void updateDiskCacheKey(MessageDigest messageDigest) {
@Override public void updateDiskCacheKey(MessageDigest messageDigest) {
messageDigest.update(ID_BYTES);
}
}

View File

@ -1,7 +1,7 @@
package jp.wasabeef.glide.transformations.gpu;
/**
* Copyright (C) 2017 Wasabeef
* Copyright (C) 2018 Wasabeef
*
* Licensed under the Apache License, Version 2.0 (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 {
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 PointF center;
@ -55,23 +56,19 @@ public class VignetteFilterTransformation extends GPUFilterTransformation {
}
@Override public String toString() {
return "VignetteFilterTransformation(center=" + center.toString() +
",color=" + Arrays.toString(vignetteColor) +
",start=" + vignetteStart + ",end=" + vignetteEnd + ")";
return "VignetteFilterTransformation(center=" + center.toString() + ",color=" + Arrays.toString(
vignetteColor) + ",start=" + vignetteStart + ",end=" + vignetteEnd + ")";
}
@Override
public boolean equals(Object o) {
@Override public boolean equals(Object o) {
return o instanceof VignetteFilterTransformation;
}
@Override
public int hashCode() {
@Override public int hashCode() {
return ID.hashCode();
}
@Override
public void updateDiskCacheKey(MessageDigest messageDigest) {
@Override public void updateDiskCacheKey(MessageDigest messageDigest) {
messageDigest.update(ID_BYTES);
}
}

View File

@ -3,7 +3,7 @@ package jp.wasabeef.glide.transformations.internal;
import android.graphics.Bitmap;
/**
* Copyright (C) 2017 Wasabeef
* Copyright (C) 2018 Wasabeef
*
* Licensed under the Apache License, Version 2.0 (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;
/**
* Copyright (C) 2017 Wasabeef
* Copyright (C) 2018 Wasabeef
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -48,7 +48,11 @@ public class RSBlur {
output.copyTo(bitmap);
} finally {
if (rs != null) {
rs.destroy();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
RenderScript.releaseAllContexts();
} else {
rs.destroy();
}
}
if (input != null) {
input.destroy();

View File

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