Skip to content

Commit

Permalink
Update ktfmt component on FBS:master
Browse files Browse the repository at this point in the history
Differential Revision: D46802820

fbshipit-source-id: a2737658576bf86f431a7b355d853a529f6a2c34
  • Loading branch information
cgrushko authored and facebook-github-bot committed Jun 19, 2023
1 parent 1c53209 commit 947f193
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class BitmapPool(private val config: Bitmap.Config = Bitmap.Config.RGB_565) {

interface ReusableBitmap {
val bitmap: Bitmap?

fun readyForReuse()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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__"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ class RootViewResolver {

interface Listener {
fun onRootViewAdded(rootView: View)

fun onRootViewRemoved(rootView: View)

fun onRootViewsChanged(rootViews: List<View>)
}

Expand Down Expand Up @@ -105,6 +107,7 @@ class RootViewResolver {

class ObservableViewArrayList : ArrayList<View>() {
private var listener: Listener? = null

fun setListener(listener: Listener?) {
this.listener = listener
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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? {
Expand All @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()) }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()))
}

0 comments on commit 947f193

Please sign in to comment.