diff options
author | Patrick Demers <patrickdemers6@gmail.com> | 2022-10-22 06:39:36 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-22 06:39:36 +0000 |
commit | 4cc6c2b21a38647315e8605905a82f743bb913fe (patch) | |
tree | ac3fd1156995af342933571834d0cf8e173ffd2d /app/src/main/java/ml/docilealligator | |
parent | 5e3eaafe268fc64e8c7d92187e6c2447addc410d (diff) | |
download | infinity-for-reddit-4cc6c2b21a38647315e8605905a82f743bb913fe.tar infinity-for-reddit-4cc6c2b21a38647315e8605905a82f743bb913fe.tar.gz infinity-for-reddit-4cc6c2b21a38647315e8605905a82f743bb913fe.tar.bz2 infinity-for-reddit-4cc6c2b21a38647315e8605905a82f743bb913fe.tar.lz infinity-for-reddit-4cc6c2b21a38647315e8605905a82f743bb913fe.tar.xz infinity-for-reddit-4cc6c2b21a38647315e8605905a82f743bb913fe.tar.zst infinity-for-reddit-4cc6c2b21a38647315e8605905a82f743bb913fe.zip |
Hide Karma (#1168)
* feature/ability to hide karma
* only hide karma in nav bar
* center account name vertically when not showing karma
Diffstat (limited to 'app/src/main/java/ml/docilealligator')
2 files changed, 9 insertions, 1 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/HeaderSectionRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/HeaderSectionRecyclerViewAdapter.java index 55989855..bc051f76 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/HeaderSectionRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/HeaderSectionRecyclerViewAdapter.java @@ -47,6 +47,7 @@ public class HeaderSectionRecyclerViewAdapter extends RecyclerView.Adapter<Recyc private boolean isLoggedIn; private boolean isInMainPage = true; private PageToggle pageToggle; + private boolean showKarma; public HeaderSectionRecyclerViewAdapter(BaseActivity baseActivity, CustomThemeWrapper customThemeWrapper, RequestManager glide, String accountName, @@ -64,6 +65,7 @@ public class HeaderSectionRecyclerViewAdapter extends RecyclerView.Adapter<Recyc requireAuthToAccountSection = securitySharedPreferences.getBoolean(SharedPreferencesUtils.REQUIRE_AUTHENTICATION_TO_GO_TO_ACCOUNT_SECTION_IN_NAVIGATION_DRAWER, false); showAvatarOnTheRightInTheNavigationDrawer = sharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_AVATAR_ON_THE_RIGHT, false); showAvatarOnTheRightInTheNavigationDrawer = navigationDrawerSharedPreferences.getBoolean(SharedPreferencesUtils.SHOW_AVATAR_ON_THE_RIGHT, false); + this.showKarma = !navigationDrawerSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_ACCOUNT_KARMA_NAV_BAR, false); } @NonNull @@ -84,7 +86,12 @@ public class HeaderSectionRecyclerViewAdapter extends RecyclerView.Adapter<Recyc } ((NavHeaderViewHolder) holder).profileImageView.setLayoutParams(params); if (isLoggedIn) { - ((NavHeaderViewHolder) holder).karmaTextView.setText(baseActivity.getString(R.string.karma_info, karma)); + if (showKarma) { + ((NavHeaderViewHolder) holder).karmaTextView.setText(baseActivity.getString(R.string.karma_info, karma)); + } else { + int karmaTextHeight = ((NavHeaderViewHolder) holder).karmaTextView.getHeight(); + ((NavHeaderViewHolder) holder).accountNameTextView.setTranslationY(karmaTextHeight / 2); + } ((NavHeaderViewHolder) holder).accountNameTextView.setText(accountName); if (profileImageUrl != null && !profileImageUrl.equals("")) { glide.load(profileImageUrl) diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java index 29f42e4b..cabf8de6 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java @@ -196,6 +196,7 @@ public class SharedPreferencesUtils { public static final String REMEMBER_MUTING_OPTION_IN_POST_FEED = "remember_muting_option_in_post_feed"; public static final String DEFAULT_LINK_POST_LAYOUT_KEY = "default_link_post_layout"; public static final String USE_BOTTOM_TOOLBAR_IN_MEDIA_VIEWER = "use_bottom_toolbar_in_media_viewer"; + public static final String HIDE_ACCOUNT_KARMA_NAV_BAR = "hide_account_karma"; public static final String LOCK_SCREEN_ANIMATION = "lock_screen_animation"; public static final String ENABLE_FOLD_SUPPORT = "enable_fold_support"; public static final String LOOP_VIDEO = "loop_video"; |