Remove Reference API

Summary: Reference has been deprecated for a while. This diff completely removes it in favor of using ComparableDrawable everywhere.

Reviewed By: astreet

Differential Revision: D14241428

fbshipit-source-id: a986f34fda3a05c85d3d57b1e806c5e48c3f485e
This commit is contained in:
Pasquale Anatriello
2019-03-08 11:16:55 -08:00
committed by Facebook Github Bot
parent b65581262a
commit a0ddb92cd2
2 changed files with 2 additions and 15 deletions

View File

@@ -25,14 +25,12 @@ import com.facebook.flipper.plugins.inspector.NodeDescriptor;
import com.facebook.flipper.plugins.inspector.Touch;
import com.facebook.flipper.plugins.inspector.descriptors.ObjectDescriptor;
import com.facebook.litho.Component;
import com.facebook.litho.ComponentContext;
import com.facebook.litho.DebugComponent;
import com.facebook.litho.DebugLayoutNode;
import com.facebook.litho.LithoView;
import com.facebook.litho.StateContainer;
import com.facebook.litho.annotations.Prop;
import com.facebook.litho.annotations.State;
import com.facebook.litho.reference.Reference;
import com.facebook.yoga.YogaAlign;
import com.facebook.yoga.YogaDirection;
import com.facebook.yoga.YogaEdge;
@@ -180,7 +178,7 @@ public class DebugComponentDescriptor extends NodeDescriptor<DebugComponent> {
}
final FlipperObject.Builder data = new FlipperObject.Builder();
data.put("background", fromReference(node.getContext(), layout.getBackground()));
data.put("background", fromDrawable(layout.getBackground()));
data.put("foreground", fromDrawable(layout.getForeground()));
data.put("direction", InspectorValue.mutable(Enum, layout.getLayoutDirection().toString()));
@@ -631,17 +629,6 @@ public class DebugComponentDescriptor extends NodeDescriptor<DebugComponent> {
return InspectorValue.mutable(Color, 0);
}
private static <T extends Drawable> InspectorValue fromReference(
ComponentContext c, Reference<T> r) {
if (r == null) {
return fromDrawable(null);
}
final T d = Reference.acquire(c.getAndroidContext(), r);
final InspectorValue v = fromDrawable(d);
Reference.release(c.getAndroidContext(), d, r);
return v;
}
private static InspectorValue fromFloat(float f) {
if (Float.isNaN(f)) {