|
@ -464,13 +464,13 @@ public class FragmentMessages extends FragmentEx { |
|
|
bottom_navigation.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() { |
|
|
bottom_navigation.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() { |
|
|
@Override |
|
|
@Override |
|
|
public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) { |
|
|
public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) { |
|
|
String[] pn = (String[]) bottom_navigation.getTag(); |
|
|
|
|
|
String thread = (menuItem.getItemId() == R.id.action_prev ? pn[0] : pn[1]); |
|
|
|
|
|
|
|
|
ViewModelMessages.AccountThread[] pn = (ViewModelMessages.AccountThread[]) bottom_navigation.getTag(); |
|
|
|
|
|
ViewModelMessages.AccountThread target = (menuItem.getItemId() == R.id.action_prev ? pn[0] : pn[1]); |
|
|
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(getContext()); |
|
|
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(getContext()); |
|
|
lbm.sendBroadcast( |
|
|
lbm.sendBroadcast( |
|
|
new Intent(ActivityView.ACTION_VIEW_THREAD) |
|
|
new Intent(ActivityView.ACTION_VIEW_THREAD) |
|
|
.putExtra("account", account) |
|
|
|
|
|
.putExtra("thread", thread)); |
|
|
|
|
|
|
|
|
.putExtra("account", target.account) |
|
|
|
|
|
.putExtra("thread", target.thread)); |
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
@ -587,7 +587,7 @@ public class FragmentMessages extends FragmentEx { |
|
|
if (viewType == AdapterMessage.ViewType.THREAD) { |
|
|
if (viewType == AdapterMessage.ViewType.THREAD) { |
|
|
// Navigation |
|
|
// Navigation |
|
|
ViewModelMessages model = ViewModelProviders.of(getActivity()).get(ViewModelMessages.class); |
|
|
ViewModelMessages model = ViewModelProviders.of(getActivity()).get(ViewModelMessages.class); |
|
|
String[] pn = model.getPrevNext(thread); |
|
|
|
|
|
|
|
|
ViewModelMessages.AccountThread[] pn = model.getPrevNext(thread); |
|
|
bottom_navigation.setTag(pn); |
|
|
bottom_navigation.setTag(pn); |
|
|
bottom_navigation.getMenu().findItem(R.id.action_prev).setEnabled(pn[0] != null); |
|
|
bottom_navigation.getMenu().findItem(R.id.action_prev).setEnabled(pn[0] != null); |
|
|
bottom_navigation.getMenu().findItem(R.id.action_next).setEnabled(pn[1] != null); |
|
|
bottom_navigation.getMenu().findItem(R.id.action_next).setEnabled(pn[1] != null); |
|
|