diff --git a/README.md b/README.md index bf1317f17..3cd7927af 100644 --- a/README.md +++ b/README.md @@ -8,13 +8,23 @@
+ + +Screenshots • Supported Services • Description • Features • Installation and updates • Contribution • Donate • License
diff --git a/app/src/main/java/org/schabi/newpipe/MainActivity.java b/app/src/main/java/org/schabi/newpipe/MainActivity.java index 95b1f4164..bf23d3d70 100644 --- a/app/src/main/java/org/schabi/newpipe/MainActivity.java +++ b/app/src/main/java/org/schabi/newpipe/MainActivity.java @@ -122,7 +122,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 //////////////////////////////////////////////////////////////////////////*/ @@ -152,6 +155,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; @@ -195,16 +200,29 @@ public class MainActivity extends AppCompatActivity { super.onPostCreate(savedInstanceState); final App app = App.getInstance(); - 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(); @@ -504,13 +522,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); } @@ -518,7 +534,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)) + } } /** 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 f976f44aa..038f2bed1 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 @@ -274,7 +274,12 @@ class FeedFragment : BaseStateFragment+ * 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
@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(
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..bb17d5f6e
--- /dev/null
+++ b/app/src/main/res/layout/select_feed_group_fragment.xml
@@ -0,0 +1,42 @@
+
+لقطات الشاشة • الخدمات المدعومة • وصف • سمات • التثبيت والتحديثات • مساهمة • التبرعات • رخصة
موقع • مدونة • الأسئلة الشائعة • إضغط
diff --git a/doc/README.asm.md b/doc/README.asm.md index 8042b3db9..c2d919d09 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 5b3275d07..03dd2b364 100644 --- a/doc/README.de.md +++ b/doc/README.de.md @@ -9,11 +9,22 @@
+ + +Screenshots • Unterstützte Dienste • Beschreibung • Features • Installation und Updates • Beitrag • Spenden • Lizenz
Website • Blog • FAQ • Über NewPipe
diff --git a/doc/README.es.md b/doc/README.es.md index 8ec58e771..338b3242a 100644 --- a/doc/README.es.md +++ b/doc/README.es.md @@ -6,11 +6,22 @@ + + +Capturas de Pantalla • Descripción • Características • Instalación y Actualizaciones • Contribución • Donar • Licencia
diff --git a/doc/README.fr.md b/doc/README.fr.md index 772f4a1ae..ee3621e27 100644 --- a/doc/README.fr.md +++ b/doc/README.fr.md @@ -9,11 +9,22 @@ + + +Captures d'écran • Services Supportés • Description • Fonctionnalités • Installation et mises à jour • Contribuer • Dons • Licence
diff --git a/doc/README.hi.md b/doc/README.hi.md index 37ae71a4a..ed56fca14 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 6c227ea2f..930959c77 100644 --- a/doc/README.it.md +++ b/doc/README.it.md @@ -6,11 +6,22 @@ + + +Screenshot • Servizi Supportati • Descrizione • Funzionalità • Installazione e aggiornamenti • Contribuire • Donare • Licenza
diff --git a/doc/README.ja.md b/doc/README.ja.md index e8f708a8a..19902d57e 100644 --- a/doc/README.ja.md +++ b/doc/README.ja.md @@ -6,11 +6,22 @@ + + +スクリーンショット • 説明 • 機能 • インストールと更新 • 貢献 • 寄付 • ライセンス
diff --git a/doc/README.ko.md b/doc/README.ko.md index 3215bd713..3c2f9f39e 100644 --- a/doc/README.ko.md +++ b/doc/README.ko.md @@ -6,11 +6,22 @@ + + +Screenshots • Description • Features • Updates • Contribution • Donate • License
diff --git a/doc/README.pa.md b/doc/README.pa.md index 0e254adf1..2dbc94c14 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 96d493153..9d216c590 100644 --- a/doc/README.pl.md +++ b/doc/README.pl.md @@ -6,11 +6,22 @@ + + +Screenshoty • Opis • Funkcje • Instalacja i aktualizacje • Wkład • Wesprzyj • Licencja
diff --git a/doc/README.pt_BR.md b/doc/README.pt_BR.md index da6c4fce6..d65fa9790 100644 --- a/doc/README.pt_BR.md +++ b/doc/README.pt_BR.md @@ -10,11 +10,22 @@ + + +Screenshots • Serviços Suportados • Descrição • Recursos • Instalação e atualizações • Contribuições • Doar • Licença
diff --git a/doc/README.ro.md b/doc/README.ro.md index 29c1d3666..5363ef7bc 100644 --- a/doc/README.ro.md +++ b/doc/README.ro.md @@ -6,11 +6,22 @@ + + +Capturi de ecran • Descriere • Funcţii • Instalare şi actualizări • Contribuţie • Donaţi • Licenţă
diff --git a/doc/README.ru.md b/doc/README.ru.md index e3c76d329..894e5f2e0 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 2e24aa41c..8676f1bfd 100644 --- a/doc/README.ryu.md +++ b/doc/README.ryu.md @@ -6,11 +6,22 @@ + + +スクリーンショット • しちめい • ちぬー • インストールとぅこうしん • こうきん • ちーふ • ライセンス
diff --git a/doc/README.so.md b/doc/README.so.md index 640feae60..82e544d93 100644 --- a/doc/README.so.md +++ b/doc/README.so.md @@ -6,11 +6,22 @@ + + +Sawir-shaashadeed • Faahfaahin • Waxqabadka • Kushubida iyo cusboonaysiinta • Kusoo Kordhin • Ugu Deeq • Laysinka
Website-ka • Maqaalada • Su'aalaha Aalaa La-iswaydiiyo • Warbaahinta
diff --git a/doc/README.sr.md b/doc/README.sr.md index 1a9118638..d8b0fe435 100644 --- a/doc/README.sr.md +++ b/doc/README.sr.md @@ -9,11 +9,22 @@ + + +Снимци екрана • Подржане услуге • Опис • Карактеристике • Инсталација и ажурирања • Допринос • Донација • Лиценца
Веб-сајт • Блог • ЧПП • Штампа
diff --git a/doc/README.tr.md b/doc/README.tr.md index bbdd85f76..c6610d97d 100644 --- a/doc/README.tr.md +++ b/doc/README.tr.md @@ -6,11 +6,22 @@ + + +Ekran fotoğrafları • Açıklama • Özellikler • Kurulum ve güncellemeler • Katkıda bulunma • Bağış • Lisans
Web sitesi • Blog • SSS • Basın
diff --git a/doc/README.zh_TW.md b/doc/README.zh_TW.md index 760a43ad5..04a8355cb 100644 --- a/doc/README.zh_TW.md +++ b/doc/README.zh_TW.md @@ -6,11 +6,22 @@ + + +