Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Room Park Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vladislav Bogdashkin
Room Park Android
Commits
a9b08b91
Commit
a9b08b91
authored
Oct 10, 2019
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added auth screen pattern
parent
230d45a8
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
254 additions
and
76 deletions
+254
-76
RoomParkMainActivity.kt
.../com/biganto/visual/roompark/base/RoomParkMainActivity.kt
+15
-16
BigantoBaseController.kt
...iganto/visual/roompark/conductor/BigantoBaseController.kt
+3
-13
auth.kt
...ava/com/biganto/visual/roompark/domain/interactor/auth.kt
+14
-0
ScreenContract.kt
...isual/roompark/presentation/screen/auth/ScreenContract.kt
+11
-0
ScreenController.kt
...ual/roompark/presentation/screen/auth/ScreenController.kt
+73
-0
ScreenDI.kt
...anto/visual/roompark/presentation/screen/auth/ScreenDI.kt
+44
-0
ScreenPresenter.kt
...sual/roompark/presentation/screen/auth/ScreenPresenter.kt
+24
-0
ScreenViewState.kt
...sual/roompark/presentation/screen/auth/ScreenViewState.kt
+13
-0
ScreenController.kt
...l/roompark/presentation/screen/splash/ScreenController.kt
+11
-8
ScreenDI.kt
...to/visual/roompark/presentation/screen/splash/ScreenDI.kt
+2
-29
ScreenPresenter.kt
...al/roompark/presentation/screen/splash/ScreenPresenter.kt
+2
-2
ic_onlyr.xml
app/src/main/res/drawable/ic_onlyr.xml
+9
-0
activity_main.xml
app/src/main/res/layout/activity_main.xml
+4
-4
splash_screen.xml
app/src/main/res/layout/splash_screen.xml
+29
-4
No files found.
app/src/main/java/com/biganto/visual/roompark/base/RoomParkMainActivity.kt
View file @
a9b08b91
...
...
@@ -19,7 +19,8 @@ import com.google.android.material.appbar.AppBarLayout
import
com.google.android.material.appbar.CollapsingToolbarLayout
import
com.google.android.material.bottomnavigation.BottomNavigationView
import
io.fabric.sdk.android.Fabric
import
kotlin.concurrent.thread
import
kotlinx.android.synthetic.main.activity_main.*
import
timber.log.Timber
class
RoomParkMainActivity
(
)
:
BaseRoomParkActivity
()
...
...
@@ -41,6 +42,8 @@ class RoomParkMainActivity(
@BindView
(
R
.
id
.
conductor_container
)
override
lateinit
var
conductorContainer
:
ViewGroup
@BindView
(
R
.
id
.
bottom_navigation_view
)
override
lateinit
var
bottomNavigation
:
BottomNavigationView
@BindView
(
R
.
id
.
bottom_view_divider
)
lateinit
var
bottomShadow
:
View
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
setTheme
(
R
.
style
.
AppTheme
)
super
.
onCreate
(
savedInstanceState
)
...
...
@@ -53,18 +56,11 @@ class RoomParkMainActivity(
setSupportActionBar
(
topAppBar
)
router
=
Conductor
.
attachRouter
(
this
,
conductorContainer
,
savedInstanceState
)
thread
(
start
=
true
)
{
Thread
.
sleep
(
1000L
)
runOnUiThread
{
router
.
setRoot
(
RouterTransaction
.
with
(
SplashScreenController
()))
}
}
hideAll
()
router
=
Conductor
.
attachRouter
(
this
,
conductorContainer
,
savedInstanceState
)
// snackbarProvider.bindRootView(rootView = coordinatorLayout
)
router
.
setRoot
(
RouterTransaction
.
with
(
SplashScreenController
())
)
}
override
fun
displayBackButton
(
show
:
Boolean
)
{
...
...
@@ -73,22 +69,25 @@ class RoomParkMainActivity(
override
fun
hideAll
()
{
appBar
.
visibility
=
Toolbar
.
INVISIBLE
bottomNavigation
.
visibility
=
Toolbar
.
GONE
val
params
=
coordinatorLayout
.
layoutParams
as
CoordinatorLayout
.
LayoutParams
bottomNavigation
.
visibility
=
BottomNavigationView
.
GONE
bottomShadow
.
visibility
=
View
.
GONE
Timber
.
e
(
" lay params : ${appBar.layoutParams.javaClass}"
)
val
params
:
CoordinatorLayout
.
LayoutParams
=
conductor_container
.
layoutParams
as
CoordinatorLayout
.
LayoutParams
params
.
behavior
=
null
co
ordinatorLayout
.
requestLayout
()
co
nductor_container
.
requestLayout
()
}
override
fun
showAll
()
{
appBar
.
setExpanded
(
false
,
false
)
collapsingToolbarLayout
.
visibility
=
View
.
VISIBLE
bottomNavigation
.
visibility
=
Toolbar
.
VISIBLE
bottomShadow
.
visibility
=
View
.
VISIBLE
appBar
.
visibility
=
View
.
VISIBLE
topAppBar
.
visibility
=
View
.
VISIBLE
val
params
=
co
ordinatorLayout
.
layoutParams
as
CoordinatorLayout
.
LayoutParams
val
params
=
co
nductor_container
.
layoutParams
as
CoordinatorLayout
.
LayoutParams
params
.
behavior
=
AppBarLayout
.
ScrollingViewBehavior
()
co
ordinatorLayout
.
requestLayout
()
co
nductor_container
.
requestLayout
()
}
override
fun
appBarScrollable
(
allow
:
Boolean
)
{
...
...
app/src/main/java/com/biganto/visual/roompark/conductor/BigantoBaseController.kt
View file @
a9b08b91
...
...
@@ -18,7 +18,6 @@ import com.biganto.visual.roompark.di.dagger.ActivityModule
import
com.biganto.visual.roompark.view_utils.snackbar.ISnackBarProvider
import
com.hannesdorfmann.mosby3.mvi.MviBasePresenter
import
io.reactivex.disposables.CompositeDisposable
import
timber.log.Timber
/**
* Created by Vladislav Bogdashkin on 28.05.2018.
...
...
@@ -37,12 +36,13 @@ abstract class BigantoBaseController<VS : BigantoBaseViewState,V: BigantoBaseCon
protected
val
detachDisposable
=
CompositeDisposable
()
abstract
override
fun
createPresenter
():
P
abstract
var
injectedPresenter
:
P
override
fun
createPresenter
():
P
=
injectedPresenter
@LayoutRes
protected
abstract
fun
getLayoutId
():
Int
lateinit
var
toolBar
:
ICollapsingToolBar
lateinit
var
snackbar
:
ISnackBarProvider
...
...
@@ -53,16 +53,6 @@ abstract class BigantoBaseController<VS : BigantoBaseViewState,V: BigantoBaseCon
private
var
isInjected
=
false
override
fun
onRestoreViewState
(
view
:
View
,
savedViewState
:
Bundle
)
{
super
.
onRestoreViewState
(
view
,
savedViewState
)
// try {
// ConductorInjection.inject(this)
// isInjected = true
// } catch (ignored: Throwable) {
// delay injection until onCreateView
// }
}
override
fun
onContextAvailable
(
context
:
Context
)
{
super
.
onContextAvailable
(
context
)
inject
...
...
app/src/main/java/com/biganto/visual/roompark/domain/interactor/auth.kt
0 → 100644
View file @
a9b08b91
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
AuthInteractor
@Inject
constructor
(
private
val
uc
:
AuthUseCase
){
fun
getAuth
()
=
uc
.
validateAuth
()
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/presentation/screen/auth/ScreenContract.kt
0 → 100644
View file @
a9b08b91
package
com.biganto.visual.roompark.presentation.screen.auth
import
com.biganto.visual.roompark.conductor.BigantoBaseContract
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
*/
interface
AuthScreen
:
BigantoBaseContract
<
AuthScreenViewState
>
{
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/presentation/screen/auth/ScreenController.kt
0 → 100644
View file @
a9b08b91
package
com.biganto.visual.roompark.presentation.screen.auth
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
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
com.google.android.material.snackbar.Snackbar
import
javax.inject.Inject
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
*/
class
AuthScreenController
:
BigantoBaseController
<
AuthScreenViewState
,
AuthScreen
,
AuthScreenPresenter
>()
,
AuthScreen
{
override
fun
injectDependencies
()
{
getComponent
()
}
@Inject
override
lateinit
var
injectedPresenter
:
AuthScreenPresenter
// @Inject
// lateinit var snacky:ISnackBarProvider
lateinit
var
rpActivity
:
RoomParkMainActivity
fun
getComponent
()
=
DaggerAuthScreenComponent
.
factory
()
.
create
(
RoomParkApplication
.
component
,
activity
as
RoomParkMainActivity
)
.
inject
(
this
)
// @Inject
// 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
)
{
when
(
viewState
){
is
AuthScreenViewState
.
Idle
->
render
(
viewState
)
is
AuthScreenViewState
.
ToScreen
->
render
(
viewState
)
}
}
private
fun
render
(
viewState
:
AuthScreenViewState
.
Idle
){
}
private
fun
render
(
viewState
:
AuthScreenViewState
.
ToScreen
){
snackbar
.
showSnackBar
(
viewState
.
message
,
Snackbar
.
LENGTH_LONG
)
toolBar
.
hideAll
()
// snacky.showSnackBar("lul")
}
override
fun
getLayoutId
():
Int
=
R
.
layout
.
authentication_screen
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/presentation/screen/auth/ScreenDI.kt
0 → 100644
View file @
a9b08b91
package
com.biganto.visual.roompark.presentation.screen.auth
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.AuthContractModule
import
com.biganto.visual.roompark.di.dagger.PerScreen
import
com.biganto.visual.roompark.domain.contract.AuthContract
import
dagger.Binds
import
dagger.BindsInstance
import
dagger.Component
import
dagger.Module
@PerScreen
@Component
(
modules
=
[
AuthScreenModule
::
class
],
dependencies
=
[
AppComponent
::
class
])
interface
AuthScreenComponent
{
@Component
.
Factory
interface
Factory
{
fun
create
(
appComponent
:
AppComponent
,
@BindsInstance
activity
:
RoomParkMainActivity
):
AuthScreenComponent
}
val
presenter
:
AuthScreenPresenter
fun
inject
(
controller
:
AuthScreenController
)
}
@Module
abstract
class
AuthScreenModule
{
@PerScreen
@Binds
abstract
fun
provideContext
(
activity
:
RoomParkMainActivity
):
Context
@PerScreen
@Binds
abstract
fun
provideAuth
(
contract
:
AuthContractModule
):
AuthContract
}
app/src/main/java/com/biganto/visual/roompark/presentation/screen/auth/ScreenPresenter.kt
0 → 100644
View file @
a9b08b91
package
com.biganto.visual.roompark.presentation.screen.auth
import
com.biganto.visual.roompark.conductor.BigantoBasePresenter
import
com.biganto.visual.roompark.domain.interactor.AuthInteractor
import
javax.inject.Inject
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
*/
class
AuthScreenPresenter
@Inject
constructor
(
private
val
interactor
:
AuthInteractor
)
:
BigantoBasePresenter
<
AuthScreen
,
AuthScreenViewState
>()
{
override
fun
bindIntents
()
{
val
state
=
restoreStateObservable
.
mergeWith
(
interactor
.
getAuth
()
.
map
{
AuthScreenViewState
.
ToScreen
(
it
.
toString
())
})
subscribeViewState
(
state
.
cast
(
AuthScreenViewState
::
class
.
java
),
AuthScreen
::
render
)
}
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/presentation/screen/auth/ScreenViewState.kt
0 → 100644
View file @
a9b08b91
package
com.biganto.visual.roompark.presentation.screen.auth
import
com.biganto.visual.roompark.conductor.BigantoBaseViewState
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
*/
sealed
class
AuthScreenViewState
:
BigantoBaseViewState
()
{
class
Idle
:
AuthScreenViewState
()
class
ToScreen
(
val
message
:
String
)
:
AuthScreenViewState
()
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/presentation/screen/splash/ScreenController.kt
View file @
a9b08b91
package
com.biganto.visual.roompark.presentation.screen.splash
import
DaggerSplashScreenComponent
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
...
...
@@ -9,6 +8,9 @@ import com.biganto.visual.roompark.base.ICollapsingToolBar
import
com.biganto.visual.roompark.base.RoomParkApplication
import
com.biganto.visual.roompark.base.RoomParkMainActivity
import
com.biganto.visual.roompark.conductor.BigantoBaseController
import
com.biganto.visual.roompark.presentation.screen.auth.AuthScreenController
import
com.bluelinelabs.conductor.RouterTransaction
import
com.bluelinelabs.conductor.changehandler.FadeChangeHandler
import
com.google.android.material.snackbar.Snackbar
import
javax.inject.Inject
...
...
@@ -29,6 +31,9 @@ class SplashScreenController :
@Inject
lateinit
var
tb
:
ICollapsingToolBar
@Inject
override
lateinit
var
injectedPresenter
:
SplashScreenPresenter
// @Inject
// lateinit var snacky:ISnackBarProvider
...
...
@@ -46,7 +51,6 @@ class SplashScreenController :
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
):
View
{
val
v
=
super
.
onCreateView
(
inflater
,
container
)
snackbar
.
showSnackBar
(
"AZZZA"
,
Snackbar
.
LENGTH_LONG
)
return
v
}
...
...
@@ -64,16 +68,15 @@ class SplashScreenController :
private
fun
render
(
viewState
:
SplashScreenViewState
.
ToScreen
){
snackbar
.
showSnackBar
(
viewState
.
message
,
Snackbar
.
LENGTH_LONG
)
tb
.
appBar
.
setBackgroundColor
(
resources
?.
getColor
(
R
.
color
.
colorAccentSecondary
)
?:
R
.
color
.
colorAccent
)
tb
.
hideAll
()
router
.
pushController
(
RouterTransaction
.
with
(
AuthScreenController
())
.
popChangeHandler
(
FadeChangeHandler
())
.
pushChangeHandler
(
FadeChangeHandler
())
)
// snacky.showSnackBar("lul")
}
@Inject
lateinit
var
_p
:
SplashScreenPresenter
override
fun
createPresenter
():
SplashScreenPresenter
=
_p
override
fun
getLayoutId
():
Int
=
R
.
layout
.
splash_screen
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/splash/ScreenDI.kt
View file @
a9b08b91
package
com.biganto.visual.roompark.presentation.screen.splash
import
android.content.Context
import
com.biganto.visual.roompark.base.ICollapsingToolBar
...
...
@@ -6,34 +7,15 @@ import com.biganto.visual.roompark.di.dagger.AppComponent
import
com.biganto.visual.roompark.di.dagger.AuthContractModule
import
com.biganto.visual.roompark.di.dagger.PerScreen
import
com.biganto.visual.roompark.domain.contract.AuthContract
import
com.biganto.visual.roompark.presentation.screen.splash.SplashScreenController
import
com.biganto.visual.roompark.presentation.screen.splash.SplashScreenPresenter
import
dagger.Binds
import
dagger.BindsInstance
import
dagger.Component
import
dagger.Module
//package com.biganto.visual.roompark.presentation.screen.splash
//
//import com.biganto.visual.roompark.di.dagger.AppComponent
//import com.biganto.visual.roompark.di.dagger.PerScreen
//import dagger.Component
//import dagger.Provides
//
///**
// * Created by Vladislav Bogdashkin on 30.09.2019.
// */
//
//@PerScreen
//@Component(dependencies = [AppComponent::class])
//interface SplashComponent {
// @Provides
// fun presenter(): SplashScreenPresenter
//}
//
//
@PerScreen
@Component
(
modules
=
[
SplashScreenModule
::
class
],
...
...
@@ -45,7 +27,7 @@ interface SplashScreenComponent {
fun
create
(
appComponent
:
AppComponent
,
@BindsInstance
activity
:
RoomParkMainActivity
):
SplashScreenComponent
):
SplashScreenComponent
}
val
presenter
:
SplashScreenPresenter
...
...
@@ -60,19 +42,10 @@ abstract class SplashScreenModule{
@Binds
abstract
fun
provideContext
(
activity
:
RoomParkMainActivity
):
Context
@PerScreen
@Binds
abstract
fun
provideAuth
(
contract
:
AuthContractModule
):
AuthContract
// @Binds
// abstract fun provideContext(activity: Activity): Context
// @Binds
// abstract fun provideSnack(snack:ISnackBarProvider) : ISnackBarProvider
@PerScreen
@Binds
abstract
fun
provideToolbar
(
activitiy
:
RoomParkMainActivity
):
ICollapsingToolBar
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/splash/ScreenPresenter.kt
View file @
a9b08b91
...
...
@@ -11,8 +11,8 @@ import javax.inject.Inject
class
SplashScreenPresenter
@Inject
constructor
(
var
acitivityContext
:
RoomParkMainActivity
,
val
interactor
:
SplashInteractor
private
val
acitivityContext
:
RoomParkMainActivity
,
private
val
interactor
:
SplashInteractor
// ,var context:Context
)
:
BigantoBasePresenter
<
SplashScreen
,
SplashScreenViewState
>()
{
...
...
app/src/main/res/drawable/ic_onlyr.xml
0 → 100644
View file @
a9b08b91
<vector
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:width=
"21.3dp"
android:height=
"38.5dp"
android:viewportWidth=
"21.3"
android:viewportHeight=
"38.5"
>
<path
android:pathData=
"M8.6,8.6h4.3V21.4H8.6ZM2.1,2.1H19.2V27.8H8.6V23.5H15V6.4H6.4V23.5H2.1ZM0,0V25.7H6.4V38.5H8.5V29.9H21.3V0Z"
android:fillColor=
"#217f79"
/>
</vector>
app/src/main/res/layout/activity_main.xml
View file @
a9b08b91
...
...
@@ -86,7 +86,8 @@
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/bottom_gradient_height"
android:layout_gravity=
"bottom"
android:background=
"@drawable/botttom_bar_shadow"
/>
android:background=
"@drawable/botttom_bar_shadow"
android:visibility=
"invisible"
/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
...
...
@@ -97,14 +98,13 @@
android:layout_height=
"wrap_content"
android:layout_gravity=
"bottom"
android:fitsSystemWindows=
"true"
android:visibility=
"
visibl
e"
android:visibility=
"
gon
e"
app:elevation=
"0dp"
app:itemBackground=
"@color/colorCommonBackground"
app:itemHorizontalTranslationEnabled=
"false"
app:itemIconTint=
"@drawable/bottom_navigation_icon_selector"
app:labelVisibilityMode=
"labeled"
app:menu=
"@menu/bottom_navigation_menu"
tools:visibility=
"invisible"
>
app:menu=
"@menu/bottom_navigation_menu"
>
</com.google.android.material.bottomnavigation.BottomNavigationView>
...
...
app/src/main/res/layout/splash_screen.xml
View file @
a9b08b91
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:orientation=
"vertical"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:id=
"@+id/linearLayout"
>
</LinearLayout>
\ No newline at end of file
<ImageView
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:id=
"@+id/splashBackground"
tools:layout_editor_absoluteX=
"174dp"
tools:layout_editor_absoluteY=
"540dp"
android:scaleType=
"centerCrop"
/>
<ImageView
android:layout_width=
"32dp"
android:layout_height=
"wrap_content"
app:srcCompat=
"@drawable/ic_onlyr"
android:id=
"@+id/imageView3"
app:layout_constraintEnd_toEndOf=
"@+id/splashBackground"
app:layout_constraintStart_toStartOf=
"@+id/splashBackground"
app:layout_constraintBottom_toBottomOf=
"parent"
android:layout_marginTop=
"8dp"
app:layout_constraintTop_toTopOf=
"@+id/splashBackground"
android:layout_marginBottom=
"8dp"
android:layout_marginEnd=
"8dp"
/>
<TextView
style=
"@style/Header_TextView.Main_Header"
android:text=
"РУМЯНЦЕВО-ПАРК"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:id=
"@+id/logo_header"
android:layout_marginBottom=
"8dp"
app:layout_constraintBottom_toBottomOf=
"parent"
android:layout_marginTop=
"8dp"
app:layout_constraintTop_toBottomOf=
"@+id/imageView3"
app:layout_constraintStart_toStartOf=
"@+id/imageView3"
app:layout_constraintEnd_toEndOf=
"@+id/imageView3"
app:layout_constraintVertical_bias=
"0.0"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment