Skip to content

Commit 9b22773

Browse files
ProfpatschStypox
authored andcommitted
PlayerHolder: convert to kotlin (mechanical)
1 parent 86063fd commit 9b22773

8 files changed

Lines changed: 395 additions & 396 deletions

File tree

app/src/main/java/org/schabi/newpipe/MainActivity.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,7 @@ private void openMiniPlayerUponPlayerStarted() {
849849
return;
850850
}
851851

852-
if (PlayerHolder.getInstance().isPlayerOpen()) {
852+
if (PlayerHolder.Companion.getInstance().isPlayerOpen()) {
853853
// if the player is already open, no need for a broadcast receiver
854854
openMiniPlayerIfMissing();
855855
} else {
@@ -859,7 +859,7 @@ private void openMiniPlayerUponPlayerStarted() {
859859
public void onReceive(final Context context, final Intent intent) {
860860
if (Objects.equals(intent.getAction(),
861861
VideoDetailFragment.ACTION_PLAYER_STARTED)
862-
&& PlayerHolder.getInstance().isPlayerOpen()) {
862+
&& PlayerHolder.Companion.getInstance().isPlayerOpen()) {
863863
openMiniPlayerIfMissing();
864864
// At this point the player is added 100%, we can unregister. Other actions
865865
// are useless since the fragment will not be removed after that.
@@ -874,7 +874,7 @@ public void onReceive(final Context context, final Intent intent) {
874874

875875
// If the PlayerHolder is not bound yet, but the service is running, try to bind to it.
876876
// Once the connection is established, the ACTION_PLAYER_STARTED will be sent.
877-
PlayerHolder.getInstance().tryBindIfNeeded(this);
877+
PlayerHolder.Companion.getInstance().tryBindIfNeeded(this);
878878
}
879879
}
880880

app/src/main/java/org/schabi/newpipe/RouterActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ private boolean canHandleChoiceLikeShowInfo(final String selectedChoiceKey) {
701701
}
702702

703703
// ...the player is not running or in normal Video-mode/type
704-
final PlayerType playerType = PlayerHolder.getInstance().getType();
704+
final PlayerType playerType = PlayerHolder.Companion.getInstance().getType();
705705
return playerType == null || playerType == PlayerType.MAIN;
706706
}
707707

app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ public final class VideoDetailFragment
228228
@Nullable
229229
private PlayerService playerService;
230230
private Player player;
231-
private final PlayerHolder playerHolder = PlayerHolder.getInstance();
231+
private final PlayerHolder playerHolder = PlayerHolder.Companion.getInstance();
232232

233233
/*//////////////////////////////////////////////////////////////////////////
234234
// Service management

app/src/main/java/org/schabi/newpipe/info_list/dialog/InfoItemDialog.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ public Builder setAction(@NonNull final StreamDialogDefaultEntry entry,
252252
* @return the current {@link Builder} instance
253253
*/
254254
public Builder addEnqueueEntriesIfNeeded() {
255-
final PlayerHolder holder = PlayerHolder.getInstance();
255+
final PlayerHolder holder = PlayerHolder.Companion.getInstance();
256256
if (holder.isPlayQueueReady()) {
257257
addEntry(StreamDialogDefaultEntry.ENQUEUE);
258258

0 commit comments

Comments
 (0)