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
3ba27c4e
Commit
3ba27c4e
authored
Sep 30, 2019
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve mvi behaviour
parent
aabbca59
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
25 deletions
+15
-25
.gitignore
.gitignore
+1
-0
bogdashkin.xml
.idea/dictionaries/bogdashkin.xml
+1
-0
BigantoBaseController.kt
...iganto/visual/roompark/conductor/BigantoBaseController.kt
+13
-25
No files found.
.gitignore
View file @
3ba27c4e
*.iml
.gradle
/local.properties
/.idea
/.idea/caches
/.idea/libraries
/.idea/modules.xml
...
...
.idea/dictionaries/bogdashkin.xml
View file @
3ba27c4e
...
...
@@ -2,6 +2,7 @@
<dictionary
name=
"bogdashkin"
>
<words>
<w>
Biganto
</w>
<w>
snackbar
</w>
</words>
</dictionary>
</component>
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/conductor/BigantoBaseController.kt
View file @
3ba27c4e
...
...
@@ -9,18 +9,22 @@ import android.view.inputmethod.InputMethodManager
import
android.widget.Toast
import
androidx.annotation.LayoutRes
import
androidx.annotation.StringRes
import
androidx.appcompat.app.ActionBar
import
androidx.appcompat.app.AppCompatActivity
import
butterknife.ButterKnife
import
com.biganto.visual.roompark.R
import
com.biganto.visual.roompark.base.ICollapsingToolBar
import
com.biganto.visual.roompark.base.RoomParkMainActivity
import
com.biganto.visual.roompark.conductor.mosby.mvi.BigantoMviController
import
com.biganto.visual.roompark.di.dagger.PerScreen
import
com.biganto.visual.roompark.view_utils.snackbar.ISnackBarProvider
import
com.hannesdorfmann.mosby3.mvi.MviBasePresenter
import
io.reactivex.disposables.CompositeDisposable
import
javax.inject.Inject
/**
* Created by Vladislav Bogdashkin on 28.05.2018.
*/
@PerScreen
abstract
class
BigantoBaseController
<
VS
:
BigantoBaseViewState
,
V
:
BigantoBaseContract
<
VS
>,
P
:
MviBasePresenter
<
V
,
VS
>>
:
BigantoMviController
<
V
,
P
>
{
...
...
@@ -38,22 +42,12 @@ abstract class BigantoBaseController<VS : BigantoBaseViewState,V: BigantoBaseCon
@StringRes
protected
abstract
fun
getToolbarTitleId
():
Int
protected
abstract
fun
showBottomAppBar
():
Boolean
// protected lateinit var toolBars:TopBottomActionBarsSupported
protected
lateinit
var
snackbar
:
ISnackBarProvider
private
fun
setToolbarTitle
()
{
// if the Activity happens to be non-AppCompatActivity or it does not have ActionBar, simply do not set the title
(
activity
as
?
AppCompatActivity
)
?.
supportActionBar
?.
apply
{
title
=
resources
?.
getString
(
getToolbarTitleId
())
setDisplayHomeAsUpEnabled
(
router
.
backstackSize
>
1
)
}
}
@Inject
private
lateinit
var
roomParkActivity
:
RoomParkMainActivity
//TODO(injection)
pr
ivate
fun
bottomToolbar
()
:
ActionBar
?=(
activity
as
?
AppCompatActivity
)
?.
supportActionBa
r
protected
val
toolBar
:
ICollapsingToolBar
=
roomParkActivity
pr
otected
val
snackbar
:
ISnackBarProvider
=
roomParkActivity
.
snackbarProvide
r
override
fun
onDetach
(
view
:
View
)
{
detachDisposable
.
clear
()
...
...
@@ -64,19 +58,13 @@ abstract class BigantoBaseController<VS : BigantoBaseViewState,V: BigantoBaseCon
val
view
=
inflater
.
inflate
(
getLayoutId
(),
container
,
false
)
// instantiate the view
ButterKnife
.
bind
(
this
,
view
)
// toolBars=(activity as TopBottomActionBarsSupported)
snackbar
=
activity
as
ISnackBarProvider
//TODO(remove duplicated code:)
if
(
showBottomAppBar
())
bottomToolbar
()
?.
show
()
if
(!
showBottomAppBar
())
bottomToolbar
()
?.
hide
()
return
view
}
protected
fun
View
.
hideKeyboard
()
{
val
inputMethodManager
=
applicationContext
?.
getSystemService
(
Context
.
INPUT_METHOD_SERVICE
)
as
InputMethodManager
val
inputMethodManager
=
applicationContext
?.
getSystemService
(
Context
.
INPUT_METHOD_SERVICE
)
as
InputMethodManager
inputMethodManager
.
hideSoftInputFromWindow
(
this
.
windowToken
,
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