@@ -543,35 +543,39 @@ protected void updateFileFromDB(){
543
543
public void showLoadingDialog (String message ) {
544
544
dismissLoadingDialog ();
545
545
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
+ }
556
558
}
557
- }
559
+ });
558
560
}
559
561
560
562
/**
561
563
* Dismiss loading dialog
562
564
*/
563
565
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
+ }
573
577
}
574
- }
578
+ });
575
579
}
576
580
577
581
private void doOnResumeAndBound () {
0 commit comments