Fixes layout issue with themes, added pdf night mode switch in settings

This commit is contained in:
M M Arif
2020-03-06 18:46:22 +05:00
parent 14addf5ed0
commit 61f953d70d
17 changed files with 155 additions and 23 deletions

View File

@@ -69,6 +69,7 @@ public class SettingsFragment extends Fragment {
LinearLayout themeFrame = v.findViewById(R.id.themeSelectionFrame);
Switch issuesSwitch = v.findViewById(R.id.switchIssuesBadge);
Switch pdfModeSwitch = v.findViewById(R.id.switchPdfMode);
TextView helpTranslate = v.findViewById(R.id.helpTranslate);
helpTranslate.setOnClickListener(new View.OnClickListener() {
@@ -132,6 +133,16 @@ public class SettingsFragment extends Fragment {
if(tinyDb.getBoolean("enableCounterIssueBadge")) {
issuesSwitch.setChecked(true);
}
else {
issuesSwitch.setChecked(false);
}
if(tinyDb.getBoolean("enablePdfMode")) {
pdfModeSwitch.setChecked(true);
}
else {
pdfModeSwitch.setChecked(false);
}
// issues badge switcher
issuesSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@@ -148,6 +159,21 @@ public class SettingsFragment extends Fragment {
}
});
// pdf night mode switcher
pdfModeSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
tinyDb.putBoolean("enablePdfMode", true);
tinyDb.putString("enablePdfModeInit", "yes");
Toasty.info(getContext(), getResources().getString(R.string.settingsSave));
} else {
tinyDb.putBoolean("enablePdfMode", false);
tinyDb.putString("enablePdfModeInit", "yes");
Toasty.info(getContext(), getResources().getString(R.string.settingsSave));
}
}
});
// theme selection dialog
themeFrame.setOnClickListener(new View.OnClickListener() {
@Override