Crash fixes

This commit is contained in:
Grishka 2023-09-25 16:52:51 -03:00 committed by LucasGGamerM
parent 49f10bacb3
commit 22b1cd0d0b
1 changed files with 7 additions and 0 deletions

View File

@ -361,6 +361,7 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
pager.setUserInputEnabled(!GlobalUserPreferences.disableSwipe); pager.setUserInputEnabled(!GlobalUserPreferences.disableSwipe);
pager.setAdapter(new ProfilePagerAdapter()); pager.setAdapter(new ProfilePagerAdapter());
pager.getLayoutParams().height=getResources().getDisplayMetrics().heightPixels; pager.getLayoutParams().height=getResources().getDisplayMetrics().heightPixels;
pager.setVisibility(View.GONE); // Prevents a strange NPE when search is opened on the search tab. Shown in onShown()
scrollView.setScrollableChildSupplier(this::getScrollableRecyclerView); scrollView.setScrollableChildSupplier(this::getScrollableRecyclerView);
scrollView.getViewTreeObserver().addOnGlobalLayoutListener(this::updateMetadataHeight); scrollView.getViewTreeObserver().addOnGlobalLayoutListener(this::updateMetadataHeight);
@ -1424,6 +1425,12 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
return actionButton.getVisibility()==View.VISIBLE && actionButtonWrap.getTop()+actionButtonWrap.getHeight()>scrollView.getScrollY(); return actionButton.getVisibility()==View.VISIBLE && actionButtonWrap.getTop()+actionButtonWrap.getHeight()>scrollView.getScrollY();
} }
@Override
protected void onShown(){
super.onShown();
pager.setVisibility(View.VISIBLE);
}
private class ProfilePagerAdapter extends RecyclerView.Adapter<SimpleViewHolder>{ private class ProfilePagerAdapter extends RecyclerView.Adapter<SimpleViewHolder>{
@NonNull @NonNull
@Override @Override