Also Android Performance best practice suggests that developers should use StringDef and IntDef over enums and here's why, with the exception of kotlin especially when using R8. Strangely there are tons of simple examples all over Medium using apollo graphql for Android, but none of them ...
应用截图(页面效果一般,不过看这个项目看的不是页面,主要学习的是Kotlin+RxJava2+Retrofit2+MVP架构+组件化 和Kotlin+Retrofit2+协程+Jetpack MVVM架构+组件化的设计) 我们先来看一下组件化架构设计,组件化架构图解说明 1. 组件化概念 组件化开发:就是将一个app分成多个Module,每个Module都是一个组件(也可以是一...
buildscript { ext.kotlin_version = '1.1.61' repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.0.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong // in...
A Retrofit 2 `Converter.Factory` for [Kotlin serialization][1]. Usage --- Add a converter factory when building your `Retrofit` instance using either the `stringBased` or `bytesBased` factory methods: ```kotlin val contentType = MediaType.parse("application/json")!! val json = JSON ...
applyplugin:'kotlin-kapt'// 使用 kapt 注解处理工具applyplugin:'kotlinx-serialization'//序列化 3. 在app的build.gradle的android下添加 buildFeatures { viewBinding =true} 4. 添加依赖 Gitee implementation"com.gitee.catchpig.kmvvm:mvvm:last_version"kapt"com.gitee.catchpig.kmvvm:compiler:last_version"...
I’ll skip some parts of the Hilt setup, so if you want to see the source code, you can find the link at the bottom of this article. Getting Started App levelbuild.gradlefile, //DataStore implementation"androidx.datastore:datastore-preferences:1.0.0" ...
Exploring Kotlin Coroutines and Lifecycle Architectural Components integration on Android What’s new in Android lifecycle and Coroutines integration with lifecycleScope and LiveData building blocks. medium.com Viewmodel Remember that theactivity is expecting a LiveData to observe. ...
原文地址:https://medium.com/mindorks/caching-with-retrofit-store-responses-offline-71439ed32fda 当你使用Retrofit的时候,构建Retrofit实例: valretrofit=Retrofit.Builder().baseUrl(BASE_URL).addConverterFactory(GsonConverterFactory.create()).build() ...
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" compile 'io.reactivex:rxjava:1.1.0' compile 'io.reactivex:rxandroid:1.1.0' compile 'com.squareup.retrofit2:retrofit:2.0.0-beta4' compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta4' compile 'com.squareup.retrofit2:adapter...
You have probably come across different JSON structures in a single response. The ways in which you parse it in the application can be different. Imagine we have the following JSON: We can…