[Android] Simplify resizeDrawable in OverlayConfigButton.java.

Also add a missing override to onRestart in DolphinEmulator.java.
This commit is contained in:
Lioncash 2014-01-02 11:53:28 -05:00
parent 0faf696be7
commit 5635c94a30
2 changed files with 8 additions and 5 deletions

View File

@ -82,6 +82,8 @@ public final class DolphinEmulator extends Activity
UserPreferences.LoadIniToPrefs(this);
}
}
@Override
protected void onRestart()
{
super.onRestart();

View File

@ -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);
@ -52,7 +53,8 @@ public final class OverlayConfigButton extends Button implements OnTouchListener
(int)(displayMetrics.heightPixels * scale),
(int)(displayMetrics.heightPixels * scale),
false);
return new BitmapDrawable(context.getResources(), bitmapResized);
return new BitmapDrawable(getResources(), bitmapResized);
}
/**
@ -73,8 +75,7 @@ public final class OverlayConfigButton extends Button implements OnTouchListener
setOnTouchListener(this);
// Set the button's icon that represents it.
setBackground(resizeDrawable(wm, context,
context.getResources().getDrawable(drawableId),
setBackground(resizeDrawable(wm, getResources().getDrawable(drawableId),
drawableId == R.drawable.gcpad_joystick_range ? 0.30f : 0.20f));
// Get the SharedPreferences instance.