fix: ChannelFragment: save last tab
This commit is contained in:
parent
2c03ba204e
commit
4357a34339
|
@ -100,6 +100,12 @@ public class ChannelFragment extends BaseStateFragment<ChannelInfo>
|
|||
public void onCreate(final Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setHasOptionsMenu(true);
|
||||
|
||||
if (savedInstanceState != null) {
|
||||
lastTab = savedInstanceState.getInt("LastTab");
|
||||
} else {
|
||||
lastTab = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -125,6 +131,12 @@ public class ChannelFragment extends BaseStateFragment<ChannelInfo>
|
|||
binding.tabLayout.setupWithViewPager(binding.viewPager);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(final @NonNull Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putInt("LastTab", binding.tabLayout.getSelectedTabPosition());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
|
Loading…
Reference in New Issue