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
8b3ed8b1
Commit
8b3ed8b1
authored
May 05, 2017
by
Tiago Cunha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
How to show editting?
parent
c687071d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
6 deletions
+42
-6
RoomFragment.java
...a/chat/rocket/android/fragment/chatroom/RoomFragment.java
+9
-0
MessageOptionsDialogFragment.java
...ragment/chatroom/dialog/MessageOptionsDialogFragment.java
+33
-6
No files found.
app/src/main/java/chat/rocket/android/fragment/chatroom/RoomFragment.java
View file @
8b3ed8b1
...
...
@@ -289,6 +289,12 @@ public class RoomFragment extends AbstractChatRoomFragment
public
boolean
onItemLongClick
(
PairedMessage
pairedMessage
)
{
MessageOptionsDialogFragment
messageOptionsDialogFragment
=
MessageOptionsDialogFragment
.
create
(
pairedMessage
.
target
);
messageOptionsDialogFragment
.
setOnMessageOptionSelectedListener
(
message
->
{
messageOptionsDialogFragment
.
dismiss
();
onEditMessage
(
message
);
});
messageOptionsDialogFragment
.
show
(
getChildFragmentManager
(),
"MessageOptionsDialogFragment"
);
return
true
;
}
...
...
@@ -589,4 +595,7 @@ public class RoomFragment extends AbstractChatRoomFragment
public
void
manualLoadImages
()
{
adapter
.
setAutoloadImages
(
false
);
}
private
void
onEditMessage
(
Message
message
)
{
}
}
app/src/main/java/chat/rocket/android/fragment/chatroom/dialog/MessageOptionsDialogFragment.java
View file @
8b3ed8b1
...
...
@@ -6,6 +6,7 @@ import android.os.Bundle;
import
android.support.annotation.NonNull
;
import
android.support.design.widget.BottomSheetDialog
;
import
android.support.design.widget.BottomSheetDialogFragment
;
import
android.support.v4.util.Pair
;
import
android.view.View
;
import
android.widget.TextView
;
...
...
@@ -39,6 +40,16 @@ public class MessageOptionsDialogFragment extends BottomSheetDialogFragment {
public
final
static
String
ARG_MESSAGE_ID
=
"messageId"
;
private
CompositeDisposable
compositeDisposable
=
new
CompositeDisposable
();
private
OnMessageOptionSelectedListener
internalListener
=
new
OnMessageOptionSelectedListener
()
{
@Override
public
void
onEdit
(
Message
message
)
{
if
(
externalListener
!=
null
)
{
externalListener
.
onEdit
(
message
);
}
}
};
private
OnMessageOptionSelectedListener
externalListener
=
null
;
public
static
MessageOptionsDialogFragment
create
(
@NonNull
Message
message
)
{
Bundle
bundle
=
new
Bundle
();
...
...
@@ -50,6 +61,11 @@ public class MessageOptionsDialogFragment extends BottomSheetDialogFragment {
return
messageOptionsDialogFragment
;
}
public
void
setOnMessageOptionSelectedListener
(
OnMessageOptionSelectedListener
onMessageOptionSelectedListener
)
{
externalListener
=
onMessageOptionSelectedListener
;
}
@NonNull
@Override
public
Dialog
onCreateDialog
(
Bundle
savedInstanceState
)
{
...
...
@@ -87,18 +103,25 @@ public class MessageOptionsDialogFragment extends BottomSheetDialogFragment {
Disposable
disposable
=
messageRepository
.
getById
(
messageId
)
.
flatMap
(
it
->
{
if
(!
it
.
isPresent
())
{
return
Single
.
just
(
false
);
return
Single
.
just
(
Pair
.<
Message
,
Boolean
>
create
(
null
,
false
)
);
}
return
editMessageInteractor
.
isAllowed
(
it
.
get
());
Message
message
=
it
.
get
();
return
Single
.
zip
(
Single
.
just
(
message
),
editMessageInteractor
.
isAllowed
(
message
),
Pair:
:
create
);
})
.
subscribeOn
(
AndroidSchedulers
.
from
(
BackgroundLooper
.
get
()))
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
(
isEditAllowed
->
{
if
(
isEditAllowed
)
{
bottomSheetDialog
.
findViewById
(
R
.
id
.
message_options_edit_action
)
.
setVisibility
(
View
.
VISIBLE
);
pair
->
{
if
(
pair
.
second
)
{
View
editView
=
bottomSheetDialog
.
findViewById
(
R
.
id
.
message_options_edit_action
);
editView
.
setVisibility
(
View
.
VISIBLE
);
editView
.
setOnClickListener
(
view
->
internalListener
.
onEdit
(
pair
.
first
));
}
else
{
((
TextView
)
bottomSheetDialog
.
findViewById
(
R
.
id
.
message_options_info
))
.
setText
(
R
.
string
.
message_options_no_permissions_info
);
...
...
@@ -138,4 +161,8 @@ public class MessageOptionsDialogFragment extends BottomSheetDialogFragment {
publicSettingRepository
);
}
public
interface
OnMessageOptionSelectedListener
{
void
onEdit
(
Message
message
);
}
}
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