|
|
|
@ -122,6 +122,7 @@ import androidx.core.content.FileProvider;
|
|
|
|
|
import androidx.core.content.pm.ShortcutInfoCompat;
|
|
|
|
|
import androidx.core.content.pm.ShortcutManagerCompat;
|
|
|
|
|
import androidx.core.graphics.ColorUtils;
|
|
|
|
|
import androidx.core.view.MenuCompat;
|
|
|
|
|
import androidx.fragment.app.DialogFragment;
|
|
|
|
|
import androidx.fragment.app.Fragment;
|
|
|
|
|
import androidx.fragment.app.FragmentManager;
|
|
|
|
@ -4531,18 +4532,14 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|
|
|
|
.setEnabled(message.uid == null || !message.folderReadOnly)
|
|
|
|
|
.setVisible(message.accountProtocol == EntityAccount.TYPE_IMAP);
|
|
|
|
|
|
|
|
|
|
popupMenu.getMenu().findItem(R.id.menu_resync)
|
|
|
|
|
.setEnabled(message.uid != null)
|
|
|
|
|
.setVisible(message.accountProtocol == EntityAccount.TYPE_IMAP);
|
|
|
|
|
|
|
|
|
|
popupMenu.getMenu().findItem(R.id.menu_search_in_text).setEnabled(message.content && !full);
|
|
|
|
|
|
|
|
|
|
popupMenu.getMenu().findItem(R.id.menu_create_rule).setVisible(!message.folderReadOnly);
|
|
|
|
|
|
|
|
|
|
popupMenu.getMenu().findItem(R.id.menu_manage_keywords)
|
|
|
|
|
.setEnabled(message.uid != null && !message.folderReadOnly)
|
|
|
|
|
.setVisible(message.accountProtocol == EntityAccount.TYPE_IMAP);
|
|
|
|
|
|
|
|
|
|
popupMenu.getMenu().findItem(R.id.menu_search_in_text).setEnabled(message.content && !full);
|
|
|
|
|
|
|
|
|
|
popupMenu.getMenu().findItem(R.id.menu_share).setEnabled(message.content);
|
|
|
|
|
popupMenu.getMenu().findItem(R.id.menu_pin).setVisible(pin);
|
|
|
|
|
popupMenu.getMenu().findItem(R.id.menu_event).setEnabled(message.content);
|
|
|
|
@ -4562,8 +4559,14 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|
|
|
|
popupMenu.getMenu().findItem(R.id.menu_raw_save).setVisible(message.accountProtocol == EntityAccount.TYPE_IMAP);
|
|
|
|
|
popupMenu.getMenu().findItem(R.id.menu_raw_send).setVisible(message.accountProtocol == EntityAccount.TYPE_IMAP);
|
|
|
|
|
|
|
|
|
|
popupMenu.getMenu().findItem(R.id.menu_resync)
|
|
|
|
|
.setEnabled(message.uid != null)
|
|
|
|
|
.setVisible(message.accountProtocol == EntityAccount.TYPE_IMAP);
|
|
|
|
|
|
|
|
|
|
popupMenu.insertIcons(context);
|
|
|
|
|
|
|
|
|
|
MenuCompat.setGroupDividerEnabled(popupMenu.getMenu(), true);
|
|
|
|
|
|
|
|
|
|
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public boolean onMenuItemClick(MenuItem target) {
|
|
|
|
@ -4603,21 +4606,18 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|
|
|
|
} else if (itemId == R.id.menu_delete) {
|
|
|
|
|
onActionDelete(message);
|
|
|
|
|
return true;
|
|
|
|
|
} else if (itemId == R.id.menu_resync) {
|
|
|
|
|
onMenuResync(message);
|
|
|
|
|
return true;
|
|
|
|
|
} else if (itemId == R.id.menu_edit_notes) {
|
|
|
|
|
onMenuNotes(message);
|
|
|
|
|
return true;
|
|
|
|
|
} else if (itemId == R.id.menu_search_in_text) {
|
|
|
|
|
onSearchText(message);
|
|
|
|
|
return true;
|
|
|
|
|
} else if (itemId == R.id.menu_create_rule) {
|
|
|
|
|
onMenuCreateRule(message);
|
|
|
|
|
return true;
|
|
|
|
|
} else if (itemId == R.id.menu_manage_keywords) {
|
|
|
|
|
onMenuManageKeywords(message);
|
|
|
|
|
return true;
|
|
|
|
|
} else if (itemId == R.id.menu_search_in_text) {
|
|
|
|
|
onSearchText(message);
|
|
|
|
|
return true;
|
|
|
|
|
} else if (itemId == R.id.menu_event) {
|
|
|
|
|
if (ActivityBilling.isPro(context))
|
|
|
|
|
onMenuShare(message, true);
|
|
|
|
@ -4648,6 +4648,9 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|
|
|
|
} else if (itemId == R.id.menu_raw_send_thread) {
|
|
|
|
|
onMenuRawSend(message, true);
|
|
|
|
|
return true;
|
|
|
|
|
} else if (itemId == R.id.menu_resync) {
|
|
|
|
|
onMenuResync(message);
|
|
|
|
|
return true;
|
|
|
|
|
} else if (itemId == R.id.menu_log) {
|
|
|
|
|
onMenuLog(message);
|
|
|
|
|
return true;
|
|
|
|
@ -7236,15 +7239,16 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|
|
|
|
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
|
|
|
|
|
|
|
|
|
final View dview = LayoutInflater.from(context).inflate(R.layout.dialog_buttons, null);
|
|
|
|
|
final CheckBox cbSeen = dview.findViewById(R.id.cbSeen);
|
|
|
|
|
final CheckBox cbHide = dview.findViewById(R.id.cbHide);
|
|
|
|
|
final CheckBox cbJunk = dview.findViewById(R.id.cbJunk);
|
|
|
|
|
final CheckBox cbTrash = dview.findViewById(R.id.cbTrash);
|
|
|
|
|
final CheckBox cbArchive = dview.findViewById(R.id.cbArchive);
|
|
|
|
|
final CheckBox cbMove = dview.findViewById(R.id.cbMove);
|
|
|
|
|
final CheckBox cbCopy = dview.findViewById(R.id.cbCopy);
|
|
|
|
|
final CheckBox cbKeywords = dview.findViewById(R.id.cbKeywords);
|
|
|
|
|
final CheckBox cbNotes = dview.findViewById(R.id.cbNotes);
|
|
|
|
|
final CheckBox cbSeen = dview.findViewById(R.id.cbSeen);
|
|
|
|
|
final CheckBox cbHide = dview.findViewById(R.id.cbHide);
|
|
|
|
|
final CheckBox cbRule = dview.findViewById(R.id.cbRule);
|
|
|
|
|
final CheckBox cbKeywords = dview.findViewById(R.id.cbKeywords);
|
|
|
|
|
final CheckBox cbSearch = dview.findViewById(R.id.cbSearch);
|
|
|
|
|
final CheckBox cbSearchText = dview.findViewById(R.id.cbSearchText);
|
|
|
|
|
final CheckBox cbTranslate = dview.findViewById(R.id.cbTranslate);
|
|
|
|
@ -7254,20 +7258,20 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|
|
|
|
final CheckBox cbPrint = dview.findViewById(R.id.cbPrint);
|
|
|
|
|
final CheckBox cbHeaders = dview.findViewById(R.id.cbHeaders);
|
|
|
|
|
final CheckBox cbUnsubscribe = dview.findViewById(R.id.cbUnsubscribe);
|
|
|
|
|
final CheckBox cbRule = dview.findViewById(R.id.cbRule);
|
|
|
|
|
|
|
|
|
|
cbTranslate.setVisibility(DeepL.isAvailable(context) ? View.VISIBLE : View.GONE);
|
|
|
|
|
cbPin.setVisibility(Shortcuts.can(context) ? View.VISIBLE : View.GONE);
|
|
|
|
|
|
|
|
|
|
cbSeen.setChecked(prefs.getBoolean("button_seen", false));
|
|
|
|
|
cbHide.setChecked(prefs.getBoolean("button_hide", false));
|
|
|
|
|
cbJunk.setChecked(prefs.getBoolean("button_junk", true));
|
|
|
|
|
cbTrash.setChecked(prefs.getBoolean("button_trash", true));
|
|
|
|
|
cbArchive.setChecked(prefs.getBoolean("button_archive", true));
|
|
|
|
|
cbMove.setChecked(prefs.getBoolean("button_move", true));
|
|
|
|
|
cbCopy.setChecked(prefs.getBoolean("button_copy", false));
|
|
|
|
|
cbKeywords.setChecked(prefs.getBoolean("button_keywords", false));
|
|
|
|
|
cbNotes.setChecked(prefs.getBoolean("button_notes", false));
|
|
|
|
|
cbSeen.setChecked(prefs.getBoolean("button_seen", false));
|
|
|
|
|
cbHide.setChecked(prefs.getBoolean("button_hide", false));
|
|
|
|
|
cbRule.setChecked(prefs.getBoolean("button_rule", false));
|
|
|
|
|
cbKeywords.setChecked(prefs.getBoolean("button_keywords", false));
|
|
|
|
|
cbSearch.setChecked(prefs.getBoolean("button_search", false));
|
|
|
|
|
cbSearchText.setChecked(prefs.getBoolean("button_search_text", false));
|
|
|
|
|
cbTranslate.setChecked(prefs.getBoolean("button_translate", false));
|
|
|
|
@ -7277,7 +7281,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|
|
|
|
cbPrint.setChecked(prefs.getBoolean("button_print", false));
|
|
|
|
|
cbHeaders.setChecked(prefs.getBoolean("button_headers", false));
|
|
|
|
|
cbUnsubscribe.setChecked(prefs.getBoolean("button_unsubscribe", true));
|
|
|
|
|
cbRule.setChecked(prefs.getBoolean("button_rule", false));
|
|
|
|
|
|
|
|
|
|
return new AlertDialog.Builder(getContext())
|
|
|
|
|
.setView(dview)
|
|
|
|
@ -7285,15 +7288,16 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
|
|
SharedPreferences.Editor editor = prefs.edit();
|
|
|
|
|
editor.putBoolean("button_seen", cbSeen.isChecked());
|
|
|
|
|
editor.putBoolean("button_hide", cbHide.isChecked());
|
|
|
|
|
editor.putBoolean("button_junk", cbJunk.isChecked());
|
|
|
|
|
editor.putBoolean("button_trash", cbTrash.isChecked());
|
|
|
|
|
editor.putBoolean("button_archive", cbArchive.isChecked());
|
|
|
|
|
editor.putBoolean("button_move", cbMove.isChecked());
|
|
|
|
|
editor.putBoolean("button_copy", cbCopy.isChecked());
|
|
|
|
|
editor.putBoolean("button_keywords", cbKeywords.isChecked());
|
|
|
|
|
editor.putBoolean("button_notes", cbNotes.isChecked());
|
|
|
|
|
editor.putBoolean("button_seen", cbSeen.isChecked());
|
|
|
|
|
editor.putBoolean("button_hide", cbHide.isChecked());
|
|
|
|
|
editor.putBoolean("button_rule", cbRule.isChecked());
|
|
|
|
|
editor.putBoolean("button_keywords", cbKeywords.isChecked());
|
|
|
|
|
editor.putBoolean("button_search", cbSearch.isChecked());
|
|
|
|
|
editor.putBoolean("button_search_text", cbSearchText.isChecked());
|
|
|
|
|
editor.putBoolean("button_translate", cbTranslate.isChecked());
|
|
|
|
@ -7303,7 +7307,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|
|
|
|
editor.putBoolean("button_print", cbPrint.isChecked());
|
|
|
|
|
editor.putBoolean("button_headers", cbHeaders.isChecked());
|
|
|
|
|
editor.putBoolean("button_unsubscribe", cbUnsubscribe.isChecked());
|
|
|
|
|
editor.putBoolean("button_rule", cbRule.isChecked());
|
|
|
|
|
editor.apply();
|
|
|
|
|
sendResult(Activity.RESULT_OK);
|
|
|
|
|
}
|
|
|
|
|