From d6257cf52e2832228c040947b5cfb3c8a2b0af98 Mon Sep 17 00:00:00 2001 From: inorichi Date: Wed, 2 Dec 2015 12:27:18 +0100 Subject: [PATCH] Fix order button --- .../ui/manga/chapter/ChaptersFragment.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/eu/kanade/mangafeed/ui/manga/chapter/ChaptersFragment.java b/app/src/main/java/eu/kanade/mangafeed/ui/manga/chapter/ChaptersFragment.java index 794afd8b3..9cc887fd4 100644 --- a/app/src/main/java/eu/kanade/mangafeed/ui/manga/chapter/ChaptersFragment.java +++ b/app/src/main/java/eu/kanade/mangafeed/ui/manga/chapter/ChaptersFragment.java @@ -78,13 +78,16 @@ public class ChaptersFragment extends BaseRxFragment implemen chapters.setAdapter(adapter); // Set initial values - setReadFilter(getPresenter().getReadFilter()); - setSortIcon(getPresenter().getSortOrder()); + setReadFilter(); + setSortIcon(); // Init listeners swipeRefresh.setOnRefreshListener(this::onFetchChapters); readCb.setOnCheckedChangeListener((arg, isChecked) -> getPresenter().setReadFilter(isChecked)); - sortBtn.setOnClickListener(v -> getPresenter().revertSortOrder()); + sortBtn.setOnClickListener(v -> { + getPresenter().revertSortOrder(); + setSortIcon(); + }); nextUnreadBtn.setOnClickListener(v -> { Chapter chapter = getPresenter().getNextUnreadChapter(); if (chapter != null) { @@ -279,13 +282,16 @@ public class ChaptersFragment extends BaseRxFragment implemen actionMode.setTitle(getString(R.string.selected_chapters_title, count)); } - public void setSortIcon(boolean aToZ) { + public void setSortIcon() { if (sortBtn != null) { + boolean aToZ = getPresenter().getSortOrder(); sortBtn.setImageResource(!aToZ ? R.drawable.ic_expand_less_white_36dp : R.drawable.ic_expand_more_white_36dp); } } - public void setReadFilter(boolean onlyUnread) { - if (readCb != null) readCb.setChecked(onlyUnread); + public void setReadFilter() { + if (readCb != null) { + readCb.setChecked(getPresenter().getReadFilter()); + } } }