Commit 34ea90aa authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf
Browse files

Util.convertPxToDp simplification

parent a4698253
......@@ -31,8 +31,6 @@ import android.content.Context;
import android.content.res.TypedArray;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.Display;
import android.view.WindowManager;
import android.widget.Toast;
public class Util {
......@@ -42,11 +40,7 @@ public class Util {
}
public static int convertPxToDp(int px) {
WindowManager wm = (WindowManager)VLCApplication.getAppContext().
getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay();
DisplayMetrics metrics = new DisplayMetrics();
display.getMetrics(metrics);
DisplayMetrics metrics = VLCApplication.getAppResources().getDisplayMetrics();
float logicalDensity = metrics.density;
int dp = Math.round(px / logicalDensity);
return dp;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment