Unverified Commit ef0c17c5 authored by Rafael Kellermann Streit's avatar Rafael Kellermann Streit Committed by GitHub

Merge branch 'develop' into basicauth

parents 80eaf693 aceef97b
...@@ -8,6 +8,7 @@ import android.view.View ...@@ -8,6 +8,7 @@ import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.core.view.ViewCompat import androidx.core.view.ViewCompat
import androidx.core.view.isVisible
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import chat.rocket.android.R import chat.rocket.android.R
import chat.rocket.android.analytics.AnalyticsManager import chat.rocket.android.analytics.AnalyticsManager
...@@ -16,7 +17,6 @@ import chat.rocket.android.authentication.registerusername.presentation.Register ...@@ -16,7 +17,6 @@ import chat.rocket.android.authentication.registerusername.presentation.Register
import chat.rocket.android.authentication.registerusername.presentation.RegisterUsernameView import chat.rocket.android.authentication.registerusername.presentation.RegisterUsernameView
import chat.rocket.android.util.extension.asObservable import chat.rocket.android.util.extension.asObservable
import chat.rocket.android.util.extensions.inflate import chat.rocket.android.util.extensions.inflate
import chat.rocket.android.util.extensions.setVisible
import chat.rocket.android.util.extensions.showKeyboard import chat.rocket.android.util.extensions.showKeyboard
import chat.rocket.android.util.extensions.showToast import chat.rocket.android.util.extensions.showToast
import chat.rocket.android.util.extensions.textContent import chat.rocket.android.util.extensions.textContent
...@@ -113,13 +113,13 @@ class RegisterUsernameFragment : Fragment(), RegisterUsernameView { ...@@ -113,13 +113,13 @@ class RegisterUsernameFragment : Fragment(), RegisterUsernameView {
override fun showLoading() { override fun showLoading() {
ui { ui {
disableUserInput() disableUserInput()
view_loading.setVisible(true) view_loading.isVisible = true
} }
} }
override fun hideLoading() { override fun hideLoading() {
ui { ui {
view_loading.setVisible(false) view_loading.isVisible = false
enableUserInput() enableUserInput()
} }
} }
......
...@@ -6,6 +6,7 @@ import android.view.View ...@@ -6,6 +6,7 @@ import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.core.view.ViewCompat import androidx.core.view.ViewCompat
import androidx.core.view.isVisible
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import chat.rocket.android.R import chat.rocket.android.R
import chat.rocket.android.analytics.AnalyticsManager import chat.rocket.android.analytics.AnalyticsManager
...@@ -15,7 +16,6 @@ import chat.rocket.android.authentication.resetpassword.presentation.ResetPasswo ...@@ -15,7 +16,6 @@ import chat.rocket.android.authentication.resetpassword.presentation.ResetPasswo
import chat.rocket.android.util.extension.asObservable import chat.rocket.android.util.extension.asObservable
import chat.rocket.android.util.extensions.inflate import chat.rocket.android.util.extensions.inflate
import chat.rocket.android.util.extensions.isEmail import chat.rocket.android.util.extensions.isEmail
import chat.rocket.android.util.extensions.setVisible
import chat.rocket.android.util.extensions.showKeyboard import chat.rocket.android.util.extensions.showKeyboard
import chat.rocket.android.util.extensions.showToast import chat.rocket.android.util.extensions.showToast
import chat.rocket.android.util.extensions.textContent import chat.rocket.android.util.extensions.textContent
...@@ -93,13 +93,13 @@ class ResetPasswordFragment : Fragment(), ResetPasswordView { ...@@ -93,13 +93,13 @@ class ResetPasswordFragment : Fragment(), ResetPasswordView {
override fun showLoading() { override fun showLoading() {
ui { ui {
disableUserInput() disableUserInput()
view_loading.setVisible(true) view_loading.isVisible = true
} }
} }
override fun hideLoading() { override fun hideLoading() {
ui { ui {
view_loading.setVisible(false) view_loading.isVisible = false
enableUserInput() enableUserInput()
} }
} }
......
...@@ -4,6 +4,7 @@ import android.os.Bundle ...@@ -4,6 +4,7 @@ import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.core.view.isVisible
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.DefaultItemAnimator import androidx.recyclerview.widget.DefaultItemAnimator
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
...@@ -15,7 +16,6 @@ import chat.rocket.android.chatinformation.adapter.ReadReceiptAdapter ...@@ -15,7 +16,6 @@ import chat.rocket.android.chatinformation.adapter.ReadReceiptAdapter
import chat.rocket.android.chatinformation.presentation.MessageInfoPresenter import chat.rocket.android.chatinformation.presentation.MessageInfoPresenter
import chat.rocket.android.chatinformation.presentation.MessageInfoView import chat.rocket.android.chatinformation.presentation.MessageInfoView
import chat.rocket.android.chatinformation.viewmodel.ReadReceiptViewModel import chat.rocket.android.chatinformation.viewmodel.ReadReceiptViewModel
import chat.rocket.android.util.extensions.setVisible
import chat.rocket.android.util.extensions.showToast import chat.rocket.android.util.extensions.showToast
import chat.rocket.android.util.extensions.ui import chat.rocket.android.util.extensions.ui
import dagger.android.support.AndroidSupportInjection import dagger.android.support.AndroidSupportInjection
...@@ -86,15 +86,15 @@ class MessageInfoFragment : Fragment(), MessageInfoView { ...@@ -86,15 +86,15 @@ class MessageInfoFragment : Fragment(), MessageInfoView {
override fun showLoading() { override fun showLoading() {
ui { ui {
view_loading.setVisible(true) view_loading.isVisible = true
view_loading.show() view_loading.show()
} }
} }
override fun hideLoading() { override fun hideLoading() {
ui { ui {
view_loading.isVisible = false
view_loading.hide() view_loading.hide()
view_loading.setVisible(false)
} }
} }
......
...@@ -7,10 +7,10 @@ import android.view.View ...@@ -7,10 +7,10 @@ import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.ImageView import android.widget.ImageView
import android.widget.TextView import android.widget.TextView
import androidx.core.view.isVisible
import chat.rocket.android.R import chat.rocket.android.R
import chat.rocket.android.chatroom.adapter.PeopleSuggestionsAdapter.PeopleSuggestionViewHolder import chat.rocket.android.chatroom.adapter.PeopleSuggestionsAdapter.PeopleSuggestionViewHolder
import chat.rocket.android.chatroom.uimodel.suggestion.PeopleSuggestionUiModel import chat.rocket.android.chatroom.uimodel.suggestion.PeopleSuggestionUiModel
import chat.rocket.android.util.extensions.setVisible
import chat.rocket.android.suggestions.model.SuggestionModel import chat.rocket.android.suggestions.model.SuggestionModel
import chat.rocket.android.suggestions.ui.BaseSuggestionViewHolder import chat.rocket.android.suggestions.ui.BaseSuggestionViewHolder
import chat.rocket.android.suggestions.ui.SuggestionsAdapter import chat.rocket.android.suggestions.ui.SuggestionsAdapter
...@@ -58,9 +58,9 @@ class PeopleSuggestionsAdapter(context: Context) : SuggestionsAdapter<PeopleSugg ...@@ -58,9 +58,9 @@ class PeopleSuggestionsAdapter(context: Context) : SuggestionsAdapter<PeopleSugg
username.text = item.username username.text = item.username
name.text = item.name name.text = item.name
if (item.imageUri?.isEmpty() != false) { if (item.imageUri?.isEmpty() != false) {
avatar.setVisible(false) avatar.isVisible = false
} else { } else {
avatar.setVisible(true) avatar.isVisible = true
avatar.setImageURI(item.imageUri) avatar.setImageURI(item.imageUri)
} }
val status = item.status val status = item.status
...@@ -68,7 +68,7 @@ class PeopleSuggestionsAdapter(context: Context) : SuggestionsAdapter<PeopleSugg ...@@ -68,7 +68,7 @@ class PeopleSuggestionsAdapter(context: Context) : SuggestionsAdapter<PeopleSugg
val statusDrawable = DrawableHelper.getUserStatusDrawable(status, itemView.context) val statusDrawable = DrawableHelper.getUserStatusDrawable(status, itemView.context)
statusView.setImageDrawable(statusDrawable) statusView.setImageDrawable(statusDrawable)
} else { } else {
statusView.setVisible(false) statusView.isVisible = false
} }
setOnClickListener { setOnClickListener {
itemClickListener?.onClick(item) itemClickListener?.onClick(item)
......
...@@ -12,6 +12,7 @@ import android.view.View ...@@ -12,6 +12,7 @@ import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.ImageView import android.widget.ImageView
import android.widget.TextView import android.widget.TextView
import androidx.core.view.isVisible
import chat.rocket.android.R import chat.rocket.android.R
import chat.rocket.android.infrastructure.LocalRepository import chat.rocket.android.infrastructure.LocalRepository
import chat.rocket.android.infrastructure.checkIfMyself import chat.rocket.android.infrastructure.checkIfMyself
...@@ -53,13 +54,13 @@ class ChatRoomsAdapter( ...@@ -53,13 +54,13 @@ class ChatRoomsAdapter(
bindName(chatRoom, text_chat_name) bindName(chatRoom, text_chat_name)
bindIcon(chatRoom, image_chat_icon) bindIcon(chatRoom, image_chat_icon)
if (settings.showLastMessage()) { if (settings.showLastMessage()) {
text_last_message.setVisible(true) text_last_message.isVisible = true
text_last_message_date_time.setVisible(true) text_last_message_date_time.isVisible = true
bindLastMessageDateTime(chatRoom, text_last_message_date_time) bindLastMessageDateTime(chatRoom, text_last_message_date_time)
bindLastMessage(chatRoom, text_last_message) bindLastMessage(chatRoom, text_last_message)
} else { } else {
text_last_message.setVisible(false) text_last_message.isVisible = false
text_last_message_date_time.setVisible(false) text_last_message_date_time.isVisible = false
} }
bindUnreadMessages(chatRoom, text_total_unread_messages) bindUnreadMessages(chatRoom, text_total_unread_messages)
...@@ -178,13 +179,13 @@ class ChatRoomsAdapter( ...@@ -178,13 +179,13 @@ class ChatRoomsAdapter(
when { when {
totalUnreadMessage in 1..99 -> { totalUnreadMessage in 1..99 -> {
textView.textContent = totalUnreadMessage.toString() textView.textContent = totalUnreadMessage.toString()
textView.setVisible(true) textView.isVisible = true
} }
totalUnreadMessage > 99 -> { totalUnreadMessage > 99 -> {
textView.textContent = context.getString(R.string.msg_more_than_ninety_nine_unread_messages) textView.textContent = context.getString(R.string.msg_more_than_ninety_nine_unread_messages)
textView.setVisible(true) textView.isVisible = true
} }
else -> textView.setVisible(false) else -> textView.isVisible = false
} }
} }
} }
......
...@@ -37,19 +37,6 @@ fun FragmentActivity.clearLightStatusBar() { ...@@ -37,19 +37,6 @@ fun FragmentActivity.clearLightStatusBar() {
} }
} }
// TODO: Remove. Use KTX instead.
fun View.setVisible(visible: Boolean) {
visibility = if (visible) {
View.VISIBLE
} else {
View.GONE
}
}
fun View.isVisible(): Boolean {
return visibility == View.VISIBLE
}
fun ViewGroup.inflate(@LayoutRes resource: Int, attachToRoot: Boolean = false): View = fun ViewGroup.inflate(@LayoutRes resource: Int, attachToRoot: Boolean = false): View =
LayoutInflater.from(context).inflate(resource, this, attachToRoot) LayoutInflater.from(context).inflate(resource, this, attachToRoot)
......
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