Minor fixes

This commit is contained in:
2026-08-26 16:38:38 +02:00
parent 3f28e7b2bc
commit 4673bc2289
5 changed files with 184 additions and 148 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ android {
compileSdkVersion 36
buildToolsVersion '36.0.0'
useLibrary 'org.apache.http.legacy'
versionCode 149
versionCode 150
versionName "1.8.8"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -403,7 +403,11 @@ public class ActivityDetectionReceiver extends IntentService implements Automati
private PendingIntent getActivityDetectionPendingIntent()
{
Intent intent = new Intent(AutomationService.getInstance(), ActivityDetectionReceiver.class);
PendingIntent returnValue = PendingIntent.getService(AutomationService.getInstance(), 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
PendingIntent returnValue;
if(Miscellaneous.getTargetSDK(AutomationService.getInstance()) >= 31)
returnValue = PendingIntent.getService(AutomationService.getInstance(), 0, intent, PendingIntent.FLAG_UPDATE_CURRENT|PendingIntent.FLAG_IMMUTABLE);
else
returnValue = PendingIntent.getService(AutomationService.getInstance(), 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
return returnValue;
}
}
@@ -670,6 +670,8 @@ public class ActivityManageRule extends Activity
items.add(new Item(typesLong[i].toString(), R.drawable.subsystemstate));
else if(types[i].toString().equals(Trigger_Enum.checkVariable.toString()))
items.add(new Item(typesLong[i].toString(), R.drawable.variable));
else if(types[i].toString().equals(Trigger_Enum.proximity.toString()))
items.add(new Item(typesLong[i].toString(), R.drawable.proximity));
else if(types[i].toString().equals(Trigger_Enum.calendarEvent.toString()))
{
if(ActivityPermissions.isPermissionDeclaredInManifest(ActivityManageRule.this, Manifest.permission.READ_CALENDAR))
@@ -753,7 +755,17 @@ public class ActivityManageRule extends Activity
booleanChoices = new String[]{getResources().getString(R.string.started), getResources().getString(R.string.stopped)};
else if(triggerType == Trigger_Enum.usb_host_connection)
booleanChoices = new String[]{getResources().getString(R.string.connected), getResources().getString(R.string.disconnected)};
else if(triggerType == Trigger_Enum.speed || triggerType == Trigger_Enum.noiseLevel || triggerType == Trigger_Enum.batteryLevel)
else if(triggerType == Trigger_Enum.speed)
{
if(Miscellaneous.googleToBlameForLocation(false))
{
ActivityMainScreen.openGoogleBlamingWindow();
return;
}
else
booleanChoices = new String[]{getResources().getString(R.string.exceeds), getResources().getString(R.string.dropsBelow)};
}
else if(triggerType == Trigger_Enum.noiseLevel || triggerType == Trigger_Enum.batteryLevel)
booleanChoices = new String[]{getResources().getString(R.string.exceeds), getResources().getString(R.string.dropsBelow)};
else if(triggerType == Trigger_Enum.wifiConnection)
{
@@ -409,6 +409,7 @@ public class Miscellaneous extends Service
}
protected static boolean logCleanerRunning = false;
protected static void rotateLogFile(File logFile)
{
logCleanerRunning = true;
@@ -522,7 +523,8 @@ public class Miscellaneous extends Service
}
// }
}
} catch (Exception e)
}
catch (Exception e)
{
Log.w("getWritableFolder", folder + " not writable.");
}
@@ -534,6 +536,7 @@ public class Miscellaneous extends Service
}
protected final static String logFileName = "Automation_logfile.txt";
protected static File getLogFile()
{
File logFile = null;
@@ -553,6 +556,7 @@ public class Miscellaneous extends Service
return logFile;
}
private static void writeToLogFile(String type, String header, String description)
{
try
@@ -1061,7 +1065,8 @@ public class Miscellaneous extends Service
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo[] netInfo = cm.getAllNetworkInfo();
for (NetworkInfo ni : netInfo) {
for (NetworkInfo ni : netInfo)
{
if (ni.getTypeName().equalsIgnoreCase("WIFI"))
if (ni.isConnected())
haveConnectedWifi = true;
@@ -1295,7 +1300,8 @@ public class Miscellaneous extends Service
Thread.sleep(delay);
}
catch (Exception e)
{}
{
}
createDismissibleNotification(title, textToDisplay, notificationId, true, notificationChannelId, pendingIntent);
@@ -1359,6 +1365,7 @@ public class Miscellaneous extends Service
return null;
}
@RequiresApi(api = Build.VERSION_CODES.O)
static NotificationChannel getNotificationChannel(String channelId)
{
@@ -2270,6 +2277,7 @@ public class Miscellaneous extends Service
/**
* Get ISO 3166-1 alpha-2 country code for this device (or null if not available)
*
* @param context Context reference to get the TelephonyManager instance from
* @return country code or null
*/
@@ -2297,7 +2305,8 @@ public class Miscellaneous extends Service
return "unknown";
}
catch (Exception e)
{ }
{
}
return null;
}
@@ -2356,7 +2365,18 @@ public class Miscellaneous extends Service
public static void setDisplayLanguage(Context context)
{
if(!Settings.displayLanguage.equals(Settings.default_displayLanguage))
String targetLanguage = null;
if (Settings.displayLanguage == null)
{
targetLanguage = Settings.default_displayLanguage;
}
else if (!Settings.displayLanguage.equals(Settings.default_displayLanguage))
{
targetLanguage = Settings.default_displayLanguage;
}
if (targetLanguage != null)
{
Locale myLocale;
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB