Added optional copy button

pull/182/head
M66B 5 years ago
parent 3192cea0db
commit ef616d466c

@ -414,6 +414,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private ImageButton ibUnsubscribe; private ImageButton ibUnsubscribe;
private ImageButton ibAnswer; private ImageButton ibAnswer;
private ImageButton ibLabels; private ImageButton ibLabels;
private ImageButton ibCopy;
private ImageButton ibMove; private ImageButton ibMove;
private ImageButton ibArchive; private ImageButton ibArchive;
private ImageButton ibTrash; private ImageButton ibTrash;
@ -617,6 +618,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibUnsubscribe = vsBody.findViewById(R.id.ibUnsubscribe); ibUnsubscribe = vsBody.findViewById(R.id.ibUnsubscribe);
ibAnswer = vsBody.findViewById(R.id.ibAnswer); ibAnswer = vsBody.findViewById(R.id.ibAnswer);
ibLabels = vsBody.findViewById(R.id.ibLabels); ibLabels = vsBody.findViewById(R.id.ibLabels);
ibCopy = vsBody.findViewById(R.id.ibCopy);
ibMove = vsBody.findViewById(R.id.ibMove); ibMove = vsBody.findViewById(R.id.ibMove);
ibArchive = vsBody.findViewById(R.id.ibArchive); ibArchive = vsBody.findViewById(R.id.ibArchive);
ibTrash = vsBody.findViewById(R.id.ibTrash); ibTrash = vsBody.findViewById(R.id.ibTrash);
@ -708,6 +710,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibUndo.setOnClickListener(this); ibUndo.setOnClickListener(this);
ibAnswer.setOnClickListener(this); ibAnswer.setOnClickListener(this);
ibLabels.setOnClickListener(this); ibLabels.setOnClickListener(this);
ibCopy.setOnClickListener(this);
ibMove.setOnClickListener(this); ibMove.setOnClickListener(this);
ibArchive.setOnClickListener(this); ibArchive.setOnClickListener(this);
ibTrash.setOnClickListener(this); ibTrash.setOnClickListener(this);
@ -796,6 +799,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibUndo.setOnClickListener(null); ibUndo.setOnClickListener(null);
ibAnswer.setOnClickListener(null); ibAnswer.setOnClickListener(null);
ibLabels.setOnClickListener(null); ibLabels.setOnClickListener(null);
ibCopy.setOnClickListener(null);
ibMove.setOnClickListener(null); ibMove.setOnClickListener(null);
ibArchive.setOnClickListener(null); ibArchive.setOnClickListener(null);
ibTrash.setOnClickListener(null); ibTrash.setOnClickListener(null);
@ -1299,6 +1303,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibUnsubscribe.setVisibility(View.GONE); ibUnsubscribe.setVisibility(View.GONE);
ibAnswer.setVisibility(View.GONE); ibAnswer.setVisibility(View.GONE);
ibLabels.setVisibility(View.GONE); ibLabels.setVisibility(View.GONE);
ibCopy.setVisibility(View.GONE);
ibMove.setVisibility(View.GONE); ibMove.setVisibility(View.GONE);
ibArchive.setVisibility(View.GONE); ibArchive.setVisibility(View.GONE);
ibTrash.setVisibility(View.GONE); ibTrash.setVisibility(View.GONE);
@ -1430,6 +1435,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibUnsubscribe.setVisibility(View.GONE); ibUnsubscribe.setVisibility(View.GONE);
ibAnswer.setVisibility(View.GONE); ibAnswer.setVisibility(View.GONE);
ibLabels.setVisibility(View.GONE); ibLabels.setVisibility(View.GONE);
ibCopy.setVisibility(View.GONE);
ibMove.setVisibility(View.GONE); ibMove.setVisibility(View.GONE);
ibArchive.setVisibility(View.GONE); ibArchive.setVisibility(View.GONE);
ibTrash.setVisibility(View.GONE); ibTrash.setVisibility(View.GONE);
@ -1562,6 +1568,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
boolean button_trash = prefs.getBoolean("button_trash", true); boolean button_trash = prefs.getBoolean("button_trash", true);
boolean button_archive = prefs.getBoolean("button_archive", true); boolean button_archive = prefs.getBoolean("button_archive", true);
boolean button_move = prefs.getBoolean("button_move", true); boolean button_move = prefs.getBoolean("button_move", true);
boolean button_copy = prefs.getBoolean("button_copy", false);
boolean button_unsubscribe = prefs.getBoolean("button_unsubscribe", true); boolean button_unsubscribe = prefs.getBoolean("button_unsubscribe", true);
boolean button_rule = prefs.getBoolean("button_rule", false); boolean button_rule = prefs.getBoolean("button_rule", false);
@ -1573,6 +1580,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibUnsubscribe.setVisibility(tools && button_unsubscribe && message.unsubscribe != null ? View.VISIBLE : View.GONE); ibUnsubscribe.setVisibility(tools && button_unsubscribe && message.unsubscribe != null ? 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 && !outbox ? View.VISIBLE : View.GONE); ibLabels.setVisibility(tools && labels_header && labels && !outbox ? View.VISIBLE : View.GONE);
ibCopy.setVisibility(tools && button_copy && move ? View.VISIBLE : View.GONE);
ibMove.setVisibility(tools && button_move && move ? View.VISIBLE : View.GONE); ibMove.setVisibility(tools && button_move && move ? View.VISIBLE : View.GONE);
ibArchive.setVisibility(tools && button_archive && archive ? View.VISIBLE : View.GONE); ibArchive.setVisibility(tools && button_archive && archive ? View.VISIBLE : View.GONE);
ibTrash.setVisibility(outbox || (tools && button_trash && trash) ? View.VISIBLE : View.GONE); ibTrash.setVisibility(outbox || (tools && button_trash && trash) ? View.VISIBLE : View.GONE);
@ -2781,6 +2789,9 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
case R.id.ibLabels: case R.id.ibLabels:
onActionLabels(message); onActionLabels(message);
break; break;
case R.id.ibCopy:
onActionMove(message, true);
break;
case R.id.ibMove: case R.id.ibMove:
onActionMove(message, false); onActionMove(message, false);
break; break;
@ -3766,6 +3777,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
boolean button_trash = prefs.getBoolean("button_trash", true); boolean button_trash = prefs.getBoolean("button_trash", true);
boolean button_archive = prefs.getBoolean("button_archive", true); boolean button_archive = prefs.getBoolean("button_archive", true);
boolean button_move = prefs.getBoolean("button_move", true); boolean button_move = prefs.getBoolean("button_move", true);
boolean button_copy = prefs.getBoolean("button_copy", false);
boolean button_unsubscribe = prefs.getBoolean("button_unsubscribe", true); boolean button_unsubscribe = prefs.getBoolean("button_unsubscribe", true);
boolean button_rule = prefs.getBoolean("button_rule", false); boolean button_rule = prefs.getBoolean("button_rule", false);
@ -3776,6 +3788,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
popupMenu.getMenu().findItem(R.id.menu_button_trash).setChecked(button_trash); popupMenu.getMenu().findItem(R.id.menu_button_trash).setChecked(button_trash);
popupMenu.getMenu().findItem(R.id.menu_button_archive).setChecked(button_archive); popupMenu.getMenu().findItem(R.id.menu_button_archive).setChecked(button_archive);
popupMenu.getMenu().findItem(R.id.menu_button_move).setChecked(button_move); popupMenu.getMenu().findItem(R.id.menu_button_move).setChecked(button_move);
popupMenu.getMenu().findItem(R.id.menu_button_copy).setChecked(button_copy);
popupMenu.getMenu().findItem(R.id.menu_button_unsubscribe).setChecked(button_unsubscribe); popupMenu.getMenu().findItem(R.id.menu_button_unsubscribe).setChecked(button_unsubscribe);
popupMenu.getMenu().findItem(R.id.menu_button_rule).setChecked(button_rule); popupMenu.getMenu().findItem(R.id.menu_button_rule).setChecked(button_rule);
@ -3843,6 +3856,9 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
case R.id.menu_button_move: case R.id.menu_button_move:
onMenuButton(message, "move", target.isChecked()); onMenuButton(message, "move", target.isChecked());
return true; return true;
case R.id.menu_button_copy:
onMenuButton(message, "copy", target.isChecked());
return true;
case R.id.menu_button_unsubscribe: case R.id.menu_button_unsubscribe:
onMenuButton(message, "unsubscribe", target.isChecked()); onMenuButton(message, "unsubscribe", 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,ibLabels,ibAnswer,ibUnsubscribe,ibRule,ibUndo" app:constraint_referenced_ids="ibMore,ibInbox,ibJunk,ibTrash,ibArchive,ibMove,ibCopy,ibLabels,ibAnswer,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"
@ -122,6 +122,18 @@
app:srcCompat="@drawable/baseline_folder_24" app:srcCompat="@drawable/baseline_folder_24"
tools:ignore="MissingConstraints" /> tools:ignore="MissingConstraints" />
<ImageButton
android:id="@+id/ibCopy"
android:layout_width="36dp"
android:layout_height="36dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/title_copy"
android:padding="6dp"
android:scaleType="fitCenter"
android:tooltipText="@string/title_copy"
app:srcCompat="@drawable/baseline_file_copy_24"
tools:ignore="MissingConstraints" />
<ImageButton <ImageButton
android:id="@+id/ibLabels" android:id="@+id/ibLabels"
android:layout_width="36dp" android:layout_width="36dp"

@ -20,6 +20,10 @@
android:id="@+id/menu_button_move" android:id="@+id/menu_button_move"
android:checkable="true" android:checkable="true"
android:title="@string/title_move" /> android:title="@string/title_move" />
<item
android:id="@+id/menu_button_copy"
android:checkable="true"
android:title="@string/title_copy_btn" />
<item <item
android:id="@+id/menu_button_unsubscribe" android:id="@+id/menu_button_unsubscribe"
android:checkable="true" android:checkable="true"

@ -761,6 +761,7 @@
<string name="title_more">More</string> <string name="title_more">More</string>
<string name="title_spam">Spam</string> <string name="title_spam">Spam</string>
<string name="title_move">Move</string> <string name="title_move">Move</string>
<string name="title_copy_btn">Copy</string>
<string name="title_unsubscribe">Unsubscribe</string> <string name="title_unsubscribe">Unsubscribe</string>
<string name="title_message_rule">Create rule</string> <string name="title_message_rule">Create rule</string>
<string name="title_no_junk">Not spam</string> <string name="title_no_junk">Not spam</string>

Loading…
Cancel
Save