Added optional search button

pull/191/head
M66B 4 years ago
parent 309f94a0aa
commit f918a63729

@ -424,6 +424,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private ImageButton ibPrint; private ImageButton ibPrint;
private ImageButton ibShare; private ImageButton ibShare;
private ImageButton ibEvent; private ImageButton ibEvent;
private ImageButton ibSearch;
private ImageButton ibSeen; private ImageButton ibSeen;
private ImageButton ibAnswer; private ImageButton ibAnswer;
private ImageButton ibLabels; private ImageButton ibLabels;
@ -647,6 +648,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibPrint = vsBody.findViewById(R.id.ibPrint); ibPrint = vsBody.findViewById(R.id.ibPrint);
ibShare = vsBody.findViewById(R.id.ibShare); ibShare = vsBody.findViewById(R.id.ibShare);
ibEvent = vsBody.findViewById(R.id.ibEvent); ibEvent = vsBody.findViewById(R.id.ibEvent);
ibSearch = vsBody.findViewById(R.id.ibSearch);
ibSeen = vsBody.findViewById(R.id.ibSeen); ibSeen = vsBody.findViewById(R.id.ibSeen);
ibAnswer = vsBody.findViewById(R.id.ibAnswer); ibAnswer = vsBody.findViewById(R.id.ibAnswer);
ibLabels = vsBody.findViewById(R.id.ibLabels); ibLabels = vsBody.findViewById(R.id.ibLabels);
@ -747,6 +749,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibPrint.setOnClickListener(this); ibPrint.setOnClickListener(this);
ibShare.setOnClickListener(this); ibShare.setOnClickListener(this);
ibEvent.setOnClickListener(this); ibEvent.setOnClickListener(this);
ibSearch.setOnClickListener(this);
ibSeen.setOnClickListener(this); ibSeen.setOnClickListener(this);
ibAnswer.setOnClickListener(this); ibAnswer.setOnClickListener(this);
ibLabels.setOnClickListener(this); ibLabels.setOnClickListener(this);
@ -856,6 +859,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibPrint.setOnClickListener(null); ibPrint.setOnClickListener(null);
ibShare.setOnClickListener(null); ibShare.setOnClickListener(null);
ibEvent.setOnClickListener(null); ibEvent.setOnClickListener(null);
ibSearch.setOnClickListener(null);
ibSeen.setOnClickListener(null); ibSeen.setOnClickListener(null);
ibAnswer.setOnClickListener(null); ibAnswer.setOnClickListener(null);
ibLabels.setOnClickListener(null); ibLabels.setOnClickListener(null);
@ -1315,6 +1319,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibPrint.setVisibility(View.GONE); ibPrint.setVisibility(View.GONE);
ibShare.setVisibility(View.GONE); ibShare.setVisibility(View.GONE);
ibEvent.setVisibility(View.GONE); ibEvent.setVisibility(View.GONE);
ibSearch.setVisibility(View.GONE);
ibSeen.setVisibility(View.GONE); ibSeen.setVisibility(View.GONE);
ibAnswer.setVisibility(View.GONE); ibAnswer.setVisibility(View.GONE);
ibLabels.setVisibility(View.GONE); ibLabels.setVisibility(View.GONE);
@ -1501,6 +1506,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibPrint.setVisibility(View.GONE); ibPrint.setVisibility(View.GONE);
ibShare.setVisibility(View.GONE); ibShare.setVisibility(View.GONE);
ibEvent.setVisibility(View.GONE); ibEvent.setVisibility(View.GONE);
ibSearch.setVisibility(View.GONE);
ibSeen.setVisibility(View.GONE); ibSeen.setVisibility(View.GONE);
ibAnswer.setVisibility(View.GONE); ibAnswer.setVisibility(View.GONE);
ibLabels.setVisibility(View.GONE); ibLabels.setVisibility(View.GONE);
@ -1641,6 +1647,9 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
boolean seen = (!(message.folderReadOnly || message.uid == null) || boolean seen = (!(message.folderReadOnly || message.uid == null) ||
message.accountProtocol == EntityAccount.TYPE_POP); message.accountProtocol == EntityAccount.TYPE_POP);
int froms = (message.from == null ? 0 : message.from.length);
int tos = (message.to == null ? 0 : message.to.length);
final boolean delete = (inTrash || !hasTrash || inJunk || outbox || final boolean delete = (inTrash || !hasTrash || inJunk || outbox ||
message.uid == null || message.accountProtocol == EntityAccount.TYPE_POP); message.uid == null || message.accountProtocol == EntityAccount.TYPE_POP);
@ -1655,6 +1664,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
boolean button_copy = prefs.getBoolean("button_copy", false); boolean button_copy = prefs.getBoolean("button_copy", false);
boolean button_keywords = prefs.getBoolean("button_keywords", false); boolean button_keywords = prefs.getBoolean("button_keywords", false);
boolean button_seen = prefs.getBoolean("button_seen", false); boolean button_seen = prefs.getBoolean("button_seen", false);
boolean button_search = prefs.getBoolean("button_search", false);
boolean button_event = prefs.getBoolean("button_event", false); boolean button_event = prefs.getBoolean("button_event", false);
boolean button_share = prefs.getBoolean("button_share", false); boolean button_share = prefs.getBoolean("button_share", false);
boolean button_print = prefs.getBoolean("button_print", false); boolean button_print = prefs.getBoolean("button_print", false);
@ -1670,6 +1680,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibPrint.setVisibility(tools && button_print && hasWebView && message.content && Helper.canPrint(context) ? View.VISIBLE : View.GONE); ibPrint.setVisibility(tools && button_print && hasWebView && message.content && Helper.canPrint(context) ? View.VISIBLE : View.GONE);
ibShare.setVisibility(tools && button_share && message.content ? View.VISIBLE : View.GONE); ibShare.setVisibility(tools && button_share && message.content ? View.VISIBLE : View.GONE);
ibEvent.setVisibility(tools && button_event && message.content ? View.VISIBLE : View.GONE); ibEvent.setVisibility(tools && button_event && message.content ? View.VISIBLE : View.GONE);
ibSearch.setVisibility(tools && button_search && (froms > 0 || tos > 0) ? View.VISIBLE : View.GONE);
ibSeen.setVisibility(tools && button_seen && !outbox && seen ? View.VISIBLE : View.GONE); ibSeen.setVisibility(tools && button_seen && !outbox && seen ? View.VISIBLE : View.GONE);
ibAnswer.setVisibility(!tools || outbox || (!expand_all && expand_one) ? View.GONE : View.VISIBLE); ibAnswer.setVisibility(!tools || outbox || (!expand_all && expand_one) ? View.GONE : View.VISIBLE);
ibLabels.setVisibility(tools && labels_header && labels ? View.VISIBLE : View.GONE); ibLabels.setVisibility(tools && labels_header && labels ? View.VISIBLE : View.GONE);
@ -1724,7 +1735,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ivAutoSubmitted.setVisibility(show_addresses && message.auto_submitted != null && message.auto_submitted ? View.VISIBLE : View.GONE); ivAutoSubmitted.setVisibility(show_addresses && message.auto_submitted != null && message.auto_submitted ? View.VISIBLE : View.GONE);
ivBrowsed.setVisibility(show_addresses && message.ui_browsed ? View.VISIBLE : View.GONE); ivBrowsed.setVisibility(show_addresses && message.ui_browsed ? View.VISIBLE : View.GONE);
ibSearchContact.setVisibility(show_addresses && (froms > 0 || tos > 0) ? View.VISIBLE : View.GONE); boolean button_search = prefs.getBoolean("button_search", false);
ibSearchContact.setVisibility(show_addresses && (froms > 0 || tos > 0) && !button_search ? View.VISIBLE : View.GONE);
ibNotifyContact.setVisibility(show_addresses && hasChannel && froms > 0 ? View.VISIBLE : View.GONE); ibNotifyContact.setVisibility(show_addresses && hasChannel && froms > 0 ? View.VISIBLE : View.GONE);
ibPinContact.setVisibility(show_addresses && pin && froms > 0 ? View.VISIBLE : View.GONE); ibPinContact.setVisibility(show_addresses && pin && froms > 0 ? View.VISIBLE : View.GONE);
ibAddContact.setVisibility(show_addresses && contacts && froms > 0 ? View.VISIBLE : View.GONE); ibAddContact.setVisibility(show_addresses && contacts && froms > 0 ? View.VISIBLE : View.GONE);
@ -2940,6 +2952,9 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
else else
context.startActivity(new Intent(context, ActivityBilling.class)); context.startActivity(new Intent(context, ActivityBilling.class));
break; break;
case R.id.ibSearch:
onSearchContact(message);
break;
case R.id.ibAnswer: case R.id.ibAnswer:
onActionAnswer(message, ibAnswer); onActionAnswer(message, ibAnswer);
break; break;
@ -3959,6 +3974,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
boolean button_copy = prefs.getBoolean("button_copy", false); boolean button_copy = prefs.getBoolean("button_copy", false);
boolean button_keywords = prefs.getBoolean("button_keywords", false); boolean button_keywords = prefs.getBoolean("button_keywords", false);
boolean button_seen = prefs.getBoolean("button_seen", false); boolean button_seen = prefs.getBoolean("button_seen", false);
boolean button_search = prefs.getBoolean("button_search", false);
boolean button_event = prefs.getBoolean("button_event", false); boolean button_event = prefs.getBoolean("button_event", false);
boolean button_share = prefs.getBoolean("button_share", false); boolean button_share = prefs.getBoolean("button_share", false);
boolean button_print = prefs.getBoolean("button_print", false); boolean button_print = prefs.getBoolean("button_print", false);
@ -3975,6 +3991,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
popupMenu.getMenu().findItem(R.id.menu_button_copy).setChecked(button_copy); popupMenu.getMenu().findItem(R.id.menu_button_copy).setChecked(button_copy);
popupMenu.getMenu().findItem(R.id.menu_button_keywords).setChecked(button_keywords); popupMenu.getMenu().findItem(R.id.menu_button_keywords).setChecked(button_keywords);
popupMenu.getMenu().findItem(R.id.menu_button_seen).setChecked(button_seen); popupMenu.getMenu().findItem(R.id.menu_button_seen).setChecked(button_seen);
popupMenu.getMenu().findItem(R.id.menu_button_search).setChecked(button_search);
popupMenu.getMenu().findItem(R.id.menu_button_event).setChecked(button_event); popupMenu.getMenu().findItem(R.id.menu_button_event).setChecked(button_event);
popupMenu.getMenu().findItem(R.id.menu_button_share).setChecked(button_share); popupMenu.getMenu().findItem(R.id.menu_button_share).setChecked(button_share);
popupMenu.getMenu().findItem(R.id.menu_button_print).setChecked(button_print); popupMenu.getMenu().findItem(R.id.menu_button_print).setChecked(button_print);
@ -4054,6 +4071,10 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
case R.id.menu_button_seen: case R.id.menu_button_seen:
onMenuButton(message, "seen", target.isChecked()); onMenuButton(message, "seen", target.isChecked());
return true; return true;
case R.id.menu_button_search:
onMenuButton(message, "search", target.isChecked());
bindAddresses(message);
return true;
case R.id.menu_button_event: case R.id.menu_button_event:
onMenuButton(message, "event", target.isChecked()); onMenuButton(message, "event", target.isChecked());
return true; return true;

@ -41,7 +41,7 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="3dp" android:layout_marginEnd="3dp"
app:constraint_referenced_ids="ibMore,ibInbox,ibJunk,ibTrash,ibArchive,ibMove,ibCopy,ibKeywords,ibLabels,ibAnswer,ibSeen,ibEvent,ibShare,ibPrint,ibUnsubscribe,ibRule,ibUndo" app:constraint_referenced_ids="ibMore,ibInbox,ibJunk,ibTrash,ibArchive,ibMove,ibCopy,ibKeywords,ibLabels,ibAnswer,ibSeen,ibSearch,ibEvent,ibShare,ibPrint,ibUnsubscribe,ibRule,ibUndo"
app:flow_horizontalBias="0" app:flow_horizontalBias="0"
app:flow_horizontalGap="3dp" app:flow_horizontalGap="3dp"
app:flow_horizontalStyle="packed" app:flow_horizontalStyle="packed"
@ -178,6 +178,18 @@
app:srcCompat="@drawable/twotone_visibility_24" app:srcCompat="@drawable/twotone_visibility_24"
tools:ignore="MissingConstraints" /> tools:ignore="MissingConstraints" />
<ImageButton
android:id="@+id/ibSearch"
android:layout_width="36dp"
android:layout_height="36dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/title_search"
android:padding="6dp"
android:scaleType="fitCenter"
android:tooltipText="@string/title_search"
app:srcCompat="@drawable/twotone_search_24"
tools:ignore="MissingConstraints" />
<ImageButton <ImageButton
android:id="@+id/ibEvent" android:id="@+id/ibEvent"
android:layout_width="36dp" android:layout_width="36dp"

@ -32,6 +32,10 @@
android:id="@+id/menu_button_seen" android:id="@+id/menu_button_seen"
android:checkable="true" android:checkable="true"
android:title="@string/title_toggle_seen" /> android:title="@string/title_toggle_seen" />
<item
android:id="@+id/menu_button_search"
android:checkable="true"
android:title="@string/title_search" />
<item <item
android:id="@+id/menu_button_event" android:id="@+id/menu_button_event"
android:checkable="true" android:checkable="true"

Loading…
Cancel
Save