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

Merge branch 'develop' into fixTypo

parents b2977969 c733567b
package chat.rocket.android.authentication.loginoptions.ui
import android.animation.Animator
import android.animation.AnimatorListenerAdapter
import android.animation.ValueAnimator
import android.app.Activity
import android.content.Intent
import android.graphics.PorterDuff
......@@ -7,10 +10,13 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.animation.AlphaAnimation
import android.view.animation.Animation
import android.widget.Button
import android.widget.LinearLayout
import androidx.appcompat.view.ContextThemeWrapper
import androidx.core.view.isVisible
import androidx.core.view.marginTop
import androidx.fragment.app.Fragment
import chat.rocket.android.R
import chat.rocket.android.analytics.AnalyticsManager
......@@ -28,6 +34,7 @@ import chat.rocket.android.webview.sso.ui.ssoWebViewIntent
import dagger.android.support.AndroidSupportInjection
import kotlinx.android.synthetic.main.app_bar.*
import kotlinx.android.synthetic.main.fragment_authentication_login_options.*
import timber.log.Timber
import javax.inject.Inject
private const val SERVER_NAME = "server_name"
......@@ -61,6 +68,8 @@ internal const val REQUEST_CODE_FOR_OAUTH = 1
internal const val REQUEST_CODE_FOR_CAS = 2
internal const val REQUEST_CODE_FOR_SAML = 3
private const val DEFAULT_ANIMATION_DURATION = 400L
fun newInstance(
serverName: String,
state: String? = null,
......@@ -238,7 +247,6 @@ class LoginOptionsFragment : Fragment(), LoginOptionsView {
enableLoginByLinkedin()
}
if (gitlabOauthUrl != null && state != null) {
setupGitlabButtonListener(gitlabOauthUrl.toString(), state.toString())
enableLoginByGitlab()
......@@ -390,11 +398,11 @@ class LoginOptionsFragment : Fragment(), LoginOptionsView {
var isAccountsCollapsed = true
button_expand_collapse_accounts.setOnClickListener {
isAccountsCollapsed = if (isAccountsCollapsed) {
button_expand_collapse_accounts.rotateBy(180F, 400)
button_expand_collapse_accounts.rotateBy(180F, DEFAULT_ANIMATION_DURATION)
expandAccountsView()
false
} else {
button_expand_collapse_accounts.rotateBy(180F, 400)
button_expand_collapse_accounts.rotateBy(180F, DEFAULT_ANIMATION_DURATION)
collapseAccountsView()
true
}
......@@ -532,17 +540,73 @@ class LoginOptionsFragment : Fragment(), LoginOptionsView {
}
private fun expandAccountsView() {
(0..accounts_container.childCount)
val buttons = (0..accounts_container.childCount)
.mapNotNull { accounts_container.getChildAt(it) as? Button }
.filter { it.isClickable && !it.isVisible }
.forEach { it.isVisible = true }
val optionHeight = accounts_container.getChildAt(1).height +
accounts_container.getChildAt(1).marginTop
val collapsedHeight = accounts_container.height
val expandedHeight = collapsedHeight + optionHeight * buttons.size
with(ValueAnimator.ofInt(collapsedHeight, expandedHeight)) {
addUpdateListener {
val params = accounts_container.layoutParams
params.height = animatedValue as Int
accounts_container.layoutParams = params
}
addListener(object : AnimatorListenerAdapter() {
override fun onAnimationStart(animator: Animator) {
buttons.forEach {
it.isVisible = true
val anim = AlphaAnimation(0.0f, 1.0f)
anim.duration = DEFAULT_ANIMATION_DURATION
it.startAnimation(anim)
}
}
})
setDuration(DEFAULT_ANIMATION_DURATION).start()
}
}
private fun collapseAccountsView() {
(0..accounts_container.childCount)
val buttons = (0..accounts_container.childCount)
.mapNotNull { accounts_container.getChildAt(it) as? Button }
.filter { it.isClickable && it.isVisible }
.drop(3)
.forEach { it.isVisible = false }
val optionHeight = accounts_container.getChildAt(1).height +
accounts_container.getChildAt(1).marginTop
val expandedHeight = accounts_container.height
val collapsedHeight = expandedHeight - optionHeight * buttons.size
with(ValueAnimator.ofInt(expandedHeight, collapsedHeight)) {
addUpdateListener {
val params = accounts_container.layoutParams
params.height = animatedValue as Int
accounts_container.layoutParams = params
}
addListener(object : AnimatorListenerAdapter() {
override fun onAnimationStart(animator: Animator) {
buttons.forEach {
val anim = AlphaAnimation(1.0f, 0.0f)
anim.duration = DEFAULT_ANIMATION_DURATION
anim.setAnimationListener(object : Animation.AnimationListener {
override fun onAnimationStart(animation: Animation) {
Timber.d("Animation starts: $animation")
}
override fun onAnimationEnd(animation: Animation) {
it.isVisible = false
}
override fun onAnimationRepeat(animation: Animation) {
Timber.d("Animation repeats: $animation")
}
})
it.startAnimation(anim)
}
}
})
setDuration(DEFAULT_ANIMATION_DURATION).start()
}
}
}
......@@ -71,6 +71,7 @@ import chat.rocket.android.helper.AndroidPermissionsHelper.hasCameraPermission
import chat.rocket.android.helper.AndroidPermissionsHelper.hasWriteExternalStoragePermission
import chat.rocket.android.util.extension.asObservable
import chat.rocket.android.util.extension.createImageFile
import chat.rocket.android.util.extension.orFalse
import chat.rocket.android.util.extensions.circularRevealOrUnreveal
import chat.rocket.android.util.extensions.clearLightStatusBar
import chat.rocket.android.util.extensions.fadeIn
......@@ -463,6 +464,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
setupToolbar(roomUiModel.name.toString())
setupMessageComposer(roomUiModel)
isBroadcastChannel = roomUiModel.broadcast
isFavorite = roomUiModel.favorite.orFalse()
if (isBroadcastChannel && !roomUiModel.canModerate) {
disableMenu = true
activity?.invalidateOptionsMenu()
......
......@@ -69,7 +69,7 @@ abstract class ChatRoomDao : BaseDao<ChatRoomEntity> {
@Query("""
$BASE_QUERY
$FILTER_NOT_OPENED
ORDER BY name
ORDER BY name COLLATE NOCASE
""")
abstract fun getAllAlphabetically(): LiveData<List<ChatRoom>>
......@@ -79,7 +79,7 @@ abstract class ChatRoomDao : BaseDao<ChatRoomEntity> {
$FILTER_NOT_OPENED
ORDER BY
$TYPE_ORDER,
name
name COLLATE NOCASE
""")
abstract fun getAllAlphabeticallyGrouped(): LiveData<List<ChatRoom>>
......
......@@ -3,7 +3,7 @@ package chat.rocket.android.helper
object JitsiHelper {
/**
* Returns the for the Jitsi video conferencing URL.
* Returns the Jitsi video conferencing URL.
*
* @param isSecureProtocol True if using SSL, false otherwise - from the public settings.
* @param domain The Jitsi domain - from public settings.
......
......@@ -94,10 +94,16 @@ class MessageParser @Inject constructor(
}
private fun getMention(user: SimpleUser): String {
user.id?.let {
if (SYSTEM_MENTIONS.contains(it)) {
return "@$it"
}
}
return if (settings.useRealName()) {
user.name ?: "@${user.username}"
user.name ?: user.username.orEmpty()
} else {
"@${user.username}"
user.username.orEmpty()
}
}
......@@ -527,5 +533,7 @@ class MessageParser @Inject constructor(
*/
private val WEB_URL = Pattern.compile(
"($WEB_URL_WITH_PROTOCOL|$WEB_URL_WITHOUT_PROTOCOL)")
private val SYSTEM_MENTIONS = arrayOf("all", "here")
}
}
......@@ -95,7 +95,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/screen_edge_left_and_right_margins"
android:layout_marginTop="20dp"
android:text="@string/status"
android:text="@string/user_detail_status"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/text_message" />
......
......@@ -32,7 +32,7 @@
<string name="action_use_this_username">Benutze den Benutzernamen</string>
<string name="action_terms_of_service">Nutzungsbedingungen</string>
<string name="action_privacy_policy">Datenschutz</string>
<string name="action_new_channel">New channel</string> <!-- TODO Translate -->
<string name="action_new_channel">Neuer Kanal</string>
<string name="action_search">Suche</string>
<string name="action_update">Updaten</string>
<string name="action_settings">Einstellungen</string>
......@@ -60,18 +60,18 @@
<string name="action_remove_favorite">Favoriten entfernen</string>
<!-- Settings messages -->
<string name="msg_contact_us">Contact us</string> <!-- TODO Translate -->
<string name="msg_language">Language</string> <!-- TODO Translate -->
<string name="msg_review_this_app">Review this app</string> <!-- TODO Translate -->
<string name="msg_share_this_app">Share this app</string> <!-- TODO Translate -->
<string name="msg_administration">Administration</string> <!-- TODO Translate -->
<string name="msg_license">License</string> <!-- TODO Translate -->
<string name="msg_app_version">Version: %1$s (%2$d)</string> <!-- TODO Translate -->
<string name="msg_server_version">Server version: %1$s</string> <!-- TODO Translate -->
<string name="msg_send_analytics">Send analytics</string> <!-- TODO Translate -->
<string name="msg_logout_from_rocket_chat">Logout from Rocket.Chat</string> <!-- TODO Translate -->
<string name="msg_delete_account">Delete account</string> <!-- TODO Translate -->
<string name="msg_change_status">Change status</string> <!-- TODO Translate -->
<string name="msg_contact_us">Kontaktiere uns</string>
<string name="msg_language">Sprache</string>
<string name="msg_review_this_app">Bewerte diese App</string>
<string name="msg_share_this_app">Teile diese App</string>
<string name="msg_administration">Administration</string>
<string name="msg_license">Lizenz</string>
<string name="msg_app_version">Version: %1$s (%2$d)</string>
<string name="msg_server_version">Serverversion: %1$s</string>
<string name="msg_send_analytics">Analysesaten senden</string>
<string name="msg_logout_from_rocket_chat">Logout von Rocket.Chat</string>
<string name="msg_delete_account">Konto löschen</string>
<string name="msg_change_status">Status ändern</string>
<!-- Regular information messages -->
<string name="msg_generic_error">Entschuldigung, ein Fehler ist aufgetreten, bitte versuchen Sie es noch einmal.</string>
......@@ -172,11 +172,11 @@
<item quantity="other">%1$s reagierte mit %2$s</item>
</plurals>
<string name="msg_credentials_saved_successfully">Login-Daten erfolgreich gespeichert</string>
<string name="msg_camera_permission_denied">Camera permission is needed to open camera.</string> <!-- TODO Add translation -->
<string name="msg_storage_permission_denied">Storage permission is needed to open Drawing.</string> <!-- TODO Add translation -->
<string name="msg_server">Server</string> <!-- TODO Translate -->
<string name="msg_add_new_server">Add New Server</string> <!-- TODO Translate -->
<string name="msg_directory">Directory</string> <!-- TODO Translate -->
<string name="msg_camera_permission_denied">Zum Öffnen der Kamera ist eine Kamera-Berechtigung erforderlich.</string>
<string name="msg_storage_permission_denied">Zum Öffnen der Zeichnung ist eine Speicher-Berechtigung erforderlich.</string>
<string name="msg_server">Server</string>
<string name="msg_add_new_server">Neuen Server hinzufügen</string>
<string name="msg_directory">Verzeichnis</string>
<!-- Create channel messages -->
<string name="msg_private_channel">Privat</string>
......@@ -314,20 +314,20 @@
<string name="alert_title_default_skin_tone">Standard Hautton</string>
<!-- Sort and group -->
<string name="msg_sort_by_placeholder">Sort by %1$s</string> <!-- TODO Translate -->
<string name="msg_sort_by">Sort by</string> <!-- TODO Translate -->
<string name="msg_sort_by_activity">Activity</string> <!-- TODO Translate -->
<string name="msg_sort_by_name">Name</string> <!-- TODO Translate -->
<string name="msg_group_by_unread_on_top">Unread on top</string> <!-- TODO Translate -->
<string name="msg_group_by_type">Group by type</string> <!-- TODO Translate -->
<string name="msg_group_by_favorites">Group by favorites</string> <!-- TODO Translate -->
<string name="msg_sort_by_placeholder">Sortiere nach %1$s</string>
<string name="msg_sort_by">Sortiert nach</string>
<string name="msg_sort_by_activity">Aktivität</string>
<string name="msg_sort_by_name">Name</string>
<string name="msg_group_by_unread_on_top">Ungelesen oben</string>
<string name="msg_group_by_type">Gruppieren nach Typ</string>
<string name="msg_group_by_favorites">Gruppieren nach Favoriten</string>
<!--ChatRooms Headers-->
<string name="header_favorite">Favoriten</string>
<string name="msg_channels">Räume</string>
<string name="msg_users">Users</string> <!-- TODO Translate -->
<string name="msg_search_for_global_users">Search for global users</string> <!-- TODO Translate -->
<string name="msg_search_for_global_users_description">If you turn on, you can search for any user from others companies or servers.</string> <!-- TODO Translate -->
<string name="msg_users">Benutzer</string>
<string name="msg_search_for_global_users">Suche nach globalen Benutzern</string>
<string name="msg_search_for_global_users_description">Wenn Sie dies einschalten, können Sie nach Benutzern von anderen Unternehmen oder Servern suchen.</string>
<string name="header_private_groups">Private Räume</string>
<string name="header_direct_messages">Direkt Nachrichten</string>
<string name="header_live_chats">Live Chats</string>
......
......@@ -360,6 +360,7 @@ https://github.com/RocketChat/java-code-styles/blob/master/CODING_STYLE.md#strin
<!-- User Details -->
<string name="timezone">Timezone</string>
<string name="status" translatable="false">Status: %1$s</string>
<string name="user_detail_status" translatable="false">Status</string>
<!-- Report -->
<string name="submit">Submit</string>
......
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