Fix some crashes
This commit is contained in:
parent
a3a3d9350e
commit
29995fc219
|
@ -1537,7 +1537,8 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
|
||||||
}
|
}
|
||||||
popup.setOnDismissListener(menu1 -> {
|
popup.setOnDismissListener(menu1 -> {
|
||||||
if (binding.viewPager.getAdapter() != null) {
|
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()) {
|
if (fragment instanceof FragmentMastodonTimeline && fragment.isVisible()) {
|
||||||
FragmentMastodonTimeline fragmentMastodonTimeline = ((FragmentMastodonTimeline) fragment);
|
FragmentMastodonTimeline fragmentMastodonTimeline = ((FragmentMastodonTimeline) fragment);
|
||||||
fragmentMastodonTimeline.refreshAllAdapters();
|
fragmentMastodonTimeline.refreshAllAdapters();
|
||||||
|
@ -1634,7 +1635,8 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
|
||||||
|
|
||||||
public void refreshFragment() {
|
public void refreshFragment() {
|
||||||
if (binding.viewPager.getAdapter() != null) {
|
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) {
|
if (fragment instanceof FragmentNotificationContainer) {
|
||||||
FragmentTransaction fragTransaction = getSupportFragmentManager().beginTransaction();
|
FragmentTransaction fragTransaction = getSupportFragmentManager().beginTransaction();
|
||||||
fragTransaction.detach(fragment).commit();
|
fragTransaction.detach(fragment).commit();
|
||||||
|
|
|
@ -105,13 +105,9 @@ public class FragmentMedia extends Fragment {
|
||||||
enableSliding(true);
|
enableSliding(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
binding.mediaPicture.setOnClickListener(v -> {
|
binding.mediaPicture.setOnClickListener(v -> ((MediaActivity) requireActivity()).toogleFullScreen());
|
||||||
((MediaActivity) requireActivity()).toogleFullScreen();
|
|
||||||
});
|
|
||||||
|
|
||||||
binding.mediaVideo.setOnClickListener(v -> {
|
binding.mediaVideo.setOnClickListener(v -> ((MediaActivity) requireActivity()).toogleFullScreen());
|
||||||
((MediaActivity) requireActivity()).toogleFullScreen();
|
|
||||||
});
|
|
||||||
|
|
||||||
String type = attachment.type;
|
String type = attachment.type;
|
||||||
String preview_url = attachment.preview_url;
|
String preview_url = attachment.preview_url;
|
||||||
|
|
Loading…
Reference in New Issue