Commit 95354150 authored by Filipe de Lima Brito's avatar Filipe de Lima Brito

Merge branch 'develop' of github.com:RocketChat/Rocket.Chat.Android into issue_1887

parents 46e490be 31c879b2
...@@ -16,7 +16,7 @@ android { ...@@ -16,7 +16,7 @@ android {
applicationId "chat.rocket.android" applicationId "chat.rocket.android"
minSdkVersion versions.minSdk minSdkVersion versions.minSdk
targetSdkVersion versions.targetSdk targetSdkVersion versions.targetSdk
versionCode 2055 versionCode 2057
versionName "3.2.0" versionName "3.2.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true multiDexEnabled true
......
package chat.rocket.android.chatroom.ui package chat.rocket.android.chatroom.ui
import android.app.Activity import android.app.Activity
import android.app.AlertDialog import androidx.appcompat.app.AlertDialog
import android.content.ClipData import android.content.ClipData
import android.content.ClipboardManager import android.content.ClipboardManager
import android.content.Context import android.content.Context
...@@ -199,7 +199,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR ...@@ -199,7 +199,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
private var verticalScrollOffset = AtomicInteger(0) private var verticalScrollOffset = AtomicInteger(0)
private val dialogView by lazy { View.inflate(context, R.layout.file_attachments_dialog, null) } private val dialogView by lazy { View.inflate(context, R.layout.file_attachments_dialog, null) }
internal val alertDialog by lazy { AlertDialog.Builder(activity).setView(dialogView).create() } internal val alertDialog by lazy { activity?.let { AlertDialog.Builder(it).setView(dialogView).create() } }
internal val imagePreview by lazy { dialogView.findViewById<ImageView>(R.id.image_preview) } internal val imagePreview by lazy { dialogView.findViewById<ImageView>(R.id.image_preview) }
internal val sendButton by lazy { dialogView.findViewById<android.widget.Button>(R.id.button_send) } internal val sendButton by lazy { dialogView.findViewById<android.widget.Button>(R.id.button_send) }
internal val cancelButton by lazy { dialogView.findViewById<android.widget.Button>(R.id.button_cancel) } internal val cancelButton by lazy { dialogView.findViewById<android.widget.Button>(R.id.button_cancel) }
...@@ -311,6 +311,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR ...@@ -311,6 +311,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
showToolbarChatRoomIcon(chatRoomType) showToolbarChatRoomIcon(chatRoomType)
} }
getDraftMessage() getDraftMessage()
subscribeComposeTextMessage()
analyticsManager.logScreenView(ScreenViewEvent.ChatRoom) analyticsManager.logScreenView(ScreenViewEvent.ChatRoom)
} }
...@@ -845,7 +846,6 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR ...@@ -845,7 +846,6 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
true true
) )
subscribeComposeTextMessage()
emojiKeyboardPopup = EmojiKeyboardPopup(activity!!, activity!!.findViewById(R.id.fragment_container)) emojiKeyboardPopup = EmojiKeyboardPopup(activity!!, activity!!.findViewById(R.id.fragment_container))
emojiKeyboardPopup.listener = this emojiKeyboardPopup.listener = this
...@@ -997,12 +997,12 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR ...@@ -997,12 +997,12 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
} }
private fun subscribeComposeTextMessage() { private fun subscribeComposeTextMessage() {
val editTextObservable = text_message.asObservable() text_message.asObservable().let {
compositeDisposable.addAll(
compositeDisposable.addAll( subscribeComposeButtons(it),
subscribeComposeButtons(editTextObservable), subscribeComposeTypingStatus(it)
subscribeComposeTypingStatus(editTextObservable) )
) }
} }
private fun unsubscribeComposeTextMessage() { private fun unsubscribeComposeTextMessage() {
......
...@@ -75,10 +75,10 @@ fun ChatRoomFragment.showFileAttachmentDialog(uri: Uri) { ...@@ -75,10 +75,10 @@ fun ChatRoomFragment.showFileAttachmentDialog(uri: Uri) {
(citation ?: "") + description.text.toString() (citation ?: "") + description.text.toString()
) )
} }
alertDialog.dismiss() alertDialog?.dismiss()
} }
cancelButton.setOnClickListener { alertDialog.dismiss() } cancelButton.setOnClickListener { alertDialog?.dismiss() }
alertDialog.show() alertDialog?.show()
} }
fun ChatRoomFragment.showDrawAttachmentDialog(byteArray: ByteArray) { fun ChatRoomFragment.showDrawAttachmentDialog(byteArray: ByteArray) {
...@@ -92,9 +92,9 @@ fun ChatRoomFragment.showDrawAttachmentDialog(byteArray: ByteArray) { ...@@ -92,9 +92,9 @@ fun ChatRoomFragment.showDrawAttachmentDialog(byteArray: ByteArray) {
byteArray, byteArray,
(citation ?: "") + description.text.toString() (citation ?: "") + description.text.toString()
) )
alertDialog.dismiss() alertDialog?.dismiss()
} }
cancelButton.setOnClickListener { alertDialog.dismiss() } cancelButton.setOnClickListener { alertDialog?.dismiss() }
alertDialog.show() alertDialog?.show()
} }
package chat.rocket.android.chatrooms.ui package chat.rocket.android.chatrooms.ui
import android.app.AlertDialog import androidx.appcompat.app.AlertDialog
import android.app.ProgressDialog import android.app.ProgressDialog
import android.os.Bundle import android.os.Bundle
import android.os.Handler import android.os.Handler
...@@ -236,14 +236,16 @@ class ChatRoomsFragment : Fragment(), ChatRoomsView { ...@@ -236,14 +236,16 @@ class ChatRoomsFragment : Fragment(), ChatRoomsView {
) )
} }
AlertDialog.Builder(context) context?.let {
.setTitle(R.string.dialog_sort_title) AlertDialog.Builder(it)
.setView(dialogLayout) .setTitle(R.string.dialog_sort_title)
.setPositiveButton(R.string.msg_sort) { dialog, _ -> .setView(dialogLayout)
invalidateQueryOnSearch() .setPositiveButton(R.string.msg_sort) { dialog, _ ->
updateSort() invalidateQueryOnSearch()
dialog.dismiss() updateSort()
}.show() dialog.dismiss()
}.show()
}
} }
} }
return super.onOptionsItemSelected(item) return super.onOptionsItemSelected(item)
......
...@@ -2,7 +2,7 @@ package chat.rocket.android.main.ui ...@@ -2,7 +2,7 @@ package chat.rocket.android.main.ui
import DrawableHelper import DrawableHelper
import android.app.Activity import android.app.Activity
import android.app.AlertDialog import androidx.appcompat.app.AlertDialog
import android.app.ProgressDialog import android.app.ProgressDialog
import android.os.Bundle import android.os.Bundle
import androidx.annotation.IdRes import androidx.annotation.IdRes
...@@ -13,6 +13,7 @@ import androidx.fragment.app.Fragment ...@@ -13,6 +13,7 @@ import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import chat.rocket.android.BuildConfig import chat.rocket.android.BuildConfig
import chat.rocket.android.R import chat.rocket.android.R
import chat.rocket.android.chatrooms.ui.ChatRoomsFragment
import chat.rocket.android.main.adapter.AccountsAdapter import chat.rocket.android.main.adapter.AccountsAdapter
import chat.rocket.android.main.adapter.Selector import chat.rocket.android.main.adapter.Selector
import chat.rocket.android.main.presentation.MainPresenter import chat.rocket.android.main.presentation.MainPresenter
...@@ -98,6 +99,21 @@ class MainActivity : AppCompatActivity(), MainView, HasActivityInjector, ...@@ -98,6 +99,21 @@ class MainActivity : AppCompatActivity(), MainView, HasActivityInjector,
} }
} }
override fun onBackPressed() {
if (drawer_layout.isDrawerOpen(GravityCompat.START)) {
closeDrawer()
} else {
supportFragmentManager.findFragmentById(R.id.fragment_container)?.let {
if (it !is ChatRoomsFragment && supportFragmentManager.backStackEntryCount == 0) {
presenter.toChatList(chatRoomId)
setCheckedNavDrawerItem(R.id.menu_action_chats)
} else {
super.onBackPressed()
}
}
}
}
override fun activityInjector(): AndroidInjector<Activity> = activityDispatchingAndroidInjector override fun activityInjector(): AndroidInjector<Activity> = activityDispatchingAndroidInjector
override fun supportFragmentInjector(): AndroidInjector<Fragment> = override fun supportFragmentInjector(): AndroidInjector<Fragment> =
......
...@@ -2,7 +2,7 @@ package chat.rocket.android.profile.ui ...@@ -2,7 +2,7 @@ package chat.rocket.android.profile.ui
import DrawableHelper import DrawableHelper
import android.app.Activity import android.app.Activity
import android.app.AlertDialog import androidx.appcompat.app.AlertDialog
import android.content.Intent import android.content.Intent
import android.graphics.Bitmap import android.graphics.Bitmap
import android.os.Build import android.os.Build
...@@ -296,14 +296,16 @@ class ProfileFragment : Fragment(), ProfileView, ActionMode.Callback { ...@@ -296,14 +296,16 @@ class ProfileFragment : Fragment(), ProfileView, ActionMode.Callback {
val passwordEditText = EditText(context) val passwordEditText = EditText(context)
passwordEditText.hint = getString(R.string.msg_password) passwordEditText.hint = getString(R.string.msg_password)
val builder = AlertDialog.Builder(context) context?.let {
builder.setTitle(R.string.title_are_you_sure) val builder = AlertDialog.Builder(it)
.setView(passwordEditText) builder.setTitle(R.string.title_are_you_sure)
.setPositiveButton(R.string.action_delete_account) { _, _ -> .setView(passwordEditText)
presenter.deleteAccount(passwordEditText.text.toString()) .setPositiveButton(R.string.action_delete_account) { _, _ ->
} presenter.deleteAccount(passwordEditText.text.toString())
.setNegativeButton(android.R.string.no) { dialog, _ -> dialog.cancel() } }
.create() .setNegativeButton(android.R.string.no) { dialog, _ -> dialog.cancel() }
.show() .create()
.show()
}
} }
} }
...@@ -23,6 +23,7 @@ import chat.rocket.android.settings.password.ui.PasswordActivity ...@@ -23,6 +23,7 @@ import chat.rocket.android.settings.password.ui.PasswordActivity
import chat.rocket.android.settings.presentation.SettingsView import chat.rocket.android.settings.presentation.SettingsView
import chat.rocket.android.util.extensions.addFragmentBackStack import chat.rocket.android.util.extensions.addFragmentBackStack
import chat.rocket.android.util.extensions.inflate import chat.rocket.android.util.extensions.inflate
import chat.rocket.android.util.extensions.showToast
import chat.rocket.android.webview.ui.webViewIntent import chat.rocket.android.webview.ui.webViewIntent
import dagger.android.support.AndroidSupportInjection import dagger.android.support.AndroidSupportInjection
import kotlinx.android.synthetic.main.fragment_settings.* import kotlinx.android.synthetic.main.fragment_settings.*
...@@ -73,20 +74,23 @@ class SettingsFragment : Fragment(), SettingsView, AdapterView.OnItemClickListen ...@@ -73,20 +74,23 @@ class SettingsFragment : Fragment(), SettingsView, AdapterView.OnItemClickListen
resources.getStringArray(R.array.settings_actions)[1] -> resources.getStringArray(R.array.settings_actions)[1] ->
activity?.startActivity(Intent(activity, PasswordActivity::class.java)) activity?.startActivity(Intent(activity, PasswordActivity::class.java))
resources.getStringArray(R.array.settings_actions)[2] -> shareApp() // TODO (https://github.com/RocketChat/Rocket.Chat.Android/pull/1918)
resources.getStringArray(R.array.settings_actions)[2] -> showToast("Coming soon")
resources.getStringArray(R.array.settings_actions)[3] -> showAppOnStore() resources.getStringArray(R.array.settings_actions)[3] -> shareApp()
resources.getStringArray(R.array.settings_actions)[4] -> contactSupport() resources.getStringArray(R.array.settings_actions)[4] -> showAppOnStore()
resources.getStringArray(R.array.settings_actions)[5] -> activity?.startActivity( resources.getStringArray(R.array.settings_actions)[5] -> contactSupport()
resources.getStringArray(R.array.settings_actions)[6] -> activity?.startActivity(
context?.webViewIntent( context?.webViewIntent(
getString(R.string.license_url), getString(R.string.license_url),
getString(R.string.title_licence) getString(R.string.title_licence)
) )
) )
resources.getStringArray(R.array.settings_actions)[6] -> { resources.getStringArray(R.array.settings_actions)[7] -> {
(activity as AppCompatActivity).addFragmentBackStack( (activity as AppCompatActivity).addFragmentBackStack(
TAG_ABOUT_FRAGMENT, TAG_ABOUT_FRAGMENT,
R.id.fragment_container R.id.fragment_container
......
...@@ -71,12 +71,12 @@ ...@@ -71,12 +71,12 @@
<string-array name="settings_actions"> <string-array name="settings_actions">
<item name="item_preferences">Eigenschaften</item> <item name="item_preferences">Eigenschaften</item>
<item name="item_password">Passwort ändern</item> <item name="item_password">Passwort ändern</item>
<item name="change_language">Change Language</item>
<item name="item_share_app">Link zur App teilen</item> <item name="item_share_app">Link zur App teilen</item>
<item name="item_rate_us">Bewerten Sie uns</item> <item name="item_rate_us">Bewerten Sie uns</item>
<item name="item_contact_us">Kontaktieren Sie uns</item> <item name="item_contact_us">Kontaktieren Sie uns</item>
<item name="item_licence">Lizenz</item> <item name="item_licence">Lizenz</item>
<item name="item_about">Über</item> <item name="item_about">Über</item>
</string-array> </string-array>
<!-- Regular information messages --> <!-- Regular information messages -->
......
...@@ -63,6 +63,7 @@ ...@@ -63,6 +63,7 @@
<string-array name="settings_actions"> <string-array name="settings_actions">
<item name="item_preferences">Preferences</item> <!-- TODO Add translation --> <item name="item_preferences">Preferences</item> <!-- TODO Add translation -->
<item name="item_password">Change password</item> <!-- TODO Add translation --> <item name="item_password">Change password</item> <!-- TODO Add translation -->
<item name="change_language">Change Language</item> <!-- TODO Add translation -->
<item name="item_share_app">Share app</item> <!-- TODO Add translation --> <item name="item_share_app">Share app</item> <!-- TODO Add translation -->
<item name="item_rate_us">Rate us</item> <!-- TODO Add translation --> <item name="item_rate_us">Rate us</item> <!-- TODO Add translation -->
<item name="item_contact_us">Contact us</item> <!-- TODO Add translation --> <item name="item_contact_us">Contact us</item> <!-- TODO Add translation -->
......
...@@ -64,6 +64,7 @@ ...@@ -64,6 +64,7 @@
<string-array name="settings_actions"> <string-array name="settings_actions">
<item name="item_preferences">Preferences</item> <!-- TODO Add translation --> <item name="item_preferences">Preferences</item> <!-- TODO Add translation -->
<item name="item_password">Change password</item> <!-- TODO Add translation --> <item name="item_password">Change password</item> <!-- TODO Add translation -->
<item name="change_language">Change Language</item> <!-- TODO Add translation -->
<item name="item_share_app">Share app</item> <!-- TODO Add translation --> <item name="item_share_app">Share app</item> <!-- TODO Add translation -->
<item name="item_rate_us">Rate us</item> <!-- TODO Add translation --> <item name="item_rate_us">Rate us</item> <!-- TODO Add translation -->
<item name="item_contact_us">Contact us</item> <!-- TODO Add translation --> <item name="item_contact_us">Contact us</item> <!-- TODO Add translation -->
......
<?xml version="1.0" encoding="utf-8" ?>
<resources> <resources>
<string name="app_name" translatable="false">Rocket.Chat</string>
<!-- Titles --> <!-- Titles -->
<string name="title_sign_in_your_server">サーバーに接続</string> <string name="title_sign_in_your_server">サーバーに接続</string>
...@@ -66,7 +64,7 @@ ...@@ -66,7 +64,7 @@
<string-array name="settings_actions"> <string-array name="settings_actions">
<item name="item_preferences">Preferences</item> <!-- TODO Add translation --> <item name="item_preferences">Preferences</item> <!-- TODO Add translation -->
<item name="item_password">Change password</item> <!-- TODO Add translation --> <item name="item_password">Change password</item> <!-- TODO Add translation -->
<item name="change_language">Change Language </item><!-- TODO Add translation --> <item name="change_language">Change Language</item><!-- TODO Add translation -->
<item name="item_share_app">Share app</item> <!-- TODO Add translation --> <item name="item_share_app">Share app</item> <!-- TODO Add translation -->
<item name="item_rate_us">Rate us</item> <!-- TODO Add translation --> <item name="item_rate_us">Rate us</item> <!-- TODO Add translation -->
<item name="item_contact_us">Contact us</item> <!-- TODO Add translation --> <item name="item_contact_us">Contact us</item> <!-- TODO Add translation -->
......
...@@ -64,6 +64,7 @@ ...@@ -64,6 +64,7 @@
<string-array name="settings_actions"> <string-array name="settings_actions">
<item name="item_preferences">Preferências</item> <item name="item_preferences">Preferências</item>
<item name="item_password">Alterar senha</item> <item name="item_password">Alterar senha</item>
<item name="change_language">Alterar idioma</item>
<item name="item_share_app">Compartilhar app</item> <item name="item_share_app">Compartilhar app</item>
<item name="item_rate_us">Classifique-nos</item> <item name="item_rate_us">Classifique-nos</item>
<item name="item_contact_us">Contate-nos</item> <item name="item_contact_us">Contate-nos</item>
......
...@@ -64,6 +64,7 @@ ...@@ -64,6 +64,7 @@
<string-array name="settings_actions"> <string-array name="settings_actions">
<item name="item_preferences">Preferences</item> <!-- TODO Add translation --> <item name="item_preferences">Preferences</item> <!-- TODO Add translation -->
<item name="item_password">Change password</item> <!-- TODO Add translation --> <item name="item_password">Change password</item> <!-- TODO Add translation -->
<item name="change_language">Change Language</item> <!-- TODO Add translation -->
<item name="item_share_app">Share app</item> <!-- TODO Add translation --> <item name="item_share_app">Share app</item> <!-- TODO Add translation -->
<item name="item_rate_us">Rate us</item> <!-- TODO Add translation --> <item name="item_rate_us">Rate us</item> <!-- TODO Add translation -->
<item name="item_contact_us">Contact us</item> <!-- TODO Add translation --> <item name="item_contact_us">Contact us</item> <!-- TODO Add translation -->
...@@ -90,7 +91,6 @@ ...@@ -90,7 +91,6 @@
<string name="msg_check_your_email_to_reset_your_password">Eposta gönderilmiştir! Şifrenizi sıfırlamak için eposta kutunuzu kontrol ediniz.</string> <string name="msg_check_your_email_to_reset_your_password">Eposta gönderilmiştir! Şifrenizi sıfırlamak için eposta kutunuzu kontrol ediniz.</string>
<string name="msg_invalid_email">Lütfen, geçerli bir eposta adresi giriniz</string> <string name="msg_invalid_email">Lütfen, geçerli bir eposta adresi giriniz</string>
<string name="msg_new_user_agreement">Devam ederek \n%1$s ve %2$s kabul ediyorsunuz</string> <string name="msg_new_user_agreement">Devam ederek \n%1$s ve %2$s kabul ediyorsunuz</string>
<string name="msg_more_than_ninety_nine_unread_messages" translatable="false">99+</string>
<string name="msg_yesterday">Dün</string> <string name="msg_yesterday">Dün</string>
<string name="msg_today">Bugün</string> <string name="msg_today">Bugün</string>
<string name="msg_message">Mesaj</string> <string name="msg_message">Mesaj</string>
......
...@@ -64,6 +64,7 @@ ...@@ -64,6 +64,7 @@
<string-array name="settings_actions"> <string-array name="settings_actions">
<item name="item_preferences">Preferences</item> <!-- TODO Add translation --> <item name="item_preferences">Preferences</item> <!-- TODO Add translation -->
<item name="item_password">Change password</item> <!-- TODO Add translation --> <item name="item_password">Change password</item> <!-- TODO Add translation -->
<item name="change_language">Change Language</item> <!-- TODO Add translation -->
<item name="item_share_app">Share app</item> <!-- TODO Add translation --> <item name="item_share_app">Share app</item> <!-- TODO Add translation -->
<item name="item_rate_us">Rate us</item> <!-- TODO Add translation --> <item name="item_rate_us">Rate us</item> <!-- TODO Add translation -->
<item name="item_contact_us">Contact us</item> <!-- TODO Add translation --> <item name="item_contact_us">Contact us</item> <!-- TODO Add translation -->
......
This diff is collapsed.
...@@ -76,7 +76,7 @@ https://github.com/RocketChat/java-code-styles/blob/master/CODING_STYLE.md#strin ...@@ -76,7 +76,7 @@ https://github.com/RocketChat/java-code-styles/blob/master/CODING_STYLE.md#strin
<string-array name="settings_actions"> <string-array name="settings_actions">
<item name="item_preferences">Preferences</item> <item name="item_preferences">Preferences</item>
<item name="item_password">Change password</item> <item name="item_password">Change password</item>
<item name="change_language">Change Language </item> <item name="change_language">Change Language</item>
<item name="item_share_app">Share app</item> <item name="item_share_app">Share app</item>
<item name="item_rate_us">Rate us</item> <item name="item_rate_us">Rate us</item>
<item name="item_contact_us">Contact us</item> <item name="item_contact_us">Contact us</item>
......
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