Fix crash

Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
alperozturk 2023-11-30 12:55:32 +01:00 committed by Andy Scherzinger
parent 79aceb8990
commit 0b351d2e0e
2 changed files with 9 additions and 3 deletions

View file

@ -780,9 +780,11 @@ public abstract class FileActivity extends DrawerActivity
}
public void refreshList() {
final Fragment fileListFragment = getSupportFragmentManager().findFragmentByTag(FileDisplayActivity.TAG_LIST_OF_FILES);
if (fileListFragment != null) {
((OCFileListFragment) fileListFragment).onRefresh();
final Fragment fragment = getSupportFragmentManager().findFragmentByTag(FileDisplayActivity.TAG_LIST_OF_FILES);
if (fragment instanceof OCFileListFragment listFragment) {
listFragment.onRefresh();
} else if (fragment instanceof FileDetailFragment detailFragment) {
detailFragment.goBackToOCFileListFragment();
}
}

View file

@ -195,6 +195,10 @@ public class FileDetailFragment extends FileFragment implements OnClickListener,
return ((FileDetailTabAdapter) binding.pager.getAdapter()).getFileDetailActivitiesFragment();
}
public void goBackToOCFileListFragment() {
requireActivity().onBackPressed();
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);