mirror of
				https://github.com/TeamNewPipe/NewPipe
				synced 2025-10-30 23:03:00 +00:00 
			
		
		
		
	PlayerHolder: move unbind right next to stopService
This commit is contained in:
		| @@ -162,6 +162,26 @@ public final class PlayerHolder { | ||||
|         context.stopService(new Intent(context, PlayerService.class)); | ||||
|     } | ||||
|  | ||||
|  | ||||
|     private void unbind(final Context context) { | ||||
|         if (DEBUG) { | ||||
|             Log.d(TAG, "unbind() called"); | ||||
|         } | ||||
|  | ||||
|         if (bound) { | ||||
|             context.unbindService(serviceConnection); | ||||
|             bound = false; | ||||
|             if (player != null) { | ||||
|                 player.removeFragmentListener(internalListener); | ||||
|             } | ||||
|             playerService = null; | ||||
|             player = null; | ||||
|             if (listener != null) { | ||||
|                 listener.onServiceDisconnected(); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     class PlayerServiceConnection implements ServiceConnection { | ||||
|  | ||||
|         private boolean playAfterConnect = false; | ||||
| @@ -195,25 +215,6 @@ public final class PlayerHolder { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private void unbind(final Context context) { | ||||
|         if (DEBUG) { | ||||
|             Log.d(TAG, "unbind() called"); | ||||
|         } | ||||
|  | ||||
|         if (bound) { | ||||
|             context.unbindService(serviceConnection); | ||||
|             bound = false; | ||||
|             if (player != null) { | ||||
|                 player.removeFragmentListener(internalListener); | ||||
|             } | ||||
|             playerService = null; | ||||
|             player = null; | ||||
|             if (listener != null) { | ||||
|                 listener.onServiceDisconnected(); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private final PlayerServiceEventListener internalListener = | ||||
|             new PlayerServiceEventListener() { | ||||
|                 @Override | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Profpatsch
					Profpatsch