diff options
Diffstat (limited to 'app')
4 files changed, 16 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"; diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 896a4a3d..46ba6923 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -611,6 +611,7 @@ <string name="settings_separate_post_and_comments_in_landscape_mode_title">Separate Post And Comments in Landscape Mode</string> <string name="settings_separate_post_and_comments_summary">Video autoplay will be disabled in the post detail page</string> <string name="settings_use_bottom_toolbar_in_media_viewer_title">Use Bottom Toolbar in Media Viewer</string> + <string name="settings_navigation_drawer_enable_hide_karma_title">Hide Account Karma</string> <string name="settings_secure_mode_title">Secure Mode</string> <string name="settings_secure_mode_summary">Screenshot and video recording are not allowed. No preview in recent app screen.</string> <string name="settings_credits_lock_screen_animation_title">Lock Screen Animation</string> diff --git a/app/src/main/res/xml/navigation_drawer_preferences.xml b/app/src/main/res/xml/navigation_drawer_preferences.xml index 85879aee..db57a2e2 100644 --- a/app/src/main/res/xml/navigation_drawer_preferences.xml +++ b/app/src/main/res/xml/navigation_drawer_preferences.xml @@ -51,4 +51,10 @@ app:key="hide_subscribed_subreddits_sections" app:title="@string/settings_hide_subscribed_subreddits_sections_title" /> + <ml.docilealligator.infinityforreddit.customviews.CustomFontSwitchPreference + app:defaultValue="false" + app:key="hide_account_karma" + app:title="@string/settings_navigation_drawer_enable_hide_karma_title" /> + + </PreferenceScreen>
\ No newline at end of file |