diff options
author | Christian Schneppe <christian@pix-art.de> | 2017-01-31 19:27:20 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2017-01-31 19:27:20 +0100 |
commit | 86d7540e3460c702e511cab368c37c17d06f5983 (patch) | |
tree | b82a85e7052b24e23406dfe81d04457e635b56f3 | |
parent | 49cbd712e3ef9acedd0728298ac4da910780ee67 (diff) |
fix showing of buttons in chats
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java | 17 | ||||
-rw-r--r-- | src/main/res/layout/message_sent.xml | 7 |
2 files changed, 18 insertions, 6 deletions
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 e5f98ca4e..e5daf53f0 100644 --- a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java +++ b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java @@ -175,7 +175,6 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie } 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; @@ -244,16 +243,19 @@ 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; + viewHolder.resend_button.setVisibility(View.VISIBLE); + viewHolder.resend_button.setText(R.string.send_again); + viewHolder.resend_button.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_resend_grey600_48dp, 0, 0, 0); + viewHolder.resend_button.setOnClickListener(new OnClickListener() { + final Message mMessage = message; + @Override public void onClick(View v) { activity.mConversationFragment.resendMessage(mMessage); } }); + } else if (!error && type == SENT) { + viewHolder.resend_button.setVisibility(View.GONE); } else if (!message.isValidInSession() && type == RECEIVED) { viewHolder.time.setTextColor(activity.getUnencryptedTextColor()); } else { @@ -722,6 +724,8 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie viewHolder.aw_player = (ViewGroup) view.findViewById(R.id.aw_player); viewHolder.download_button = (Button) view .findViewById(R.id.download_button); + viewHolder.resend_button = (Button) view + .findViewById(R.id.resend_button); viewHolder.indicator = (ImageView) view .findViewById(R.id.security_indicator); viewHolder.edit_indicator = (ImageView) view.findViewById(R.id.edit_indicator); @@ -1110,6 +1114,7 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie protected LinearLayout message_box; protected Button download_button; + protected Button resend_button; protected ViewGroup aw_player; protected ImageView image; protected ImageView indicator; diff --git a/src/main/res/layout/message_sent.xml b/src/main/res/layout/message_sent.xml index c44a216bd..d1923df71 100644 --- a/src/main/res/layout/message_sent.xml +++ b/src/main/res/layout/message_sent.xml @@ -76,6 +76,13 @@ android:longClickable="true" android:visibility="gone" /> + <Button + android:id="@+id/resend_button" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:longClickable="true" + android:visibility="gone" /> + <RelativeLayout android:id="@+id/aw_player" android:layout_width="wrap_content" |