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
0d36f350
Commit
0d36f350
authored
May 17, 2018
by
Leonardo Aramaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Get back old chat room toolbar
parent
eaaad0d5
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
133 additions
and
18 deletions
+133
-18
ChatRoomActivity.kt
.../java/chat/rocket/android/chatroom/ui/ChatRoomActivity.kt
+38
-3
ChatRoomFragment.kt
.../java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
+17
-14
ic_room_channel.xml
app/src/main/res/drawable/ic_room_channel.xml
+9
-0
ic_room_dm.xml
app/src/main/res/drawable/ic_room_dm.xml
+9
-0
ic_room_lock.xml
app/src/main/res/drawable/ic_room_lock.xml
+9
-0
activity_chat_room.xml
app/src/main/res/layout/activity_chat_room.xml
+1
-1
app_bar_chat_room.xml
app/src/main/res/layout/app_bar_chat_room.xml
+50
-0
No files found.
app/src/main/java/chat/rocket/android/chatroom/ui/ChatRoomActivity.kt
View file @
0d36f350
...
@@ -10,11 +10,14 @@ import chat.rocket.android.chatroom.presentation.ChatRoomNavigator
...
@@ -10,11 +10,14 @@ import chat.rocket.android.chatroom.presentation.ChatRoomNavigator
import
chat.rocket.android.server.domain.GetCurrentServerInteractor
import
chat.rocket.android.server.domain.GetCurrentServerInteractor
import
chat.rocket.android.server.infraestructure.ConnectionManagerFactory
import
chat.rocket.android.server.infraestructure.ConnectionManagerFactory
import
chat.rocket.android.util.extensions.addFragment
import
chat.rocket.android.util.extensions.addFragment
import
chat.rocket.android.util.extensions.textContent
import
chat.rocket.common.model.RoomType
import
chat.rocket.common.model.roomTypeOf
import
dagger.android.AndroidInjection
import
dagger.android.AndroidInjection
import
dagger.android.AndroidInjector
import
dagger.android.AndroidInjector
import
dagger.android.DispatchingAndroidInjector
import
dagger.android.DispatchingAndroidInjector
import
dagger.android.support.HasSupportFragmentInjector
import
dagger.android.support.HasSupportFragmentInjector
import
kotlinx.android.synthetic.main.app_bar.*
import
kotlinx.android.synthetic.main.app_bar
_chat_room
.*
import
javax.inject.Inject
import
javax.inject.Inject
fun
Context
.
chatRoomIntent
(
fun
Context
.
chatRoomIntent
(
...
@@ -123,13 +126,45 @@ class ChatRoomActivity : AppCompatActivity(), HasSupportFragmentInjector {
...
@@ -123,13 +126,45 @@ class ChatRoomActivity : AppCompatActivity(), HasSupportFragmentInjector {
private
fun
setupToolbar
()
{
private
fun
setupToolbar
()
{
setSupportActionBar
(
toolbar
)
setSupportActionBar
(
toolbar
)
supportActionBar
?.
setDisplayShowTitleEnabled
(
false
)
toolbar
.
setNavigationIcon
(
R
.
drawable
.
ic_arrow_back_white_24dp
)
toolbar
.
setNavigationIcon
(
R
.
drawable
.
ic_arrow_back_white_24dp
)
toolbar
.
title
=
chatRoomName
text_room_name
.
textContent
=
chatRoomName
showRoomTypeIcon
(
true
)
toolbar
.
setNavigationOnClickListener
{
finishActivity
()
}
toolbar
.
setNavigationOnClickListener
{
finishActivity
()
}
}
}
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
)
}
}
fun
setupToolbarTitle
(
toolbarTitle
:
String
)
{
fun
setupToolbarTitle
(
toolbarTitle
:
String
)
{
supportActionBar
?.
title
=
toolbarTitle
text_room_name
.
textContent
=
toolbarTitle
}
}
private
fun
finishActivity
()
{
private
fun
finishActivity
()
{
...
...
app/src/main/java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
View file @
0d36f350
...
@@ -187,6 +187,9 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
...
@@ -187,6 +187,9 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
setupFab
()
setupFab
()
setupSuggestionsView
()
setupSuggestionsView
()
setupActionSnackbar
()
setupActionSnackbar
()
activity
?.
apply
{
(
this
as
?
ChatRoomActivity
)
?.
showRoomTypeIcon
(
true
)
}
}
}
override
fun
onActivityCreated
(
savedInstanceState
:
Bundle
?)
{
override
fun
onActivityCreated
(
savedInstanceState
:
Bundle
?)
{
...
@@ -383,17 +386,17 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
...
@@ -383,17 +386,17 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
when
(
usernameList
.
size
)
{
when
(
usernameList
.
size
)
{
1
->
{
1
->
{
text_typing_status
.
text
=
text_typing_status
.
text
=
SpannableStringBuilder
()
SpannableStringBuilder
()
.
bold
{
append
(
usernameList
[
0
])
}
.
bold
{
append
(
usernameList
[
0
])
}
.
append
(
getString
(
R
.
string
.
msg_is_typing
))
.
append
(
getString
(
R
.
string
.
msg_is_typing
))
}
}
2
->
{
2
->
{
text_typing_status
.
text
=
text_typing_status
.
text
=
SpannableStringBuilder
()
SpannableStringBuilder
()
.
bold
{
append
(
usernameList
[
0
])
}
.
bold
{
append
(
usernameList
[
0
])
}
.
append
(
getString
(
R
.
string
.
msg_and
))
.
append
(
getString
(
R
.
string
.
msg_and
))
.
bold
{
append
(
usernameList
[
1
])
}
.
bold
{
append
(
usernameList
[
1
])
}
.
append
(
getString
(
R
.
string
.
msg_are_typing
))
.
append
(
getString
(
R
.
string
.
msg_are_typing
))
}
}
else
->
{
else
->
{
text_typing_status
.
text
=
getString
(
R
.
string
.
msg_several_users_are_typing
)
text_typing_status
.
text
=
getString
(
R
.
string
.
msg_several_users_are_typing
)
...
@@ -610,15 +613,15 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
...
@@ -610,15 +613,15 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
handler
.
postDelayed
(
dismissStatus
,
2000
)
handler
.
postDelayed
(
dismissStatus
,
2000
)
}
}
is
State
.
Disconnected
->
connection_status_text
.
text
=
is
State
.
Disconnected
->
connection_status_text
.
text
=
getString
(
R
.
string
.
status_disconnected
)
getString
(
R
.
string
.
status_disconnected
)
is
State
.
Connecting
->
connection_status_text
.
text
=
is
State
.
Connecting
->
connection_status_text
.
text
=
getString
(
R
.
string
.
status_connecting
)
getString
(
R
.
string
.
status_connecting
)
is
State
.
Authenticating
->
connection_status_text
.
text
=
is
State
.
Authenticating
->
connection_status_text
.
text
=
getString
(
R
.
string
.
status_authenticating
)
getString
(
R
.
string
.
status_authenticating
)
is
State
.
Disconnecting
->
connection_status_text
.
text
=
is
State
.
Disconnecting
->
connection_status_text
.
text
=
getString
(
R
.
string
.
status_disconnecting
)
getString
(
R
.
string
.
status_disconnecting
)
is
State
.
Waiting
->
connection_status_text
.
text
=
is
State
.
Waiting
->
connection_status_text
.
text
=
getString
(
R
.
string
.
status_waiting
,
state
.
seconds
)
getString
(
R
.
string
.
status_waiting
,
state
.
seconds
)
}
}
}
}
}
}
...
@@ -675,7 +678,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
...
@@ -675,7 +678,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
subscribeComposeTextMessage
()
subscribeComposeTextMessage
()
emojiKeyboardPopup
=
emojiKeyboardPopup
=
EmojiKeyboardPopup
(
activity
!!
,
activity
!!
.
findViewById
(
R
.
id
.
fragment_container
))
EmojiKeyboardPopup
(
activity
!!
,
activity
!!
.
findViewById
(
R
.
id
.
fragment_container
))
emojiKeyboardPopup
.
listener
=
this
emojiKeyboardPopup
.
listener
=
this
text_message
.
listener
=
object
:
ComposerEditText
.
ComposerEditTextListener
{
text_message
.
listener
=
object
:
ComposerEditText
.
ComposerEditTextListener
{
override
fun
onKeyboardOpened
()
{
override
fun
onKeyboardOpened
()
{
...
...
app/src/main/res/drawable/ic_room_channel.xml
0 → 100644
View file @
0d36f350
<vector
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:width=
"16dp"
android:height=
"16dp"
android:viewportHeight=
"24.0"
android:viewportWidth=
"24.0"
>
<path
android:fillColor=
"#FF000000"
android:pathData=
"M22.548,9l0.452,-2h-5.364l1.364,-6h-2l-1.364,6h-5l1.364,-6h-2l-1.364,6h-6.184l-0.452,2h6.182l-1.364,6h-5.36l-0.458,2h5.364l-1.364,6h2l1.364,-6h5l-1.364,6h2l1.364,-6h6.185l0.451,-2h-6.182l1.364,-6h5.366zM13.818,15h-5l1.364,-6h5l-1.364,6z"
/>
</vector>
\ No newline at end of file
app/src/main/res/drawable/ic_room_dm.xml
0 → 100644
View file @
0d36f350
<vector
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:width=
"16dp"
android:height=
"16dp"
android:viewportHeight=
"20.0"
android:viewportWidth=
"20.0"
>
<path
android:fillColor=
"#FF000000"
android:pathData=
"M13.6,13.47c-0.91,0.953 -2.191,1.545 -3.61,1.545 -2.756,0 -4.99,-2.234 -4.99,-4.99 0,-0.009 0,-0.018 0,-0.026v0.001c0,-2.761 2.239,-5 5,-5 1.131,0 2.175,0.376 3.013,1.009l-0.013,-0.009v-1h2v6.5c0,0.828 0.672,1.5 1.5,1.5s1.5,-0.672 1.5,-1.5v0,-1.5c-0.003,-4.416 -3.584,-7.994 -8,-7.994 -4.418,0 -8,3.582 -8,8s3.582,8 8,8c1.305,0 2.537,-0.312 3.625,-0.867l-0.045,0.021 0.9,1.79c-1.305,0.668 -2.847,1.06 -4.48,1.06 -5.523,0 -10,-4.477 -10,-10s4.477,-10 10,-10c5.519,0 9.994,4.472 10,9.99v0.001h-0.01v1.5c0,0.003 0,0.007 0,0.01 0,1.933 -1.567,3.5 -3.5,3.5 -1.202,0 -2.262,-0.606 -2.892,-1.528l-0.008,-0.012zM10,13c1.657,0 3,-1.343 3,-3s-1.343,-3 -3,-3v0c-1.657,0 -3,1.343 -3,3s1.343,3 3,3v0z"
/>
</vector>
\ No newline at end of file
app/src/main/res/drawable/ic_room_lock.xml
0 → 100644
View file @
0d36f350
<vector
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:width=
"16dp"
android:height=
"16dp"
android:viewportHeight=
"24.0"
android:viewportWidth=
"24.0"
>
<path
android:fillColor=
"#FF000000"
android:pathData=
"M18,10v-4c0,-3.313 -2.687,-6 -6,-6s-6,2.687 -6,6v4h-3v14h18v-14h-3zM8,6c0,-2.206 1.794,-4 4,-4s4,1.794 4,4v4h-8v-4zM19,22h-14v-10h14v10z"
/>
</vector>
\ No newline at end of file
app/src/main/res/layout/activity_chat_room.xml
View file @
0d36f350
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
<include
<include
android:id=
"@+id/layout_app_bar"
android:id=
"@+id/layout_app_bar"
layout=
"@layout/app_bar"
/>
layout=
"@layout/app_bar
_chat_room
"
/>
<FrameLayout
<FrameLayout
android:id=
"@+id/fragment_container"
android:id=
"@+id/fragment_container"
...
...
app/src/main/res/layout/app_bar_chat_room.xml
0 → 100644
View file @
0d36f350
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.AppBarLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"@color/colorPrimary"
android:theme=
"@style/Theme.AppCompat.Light.NoActionBar"
>
<android.support.v7.widget.Toolbar
android:id=
"@+id/toolbar"
android:layout_width=
"match_parent"
android:layout_height=
"?attr/actionBarSize"
app:layout_scrollFlags=
"scroll|enterAlways"
app:navigationIcon=
"?android:attr/homeAsUpIndicator"
app:popupTheme=
"@style/ThemeOverlay.AppCompat.Light"
app:theme=
"@style/ThemeOverlay.AppCompat.Dark.ActionBar"
>
<android.support.constraint.ConstraintLayout
android:id=
"@+id/toolbar_content_container"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
>
<!-- TODO implement -->
<com.facebook.drawee.view.SimpleDraweeView
android:id=
"@+id/image_room_avatar"
android:layout_width=
"30dp"
android:layout_height=
"30dp"
android:visibility=
"gone"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:roundAsCircle=
"true"
/>
<TextView
android:id=
"@+id/text_room_name"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"10dp"
android:drawablePadding=
"@dimen/text_view_drawable_padding"
android:ellipsize=
"end"
android:maxLines=
"1"
android:textColor=
"@color/white"
android:textSize=
"18sp"
android:textStyle=
"bold"
tools:text=
"Developers"
/>
</android.support.constraint.ConstraintLayout>
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
\ No newline at end of file
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