mirror of
https://github.com/TeamNewPipe/NewPipe.git
synced 2024-11-25 20:42:34 +01:00
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) {
|
public void onCreate(final Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setHasOptionsMenu(true);
|
setHasOptionsMenu(true);
|
||||||
|
|
||||||
|
if (savedInstanceState != null) {
|
||||||
|
lastTab = savedInstanceState.getInt("LastTab");
|
||||||
|
} else {
|
||||||
|
lastTab = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -125,6 +131,12 @@ public class ChannelFragment extends BaseStateFragment<ChannelInfo>
|
|||||||
binding.tabLayout.setupWithViewPager(binding.viewPager);
|
binding.tabLayout.setupWithViewPager(binding.viewPager);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSaveInstanceState(final @NonNull Bundle outState) {
|
||||||
|
super.onSaveInstanceState(outState);
|
||||||
|
outState.putInt("LastTab", binding.tabLayout.getSelectedTabPosition());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
|
Loading…
Reference in New Issue
Block a user