aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsteckbrief <steckbrief@chefmail.de>2016-10-23 15:33:35 +0200
committersteckbrief <steckbrief@chefmail.de>2016-10-23 15:33:35 +0200
commite98aa48990d08b75f689c794bf720c5efe21a4b7 (patch)
treeb580105c43d7d31416d7293ca536910e3066c326
parent9ec29bb1dcf664fea606105b7e700641a4b44ae4 (diff)
Fixes FS#237: Enable long click in layout instead of programmatically
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/ui/adapter/MessageAdapter.java14
-rw-r--r--src/main/res/layout/message_received.xml5
-rw-r--r--src/main/res/layout/message_sent.xml3
3 files changed, 7 insertions, 15 deletions
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 e93ddbf..dd19057 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<Message> {
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<Message> messages) {
super(activity, 0, messages);
this.activity = activity;
@@ -389,7 +380,6 @@ public class MessageAdapter extends ArrayAdapter<Message> {
}
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<Message> {
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<Message> {
openDownloadable(message);
}
});
- viewHolder.download_button.setOnLongClickListener(openContextMenu);
}
private void displayLocationMessage(ViewHolder viewHolder, final Message message) {
@@ -450,7 +438,6 @@ public class MessageAdapter extends ArrayAdapter<Message> {
showLocation(message);
}
});
- viewHolder.download_button.setOnLongClickListener(openContextMenu);
}
private void displayImageMessage(ViewHolder viewHolder,
@@ -485,7 +472,6 @@ public class MessageAdapter extends ArrayAdapter<Message> {
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 d331b3e..029b0d7 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" />
<github.ankushsachdeva.emojicon.EmojiconTextView
@@ -54,6 +55,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:autoLink="web|phone|email"
+ android:longClickable="true"
android:textColor="@color/primaryText"
android:textSize="?attr/TextSizeBody"
app:emojiconSize="?attr/EmojiconSizeBody" />
@@ -61,6 +63,7 @@
<Button
android:id="@+id/download_button"
style="?android:attr/buttonStyleSmall"
+ android:longClickable="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone" />
diff --git a/src/main/res/layout/message_sent.xml b/src/main/res/layout/message_sent.xml
index 3000330..f59c51f 100644
--- a/src/main/res/layout/message_sent.xml
+++ b/src/main/res/layout/message_sent.xml
@@ -48,6 +48,7 @@
android:layout_marginBottom="4dp"
android:adjustViewBounds="true"
android:background="@color/primaryText"
+ android:longClickable="true"
android:scaleType="centerCrop" />
<github.ankushsachdeva.emojicon.EmojiconTextView
@@ -55,6 +56,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:autoLink="web|phone|email"
+ android:longClickable="true"
android:textColor="@color/primaryText"
android:textSize="?attr/TextSizeBody"
app:emojiconSize="?attr/EmojiconSizeBody"/>
@@ -62,6 +64,7 @@
<Button
android:id="@+id/download_button"
style="?android:attr/buttonStyleSmall"
+ android:longClickable="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone" />