Donate button

This commit is contained in:
jens 2021-11-20 16:14:21 +01:00
parent 5fdc68e396
commit 06d63826e6
4 changed files with 47 additions and 4 deletions

View File

@ -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

View File

@ -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
{

View File

@ -332,6 +332,14 @@
android:layout_height="wrap_content"
android:layout_gravity="top"
android:text="@string/settings" />
<Button
android:id="@+id/bDonate"
android:visibility="gone"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:text="@string/donate" />
</LinearLayout>

View File

@ -706,4 +706,6 @@
<string name="repeatEveryXseconds">Repeat every x seconds</string>
<string name="repeatEveryXsecondsWithVariable">repeat every %1$s seconds</string>
<string name="enterRepetitionTime">You need to enter a positive non-decimal value for reptition time.</string>
<string name="elementSkipped">An element of the configuration file could not be read. The file may have been created by a newer program version.</string>
<string name="donate">Donate</string>
</resources>