add an option to disable new badge on unread statuses

This commit is contained in:
Kasun 2019-04-22 14:42:42 +05:30
parent b0dcf967eb
commit e977ecac68
6 changed files with 35 additions and 1 deletions

View File

@ -777,7 +777,8 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
});
}
if (status.isNew())
boolean new_badge = sharedpreferences.getBoolean(Helper.SET_DISPLAY_NEW_BADGE, true);
if (status.isNew() && new_badge)
holder.new_element.setVisibility(View.VISIBLE);
else
holder.new_element.setVisibility(View.GONE);

View File

@ -674,6 +674,19 @@ public class SettingsFragment extends Fragment {
}
});
boolean new_badge = sharedpreferences.getBoolean(Helper.SET_DISPLAY_NEW_BADGE, true);
final CheckBox set_new_badge = rootView.findViewById(R.id.set_display_new_badge);
set_new_badge.setChecked(new_badge);
set_new_badge.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putBoolean(Helper.SET_DISPLAY_NEW_BADGE, set_new_badge.isChecked());
editor.apply();
}
});
boolean fit_preview = sharedpreferences.getBoolean(Helper.SET_FULL_PREVIEW, false);
final CheckBox set_fit_preview = rootView.findViewById(R.id.set_fit_preview);
set_fit_preview.setChecked(fit_preview);

View File

@ -364,6 +364,7 @@ public class Helper {
public static final String SET_EXPAND_CW = "set_expand_cw";
public static final String SET_EXPAND_MEDIA = "set_expand_media";
public static final String SET_DISPLAY_FOLLOW_INSTANCE = "set_display_follow_instance";
public static final String SET_DISPLAY_NEW_BADGE = "set_display_new_badge";
public static final String SET_EMBEDDED_BROWSER = "set_embedded_browser";
public static final String SET_CUSTOM_TABS = "set_custom_tabs";
public static final String SET_JAVASCRIPT = "set_javascript";

View File

@ -247,6 +247,15 @@
android:text="@string/set_display_follow_instance"
android:layout_height="wrap_content" />
<!-- DISPLAY NEW BADGE -->
<CheckBox
android:id="@+id/set_display_new_badge"
android:layout_width="wrap_content"
android:layout_marginTop="@dimen/settings_checkbox_margin"
android:layout_marginBottom="@dimen/settings_checkbox_margin"
android:text="@string/set_display_new_badge"
android:layout_height="wrap_content" />
<!-- DISPLAY BOOKMARK BUTTON -->
<CheckBox
android:id="@+id/set_display_bookmarks"

View File

@ -254,6 +254,15 @@
android:text="@string/set_display_follow_instance"
android:layout_height="wrap_content" />
<!-- DISPLAY NEW BADGE -->
<CheckBox
android:id="@+id/set_display_new_badge"
android:layout_width="wrap_content"
android:layout_marginTop="@dimen/settings_checkbox_margin"
android:layout_marginBottom="@dimen/settings_checkbox_margin"
android:text="@string/set_display_new_badge"
android:layout_height="wrap_content" />
<!-- DISPLAY BOOKMARK BUTTON -->
<CheckBox
android:id="@+id/set_display_bookmarks"

View File

@ -920,6 +920,7 @@
<string name="settings_category_notif_news">News</string>
<string name="settings_category_notif_time_slot">Time slot</string>
<string name="settings_category_notif_advanced">Advanced</string>
<string name="set_display_new_badge">Display \'new\' badge on unread toots</string>
<plurals name="number_of_vote">
<item quantity="one">%d vote</item>