Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
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
aa875bfc
Commit
aa875bfc
authored
Oct 10, 2019
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added rxBinding
parent
a9b08b91
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
58 additions
and
5 deletions
+58
-5
build.gradle
app/build.gradle
+4
-0
auth.kt
...ava/com/biganto/visual/roompark/domain/interactor/auth.kt
+3
-0
authUseCase.kt
...om/biganto/visual/roompark/domain/use_case/authUseCase.kt
+2
-0
ScreenContract.kt
...isual/roompark/presentation/screen/auth/ScreenContract.kt
+4
-1
ScreenController.kt
...ual/roompark/presentation/screen/auth/ScreenController.kt
+33
-2
ScreenPresenter.kt
...sual/roompark/presentation/screen/auth/ScreenPresenter.kt
+7
-0
ScreenViewState.kt
...sual/roompark/presentation/screen/auth/ScreenViewState.kt
+3
-1
authentication_screen.xml
app/src/main/res/layout/authentication_screen.xml
+1
-0
dependencies.gradle
dependencies.gradle
+1
-1
No files found.
app/build.gradle
View file @
aa875bfc
...
@@ -114,6 +114,10 @@ dependencies {
...
@@ -114,6 +114,10 @@ dependencies {
compileOnly
'com.squareup.inject:assisted-inject-annotations-dagger2:0.5.0'
compileOnly
'com.squareup.inject:assisted-inject-annotations-dagger2:0.5.0'
kapt
'com.squareup.inject:assisted-inject-processor-dagger2:0.5.0'
kapt
'com.squareup.inject:assisted-inject-processor-dagger2:0.5.0'
//RxBinding
implementation
"com.jakewharton.rxbinding3:rxbinding:$rxBindingVersion"
implementation
"com.jakewharton.rxbinding3:rxbinding-recyclerview:$rxBindingVersion"
//Tests
//Tests
testImplementation
'junit:junit:4.12'
testImplementation
'junit:junit:4.12'
androidTestImplementation
'androidx.test:runner:1.2.0'
androidTestImplementation
'androidx.test:runner:1.2.0'
...
...
app/src/main/java/com/biganto/visual/roompark/domain/interactor/auth.kt
View file @
aa875bfc
...
@@ -11,4 +11,7 @@ class AuthInteractor @Inject constructor(
...
@@ -11,4 +11,7 @@ class AuthInteractor @Inject constructor(
private
val
uc
:
AuthUseCase
private
val
uc
:
AuthUseCase
){
){
fun
getAuth
()
=
uc
.
validateAuth
()
fun
getAuth
()
=
uc
.
validateAuth
()
fun
authorizate
(
login
:
String
,
password
:
String
)
=
uc
.
authorizate
(
login
,
password
)
}
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/domain/use_case/authUseCase.kt
View file @
aa875bfc
...
@@ -14,6 +14,8 @@ class AuthUseCase @Inject constructor(
...
@@ -14,6 +14,8 @@ class AuthUseCase @Inject constructor(
fun
validateAuth
()
=
Observable
.
just
(
true
)
fun
validateAuth
()
=
Observable
.
just
(
true
)
fun
authorizate
(
login
:
String
,
pwd
:
String
)
=
authContract
.
signIn
(
login
,
pwd
)
}
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/presentation/screen/auth/ScreenContract.kt
View file @
aa875bfc
package
com.biganto.visual.roompark.presentation.screen.auth
package
com.biganto.visual.roompark.presentation.screen.auth
import
com.biganto.visual.roompark.conductor.BigantoBaseContract
import
com.biganto.visual.roompark.conductor.BigantoBaseContract
import
io.reactivex.Observable
/**
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
* Created by Vladislav Bogdashkin on 30.09.2019.
*/
*/
interface
AuthScreen
:
BigantoBaseContract
<
AuthScreenViewState
>
{
interface
AuthScreen
:
BigantoBaseContract
<
AuthScreenViewState
>
{
fun
tryAuth
():
Observable
<
AuthInputModel
>
}
}
data class
AuthInputModel
(
val
login
:
String
,
val
pwd
:
String
)
\ No newline at end of file
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/presentation/screen/auth/ScreenController.kt
View file @
aa875bfc
...
@@ -3,11 +3,16 @@ package com.biganto.visual.roompark.presentation.screen.auth
...
@@ -3,11 +3,16 @@ package com.biganto.visual.roompark.presentation.screen.auth
import
android.view.LayoutInflater
import
android.view.LayoutInflater
import
android.view.View
import
android.view.View
import
android.view.ViewGroup
import
android.view.ViewGroup
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
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.google.android.material.button.MaterialButton
import
com.google.android.material.snackbar.Snackbar
import
com.google.android.material.snackbar.Snackbar
import
com.google.android.material.textfield.TextInputLayout
import
com.jakewharton.rxbinding3.view.clicks
import
io.reactivex.Observable
import
javax.inject.Inject
import
javax.inject.Inject
/**
/**
...
@@ -20,6 +25,19 @@ class AuthScreenController :
...
@@ -20,6 +25,19 @@ class AuthScreenController :
,
AuthScreenPresenter
>()
,
AuthScreenPresenter
>()
,
AuthScreen
{
,
AuthScreen
{
@BindView
(
R
.
id
.
login_text_input
)
lateinit
var
loginInput
:
TextInputLayout
@BindView
(
R
.
id
.
password_text_input
)
lateinit
var
pwdInput
:
TextInputLayout
@BindView
(
R
.
id
.
sign_in_button
)
lateinit
var
signInButton
:
MaterialButton
override
fun
tryAuth
():
Observable
<
AuthInputModel
>
=
signInButton
.
clicks
()
.
map
<
AuthInputModel
>{
AuthInputModel
(
loginInput
.
editText
?.
text
?.
toString
()
?:
""
,
pwdInput
.
editText
?.
text
?.
toString
()
?:
""
)}
override
fun
injectDependencies
()
{
override
fun
injectDependencies
()
{
getComponent
()
getComponent
()
}
}
...
@@ -52,7 +70,11 @@ class AuthScreenController :
...
@@ -52,7 +70,11 @@ class AuthScreenController :
override
fun
render
(
viewState
:
AuthScreenViewState
)
{
override
fun
render
(
viewState
:
AuthScreenViewState
)
{
when
(
viewState
){
when
(
viewState
){
is
AuthScreenViewState
.
Idle
->
render
(
viewState
)
is
AuthScreenViewState
.
Idle
->
render
(
viewState
)
is
AuthScreenViewState
.
ToScreen
->
render
(
viewState
)
is
AuthScreenViewState
.
Authorization
->
render
(
viewState
)
is
AuthScreenViewState
.
SignedIn
->
render
(
viewState
)
is
AuthScreenViewState
.
SignInError
->
render
(
viewState
)
}
}
}
}
...
@@ -60,7 +82,16 @@ class AuthScreenController :
...
@@ -60,7 +82,16 @@ class AuthScreenController :
}
}
private
fun
render
(
viewState
:
AuthScreenViewState
.
ToScreen
){
private
fun
render
(
viewState
:
AuthScreenViewState
.
Authorization
){
toolBar
.
hideAll
()
// snacky.showSnackBar("lul")
}
private
fun
render
(
viewState
:
AuthScreenViewState
.
SignedIn
){
// snacky.showSnackBar("lul")
}
private
fun
render
(
viewState
:
AuthScreenViewState
.
SignInError
){
snackbar
.
showSnackBar
(
viewState
.
message
,
Snackbar
.
LENGTH_LONG
)
snackbar
.
showSnackBar
(
viewState
.
message
,
Snackbar
.
LENGTH_LONG
)
toolBar
.
hideAll
()
toolBar
.
hideAll
()
// snacky.showSnackBar("lul")
// snacky.showSnackBar("lul")
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/auth/ScreenPresenter.kt
View file @
aa875bfc
...
@@ -14,7 +14,14 @@ class AuthScreenPresenter @Inject constructor(
...
@@ -14,7 +14,14 @@ class AuthScreenPresenter @Inject constructor(
)
)
:
BigantoBasePresenter
<
AuthScreen
,
AuthScreenViewState
>()
{
:
BigantoBasePresenter
<
AuthScreen
,
AuthScreenViewState
>()
{
override
fun
bindIntents
()
{
override
fun
bindIntents
()
{
val
onAuth
=
intent
(
AuthScreen
::
tryAuth
)
.
flatMap
{
interactor
.
getAuth
()
}
val
state
=
restoreStateObservable
val
state
=
restoreStateObservable
.
mergeWith
(
interactor
.
getAuth
()
.
mergeWith
(
interactor
.
getAuth
()
.
map
{
AuthScreenViewState
.
ToScreen
(
it
.
toString
())
})
.
map
{
AuthScreenViewState
.
ToScreen
(
it
.
toString
())
})
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/auth/ScreenViewState.kt
View file @
aa875bfc
...
@@ -9,5 +9,7 @@ import com.biganto.visual.roompark.conductor.BigantoBaseViewState
...
@@ -9,5 +9,7 @@ import com.biganto.visual.roompark.conductor.BigantoBaseViewState
sealed
class
AuthScreenViewState
:
BigantoBaseViewState
()
{
sealed
class
AuthScreenViewState
:
BigantoBaseViewState
()
{
class
Idle
:
AuthScreenViewState
()
class
Idle
:
AuthScreenViewState
()
class
ToScreen
(
val
message
:
String
)
:
AuthScreenViewState
()
class
Authorization
:
AuthScreenViewState
()
class
SignedIn
:
AuthScreenViewState
()
class
SignInError
(
val
message
:
String
)
:
AuthScreenViewState
()
}
}
\ No newline at end of file
app/src/main/res/layout/authentication_screen.xml
View file @
aa875bfc
...
@@ -109,6 +109,7 @@
...
@@ -109,6 +109,7 @@
</FrameLayout>
</FrameLayout>
<com.google.android.material.button.MaterialButton
<com.google.android.material.button.MaterialButton
android:id=
"@+id/sign_in_button"
style=
"@style/AuthButton.Enable"
style=
"@style/AuthButton.Enable"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
...
...
dependencies.gradle
View file @
aa875bfc
...
@@ -11,7 +11,7 @@ ext {
...
@@ -11,7 +11,7 @@ ext {
// supportLibraryVersion = '1.1.0-alpha05'
// supportLibraryVersion = '1.1.0-alpha05'
constrainLayoutVersion
=
'1.1.3'
constrainLayoutVersion
=
'1.1.3'
// requeryVersion = '1.5.1'
// requeryVersion = '1.5.1'
// rxBindingVersion = '2.1.1
'
rxBindingVersion
=
'3.0.0
'
conductorVersion
=
'3.0.0-rc1'
conductorVersion
=
'3.0.0-rc1'
materialVersion
=
'1.1.0-alpha10'
materialVersion
=
'1.1.0-alpha10'
gradleVersion
=
'3.5.0'
gradleVersion
=
'3.5.0'
...
...
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