All Projects → ubuntudroid → litho-kotlin

ubuntudroid / litho-kotlin

Licence: other
A simple project showing how to set up an Android project to work with Kotlin and Facebook's Litho.

Programming Languages

kotlin
9241 projects
java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to litho-kotlin

Androidbasemvp
🚀一个快速搭建MVP+RxJava2+Retrofit 基础框架,主要是封装有Http网络请求、日志、缓存、加载等待、toast、页面状态布局管理、权限、RxBus、Glide图片加载等组件,方便快速开发新项目、减少开发成本。
Stars: ✭ 184 (+397.3%)
Mutual labels:  retrofit
Mvpapp
Android MVP Architecture
Stars: ✭ 2,354 (+6262.16%)
Mutual labels:  retrofit
Retrosheet
Turn Google Spreadsheet to JSON endpoint (for Android and JVM) for FREE (100%)
Stars: ✭ 245 (+562.16%)
Mutual labels:  retrofit
Android Kotlin Mvi Cleanarchitecture
Android + Kotlin + Modularization + Gradle Depedency managment + Gradle written in Kotlin DSL + Custom Gradle Plugin + MVVM + MVI + Clean Architecture + Repository Pattern + Coroutines + Flows + Koin + Retrofit2 + ROOM + Kotlin-Android-Extension + KtLints
Stars: ✭ 187 (+405.41%)
Mutual labels:  retrofit
Wanandroid
玩安卓java客户端http://www.wanandroid.com/ 模块化客户端,运用MVP+Retrofit+Rxjava+Rxlifecycle+Glide+Eventbus+ARouter等架构,构建一个最简洁的玩安卓app。
Stars: ✭ 199 (+437.84%)
Mutual labels:  retrofit
Flyabbit
🔥组件化,Retrofit,Rxjava2,dagger2,Mvp ,ReactNative ,Atlas(插件化)
Stars: ✭ 219 (+491.89%)
Mutual labels:  retrofit
Wanandroid
玩安卓客户端(Java版)
Stars: ✭ 166 (+348.65%)
Mutual labels:  retrofit
RestaurantsExplorer
Android application build with MVVM Pattern, using Zomato API to enable search cities arround the world and display the city restaurants on a map.
Stars: ✭ 32 (-13.51%)
Mutual labels:  retrofit
Wandroid
首款适配玩Android、掘金、简书、CSDN、公众号文章黑夜模式,无广告,支持离线阅读,代码图片显示,关注内容本身,阅读体验升级。
Stars: ✭ 199 (+437.84%)
Mutual labels:  retrofit
Networkresponseadapter
A Kotlin Coroutines based Retrofit call adapter that handles errors as a part of state
Stars: ✭ 246 (+564.86%)
Mutual labels:  retrofit
Retrofitutils
retrofit网络工具类
Stars: ✭ 188 (+408.11%)
Mutual labels:  retrofit
Component
🔥🔥🔥A powerful componentized framework.一个强大、100% 兼容、支持 AndroidX、支持 Kotlin并且灵活的组件化框架
Stars: ✭ 2,434 (+6478.38%)
Mutual labels:  retrofit
Newandroidarchitecture Component Github
Sample project based on the new Android Component Architecture
Stars: ✭ 229 (+518.92%)
Mutual labels:  retrofit
Cookman
一款菜谱查询工具Android APP
Stars: ✭ 186 (+402.7%)
Mutual labels:  retrofit
Relax
☘☘Relax 基于Kotlin语言编写的一套组件化框架,不紧整体组件化、内部也高度组件化🎋你可配置MVP、MVVM的开发模式、也可以配置所需要的业务组件🍁🍁
Stars: ✭ 253 (+583.78%)
Mutual labels:  retrofit
Jreadhub
Readhub Android 客户端——官网 : https://readhub.cn
Stars: ✭ 168 (+354.05%)
Mutual labels:  retrofit
Progressmanager
⏳ Listen the progress of downloading and uploading in Okhttp, compatible Retrofit and Glide (一行代码即可监听 App 中所有网络链接的上传以及下载进度, 包括 Glide 的图片加载进度).
Stars: ✭ 2,463 (+6556.76%)
Mutual labels:  retrofit
Library-Spring
The library web application where you can borrow books. It's Spring MVC and Hibernate project.
Stars: ✭ 73 (+97.3%)
Mutual labels:  retrofit
RxHttp
Retrofit 与 协程结合 断点下载 上传,网络缓存
Stars: ✭ 15 (-59.46%)
Mutual labels:  retrofit
Okhttp Json Mock
Mock your datas for Okhttp and Retrofit in json format in just a few moves
Stars: ✭ 231 (+524.32%)
Mutual labels:  retrofit

litho-kotlin

A simple project showing how to set up an Android project to work with Kotlin AND Facebook's Litho.

Check out the litho-retrofit branch for a more advanced example showing how to load a webservice response into a Recycler using RxJava and Retrofit.

Gist

Apart from the regular Kotlin and Litho setup two changes are important:

In your app module's build.gradle:

apply plugin: 'kotlin-kapt'

dependencies {
...

  def lithoVersion = '0.2.0'
  compile "com.facebook.litho:litho-core:$lithoVersion"
  compile "com.facebook.litho:litho-widget:$lithoVersion"
  provided "com.facebook.litho:litho-annotations:$lithoVersion"
  kapt "com.facebook.litho:litho-annotations:$lithoVersion" // in addition(!) to the "provided" line
  kapt "com.facebook.litho:litho-processor:$lithoVersion" // kapt instead of annotationprocessor or apt
  compile "com.facebook.soloader:soloader:$lithoVersion"
  debugCompile "com.facebook.litho:litho-stetho:$lithoVersion"
  compile "com.facebook.litho:litho-fresco:$lithoVersion"
  testCompile("com.facebook.litho:litho-testing:$lithoVersion") {
      exclude group: 'com.google.code.findbugs'
  }
}

In your Litho component specs (thanks to @grandstaish for the @JvmStatic hint):

@LayoutSpec
class ListItemSpec { // no object!!!

  companion object {

      @JvmStatic // important!!!
      @OnCreateLayout
      fun onCreateLayout(context: ComponentContext): ComponentLayout = Column.create(context)
              .paddingDip(YogaEdge.ALL, 16)
              .backgroundColor(Color.WHITE)
              .child(
                      Text.create(context)
                              .text("Hello world")
                              .textSizeSp(40f)
              )
              .child(
                      Text.create(context)
                              .text("Litho tutorial")
                              .textSizeSp(20f)
              )
              .build()
  }
}

License

Copyright 2017 Sven Bendel

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].