Merge branch 'development' into development-stable

# Conflicts:
#	app/src/main/res/values-it/strings.xml
This commit is contained in:
2022-06-25 02:07:14 +02:00
30 changed files with 1205 additions and 246 deletions

View File

@ -781,29 +781,21 @@ public class Actions
return false;
}
@RequiresApi(api = Build.VERSION_CODES.M)
public static void setDoNotDisturb(Context context, int desiredSetting)
public static void setDoNotDisturb(Context context, int desiredDndMode)
{
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
// Check if the notification policy access has been granted for the app.
/* if (!notificationManager.isNotificationPolicyAccessGranted())
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
{
Intent intent = new Intent(android.provider.Settings.ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS);
startActivity(intent);
return;
}*/
/*
if (!notificationManager.isNotificationPolicyAccessGranted())
--> done externally
*/
notificationManager.setInterruptionFilter(desiredSetting);
/*if (notificationManager.getCurrentInterruptionFilter() == NotificationManager.INTERRUPTION_FILTER_ALL)
{
notificationManager.setInterruptionFilter(NotificationManager.INTERRUPTION_FILTER_NONE);
Miscellaneous.logEvent("i", context.getResources().getString(R.string.soundSettings), "Changing DND to " + String.valueOf(desiredDndMode), 4);
NotificationManager mNotificationManager = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
mNotificationManager.setInterruptionFilter(desiredDndMode);
}
else
{
notificationManager.setInterruptionFilter(NotificationManager.INTERRUPTION_FILTER_ALL);
}*/
Miscellaneous.logEvent("w", context.getResources().getString(R.string.soundSettings), "Cannot change DND to " + String.valueOf(desiredDndMode) + ". This Android version is too and doesn\'t have that feature, yet.", 4);
}
@RequiresApi(api = Build.VERSION_CODES.M)
@ -940,18 +932,6 @@ public class Actions
}
}
public static void setDND(Context context, int desiredDndMode)
{
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
{
Miscellaneous.logEvent("i", context.getResources().getString(R.string.soundSettings), "Changing DND to " + String.valueOf(desiredDndMode), 4);
NotificationManager mNotificationManager = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
mNotificationManager.setInterruptionFilter(desiredDndMode);
}
else
Miscellaneous.logEvent("w", context.getResources().getString(R.string.soundSettings), "Cannot change DND to " + String.valueOf(desiredDndMode) + ". This Android version is too and doesn\'t have that feature, yet.", 4);
}
public void useDownloadedWebpage(String result)
{
// Toast.makeText(context, "Result: " + result, Toast.LENGTH_LONG).show();

View File

@ -2,19 +2,16 @@ package com.jens.automation2;
import android.app.Activity;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.RadioButton;
import android.widget.TextView;
import androidx.annotation.Nullable;
public class ActivityManageTriggerTethering extends Activity
{
RadioButton rbTetheringOn, rTetheringOff;
RadioButton rbTetheringOn, rbTetheringOff;
Button bTriggerTetheringSave;
@Override
@ -24,12 +21,15 @@ public class ActivityManageTriggerTethering extends Activity
setContentView(R.layout.activity_manage_trigger_tethering);
rbTetheringOn = (RadioButton) findViewById(R.id.rbTetheringOn);
rTetheringOff = (RadioButton)findViewById(R.id.rTetheringOff);
rbTetheringOff = (RadioButton)findViewById(R.id.rbTetheringOff);
bTriggerTetheringSave = (Button) findViewById(R.id.bTriggerTetheringSave);
Intent input = getIntent();
if(input.hasExtra(ActivityManageRule.intentNameTriggerParameter1))
{
rbTetheringOn.setChecked(input.getBooleanExtra(ActivityManageRule.intentNameTriggerParameter1, true));
rbTetheringOff.setChecked(!input.getBooleanExtra(ActivityManageRule.intentNameTriggerParameter1, false));
}
bTriggerTetheringSave.setOnClickListener(new View.OnClickListener()
{

View File

@ -4,12 +4,10 @@ import android.app.NotificationManager;
import android.content.ContentValues;
import android.content.Context;
import android.media.AudioManager;
import android.media.Ringtone;
import android.media.RingtoneManager;
import android.net.Uri;
import android.os.Build;
import android.provider.MediaStore;
import android.provider.Settings;
import android.util.Log;
import android.widget.Toast;
@ -509,7 +507,7 @@ public class Profile implements Comparable<Profile>
Actions.setSound(context, soundMode);
if(changeDndMode)
Actions.setDND(context, dndMode);
Actions.setDoNotDisturb(context, dndMode);
if(changeVolumeMusicVideoGameMedia)
am.setStreamVolume(AudioManager.STREAM_MUSIC, volumeMusic, AudioManager.FLAG_PLAY_SOUND);

View File

@ -1,5 +1,7 @@
package com.jens.automation2;
import androidx.annotation.NonNull;
import java.sql.Time;
public class TimeObject
@ -65,4 +67,12 @@ public class TimeObject
return ro;
}
@NonNull
@Override
public String toString()
{
Time time = Time.valueOf(this.getHours() + ":" + this.getMinutes() + ":" + this.getSeconds());
return time.toString();
}
}

View File

@ -7,7 +7,6 @@ import android.location.LocationManager;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.telephony.TelephonyManager;
import android.util.Log;
import com.jens.automation2.ActivityMainScreen;
@ -485,7 +484,6 @@ public class LocationProvider
}
}
public static void resetSpeedTimer(Calendar timeOfForcedLocationCheck)
{
if(speedTimerActive)