Skip to content

Commit

Permalink
Use service helper for getting int pixels for size
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinsawicki committed Dec 3, 2012
1 parent 5ef568b commit 35aad34
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ private static class LoadingImageGetter implements ImageGetter {
private final Drawable image;

private LoadingImageGetter(final Context context, final int size) {
int imageSize = Math.round(context.getResources()
.getDisplayMetrics().density * size + 0.5F);
int imageSize = ServiceUtils.getIntPixels(context, size);
image = context.getResources().getDrawable(
drawable.image_loading_icon);
image.setBounds(0, 0, imageSize, imageSize);
Expand Down
11 changes: 11 additions & 0 deletions app/src/main/java/com/github/mobile/util/ServiceUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,17 @@ public static int getIntPixels(final View view, final int dp) {
return getIntPixels(view.getResources(), dp);
}

/**
* Get pixels from dps
*
* @param context
* @param dp
* @return pixels
*/
public static int getIntPixels(final Context context, final int dp) {
return getIntPixels(context.getResources(), dp);
}

/**
* Get pixels from dps
*
Expand Down

0 comments on commit 35aad34

Please sign in to comment.