mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Format Java code in xplat/js/react-native-github
Summary: This diff formats the Java class files inside xplat/js/react-native-github. Since google-java-format was enabled in D16071401 we want to codemode the existing code so that users don't have to deal with formatter lint noise at diff-time. ```arc f --paths-cmd 'hg files -I "**/*.java"'``` drop-conflicts Reviewed By: cpojer Differential Revision: D16071725 fbshipit-source-id: fc6e3852e45742c109f0c5ac4065d64201c74204
This commit is contained in:
1 parent
61e95e5cbf
commit
6c0f73b322
681 files changed
+14082
-16365
No files matched your search
@@ -1,54 +1,39 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* <p>This source code is licensed under the MIT license found in the LICENSE file in the root
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.react.uimanager;
|
||||
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.TypedValue;
|
||||
|
||||
/**
|
||||
* Android dp to pixel manipulation
|
||||
*/
|
||||
/** Android dp to pixel manipulation */
|
||||
public class PixelUtil {
|
||||
|
||||
/**
|
||||
* Convert from DIP to PX
|
||||
*/
|
||||
/** Convert from DIP to PX */
|
||||
public static float toPixelFromDIP(float value) {
|
||||
return TypedValue.applyDimension(
|
||||
TypedValue.COMPLEX_UNIT_DIP,
|
||||
value,
|
||||
DisplayMetricsHolder.getWindowDisplayMetrics());
|
||||
TypedValue.COMPLEX_UNIT_DIP, value, DisplayMetricsHolder.getWindowDisplayMetrics());
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert from DIP to PX
|
||||
*/
|
||||
/** Convert from DIP to PX */
|
||||
public static float toPixelFromDIP(double value) {
|
||||
return toPixelFromDIP((float) value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert from PX to SP
|
||||
*/
|
||||
/** Convert from PX to SP */
|
||||
public static float toSPFromPixel(float value) {
|
||||
return value / DisplayMetricsHolder.getScreenDisplayMetrics().scaledDensity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert from SP to PX
|
||||
*/
|
||||
/** Convert from SP to PX */
|
||||
public static float toPixelFromSP(float value) {
|
||||
return toPixelFromSP(value, Float.NaN);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert from SP to PX
|
||||
*/
|
||||
/** Convert from SP to PX */
|
||||
public static float toPixelFromSP(float value, float maxFontScale) {
|
||||
DisplayMetrics displayMetrics = DisplayMetricsHolder.getWindowDisplayMetrics();
|
||||
float scaledDensity = displayMetrics.scaledDensity;
|
||||
@@ -60,25 +45,18 @@ public class PixelUtil {
|
||||
return value * scaledDensity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert from SP to PX
|
||||
*/
|
||||
/** Convert from SP to PX */
|
||||
public static float toPixelFromSP(double value) {
|
||||
return toPixelFromSP((float) value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert from PX to DP
|
||||
*/
|
||||
/** Convert from PX to DP */
|
||||
public static float toDIPFromPixel(float value) {
|
||||
return value / DisplayMetricsHolder.getWindowDisplayMetrics().density;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link float} that represents the density of the display metrics for device screen.
|
||||
*/
|
||||
/** @return {@link float} that represents the density of the display metrics for device screen. */
|
||||
public static float getDisplayMetricDensity() {
|
||||
return DisplayMetricsHolder.getScreenDisplayMetrics().density;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user