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
423dc854
Commit
423dc854
authored
Nov 15, 2019
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
need to resolve insets issue (status bar? )
parent
3dfee915
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
43 additions
and
40 deletions
+43
-40
UserHolder.kt
...java/com/biganto/visual/roompark/data/local/UserHolder.kt
+6
-2
ContextModule.kt
...va/com/biganto/visual/roompark/di/dagger/ContextModule.kt
+2
-1
authUseCase.kt
...om/biganto/visual/roompark/domain/use_case/authUseCase.kt
+0
-3
HomeBottomNavigationController.kt
...creen/home/home_routing/HomeBottomNavigationController.kt
+18
-22
ScreenController.kt
...l/roompark/presentation/screen/splash/ScreenController.kt
+2
-2
ScreenPresenter.kt
...al/roompark/presentation/screen/splash/ScreenPresenter.kt
+6
-0
activity_main.xml
app/src/main/res/layout/activity_main.xml
+9
-10
No files found.
app/src/main/java/com/biganto/visual/roompark/data/local/UserHolder.kt
View file @
423dc854
package
com.biganto.visual.roompark.data.local
package
com.biganto.visual.roompark.data.local
import
android.content.Context
import
android.content.Context
import
com.afollestad.rxkprefs.Pref
import
com.afollestad.rxkprefs.rxkPrefs
import
com.afollestad.rxkprefs.rxkPrefs
import
com.biganto.visual.androidplayer.data.repository.local.ILocalStore
import
com.biganto.visual.androidplayer.data.repository.local.ILocalStore
import
dagger.Binds
import
dagger.Binds
...
@@ -28,6 +29,8 @@ class UserHolder @Inject constructor(val context : Context) : ILocalStore
...
@@ -28,6 +29,8 @@ class UserHolder @Inject constructor(val context : Context) : ILocalStore
}
}
private
val
prefs
=
rxkPrefs
(
context
)
private
val
prefs
=
rxkPrefs
(
context
)
private
val
userSession
:
Pref
<
String
>
=
prefs
.
string
(
RECENT_UUID_KEY
,
EMPTY_PREF_VALUE_KEY
)
companion
object
{
companion
object
{
const
val
RECENT_UUID_KEY
=
"com.biganto.visual.androidplayer.LAST_USER_UUD"
const
val
RECENT_UUID_KEY
=
"com.biganto.visual.androidplayer.LAST_USER_UUD"
const
val
EMPTY_PREF_VALUE_KEY
=
"NO_ACTIVE_SESSION"
const
val
EMPTY_PREF_VALUE_KEY
=
"NO_ACTIVE_SESSION"
...
@@ -46,15 +49,16 @@ class UserHolder @Inject constructor(val context : Context) : ILocalStore
...
@@ -46,15 +49,16 @@ class UserHolder @Inject constructor(val context : Context) : ILocalStore
.
observe
()
.
observe
()
override
fun
recentUser
():
Observable
<
in
UserState
>
=
override
fun
recentUser
():
Observable
<
in
UserState
>
=
prefs
.
string
(
RECENT_UUID_KEY
,
EMPTY_PREF_VALUE_KEY
)
userSession
.
observe
()
.
observe
()
.
map
{
.
map
{
Timber
.
d
(
" AUTH VALUE: $it"
)
if
(
it
==
EMPTY_PREF_VALUE_KEY
)
return
@map
UserState
.
NotAuthenticated
()
if
(
it
==
EMPTY_PREF_VALUE_KEY
)
return
@map
UserState
.
NotAuthenticated
()
else
return
@map
UserState
.
Authenticated
(
it
)
else
return
@map
UserState
.
Authenticated
(
it
)
}
}
override
fun
setRecentUser
(
uuid
:
String
?)
=
override
fun
setRecentUser
(
uuid
:
String
?)
=
Completable
.
from
Observable
(
prefs
.
string
(
RECENT_UUID_KEY
,
uuid
?:
EMPTY_PREF_VALUE_KEY
).
observe
())
Completable
.
from
Callable
{
userSession
.
set
(
uuid
?:
EMPTY_PREF_VALUE_KEY
)}
}
}
sealed
class
UserState
{
sealed
class
UserState
{
...
...
app/src/main/java/com/biganto/visual/roompark/di/dagger/ContextModule.kt
View file @
423dc854
...
@@ -59,7 +59,8 @@ class AuthContractModule @Inject constructor(
...
@@ -59,7 +59,8 @@ class AuthContractModule @Inject constructor(
api
.
authenticate
(
email
,
password
)
api
.
authenticate
(
email
,
password
)
.
map
(
::
fromRaw
)
.
map
(
::
fromRaw
)
.
flatMap
{
db
.
upsertUser
(
it
)
}
.
flatMap
{
db
.
upsertUser
(
it
)
}
.
doOnNext
{
local
.
setRecentUser
(
it
.
uuid
.
toString
())
}
.
doOnNext
{
Timber
.
d
(
"user id: ${it.uuid}"
)}
.
doOnNext
{
local
.
setRecentUser
(
it
.
uuid
.
toString
()).
blockingAwait
()
}
.
map
(
::
fromEntity
)
.
map
(
::
fromEntity
)
override
fun
validateAuthState
():
Observable
<
Boolean
>
=
local
.
recentUser
()
override
fun
validateAuthState
():
Observable
<
Boolean
>
=
local
.
recentUser
()
...
...
app/src/main/java/com/biganto/visual/roompark/domain/use_case/authUseCase.kt
View file @
423dc854
...
@@ -10,11 +10,8 @@ import javax.inject.Inject
...
@@ -10,11 +10,8 @@ import javax.inject.Inject
class
AuthUseCase
@Inject
constructor
(
class
AuthUseCase
@Inject
constructor
(
private
val
authContract
:
AuthContract
private
val
authContract
:
AuthContract
){
){
fun
validateAuth
()
=
authContract
.
validateAuthState
()
fun
validateAuth
()
=
authContract
.
validateAuthState
()
fun
signIn
(
login
:
String
,
pwd
:
String
)
=
authContract
.
signIn
(
login
,
pwd
)
fun
signIn
(
login
:
String
,
pwd
:
String
)
=
authContract
.
signIn
(
login
,
pwd
)
}
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/presentation/screen/home/home_routing/HomeBottomNavigationController.kt
View file @
423dc854
package
com.biganto.visual.roompark.presentation.screen.home.home_routing
package
com.biganto.visual.roompark.presentation.screen.home.home_routing
import
android.os.Bundle
import
android.os.Bundle
import
android.util.Log
import
android.view.View
import
android.view.View
import
androidx.annotation.IdRes
import
androidx.annotation.IdRes
import
androidx.annotation.NonNull
import
androidx.annotation.NonNull
...
@@ -43,7 +42,7 @@ class HomeBottomNavigationController(@IdRes toPage: Int = R.id.tab_feeds)
...
@@ -43,7 +42,7 @@ class HomeBottomNavigationController(@IdRes toPage: Int = R.id.tab_feeds)
}
}
override
fun
getStartupMenuId
():
Int
=
override
fun
getStartupMenuId
():
Int
=
args
.
getInt
(
OPEN_CHILD_CONTROLLER_KEY
,
R
.
id
.
tab_feeds
)
args
.
getInt
(
OPEN_CHILD_CONTROLLER_KEY
,
R
.
id
.
tab_feeds
)
@Inject
@Inject
...
@@ -56,40 +55,34 @@ class HomeBottomNavigationController(@IdRes toPage: Int = R.id.tab_feeds)
...
@@ -56,40 +55,34 @@ class HomeBottomNavigationController(@IdRes toPage: Int = R.id.tab_feeds)
override
lateinit
var
injectedPresenter
:
HomeScreenPresenter
override
lateinit
var
injectedPresenter
:
HomeScreenPresenter
fun
getComponent
()
=
DaggerHomeScreenComponent
fun
getComponent
()
=
DaggerHomeScreenComponent
.
factory
()
.
factory
()
.
create
(
RoomParkApplication
.
component
,
activity
as
RoomParkMainActivity
)
.
create
(
RoomParkApplication
.
component
,
activity
as
RoomParkMainActivity
)
.
inject
(
this
)
.
inject
(
this
)
override
fun
render
(
viewState
:
HomeScreenViewState
)
{
override
fun
render
(
viewState
:
HomeScreenViewState
)
{
when
(
viewState
)
{
when
(
viewState
)
{
is
HomeScreenViewState
.
Idle
->
render
(
viewState
)
is
HomeScreenViewState
.
Idle
->
render
(
viewState
)
is
HomeScreenViewState
.
ToScreen
->
render
(
viewState
)
is
HomeScreenViewState
.
ToScreen
->
render
(
viewState
)
is
HomeScreenViewState
.
SomeError
->
render
(
viewState
)
is
HomeScreenViewState
.
SomeError
->
render
(
viewState
)
}
}
}
}
private
fun
render
(
viewState
:
HomeScreenViewState
.
Idle
){
private
fun
render
(
viewState
:
HomeScreenViewState
.
Idle
)
{
}
}
private
fun
render
(
viewState
:
HomeScreenViewState
.
SomeError
)
=
private
fun
render
(
viewState
:
HomeScreenViewState
.
SomeError
)
=
showError
(
viewState
.
exception
)
showError
(
viewState
.
exception
)
private
fun
render
(
viewState
:
HomeScreenViewState
.
ToScreen
){
private
fun
render
(
viewState
:
HomeScreenViewState
.
ToScreen
)
{
// snacky.showSnackBar("lul")
// snacky.showSnackBar("lul")
}
}
override
fun
getLayoutId
()
=
R
.
layout
.
tab_routing_screen_view
override
fun
getLayoutId
()
=
R
.
layout
.
tab_routing_screen_view
override
val
tag
:
String
override
val
tag
:
String
...
@@ -100,7 +93,8 @@ class HomeBottomNavigationController(@IdRes toPage: Int = R.id.tab_feeds)
...
@@ -100,7 +93,8 @@ class HomeBottomNavigationController(@IdRes toPage: Int = R.id.tab_feeds)
bottomNavigation
.
show
()
bottomNavigation
.
show
()
Timber
.
d
(
" onViewBound: ${this::class}"
)
Timber
.
d
(
" onViewBound: ${this::class}"
)
bottomNavigationView
=
((
activity
as
RoomParkMainActivity
)
as
IBottomNavigation
).
bottomNavigation
bottomNavigationView
=
((
activity
as
RoomParkMainActivity
)
as
IBottomNavigation
).
bottomNavigation
bottomNavigationView
.
visibility
=
BottomNavigationView
.
VISIBLE
bottomNavigationView
.
visibility
=
BottomNavigationView
.
VISIBLE
controllerContainer
=
view
.
findViewById
(
R
.
id
.
tabContainer
)
controllerContainer
=
view
.
findViewById
(
R
.
id
.
tabContainer
)
bottomNavigationView
.
setOnNavigationItemSelectedListener
{
item
->
bottomNavigationView
.
setOnNavigationItemSelectedListener
{
item
->
...
@@ -146,19 +140,21 @@ class HomeBottomNavigationController(@IdRes toPage: Int = R.id.tab_feeds)
...
@@ -146,19 +140,21 @@ class HomeBottomNavigationController(@IdRes toPage: Int = R.id.tab_feeds)
val
childRouter
=
getChildRouter
(
currentlySelectedItemId
)
val
childRouter
=
getChildRouter
(
currentlySelectedItemId
)
Timber
.
d
(
"in back stack - ${childRouter?.backstackSize}"
)
Timber
.
d
(
"in back stack - ${childRouter?.backstackSize}"
)
if
(
childRouter
!=
null
)
{
if
(
childRouter
!=
null
)
{
val
backStackSizeCondition
=
childRouter
.
backstackSize
<
0
val
backStackResult
=
childRouter
.
handleBack
()
if
(
childRouter
.
backstackSize
<
2
)
return
false
if
(
backStackResult
&&
backStackSizeCondition
if
(
childRouter
.
handleBack
())
)
navigateTo
(
getControllerFor
(
R
.
id
.
tab_feeds
),
false
)
navigateTo
(
getControllerFor
(
R
.
id
.
tab_feeds
),
false
)
return
backStackResult
return
true
}
else
{
}
else
{
Log
.
e
(
TAG
,
"handleBack called with getChildRouter(currentlySelectedItemId) == null."
,
Timber
.
e
(
IllegalStateException
(
IllegalStateException
(
"handleBack called with getChildRouter(currentlySelectedItemId) == null."
))
"handleBack called with getChildRouter(currentlySelectedItemId) == null."
),
"handleBack called with getChildRouter(currentlySelectedItemId) == null."
)
}
}
return
false
return
false
}
}
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/splash/ScreenController.kt
View file @
423dc854
...
@@ -72,8 +72,8 @@ class SplashScreenController :
...
@@ -72,8 +72,8 @@ class SplashScreenController :
private
fun
render
(
viewState
:
SplashScreenViewState
.
ToHomeScreen
){
private
fun
render
(
viewState
:
SplashScreenViewState
.
ToHomeScreen
){
router
.
setRoot
(
RouterTransaction
.
with
(
HomeBottomNavigationController
())
router
.
setRoot
(
RouterTransaction
.
with
(
HomeBottomNavigationController
())
.
popChangeHandler
(
FadeChangeHandler
())
.
popChangeHandler
(
FadeChangeHandler
(
200L
))
.
pushChangeHandler
(
FadeChangeHandler
())
.
pushChangeHandler
(
FadeChangeHandler
(
300L
))
)
)
}
}
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/splash/ScreenPresenter.kt
View file @
423dc854
...
@@ -4,6 +4,9 @@ import com.biganto.visual.roompark.base.RoomParkMainActivity
...
@@ -4,6 +4,9 @@ import com.biganto.visual.roompark.base.RoomParkMainActivity
import
com.biganto.visual.roompark.conductor.BigantoBasePresenter
import
com.biganto.visual.roompark.conductor.BigantoBasePresenter
import
com.biganto.visual.roompark.domain.interactor.SplashInteractor
import
com.biganto.visual.roompark.domain.interactor.SplashInteractor
import
com.biganto.visual.roompark.util.monades.ExceptionString
import
com.biganto.visual.roompark.util.monades.ExceptionString
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.schedulers.Schedulers
import
java.util.concurrent.TimeUnit
import
javax.inject.Inject
import
javax.inject.Inject
/**
/**
...
@@ -29,7 +32,10 @@ class SplashScreenPresenter @Inject constructor(
...
@@ -29,7 +32,10 @@ class SplashScreenPresenter @Inject constructor(
if
(
it
)
SplashScreenViewState
.
ToHomeScreen
()
if
(
it
)
SplashScreenViewState
.
ToHomeScreen
()
else
SplashScreenViewState
.
ToAuthScreen
()
else
SplashScreenViewState
.
ToAuthScreen
()
}
}
.
delay
(
250
,
TimeUnit
.
MILLISECONDS
)
)
)
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
subscribeViewState
(
state
.
cast
(
SplashScreenViewState
::
class
.
java
),
SplashScreen
::
render
)
subscribeViewState
(
state
.
cast
(
SplashScreenViewState
::
class
.
java
),
SplashScreen
::
render
)
}
}
...
...
app/src/main/res/layout/activity_main.xml
View file @
423dc854
...
@@ -5,7 +5,6 @@
...
@@ -5,7 +5,6 @@
android:id=
"@+id/bottom_drawer_menu"
android:id=
"@+id/bottom_drawer_menu"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
android:fitsSystemWindows=
"true"
tools:context=
".base.RoomParkMainActivity"
>
tools:context=
".base.RoomParkMainActivity"
>
...
@@ -24,11 +23,11 @@
...
@@ -24,11 +23,11 @@
android:clipToPadding=
"true"
android:clipToPadding=
"true"
android:theme=
"@style/ThemeOverlay.AppCompat.Light"
android:theme=
"@style/ThemeOverlay.AppCompat.Light"
app:expanded=
"false"
app:expanded=
"false"
app:liftOnScroll=
"true"
app:layout_behavior=
".util.view_utils.app_bar.DragControlAppBarLayoutBehaviour"
app:layout_behavior=
".util.view_utils.app_bar.DragControlAppBarLayoutBehaviour"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:liftOnScroll=
"true"
tools:visibility=
"visible"
>
tools:visibility=
"visible"
>
<com.google.android.material.appbar.CollapsingToolbarLayout
<com.google.android.material.appbar.CollapsingToolbarLayout
...
@@ -47,9 +46,9 @@
...
@@ -47,9 +46,9 @@
android:layout_height=
"?android:attr/actionBarSize"
android:layout_height=
"?android:attr/actionBarSize"
android:visibility=
"invisible"
android:visibility=
"invisible"
app:layout_collapseMode=
"pin"
app:layout_collapseMode=
"pin"
app:titleTextAppearance=
"@style/Header_TextView.Main_Header"
app:popupTheme=
"@style/ThemeOverlay.AppCompat.Light"
app:popupTheme=
"@style/ThemeOverlay.AppCompat.Light"
app:showAsAction=
"always"
app:showAsAction=
"always"
app:titleTextAppearance=
"@style/Header_TextView.Main_Header"
tools:visibility=
"invisible"
>
tools:visibility=
"invisible"
>
</androidx.appcompat.widget.Toolbar>
</androidx.appcompat.widget.Toolbar>
...
@@ -62,7 +61,7 @@
...
@@ -62,7 +61,7 @@
android:id=
"@+id/conductor_container"
android:id=
"@+id/conductor_container"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
app:layout_behavior=
"com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"
>
app:layout_behavior=
"com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"
>
<include
<include
layout=
"@layout/test_progress_status"
layout=
"@layout/test_progress_status"
...
@@ -71,12 +70,12 @@
...
@@ -71,12 +70,12 @@
</FrameLayout>
</FrameLayout>
<!-- <com.bluelinelabs.conductor.ChangeHandlerFrameLayout-->
<!-- <com.bluelinelabs.conductor.ChangeHandlerFrameLayout-->
<!-- android:id="@+id/conductor_container"-->
<!-- android:id="@+id/conductor_container"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:background="@color/colorBackground"-->
<!-- android:background="@color/colorBackground"-->
<!-- app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior" />-->
<!-- app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior" />-->
<!--</android.support.constraint.ConstraintLayout>-->
<!--</android.support.constraint.ConstraintLayout>-->
...
...
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