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
7913eb5c
Commit
7913eb5c
authored
Mar 31, 2018
by
Leonardo Aramaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show/hide chatroom type icon when accessing members list
parent
0f6d0569
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
20 deletions
+44
-20
ChatRoomActivity.kt
.../java/chat/rocket/android/chatroom/ui/ChatRoomActivity.kt
+28
-20
ChatRoomFragment.kt
.../java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
+4
-0
MembersFragment.kt
...in/java/chat/rocket/android/members/ui/MembersFragment.kt
+12
-0
No files found.
app/src/main/java/chat/rocket/android/chatroom/ui/ChatRoomActivity.kt
View file @
7913eb5c
...
...
@@ -102,31 +102,39 @@ class ChatRoomActivity : AppCompatActivity(), HasSupportFragmentInjector {
return
fragmentDispatchingAndroidInjector
}
fun
showRoomTypeIcon
(
showRoomTypeIcon
:
Boolean
)
{
if
(
showRoomTypeIcon
)
{
val
roomType
=
roomTypeOf
(
chatRoomType
)
val
drawable
=
when
(
roomType
)
{
is
RoomType
.
Channel
->
{
DrawableHelper
.
getDrawableFromId
(
R
.
drawable
.
ic_room_channel
,
this
)
}
is
RoomType
.
PrivateGroup
->
{
DrawableHelper
.
getDrawableFromId
(
R
.
drawable
.
ic_room_lock
,
this
)
}
is
RoomType
.
DirectMessage
->
{
DrawableHelper
.
getDrawableFromId
(
R
.
drawable
.
ic_room_dm
,
this
)
}
else
->
null
}
drawable
?.
let
{
val
wrappedDrawable
=
DrawableHelper
.
wrapDrawable
(
it
)
val
mutableDrawable
=
wrappedDrawable
.
mutate
()
DrawableHelper
.
tintDrawable
(
mutableDrawable
,
this
,
R
.
color
.
white
)
DrawableHelper
.
compoundDrawable
(
text_room_name
,
mutableDrawable
)
}
}
else
{
text_room_name
.
setCompoundDrawablesWithIntrinsicBounds
(
0
,
0
,
0
,
0
)
}
}
private
fun
setupToolbar
()
{
setSupportActionBar
(
toolbar
)
supportActionBar
?.
setDisplayShowTitleEnabled
(
false
)
text_room_name
.
textContent
=
chatRoomName
val
roomType
=
roomTypeOf
(
chatRoomType
)
val
drawable
=
when
(
roomType
)
{
is
RoomType
.
Channel
->
{
DrawableHelper
.
getDrawableFromId
(
R
.
drawable
.
ic_room_channel
,
this
)
}
is
RoomType
.
PrivateGroup
->
{
DrawableHelper
.
getDrawableFromId
(
R
.
drawable
.
ic_room_lock
,
this
)
}
is
RoomType
.
DirectMessage
->
{
DrawableHelper
.
getDrawableFromId
(
R
.
drawable
.
ic_room_dm
,
this
)
}
else
->
null
}
drawable
?.
let
{
val
wrappedDrawable
=
DrawableHelper
.
wrapDrawable
(
it
)
val
mutableDrawable
=
wrappedDrawable
.
mutate
()
DrawableHelper
.
tintDrawable
(
mutableDrawable
,
this
,
R
.
color
.
white
)
DrawableHelper
.
compoundDrawable
(
text_room_name
,
mutableDrawable
)
}
showRoomTypeIcon
(
true
)
toolbar
.
setNavigationOnClickListener
{
finishActivity
()
...
...
app/src/main/java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
View file @
7913eb5c
...
...
@@ -123,6 +123,10 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
setupMessageComposer
()
setupSuggestionsView
()
setupActionSnackbar
()
activity
?.
apply
{
(
this
as
?
ChatRoomActivity
)
?.
showRoomTypeIcon
(
true
)
}
}
override
fun
onActivityCreated
(
savedInstanceState
:
Bundle
?)
{
...
...
app/src/main/java/chat/rocket/android/members/ui/MembersFragment.kt
View file @
7913eb5c
...
...
@@ -6,6 +6,7 @@ import android.support.v7.app.AppCompatActivity
import
android.support.v7.widget.LinearLayoutManager
import
android.support.v7.widget.RecyclerView
import
android.view.LayoutInflater
import
android.view.MenuItem
import
android.view.View
import
android.view.ViewGroup
import
chat.rocket.android.R
...
...
@@ -83,7 +84,18 @@ class MembersFragment : Fragment(), MembersView {
}
else
{
adapter
.
appendData
(
dataSet
)
}
if
(
this
is
ChatRoomActivity
)
{
this
.
showRoomTypeIcon
(
false
)
}
}
}
override
fun
onOptionsItemSelected
(
item
:
MenuItem
):
Boolean
{
if
(
item
.
itemId
==
android
.
R
.
id
.
home
)
{
(
activity
as
ChatRoomActivity
).
showRoomTypeIcon
(
true
)
return
super
.
onOptionsItemSelected
(
item
)
}
return
super
.
onOptionsItemSelected
(
item
)
}
override
fun
showLoading
()
=
view_loading
.
setVisible
(
true
)
...
...
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