mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-26 23:25:20 +03:00
Forwarding message to selected conversation
Signed-off-by: Tim Krüger <t@timkrueger.me>
This commit is contained in:
parent
6f75c25bbd
commit
d67226e39d
6 changed files with 36 additions and 6 deletions
|
@ -111,7 +111,7 @@ class MainActivity : BaseActivity(), ActionBarProvider {
|
|||
if (intent.hasExtra(BundleKeys.KEY_FROM_NOTIFICATION_START_CALL)) {
|
||||
if (!router!!.hasRootController()) {
|
||||
router!!.setRoot(
|
||||
RouterTransaction.with(ConversationsListController())
|
||||
RouterTransaction.with(ConversationsListController(Bundle()))
|
||||
.pushChangeHandler(HorizontalChangeHandler())
|
||||
.popChangeHandler(HorizontalChangeHandler())
|
||||
)
|
||||
|
@ -121,7 +121,7 @@ class MainActivity : BaseActivity(), ActionBarProvider {
|
|||
if (hasDb) {
|
||||
if (userUtils.anyUserExists()) {
|
||||
router!!.setRoot(
|
||||
RouterTransaction.with(ConversationsListController())
|
||||
RouterTransaction.with(ConversationsListController(Bundle()))
|
||||
.pushChangeHandler(HorizontalChangeHandler())
|
||||
.popChangeHandler(HorizontalChangeHandler())
|
||||
)
|
||||
|
@ -174,7 +174,7 @@ class MainActivity : BaseActivity(), ActionBarProvider {
|
|||
fun resetConversationsList() {
|
||||
if (userUtils.anyUserExists()) {
|
||||
router!!.setRoot(
|
||||
RouterTransaction.with(ConversationsListController())
|
||||
RouterTransaction.with(ConversationsListController(Bundle()))
|
||||
.pushChangeHandler(HorizontalChangeHandler())
|
||||
.popChangeHandler(HorizontalChangeHandler())
|
||||
)
|
||||
|
|
|
@ -443,7 +443,7 @@ public class AccountVerificationController extends BaseController {
|
|||
getActivity().runOnUiThread(() -> {
|
||||
if (userUtils.getUsers().size() == 1) {
|
||||
getRouter().setRoot(RouterTransaction.with(new
|
||||
ConversationsListController())
|
||||
ConversationsListController(new Bundle()))
|
||||
.pushChangeHandler(new HorizontalChangeHandler())
|
||||
.popChangeHandler(new HorizontalChangeHandler()));
|
||||
} else {
|
||||
|
@ -524,7 +524,7 @@ public class AccountVerificationController extends BaseController {
|
|||
|
||||
} else {
|
||||
if (userUtils.anyUserExists()) {
|
||||
getRouter().setRoot(RouterTransaction.with(new ConversationsListController())
|
||||
getRouter().setRoot(RouterTransaction.with(new ConversationsListController(new Bundle()))
|
||||
.pushChangeHandler(new HorizontalChangeHandler())
|
||||
.popChangeHandler(new HorizontalChangeHandler()));
|
||||
} else {
|
||||
|
|
|
@ -2165,6 +2165,14 @@ class ChatController(args: Bundle) :
|
|||
clipboardManager.setPrimaryClip(clipData)
|
||||
true
|
||||
}
|
||||
R.id.action_forward_message -> {
|
||||
val bundle = Bundle()
|
||||
bundle.putBoolean("forwardMessage", true)
|
||||
getRouter().pushController(
|
||||
RouterTransaction.with(ConversationsListController(bundle)).pushChangeHandler
|
||||
(HorizontalChangeHandler()).popChangeHandler(HorizontalChangeHandler()))
|
||||
true
|
||||
}
|
||||
R.id.action_reply_to_message -> {
|
||||
val chatMessage = message as ChatMessage?
|
||||
replyToMessage(chatMessage, message?.jsonMessageId)
|
||||
|
|
|
@ -203,9 +203,12 @@ public class ConversationsListController extends BaseController implements Searc
|
|||
|
||||
private String textToPaste = "";
|
||||
|
||||
public ConversationsListController() {
|
||||
private boolean forwardMessage = false;
|
||||
|
||||
public ConversationsListController(Bundle bundle) {
|
||||
super();
|
||||
setHasOptionsMenu(true);
|
||||
forwardMessage = bundle.getBoolean("forwardMessage");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -340,9 +343,13 @@ public class ConversationsListController extends BaseController implements Searc
|
|||
|
||||
showShareToScreen = !shareToScreenWasShown && hasActivityActionSendIntent();
|
||||
|
||||
|
||||
if (showShareToScreen) {
|
||||
hideSearchBar();
|
||||
getActionBar().setTitle(R.string.send_to_three_dots);
|
||||
} else if (forwardMessage) {
|
||||
hideSearchBar();
|
||||
getActionBar().setTitle(R.string.nc_forward_to_three_dots);
|
||||
} else {
|
||||
MainActivity activity = (MainActivity) getActivity();
|
||||
|
||||
|
@ -752,6 +759,8 @@ public class ConversationsListController extends BaseController implements Searc
|
|||
if (showShareToScreen) {
|
||||
shareToScreenWasShown = true;
|
||||
handleSharedData();
|
||||
}else if (forwardMessage) {
|
||||
forwardMessage();
|
||||
} else {
|
||||
openConversation();
|
||||
}
|
||||
|
@ -759,6 +768,10 @@ public class ConversationsListController extends BaseController implements Searc
|
|||
return true;
|
||||
}
|
||||
|
||||
private void forwardMessage() {
|
||||
System.out.println("Add code to forward a message here");
|
||||
}
|
||||
|
||||
private void handleSharedData() {
|
||||
collectDataFromIntent();
|
||||
if (!textToPaste.isEmpty()) {
|
||||
|
|
|
@ -8,6 +8,12 @@
|
|||
android:title="@string/nc_copy_message"
|
||||
app:showAsAction="always" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_forward_message"
|
||||
android:icon="@drawable/ic_content_copy"
|
||||
android:title="@string/nc_forward_message"
|
||||
app:showAsAction="always" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_reply_to_message"
|
||||
android:icon="@drawable/ic_reply"
|
||||
|
|
|
@ -189,6 +189,8 @@
|
|||
<string name="nc_add_to_favorites">Add to favorites</string>
|
||||
<string name="nc_remove_from_favorites">Remove from favorites</string>
|
||||
|
||||
<string name="nc_forward_to_three_dots">Forward to …</string>
|
||||
|
||||
<!-- Contacts -->
|
||||
<string name="nc_select_participants">Select participants</string>
|
||||
<string name="nc_add_participants">Add participants</string>
|
||||
|
@ -357,6 +359,7 @@
|
|||
|
||||
<!-- Chat -->
|
||||
<string name="nc_copy_message">Copy</string>
|
||||
<string name="nc_forward_message">Forward</string>
|
||||
<string name="nc_reply">Reply</string>
|
||||
<string name="nc_reply_privately">Reply privately</string>
|
||||
<string name="nc_delete_message">Delete</string>
|
||||
|
|
Loading…
Reference in a new issue