Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
elm
Element Android
Commits
4f7be057
Commit
4f7be057
authored
2 years ago
by
Onuray Sahin
Browse files
Options
Download
Email Patches
Plain Diff
Implement live location users bottom sheet with dummy data (waiting for other PRs for actual data).
parent
485d7e66
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
85 additions
and
5 deletions
+85
-5
vector/src/main/java/im/vector/app/features/location/LocationSharingActivity.kt
...m/vector/app/features/location/LocationSharingActivity.kt
+7
-0
vector/src/main/java/im/vector/app/features/location/live/map/bottomsheet/LiveLocationUsersBottomSheet.kt
...tion/live/map/bottomsheet/LiveLocationUsersBottomSheet.kt
+78
-5
No files found.
vector/src/main/java/im/vector/app/features/location/LocationSharingActivity.kt
View file @
4f7be057
...
...
@@ -23,7 +23,10 @@ import dagger.hilt.android.AndroidEntryPoint
import
im.vector.app.core.extensions.addFragment
import
im.vector.app.core.platform.VectorBaseActivity
import
im.vector.app.databinding.ActivityLocationSharingBinding
import
im.vector.app.features.home.AvatarRenderer
import
im.vector.app.features.location.live.map.bottomsheet.LiveLocationUsersBottomSheet
import
kotlinx.parcelize.Parcelize
import
javax.inject.Inject
@Parcelize
data class
LocationSharingArgs
(
...
...
@@ -36,6 +39,8 @@ data class LocationSharingArgs(
@AndroidEntryPoint
class
LocationSharingActivity
:
VectorBaseActivity
<
ActivityLocationSharingBinding
>()
{
@Inject
lateinit
var
avatarRenderer
:
AvatarRenderer
override
fun
getBinding
()
=
ActivityLocationSharingBinding
.
inflate
(
layoutInflater
)
override
fun
initUiAndData
()
{
...
...
@@ -66,6 +71,8 @@ class LocationSharingActivity : VectorBaseActivity<ActivityLocationSharingBindin
}
}
}
LiveLocationUsersBottomSheet
(
avatarRenderer
).
show
(
supportFragmentManager
,
"LiveLocationUsersBottomSheet"
)
}
companion
object
{
...
...
This diff is collapsed.
Click to expand it.
vector/src/main/java/im/vector/app/features/location/live/map/bottomsheet/LiveLocationUsersBottomSheet.kt
View file @
4f7be057
...
...
@@ -16,14 +16,87 @@
package
im.vector.app.features.location.live.map.bottomsheet
import
com.airbnb.epoxy.TypedEpoxyController
import
javax.inject.Inject
import
android.content.res.ColorStateList
import
android.content.res.Resources
import
android.graphics.Color
import
android.graphics.PorterDuff
import
android.os.Bundle
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
import
com.airbnb.epoxy.SimpleEpoxyController
import
com.google.android.material.bottomsheet.BottomSheetBehavior
import
im.vector.app.core.epoxy.BottomSheetDividerItem_
import
im.vector.app.core.extensions.configureWith
import
im.vector.app.core.platform.VectorBaseBottomSheetDialogFragment
import
im.vector.app.core.utils.DimensionConverter
import
im.vector.app.databinding.BottomSheetLiveLocationUsersBinding
import
im.vector.app.features.home.AvatarRenderer
import
org.matrix.android.sdk.api.util.MatrixItem
class
LiveLocationUsersBottomSheet
@Inject
constructor
(
class
LiveLocationUsersBottomSheet
(
private
var
avatarRenderer
:
AvatarRenderer
)
:
VectorBaseBottomSheetDialogFragment
<
BottomSheetLiveLocationUsersBinding
>()
{
)
:
TypedEpoxyController
<
LiveLocationUsersBottomSheetViewState
>()
{
private
var
bottomSheetBehavior
:
BottomSheetBehavior
<
View
>?
=
null
private
val
controller
=
SimpleEpoxyController
()
override
fun
buildModels
(
data
:
LiveLocationUsersBottomSheetViewState
?)
{
override
fun
onViewCreated
(
view
:
View
,
savedInstanceState
:
Bundle
?)
{
super
.
onViewCreated
(
view
,
savedInstanceState
)
val
layoutParams
=
view
.
layoutParams
layoutParams
.
height
=
Resources
.
getSystem
().
displayMetrics
.
heightPixels
view
.
layoutParams
=
layoutParams
view
.
requestLayout
()
views
.
bottomSheetRecyclerView
.
configureWith
(
controller
,
hasFixedSize
=
false
)
val
models
=
dummyData
.
mapIndexed
{
index
,
item
->
listOf
(
LiveLocationUserItem_
().
apply
{
id
(
index
)
matrixItem
(
item
)
avatarRenderer
(
this
@LiveLocationUsersBottomSheet
.
avatarRenderer
)
remainingTime
(
"9min left"
)
lastUpdatedAt
(
"Updated 2min ago"
)
showStopSharingButton
(
index
==
1
)
},
BottomSheetDividerItem_
().
apply
{
id
(
"divider_$index"
)
}
)
}
controller
.
setModels
(
models
.
flatten
())
}
override
fun
onStart
()
{
super
.
onStart
()
val
bottomSheet
=
(
view
?.
parent
as
View
)
bottomSheet
.
backgroundTintMode
=
PorterDuff
.
Mode
.
CLEAR
bottomSheet
.
backgroundTintList
=
ColorStateList
.
valueOf
(
Color
.
TRANSPARENT
)
bottomSheet
.
setBackgroundColor
(
Color
.
TRANSPARENT
)
bottomSheetBehavior
=
BottomSheetBehavior
.
from
(
view
?.
parent
as
View
)
bottomSheetBehavior
?.
setPeekHeight
(
DimensionConverter
(
resources
).
dpToPx
(
200
),
false
)
}
override
fun
getBinding
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
?):
BottomSheetLiveLocationUsersBinding
{
return
BottomSheetLiveLocationUsersBinding
.
inflate
(
inflater
,
container
,
false
)
}
companion
object
{
// Waiting for other PR to be merged
private
val
dummyData
=
mutableListOf
<
MatrixItem
>().
apply
{
repeat
(
5
)
{
add
(
MatrixItem
.
UserItem
(
"@test_$it:matrix.org"
,
"Test_$it"
,
"https://matrix-client.matrix.org/_matrix/media/r0/download/matrix.org/vQMHeiAfRxrEENOFnIMccZoI"
)
)
}
}
}
}
This diff is collapsed.
Click to expand it.
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