Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[Android] Simplify resizeDrawable in OverlayConfigButton.java.
Also add a missing override to onRestart in DolphinEmulator.java.
  • Loading branch information
lioncash committed Jan 2, 2014
1 parent 0faf696 commit 5635c94
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Expand Up @@ -82,6 +82,8 @@ public void onCreate(Bundle savedInstanceState)
UserPreferences.LoadIniToPrefs(this);
}
}

@Override
protected void onRestart()
{
super.onRestart();
Expand Down
Expand Up @@ -42,7 +42,8 @@ public final class OverlayConfigButton extends Button implements OnTouchListener
// float buttonY = sPrefs.getFloat(buttonId+"-Y", -1f);
//
private final String buttonId;
private Drawable resizeDrawable(WindowManager wm, Context context, Drawable image, float scale) {
private Drawable resizeDrawable(WindowManager wm, Drawable image, float scale)
{
// Retrieve screen dimensions.
DisplayMetrics displayMetrics = new DisplayMetrics();
wm.getDefaultDisplay().getMetrics(displayMetrics);
Expand All @@ -52,7 +53,8 @@ private Drawable resizeDrawable(WindowManager wm, Context context, Drawable imag
(int)(displayMetrics.heightPixels * scale),
(int)(displayMetrics.heightPixels * scale),
false);
return new BitmapDrawable(context.getResources(), bitmapResized);

return new BitmapDrawable(getResources(), bitmapResized);
}

/**
Expand All @@ -73,9 +75,8 @@ public OverlayConfigButton(WindowManager wm, Context context, String buttonId, i
setOnTouchListener(this);

// Set the button's icon that represents it.
setBackground(resizeDrawable(wm, context,
context.getResources().getDrawable(drawableId),
drawableId == R.drawable.gcpad_joystick_range ? 0.30f : 0.20f));
setBackground(resizeDrawable(wm, getResources().getDrawable(drawableId),
drawableId == R.drawable.gcpad_joystick_range ? 0.30f : 0.20f));

// Get the SharedPreferences instance.
sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
Expand Down

0 comments on commit 5635c94

Please sign in to comment.