replace some infrequently used methods from theme library
This commit is contained in:
parent
70a561e9d1
commit
5ae5d3017a
9 changed files with 76 additions and 53 deletions
|
|
@ -111,6 +111,7 @@ public class ImageUtil {
|
|||
|
||||
public static Bitmap resize(InputStream stream, int scaledWidth, int scaledHeight) {
|
||||
final Bitmap bitmap = BitmapFactory.decodeStream(stream);
|
||||
|
||||
return Bitmap.createScaledBitmap(bitmap, scaledWidth, scaledHeight, true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.dkanada.gramophone.util;
|
||||
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.Bitmap;
|
||||
|
||||
import androidx.annotation.ColorInt;
|
||||
|
|
@ -19,6 +20,20 @@ public class ThemeUtil {
|
|||
return Palette.from(bitmap).generate();
|
||||
}
|
||||
|
||||
public static ColorStateList getColorStateList(int normal, int active) {
|
||||
int[][] states = new int[][]{
|
||||
new int[]{-android.R.attr.state_checked},
|
||||
new int[]{android.R.attr.state_checked}
|
||||
};
|
||||
|
||||
int[] colors = new int[]{
|
||||
normal,
|
||||
active
|
||||
};
|
||||
|
||||
return new ColorStateList(states, colors);
|
||||
}
|
||||
|
||||
@ColorInt
|
||||
public static int getColor(@Nullable Palette palette, int fallback) {
|
||||
if (palette != null) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue