2020-04-29 14:38:01 +02:00
|
|
|
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(
|
2020-04-29 17:58:54 +02:00
|
|
|
private val viewModelFactory: ${viewModelClass}.Factory
|
|
|
|
) : VectorBaseFragment(), ${viewModelClass}.Factory by viewModelFactory {
|
2020-04-29 14:38:01 +02:00
|
|
|
|
|
|
|
<#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
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|