Skip to content

Commit

Permalink
Remove connection/disconnection to LibrarySyncService from fragments …
Browse files Browse the repository at this point in the history
…that don't have sync items (#1001)

The creation and connection to the LibrarySyncService was being done by all descendants of AbstractInfoFragment, but this only needs to be done by fragments that have sync items. So, for instance the Addons info fragment was creating and connecting to the service even though it didn't have anything to do with it.

This only creates and connects to the service if the fragment signals that it can use it (has sync items).
  • Loading branch information
SyncedSynapse authored Jan 9, 2024
1 parent 62c08dd commit ada6a47
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/src/main/java/org/xbmc/kore/ui/AbstractInfoFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,9 @@ public void onCreateOptionsMenu(@NonNull Menu menu, MenuInflater inflater) {
@Override
public void onStart() {
super.onStart();
serviceConnection = SyncUtils.connectToLibrarySyncService(getActivity(), this);
if (getSyncType() != null) {
serviceConnection = SyncUtils.connectToLibrarySyncService(getActivity(), this);
}
// Force the exit view to invisible
binding.exitTransitionView.setVisibility(View.INVISIBLE);
}
Expand Down Expand Up @@ -234,7 +236,9 @@ public void onPause() {

@Override
public void onStop() {
SyncUtils.disconnectFromLibrarySyncService(requireContext(), serviceConnection);
if (getSyncType() != null) {
SyncUtils.disconnectFromLibrarySyncService(requireContext(), serviceConnection);
}
super.onStop();
}

Expand Down

0 comments on commit ada6a47

Please sign in to comment.