From b492ec5814d0fe83010f8b71edb9589c6799ae77 Mon Sep 17 00:00:00 2001 From: Jake Lee Date: Wed, 10 Apr 2024 10:06:13 +0100 Subject: [PATCH] Fix few crashes from 3.0.0 --- Blacksmith/build.gradle | 4 ++-- Blacksmith/release/output-metadata.json | 4 ++-- Blacksmith/src/main/AndroidManifest.xml | 1 + .../blacksmith/helper/NotificationHelper.java | 16 ++++++++++------ .../blacksmith/main/StatisticsActivity.java | 3 --- 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/Blacksmith/build.gradle b/Blacksmith/build.gradle index 04721c13..2f4a7215 100644 --- a/Blacksmith/build.gradle +++ b/Blacksmith/build.gradle @@ -8,8 +8,8 @@ android { applicationId "uk.co.jakelee.blacksmith" minSdkVersion 19 targetSdkVersion apiVersion - versionCode 86 - versionName "3.0.0" + versionCode 87 + versionName "3.0.1" multiDexEnabled true } buildTypes { diff --git a/Blacksmith/release/output-metadata.json b/Blacksmith/release/output-metadata.json index a0831d4e..6010bc1f 100644 --- a/Blacksmith/release/output-metadata.json +++ b/Blacksmith/release/output-metadata.json @@ -11,8 +11,8 @@ "type": "SINGLE", "filters": [], "attributes": [], - "versionCode": 85, - "versionName": "3.0.0", + "versionCode": 87, + "versionName": "3.0.1", "outputFile": "Blacksmith-release.apk" } ], diff --git a/Blacksmith/src/main/AndroidManifest.xml b/Blacksmith/src/main/AndroidManifest.xml index c1751062..c682156c 100644 --- a/Blacksmith/src/main/AndroidManifest.xml +++ b/Blacksmith/src/main/AndroidManifest.xml @@ -3,6 +3,7 @@ xmlns:tools="http://schemas.android.com/tools" android:installLocation="auto"> + diff --git a/Blacksmith/src/main/java/uk/co/jakelee/blacksmith/helper/NotificationHelper.java b/Blacksmith/src/main/java/uk/co/jakelee/blacksmith/helper/NotificationHelper.java index 6c0555d2..fd952d16 100644 --- a/Blacksmith/src/main/java/uk/co/jakelee/blacksmith/helper/NotificationHelper.java +++ b/Blacksmith/src/main/java/uk/co/jakelee/blacksmith/helper/NotificationHelper.java @@ -100,15 +100,19 @@ public static void addFinishedNotification(Context context, boolean useSoundsSet } private static void addNotification(Context context, long notificationTime, int notificationType) { - AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); + try { + AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); - Intent notificationIntent = new Intent("android.media.action.DISPLAY_NOTIFICATION"); - notificationIntent.addCategory("android.intent.category.DEFAULT"); - notificationIntent.putExtra(NOTIFICATION_TYPE, notificationType); + Intent notificationIntent = new Intent("android.media.action.DISPLAY_NOTIFICATION"); + notificationIntent.addCategory("android.intent.category.DEFAULT"); + notificationIntent.putExtra(NOTIFICATION_TYPE, notificationType); - PendingIntent broadcast = PendingIntent.getBroadcast(context, 9000 + notificationType, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT); + PendingIntent broadcast = PendingIntent.getBroadcast(context, 9000 + notificationType, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT); - alarmManager.set(AlarmManager.RTC_WAKEUP, notificationTime, broadcast); + alarmManager.set(AlarmManager.RTC_WAKEUP, notificationTime, broadcast); + } catch (IllegalArgumentException e) { + e.printStackTrace(); + } } public static void clearNotifications(final Context context) { diff --git a/Blacksmith/src/main/java/uk/co/jakelee/blacksmith/main/StatisticsActivity.java b/Blacksmith/src/main/java/uk/co/jakelee/blacksmith/main/StatisticsActivity.java index 0af716e4..de90fe0d 100644 --- a/Blacksmith/src/main/java/uk/co/jakelee/blacksmith/main/StatisticsActivity.java +++ b/Blacksmith/src/main/java/uk/co/jakelee/blacksmith/main/StatisticsActivity.java @@ -157,9 +157,6 @@ private void displayStatistics() { int collectionsCrafted = Player_Info.getCollectionsCrafted(); ((TextViewPixel) findViewById(R.id.collectionsCrafted)).setText(String.format("%,d", collectionsCrafted)); - int questsCompleted = Select.from(Player_Info.class).where(Condition.prop("name").eq("QuestsCompleted")).first().getIntValue(); - ((TextViewPixel) findViewById(R.id.questsCompleted)).setText(String.format("%,d", questsCompleted)); - int prestigeLevel = Player_Info.getPrestige(); int prestigeGoldPercent = prestigeLevel * 50; int bonusGoldPercent = prestigeGoldPercent + Select.from(Upgrade.class).where(Condition.prop("name").eq("Coins Bonus")).first().getCurrent();