Guys, if you want to add facebook-shimmer feature with litho, please do try slither.
It can be used to show loading effect, highlighting important parts in ui etc.
TodoDetailComponentSpec
’s component, it stopped working.@LayoutSpec
object AppComponentSpec {
private val TRANSITION_ANIMATOR = Transition.timing(200, AccelerateDecelerateInterpolator())
@OnCreateLayout
fun onCreateLayout(
context: ComponentContext,
@Prop props: Props,
@Prop dispatch: Dispatch<Msg>
): Component {
val screen = when (props) {
is Props.TodoList -> {
TodoListComponent.create(context)
.props(props.props)
.dispatch(contramap(dispatch, Msg::TodoList))
}
is Props.TodoDetail -> {
TodoDetailComponent.create(context)
.props(props.props)
.dispatch(contramap(dispatch, Msg::TodoDetail))
}
}
return screen
.transitionKey(javaClass.name)
.widthPercent(100F)
.heightPercent(100F)
.positionType(YogaPositionType.ABSOLUTE)
.build()
}
@OnCreateTransition
fun onCreateTransition(
context: ComponentContext,
@Prop props: Props
): Transition {
return Transition.create(javaClass.name)
.animator(TRANSITION_ANIMATOR)
.let { transition ->
when (props.direction) {
Model.Direction.FORWARD -> {
transition
.animate(AnimatedProperties.X)
.appearFrom(DimensionValue.widthPercentageOffset(100F))
.disappearTo(DimensionValue.widthPercentageOffset(-100F))
}
Model.Direction.BACKWARD -> {
transition
.animate(AnimatedProperties.X)
.appearFrom(DimensionValue.widthPercentageOffset(-100F))
.disappearTo(DimensionValue.widthPercentageOffset(100F))
}
Model.Direction.REPLACE -> {
transition
.animate(AnimatedProperties.ALPHA)
.appearFrom(0F)
.disappearTo(0F)
}
}
}
}
}
transitionKey
to the both the parent and child components with no luck. Tried wrapping the child component in a row to no success.
SectionSpec
as a @prop
param.2019-08-21 16:32:51.400 5359-6719/com.gamepix.gameapp W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
2019-08-21 16:32:51.431 5359-5359/com.gamepix.gameapp W/gamepix.gameap: CheckJNI: method to register "jni_YGNodeReset" not in the given class. This is slow, consider changing your RegisterNatives calls.
2019-08-21 16:32:51.432 5359-5359/com.gamepix.gameapp E/gamepix.gameap: ----- class 'Lcom/facebook/yoga/YogaNative;' cl=0x12c23638 -----
2019-08-21 16:32:51.432 5359-5359/com.gamepix.gameapp E/gamepix.gameap: objectSize=172 (172 from super)
2019-08-21 16:32:51.432 5359-5359/com.gamepix.gameapp E/gamepix.gameap: access=0x0008.0001
2019-08-21 16:32:51.432 5359-5359/com.gamepix.gameapp E/gamepix.gameap: super='java.lang.Class<java.lang.Object>' (cl=0x0)
2019-08-21 16:32:51.432 5359-5359/com.gamepix.gameapp E/gamepix.gameap: vtable (0 entries, 11 in super):
2019-08-21 16:32:51.432 5359-5359/com.gamepix.gameapp E/gamepix.gameap: direct methods (42 entries):
2019-08-21 16:32:51.432 5359-5359/com.gamepix.gameapp E/gamepix.gameap: 0: void com.facebook.yoga.YogaNative.<clinit>()
2019-08-21 16:32:51.432 5359-5359/com.gamepix.gameapp E/gamepix.gameap: 1: void com.facebook.yoga.YogaNative.<init>()
2019-08-21 16:32:51.432 5359-5359/com.gamepix.gameapp E/gamepix.gameap: 2: void com.facebook.yoga.YogaNative.jni_YGConfigFree(long)
2019-08-21 16:32:51.432 5359-5359/com.gamepix.gameapp E/gamepix.gameap: 3: long com.facebook.yoga.YogaNative.jni_YGConfigNew()
2019-08-21 16:32:51.432 5359-5359/com.gamepix.gameapp E/gamepix.gameap: 4: void com.facebook.yoga.YogaNative.jni_YGConfigSetUseWebDefaults(long, boolean)
2019-08-21 16:32:51.432 5359-5359/com.gamepix.gameapp E/gamepix.gameap: 5: void com.facebook.yoga.YogaNative.jni_YGNodeCalculateLayout(long, float, float, long[], com.facebook.yoga.YogaNodeJNIBase[])
2019-08-21 16:32:51.432 5359-5359/com.gamepix.gameapp E/gamepix.gameap: 6: void com.facebook.yoga.YogaNative.jni_YGNodeClearChildren(long)
2019-08-21 16:32:51.432 5359-5359/com.gamepix.gameapp E/gamepix.gameap: 7: long com.facebook.yoga.YogaNative.jni_YGNodeClone(long)
2019-08-21 16:32:51.432 5359-5359/com.gamepix.gameapp E/gamepix.gameap: 8: void com.facebook.yoga.YogaNative.jni_YGNodeFree(long)
2019-08-21 16:32:51.432 5359-5359/com.gamepix.gameapp E/gamepix.gameap: 9: void com.facebook.yoga.YogaNative.jni_YGNodeInsertChild(long, long, int)
2019-08-21 16:32:51.432 5359-5359/com.gamepix.gameapp E/gamepix.gameap: 10: long com.facebook.yoga.YogaNative.jni_YGNodeNew(boolean)
2019-08-21 16:32:51.432 5359-5359/com.gamepix.gameapp E/gamepix.gameap: 11: long com.facebook.yoga.YogaNative.jni_YGNodeNewWithConfig(long, boolean)
2019-08-21 16:32:51.432 5359-5359/com.gamepix.gameapp E/gamepix.gameap: 12: void com.facebook.yoga.YogaNative.jni_YGNodeSetHasBaselineFunc(long, boolean)
2019-08-21 16:32:51.432 5359-5359/com.gamepix.gameapp E/gamepix.gameap: 13: void com.facebook.yoga.YogaNative.jni_YGNodeSetHasMeasureFunc(long, boolean)
2019-08-21 16:32:51.432 5359-5359/com.gamepix.gameapp E/gamepix.gameap: 14: void com.facebook.yoga.YogaNative.jni_YGNodeSetIsReferenceBaseline(long, boolean)
2019-08-21 16:32:51.432 5359-5359/com.gamepix.gameapp E/gamepix.gameap: 15: int com.facebook.yoga.YogaNative.jni_YGNodeStyleGetDirection(long)
2019-08-21 16:32:51.432 5359-5359/com.gamepix.gameapp E/gamepix.gameap: 16: long com.facebook.yoga.YogaNative.jni_YGNodeStyleGetHeight(long)
2019-08-21 16:32:51.432 5359-5359/com.gamepix.gameapp E/gamepix.gameap: 17: long com.facebook.yoga.YogaNative.jni_YGNodeStyleGetWidth(long)
2019-08-21 16:32:51.432 5359-5359/com.gamepix.gameapp E/gamepix.gameap: 18: void com.facebook.yoga.YogaNative.jni_YGNodeStyleSetAlignContent(long, int)
2019-08-21 16:32:51.432 5359-5359/com.gamepix.gameapp E/gamepix.gameap: 19: void com.facebook.yoga.YogaNative.jni_YGNodeStyleSetAlignItems(long, int)
2019-08-21 16:32:51.432 5359-5359/com.gamepix.gameapp E/gamepix.gameap: 20: void com.facebook.yoga
-keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip
-keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters
# Do not strip any method/class that is annotated with @DoNotStrip
-keep @com.facebook.proguard.annotations.DoNotStrip class *
-keepclassmembers class * {
@com.facebook.proguard.annotations.DoNotStrip *;
}
-keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * {
void set*(***);
*** get*();
}
-keep @com.facebook.proguard.annotations.DoNotStrip class *
with-keep @com.facebook.proguard.annotations.DoNotStrip class * { *; }
Hi everyone, i have a big problem with
Fatal Exception: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libyoga.so caused by: couldn't find DSO to load: libfb.so caused by: Error: Cannot load /data/user/0/my.packagei/lib-main/libfb.so
While using litho.
Anyone knows this ?
/art: art/runtime/java_vm_ext.cc:470] JNI DETECTED ERROR IN APPLICATION: JNI GetFieldID called with pending exception java.lang.ClassNotFoundException: Didn't find class "com.facebook.jni.Countable" on path: DexPathList[[zip file "/data/app/com.geinikoudai.myapplication-2/base.apk"],
crashed when updated to Adroid Studio 3.6, any one has the same issue?
anyone have some working code using the latest version of litho?
e.g: "com.facebook.litho:litho-core:0.35.0"
cause when im trying the latest version it seems to always have some errors
but whenever i tried using the old version e.g: "com.facebook.litho:litho-core:0.12.0"
it works
Hello all, I am wondering to use Litho on my next project. However, I know I will need shared elements between fragments.
Typically, I have a list of items. When I click on an item, I need a shared elements transition to a new "details" fragment.
How can I use Litho with fragments Shared Elements ? Do you know some code examples ?
Thanks !
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?){
val c = ComponentContext(this.activity?.applicationContext)
return LithoView.create(
c,
RecyclerCollectionComponent.create(c)
.section(
SingleComponentSection.create(SectionContext(c))
.component(Text.create(c).text("some text").build())
.build()
.build()
)
setViewContent()
it works.
java.lang.IllegalStateException: Can't use Unspecified height on an horizontal scrolling Recycler if dynamic measurement is not allowed
var recyclerBinder = RecyclerBinder.Builder()
.layoutInfo(LinearLayoutInfo(lithoContext, OrientationHelper.HORIZONTAL, false))
.hasDynamicItemHeight(true)
.build(lithoContext)
var recycler = LithoView.create(lithoContext,Recycler.create(lithoContext)
.binder(recyclerBinder)
.useHeightAsBaseline(true)
.snapHelper(getSnapHelper(SNAP_TO_START, 2, 0 ))
.hasFixedSize(false)
.marginDip(YogaEdge.BOTTOM, carouselInstance.marginVertical ?: 0f)
.build())