Restore display tab on changing theme

This commit is contained in:
M66B 2019-06-14 21:41:53 +02:00
parent ca23b0dd85
commit 2088d3a4ba
2 changed files with 6 additions and 0 deletions

View File

@ -61,6 +61,10 @@ public class FragmentOptions extends FragmentBase {
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
TabLayout tabLayout = view.findViewById(R.id.tab_layout);
tabLayout.setupWithViewPager(pager);
String tab = getActivity().getIntent().getStringExtra("tab");
if ("display".equals(tab))
pager.setCurrentItem(4);
}
private class PagerAdapter extends FragmentStatePagerAdapter {

View File

@ -280,6 +280,8 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
rgTheme.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
getActivity().getIntent().putExtra("tab", "display");
switch (checkedId) {
case R.id.rbThemeLight:
prefs.edit().putString("theme", "light").apply();