From e98aa48990d08b75f689c794bf720c5efe21a4b7 Mon Sep 17 00:00:00 2001 From: steckbrief Date: Sun, 23 Oct 2016 15:33:35 +0200 Subject: Fixes FS#237: Enable long click in layout instead of programmatically --- .../conversationsplus/ui/adapter/MessageAdapter.java | 14 -------------- src/main/res/layout/message_received.xml | 5 ++++- src/main/res/layout/message_sent.xml | 3 +++ 3 files changed, 7 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/adapter/MessageAdapter.java b/src/main/java/de/thedevstack/conversationsplus/ui/adapter/MessageAdapter.java index e93ddbfa..dd190576 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/adapter/MessageAdapter.java +++ b/src/main/java/de/thedevstack/conversationsplus/ui/adapter/MessageAdapter.java @@ -79,15 +79,6 @@ public class MessageAdapter extends ArrayAdapter { private OnContactPictureClicked mOnContactPictureClickedListener; private OnContactPictureLongClicked mOnContactPictureLongClickedListener; - private OnLongClickListener openContextMenu = new OnLongClickListener() { - - @Override - public boolean onLongClick(View v) { - v.showContextMenu(); - return true; - } - }; - public MessageAdapter(ConversationActivity activity, List messages) { super(activity, 0, messages); this.activity = activity; @@ -389,7 +380,6 @@ public class MessageAdapter extends ArrayAdapter { } viewHolder.messageBody.setTextColor(this.getMessageTextColor(darkBackground, true)); viewHolder.messageBody.setTypeface(null, Typeface.NORMAL); - viewHolder.messageBody.setOnLongClickListener(openContextMenu); } /** @@ -420,7 +410,6 @@ public class MessageAdapter extends ArrayAdapter { activity.startDownloadable(message); } }); - viewHolder.download_button.setOnLongClickListener(openContextMenu); } private void displayOpenableMessage(ViewHolder viewHolder,final Message message) { @@ -435,7 +424,6 @@ public class MessageAdapter extends ArrayAdapter { openDownloadable(message); } }); - viewHolder.download_button.setOnLongClickListener(openContextMenu); } private void displayLocationMessage(ViewHolder viewHolder, final Message message) { @@ -450,7 +438,6 @@ public class MessageAdapter extends ArrayAdapter { showLocation(message); } }); - viewHolder.download_button.setOnLongClickListener(openContextMenu); } private void displayImageMessage(ViewHolder viewHolder, @@ -485,7 +472,6 @@ public class MessageAdapter extends ArrayAdapter { openDownloadable(message); } }); - viewHolder.image.setOnLongClickListener(openContextMenu); } @Override diff --git a/src/main/res/layout/message_received.xml b/src/main/res/layout/message_received.xml index d331b3ef..029b0d74 100644 --- a/src/main/res/layout/message_received.xml +++ b/src/main/res/layout/message_received.xml @@ -46,7 +46,8 @@ android:layout_marginTop="8dp" android:layout_marginBottom="4dp" android:adjustViewBounds="true" - android:background="@color/black87" + android:longClickable="true" + android:background="@color/primaryText" android:scaleType="centerCrop" /> @@ -61,6 +63,7 @@