Update ktfmt component on FBS:master
Differential Revision: D46802820 fbshipit-source-id: a2737658576bf86f431a7b355d853a529f6a2c34
This commit is contained in:
committed by
Facebook GitHub Bot
parent
1c532095ab
commit
947f1932b5
@@ -17,6 +17,7 @@ class BitmapPool(private val config: Bitmap.Config = Bitmap.Config.RGB_565) {
|
||||
|
||||
interface ReusableBitmap {
|
||||
val bitmap: Bitmap?
|
||||
|
||||
fun readyForReuse()
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ open class EnumMapping<T>(private val mapping: Map<String, T>) {
|
||||
fun toInspectable(value: T): InspectableValue.Enum {
|
||||
return InspectableValue.Enum(getStringRepresentation(value))
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val NoMapping = "__UNKNOWN_ENUM_VALUE__"
|
||||
}
|
||||
|
||||
@@ -19,7 +19,9 @@ import java.lang.reflect.Method
|
||||
object ActivityTracker : Application.ActivityLifecycleCallbacks {
|
||||
interface ActivityStackChangedListener {
|
||||
fun onActivityAdded(activity: Activity, stack: List<Activity>)
|
||||
|
||||
fun onActivityStackChanged(stack: List<Activity>)
|
||||
|
||||
fun onActivityDestroyed(activity: Activity, stack: List<Activity>)
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,9 @@ class RootViewResolver {
|
||||
|
||||
interface Listener {
|
||||
fun onRootViewAdded(rootView: View)
|
||||
|
||||
fun onRootViewRemoved(rootView: View)
|
||||
|
||||
fun onRootViewsChanged(rootViews: List<View>)
|
||||
}
|
||||
|
||||
@@ -105,6 +107,7 @@ class RootViewResolver {
|
||||
|
||||
class ObservableViewArrayList : ArrayList<View>() {
|
||||
private var listener: Listener? = null
|
||||
|
||||
fun setListener(listener: Listener?) {
|
||||
this.listener = listener
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ object OffsetChildDescriptor : NodeDescriptor<OffsetChild> {
|
||||
node.descriptor.getAttributes(node.child)
|
||||
|
||||
override fun getTags(node: OffsetChild): Set<String> = node.descriptor.getTags(node.child)
|
||||
|
||||
override fun getSnapshot(node: OffsetChild, bitmap: Bitmap?): Bitmap? =
|
||||
node.descriptor.getSnapshot(node.child, bitmap)
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ object ViewGroupDescriptor : ChainedDescriptor<ViewGroup>() {
|
||||
private const val NAMESPACE = "ViewGroup"
|
||||
private var SectionId =
|
||||
MetadataRegister.register(MetadataRegister.TYPE_ATTRIBUTE, NAMESPACE, NAMESPACE)
|
||||
|
||||
override fun onGetName(node: ViewGroup): String {
|
||||
return node.javaClass.simpleName
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ object ViewPagerDescriptor : ChainedDescriptor<ViewPager>() {
|
||||
private const val NAMESPACE = "ViewPager"
|
||||
private var SectionId =
|
||||
MetadataRegister.register(MetadataRegister.TYPE_ATTRIBUTE, NAMESPACE, NAMESPACE)
|
||||
|
||||
override fun onGetName(node: ViewPager): String = node.javaClass.simpleName
|
||||
|
||||
override fun onGetActiveChild(node: ViewPager): Any? {
|
||||
@@ -31,6 +32,7 @@ object ViewPagerDescriptor : ChainedDescriptor<ViewPager>() {
|
||||
|
||||
private val CurrentItemIndexAttributeId =
|
||||
MetadataRegister.register(MetadataRegister.TYPE_ATTRIBUTE, NAMESPACE, "currentItemIndex")
|
||||
|
||||
override fun onGetAttributes(
|
||||
node: ViewPager,
|
||||
attributeSections: MutableMap<MetadataId, InspectableObject>
|
||||
|
||||
@@ -38,6 +38,7 @@ data class Color(val r: Int, val g: Int, val b: Int, val a: Int) {
|
||||
val blue: Int = (color shr 0) and 0xFF
|
||||
return Color(red, green, blue, alpha)
|
||||
}
|
||||
|
||||
fun fromColor(color: android.graphics.Color): Color {
|
||||
return fromColor(color.toArgb())
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.facebook.flipper.plugins.uidebugger.core.UIDContext
|
||||
|
||||
interface TreeObserverBuilder<T> {
|
||||
fun canBuildFor(node: Any): Boolean
|
||||
|
||||
fun build(context: UIDContext): TreeObserver<T>
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ class Immediate<T>(private val value: T) : MaybeDeferred<T>() {
|
||||
|
||||
class Deferred<T>(private val lazyLoader: () -> T) : MaybeDeferred<T>() {
|
||||
override fun value(): T = lazyLoader()
|
||||
|
||||
override fun <U> map(fn: (T) -> U): MaybeDeferred<U> {
|
||||
return Deferred { fn(lazyLoader()) }
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ class UIDebuggerFlipperPluginTest {
|
||||
Mockito.`when`(app.applicationContext).thenReturn(app)
|
||||
Mockito.`when`(app.packageName).thenReturn("com.facebook.flipper")
|
||||
}
|
||||
|
||||
@Throws(Exception::class)
|
||||
@Test
|
||||
fun emptyTest() {
|
||||
|
||||
@@ -14,14 +14,18 @@ object MarineMammals {
|
||||
listOf(
|
||||
MarineMammal(
|
||||
"Polar Bear",
|
||||
"https://upload.wikimedia.org/wikipedia/commons/thumb/8/84/Ursus_maritimus_4_1996-08-04.jpg/190px-Ursus_maritimus_4_1996-08-04.jpg".toUri()),
|
||||
"https://upload.wikimedia.org/wikipedia/commons/thumb/8/84/Ursus_maritimus_4_1996-08-04.jpg/190px-Ursus_maritimus_4_1996-08-04.jpg"
|
||||
.toUri()),
|
||||
MarineMammal(
|
||||
"Sea Otter",
|
||||
"https://upload.wikimedia.org/wikipedia/commons/thumb/1/15/Sea_otter_cropped.jpg/220px-Sea_otter_cropped.jpg".toUri()),
|
||||
"https://upload.wikimedia.org/wikipedia/commons/thumb/1/15/Sea_otter_cropped.jpg/220px-Sea_otter_cropped.jpg"
|
||||
.toUri()),
|
||||
MarineMammal(
|
||||
"West Indian Manatee",
|
||||
"https://upload.wikimedia.org/wikipedia/commons/thumb/6/6f/FL_fig04.jpg/230px-FL_fig04.jpg".toUri()),
|
||||
"https://upload.wikimedia.org/wikipedia/commons/thumb/6/6f/FL_fig04.jpg/230px-FL_fig04.jpg"
|
||||
.toUri()),
|
||||
MarineMammal(
|
||||
"Bottlenose Dolphin",
|
||||
"https://upload.wikimedia.org/wikipedia/commons/thumb/1/10/Tursiops_truncatus_01.jpg/220px-Tursiops_truncatus_01.jpg".toUri()))
|
||||
"https://upload.wikimedia.org/wikipedia/commons/thumb/1/10/Tursiops_truncatus_01.jpg/220px-Tursiops_truncatus_01.jpg"
|
||||
.toUri()))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user