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
f5ee4da1
Commit
f5ee4da1
authored
Nov 18, 2019
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
resolve on error auth editText issue
parent
5d067764
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
57 additions
and
5 deletions
+57
-5
BigantoBaseController.kt
...iganto/visual/roompark/conductor/BigantoBaseController.kt
+8
-0
ScreenController.kt
...ual/roompark/presentation/screen/auth/ScreenController.kt
+29
-2
ScreenPresenter.kt
...sual/roompark/presentation/screen/auth/ScreenPresenter.kt
+15
-1
sign_in_button_selector.xml
app/src/main/res/color/sign_in_button_selector.xml
+3
-2
styles.xml
app/src/main/res/values/styles.xml
+2
-0
No files found.
app/src/main/java/com/biganto/visual/roompark/conductor/BigantoBaseController.kt
View file @
f5ee4da1
...
@@ -19,6 +19,7 @@ import com.biganto.visual.roompark.util.monades.ExceptionString
...
@@ -19,6 +19,7 @@ import com.biganto.visual.roompark.util.monades.ExceptionString
import
com.biganto.visual.roompark.util.view_utils.snackbar.ISnackBarProvider
import
com.biganto.visual.roompark.util.view_utils.snackbar.ISnackBarProvider
import
com.hannesdorfmann.mosby3.mvi.MviBasePresenter
import
com.hannesdorfmann.mosby3.mvi.MviBasePresenter
import
io.reactivex.disposables.CompositeDisposable
import
io.reactivex.disposables.CompositeDisposable
import
timber.log.Timber
/**
/**
* Created by Vladislav Bogdashkin on 28.05.2018.
* Created by Vladislav Bogdashkin on 28.05.2018.
...
@@ -47,7 +48,14 @@ abstract class BigantoBaseController<VS : BigantoBaseViewState,V: BigantoBaseCon
...
@@ -47,7 +48,14 @@ abstract class BigantoBaseController<VS : BigantoBaseViewState,V: BigantoBaseCon
lateinit
var
toolBar
:
ICollapsingToolBar
lateinit
var
toolBar
:
ICollapsingToolBar
lateinit
var
snackbar
:
ISnackBarProvider
lateinit
var
snackbar
:
ISnackBarProvider
override
fun
onAttach
(
view
:
View
)
{
Timber
.
d
(
"On Attach"
)
super
.
onAttach
(
view
)
}
override
fun
onDetach
(
view
:
View
)
{
override
fun
onDetach
(
view
:
View
)
{
Timber
.
d
(
"On Detach"
)
detachDisposable
.
clear
()
detachDisposable
.
clear
()
super
.
onDetach
(
view
)
super
.
onDetach
(
view
)
}
}
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/auth/ScreenController.kt
View file @
f5ee4da1
...
@@ -12,9 +12,11 @@ import com.bluelinelabs.conductor.RouterTransaction
...
@@ -12,9 +12,11 @@ import com.bluelinelabs.conductor.RouterTransaction
import
com.google.android.material.button.MaterialButton
import
com.google.android.material.button.MaterialButton
import
com.google.android.material.textfield.TextInputLayout
import
com.google.android.material.textfield.TextInputLayout
import
com.jakewharton.rxbinding3.view.clicks
import
com.jakewharton.rxbinding3.view.clicks
import
com.jakewharton.rxbinding3.widget.textChanges
import
io.reactivex.Observable
import
io.reactivex.Observable
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.android.schedulers.AndroidSchedulers
import
timber.log.Timber
import
timber.log.Timber
import
java.util.concurrent.TimeUnit
import
javax.inject.Inject
import
javax.inject.Inject
/**
/**
...
@@ -26,19 +28,24 @@ class AuthScreenController :
...
@@ -26,19 +28,24 @@ class AuthScreenController :
,
AuthScreen
,
AuthScreen
,
AuthScreenPresenter
>()
,
AuthScreenPresenter
>()
,
AuthScreen
{
,
AuthScreen
{
override
fun
onViewBound
(
v
:
View
)
{
override
fun
onViewBound
(
v
:
View
)
{
toolBar
.
hideAll
()
toolBar
.
hideAll
()
bottomNavigation
.
hide
()
bottomNavigation
.
hide
()
}
}
@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
@BindView
(
R
.
id
.
sign_in_button
)
lateinit
var
signInButton
:
MaterialButton
@BindView
(
R
.
id
.
sign_in_button
)
lateinit
var
signInButton
:
MaterialButton
override
fun
tryAuth
():
Observable
<
AuthInputModel
>
=
override
fun
tryAuth
():
Observable
<
AuthInputModel
>
=
signInButton
.
clicks
()
signInButton
.
clicks
()
.
debounce
(
200L
,
TimeUnit
.
MILLISECONDS
)
.
doOnNext
{
signInButton
.
hideKeyboard
()
}
.
doOnNext
{
signInButton
.
hideKeyboard
()
}
.
map
<
AuthInputModel
>
{
.
map
<
AuthInputModel
>
{
AuthInputModel
(
AuthInputModel
(
...
@@ -52,6 +59,27 @@ class AuthScreenController :
...
@@ -52,6 +59,27 @@ class AuthScreenController :
getComponent
()
getComponent
()
}
}
override
fun
onAttach
(
view
:
View
)
{
super
.
onAttach
(
view
)
detachDisposable
.
addAll
(
loginInput
.
editText
?.
textChanges
()
?.
doOnNext
{
Timber
.
d
(
"loginInput.isErrorEnabled ${loginInput.isErrorEnabled}"
)}
?.
filter
{
loginInput
.
isErrorEnabled
}
?.
subscribe
{
Timber
.
d
(
"got key $it"
)
loginInput
.
isErrorEnabled
=
false
loginInput
.
error
=
null
signInButton
.
isEnabled
=
true
},
pwdInput
.
editText
?.
textChanges
()
?.
filter
{
pwdInput
.
isErrorEnabled
}
?.
subscribe
{
pwdInput
.
isErrorEnabled
=
false
signInButton
.
isEnabled
=
true
}
)
}
@Inject
@Inject
lateinit
var
bottomNavigation
:
IBottomNavigation
lateinit
var
bottomNavigation
:
IBottomNavigation
...
@@ -114,7 +142,6 @@ class AuthScreenController :
...
@@ -114,7 +142,6 @@ class AuthScreenController :
{
strId
->
loginInput
.
error
=
resources
?.
getString
(
strId
)},
{
strId
->
loginInput
.
error
=
resources
?.
getString
(
strId
)},
{
message
->
loginInput
.
error
=
message
}
{
message
->
loginInput
.
error
=
message
}
)
)
signInButton
.
isEnabled
=
true
}
}
private
fun
render
(
viewState
:
AuthScreenViewState
.
WrongPassword
){
private
fun
render
(
viewState
:
AuthScreenViewState
.
WrongPassword
){
...
@@ -124,10 +151,10 @@ class AuthScreenController :
...
@@ -124,10 +151,10 @@ class AuthScreenController :
{
strId
->
pwdInput
.
error
=
resources
?.
getString
(
strId
)},
{
strId
->
pwdInput
.
error
=
resources
?.
getString
(
strId
)},
{
message
->
pwdInput
.
error
=
message
}
{
message
->
pwdInput
.
error
=
message
}
)
)
signInButton
.
isEnabled
=
true
}
}
private
fun
render
(
viewState
:
AuthScreenViewState
.
SomeError
)
=
private
fun
render
(
viewState
:
AuthScreenViewState
.
SomeError
)
=
showError
(
viewState
.
exception
)
showError
(
viewState
.
exception
)
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/auth/ScreenPresenter.kt
View file @
f5ee4da1
...
@@ -3,6 +3,7 @@ package com.biganto.visual.roompark.presentation.screen.auth
...
@@ -3,6 +3,7 @@ package com.biganto.visual.roompark.presentation.screen.auth
import
com.biganto.visual.roompark.conductor.BigantoBasePresenter
import
com.biganto.visual.roompark.conductor.BigantoBasePresenter
import
com.biganto.visual.roompark.domain.interactor.AuthInteractor
import
com.biganto.visual.roompark.domain.interactor.AuthInteractor
import
com.biganto.visual.roompark.util.monades.ExceptionString
import
com.biganto.visual.roompark.util.monades.ExceptionString
import
io.reactivex.Observable
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.schedulers.Schedulers
import
io.reactivex.schedulers.Schedulers
import
timber.log.Timber
import
timber.log.Timber
...
@@ -18,6 +19,18 @@ class AuthScreenPresenter @Inject constructor(
...
@@ -18,6 +19,18 @@ class AuthScreenPresenter @Inject constructor(
)
)
:
BigantoBasePresenter
<
AuthScreen
,
AuthScreenViewState
>()
{
:
BigantoBasePresenter
<
AuthScreen
,
AuthScreenViewState
>()
{
override
fun
attachView
(
view
:
AuthScreen
)
{
super
.
attachView
(
view
)
Timber
.
d
(
"on AttachView"
)
restoreStateObservable
.
accept
(
AuthScreenViewState
.
Idle
())
}
override
fun
detachView
()
{
super
.
detachView
()
Timber
.
d
(
"on DetachView"
)
restoreStateObservable
}
override
fun
defaultErrorViewStateHandler
()
=
override
fun
defaultErrorViewStateHandler
()
=
{
e
:
ExceptionString
->
AuthScreenViewState
.
SomeError
(
e
)}
{
e
:
ExceptionString
->
AuthScreenViewState
.
SomeError
(
e
)}
...
@@ -38,8 +51,9 @@ class AuthScreenPresenter @Inject constructor(
...
@@ -38,8 +51,9 @@ class AuthScreenPresenter @Inject constructor(
.
map
{
it
}
.
map
{
it
}
.
map
<
AuthScreenViewState
>
{
AuthScreenViewState
.
SignedIn
()
}
.
map
<
AuthScreenViewState
>
{
AuthScreenViewState
.
SignedIn
()
}
.
onErrorReturn
{
parseError
(
it
)}
.
onErrorReturn
{
parseError
(
it
)}
.
startWith
(
Observable
.
just
(
AuthScreenViewState
.
Authorization
()))
}
}
// .startWith(Observable.just(AuthScreenViewState.Authorization()))
val
state
=
restoreStateObservable
val
state
=
restoreStateObservable
...
...
app/src/main/res/color/sign_in_button_selector.xml
View file @
f5ee4da1
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:state_enabled=
"false"
android:color=
"@color/colorAccent"
/>
<item
android:state_enabled=
"false"
android:color=
"@color/colorGray"
/>
<item
android:color=
"@color/colorGray"
/>
<item
android:color=
"@color/colorAccent"
/>
</selector>
</selector>
\ No newline at end of file
app/src/main/res/values/styles.xml
View file @
f5ee4da1
...
@@ -41,6 +41,7 @@
...
@@ -41,6 +41,7 @@
<style
name=
"Auth.ErrorText"
parent=
"TextAppearance.Design.Error"
>
<style
name=
"Auth.ErrorText"
parent=
"TextAppearance.Design.Error"
>
<item
name=
"android:textColor"
>
@color/colorError
</item>
<item
name=
"android:textColor"
>
@color/colorError
</item>
<item
name=
"android:textSize"
>
@dimen/lite_notice
</item>
</style>
</style>
<style
name=
"Auth.EditText"
parent=
"Widget.AppCompat.EditText"
>
<style
name=
"Auth.EditText"
parent=
"Widget.AppCompat.EditText"
>
...
@@ -151,6 +152,7 @@
...
@@ -151,6 +152,7 @@
<style
name=
"AuthButton.Enable"
>
<style
name=
"AuthButton.Enable"
>
<item
name=
"android:text"
>
"ВОЙТИ"
</item>
<item
name=
"android:text"
>
"ВОЙТИ"
</item>
<item
name=
"android:textColor"
>
@color/sign_in_button_selector
</item>
<item
name=
"strokeColor"
>
@color/sign_in_button_selector
</item>
<item
name=
"strokeColor"
>
@color/sign_in_button_selector
</item>
</style>
</style>
...
...
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