aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/ui/util/StyledAttributes.java
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-09-23 16:42:56 +0200
committerChristian Schneppe <christian@pix-art.de>2018-09-23 16:42:56 +0200
commit1e63a8291579043659f86dbb46d4d63d3225c471 (patch)
tree8f1f2a24aee230eb63364a80ef04d1d7a379d67c /src/main/java/de/pixart/messenger/ui/util/StyledAttributes.java
parentd159ba22126f7be06f50cb33b677ddcc8786219c (diff)
preview media before sending them and allow sharing and attaching of multiple files
Diffstat (limited to '')
-rw-r--r--src/main/java/de/pixart/messenger/ui/util/StyledAttributes.java (renamed from src/main/java/de/pixart/messenger/ui/util/Color.java)18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/util/Color.java b/src/main/java/de/pixart/messenger/ui/util/StyledAttributes.java
index 58ce6a465..cd4ad3e49 100644
--- a/src/main/java/de/pixart/messenger/ui/util/Color.java
+++ b/src/main/java/de/pixart/messenger/ui/util/StyledAttributes.java
@@ -35,14 +35,26 @@ import android.content.res.TypedArray;
import android.support.annotation.AttrRes;
import android.support.annotation.ColorInt;
-public class Color {
+public class StyledAttributes {
+ public static android.graphics.drawable.Drawable getDrawable(Context context, @AttrRes int id) {
+ TypedArray typedArray = context.obtainStyledAttributes(new int[]{id});
+ android.graphics.drawable.Drawable drawable = typedArray.getDrawable(0);
+ typedArray.recycle();
+ return drawable;
+ }
+
+ public static float getFloat(Context context, @AttrRes int id) {
+ TypedArray typedArray = context.obtainStyledAttributes(new int[]{id});
+ float value = typedArray.getFloat(0, 0f);
+ typedArray.recycle();
+ return value;
+ }
public static @ColorInt
- int get(Context context, @AttrRes int attr) {
+ int getColor(Context context, @AttrRes int attr) {
TypedArray typedArray = context.obtainStyledAttributes(new int[]{attr});
int color = typedArray.getColor(0, 0);
typedArray.recycle();
return color;
}
-
} \ No newline at end of file