Use correct answer icon

pull/214/head
M66B 2 years ago
parent 44a437562a
commit 053f9008d4

@ -431,6 +431,7 @@ public class FragmentMessages extends FragmentBase
static final int REQUEST_BLOCK_SENDERS = 28; static final int REQUEST_BLOCK_SENDERS = 28;
static final int REQUEST_CALENDAR = 29; static final int REQUEST_CALENDAR = 29;
static final int REQUEST_EDIT_SUBJECT = 30; static final int REQUEST_EDIT_SUBJECT = 30;
private static final int REQUEST_ANSWER_SETTINGS = 31;
static final String ACTION_STORE_RAW = BuildConfig.APPLICATION_ID + ".STORE_RAW"; static final String ACTION_STORE_RAW = BuildConfig.APPLICATION_ID + ".STORE_RAW";
static final String ACTION_VERIFYDECRYPT = BuildConfig.APPLICATION_ID + ".VERIFYDECRYPT"; static final String ACTION_VERIFYDECRYPT = BuildConfig.APPLICATION_ID + ".VERIFYDECRYPT";
@ -4146,6 +4147,7 @@ public class FragmentMessages extends FragmentBase
private void onMenuAnswerSettings() { private void onMenuAnswerSettings() {
FragmentDialogAnswerButton fragment = new FragmentDialogAnswerButton(); FragmentDialogAnswerButton fragment = new FragmentDialogAnswerButton();
fragment.setTargetFragment(this, REQUEST_ANSWER_SETTINGS);
fragment.show(getParentFragmentManager(), "dialog:answer"); fragment.show(getParentFragmentManager(), "dialog:answer");
} }
@ -7604,9 +7606,10 @@ public class FragmentMessages extends FragmentBase
long id = values.get("expanded").get(0); long id = values.get("expanded").get(0);
int pos = adapter.getPositionForKey(id); int pos = adapter.getPositionForKey(id);
TupleMessageEx message = adapter.getItemAtPosition(pos); TupleMessageEx message = adapter.getItemAtPosition(pos);
if (message != null && !EntityFolder.OUTBOX.equals(message.folderType)) if (message != null && !EntityFolder.OUTBOX.equals(message.folderType)) {
updateAnswerIcon();
fabReply.show(); fabReply.show();
else } else
fabReply.hide(); fabReply.hide();
} else } else
fabReply.hide(); fabReply.hide();
@ -7616,6 +7619,39 @@ public class FragmentMessages extends FragmentBase
ibUp.setVisibility(quick_scroll && expanded > 0 ? View.VISIBLE : View.GONE); ibUp.setVisibility(quick_scroll && expanded > 0 ? View.VISIBLE : View.GONE);
} }
private void updateAnswerIcon() {
if (!getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
return;
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
String action = prefs.getString("answer_single", "menu");
switch (action) {
case "reply":
fabReply.setImageResource(R.drawable.twotone_reply_24);
break;
case "reply_all":
fabReply.setImageResource(R.drawable.twotone_reply_all_24);
break;
case "list":
fabReply.setImageResource(R.drawable.twotone_reorder_24);
break;
case "forward":
fabReply.setImageResource(R.drawable.twotone_forward_24);
break;
case "resend":
fabReply.setImageResource(R.drawable.twotone_redo_24);
break;
case "editasnew":
fabReply.setImageResource(R.drawable.twotone_add_24);
break;
case "move":
fabReply.setImageResource(R.drawable.twotone_drive_file_move_24);
break;
default:
fabReply.setImageResource(R.drawable.twotone_reply_24_options);
}
}
private void handleExpand(long id) { private void handleExpand(long id) {
SimpleTask<Void> taskExpand = new SimpleTask<Void>() { SimpleTask<Void> taskExpand = new SimpleTask<Void>() {
@Override @Override
@ -8811,6 +8847,10 @@ public class FragmentMessages extends FragmentBase
if (resultCode == RESULT_OK) if (resultCode == RESULT_OK)
onEditSubject(data.getBundleExtra("args")); onEditSubject(data.getBundleExtra("args"));
break; break;
case REQUEST_ANSWER_SETTINGS:
if (resultCode == RESULT_OK)
updateAnswerIcon();
break;
} }
} catch (Throwable ex) { } catch (Throwable ex) {
Log.e(ex); Log.e(ex);

@ -139,7 +139,7 @@ public class FragmentOptions extends FragmentBase {
"subscriptions", "subscriptions",
"check_authentication", "check_tls", "check_reply_domain", "check_mx", "check_blocklist", "check_authentication", "check_tls", "check_reply_domain", "check_mx", "check_blocklist",
"send_pending", "send_pending",
"startup", "startup", "answer_single",
"cards", "beige", "tabular_card_bg", "shadow_unread", "shadow_border", "shadow_highlight", "dividers", "cards", "beige", "tabular_card_bg", "shadow_unread", "shadow_border", "shadow_highlight", "dividers",
"portrait2", "portrait2c", "portrait_min_size", "landscape", "landscape_min_size", "portrait2", "portrait2c", "portrait_min_size", "landscape", "landscape_min_size",
"column_width", "column_width",

Loading…
Cancel
Save