Migrate LayoutPassReason
to Kotlin (#1836)
Summary: Migrate com.facebook.yoga.LayoutPassReason to Kotlin. Pull Request resolved: https://github.com/facebook/yoga/pull/1836 Test Plan: RN ```sh yarn android yarn test-android ``` Yoga ```sh ./gradlew :yoga:assembleDebug ``` Reviewed By: rshest Differential Revision: D79897685 Pulled By: cortinico fbshipit-source-id: 87d2e4b95fbdbfe48d84019e9ffb50deb9286d8c
This commit is contained in:
committed by
Facebook GitHub Bot
parent
c54215fd77
commit
c90aecbdfe
@@ -1,43 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
||||||
*
|
|
||||||
* 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.yoga;
|
|
||||||
|
|
||||||
public enum LayoutPassReason {
|
|
||||||
INITIAL(0),
|
|
||||||
ABS_LAYOUT(1),
|
|
||||||
STRETCH(2),
|
|
||||||
MULTILINE_STRETCH(3),
|
|
||||||
FLEX_LAYOUT(4),
|
|
||||||
MEASURE(5),
|
|
||||||
ABS_MEASURE(6),
|
|
||||||
FLEX_MEASURE(7);
|
|
||||||
|
|
||||||
private final int mIntValue;
|
|
||||||
|
|
||||||
LayoutPassReason(int intValue) {
|
|
||||||
mIntValue = intValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int intValue() {
|
|
||||||
return mIntValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static LayoutPassReason fromInt(int value) {
|
|
||||||
switch (value) {
|
|
||||||
case 0: return INITIAL;
|
|
||||||
case 1: return ABS_LAYOUT;
|
|
||||||
case 2: return STRETCH;
|
|
||||||
case 3: return MULTILINE_STRETCH;
|
|
||||||
case 4: return FLEX_LAYOUT;
|
|
||||||
case 5: return MEASURE;
|
|
||||||
case 6: return ABS_MEASURE;
|
|
||||||
case 7: return FLEX_MEASURE;
|
|
||||||
default: throw new IllegalArgumentException("Unknown enum value: " + value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
35
java/com/facebook/yoga/LayoutPassReason.kt
Normal file
35
java/com/facebook/yoga/LayoutPassReason.kt
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||||
|
*
|
||||||
|
* 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.yoga
|
||||||
|
|
||||||
|
public enum class LayoutPassReason(public val intValue: Int) {
|
||||||
|
INITIAL(0),
|
||||||
|
ABS_LAYOUT(1),
|
||||||
|
STRETCH(2),
|
||||||
|
MULTILINE_STRETCH(3),
|
||||||
|
FLEX_LAYOUT(4),
|
||||||
|
MEASURE(5),
|
||||||
|
ABS_MEASURE(6),
|
||||||
|
FLEX_MEASURE(7);
|
||||||
|
|
||||||
|
public companion object {
|
||||||
|
@JvmStatic
|
||||||
|
public fun fromInt(value: Int): LayoutPassReason =
|
||||||
|
when (value) {
|
||||||
|
0 -> INITIAL
|
||||||
|
1 -> ABS_LAYOUT
|
||||||
|
2 -> STRETCH
|
||||||
|
3 -> MULTILINE_STRETCH
|
||||||
|
4 -> FLEX_LAYOUT
|
||||||
|
5 -> MEASURE
|
||||||
|
6 -> ABS_MEASURE
|
||||||
|
7 -> FLEX_MEASURE
|
||||||
|
else -> throw IllegalArgumentException("Unknown enum value: $value")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user