mirror of
https://github.com/wasabeef/glide-transformations.git
synced 2025-10-04 18:03:21 +08:00
4.1.0 (#163)
* 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:
@@ -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.
|
||||
|
@@ -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
|
||||
))
|
||||
}
|
||||
}
|
||||
|
@@ -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))))
|
||||
|
Reference in New Issue
Block a user