|
|
@@ -47,11 +47,24 @@ public class BookMarkListPresenter extends Presenter<BookMarkListModel, IBookMar
|
|
|
protected void startInternal() {
|
|
|
// contents 화면에서 좋아요/북마크 변경했다면 view 업데이트
|
|
|
if (model.hasFlagChanged()) {
|
|
|
- updateCategorizedContentsAndCategory();
|
|
|
+ updateContents();
|
|
|
model.clearFlagChanged();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void updateContents() {
|
|
|
+
|
|
|
+ if (model.getSort() == Event.BOOKMARK_CATEGORY) {
|
|
|
+ // 카테고리 별
|
|
|
+ updateCategorizedContentsAndCategory();
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ // 최신 순
|
|
|
+ view.updateContents(model.getBookmarkList());
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
private void updateCategorizedContentsAndCategory() {
|
|
|
view.updateContents(model.getCategorizedBookmarkList());
|
|
|
view.updateCategory(model.getCategoryIndies());
|
|
|
@@ -113,16 +126,9 @@ public class BookMarkListPresenter extends Presenter<BookMarkListModel, IBookMar
|
|
|
break;
|
|
|
case Event.SORT:
|
|
|
Log.i("APP# BookMarkListPresenter | onEventInternal", "|===================> " + event);
|
|
|
- if (event.getInteger() == Event.BOOKMARK_CATEGORY) {
|
|
|
- // 카테고리 별
|
|
|
- view.setSort(Event.BOOKMARK_CATEGORY);
|
|
|
- updateCategorizedContentsAndCategory();
|
|
|
- }
|
|
|
- else {
|
|
|
- // 최근 순
|
|
|
- view.setSort(Event.BOOKMARK_LATEST);
|
|
|
- view.updateContents(model.getBookmarkList());
|
|
|
- }
|
|
|
+ model.setSort(event.getInteger());
|
|
|
+ view.setSort(model.getSort());
|
|
|
+ updateContents();
|
|
|
break;
|
|
|
case Event.CATEGORY_CLICK:
|
|
|
// 카테고리별 -> 카테고리 클릭
|
|
|
@@ -140,7 +146,6 @@ public class BookMarkListPresenter extends Presenter<BookMarkListModel, IBookMar
|
|
|
private void setCategoryFocus(int index) {
|
|
|
model.setCategoryIndex(index);
|
|
|
view.setCategoryFocus(model.getCategoryIndex());
|
|
|
-
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -154,7 +159,7 @@ public class BookMarkListPresenter extends Presenter<BookMarkListModel, IBookMar
|
|
|
}
|
|
|
else if (integer == Event.CONTENTS_LIKE) {
|
|
|
// 북마크의 좋아요(체크박스)
|
|
|
- // view.setBookmarkContentsLiked(event.getIndex(), event.getBool());
|
|
|
+ // view.setBookmarkContentsLiked(event.getIndex(), event.getBool());
|
|
|
}
|
|
|
else {
|
|
|
doubleChecker.checkSecond();
|
|
|
@@ -177,15 +182,19 @@ public class BookMarkListPresenter extends Presenter<BookMarkListModel, IBookMar
|
|
|
}
|
|
|
|
|
|
private void drawBookmarkContents() {
|
|
|
- // 최신 순
|
|
|
- view.setSort(Event.BOOKMARK_LATEST);
|
|
|
- view.drawContents(model.getBookmarkList());
|
|
|
-
|
|
|
- // 카테고리 별
|
|
|
-// view.setSort(Event.BOOKMARK_CATEGORY);
|
|
|
-// view.drawContents(model.getCategorizedBookmarkList());
|
|
|
-// view.updateCategory(model.getCategoryIndies());
|
|
|
-// setCategoryFocus(0);
|
|
|
+ if (model.getSort() == Event.BOOKMARK_CATEGORY) {
|
|
|
+ // 카테고리 별
|
|
|
+ view.setSort(Event.BOOKMARK_CATEGORY);
|
|
|
+ view.drawContents(model.getCategorizedBookmarkList());
|
|
|
+ view.updateCategory(model.getCategoryIndies());
|
|
|
+ setCategoryFocus(0);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ // 최신 순
|
|
|
+ view.setSort(Event.BOOKMARK_LATEST);
|
|
|
+ view.drawContents(model.getBookmarkList());
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@Override
|