Browse Source

Fixed bug bookmarks from drawer not removed when logging out

pull/24/head
Ezerous 8 years ago
parent
commit
86f1c6eb7a
  1. 8
      app/src/main/java/gr/thmmy/mthmmy/activities/BookmarkActivity.java
  2. 2
      app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java
  3. 3
      app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java
  4. 1
      app/src/main/java/gr/thmmy/mthmmy/session/SessionManager.java

8
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.LayoutInflater;
import android.view.View; import android.view.View;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
import gr.thmmy.mthmmy.R; 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.activities.topic.TopicActivity;
import gr.thmmy.mthmmy.base.BaseActivity; import gr.thmmy.mthmmy.base.BaseActivity;
import gr.thmmy.mthmmy.model.Bookmark; 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_TITLE;
import static gr.thmmy.mthmmy.activities.board.BoardActivity.BUNDLE_BOARD_URL; 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();
}
} }

2
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.activities.profile.ProfileActivity;
import gr.thmmy.mthmmy.base.BaseActivity; import gr.thmmy.mthmmy.base.BaseActivity;
import gr.thmmy.mthmmy.model.Post; import gr.thmmy.mthmmy.model.Post;
import gr.thmmy.mthmmy.model.ThmmyFile;
import gr.thmmy.mthmmy.model.ThmmyPage; import gr.thmmy.mthmmy.model.ThmmyPage;
import gr.thmmy.mthmmy.utils.CircleTransform; import gr.thmmy.mthmmy.utils.CircleTransform;
import gr.thmmy.mthmmy.model.ThmmyFile;
import mthmmy.utils.Report; import mthmmy.utils.Report;
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK; import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;

3
app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java

@ -328,7 +328,7 @@ public abstract class BaseActivity extends AppCompatActivity {
}); });
if (sessionManager.isLoggedIn()) if (sessionManager.isLoggedIn())
drawerBuilder.addDrawerItems(homeItem, downloadsItem, bookmarksItem, loginLogoutItem, aboutItem); drawerBuilder.addDrawerItems(homeItem, bookmarksItem, downloadsItem, loginLogoutItem, aboutItem);
else else
drawerBuilder.addDrawerItems(homeItem, loginLogoutItem, aboutItem); 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 if (!sessionManager.isLoggedIn()) //When logged out or if user is guest
{ {
drawer.removeItem(DOWNLOADS_ID); drawer.removeItem(DOWNLOADS_ID);
drawer.removeItem(BOOKMARKS_ID);
loginLogoutItem.withName(R.string.login).withIcon(loginIcon); //Swap logout with login loginLogoutItem.withName(R.string.login).withIcon(loginIcon); //Swap logout with login
profileDrawerItem.withName(sessionManager.getUsername()).withIcon(new IconicsDrawable(this) profileDrawerItem.withName(sessionManager.getUsername()).withIcon(new IconicsDrawable(this)
.icon(FontAwesome.Icon.faw_user) .icon(FontAwesome.Icon.faw_user)

1
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.Jsoup;
import org.jsoup.nodes.Document; import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements; import org.jsoup.select.Elements;
import java.io.IOException; import java.io.IOException;

Loading…
Cancel
Save