aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-01-30 19:18:00 +0100
committerChristian Schneppe <christian@pix-art.de>2017-01-30 19:18:00 +0100
commit489bc37c39989a2a14a747213f3b6478c7f2f9be (patch)
tree2d0b6ec7626339f09373f1727f2b8325d3efd62d /src/main/java/de
parent4a38942f3bb2d56517146ea2a26661ddf4f5809d (diff)
add button to resend failed messages
Diffstat (limited to 'src/main/java/de')
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationActivity.java2
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationFragment.java7
-rw-r--r--src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java13
3 files changed, 14 insertions, 8 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationActivity.java b/src/main/java/de/pixart/messenger/ui/ConversationActivity.java
index 0dfd7bc14..069985745 100644
--- a/src/main/java/de/pixart/messenger/ui/ConversationActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/ConversationActivity.java
@@ -133,7 +133,7 @@ public class ConversationActivity extends XmppActivity
private Conversation swipedConversation = null;
private Conversation mSelectedConversation = null;
private EnhancedListView listView;
- private ConversationFragment mConversationFragment;
+ public ConversationFragment mConversationFragment;
private ArrayAdapter<Conversation> listAdapter;
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
index 5b17e7179..7bc1a3208 100644
--- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
+++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
@@ -614,7 +614,6 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
MenuItem retryDecryption = menu.findItem(R.id.retry_decryption);
MenuItem correctMessage = menu.findItem(R.id.correct_message);
MenuItem shareWith = menu.findItem(R.id.share_with);
- MenuItem sendAgain = menu.findItem(R.id.send_again);
MenuItem copyUrl = menu.findItem(R.id.copy_url);
MenuItem downloadFile = menu.findItem(R.id.download_file);
MenuItem cancelTransmission = menu.findItem(R.id.cancel_transmission);
@@ -646,7 +645,6 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
shareWith.setVisible(true);
}
if (m.getStatus() == Message.STATUS_SEND_FAILED) {
- sendAgain.setVisible(true);
}
if (m.hasFileOnRemoteHost()
|| GeoHelper.isGeoUri(m.getBody())
@@ -695,9 +693,6 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
case R.id.correct_message:
correctMessage(selectedMessage);
return true;
- case R.id.send_again:
- resendMessage(selectedMessage);
- return true;
case R.id.copy_url:
copyUrl(selectedMessage);
return true;
@@ -792,7 +787,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
}
}
- private void resendMessage(Message message) {
+ public void resendMessage(Message message) {
if (message.getType() == Message.TYPE_FILE || message.getType() == Message.TYPE_IMAGE) {
DownloadableFile file = activity.xmppConnectionService.getFileBackend().getFile(message);
if (!file.exists()) {
diff --git a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java
index 385fa184b..e5f98ca4e 100644
--- a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java
+++ b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java
@@ -174,7 +174,8 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
}
}
- private void displayStatus(ViewHolder viewHolder, Message message, int type, boolean darkBackground, boolean inValidSession) {
+ private void displayStatus(ViewHolder viewHolder, final Message message, int type, boolean darkBackground, boolean inValidSession) {
+ viewHolder.download_button.setVisibility(View.GONE);
String filesize = null;
String info = null;
boolean error = false;
@@ -243,6 +244,16 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
}
if (error && type == SENT) {
viewHolder.time.setTextColor(activity.getWarningTextColor());
+ viewHolder.download_button.setVisibility(View.VISIBLE);
+ viewHolder.download_button.setText(R.string.send_again);
+ viewHolder.download_button.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_resend_grey600_48dp, 0, 0, 0);
+ viewHolder.download_button.setOnClickListener(new OnClickListener() {
+ final Message mMessage = message;
+ @Override
+ public void onClick(View v) {
+ activity.mConversationFragment.resendMessage(mMessage);
+ }
+ });
} else if (!message.isValidInSession() && type == RECEIVED) {
viewHolder.time.setTextColor(activity.getUnencryptedTextColor());
} else {