Update prev/next icon

pull/216/head
M66B 3 months ago
parent 122d1d3382
commit 6c496c20cb

@ -1440,14 +1440,6 @@ public class FragmentMessages extends FragmentBase
} }
}); });
if (prefs.getBoolean("updown", true)) {
boolean reversed = prefs.getBoolean("reversed", false);
bottom_navigation.getMenu().findItem(R.id.action_prev)
.setIcon(reversed ? R.drawable.twotone_north_24 : R.drawable.twotone_south_24);
bottom_navigation.getMenu().findItem(R.id.action_next)
.setIcon(reversed ? R.drawable.twotone_south_24 : R.drawable.twotone_north_24);
}
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) {
@ -2030,6 +2022,7 @@ public class FragmentMessages extends FragmentBase
ibSnoozed.setVisibility(View.GONE); ibSnoozed.setVisibility(View.GONE);
bottom_navigation.getMenu().findItem(R.id.action_prev).setEnabled(false); bottom_navigation.getMenu().findItem(R.id.action_prev).setEnabled(false);
bottom_navigation.getMenu().findItem(R.id.action_next).setEnabled(false); bottom_navigation.getMenu().findItem(R.id.action_next).setEnabled(false);
updateNavPrevNext();
bottom_navigation.setVisibility(actionbar && viewType == AdapterMessage.ViewType.THREAD ? View.INVISIBLE : View.GONE); bottom_navigation.setVisibility(actionbar && viewType == AdapterMessage.ViewType.THREAD ? View.INVISIBLE : View.GONE);
grpReady.setVisibility(View.GONE); grpReady.setVisibility(View.GONE);
pbWait.setVisibility(View.VISIBLE); pbWait.setVisibility(View.VISIBLE);
@ -2084,6 +2077,7 @@ public class FragmentMessages extends FragmentBase
prev = id; prev = id;
bottom_navigation.getMenu().findItem(R.id.action_prev).setEnabled(prev != null); bottom_navigation.getMenu().findItem(R.id.action_prev).setEnabled(prev != null);
bottom_navigation.getMenu().findItem(R.id.action_next).setEnabled(next != null); bottom_navigation.getMenu().findItem(R.id.action_next).setEnabled(next != null);
updateNavPrevNext();
} }
@Override @Override
@ -2095,6 +2089,7 @@ public class FragmentMessages extends FragmentBase
next = id; next = id;
bottom_navigation.getMenu().findItem(R.id.action_prev).setEnabled(prev != null); bottom_navigation.getMenu().findItem(R.id.action_prev).setEnabled(prev != null);
bottom_navigation.getMenu().findItem(R.id.action_next).setEnabled(next != null); bottom_navigation.getMenu().findItem(R.id.action_next).setEnabled(next != null);
updateNavPrevNext();
} }
@Override @Override
@ -7967,6 +7962,29 @@ public class FragmentMessages extends FragmentBase
return false; return false;
} }
private void updateNavPrevNext() {
MenuItem prev = bottom_navigation.getMenu().findItem(R.id.action_prev);
MenuItem next = bottom_navigation.getMenu().findItem(R.id.action_next);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
if (prefs.getBoolean("updown", true)) {
boolean reversed = prefs.getBoolean("reversed", false);
prev.setIcon(prev.isEnabled()
? (reversed ? R.drawable.twotone_north_24 : R.drawable.twotone_south_24)
: R.drawable.twotone_horizontal_rule_24);
next.setIcon(next.isEnabled()
? (reversed ? R.drawable.twotone_south_24 : R.drawable.twotone_north_24)
: R.drawable.twotone_horizontal_rule_24);
} else {
prev.setIcon(prev.isEnabled()
? R.drawable.twotone_play_arrow_back_24
: R.drawable.twotone_horizontal_rule_24);
next.setIcon(next.isEnabled()
? R.drawable.twotone_play_arrow_24
: R.drawable.twotone_horizontal_rule_24);
}
}
private void updateCompose() { private void updateCompose() {
if (!getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED)) if (!getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
return; return;

Loading…
Cancel
Save