Skip to content

Commit 3750561

Browse files
authored
Merge pull request #7475 from litetex/release/v0.21.14
Release/v0.21.14
2 parents 0ae04b8 + 6b02655 commit 3750561

302 files changed

Lines changed: 3797 additions & 1476 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
.gitignore
2-
.gradle
3-
/local.properties
1+
.gradle/
2+
local.properties
43
.DS_Store
5-
/build
6-
/captures
7-
/app/app.iml
8-
/.idea
9-
/*.iml
4+
build/
5+
captures/
6+
.idea/
7+
*.iml
108
*~
119
.weblate
1210
*.class
11+
**/debug/
12+
**/release/
1313

1414
# vscode / eclipse files
1515
*.classpath

app/.gitignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

app/build.gradle

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ android {
1717
resValue "string", "app_name", "NewPipe"
1818
minSdkVersion 19
1919
targetSdkVersion 29
20-
versionCode 979
21-
versionName "0.21.13"
20+
versionCode 980
21+
versionName "0.21.14"
2222

2323
multiDexEnabled true
2424

@@ -105,9 +105,9 @@ ext {
105105
androidxRoomVersion = '2.3.0'
106106

107107
icepickVersion = '3.2.0'
108-
exoPlayerVersion = '2.12.3'
108+
exoPlayerVersion = '2.14.2'
109109
googleAutoServiceVersion = '1.0'
110-
groupieVersion = '2.9.0'
110+
groupieVersion = '2.10.0'
111111
markwonVersion = '4.6.2'
112112

113113
leakCanaryVersion = '2.5'
@@ -189,7 +189,7 @@ dependencies {
189189
// name and the commit hash with the commit hash of the (pushed) commit you want to test
190190
// This works thanks to JitPack: https://jitpack.io/
191191
implementation 'com.github.TeamNewPipe:nanojson:1d9e1aea9049fc9f85e68b43ba39fe7be1c1f751'
192-
implementation 'com.github.TeamNewPipe:NewPipeExtractor:v0.21.11'
192+
implementation 'com.github.TeamNewPipe:NewPipeExtractor:v0.21.12'
193193

194194
/** Checkstyle **/
195195
checkstyle "com.puppycrawl.tools:checkstyle:${checkstyleVersion}"
@@ -208,14 +208,17 @@ dependencies {
208208
implementation "androidx.lifecycle:lifecycle-livedata:${androidxLifecycleVersion}"
209209
implementation "androidx.lifecycle:lifecycle-viewmodel:${androidxLifecycleVersion}"
210210
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
211-
implementation 'androidx.media:media:1.3.1'
211+
implementation 'androidx.media:media:1.4.3'
212212
implementation 'androidx.multidex:multidex:2.0.1'
213213
implementation 'androidx.preference:preference:1.1.1'
214-
implementation 'androidx.recyclerview:recyclerview:1.1.0'
214+
implementation 'androidx.recyclerview:recyclerview:1.2.1'
215215
implementation "androidx.room:room-runtime:${androidxRoomVersion}"
216216
implementation "androidx.room:room-rxjava3:${androidxRoomVersion}"
217217
kapt "androidx.room:room-compiler:${androidxRoomVersion}"
218218
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
219+
// Newer version specified to prevent accessibility regressions with RecyclerView, see:
220+
// https://developer.android.com/jetpack/androidx/releases/viewpager2#1.1.0-alpha01
221+
implementation 'androidx.viewpager2:viewpager2:1.1.0-beta01'
219222
implementation 'androidx.webkit:webkit:1.4.0'
220223
implementation 'com.google.android.material:material:1.2.1'
221224

app/src/main/AndroidManifest.xml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,21 @@
256256
<data android:pathPrefix="/" />
257257
</intent-filter>
258258

259+
<!-- y2u.be filter -->
260+
<intent-filter>
261+
<action android:name="android.intent.action.VIEW" />
262+
<action android:name="android.media.action.MEDIA_PLAY_FROM_SEARCH" />
263+
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
264+
265+
<category android:name="android.intent.category.DEFAULT" />
266+
<category android:name="android.intent.category.BROWSABLE" />
267+
268+
<data android:scheme="http" />
269+
<data android:scheme="https" />
270+
<data android:host="y2u.be" />
271+
<data android:pathPrefix="/" />
272+
</intent-filter>
273+
259274
<!-- Soundcloud filter -->
260275
<intent-filter>
261276
<action android:name="android.intent.action.VIEW" />
@@ -325,8 +340,12 @@
325340
<data android:host="skeptikon.fr" />
326341

327342
<data android:pathPrefix="/videos/" /> <!-- it contains playlists -->
343+
<data android:pathPrefix="/w/" /> <!-- short video URLs -->
344+
<data android:pathPrefix="/w/p/" /> <!-- short playlist URLs -->
328345
<data android:pathPrefix="/accounts/" />
346+
<data android:pathPrefix="/a/" /> <!-- short account URLs -->
329347
<data android:pathPrefix="/video-channels/" />
348+
<data android:pathPrefix="/c/" /> <!-- short video-channels URLs -->
330349
</intent-filter>
331350

332351
<!-- Bandcamp filter for tracks, albums and playlists -->

app/src/main/java/androidx/fragment/app/FragmentStatePagerAdapterMenuWorkaround.java

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,12 @@
5151
* <li>{@link #saveState()}</li>
5252
* <li>{@link #restoreState(Parcelable, ClassLoader)}</li>
5353
* </ul>
54+
*
55+
* @deprecated Switch to {@link androidx.viewpager2.widget.ViewPager2} and use
56+
* {@link androidx.viewpager2.adapter.FragmentStateAdapter} instead.
5457
*/
5558
@SuppressWarnings("deprecation")
59+
@Deprecated
5660
public abstract class FragmentStatePagerAdapterMenuWorkaround extends PagerAdapter {
5761
private static final String TAG = "FragmentStatePagerAdapt";
5862
private static final boolean DEBUG = false;
@@ -86,9 +90,10 @@ public abstract class FragmentStatePagerAdapterMenuWorkaround extends PagerAdapt
8690
private final int mBehavior;
8791
private FragmentTransaction mCurTransaction = null;
8892

89-
private final ArrayList<Fragment.SavedState> mSavedState = new ArrayList<Fragment.SavedState>();
90-
private final ArrayList<Fragment> mFragments = new ArrayList<Fragment>();
93+
private final ArrayList<Fragment.SavedState> mSavedState = new ArrayList<>();
94+
private final ArrayList<Fragment> mFragments = new ArrayList<>();
9195
private Fragment mCurrentPrimaryItem = null;
96+
private boolean mExecutingFinishUpdate;
9297

9398
/**
9499
* Constructor for {@link FragmentStatePagerAdapterMenuWorkaround}
@@ -208,7 +213,7 @@ public void destroyItem(@NonNull final ViewGroup container, final int position,
208213
mFragments.set(position, null);
209214

210215
mCurTransaction.remove(fragment);
211-
if (fragment == mCurrentPrimaryItem) {
216+
if (fragment.equals(mCurrentPrimaryItem)) {
212217
mCurrentPrimaryItem = null;
213218
}
214219
}
@@ -247,7 +252,19 @@ public void setPrimaryItem(@NonNull final ViewGroup container, final int positio
247252
@Override
248253
public void finishUpdate(@NonNull final ViewGroup container) {
249254
if (mCurTransaction != null) {
250-
mCurTransaction.commitNowAllowingStateLoss();
255+
// We drop any transactions that attempt to be committed
256+
// from a re-entrant call to finishUpdate(). We need to
257+
// do this as a workaround for Robolectric running measure/layout
258+
// calls inline rather than allowing them to be posted
259+
// as they would on a real device.
260+
if (!mExecutingFinishUpdate) {
261+
try {
262+
mExecutingFinishUpdate = true;
263+
mCurTransaction.commitNowAllowingStateLoss();
264+
} finally {
265+
mExecutingFinishUpdate = false;
266+
}
267+
}
251268
mCurTransaction = null;
252269
}
253270
}

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

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ public abstract class BaseFragment extends Fragment {
2121
//These values are used for controlling fragments when they are part of the frontpage
2222
@State
2323
protected boolean useAsFrontPage = false;
24-
private boolean mIsVisibleToUser = false;
2524

2625
public void useAsFrontPage(final boolean value) {
2726
useAsFrontPage = value;
@@ -85,12 +84,6 @@ public void onDestroy() {
8584
AppWatcher.INSTANCE.getObjectWatcher().watch(this);
8685
}
8786

88-
@Override
89-
public void setUserVisibleHint(final boolean isVisibleToUser) {
90-
super.setUserVisibleHint(isVisibleToUser);
91-
mIsVisibleToUser = isVisibleToUser;
92-
}
93-
9487
/*//////////////////////////////////////////////////////////////////////////
9588
// Init
9689
//////////////////////////////////////////////////////////////////////////*/
@@ -109,8 +102,7 @@ public void setTitle(final String title) {
109102
if (DEBUG) {
110103
Log.d(TAG, "setTitle() called with: title = [" + title + "]");
111104
}
112-
if ((!useAsFrontPage || mIsVisibleToUser)
113-
&& (activity != null && activity.getSupportActionBar() != null)) {
105+
if (!useAsFrontPage && activity != null && activity.getSupportActionBar() != null) {
114106
activity.getSupportActionBar().setDisplayShowTitleEnabled(true);
115107
activity.getSupportActionBar().setTitle(title);
116108
}

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

Lines changed: 31 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,13 @@
77
import android.content.SharedPreferences;
88
import android.content.pm.PackageManager;
99
import android.content.pm.Signature;
10-
import android.net.ConnectivityManager;
1110
import android.net.Uri;
1211
import android.util.Log;
1312

1413
import androidx.annotation.NonNull;
1514
import androidx.annotation.Nullable;
1615
import androidx.core.app.NotificationCompat;
1716
import androidx.core.app.NotificationManagerCompat;
18-
import androidx.core.content.ContextCompat;
1917
import androidx.core.content.pm.PackageInfoCompat;
2018
import androidx.preference.PreferenceManager;
2119

@@ -48,7 +46,8 @@ public CheckForNewAppVersion() {
4846
private static final boolean DEBUG = MainActivity.DEBUG;
4947
private static final String TAG = CheckForNewAppVersion.class.getSimpleName();
5048

51-
private static final String GITHUB_APK_SHA1
49+
// Public key of the certificate that is used in NewPipe release versions
50+
private static final String RELEASE_CERT_PUBLIC_KEY_SHA1
5251
= "B0:2E:90:7C:1C:D6:FC:57:C3:35:F0:88:D0:8F:50:5F:94:E4:D2:15";
5352
private static final String NEWPIPE_API_URL = "https://newpipe.net/api/data.json";
5453

@@ -129,44 +128,37 @@ private static void compareAppVersionAndShowNotification(@NonNull final Applicat
129128
final String versionName,
130129
final String apkLocationUrl,
131130
final int versionCode) {
132-
final int notificationId = 2000;
133-
134-
if (BuildConfig.VERSION_CODE < versionCode) {
135-
// A pending intent to open the apk location url in the browser.
136-
final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(apkLocationUrl));
137-
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
138-
final PendingIntent pendingIntent
139-
= PendingIntent.getActivity(application, 0, intent, 0);
131+
if (BuildConfig.VERSION_CODE >= versionCode) {
132+
return;
133+
}
140134

141-
final String channelId = application
142-
.getString(R.string.app_update_notification_channel_id);
143-
final NotificationCompat.Builder notificationBuilder
144-
= new NotificationCompat.Builder(application, channelId)
145-
.setSmallIcon(R.drawable.ic_newpipe_update)
146-
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
147-
.setContentIntent(pendingIntent)
148-
.setAutoCancel(true)
149-
.setContentTitle(application
150-
.getString(R.string.app_update_notification_content_title))
151-
.setContentText(application
152-
.getString(R.string.app_update_notification_content_text)
153-
+ " " + versionName);
135+
// A pending intent to open the apk location url in the browser.
136+
final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(apkLocationUrl));
137+
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
138+
final PendingIntent pendingIntent
139+
= PendingIntent.getActivity(application, 0, intent, 0);
154140

155-
final NotificationManagerCompat notificationManager
156-
= NotificationManagerCompat.from(application);
157-
notificationManager.notify(notificationId, notificationBuilder.build());
158-
}
159-
}
141+
final String channelId = application
142+
.getString(R.string.app_update_notification_channel_id);
143+
final NotificationCompat.Builder notificationBuilder
144+
= new NotificationCompat.Builder(application, channelId)
145+
.setSmallIcon(R.drawable.ic_newpipe_update)
146+
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
147+
.setContentIntent(pendingIntent)
148+
.setAutoCancel(true)
149+
.setContentTitle(application
150+
.getString(R.string.app_update_notification_content_title))
151+
.setContentText(application
152+
.getString(R.string.app_update_notification_content_text)
153+
+ " " + versionName);
160154

161-
private static boolean isConnected(@NonNull final App app) {
162-
final ConnectivityManager connectivityManager =
163-
ContextCompat.getSystemService(app, ConnectivityManager.class);
164-
return connectivityManager != null && connectivityManager.getActiveNetworkInfo() != null
165-
&& connectivityManager.getActiveNetworkInfo().isConnected();
155+
final NotificationManagerCompat notificationManager
156+
= NotificationManagerCompat.from(application);
157+
notificationManager.notify(2000, notificationBuilder.build());
166158
}
167159

168-
public static boolean isGithubApk(@NonNull final App app) {
169-
return getCertificateSHA1Fingerprint(app).equals(GITHUB_APK_SHA1);
160+
public static boolean isReleaseApk(@NonNull final App app) {
161+
return getCertificateSHA1Fingerprint(app).equals(RELEASE_CERT_PUBLIC_KEY_SHA1);
170162
}
171163

172164
private void checkNewVersion() throws IOException, ReCaptchaException {
@@ -175,9 +167,8 @@ private void checkNewVersion() throws IOException, ReCaptchaException {
175167
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(app);
176168
final NewVersionManager manager = new NewVersionManager();
177169

178-
// Check if user has enabled/disabled update checking
179-
// and if the current apk is a github one or not.
180-
if (!prefs.getBoolean(app.getString(R.string.update_app_key), true) || !isGithubApk(app)) {
170+
// Check if the current apk is a github one or not.
171+
if (!isReleaseApk(app)) {
181172
return;
182173
}
183174

@@ -213,6 +204,7 @@ private void handleResponse(@NonNull final Response response,
213204

214205
// Parse the json from the response.
215206
try {
207+
216208
final JsonObject githubStableObject = JsonParser.object()
217209
.from(response.responseBody()).getObject("flavors")
218210
.getObject("github").getObject("stable");

0 commit comments

Comments
 (0)