diff options
author | Alex Ning <chineseperson5@gmail.com> | 2020-06-05 15:28:04 +0000 |
---|---|---|
committer | Alex Ning <chineseperson5@gmail.com> | 2020-06-05 15:28:04 +0000 |
commit | ff5691aecb0f53ab11ea5a74244d10da7582cf26 (patch) | |
tree | 7ad639737c9b48121ea2413238b9b155d7046aec | |
parent | e9ffe5a13c3aea89a80dc745c4bec4ab96ff8d9d (diff) | |
download | infinity-for-reddit-ff5691aecb0f53ab11ea5a74244d10da7582cf26.tar infinity-for-reddit-ff5691aecb0f53ab11ea5a74244d10da7582cf26.tar.gz infinity-for-reddit-ff5691aecb0f53ab11ea5a74244d10da7582cf26.tar.bz2 infinity-for-reddit-ff5691aecb0f53ab11ea5a74244d10da7582cf26.tar.lz infinity-for-reddit-ff5691aecb0f53ab11ea5a74244d10da7582cf26.tar.xz infinity-for-reddit-ff5691aecb0f53ab11ea5a74244d10da7582cf26.tar.zst infinity-for-reddit-ff5691aecb0f53ab11ea5a74244d10da7582cf26.zip |
Fix some issues related to showing sort type on toolbars.
Diffstat (limited to '')
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java | 26 | ||||
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java | 2 |
2 files changed, 21 insertions, 7 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java index f5232d7f..304c0bac 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java @@ -1375,15 +1375,29 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb void displaySortTypeInToolbar() { switch (viewPager.getCurrentItem()) { case 0: - if (tab1 != null) { - SortType sortType = tab1.getSortType(); - Utils.displaySortTypeInToolbar(sortType, toolbar); + if (mAccessToken != null) { + if (tab1 != null) { + SortType sortType = tab1.getSortType(); + Utils.displaySortTypeInToolbar(sortType, toolbar); + } + } else { + if (tab2 != null) { + SortType sortType = tab2.getSortType(); + Utils.displaySortTypeInToolbar(sortType, toolbar); + } } break; case 1: - if (tab2 != null) { - SortType sortType = tab2.getSortType(); - Utils.displaySortTypeInToolbar(sortType, toolbar); + if (mAccessToken != null) { + if (tab2 != null) { + SortType sortType = tab2.getSortType(); + Utils.displaySortTypeInToolbar(sortType, toolbar); + } + } else { + if (tab3 != null) { + SortType sortType = tab3.getSortType(); + Utils.displaySortTypeInToolbar(sortType, toolbar); + } } break; case 2: diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java index 348a14ed..247bd12e 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewPostDetailActivity.java @@ -345,7 +345,7 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS }; mSingleCommentId = getIntent().getStringExtra(EXTRA_SINGLE_COMMENT_ID); - sortType = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_POST_COMMENT, SortType.Type.BEST.value); + sortType = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_POST_COMMENT, SortType.Type.BEST.value.toUpperCase()); mToolbar.setTitle(new SortType(SortType.Type.valueOf(sortType)).getType().fullName); sortType = sortType.toLowerCase(); if (savedInstanceState == null) { |