Commit d9511b06 authored by Vladislav Bogdashkin's avatar Vladislav Bogdashkin 🎣

default patterns for the screens

parent c3519432
...@@ -58,6 +58,8 @@ abstract class BigantoBaseController<VS : BigantoBaseViewState,V: BigantoBaseCon ...@@ -58,6 +58,8 @@ abstract class BigantoBaseController<VS : BigantoBaseViewState,V: BigantoBaseCon
inject inject
} }
abstract fun onViewBound(v:View)
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup): View { override fun onCreateView(inflater: LayoutInflater, container: ViewGroup): View {
val view = inflater.inflate(getLayoutId(), container, false) val view = inflater.inflate(getLayoutId(), container, false)
// instantiate the view // instantiate the view
...@@ -68,6 +70,7 @@ abstract class BigantoBaseController<VS : BigantoBaseViewState,V: BigantoBaseCon ...@@ -68,6 +70,7 @@ abstract class BigantoBaseController<VS : BigantoBaseViewState,V: BigantoBaseCon
toolBar = it toolBar = it
snackbar.bindRootView(toolBar.coordinatorLayout) snackbar.bindRootView(toolBar.coordinatorLayout)
} }
onViewBound(view)
return view return view
} }
......
package com.biganto.visual.roompark.domain.interactor
import javax.inject.Inject
/**
* Created by Vladislav Bogdashkin on 09.10.2019.
*/
class DealsInteractor @Inject constructor(
){
}
\ No newline at end of file
package com.biganto.visual.roompark.domain.interactor
import javax.inject.Inject
/**
* Created by Vladislav Bogdashkin on 09.10.2019.
*/
class FavoritesInteractor @Inject constructor(
){
}
\ No newline at end of file
package com.biganto.visual.roompark.domain.interactor
import com.biganto.visual.roompark.domain.use_case.AuthUseCase
import javax.inject.Inject
/**
* Created by Vladislav Bogdashkin on 09.10.2019.
*/
class FeedsInteractor @Inject constructor(
){
}
\ No newline at end of file
package com.biganto.visual.roompark.domain.interactor
import javax.inject.Inject
/**
* Created by Vladislav Bogdashkin on 09.10.2019.
*/
class FindFlatInteractor @Inject constructor(
){
}
\ No newline at end of file
package com.biganto.visual.roompark.domain.interactor
import javax.inject.Inject
/**
* Created by Vladislav Bogdashkin on 09.10.2019.
*/
class SettingsInteractor @Inject constructor(
){
}
\ No newline at end of file
package com.biganto.visual.roompark.presentation.screen.auth package com.biganto.visual.roompark.presentation.screen.auth
import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup
import butterknife.BindView import butterknife.BindView
import com.biganto.visual.roompark.R import com.biganto.visual.roompark.R
import com.biganto.visual.roompark.base.RoomParkApplication import com.biganto.visual.roompark.base.RoomParkApplication
...@@ -27,6 +25,8 @@ class AuthScreenController : ...@@ -27,6 +25,8 @@ class AuthScreenController :
, AuthScreen , AuthScreen
, AuthScreenPresenter>() , AuthScreenPresenter>()
, AuthScreen { , AuthScreen {
override fun onViewBound(v: View) {
}
@BindView(R.id.login_text_input) lateinit var loginInput:TextInputLayout @BindView(R.id.login_text_input) lateinit var loginInput:TextInputLayout
@BindView(R.id.password_text_input) lateinit var pwdInput:TextInputLayout @BindView(R.id.password_text_input) lateinit var pwdInput:TextInputLayout
...@@ -39,7 +39,8 @@ class AuthScreenController : ...@@ -39,7 +39,8 @@ class AuthScreenController :
override fun tryAuth(): Observable<AuthInputModel> = override fun tryAuth(): Observable<AuthInputModel> =
signInButton.clicks() signInButton.clicks()
.map<AuthInputModel>{ AuthInputModel(loginInput.editText?.text?.toString()?:"" .map<AuthInputModel>{ AuthInputModel(loginInput.editText?.text?.toString()?:""
,pwdInput.editText?.text?.toString()?:"")} ,pwdInput.editText?.text?.toString()?:"")
}
override fun injectDependencies() { override fun injectDependencies() {
getComponent() getComponent()
...@@ -63,11 +64,6 @@ class AuthScreenController : ...@@ -63,11 +64,6 @@ class AuthScreenController :
// @Inject // @Inject
// lateinit var ac: RoomParkMainActivity // lateinit var ac: RoomParkMainActivity
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup): View {
val v = super.onCreateView(inflater, container)
return v
}
override fun render(viewState: AuthScreenViewState) { override fun render(viewState: AuthScreenViewState) {
......
...@@ -17,7 +17,6 @@ class AuthScreenPresenter @Inject constructor( ...@@ -17,7 +17,6 @@ class AuthScreenPresenter @Inject constructor(
) )
: BigantoBasePresenter<AuthScreen, AuthScreenViewState>() { : BigantoBasePresenter<AuthScreen, AuthScreenViewState>() {
override fun bindIntents() { override fun bindIntents() {
val onAuth = intent(AuthScreen::tryAuth) val onAuth = intent(AuthScreen::tryAuth)
...@@ -35,7 +34,7 @@ class AuthScreenPresenter @Inject constructor( ...@@ -35,7 +34,7 @@ class AuthScreenPresenter @Inject constructor(
val state = restoreStateObservable val state = restoreStateObservable
.mergeWith(onAuth) .mergeWith(onAuth)
.doOnError{ Timber.e(it)} .doOnError{ Timber.e(it)}
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.single())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
subscribeViewState(state.cast(AuthScreenViewState::class.java), AuthScreen::render) subscribeViewState(state.cast(AuthScreenViewState::class.java), AuthScreen::render)
......
package com.biganto.visual.roompark.presentation.screen.deals
import com.biganto.visual.roompark.conductor.BigantoBaseContract
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
*/
interface DealsScreen : BigantoBaseContract<DealsScreenViewState> {
}
package com.biganto.visual.roompark.presentation.screen.deals
import android.view.View
import com.biganto.visual.roompark.R
import com.biganto.visual.roompark.base.RoomParkApplication
import com.biganto.visual.roompark.base.RoomParkMainActivity
import com.biganto.visual.roompark.conductor.BigantoBaseController
import timber.log.Timber
import javax.inject.Inject
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
*/
class DealsScreenController :
BigantoBaseController<DealsScreenViewState
, DealsScreen
, DealsScreenPresenter>()
, DealsScreen {
override fun injectDependencies() {
getComponent()
}
@Inject
override lateinit var injectedPresenter: DealsScreenPresenter
override fun onViewBound(v: View) {
}
override fun render(viewState: DealsScreenViewState) {
super.render(viewState)
Timber.d("Render state $viewState")
when(viewState){
is DealsScreenViewState.Idle -> render(viewState)
}
}
private fun render(viewState: DealsScreenViewState.Idle){
}
private fun getComponent() = DaggerDealsScreenComponent.factory()
.create(RoomParkApplication.component,activity as RoomParkMainActivity)
.inject(this)
override fun getLayoutId(): Int = R.layout.favorites_screen
}
\ No newline at end of file
package com.biganto.visual.roompark.presentation.screen.deals
import android.content.Context
import com.biganto.visual.roompark.base.RoomParkMainActivity
import com.biganto.visual.roompark.di.dagger.AppComponent
import com.biganto.visual.roompark.di.dagger.PerScreen
import dagger.Binds
import dagger.BindsInstance
import dagger.Component
import dagger.Module
@PerScreen
@Component(
modules = [DealsScreenModule::class],
dependencies = [AppComponent::class])
interface DealsScreenComponent {
@Component.Factory
interface Factory{
fun create(
appComponent: AppComponent
,@BindsInstance activity: RoomParkMainActivity
): DealsScreenComponent
}
val presenter: DealsScreenPresenter
fun inject(controller: DealsScreenController)
}
@Module
abstract class DealsScreenModule{
@PerScreen
@Binds
abstract fun provideContext(activity: RoomParkMainActivity): Context
}
package com.biganto.visual.roompark.presentation.screen.deals
import com.biganto.visual.roompark.conductor.BigantoBasePresenter
import com.biganto.visual.roompark.domain.interactor.DealsInteractor
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import timber.log.Timber
import javax.inject.Inject
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
*/
class DealsScreenPresenter @Inject constructor(
private val interactor: DealsInteractor
)
: BigantoBasePresenter<DealsScreen, DealsScreenViewState>() {
override fun bindIntents() {
val state = restoreStateObservable
.doOnError{ Timber.e(it)}
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
subscribeViewState(state.cast(DealsScreenViewState::class.java), DealsScreen::render)
}
}
\ No newline at end of file
package com.biganto.visual.roompark.presentation.screen.deals
import com.biganto.visual.roompark.conductor.BigantoBaseViewState
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
*/
sealed class DealsScreenViewState : BigantoBaseViewState() {
class Idle : DealsScreenViewState()
}
\ No newline at end of file
package com.biganto.visual.roompark.presentation.screen.favorites
import com.biganto.visual.roompark.conductor.BigantoBaseContract
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
*/
interface FavoritesScreen : BigantoBaseContract<FavoritesScreenViewState> {
}
package com.biganto.visual.roompark.presentation.screen.favorites
import android.view.View
import com.biganto.visual.roompark.R
import com.biganto.visual.roompark.base.RoomParkApplication
import com.biganto.visual.roompark.base.RoomParkMainActivity
import com.biganto.visual.roompark.conductor.BigantoBaseController
import timber.log.Timber
import javax.inject.Inject
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
*/
class FavoritesScreenController :
BigantoBaseController<FavoritesScreenViewState
, FavoritesScreen
, FavoritesScreenPresenter>()
, FavoritesScreen {
override fun injectDependencies() {
getComponent()
}
@Inject
override lateinit var injectedPresenter: FavoritesScreenPresenter
override fun onViewBound(v: View) {
}
override fun render(viewState: FavoritesScreenViewState) {
super.render(viewState)
Timber.d("Render state $viewState")
when(viewState){
is FavoritesScreenViewState.Idle -> render(viewState)
}
}
private fun render(viewState: FavoritesScreenViewState.Idle){
}
private fun getComponent() = DaggerFavoritesScreenComponent.factory()
.create(RoomParkApplication.component,activity as RoomParkMainActivity)
.inject(this)
override fun getLayoutId(): Int = R.layout.favorites_screen
}
\ No newline at end of file
package com.biganto.visual.roompark.presentation.screen.favorites
import android.content.Context
import com.biganto.visual.roompark.base.RoomParkMainActivity
import com.biganto.visual.roompark.di.dagger.AppComponent
import com.biganto.visual.roompark.di.dagger.PerScreen
import dagger.Binds
import dagger.BindsInstance
import dagger.Component
import dagger.Module
@PerScreen
@Component(
modules = [FavoritesScreenModule::class],
dependencies = [AppComponent::class])
interface FavoritesScreenComponent {
@Component.Factory
interface Factory{
fun create(
appComponent: AppComponent
,@BindsInstance activity: RoomParkMainActivity
): FavoritesScreenComponent
}
val presenter: FavoritesScreenPresenter
fun inject(controller: FavoritesScreenController)
}
@Module
abstract class FavoritesScreenModule{
@PerScreen
@Binds
abstract fun provideContext(activity: RoomParkMainActivity): Context
}
package com.biganto.visual.roompark.presentation.screen.favorites
import com.biganto.visual.roompark.conductor.BigantoBasePresenter
import com.biganto.visual.roompark.domain.interactor.FavoritesInteractor
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import timber.log.Timber
import javax.inject.Inject
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
*/
class FavoritesScreenPresenter @Inject constructor(
private val interactor: FavoritesInteractor
)
: BigantoBasePresenter<FavoritesScreen, FavoritesScreenViewState>() {
override fun bindIntents() {
val state = restoreStateObservable
.doOnError{ Timber.e(it)}
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
subscribeViewState(state.cast(FavoritesScreenViewState::class.java), FavoritesScreen::render)
}
}
\ No newline at end of file
package com.biganto.visual.roompark.presentation.screen.favorites
import com.biganto.visual.roompark.conductor.BigantoBaseViewState
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
*/
sealed class FavoritesScreenViewState : BigantoBaseViewState() {
class Idle : FavoritesScreenViewState()
}
\ No newline at end of file
package com.biganto.visual.roompark.presentation.screen.feeds
import com.biganto.visual.roompark.conductor.BigantoBaseContract
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
*/
interface FeedsScreen : BigantoBaseContract<FeedsScreenViewState> {
}
package com.biganto.visual.roompark.presentation.screen.feeds
import android.view.View
import com.biganto.visual.roompark.R
import com.biganto.visual.roompark.base.RoomParkApplication
import com.biganto.visual.roompark.base.RoomParkMainActivity
import com.biganto.visual.roompark.conductor.BigantoBaseController
import timber.log.Timber
import javax.inject.Inject
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
*/
class FeedsScreenController :
BigantoBaseController<FeedsScreenViewState
, FeedsScreen
, FeedsScreenPresenter>()
, FeedsScreen {
override fun injectDependencies() {
getComponent()
}
@Inject
override lateinit var injectedPresenter: FeedsScreenPresenter
override fun onViewBound(v: View) {
}
override fun render(viewState: FeedsScreenViewState) {
super.render(viewState)
Timber.d("Render state $viewState")
when(viewState){
is FeedsScreenViewState.Idle -> render(viewState)
}
}
private fun render(viewState: FeedsScreenViewState.Idle){
}
private fun getComponent() = DaggerFeedsScreenComponent.factory()
.create(RoomParkApplication.component,activity as RoomParkMainActivity)
.inject(this)
override fun getLayoutId(): Int = R.layout.feeds_screen
}
\ No newline at end of file
package com.biganto.visual.roompark.presentation.screen.feeds
import android.content.Context
import com.biganto.visual.roompark.base.RoomParkMainActivity
import com.biganto.visual.roompark.di.dagger.AppComponent
import com.biganto.visual.roompark.di.dagger.PerScreen
import dagger.Binds
import dagger.BindsInstance
import dagger.Component
import dagger.Module
@PerScreen
@Component(
modules = [FeedsScreenModule::class],
dependencies = [AppComponent::class])
interface FeedsScreenComponent {
@Component.Factory
interface Factory{
fun create(
appComponent: AppComponent
,@BindsInstance activity: RoomParkMainActivity
): FeedsScreenComponent
}
val presenter: FeedsScreenPresenter
fun inject(controller: FeedsScreenController)
}
@Module
abstract class FeedsScreenModule{
@PerScreen
@Binds
abstract fun provideContext(activity: RoomParkMainActivity): Context
}
package com.biganto.visual.roompark.presentation.screen.feeds
import com.biganto.visual.roompark.conductor.BigantoBasePresenter
import com.biganto.visual.roompark.domain.interactor.FeedsInteractor
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import timber.log.Timber
import javax.inject.Inject
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
*/
class FeedsScreenPresenter @Inject constructor(
private val interactor: FeedsInteractor
)
: BigantoBasePresenter<FeedsScreen, FeedsScreenViewState>() {
override fun bindIntents() {
val state = restoreStateObservable
.doOnError{ Timber.e(it)}
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
subscribeViewState(state.cast(FeedsScreenViewState::class.java), FeedsScreen::render)
}
}
\ No newline at end of file
package com.biganto.visual.roompark.presentation.screen.feeds
import com.biganto.visual.roompark.conductor.BigantoBaseViewState
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
*/
sealed class FeedsScreenViewState : BigantoBaseViewState() {
class Idle : FeedsScreenViewState()
}
\ No newline at end of file
...@@ -11,8 +11,11 @@ import com.biganto.visual.roompark.base.ICollapsingToolBar ...@@ -11,8 +11,11 @@ import com.biganto.visual.roompark.base.ICollapsingToolBar
import com.biganto.visual.roompark.base.RoomParkApplication import com.biganto.visual.roompark.base.RoomParkApplication
import com.biganto.visual.roompark.base.RoomParkMainActivity import com.biganto.visual.roompark.base.RoomParkMainActivity
import com.biganto.visual.roompark.conductor.BigantoBaseController import com.biganto.visual.roompark.conductor.BigantoBaseController
import com.biganto.visual.roompark.presentation.screen.auth.AuthScreenController import com.biganto.visual.roompark.presentation.screen.deals.DealsScreenController
import com.biganto.visual.roompark.presentation.screen.splash.SplashScreenController import com.biganto.visual.roompark.presentation.screen.favorites.FavoritesScreenController
import com.biganto.visual.roompark.presentation.screen.feeds.FeedsScreenController
import com.biganto.visual.roompark.presentation.screen.settings.SettingsScreenController
import com.biganto.visual.roompark.presentation.screen.to_flat.FindFlatScreenController
import javax.inject.Inject import javax.inject.Inject
/** /**
...@@ -25,6 +28,19 @@ class HomeController : ...@@ -25,6 +28,19 @@ class HomeController :
, HomeScreenPresenter>() , HomeScreenPresenter>()
, HomeScreen { , HomeScreen {
override fun onViewBound(v: View) {
tb.showAll()
pageAdapter = BNVRouterPagerAdapter(this,bottomNavigation.bottomNavigation,viewpager,
mapOf(
Pair(R.id.tab_feeds,{FeedsScreenController()})
,Pair(R.id.tab_favorites,{ FavoritesScreenController() })
,Pair(R.id.tab_deals,{ DealsScreenController() })
,Pair(R.id.tab_look_flat,{ FindFlatScreenController() })
,Pair(R.id.tab_settings,{SettingsScreenController()})
)
)
}
override fun injectDependencies() { override fun injectDependencies() {
getComponent() getComponent()
} }
...@@ -57,21 +73,6 @@ class HomeController : ...@@ -57,21 +73,6 @@ class HomeController :
// @Inject // @Inject
// lateinit var ac: RoomParkMainActivity // lateinit var ac: RoomParkMainActivity
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup): View {
val v = super.onCreateView(inflater, container)
tb.showAll()
pageAdapter = BNVRouterPagerAdapter(this,bottomNavigation.bottomNavigation,viewpager,
mapOf(
Pair(R.id.tab_feeds,{SplashScreenController()})
,Pair(R.id.tab_favorites,{AuthScreenController()})
,Pair(R.id.tab_deals,{AuthScreenController()})
,Pair(R.id.tab_look_flat,{AuthScreenController()})
,Pair(R.id.tab_settings,{SplashScreenController()})
)
)
return v
}
override fun render(viewState: HomeScreenViewState) { override fun render(viewState: HomeScreenViewState) {
......
package com.biganto.visual.roompark.presentation.screen.settings
import com.biganto.visual.roompark.conductor.BigantoBaseContract
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
*/
interface SettingsScreen : BigantoBaseContract<SettingsScreenViewState> {
}
package com.biganto.visual.roompark.presentation.screen.settings
import android.view.View
import com.biganto.visual.roompark.R
import com.biganto.visual.roompark.base.RoomParkApplication
import com.biganto.visual.roompark.base.RoomParkMainActivity
import com.biganto.visual.roompark.conductor.BigantoBaseController
import timber.log.Timber
import javax.inject.Inject
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
*/
class SettingsScreenController :
BigantoBaseController<SettingsScreenViewState
, SettingsScreen
, SettingsScreenPresenter>()
, SettingsScreen {
override fun injectDependencies() {
getComponent()
}
@Inject
override lateinit var injectedPresenter: SettingsScreenPresenter
override fun onViewBound(v: View) {
}
override fun render(viewState: SettingsScreenViewState) {
super.render(viewState)
Timber.d("Render state $viewState")
when(viewState){
is SettingsScreenViewState.Idle -> render(viewState)
}
}
private fun render(viewState: SettingsScreenViewState.Idle){
}
private fun getComponent() = DaggerSettingsScreenComponent.factory()
.create(RoomParkApplication.component,activity as RoomParkMainActivity)
.inject(this)
override fun getLayoutId(): Int = R.layout.favorites_screen
}
\ No newline at end of file
package com.biganto.visual.roompark.presentation.screen.settings
import android.content.Context
import com.biganto.visual.roompark.base.RoomParkMainActivity
import com.biganto.visual.roompark.di.dagger.AppComponent
import com.biganto.visual.roompark.di.dagger.PerScreen
import dagger.Binds
import dagger.BindsInstance
import dagger.Component
import dagger.Module
@PerScreen
@Component(
modules = [SettingsScreenModule::class],
dependencies = [AppComponent::class])
interface SettingsScreenComponent {
@Component.Factory
interface Factory{
fun create(
appComponent: AppComponent
,@BindsInstance activity: RoomParkMainActivity
): SettingsScreenComponent
}
val presenter: SettingsScreenPresenter
fun inject(controller: SettingsScreenController)
}
@Module
abstract class SettingsScreenModule{
@PerScreen
@Binds
abstract fun provideContext(activity: RoomParkMainActivity): Context
}
package com.biganto.visual.roompark.presentation.screen.settings
import com.biganto.visual.roompark.conductor.BigantoBasePresenter
import com.biganto.visual.roompark.domain.interactor.SettingsInteractor
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import timber.log.Timber
import javax.inject.Inject
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
*/
class SettingsScreenPresenter @Inject constructor(
private val interactor: SettingsInteractor
)
: BigantoBasePresenter<SettingsScreen, SettingsScreenViewState>() {
override fun bindIntents() {
val state = restoreStateObservable
.doOnError{ Timber.e(it)}
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
subscribeViewState(state.cast(SettingsScreenViewState::class.java), SettingsScreen::render)
}
}
\ No newline at end of file
package com.biganto.visual.roompark.presentation.screen.settings
import com.biganto.visual.roompark.conductor.BigantoBaseViewState
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
*/
sealed class SettingsScreenViewState : BigantoBaseViewState() {
class Idle : SettingsScreenViewState()
}
\ No newline at end of file
package com.biganto.visual.roompark.presentation.screen.splash package com.biganto.visual.roompark.presentation.screen.splash
import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup
import com.biganto.visual.roompark.R import com.biganto.visual.roompark.R
import com.biganto.visual.roompark.base.ICollapsingToolBar import com.biganto.visual.roompark.base.ICollapsingToolBar
import com.biganto.visual.roompark.base.RoomParkApplication import com.biganto.visual.roompark.base.RoomParkApplication
...@@ -22,7 +20,11 @@ class SplashScreenController : ...@@ -22,7 +20,11 @@ class SplashScreenController :
BigantoBaseController<SplashScreenViewState BigantoBaseController<SplashScreenViewState
, SplashScreen , SplashScreen
, SplashScreenPresenter>() , SplashScreenPresenter>()
, SplashScreen { , SplashScreen {
override fun onViewBound(v: View) {
}
override fun injectDependencies() { override fun injectDependencies() {
getComponent() getComponent()
...@@ -48,12 +50,6 @@ class SplashScreenController : ...@@ -48,12 +50,6 @@ class SplashScreenController :
// @Inject // @Inject
// lateinit var ac: RoomParkMainActivity // lateinit var ac: RoomParkMainActivity
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup): View {
val v = super.onCreateView(inflater, container)
return v
}
override fun render(viewState: SplashScreenViewState) { override fun render(viewState: SplashScreenViewState) {
when(viewState){ when(viewState){
......
package com.biganto.visual.roompark.presentation.screen.to_flat
import com.biganto.visual.roompark.conductor.BigantoBaseContract
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
*/
interface FindFlatScreen : BigantoBaseContract<FindFlatScreenViewState> {
}
package com.biganto.visual.roompark.presentation.screen.to_flat
import android.view.View
import com.biganto.visual.roompark.R
import com.biganto.visual.roompark.base.RoomParkApplication
import com.biganto.visual.roompark.base.RoomParkMainActivity
import com.biganto.visual.roompark.conductor.BigantoBaseController
import timber.log.Timber
import javax.inject.Inject
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
*/
class FindFlatScreenController :
BigantoBaseController<FindFlatScreenViewState
, FindFlatScreen
, FindFlatScreenPresenter>()
, FindFlatScreen {
override fun injectDependencies() {
getComponent()
}
@Inject
override lateinit var injectedPresenter: FindFlatScreenPresenter
override fun onViewBound(v: View) {
}
override fun render(viewState: FindFlatScreenViewState) {
super.render(viewState)
Timber.d("Render state $viewState")
when(viewState){
is FindFlatScreenViewState.Idle -> render(viewState)
}
}
private fun render(viewState: FindFlatScreenViewState.Idle){
}
private fun getComponent() = DaggerFindFlatScreenComponent.factory()
.create(RoomParkApplication.component,activity as RoomParkMainActivity)
.inject(this)
override fun getLayoutId(): Int = R.layout.find_flat_screen
}
\ No newline at end of file
package com.biganto.visual.roompark.presentation.screen.to_flat
import android.content.Context
import com.biganto.visual.roompark.base.RoomParkMainActivity
import com.biganto.visual.roompark.di.dagger.AppComponent
import com.biganto.visual.roompark.di.dagger.PerScreen
import dagger.Binds
import dagger.BindsInstance
import dagger.Component
import dagger.Module
@PerScreen
@Component(
modules = [FindFlatScreenModule::class],
dependencies = [AppComponent::class])
interface FindFlatScreenComponent {
@Component.Factory
interface Factory{
fun create(
appComponent: AppComponent
,@BindsInstance activity: RoomParkMainActivity
): FindFlatScreenComponent
}
val presenter: FindFlatScreenPresenter
fun inject(controller: FindFlatScreenController)
}
@Module
abstract class FindFlatScreenModule{
@PerScreen
@Binds
abstract fun provideContext(activity: RoomParkMainActivity): Context
}
package com.biganto.visual.roompark.presentation.screen.to_flat
import com.biganto.visual.roompark.conductor.BigantoBasePresenter
import com.biganto.visual.roompark.domain.interactor.FindFlatInteractor
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import timber.log.Timber
import javax.inject.Inject
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
*/
class FindFlatScreenPresenter @Inject constructor(
private val interactor: FindFlatInteractor
)
: BigantoBasePresenter<FindFlatScreen, FindFlatScreenViewState>() {
override fun bindIntents() {
val state = restoreStateObservable
.doOnError{ Timber.e(it)}
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
subscribeViewState(state.cast(FindFlatScreenViewState::class.java), FindFlatScreen::render)
}
}
\ No newline at end of file
package com.biganto.visual.roompark.presentation.screen.to_flat
import com.biganto.visual.roompark.conductor.BigantoBaseViewState
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
*/
sealed class FindFlatScreenViewState : BigantoBaseViewState() {
class Idle : FindFlatScreenViewState()
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
...@@ -49,4 +55,5 @@ ...@@ -49,4 +55,5 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/dev_progress_recycler_view" /> app:layout_constraintTop_toBottomOf="@+id/dev_progress_recycler_view" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file </androidx.core.widget.NestedScrollView>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment