From 9e8671e5beb851f4bc2b5c92013f52040fed8461 Mon Sep 17 00:00:00 2001 From: Uwe Trottmann Date: Thu, 17 Apr 2014 15:25:17 +0200 Subject: [PATCH 1/5] Allow all users to add two extensions. - Display upgrade hint if two extensions are already added. --- .../seriesguide/adapters/ExtensionsAdapter.java | 9 +++++++++ .../extensions/ExtensionsConfigurationFragment.java | 10 +++++----- SeriesGuide/src/main/res/layout/item_extension_add.xml | 9 +++++++++ SeriesGuide/src/main/res/values/strings.xml | 1 + 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/SeriesGuide/src/main/java/com/battlelancer/seriesguide/adapters/ExtensionsAdapter.java b/SeriesGuide/src/main/java/com/battlelancer/seriesguide/adapters/ExtensionsAdapter.java index b01eecc333..9471e7df7b 100644 --- a/SeriesGuide/src/main/java/com/battlelancer/seriesguide/adapters/ExtensionsAdapter.java +++ b/SeriesGuide/src/main/java/com/battlelancer/seriesguide/adapters/ExtensionsAdapter.java @@ -31,6 +31,7 @@ import com.battlelancer.seriesguide.R; import com.battlelancer.seriesguide.api.SeriesGuideExtension; import com.battlelancer.seriesguide.extensions.ExtensionManager; +import com.battlelancer.seriesguide.extensions.ExtensionsConfigurationFragment; import com.battlelancer.seriesguide.util.Utils; import de.greenrobot.event.EventBus; @@ -84,6 +85,14 @@ public View getView(final int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = mLayoutInflater.inflate(LAYOUT_ADD, parent, false); } + // warn non-supporters that they only can add a few extensions + boolean isAtLimit = + getCount() - 1 == ExtensionsConfigurationFragment.EXTENSION_LIMIT_FREE + && !Utils.hasAccessToX(getContext()); + convertView.findViewById(R.id.textViewItemExtensionAddLabel) + .setVisibility(isAtLimit ? View.GONE : View.VISIBLE); + convertView.findViewById(R.id.textViewItemExtensionAddLimit) + .setVisibility(isAtLimit ? View.VISIBLE : View.GONE); return convertView; } diff --git a/SeriesGuide/src/main/java/com/battlelancer/seriesguide/extensions/ExtensionsConfigurationFragment.java b/SeriesGuide/src/main/java/com/battlelancer/seriesguide/extensions/ExtensionsConfigurationFragment.java index b64bc3bd04..288a974370 100644 --- a/SeriesGuide/src/main/java/com/battlelancer/seriesguide/extensions/ExtensionsConfigurationFragment.java +++ b/SeriesGuide/src/main/java/com/battlelancer/seriesguide/extensions/ExtensionsConfigurationFragment.java @@ -61,6 +61,8 @@ public class ExtensionsConfigurationFragment extends SherlockFragment implements AdapterView.OnItemClickListener { + public static final int EXTENSION_LIMIT_FREE = 2; + private static final String TAG = "Extension Configuration"; private static final String PLAY_STORE_EXTENSIONS_SEARCH = "https://play.google.com/store/search?q=SeriesGuide%20Extension&c=apps"; @@ -260,7 +262,9 @@ public void onLoaderReset(Loader> loader) { @Override public void onItemClick(AdapterView parent, View view, int position, long id) { if (position == mAdapter.getCount() - 1) { - if (!Utils.hasAccessToX(getActivity())) { + // non-supporters only can add a few extensions + if (mAdapter.getCount() - 1 == EXTENSION_LIMIT_FREE + && !Utils.hasAccessToX(getActivity())) { Utils.advertiseSubscription(getActivity()); return; } @@ -270,10 +274,6 @@ public void onItemClick(AdapterView parent, View view, int position, long id) } public void onEventMainThread(ExtensionsAdapter.ExtensionDisableRequestEvent event) { - if (!Utils.hasAccessToX(getActivity())) { - Utils.advertiseSubscription(getActivity()); - return; - } mEnabledExtensions.remove(event.position); getLoaderManager().restartLoader(ExtensionsConfigurationActivity.LOADER_ACTIONS_ID, null, mExtensionsLoaderCallbacks); diff --git a/SeriesGuide/src/main/res/layout/item_extension_add.xml b/SeriesGuide/src/main/res/layout/item_extension_add.xml index ecc747d03c..7181dec3d8 100644 --- a/SeriesGuide/src/main/res/layout/item_extension_add.xml +++ b/SeriesGuide/src/main/res/layout/item_extension_add.xml @@ -30,4 +30,13 @@ android:text="@string/action_extensions_add" android:textAppearance="@style/TextAppearance.Medium" /> + + \ No newline at end of file diff --git a/SeriesGuide/src/main/res/values/strings.xml b/SeriesGuide/src/main/res/values/strings.xml index c0d1e887d6..236972f660 100644 --- a/SeriesGuide/src/main/res/values/strings.xml +++ b/SeriesGuide/src/main/res/values/strings.xml @@ -534,6 +534,7 @@ Extensions Customize extensions Add extension + Get X to add more extensions Get more extensions Settings Remove From 14226eb8a834512107b8b7dcca3dcbe9f09e22c2 Mon Sep 17 00:00:00 2001 From: Uwe Trottmann Date: Thu, 17 Apr 2014 15:46:38 +0200 Subject: [PATCH 2/5] Push version to 13.1, 11256. --- build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index a2d1faf8a4..626ae8c387 100644 --- a/build.gradle +++ b/build.gradle @@ -33,8 +33,8 @@ ext { buildToolsVersion = '19.0.3' // API level 11+ -> version 11xxx - versionCode = 11255 - versionName = '13.0.1' + versionCode = 11256 + versionName = '13.1' } ext.libraries = [ From 3300165e45ea499da13398ac425499f305a3d273 Mon Sep 17 00:00:00 2001 From: Uwe Trottmann Date: Thu, 17 Apr 2014 15:46:50 +0200 Subject: [PATCH 3/5] Change log for 13.1. --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c456e4c78..0f819dc779 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ Changelog All dates are in the European Central timezone. +Version 13.1 *(2014-04-17)* +----------------------------- + +* Extensions API: now all users can add up to two extensions. To add more subscribe or buy the X Pass! + Version 13.0.1 *(2014-04-17)* ----------------------------- From 024b4fae003626e6b11c6f8981beebb5cacd4f8d Mon Sep 17 00:00:00 2001 From: Uwe Trottmann Date: Thu, 17 Apr 2014 15:53:32 +0200 Subject: [PATCH 4/5] Add new strings to all languages. --- SeriesGuide/src/main/res/values-ar/strings.xml | 1 + SeriesGuide/src/main/res/values-bg/strings.xml | 1 + SeriesGuide/src/main/res/values-cs/strings.xml | 1 + SeriesGuide/src/main/res/values-da/strings.xml | 1 + SeriesGuide/src/main/res/values-de/strings.xml | 1 + SeriesGuide/src/main/res/values-el/strings.xml | 1 + SeriesGuide/src/main/res/values-es/strings.xml | 1 + SeriesGuide/src/main/res/values-fa/strings.xml | 1 + SeriesGuide/src/main/res/values-fi/strings.xml | 1 + SeriesGuide/src/main/res/values-fr/strings.xml | 1 + SeriesGuide/src/main/res/values-hr/strings.xml | 1 + SeriesGuide/src/main/res/values-hu/strings.xml | 1 + SeriesGuide/src/main/res/values-it/strings.xml | 1 + SeriesGuide/src/main/res/values-iw/strings.xml | 1 + SeriesGuide/src/main/res/values-ko/strings.xml | 1 + SeriesGuide/src/main/res/values-lt/strings.xml | 1 + SeriesGuide/src/main/res/values-lv/strings.xml | 1 + SeriesGuide/src/main/res/values-nb/strings.xml | 1 + SeriesGuide/src/main/res/values-nl/strings.xml | 1 + SeriesGuide/src/main/res/values-pl/strings.xml | 1 + SeriesGuide/src/main/res/values-pt-rBR/strings.xml | 1 + SeriesGuide/src/main/res/values-pt-rPT/strings.xml | 1 + SeriesGuide/src/main/res/values-ro/strings.xml | 1 + SeriesGuide/src/main/res/values-ru/strings.xml | 1 + SeriesGuide/src/main/res/values-sk/strings.xml | 1 + SeriesGuide/src/main/res/values-sl/strings.xml | 1 + SeriesGuide/src/main/res/values-sr/strings.xml | 1 + SeriesGuide/src/main/res/values-sv/strings.xml | 1 + SeriesGuide/src/main/res/values-tr/strings.xml | 3 ++- SeriesGuide/src/main/res/values-uk/strings.xml | 1 + SeriesGuide/src/main/res/values-zh-rCN/strings.xml | 1 + SeriesGuide/src/main/res/values-zh-rTW/strings.xml | 1 + 32 files changed, 33 insertions(+), 1 deletion(-) diff --git a/SeriesGuide/src/main/res/values-ar/strings.xml b/SeriesGuide/src/main/res/values-ar/strings.xml index 4aaedd409d..4515993419 100644 --- a/SeriesGuide/src/main/res/values-ar/strings.xml +++ b/SeriesGuide/src/main/res/values-ar/strings.xml @@ -364,6 +364,7 @@ الإضافات تخصيص الإضافات إضافة ملحق + Get X to add more extensions المزيد من الإضافات الإعدادات إزالة diff --git a/SeriesGuide/src/main/res/values-bg/strings.xml b/SeriesGuide/src/main/res/values-bg/strings.xml index 8f59ab1619..3209f4a074 100644 --- a/SeriesGuide/src/main/res/values-bg/strings.xml +++ b/SeriesGuide/src/main/res/values-bg/strings.xml @@ -364,6 +364,7 @@ Extensions Customize extensions Add extension + Get X to add more extensions Get more extensions Настройки Премахване diff --git a/SeriesGuide/src/main/res/values-cs/strings.xml b/SeriesGuide/src/main/res/values-cs/strings.xml index 1609d7bdea..41cbb8a174 100644 --- a/SeriesGuide/src/main/res/values-cs/strings.xml +++ b/SeriesGuide/src/main/res/values-cs/strings.xml @@ -364,6 +364,7 @@ Rozšíření Přispůsobení rozšířeních Přidat rozšíření + Get X to add more extensions Získat další rozšíření Nastavení Odstranit diff --git a/SeriesGuide/src/main/res/values-da/strings.xml b/SeriesGuide/src/main/res/values-da/strings.xml index 411b76e191..849177d972 100644 --- a/SeriesGuide/src/main/res/values-da/strings.xml +++ b/SeriesGuide/src/main/res/values-da/strings.xml @@ -364,6 +364,7 @@ Extensions Customize extensions Add extension + Get X to add more extensions Get more extensions Indstillinger Fjern diff --git a/SeriesGuide/src/main/res/values-de/strings.xml b/SeriesGuide/src/main/res/values-de/strings.xml index 86ff3b9716..f9a6b6bef6 100644 --- a/SeriesGuide/src/main/res/values-de/strings.xml +++ b/SeriesGuide/src/main/res/values-de/strings.xml @@ -364,6 +364,7 @@ Erweiterungen Erweiterungen anpassen Erweiterung hinzufügen + Erwerben Sie X um mehr Erweiterungen hinzuzufügen Mehr Erweiterungen Einstellungen Löschen diff --git a/SeriesGuide/src/main/res/values-el/strings.xml b/SeriesGuide/src/main/res/values-el/strings.xml index aa6f57d964..a94146acfc 100644 --- a/SeriesGuide/src/main/res/values-el/strings.xml +++ b/SeriesGuide/src/main/res/values-el/strings.xml @@ -364,6 +364,7 @@ Extensions Customize extensions Add extension + Get X to add more extensions Get more extensions Ρυθμίσεις Αφαίρεση diff --git a/SeriesGuide/src/main/res/values-es/strings.xml b/SeriesGuide/src/main/res/values-es/strings.xml index fd88e3c4b8..3c75f529b4 100644 --- a/SeriesGuide/src/main/res/values-es/strings.xml +++ b/SeriesGuide/src/main/res/values-es/strings.xml @@ -364,6 +364,7 @@ Extensions Customize extensions Add extension + Get X to add more extensions Get more extensions Configuración Eliminar diff --git a/SeriesGuide/src/main/res/values-fa/strings.xml b/SeriesGuide/src/main/res/values-fa/strings.xml index 9b621b9e44..60f749040f 100644 --- a/SeriesGuide/src/main/res/values-fa/strings.xml +++ b/SeriesGuide/src/main/res/values-fa/strings.xml @@ -364,6 +364,7 @@ Extensions Customize extensions Add extension + Get X to add more extensions Get more extensions تنظیمات Remove diff --git a/SeriesGuide/src/main/res/values-fi/strings.xml b/SeriesGuide/src/main/res/values-fi/strings.xml index 29e2864fcd..fa5a79fccc 100644 --- a/SeriesGuide/src/main/res/values-fi/strings.xml +++ b/SeriesGuide/src/main/res/values-fi/strings.xml @@ -364,6 +364,7 @@ Laajennukset Muokkaa laajennuksia Lisää laajennus + Get X to add more extensions Hanki lisää laajennuksia Asetukset Poista diff --git a/SeriesGuide/src/main/res/values-fr/strings.xml b/SeriesGuide/src/main/res/values-fr/strings.xml index 632b7dfbd2..4106648691 100644 --- a/SeriesGuide/src/main/res/values-fr/strings.xml +++ b/SeriesGuide/src/main/res/values-fr/strings.xml @@ -364,6 +364,7 @@ Extensions Personnaliser les extensions Ajouter une extension + Get X to add more extensions Obtenir plus d\'extensions Paramètres Supprimer diff --git a/SeriesGuide/src/main/res/values-hr/strings.xml b/SeriesGuide/src/main/res/values-hr/strings.xml index 4cab104853..2b0a65634a 100644 --- a/SeriesGuide/src/main/res/values-hr/strings.xml +++ b/SeriesGuide/src/main/res/values-hr/strings.xml @@ -364,6 +364,7 @@ Extensions Customize extensions Add extension + Get X to add more extensions Get more extensions Postavke Izbriši diff --git a/SeriesGuide/src/main/res/values-hu/strings.xml b/SeriesGuide/src/main/res/values-hu/strings.xml index 1c7d1840d6..63adcbf5ef 100644 --- a/SeriesGuide/src/main/res/values-hu/strings.xml +++ b/SeriesGuide/src/main/res/values-hu/strings.xml @@ -364,6 +364,7 @@ Extensions Customize extensions Add extension + Get X to add more extensions Get more extensions Beállítások Törlés diff --git a/SeriesGuide/src/main/res/values-it/strings.xml b/SeriesGuide/src/main/res/values-it/strings.xml index 7f9c6d031e..479ae89e81 100644 --- a/SeriesGuide/src/main/res/values-it/strings.xml +++ b/SeriesGuide/src/main/res/values-it/strings.xml @@ -364,6 +364,7 @@ Extensions Customize extensions Add extension + Get X to add more extensions Get more extensions Impostazioni Rimuovere diff --git a/SeriesGuide/src/main/res/values-iw/strings.xml b/SeriesGuide/src/main/res/values-iw/strings.xml index d16448ffe3..d015f1080b 100644 --- a/SeriesGuide/src/main/res/values-iw/strings.xml +++ b/SeriesGuide/src/main/res/values-iw/strings.xml @@ -364,6 +364,7 @@ תוספים התאמת תוספים הוספת תוסף + Get X to add more extensions חפש תוספים נוספים הגדרות הסר diff --git a/SeriesGuide/src/main/res/values-ko/strings.xml b/SeriesGuide/src/main/res/values-ko/strings.xml index e53d2b3f0f..09c6ddc62e 100644 --- a/SeriesGuide/src/main/res/values-ko/strings.xml +++ b/SeriesGuide/src/main/res/values-ko/strings.xml @@ -364,6 +364,7 @@ Extensions Customize extensions Add extension + Get X to add more extensions Get more extensions 설정 삭제 diff --git a/SeriesGuide/src/main/res/values-lt/strings.xml b/SeriesGuide/src/main/res/values-lt/strings.xml index 283b50a56d..5774eda337 100644 --- a/SeriesGuide/src/main/res/values-lt/strings.xml +++ b/SeriesGuide/src/main/res/values-lt/strings.xml @@ -364,6 +364,7 @@ Extensions Customize extensions Add extension + Get X to add more extensions Get more extensions Nustatymai Pašalinti diff --git a/SeriesGuide/src/main/res/values-lv/strings.xml b/SeriesGuide/src/main/res/values-lv/strings.xml index a777aff57c..613876ca7d 100644 --- a/SeriesGuide/src/main/res/values-lv/strings.xml +++ b/SeriesGuide/src/main/res/values-lv/strings.xml @@ -365,6 +365,7 @@ Extensions Customize extensions Add extension + Get X to add more extensions Get more extensions Iestatījumi Remove diff --git a/SeriesGuide/src/main/res/values-nb/strings.xml b/SeriesGuide/src/main/res/values-nb/strings.xml index 7a22258130..e56522641b 100644 --- a/SeriesGuide/src/main/res/values-nb/strings.xml +++ b/SeriesGuide/src/main/res/values-nb/strings.xml @@ -364,6 +364,7 @@ Extensions Customize extensions Add extension + Get X to add more extensions Get more extensions Innstillinger Fjern diff --git a/SeriesGuide/src/main/res/values-nl/strings.xml b/SeriesGuide/src/main/res/values-nl/strings.xml index 83104eb2a2..d8ff768a87 100644 --- a/SeriesGuide/src/main/res/values-nl/strings.xml +++ b/SeriesGuide/src/main/res/values-nl/strings.xml @@ -364,6 +364,7 @@ Extensies Extensies aanpassen Extensie toevoegen + Get X to add more extensions Vind meer extensies Instellingen Verwijderen diff --git a/SeriesGuide/src/main/res/values-pl/strings.xml b/SeriesGuide/src/main/res/values-pl/strings.xml index 2c63b89111..59edfc3843 100644 --- a/SeriesGuide/src/main/res/values-pl/strings.xml +++ b/SeriesGuide/src/main/res/values-pl/strings.xml @@ -364,6 +364,7 @@ Rozszerzenia Dostosuj rozszerzenia Dodaj rozszerzenia + Get X to add more extensions Pobierz więcej rozszerzeń Ustawienia Usuń diff --git a/SeriesGuide/src/main/res/values-pt-rBR/strings.xml b/SeriesGuide/src/main/res/values-pt-rBR/strings.xml index 03480b82db..47e0a0ac4a 100644 --- a/SeriesGuide/src/main/res/values-pt-rBR/strings.xml +++ b/SeriesGuide/src/main/res/values-pt-rBR/strings.xml @@ -364,6 +364,7 @@ Extensions Customize extensions Add extension + Get X to add more extensions Get more extensions Configurações Remover diff --git a/SeriesGuide/src/main/res/values-pt-rPT/strings.xml b/SeriesGuide/src/main/res/values-pt-rPT/strings.xml index 0bcb4f930b..31c0a572da 100644 --- a/SeriesGuide/src/main/res/values-pt-rPT/strings.xml +++ b/SeriesGuide/src/main/res/values-pt-rPT/strings.xml @@ -364,6 +364,7 @@ Extensões Personalizar extensões Adicionar extensão + Get X to add more extensions Obter mais extensões Definições Remover diff --git a/SeriesGuide/src/main/res/values-ro/strings.xml b/SeriesGuide/src/main/res/values-ro/strings.xml index 7e729bcf59..6cc658eb52 100644 --- a/SeriesGuide/src/main/res/values-ro/strings.xml +++ b/SeriesGuide/src/main/res/values-ro/strings.xml @@ -364,6 +364,7 @@ Extensions Customize extensions Add extension + Get X to add more extensions Get more extensions Setări Eliminați diff --git a/SeriesGuide/src/main/res/values-ru/strings.xml b/SeriesGuide/src/main/res/values-ru/strings.xml index 998c7c4d0f..d8af383e50 100644 --- a/SeriesGuide/src/main/res/values-ru/strings.xml +++ b/SeriesGuide/src/main/res/values-ru/strings.xml @@ -364,6 +364,7 @@ Extensions Customize extensions Add extension + Get X to add more extensions Get more extensions Настройки Удалить diff --git a/SeriesGuide/src/main/res/values-sk/strings.xml b/SeriesGuide/src/main/res/values-sk/strings.xml index fec2d622fa..30ddec7c04 100644 --- a/SeriesGuide/src/main/res/values-sk/strings.xml +++ b/SeriesGuide/src/main/res/values-sk/strings.xml @@ -364,6 +364,7 @@ Extensions Customize extensions Add extension + Get X to add more extensions Get more extensions Nastavenia Odstrániť diff --git a/SeriesGuide/src/main/res/values-sl/strings.xml b/SeriesGuide/src/main/res/values-sl/strings.xml index a556e79413..410ed3c182 100644 --- a/SeriesGuide/src/main/res/values-sl/strings.xml +++ b/SeriesGuide/src/main/res/values-sl/strings.xml @@ -364,6 +364,7 @@ Extensions Customize extensions Add extension + Get X to add more extensions Get more extensions Nastavitve odstrani diff --git a/SeriesGuide/src/main/res/values-sr/strings.xml b/SeriesGuide/src/main/res/values-sr/strings.xml index 64a1c94539..3c6e2ce375 100644 --- a/SeriesGuide/src/main/res/values-sr/strings.xml +++ b/SeriesGuide/src/main/res/values-sr/strings.xml @@ -365,6 +365,7 @@ Extensions Customize extensions Add extension + Get X to add more extensions Get more extensions Подешавања Уклони diff --git a/SeriesGuide/src/main/res/values-sv/strings.xml b/SeriesGuide/src/main/res/values-sv/strings.xml index 9c00381b5d..5f102dbfd0 100644 --- a/SeriesGuide/src/main/res/values-sv/strings.xml +++ b/SeriesGuide/src/main/res/values-sv/strings.xml @@ -365,6 +365,7 @@ Extensions Customize extensions Add extension + Get X to add more extensions Get more extensions Inställningar Ta bort diff --git a/SeriesGuide/src/main/res/values-tr/strings.xml b/SeriesGuide/src/main/res/values-tr/strings.xml index 960d87f387..3894850732 100644 --- a/SeriesGuide/src/main/res/values-tr/strings.xml +++ b/SeriesGuide/src/main/res/values-tr/strings.xml @@ -169,7 +169,7 @@ Bazı posterler yüklenemedi, daha sonra tekrar deneyin. Posterler yükleniyor… kanal %s - izlenilmemiş bölüm + izlenmeyen bölümler Tüm bölümler izlendi bölüm izlenmedi yayınlanmadı @@ -364,6 +364,7 @@ Eklentiler Eklentileri özelleştir Eklenti ekle + Get X to add more extensions Daha fazla eklenti edin Ayarlar Kaldır diff --git a/SeriesGuide/src/main/res/values-uk/strings.xml b/SeriesGuide/src/main/res/values-uk/strings.xml index af79ae2d83..8112225d43 100644 --- a/SeriesGuide/src/main/res/values-uk/strings.xml +++ b/SeriesGuide/src/main/res/values-uk/strings.xml @@ -364,6 +364,7 @@ Extensions Customize extensions Add extension + Get X to add more extensions Get more extensions Налаштування Видалити diff --git a/SeriesGuide/src/main/res/values-zh-rCN/strings.xml b/SeriesGuide/src/main/res/values-zh-rCN/strings.xml index a72a466689..3bdf5de887 100644 --- a/SeriesGuide/src/main/res/values-zh-rCN/strings.xml +++ b/SeriesGuide/src/main/res/values-zh-rCN/strings.xml @@ -364,6 +364,7 @@ Extensions Customize extensions Add extension + Get X to add more extensions Get more extensions 设置 删除 diff --git a/SeriesGuide/src/main/res/values-zh-rTW/strings.xml b/SeriesGuide/src/main/res/values-zh-rTW/strings.xml index 342017523b..9b7a28f2ae 100644 --- a/SeriesGuide/src/main/res/values-zh-rTW/strings.xml +++ b/SeriesGuide/src/main/res/values-zh-rTW/strings.xml @@ -364,6 +364,7 @@ Extensions Customize extensions Add extension + Get X to add more extensions Get more extensions 設定 刪除 From a7c0e4066d7d2c478352bff4c3f0031865215001 Mon Sep 17 00:00:00 2001 From: Uwe Trottmann Date: Thu, 17 Apr 2014 16:00:41 +0200 Subject: [PATCH 5/5] Avoid crash on null database return. - https://crashlytics.com/seriesguide/android/apps/com.battlelancer.seriesguide/issues/534fda6ce3de5099ba170f6c --- .../seriesguide/service/NotificationService.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/SeriesGuide/src/main/java/com/battlelancer/seriesguide/service/NotificationService.java b/SeriesGuide/src/main/java/com/battlelancer/seriesguide/service/NotificationService.java index ef400e6300..dea91233e9 100644 --- a/SeriesGuide/src/main/java/com/battlelancer/seriesguide/service/NotificationService.java +++ b/SeriesGuide/src/main/java/com/battlelancer/seriesguide/service/NotificationService.java @@ -17,6 +17,7 @@ package com.battlelancer.seriesguide.service; import android.support.v4.app.TaskStackBuilder; +import android.text.TextUtils; import com.battlelancer.seriesguide.provider.SeriesGuideContract.Episodes; import com.battlelancer.seriesguide.provider.SeriesGuideContract.Shows; import com.battlelancer.seriesguide.provider.SeriesGuideDatabase.Tables; @@ -422,11 +423,11 @@ private void onNotify(final Cursor upcomingEpisodes, List notifyPositio .getString(NotificationQuery.OVERVIEW); final SpannableStringBuilder bigText = new SpannableStringBuilder(); - bigText.append(episodeTitle); + bigText.append(TextUtils.isEmpty(episodeTitle) ? "" : episodeTitle); bigText.setSpan(new ForegroundColorSpan(Color.WHITE), 0, bigText.length(), 0); bigText.append("\n"); - bigText.append(episodeSummary); + bigText.append(TextUtils.isEmpty(episodeSummary) ? "" : episodeSummary); nb.setStyle(new NotificationCompat.BigTextStyle().bigText(bigText) .setSummaryText(contentText)); @@ -456,7 +457,8 @@ private void onNotify(final Cursor upcomingEpisodes, List notifyPositio final SpannableStringBuilder lineText = new SpannableStringBuilder(); // show title - lineText.append(upcomingEpisodes.getString(NotificationQuery.SHOW_TITLE)); + String showTitle = upcomingEpisodes.getString(NotificationQuery.SHOW_TITLE); + lineText.append(TextUtils.isEmpty(showTitle) ? "" : showTitle); lineText.setSpan(new ForegroundColorSpan(Color.WHITE), 0, lineText.length(), 0); lineText.append(" ");