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
e6ecb84b
Commit
e6ecb84b
authored
Feb 22, 2018
by
Filipe de Lima Brito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Layout improvements to satisfy issue #751
parent
49de7deb
Changes
36
Hide whitespace changes
Inline
Side-by-side
Showing
36 changed files
with
309 additions
and
194 deletions
+309
-194
LoginFragmentProvider.kt
.../android/authentication/login/di/LoginFragmentProvider.kt
+1
-1
AuthenticationNavigator.kt
...id/authentication/presentation/AuthenticationNavigator.kt
+4
-3
ServerFragmentProvider.kt
...ndroid/authentication/server/di/ServerFragmentProvider.kt
+3
-2
PinnedMessagesFragmentModule.kt
...ocket/android/chatroom/di/PinnedMessagesFragmentModule.kt
+1
-1
ChatRoomsPresenter.kt
...cket/android/chatrooms/presentation/ChatRoomsPresenter.kt
+0
-32
ChatRoomsView.kt
...at/rocket/android/chatrooms/presentation/ChatRoomsView.kt
+1
-6
ChatRoomsAdapter.kt
...java/chat/rocket/android/chatrooms/ui/ChatRoomsAdapter.kt
+7
-0
ChatRoomsFragment.kt
...ava/chat/rocket/android/chatrooms/ui/ChatRoomsFragment.kt
+2
-20
ActivityBuilder.kt
...java/chat/rocket/android/dagger/module/ActivityBuilder.kt
+8
-1
MessageParser.kt
...src/main/java/chat/rocket/android/helper/MessageParser.kt
+3
-2
MainActivityModule.kt
...in/java/chat/rocket/android/main/di/MainActivityModule.kt
+23
-0
MainActivityProvider.kt
.../java/chat/rocket/android/main/di/MainActivityProvider.kt
+12
-0
MainModule.kt
app/src/main/java/chat/rocket/android/main/di/MainModule.kt
+16
-0
MainNavigator.kt
...va/chat/rocket/android/main/presentation/MainNavigator.kt
+23
-0
MainPresenter.kt
...va/chat/rocket/android/main/presentation/MainPresenter.kt
+56
-0
MainView.kt
...in/java/chat/rocket/android/main/presentation/MainView.kt
+11
-0
MainActivity.kt
...src/main/java/chat/rocket/android/main/ui/MainActivity.kt
+26
-18
close_enter.xml
app/src/main/res/anim/close_enter.xml
+5
-2
close_exit.xml
app/src/main/res/anim/close_exit.xml
+3
-1
open_enter.xml
app/src/main/res/anim/open_enter.xml
+3
-1
open_exit.xml
app/src/main/res/anim/open_exit.xml
+5
-2
ic_exit_to_app_black_24dp.xml
app/src/main/res/drawable/ic_exit_to_app_black_24dp.xml
+11
-0
ic_settings_black_24dp.xml
app/src/main/res/drawable/ic_settings_black_24dp.xml
+9
-0
style_message_file_upload_content_bg.xml
...ain/res/drawable/style_message_file_upload_content_bg.xml
+0
-15
style_message_file_upload_layout_bg.xml
...main/res/drawable/style_message_file_upload_layout_bg.xml
+0
-11
fragment_authentication_two_fa.xml
app/src/main/res/layout/fragment_authentication_two_fa.xml
+0
-1
item_chat.xml
app/src/main/res/layout/item_chat.xml
+39
-40
item_message.xml
app/src/main/res/layout/item_message.xml
+5
-2
message_attachment.xml
app/src/main/res/layout/message_attachment.xml
+0
-16
unread_messages_badge.xml
app/src/main/res/layout/unread_messages_badge.xml
+2
-2
chatrooms.xml
app/src/main/res/menu/chatrooms.xml
+0
-5
navigation.xml
app/src/main/res/menu/navigation.xml
+20
-1
strings.xml
app/src/main/res/values-pt-rBR/strings.xml
+1
-0
colors.xml
app/src/main/res/values/colors.xml
+6
-7
strings.xml
app/src/main/res/values/strings.xml
+2
-1
dependencies.gradle
dependencies.gradle
+1
-1
No files found.
app/src/main/java/chat/rocket/android/authentication/login/di/LoginFragmentProvider.kt
View file @
e6ecb84b
...
@@ -6,6 +6,6 @@ import dagger.android.ContributesAndroidInjector
...
@@ -6,6 +6,6 @@ import dagger.android.ContributesAndroidInjector
@Module
abstract
class
LoginFragmentProvider
{
@Module
abstract
class
LoginFragmentProvider
{
@ContributesAndroidInjector
(
modules
=
[
(
LoginFragmentModule
::
class
)
])
@ContributesAndroidInjector
(
modules
=
[
LoginFragmentModule
::
class
])
abstract
fun
provideLoginFragment
():
LoginFragment
abstract
fun
provideLoginFragment
():
LoginFragment
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/authentication/presentation/AuthenticationNavigator.kt
View file @
e6ecb84b
...
@@ -12,20 +12,21 @@ import chat.rocket.android.util.extensions.addFragmentBackStack
...
@@ -12,20 +12,21 @@ import chat.rocket.android.util.extensions.addFragmentBackStack
import
chat.rocket.android.webview.webViewIntent
import
chat.rocket.android.webview.webViewIntent
class
AuthenticationNavigator
(
internal
val
activity
:
AuthenticationActivity
,
internal
val
context
:
Context
)
{
class
AuthenticationNavigator
(
internal
val
activity
:
AuthenticationActivity
,
internal
val
context
:
Context
)
{
fun
toLogin
()
{
fun
toLogin
()
{
activity
.
addFragmentBackStack
(
"
l
oginFragment"
,
R
.
id
.
fragment_container
)
{
activity
.
addFragmentBackStack
(
"
L
oginFragment"
,
R
.
id
.
fragment_container
)
{
LoginFragment
.
newInstance
()
LoginFragment
.
newInstance
()
}
}
}
}
fun
toTwoFA
(
username
:
String
,
password
:
String
)
{
fun
toTwoFA
(
username
:
String
,
password
:
String
)
{
activity
.
addFragmentBackStack
(
"
t
woFAFragment"
,
R
.
id
.
fragment_container
)
{
activity
.
addFragmentBackStack
(
"
T
woFAFragment"
,
R
.
id
.
fragment_container
)
{
TwoFAFragment
.
newInstance
(
username
,
password
)
TwoFAFragment
.
newInstance
(
username
,
password
)
}
}
}
}
fun
toSignUp
()
{
fun
toSignUp
()
{
activity
.
addFragmentBackStack
(
"
s
ignupFragment"
,
R
.
id
.
fragment_container
)
{
activity
.
addFragmentBackStack
(
"
S
ignupFragment"
,
R
.
id
.
fragment_container
)
{
SignupFragment
.
newInstance
()
SignupFragment
.
newInstance
()
}
}
}
}
...
...
app/src/main/java/chat/rocket/android/authentication/server/di/ServerFragmentProvider.kt
View file @
e6ecb84b
...
@@ -4,8 +4,9 @@ import chat.rocket.android.authentication.server.ui.ServerFragment
...
@@ -4,8 +4,9 @@ import chat.rocket.android.authentication.server.ui.ServerFragment
import
dagger.Module
import
dagger.Module
import
dagger.android.ContributesAndroidInjector
import
dagger.android.ContributesAndroidInjector
@Module
abstract
class
ServerFragmentProvider
{
@Module
abstract
class
ServerFragmentProvider
{
@ContributesAndroidInjector
(
modules
=
[
(
ServerFragmentModule
::
class
)
])
@ContributesAndroidInjector
(
modules
=
[
ServerFragmentModule
::
class
])
abstract
fun
provideServerFragment
():
ServerFragment
abstract
fun
provideServerFragment
():
ServerFragment
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/chatroom/di/PinnedMessagesFragmentModule.kt
View file @
e6ecb84b
...
@@ -24,7 +24,7 @@ class PinnedMessagesFragmentModule {
...
@@ -24,7 +24,7 @@ class PinnedMessagesFragmentModule {
}
}
@Provides
@Provides
fun
providePinnedMessageView
(
frag
:
PinnedMessagesFragment
):
PinnedMessagesView
{
fun
providePinnedMessage
s
View
(
frag
:
PinnedMessagesFragment
):
PinnedMessagesView
{
return
frag
return
frag
}
}
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/chatrooms/presentation/ChatRoomsPresenter.kt
View file @
e6ecb84b
package
chat.rocket.android.chatrooms.presentation
package
chat.rocket.android.chatrooms.presentation
import
chat.rocket.android.core.lifecycle.CancelStrategy
import
chat.rocket.android.core.lifecycle.CancelStrategy
import
chat.rocket.android.infrastructure.LocalRepository
import
chat.rocket.android.server.domain.GetChatRoomsInteractor
import
chat.rocket.android.server.domain.GetChatRoomsInteractor
import
chat.rocket.android.server.domain.GetCurrentServerInteractor
import
chat.rocket.android.server.domain.GetCurrentServerInteractor
import
chat.rocket.android.server.domain.RefreshSettingsInteractor
import
chat.rocket.android.server.domain.RefreshSettingsInteractor
...
@@ -13,8 +12,6 @@ import chat.rocket.core.RocketChatClient
...
@@ -13,8 +12,6 @@ import chat.rocket.core.RocketChatClient
import
chat.rocket.core.internal.model.Subscription
import
chat.rocket.core.internal.model.Subscription
import
chat.rocket.core.internal.realtime.*
import
chat.rocket.core.internal.realtime.*
import
chat.rocket.core.internal.rest.chatRooms
import
chat.rocket.core.internal.rest.chatRooms
import
chat.rocket.core.internal.rest.logout
import
chat.rocket.core.internal.rest.unregisterPushToken
import
chat.rocket.core.model.ChatRoom
import
chat.rocket.core.model.ChatRoom
import
chat.rocket.core.model.Room
import
chat.rocket.core.model.Room
import
kotlinx.coroutines.experimental.*
import
kotlinx.coroutines.experimental.*
...
@@ -28,7 +25,6 @@ class ChatRoomsPresenter @Inject constructor(private val view: ChatRoomsView,
...
@@ -28,7 +25,6 @@ class ChatRoomsPresenter @Inject constructor(private val view: ChatRoomsView,
private
val
serverInteractor
:
GetCurrentServerInteractor
,
private
val
serverInteractor
:
GetCurrentServerInteractor
,
private
val
getChatRoomsInteractor
:
GetChatRoomsInteractor
,
private
val
getChatRoomsInteractor
:
GetChatRoomsInteractor
,
private
val
saveChatRoomsInteractor
:
SaveChatRoomsInteractor
,
private
val
saveChatRoomsInteractor
:
SaveChatRoomsInteractor
,
private
val
localRepository
:
LocalRepository
,
private
val
refreshSettingsInteractor
:
RefreshSettingsInteractor
,
private
val
refreshSettingsInteractor
:
RefreshSettingsInteractor
,
factory
:
RocketChatClientFactory
)
{
factory
:
RocketChatClientFactory
)
{
private
val
client
:
RocketChatClient
=
factory
.
create
(
serverInteractor
.
get
()
!!
)
private
val
client
:
RocketChatClient
=
factory
.
create
(
serverInteractor
.
get
()
!!
)
...
@@ -265,32 +261,4 @@ class ChatRoomsPresenter @Inject constructor(private val view: ChatRoomsView,
...
@@ -265,32 +261,4 @@ class ChatRoomsPresenter @Inject constructor(private val view: ChatRoomsView,
client
.
removeStateChannel
(
stateChannel
)
client
.
removeStateChannel
(
stateChannel
)
client
.
disconnect
()
client
.
disconnect
()
}
}
/**
* Logout from current server.
*/
fun
logout
()
{
launchUI
(
strategy
)
{
try
{
clearTokens
()
client
.
logout
()
//TODO: Add the code to unsubscribe to all subscriptions.
client
.
disconnect
()
view
.
onLogout
()
}
catch
(
e
:
RocketChatException
)
{
Timber
.
e
(
e
)
view
.
showMessage
(
e
.
message
!!
)
}
}
}
private
suspend
fun
clearTokens
()
{
serverInteractor
.
clear
()
val
pushToken
=
localRepository
.
get
(
LocalRepository
.
KEY_PUSH_TOKEN
)
if
(
pushToken
!=
null
)
{
client
.
unregisterPushToken
(
pushToken
)
localRepository
.
clear
(
LocalRepository
.
KEY_PUSH_TOKEN
)
}
localRepository
.
clearAllFromServer
(
currentServer
)
}
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/chatrooms/presentation/ChatRoomsView.kt
View file @
e6ecb84b
...
@@ -9,7 +9,7 @@ interface ChatRoomsView : LoadingView, MessageView {
...
@@ -9,7 +9,7 @@ interface ChatRoomsView : LoadingView, MessageView {
/**
/**
* Shows the chat rooms.
* Shows the chat rooms.
*
*
* @param
dataSet The
data set to show.
* @param
newDataSet The new
data set to show.
*/
*/
suspend
fun
updateChatRooms
(
newDataSet
:
List
<
ChatRoom
>)
suspend
fun
updateChatRooms
(
newDataSet
:
List
<
ChatRoom
>)
...
@@ -17,9 +17,4 @@ interface ChatRoomsView : LoadingView, MessageView {
...
@@ -17,9 +17,4 @@ interface ChatRoomsView : LoadingView, MessageView {
* Shows no chat rooms to display.
* Shows no chat rooms to display.
*/
*/
fun
showNoChatRoomsToDisplay
()
fun
showNoChatRoomsToDisplay
()
/**
* User has successfully logged out from the current server.
**/
fun
onLogout
()
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/chatrooms/ui/ChatRoomsAdapter.kt
View file @
e6ecb84b
...
@@ -2,6 +2,7 @@ package chat.rocket.android.chatrooms.ui
...
@@ -2,6 +2,7 @@ package chat.rocket.android.chatrooms.ui
import
DateTimeHelper
import
DateTimeHelper
import
android.content.Context
import
android.content.Context
import
android.support.v4.content.res.ResourcesCompat
import
android.support.v7.widget.RecyclerView
import
android.support.v7.widget.RecyclerView
import
android.view.View
import
android.view.View
import
android.view.ViewGroup
import
android.view.ViewGroup
...
@@ -43,6 +44,12 @@ class ChatRoomsAdapter(private val context: Context,
...
@@ -43,6 +44,12 @@ class ChatRoomsAdapter(private val context: Context,
bindLastMessage
(
chatRoom
,
text_last_message
)
bindLastMessage
(
chatRoom
,
text_last_message
)
bindUnreadMessages
(
chatRoom
,
text_total_unread_messages
)
bindUnreadMessages
(
chatRoom
,
text_total_unread_messages
)
if
(
chatRoom
.
alert
||
chatRoom
.
unread
>
0
)
{
text_chat_name
.
alpha
=
1F
text_last_message_date_time
.
setTextColor
(
ResourcesCompat
.
getColor
(
resources
,
R
.
color
.
colorAccent
,
null
))
text_last_message
.
setTextColor
(
ResourcesCompat
.
getColor
(
resources
,
android
.
R
.
color
.
primary_text_light
,
null
))
}
setOnClickListener
{
listener
(
chatRoom
)
}
setOnClickListener
{
listener
(
chatRoom
)
}
}
}
...
...
app/src/main/java/chat/rocket/android/chatrooms/ui/ChatRoomsFragment.kt
View file @
e6ecb84b
package
chat.rocket.android.chatrooms.ui
package
chat.rocket.android.chatrooms.ui
import
android.content.Intent
import
android.os.Bundle
import
android.os.Bundle
import
android.support.v4.app.Fragment
import
android.support.v4.app.Fragment
import
android.support.v7.app.AppCompatActivity
import
android.support.v7.app.AppCompatActivity
...
@@ -10,7 +9,6 @@ import android.support.v7.widget.LinearLayoutManager
...
@@ -10,7 +9,6 @@ import android.support.v7.widget.LinearLayoutManager
import
android.support.v7.widget.SearchView
import
android.support.v7.widget.SearchView
import
android.view.*
import
android.view.*
import
chat.rocket.android.R
import
chat.rocket.android.R
import
chat.rocket.android.authentication.ui.AuthenticationActivity
import
chat.rocket.android.chatrooms.presentation.ChatRoomsPresenter
import
chat.rocket.android.chatrooms.presentation.ChatRoomsPresenter
import
chat.rocket.android.chatrooms.presentation.ChatRoomsView
import
chat.rocket.android.chatrooms.presentation.ChatRoomsView
import
chat.rocket.android.util.extensions.inflate
import
chat.rocket.android.util.extensions.inflate
...
@@ -72,13 +70,6 @@ class ChatRoomsFragment : Fragment(), ChatRoomsView {
...
@@ -72,13 +70,6 @@ class ChatRoomsFragment : Fragment(), ChatRoomsView {
})
})
}
}
override
fun
onOptionsItemSelected
(
item
:
MenuItem
?):
Boolean
{
when
(
item
?.
itemId
)
{
R
.
id
.
action_logout
->
presenter
.
logout
()
}
return
true
}
override
suspend
fun
updateChatRooms
(
newDataSet
:
List
<
ChatRoom
>)
{
override
suspend
fun
updateChatRooms
(
newDataSet
:
List
<
ChatRoom
>)
{
activity
.
apply
{
activity
.
apply
{
launch
(
UI
)
{
launch
(
UI
)
{
...
@@ -105,15 +96,6 @@ class ChatRoomsFragment : Fragment(), ChatRoomsView {
...
@@ -105,15 +96,6 @@ class ChatRoomsFragment : Fragment(), ChatRoomsView {
override
fun
showGenericErrorMessage
()
=
showMessage
(
getString
(
R
.
string
.
msg_generic_error
))
override
fun
showGenericErrorMessage
()
=
showMessage
(
getString
(
R
.
string
.
msg_generic_error
))
override
fun
onLogout
()
{
activity
?.
apply
{
finish
()
val
intent
=
Intent
(
this
,
AuthenticationActivity
::
class
.
java
)
intent
.
addFlags
(
Intent
.
FLAG_ACTIVITY_CLEAR_TASK
or
Intent
.
FLAG_ACTIVITY_NEW_TASK
)
startActivity
(
intent
)
}
}
private
fun
setupToolbar
()
{
private
fun
setupToolbar
()
{
(
activity
as
AppCompatActivity
).
supportActionBar
?.
title
=
getString
(
R
.
string
.
title_chats
)
(
activity
as
AppCompatActivity
).
supportActionBar
?.
title
=
getString
(
R
.
string
.
title_chats
)
}
}
...
@@ -121,7 +103,7 @@ class ChatRoomsFragment : Fragment(), ChatRoomsView {
...
@@ -121,7 +103,7 @@ class ChatRoomsFragment : Fragment(), ChatRoomsView {
private
fun
setupRecyclerView
()
{
private
fun
setupRecyclerView
()
{
activity
?.
apply
{
activity
?.
apply
{
recycler_view
.
layoutManager
=
LinearLayoutManager
(
this
,
LinearLayoutManager
.
VERTICAL
,
false
)
recycler_view
.
layoutManager
=
LinearLayoutManager
(
this
,
LinearLayoutManager
.
VERTICAL
,
false
)
recycler_view
.
addItemDecoration
(
DividerItemDecoration
(
this
,
144
,
32
))
recycler_view
.
addItemDecoration
(
DividerItemDecoration
(
this
,
144
,
0
))
recycler_view
.
itemAnimator
=
DefaultItemAnimator
()
recycler_view
.
itemAnimator
=
DefaultItemAnimator
()
recycler_view
.
adapter
=
ChatRoomsAdapter
(
this
)
{
chatRoom
->
recycler_view
.
adapter
=
ChatRoomsAdapter
(
this
)
{
chatRoom
->
presenter
.
loadChatRoom
(
chatRoom
)
presenter
.
loadChatRoom
(
chatRoom
)
...
@@ -157,4 +139,4 @@ class ChatRoomsFragment : Fragment(), ChatRoomsView {
...
@@ -157,4 +139,4 @@ class ChatRoomsFragment : Fragment(), ChatRoomsView {
return
newRooms
[
newItemPosition
]
return
newRooms
[
newItemPosition
]
}
}
}
}
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/dagger/module/ActivityBuilder.kt
View file @
e6ecb84b
...
@@ -13,6 +13,8 @@ import chat.rocket.android.chatroom.ui.PinnedMessagesActivity
...
@@ -13,6 +13,8 @@ import chat.rocket.android.chatroom.ui.PinnedMessagesActivity
import
chat.rocket.android.chatrooms.di.ChatRoomsFragmentProvider
import
chat.rocket.android.chatrooms.di.ChatRoomsFragmentProvider
import
chat.rocket.android.chatrooms.di.ChatRoomsModule
import
chat.rocket.android.chatrooms.di.ChatRoomsModule
import
chat.rocket.android.dagger.scope.PerActivity
import
chat.rocket.android.dagger.scope.PerActivity
import
chat.rocket.android.main.di.MainActivityProvider
import
chat.rocket.android.main.di.MainModule
import
chat.rocket.android.main.ui.MainActivity
import
chat.rocket.android.main.ui.MainActivity
import
chat.rocket.android.profile.di.ProfileFragmentProvider
import
chat.rocket.android.profile.di.ProfileFragmentProvider
import
dagger.Module
import
dagger.Module
...
@@ -31,7 +33,12 @@ abstract class ActivityBuilder {
...
@@ -31,7 +33,12 @@ abstract class ActivityBuilder {
abstract
fun
bindAuthenticationActivity
():
AuthenticationActivity
abstract
fun
bindAuthenticationActivity
():
AuthenticationActivity
@PerActivity
@PerActivity
@ContributesAndroidInjector
(
modules
=
[
ChatRoomsModule
::
class
,
ChatRoomsFragmentProvider
::
class
,
ProfileFragmentProvider
::
class
])
@ContributesAndroidInjector
(
modules
=
[
MainModule
::
class
,
MainActivityProvider
::
class
,
ChatRoomsModule
::
class
,
ChatRoomsFragmentProvider
::
class
,
ProfileFragmentProvider
::
class
])
abstract
fun
bindMainActivity
():
MainActivity
abstract
fun
bindMainActivity
():
MainActivity
@PerActivity
@PerActivity
...
...
app/src/main/java/chat/rocket/android/helper/MessageParser.kt
View file @
e6ecb84b
...
@@ -7,6 +7,7 @@ import android.graphics.Color
...
@@ -7,6 +7,7 @@ import android.graphics.Color
import
android.graphics.Paint
import
android.graphics.Paint
import
android.graphics.Typeface
import
android.graphics.Typeface
import
android.graphics.drawable.Drawable
import
android.graphics.drawable.Drawable
import
android.support.v4.content.res.ResourcesCompat
import
android.text.Layout
import
android.text.Layout
import
android.text.Spannable
import
android.text.Spannable
import
android.text.Spanned
import
android.text.Spanned
...
@@ -78,8 +79,8 @@ class MessageParser @Inject constructor(val context: Application, private val co
...
@@ -78,8 +79,8 @@ class MessageParser @Inject constructor(val context: Application, private val co
val
user
=
matcher
.
group
(
2
)
val
user
=
matcher
.
group
(
2
)
val
start
=
matcher
.
start
(
2
)
val
start
=
matcher
.
start
(
2
)
//TODO: should check if username actually exists prior to applying.
//TODO: should check if username actually exists prior to applying.
val
linkColor
=
context
.
resources
.
getColor
(
R
.
color
.
linkTextColor
)
val
linkColor
=
ResourcesCompat
.
getColor
(
context
.
resources
,
R
.
color
.
white
,
null
)
val
linkBackgroundColor
=
context
.
resources
.
getColor
(
R
.
color
.
linkBackgroundColor
)
val
linkBackgroundColor
=
ResourcesCompat
.
getColor
(
context
.
resources
,
R
.
color
.
colorAccent
,
null
)
val
referSelf
=
currentUser
!=
null
&&
"@$currentUser"
==
user
val
referSelf
=
currentUser
!=
null
&&
"@$currentUser"
==
user
val
usernameSpan
=
UsernameClickableSpan
(
linkBackgroundColor
,
linkColor
,
referSelf
)
val
usernameSpan
=
UsernameClickableSpan
(
linkBackgroundColor
,
linkColor
,
referSelf
)
result
.
setSpan
(
usernameSpan
,
start
,
start
+
user
.
length
,
0
)
result
.
setSpan
(
usernameSpan
,
start
,
start
+
user
.
length
,
0
)
...
...
app/src/main/java/chat/rocket/android/main/di/MainActivityModule.kt
0 → 100644
View file @
e6ecb84b
package
chat.rocket.android.main.di
import
android.arch.lifecycle.LifecycleOwner
import
chat.rocket.android.core.lifecycle.CancelStrategy
import
chat.rocket.android.main.presentation.MainView
import
chat.rocket.android.main.ui.MainActivity
import
dagger.Module
import
dagger.Provides
import
kotlinx.coroutines.experimental.Job
@Module
class
MainActivityModule
{
// @Provides
// fun provideMainView(activity: MainActivity): MainView = activity
@Provides
fun
provideLifecycleOwner
(
activity
:
MainActivity
):
LifecycleOwner
=
activity
@Provides
fun
provideCancelStrategy
(
owner
:
LifecycleOwner
,
jobs
:
Job
):
CancelStrategy
=
CancelStrategy
(
owner
,
jobs
)
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/main/di/MainActivityProvider.kt
0 → 100644
View file @
e6ecb84b
package
chat.rocket.android.main.di
import
chat.rocket.android.main.ui.MainActivity
import
dagger.Module
import
dagger.android.ContributesAndroidInjector
@Module
abstract
class
MainActivityProvider
{
@ContributesAndroidInjector
(
modules
=
[
MainActivityModule
::
class
])
abstract
fun
provideMainActivity
():
MainActivity
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/main/di/MainModule.kt
0 → 100644
View file @
e6ecb84b
package
chat.rocket.android.main.di
import
android.content.Context
import
chat.rocket.android.dagger.scope.PerActivity
import
chat.rocket.android.main.presentation.MainNavigator
import
chat.rocket.android.main.ui.MainActivity
import
dagger.Module
import
dagger.Provides
@Module
class
MainModule
{
@Provides
@PerActivity
fun
provideMainNavigator
(
activity
:
MainActivity
,
context
:
Context
)
=
MainNavigator
(
activity
,
context
)
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/main/presentation/MainNavigator.kt
0 → 100644
View file @
e6ecb84b
package
chat.rocket.android.main.presentation
import
android.content.Context
import
chat.rocket.android.R
import
chat.rocket.android.chatrooms.ui.ChatRoomsFragment
import
chat.rocket.android.main.ui.MainActivity
import
chat.rocket.android.profile.ui.ProfileFragment
import
chat.rocket.android.util.extensions.addFragment
class
MainNavigator
(
internal
val
activity
:
MainActivity
,
internal
val
context
:
Context
)
{
fun
toChatList
()
{
activity
.
addFragment
(
"ChatRoomsFragment"
,
R
.
id
.
fragment_container
)
{
ChatRoomsFragment
.
newInstance
()
}
}
fun
toUserProfile
()
{
activity
.
addFragment
(
"ProfileFragment"
,
R
.
id
.
fragment_container
)
{
ProfileFragment
.
newInstance
()
}
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/main/presentation/MainPresenter.kt
0 → 100644
View file @
e6ecb84b
package
chat.rocket.android.main.presentation
import
chat.rocket.android.core.lifecycle.CancelStrategy
import
chat.rocket.android.infrastructure.LocalRepository
import
chat.rocket.android.server.domain.GetCurrentServerInteractor
import
chat.rocket.android.server.infraestructure.RocketChatClientFactory
import
chat.rocket.android.util.extensions.launchUI
import
chat.rocket.common.RocketChatException
import
chat.rocket.core.RocketChatClient
import
chat.rocket.core.internal.realtime.disconnect
import
chat.rocket.core.internal.rest.logout
import
chat.rocket.core.internal.rest.unregisterPushToken
import
timber.log.Timber
import
javax.inject.Inject
class
MainPresenter
@Inject
constructor
(
private
val
navigator
:
MainNavigator
,
private
val
serverInteractor
:
GetCurrentServerInteractor
,
private
val
localRepository
:
LocalRepository
,
factory
:
RocketChatClientFactory
)
{
private
val
client
:
RocketChatClient
=
factory
.
create
(
serverInteractor
.
get
()
!!
)
private
val
currentServer
=
serverInteractor
.
get
()
!!
fun
toChatList
()
=
navigator
.
toChatList
()
fun
toUserProfile
()
=
navigator
.
toUserProfile
()
/**
* Logout from current server.
*/
fun
logout
()
{
// launchUI(strategy) {
try
{
// clearTokens()
// client.logout()
//TODO: Add the code to unsubscribe to all subscriptions.
client
.
disconnect
()
// view.onLogout()
}
catch
(
e
:
RocketChatException
)
{
Timber
.
e
(
e
)
// view.showMessage(e.message!!)
}
// }
}
private
suspend
fun
clearTokens
()
{
serverInteractor
.
clear
()
val
pushToken
=
localRepository
.
get
(
LocalRepository
.
KEY_PUSH_TOKEN
)
if
(
pushToken
!=
null
)
{
client
.
unregisterPushToken
(
pushToken
)
localRepository
.
clear
(
LocalRepository
.
KEY_PUSH_TOKEN
)
}
localRepository
.
clearAllFromServer
(
currentServer
)
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/main/presentation/MainView.kt
0 → 100644
View file @
e6ecb84b
package
chat.rocket.android.main.presentation
import
chat.rocket.android.core.behaviours.MessageView
interface
MainView
:
MessageView
{
/**
* User has successfully logged out from the current server.
**/
fun
onLogout
()
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/main/ui/MainActivity.kt
View file @
e6ecb84b
package
chat.rocket.android.main.ui
package
chat.rocket.android.main.ui
import
android.content.Intent
import
android.os.Bundle
import
android.os.Bundle
import
android.support.v4.app.Fragment
import
android.support.v4.app.Fragment
import
android.support.v7.app.AppCompatActivity
import
android.support.v7.app.AppCompatActivity
import
android.view.Gravity
import
android.view.Gravity
import
android.view.MenuItem
import
android.view.MenuItem
import
chat.rocket.android.R
import
chat.rocket.android.R
import
chat.rocket.android.chatrooms.ui.ChatRoomsFragment
import
chat.rocket.android.authentication.ui.AuthenticationActivity
import
chat.rocket.android.profile.ui.ProfileFragment
import
chat.rocket.android.main.presentation.MainPresenter
import
chat.rocket.android.util.extensions.addFragment
import
chat.rocket.android.main.presentation.MainView
import
chat.rocket.android.util.extensions.showToast
import
dagger.android.AndroidInjection
import
dagger.android.AndroidInjection
import
dagger.android.AndroidInjector
import
dagger.android.AndroidInjector
import
dagger.android.DispatchingAndroidInjector
import
dagger.android.DispatchingAndroidInjector
...
@@ -17,8 +19,9 @@ import kotlinx.android.synthetic.main.activity_main.*
...
@@ -17,8 +19,9 @@ import kotlinx.android.synthetic.main.activity_main.*
import
kotlinx.android.synthetic.main.app_bar.*
import
kotlinx.android.synthetic.main.app_bar.*
import
javax.inject.Inject
import
javax.inject.Inject
class
MainActivity
:
AppCompatActivity
(),
HasSupportFragmentInjector
{
class
MainActivity
:
AppCompatActivity
(),
MainView
,
HasSupportFragmentInjector
{
@Inject
lateinit
var
fragmentDispatchingAndroidInjector
:
DispatchingAndroidInjector
<
Fragment
>
@Inject
lateinit
var
fragmentDispatchingAndroidInjector
:
DispatchingAndroidInjector
<
Fragment
>
@Inject
lateinit
var
presenter
:
MainPresenter
private
var
isFragmentAdded
:
Boolean
=
false
private
var
isFragmentAdded
:
Boolean
=
false
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
...
@@ -33,12 +36,24 @@ class MainActivity : AppCompatActivity(), HasSupportFragmentInjector {
...
@@ -33,12 +36,24 @@ class MainActivity : AppCompatActivity(), HasSupportFragmentInjector {
override
fun
onResume
()
{
override
fun
onResume
()
{
super
.
onResume
()
super
.
onResume
()
if
(!
isFragmentAdded
)
{
if
(!
isFragmentAdded
)
{
// Adding the first fragment.
presenter
.
toChatList
()
addFragment
(
"ChatRoomsFragment"
)
isFragmentAdded
=
true
isFragmentAdded
=
true
}
}
}
}
override
fun
onLogout
()
{
finish
()
val
intent
=
Intent
(
this
,
AuthenticationActivity
::
class
.
java
)
intent
.
addFlags
(
Intent
.
FLAG_ACTIVITY_CLEAR_TASK
or
Intent
.
FLAG_ACTIVITY_NEW_TASK
)
startActivity
(
intent
)
}
override
fun
showMessage
(
resId
:
Int
)
=
showToast
(
resId
)
override
fun
showMessage
(
message
:
String
)
=
showToast
(
message
)
override
fun
showGenericErrorMessage
()
=
showMessage
(
getString
(
R
.
string
.
msg_generic_error
))
override
fun
supportFragmentInjector
():
AndroidInjector
<
Fragment
>
=
fragmentDispatchingAndroidInjector
override
fun
supportFragmentInjector
():
AndroidInjector
<
Fragment
>
=
fragmentDispatchingAndroidInjector
private
fun
setupToolbar
()
{
private
fun
setupToolbar
()
{
...
@@ -61,21 +76,14 @@ class MainActivity : AppCompatActivity(), HasSupportFragmentInjector {
...
@@ -61,21 +76,14 @@ class MainActivity : AppCompatActivity(), HasSupportFragmentInjector {
private
fun
onNavDrawerItemSelected
(
menuItem
:
MenuItem
)
{
private
fun
onNavDrawerItemSelected
(
menuItem
:
MenuItem
)
{
when
(
menuItem
.
itemId
)
{
when
(
menuItem
.
itemId
)
{
R
.
id
.
action_chat_rooms
->
{
R
.
id
.
action_chat_rooms
->
{
addFragment
(
"ChatRoomsFragment"
,
R
.
id
.
fragment_container
)
{
presenter
.
toChatList
()
ChatRoomsFragment
.
newInstance
()
}
}
}
R
.
id
.
action_profile
->
{
R
.
id
.
action_profile
->
{
addFragment
(
"ProfileFragment"
,
R
.
id
.
fragment_container
)
{
presenter
.
toUserProfile
()
ProfileFragment
.
newInstance
()
}
}
R
.
id
.
action_logout
->
{
presenter
.
logout
()
}
}
}
}
private
fun
addFragment
(
tag
:
String
)
{
addFragment
(
tag
,
R
.
id
.
fragment_container
)
{
ChatRoomsFragment
.
newInstance
()
}
}
}
}
}
}
\ No newline at end of file
app/src/main/res/anim/close_enter.xml
View file @
e6ecb84b
...
@@ -6,13 +6,15 @@
...
@@ -6,13 +6,15 @@
android:fillEnabled=
"true"
android:fillEnabled=
"true"
android:shareInterpolator=
"false"
android:shareInterpolator=
"false"
android:zAdjustment=
"top"
>
android:zAdjustment=
"top"
>
<alpha
<alpha
android:duration=
"
25
0"
android:duration=
"
10
0"
android:fromAlpha=
"0.2"
android:fromAlpha=
"0.2"
android:interpolator=
"@anim/accelerate_cubic"
android:interpolator=
"@anim/accelerate_cubic"
android:toAlpha=
"1.0"
/>
android:toAlpha=
"1.0"
/>
<scale
<scale
android:duration=
"
25
0"
android:duration=
"
10
0"
android:fromXScale=
"0.9"
android:fromXScale=
"0.9"
android:fromYScale=
"0.9"
android:fromYScale=
"0.9"
android:interpolator=
"@anim/accelerate_cubic"
android:interpolator=
"@anim/accelerate_cubic"
...
@@ -20,4 +22,5 @@
...
@@ -20,4 +22,5 @@
android:pivotY=
"50.0%p"
android:pivotY=
"50.0%p"
android:toXScale=
"1.0"
android:toXScale=
"1.0"
android:toYScale=
"1.0"
/>
android:toYScale=
"1.0"
/>
</set>
</set>
\ No newline at end of file
app/src/main/res/anim/close_exit.xml
View file @
e6ecb84b
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android=
"http://schemas.android.com/apk/res/android"
<set
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:zAdjustment=
"top"
>
android:zAdjustment=
"top"
>
<translate
<translate
android:duration=
"
25
0"
android:duration=
"
10
0"
android:fromXDelta=
"0.0%p"
android:fromXDelta=
"0.0%p"
android:interpolator=
"@anim/accelerate_cubic"
android:interpolator=
"@anim/accelerate_cubic"
android:toXDelta=
"100.0%p"
/>
android:toXDelta=
"100.0%p"
/>
</set>
</set>
\ No newline at end of file
app/src/main/res/anim/open_enter.xml
View file @
e6ecb84b
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android=
"http://schemas.android.com/apk/res/android"
<set
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:zAdjustment=
"top"
>
android:zAdjustment=
"top"
>
<translate
<translate
android:duration=
"
25
0"
android:duration=
"
10
0"
android:fromXDelta=
"100.0%p"
android:fromXDelta=
"100.0%p"
android:interpolator=
"@anim/decelerate_cubic"
android:interpolator=
"@anim/decelerate_cubic"
android:toXDelta=
"0.0%p"
/>
android:toXDelta=
"0.0%p"
/>
</set>
</set>
\ No newline at end of file
app/src/main/res/anim/open_exit.xml
View file @
e6ecb84b
...
@@ -6,13 +6,15 @@
...
@@ -6,13 +6,15 @@
android:fillEnabled=
"true"
android:fillEnabled=
"true"
android:shareInterpolator=
"false"
android:shareInterpolator=
"false"
android:zAdjustment=
"normal"
>
android:zAdjustment=
"normal"
>
<alpha
<alpha
android:duration=
"
25
0"
android:duration=
"
10
0"
android:fromAlpha=
"1.0"
android:fromAlpha=
"1.0"
android:interpolator=
"@anim/decelerate_cubic"
android:interpolator=
"@anim/decelerate_cubic"
android:toAlpha=
"0.2"
/>
android:toAlpha=
"0.2"
/>
<scale
<scale
android:duration=
"
25
0"
android:duration=
"
10
0"
android:fromXScale=
"1.0"
android:fromXScale=
"1.0"
android:fromYScale=
"1.0"
android:fromYScale=
"1.0"
android:interpolator=
"@anim/decelerate_cubic"
android:interpolator=
"@anim/decelerate_cubic"
...
@@ -20,4 +22,5 @@
...
@@ -20,4 +22,5 @@
android:pivotY=
"50.0%p"
android:pivotY=
"50.0%p"
android:toXScale=
"0.9"
android:toXScale=
"0.9"
android:toYScale=
"0.9"
/>
android:toYScale=
"0.9"
/>
</set>
</set>
\ No newline at end of file
app/src/main/res/drawable/ic_exit_to_app_black_24dp.xml
0 → 100644
View file @
e6ecb84b
<vector
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:width=
"24dp"
android:height=
"24dp"
android:viewportHeight=
"24.0"
android:viewportWidth=
"24.0"
>
<path
android:fillColor=
"#FF000000"
android:pathData=
"M10.09,15.59L11.5,17l5,-5 -5,-5 -1.41,1.41L12.67,11H3v2h9.67l-2.58,2.59zM19,3H5c-1.11,0 -2,0.9 -2,2v4h2V5h14v14H5v-4H3v4c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2V5c0,-1.1 -0.9,-2 -2,-2z"
/>
</vector>
\ No newline at end of file
app/src/main/res/drawable/ic_settings_black_24dp.xml
0 → 100644
View file @
e6ecb84b
<vector
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:width=
"24dp"
android:height=
"24dp"
android:viewportWidth=
"24.0"
android:viewportHeight=
"24.0"
>
<path
android:fillColor=
"#FF000000"
android:pathData=
"M19.43,12.98c0.04,-0.32 0.07,-0.64 0.07,-0.98s-0.03,-0.66 -0.07,-0.98l2.11,-1.65c0.19,-0.15 0.24,-0.42 0.12,-0.64l-2,-3.46c-0.12,-0.22 -0.39,-0.3 -0.61,-0.22l-2.49,1c-0.52,-0.4 -1.08,-0.73 -1.69,-0.98l-0.38,-2.65C14.46,2.18 14.25,2 14,2h-4c-0.25,0 -0.46,0.18 -0.49,0.42l-0.38,2.65c-0.61,0.25 -1.17,0.59 -1.69,0.98l-2.49,-1c-0.23,-0.09 -0.49,0 -0.61,0.22l-2,3.46c-0.13,0.22 -0.07,0.49 0.12,0.64l2.11,1.65c-0.04,0.32 -0.07,0.65 -0.07,0.98s0.03,0.66 0.07,0.98l-2.11,1.65c-0.19,0.15 -0.24,0.42 -0.12,0.64l2,3.46c0.12,0.22 0.39,0.3 0.61,0.22l2.49,-1c0.52,0.4 1.08,0.73 1.69,0.98l0.38,2.65c0.03,0.24 0.24,0.42 0.49,0.42h4c0.25,0 0.46,-0.18 0.49,-0.42l0.38,-2.65c0.61,-0.25 1.17,-0.59 1.69,-0.98l2.49,1c0.23,0.09 0.49,0 0.61,-0.22l2,-3.46c0.12,-0.22 0.07,-0.49 -0.12,-0.64l-2.11,-1.65zM12,15.5c-1.93,0 -3.5,-1.57 -3.5,-3.5s1.57,-3.5 3.5,-3.5 3.5,1.57 3.5,3.5 -1.57,3.5 -3.5,3.5z"
/>
</vector>
app/src/main/res/drawable/style_message_file_upload_content_bg.xml
deleted
100644 → 0
View file @
49de7deb
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<solid
android:color=
"@color/colorBackgroundContentFileAttachment"
/>
<corners
android:radius=
"6dp"
/>
<stroke
android:width=
"2dp"
android:color=
"@color/colorDrawableTintGrey"
/>
</shape>
\ No newline at end of file
app/src/main/res/drawable/style_message_file_upload_layout_bg.xml
deleted
100644 → 0
View file @
49de7deb
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<solid
android:color=
"@color/colorBackgroundFileAttachment"
/>
<corners
android:radius=
"6dp"
/>
</shape>
\ No newline at end of file
app/src/main/res/layout/fragment_authentication_two_fa.xml
View file @
e6ecb84b
...
@@ -31,7 +31,6 @@
...
@@ -31,7 +31,6 @@
app:indicatorName=
"BallPulseIndicator"
app:indicatorName=
"BallPulseIndicator"
tools:visibility=
"visible"
/>
tools:visibility=
"visible"
/>
<Button
<Button
android:id=
"@+id/button_log_in"
android:id=
"@+id/button_log_in"
style=
"@style/AuthenticationButton"
style=
"@style/AuthenticationButton"
...
...
app/src/main/res/layout/item_chat.xml
View file @
e6ecb84b
...
@@ -14,76 +14,75 @@
...
@@ -14,76 +14,75 @@
layout=
"@layout/avatar"
layout=
"@layout/avatar"
android:layout_width=
"40dp"
android:layout_width=
"40dp"
android:layout_height=
"40dp"
android:layout_height=
"40dp"
a
pp:layout_constraintBottom_toBottomOf=
"parent
"
a
ndroid:layout_marginTop=
"6dp
"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toLeftOf=
"@+id/middle_container"
app:layout_constraintTop_toTopOf=
"parent"
/>
app:layout_constraintTop_toTopOf=
"parent"
/>
<android.support.constraint.ConstraintLayout
<android.support.constraint.ConstraintLayout
android:id=
"@+id/
middle
_container"
android:id=
"@+id/
top
_container"
android:layout_width=
"0dp"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginEnd=
"16dp"
android:layout_marginStart=
"16dp"
android:layout_marginStart=
"16dp"
app:layout_constraintLeft_toRightOf=
"@+id/layout_avatar"
app:layout_constraintLeft_toRightOf=
"@+id/layout_avatar"
app:layout_constraintRight_to
LeftOf=
"@+id/right_container
"
>
app:layout_constraintRight_to
RightOf=
"parent
"
>
<TextView
<TextView
android:id=
"@+id/text_chat_name"
android:id=
"@+id/text_chat_name"
style=
"@style/TextAppearance.AppCompat.Title"
style=
"@style/TextAppearance.AppCompat.Title"
android:layout_width=
"
wrap_content
"
android:layout_width=
"
0dp
"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:
drawablePadding=
"5dp
"
android:
alpha=
"0.6
"
android:ellipsize=
"end"
android:ellipsize=
"end"
android:maxLines=
"1"
android:maxLines=
"1"
android:textSize=
"16sp"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toLeftOf=
"@+id/text_last_message_date_time"
app:layout_constraintTop_toTopOf=
"parent"
tools:text=
"General"
/>
tools:text=
"General"
/>
<TextView
<TextView
android:id=
"@+id/text_last_message"
android:id=
"@+id/text_last_message_date_time"
android:layout_width=
"0dp"
style=
"@style/TextAppearance.AppCompat.Caption"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:ellipsize=
"end"
android:layout_marginStart=
"5dp"
android:maxLines=
"2"
android:textSize=
"10sp"
app:layout_constraintTop_toBottomOf=
"@+id/text_chat_name"
app:layout_constraintBaseline_toBaselineOf=
"@+id/text_chat_name"
tools:text=
"You: Type something"
/>
app:layout_constraintLeft_toRightOf=
"@+id/text_chat_name"
app:layout_constraintRight_toRightOf=
"parent"
tools:text=
"11:45 AM"
/>
</android.support.constraint.ConstraintLayout>
</android.support.constraint.ConstraintLayout>
<android.support.constraint.ConstraintLayout
<android.support.constraint.ConstraintLayout
android:id=
"@+id/
right
_container"
android:id=
"@+id/
bottom
_container"
android:layout_width=
"
wrap_content
"
android:layout_width=
"
0dp
"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
app:layout_constraintRight_toRightOf=
"parent"
>
android:layout_marginStart=
"16dp"
android:layout_marginTop=
"2dp"
app:layout_constraintLeft_toRightOf=
"@+id/layout_avatar"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/top_container"
>
<TextView
<TextView
android:id=
"@+id/text_last_message_date_time"
android:id=
"@+id/text_last_message"
style=
"@style/TextAppearance.AppCompat.Caption"
android:layout_width=
"0dp"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
app:layout_constraintBottom_toTopOf=
"@+id/guideline_one"
android:ellipsize=
"end"
app:layout_constraintRight_toRightOf=
"@+id/layout_unread_messages_badge"
android:maxLines=
"2"
tools:text=
"11:45"
/>
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toLeftOf=
"@+id/layout_unread_messages_badge"
app:layout_constraintTop_toTopOf=
"parent"
tools:text=
"You: Type something"
/>
<include
<include
android:id=
"@+id/layout_unread_messages_badge"
android:id=
"@+id/layout_unread_messages_badge"
layout=
"@layout/unread_messages_badge"
layout=
"@layout/unread_messages_badge"
android:layout_width=
"20dp"
android:layout_width=
"18dp"
android:layout_height=
"20dp"
android:layout_height=
"18dp"
app:layout_constraintBottom_toTopOf=
"@+id/guideline_two"
android:layout_marginStart=
"5dp"
app:layout_constraintRight_toRightOf=
"parent"
/>
app:layout_constraintLeft_toRightOf=
"@+id/text_last_message"
app:layout_constraintRight_toRightOf=
"parent"
<android.support.constraint.Guideline
app:layout_constraintBottom_toBottomOf=
"parent"
/>
android:id=
"@+id/guideline_one"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
app:layout_constraintGuide_begin=
"22dp"
/>
<android.support.constraint.Guideline
android:id=
"@+id/guideline_two"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
app:layout_constraintGuide_begin=
"48dp"
/>
</android.support.constraint.ConstraintLayout>
</android.support.constraint.ConstraintLayout>
</android.support.constraint.ConstraintLayout>
</android.support.constraint.ConstraintLayout>
\ No newline at end of file
app/src/main/res/layout/item_message.xml
View file @
e6ecb84b
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
layout=
"@layout/avatar"
layout=
"@layout/avatar"
android:layout_width=
"40dp"
android:layout_width=
"40dp"
android:layout_height=
"40dp"
android:layout_height=
"40dp"
android:layout_marginTop=
"
7
dp"
android:layout_marginTop=
"
5
dp"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
app:layout_constraintTop_toTopOf=
"parent"
/>
...
@@ -33,6 +33,7 @@
...
@@ -33,6 +33,7 @@
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:ellipsize=
"end"
android:ellipsize=
"end"
android:maxLines=
"1"
android:maxLines=
"1"
android:textSize=
"16sp"
tools:text=
"Ronald Perkins"
/>
tools:text=
"Ronald Perkins"
/>
<TextView
<TextView
...
@@ -41,15 +42,17 @@
...
@@ -41,15 +42,17 @@
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"10dp"
android:layout_marginStart=
"10dp"
android:textSize=
"10sp"
tools:text=
"11:45 pm"
/>
tools:text=
"11:45 pm"
/>
</LinearLayout>
</LinearLayout>
<TextView
<TextView
android:id=
"@+id/text_content"
android:id=
"@+id/text_content"
style=
"@style/TextAppearance.AppCompat.Subhead"
android:layout_width=
"0dp"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"5dp"
android:layout_marginTop=
"5dp"
android:textColor=
"@color/colorPrimaryText"
android:textSize=
"15sp"
app:layout_constraintLeft_toLeftOf=
"@id/top_container"
app:layout_constraintLeft_toLeftOf=
"@id/top_container"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/top_container"
app:layout_constraintTop_toBottomOf=
"@+id/top_container"
...
...
app/src/main/res/layout/message_attachment.xml
View file @
e6ecb84b
...
@@ -7,22 +7,6 @@
...
@@ -7,22 +7,6 @@
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
android:orientation=
"vertical"
>
<TextView
android:id=
"@+id/text_file_attachment"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:background=
"@drawable/style_message_file_upload_content_bg"
android:drawablePadding=
"10dp"
android:drawableStart=
"@drawable/ic_files_24dp"
android:ellipsize=
"end"
android:gravity=
"center"
android:maxLength=
"20"
android:maxLines=
"1"
android:padding=
"5dp"
android:visibility=
"gone"
tools:text=
"brazilian_anthem.mp4"
tools:visibility=
"visible"
/>
<com.facebook.drawee.view.SimpleDraweeView
<com.facebook.drawee.view.SimpleDraweeView
android:id=
"@+id/image_attachment"
android:id=
"@+id/image_attachment"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
...
...
app/src/main/res/layout/unread_messages_badge.xml
View file @
e6ecb84b
...
@@ -7,8 +7,8 @@
...
@@ -7,8 +7,8 @@
<TextView
<TextView
android:id=
"@+id/text_total_unread_messages"
android:id=
"@+id/text_total_unread_messages"
style=
"@style/TextAppearance.AppCompat.Caption"
style=
"@style/TextAppearance.AppCompat.Caption"
android:layout_width=
"
20
dp"
android:layout_width=
"
18
dp"
android:layout_height=
"
20
dp"
android:layout_height=
"
18
dp"
android:background=
"@drawable/style_total_unread_messages"
android:background=
"@drawable/style_total_unread_messages"
android:gravity=
"center"
android:gravity=
"center"
android:textColor=
"@color/white"
android:textColor=
"@color/white"
...
...
app/src/main/res/menu/chatrooms.xml
View file @
e6ecb84b
...
@@ -9,9 +9,4 @@
...
@@ -9,9 +9,4 @@
app:actionViewClass=
"android.support.v7.widget.SearchView"
app:actionViewClass=
"android.support.v7.widget.SearchView"
app:showAsAction=
"ifRoom|collapseActionView"
/>
app:showAsAction=
"ifRoom|collapseActionView"
/>
<item
android:id=
"@+id/action_logout"
android:title=
"@string/action_logout"
app:showAsAction=
"never"
/>
</menu>
</menu>
\ No newline at end of file
app/src/main/res/menu/navigation.xml
View file @
e6ecb84b
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<menu
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<menu
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<group
android:checkableBehavior=
"single"
>
<group
android:id=
"@+id/menu_section_1"
android:checkableBehavior=
"single"
>
<item
<item
android:id=
"@+id/action_chat_rooms"
android:id=
"@+id/action_chat_rooms"
android:checked=
"true"
android:checked=
"true"
...
@@ -13,4 +17,19 @@
...
@@ -13,4 +17,19 @@
android:title=
"@string/title_profile"
/>
android:title=
"@string/title_profile"
/>
</group>
</group>
<group
android:id=
"@+id/menu_section_2"
android:checkableBehavior=
"none"
>
<item
android:id=
"@+id/action_settings"
android:icon=
"@drawable/ic_settings_black_24dp"
android:title=
"@string/action_settings"
/>
<item
android:id=
"@+id/action_logout"
android:icon=
"@drawable/ic_exit_to_app_black_24dp"
android:title=
"@string/action_logout"
/>
</group>
</menu>
</menu>
\ No newline at end of file
app/src/main/res/values-pt-rBR/strings.xml
View file @
e6ecb84b
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
<string
name=
"action_privacy_policy"
>
Política de Privacidade
</string>
<string
name=
"action_privacy_policy"
>
Política de Privacidade
</string>
<string
name=
"action_search"
>
Pesquisar
</string>
<string
name=
"action_search"
>
Pesquisar
</string>
<string
name=
"action_update"
>
Atualizar
</string>
<string
name=
"action_update"
>
Atualizar
</string>
<string
name=
"action_settings"
>
Configurações
</string>
<string
name=
"action_logout"
>
Sair
</string>
<string
name=
"action_logout"
>
Sair
</string>
<string
name=
"action_files"
>
Arquivos
</string>
<string
name=
"action_files"
>
Arquivos
</string>
...
...
app/src/main/res/values/colors.xml
View file @
e6ecb84b
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<resources>
<color
name=
"ic_launcher_background"
>
#15293F
</color>
<!-- Main colors -->
<color
name=
"colorPrimary"
>
#FF303030
</color>
<!-- Material Grey 850 -->
<color
name=
"colorPrimary"
>
#FF303030
</color>
<!-- Material Grey 850 -->
<color
name=
"colorPrimaryDark"
>
#ff212121
</color>
<!-- Material Grey 900 -->
<color
name=
"colorPrimaryDark"
>
#ff212121
</color>
<!-- Material Grey 900 -->
<color
name=
"colorAccent"
>
#FF1976D2
</color>
<!-- Material Blue 700 -->
<color
name=
"colorAccent"
>
#FF1976D2
</color>
<!-- Material Blue 700 -->
<color
name=
"ic_launcher_background"
>
#15293F
</color>
<!-- Text colors -->
<color
name=
"colorPrimaryText"
>
#DE000000
</color>
<!-- User status colors -->
<color
name=
"colorUserStatusOnline"
>
#2FE1A8
</color>
<color
name=
"colorUserStatusOnline"
>
#2FE1A8
</color>
<color
name=
"colorUserStatusBusy"
>
#F33E5B
</color>
<color
name=
"colorUserStatusBusy"
>
#F33E5B
</color>
<color
name=
"colorUserStatusAway"
>
#FDD236
</color>
<color
name=
"colorUserStatusAway"
>
#FDD236
</color>
...
@@ -19,16 +24,10 @@
...
@@ -19,16 +24,10 @@
<color
name=
"colorDim"
>
#99000000
</color>
<color
name=
"colorDim"
>
#99000000
</color>
<color
name=
"colorBackgroundFileAttachment"
>
#E2FFC8
</color>
<color
name=
"colorBackgroundContentFileAttachment"
>
#FFD8F5C0
</color>
<color
name=
"white"
>
#FFFFFFFF
</color>
<color
name=
"white"
>
#FFFFFFFF
</color>
<color
name=
"black"
>
#FF000000
</color>
<color
name=
"black"
>
#FF000000
</color>
<color
name=
"red"
>
#FFFF0000
</color>
<color
name=
"red"
>
#FFFF0000
</color>
<color
name=
"darkGray"
>
#a0a0a0
</color>
<color
name=
"darkGray"
>
#a0a0a0
</color>
<color
name=
"actionMenuColor"
>
#727272
</color>
<color
name=
"actionMenuColor"
>
#727272
</color>
<color
name=
"linkTextColor"
>
#FF074481
</color>
<color
name=
"linkBackgroundColor"
>
#30074481
</color>
</resources>
</resources>
app/src/main/res/values/strings.xml
View file @
e6ecb84b
...
@@ -16,7 +16,8 @@
...
@@ -16,7 +16,8 @@
<string
name=
"action_privacy_policy"
>
Privacy Policy
</string>
<string
name=
"action_privacy_policy"
>
Privacy Policy
</string>
<string
name=
"action_search"
>
Search
</string>
<string
name=
"action_search"
>
Search
</string>
<string
name=
"action_update"
>
Update
</string>
<string
name=
"action_update"
>
Update
</string>
<string
name=
"action_logout"
>
Log Out
</string>
<string
name=
"action_settings"
>
Settings
</string>
<string
name=
"action_logout"
>
Logout
</string>
<string
name=
"action_files"
>
Files
</string>
<string
name=
"action_files"
>
Files
</string>
<!-- Regular information messages -->
<!-- Regular information messages -->
...
...
dependencies.gradle
View file @
e6ecb84b
...
@@ -11,7 +11,7 @@ ext {
...
@@ -11,7 +11,7 @@ ext {
// Main dependencies
// Main dependencies
support
:
'27.0.2'
,
support
:
'27.0.2'
,
constraintLayout
:
'1.0.2'
,
constraintLayout
:
'1.0.2'
,
dagger
:
'2.1
3
'
,
dagger
:
'2.1
4.1
'
,
exoPlayer
:
'2.6.0'
,
exoPlayer
:
'2.6.0'
,
playServices
:
'11.8.0'
,
playServices
:
'11.8.0'
,
room
:
'1.0.0'
,
room
:
'1.0.0'
,
...
...
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