mirror of
https://github.com/element-hq/element-android
synced 2024-12-22 09:14:58 +03:00
48 lines
1.3 KiB
Text
48 lines
1.3 KiB
Text
|
package ${escapeKotlinIdentifiers(packageName)}
|
||
|
|
||
|
import android.os.Bundle
|
||
|
<#if createFragmentArgs>
|
||
|
import android.os.Parcelable
|
||
|
import kotlinx.android.parcel.Parcelize
|
||
|
import com.airbnb.mvrx.args
|
||
|
</#if>
|
||
|
import android.view.View
|
||
|
import com.airbnb.mvrx.fragmentViewModel
|
||
|
import com.airbnb.mvrx.withState
|
||
|
import im.vector.riotx.R
|
||
|
import im.vector.riotx.core.platform.VectorBaseFragment
|
||
|
import javax.inject.Inject
|
||
|
|
||
|
<#if createFragmentArgs>
|
||
|
@Parcelize
|
||
|
data class ${fragmentArgsClass}() : Parcelable
|
||
|
</#if>
|
||
|
|
||
|
//TODO: add this fragment into FragmentModule
|
||
|
class ${fragmentClass} @Inject constructor(
|
||
|
val viewModelFactory: ${viewModelClass}.Factory
|
||
|
) : VectorBaseFragment() {
|
||
|
|
||
|
<#if createFragmentArgs>
|
||
|
private val fragmentArgs: ${fragmentArgsClass} by args()
|
||
|
</#if>
|
||
|
private val viewModel: ${viewModelClass} by fragmentViewModel()
|
||
|
|
||
|
override fun getLayoutResId() = R.layout.${fragmentLayout}
|
||
|
|
||
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||
|
super.onViewCreated(view, savedInstanceState)
|
||
|
// Initialize your view, subscribe to viewModel...
|
||
|
}
|
||
|
|
||
|
override fun onDestroyView() {
|
||
|
super.onDestroyView()
|
||
|
// Clear your view, unsubscribe...
|
||
|
}
|
||
|
|
||
|
override fun invalidate() = withState(viewModel) { state ->
|
||
|
//TODO
|
||
|
}
|
||
|
|
||
|
}
|