|
|
@ -94,6 +94,7 @@ import androidx.appcompat.app.AlertDialog;
|
|
|
|
import androidx.appcompat.widget.PopupMenu;
|
|
|
|
import androidx.appcompat.widget.PopupMenu;
|
|
|
|
import androidx.constraintlayout.widget.ConstraintLayout;
|
|
|
|
import androidx.constraintlayout.widget.ConstraintLayout;
|
|
|
|
import androidx.constraintlayout.widget.Group;
|
|
|
|
import androidx.constraintlayout.widget.Group;
|
|
|
|
|
|
|
|
import androidx.core.content.FileProvider;
|
|
|
|
import androidx.fragment.app.Fragment;
|
|
|
|
import androidx.fragment.app.Fragment;
|
|
|
|
import androidx.fragment.app.FragmentManager;
|
|
|
|
import androidx.fragment.app.FragmentManager;
|
|
|
|
import androidx.lifecycle.Lifecycle;
|
|
|
|
import androidx.lifecycle.Lifecycle;
|
|
|
@ -2393,10 +2394,12 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|
|
|
popupMenu.getMenu().findItem(R.id.menu_show_headers).setChecked(show_headers);
|
|
|
|
popupMenu.getMenu().findItem(R.id.menu_show_headers).setChecked(show_headers);
|
|
|
|
popupMenu.getMenu().findItem(R.id.menu_show_headers).setEnabled(message.uid != null);
|
|
|
|
popupMenu.getMenu().findItem(R.id.menu_show_headers).setEnabled(message.uid != null);
|
|
|
|
|
|
|
|
|
|
|
|
popupMenu.getMenu().findItem(R.id.menu_raw).setEnabled(
|
|
|
|
popupMenu.getMenu().findItem(R.id.menu_raw_download).setEnabled(
|
|
|
|
message.uid != null && (message.raw == null || message.raw));
|
|
|
|
message.uid != null && (message.raw == null || !message.raw));
|
|
|
|
popupMenu.getMenu().findItem(R.id.menu_raw).setTitle(
|
|
|
|
popupMenu.getMenu().findItem(R.id.menu_raw_save).setEnabled(
|
|
|
|
message.raw == null || !message.raw ? R.string.title_raw_download : R.string.title_raw_save);
|
|
|
|
message.uid != null && (message.raw != null && message.raw));
|
|
|
|
|
|
|
|
popupMenu.getMenu().findItem(R.id.menu_raw_send).setEnabled(
|
|
|
|
|
|
|
|
message.uid != null && (message.raw != null && message.raw));
|
|
|
|
|
|
|
|
|
|
|
|
popupMenu.getMenu().findItem(R.id.menu_manage_keywords).setEnabled(message.uid != null && !message.folderReadOnly);
|
|
|
|
popupMenu.getMenu().findItem(R.id.menu_manage_keywords).setEnabled(message.uid != null && !message.folderReadOnly);
|
|
|
|
|
|
|
|
|
|
|
@ -2449,8 +2452,14 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|
|
|
case R.id.menu_show_headers:
|
|
|
|
case R.id.menu_show_headers:
|
|
|
|
onMenuShowHeaders(message);
|
|
|
|
onMenuShowHeaders(message);
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
case R.id.menu_raw:
|
|
|
|
case R.id.menu_raw_download:
|
|
|
|
onMenuRaw(message);
|
|
|
|
onMenuRawDownload(message);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
case R.id.menu_raw_save:
|
|
|
|
|
|
|
|
onMenuRawSave(message);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
case R.id.menu_raw_send:
|
|
|
|
|
|
|
|
onMenuRawSend(message);
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
@ -3041,8 +3050,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|
|
|
notifyDataSetChanged();
|
|
|
|
notifyDataSetChanged();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void onMenuRaw(TupleMessageEx message) {
|
|
|
|
private void onMenuRawDownload(TupleMessageEx message) {
|
|
|
|
if (message.raw == null) {
|
|
|
|
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
args.putLong("id", message.id);
|
|
|
|
args.putLong("id", message.id);
|
|
|
|
|
|
|
|
|
|
|
@ -3075,12 +3083,23 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|
|
|
Helper.unexpectedError(parentFragment.getFragmentManager(), ex);
|
|
|
|
Helper.unexpectedError(parentFragment.getFragmentManager(), ex);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}.execute(context, owner, args, "message:raw");
|
|
|
|
}.execute(context, owner, args, "message:raw");
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void onMenuRawSave(TupleMessageEx message) {
|
|
|
|
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context);
|
|
|
|
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context);
|
|
|
|
lbm.sendBroadcast(
|
|
|
|
lbm.sendBroadcast(
|
|
|
|
new Intent(FragmentMessages.ACTION_STORE_RAW)
|
|
|
|
new Intent(FragmentMessages.ACTION_STORE_RAW)
|
|
|
|
.putExtra("id", message.id));
|
|
|
|
.putExtra("id", message.id));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void onMenuRawSend(TupleMessageEx message) {
|
|
|
|
|
|
|
|
File file = message.getRawFile(context);
|
|
|
|
|
|
|
|
Uri uri = FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID, file);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Intent send = new Intent(Intent.ACTION_SEND);
|
|
|
|
|
|
|
|
send.putExtra(Intent.EXTRA_STREAM, uri);
|
|
|
|
|
|
|
|
send.setType("message/rfc822");
|
|
|
|
|
|
|
|
context.startActivity(send);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ItemDetailsLookup.ItemDetails<Long> getItemDetails(@NonNull MotionEvent motionEvent) {
|
|
|
|
ItemDetailsLookup.ItemDetails<Long> getItemDetails(@NonNull MotionEvent motionEvent) {
|
|
|
|