Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AloqaIM-Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Administrator
AloqaIM-Android
Commits
c2b06839
Commit
c2b06839
authored
Mar 02, 2018
by
Filipe de Lima Brito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix transparency on member details view.
In fact, now we are using modal bottom sheet.
parent
c68e38f8
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
121 additions
and
29 deletions
+121
-29
MemberBottomSheetFragment.kt
...hat/rocket/android/member/ui/MemberBottomSheetFragment.kt
+80
-0
MembersFragmentModule.kt
...a/chat/rocket/android/members/di/MembersFragmentModule.kt
+5
-0
MembersNavigator.kt
...t/rocket/android/members/presentation/MembersNavigator.kt
+14
-0
MembersPresenter.kt
...t/rocket/android/members/presentation/MembersPresenter.kt
+12
-0
MembersFragment.kt
...in/java/chat/rocket/android/members/ui/MembersFragment.kt
+6
-23
fragment_chat_room.xml
app/src/main/res/layout/fragment_chat_room.xml
+2
-1
fragment_member_bottom_sheet.xml
app/src/main/res/layout/fragment_member_bottom_sheet.xml
+2
-3
fragment_members.xml
app/src/main/res/layout/fragment_members.xml
+0
-2
No files found.
app/src/main/java/chat/rocket/android/member/ui/MemberBottomSheetFragment.kt
0 → 100644
View file @
c2b06839
package
chat.rocket.android.member.ui
import
android.os.Bundle
import
android.support.design.widget.BottomSheetDialogFragment
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
import
chat.rocket.android.R
import
chat.rocket.android.util.extensions.content
import
chat.rocket.android.util.extensions.setVisible
import
chat.rocket.android.util.extensions.textContent
import
kotlinx.android.synthetic.main.fragment_member_bottom_sheet.*
fun
newInstance
(
avatarUri
:
String
,
realName
:
String
,
username
:
String
,
email
:
String
,
utcOffset
:
String
):
BottomSheetDialogFragment
{
return
MemberBottomSheetFragment
().
apply
{
arguments
=
Bundle
(
1
).
apply
{
putString
(
BUNDLE_AVATAR_URI
,
avatarUri
)
putString
(
BUNDLE_REAL_NAME
,
realName
)
putString
(
BUNDLE_USERNAME
,
username
)
putString
(
BUNDLE_EMAIL
,
email
)
putString
(
BUNDLE_UTC_OFFSET
,
utcOffset
)
}
}
}
private
const
val
BUNDLE_AVATAR_URI
=
"avatar_uri"
private
const
val
BUNDLE_REAL_NAME
=
"real_name"
private
const
val
BUNDLE_USERNAME
=
"username"
private
const
val
BUNDLE_EMAIL
=
"email"
private
const
val
BUNDLE_UTC_OFFSET
=
"utc_offset"
class
MemberBottomSheetFragment
:
BottomSheetDialogFragment
()
{
private
lateinit
var
avatarUri
:
String
private
lateinit
var
realName
:
String
private
lateinit
var
username
:
String
private
lateinit
var
email
:
String
private
lateinit
var
utcOffset
:
String
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
val
bundle
=
arguments
if
(
bundle
!=
null
)
{
avatarUri
=
bundle
.
getString
(
BUNDLE_AVATAR_URI
)
realName
=
bundle
.
getString
(
BUNDLE_REAL_NAME
)
username
=
bundle
.
getString
(
BUNDLE_USERNAME
)
email
=
bundle
.
getString
(
BUNDLE_EMAIL
)
utcOffset
=
bundle
.
getString
(
BUNDLE_UTC_OFFSET
)
}
else
{
requireNotNull
(
bundle
)
{
"no arguments supplied when the fragment was instantiated"
}
}
}
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?):
View
?
=
inflater
.
inflate
(
R
.
layout
.
fragment_member_bottom_sheet
,
container
,
false
)
override
fun
onViewCreated
(
view
:
View
,
savedInstanceState
:
Bundle
?)
{
super
.
onViewCreated
(
view
,
savedInstanceState
)
showMemberDetails
()
}
private
fun
showMemberDetails
()
{
image_bottom_sheet_avatar
.
setImageURI
(
avatarUri
)
text_bottom_sheet_member_name
.
content
=
realName
text_bottom_sheet_member_username
.
content
=
username
if
(
email
.
isNotEmpty
())
{
text_member_email_address
.
textContent
=
email
}
else
{
text_email_address
.
setVisible
(
false
)
text_member_email_address
.
setVisible
(
false
)
}
if
(
utcOffset
.
isNotEmpty
()){
text_member_utc
.
content
=
utcOffset
}
else
{
text_utc
.
setVisible
(
false
)
text_member_utc
.
setVisible
(
false
)
}
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/members/di/MembersFragmentModule.kt
View file @
c2b06839
package
chat.rocket.android.members.di
import
android.arch.lifecycle.LifecycleOwner
import
chat.rocket.android.chatroom.ui.ChatRoomActivity
import
chat.rocket.android.core.lifecycle.CancelStrategy
import
chat.rocket.android.dagger.scope.PerFragment
import
chat.rocket.android.members.presentation.MembersNavigator
import
chat.rocket.android.members.presentation.MembersView
import
chat.rocket.android.members.ui.MembersFragment
import
dagger.Module
...
...
@@ -13,6 +15,9 @@ import kotlinx.coroutines.experimental.Job
@PerFragment
class
MembersFragmentModule
{
@Provides
fun
provideChatRoomNavigator
(
activity
:
ChatRoomActivity
)
=
MembersNavigator
(
activity
)
@Provides
fun
membersView
(
frag
:
MembersFragment
):
MembersView
{
return
frag
...
...
app/src/main/java/chat/rocket/android/members/presentation/MembersNavigator.kt
0 → 100644
View file @
c2b06839
package
chat.rocket.android.members.presentation
import
chat.rocket.android.chatroom.ui.ChatRoomActivity
import
chat.rocket.android.member.ui.newInstance
class
MembersNavigator
(
internal
val
activity
:
ChatRoomActivity
)
{
fun
toMemberDetails
(
avatarUri
:
String
,
realName
:
String
,
username
:
String
,
email
:
String
,
utcOffset
:
String
)
{
activity
.
apply
{
newInstance
(
avatarUri
,
realName
,
username
,
email
,
utcOffset
)
.
show
(
supportFragmentManager
,
"MemberBottomSheetFragment"
)
}
}
}
app/src/main/java/chat/rocket/android/members/presentation/MembersPresenter.kt
View file @
c2b06839
package
chat.rocket.android.members.presentation
import
chat.rocket.android.core.lifecycle.CancelStrategy
import
chat.rocket.android.members.viewmodel.MemberViewModel
import
chat.rocket.android.members.viewmodel.MemberViewModelMapper
import
chat.rocket.android.server.domain.GetCurrentServerInteractor
import
chat.rocket.android.server.infraestructure.RocketChatClientFactory
...
...
@@ -13,6 +14,7 @@ import chat.rocket.core.internal.rest.getMembers
import
javax.inject.Inject
class
MembersPresenter
@Inject
constructor
(
private
val
view
:
MembersView
,
private
val
navigator
:
MembersNavigator
,
private
val
strategy
:
CancelStrategy
,
private
val
serverInteractor
:
GetCurrentServerInteractor
,
factory
:
RocketChatClientFactory
,
...
...
@@ -38,4 +40,14 @@ class MembersPresenter @Inject constructor(private val view: MembersView,
}
}
}
fun
toMemberDetails
(
memberViewModel
:
MemberViewModel
)
{
val
avatarUri
=
memberViewModel
.
avatarUri
.
toString
()
val
realName
=
memberViewModel
.
realName
.
toString
()
val
username
=
"@${memberViewModel.username}"
val
email
=
memberViewModel
.
email
?:
""
val
utcOffset
=
memberViewModel
.
utcOffset
.
toString
()
navigator
.
toMemberDetails
(
avatarUri
,
realName
,
username
,
email
,
utcOffset
)
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/members/ui/MembersFragment.kt
View file @
c2b06839
package
chat.rocket.android.members.ui
import
android.os.Bundle
import
android.support.design.widget.BottomSheetBehavior
import
android.support.v4.app.Fragment
import
android.support.v7.app.AppCompatActivity
import
android.support.v7.widget.LinearLayoutManager
...
...
@@ -12,15 +11,18 @@ import android.view.ViewGroup
import
chat.rocket.android.R
import
chat.rocket.android.chatroom.ui.ChatRoomActivity
import
chat.rocket.android.helper.EndlessRecyclerViewScrollListener
import
chat.rocket.android.member.ui.MemberBottomSheetFragment
import
chat.rocket.android.member.ui.newInstance
import
chat.rocket.android.members.adapter.MembersAdapter
import
chat.rocket.android.members.presentation.MembersPresenter
import
chat.rocket.android.members.presentation.MembersView
import
chat.rocket.android.members.viewmodel.MemberViewModel
import
chat.rocket.android.util.extensions.*
import
chat.rocket.android.util.extensions.inflate
import
chat.rocket.android.util.extensions.setVisible
import
chat.rocket.android.util.extensions.showToast
import
chat.rocket.android.widget.DividerItemDecoration
import
dagger.android.support.AndroidSupportInjection
import
kotlinx.android.synthetic.main.fragment_members.*
import
kotlinx.android.synthetic.main.member_bottom_sheet.*
import
javax.inject.Inject
fun
newInstance
(
chatRoomId
:
String
,
chatRoomType
:
String
):
Fragment
{
...
...
@@ -37,9 +39,8 @@ private const val BUNDLE_CHAT_ROOM_TYPE = "chat_room_type"
class
MembersFragment
:
Fragment
(),
MembersView
{
@Inject
lateinit
var
presenter
:
MembersPresenter
private
val
adapter
:
MembersAdapter
=
MembersAdapter
{
memberViewModel
->
show
MemberDetails
(
memberViewModel
)
}
private
val
adapter
:
MembersAdapter
=
MembersAdapter
{
memberViewModel
->
presenter
.
to
MemberDetails
(
memberViewModel
)
}
private
val
linearLayoutManager
=
LinearLayoutManager
(
context
,
LinearLayoutManager
.
VERTICAL
,
false
)
private
val
bottomSheetBehavior
by
lazy
{
BottomSheetBehavior
.
from
(
member_bottom_sheet
)
}
private
lateinit
var
chatRoomId
:
String
private
lateinit
var
chatRoomType
:
String
...
...
@@ -103,24 +104,6 @@ class MembersFragment : Fragment(), MembersView {
}
}
private
fun
showMemberDetails
(
memberViewModel
:
MemberViewModel
)
{
image_bottom_sheet_avatar
.
setImageURI
(
memberViewModel
.
avatarUri
)
text_bottom_sheet_member_name
.
content
=
memberViewModel
.
realName
text_bottom_sheet_member_username
.
content
=
"@${memberViewModel.username}"
val
memberEmail
=
memberViewModel
.
email
if
(
memberEmail
!=
null
)
{
text_member_email_address
.
textContent
=
memberEmail
}
else
{
text_email_address
.
setVisible
(
false
)
text_member_email_address
.
setVisible
(
false
)
}
text_member_utc
.
content
=
memberViewModel
.
utcOffset
.
toString
()
bottomSheetBehavior
.
state
=
BottomSheetBehavior
.
STATE_EXPANDED
}
private
fun
setupToolbar
(
totalMembers
:
Long
)
{
(
activity
as
ChatRoomActivity
).
setupToolbarTitle
(
getString
(
R
.
string
.
title_members
,
totalMembers
))
}
...
...
app/src/main/res/layout/fragment_chat_room.xml
View file @
c2b06839
...
...
@@ -4,7 +4,8 @@
xmlns:tools=
"http://schemas.android.com/tools"
android:id=
"@+id/root_layout"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
android:layout_height=
"match_parent"
tools:context=
".chatroom.ui.ChatRoomFragment"
>
<com.wang.avi.AVLoadingIndicatorView
android:id=
"@+id/view_loading"
...
...
app/src/main/res/layout/member_bottom_sheet.xml
→
app/src/main/res/layout/
fragment_
member_bottom_sheet.xml
View file @
c2b06839
...
...
@@ -4,9 +4,8 @@
xmlns:tools=
"http://schemas.android.com/tools"
android:id=
"@+id/member_bottom_sheet"
android:layout_width=
"match_parent"
android:layout_height=
"340dp"
app:behavior_hideable=
"true"
app:behavior_peekHeight=
"0dp"
android:layout_height=
"match_parent"
android:paddingBottom=
"16dp"
app:layout_behavior=
"android.support.design.widget.BottomSheetBehavior"
>
<com.facebook.drawee.view.SimpleDraweeView
...
...
app/src/main/res/layout/fragment_members.xml
View file @
c2b06839
...
...
@@ -11,8 +11,6 @@
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
<include
layout=
"@layout/member_bottom_sheet"
/>
<com.wang.avi.AVLoadingIndicatorView
android:id=
"@+id/view_loading"
android:layout_width=
"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