1
0
mirror of https://github.com/wasabeef/glide-transformations.git synced 2025-10-04 18:03:21 +08:00
* update gradle wrapper

* update Copyright

* update kotlin version

* update glide

* update Copyright

* refactor to be simply

* add CircleCropWithBorder to sample

* code cleanup

* add px to dp convert

* update gradle

* update idea settings

* bump up to 4.1.0

* update readme
This commit is contained in:
Daichi Furiya
2019-08-15 13:47:18 +09:00
committed by GitHub
parent e16eda6af1
commit 0b9311813a
38 changed files with 450 additions and 247 deletions

View File

@@ -1,7 +1,7 @@
package jp.wasabeef.example.glide
/**
* Copyright (C) 2018 Wasabeef
* Copyright (C) 2019 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

@@ -15,9 +15,9 @@ class MainActivity : AppCompatActivity() {
findViewById<RecyclerView>(R.id.list).apply {
layoutManager = LinearLayoutManager(context)
adapter = MainAdapter(context, mutableListOf(
Mask, NinePatchMask, CropTop, CropCenter, CropBottom, CropSquare, CropCircle, Grayscale,
Blur, SupportRSBlur, Toon, Sepia, Contrast, Invert, Pixel, Sketch, Swirl, Brightness,
Kuawahara, Vignette
Mask, NinePatchMask, CropTop, CropCenter, CropBottom, CropSquare, CropCircle,
CropCircleWithBorder, Grayscale, Blur, SupportRSBlur, Toon, Sepia, Contrast, Invert,
Pixel, Sketch, Swirl, Brightness, Kuawahara, Vignette
))
}
}

View File

@@ -19,6 +19,7 @@ import jp.wasabeef.example.glide.MainAdapter.Type.*
import jp.wasabeef.glide.transformations.*
import jp.wasabeef.glide.transformations.CropTransformation.CropType
import jp.wasabeef.glide.transformations.gpu.*
import jp.wasabeef.glide.transformations.internal.Utils
/**
* Created by Wasabeef on 2015/01/11.
@@ -36,6 +37,7 @@ class MainAdapter(
CropBottom,
CropSquare,
CropCircle,
CropCircleWithBorder,
ColorFilter,
Grayscale,
RoundedCorners,
@@ -65,7 +67,7 @@ class MainAdapter(
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
when (dataSet[position]) {
MainAdapter.Type.Mask -> {
Mask -> {
Glide.with(context)
.load(R.drawable.check)
.apply(overrideOf(266.px, 252.px))
@@ -73,7 +75,7 @@ class MainAdapter(
MaskTransformation(R.drawable.mask_starfish))))
.into(holder.image)
}
MainAdapter.Type.NinePatchMask -> {
NinePatchMask -> {
Glide.with(context)
.load(R.drawable.check)
.apply(overrideOf(300.px, 200.px))
@@ -107,6 +109,12 @@ class MainAdapter(
.apply(bitmapTransform(CropCircleTransformation()))
.into(holder.image)
CropCircleWithBorder -> Glide.with(context)
.load(R.drawable.demo)
.apply(bitmapTransform(
CropCircleWithBorderTransformation(Utils.toDp(4), Color.rgb(0, 145, 86))))
.into(holder.image)
ColorFilter -> Glide.with(context)
.load(R.drawable.demo)
.apply(bitmapTransform(ColorFilterTransformation(Color.argb(80, 255, 0, 0))))