Enabling counter badges by default. (#378)

Merge remote-tracking branch 'remotes/main/master' into counter-badges

# Conflicts:
#	app/src/main/java/org/mian/gitnex/fragments/SettingsFragment.java

Moving to BaseActivity

Enabling counter badges by default.

Co-authored-by: opyale <example@example.com>
Reviewed-on: https://gitea.com/gitnex/GitNex/pulls/378
Reviewed-by: M M Arif <mmarif@swatian.com>
This commit is contained in:
opyale 2020-04-07 20:45:40 +00:00 committed by M M Arif
parent 73950f9f2a
commit e07ee1aceb
2 changed files with 17 additions and 13 deletions

View File

@ -60,6 +60,12 @@ public abstract class BaseActivity extends AppCompatActivity {
}
// enabling counter badges by default
if(tinyDb.getString("enableCounterBadgesInit").isEmpty()) {
tinyDb.putBoolean("enableCounterBadges", true);
tinyDb.putString("enableCounterBadgesInit", "yes");
}
}
protected abstract int getLayoutResourceId();

View File

@ -99,9 +99,9 @@ public class SettingsFragment extends Fragment {
homeScreenSelected.setText(tinyDb.getString("homeScreenStr"));
}
if(!tinyDb.getString("customFontStr").isEmpty()) {
customFontSelected.setText(tinyDb.getString("customFontStr"));
}
if(!tinyDb.getString("customFontStr").isEmpty()) {
customFontSelected.setText(tinyDb.getString("customFontStr"));
}
if(!tinyDb.getString("themeStr").isEmpty()) {
themeSelected.setText(tinyDb.getString("themeStr"));
@ -167,16 +167,14 @@ public class SettingsFragment extends Fragment {
// counter badge switcher
counterBadgesSwitch.setOnCheckedChangeListener((buttonView, isChecked) -> {
if(isChecked) {
tinyDb.putBoolean("enableCounterBadges", true);
tinyDb.putString("enableCounterBadgesInit", "yes");
Toasty.info(getContext(), getResources().getString(R.string.settingsSave));
}
else {
tinyDb.putBoolean("enableCounterBadges", false);
tinyDb.putString("enableCounterBadgesInit", "yes");
Toasty.info(getContext(), getResources().getString(R.string.settingsSave));
}
if (isChecked) {
tinyDb.putBoolean("enableCounterBadges", true);
Toasty.info(getContext(), getResources().getString(R.string.settingsSave));
}
else {
tinyDb.putBoolean("enableCounterBadges", false);
Toasty.info(getContext(), getResources().getString(R.string.settingsSave));
}
});