diff --git a/android/src/main/java/com/facebook/flipper/plugins/uidebugger/descriptors/AbstractChainedDescriptor.kt b/android/src/main/java/com/facebook/flipper/plugins/uidebugger/descriptors/AbstractChainedDescriptor.kt index 51896a3630f..cd3eccf8c45 100644 --- a/android/src/main/java/com/facebook/flipper/plugins/uidebugger/descriptors/AbstractChainedDescriptor.kt +++ b/android/src/main/java/com/facebook/flipper/plugins/uidebugger/descriptors/AbstractChainedDescriptor.kt @@ -26,14 +26,6 @@ abstract class AbstractChainedDescriptor : Descriptor(), ChainedDescriptor return mSuper } - /** Initialize a descriptor. */ - final override fun init() { - mSuper?.init() - onInit() - } - - open fun onInit() {} - final override fun getActiveChild(node: T): Any? { // ask each descriptor in the chain for an active child, if none available look up the chain // until no more super descriptors @@ -58,7 +50,7 @@ abstract class AbstractChainedDescriptor : Descriptor(), ChainedDescriptor return onGetName(node) } - abstract fun onGetActiveChild(node: T): Any? + open fun onGetActiveChild(node: T): Any? = null abstract fun onGetName(node: T): String diff --git a/android/src/main/java/com/facebook/flipper/plugins/uidebugger/descriptors/ActivityDescriptor.kt b/android/src/main/java/com/facebook/flipper/plugins/uidebugger/descriptors/ActivityDescriptor.kt index 69d958979bb..e18dc9fcadb 100644 --- a/android/src/main/java/com/facebook/flipper/plugins/uidebugger/descriptors/ActivityDescriptor.kt +++ b/android/src/main/java/com/facebook/flipper/plugins/uidebugger/descriptors/ActivityDescriptor.kt @@ -11,11 +11,7 @@ import android.app.Activity import com.facebook.flipper.plugins.uidebugger.common.InspectableObject import com.facebook.flipper.plugins.uidebugger.stetho.FragmentCompat -class ActivityDescriptor : AbstractChainedDescriptor() { - override fun onInit() {} - override fun onGetActiveChild(node: Activity): Any? { - return null - } +object ActivityDescriptor : AbstractChainedDescriptor() { override fun onGetId(activity: Activity): String { return Integer.toString(System.identityHashCode(activity)) diff --git a/android/src/main/java/com/facebook/flipper/plugins/uidebugger/descriptors/ApplicationRefDescriptor.kt b/android/src/main/java/com/facebook/flipper/plugins/uidebugger/descriptors/ApplicationRefDescriptor.kt index d76b8fbf722..534038b48db 100644 --- a/android/src/main/java/com/facebook/flipper/plugins/uidebugger/descriptors/ApplicationRefDescriptor.kt +++ b/android/src/main/java/com/facebook/flipper/plugins/uidebugger/descriptors/ApplicationRefDescriptor.kt @@ -8,12 +8,10 @@ package com.facebook.flipper.plugins.uidebugger.descriptors import android.app.Activity -import com.facebook.flipper.plugins.uidebugger.common.InspectableObject import com.facebook.flipper.plugins.uidebugger.core.ApplicationRef -class ApplicationRefDescriptor : AbstractChainedDescriptor() { +object ApplicationRefDescriptor : AbstractChainedDescriptor() { - override fun onInit() {} override fun onGetActiveChild(node: ApplicationRef): Any? { return if (node.activitiesStack.size > 0) node.activitiesStack.last() else null } @@ -34,9 +32,4 @@ class ApplicationRefDescriptor : AbstractChainedDescriptor() { children.add(activity) } } - - override fun onGetData( - applicationRef: ApplicationRef, - attributeSections: MutableMap - ) {} } diff --git a/android/src/main/java/com/facebook/flipper/plugins/uidebugger/descriptors/ButtonDescriptor.kt b/android/src/main/java/com/facebook/flipper/plugins/uidebugger/descriptors/ButtonDescriptor.kt index 740e4a548f1..ff040474eda 100644 --- a/android/src/main/java/com/facebook/flipper/plugins/uidebugger/descriptors/ButtonDescriptor.kt +++ b/android/src/main/java/com/facebook/flipper/plugins/uidebugger/descriptors/ButtonDescriptor.kt @@ -10,7 +10,7 @@ package com.facebook.flipper.plugins.uidebugger.descriptors import android.widget.Button import com.facebook.flipper.plugins.uidebugger.common.InspectableObject -class ButtonDescriptor : AbstractChainedDescriptor