Skip to content

Commit

Permalink
Highlight own username in comments
Browse files Browse the repository at this point in the history
  • Loading branch information
folkemat committed Jan 19, 2024
1 parent 4b2c2ed commit 31eeac7
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ public static boolean isRefreshRequired(final Context context, final String key)
R.string.pref_appearance_hide_headertoolbar_commentlist_key))
|| key.equals(context.getString(
R.string.pref_appearance_hide_headertoolbar_postlist_key))
|| key.equals(context.getString(
R.string.pref_appearance_highlight_own_username_key))
|| key.equals(context.getString(R.string.pref_images_thumbnail_size_key))
|| key.equals(context.getString(R.string.pref_images_inline_image_previews_key))
|| key.equals(context.getString(
Expand Down Expand Up @@ -576,6 +578,12 @@ public static boolean pref_appearance_hide_headertoolbar_commentlist() {
false);
}

public static boolean pref_appearance_highlight_own_username() {
return getBoolean(
R.string.pref_appearance_highlight_own_username_key,
true);
}

public enum AppearancePostSubtitleItem {
AUTHOR,
FLAIR,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,13 @@ public CharSequence getHeader(
} else if("admin".equals(rawComment.getDistinguished())) {
setBackgroundColour = true;
backgroundColour = Color.rgb(170, 0, 0);

} else if(rawComment.getAuthor().getDecoded().equalsIgnoreCase(
mCurrentCanonicalUserName)) {
if (PrefsUtility.pref_appearance_highlight_own_username()){
setBackgroundColour = true;
backgroundColour = Color.rgb(254, 187, 50);
}
}

if(setBackgroundColour) {
Expand Down
3 changes: 3 additions & 0 deletions src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1829,4 +1829,7 @@
<string name="pref_album_skip_to_first_key" translatable="false">pref_album_skip_to_first_key</string>
<string name="pref_album_skip_to_first_title">Automatically open first album image</string>

<!-- 2024-01-19 -->
<string name="pref_appearance_highlight_own_username_key" translatable="false">pref_appearance_highlight_own_username</string>
<string name="pref_appearance_highlight_own_username_title">Highlight your own username in comments</string>
</resources>
5 changes: 5 additions & 0 deletions src/main/res/xml/prefs_appearance.xml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,11 @@
android:key="@string/pref_appearance_hide_headertoolbar_commentlist_key"
android:defaultValue="false"/>

<CheckBoxPreference
android:title="@string/pref_appearance_highlight_own_username_title"
android:key="@string/pref_appearance_highlight_own_username_key"
android:defaultValue="true"/>

</PreferenceCategory>

<PreferenceCategory android:title="@string/pref_appearance_user_header">
Expand Down

0 comments on commit 31eeac7

Please sign in to comment.