Hide floating wallet on the Channel fragment #1177
1 changed files with 27 additions and 0 deletions
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue