Hide floating wallet on the Channel fragment #1177

Merged
kekkyojin merged 2 commits from lbry-android-1054 into master 2021-03-29 17:38:51 +02:00
Showing only changes of commit d361d685d7 - Show all commits

View file

@ -73,6 +73,7 @@ public class ChannelFragment extends BaseFragment implements FetchChannelsListen
private TextView textFollowerCount; private TextView textFollowerCount;
private TabLayout tabLayout; private TabLayout tabLayout;
private ViewPager2 tabPager; private ViewPager2 tabPager;
ViewPager2.OnPageChangeCallback opcc;
private View buttonEdit; private View buttonEdit;
private View buttonDelete; private View buttonDelete;
@ -127,7 +128,7 @@ public class ChannelFragment extends BaseFragment implements FetchChannelsListen
View floatingBalance = getActivity().findViewById(R.id.floating_balance_main_container); View floatingBalance = getActivity().findViewById(R.id.floating_balance_main_container);
floatingWalletPositionY = floatingBalance.getY(); floatingWalletPositionY = floatingBalance.getY();
tabPager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() { opcc = new ViewPager2.OnPageChangeCallback() {
@Override @Override
public void onPageSelected(int position) { public void onPageSelected(int position) {
super.onPageSelected(position); super.onPageSelected(position);
@ -139,7 +140,9 @@ public class ChannelFragment extends BaseFragment implements FetchChannelsListen
((MainActivity) getContext()).restoreWalletContainerPosition(); ((MainActivity) getContext()).restoreWalletContainerPosition();
} }
} }
}); };
tabPager.registerOnPageChangeCallback(opcc);
buttonEdit.setOnClickListener(new View.OnClickListener() { buttonEdit.setOnClickListener(new View.OnClickListener() {
@Override @Override
@ -404,6 +407,7 @@ public class ChannelFragment extends BaseFragment implements FetchChannelsListen
if (context instanceof MainActivity) { if (context instanceof MainActivity) {
((MainActivity) context ).restoreWalletContainerPosition(); ((MainActivity) context ).restoreWalletContainerPosition();
} }
tabPager.unregisterOnPageChangeCallback(opcc);
super.onStop(); super.onStop();
} }