Allow to disable counters in settings
This commit is contained in:
parent
116f5a01a1
commit
5957daf956
|
@ -1103,6 +1103,10 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
|
|||
public void onUpdateConversation(int count) {
|
||||
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(BaseMainActivity.this);
|
||||
boolean singleBar = sharedpreferences.getBoolean(getString(R.string.SET_USE_SINGLE_TOPBAR), false);
|
||||
boolean displayCounters = sharedpreferences.getBoolean(getString(R.string.SET_DISPLAY_COUNTERS), true);
|
||||
if (!displayCounters) {
|
||||
return;
|
||||
}
|
||||
if (!singleBar) {
|
||||
if (count > 0) {
|
||||
binding.bottomNavView.getOrCreateBadge(R.id.nav_privates).setNumber(count);
|
||||
|
@ -1119,6 +1123,10 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
|
|||
public void onUpdateNotification(int count) {
|
||||
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(BaseMainActivity.this);
|
||||
boolean singleBar = sharedpreferences.getBoolean(getString(R.string.SET_USE_SINGLE_TOPBAR), false);
|
||||
boolean displayCounters = sharedpreferences.getBoolean(getString(R.string.SET_DISPLAY_COUNTERS), true);
|
||||
if (!displayCounters) {
|
||||
return;
|
||||
}
|
||||
if (!singleBar) {
|
||||
if (count > 0) {
|
||||
binding.bottomNavView.getOrCreateBadge(R.id.nav_notifications).setNumber(count);
|
||||
|
@ -1178,6 +1186,10 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
|
|||
@Override
|
||||
public void onUpdate(int count, Timeline.TimeLineEnum type, String slug) {
|
||||
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(BaseMainActivity.this);
|
||||
boolean displayCounters = sharedpreferences.getBoolean(getString(R.string.SET_DISPLAY_COUNTERS), true);
|
||||
if (!displayCounters) {
|
||||
return;
|
||||
}
|
||||
boolean singleBar = sharedpreferences.getBoolean(getString(R.string.SET_USE_SINGLE_TOPBAR), false);
|
||||
if (!singleBar) {
|
||||
switch (type) {
|
||||
|
|
|
@ -888,6 +888,7 @@
|
|||
<string name="SET_LONG_PRESS_STORE_MEDIA" translatable="false">SET_LONG_PRESS_STORE_MEDIA</string>
|
||||
<string name="SET_UNFOLLOW_VALIDATION" translatable="false">SET_UNFOLLOW_VALIDATION</string>
|
||||
<string name="SET_USE_SINGLE_TOPBAR" translatable="false">SET_USE_SINGLE_TOPBAR</string>
|
||||
<string name="SET_DISPLAY_COUNTERS" translatable="false">SET_DISPLAY_COUNTERS</string>
|
||||
<string name="SET_TIMELINES_IN_A_LIST" translatable="false">SET_TIMELINES_IN_A_LIST</string>
|
||||
<string name="SET_DISPLAY_ADMIN_STATUSES" translatable="false">SET_DISPLAY_ADMIN_STATUSES</string>
|
||||
<string name="SET_LED_COLOUR_VAL" translatable="false">SET_LED_COLOUR_VAL</string>
|
||||
|
@ -1475,4 +1476,6 @@
|
|||
<string name="reply">Reply</string>
|
||||
<string name="display_options">Display options</string>
|
||||
<string name="fetch_notifications">Fetch notifications</string>
|
||||
<string name="set_display_counters">Display counters</string>
|
||||
<string name="set_display_counters_description">Will display a bubble counter in tab timelines for new messages</string>
|
||||
</resources>
|
||||
|
|
|
@ -28,6 +28,13 @@
|
|||
app:summary="@string/set_unfollow_validation"
|
||||
app:title="@string/set_unfollow_validation_title" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
app:defaultValue="true"
|
||||
app:iconSpaceReserved="false"
|
||||
app:key="@string/SET_DISPLAY_COUNTERS"
|
||||
app:singleLineTitle="false"
|
||||
app:summary="@string/set_display_counters_description"
|
||||
app:title="@string/set_display_counters" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
app:defaultValue="true"
|
||||
|
|
Loading…
Reference in New Issue