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
c4e3681f
Commit
c4e3681f
authored
Oct 22, 2019
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
view events attached
parent
6d79e26b
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
97 additions
and
9 deletions
+97
-9
find_flat.kt
...om/biganto/visual/roompark/domain/interactor/find_flat.kt
+17
-0
tour.kt
...ain/java/com/biganto/visual/roompark/domain/model/tour.kt
+10
-0
ScreenContract.kt
...al/roompark/presentation/screen/to_flat/ScreenContract.kt
+4
-0
ScreenController.kt
.../roompark/presentation/screen/to_flat/ScreenController.kt
+35
-3
ScreenPresenter.kt
...l/roompark/presentation/screen/to_flat/ScreenPresenter.kt
+20
-2
ScreenViewState.kt
...l/roompark/presentation/screen/to_flat/ScreenViewState.kt
+5
-0
find_flat_screen.xml
app/src/main/res/layout/find_flat_screen.xml
+6
-4
No files found.
app/src/main/java/com/biganto/visual/roompark/domain/interactor/find_flat.kt
View file @
c4e3681f
package
com.biganto.visual.roompark.domain.interactor
import
com.biganto.visual.roompark.domain.model.TourModel
import
com.biganto.visual.roompark.domain.model.TourRequestModel
import
com.biganto.visual.roompark.domain.model.TourResponse
import
io.reactivex.Observable
import
javax.inject.Inject
/**
...
...
@@ -8,4 +12,17 @@ import javax.inject.Inject
class
FindFlatInteractor
@Inject
constructor
(
){
fun
getFlat
(
requaest
:
TourRequestModel
):
Observable
<
TourResponse
>
=
Observable
.
just
(
tourResponseMock
)
companion
object
{
val
tourResponseMock
=
TourResponse
(
arrayListOf
(
TourModel
(
"125"
,
"Tour s otdelkoj"
,
null
),
TourModel
(
"126"
,
"Tour bez otdelki"
,
null
)
)
)
}
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/domain/model/tour.kt
0 → 100644
View file @
c4e3681f
package
com.biganto.visual.roompark.domain.model
/**
* Created by Vladislav Bogdashkin on 22.10.2019.
*/
data class
TourRequestModel
(
val
building
:
Int
,
val
flat
:
String
)
data class
TourResponse
(
val
response
:
List
<
TourModel
>)
data class
TourModel
(
val
tourId
:
String
,
val
title
:
String
,
val
preview
:
String
?)
app/src/main/java/com/biganto/visual/roompark/presentation/screen/to_flat/ScreenContract.kt
View file @
c4e3681f
package
com.biganto.visual.roompark.presentation.screen.to_flat
import
com.biganto.visual.roompark.conductor.BigantoBaseContract
import
com.biganto.visual.roompark.domain.model.TourRequestModel
import
io.reactivex.Observable
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
*/
interface
FindFlatScreen
:
BigantoBaseContract
<
FindFlatScreenViewState
>
{
fun
getFlat
()
:
Observable
<
TourRequestModel
>
fun
startTour
()
:
Observable
<
String
>
}
app/src/main/java/com/biganto/visual/roompark/presentation/screen/to_flat/ScreenController.kt
View file @
c4e3681f
package
com.biganto.visual.roompark.presentation.screen.to_flat
import
android.view.KeyEvent
import
android.view.View
import
android.widget.EditText
import
android.widget.TextView
import
butterknife.BindView
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.biganto.visual.roompark.domain.model.TourRequestModel
import
com.biganto.visual.roompark.presentation.screen.feeds.EstateTabModel
import
com.google.android.material.button.MaterialButton
import
com.google.android.material.tabs.TabLayout
import
com.google.android.material.textfield.TextInputLayout
import
com.jakewharton.rxbinding3.view.keys
import
io.reactivex.Observable
import
timber.log.Timber
import
javax.inject.Inject
...
...
@@ -22,12 +29,36 @@ class FindFlatScreenController :
,
FindFlatScreenPresenter
>()
,
FindFlatScreen
{
override
fun
getFlat
():
Observable
<
TourRequestModel
>
=
flatNumberEditor
.
keys
{
it
.
keyCode
==
KeyEvent
.
KEYCODE_ENTER
}
.
doOnNext
{
flatNumberEditor
.
hideKeyboard
()
}
.
doOnNext
{
Timber
.
d
(
" key code is : ${it.keyCode}"
)}
.
doOnNext
{
Timber
.
d
(
" KeyEvent.FLAG_EDITOR_ACTION : ${KeyEvent.FLAG_EDITOR_ACTION}"
)}
.
map
{
TourRequestModel
(
estateTabs
[
flatTabs
.
selectedTabPosition
].
building
,
flatNumberInput
.
editText
?.
text
.
toString
()
)
}
override
fun
startTour
():
Observable
<
String
>
=
Observable
.
just
(
"1"
)
override
fun
injectDependencies
()
{
getComponent
()
}
@BindView
(
R
.
id
.
flat_estate_tabs
)
lateinit
var
feedsTabs
:
TabLayout
lateinit
var
flatTabs
:
TabLayout
@BindView
(
R
.
id
.
flatNumberInputer
)
lateinit
var
flatNumberInput
:
TextInputLayout
@BindView
(
R
.
id
.
flatNumberEditText
)
lateinit
var
flatNumberEditor
:
EditText
@BindView
(
R
.
id
.
findFlatButton
)
lateinit
var
fubdFlatButton
:
MaterialButton
@Inject
override
lateinit
var
injectedPresenter
:
FindFlatScreenPresenter
...
...
@@ -40,7 +71,7 @@ class FindFlatScreenController :
override
fun
onViewBound
(
v
:
View
)
{
estateTabs
.
forEach
{
estate
->
val
tab
=
f
eeds
Tabs
.
newTab
()
val
tab
=
f
lat
Tabs
.
newTab
()
.
setCustomView
(
R
.
layout
.
to_flat_tab_view
)
tab
.
customView
?.
let
{
...
...
@@ -50,7 +81,8 @@ class FindFlatScreenController :
if
(
estateTabs
.
indexOf
(
estate
)
==
estateTabs
.
size
-
1
)
View
.
GONE
else
View
.
VISIBLE
}
feedsTabs
.
addTab
(
tab
)
flatTabs
.
addTab
(
tab
)
}
}
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/to_flat/ScreenPresenter.kt
View file @
c4e3681f
...
...
@@ -2,6 +2,7 @@ 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.Observable
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.schedulers.Schedulers
import
timber.log.Timber
...
...
@@ -20,12 +21,29 @@ class FindFlatScreenPresenter @Inject constructor(
override
fun
bindIntents
()
{
val
startTourIntent
=
intent
(
FindFlatScreen
::
startTour
)
.
map
{
FindFlatScreenViewState
.
StartTour
(
it
)
}
val
getFlatIntent
=
intent
(
FindFlatScreen
::
getFlat
)
.
doOnNext
{
Timber
.
d
(
" flat is $it"
)}
.
flatMap
{
request
->
interactor
.
getFlat
(
request
)
.
map
{
if
(
it
.
response
.
isNullOrEmpty
())
FindFlatScreenViewState
.
FlatNotFound
()
else
FindFlatScreenViewState
.
TourFounded
(
it
.
response
)
}
.
onErrorReturn
{
Timber
.
e
(
it
);
FindFlatScreenViewState
.
RequstFlatProgress
()
}
}
.
startWith
(
Observable
.
just
(
FindFlatScreenViewState
.
RequstFlatProgress
()))
val
state
=
restoreStateObservable
.
doOnError
{
Timber
.
e
(
it
)}
.
mergeWith
(
getFlatIntent
)
.
mergeWith
(
startTourIntent
)
.
doOnError
{
Timber
.
e
(
it
)
}
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
subscribeViewState
(
state
.
cast
(
FindFlatScreenViewState
::
class
.
java
),
FindFlatScreen
::
render
)
}
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/presentation/screen/to_flat/ScreenViewState.kt
View file @
c4e3681f
package
com.biganto.visual.roompark.presentation.screen.to_flat
import
com.biganto.visual.roompark.conductor.BigantoBaseViewState
import
com.biganto.visual.roompark.domain.model.TourModel
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
...
...
@@ -9,4 +10,8 @@ import com.biganto.visual.roompark.conductor.BigantoBaseViewState
sealed
class
FindFlatScreenViewState
:
BigantoBaseViewState
()
{
class
Idle
:
FindFlatScreenViewState
()
class
RequstFlatProgress
:
FindFlatScreenViewState
()
class
TourFounded
(
val
items
:
List
<
TourModel
>)
:
FindFlatScreenViewState
()
class
StartTour
(
val
tourId
:
String
)
:
FindFlatScreenViewState
()
class
FlatNotFound
()
:
FindFlatScreenViewState
()
}
\ No newline at end of file
app/src/main/res/layout/find_flat_screen.xml
View file @
c4e3681f
...
...
@@ -19,17 +19,18 @@
<com.google.android.material.textfield.TextInputLayout
style=
"@style/SelectFlatInputLayout
"
android:id=
"@+id/flatNumberInputer
"
android:colorControlActivated=
"@color/colorAccen
t"
style=
"@style/SelectFlatInputLayou
t"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"16dp"
android:layout_marginTop=
"16dp"
android:layout_marginEnd=
"16dp"
>
android:layout_marginEnd=
"16dp"
android:colorControlActivated=
"@color/colorAccent"
>
<com.google.android.material.textfield.TextInputEditText
android:id=
"@+id/flatNumberEditText"
style=
"@style/ToFlat.EditText"
android:layout_width=
"match_parent"
...
...
@@ -41,6 +42,7 @@
<com.google.android.material.button.MaterialButton
android:id=
"@+id/findFlatButton"
style=
"@style/AuthButton.Enable"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
...
...
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