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
e719508d
Unverified
Commit
e719508d
authored
Feb 23, 2018
by
Filipe de Lima Brito
Committed by
GitHub
Feb 23, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #794 from filipedelimabrito/improvement/layout
[FIX] Layout improvements
parents
308b7f48
e6581724
Changes
47
Show whitespace changes
Inline
Side-by-side
Showing
47 changed files
with
385 additions
and
250 deletions
+385
-250
build.gradle
app/build.gradle
+2
-0
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
ChatRoomActivity.kt
.../java/chat/rocket/android/chatroom/ui/ChatRoomActivity.kt
+5
-1
ChatRoomFragment.kt
.../java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
+3
-5
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
+4
-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
+52
-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
Animation.kt
...ain/java/chat/rocket/android/util/extensions/Animation.kt
+2
-2
DividerItemDecoration.kt
.../java/chat/rocket/android/widget/DividerItemDecoration.kt
+5
-5
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_log_in.xml
app/src/main/res/layout/fragment_authentication_log_in.xml
+4
-4
fragment_authentication_server.xml
app/src/main/res/layout/fragment_authentication_server.xml
+4
-4
fragment_authentication_sign_up.xml
app/src/main/res/layout/fragment_authentication_sign_up.xml
+6
-6
fragment_authentication_two_fa.xml
app/src/main/res/layout/fragment_authentication_two_fa.xml
+3
-4
fragment_profile.xml
app/src/main/res/layout/fragment_profile.xml
+3
-3
item_chat.xml
app/src/main/res/layout/item_chat.xml
+37
-42
item_message.xml
app/src/main/res/layout/item_message.xml
+5
-7
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
dimens.xml
app/src/main/res/values/dimens.xml
+3
-0
strings.xml
app/src/main/res/values/strings.xml
+2
-1
styles.xml
app/src/main/res/values/styles.xml
+37
-16
dependencies.gradle
dependencies.gradle
+4
-1
No files found.
app/build.gradle
View file @
e719508d
...
...
@@ -105,6 +105,8 @@ dependencies {
implementation
libraries
.
aVLoadingIndicatorView
implementation
libraries
.
swipeBackLayout
implementation
(
'com.crashlytics.sdk.android:crashlytics:2.6.8@aar'
)
{
transitive
=
true
}
...
...
app/src/main/java/chat/rocket/android/authentication/login/di/LoginFragmentProvider.kt
View file @
e719508d
...
...
@@ -6,6 +6,6 @@ import dagger.android.ContributesAndroidInjector
@Module
abstract
class
LoginFragmentProvider
{
@ContributesAndroidInjector
(
modules
=
[
(
LoginFragmentModule
::
class
)
])
@ContributesAndroidInjector
(
modules
=
[
LoginFragmentModule
::
class
])
abstract
fun
provideLoginFragment
():
LoginFragment
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/authentication/presentation/AuthenticationNavigator.kt
View file @
e719508d
...
...
@@ -12,20 +12,21 @@ import chat.rocket.android.util.extensions.addFragmentBackStack
import
chat.rocket.android.webview.webViewIntent
class
AuthenticationNavigator
(
internal
val
activity
:
AuthenticationActivity
,
internal
val
context
:
Context
)
{
fun
toLogin
()
{
activity
.
addFragmentBackStack
(
"
l
oginFragment"
,
R
.
id
.
fragment_container
)
{
activity
.
addFragmentBackStack
(
"
L
oginFragment"
,
R
.
id
.
fragment_container
)
{
LoginFragment
.
newInstance
()
}
}
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
)
}
}
fun
toSignUp
()
{
activity
.
addFragmentBackStack
(
"
s
ignupFragment"
,
R
.
id
.
fragment_container
)
{
activity
.
addFragmentBackStack
(
"
S
ignupFragment"
,
R
.
id
.
fragment_container
)
{
SignupFragment
.
newInstance
()
}
}
...
...
app/src/main/java/chat/rocket/android/authentication/server/di/ServerFragmentProvider.kt
View file @
e719508d
...
...
@@ -4,8 +4,9 @@ import chat.rocket.android.authentication.server.ui.ServerFragment
import
dagger.Module
import
dagger.android.ContributesAndroidInjector
@Module
abstract
class
ServerFragmentProvider
{
@Module
abstract
class
ServerFragmentProvider
{
@ContributesAndroidInjector
(
modules
=
[
(
ServerFragmentModule
::
class
)
])
@ContributesAndroidInjector
(
modules
=
[
ServerFragmentModule
::
class
])
abstract
fun
provideServerFragment
():
ServerFragment
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/chatroom/di/PinnedMessagesFragmentModule.kt
View file @
e719508d
...
...
@@ -24,7 +24,7 @@ class PinnedMessagesFragmentModule {
}
@Provides
fun
providePinnedMessageView
(
frag
:
PinnedMessagesFragment
):
PinnedMessagesView
{
fun
providePinnedMessage
s
View
(
frag
:
PinnedMessagesFragment
):
PinnedMessagesView
{
return
frag
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/chatroom/ui/ChatRoomActivity.kt
View file @
e719508d
...
...
@@ -13,6 +13,8 @@ import dagger.android.AndroidInjector
import
dagger.android.DispatchingAndroidInjector
import
dagger.android.support.HasSupportFragmentInjector
import
kotlinx.android.synthetic.main.app_bar_chat_room.*
import
me.imid.swipebacklayout.lib.SwipeBackLayout
import
me.imid.swipebacklayout.lib.app.SwipeBackActivity
import
javax.inject.Inject
...
...
@@ -30,7 +32,7 @@ private const val INTENT_CHAT_ROOM_NAME = "chat_room_name"
private
const
val
INTENT_CHAT_ROOM_TYPE
=
"chat_room_type"
private
const
val
INTENT_IS_CHAT_ROOM_READ_ONLY
=
"is_chat_room_read_only"
class
ChatRoomActivity
:
AppCompat
Activity
(),
HasSupportFragmentInjector
{
class
ChatRoomActivity
:
SwipeBack
Activity
(),
HasSupportFragmentInjector
{
@Inject
lateinit
var
fragmentDispatchingAndroidInjector
:
DispatchingAndroidInjector
<
Fragment
>
private
lateinit
var
chatRoomId
:
String
private
lateinit
var
chatRoomName
:
String
...
...
@@ -54,6 +56,8 @@ class ChatRoomActivity : AppCompatActivity(), HasSupportFragmentInjector {
isChatRoomReadOnly
=
intent
.
getBooleanExtra
(
INTENT_IS_CHAT_ROOM_READ_ONLY
,
true
)
requireNotNull
(
chatRoomType
)
{
"no is_chat_room_read_only provided in Intent extras"
}
swipeBackLayout
.
setEdgeTrackingEnabled
(
SwipeBackLayout
.
EDGE_LEFT
)
setupToolbar
(
chatRoomName
)
addFragment
(
"ChatRoomFragment"
,
R
.
id
.
fragment_container
)
{
...
...
app/src/main/java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
View file @
e719508d
...
...
@@ -247,10 +247,8 @@ class ChatRoomFragment : Fragment(), ChatRoomView {
if
(!
recyclerView
.
canScrollVertically
(
1
))
{
button_fab
.
hide
()
}
else
{
if
(
dy
>
0
&&
!
button_fab
.
isVisible
())
{
if
(
dy
<
0
&&
!
button_fab
.
isVisible
())
{
button_fab
.
show
()
}
else
if
(
dy
<
0
&&
button_fab
.
isVisible
())
{
button_fab
.
hide
()
}
}
}
...
...
@@ -292,11 +290,11 @@ class ChatRoomFragment : Fragment(), ChatRoomView {
button_files
.
setOnClickListener
{
handler
.
postDelayed
({
presenter
.
selectFile
()
},
3
00
)
},
2
00
)
handler
.
postDelayed
({
hideAttachmentOptions
()
},
6
00
)
},
4
00
)
}
}
}
...
...
app/src/main/java/chat/rocket/android/chatrooms/presentation/ChatRoomsPresenter.kt
View file @
e719508d
package
chat.rocket.android.chatrooms.presentation
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.GetCurrentServerInteractor
import
chat.rocket.android.server.domain.RefreshSettingsInteractor
...
...
@@ -13,8 +12,6 @@ import chat.rocket.core.RocketChatClient
import
chat.rocket.core.internal.model.Subscription
import
chat.rocket.core.internal.realtime.*
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.Room
import
kotlinx.coroutines.experimental.*
...
...
@@ -28,7 +25,6 @@ class ChatRoomsPresenter @Inject constructor(private val view: ChatRoomsView,
private
val
serverInteractor
:
GetCurrentServerInteractor
,
private
val
getChatRoomsInteractor
:
GetChatRoomsInteractor
,
private
val
saveChatRoomsInteractor
:
SaveChatRoomsInteractor
,
private
val
localRepository
:
LocalRepository
,
private
val
refreshSettingsInteractor
:
RefreshSettingsInteractor
,
factory
:
RocketChatClientFactory
)
{
private
val
client
:
RocketChatClient
=
factory
.
create
(
serverInteractor
.
get
()
!!
)
...
...
@@ -265,32 +261,4 @@ class ChatRoomsPresenter @Inject constructor(private val view: ChatRoomsView,
client
.
removeStateChannel
(
stateChannel
)
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 @
e719508d
...
...
@@ -9,7 +9,7 @@ interface ChatRoomsView : LoadingView, MessageView {
/**
* 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
>)
...
...
@@ -17,9 +17,4 @@ interface ChatRoomsView : LoadingView, MessageView {
* Shows no chat rooms to display.
*/
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 @
e719508d
...
...
@@ -2,6 +2,7 @@ package chat.rocket.android.chatrooms.ui
import
DateTimeHelper
import
android.content.Context
import
android.support.v4.content.res.ResourcesCompat
import
android.support.v7.widget.RecyclerView
import
android.view.View
import
android.view.ViewGroup
...
...
@@ -43,6 +44,12 @@ class ChatRoomsAdapter(private val context: Context,
bindLastMessage
(
chatRoom
,
text_last_message
)
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
)
}
}
...
...
app/src/main/java/chat/rocket/android/chatrooms/ui/ChatRoomsFragment.kt
View file @
e719508d
package
chat.rocket.android.chatrooms.ui
import
android.content.Intent
import
android.os.Bundle
import
android.support.v4.app.Fragment
import
android.support.v7.app.AppCompatActivity
...
...
@@ -10,7 +9,6 @@ import android.support.v7.widget.LinearLayoutManager
import
android.support.v7.widget.SearchView
import
android.view.*
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.ChatRoomsView
import
chat.rocket.android.util.extensions.inflate
...
...
@@ -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
>)
{
activity
.
apply
{
launch
(
UI
)
{
...
...
@@ -105,15 +96,6 @@ class ChatRoomsFragment : Fragment(), ChatRoomsView {
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
()
{
(
activity
as
AppCompatActivity
).
supportActionBar
?.
title
=
getString
(
R
.
string
.
title_chats
)
}
...
...
@@ -121,7 +103,9 @@ class ChatRoomsFragment : Fragment(), ChatRoomsView {
private
fun
setupRecyclerView
()
{
activity
?.
apply
{
recycler_view
.
layoutManager
=
LinearLayoutManager
(
this
,
LinearLayoutManager
.
VERTICAL
,
false
)
recycler_view
.
addItemDecoration
(
DividerItemDecoration
(
this
,
144
,
32
))
recycler_view
.
addItemDecoration
(
DividerItemDecoration
(
this
,
resources
.
getDimensionPixelSize
(
R
.
dimen
.
divider_item_decorator_bound_start
),
resources
.
getDimensionPixelSize
(
R
.
dimen
.
divider_item_decorator_bound_end
)))
recycler_view
.
itemAnimator
=
DefaultItemAnimator
()
recycler_view
.
adapter
=
ChatRoomsAdapter
(
this
)
{
chatRoom
->
presenter
.
loadChatRoom
(
chatRoom
)
...
...
app/src/main/java/chat/rocket/android/dagger/module/ActivityBuilder.kt
View file @
e719508d
...
...
@@ -13,6 +13,8 @@ import chat.rocket.android.chatroom.ui.PinnedMessagesActivity
import
chat.rocket.android.chatrooms.di.ChatRoomsFragmentProvider
import
chat.rocket.android.chatrooms.di.ChatRoomsModule
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.profile.di.ProfileFragmentProvider
import
dagger.Module
...
...
@@ -31,7 +33,12 @@ abstract class ActivityBuilder {
abstract
fun
bindAuthenticationActivity
():
AuthenticationActivity
@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
@PerActivity
...
...
app/src/main/java/chat/rocket/android/helper/MessageParser.kt
View file @
e719508d
...
...
@@ -7,6 +7,7 @@ import android.graphics.Color
import
android.graphics.Paint
import
android.graphics.Typeface
import
android.graphics.drawable.Drawable
import
android.support.v4.content.res.ResourcesCompat
import
android.text.Layout
import
android.text.Spannable
import
android.text.Spanned
...
...
@@ -78,8 +79,8 @@ class MessageParser @Inject constructor(val context: Application, private val co
val
user
=
matcher
.
group
(
2
)
val
start
=
matcher
.
start
(
2
)
//TODO: should check if username actually exists prior to applying.
val
linkColor
=
context
.
resources
.
getColor
(
R
.
color
.
linkTextColor
)
val
linkBackgroundColor
=
context
.
resources
.
getColor
(
R
.
color
.
linkBackgroundColor
)
val
linkColor
=
ResourcesCompat
.
getColor
(
context
.
resources
,
R
.
color
.
white
,
null
)
val
linkBackgroundColor
=
ResourcesCompat
.
getColor
(
context
.
resources
,
R
.
color
.
colorAccent
,
null
)
val
referSelf
=
currentUser
!=
null
&&
"@$currentUser"
==
user
val
usernameSpan
=
UsernameClickableSpan
(
linkBackgroundColor
,
linkColor
,
referSelf
)
result
.
setSpan
(
usernameSpan
,
start
,
start
+
user
.
length
,
0
)
...
...
app/src/main/java/chat/rocket/android/main/di/MainActivityModule.kt
0 → 100644
View file @
e719508d
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 @
e719508d
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 @
e719508d
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 @
e719508d
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 @
e719508d
package
chat.rocket.android.main.presentation
import
chat.rocket.android.infrastructure.LocalRepository
import
chat.rocket.android.server.domain.GetCurrentServerInteractor
import
chat.rocket.android.server.infraestructure.RocketChatClientFactory
import
chat.rocket.common.RocketChatException
import
chat.rocket.core.RocketChatClient
import
chat.rocket.core.internal.realtime.disconnect
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
()
{
// TODO: inject CancelStrategy, and MainView.
// 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 @
e719508d
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 @
e719508d
package
chat.rocket.android.main.ui
import
android.content.Intent
import
android.os.Bundle
import
android.support.v4.app.Fragment
import
android.support.v7.app.AppCompatActivity
import
android.view.Gravity
import
android.view.MenuItem
import
chat.rocket.android.R
import
chat.rocket.android.chatrooms.ui.ChatRoomsFragment
import
chat.rocket.android.profile.ui.ProfileFragment
import
chat.rocket.android.util.extensions.addFragment
import
chat.rocket.android.authentication.ui.AuthenticationActivity
import
chat.rocket.android.main.presentation.MainPresenter
import
chat.rocket.android.main.presentation.MainView
import
chat.rocket.android.util.extensions.showToast
import
dagger.android.AndroidInjection
import
dagger.android.AndroidInjector
import
dagger.android.DispatchingAndroidInjector
...
...
@@ -17,8 +19,9 @@ import kotlinx.android.synthetic.main.activity_main.*
import
kotlinx.android.synthetic.main.app_bar.*
import
javax.inject.Inject
class
MainActivity
:
AppCompatActivity
(),
HasSupportFragmentInjector
{
class
MainActivity
:
AppCompatActivity
(),
MainView
,
HasSupportFragmentInjector
{
@Inject
lateinit
var
fragmentDispatchingAndroidInjector
:
DispatchingAndroidInjector
<
Fragment
>
@Inject
lateinit
var
presenter
:
MainPresenter
private
var
isFragmentAdded
:
Boolean
=
false
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
...
...
@@ -33,12 +36,24 @@ class MainActivity : AppCompatActivity(), HasSupportFragmentInjector {
override
fun
onResume
()
{
super
.
onResume
()
if
(!
isFragmentAdded
)
{
// Adding the first fragment.
addFragment
(
"ChatRoomsFragment"
)
presenter
.
toChatList
()
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
private
fun
setupToolbar
()
{
...
...
@@ -61,21 +76,14 @@ class MainActivity : AppCompatActivity(), HasSupportFragmentInjector {
private
fun
onNavDrawerItemSelected
(
menuItem
:
MenuItem
)
{
when
(
menuItem
.
itemId
)
{
R
.
id
.
action_chat_rooms
->
{
addFragment
(
"ChatRoomsFragment"
,
R
.
id
.
fragment_container
)
{
ChatRoomsFragment
.
newInstance
()
}
presenter
.
toChatList
()
}
R
.
id
.
action_profile
->
{
addFragment
(
"ProfileFragment"
,
R
.
id
.
fragment_container
)
{
ProfileFragment
.
newInstance
()
}
presenter
.
toUserProfile
()
}
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/java/chat/rocket/android/util/extensions/Animation.kt
View file @
e719508d
...
...
@@ -5,7 +5,7 @@ import android.view.ViewAnimationUtils
import
android.view.animation.AccelerateInterpolator
import
android.view.animation.DecelerateInterpolator
fun
View
.
rotateBy
(
value
:
Float
,
duration
:
Long
=
2
00
)
{
fun
View
.
rotateBy
(
value
:
Float
,
duration
:
Long
=
1
00
)
{
animate
()
.
rotationBy
(
value
)
.
setDuration
(
duration
)
...
...
@@ -42,7 +42,7 @@ fun View.fadeOut(startValue: Float, finishValue: Float, duration: Long = 200) {
setVisible
(
false
)
}
fun
View
.
circularRevealOrUnreveal
(
centerX
:
Int
,
centerY
:
Int
,
startRadius
:
Float
,
endRadius
:
Float
,
duration
:
Long
=
6
00
)
{
fun
View
.
circularRevealOrUnreveal
(
centerX
:
Int
,
centerY
:
Int
,
startRadius
:
Float
,
endRadius
:
Float
,
duration
:
Long
=
2
00
)
{
val
anim
=
ViewAnimationUtils
.
createCircularReveal
(
this
,
centerX
,
centerY
,
startRadius
,
endRadius
)
anim
.
duration
=
duration
...
...
app/src/main/java/chat/rocket/android/widget/DividerItemDecoration.kt
View file @
e719508d
...
...
@@ -14,7 +14,7 @@ import android.support.v7.widget.RecyclerView
class
DividerItemDecoration
()
:
RecyclerView
.
ItemDecoration
()
{
private
lateinit
var
divider
:
Drawable
private
var
boundStart
=
0
private
var
bound
Right
=
0
private
var
bound
End
=
0
// Default divider will be used.
constructor
(
context
:
Context
)
:
this
()
{
...
...
@@ -24,15 +24,15 @@ class DividerItemDecoration() : RecyclerView.ItemDecoration() {
styledAttributes
.
recycle
()
}
// Default divider with custom boundaries (start and
right
) will be used.
constructor
(
context
:
Context
,
boundStart
:
Int
,
bound
Right
:
Int
)
:
this
()
{
// Default divider with custom boundaries (start and
end
) will be used.
constructor
(
context
:
Context
,
boundStart
:
Int
,
bound
End
:
Int
)
:
this
()
{
val
attrs
=
intArrayOf
(
android
.
R
.
attr
.
listDivider
)
val
styledAttributes
=
context
.
obtainStyledAttributes
(
attrs
)
divider
=
styledAttributes
.
getDrawable
(
0
)
styledAttributes
.
recycle
()
this
.
boundStart
=
boundStart
this
.
bound
Right
=
boundRight
this
.
bound
End
=
boundEnd
}
// Custom divider will be used.
...
...
@@ -45,7 +45,7 @@ class DividerItemDecoration() : RecyclerView.ItemDecoration() {
override
fun
onDraw
(
c
:
Canvas
,
parent
:
RecyclerView
,
state
:
RecyclerView
.
State
)
{
val
left
=
parent
.
paddingLeft
+
boundStart
val
right
=
(
parent
.
width
-
parent
.
paddingRight
)
-
bound
Right
val
right
=
(
parent
.
width
-
parent
.
paddingRight
)
-
bound
End
val
childCount
=
parent
.
childCount
for
(
i
in
0
until
childCount
)
{
...
...
app/src/main/res/anim/close_enter.xml
View file @
e719508d
...
...
@@ -6,13 +6,15 @@
android:fillEnabled=
"true"
android:shareInterpolator=
"false"
android:zAdjustment=
"top"
>
<alpha
android:duration=
"
25
0"
android:duration=
"
10
0"
android:fromAlpha=
"0.2"
android:interpolator=
"@anim/accelerate_cubic"
android:toAlpha=
"1.0"
/>
<scale
android:duration=
"
25
0"
android:duration=
"
10
0"
android:fromXScale=
"0.9"
android:fromYScale=
"0.9"
android:interpolator=
"@anim/accelerate_cubic"
...
...
@@ -20,4 +22,5 @@
android:pivotY=
"50.0%p"
android:toXScale=
"1.0"
android:toYScale=
"1.0"
/>
</set>
\ No newline at end of file
app/src/main/res/anim/close_exit.xml
View file @
e719508d
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:zAdjustment=
"top"
>
<translate
android:duration=
"
25
0"
android:duration=
"
10
0"
android:fromXDelta=
"0.0%p"
android:interpolator=
"@anim/accelerate_cubic"
android:toXDelta=
"100.0%p"
/>
</set>
\ No newline at end of file
app/src/main/res/anim/open_enter.xml
View file @
e719508d
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:zAdjustment=
"top"
>
<translate
android:duration=
"
25
0"
android:duration=
"
10
0"
android:fromXDelta=
"100.0%p"
android:interpolator=
"@anim/decelerate_cubic"
android:toXDelta=
"0.0%p"
/>
</set>
\ No newline at end of file
app/src/main/res/anim/open_exit.xml
View file @
e719508d
...
...
@@ -6,13 +6,15 @@
android:fillEnabled=
"true"
android:shareInterpolator=
"false"
android:zAdjustment=
"normal"
>
<alpha
android:duration=
"
25
0"
android:duration=
"
10
0"
android:fromAlpha=
"1.0"
android:interpolator=
"@anim/decelerate_cubic"
android:toAlpha=
"0.2"
/>
<scale
android:duration=
"
25
0"
android:duration=
"
10
0"
android:fromXScale=
"1.0"
android:fromYScale=
"1.0"
android:interpolator=
"@anim/decelerate_cubic"
...
...
@@ -20,4 +22,5 @@
android:pivotY=
"50.0%p"
android:toXScale=
"0.9"
android:toYScale=
"0.9"
/>
</set>
\ No newline at end of file
app/src/main/res/drawable/ic_exit_to_app_black_24dp.xml
0 → 100644
View file @
e719508d
<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 @
e719508d
<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 @
308b7f48
<?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 @
308b7f48
<?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_log_in.xml
View file @
e719508d
...
...
@@ -15,7 +15,7 @@
<TextView
android:id=
"@+id/text_headline"
style=
"@style/
Headline
TextView"
style=
"@style/
Authentication.Headline.
TextView"
android:text=
"@string/title_log_in"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
...
...
@@ -23,7 +23,7 @@
<EditText
android:id=
"@+id/text_username_or_email"
style=
"@style/
EditText.Authentication
"
style=
"@style/
Authentication.EditText
"
android:layout_marginTop=
"32dp"
android:drawableStart=
"@drawable/ic_assignment_ind_black_24dp"
android:hint=
"@string/msg_username_or_email"
...
...
@@ -35,7 +35,7 @@
<EditText
android:id=
"@+id/text_password"
style=
"@style/
EditText.Authentication
"
style=
"@style/
Authentication.EditText
"
android:layout_marginTop=
"16dp"
android:drawableStart=
"@drawable/ic_lock_black_24dp"
android:hint=
"@string/msg_password"
...
...
@@ -193,7 +193,7 @@
<Button
android:id=
"@+id/button_log_in"
style=
"@style/AuthenticationButton"
style=
"@style/Authentication
.
Button"
android:text=
"@string/title_log_in"
android:visibility=
"visible"
app:layout_constraintBottom_toBottomOf=
"parent"
...
...
app/src/main/res/layout/fragment_authentication_server.xml
View file @
e719508d
...
...
@@ -10,13 +10,13 @@
<TextView
android:id=
"@+id/text_headline"
style=
"@style/
Headline
TextView"
style=
"@style/
Authentication.Headline.
TextView"
android:layout_centerHorizontal=
"true"
android:text=
"@string/title_sign_in_your_server"
/>
<TextView
android:id=
"@+id/text_server_protocol"
style=
"@style/Authentication
Label
"
style=
"@style/Authentication
.TextView
"
android:layout_below=
"@id/text_headline"
android:layout_marginTop=
"32dp"
android:gravity=
"center_vertical"
...
...
@@ -24,7 +24,7 @@
<EditText
android:id=
"@+id/text_server_url"
style=
"@style/
EditText.Authentication
"
style=
"@style/
Authentication.EditText
"
android:layout_below=
"@id/text_headline"
android:layout_marginStart=
"0dp"
android:layout_marginTop=
"32dp"
...
...
@@ -48,7 +48,7 @@
<Button
android:id=
"@+id/button_connect"
style=
"@style/AuthenticationButton"
style=
"@style/Authentication
.
Button"
android:layout_alignParentBottom=
"true"
android:text=
"@string/action_connect"
/>
...
...
app/src/main/res/layout/fragment_authentication_sign_up.xml
View file @
e719508d
...
...
@@ -9,7 +9,7 @@
<TextView
android:id=
"@+id/text_headline"
style=
"@style/
Headline
TextView"
style=
"@style/
Authentication.Headline.
TextView"
android:text=
"@string/title_sign_up"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
...
...
@@ -17,7 +17,7 @@
<EditText
android:id=
"@+id/text_name"
style=
"@style/
EditText.Authentication
"
style=
"@style/
Authentication.EditText
"
android:layout_marginTop=
"32dp"
android:drawableStart=
"@drawable/ic_person_black_24dp"
android:hint=
"@string/msg_name"
...
...
@@ -29,7 +29,7 @@
<EditText
android:id=
"@+id/text_username"
style=
"@style/
EditText.Authentication
"
style=
"@style/
Authentication.EditText
"
android:layout_marginTop=
"16dp"
android:drawableStart=
"@drawable/ic_at_black_24dp"
android:hint=
"@string/msg_username"
...
...
@@ -41,7 +41,7 @@
<EditText
android:id=
"@+id/text_password"
style=
"@style/
EditText.Authentication
"
style=
"@style/
Authentication.EditText
"
android:layout_marginTop=
"16dp"
android:drawableStart=
"@drawable/ic_lock_black_24dp"
android:hint=
"@string/msg_password"
...
...
@@ -53,7 +53,7 @@
<EditText
android:id=
"@+id/text_email"
style=
"@style/
EditText.Authentication
"
style=
"@style/
Authentication.EditText
"
android:layout_marginTop=
"16dp"
android:drawableStart=
"@drawable/ic_email_black_24dp"
android:hint=
"@string/msg_email"
...
...
@@ -91,7 +91,7 @@
<Button
android:id=
"@+id/button_sign_up"
style=
"@style/AuthenticationButton"
style=
"@style/Authentication
.
Button"
android:text=
"@string/title_sign_up"
app:layout_constraintBottom_toBottomOf=
"parent"
/>
...
...
app/src/main/res/layout/fragment_authentication_two_fa.xml
View file @
e719508d
...
...
@@ -8,13 +8,13 @@
<TextView
android:id=
"@+id/text_headline"
style=
"@style/
Headline
TextView"
style=
"@style/
Authentication.Headline.
TextView"
android:layout_centerHorizontal=
"true"
android:text=
"@string/title_log_in"
/>
<EditText
android:id=
"@+id/text_two_factor_auth"
style=
"@style/
EditText.Authentication
"
style=
"@style/
Authentication.EditText
"
android:layout_below=
"@id/text_headline"
android:layout_marginTop=
"32dp"
android:drawableStart=
"@drawable/ic_vpn_key_black_24dp"
...
...
@@ -31,10 +31,9 @@
app:indicatorName=
"BallPulseIndicator"
tools:visibility=
"visible"
/>
<Button
android:id=
"@+id/button_log_in"
style=
"@style/AuthenticationButton"
style=
"@style/Authentication
.
Button"
android:layout_alignParentBottom=
"true"
android:text=
"@string/title_log_in"
/>
...
...
app/src/main/res/layout/fragment_profile.xml
View file @
e719508d
...
...
@@ -25,7 +25,7 @@
<EditText
android:id=
"@+id/text_name"
style=
"@style/
EditText.Profile
"
style=
"@style/
Profile.EditText
"
android:layout_marginTop=
"32dp"
android:drawableStart=
"@drawable/ic_person_black_24dp"
android:hint=
"@string/msg_name"
...
...
@@ -33,7 +33,7 @@
<EditText
android:id=
"@+id/text_username"
style=
"@style/
EditText.Profile
"
style=
"@style/
Profile.EditText
"
android:layout_marginTop=
"16dp"
android:drawableStart=
"@drawable/ic_at_black_24dp"
android:hint=
"@string/msg_username"
...
...
@@ -41,7 +41,7 @@
<EditText
android:id=
"@+id/text_email"
style=
"@style/
EditText.Profile
"
style=
"@style/
Profile.EditText
"
android:layout_marginTop=
"16dp"
android:drawableStart=
"@drawable/ic_email_black_24dp"
android:hint=
"@string/msg_email"
...
...
app/src/main/res/layout/item_chat.xml
View file @
e719508d
...
...
@@ -14,76 +14,71 @@
layout=
"@layout/avatar"
android:layout_width=
"40dp"
android:layout_height=
"40dp"
a
pp:layout_constraintBottom_toBottomOf=
"parent
"
a
ndroid:layout_marginTop=
"6dp
"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toLeftOf=
"@+id/middle_container"
app:layout_constraintTop_toTopOf=
"parent"
/>
<android.support.constraint.ConstraintLayout
android:id=
"@+id/
middle
_container"
android:id=
"@+id/
top
_container"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginEnd=
"16dp"
android:layout_marginStart=
"16dp"
app:layout_constraintLeft_toRightOf=
"@+id/layout_avatar"
app:layout_constraintRight_to
LeftOf=
"@+id/right_container
"
>
app:layout_constraintRight_to
RightOf=
"parent
"
>
<TextView
android:id=
"@+id/text_chat_name"
style=
"@style/
TextAppearance.AppCompat.Title
"
android:layout_width=
"
wrap_content
"
style=
"@style/
ChatRoom.Name.TextView
"
android:layout_width=
"
0dp
"
android:layout_height=
"wrap_content"
android:drawablePadding=
"5dp"
android:ellipsize=
"end"
android:maxLines=
"1"
android:alpha=
"0.6"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toLeftOf=
"@+id/text_last_message_date_time"
app:layout_constraintTop_toTopOf=
"parent"
tools:text=
"General"
/>
<TextView
android:id=
"@+id/text_last_message"
android:layout_width=
"0dp"
android:id=
"@+id/text_last_message_date_time"
style=
"@style/Timestamp.TextView"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:ellipsize=
"end"
android:maxLines=
"2"
app:layout_constraintTop_toBottomOf=
"@+id/text_chat_name"
tools:text=
"You: Type something"
/>
android:layout_marginStart=
"5dp"
app:layout_constraintBaseline_toBaselineOf=
"@+id/text_chat_name"
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:id=
"@+id/
right
_container"
android:layout_width=
"
wrap_content
"
android:id=
"@+id/
bottom
_container"
android:layout_width=
"
0dp
"
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
android:id=
"@+id/text_last_message_date_time"
style=
"@style/TextAppearance.AppCompat.Caption"
android:layout_width=
"wrap_content"
android:id=
"@+id/text_last_message"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
app:layout_constraintBottom_toTopOf=
"@+id/guideline_one"
app:layout_constraintRight_toRightOf=
"@+id/layout_unread_messages_badge"
tools:text=
"11:45"
/>
android:ellipsize=
"end"
android:maxLines=
"2"
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
android:id=
"@+id/layout_unread_messages_badge"
layout=
"@layout/unread_messages_badge"
android:layout_width=
"20dp"
android:layout_height=
"20dp"
app:layout_constraintBottom_toTopOf=
"@+id/guideline_two"
android:layout_width=
"18dp"
android:layout_height=
"18dp"
android:layout_marginStart=
"5dp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintLeft_toRightOf=
"@+id/text_last_message"
app:layout_constraintRight_toRightOf=
"parent"
/>
<android.support.constraint.Guideline
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>
\ No newline at end of file
app/src/main/res/layout/item_message.xml
View file @
e719508d
...
...
@@ -14,7 +14,7 @@
layout=
"@layout/avatar"
android:layout_width=
"40dp"
android:layout_height=
"40dp"
android:layout_marginTop=
"
7
dp"
android:layout_marginTop=
"
5
dp"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
...
...
@@ -28,25 +28,23 @@
<TextView
android:id=
"@+id/text_sender"
style=
"@style/
TextAppearance.AppCompat.Title
"
style=
"@style/
Sender.Name.TextView
"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:ellipsize=
"end"
android:maxLines=
"1"
tools:text=
"Ronald Perkins"
/>
<TextView
android:id=
"@+id/text_message_time"
style=
"@style/T
extAppearance.AppCompat.Caption
"
style=
"@style/T
imestamp.TextView
"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"10dp"
tools:text=
"11:45
pm
"
/>
tools:text=
"11:45
PM
"
/>
</LinearLayout>
<TextView
android:id=
"@+id/text_content"
style=
"@style/
TextAppearance.AppCompat.Subhead
"
style=
"@style/
Message.TextView
"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"5dp"
...
...
app/src/main/res/layout/message_attachment.xml
View file @
e719508d
...
...
@@ -7,22 +7,6 @@
android:layout_height=
"wrap_content"
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
android:id=
"@+id/image_attachment"
android:layout_width=
"match_parent"
...
...
app/src/main/res/layout/unread_messages_badge.xml
View file @
e719508d
...
...
@@ -7,8 +7,8 @@
<TextView
android:id=
"@+id/text_total_unread_messages"
style=
"@style/TextAppearance.AppCompat.Caption"
android:layout_width=
"
20
dp"
android:layout_height=
"
20
dp"
android:layout_width=
"
18
dp"
android:layout_height=
"
18
dp"
android:background=
"@drawable/style_total_unread_messages"
android:gravity=
"center"
android:textColor=
"@color/white"
...
...
app/src/main/res/menu/chatrooms.xml
View file @
e719508d
...
...
@@ -9,9 +9,4 @@
app:actionViewClass=
"android.support.v7.widget.SearchView"
app:showAsAction=
"ifRoom|collapseActionView"
/>
<item
android:id=
"@+id/action_logout"
android:title=
"@string/action_logout"
app:showAsAction=
"never"
/>
</menu>
\ No newline at end of file
app/src/main/res/menu/navigation.xml
View file @
e719508d
<?xml version="1.0" encoding="utf-8"?>
<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
android:id=
"@+id/action_chat_rooms"
android:checked=
"true"
...
...
@@ -13,4 +17,19 @@
android:title=
"@string/title_profile"
/>
</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>
\ No newline at end of file
app/src/main/res/values-pt-rBR/strings.xml
View file @
e719508d
...
...
@@ -15,6 +15,7 @@
<string
name=
"action_privacy_policy"
>
Política de Privacidade
</string>
<string
name=
"action_search"
>
Pesquisar
</string>
<string
name=
"action_update"
>
Atualizar
</string>
<string
name=
"action_settings"
>
Configurações
</string>
<string
name=
"action_logout"
>
Sair
</string>
<string
name=
"action_files"
>
Arquivos
</string>
...
...
app/src/main/res/values/colors.xml
View file @
e719508d
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color
name=
"ic_launcher_background"
>
#15293F
</color>
<!-- Main colors -->
<color
name=
"colorPrimary"
>
#FF303030
</color>
<!-- Material Grey 850 -->
<color
name=
"colorPrimaryDark"
>
#ff212121
</color>
<!-- Material Grey 900 -->
<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=
"colorUserStatusBusy"
>
#F33E5B
</color>
<color
name=
"colorUserStatusAway"
>
#FDD236
</color>
...
...
@@ -19,16 +24,10 @@
<color
name=
"colorDim"
>
#99000000
</color>
<color
name=
"colorBackgroundFileAttachment"
>
#E2FFC8
</color>
<color
name=
"colorBackgroundContentFileAttachment"
>
#FFD8F5C0
</color>
<color
name=
"white"
>
#FFFFFFFF
</color>
<color
name=
"black"
>
#FF000000
</color>
<color
name=
"red"
>
#FFFF0000
</color>
<color
name=
"darkGray"
>
#a0a0a0
</color>
<color
name=
"actionMenuColor"
>
#727272
</color>
<color
name=
"linkTextColor"
>
#FF074481
</color>
<color
name=
"linkBackgroundColor"
>
#30074481
</color>
</resources>
app/src/main/res/values/dimens.xml
View file @
e719508d
...
...
@@ -9,6 +9,9 @@
<dimen
name=
"fab_elevation"
>
6dp
</dimen>
<dimen
name=
"divider_item_decorator_bound_start"
>
72dp
</dimen>
<dimen
name=
"divider_item_decorator_bound_end"
>
0dp
</dimen>
<dimen
name=
"message_time_text_size"
>
12sp
</dimen>
</resources>
\ No newline at end of file
app/src/main/res/values/strings.xml
View file @
e719508d
...
...
@@ -16,7 +16,8 @@
<string
name=
"action_privacy_policy"
>
Privacy Policy
</string>
<string
name=
"action_search"
>
Search
</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>
<!-- Regular information messages -->
...
...
app/src/main/res/values/styles.xml
View file @
e719508d
...
...
@@ -17,7 +17,18 @@
</style>
<!-- Widget styles. -->
<style
name=
"HeadlineTextView"
parent=
"TextAppearance.AppCompat.Headline"
>
<style
name=
"Authentication.TextView"
parent=
"TextAppearance.AppCompat.Medium"
>
<item
name=
"android:layout_width"
>
wrap_content
</item>
<item
name=
"android:layout_height"
>
50dp
</item>
<item
name=
"android:layout_marginStart"
>
@dimen/screen_edge_left_and_right_margins
</item>
<item
name=
"android:paddingStart"
>
@dimen/edit_text_margin
</item>
<item
name=
"android:maxLines"
>
1
</item>
<item
name=
"android:drawablePadding"
>
@dimen/edit_text_drawable_padding
</item>
<item
name=
"android:fontFamily"
>
sans-serif
</item>
<item
name=
"android:background"
>
@drawable/style_edit_text_authentication
</item>
</style>
<style
name=
"Authentication.Headline.TextView"
parent=
"TextAppearance.AppCompat.Headline"
>
<item
name=
"android:layout_width"
>
wrap_content
</item>
<item
name=
"android:layout_height"
>
wrap_content
</item>
<item
name=
"android:layout_marginTop"
>
20dp
</item>
...
...
@@ -25,7 +36,7 @@
<item
name=
"android:layout_marginEnd"
>
@dimen/screen_edge_left_and_right_margins
</item>
</style>
<style
name=
"
EditText.Authentication
"
parent=
"Widget.AppCompat.EditText"
>
<style
name=
"
Authentication.EditText
"
parent=
"Widget.AppCompat.EditText"
>
<item
name=
"android:layout_width"
>
match_parent
</item>
<item
name=
"android:layout_height"
>
50dp
</item>
<item
name=
"android:layout_marginStart"
>
@dimen/screen_edge_left_and_right_margins
</item>
...
...
@@ -39,25 +50,35 @@
<item
name=
"android:background"
>
@drawable/style_edit_text_authentication
</item>
</style>
<style
name=
"EditText.Profile"
parent=
"EditText.Authentication"
>
<item
name=
"android:background"
>
@drawable/style_edit_text_profile
</item>
<style
name=
"Authentication.Button"
parent=
"Widget.AppCompat.Button"
>
<item
name=
"android:layout_width"
>
match_parent
</item>
<item
name=
"android:layout_height"
>
wrap_content
</item>
<item
name=
"android:background"
>
@drawable/effect_ripple
</item>
</style>
<style
name=
"AuthenticationLabel"
parent=
"TextAppearance.AppCompat.Medium"
>
<item
name=
"android:layout_width"
>
wrap_content
</item>
<item
name=
"android:layout_height"
>
50dp
</item>
<item
name=
"android:layout_marginStart"
>
@dimen/screen_edge_left_and_right_margins
</item>
<item
name=
"android:paddingStart"
>
@dimen/edit_text_margin
</item>
<style
name=
"ChatRoom.Name.TextView"
parent=
"TextAppearance.AppCompat.Title"
>
<item
name=
"android:ellipsize"
>
end
</item>
<item
name=
"android:maxLines"
>
1
</item>
<item
name=
"android:drawablePadding"
>
@dimen/edit_text_drawable_padding
</item>
<item
name=
"android:fontFamily"
>
sans-serif
</item>
<item
name=
"android:background"
>
@drawable/style_edit_text_authentication
</item>
<item
name=
"android:textSize"
>
16sp
</item>
</style>
<style
name=
"AuthenticationButton"
parent=
"Widget.AppCompat.Button"
>
<item
name=
"android:layout_width"
>
match_parent
</item>
<item
name=
"android:layout_height"
>
wrap_content
</item>
<item
name=
"android:background"
>
@drawable/effect_ripple
</item>
<style
name=
"Sender.Name.TextView"
parent=
"TextAppearance.AppCompat.Title"
>
<item
name=
"android:ellipsize"
>
end
</item>
<item
name=
"android:maxLines"
>
1
</item>
<item
name=
"android:textSize"
>
16sp
</item>
</style>
<style
name=
"Message.TextView"
parent=
"android:TextAppearance"
>
<item
name=
"android:textSize"
>
15sp
</item>
<item
name=
"android:textColor"
>
@color/colorPrimaryText
</item>
</style>
<style
name=
"Timestamp.TextView"
parent=
"TextAppearance.AppCompat.Caption"
>
<item
name=
"android:textSize"
>
10sp
</item>
</style>
<style
name=
"Profile.EditText"
parent=
"Authentication.EditText"
>
<item
name=
"android:background"
>
@drawable/style_edit_text_profile
</item>
</style>
</resources>
\ No newline at end of file
dependencies.gradle
View file @
e719508d
...
...
@@ -11,7 +11,7 @@ ext {
// Main dependencies
support
:
'27.0.2'
,
constraintLayout
:
'1.0.2'
,
dagger
:
'2.1
3
'
,
dagger
:
'2.1
4.1
'
,
exoPlayer
:
'2.6.0'
,
playServices
:
'11.8.0'
,
room
:
'1.0.0'
,
...
...
@@ -29,6 +29,7 @@ ext {
markwon
:
'1.0.3'
,
sheetMenu
:
'1.3.3'
,
aVLoadingIndicatorView
:
'2.1.3'
,
swipeBackLayout
:
'1.1.0'
,
// For testing
junit
:
'4.12'
,
...
...
@@ -91,6 +92,8 @@ ext {
aVLoadingIndicatorView
:
"com.wang.avi:library:${versions.aVLoadingIndicatorView}"
,
swipeBackLayout
:
"me.imid.swipebacklayout.lib:library:${versions.swipeBackLayout}"
,
// For testing
junit
:
"junit:junit:$versions.junit"
,
expressoCore
:
"com.android.support.test.espresso:espresso-core:${versions.expresso}"
,
...
...
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