2020-04-29 15:38:01 +03:00
|
|
|
package ${escapeKotlinIdentifiers(packageName)}
|
|
|
|
|
|
|
|
import android.os.Bundle
|
|
|
|
<#if createFragmentArgs>
|
|
|
|
import android.os.Parcelable
|
2020-12-16 02:46:52 +03:00
|
|
|
import kotlinx.parcelize.Parcelize
|
2020-04-29 15:38:01 +03:00
|
|
|
import com.airbnb.mvrx.args
|
|
|
|
</#if>
|
|
|
|
import android.view.View
|
|
|
|
import com.airbnb.mvrx.fragmentViewModel
|
|
|
|
import com.airbnb.mvrx.withState
|
2020-08-03 19:31:41 +03:00
|
|
|
import im.vector.app.R
|
|
|
|
import im.vector.app.core.platform.VectorBaseFragment
|
2020-04-29 15:38:01 +03:00
|
|
|
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 18:58:54 +03:00
|
|
|
private val viewModelFactory: ${viewModelClass}.Factory
|
|
|
|
) : VectorBaseFragment(), ${viewModelClass}.Factory by viewModelFactory {
|
2020-04-29 15:38:01 +03: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() {
|
|
|
|
// Clear your view, unsubscribe...
|
2020-12-16 12:16:33 +03:00
|
|
|
super.onDestroyView()
|
2020-04-29 15:38:01 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
override fun invalidate() = withState(viewModel) { state ->
|
|
|
|
//TODO
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|