Skip to content

Instantly share code, notes, and snippets.

View ekursakov's full-sized avatar

Evgeny Kursakov ekursakov

View GitHub Profile
@bamboo
bamboo / build.gradle.kts
Last active April 21, 2021 18:20
Gradle ArtifactTransform example using the Gradle Kotlin DSL
import org.gradle.api.internal.artifacts.repositories.layout.IvyRepositoryLayout
import java.io.InputStream
import java.util.zip.*
object Attributes {
val artifactType = Attribute.of("artifactType", String::class.java)
val zipType = "zip"
val jars = "jars"
}
@gabrielemariotti
gabrielemariotti / MainActivity.java
Last active February 15, 2021 17:32
How to obtain a CardView (support library) with a Image and rounded corners for API<21
ImageView imageView = (ImageView) findViewById(R.id.card_thumbnail_image);
Bitmap mBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.rose);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
//Default
imageView.setBackgroundResource(R.drawable.rose);
} else {
//RoundCorners
RoundCornersDrawable round = new RoundCornersDrawable(mBitmap,
getResources().getDimension(R.dimen.cardview_default_radius), 0); //or your custom radius
@briangriffey
briangriffey / NinePatchBitmapFactory.java
Last active December 3, 2024 01:35
Create 9-patches simlar to - (UIImage *)resizableImageWithCapInsets:(UIEdgeInsets)capInsets
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.NinePatch;
import android.graphics.Rect;
import android.graphics.drawable.NinePatchDrawable;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
/**