Unverified Commit e719508d authored by Filipe de Lima Brito's avatar Filipe de Lima Brito Committed by GitHub

Merge pull request #794 from filipedelimabrito/improvement/layout

[FIX] Layout improvements
parents 308b7f48 e6581724
...@@ -105,6 +105,8 @@ dependencies { ...@@ -105,6 +105,8 @@ dependencies {
implementation libraries.aVLoadingIndicatorView implementation libraries.aVLoadingIndicatorView
implementation libraries.swipeBackLayout
implementation('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') { implementation('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
transitive = true transitive = true
} }
......
...@@ -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
...@@ -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("loginFragment", R.id.fragment_container) { activity.addFragmentBackStack("LoginFragment", R.id.fragment_container) {
LoginFragment.newInstance() LoginFragment.newInstance()
} }
} }
fun toTwoFA(username: String, password: String) { fun toTwoFA(username: String, password: String) {
activity.addFragmentBackStack("twoFAFragment", R.id.fragment_container) { activity.addFragmentBackStack("TwoFAFragment", R.id.fragment_container) {
TwoFAFragment.newInstance(username, password) TwoFAFragment.newInstance(username, password)
} }
} }
fun toSignUp() { fun toSignUp() {
activity.addFragmentBackStack("signupFragment", R.id.fragment_container) { activity.addFragmentBackStack("SignupFragment", R.id.fragment_container) {
SignupFragment.newInstance() SignupFragment.newInstance()
} }
} }
......
...@@ -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
...@@ -24,7 +24,7 @@ class PinnedMessagesFragmentModule { ...@@ -24,7 +24,7 @@ class PinnedMessagesFragmentModule {
} }
@Provides @Provides
fun providePinnedMessageView(frag: PinnedMessagesFragment): PinnedMessagesView { fun providePinnedMessagesView(frag: PinnedMessagesFragment): PinnedMessagesView {
return frag return frag
} }
} }
\ No newline at end of file
...@@ -13,6 +13,8 @@ import dagger.android.AndroidInjector ...@@ -13,6 +13,8 @@ import dagger.android.AndroidInjector
import dagger.android.DispatchingAndroidInjector import dagger.android.DispatchingAndroidInjector
import dagger.android.support.HasSupportFragmentInjector import dagger.android.support.HasSupportFragmentInjector
import kotlinx.android.synthetic.main.app_bar_chat_room.* 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 import javax.inject.Inject
...@@ -30,7 +32,7 @@ private const val INTENT_CHAT_ROOM_NAME = "chat_room_name" ...@@ -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_CHAT_ROOM_TYPE = "chat_room_type"
private const val INTENT_IS_CHAT_ROOM_READ_ONLY = "is_chat_room_read_only" private const val INTENT_IS_CHAT_ROOM_READ_ONLY = "is_chat_room_read_only"
class ChatRoomActivity : AppCompatActivity(), HasSupportFragmentInjector { class ChatRoomActivity : SwipeBackActivity(), HasSupportFragmentInjector {
@Inject lateinit var fragmentDispatchingAndroidInjector: DispatchingAndroidInjector<Fragment> @Inject lateinit var fragmentDispatchingAndroidInjector: DispatchingAndroidInjector<Fragment>
private lateinit var chatRoomId: String private lateinit var chatRoomId: String
private lateinit var chatRoomName: String private lateinit var chatRoomName: String
...@@ -54,6 +56,8 @@ class ChatRoomActivity : AppCompatActivity(), HasSupportFragmentInjector { ...@@ -54,6 +56,8 @@ class ChatRoomActivity : AppCompatActivity(), HasSupportFragmentInjector {
isChatRoomReadOnly = intent.getBooleanExtra(INTENT_IS_CHAT_ROOM_READ_ONLY, true) isChatRoomReadOnly = intent.getBooleanExtra(INTENT_IS_CHAT_ROOM_READ_ONLY, true)
requireNotNull(chatRoomType) { "no is_chat_room_read_only provided in Intent extras" } requireNotNull(chatRoomType) { "no is_chat_room_read_only provided in Intent extras" }
swipeBackLayout.setEdgeTrackingEnabled(SwipeBackLayout.EDGE_LEFT)
setupToolbar(chatRoomName) setupToolbar(chatRoomName)
addFragment("ChatRoomFragment", R.id.fragment_container) { addFragment("ChatRoomFragment", R.id.fragment_container) {
......
...@@ -247,10 +247,8 @@ class ChatRoomFragment : Fragment(), ChatRoomView { ...@@ -247,10 +247,8 @@ class ChatRoomFragment : Fragment(), ChatRoomView {
if (!recyclerView.canScrollVertically(1)) { if (!recyclerView.canScrollVertically(1)) {
button_fab.hide() button_fab.hide()
} else { } else {
if (dy > 0 && !button_fab.isVisible()) { if (dy < 0 && !button_fab.isVisible()) {
button_fab.show() button_fab.show()
} else if (dy < 0 && button_fab.isVisible()) {
button_fab.hide()
} }
} }
} }
...@@ -292,11 +290,11 @@ class ChatRoomFragment : Fragment(), ChatRoomView { ...@@ -292,11 +290,11 @@ class ChatRoomFragment : Fragment(), ChatRoomView {
button_files.setOnClickListener { button_files.setOnClickListener {
handler.postDelayed({ handler.postDelayed({
presenter.selectFile() presenter.selectFile()
}, 300) }, 200)
handler.postDelayed({ handler.postDelayed({
hideAttachmentOptions() hideAttachmentOptions()
}, 600) }, 400)
} }
} }
} }
......
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
...@@ -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
...@@ -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) }
} }
......
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,9 @@ class ChatRoomsFragment : Fragment(), ChatRoomsView { ...@@ -121,7 +103,9 @@ 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,
resources.getDimensionPixelSize(R.dimen.divider_item_decorator_bound_start),
resources.getDimensionPixelSize(R.dimen.divider_item_decorator_bound_end)))
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)
......
...@@ -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
......
...@@ -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)
......
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
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
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
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
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
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
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
...@@ -5,7 +5,7 @@ import android.view.ViewAnimationUtils ...@@ -5,7 +5,7 @@ import android.view.ViewAnimationUtils
import android.view.animation.AccelerateInterpolator import android.view.animation.AccelerateInterpolator
import android.view.animation.DecelerateInterpolator import android.view.animation.DecelerateInterpolator
fun View.rotateBy(value: Float, duration: Long = 200) { fun View.rotateBy(value: Float, duration: Long = 100) {
animate() animate()
.rotationBy(value) .rotationBy(value)
.setDuration(duration) .setDuration(duration)
...@@ -42,7 +42,7 @@ fun View.fadeOut(startValue: Float, finishValue: Float, duration: Long = 200) { ...@@ -42,7 +42,7 @@ fun View.fadeOut(startValue: Float, finishValue: Float, duration: Long = 200) {
setVisible(false) setVisible(false)
} }
fun View.circularRevealOrUnreveal(centerX: Int, centerY: Int, startRadius: Float, endRadius: Float, duration: Long = 600) { fun View.circularRevealOrUnreveal(centerX: Int, centerY: Int, startRadius: Float, endRadius: Float, duration: Long = 200) {
val anim = ViewAnimationUtils.createCircularReveal(this, centerX, centerY, startRadius, endRadius) val anim = ViewAnimationUtils.createCircularReveal(this, centerX, centerY, startRadius, endRadius)
anim.duration = duration anim.duration = duration
......
...@@ -14,7 +14,7 @@ import android.support.v7.widget.RecyclerView ...@@ -14,7 +14,7 @@ import android.support.v7.widget.RecyclerView
class DividerItemDecoration() : RecyclerView.ItemDecoration() { class DividerItemDecoration() : RecyclerView.ItemDecoration() {
private lateinit var divider: Drawable private lateinit var divider: Drawable
private var boundStart = 0 private var boundStart = 0
private var boundRight = 0 private var boundEnd = 0
// Default divider will be used. // Default divider will be used.
constructor(context: Context) : this() { constructor(context: Context) : this() {
...@@ -24,15 +24,15 @@ class DividerItemDecoration() : RecyclerView.ItemDecoration() { ...@@ -24,15 +24,15 @@ class DividerItemDecoration() : RecyclerView.ItemDecoration() {
styledAttributes.recycle() styledAttributes.recycle()
} }
// Default divider with custom boundaries (start and right) will be used. // Default divider with custom boundaries (start and end) will be used.
constructor(context: Context, boundStart: Int, boundRight: Int) : this() { constructor(context: Context, boundStart: Int, boundEnd: Int) : this() {
val attrs = intArrayOf(android.R.attr.listDivider) val attrs = intArrayOf(android.R.attr.listDivider)
val styledAttributes = context.obtainStyledAttributes(attrs) val styledAttributes = context.obtainStyledAttributes(attrs)
divider = styledAttributes.getDrawable(0) divider = styledAttributes.getDrawable(0)
styledAttributes.recycle() styledAttributes.recycle()
this.boundStart = boundStart this.boundStart = boundStart
this.boundRight = boundRight this.boundEnd = boundEnd
} }
// Custom divider will be used. // Custom divider will be used.
...@@ -45,7 +45,7 @@ class DividerItemDecoration() : RecyclerView.ItemDecoration() { ...@@ -45,7 +45,7 @@ class DividerItemDecoration() : RecyclerView.ItemDecoration() {
override fun onDraw(c: Canvas, parent: RecyclerView, state: RecyclerView.State) { override fun onDraw(c: Canvas, parent: RecyclerView, state: RecyclerView.State) {
val left = parent.paddingLeft + boundStart val left = parent.paddingLeft + boundStart
val right = (parent.width - parent.paddingRight) - boundRight val right = (parent.width - parent.paddingRight) - boundEnd
val childCount = parent.childCount val childCount = parent.childCount
for (i in 0 until childCount) { for (i in 0 until childCount) {
......
...@@ -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="250" android:duration="100"
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="250" android:duration="100"
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
<?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="250" android:duration="100"
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
<?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="250" android:duration="100"
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
...@@ -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="250" android:duration="100"
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="250" android:duration="100"
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
<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
<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>
<?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
<?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
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<TextView <TextView
android:id="@+id/text_headline" android:id="@+id/text_headline"
style="@style/HeadlineTextView" style="@style/Authentication.Headline.TextView"
android:text="@string/title_log_in" android:text="@string/title_log_in"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
<EditText <EditText
android:id="@+id/text_username_or_email" android:id="@+id/text_username_or_email"
style="@style/EditText.Authentication" style="@style/Authentication.EditText"
android:layout_marginTop="32dp" android:layout_marginTop="32dp"
android:drawableStart="@drawable/ic_assignment_ind_black_24dp" android:drawableStart="@drawable/ic_assignment_ind_black_24dp"
android:hint="@string/msg_username_or_email" android:hint="@string/msg_username_or_email"
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
<EditText <EditText
android:id="@+id/text_password" android:id="@+id/text_password"
style="@style/EditText.Authentication" style="@style/Authentication.EditText"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:drawableStart="@drawable/ic_lock_black_24dp" android:drawableStart="@drawable/ic_lock_black_24dp"
android:hint="@string/msg_password" android:hint="@string/msg_password"
...@@ -193,7 +193,7 @@ ...@@ -193,7 +193,7 @@
<Button <Button
android:id="@+id/button_log_in" android:id="@+id/button_log_in"
style="@style/AuthenticationButton" style="@style/Authentication.Button"
android:text="@string/title_log_in" android:text="@string/title_log_in"
android:visibility="visible" android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
......
...@@ -10,13 +10,13 @@ ...@@ -10,13 +10,13 @@
<TextView <TextView
android:id="@+id/text_headline" android:id="@+id/text_headline"
style="@style/HeadlineTextView" style="@style/Authentication.Headline.TextView"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:text="@string/title_sign_in_your_server" /> android:text="@string/title_sign_in_your_server" />
<TextView <TextView
android:id="@+id/text_server_protocol" android:id="@+id/text_server_protocol"
style="@style/AuthenticationLabel" style="@style/Authentication.TextView"
android:layout_below="@id/text_headline" android:layout_below="@id/text_headline"
android:layout_marginTop="32dp" android:layout_marginTop="32dp"
android:gravity="center_vertical" android:gravity="center_vertical"
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<EditText <EditText
android:id="@+id/text_server_url" android:id="@+id/text_server_url"
style="@style/EditText.Authentication" style="@style/Authentication.EditText"
android:layout_below="@id/text_headline" android:layout_below="@id/text_headline"
android:layout_marginStart="0dp" android:layout_marginStart="0dp"
android:layout_marginTop="32dp" android:layout_marginTop="32dp"
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
<Button <Button
android:id="@+id/button_connect" android:id="@+id/button_connect"
style="@style/AuthenticationButton" style="@style/Authentication.Button"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:text="@string/action_connect" /> android:text="@string/action_connect" />
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<TextView <TextView
android:id="@+id/text_headline" android:id="@+id/text_headline"
style="@style/HeadlineTextView" style="@style/Authentication.Headline.TextView"
android:text="@string/title_sign_up" android:text="@string/title_sign_up"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<EditText <EditText
android:id="@+id/text_name" android:id="@+id/text_name"
style="@style/EditText.Authentication" style="@style/Authentication.EditText"
android:layout_marginTop="32dp" android:layout_marginTop="32dp"
android:drawableStart="@drawable/ic_person_black_24dp" android:drawableStart="@drawable/ic_person_black_24dp"
android:hint="@string/msg_name" android:hint="@string/msg_name"
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
<EditText <EditText
android:id="@+id/text_username" android:id="@+id/text_username"
style="@style/EditText.Authentication" style="@style/Authentication.EditText"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:drawableStart="@drawable/ic_at_black_24dp" android:drawableStart="@drawable/ic_at_black_24dp"
android:hint="@string/msg_username" android:hint="@string/msg_username"
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
<EditText <EditText
android:id="@+id/text_password" android:id="@+id/text_password"
style="@style/EditText.Authentication" style="@style/Authentication.EditText"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:drawableStart="@drawable/ic_lock_black_24dp" android:drawableStart="@drawable/ic_lock_black_24dp"
android:hint="@string/msg_password" android:hint="@string/msg_password"
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
<EditText <EditText
android:id="@+id/text_email" android:id="@+id/text_email"
style="@style/EditText.Authentication" style="@style/Authentication.EditText"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:drawableStart="@drawable/ic_email_black_24dp" android:drawableStart="@drawable/ic_email_black_24dp"
android:hint="@string/msg_email" android:hint="@string/msg_email"
...@@ -91,7 +91,7 @@ ...@@ -91,7 +91,7 @@
<Button <Button
android:id="@+id/button_sign_up" android:id="@+id/button_sign_up"
style="@style/AuthenticationButton" style="@style/Authentication.Button"
android:text="@string/title_sign_up" android:text="@string/title_sign_up"
app:layout_constraintBottom_toBottomOf="parent" /> app:layout_constraintBottom_toBottomOf="parent" />
......
...@@ -8,13 +8,13 @@ ...@@ -8,13 +8,13 @@
<TextView <TextView
android:id="@+id/text_headline" android:id="@+id/text_headline"
style="@style/HeadlineTextView" style="@style/Authentication.Headline.TextView"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:text="@string/title_log_in" /> android:text="@string/title_log_in" />
<EditText <EditText
android:id="@+id/text_two_factor_auth" android:id="@+id/text_two_factor_auth"
style="@style/EditText.Authentication" style="@style/Authentication.EditText"
android:layout_below="@id/text_headline" android:layout_below="@id/text_headline"
android:layout_marginTop="32dp" android:layout_marginTop="32dp"
android:drawableStart="@drawable/ic_vpn_key_black_24dp" android:drawableStart="@drawable/ic_vpn_key_black_24dp"
...@@ -31,10 +31,9 @@ ...@@ -31,10 +31,9 @@
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/Authentication.Button"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:text="@string/title_log_in" /> android:text="@string/title_log_in" />
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
<EditText <EditText
android:id="@+id/text_name" android:id="@+id/text_name"
style="@style/EditText.Profile" style="@style/Profile.EditText"
android:layout_marginTop="32dp" android:layout_marginTop="32dp"
android:drawableStart="@drawable/ic_person_black_24dp" android:drawableStart="@drawable/ic_person_black_24dp"
android:hint="@string/msg_name" android:hint="@string/msg_name"
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
<EditText <EditText
android:id="@+id/text_username" android:id="@+id/text_username"
style="@style/EditText.Profile" style="@style/Profile.EditText"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:drawableStart="@drawable/ic_at_black_24dp" android:drawableStart="@drawable/ic_at_black_24dp"
android:hint="@string/msg_username" android:hint="@string/msg_username"
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
<EditText <EditText
android:id="@+id/text_email" android:id="@+id/text_email"
style="@style/EditText.Profile" style="@style/Profile.EditText"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:drawableStart="@drawable/ic_email_black_24dp" android:drawableStart="@drawable/ic_email_black_24dp"
android:hint="@string/msg_email" android:hint="@string/msg_email"
......
...@@ -14,76 +14,71 @@ ...@@ -14,76 +14,71 @@
layout="@layout/avatar" layout="@layout/avatar"
android:layout_width="40dp" android:layout_width="40dp"
android:layout_height="40dp" android:layout_height="40dp"
app:layout_constraintBottom_toBottomOf="parent" android: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_toLeftOf="@+id/right_container"> app:layout_constraintRight_toRightOf="parent">
<TextView <TextView
android:id="@+id/text_chat_name" android:id="@+id/text_chat_name"
style="@style/TextAppearance.AppCompat.Title" style="@style/ChatRoom.Name.TextView"
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" app:layout_constraintLeft_toLeftOf="parent"
android:maxLines="1" 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/Timestamp.TextView"
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" app:layout_constraintBaseline_toBaselineOf="@+id/text_chat_name"
app:layout_constraintTop_toBottomOf="@+id/text_chat_name" app:layout_constraintLeft_toRightOf="@+id/text_chat_name"
tools:text="You: Type something" /> 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_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@+id/text_last_message"
app:layout_constraintRight_toRightOf="parent" /> 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>
</android.support.constraint.ConstraintLayout> </android.support.constraint.ConstraintLayout>
\ No newline at end of file
...@@ -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="7dp" android:layout_marginTop="5dp"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
...@@ -28,25 +28,23 @@ ...@@ -28,25 +28,23 @@
<TextView <TextView
android:id="@+id/text_sender" android:id="@+id/text_sender"
style="@style/TextAppearance.AppCompat.Title" style="@style/Sender.Name.TextView"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
tools:text="Ronald Perkins" /> tools:text="Ronald Perkins" />
<TextView <TextView
android:id="@+id/text_message_time" android:id="@+id/text_message_time"
style="@style/TextAppearance.AppCompat.Caption" style="@style/Timestamp.TextView"
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"
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" style="@style/Message.TextView"
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"
......
...@@ -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"
......
...@@ -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="20dp" android:layout_width="18dp"
android:layout_height="20dp" android:layout_height="18dp"
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"
......
...@@ -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
<?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
...@@ -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>
......
<?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>
...@@ -9,6 +9,9 @@ ...@@ -9,6 +9,9 @@
<dimen name="fab_elevation">6dp</dimen> <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> <dimen name="message_time_text_size">12sp</dimen>
</resources> </resources>
\ No newline at end of file
...@@ -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 -->
......
...@@ -17,7 +17,18 @@ ...@@ -17,7 +17,18 @@
</style> </style>
<!-- Widget styles. --> <!-- 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_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item> <item name="android:layout_height">wrap_content</item>
<item name="android:layout_marginTop">20dp</item> <item name="android:layout_marginTop">20dp</item>
...@@ -25,7 +36,7 @@ ...@@ -25,7 +36,7 @@
<item name="android:layout_marginEnd">@dimen/screen_edge_left_and_right_margins</item> <item name="android:layout_marginEnd">@dimen/screen_edge_left_and_right_margins</item>
</style> </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_width">match_parent</item>
<item name="android:layout_height">50dp</item> <item name="android:layout_height">50dp</item>
<item name="android:layout_marginStart">@dimen/screen_edge_left_and_right_margins</item> <item name="android:layout_marginStart">@dimen/screen_edge_left_and_right_margins</item>
...@@ -39,25 +50,35 @@ ...@@ -39,25 +50,35 @@
<item name="android:background">@drawable/style_edit_text_authentication</item> <item name="android:background">@drawable/style_edit_text_authentication</item>
</style> </style>
<style name="EditText.Profile" parent="EditText.Authentication"> <style name="Authentication.Button" parent="Widget.AppCompat.Button">
<item name="android:background">@drawable/style_edit_text_profile</item> <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>
<style name="AuthenticationLabel" parent="TextAppearance.AppCompat.Medium"> <style name="ChatRoom.Name.TextView" parent="TextAppearance.AppCompat.Title">
<item name="android:layout_width">wrap_content</item> <item name="android:ellipsize">end</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:maxLines">1</item>
<item name="android:drawablePadding">@dimen/edit_text_drawable_padding</item> <item name="android:textSize">16sp</item>
<item name="android:fontFamily">sans-serif</item>
<item name="android:background">@drawable/style_edit_text_authentication</item>
</style> </style>
<style name="AuthenticationButton" parent="Widget.AppCompat.Button"> <style name="Sender.Name.TextView" parent="TextAppearance.AppCompat.Title">
<item name="android:layout_width">match_parent</item> <item name="android:ellipsize">end</item>
<item name="android:layout_height">wrap_content</item> <item name="android:maxLines">1</item>
<item name="android:background">@drawable/effect_ripple</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> </style>
</resources> </resources>
\ No newline at end of file
...@@ -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.13', dagger : '2.14.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',
...@@ -29,6 +29,7 @@ ext { ...@@ -29,6 +29,7 @@ ext {
markwon : '1.0.3', markwon : '1.0.3',
sheetMenu : '1.3.3', sheetMenu : '1.3.3',
aVLoadingIndicatorView : '2.1.3', aVLoadingIndicatorView : '2.1.3',
swipeBackLayout : '1.1.0',
// For testing // For testing
junit : '4.12', junit : '4.12',
...@@ -91,6 +92,8 @@ ext { ...@@ -91,6 +92,8 @@ ext {
aVLoadingIndicatorView : "com.wang.avi:library:${versions.aVLoadingIndicatorView}", aVLoadingIndicatorView : "com.wang.avi:library:${versions.aVLoadingIndicatorView}",
swipeBackLayout : "me.imid.swipebacklayout.lib:library:${versions.swipeBackLayout}",
// For testing // For testing
junit : "junit:junit:$versions.junit", junit : "junit:junit:$versions.junit",
expressoCore : "com.android.support.test.espresso:espresso-core:${versions.expresso}", expressoCore : "com.android.support.test.espresso:espresso-core:${versions.expresso}",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment