Skip to content

Instantly share code, notes, and snippets.

View Popalay's full-sized avatar
🇺🇦

Denys Nykyforov Popalay

🇺🇦
View GitHub Profile
@fesago90
fesago90 / gist:ae7a56628c35e65ddaab
Last active February 20, 2019 14:29
shared element transition mem leak fix
package com.dopplerlabs.hereactivelistening.hacks;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Matrix;
import android.graphics.RectF;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
@AnderWeb
AnderWeb / Simple setup for item backgrounds pre - post lollipop
Last active January 12, 2024 18:04
Simple setup for item backgrounds pre/post lollipop
AppCompat-v7:21 provides a very useful way of dealing with pressed/focused/activated states maintaining backwards compatibility downto API-7, but there's a small issue (big for some) with the default selectableItemBackground: It uses some PNGs and/or default values for API<21.
The main reason is that android drawable resource definitions (prior API 21) CANNOT use theme attributes at all, so there's no way of making something like:
<shape android:shape="rectangle">
<solid android:color="?attr/colorControlHighlight" />
</shape>
For this, I've put this simple mockup on how to give your app better drawables that the appcompat defaults.