Fix review issues

This commit is contained in:
Mario Danic 2017-01-24 10:12:46 +01:00 committed by AndyScherzinger
parent 90ce5fcea1
commit 33bac40563
No known key found for this signature in database
GPG key ID: 6CADC7E3523C308B

View file

@ -545,10 +545,10 @@ public class PreviewImageFragment extends FileFragment {
Drawable bitmapDrawable = new BitmapDrawable(getResources(), bitmap); Drawable bitmapDrawable = new BitmapDrawable(getResources(), bitmap);
layers[1] = bitmapDrawable; layers[1] = bitmapDrawable;
LayerDrawable layerDrawable = new LayerDrawable(layers); LayerDrawable layerDrawable = new LayerDrawable(layers);
layerDrawable.setLayerHeight(0, (int) convertDpToPixel(bitmap.getHeight(), getActivity())); layerDrawable.setLayerHeight(0, convertDpToPixel(bitmap.getHeight(), getActivity()));
layerDrawable.setLayerHeight(1, (int) convertDpToPixel(bitmap.getHeight(), getActivity())); layerDrawable.setLayerHeight(1, convertDpToPixel(bitmap.getHeight(), getActivity()));
layerDrawable.setLayerWidth(0, (int) convertDpToPixel(bitmap.getWidth(), getActivity())); layerDrawable.setLayerWidth(0, convertDpToPixel(bitmap.getWidth(), getActivity()));
layerDrawable.setLayerWidth(1, (int) convertDpToPixel(bitmap.getWidth(), getActivity())); layerDrawable.setLayerWidth(1, convertDpToPixel(bitmap.getWidth(), getActivity()));
imageView.setImageDrawable(layerDrawable); imageView.setImageDrawable(layerDrawable);
} else { } else {
imageView.setImageBitmap(bitmap); imageView.setImageBitmap(bitmap);
@ -636,10 +636,10 @@ public class PreviewImageFragment extends FileFragment {
} }
private static float convertDpToPixel(float dp, Context context) { private static int convertDpToPixel(float dp, Context context) {
Resources resources = context.getResources(); Resources resources = context.getResources();
DisplayMetrics metrics = resources.getDisplayMetrics(); DisplayMetrics metrics = resources.getDisplayMetrics();
float px = dp * ((float) metrics.densityDpi / DisplayMetrics.DENSITY_DEFAULT); int px = (int) (dp * ((float) metrics.densityDpi / DisplayMetrics.DENSITY_DEFAULT));
return px; return px;
} }