From e554c77f2e085a900d28ac83a46e6073e082f582 Mon Sep 17 00:00:00 2001 From: Profpatsch Date: Wed, 7 May 2025 14:20:44 +0200 Subject: [PATCH 01/18] Comments: Put @ on the right side of right-to-left usernames From the discussion in https://github.com/TeamNewPipe/NewPipe/pull/12188 it reads more natural for RTL readers. --- .../main/java/org/schabi/newpipe/util/Localization.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/util/Localization.java b/app/src/main/java/org/schabi/newpipe/util/Localization.java index e92ad0b1c..65cfec930 100644 --- a/app/src/main/java/org/schabi/newpipe/util/Localization.java +++ b/app/src/main/java/org/schabi/newpipe/util/Localization.java @@ -90,19 +90,14 @@ public final class Localization { * Localize a user name like @foobar. * * Will correctly handle right-to-left usernames by using a {@link BidiFormatter}. + * For right-to-left usernames, it will put the @ on the right side to read more naturally. * * @param plainName username, with an optional leading @ * @return a usernames that can include RTL-characters */ @NonNull public static String localizeUserName(final String plainName) { - final BidiFormatter bidi = BidiFormatter.getInstance(); - - if (plainName.startsWith("@")) { - return "@" + bidi.unicodeWrap(plainName.substring(1)); - } else { - return bidi.unicodeWrap(plainName); - } + return BidiFormatter.getInstance().unicodeWrap(plainName); } public static org.schabi.newpipe.extractor.localization.Localization getPreferredLocalization( From 90e2f234e72b8ce4b95aba64173db1a848c395fb Mon Sep 17 00:00:00 2001 From: Thompson3142 Date: Tue, 3 Dec 2024 00:51:15 +0100 Subject: [PATCH 02/18] Initial commit for better handling of background crashes Fix crashing behaviour with entry in SharedPreferences A few minor improvements Added docs for isInBackground Some more minor changes Overwrite methods in MainActivity instead of creating a new class --- app/build.gradle | 1 + .../java/org/schabi/newpipe/MainActivity.java | 30 ++++++++++++++----- .../org/schabi/newpipe/error/ErrorUtil.kt | 12 +++++++- 3 files changed, 35 insertions(+), 8 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 5a5a2be1b..6fc06aadc 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -233,6 +233,7 @@ dependencies { implementation 'androidx.fragment:fragment-ktx:1.6.2' implementation "androidx.lifecycle:lifecycle-livedata-ktx:${androidxLifecycleVersion}" implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:${androidxLifecycleVersion}" + implementation "androidx.lifecycle:lifecycle-process:${androidxLifecycleVersion}" implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.1.0' implementation 'androidx.media:media:1.7.0' implementation 'androidx.preference:preference:1.2.1' diff --git a/app/src/main/java/org/schabi/newpipe/MainActivity.java b/app/src/main/java/org/schabi/newpipe/MainActivity.java index f74e8b7a7..b709c1107 100644 --- a/app/src/main/java/org/schabi/newpipe/MainActivity.java +++ b/app/src/main/java/org/schabi/newpipe/MainActivity.java @@ -126,7 +126,10 @@ public class MainActivity extends AppCompatActivity { private static final int ITEM_ID_ABOUT = 2; private static final int ORDER = 0; + public static final String KEY_IS_IN_BACKGROUND = "is_in_background"; + private SharedPreferences sharedPreferences; + private SharedPreferences.Editor sharedPrefEditor; /*////////////////////////////////////////////////////////////////////////// // Activity's LifeCycle //////////////////////////////////////////////////////////////////////////*/ @@ -156,6 +159,8 @@ public class MainActivity extends AppCompatActivity { assureCorrectAppLanguage(this); super.onCreate(savedInstanceState); + sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); + sharedPrefEditor = sharedPreferences.edit(); mainBinding = ActivityMainBinding.inflate(getLayoutInflater()); drawerLayoutBinding = mainBinding.drawerLayout; @@ -199,16 +204,29 @@ public class MainActivity extends AppCompatActivity { super.onPostCreate(savedInstanceState); final App app = App.getApp(); - final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(app); - if (prefs.getBoolean(app.getString(R.string.update_app_key), false) - && prefs.getBoolean(app.getString(R.string.update_check_consent_key), false)) { + if (sharedPreferences.getBoolean(app.getString(R.string.update_app_key), false) + && sharedPreferences + .getBoolean(app.getString(R.string.update_check_consent_key), false)) { // Start the worker which is checking all conditions // and eventually searching for a new version. NewVersionWorker.enqueueNewVersionCheckingWork(app, false); } } + @Override + protected void onStart() { + super.onStart(); + sharedPrefEditor.putBoolean(KEY_IS_IN_BACKGROUND, false).apply(); + Log.d(TAG, "App moved to foreground"); + } + + @Override + protected void onStop() { + super.onStop(); + sharedPrefEditor.putBoolean(KEY_IS_IN_BACKGROUND, true).apply(); + Log.d(TAG, "App moved to background"); + } private void setupDrawer() throws ExtractionException { addDrawerMenuForCurrentService(); @@ -508,13 +526,11 @@ public class MainActivity extends AppCompatActivity { ErrorUtil.showUiErrorSnackbar(this, "Setting up service toggle", e); } - final SharedPreferences sharedPreferences = - PreferenceManager.getDefaultSharedPreferences(this); if (sharedPreferences.getBoolean(Constants.KEY_THEME_CHANGE, false)) { if (DEBUG) { Log.d(TAG, "Theme has changed, recreating activity..."); } - sharedPreferences.edit().putBoolean(Constants.KEY_THEME_CHANGE, false).apply(); + sharedPrefEditor.putBoolean(Constants.KEY_THEME_CHANGE, false).apply(); ActivityCompat.recreate(this); } @@ -522,7 +538,7 @@ public class MainActivity extends AppCompatActivity { if (DEBUG) { Log.d(TAG, "main page has changed, recreating main fragment..."); } - sharedPreferences.edit().putBoolean(Constants.KEY_MAIN_PAGE_CHANGE, false).apply(); + sharedPrefEditor.putBoolean(Constants.KEY_MAIN_PAGE_CHANGE, false).apply(); NavigationHelper.openMainActivity(this); } diff --git a/app/src/main/java/org/schabi/newpipe/error/ErrorUtil.kt b/app/src/main/java/org/schabi/newpipe/error/ErrorUtil.kt index dcbc11413..93dd8e522 100644 --- a/app/src/main/java/org/schabi/newpipe/error/ErrorUtil.kt +++ b/app/src/main/java/org/schabi/newpipe/error/ErrorUtil.kt @@ -11,7 +11,9 @@ import androidx.core.app.NotificationCompat import androidx.core.app.NotificationManagerCompat import androidx.core.app.PendingIntentCompat import androidx.fragment.app.Fragment +import androidx.preference.PreferenceManager import com.google.android.material.snackbar.Snackbar +import org.schabi.newpipe.MainActivity import org.schabi.newpipe.R /** @@ -35,12 +37,20 @@ class ErrorUtil { * activity (since the workflow would be interrupted anyway in that case). So never use this * for background services. * + * If the crashed occurred while the app was in the background open a notification instead + * * @param context the context to use to start the new activity * @param errorInfo the error info to be reported */ @JvmStatic fun openActivity(context: Context, errorInfo: ErrorInfo) { - context.startActivity(getErrorActivityIntent(context, errorInfo)) + if (PreferenceManager.getDefaultSharedPreferences(context) + .getBoolean(MainActivity.KEY_IS_IN_BACKGROUND, true) + ) { + createNotification(context, errorInfo) + } else { + context.startActivity(getErrorActivityIntent(context, errorInfo)) + } } /** From 76202e6b4b20e1d4bd17359675015cfed08ca7f5 Mon Sep 17 00:00:00 2001 From: Thompson3142 Date: Tue, 17 Dec 2024 19:49:43 +0100 Subject: [PATCH 03/18] Remove no longer needed dependency --- app/build.gradle | 1 - 1 file changed, 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 6fc06aadc..5a5a2be1b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -233,7 +233,6 @@ dependencies { implementation 'androidx.fragment:fragment-ktx:1.6.2' implementation "androidx.lifecycle:lifecycle-livedata-ktx:${androidxLifecycleVersion}" implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:${androidxLifecycleVersion}" - implementation "androidx.lifecycle:lifecycle-process:${androidxLifecycleVersion}" implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.1.0' implementation 'androidx.media:media:1.7.0' implementation 'androidx.preference:preference:1.2.1' From 7dd1abdf9c87c199e108ad9e03c71702605f94f9 Mon Sep 17 00:00:00 2001 From: David <22662897+davidasunmo@users.noreply.github.com> Date: Tue, 20 May 2025 02:22:47 +0100 Subject: [PATCH 04/18] Add dev and refactor nightly build badges bottom text --- README.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index bf1317f17..f4548cf9e 100644 --- a/README.md +++ b/README.md @@ -8,13 +8,23 @@

Get it on F-Droid

- + + + + + + + +

+ +

+

ScreenshotsSupported ServicesDescriptionFeaturesInstallation and updatesContributionDonateLicense

WebsiteBlogFAQPress

From 16077dee80d2d87199b92c758fa00292a2a5072a Mon Sep 17 00:00:00 2001 From: David Asunmo Date: Wed, 21 May 2025 17:51:11 +0100 Subject: [PATCH 05/18] Add matrix chat link to all READMEs --- doc/README.ar.md | 1 + doc/README.de.md | 1 + doc/README.es.md | 1 + doc/README.fr.md | 1 + doc/README.it.md | 1 + doc/README.ja.md | 1 + doc/README.ko.md | 1 + doc/README.pl.md | 1 + doc/README.pt_BR.md | 1 + doc/README.ro.md | 1 + doc/README.ryu.md | 1 + doc/README.so.md | 1 + doc/README.sr.md | 1 + doc/README.tr.md | 1 + doc/README.zh_TW.md | 1 + 15 files changed, 15 insertions(+) diff --git a/doc/README.ar.md b/doc/README.ar.md index 242516cdc..41f498243 100644 --- a/doc/README.ar.md +++ b/doc/README.ar.md @@ -10,6 +10,7 @@ +


لقطات الشاشةالخدمات المدعومةوصفسماتالتثبيت والتحديثاتمساهمةالتبرعاترخصة

diff --git a/doc/README.de.md b/doc/README.de.md index 5b3275d07..a1ab2efe5 100644 --- a/doc/README.de.md +++ b/doc/README.de.md @@ -13,6 +13,7 @@ +


ScreenshotsUnterstützte DiensteBeschreibungFeaturesInstallation und UpdatesBeitragSpendenLizenz

diff --git a/doc/README.es.md b/doc/README.es.md index 8ec58e771..3e8744ecc 100644 --- a/doc/README.es.md +++ b/doc/README.es.md @@ -10,6 +10,7 @@ +


diff --git a/doc/README.fr.md b/doc/README.fr.md index 772f4a1ae..026811488 100644 --- a/doc/README.fr.md +++ b/doc/README.fr.md @@ -13,6 +13,7 @@ +


Captures d'écranServices SupportésDescriptionFonctionnalitésInstallation et mises à jourContribuerDonsLicence

diff --git a/doc/README.it.md b/doc/README.it.md index 6c227ea2f..c42f28cfb 100644 --- a/doc/README.it.md +++ b/doc/README.it.md @@ -10,6 +10,7 @@ +


ScreenshotServizi SupportatiDescrizioneFunzionalitàInstallazione e aggiornamentiContribuireDonareLicenza

diff --git a/doc/README.ja.md b/doc/README.ja.md index e8f708a8a..116b8904d 100644 --- a/doc/README.ja.md +++ b/doc/README.ja.md @@ -10,6 +10,7 @@ +


スクリーンショット説明機能インストールと更新貢献寄付ライセンス

diff --git a/doc/README.ko.md b/doc/README.ko.md index 3215bd713..ecb68b7b3 100644 --- a/doc/README.ko.md +++ b/doc/README.ko.md @@ -10,6 +10,7 @@ +


ScreenshotsDescriptionFeaturesUpdatesContributionDonateLicense

diff --git a/doc/README.pl.md b/doc/README.pl.md index 96d493153..064c3b86b 100644 --- a/doc/README.pl.md +++ b/doc/README.pl.md @@ -10,6 +10,7 @@ +


ScreenshotyOpisFunkcjeInstalacja i aktualizacjeWkładWesprzyjLicencja

diff --git a/doc/README.pt_BR.md b/doc/README.pt_BR.md index da6c4fce6..3a99d47da 100644 --- a/doc/README.pt_BR.md +++ b/doc/README.pt_BR.md @@ -14,6 +14,7 @@ +


ScreenshotsServiços SuportadosDescriçãoRecursosInstalação e atualizaçõesContribuiçõesDoarLicença

diff --git a/doc/README.ro.md b/doc/README.ro.md index 29c1d3666..ec440d03c 100644 --- a/doc/README.ro.md +++ b/doc/README.ro.md @@ -10,6 +10,7 @@ +


Capturi de ecranDescriereFuncţiiInstalare şi actualizăriContribuţieDonaţiLicenţă

diff --git a/doc/README.ryu.md b/doc/README.ryu.md index 2e24aa41c..a5b8f1e7c 100644 --- a/doc/README.ryu.md +++ b/doc/README.ryu.md @@ -10,6 +10,7 @@ +


スクリーンショットしちめいちぬーインストールとぅこうしんこうきんちーふライセンス

diff --git a/doc/README.so.md b/doc/README.so.md index 640feae60..e3cfc6c8c 100644 --- a/doc/README.so.md +++ b/doc/README.so.md @@ -10,6 +10,7 @@ +


Sawir-shaashadeedFaahfaahinWaxqabadkaKushubida iyo cusboonaysiintaKusoo KordhinUgu DeeqLaysinka

diff --git a/doc/README.sr.md b/doc/README.sr.md index 1a9118638..28445c547 100644 --- a/doc/README.sr.md +++ b/doc/README.sr.md @@ -13,6 +13,7 @@ +


Снимци екранаПодржане услугеОписКарактеристикеИнсталација и ажурирањаДоприносДонацијаЛиценца

diff --git a/doc/README.tr.md b/doc/README.tr.md index bbdd85f76..9d8419311 100644 --- a/doc/README.tr.md +++ b/doc/README.tr.md @@ -10,6 +10,7 @@ +


Ekran fotoğraflarıAçıklamaÖzelliklerKurulum ve güncellemelerKatkıda bulunmaBağışLisans

diff --git a/doc/README.zh_TW.md b/doc/README.zh_TW.md index 760a43ad5..233f88be7 100644 --- a/doc/README.zh_TW.md +++ b/doc/README.zh_TW.md @@ -10,6 +10,7 @@ +


截圖說明功能安裝與更新貢獻捐款授權憑證

From de3d11568d85a526239582e3e00ced2c4b8c430a Mon Sep 17 00:00:00 2001 From: David Asunmo Date: Thu, 22 May 2025 03:15:13 +0100 Subject: [PATCH 06/18] Add nightly builds to all readmes Add matrix to .ru --- doc/README.ar.md | 10 ++++++++++ doc/README.asm.md | 10 ++++++++++ doc/README.de.md | 10 ++++++++++ doc/README.es.md | 10 ++++++++++ doc/README.fr.md | 10 ++++++++++ doc/README.hi.md | 10 ++++++++++ doc/README.it.md | 10 ++++++++++ doc/README.ja.md | 10 ++++++++++ doc/README.ko.md | 10 ++++++++++ doc/README.pa.md | 10 ++++++++++ doc/README.pl.md | 10 ++++++++++ doc/README.pt_BR.md | 10 ++++++++++ doc/README.ro.md | 10 ++++++++++ doc/README.ru.md | 13 ++++++++++++- doc/README.ryu.md | 10 ++++++++++ doc/README.so.md | 10 ++++++++++ doc/README.sr.md | 10 ++++++++++ doc/README.tr.md | 10 ++++++++++ doc/README.zh_TW.md | 10 ++++++++++ 19 files changed, 192 insertions(+), 1 deletion(-) diff --git a/doc/README.ar.md b/doc/README.ar.md index 41f498243..d40c4c2c3 100644 --- a/doc/README.ar.md +++ b/doc/README.ar.md @@ -6,12 +6,22 @@

+ + + + + + +

+ +

+

لقطات الشاشةالخدمات المدعومةوصفسماتالتثبيت والتحديثاتمساهمةالتبرعاترخصة

موقعمدونةالأسئلة الشائعةإضغط

diff --git a/doc/README.asm.md b/doc/README.asm.md index 8042b3db9..bd2058665 100644 --- a/doc/README.asm.md +++ b/doc/README.asm.md @@ -6,12 +6,22 @@

+ + + + + + +

+ +

+

স্ক্ৰীণশ্বটসমৰ্থিত সেৱাসমূহবিৱৰণ • diff --git a/doc/README.de.md b/doc/README.de.md index a1ab2efe5..6d93ae0b0 100644 --- a/doc/README.de.md +++ b/doc/README.de.md @@ -9,12 +9,22 @@

+ + + + + + +

+ +

+

ScreenshotsUnterstützte DiensteBeschreibungFeaturesInstallation und UpdatesBeitragSpendenLizenz

WebsiteBlogFAQÜber NewPipe

diff --git a/doc/README.es.md b/doc/README.es.md index 3e8744ecc..2a229443c 100644 --- a/doc/README.es.md +++ b/doc/README.es.md @@ -6,12 +6,22 @@

+ + + + + + +

+ +

+

Capturas de PantallaDescripciónCaracterísticasInstalación y ActualizacionesContribuciónDonarLicencia

diff --git a/doc/README.fr.md b/doc/README.fr.md index 026811488..a98086265 100644 --- a/doc/README.fr.md +++ b/doc/README.fr.md @@ -9,12 +9,22 @@

+ + + + + + +

+ +

+

Captures d'écranServices SupportésDescriptionFonctionnalitésInstallation et mises à jourContribuerDonsLicence

SiteBlogFAQPresse

diff --git a/doc/README.hi.md b/doc/README.hi.md index 37ae71a4a..9d1e310f7 100644 --- a/doc/README.hi.md +++ b/doc/README.hi.md @@ -6,12 +6,22 @@

+ + + + + + +

+ +

+

ऐप कैसी दिखती हैसमर्थित सेवाएँविवरणसुविधाएँस्थापित करना और अपडेट करनायोगदान करेंआर्थिक योगदान करेंलाइसेंस

वेबसाइटब्लॉगसाधारण सवाल-जवाबप्रेस

diff --git a/doc/README.it.md b/doc/README.it.md index c42f28cfb..7b3b4ea9e 100644 --- a/doc/README.it.md +++ b/doc/README.it.md @@ -6,12 +6,22 @@

+ + + + + + +

+ +

+

ScreenshotServizi SupportatiDescrizioneFunzionalitàInstallazione e aggiornamentiContribuireDonareLicenza

SitoBlogFAQStampa

diff --git a/doc/README.ja.md b/doc/README.ja.md index 116b8904d..80a3f6316 100644 --- a/doc/README.ja.md +++ b/doc/README.ja.md @@ -6,12 +6,22 @@

+ + + + + + +

+ +

+

スクリーンショット説明機能インストールと更新貢献寄付ライセンス

ウェブサイトブログFAQニュース

diff --git a/doc/README.ko.md b/doc/README.ko.md index ecb68b7b3..ba93afd72 100644 --- a/doc/README.ko.md +++ b/doc/README.ko.md @@ -6,12 +6,22 @@

+ + + + + + +

+ +

+

ScreenshotsDescriptionFeaturesUpdatesContributionDonateLicense

WebsiteBlogFAQPress

diff --git a/doc/README.pa.md b/doc/README.pa.md index 0e254adf1..261fe5c4e 100644 --- a/doc/README.pa.md +++ b/doc/README.pa.md @@ -6,12 +6,22 @@

+ + + + + + +

+ +

+

ਐਪ ਕਿਹੋ-ਜਿਹੀ ਦਿਖਦੀ ਹੈਸਮਰਥਿਤ ਸੇਵਾਵਾਂਵਰਣਨਵਿਸ਼ੇਸ਼ਤਾਵਾਂਇੰਸਟਾਲੇਸ਼ਨ ਅਤੇ ਅੱਪਡੇਟਯੋਗਦਾਨਦਾਨਲਾਈਸੈਂਸ

ਵੈੱਬਸਾਈਟਬਲੌਗਆਮ ਸਵਾਲ ਜਵਾਬਪ੍ਰੈਸ

diff --git a/doc/README.pl.md b/doc/README.pl.md index 064c3b86b..7789cdd45 100644 --- a/doc/README.pl.md +++ b/doc/README.pl.md @@ -6,12 +6,22 @@

+ + + + + + +

+ +

+

ScreenshotyOpisFunkcjeInstalacja i aktualizacjeWkładWesprzyjLicencja

StronaBlogFAQPress

diff --git a/doc/README.pt_BR.md b/doc/README.pt_BR.md index 3a99d47da..c61750f9e 100644 --- a/doc/README.pt_BR.md +++ b/doc/README.pt_BR.md @@ -10,12 +10,22 @@

+ + + + + + +

+ +

+

ScreenshotsServiços SuportadosDescriçãoRecursosInstalação e atualizaçõesContribuiçõesDoarLicença

SiteBlogFAQPress

diff --git a/doc/README.ro.md b/doc/README.ro.md index ec440d03c..4ae789389 100644 --- a/doc/README.ro.md +++ b/doc/README.ro.md @@ -6,12 +6,22 @@

+ + + + + + +

+ +

+

Capturi de ecranDescriereFuncţiiInstalare şi actualizăriContribuţieDonaţiLicenţă

WebsiteBlogFAQPresă

diff --git a/doc/README.ru.md b/doc/README.ru.md index e3c76d329..8da329bf5 100644 --- a/doc/README.ru.md +++ b/doc/README.ru.md @@ -6,11 +6,22 @@

+ + + + + + -

+ +

+ + +

+

СкриншотыПоддерживаемые сервисыОписаниеВозможностиУстановка и обновленияУчастиеПожертвованиеЛицензия

СайтБлогЧЗВПресса

diff --git a/doc/README.ryu.md b/doc/README.ryu.md index a5b8f1e7c..d080076dc 100644 --- a/doc/README.ryu.md +++ b/doc/README.ryu.md @@ -6,12 +6,22 @@

+ + + + + + +

+ +

+

スクリーンショットしちめいちぬーインストールとぅこうしんこうきんちーふライセンス

ウェブサイトブログFAQニュース

diff --git a/doc/README.so.md b/doc/README.so.md index e3cfc6c8c..171aa903c 100644 --- a/doc/README.so.md +++ b/doc/README.so.md @@ -6,12 +6,22 @@

+ + + + + + +

+ +

+

Sawir-shaashadeedFaahfaahinWaxqabadkaKushubida iyo cusboonaysiintaKusoo KordhinUgu DeeqLaysinka

Website-kaMaqaaladaSu'aalaha Aalaa La-iswaydiiyoWarbaahinta

diff --git a/doc/README.sr.md b/doc/README.sr.md index 28445c547..22cb39457 100644 --- a/doc/README.sr.md +++ b/doc/README.sr.md @@ -9,12 +9,22 @@

+ + + + + + +

+ +

+

Снимци екранаПодржане услугеОписКарактеристикеИнсталација и ажурирањаДоприносДонацијаЛиценца

Веб-сајтБлогЧППШтампа

diff --git a/doc/README.tr.md b/doc/README.tr.md index 9d8419311..4d8cf11ea 100644 --- a/doc/README.tr.md +++ b/doc/README.tr.md @@ -6,12 +6,22 @@

+ + + + + + +

+ +

+

Ekran fotoğraflarıAçıklamaÖzelliklerKurulum ve güncellemelerKatkıda bulunmaBağışLisans

Web sitesiBlogSSSBasın

diff --git a/doc/README.zh_TW.md b/doc/README.zh_TW.md index 233f88be7..906967e8e 100644 --- a/doc/README.zh_TW.md +++ b/doc/README.zh_TW.md @@ -6,12 +6,22 @@

+ + + + + + +

+ +

+

截圖說明功能安裝與更新貢獻捐款授權憑證

網站部落格FAQ媒體

From 55bf74b4a79d509a26ba653172ef88443a9cbe46 Mon Sep 17 00:00:00 2001 From: David Asunmo <22662897+davidasunmo@users.noreply.github.com.> Date: Sat, 24 May 2025 02:15:45 +0100 Subject: [PATCH 07/18] Fix CI status badge --- README.md | 2 +- doc/README.ar.md | 2 +- doc/README.asm.md | 2 +- doc/README.de.md | 2 +- doc/README.es.md | 2 +- doc/README.fr.md | 2 +- doc/README.hi.md | 2 +- doc/README.it.md | 2 +- doc/README.ja.md | 2 +- doc/README.ko.md | 2 +- doc/README.pa.md | 2 +- doc/README.pl.md | 2 +- doc/README.pt_BR.md | 2 +- doc/README.ro.md | 2 +- doc/README.ru.md | 2 +- doc/README.ryu.md | 2 +- doc/README.so.md | 2 +- doc/README.sr.md | 2 +- doc/README.tr.md | 2 +- doc/README.zh_TW.md | 2 +- 20 files changed, 20 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index f4548cf9e..3cd7927af 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ - +

diff --git a/doc/README.ar.md b/doc/README.ar.md index d40c4c2c3..8747d3e2c 100644 --- a/doc/README.ar.md +++ b/doc/README.ar.md @@ -13,7 +13,7 @@ - +

diff --git a/doc/README.asm.md b/doc/README.asm.md index bd2058665..c2d919d09 100644 --- a/doc/README.asm.md +++ b/doc/README.asm.md @@ -13,7 +13,7 @@ - +

diff --git a/doc/README.de.md b/doc/README.de.md index 6d93ae0b0..03dd2b364 100644 --- a/doc/README.de.md +++ b/doc/README.de.md @@ -16,7 +16,7 @@ - +

diff --git a/doc/README.es.md b/doc/README.es.md index 2a229443c..338b3242a 100644 --- a/doc/README.es.md +++ b/doc/README.es.md @@ -13,7 +13,7 @@ - +

diff --git a/doc/README.fr.md b/doc/README.fr.md index a98086265..ee3621e27 100644 --- a/doc/README.fr.md +++ b/doc/README.fr.md @@ -16,7 +16,7 @@ - +

diff --git a/doc/README.hi.md b/doc/README.hi.md index 9d1e310f7..ed56fca14 100644 --- a/doc/README.hi.md +++ b/doc/README.hi.md @@ -13,7 +13,7 @@ - +

diff --git a/doc/README.it.md b/doc/README.it.md index 7b3b4ea9e..930959c77 100644 --- a/doc/README.it.md +++ b/doc/README.it.md @@ -13,7 +13,7 @@ - +

diff --git a/doc/README.ja.md b/doc/README.ja.md index 80a3f6316..19902d57e 100644 --- a/doc/README.ja.md +++ b/doc/README.ja.md @@ -13,7 +13,7 @@ - +

diff --git a/doc/README.ko.md b/doc/README.ko.md index ba93afd72..3c2f9f39e 100644 --- a/doc/README.ko.md +++ b/doc/README.ko.md @@ -13,7 +13,7 @@ - +

diff --git a/doc/README.pa.md b/doc/README.pa.md index 261fe5c4e..2dbc94c14 100644 --- a/doc/README.pa.md +++ b/doc/README.pa.md @@ -13,7 +13,7 @@ - +

diff --git a/doc/README.pl.md b/doc/README.pl.md index 7789cdd45..9d216c590 100644 --- a/doc/README.pl.md +++ b/doc/README.pl.md @@ -13,7 +13,7 @@ - +

diff --git a/doc/README.pt_BR.md b/doc/README.pt_BR.md index c61750f9e..d65fa9790 100644 --- a/doc/README.pt_BR.md +++ b/doc/README.pt_BR.md @@ -17,7 +17,7 @@ - +

diff --git a/doc/README.ro.md b/doc/README.ro.md index 4ae789389..5363ef7bc 100644 --- a/doc/README.ro.md +++ b/doc/README.ro.md @@ -13,7 +13,7 @@ - +

diff --git a/doc/README.ru.md b/doc/README.ru.md index 8da329bf5..894e5f2e0 100644 --- a/doc/README.ru.md +++ b/doc/README.ru.md @@ -13,7 +13,7 @@ - +

diff --git a/doc/README.ryu.md b/doc/README.ryu.md index d080076dc..8676f1bfd 100644 --- a/doc/README.ryu.md +++ b/doc/README.ryu.md @@ -13,7 +13,7 @@ - +

diff --git a/doc/README.so.md b/doc/README.so.md index 171aa903c..82e544d93 100644 --- a/doc/README.so.md +++ b/doc/README.so.md @@ -13,7 +13,7 @@ - +

diff --git a/doc/README.sr.md b/doc/README.sr.md index 22cb39457..d8b0fe435 100644 --- a/doc/README.sr.md +++ b/doc/README.sr.md @@ -16,7 +16,7 @@ - +

diff --git a/doc/README.tr.md b/doc/README.tr.md index 4d8cf11ea..c6610d97d 100644 --- a/doc/README.tr.md +++ b/doc/README.tr.md @@ -13,7 +13,7 @@ - +

diff --git a/doc/README.zh_TW.md b/doc/README.zh_TW.md index 906967e8e..04a8355cb 100644 --- a/doc/README.zh_TW.md +++ b/doc/README.zh_TW.md @@ -13,7 +13,7 @@ - +

From aa0b45c05f70b981107a09c7574fb0270f538f20 Mon Sep 17 00:00:00 2001 From: Diana Victoria Furrer Date: Fri, 30 May 2025 13:21:45 +0200 Subject: [PATCH 08/18] ChannelTab.equals fix comparison --- app/src/main/java/org/schabi/newpipe/settings/tabs/Tab.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/org/schabi/newpipe/settings/tabs/Tab.java b/app/src/main/java/org/schabi/newpipe/settings/tabs/Tab.java index 7e3f5d0c8..dd2ff0582 100644 --- a/app/src/main/java/org/schabi/newpipe/settings/tabs/Tab.java +++ b/app/src/main/java/org/schabi/newpipe/settings/tabs/Tab.java @@ -458,7 +458,7 @@ public abstract class Tab { final ChannelTab other = (ChannelTab) obj; return super.equals(obj) && channelServiceId == other.channelServiceId - && channelUrl.equals(other.channelName) + && channelUrl.equals(other.channelUrl) && channelName.equals(other.channelName); } From 86869f0a1415b67f82e2b69687a431679e596743 Mon Sep 17 00:00:00 2001 From: Diana Victoria Furrer Date: Fri, 30 May 2025 16:55:07 +0200 Subject: [PATCH 09/18] Copied SelectFeedGroupFragment from SelectChannelFragment --- .../settings/SelectFeedGroupFragment.java | 213 ++++++++++++++++++ 1 file changed, 213 insertions(+) create mode 100644 app/src/main/java/org/schabi/newpipe/settings/SelectFeedGroupFragment.java diff --git a/app/src/main/java/org/schabi/newpipe/settings/SelectFeedGroupFragment.java b/app/src/main/java/org/schabi/newpipe/settings/SelectFeedGroupFragment.java new file mode 100644 index 000000000..76ba57b96 --- /dev/null +++ b/app/src/main/java/org/schabi/newpipe/settings/SelectFeedGroupFragment.java @@ -0,0 +1,213 @@ +package org.schabi.newpipe.settings; + +import android.content.DialogInterface; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.ProgressBar; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.DialogFragment; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import org.schabi.newpipe.R; +import org.schabi.newpipe.database.subscription.SubscriptionEntity; +import org.schabi.newpipe.error.ErrorUtil; +import org.schabi.newpipe.local.subscription.SubscriptionManager; +import org.schabi.newpipe.util.ThemeHelper; +import org.schabi.newpipe.util.image.PicassoHelper; + +import java.util.List; +import java.util.Vector; + +import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers; +import io.reactivex.rxjava3.core.Observer; +import io.reactivex.rxjava3.disposables.Disposable; +import io.reactivex.rxjava3.schedulers.Schedulers; + +/** + * Created by Christian Schabesberger on 26.09.17. + * SelectChannelFragment.java is part of NewPipe. + *

+ * NewPipe is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ *

+ * NewPipe is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ *

+ * You should have received a copy of the GNU General Public License + * along with NewPipe. If not, see . + *

+ */ + +public class SelectFeedGroupFragment extends DialogFragment { + + private OnSelectedListener onSelectedListener = null; + private OnCancelListener onCancelListener = null; + + private ProgressBar progressBar; + private TextView emptyView; + private RecyclerView recyclerView; + + private List subscriptions = new Vector<>(); + + public void setOnSelectedListener(final OnSelectedListener listener) { + onSelectedListener = listener; + } + + public void setOnCancelListener(final OnCancelListener listener) { + onCancelListener = listener; + } + + /*////////////////////////////////////////////////////////////////////////// + // Init + //////////////////////////////////////////////////////////////////////////*/ + + @Override + public void onCreate(@Nullable final Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setStyle(STYLE_NO_TITLE, ThemeHelper.getMinWidthDialogTheme(requireContext())); + } + + @Override + public View onCreateView(@NonNull final LayoutInflater inflater, final ViewGroup container, + final Bundle savedInstanceState) { + final View v = inflater.inflate(R.layout.select_channel_fragment, container, false); + recyclerView = v.findViewById(R.id.items_list); + recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); + final SelectChannelAdapter channelAdapter = new SelectChannelAdapter(); + recyclerView.setAdapter(channelAdapter); + + progressBar = v.findViewById(R.id.progressBar); + emptyView = v.findViewById(R.id.empty_state_view); + progressBar.setVisibility(View.VISIBLE); + recyclerView.setVisibility(View.GONE); + emptyView.setVisibility(View.GONE); + + + final SubscriptionManager subscriptionManager = new SubscriptionManager(requireContext()); + subscriptionManager.subscriptions().toObservable() + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(getSubscriptionObserver()); + + return v; + } + + /*////////////////////////////////////////////////////////////////////////// + // Handle actions + //////////////////////////////////////////////////////////////////////////*/ + + @Override + public void onCancel(@NonNull final DialogInterface dialogInterface) { + super.onCancel(dialogInterface); + if (onCancelListener != null) { + onCancelListener.onCancel(); + } + } + + private void clickedItem(final int position) { + if (onSelectedListener != null) { + final SubscriptionEntity entry = subscriptions.get(position); + onSelectedListener + .onChannelSelected(entry.getServiceId(), entry.getUrl(), entry.getName()); + } + dismiss(); + } + + /*////////////////////////////////////////////////////////////////////////// + // Item handling + //////////////////////////////////////////////////////////////////////////*/ + + private void displayChannels(final List newSubscriptions) { + this.subscriptions = newSubscriptions; + progressBar.setVisibility(View.GONE); + if (newSubscriptions.isEmpty()) { + emptyView.setVisibility(View.VISIBLE); + return; + } + recyclerView.setVisibility(View.VISIBLE); + + } + + private Observer> getSubscriptionObserver() { + return new Observer>() { + @Override + public void onSubscribe(@NonNull final Disposable disposable) { } + + @Override + public void onNext(@NonNull final List newSubscriptions) { + displayChannels(newSubscriptions); + } + + @Override + public void onError(@NonNull final Throwable exception) { + ErrorUtil.showUiErrorSnackbar(SelectFeedGroupFragment.this, + "Loading subscription", exception); + } + + @Override + public void onComplete() { } + }; + } + + /*////////////////////////////////////////////////////////////////////////// + // Interfaces + //////////////////////////////////////////////////////////////////////////*/ + + public interface OnSelectedListener { + void onChannelSelected(int serviceId, String url, String name); + } + + public interface OnCancelListener { + void onCancel(); + } + + private class SelectChannelAdapter + extends RecyclerView.Adapter { + @NonNull + @Override + public SelectChannelItemHolder onCreateViewHolder(final ViewGroup parent, + final int viewType) { + final View item = LayoutInflater.from(parent.getContext()) + .inflate(R.layout.select_channel_item, parent, false); + return new SelectChannelItemHolder(item); + } + + @Override + public void onBindViewHolder(final SelectChannelItemHolder holder, final int position) { + final SubscriptionEntity entry = subscriptions.get(position); + holder.titleView.setText(entry.getName()); + holder.view.setOnClickListener(view -> clickedItem(position)); + PicassoHelper.loadAvatar(entry.getAvatarUrl()).into(holder.thumbnailView); + } + + @Override + public int getItemCount() { + return subscriptions.size(); + } + + public class SelectChannelItemHolder extends RecyclerView.ViewHolder { + public final View view; + final ImageView thumbnailView; + final TextView titleView; + SelectChannelItemHolder(final View v) { + super(v); + this.view = v; + thumbnailView = v.findViewById(R.id.itemThumbnailView); + titleView = v.findViewById(R.id.itemTitleView); + } + } + } +} From e6c4690e7da2679f9700816f4d9288442b4782c1 Mon Sep 17 00:00:00 2001 From: Diana Victoria Furrer Date: Fri, 30 May 2025 17:07:19 +0200 Subject: [PATCH 10/18] # Copied Layouts Copied select_channel_fragment to select_feed_group_fragment Copied select_channel_item to select_feed_group_item # Change Replaced the Layout references in the new Class SelectFeedGroupFragment --- .../settings/SelectFeedGroupFragment.java | 4 +- .../res/layout/select_feed_group_fragment.xml | 42 +++++++++++++++++++ .../res/layout/select_feed_group_item.xml | 39 +++++++++++++++++ 3 files changed, 83 insertions(+), 2 deletions(-) create mode 100644 app/src/main/res/layout/select_feed_group_fragment.xml create mode 100644 app/src/main/res/layout/select_feed_group_item.xml diff --git a/app/src/main/java/org/schabi/newpipe/settings/SelectFeedGroupFragment.java b/app/src/main/java/org/schabi/newpipe/settings/SelectFeedGroupFragment.java index 76ba57b96..c6cc28a60 100644 --- a/app/src/main/java/org/schabi/newpipe/settings/SelectFeedGroupFragment.java +++ b/app/src/main/java/org/schabi/newpipe/settings/SelectFeedGroupFragment.java @@ -83,7 +83,7 @@ public class SelectFeedGroupFragment extends DialogFragment { @Override public View onCreateView(@NonNull final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { - final View v = inflater.inflate(R.layout.select_channel_fragment, container, false); + final View v = inflater.inflate(R.layout.select_feed_group_fragment, container, false); recyclerView = v.findViewById(R.id.items_list); recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); final SelectChannelAdapter channelAdapter = new SelectChannelAdapter(); @@ -181,7 +181,7 @@ public class SelectFeedGroupFragment extends DialogFragment { public SelectChannelItemHolder onCreateViewHolder(final ViewGroup parent, final int viewType) { final View item = LayoutInflater.from(parent.getContext()) - .inflate(R.layout.select_channel_item, parent, false); + .inflate(R.layout.select_feed_group_item, parent, false); return new SelectChannelItemHolder(item); } diff --git a/app/src/main/res/layout/select_feed_group_fragment.xml b/app/src/main/res/layout/select_feed_group_fragment.xml new file mode 100644 index 000000000..bd62aefea --- /dev/null +++ b/app/src/main/res/layout/select_feed_group_fragment.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + diff --git a/app/src/main/res/layout/select_feed_group_item.xml b/app/src/main/res/layout/select_feed_group_item.xml new file mode 100644 index 000000000..c5fd51bb8 --- /dev/null +++ b/app/src/main/res/layout/select_feed_group_item.xml @@ -0,0 +1,39 @@ + + + + + + + + From 7c3989ff93cf709f2319b5fd5c2ffabd486f56e3 Mon Sep 17 00:00:00 2001 From: Diana Victoria Furrer Date: Fri, 30 May 2025 17:45:51 +0200 Subject: [PATCH 11/18] # Change Adjusted the new Class SelectFeedGroupFragment for its Role - Renamed Variables - adjusted Imports - adjusted Interface with FeedGroupEntity Values --- .../settings/SelectFeedGroupFragment.java | 61 ++++++++++--------- 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/settings/SelectFeedGroupFragment.java b/app/src/main/java/org/schabi/newpipe/settings/SelectFeedGroupFragment.java index c6cc28a60..662379369 100644 --- a/app/src/main/java/org/schabi/newpipe/settings/SelectFeedGroupFragment.java +++ b/app/src/main/java/org/schabi/newpipe/settings/SelectFeedGroupFragment.java @@ -15,12 +15,12 @@ import androidx.fragment.app.DialogFragment; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; +import org.schabi.newpipe.NewPipeDatabase; import org.schabi.newpipe.R; -import org.schabi.newpipe.database.subscription.SubscriptionEntity; +import org.schabi.newpipe.database.AppDatabase; +import org.schabi.newpipe.database.feed.model.FeedGroupEntity; import org.schabi.newpipe.error.ErrorUtil; -import org.schabi.newpipe.local.subscription.SubscriptionManager; import org.schabi.newpipe.util.ThemeHelper; -import org.schabi.newpipe.util.image.PicassoHelper; import java.util.List; import java.util.Vector; @@ -60,7 +60,7 @@ public class SelectFeedGroupFragment extends DialogFragment { private TextView emptyView; private RecyclerView recyclerView; - private List subscriptions = new Vector<>(); + private List feedGroups = new Vector<>(); public void setOnSelectedListener(final OnSelectedListener listener) { onSelectedListener = listener; @@ -86,8 +86,8 @@ public class SelectFeedGroupFragment extends DialogFragment { final View v = inflater.inflate(R.layout.select_feed_group_fragment, container, false); recyclerView = v.findViewById(R.id.items_list); recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); - final SelectChannelAdapter channelAdapter = new SelectChannelAdapter(); - recyclerView.setAdapter(channelAdapter); + final SelectFeedGroupAdapter feedGroupAdapter = new SelectFeedGroupAdapter(); + recyclerView.setAdapter(feedGroupAdapter); progressBar = v.findViewById(R.id.progressBar); emptyView = v.findViewById(R.id.empty_state_view); @@ -96,11 +96,11 @@ public class SelectFeedGroupFragment extends DialogFragment { emptyView.setVisibility(View.GONE); - final SubscriptionManager subscriptionManager = new SubscriptionManager(requireContext()); - subscriptionManager.subscriptions().toObservable() + final AppDatabase database = NewPipeDatabase.getInstance(requireContext()); + database.feedGroupDAO().getAll().toObservable() .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) - .subscribe(getSubscriptionObserver()); + .subscribe(getFeedGroupObserver()); return v; } @@ -119,9 +119,10 @@ public class SelectFeedGroupFragment extends DialogFragment { private void clickedItem(final int position) { if (onSelectedListener != null) { - final SubscriptionEntity entry = subscriptions.get(position); + final FeedGroupEntity entry = feedGroups.get(position); onSelectedListener - .onChannelSelected(entry.getServiceId(), entry.getUrl(), entry.getName()); + .onFeedGroupSelected(entry.getUid(), entry.getName(), + entry.getIcon().getDrawableResource()); } dismiss(); } @@ -130,10 +131,10 @@ public class SelectFeedGroupFragment extends DialogFragment { // Item handling //////////////////////////////////////////////////////////////////////////*/ - private void displayChannels(final List newSubscriptions) { - this.subscriptions = newSubscriptions; + private void displayFeedGroups(final List newFeedGroups) { + this.feedGroups = newFeedGroups; progressBar.setVisibility(View.GONE); - if (newSubscriptions.isEmpty()) { + if (newFeedGroups.isEmpty()) { emptyView.setVisibility(View.VISIBLE); return; } @@ -141,20 +142,20 @@ public class SelectFeedGroupFragment extends DialogFragment { } - private Observer> getSubscriptionObserver() { - return new Observer>() { + private Observer> getFeedGroupObserver() { + return new Observer>() { @Override public void onSubscribe(@NonNull final Disposable disposable) { } @Override - public void onNext(@NonNull final List newSubscriptions) { - displayChannels(newSubscriptions); + public void onNext(@NonNull final List newGroups) { + displayFeedGroups(newGroups); } @Override public void onError(@NonNull final Throwable exception) { ErrorUtil.showUiErrorSnackbar(SelectFeedGroupFragment.this, - "Loading subscription", exception); + "Loading Feed Groups", exception); } @Override @@ -167,42 +168,42 @@ public class SelectFeedGroupFragment extends DialogFragment { //////////////////////////////////////////////////////////////////////////*/ public interface OnSelectedListener { - void onChannelSelected(int serviceId, String url, String name); + void onFeedGroupSelected(Long groupId, String name, int icon); } public interface OnCancelListener { void onCancel(); } - private class SelectChannelAdapter - extends RecyclerView.Adapter { + private class SelectFeedGroupAdapter + extends RecyclerView.Adapter { @NonNull @Override - public SelectChannelItemHolder onCreateViewHolder(final ViewGroup parent, + public SelectFeedGroupItemHolder onCreateViewHolder(final ViewGroup parent, final int viewType) { final View item = LayoutInflater.from(parent.getContext()) .inflate(R.layout.select_feed_group_item, parent, false); - return new SelectChannelItemHolder(item); + return new SelectFeedGroupItemHolder(item); } @Override - public void onBindViewHolder(final SelectChannelItemHolder holder, final int position) { - final SubscriptionEntity entry = subscriptions.get(position); + public void onBindViewHolder(final SelectFeedGroupItemHolder holder, final int position) { + final FeedGroupEntity entry = feedGroups.get(position); holder.titleView.setText(entry.getName()); holder.view.setOnClickListener(view -> clickedItem(position)); - PicassoHelper.loadAvatar(entry.getAvatarUrl()).into(holder.thumbnailView); + holder.thumbnailView.setImageResource(entry.getIcon().getDrawableResource()); } @Override public int getItemCount() { - return subscriptions.size(); + return feedGroups.size(); } - public class SelectChannelItemHolder extends RecyclerView.ViewHolder { + public class SelectFeedGroupItemHolder extends RecyclerView.ViewHolder { public final View view; final ImageView thumbnailView; final TextView titleView; - SelectChannelItemHolder(final View v) { + SelectFeedGroupItemHolder(final View v) { super(v); this.view = v; thumbnailView = v.findViewById(R.id.itemThumbnailView); From 436626fa8394a79c36ee71b7150f83cb39b88095 Mon Sep 17 00:00:00 2001 From: Diana Victoria Furrer Date: Fri, 30 May 2025 17:54:49 +0200 Subject: [PATCH 12/18] # Change Adjusted select_feed_group_fragment Layout - reference select_feed_group_item layout - use new Strings Added strings: - select_a_feed_group - no_feed_group_created_yet --- app/src/main/res/layout/select_feed_group_fragment.xml | 6 +++--- app/src/main/res/values/strings.xml | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/res/layout/select_feed_group_fragment.xml b/app/src/main/res/layout/select_feed_group_fragment.xml index bd62aefea..bb17d5f6e 100644 --- a/app/src/main/res/layout/select_feed_group_fragment.xml +++ b/app/src/main/res/layout/select_feed_group_fragment.xml @@ -15,14 +15,14 @@ android:layout_marginEnd="5dp" android:layout_marginRight="5dp" android:layout_marginBottom="10dp" - android:text="@string/select_a_channel" + android:text="@string/select_a_feed_group" android:textAppearance="?android:attr/textAppearanceLarge" /> + tools:listitem="@layout/select_feed_group_item" /> Do you want to also import settings? Could not load comments The language will change once the app is restarted + Select a feed group + No feed group created yet Trending Top 50 From f8ed8e575ed05c832f28ddaa3aba675004a3df2e Mon Sep 17 00:00:00 2001 From: Diana Victoria Furrer Date: Fri, 30 May 2025 20:47:37 +0200 Subject: [PATCH 13/18] # Change Added FEEDGROUP Tab Code to - ChooseTabsFragment - Tab Added strings: - feed_group_page_summary --- .../settings/tabs/ChooseTabsFragment.java | 17 ++++ .../org/schabi/newpipe/settings/tabs/Tab.java | 94 ++++++++++++++++++- app/src/main/res/values/strings.xml | 1 + 3 files changed, 111 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/schabi/newpipe/settings/tabs/ChooseTabsFragment.java b/app/src/main/java/org/schabi/newpipe/settings/tabs/ChooseTabsFragment.java index 289c824ba..585d00260 100644 --- a/app/src/main/java/org/schabi/newpipe/settings/tabs/ChooseTabsFragment.java +++ b/app/src/main/java/org/schabi/newpipe/settings/tabs/ChooseTabsFragment.java @@ -34,6 +34,7 @@ import org.schabi.newpipe.error.UserAction; import org.schabi.newpipe.settings.SelectChannelFragment; import org.schabi.newpipe.settings.SelectKioskFragment; import org.schabi.newpipe.settings.SelectPlaylistFragment; +import org.schabi.newpipe.settings.SelectFeedGroupFragment; import org.schabi.newpipe.settings.tabs.AddTabDialog.ChooseTabListItem; import org.schabi.newpipe.util.ThemeHelper; @@ -203,6 +204,14 @@ public class ChooseTabsFragment extends Fragment { }); selectPlaylistFragment.show(getParentFragmentManager(), "select_playlist"); return; + case FEEDGROUP: + final SelectFeedGroupFragment selectFeedGroupFragment = + new SelectFeedGroupFragment(); + selectFeedGroupFragment.setOnSelectedListener( + (groupId, name, iconId) -> + addTab(new Tab.FeedGroupTab(groupId, name, iconId))); + selectFeedGroupFragment.show(getParentFragmentManager(), "select_feed_group"); + return; default: addTab(type.getTab()); break; @@ -244,6 +253,11 @@ public class ChooseTabsFragment extends Fragment { getString(R.string.playlist_page_summary), tab.getTabIconRes(context))); break; + case FEEDGROUP: + returnList.add(new ChooseTabListItem(tab.getTabId(), + getString(R.string.feed_group_page_summary), + tab.getTabIconRes(context))); + break; default: if (!tabList.contains(tab)) { returnList.add(new ChooseTabListItem(context, tab)); @@ -396,6 +410,9 @@ public class ChooseTabsFragment extends Fragment { ? getString(R.string.local) : getNameOfServiceById(serviceId); return serviceName + "/" + tab.getTabName(requireContext()); + case FEEDGROUP: + return getString(R.string.feed_groups_header_title) + + "/" + tab.getTabName(requireContext()); default: return tab.getTabName(requireContext()); } diff --git a/app/src/main/java/org/schabi/newpipe/settings/tabs/Tab.java b/app/src/main/java/org/schabi/newpipe/settings/tabs/Tab.java index 7e3f5d0c8..d44badd68 100644 --- a/app/src/main/java/org/schabi/newpipe/settings/tabs/Tab.java +++ b/app/src/main/java/org/schabi/newpipe/settings/tabs/Tab.java @@ -93,6 +93,8 @@ public abstract class Tab { return new ChannelTab(jsonObject); case PLAYLIST: return new PlaylistTab(jsonObject); + case FEEDGROUP: + return new FeedGroupTab(jsonObject); } } @@ -162,7 +164,8 @@ public abstract class Tab { HISTORY(new HistoryTab()), KIOSK(new KioskTab()), CHANNEL(new ChannelTab()), - PLAYLIST(new PlaylistTab()); + PLAYLIST(new PlaylistTab()), + FEEDGROUP(new FeedGroupTab()); private final Tab tab; @@ -652,4 +655,93 @@ public abstract class Tab { return playlistType; } } + public static class FeedGroupTab extends Tab { + public static final int ID = 9; + private static final String JSON_FEED_GROUP_ID_KEY = "feed_group_id"; + private static final String JSON_FEED_GROUP_NAME_KEY = "feed_group_name"; + private static final String JSON_FEED_GROUP_ICON_KEY = "feed_group_icon"; + private Long feedGroupId; + private String feedGroupName; + private int iconId; + + private FeedGroupTab() { + this((long) -1, NO_NAME, R.drawable.ic_asterisk); + } + + public FeedGroupTab(final Long feedGroupId, final String feedGroupName, + final int iconId) { + this.feedGroupId = feedGroupId; + this.feedGroupName = feedGroupName; + this.iconId = iconId; + + } + + public FeedGroupTab(final JsonObject jsonObject) { + super(jsonObject); + } + + @Override + public int getTabId() { + return ID; + } + + @Override + public String getTabName(final Context context) { + return feedGroupName; + } + + @DrawableRes + @Override + public int getTabIconRes(final Context context) { + return this.iconId; + } + + @Override + public FeedFragment getFragment(final Context context) { + return FeedFragment.newInstance(feedGroupId, feedGroupName); + } + + @Override + protected void writeDataToJson(final JsonStringWriter writerSink) { + writerSink.value(JSON_FEED_GROUP_ID_KEY, feedGroupId) + .value(JSON_FEED_GROUP_NAME_KEY, feedGroupName) + .value(JSON_FEED_GROUP_ICON_KEY, iconId); + } + + @Override + protected void readDataFromJson(final JsonObject jsonObject) { + feedGroupId = jsonObject.getLong(JSON_FEED_GROUP_ID_KEY, -1); + feedGroupName = jsonObject.getString(JSON_FEED_GROUP_NAME_KEY, NO_NAME); + iconId = jsonObject.getInt(JSON_FEED_GROUP_ICON_KEY, R.drawable.ic_asterisk); + } + + @Override + public boolean equals(final Object obj) { + if (!(obj instanceof FeedGroupTab)) { + return false; + } + final FeedGroupTab other = (FeedGroupTab) obj; + return super.equals(obj) + && feedGroupId.equals(other.feedGroupId) + && feedGroupName.equals(other.feedGroupName) + && iconId == other.iconId; + } + + @Override + public int hashCode() { + return Objects.hash(getTabId(), feedGroupId, feedGroupName, iconId); + } + + public Long getFeedGroupId() { + return feedGroupId; + } + + public String getFeedGroupName() { + return feedGroupName; + } + + public int getIconId() { + return iconId; + } + } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index b90482812..1015dea08 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -689,6 +689,7 @@ What\'s New + Channel group page Channel groups Feed last updated: %s Not loaded: %d From 279caac91529d40b611581422591ed81801cddff Mon Sep 17 00:00:00 2001 From: Diana Victoria Furrer Date: Fri, 30 May 2025 21:00:37 +0200 Subject: [PATCH 14/18] # Change Layout select_feed_group_item (FeedGroup Picker in the Settings) Remove rounded style from the icons --- app/src/main/res/layout/select_feed_group_item.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/main/res/layout/select_feed_group_item.xml b/app/src/main/res/layout/select_feed_group_item.xml index c5fd51bb8..e40fe6727 100644 --- a/app/src/main/res/layout/select_feed_group_item.xml +++ b/app/src/main/res/layout/select_feed_group_item.xml @@ -20,7 +20,6 @@ android:layout_marginStart="3dp" android:layout_marginRight="8dp" android:src="@drawable/placeholder_person" - app:shapeAppearance="@style/CircularImageView" tools:ignore="RtlHardcoded" /> Date: Sat, 31 May 2025 01:30:49 +0200 Subject: [PATCH 15/18] # Fixed Feed Group Titlebar - use default fragment_feed_title for TabName - only clear FeedFragment bar subtitle when it matches the groupName to clear. --- .../org/schabi/newpipe/local/feed/FeedFragment.kt | 15 +++++++++++++-- .../org/schabi/newpipe/settings/tabs/Tab.java | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/local/feed/FeedFragment.kt b/app/src/main/java/org/schabi/newpipe/local/feed/FeedFragment.kt index 61eb4c8d2..91f98f5d2 100644 --- a/app/src/main/java/org/schabi/newpipe/local/feed/FeedFragment.kt +++ b/app/src/main/java/org/schabi/newpipe/local/feed/FeedFragment.kt @@ -269,7 +269,12 @@ class FeedFragment : BaseStateFragment() { override fun onDestroyOptionsMenu() { super.onDestroyOptionsMenu() - activity?.supportActionBar?.subtitle = null + if ( + (groupName != "") && + (activity?.supportActionBar?.subtitle == groupName) + ) { + activity?.supportActionBar?.subtitle = null + } } override fun onDestroy() { @@ -281,7 +286,13 @@ class FeedFragment : BaseStateFragment() { } super.onDestroy() - activity?.supportActionBar?.subtitle = null + + if ( + (groupName != "") && + (activity?.supportActionBar?.subtitle == groupName) + ) { + activity?.supportActionBar?.subtitle = null + } } override fun onDestroyView() { diff --git a/app/src/main/java/org/schabi/newpipe/settings/tabs/Tab.java b/app/src/main/java/org/schabi/newpipe/settings/tabs/Tab.java index d44badd68..83abf87d4 100644 --- a/app/src/main/java/org/schabi/newpipe/settings/tabs/Tab.java +++ b/app/src/main/java/org/schabi/newpipe/settings/tabs/Tab.java @@ -687,7 +687,7 @@ public abstract class Tab { @Override public String getTabName(final Context context) { - return feedGroupName; + return context.getString(R.string.fragment_feed_title); } @DrawableRes From 712724211cac5a4ba7bfba927a7940cc1018f541 Mon Sep 17 00:00:00 2001 From: Diana Victoria Furrer Date: Sat, 31 May 2025 01:41:06 +0200 Subject: [PATCH 16/18] added FeedGroup to Tab Settings UnitTest --- .../newpipe/settings/tabs/TabsJsonHelperTest.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/src/test/java/org/schabi/newpipe/settings/tabs/TabsJsonHelperTest.java b/app/src/test/java/org/schabi/newpipe/settings/tabs/TabsJsonHelperTest.java index bddb130fe..561a8cbec 100644 --- a/app/src/test/java/org/schabi/newpipe/settings/tabs/TabsJsonHelperTest.java +++ b/app/src/test/java/org/schabi/newpipe/settings/tabs/TabsJsonHelperTest.java @@ -93,9 +93,11 @@ public class TabsJsonHelperTest { final Tab.ChannelTab channelTab = new Tab.ChannelTab( 666, "https://example.org", "testName"); final Tab.KioskTab kioskTab = new Tab.KioskTab(123, "trending_key"); + final Tab.FeedGroupTab feedGroupTab = new Tab.FeedGroupTab( + 1L, "x", 123); final List tabs = Arrays.asList( - blankTab, defaultKioskTab, subscriptionsTab, channelTab, kioskTab); + blankTab, defaultKioskTab, subscriptionsTab, channelTab, kioskTab, feedGroupTab); final String returnedJson = TabsJsonHelper.getJsonToSave(tabs); // Reading @@ -130,5 +132,13 @@ public class TabsJsonHelperTest { assertEquals(kioskTab.getTabId(), kioskTabFromReturnedJson.getTabId()); assertEquals(kioskTab.getKioskServiceId(), kioskTabFromReturnedJson.getKioskServiceId()); assertEquals(kioskTab.getKioskId(), kioskTabFromReturnedJson.getKioskId()); + + final Tab.FeedGroupTab grpTabFromReturnedJson = requireNonNull( + (Tab.FeedGroupTab) Tab.from((JsonObject) tabsFromArray.get(5) + )); + assertEquals(feedGroupTab.getTabId(), grpTabFromReturnedJson.getTabId()); + assertEquals(feedGroupTab.getFeedGroupId(), grpTabFromReturnedJson.getFeedGroupId()); + assertEquals(feedGroupTab.getIconId(), grpTabFromReturnedJson.getIconId()); + assertEquals(feedGroupTab.getFeedGroupName(), grpTabFromReturnedJson.getFeedGroupName()); } } From 205d18f4c4763e0dfbc8f516c713d93f3c8ae4ea Mon Sep 17 00:00:00 2001 From: Diana Victoria Furrer Date: Sat, 31 May 2025 14:11:26 +0200 Subject: [PATCH 17/18] Use GroupName for the Settings Text. The Tabname displays the default Feed title. --- .../org/schabi/newpipe/settings/tabs/ChooseTabsFragment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/org/schabi/newpipe/settings/tabs/ChooseTabsFragment.java b/app/src/main/java/org/schabi/newpipe/settings/tabs/ChooseTabsFragment.java index 585d00260..738a9c926 100644 --- a/app/src/main/java/org/schabi/newpipe/settings/tabs/ChooseTabsFragment.java +++ b/app/src/main/java/org/schabi/newpipe/settings/tabs/ChooseTabsFragment.java @@ -412,7 +412,7 @@ public class ChooseTabsFragment extends Fragment { return serviceName + "/" + tab.getTabName(requireContext()); case FEEDGROUP: return getString(R.string.feed_groups_header_title) - + "/" + tab.getTabName(requireContext()); + + "/" + ((Tab.FeedGroupTab) tab).getFeedGroupName(); default: return tab.getTabName(requireContext()); } From 571b7bc74bcb35153532efd4e2430e6e6537a422 Mon Sep 17 00:00:00 2001 From: Stypox Date: Wed, 4 Jun 2025 11:18:04 +0200 Subject: [PATCH 18/18] Improve layout of select_feed_group_item --- app/src/main/res/layout/select_feed_group_item.xml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/main/res/layout/select_feed_group_item.xml b/app/src/main/res/layout/select_feed_group_item.xml index e40fe6727..ccce555f5 100644 --- a/app/src/main/res/layout/select_feed_group_item.xml +++ b/app/src/main/res/layout/select_feed_group_item.xml @@ -1,6 +1,5 @@