Fix order button
This commit is contained in:
parent
ab48686262
commit
d6257cf52e
@ -78,13 +78,16 @@ public class ChaptersFragment extends BaseRxFragment<ChaptersPresenter> implemen
|
|||||||
chapters.setAdapter(adapter);
|
chapters.setAdapter(adapter);
|
||||||
|
|
||||||
// Set initial values
|
// Set initial values
|
||||||
setReadFilter(getPresenter().getReadFilter());
|
setReadFilter();
|
||||||
setSortIcon(getPresenter().getSortOrder());
|
setSortIcon();
|
||||||
|
|
||||||
// Init listeners
|
// Init listeners
|
||||||
swipeRefresh.setOnRefreshListener(this::onFetchChapters);
|
swipeRefresh.setOnRefreshListener(this::onFetchChapters);
|
||||||
readCb.setOnCheckedChangeListener((arg, isChecked) -> getPresenter().setReadFilter(isChecked));
|
readCb.setOnCheckedChangeListener((arg, isChecked) -> getPresenter().setReadFilter(isChecked));
|
||||||
sortBtn.setOnClickListener(v -> getPresenter().revertSortOrder());
|
sortBtn.setOnClickListener(v -> {
|
||||||
|
getPresenter().revertSortOrder();
|
||||||
|
setSortIcon();
|
||||||
|
});
|
||||||
nextUnreadBtn.setOnClickListener(v -> {
|
nextUnreadBtn.setOnClickListener(v -> {
|
||||||
Chapter chapter = getPresenter().getNextUnreadChapter();
|
Chapter chapter = getPresenter().getNextUnreadChapter();
|
||||||
if (chapter != null) {
|
if (chapter != null) {
|
||||||
@ -279,13 +282,16 @@ public class ChaptersFragment extends BaseRxFragment<ChaptersPresenter> implemen
|
|||||||
actionMode.setTitle(getString(R.string.selected_chapters_title, count));
|
actionMode.setTitle(getString(R.string.selected_chapters_title, count));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSortIcon(boolean aToZ) {
|
public void setSortIcon() {
|
||||||
if (sortBtn != null) {
|
if (sortBtn != null) {
|
||||||
|
boolean aToZ = getPresenter().getSortOrder();
|
||||||
sortBtn.setImageResource(!aToZ ? R.drawable.ic_expand_less_white_36dp : R.drawable.ic_expand_more_white_36dp);
|
sortBtn.setImageResource(!aToZ ? R.drawable.ic_expand_less_white_36dp : R.drawable.ic_expand_more_white_36dp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setReadFilter(boolean onlyUnread) {
|
public void setReadFilter() {
|
||||||
if (readCb != null) readCb.setChecked(onlyUnread);
|
if (readCb != null) {
|
||||||
|
readCb.setChecked(getPresenter().getReadFilter());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user