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 {
implementation libraries.aVLoadingIndicatorView
implementation libraries.swipeBackLayout
implementation('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
transitive = true
}
......
......@@ -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
......@@ -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("loginFragment", R.id.fragment_container) {
activity.addFragmentBackStack("LoginFragment", R.id.fragment_container) {
LoginFragment.newInstance()
}
}
fun toTwoFA(username: String, password: String) {
activity.addFragmentBackStack("twoFAFragment", R.id.fragment_container) {
activity.addFragmentBackStack("TwoFAFragment", R.id.fragment_container) {
TwoFAFragment.newInstance(username, password)
}
}
fun toSignUp() {
activity.addFragmentBackStack("signupFragment", R.id.fragment_container) {
activity.addFragmentBackStack("SignupFragment", R.id.fragment_container) {
SignupFragment.newInstance()
}
}
......
......@@ -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
......@@ -24,7 +24,7 @@ class PinnedMessagesFragmentModule {
}
@Provides
fun providePinnedMessageView(frag: PinnedMessagesFragment): PinnedMessagesView {
fun providePinnedMessagesView(frag: PinnedMessagesFragment): PinnedMessagesView {
return frag
}
}
\ No newline at end of file
......@@ -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 : AppCompatActivity(), HasSupportFragmentInjector {
class ChatRoomActivity : SwipeBackActivity(), 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) {
......
......@@ -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()
}, 300)
}, 200)
handler.postDelayed({
hideAttachmentOptions()
}, 600)
}, 400)
}
}
}
......
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
......@@ -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
......@@ -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) }
}
......
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)
......@@ -157,4 +141,4 @@ class ChatRoomsFragment : Fragment(), ChatRoomsView {
return newRooms[newItemPosition]
}
}
}
}
\ No newline at end of file
......@@ -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
......
......@@ -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)
......
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
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
......@@ -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 = 200) {
fun View.rotateBy(value: Float, duration: Long = 100) {
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 = 600) {
fun View.circularRevealOrUnreveal(centerX: Int, centerY: Int, startRadius: Float, endRadius: Float, duration: Long = 200) {
val anim = ViewAnimationUtils.createCircularReveal(this, centerX, centerY, startRadius, endRadius)
anim.duration = duration
......
......@@ -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 boundRight = 0
private var boundEnd = 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, boundRight: Int) : this() {
// Default divider with custom boundaries (start and end) will be used.
constructor(context: Context, boundStart: Int, boundEnd: Int) : this() {
val attrs = intArrayOf(android.R.attr.listDivider)
val styledAttributes = context.obtainStyledAttributes(attrs)
divider = styledAttributes.getDrawable(0)
styledAttributes.recycle()
this.boundStart = boundStart
this.boundRight = boundRight
this.boundEnd = 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) - boundRight
val right = (parent.width - parent.paddingRight) - boundEnd
val childCount = parent.childCount
for (i in 0 until childCount) {
......
......@@ -6,13 +6,15 @@
android:fillEnabled="true"
android:shareInterpolator="false"
android:zAdjustment="top">
<alpha
android:duration="250"
android:duration="100"
android:fromAlpha="0.2"
android:interpolator="@anim/accelerate_cubic"
android:toAlpha="1.0" />
<scale
android:duration="250"
android:duration="100"
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
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:zAdjustment="top">
<translate
android:duration="250"
android:duration="100"
android:fromXDelta="0.0%p"
android:interpolator="@anim/accelerate_cubic"
android:toXDelta="100.0%p" />
</set>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:zAdjustment="top">
<translate
android:duration="250"
android:duration="100"
android:fromXDelta="100.0%p"
android:interpolator="@anim/decelerate_cubic"
android:toXDelta="0.0%p" />
</set>
\ No newline at end of file
......@@ -6,13 +6,15 @@
android:fillEnabled="true"
android:shareInterpolator="false"
android:zAdjustment="normal">
<alpha
android:duration="250"
android:duration="100"
android:fromAlpha="1.0"
android:interpolator="@anim/decelerate_cubic"
android:toAlpha="0.2" />
<scale
android:duration="250"
android:duration="100"
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
<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 @@
<TextView
android:id="@+id/text_headline"
style="@style/HeadlineTextView"
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"
......
......@@ -10,13 +10,13 @@
<TextView
android:id="@+id/text_headline"
style="@style/HeadlineTextView"
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/AuthenticationLabel"
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" />
......
......@@ -9,7 +9,7 @@
<TextView
android:id="@+id/text_headline"
style="@style/HeadlineTextView"
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" />
......
......@@ -8,13 +8,13 @@
<TextView
android:id="@+id/text_headline"
style="@style/HeadlineTextView"
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" />
......
......@@ -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"
......
......@@ -14,76 +14,71 @@
layout="@layout/avatar"
android:layout_width="40dp"
android:layout_height="40dp"
app:layout_constraintBottom_toBottomOf="parent"
android: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_toLeftOf="@+id/right_container">
app:layout_constraintRight_toRightOf="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
......@@ -14,7 +14,7 @@
layout="@layout/avatar"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginTop="7dp"
android:layout_marginTop="5dp"
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/TextAppearance.AppCompat.Caption"
style="@style/Timestamp.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"
......
......@@ -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"
......
......@@ -7,8 +7,8 @@
<TextView
android:id="@+id/text_total_unread_messages"
style="@style/TextAppearance.AppCompat.Caption"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_width="18dp"
android:layout_height="18dp"
android:background="@drawable/style_total_unread_messages"
android:gravity="center"
android:textColor="@color/white"
......
......@@ -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
<?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
......@@ -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>
......
<?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>
......@@ -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
......@@ -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 -->
......
......@@ -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
......@@ -11,7 +11,7 @@ ext {
// Main dependencies
support : '27.0.2',
constraintLayout : '1.0.2',
dagger : '2.13',
dagger : '2.14.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}",
......
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