diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 97cb630..ef09f68 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -117,7 +117,7 @@
-
@@ -126,6 +126,6 @@
-
+ -->
\ No newline at end of file
diff --git a/app/src/main/java/com/djonique/birdays/activities/HelpActivity.java b/app/src/main/java/com/djonique/birdays/activities/HelpActivity.java
index 24bed26..2de289c 100644
--- a/app/src/main/java/com/djonique/birdays/activities/HelpActivity.java
+++ b/app/src/main/java/com/djonique/birdays/activities/HelpActivity.java
@@ -138,7 +138,7 @@ public void onClick(DialogInterface dialog, int which) {
@OnClick(R.id.button_help_whitelist)
void openBatteryOptimization() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
- startActivity(new Intent(Settings.ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS));
+ startActivity(Intent.createChooser(new Intent(Settings.ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS), null));
} else {
Toast.makeText(this, R.string.help_whitelist_error, Toast.LENGTH_LONG).show();
}
diff --git a/app/src/main/java/com/djonique/birdays/alarm/AlarmHelper.java b/app/src/main/java/com/djonique/birdays/alarm/AlarmHelper.java
index f6c79ba..8287293 100644
--- a/app/src/main/java/com/djonique/birdays/alarm/AlarmHelper.java
+++ b/app/src/main/java/com/djonique/birdays/alarm/AlarmHelper.java
@@ -16,6 +16,7 @@
package com.djonique.birdays.alarm;
+import android.app.Activity;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Context;
@@ -59,7 +60,14 @@ public void setAlarms(Person person) {
setAdditionalAlarm(person);
}
} catch (SecurityException e) {
- Toast.makeText(context, R.string.security_exception, Toast.LENGTH_LONG).show();
+ if (context instanceof Activity) {
+ ((Activity) context).runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ Toast.makeText(context, R.string.security_exception, Toast.LENGTH_LONG).show();
+ }
+ });
+ }
}
}
diff --git a/app/src/main/java/com/djonique/birdays/alarm/AlarmSetter.java b/app/src/main/java/com/djonique/birdays/alarm/AlarmSetter.java
index 8f69b6e..9a96049 100644
--- a/app/src/main/java/com/djonique/birdays/alarm/AlarmSetter.java
+++ b/app/src/main/java/com/djonique/birdays/alarm/AlarmSetter.java
@@ -19,7 +19,9 @@
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
+import android.widget.Toast;
+import com.djonique.birdays.R;
import com.djonique.birdays.database.DbHelper;
import com.djonique.birdays.models.Person;
@@ -39,7 +41,11 @@ public void onReceive(Context context, Intent intent) {
persons.addAll(dbHelper.query().getPersons());
for (Person person : persons) {
- alarmHelper.setAlarms(person);
+ try {
+ alarmHelper.setAlarms(person);
+ } catch (SecurityException e) {
+ Toast.makeText(context, R.string.security_exception, Toast.LENGTH_LONG).show();
+ }
}
}
}
diff --git a/app/src/main/res/drawable/ic_settings_white_24dp.xml b/app/src/main/res/drawable/ic_settings_white_24dp.xml
new file mode 100644
index 0000000..8f9a671
--- /dev/null
+++ b/app/src/main/res/drawable/ic_settings_white_24dp.xml
@@ -0,0 +1,10 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml
index ea7f9d5..74be38e 100644
--- a/app/src/main/res/menu/menu_main.xml
+++ b/app/src/main/res/menu/menu_main.xml
@@ -27,7 +27,8 @@
app:showAsAction="never" />-->
+ app:showAsAction="always" />
\ No newline at end of file