Skip to content

Commit 4dcbad8

Browse files
committed
Fixing timing issue with FileActivity's loading dialog show and dismiss.
Before dismissing the dialog, we need to wait for a potentially pending transaction. As showing the dialog also includes the dismissing of prior instances, we need to wait there as well. Both is needed to satisfy the test case added in the previous commit. Otherwise, the dialog might be shown after it was meant to be dismissed already. This issue was observed when testing RemoveFilesDialogFragment's removeFiles() and also sporadically "in the wild". Signed-off-by: Philipp Hasper <vcs@hasper.info>
1 parent 9c6eaa9 commit 4dcbad8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

app/src/main/java/com/owncloud/android/ui/activity/FileActivity.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,7 @@ protected void updateFileFromDB(){
563563
public void showLoadingDialog(String message) {
564564
runOnUiThread(() -> {
565565
FragmentManager fragmentManager = getSupportFragmentManager();
566+
fragmentManager.executePendingTransactions();
566567
Fragment existingDialog = fragmentManager.findFragmentByTag(DIALOG_WAIT_TAG);
567568

568569
if (existingDialog instanceof LoadingDialog loadingDialog) {
@@ -585,6 +586,7 @@ public void showLoadingDialog(String message) {
585586
public void dismissLoadingDialog() {
586587
runOnUiThread(() -> {
587588
FragmentManager fragmentManager = getSupportFragmentManager();
589+
fragmentManager.executePendingTransactions();
588590
Fragment fragment = fragmentManager.findFragmentByTag(DIALOG_WAIT_TAG);
589591

590592
if (fragment instanceof LoadingDialog loadingDialogFragment) {

0 commit comments

Comments
 (0)