mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2024-12-22 16:50:04 +02:00
Fix some crashes
This commit is contained in:
parent
a3a3d9350e
commit
29995fc219
2 changed files with 6 additions and 8 deletions
|
@ -1537,7 +1537,8 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
|
|||
}
|
||||
popup.setOnDismissListener(menu1 -> {
|
||||
if (binding.viewPager.getAdapter() != null) {
|
||||
Fragment fragment = (Fragment) binding.viewPager.getAdapter().instantiateItem(binding.viewPager, binding.tabLayout.getSelectedTabPosition());
|
||||
int tabPosition = binding.tabLayout.getSelectedTabPosition();
|
||||
Fragment fragment = (Fragment) binding.viewPager.getAdapter().instantiateItem(binding.viewPager, Math.max(tabPosition, 0));
|
||||
if (fragment instanceof FragmentMastodonTimeline && fragment.isVisible()) {
|
||||
FragmentMastodonTimeline fragmentMastodonTimeline = ((FragmentMastodonTimeline) fragment);
|
||||
fragmentMastodonTimeline.refreshAllAdapters();
|
||||
|
@ -1634,7 +1635,8 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
|
|||
|
||||
public void refreshFragment() {
|
||||
if (binding.viewPager.getAdapter() != null) {
|
||||
Fragment fragment = (Fragment) binding.viewPager.getAdapter().instantiateItem(binding.viewPager, binding.tabLayout.getSelectedTabPosition());
|
||||
int position = binding.tabLayout.getSelectedTabPosition();
|
||||
Fragment fragment = (Fragment) binding.viewPager.getAdapter().instantiateItem(binding.viewPager, Math.max(position, 0));
|
||||
if (fragment instanceof FragmentNotificationContainer) {
|
||||
FragmentTransaction fragTransaction = getSupportFragmentManager().beginTransaction();
|
||||
fragTransaction.detach(fragment).commit();
|
||||
|
|
|
@ -105,13 +105,9 @@ public class FragmentMedia extends Fragment {
|
|||
enableSliding(true);
|
||||
}
|
||||
});
|
||||
binding.mediaPicture.setOnClickListener(v -> {
|
||||
((MediaActivity) requireActivity()).toogleFullScreen();
|
||||
});
|
||||
binding.mediaPicture.setOnClickListener(v -> ((MediaActivity) requireActivity()).toogleFullScreen());
|
||||
|
||||
binding.mediaVideo.setOnClickListener(v -> {
|
||||
((MediaActivity) requireActivity()).toogleFullScreen();
|
||||
});
|
||||
binding.mediaVideo.setOnClickListener(v -> ((MediaActivity) requireActivity()).toogleFullScreen());
|
||||
|
||||
String type = attachment.type;
|
||||
String preview_url = attachment.preview_url;
|
||||
|
|
Loading…
Reference in a new issue