Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AloqaIM-Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
AloqaIM-Android
Commits
fc0e5f04
Commit
fc0e5f04
authored
Dec 16, 2018
by
Akshat Jain
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/nullfix' into nullfix
parents
910fa181
f5c8aa45
Changes
34
Hide whitespace changes
Inline
Side-by-side
Showing
34 changed files
with
141 additions
and
113 deletions
+141
-113
build.gradle
app/build.gradle
+1
-1
ChatRoomFragment.kt
.../java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
+2
-2
UiModelMapper.kt
...ava/chat/rocket/android/chatroom/uimodel/UiModelMapper.kt
+7
-3
PasswordPresenter.kt
...droid/settings/password/presentation/PasswordPresenter.kt
+8
-8
PasswordFragment.kt
...t/rocket/android/settings/password/ui/PasswordFragment.kt
+15
-28
dialog_report.xml
app/src/main/res/layout/dialog_report.xml
+1
-1
file_attachments_dialog.xml
app/src/main/res/layout/file_attachments_dialog.xml
+2
-2
fragment_authentication_log_in.xml
app/src/main/res/layout/fragment_authentication_log_in.xml
+2
-2
fragment_authentication_login_options.xml
...main/res/layout/fragment_authentication_login_options.xml
+8
-8
fragment_authentication_register_username.xml
.../res/layout/fragment_authentication_register_username.xml
+1
-1
fragment_authentication_reset_password.xml
...ain/res/layout/fragment_authentication_reset_password.xml
+1
-1
fragment_authentication_server.xml
app/src/main/res/layout/fragment_authentication_server.xml
+1
-1
fragment_authentication_sign_up.xml
app/src/main/res/layout/fragment_authentication_sign_up.xml
+1
-1
fragment_authentication_two_fa.xml
app/src/main/res/layout/fragment_authentication_two_fa.xml
+1
-1
fragment_password.xml
app/src/main/res/layout/fragment_password.xml
+15
-15
item_message_reply.xml
app/src/main/res/layout/item_message_reply.xml
+1
-1
message_attachment_options.xml
app/src/main/res/layout/message_attachment_options.xml
+3
-3
message_composer.xml
app/src/main/res/layout/message_composer.xml
+1
-1
update_avatar_options.xml
app/src/main/res/layout/update_avatar_options.xml
+3
-3
strings.xml
app/src/main/res/values-de/strings.xml
+2
-0
strings.xml
app/src/main/res/values-es/strings.xml
+2
-1
strings.xml
app/src/main/res/values-fr/strings.xml
+2
-1
strings.xml
app/src/main/res/values-hi-rIN/strings.xml
+2
-1
strings.xml
app/src/main/res/values-it/strings.xml
+2
-1
strings.xml
app/src/main/res/values-ja/strings.xml
+4
-3
strings.xml
app/src/main/res/values-pt-rBR/strings.xml
+2
-0
strings.xml
app/src/main/res/values-ru-rRU/strings.xml
+2
-1
strings.xml
app/src/main/res/values-tr/strings.xml
+2
-1
strings.xml
app/src/main/res/values-uk/strings.xml
+2
-1
strings.xml
app/src/main/res/values/strings.xml
+2
-1
styles.xml
app/src/main/res/values/styles.xml
+1
-1
SuggestionsAdapter.kt
.../chat/rocket/android/suggestions/ui/SuggestionsAdapter.kt
+9
-3
SuggestionsView.kt
...ava/chat/rocket/android/suggestions/ui/SuggestionsView.kt
+27
-15
Url.kt
util/src/main/java/chat/rocket/android/util/extension/Url.kt
+6
-0
No files found.
app/build.gradle
View file @
fc0e5f04
...
...
@@ -16,7 +16,7 @@ android {
applicationId
"chat.rocket.android"
minSdkVersion
versions
.
minSdk
targetSdkVersion
versions
.
targetSdk
versionCode
205
2
versionCode
205
4
versionName
"3.2.0"
testInstrumentationRunner
"androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled
true
...
...
app/src/main/java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
View file @
fc0e5f04
...
...
@@ -198,8 +198,8 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
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
imagePreview
by
lazy
{
dialogView
.
findViewById
<
ImageView
>(
R
.
id
.
image_preview
)
}
internal
val
sendButton
by
lazy
{
dialogView
.
findViewById
<
Button
>(
R
.
id
.
button_send
)
}
internal
val
cancelButton
by
lazy
{
dialogView
.
findViewById
<
Button
>(
R
.
id
.
button_cancel
)
}
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
description
by
lazy
{
dialogView
.
findViewById
<
EditText
>(
R
.
id
.
text_file_description
)
}
internal
val
audioVideoAttachment
by
lazy
{
dialogView
.
findViewById
<
FrameLayout
>(
R
.
id
.
audio_video_attachment
)
}
internal
val
textFile
by
lazy
{
dialogView
.
findViewById
<
TextView
>(
R
.
id
.
text_file_name
)
}
...
...
app/src/main/java/chat/rocket/android/chatroom/uimodel/UiModelMapper.kt
View file @
fc0e5f04
...
...
@@ -19,7 +19,6 @@ import chat.rocket.android.dagger.scope.PerFragment
import
chat.rocket.android.db.DatabaseManager
import
chat.rocket.android.emoji.EmojiParser
import
chat.rocket.android.emoji.EmojiRepository
import
chat.rocket.android.emoji.internal.isCustom
import
chat.rocket.android.helper.MessageHelper
import
chat.rocket.android.helper.MessageParser
import
chat.rocket.android.helper.UserHelper
...
...
@@ -32,7 +31,7 @@ import chat.rocket.android.server.domain.messageReadReceiptEnabled
import
chat.rocket.android.server.domain.messageReadReceiptStoreUsers
import
chat.rocket.android.server.domain.useRealName
import
chat.rocket.android.server.infraestructure.ConnectionManagerFactory
import
chat.rocket.android.util.extension.
orFals
e
import
chat.rocket.android.util.extension.
isImag
e
import
chat.rocket.android.util.extensions.avatarUrl
import
chat.rocket.android.util.extensions.ifNotNullNorEmpty
import
chat.rocket.android.util.extensions.isNotNullNorEmpty
...
...
@@ -127,7 +126,12 @@ class UiModelMapper @Inject constructor(
getChatRoomAsync
(
message
.
roomId
)
?.
let
{
chatRoom
->
message
.
urls
?.
forEach
{
url
->
mapUrl
(
message
,
url
,
chatRoom
)
?.
let
{
list
.
add
(
it
)
}
if
(
url
.
url
.
isImage
())
{
val
attachment
=
Attachment
(
imageUrl
=
url
.
url
)
mapAttachment
(
message
,
attachment
,
chatRoom
)
?.
let
{
list
.
add
(
it
)
}
}
else
{
mapUrl
(
message
,
url
,
chatRoom
)
?.
let
{
list
.
add
(
it
)
}
}
}
message
.
attachments
?.
mapNotNull
{
attachment
->
...
...
app/src/main/java/chat/rocket/android/settings/password/presentation/PasswordPresenter.kt
View file @
fc0e5f04
...
...
@@ -2,13 +2,13 @@ package chat.rocket.android.settings.password.presentation
import
chat.rocket.android.analytics.AnalyticsManager
import
chat.rocket.android.core.lifecycle.CancelStrategy
import
chat.rocket.android.helper.UserHelper
import
chat.rocket.android.server.domain.GetCurrentServerInteractor
import
chat.rocket.android.server.infraestructure.RocketChatClientFactory
import
chat.rocket.android.util.extension.launchUI
import
chat.rocket.android.util.retryIO
import
chat.rocket.common.RocketChatException
import
chat.rocket.core.RocketChatClient
import
chat.rocket.core.internal.rest.me
import
chat.rocket.core.internal.rest.updateProfile
import
javax.inject.Inject
...
...
@@ -16,6 +16,7 @@ class PasswordPresenter @Inject constructor(
private
val
view
:
PasswordView
,
private
val
strategy
:
CancelStrategy
,
private
val
analyticsManager
:
AnalyticsManager
,
private
val
userHelp
:
UserHelper
,
serverInteractor
:
GetCurrentServerInteractor
,
factory
:
RocketChatClientFactory
)
{
...
...
@@ -26,14 +27,13 @@ class PasswordPresenter @Inject constructor(
launchUI
(
strategy
)
{
try
{
view
.
showLoading
()
val
me
=
retryIO
(
"me"
)
{
client
.
me
()
}
retryIO
(
"updateProfile(${me.id})"
)
{
client
.
updateProfile
(
me
.
id
,
null
,
null
,
password
,
null
)
userHelp
.
user
()
?.
id
?.
let
{
userId
->
retryIO
(
"updateProfile()"
)
{
client
.
updateProfile
(
userId
,
null
,
null
,
password
,
null
)
}
analyticsManager
.
logResetPassword
(
true
)
view
.
showPasswordSuccessfullyUpdatedMessage
()
}
analyticsManager
.
logResetPassword
(
true
)
view
.
showPasswordSuccessfullyUpdatedMessage
()
}
catch
(
exception
:
RocketChatException
)
{
analyticsManager
.
logResetPassword
(
false
)
view
.
showPasswordFailsUpdateMessage
(
exception
.
message
)
...
...
app/src/main/java/chat/rocket/android/settings/password/ui/PasswordFragment.kt
View file @
fc0e5f04
...
...
@@ -6,7 +6,6 @@ import android.view.Menu
import
android.view.MenuItem
import
android.view.View
import
android.view.ViewGroup
import
android.widget.Toast
import
androidx.appcompat.view.ActionMode
import
androidx.fragment.app.Fragment
import
chat.rocket.android.R
...
...
@@ -16,6 +15,7 @@ import chat.rocket.android.settings.password.presentation.PasswordPresenter
import
chat.rocket.android.settings.password.presentation.PasswordView
import
chat.rocket.android.util.extension.asObservable
import
chat.rocket.android.util.extensions.inflate
import
chat.rocket.android.util.extensions.showToast
import
chat.rocket.android.util.extensions.textContent
import
chat.rocket.android.util.extensions.ui
import
dagger.android.support.AndroidSupportInjection
...
...
@@ -33,7 +33,7 @@ class PasswordFragment : Fragment(), PasswordView, ActionMode.Callback {
@Inject
lateinit
var
analyticsManager
:
AnalyticsManager
private
var
actionMode
:
ActionMode
?
=
null
private
val
disposables
=
CompositeDisposable
()
private
val
compositeDisposable
=
CompositeDisposable
()
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
AndroidSupportInjection
.
inject
(
this
)
...
...
@@ -48,14 +48,12 @@ class PasswordFragment : Fragment(), PasswordView, ActionMode.Callback {
override
fun
onViewCreated
(
view
:
View
,
savedInstanceState
:
Bundle
?)
{
super
.
onViewCreated
(
view
,
savedInstanceState
)
disposables
.
add
(
listenToChanges
())
compositeDisposable
.
add
(
listenToChanges
())
analyticsManager
.
logScreenView
(
ScreenViewEvent
.
Password
)
}
override
fun
onDestroyView
()
{
disposables
.
clear
()
compositeDisposable
.
clear
()
super
.
onDestroyView
()
}
...
...
@@ -74,21 +72,19 @@ class PasswordFragment : Fragment(), PasswordView, ActionMode.Callback {
mode
.
finish
()
return
true
}
else
->
{
false
}
else
->
false
}
}
override
fun
onCreateActionMode
(
mode
:
ActionMode
,
menu
:
Menu
?
):
Boolean
{
override
fun
onCreateActionMode
(
mode
:
ActionMode
,
menu
:
Menu
):
Boolean
{
mode
.
menuInflater
.
inflate
(
R
.
menu
.
password
,
menu
)
mode
.
title
=
resources
.
getString
(
R
.
string
.
action_confirm_password
)
return
true
}
override
fun
onPrepareActionMode
(
mode
:
ActionMode
?
,
menu
:
Menu
?):
Boolean
=
false
override
fun
onPrepareActionMode
(
mode
:
ActionMode
,
menu
:
Menu
?):
Boolean
=
false
override
fun
onDestroyActionMode
(
mode
:
ActionMode
?
)
{
override
fun
onDestroyActionMode
(
mode
:
ActionMode
)
{
actionMode
=
null
}
...
...
@@ -101,11 +97,11 @@ class PasswordFragment : Fragment(), PasswordView, ActionMode.Callback {
}
override
fun
showPasswordFailsUpdateMessage
(
error
:
String
?)
{
showToast
(
"Password fails to update: "
+
error
)
showToast
(
getString
(
R
.
string
.
msg_unable_to_update_password
,
error
)
)
}
override
fun
showPasswordSuccessfullyUpdatedMessage
()
{
showToast
(
"Password was successfully updated!"
)
showToast
(
R
.
string
.
msg_password_updated_successfully
)
}
private
fun
finishActionMode
()
=
actionMode
?.
finish
()
...
...
@@ -115,22 +111,13 @@ class PasswordFragment : Fragment(), PasswordView, ActionMode.Callback {
text_new_password
.
asObservable
(),
text_confirm_password
.
asObservable
()
).
subscribe
{
val
textPassword
=
text_new_password
.
textContent
val
textConfirmPassword
=
text_confirm_password
.
textContent
if
(
textPassword
.
length
>
5
&&
textConfirmPassword
.
length
>
5
&&
textPassword
.
equals
(
textConfirmPassword
)
)
val
newPassword
=
it
.
first
.
toString
()
val
newPasswordConfirmation
=
it
.
second
.
toString
()
if
(
newPassword
.
length
>
5
&&
newPassword
==
newPasswordConfirmation
)
{
startActionMode
()
else
}
else
{
finishActionMode
()
}
}
private
fun
showToast
(
msg
:
String
?)
{
ui
{
Toast
.
makeText
(
it
,
msg
,
Toast
.
LENGTH_LONG
).
show
()
}
}
}
...
...
app/src/main/res/layout/dialog_report.xml
View file @
fc0e5f04
...
...
@@ -113,7 +113,7 @@
app:layout_constraintTop_toBottomOf=
"@+id/edit_text_description"
tools:visibility=
"visible"
/>
<Button
<
android.widget.
Button
android:id=
"@+id/button_send_report"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
...
...
app/src/main/res/layout/file_attachments_dialog.xml
View file @
fc0e5f04
...
...
@@ -79,7 +79,7 @@
android:layout_margin=
"16dp"
android:hint=
"@string/msg_file_description"
/>
<Button
<
android.widget.
Button
android:id=
"@+id/button_send"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
...
...
@@ -90,7 +90,7 @@
android:text=
"@string/msg_send"
android:textColor=
"@color/colorWhite"
/>
<Button
<
android.widget.
Button
android:id=
"@+id/button_cancel"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
...
...
app/src/main/res/layout/fragment_authentication_log_in.xml
View file @
fc0e5f04
...
...
@@ -39,7 +39,7 @@
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/text_username_or_email"
/>
<Button
<
android.widget.
Button
android:id=
"@+id/button_log_in"
style=
"@style/Authentication.Button"
android:layout_marginTop=
"20dp"
...
...
@@ -50,7 +50,7 @@
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/text_password"
/>
<Button
<
android.widget.
Button
android:id=
"@+id/button_forgot_your_password"
style=
"@style/Authentication.Button.Borderless"
android:layout_marginTop=
"10dp"
...
...
app/src/main/res/layout/fragment_authentication_login_options.xml
View file @
fc0e5f04
...
...
@@ -21,7 +21,7 @@
app:layout_constraintTop_toTopOf=
"parent"
tools:visibility=
"visible"
>
<Button
<
android.widget.
Button
android:id=
"@+id/button_facebook"
style=
"?borderlessButtonStyle"
android:layout_width=
"match_parent"
...
...
@@ -39,7 +39,7 @@
android:visibility=
"gone"
tools:visibility=
"visible"
/>
<Button
<
android.widget.
Button
android:id=
"@+id/button_github"
style=
"?borderlessButtonStyle"
android:layout_width=
"match_parent"
...
...
@@ -58,7 +58,7 @@
android:visibility=
"gone"
tools:visibility=
"visible"
/>
<Button
<
android.widget.
Button
android:id=
"@+id/button_google"
style=
"?borderlessButtonStyle"
android:layout_width=
"match_parent"
...
...
@@ -77,7 +77,7 @@
android:visibility=
"gone"
tools:visibility=
"visible"
/>
<Button
<
android.widget.
Button
android:id=
"@+id/button_linkedin"
style=
"?borderlessButtonStyle"
android:layout_width=
"match_parent"
...
...
@@ -96,7 +96,7 @@
android:visibility=
"gone"
tools:visibility=
"visible"
/>
<Button
<
android.widget.
Button
android:id=
"@+id/button_gitlab"
style=
"?borderlessButtonStyle"
android:layout_width=
"match_parent"
...
...
@@ -115,7 +115,7 @@
android:visibility=
"gone"
tools:visibility=
"visible"
/>
<Button
<
android.widget.
Button
android:id=
"@+id/button_wordpress"
style=
"?borderlessButtonStyle"
android:layout_width=
"match_parent"
...
...
@@ -179,7 +179,7 @@
app:layout_constraintTop_toTopOf=
"@+id/button_expand_collapse_accounts"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
<Button
<
android.widget.
Button
android:id=
"@+id/button_login_with_email"
style=
"@style/Authentication.Button"
android:layout_marginTop=
"32dp"
...
...
@@ -190,7 +190,7 @@
app:layout_constraintTop_toBottomOf=
"@+id/expand_more_accounts_container"
tools:visibility=
"visible"
/>
<Button
<
android.widget.
Button
android:id=
"@+id/button_create_an_account"
style=
"@style/Authentication.Button.Borderless"
android:layout_marginTop=
"10dp"
...
...
app/src/main/res/layout/fragment_authentication_register_username.xml
View file @
fc0e5f04
...
...
@@ -26,7 +26,7 @@
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/text_sign_in_to_your_server"
/>
<Button
<
android.widget.
Button
android:id=
"@+id/button_use_this_username"
style=
"@style/Authentication.Button"
android:layout_marginTop=
"20dp"
...
...
app/src/main/res/layout/fragment_authentication_reset_password.xml
View file @
fc0e5f04
...
...
@@ -26,7 +26,7 @@
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/text_reset_password"
/>
<Button
<
android.widget.
Button
android:id=
"@+id/button_reset_password"
style=
"@style/Authentication.Button"
android:layout_marginTop=
"20dp"
...
...
app/src/main/res/layout/fragment_authentication_server.xml
View file @
fc0e5f04
...
...
@@ -63,7 +63,7 @@
android:inputType=
"text|textUri"
/>
</RelativeLayout>
<Button
<
android.widget.
Button
android:id=
"@+id/button_connect"
style=
"@style/Authentication.Button"
android:layout_marginTop=
"20dp"
...
...
app/src/main/res/layout/fragment_authentication_sign_up.xml
View file @
fc0e5f04
...
...
@@ -66,7 +66,7 @@
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/text_password"
/>
<Button
<
android.widget.
Button
android:id=
"@+id/button_register"
style=
"@style/Authentication.Button"
android:layout_marginTop=
"20dp"
...
...
app/src/main/res/layout/fragment_authentication_two_fa.xml
View file @
fc0e5f04
...
...
@@ -24,7 +24,7 @@
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/text_two_factor_authentication"
/>
<Button
<
android.widget.
Button
android:id=
"@+id/button_confirm"
style=
"@style/Authentication.Button"
android:layout_marginTop=
"20dp"
...
...
app/src/main/res/layout/fragment_password.xml
View file @
fc0e5f04
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
".settings.password.ui.PasswordFragment"
>
<com.google.android.material.textfield.TextInputLayout
android:id=
"@+id/layout_new_password"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_margin=
"16dp"
android:theme=
"@style/EditText.Password"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraint
Top_toTop
Of=
"parent"
a
ndroid:layout_margin=
"16dp"
>
app:layout_constraint
Start_toStart
Of=
"parent"
a
pp:layout_constraintTop_toTopOf=
"parent"
>
<EditText
android:id=
"@+id/text_new_password"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"@string/msg_new_password"
android:inputType=
"textPassword"
/>
android:inputType=
"textPassword"
/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id=
"@+id/layout_confirm_password"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_margin=
"16dp"
android:theme=
"@style/EditText.Password"
app:layout_constraintTop_toBottomOf=
"@+id/layout_new_password"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
android:layout_margin=
"16dp"
>
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/layout_new_password"
>
<EditText
android:id=
"@+id/text_confirm_password"
android:layout_width=
"match_parent"
...
...
@@ -47,12 +46,13 @@
android:id=
"@+id/view_loading"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
tools:visibility=
"visible"
android:visibility=
"gone"
app:indicatorColor=
"@color/colorBlack"
app:indicatorName=
"BallPulseIndicator"
app:layout_constraint
Start_toStart
Of=
"parent"
app:layout_constraint
Bottom_toBottom
Of=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
/>
tools:visibility=
"visible"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
app/src/main/res/layout/item_message_reply.xml
View file @
fc0e5f04
...
...
@@ -12,7 +12,7 @@
android:paddingEnd=
"@dimen/screen_edge_left_and_right_padding"
android:paddingBottom=
"@dimen/message_item_top_and_bottom_padding"
>
<Button
<
android.widget.
Button
android:id=
"@+id/button_message_reply"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
...
...
app/src/main/res/layout/message_attachment_options.xml
View file @
fc0e5f04
...
...
@@ -5,7 +5,7 @@
android:background=
"@drawable/style_attachment_options"
android:orientation=
"vertical"
>
<Button
<
android.widget.
Button
android:id=
"@+id/button_take_a_photo"
style=
"?android:attr/borderlessButtonStyle"
android:layout_width=
"match_parent"
...
...
@@ -15,7 +15,7 @@
android:gravity=
"start|center"
android:text=
"@string/action_take_a_photo"
/>
<Button
<
android.widget.
Button
android:id=
"@+id/button_attach_a_file"
style=
"?android:attr/borderlessButtonStyle"
android:layout_width=
"match_parent"
...
...
@@ -25,7 +25,7 @@
android:gravity=
"start|center"
android:text=
"@string/action_attach_a_files"
/>
<Button
<
android.widget.
Button
android:id=
"@+id/button_drawing"
style=
"?android:attr/borderlessButtonStyle"
android:layout_width=
"match_parent"
...
...
app/src/main/res/layout/message_composer.xml
View file @
fc0e5f04
...
...
@@ -33,7 +33,7 @@
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/divider"
/>
<Button
<
android.widget.
Button
android:id=
"@+id/button_join_chat"
android:layout_width=
"match_parent"
android:layout_height=
"45dp"
...
...
app/src/main/res/layout/update_avatar_options.xml
View file @
fc0e5f04
...
...
@@ -5,7 +5,7 @@
android:background=
"@drawable/style_attachment_options"
android:orientation=
"vertical"
>
<Button
<
android.widget.
Button
android:id=
"@+id/button_open_gallery"
style=
"?android:attr/borderlessButtonStyle"
android:layout_width=
"match_parent"
...
...
@@ -15,7 +15,7 @@
android:gravity=
"start|center"
android:text=
"@string/action_select_photo_from_gallery"
/>
<Button
<
android.widget.
Button
android:id=
"@+id/button_take_a_photo"
style=
"?android:attr/borderlessButtonStyle"
android:layout_width=
"match_parent"
...
...
@@ -25,7 +25,7 @@
android:gravity=
"start|center"
android:text=
"@string/action_take_a_photo"
/>
<Button
<
android.widget.
Button
android:id=
"@+id/button_reset_avatar"
style=
"?android:attr/borderlessButtonStyle"
android:layout_width=
"match_parent"
...
...
app/src/main/res/values-de/strings.xml
View file @
fc0e5f04
...
...
@@ -161,6 +161,8 @@
<string
name=
"msg_no_topic"
>
Kein Thema hinzugefügt
</string>
<string
name=
"msg_no_announcement"
>
Keine Ankündigung hinzugefügt
</string>
<string
name=
"msg_no_description"
>
Keine Beschreibung hinzugefügt
</string>
<string
name=
"msg_unable_to_update_password"
>
Unable to update password. Error message: %1$s
</string>
<!-- TODO - Add proper translation -->
<string
name=
"msg_password_updated_successfully"
>
Password updated successfully
</string>
<!-- TODO - Add proper translation -->
<plurals
name=
"msg_reacted_with_"
>
<item
quantity=
"one"
>
% 1 $ s reagierte mit% 2 $ s
</item>
<item
quantity=
"other"
>
% 1 $ s reagierte mit% 2 $ s
</item>
...
...
app/src/main/res/values-es/strings.xml
View file @
fc0e5f04
...
...
@@ -178,7 +178,8 @@
<string
name=
"msg_no_topic"
>
No topic added
</string>
<!-- TODO Add translation -->
<string
name=
"msg_no_announcement"
>
No announcement added
</string>
<!-- TODO Add translation -->
<string
name=
"msg_no_description"
>
No description added
</string>
<!-- TODO Add translation -->
<string
name=
"msg_unable_to_update_password"
>
Unable to update password. Error message: %1$s
</string>
<!-- TODO - Add proper translation -->
<string
name=
"msg_password_updated_successfully"
>
Password updated successfully
</string>
<!-- TODO - Add proper translation -->
<plurals
name=
"msg_reacted_with_"
>
<item
quantity=
"one"
>
%1$s reacted with %2$s
</item>
<!-- TODO - Add proper translation -->
<item
quantity=
"other"
>
%1$s reacted with %2$s
</item>
<!-- TODO - Add proper translation -->
...
...
app/src/main/res/values-fr/strings.xml
View file @
fc0e5f04
...
...
@@ -170,7 +170,8 @@
<string
name=
"msg_no_topic"
>
No topic added
</string>
<!-- TODO Add translation -->
<string
name=
"msg_no_announcement"
>
No announcement added
</string>
<!-- TODO Add translation -->
<string
name=
"msg_no_description"
>
No description added
</string>
<!-- TODO Add translation -->
<string
name=
"msg_unable_to_update_password"
>
Unable to update password. Error message: %1$s
</string>
<!-- TODO - Add proper translation -->
<string
name=
"msg_password_updated_successfully"
>
Password updated successfully
</string>
<!-- TODO - Add proper translation -->
<plurals
name=
"msg_reacted_with_"
>
<item
quantity=
"one"
>
%1$s reacted with %2$s
</item>
<!-- TODO - Add proper translation -->
<item
quantity=
"other"
>
%1$s reacted with %2$s
</item>
<!-- TODO - Add proper translation -->
...
...
app/src/main/res/values-hi-rIN/strings.xml
View file @
fc0e5f04
...
...
@@ -184,7 +184,8 @@
<string
name=
"msg_no_topic"
>
कोई विषय नहीं जोड़ा गया
</string>
<string
name=
"msg_no_announcement"
>
कोई घोषणा नहीं जोड़ा गया
</string>
<string
name=
"msg_no_description"
>
कोई विवरण नहीं जोड़ा गया
</string>
<string
name=
"msg_unable_to_update_password"
>
Unable to update password. Error message: %1$s
</string>
<!-- TODO - Add proper translation -->
<string
name=
"msg_password_updated_successfully"
>
Password updated successfully
</string>
<!-- TODO - Add proper translation -->
<plurals
name=
"msg_reacted_with_"
>
<item
quantity=
"one"
>
% 1 $ s ने% 2 $ %d s के साथ प्रतिक्रिया व्यक्त की
</item>
<item
quantity=
"few"
>
% 1 $ s ने% 2 $ s के साथ प्रतिक्रिया व्यक्त की
</item>
...
...
app/src/main/res/values-it/strings.xml
View file @
fc0e5f04
...
...
@@ -163,7 +163,8 @@
<string
name=
"msg_no_description"
>
Nessuna descrizione aggiunta
</string>
<string
name=
"msg_send_email"
>
Invia una email
</string>
<string
name=
"msg_android_app_support"
>
Supporto per le app Android
</string>
<string
name=
"msg_unable_to_update_password"
>
Unable to update password. Error message: %1$s
</string>
<!-- TODO - Add proper translation -->
<string
name=
"msg_password_updated_successfully"
>
Password updated successfully
</string>
<!-- TODO - Add proper translation -->
<plurals
name=
"msg_reacted_with_"
>
<item
quantity=
"one"
>
%1$s ha reagito con %2$s
</item>
<item
quantity=
"other"
>
%1$s ha reagito con %2$s
</item>
...
...
app/src/main/res/values-ja/strings.xml
View file @
fc0e5f04
...
...
@@ -168,10 +168,11 @@
<string
name=
"msg_no_topic"
>
No topic added
</string>
<!-- TODO Add translation -->
<string
name=
"msg_no_announcement"
>
No announcement added
</string>
<!-- TODO Add translation -->
<string
name=
"msg_no_description"
>
No description added
</string>
<!-- TODO Add translation -->
<!-- TODO - Add proper translation -->
<string
name=
"msg_unable_to_update_password"
>
Unable to update password. Error message: %1$s
</string>
<!-- TODO - Add proper translation -->
<string
name=
"msg_password_updated_successfully"
>
Password updated successfully
</string>
<!-- TODO - Add proper translation -->
<plurals
name=
"msg_reacted_with_"
>
<item
quantity=
"one"
>
%1$s reacted with %2$s
</item>
<item
quantity=
"other"
>
%1$s reacted with %2$s
</item>
<item
quantity=
"one"
>
%1$s reacted with %2$s
</item>
<!-- TODO - Add proper translation -->
<item
quantity=
"other"
>
%1$s reacted with %2$s
</item>
<!-- TODO - Add proper translation -->
</plurals>
<!-- Create channel messages -->
...
...
app/src/main/res/values-pt-rBR/strings.xml
View file @
fc0e5f04
...
...
@@ -171,6 +171,8 @@
<string
name=
"msg_no_topic"
>
No topic added
</string>
<!-- TODO Add translation -->
<string
name=
"msg_no_announcement"
>
No announcement added
</string>
<!-- TODO Add translation -->
<string
name=
"msg_no_description"
>
No description added
</string>
<!-- TODO Add translation -->
<string
name=
"msg_unable_to_update_password"
>
Não foi possível atualizar a senha. Mensagem de erro: %1$s
</string>
<string
name=
"msg_password_updated_successfully"
>
Senha alterada com sucesso
</string>
<plurals
name=
"msg_reacted_with_"
>
<item
quantity=
"one"
>
%1$s reagiu com %2$s
</item>
<item
quantity=
"other"
>
%1$s reagiram com %2$s
</item>
...
...
app/src/main/res/values-ru-rRU/strings.xml
View file @
fc0e5f04
...
...
@@ -169,7 +169,8 @@
<string
name=
"msg_send_email"
>
Отправить e-mail
</string>
<string
name=
"msg_android_app_support"
>
Поддержка Android-приложения
</string>
<string
name=
"msg_muted_on_this_channel"
>
Вы лишены дара речи на этом канале
</string>
<string
name=
"msg_unable_to_update_password"
>
Невозможно обновить пароль. Ошибка: %1$s
</string>
<string
name=
"msg_password_updated_successfully"
>
Пароль успешно обновлен
</string>
<plurals
name=
"msg_reacted_with_"
>
<item
quantity=
"one"
>
%1$s реагирует с %2$s
</item>
<item
quantity=
"few"
>
%1$s реагируют с %2$s
</item>
...
...
app/src/main/res/values-tr/strings.xml
View file @
fc0e5f04
...
...
@@ -185,7 +185,8 @@
<string
name=
"msg_no_topic"
>
No topic added
</string>
<!-- TODO Add translation -->
<string
name=
"msg_no_announcement"
>
No announcement added
</string>
<!-- TODO Add translation -->
<string
name=
"msg_no_description"
>
No description added
</string>
<!-- TODO Add translation -->
<string
name=
"msg_unable_to_update_password"
>
Unable to update password. Error message: %1$s
</string>
<!-- TODO - Add proper translation -->
<string
name=
"msg_password_updated_successfully"
>
Password updated successfully
</string>
<!-- TODO - Add proper translation -->
<plurals
name=
"msg_reacted_with_"
>
<item
quantity=
"one"
>
%1$s reacted with %2$s
</item>
<!-- TODO - Add proper translation -->
<item
quantity=
"other"
>
%1$s reacted with %2$s
</item>
<!-- TODO - Add proper translation -->
...
...
app/src/main/res/values-uk/strings.xml
View file @
fc0e5f04
...
...
@@ -168,7 +168,8 @@
<string
name=
"msg_no_topic"
>
No topic added
</string>
<!-- TODO Add translation -->
<string
name=
"msg_no_announcement"
>
No announcement added
</string>
<!-- TODO Add translation -->
<string
name=
"msg_no_description"
>
No description added
</string>
<!-- TODO Add translation -->
<string
name=
"msg_unable_to_update_password"
>
Unable to update password. Error message: %1$s
</string>
<!-- TODO - Add proper translation -->
<string
name=
"msg_password_updated_successfully"
>
Password updated successfully
</string>
<!-- TODO - Add proper translation -->
<plurals
name=
"msg_reacted_with_"
>
<item
quantity=
"one"
>
%1$s reacted with %2$s
</item>
<!-- TODO - Add proper translation -->
<item
quantity=
"few"
>
%1$s reacted with %2$s
</item>
<!-- TODO - Add proper translation -->
...
...
app/src/main/res/values/strings.xml
View file @
fc0e5f04
...
...
@@ -180,7 +180,8 @@ https://github.com/RocketChat/java-code-styles/blob/master/CODING_STYLE.md#strin
<string
name=
"msg_no_description"
>
No description added
</string>
<string
name=
"msg_send_email"
>
Send email
</string>
<string
name=
"msg_android_app_support"
>
Android app support
</string>
<string
name=
"msg_unable_to_update_password"
>
Unable to update password. Error message: %1$s
</string>
<string
name=
"msg_password_updated_successfully"
>
Password updated successfully
</string>
<plurals
name=
"msg_reacted_with_"
>
<item
quantity=
"one"
>
%1$s reacted with %2$s
</item>
<item
quantity=
"other"
>
%1$s reacted with %2$s
</item>
...
...
app/src/main/res/values/styles.xml
View file @
fc0e5f04
<resources>
<!-- Base application theme. -->
<style
name=
"AppTheme"
parent=
"Theme.
AppCompat
.Light.NoActionBar"
>
<style
name=
"AppTheme"
parent=
"Theme.
MaterialComponents
.Light.NoActionBar"
>
<!-- Customize your theme here. -->
<item
name=
"colorPrimary"
>
@color/colorPrimary
</item>
<item
name=
"colorPrimaryDark"
>
@color/colorPrimaryDark
</item>
...
...
suggestions/src/main/java/chat/rocket/android/suggestions/ui/SuggestionsAdapter.kt
View file @
fc0e5f04
...
...
@@ -29,6 +29,9 @@ abstract class SuggestionsAdapter<VH : BaseSuggestionViewHolder>(
notifyDataSetChanged
()
}
private
var
currentCount
=
0
;
private
var
currentItems
=
listOf
<
SuggestionModel
>()
init
{
setHasStableIds
(
true
)
}
...
...
@@ -41,10 +44,10 @@ abstract class SuggestionsAdapter<VH : BaseSuggestionViewHolder>(
holder
.
bind
(
getItem
(
position
),
itemClickListener
)
}
override
fun
getItemCount
()
=
strategy
.
autocompleteItems
(
currentTerm
).
size
override
fun
getItemCount
()
=
currentCount
private
fun
getItem
(
position
:
Int
):
SuggestionModel
{
return
strategy
.
autocompleteItems
(
currentTerm
)
[
position
]
return
currentItems
[
position
]
}
/**
...
...
@@ -58,12 +61,15 @@ abstract class SuggestionsAdapter<VH : BaseSuggestionViewHolder>(
fun
autocomplete
(
newTerm
:
String
)
{
this
.
currentTerm
=
newTerm
.
toLowerCase
().
trim
()
currentItems
=
strategy
.
autocompleteItems
(
currentTerm
)
currentCount
=
currentItems
.
size
}
fun
addItems
(
list
:
List
<
SuggestionModel
>)
{
strategy
.
addAll
(
list
)
// Since we've just added new items we should check for possible new completion suggestions.
strategy
.
autocompleteItems
(
currentTerm
)
//strategy.autocompleteItems(currentTerm)
autocomplete
(
currentTerm
)
notifyDataSetChanged
()
}
...
...
suggestions/src/main/java/chat/rocket/android/suggestions/ui/SuggestionsView.kt
View file @
fc0e5f04
...
...
@@ -10,6 +10,7 @@ import android.text.TextWatcher
import
android.transition.Slide
import
android.transition.TransitionManager
import
android.util.AttributeSet
import
android.util.Log
import
android.view.Gravity
import
android.view.View
import
android.widget.EditText
...
...
@@ -24,6 +25,7 @@ import chat.rocket.android.suggestions.model.SuggestionModel
import
chat.rocket.android.suggestions.ui.SuggestionsAdapter.Companion.CONSTRAINT_BOUND_TO_START
import
java.lang.ref.WeakReference
import
java.util.concurrent.atomic.AtomicInteger
import
kotlin.system.measureTimeMillis
// This is a special index that means we're not at an autocompleting state.
private
const
val
NO_STATE_INDEX
=
0
...
...
@@ -101,22 +103,32 @@ class SuggestionsView : FrameLayout, TextWatcher {
return
}
val
prefixEndIndex
=
this
.
editor
?.
get
()
?.
selectionStart
?:
NO_STATE_INDEX
if
(
prefixEndIndex
==
NO_STATE_INDEX
||
prefixEndIndex
<
completionOffset
.
get
())
return
val
prefix
=
s
.
subSequence
(
completionOffset
.
get
(),
this
.
editor
?.
get
()
?.
selectionStart
?:
completionOffset
.
get
()).
toString
()
recyclerView
.
adapter
?.
let
{
it
as
SuggestionsAdapter
// we need to look up only after the '@'
it
.
autocomplete
(
prefix
)
val
cacheMap
=
localProvidersByToken
[
it
.
token
]
if
(
cacheMap
!=
null
&&
cacheMap
[
prefix
]
!=
null
)
{
it
.
addItems
(
cacheMap
[
prefix
]
!!
)
}
else
{
// fetch more suggestions from an external source if any
externalProvidersByToken
[
it
.
token
]
?.
invoke
(
prefix
)
}
if
(
completionOffset
.
get
()
==
NO_STATE_INDEX
)
{
return
}
measureTimeMillis
{
val
prefixEndIndex
=
this
.
editor
?.
get
()
?.
selectionStart
?:
NO_STATE_INDEX
if
(
prefixEndIndex
==
NO_STATE_INDEX
||
prefixEndIndex
<
completionOffset
.
get
())
return
val
prefix
=
s
.
subSequence
(
completionOffset
.
get
(),
this
.
editor
?.
get
()
?.
selectionStart
?:
completionOffset
.
get
()).
toString
()
recyclerView
.
adapter
?.
also
{
it
as
SuggestionsAdapter
// we need to look up only after the '@'
measureTimeMillis
{
it
.
autocomplete
(
prefix
)
}.
let
{
time
->
Log
.
d
(
"SuggestionsView"
,
"autocomplete($prefix) in $time ms"
)
}
val
cacheMap
=
localProvidersByToken
[
it
.
token
]
if
(
cacheMap
!=
null
&&
cacheMap
[
prefix
]
!=
null
)
{
if
(
it
.
itemCount
==
0
)
{
it
.
addItems
(
cacheMap
[
prefix
]
!!
)
}
}
else
{
// fetch more suggestions from an external source if any
externalProvidersByToken
[
it
.
token
]
?.
invoke
(
prefix
)
}
}
}.
let
{
Log
.
d
(
"SuggestionsView"
,
"whole prefix in $it ms"
)
}
}
override
fun
onMeasure
(
widthMeasureSpec
:
Int
,
heightMeasureSpec
:
Int
)
{
...
...
util/src/main/java/chat/rocket/android/util/extension/Url.kt
0 → 100644
View file @
fc0e5f04
package
chat.rocket.android.util.extension
/**
* This purely checks if an url link ends with a image format.
*/
fun
String
.
isImage
()
=
endsWith
(
".gif"
)
||
endsWith
(
".png"
)
||
endsWith
(
".jpg"
)
||
endsWith
(
"jpeg"
)
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment