Skip to content

Commit 840084d

Browse files
Merge pull request #12419 from Isira-Seneviratne/Merge-dev-to-refactor
Merge dev to refactor
2 parents d81b571 + 2acfefd commit 840084d

25 files changed

+52
-32
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ jobs:
111111
path: app/build/reports/androidTests/connected/**
112112

113113
sonar:
114+
if: ${{ false }} # the key has expired and needs to be regenerated by the sonar admins
114115
runs-on: ubuntu-latest
115116

116117
permissions:

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
<h3 align="center">We are planning to <i>rewrite</i> large chunks of the codebase, to bring about <a href="https://github.com/TeamNewPipe/NewPipe/discussions/10118">a new, modern and stable NewPipe</a>!</h3>
2-
<h4 align="center">Please do <b>not</b> open pull requests for <i>new features</i> now, only bugfix PRs will be accepted.</h4>
1+
<h3 align="center">We are <i>rewriting</i> large chunks of the codebase, to bring about <a href="https://newpipe.net/blog/pinned/announcement/newpipe-0.27.6-rewrite-team-states/#the-refactor">a modern and stable NewPipe</a>! You can download nightly builds <a href="https://github.com/TeamNewPipe/NewPipe-refactor-nightly/releases">here</a>.</h3>
2+
<h4 align="center">Please work on the <code>refactor</code> branch if you want to contribute <i>new features</i>. The current codebase is in maintenance mode and will only receive <i>bugfixes</i>.</h4>
33

44
<p align="center"><a href="https://newpipe.net"><img src="assets/new_pipe_icon_5.png" width="150"></a></p>
55
<h2 align="center"><b>NewPipe</b></h2>
66
<h4 align="center">A libre lightweight streaming front-end for Android.</h4>
77

8-
<p align="center"><a href="https://f-droid.org/packages/org.schabi.newpipe/"><img src="https://fdroid.gitlab.io/artwork/badge/get-it-on-en.svg" alt="Get it on F-Droid" height=80/></a></p>
8+
<p align="center"><a href="https://f-droid.org/packages/org.schabi.newpipe/"><img src="https://fdroid.gitlab.io/artwork/badge/get-it-on-en.svg" alt="Get it on F-Droid" width=206/></a></p>
99

1010
<p align="center">
1111
<a href="https://github.com/TeamNewPipe/NewPipe/releases" alt="GitHub NewPipe releases"><img src="https://img.shields.io/github/release/TeamNewPipe/NewPipe.svg" ></a>

app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionFragment.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import android.view.MenuItem
1212
import android.view.SubMenu
1313
import android.view.View
1414
import android.view.ViewGroup
15+
import android.webkit.MimeTypeMap
1516
import android.widget.Toast
1617
import androidx.activity.result.ActivityResult
1718
import androidx.activity.result.contract.ActivityResultContracts.StartActivityForResult
@@ -456,6 +457,7 @@ class SubscriptionFragment : BaseStateFragment<SubscriptionState>() {
456457
}
457458

458459
companion object {
459-
const val JSON_MIME_TYPE = "application/json"
460+
val JSON_MIME_TYPE = MimeTypeMap.getSingleton()
461+
.getMimeTypeFromExtension("json") ?: "application/octet-stream"
460462
}
461463
}

app/src/main/java/org/schabi/newpipe/player/helper/PlayerHolder.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,11 @@ class PlayerServiceConnection implements ServiceConnection {
167167

168168
private boolean playAfterConnect = false;
169169

170+
/**
171+
* @param playAfterConnection Sets the value of `playAfterConnect` to pass to the {@link
172+
* PlayerServiceExtendedEventListener#onPlayerConnected(Player, boolean)} the next time it
173+
* is called. The value of `playAfterConnect` will be reset to false after that.
174+
*/
170175
public void doPlayAfterConnect(final boolean playAfterConnection) {
171176
this.playAfterConnect = playAfterConnection;
172177
}
@@ -371,6 +376,8 @@ public void onServiceStopped() {
371376
listener.onPlayerDisconnected();
372377
} else {
373378
listener.onPlayerConnected(player, serviceConnection.playAfterConnect);
379+
// reset the value of playAfterConnect: if it was true before, it is now "consumed"
380+
serviceConnection.playAfterConnect = false;
374381
player.setFragmentListener(internalListener);
375382
}
376383
}

app/src/main/java/org/schabi/newpipe/player/mediabrowser/MediaBrowserImpl.kt

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import android.support.v4.media.MediaBrowserCompat
88
import android.support.v4.media.MediaDescriptionCompat
99
import android.util.Log
1010
import androidx.annotation.DrawableRes
11+
import androidx.core.net.toUri
1112
import androidx.media.MediaBrowserServiceCompat
1213
import androidx.media.MediaBrowserServiceCompat.Result
1314
import androidx.media.utils.MediaConstants
@@ -103,7 +104,7 @@ class MediaBrowserImpl(
103104

104105
private fun onLoadChildren(parentId: String): Single<List<MediaBrowserCompat.MediaItem>> {
105106
try {
106-
val parentIdUri = Uri.parse(parentId)
107+
val parentIdUri = parentId.toUri()
107108
val path = ArrayList(parentIdUri.pathSegments)
108109

109110
if (path.isEmpty()) {
@@ -185,7 +186,7 @@ class MediaBrowserImpl(
185186
builder
186187
.setMediaId(createMediaIdForInfoItem(playlist is PlaylistRemoteEntity, playlist.uid))
187188
.setTitle(playlist.orderingName)
188-
.setIconUri(playlist.thumbnailUrl?.let { Uri.parse(it) })
189+
.setIconUri(imageUriOrNullIfDisabled(playlist.thumbnailUrl))
189190

190191
val extras = Bundle()
191192
extras.putString(
@@ -212,7 +213,7 @@ class MediaBrowserImpl(
212213
}
213214

214215
ImageStrategy.choosePreferredImage(item.thumbnails)?.let {
215-
builder.setIconUri(Uri.parse(it))
216+
builder.setIconUri(imageUriOrNullIfDisabled(it))
216217
}
217218

218219
return MediaBrowserCompat.MediaItem(
@@ -258,7 +259,7 @@ class MediaBrowserImpl(
258259
builder.setMediaId(createMediaIdForPlaylistIndex(false, playlistId, index))
259260
.setTitle(item.streamEntity.title)
260261
.setSubtitle(item.streamEntity.uploader)
261-
.setIconUri(Uri.parse(item.streamEntity.thumbnailUrl))
262+
.setIconUri(imageUriOrNullIfDisabled(item.streamEntity.thumbnailUrl))
262263

263264
return MediaBrowserCompat.MediaItem(
264265
builder.build(),
@@ -277,7 +278,7 @@ class MediaBrowserImpl(
277278
.setSubtitle(item.uploaderName)
278279

279280
ImageStrategy.choosePreferredImage(item.thumbnails)?.let {
280-
builder.setIconUri(Uri.parse(it))
281+
builder.setIconUri(imageUriOrNullIfDisabled(it))
281282
}
282283

283284
return MediaBrowserCompat.MediaItem(
@@ -316,7 +317,7 @@ class MediaBrowserImpl(
316317
builder.setMediaId(mediaId)
317318
.setTitle(streamHistoryEntry.streamEntity.title)
318319
.setSubtitle(streamHistoryEntry.streamEntity.uploader)
319-
.setIconUri(Uri.parse(streamHistoryEntry.streamEntity.thumbnailUrl))
320+
.setIconUri(imageUriOrNullIfDisabled(streamHistoryEntry.streamEntity.thumbnailUrl))
320321

321322
return MediaBrowserCompat.MediaItem(
322323
builder.build(),
@@ -395,5 +396,13 @@ class MediaBrowserImpl(
395396

396397
companion object {
397398
private val TAG: String = MediaBrowserImpl::class.java.getSimpleName()
399+
400+
fun imageUriOrNullIfDisabled(url: String?): Uri? {
401+
return if (ImageStrategy.shouldLoadImages()) {
402+
url?.toUri()
403+
} else {
404+
null
405+
}
406+
}
398407
}
399408
}

app/src/main/java/org/schabi/newpipe/player/mediabrowser/MediaBrowserPlaybackPreparer.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import android.os.Bundle
66
import android.os.ResultReceiver
77
import android.support.v4.media.session.PlaybackStateCompat
88
import android.util.Log
9+
import androidx.core.net.toUri
910
import com.google.android.exoplayer2.Player
1011
import com.google.android.exoplayer2.ext.mediasession.MediaSessionConnector.PlaybackPreparer
1112
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
@@ -137,7 +138,7 @@ class MediaBrowserPlaybackPreparer(
137138

138139
private fun extractPlayQueueFromMediaId(mediaId: String): Single<PlayQueue> {
139140
try {
140-
val mediaIdUri = Uri.parse(mediaId)
141+
val mediaIdUri = mediaId.toUri()
141142
val path = ArrayList(mediaIdUri.pathSegments)
142143
if (path.isEmpty()) {
143144
throw parseError(mediaId)

doc/README.ar.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<h2 align="center"><b>NewPipe</b></h2>
33
<h4 align="center"> .Android واجهة أمامية متدفقة خفيفة الوزن لنظام</h4>
44

5-
<p align="center"><a href="https://f-droid.org/packages/org.schabi.newpipe/"><img src="https://fdroid.gitlab.io/artwork/badge/get-it-on-fr.svg" alt="Get it on F-Droid" height=80/></a></p>
5+
<p align="center"><a href="https://f-droid.org/packages/org.schabi.newpipe/"><img src="https://fdroid.gitlab.io/artwork/badge/get-it-on-fr.svg" alt="Get it on F-Droid" width=206/></a></p>
66

77
<p align="center">
88
<a href="https://github.com/TeamNewPipe/NewPipe/releases" alt="GitHub release"><img src="https://img.shields.io/github/release/TeamNewPipe/NewPipe.svg" ></a>

doc/README.asm.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<h2 align="center"><b>NewPipe</b></h2>
33
<h4 align="center">এণ্ড্ৰইডৰ বাবে এটা লিব্ৰে লাইটৱেট ষ্ট্ৰীমিং ফ্ৰন্ট-এণ্ড।</h4>
44

5-
<p align="center"><a href="https://f-droid.org/packages/org.schabi.newpipe/"><img src="https://fdroid.gitlab.io/artwork/badge/get-it-on-en.svg" alt="Get it on F-Droid" height=80/></a></p>
5+
<p align="center"><a href="https://f-droid.org/packages/org.schabi.newpipe/"><img src="https://fdroid.gitlab.io/artwork/badge/get-it-on-en.svg" alt="Get it on F-Droid" width=206/></a></p>
66

77
<p align="center">
88
<a href="https://github.com/TeamNewPipe/NewPipe/releases" alt="GitHub release"><img src="https://img.shields.io/github/release/TeamNewPipe/NewPipe.svg" ></a>

doc/README.de.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
<h3 align="center">Wir planen große Teile des Quellcodes <i>neu zu schreiben</i>, um NewPipe <a href="https://github.com/TeamNewPipe/NewPipe/discussions/10118">neu, modern und stabiler</a> zu machen!</h3>
2-
<h4 align="center">Öffne <b>keine</b> neuen Pull Requests für <i>neue Features</i>, es werden nur Fehlerbehebungen akzeptiert.</h4>
1+
<h3 align="center">Wir sind im Prozess, größere Teile unseres Codes <i>neuzuschreiben</i>, um eine <a href="https://github.com/TeamNewPipe/NewPipe/discussions/10118">moderne und stabile</a> NewPipe App zu kreieren! Du kannst nightly builds <a href="https://github.com/TeamNewPipe/NewPipe-refactor-nightly/releases">hier</a> herunterladen.</h3>
2+
<h4 align="center">Bitte nutze den <code>refactor</code> branch als Arbeitsgrundlage, wenn du <i>neue Funktionen</i> beitragen willst. Die aktuelle Codebase ist im reinen Maintenance mode und bekommt nur noch <i>Fehlerbehebungen</i>.</h4>
33

44
<p align="center"><a href="https://newpipe.net"><img src="../assets/new_pipe_icon_5.png" width="150"></a></p>
55
<h2 align="center"><b>NewPipe</b></h2>
66
<h4 align="center">Eine freie, offene und leichtgewichtige Streaming App für Android.</h4>
77

8-
<p align="center"><a href="https://f-droid.org/packages/org.schabi.newpipe/"><img src="https://fdroid.gitlab.io/artwork/badge/get-it-on-de.svg" alt="Hole es dir auf F-Droid" height=80/></a></p>
8+
<p align="center"><a href="https://f-droid.org/packages/org.schabi.newpipe/"><img src="https://fdroid.gitlab.io/artwork/badge/get-it-on-de.svg" alt="Hole es dir auf F-Droid" width=206/></a></p>
99

1010
<p align="center">
1111
<a href="https://github.com/TeamNewPipe/NewPipe/releases" alt="GitHub Release"><img src="https://img.shields.io/github/release/TeamNewPipe/NewPipe.svg" ></a>

doc/README.es.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<h2 align="center"><b>NewPipe</b></h2>
33
<h4 align="center">Una interfaz de streaming ligera y libre para Android.</h4>
44

5-
<p align="center"><a href="https://f-droid.org/packages/org.schabi.newpipe/"><img src="https://fdroid.gitlab.io/artwork/badge/get-it-on-es.svg" alt="Get it on F-Droid" height=80/></a></p>
5+
<p align="center"><a href="https://f-droid.org/packages/org.schabi.newpipe/"><img src="https://fdroid.gitlab.io/artwork/badge/get-it-on-es.svg" alt="Get it on F-Droid" width=206/></a></p>
66

77
<p align="center">
88
<a href="https://github.com/TeamNewPipe/NewPipe/releases" alt="Lanzamientos GitHub"><img src="https://img.shields.io/github/release/TeamNewPipe/NewPipe.svg" ></a>

0 commit comments

Comments
 (0)