Add ViewModel File Template.
This commit is contained in:
parent
89271ecce2
commit
fd86dd3424
2 changed files with 28 additions and 0 deletions
8
.idea/file.template.settings.xml
generated
Normal file
8
.idea/file.template.settings.xml
generated
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ExportableFileTemplateSettings">
|
||||||
|
<default_templates>
|
||||||
|
<template name="ViewModel.kt" file-name="${NAME}ViewModel" reformat="true" live-template-enabled="false" />
|
||||||
|
</default_templates>
|
||||||
|
</component>
|
||||||
|
</project>
|
20
.idea/fileTemplates/ViewModel.kt
generated
Normal file
20
.idea/fileTemplates/ViewModel.kt
generated
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME}
|
||||||
|
|
||||||
|
import androidx.lifecycle.LiveData
|
||||||
|
import androidx.lifecycle.ViewModel
|
||||||
|
import org.thoughtcrime.securesms.util.livedata.Store
|
||||||
|
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||||
|
|
||||||
|
#end
|
||||||
|
#parse("File Header.java")
|
||||||
|
class ${NAME}ViewModel : ViewModel() {
|
||||||
|
|
||||||
|
private val store = Store(${NAME}State())
|
||||||
|
private val disposables = CompositeDisposable()
|
||||||
|
|
||||||
|
val state: LiveData<${NAME}State> = store.stateLiveData
|
||||||
|
|
||||||
|
override fun onCleared() {
|
||||||
|
disposables.clear()
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue