List of usage examples for android.content.res Resources getDimensionPixelSize
public int getDimensionPixelSize(@DimenRes int id) throws NotFoundException
From source file:Main.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP) public static Drawable getDrawableBySizeId(Resources res, int drawId, int sizeId) { int size = res.getDimensionPixelSize(sizeId); return getDrawableByWidthAndHeight(res, drawId, size, size); }
From source file:Main.java
public static int getStatusBarHeight(Resources r) { int resourceId = r.getIdentifier("status_bar_height", "dimen", "android"); return r.getDimensionPixelSize(resourceId); }
From source file:Main.java
public static int getNavigationBarHeight(Resources r) { int resourceId = r.getIdentifier("navigation_bar_height", "dimen", "android"); return r.getDimensionPixelSize(resourceId); }
From source file:Main.java
/** * Get the {@link Drawable} identified by {@code drawableId} and set its bounds * with the dimensions identified by {@code widthDimenId} and {@code heightDimenId}. * @param ctx Context// ww w. j a v a 2 s .c o m * @param drawableId Identifier of the drawable. * @param widthDimenId Identifier of the resource to use as the width. * @param heightDimenId Identifier of the resource to use as the height. * @return The {@link Drawable} identified by {@code drawableId} bounded to {@code widthDimenId} and {@code heightDimenId}. */ public static Drawable boundedDrawable(Context ctx, int drawableId, int widthDimenId, int heightDimenId) { Drawable retVal; Resources res = ctx.getResources(); retVal = res.getDrawable(drawableId); retVal.setBounds(0, 0, res.getDimensionPixelSize(widthDimenId), res.getDimensionPixelSize(heightDimenId)); return retVal; }
From source file:Main.java
public static int getNavBarHeight(Resources res) { int resourceId = res.getIdentifier("navigation_bar_height", "dimen", "android"); if (resourceId > 0) { return res.getDimensionPixelSize(resourceId); }//from w ww . j ava 2s . c o m return 0; }
From source file:Main.java
public static int getStatusBarHeight(Context context) { Resources resources = context.getResources(); int resourceId = resources.getIdentifier("status_bar_height", "dimen", "android"); return resources.getDimensionPixelSize(resourceId); }
From source file:Main.java
public static int getNavigationBarHeight(Context context) { Resources resources = context.getResources(); int resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android"); int height = resources.getDimensionPixelSize(resourceId); return height; }
From source file:Main.java
public static int getStatusBarHeight(Context context) { Resources resources = context.getResources(); int resourceId = resources.getIdentifier("status_bar_height", "dimen", "android"); int height = resources.getDimensionPixelSize(resourceId); Log.v("dbw", "Status height:" + height); return height; }
From source file:Main.java
public static Bitmap generateAvatar(Context context, String username, int avatarDimenResourceID) { Resources resources = context.getResources(); return generateAvatar(username, resources.getDimensionPixelSize(avatarDimenResourceID)); }
From source file:Main.java
private static int getInternalDimensionSize(Resources res, String key) { int result = 0; int resourceId = res.getIdentifier(key, "dimen", "android"); if (resourceId > 0) { result = res.getDimensionPixelSize(resourceId); }//from www . j a va2 s. c o m return result; }