Added menu item to show conversation for single messages

pull/204/head
M66B 3 years ago
parent a939bd6be5
commit 143652096e

@ -423,7 +423,8 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
cards = prefs.getBoolean("cards", true); cards = prefs.getBoolean("cards", true);
date = prefs.getBoolean("date", true); date = prefs.getBoolean("date", true);
date_bold = prefs.getBoolean("date_bold", false); date_bold = prefs.getBoolean("date_bold", false);
threading = prefs.getBoolean("threading", true); threading = (prefs.getBoolean("threading", true) ||
args.getBoolean("force_threading"));
seekbar = prefs.getBoolean("seekbar", false); seekbar = prefs.getBoolean("seekbar", false);
actionbar = prefs.getBoolean("actionbar", true); actionbar = prefs.getBoolean("actionbar", true);
actionbar_color = prefs.getBoolean("actionbar_color", false); actionbar_color = prefs.getBoolean("actionbar_color", false);
@ -4362,12 +4363,14 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
menu.findItem(R.id.menu_select_found).setVisible(viewType == AdapterMessage.ViewType.SEARCH); menu.findItem(R.id.menu_select_found).setVisible(viewType == AdapterMessage.ViewType.SEARCH);
menu.findItem(R.id.menu_mark_all_read).setVisible(folder); menu.findItem(R.id.menu_mark_all_read).setVisible(folder);
menu.findItem(R.id.menu_edit_properties).setVisible(viewType == AdapterMessage.ViewType.FOLDER && !outbox); menu.findItem(R.id.menu_view_thread).setVisible(viewType == AdapterMessage.ViewType.THREAD && !threading);
menu.findItem(R.id.menu_sync_more).setVisible(folder); menu.findItem(R.id.menu_sync_more).setVisible(folder);
menu.findItem(R.id.menu_force_sync).setVisible(viewType == AdapterMessage.ViewType.UNIFIED); menu.findItem(R.id.menu_force_sync).setVisible(viewType == AdapterMessage.ViewType.UNIFIED);
menu.findItem(R.id.menu_force_send).setVisible(outbox); menu.findItem(R.id.menu_force_send).setVisible(outbox);
menu.findItem(R.id.menu_edit_properties).setVisible(viewType == AdapterMessage.ViewType.FOLDER && !outbox);
ibSeen.setImageResource(filter_seen ? R.drawable.twotone_drafts_24 : R.drawable.twotone_mail_24); ibSeen.setImageResource(filter_seen ? R.drawable.twotone_drafts_24 : R.drawable.twotone_mail_24);
ibUnflagged.setImageResource(filter_unflagged ? R.drawable.twotone_star_border_24 : R.drawable.baseline_star_24); ibUnflagged.setImageResource(filter_unflagged ? R.drawable.twotone_star_border_24 : R.drawable.baseline_star_24);
ibSnoozed.setImageResource(filter_snoozed ? R.drawable.twotone_visibility_off_24 : R.drawable.twotone_visibility_24); ibSnoozed.setImageResource(filter_snoozed ? R.drawable.twotone_visibility_off_24 : R.drawable.twotone_visibility_24);
@ -4466,6 +4469,9 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
} else if (itemId == R.id.menu_mark_all_read) { } else if (itemId == R.id.menu_mark_all_read) {
onMenuMarkAllRead(); onMenuMarkAllRead();
return true; return true;
} else if (itemId == R.id.menu_view_thread) {
onMenuViewThread();
return true;
} else if (itemId == R.id.menu_sync_more) { } else if (itemId == R.id.menu_sync_more) {
onMenuSyncMore(); onMenuSyncMore();
return true; return true;
@ -4730,6 +4736,18 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
} }
private void onMenuViewThread() {
Bundle args = new Bundle(getArguments());
args.putBoolean("force_threading", true);
FragmentMessages fragment = new FragmentMessages();
fragment.setArguments(args);
FragmentTransaction fragmentTransaction = getParentFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.content_frame, fragment).addToBackStack("thread");
fragmentTransaction.commit();
}
private void markAllRead() { private void markAllRead() {
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putString("type", type); args.putString("type", type);
@ -4974,7 +4992,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
ViewModelMessages.Model vmodel = model.getModel( ViewModelMessages.Model vmodel = model.getModel(
getContext(), getViewLifecycleOwner(), getContext(), getViewLifecycleOwner(),
viewType, type, account, folder, thread, id, filter_archive, criteria, server); viewType, type, account, folder, thread, id, threading, filter_archive, criteria, server);
vmodel.setCallback(getViewLifecycleOwner(), callback); vmodel.setCallback(getViewLifecycleOwner(), callback);
vmodel.setObserver(getViewLifecycleOwner(), observer); vmodel.setObserver(getViewLifecycleOwner(), observer);

@ -81,10 +81,15 @@ public class ViewModelMessages extends ViewModel {
final Context context, final LifecycleOwner owner, final Context context, final LifecycleOwner owner,
final AdapterMessage.ViewType viewType, final AdapterMessage.ViewType viewType,
String type, long account, long folder, String type, long account, long folder,
String thread, long id, boolean filter_archive, String thread, long id,
boolean threading,
boolean filter_archive,
BoundaryCallbackMessages.SearchCriteria criteria, boolean server) { BoundaryCallbackMessages.SearchCriteria criteria, boolean server) {
Args args = new Args(context, viewType, type, account, folder, thread, id, filter_archive, criteria, server); Args args = new Args(context,
viewType, type, account, folder,
thread, id, threading,
filter_archive, criteria, server);
Log.d("Get model=" + viewType + " " + args); Log.d("Get model=" + viewType + " " + args);
dump(); dump();
@ -475,7 +480,8 @@ public class ViewModelMessages extends ViewModel {
Args(Context context, Args(Context context,
AdapterMessage.ViewType viewType, AdapterMessage.ViewType viewType,
String type, long account, long folder, String type, long account, long folder,
String thread, long id, boolean filter_archive, String thread, long id, boolean threading,
boolean filter_archive,
BoundaryCallbackMessages.SearchCriteria criteria, boolean server) { BoundaryCallbackMessages.SearchCriteria criteria, boolean server) {
this.type = type; this.type = type;
@ -483,12 +489,12 @@ public class ViewModelMessages extends ViewModel {
this.folder = folder; this.folder = folder;
this.thread = thread; this.thread = thread;
this.id = id; this.id = id;
this.threading = threading;
this.filter_archive = filter_archive; this.filter_archive = filter_archive;
this.criteria = criteria; this.criteria = criteria;
this.server = server; this.server = server;
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
this.threading = prefs.getBoolean("threading", true);
this.sort = prefs.getString("sort", "time"); this.sort = prefs.getString("sort", "time");
this.ascending = prefs.getBoolean( this.ascending = prefs.getBoolean(
viewType == AdapterMessage.ViewType.THREAD ? "ascending_thread" : "ascending_list", false); viewType == AdapterMessage.ViewType.THREAD ? "ascending_thread" : "ascending_list", false);

@ -141,6 +141,11 @@
android:title="@string/title_mark_all_read" android:title="@string/title_mark_all_read"
app:showAsAction="never" /> app:showAsAction="never" />
<item
android:id="@+id/menu_view_thread"
android:title="@string/title_view_thread"
app:showAsAction="never" />
<item <item
android:id="@+id/menu_sync_more" android:id="@+id/menu_sync_more"
android:title="@string/title_synchronize_more" android:title="@string/title_synchronize_more"

@ -1327,6 +1327,7 @@
<string name="title_select_all">Select all</string> <string name="title_select_all">Select all</string>
<string name="title_select_found">Select found</string> <string name="title_select_found">Select found</string>
<string name="title_mark_all_read">Mark all read</string> <string name="title_mark_all_read">Mark all read</string>
<string name="title_view_thread">View conversation</string>
<string name="title_force_sync">Force sync</string> <string name="title_force_sync">Force sync</string>
<string name="title_force_send">Force send</string> <string name="title_force_send">Force send</string>

Loading…
Cancel
Save