@@ -131,7 +131,7 @@ private void initializeArguments() {
131131 setupSearchView ((SearchManager ) getSystemService (Context .SEARCH_SERVICE ), getComponentName ());
132132 }
133133
134- refreshSharesFromDB ();
134+ updateShareeListAdapter ();
135135 binding .loadingLayout .setVisibility (View .GONE );
136136 });
137137 } catch (Exception e ) {
@@ -422,7 +422,7 @@ public void requestPasswordForShare(OCShare share, boolean askForPassword) {
422422 public void showProfileBottomSheet (Account account , String shareWith ) {
423423 }
424424
425- public void refreshSharesFromDB () {
425+ public void updateShareeListAdapter () {
426426 executorService .submit (() -> {
427427 try {
428428 ShareeListAdapter adapter = (ShareeListAdapter ) binding .sharesList .getAdapter ();
@@ -459,7 +459,7 @@ public void refreshSharesFromDB() {
459459 setShareWithYou ();
460460 });
461461 } catch (Exception e ) {
462- Log_OC .d (TAG , "Exception while refreshSharesFromDB : " + e );
462+ Log_OC .d (TAG , "Exception while updateShareeListAdapter : " + e );
463463 }
464464 });
465465 }
@@ -652,14 +652,42 @@ public void onQuickPermissionChanged(OCShare share, int permission) {
652652 final var result = repository .updateSharePermission (share .getId (), permission );
653653 runOnUiThread (() -> {
654654 if (ApiResultKt .isSuccess (result )) {
655- NoteShareActivity . this . recreate ( );
655+ updateShare ( share );
656656 } else if (result instanceof ApiResult .Error error ) {
657657 DisplayUtils .showSnackMessage (NoteShareActivity .this , error .getMessage ());
658658 }
659659 });
660660 });
661661 }
662662
663+ private void updateShare (OCShare share ) {
664+ executorService .submit (() -> {
665+ try {
666+ final var updatedShares = repository .getShares (share .getId ());
667+
668+ runOnUiThread (() -> {
669+ if (updatedShares != null && binding .sharesList .getAdapter () instanceof ShareeListAdapter adapter ) {
670+ OCShare updatedShare = null ;
671+ for (int i =0 ;i <updatedShares .size ();i ++) {
672+ if (updatedShares .get (i ).getId () == share .getId ()) {
673+ updatedShare = updatedShares .get (i );
674+ break ;
675+ }
676+ }
677+
678+ if (updatedShare == null ) {
679+ return ;
680+ }
681+
682+ adapter .updateShare (updatedShare );
683+ }
684+ });
685+ } catch (Exception e ) {
686+ Log_OC .d (TAG , "Exception while refreshing share info: " + e );
687+ }
688+ });
689+ }
690+
663691 private final ActivityResultLauncher <String > requestContactPermissionLauncher =
664692 registerForActivityResult (new ActivityResultContracts .RequestPermission (), isGranted -> {
665693 if (isGranted ) {
0 commit comments