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 46af0b533a - Show all commits

View file

@ -91,6 +91,8 @@ public class ChannelFragment extends BaseFragment implements FetchChannelsListen
// if this is set, scroll to the specific comment on load
private String commentHash;
private float floatingWalletPositionY;
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
View root = inflater.inflate(R.layout.fragment_channel, container, false);
@ -122,6 +124,23 @@ public class ChannelFragment extends BaseFragment implements FetchChannelsListen
tabLayout = root.findViewById(R.id.channel_view_tabs);
tabPager.setSaveEnabled(false);
View floatingBalance = getActivity().findViewById(R.id.floating_balance_main_container);
floatingWalletPositionY = floatingBalance.getY();
tabPager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
@Override
public void onPageSelected(int position) {
super.onPageSelected(position);
if (position > 0) {
// Hide floating wallet for the About and the Comment tabs as they are mostly text
((MainActivity) getContext()).translateFloatingWallet(floatingWalletPositionY);
} else {
((MainActivity) getContext()).restoreWalletContainerPosition();
}
}
});
buttonEdit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
@ -380,6 +399,14 @@ public class ChannelFragment extends BaseFragment implements FetchChannelsListen
super.onPause();
}
public void onStop() {
Context context = getContext();
if (context instanceof MainActivity) {
((MainActivity) context ).restoreWalletContainerPosition();
}
super.onStop();
}
private void checkParams() {
boolean updateRequired = false;
Map<String, Object> params = getParams();