mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-25 05:27:42 +00:00
@@ -55,10 +55,10 @@ class SignalContextMenu private constructor(
|
||||
contextMenuList.setItems(items)
|
||||
}
|
||||
|
||||
private fun show() {
|
||||
private fun show(): SignalContextMenu {
|
||||
if (anchor.width == 0 || anchor.height == 0) {
|
||||
anchor.post(this::show)
|
||||
return
|
||||
return this
|
||||
}
|
||||
|
||||
contentView.measure(
|
||||
@@ -107,6 +107,8 @@ class SignalContextMenu private constructor(
|
||||
}
|
||||
|
||||
showAsDropDown(anchor, offsetX, offsetY)
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
enum class HorizontalPosition {
|
||||
@@ -147,8 +149,8 @@ class SignalContextMenu private constructor(
|
||||
return this
|
||||
}
|
||||
|
||||
fun show(items: List<ActionItem>) {
|
||||
SignalContextMenu(
|
||||
fun show(items: List<ActionItem>): SignalContextMenu {
|
||||
return SignalContextMenu(
|
||||
anchor = anchor,
|
||||
container = container,
|
||||
items = items,
|
||||
|
||||
@@ -212,6 +212,7 @@ public class ConversationListFragment extends MainFragment implements ActionMode
|
||||
private Stub<FrameLayout> voiceNotePlayerViewStub;
|
||||
private VoiceNotePlayerView voiceNotePlayerView;
|
||||
private SignalBottomActionBar bottomActionBar;
|
||||
private SignalContextMenu activeContextMenu;
|
||||
|
||||
protected ConversationListArchiveItemDecoration archiveDecoration;
|
||||
protected ConversationListItemAnimator itemAnimator;
|
||||
@@ -1140,6 +1141,11 @@ public class ConversationListFragment extends MainFragment implements ActionMode
|
||||
return true;
|
||||
}
|
||||
|
||||
if (activeContextMenu != null) {
|
||||
Log.w(TAG, "Already showing a context menu.");
|
||||
return true;
|
||||
}
|
||||
|
||||
view.setSelected(true);
|
||||
|
||||
Collection<Long> id = Collections.singleton(conversation.getThreadRecord().getThreadId());
|
||||
@@ -1179,10 +1185,11 @@ public class ConversationListFragment extends MainFragment implements ActionMode
|
||||
|
||||
items.add(new ActionItem(R.drawable.ic_delete_24, getResources().getQuantityString(R.plurals.ConversationListFragment_delete_plural, 1), () -> handleDelete(id)));
|
||||
|
||||
new SignalContextMenu.Builder(view, list)
|
||||
activeContextMenu = new SignalContextMenu.Builder(view, list)
|
||||
.offsetX(ViewUtil.dpToPx(12))
|
||||
.offsetY(ViewUtil.dpToPx(12))
|
||||
.onDismiss(() -> {
|
||||
activeContextMenu = null;
|
||||
view.setSelected(false);
|
||||
list.suppressLayout(false);
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user