From 86f1c6eb7ab1342682770aca0af1ad622274d41c Mon Sep 17 00:00:00 2001 From: Ezerous Date: Sat, 21 Jan 2017 22:18:06 +0200 Subject: [PATCH] Fixed bug bookmarks from drawer not removed when logging out --- .../java/gr/thmmy/mthmmy/activities/BookmarkActivity.java | 8 ++++++-- .../gr/thmmy/mthmmy/activities/topic/TopicAdapter.java | 2 +- app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java | 3 ++- .../main/java/gr/thmmy/mthmmy/session/SessionManager.java | 1 - 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/BookmarkActivity.java b/app/src/main/java/gr/thmmy/mthmmy/activities/BookmarkActivity.java index 3b383267..5d854eef 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/BookmarkActivity.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/BookmarkActivity.java @@ -8,7 +8,6 @@ import android.support.v7.widget.Toolbar; import android.view.LayoutInflater; import android.view.View; import android.widget.LinearLayout; -import android.widget.ProgressBar; import android.widget.TextView; import gr.thmmy.mthmmy.R; @@ -16,7 +15,6 @@ import gr.thmmy.mthmmy.activities.board.BoardActivity; import gr.thmmy.mthmmy.activities.topic.TopicActivity; import gr.thmmy.mthmmy.base.BaseActivity; import gr.thmmy.mthmmy.model.Bookmark; -import me.zhanghai.android.materialprogressbar.MaterialProgressBar; import static gr.thmmy.mthmmy.activities.board.BoardActivity.BUNDLE_BOARD_TITLE; import static gr.thmmy.mthmmy.activities.board.BoardActivity.BUNDLE_BOARD_URL; @@ -135,4 +133,10 @@ public class BookmarkActivity extends BaseActivity { } } } + + @Override + protected void onResume() { + drawer.setSelection(BOOKMARKS_ID); + super.onResume(); + } } diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java index c4c57cb7..be2e3e53 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java @@ -39,9 +39,9 @@ import gr.thmmy.mthmmy.activities.board.BoardActivity; import gr.thmmy.mthmmy.activities.profile.ProfileActivity; import gr.thmmy.mthmmy.base.BaseActivity; import gr.thmmy.mthmmy.model.Post; +import gr.thmmy.mthmmy.model.ThmmyFile; import gr.thmmy.mthmmy.model.ThmmyPage; import gr.thmmy.mthmmy.utils.CircleTransform; -import gr.thmmy.mthmmy.model.ThmmyFile; import mthmmy.utils.Report; import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK; diff --git a/app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java b/app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java index 0f8825dc..44d5687b 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java +++ b/app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java @@ -328,7 +328,7 @@ public abstract class BaseActivity extends AppCompatActivity { }); if (sessionManager.isLoggedIn()) - drawerBuilder.addDrawerItems(homeItem, downloadsItem, bookmarksItem, loginLogoutItem, aboutItem); + drawerBuilder.addDrawerItems(homeItem, bookmarksItem, downloadsItem, loginLogoutItem, aboutItem); else drawerBuilder.addDrawerItems(homeItem, loginLogoutItem, aboutItem); @@ -349,6 +349,7 @@ public abstract class BaseActivity extends AppCompatActivity { if (!sessionManager.isLoggedIn()) //When logged out or if user is guest { drawer.removeItem(DOWNLOADS_ID); + drawer.removeItem(BOOKMARKS_ID); loginLogoutItem.withName(R.string.login).withIcon(loginIcon); //Swap logout with login profileDrawerItem.withName(sessionManager.getUsername()).withIcon(new IconicsDrawable(this) .icon(FontAwesome.Icon.faw_user) diff --git a/app/src/main/java/gr/thmmy/mthmmy/session/SessionManager.java b/app/src/main/java/gr/thmmy/mthmmy/session/SessionManager.java index a6bb4df5..d47e4969 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/session/SessionManager.java +++ b/app/src/main/java/gr/thmmy/mthmmy/session/SessionManager.java @@ -9,7 +9,6 @@ import com.franmontiel.persistentcookiejar.persistence.SharedPrefsCookiePersisto import org.jsoup.Jsoup; import org.jsoup.nodes.Document; -import org.jsoup.nodes.Element; import org.jsoup.select.Elements; import java.io.IOException;