News download finished.

This commit is contained in:
jens 2021-03-02 19:55:43 +01:00
parent 8a5fa20cad
commit d64f6e2c3b
5 changed files with 34 additions and 17 deletions

View File

@ -11,8 +11,8 @@ android {
compileSdkVersion 29 compileSdkVersion 29
buildToolsVersion '29.0.2' buildToolsVersion '29.0.2'
useLibrary 'org.apache.http.legacy' useLibrary 'org.apache.http.legacy'
versionCode 96 versionCode 97
versionName "1.6.21" versionName "1.6.22"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
} }
@ -42,7 +42,7 @@ android {
dimension "version" dimension "version"
// applicationIdSuffix ".googlePlay" // applicationIdSuffix ".googlePlay"
versionNameSuffix "-googlePlay" versionNameSuffix "-googlePlay"
targetSdkVersion 29 targetSdkVersion 30
} }
fdroidFlavor fdroidFlavor

View File

@ -0,0 +1,18 @@
{
"version": 2,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "com.jens.automation2",
"variantName": "processGooglePlayFlavorReleaseResources",
"elements": [
{
"type": "SINGLE",
"filters": [],
"versionCode": 97,
"versionName": "1.6.22-googlePlay",
"outputFile": "app-googlePlayFlavor-release.apk"
}
]
}

View File

@ -838,15 +838,15 @@ public class ActivityPermissions extends Activity
startActivityForResult(intent, requestCodeForPermissionsNotificationPolicy); startActivityForResult(intent, requestCodeForPermissionsNotificationPolicy);
return; return;
} }
else if (s.equalsIgnoreCase(permissionNameLocationBackground) && Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) // else if (s.equalsIgnoreCase(permissionNameLocationBackground) && Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
{ // {
requiredPermissions.remove(s); // requiredPermissions.remove(s);
cachedPermissionsToRequest = requiredPermissions; // cachedPermissionsToRequest = requiredPermissions;
Intent intent = new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS); // Intent intent = new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
intent.setData(Uri.parse("package:" + getPackageName())); // intent.setData(Uri.parse("package:" + getPackageName()));
startActivityForResult(intent, requestCodeForPermissionsBackgroundLocation); // startActivityForResult(intent, requestCodeForPermissionsBackgroundLocation);
return; // return;
} // }
} }
} }

View File

@ -10,10 +10,8 @@ import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap; import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import org.w3c.dom.NodeList; import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
import java.io.File; import java.io.File;
import java.lang.reflect.Array;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
@ -72,7 +70,7 @@ public class News
String filePath = context.getFilesDir() + "/appNews.xml"; String filePath = context.getFilesDir() + "/appNews.xml";
if (!(new File(filePath)).exists() || Settings.lastNewsPolltime == -1 || now.getTimeInMillis() >= Settings.lastNewsPolltime + (long)(Settings.pollNewsEveryXDays * 24 * 60 * 60 * 1000)) if (!(new File(filePath)).exists() || Settings.lastNewsPolltime == -1 || now.getTimeInMillis() >= Settings.lastNewsPolltime + (long)(Settings.newsDisplayForXDays * 24 * 60 * 60 * 1000))
{ {
String newsUrl = "https://server47.de/automation/appNews.php"; String newsUrl = "https://server47.de/automation/appNews.php";
newsContent = Miscellaneous.downloadURL(newsUrl, null, null); newsContent = Miscellaneous.downloadURL(newsUrl, null, null);
@ -245,7 +243,7 @@ public class News
try try
{ {
Calendar limit = Calendar.getInstance(); Calendar limit = Calendar.getInstance();
limit.add(Calendar.DAY_OF_MONTH, -Settings.pollNewsEveryXDays); limit.add(Calendar.DAY_OF_MONTH, -Settings.newsPollEveryXDays);
return downloadNews(contexts[0], limit); return downloadNews(contexts[0], limit);
} }
catch(Exception e) catch(Exception e)

View File

@ -12,7 +12,8 @@ public class Settings implements SharedPreferences
{ {
public static final int rulesThatHaveBeenRanHistorySize = 10; public static final int rulesThatHaveBeenRanHistorySize = 10;
public final static int lockSoundChangesInterval = 15; public final static int lockSoundChangesInterval = 15;
public static final int pollNewsEveryXDays = 7; public static final int newsPollEveryXDays = 3;
public static final int newsDisplayForXDays = 3;
public static final String folderName = "Automation"; public static final String folderName = "Automation";
public static long minimumDistanceChangeForGpsUpdate; public static long minimumDistanceChangeForGpsUpdate;