@@ -543,35 +543,39 @@ protected void updateFileFromDB(){
543543 public void showLoadingDialog (String message ) {
544544 dismissLoadingDialog ();
545545
546- FragmentManager fragmentManager = getSupportFragmentManager ();
547- Fragment fragment = fragmentManager .findFragmentByTag (DIALOG_WAIT_TAG );
548- if (fragment == null ) {
549- Log_OC .d (TAG , "show loading dialog" );
550- LoadingDialog loadingDialogFragment = LoadingDialog .newInstance (message );
551- FragmentTransaction fragmentTransaction = fragmentManager .beginTransaction ();
552- boolean isDialogFragmentReady = ActivityExtensionsKt .isDialogFragmentReady (this , loadingDialogFragment );
553- if (isDialogFragmentReady ) {
554- fragmentTransaction .add (loadingDialogFragment , DIALOG_WAIT_TAG );
555- fragmentTransaction .commitNow ();
546+ runOnUiThread (() -> {
547+ FragmentManager fragmentManager = getSupportFragmentManager ();
548+ Fragment fragment = fragmentManager .findFragmentByTag (DIALOG_WAIT_TAG );
549+ if (fragment == null ) {
550+ Log_OC .d (TAG , "show loading dialog" );
551+ LoadingDialog loadingDialogFragment = LoadingDialog .newInstance (message );
552+ FragmentTransaction fragmentTransaction = fragmentManager .beginTransaction ();
553+ boolean isDialogFragmentReady = ActivityExtensionsKt .isDialogFragmentReady (this , loadingDialogFragment );
554+ if (isDialogFragmentReady ) {
555+ fragmentTransaction .add (loadingDialogFragment , DIALOG_WAIT_TAG );
556+ fragmentTransaction .commitNow ();
557+ }
556558 }
557- }
559+ });
558560 }
559561
560562 /**
561563 * Dismiss loading dialog
562564 */
563565 public void dismissLoadingDialog () {
564- FragmentManager fragmentManager = getSupportFragmentManager ();
565- Fragment fragment = fragmentManager .findFragmentByTag (DIALOG_WAIT_TAG );
566- if (fragment != null ) {
567- Log_OC .d (TAG , "dismiss loading dialog" );
568- LoadingDialog loadingDialogFragment = (LoadingDialog ) fragment ;
569- boolean isDialogFragmentReady = ActivityExtensionsKt .isDialogFragmentReady (this , loadingDialogFragment );
570- if (isDialogFragmentReady ) {
571- loadingDialogFragment .dismiss ();
572- fragmentManager .executePendingTransactions ();
566+ runOnUiThread (() -> {
567+ FragmentManager fragmentManager = getSupportFragmentManager ();
568+ Fragment fragment = fragmentManager .findFragmentByTag (DIALOG_WAIT_TAG );
569+ if (fragment != null ) {
570+ Log_OC .d (TAG , "dismiss loading dialog" );
571+ LoadingDialog loadingDialogFragment = (LoadingDialog ) fragment ;
572+ boolean isDialogFragmentReady = ActivityExtensionsKt .isDialogFragmentReady (this , loadingDialogFragment );
573+ if (isDialogFragmentReady ) {
574+ loadingDialogFragment .dismiss ();
575+ fragmentManager .executePendingTransactions ();
576+ }
573577 }
574- }
578+ });
575579 }
576580
577581 private void doOnResumeAndBound () {
0 commit comments