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
dc8882be
Commit
dc8882be
authored
Nov 18, 2019
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoring
parent
5d7e5a33
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
25 deletions
+12
-25
ScreenController.kt
...ual/roompark/presentation/screen/auth/ScreenController.kt
+11
-11
ScreenPresenter.kt
...sual/roompark/presentation/screen/auth/ScreenPresenter.kt
+0
-13
styles.xml
app/src/main/res/values/styles.xml
+1
-1
No files found.
app/src/main/java/com/biganto/visual/roompark/presentation/screen/auth/ScreenController.kt
View file @
dc8882be
...
...
@@ -63,24 +63,22 @@ class AuthScreenController :
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
?.
subscribe
{
pwdInput
.
isErrorEnabled
=
false
pwdInput
.
error
=
null
signInButton
.
isEnabled
=
true
}
)
}
@Inject
lateinit
var
bottomNavigation
:
IBottomNavigation
...
...
@@ -97,9 +95,6 @@ class AuthScreenController :
.
create
(
RoomParkApplication
.
component
,
activity
as
RoomParkMainActivity
)
.
inject
(
this
)
// @Inject
// lateinit var ac: RoomParkMainActivity
override
fun
render
(
viewState
:
AuthScreenViewState
)
{
super
.
render
(
viewState
)
Timber
.
d
(
"Render state $viewState"
)
...
...
@@ -115,7 +110,11 @@ class AuthScreenController :
}
private
fun
render
(
viewState
:
AuthScreenViewState
.
Idle
){
loginInput
.
isErrorEnabled
=
false
loginInput
.
error
=
null
pwdInput
.
isErrorEnabled
=
false
pwdInput
.
error
=
null
signInButton
.
isEnabled
=
true
}
private
fun
render
(
viewState
:
AuthScreenViewState
.
Authorization
){
...
...
@@ -154,9 +153,10 @@ class AuthScreenController :
}
private
fun
render
(
viewState
:
AuthScreenViewState
.
SomeError
)
=
private
fun
render
(
viewState
:
AuthScreenViewState
.
SomeError
)
{
showError
(
viewState
.
exception
)
signInButton
.
isEnabled
=
true
}
override
fun
getLayoutId
():
Int
=
R
.
layout
.
authentication_screen
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/auth/ScreenPresenter.kt
View file @
dc8882be
...
...
@@ -19,24 +19,11 @@ class AuthScreenPresenter @Inject constructor(
)
:
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
()
=
{
e
:
ExceptionString
->
AuthScreenViewState
.
SomeError
(
e
)}
override
fun
vsByCode
(
code
:
Int
):
(
ExceptionString
)
->
AuthScreenViewState
=
when
(
code
)
{
101
->
{
e
:
ExceptionString
->
AuthScreenViewState
.
SignInError
(
e
)}
111
->
{
e
:
ExceptionString
->
AuthScreenViewState
.
WrongLogin
(
e
)}
112
->
{
e
:
ExceptionString
->
AuthScreenViewState
.
WrongPassword
(
e
)}
else
->
{
e
:
ExceptionString
->
AuthScreenViewState
.
SomeError
(
e
)}
...
...
app/src/main/res/values/styles.xml
View file @
dc8882be
...
...
@@ -7,7 +7,7 @@
<item
name=
"colorPrimary"
>
@color/colorPrimary
</item>
<item
name=
"colorSecondary"
>
@color/colorAccent
</item>
<item
name=
"colorSecondaryVariant"
>
@color/colorAccentSecondary
</item>
<item
name=
"colorPrimaryDark"
>
@color/color
PrimaryDark
</item>
<item
name=
"colorPrimaryDark"
>
@color/color
AccentSecondary
</item>
<item
name=
"colorAccent"
>
@color/colorAccent
</item>
<item
name=
"materialCardViewStyle"
>
@style/Widget.Biganto.MaterialCardView
</item>
...
...
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