[Android] Simplify display metrics retrieval in Config.java.

This commit is contained in:
Lioncash 2014-03-06 04:10:56 -05:00
parent 4b98fe2cb5
commit 08d40fe44f
1 changed files with 2 additions and 3 deletions

View File

@ -130,9 +130,8 @@ public class Config {
TextView text = (TextView) layout.findViewById(R.id.text);
text.setText(activity.getString(message));
DisplayMetrics metrics = new DisplayMetrics();
activity.getWindowManager().getDefaultDisplay().getMetrics(metrics);
final float scale = activity.getResources().getDisplayMetrics().density;
DisplayMetrics metrics = activity.getResources().getDisplayMetrics();
final float scale = metrics.density;
int toastPixels = (int) ((metrics.widthPixels * scale + 0.5f) / 14);
Toast toast = new Toast(activity);