diff options
author | Christian Schneppe <christian@pix-art.de> | 2017-01-30 19:18:00 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2017-01-30 19:18:00 +0100 |
commit | 489bc37c39989a2a14a747213f3b6478c7f2f9be (patch) | |
tree | 2d0b6ec7626339f09373f1727f2b8325d3efd62d /src/main | |
parent | 4a38942f3bb2d56517146ea2a26661ddf4f5809d (diff) |
add button to resend failed messages
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/ConversationActivity.java | 2 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/ConversationFragment.java | 7 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java | 13 | ||||
-rw-r--r-- | src/main/res/drawable-hdpi/ic_resend_grey600_48dp.png | bin | 0 -> 1364 bytes | |||
-rw-r--r-- | src/main/res/drawable-mdpi/ic_resend_grey600_48dp.png | bin | 0 -> 733 bytes | |||
-rw-r--r-- | src/main/res/drawable-xhdpi/ic_resend_grey600_48dp.png | bin | 0 -> 1364 bytes | |||
-rw-r--r-- | src/main/res/drawable-xxhdpi/ic_resend_grey600_48dp.png | bin | 0 -> 2804 bytes | |||
-rw-r--r-- | src/main/res/drawable-xxxhdpi/ic_resend_grey600_48dp.png | bin | 0 -> 4422 bytes |
8 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 { diff --git a/src/main/res/drawable-hdpi/ic_resend_grey600_48dp.png b/src/main/res/drawable-hdpi/ic_resend_grey600_48dp.png Binary files differnew file mode 100644 index 000000000..d9914e274 --- /dev/null +++ b/src/main/res/drawable-hdpi/ic_resend_grey600_48dp.png diff --git a/src/main/res/drawable-mdpi/ic_resend_grey600_48dp.png b/src/main/res/drawable-mdpi/ic_resend_grey600_48dp.png Binary files differnew file mode 100644 index 000000000..b8f644358 --- /dev/null +++ b/src/main/res/drawable-mdpi/ic_resend_grey600_48dp.png diff --git a/src/main/res/drawable-xhdpi/ic_resend_grey600_48dp.png b/src/main/res/drawable-xhdpi/ic_resend_grey600_48dp.png Binary files differnew file mode 100644 index 000000000..fac337fc9 --- /dev/null +++ b/src/main/res/drawable-xhdpi/ic_resend_grey600_48dp.png diff --git a/src/main/res/drawable-xxhdpi/ic_resend_grey600_48dp.png b/src/main/res/drawable-xxhdpi/ic_resend_grey600_48dp.png Binary files differnew file mode 100644 index 000000000..adc177a21 --- /dev/null +++ b/src/main/res/drawable-xxhdpi/ic_resend_grey600_48dp.png diff --git a/src/main/res/drawable-xxxhdpi/ic_resend_grey600_48dp.png b/src/main/res/drawable-xxxhdpi/ic_resend_grey600_48dp.png Binary files differnew file mode 100644 index 000000000..86e9193e8 --- /dev/null +++ b/src/main/res/drawable-xxxhdpi/ic_resend_grey600_48dp.png |