Shawn
01/16/2019, 2:15 AMNikky
01/16/2019, 2:42 AMinline fun <reified T> saveConfig(config: T = T::class.java.constructors.find { it.parameterCount == 0 }!!.newInstance() as T) {
Nikky
01/16/2019, 2:46 AM(T::class.java::newInstance)()
gildor
01/16/2019, 2:46 AMNikky
01/16/2019, 3:03 AMgildor
01/16/2019, 3:07 AMNikky
01/16/2019, 3:21 AMNikky
01/16/2019, 3:21 AMthana
07/09/2020, 7:12 AMDavid Gough
07/09/2020, 2:32 PMuser
07/09/2020, 3:30 PMDaniel Medeiros
07/09/2020, 5:17 PMKayla Charky
07/09/2020, 6:25 PMdimsuz
07/10/2020, 10:46 PMDavide Giuseppe Farella
07/11/2020, 2:45 PM// Coroutines
val coroutinesVersion = "1.3.7"
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:$coroutinesVersion")
// Ktor Client
val ktorVersion = "1.3.2"
implementation("io.ktor:ktor-client-core:$ktorVersion")
implementation("io.ktor:ktor-client-apache:$ktorVersion")
implementation("io.ktor:ktor-client-serialization-jvm:$ktorVersion")
Wrote a very simple GET function an tried to run. but I got:
Error running 'AppKt': '1.8' is bad configured
I also see in the IDE cannot access <http://java.io|java.io>.Closeable. which is supertype...
on get
of client.get<String>
Tests are running fine 😕
https://www.raywenderlich.com/5777183-write-an-aws-lambda-function-with-kotlin-and-micronaut
TL;DR
gradle init
- application
- Kotlin
Davide Giuseppe Farella
07/11/2020, 2:47 PMHullaballoonatic
07/12/2020, 7:40 PMNir
07/13/2020, 4:37 PMzalewski.se
07/14/2020, 11:05 AMJulius Marozas
07/14/2020, 2:50 PMReplaySubject
with time buffer in Kotlin Flow or Channels?
Context: I am developing an Android app which receives data from a device via Bluetooth and then graphs it in real-time.Gunslingor
07/14/2020, 8:49 PMVipul
07/15/2020, 9:21 AMuser
07/15/2020, 10:05 AMNir
07/15/2020, 5:53 PMuser
07/16/2020, 12:32 PMuser
07/16/2020, 12:33 PMGunslingor
07/16/2020, 3:10 PMahmad abas
07/16/2020, 11:15 PMiOS
. Some of the users there pointed <http://hackingwithswift.com|hackingwithswift.com>
as a good beginning resource to learn iOS dev
.. is there any similar one for android?
MSC
07/17/2020, 4:27 AMhybridDeveloper
07/17/2020, 10:01 AMabstract class MviViewModel<I : MviIntent, A : MviResult<VS>, VS : MviViewState>(initialState: VS) : ViewModel() {
private val intentsSubject: PublishSubject<I> = PublishSubject.create()
private val statesObservable: Observable<VS> = intentsSubject
.compose { intents -> intents.publish { shared -> filterIntents(shared) } }
.flatMap { dispatchIntent(it) }
.scan(initialState) { previousState: VS, result: A -> result.reduce(previousState) }
.distinctUntilChanged()
.replay(1)
.autoConnect(0)
abstract fun dispatchIntent(intent: I): Observable<A>
open fun filterIntents(intents: Observable<I>): ObservableSource<I> = intents
fun processIntents(intents: Observable<I>): Disposable {
return intents.subscribe(intentsSubject::onNext)
}
fun states(): Observable<VS> = statesObservable
}
interface MviAnalyticsViewModel {
fun onResume(activity: Activity)
}Fragment
abstract class MviFragment<V : MviView, I : MviIntent, A : MviResult<VS>, VS : MviViewState> : Fragment(), MviView {
private val onStartDisposables = CompositeDisposable()
private val onAttachDisposables = CompositeDisposable()
/**
* This activity should implement the provided MviView generic interface, it will be used by
* the renderer to update the ui.
*/
abstract val view: V
/**
* The ViewModel belonging to the activity
*/
abstract val viewModel: MviViewModel<I, A, VS>
/**
* The Renderer that will update the MviView of this activity
*/
abstract val renderer: MviRenderer<V, VS>
/**
* Push Intents to this
*/
abstract fun onStartIntents(): Observable<I>
abstract fun onStartIntentsFlow(): Flow<I>
/**
* Push Intents to this
*/
open fun onAttachIntents(): Observable<I> = Observable.empty()
open fun onAttachIntentsFlow(): Flow<I> = emptyFlow()
override fun onAttach(context: Context) = super.onAttach(context).also {
AndroidSupportInjection.inject(this)
onAttachDisposables.add(viewModel.processIntents(onAttachIntents()))
}
@ExperimentalCoroutinesApi
override fun onDetach() {
onAttachDisposables.clear()
super.onDetach()
}
override fun onStart() = super.onStart().also {
onStartDisposables.addAll(
viewModel.states()
.observeOn(AndroidSchedulers.mainThread())
.subscribe { renderer.render(view, it) },
viewModel.processIntents(onStartIntents())
)
}
@ExperimentalCoroutinesApi
override fun onStop() {
onStartDisposables.clear()
super.onStop()
}
}