diff --git a/app/src/main/java/com/jens/automation2/ActivityMainScreen.java b/app/src/main/java/com/jens/automation2/ActivityMainScreen.java
index ca9ecaf6..722ac783 100644
--- a/app/src/main/java/com/jens/automation2/ActivityMainScreen.java
+++ b/app/src/main/java/com/jens/automation2/ActivityMainScreen.java
@@ -44,7 +44,7 @@ public class ActivityMainScreen extends ActivityGeneric
private static ActivityMainScreen activityMainScreenInstance = null;
private ToggleButton toggleService, tbLockSound;
- private Button bShowHelp, bPrivacy, bSettingsErase, bAddSoundLockTIme;
+ private Button bShowHelp, bPrivacy, bSettingsErase, bAddSoundLockTIme, bDonate;
private TextView tvActivePoi, tvClosestPoi, tvLastRule, tvMainScreenNotePermissions, tvMainScreenNoteFeaturesFromOtherFlavor, tvMainScreenNoteLocationImpossibleBlameGoogle, tvMainScreenNoteNews, tvlockSoundDuration;
private static boolean updateNoteDisplayed = false;
@@ -82,6 +82,12 @@ public class ActivityMainScreen extends ActivityGeneric
tvlockSoundDuration = (TextView)findViewById(R.id.tvlockSoundDuration);
tbLockSound = (ToggleButton) findViewById(R.id.tbLockSound);
toggleService = (ToggleButton) findViewById(R.id.tbArmMastListener);
+
+ bDonate = (Button)findViewById(R.id.bDonate);
+
+ if(!BuildConfig.FLAVOR.equalsIgnoreCase("googlePlayFlavor"))
+ bDonate.setVisibility(View.VISIBLE);
+
toggleService.setChecked(AutomationService.isMyServiceRunning(this));
toggleService.setOnCheckedChangeListener(new OnCheckedChangeListener()
{
@@ -111,6 +117,18 @@ public class ActivityMainScreen extends ActivityGeneric
}
});
+ bDonate.setOnClickListener(new OnClickListener()
+ {
+ @Override
+ public void onClick(View v)
+ {
+ String privacyPolicyUrl = "https://server47.de/donate";
+
+ Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(privacyPolicyUrl));
+ startActivity(browserIntent);
+ }
+ });
+
tbLockSound.setOnCheckedChangeListener(new OnCheckedChangeListener()
{
@Override
diff --git a/app/src/main/java/com/jens/automation2/XmlFileInterface.java b/app/src/main/java/com/jens/automation2/XmlFileInterface.java
index 5c469307..303633f3 100644
--- a/app/src/main/java/com/jens/automation2/XmlFileInterface.java
+++ b/app/src/main/java/com/jens/automation2/XmlFileInterface.java
@@ -819,7 +819,15 @@ public class XmlFileInterface
// Starts by looking for the entry tag
if (name.equals("Trigger"))
{
- triggerCollection.add(readTrigger(parser));
+ try
+ {
+ triggerCollection.add(readTrigger(parser));
+ }
+ catch (IllegalArgumentException | NullPointerException e)
+ {
+ Miscellaneous.logEvent("e", "XMLFileInterface", "Unknown trigger found in config file. File was probably created by a newer program version. Details: " + Log.getStackTraceString(e), 1);
+ Miscellaneous.messageBox(context.getString(R.string.error), context.getString(R.string.elementSkipped), context).show();
+ }
}
else
{
@@ -1055,7 +1063,15 @@ public class XmlFileInterface
// Starts by looking for the entry tag
if (name.equals("Action"))
{
- actionCollection.add(readAction(parser));
+ try
+ {
+ actionCollection.add(readAction(parser));
+ }
+ catch (IllegalArgumentException | NullPointerException e)
+ {
+ Miscellaneous.logEvent("e", "XMLFileInterface", "Unknown action found in config file. File was probably created by a newer program version. Details: " + Log.getStackTraceString(e), 1);
+ Miscellaneous.messageBox(context.getString(R.string.error), context.getString(R.string.elementSkipped), context).show();
+ }
}
else
{
@@ -1064,7 +1080,6 @@ public class XmlFileInterface
}
return (actionCollection);
}
-
private static Action readAction(XmlPullParser parser) throws IOException, XmlPullParserException
{
diff --git a/app/src/main/res/layout/main_overview_layout.xml b/app/src/main/res/layout/main_overview_layout.xml
index c300af40..a62946d4 100644
--- a/app/src/main/res/layout/main_overview_layout.xml
+++ b/app/src/main/res/layout/main_overview_layout.xml
@@ -332,6 +332,14 @@
android:layout_height="wrap_content"
android:layout_gravity="top"
android:text="@string/settings" />
+
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 6d9f0d31..eabf5800 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -706,4 +706,6 @@
Repeat every x seconds
repeat every %1$s seconds
You need to enter a positive non-decimal value for reptition time.
+ An element of the configuration file could not be read. The file may have been created by a newer program version.
+ Donate
\ No newline at end of file