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
151b4d03
Commit
151b4d03
authored
Oct 06, 2017
by
Leonardo Aramaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add image thumb when replying to image attachments
parent
1c2e9e44
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
93 additions
and
17 deletions
+93
-17
RoomContract.java
...a/chat/rocket/android/fragment/chatroom/RoomContract.java
+2
-1
RoomFragment.java
...a/chat/rocket/android/fragment/chatroom/RoomFragment.java
+3
-2
RoomPresenter.java
.../chat/rocket/android/fragment/chatroom/RoomPresenter.java
+1
-2
MessageFormManager.kt
...ocket/android/layouthelper/chatroom/MessageFormManager.kt
+4
-2
MessagePopup.java
...at/rocket/android/layouthelper/chatroom/MessagePopup.java
+0
-1
MessageFormLayout.java
...chat/rocket/android/widget/message/MessageFormLayout.java
+36
-4
ic_reply.xml
...t-chat-android-widgets/src/main/res/drawable/ic_reply.xml
+8
-0
message_composer.xml
...-android-widgets/src/main/res/layout/message_composer.xml
+39
-5
No files found.
app/src/main/java/chat/rocket/android/fragment/chatroom/RoomContract.java
View file @
151b4d03
...
...
@@ -5,6 +5,7 @@ import android.support.annotation.Nullable;
import
java.util.List
;
import
chat.rocket.android.shared.BaseContract
;
import
chat.rocket.android.widget.AbsoluteUrl
;
import
chat.rocket.core.models.Message
;
import
chat.rocket.core.models.Room
;
import
chat.rocket.core.models.User
;
...
...
@@ -37,7 +38,7 @@ public interface RoomContract {
void
manualLoadImages
();
void
onReply
(
String
markdown
,
Message
message
);
void
onReply
(
AbsoluteUrl
absoluteUrl
,
String
markdown
,
Message
message
);
void
onCopy
(
String
message
);
...
...
app/src/main/java/chat/rocket/android/fragment/chatroom/RoomFragment.java
View file @
151b4d03
...
...
@@ -60,6 +60,7 @@ import chat.rocket.android.renderer.RocketChatUserStatusProvider;
import
chat.rocket.android.service.ConnectivityManager
;
import
chat.rocket.android.service.temp.DeafultTempSpotlightRoomCaller
;
import
chat.rocket.android.service.temp.DefaultTempSpotlightUserCaller
;
import
chat.rocket.android.widget.AbsoluteUrl
;
import
chat.rocket.android.widget.RoomToolbar
;
import
chat.rocket.android.widget.internal.ExtraActionPickerDialogFragment
;
import
chat.rocket.android.widget.message.MessageFormLayout
;
...
...
@@ -649,8 +650,8 @@ public class RoomFragment extends AbstractChatRoomFragment implements
}
@Override
public
void
onReply
(
String
markdown
,
Message
message
)
{
messageFormManager
.
setReply
(
markdown
,
message
);
public
void
onReply
(
AbsoluteUrl
absoluteUrl
,
String
markdown
,
Message
message
)
{
messageFormManager
.
setReply
(
absoluteUrl
,
markdown
,
message
);
}
@Override
...
...
app/src/main/java/chat/rocket/android/fragment/chatroom/RoomPresenter.java
View file @
151b4d03
...
...
@@ -24,7 +24,6 @@ import chat.rocket.core.repositories.UserRepository;
import
io.reactivex.Single
;
import
io.reactivex.android.schedulers.AndroidSchedulers
;
import
io.reactivex.disposables.Disposable
;
import
io.reactivex.schedulers.Schedulers
;
public
class
RoomPresenter
extends
BasePresenter
<
RoomContract
.
View
>
implements
RoomContract
.
Presenter
{
...
...
@@ -133,7 +132,7 @@ public class RoomPresenter extends BasePresenter<RoomContract.View>
serverUrl
->
{
if
(
serverUrl
.
isPresent
())
{
String
baseUrl
=
serverUrl
.
get
().
getBaseUrl
();
view
.
onReply
(
buildReplyMarkDown
(
baseUrl
,
message
),
message
);
view
.
onReply
(
serverUrl
.
get
(),
buildReplyMarkDown
(
baseUrl
,
message
),
message
);
}
},
Logger:
:
report
...
...
app/src/main/java/chat/rocket/android/layouthelper/chatroom/MessageFormManager.kt
View file @
151b4d03
package
chat.rocket.android.layouthelper.chatroom
import
android.text.TextUtils
import
android.view.View
import
chat.rocket.android.widget.AbsoluteUrl
import
chat.rocket.android.widget.message.MessageFormLayout
import
chat.rocket.core.models.Message
...
...
@@ -34,9 +36,9 @@ class MessageFormManager(private val messageFormLayout: MessageFormLayout, val c
messageFormLayout
.
isEnabled
=
enable
}
fun
setReply
(
replyMarkDown
:
String
,
message
:
Message
)
{
fun
setReply
(
absoluteUrl
:
AbsoluteUrl
,
replyMarkDown
:
String
,
message
:
Message
)
{
this
.
replyMarkDown
=
replyMarkDown
messageFormLayout
.
setReplyContent
(
message
)
messageFormLayout
.
setReplyContent
(
absoluteUrl
,
message
)
messageFormLayout
.
setReplyCancelListener
({
this
.
replyMarkDown
=
""
messageFormLayout
.
clearReplyContent
()
...
...
app/src/main/java/chat/rocket/android/layouthelper/chatroom/MessagePopup.java
View file @
151b4d03
...
...
@@ -6,7 +6,6 @@ import android.support.v4.util.Pair;
import
android.support.v7.app.AlertDialog
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.List
;
import
chat.rocket.android.BackgroundLooper
;
...
...
rocket-chat-android-widgets/src/main/java/chat/rocket/android/widget/message/MessageFormLayout.java
View file @
151b4d03
...
...
@@ -21,8 +21,14 @@ import android.widget.LinearLayout;
import
android.widget.RelativeLayout
;
import
android.widget.TextView
;
import
com.facebook.drawee.view.SimpleDraweeView
;
import
chat.rocket.android.widget.AbsoluteUrl
;
import
chat.rocket.android.widget.R
;
import
chat.rocket.android.widget.helper.DebouncingOnClickListener
;
import
chat.rocket.android.widget.helper.FrescoHelper
;
import
chat.rocket.core.models.Attachment
;
import
chat.rocket.core.models.AttachmentTitle
;
import
chat.rocket.core.models.Message
;
public
class
MessageFormLayout
extends
LinearLayout
{
...
...
@@ -34,6 +40,7 @@ public class MessageFormLayout extends LinearLayout {
private
RelativeLayout
replyBar
;
private
ImageView
replyCancelButton
;
private
SimpleDraweeView
replyThumb
;
private
TextView
replyMessageText
;
private
TextView
replyUsernameText
;
...
...
@@ -78,6 +85,7 @@ public class MessageFormLayout extends LinearLayout {
replyCancelButton
=
composer
.
findViewById
(
R
.
id
.
reply_cancel
);
replyMessageText
=
composer
.
findViewById
(
R
.
id
.
reply_message
);
replyUsernameText
=
composer
.
findViewById
(
R
.
id
.
reply_username
);
replyThumb
=
composer
.
findViewById
(
R
.
id
.
reply_thumb
);
replyBar
=
composer
.
findViewById
(
R
.
id
.
reply_bar
);
sendButton
=
composer
.
findViewById
(
R
.
id
.
button_send
);
...
...
@@ -136,9 +144,13 @@ public class MessageFormLayout extends LinearLayout {
public
void
clearReplyContent
()
{
replyBar
.
setVisibility
(
View
.
GONE
);
replyThumb
.
setVisibility
(
View
.
GONE
);
replyMessageText
.
setText
(
""
);
replyUsernameText
.
setText
(
""
);
}
public
void
showReplyThumb
()
{
replyThumb
.
setVisibility
(
View
.
VISIBLE
);
}
public
void
setReplyCancelListener
(
OnClickListener
onClickListener
)
{
replyCancelButton
.
setOnClickListener
(
onClickListener
);
...
...
@@ -196,14 +208,34 @@ public class MessageFormLayout extends LinearLayout {
this
.
listener
=
listener
;
}
public
void
setReplyContent
(
@NonNull
Message
message
)
{
public
void
setReplyContent
(
@NonNull
AbsoluteUrl
absoluteUrl
,
@NonNull
Message
message
)
{
String
text
=
message
.
getMessage
();
replyUsernameText
.
setText
(
message
.
getUser
().
getUsername
());
if
(!
TextUtils
.
isEmpty
(
text
))
{
replyMessageText
.
setText
(
text
);
replyUsernameText
.
setText
(
message
.
getUser
().
getUsername
());
replyBar
.
setVisibility
(
View
.
VISIBLE
);
requestFocusAndShowKeyboard
();
}
else
{
if
(
message
.
getAttachments
()
!=
null
&&
message
.
getAttachments
().
size
()
>
0
)
{
Attachment
attachment
=
message
.
getAttachments
().
get
(
0
);
AttachmentTitle
attachmentTitle
=
attachment
.
getAttachmentTitle
();
String
imageUrl
=
null
;
if
(
attachment
.
getImageUrl
()
!=
null
)
{
imageUrl
=
absoluteUrl
.
from
(
attachment
.
getImageUrl
());
}
if
(
attachmentTitle
!=
null
)
{
text
=
attachmentTitle
.
getTitle
();
}
if
(
TextUtils
.
isEmpty
(
text
))
{
text
=
"Unknown"
;
}
if
(
imageUrl
!=
null
)
{
FrescoHelper
.
INSTANCE
.
loadImageWithCustomization
(
replyThumb
,
imageUrl
);
showReplyThumb
();
}
replyMessageText
.
setText
(
text
);
}
}
replyBar
.
setVisibility
(
View
.
VISIBLE
);
requestFocusAndShowKeyboard
();
}
private
void
requestFocusAndShowKeyboard
()
{
...
...
rocket-chat-android-widgets/src/main/res/drawable/ic_reply.xml
0 → 100644
View file @
151b4d03
<!-- drawable/reply.xml -->
<vector
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:height=
"24dp"
android:width=
"24dp"
android:viewportWidth=
"24"
android:viewportHeight=
"24"
>
<path
android:fillColor=
"#000"
android:pathData=
"M10,9V5L3,12L10,19V14.9C15,14.9 18.5,16.5 21,20C20,15 17,10 10,9Z"
/>
</vector>
\ No newline at end of file
rocket-chat-android-widgets/src/main/res/layout/message_composer.xml
View file @
151b4d03
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:fresco=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
...
...
@@ -13,10 +14,10 @@
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"8dp"
android:layout_marginEnd=
"
16
dp"
android:layout_marginLeft=
"
16
dp"
android:layout_marginRight=
"
16
dp"
android:layout_marginStart=
"
16
dp"
android:layout_marginEnd=
"
8
dp"
android:layout_marginLeft=
"
8
dp"
android:layout_marginRight=
"
8
dp"
android:layout_marginStart=
"
8
dp"
android:layout_marginTop=
"8dp"
android:visibility=
"gone"
app:layout_constraintBottom_toTopOf=
"@+id/keyboard_container"
...
...
@@ -27,10 +28,25 @@
tools:layout_editor_absoluteY=
"8dp"
tools:visibility=
"visible"
>
<android.support.v7.widget.AppCompatImageView
android:id=
"@+id/reply_icon"
android:layout_width=
"24dp"
android:layout_height=
"24dp"
android:layout_marginRight=
"8dp"
android:layout_marginEnd=
"8dp"
android:layout_centerVertical=
"true"
android:layout_alignParentStart=
"true"
android:layout_alignParentLeft=
"true"
android:adjustViewBounds=
"true"
app:srcCompat=
"@drawable/ic_reply"
app:tint=
"@color/color_accent"
/>
<android.support.v7.widget.AppCompatImageView
android:id=
"@+id/reply_cancel"
android:layout_width=
"24dp"
android:layout_height=
"24dp"
android:layout_marginLeft=
"8dp"
android:layout_marginStart=
"8dp"
android:layout_centerVertical=
"true"
android:layout_alignParentEnd=
"true"
android:layout_alignParentRight=
"true"
...
...
@@ -45,12 +61,28 @@
android:layout_alignBaseline=
"@id/reply_username"
android:layout_toLeftOf=
"@+id/reply_cancel"
android:layout_toStartOf=
"@id/reply_cancel"
android:layout_toRightOf=
"@+id/reply_thumb"
android:layout_toEndOf=
"@+id/reply_thumb"
android:ellipsize=
"end"
android:maxLines=
"1"
android:textColor=
"@color/color_accent"
android:textStyle=
"bold"
tools:text=
"jane.doe"
/>
<com.facebook.drawee.view.SimpleDraweeView
android:id=
"@+id/reply_thumb"
android:layout_width=
"32dp"
android:layout_height=
"wrap_content"
android:layout_marginRight=
"4dp"
android:layout_marginEnd=
"4dp"
android:layout_toRightOf=
"@+id/reply_icon"
android:layout_toEndOf=
"@+id/reply_icon"
android:layout_alignBottom=
"@+id/reply_message"
android:layout_alignTop=
"@+id/reply_username"
android:layout_centerVertical=
"true"
android:visibility=
"gone"
fresco:actualImageScaleType=
"fitCenter"
/>
<TextView
android:id=
"@+id/reply_message"
android:layout_width=
"match_parent"
...
...
@@ -58,9 +90,11 @@
android:layout_below=
"@id/reply_username"
android:layout_toLeftOf=
"@+id/reply_cancel"
android:layout_toStartOf=
"@id/reply_cancel"
android:layout_toRightOf=
"@+id/reply_thumb"
android:layout_toEndOf=
"@+id/reply_thumb"
android:ellipsize=
"end"
android:maxLines=
"1"
tools:text=
"Me
nsagemaaaaaaaaaaaaaaaaaddddddddddddddddddddddddddddddddsdsdsdsdsdsdsdaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaadadadadddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
"
/>
tools:text=
"Me
ssage
"
/>
</RelativeLayout>
...
...
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