New version 1.8.3 RC
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package com.jens.automation2;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Context;
|
||||
@@ -28,8 +27,6 @@ import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class ActivityManageProfile extends Activity
|
||||
{
|
||||
private static ProgressDialog progressDialog;
|
||||
@@ -37,12 +34,13 @@ public class ActivityManageProfile extends Activity
|
||||
final static int intentCodeRingtonePickerCallsRingtone = 9011;
|
||||
final static int intentCodeRingtonePickerNotificationsFile = 9020;
|
||||
final static int intentCodeRingtonePickerNotificationsRingtone = 9021;
|
||||
final static String android14Hint = " (>= Android 14)";
|
||||
|
||||
CheckBox checkBoxChangeSoundMode, checkBoxChangeVolumeMusicVideoGameMedia, checkBoxChangeVolumeNotifications, checkBoxChangeVolumeAlarms, checkBoxChangeIncomingCallsRingtone, checkBoxChangeNotificationRingtone, checkBoxChangeAudibleSelection, checkBoxChangeScreenLockUnlockSound, checkBoxChangeHapticFeedback, checkBoxChangeVibrateWhenRinging, checkBoxVibrateWhenRinging, checkBoxAudibleSelection, checkBoxScreenLockUnlockSound, checkBoxHapticFeedback, checkBoxChangeDnd;
|
||||
CheckBox checkBoxChangeSoundMode, checkBoxChangeVolumeMusicVideoGameMedia, checkBoxChangeVolumeNotifications, checkBoxChangeVolumeRingtone, checkBoxChangeVolumeAlarms, checkBoxChangeIncomingCallsRingtone, checkBoxChangeNotificationRingtone, checkBoxChangeAudibleSelection, checkBoxChangeScreenLockUnlockSound, checkBoxChangeHapticFeedback, checkBoxChangeVibrateWhenRinging, checkBoxVibrateWhenRinging, checkBoxAudibleSelection, checkBoxScreenLockUnlockSound, checkBoxHapticFeedback, checkBoxChangeDnd;
|
||||
Spinner spinnerSoundMode, spinnerDndMode;
|
||||
SeekBar seekBarVolumeMusic, seekBarVolumeNotifications, seekBarVolumeAlarms;
|
||||
SeekBar seekBarVolumeMusic, seekBarVolumeNotifications, seekBarVolumeAlarms, seekBarVolumeRingtones;
|
||||
Button bChangeSoundIncomingCalls, bChangeSoundNotifications, bSaveProfile;
|
||||
TextView tvIncomingCallsRingtone, tvNotificationsRingtone;
|
||||
TextView tvIncomingCallsRingtone, tvNotificationsRingtone, tvRingtoneVolume, tvNotificationsVolume;
|
||||
EditText etName;
|
||||
|
||||
boolean guiUpdate = false;
|
||||
@@ -93,6 +91,7 @@ public class ActivityManageProfile extends Activity
|
||||
checkBoxChangeDnd = (CheckBox)findViewById(R.id.checkBoxChangeDnd);
|
||||
checkBoxChangeVolumeMusicVideoGameMedia = (CheckBox)findViewById(R.id.checkBoxChangeVolumeMusicVideoGameMedia);
|
||||
checkBoxChangeVolumeNotifications = (CheckBox)findViewById(R.id.checkBoxChangeVolumeNotifications);
|
||||
checkBoxChangeVolumeRingtone = (CheckBox)findViewById(R.id.checkBoxChangeVolumeRingtones);
|
||||
checkBoxChangeVolumeAlarms = (CheckBox)findViewById(R.id.checkBoxChangeVolumeAlarms);
|
||||
checkBoxChangeIncomingCallsRingtone = (CheckBox)findViewById(R.id.checkBoxChangeIncomingCallsRingtone);
|
||||
checkBoxChangeNotificationRingtone = (CheckBox)findViewById(R.id.checkBoxChangeNotificationRingtone);
|
||||
@@ -108,11 +107,14 @@ public class ActivityManageProfile extends Activity
|
||||
spinnerDndMode = (Spinner)findViewById(R.id.spinnerDndMode);
|
||||
seekBarVolumeMusic = (SeekBar)findViewById(R.id.seekBarVolumeMusic);
|
||||
seekBarVolumeNotifications = (SeekBar)findViewById(R.id.seekBarVolumeNotifications);
|
||||
seekBarVolumeRingtones = (SeekBar)findViewById(R.id.seekBarVolumeRingtones);
|
||||
seekBarVolumeAlarms = (SeekBar)findViewById(R.id.seekBarVolumeAlarms);
|
||||
bChangeSoundIncomingCalls = (Button)findViewById(R.id.bChangeSoundIncomingCalls);
|
||||
bChangeSoundNotifications = (Button)findViewById(R.id.bChangeSoundNotifications);
|
||||
tvIncomingCallsRingtone = (TextView)findViewById(R.id.tvIncomingCallsRingtone);
|
||||
tvNotificationsRingtone = (TextView)findViewById(R.id.tvNotificationsRingtone);
|
||||
tvRingtoneVolume = (TextView)findViewById(R.id.tvRingtoneVolume);
|
||||
tvNotificationsVolume = (TextView)findViewById(R.id.tvNotificationsVolume);
|
||||
bSaveProfile = (Button)findViewById(R.id.bSaveProfile);
|
||||
etName = (EditText)findViewById(R.id.etName);
|
||||
|
||||
@@ -124,6 +126,7 @@ public class ActivityManageProfile extends Activity
|
||||
spinnerDndMode.setEnabled(false);
|
||||
seekBarVolumeMusic.setEnabled(false);
|
||||
seekBarVolumeNotifications.setEnabled(false);
|
||||
seekBarVolumeRingtones.setEnabled(false);
|
||||
seekBarVolumeAlarms.setEnabled(false);
|
||||
bChangeSoundIncomingCalls.setEnabled(false);
|
||||
bChangeSoundNotifications.setEnabled(false);
|
||||
@@ -137,11 +140,36 @@ public class ActivityManageProfile extends Activity
|
||||
checkBoxChangeDnd.setEnabled(false);
|
||||
spinnerDndMode.setEnabled(false);
|
||||
}
|
||||
|
||||
|
||||
if(Build.VERSION.SDK_INT >= 34)
|
||||
{
|
||||
checkBoxChangeVolumeRingtone.setEnabled(true);
|
||||
|
||||
checkBoxChangeVolumeRingtone.setVisibility(View.VISIBLE);
|
||||
tvRingtoneVolume.setVisibility(View.VISIBLE);
|
||||
seekBarVolumeRingtones.setVisibility(View.VISIBLE);
|
||||
|
||||
tvNotificationsVolume.setText(getResources().getString(R.string.volumeNotifications));
|
||||
tvRingtoneVolume.setText(getResources().getString(R.string.volumeRingtone));
|
||||
}
|
||||
else
|
||||
{
|
||||
checkBoxChangeVolumeRingtone.setEnabled(false);
|
||||
tvRingtoneVolume.setEnabled(false);
|
||||
seekBarVolumeRingtones.setEnabled(false);
|
||||
|
||||
checkBoxChangeVolumeRingtone.setVisibility(View.GONE);
|
||||
tvRingtoneVolume.setVisibility(View.GONE);
|
||||
seekBarVolumeRingtones.setVisibility(View.GONE);
|
||||
|
||||
tvNotificationsVolume.setText(getResources().getString(R.string.volumeRingtone) + " + " + getResources().getString(R.string.volumeNotifications));
|
||||
}
|
||||
|
||||
// Scale SeekBars to the system's maximum volume values
|
||||
AudioManager am = (AudioManager) Miscellaneous.getAnyContext().getSystemService(Context.AUDIO_SERVICE);
|
||||
seekBarVolumeMusic.setMax(am.getStreamMaxVolume(AudioManager.STREAM_MUSIC));
|
||||
seekBarVolumeNotifications.setMax(am.getStreamMaxVolume(AudioManager.STREAM_NOTIFICATION));
|
||||
seekBarVolumeRingtones.setMax(am.getStreamMaxVolume(AudioManager.STREAM_RING));
|
||||
seekBarVolumeAlarms.setMax(am.getStreamMaxVolume(AudioManager.STREAM_ALARM));
|
||||
|
||||
soundModeAdapter = new ArrayAdapter<String>(this, R.layout.text_view_for_poi_listview_mediumtextsize, new String[]
|
||||
@@ -201,6 +229,14 @@ public class ActivityManageProfile extends Activity
|
||||
seekBarVolumeNotifications.setEnabled(isChecked);
|
||||
}
|
||||
});
|
||||
checkBoxChangeVolumeRingtone.setOnCheckedChangeListener(new OnCheckedChangeListener()
|
||||
{
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
|
||||
{
|
||||
seekBarVolumeRingtones.setEnabled(isChecked);
|
||||
}
|
||||
});
|
||||
checkBoxChangeVolumeAlarms.setOnCheckedChangeListener(new OnCheckedChangeListener()
|
||||
{
|
||||
@Override
|
||||
@@ -336,7 +372,7 @@ public class ActivityManageProfile extends Activity
|
||||
});
|
||||
|
||||
if(ActivityMainProfiles.profileToEdit != null)
|
||||
editProfile(ActivityMainProfiles.profileToEdit);
|
||||
loadValuesIntoGui(ActivityMainProfiles.profileToEdit);
|
||||
//else
|
||||
// new Profile to be created
|
||||
|
||||
@@ -369,7 +405,7 @@ public class ActivityManageProfile extends Activity
|
||||
}
|
||||
}
|
||||
|
||||
public void editProfile(Profile profileToEdit)
|
||||
public void loadValuesIntoGui(Profile profileToEdit)
|
||||
{
|
||||
guiUpdate = true;
|
||||
|
||||
@@ -378,6 +414,7 @@ public class ActivityManageProfile extends Activity
|
||||
checkBoxChangeDnd.setChecked(ActivityMainProfiles.profileToEdit.getChangeDndMode());
|
||||
checkBoxChangeVolumeMusicVideoGameMedia.setChecked(ActivityMainProfiles.profileToEdit.getChangeVolumeMusicVideoGameMedia());
|
||||
checkBoxChangeVolumeNotifications.setChecked(ActivityMainProfiles.profileToEdit.getChangeVolumeNotifications());
|
||||
checkBoxChangeVolumeRingtone.setChecked(ActivityMainProfiles.profileToEdit.getChangeVolumeRingtones());
|
||||
checkBoxChangeVolumeAlarms.setChecked(ActivityMainProfiles.profileToEdit.getChangeVolumeAlarms());
|
||||
checkBoxChangeIncomingCallsRingtone.setChecked(ActivityMainProfiles.profileToEdit.getChangeIncomingCallsRingtone());
|
||||
checkBoxChangeNotificationRingtone.setChecked(ActivityMainProfiles.profileToEdit.getChangeNotificationRingtone());
|
||||
@@ -390,6 +427,7 @@ public class ActivityManageProfile extends Activity
|
||||
spinnerDndMode.setSelection(ActivityMainProfiles.profileToEdit.getDndMode()-1);
|
||||
seekBarVolumeMusic.setProgress(ActivityMainProfiles.profileToEdit.getVolumeMusic());
|
||||
seekBarVolumeNotifications.setProgress(ActivityMainProfiles.profileToEdit.getVolumeNotifications());
|
||||
seekBarVolumeRingtones.setProgress(ActivityMainProfiles.profileToEdit.getVolumeRingtones());
|
||||
seekBarVolumeAlarms.setProgress(ActivityMainProfiles.profileToEdit.getVolumeAlarms());
|
||||
checkBoxAudibleSelection.setChecked(ActivityMainProfiles.profileToEdit.audibleSelection);
|
||||
checkBoxScreenLockUnlockSound.setChecked(ActivityMainProfiles.profileToEdit.screenLockUnlockSound);
|
||||
@@ -414,6 +452,7 @@ public class ActivityManageProfile extends Activity
|
||||
ActivityMainProfiles.profileToEdit.setChangeDndMode(checkBoxChangeDnd.isChecked());
|
||||
ActivityMainProfiles.profileToEdit.setChangeVolumeMusicVideoGameMedia(checkBoxChangeVolumeMusicVideoGameMedia.isChecked());
|
||||
ActivityMainProfiles.profileToEdit.setChangeVolumeNotifications(checkBoxChangeVolumeNotifications.isChecked());
|
||||
ActivityMainProfiles.profileToEdit.setChangeVolumeRingtones(checkBoxChangeVolumeRingtone.isChecked());
|
||||
ActivityMainProfiles.profileToEdit.setChangeVolumeAlarms(checkBoxChangeVolumeAlarms.isChecked());
|
||||
ActivityMainProfiles.profileToEdit.setChangeIncomingCallsRingtone(checkBoxChangeIncomingCallsRingtone.isChecked());
|
||||
ActivityMainProfiles.profileToEdit.setChangeNotificationRingtone(checkBoxChangeNotificationRingtone.isChecked());
|
||||
@@ -430,6 +469,7 @@ public class ActivityManageProfile extends Activity
|
||||
ActivityMainProfiles.profileToEdit.setDndMode(spinnerDndMode.getSelectedItemPosition()+1);
|
||||
ActivityMainProfiles.profileToEdit.setVolumeMusic(seekBarVolumeMusic.getProgress());
|
||||
ActivityMainProfiles.profileToEdit.setVolumeNotifications(seekBarVolumeNotifications.getProgress());
|
||||
ActivityMainProfiles.profileToEdit.setVolumeRingtones(seekBarVolumeRingtones.getProgress());
|
||||
ActivityMainProfiles.profileToEdit.setVolumeAlarms(seekBarVolumeAlarms.getProgress());
|
||||
ActivityMainProfiles.profileToEdit.setIncomingCallsRingtone(incomingCallsRingtone);
|
||||
ActivityMainProfiles.profileToEdit.setNotificationRingtone(notificationsRingtone);
|
||||
|
@@ -38,6 +38,9 @@ public class Profile implements Comparable<Profile>
|
||||
protected boolean changeVolumeNotifications;
|
||||
protected int volumeNotifications;
|
||||
|
||||
protected boolean changeVolumeRingtones;
|
||||
protected int volumeRingtones;
|
||||
|
||||
protected boolean changeVolumeAlarms;
|
||||
protected int volumeAlarms;
|
||||
|
||||
@@ -145,6 +148,26 @@ public class Profile implements Comparable<Profile>
|
||||
return volumeNotifications;
|
||||
}
|
||||
|
||||
public boolean getChangeVolumeRingtones()
|
||||
{
|
||||
return changeVolumeRingtones;
|
||||
}
|
||||
|
||||
public void setChangeVolumeRingtones(boolean changeVolumeRingtones)
|
||||
{
|
||||
this.changeVolumeRingtones = changeVolumeRingtones;
|
||||
}
|
||||
|
||||
public int getVolumeRingtones()
|
||||
{
|
||||
return volumeRingtones;
|
||||
}
|
||||
|
||||
public void setVolumeRingtones(int volumeRingtones)
|
||||
{
|
||||
this.volumeRingtones = volumeRingtones;
|
||||
}
|
||||
|
||||
public void setChangeVolumeAlarms(boolean changeVolumeAlarms)
|
||||
{
|
||||
this.changeVolumeAlarms = changeVolumeAlarms;
|
||||
@@ -531,7 +554,13 @@ public class Profile implements Comparable<Profile>
|
||||
|
||||
if(changeVolumeNotifications)
|
||||
am.setStreamVolume(AudioManager.STREAM_NOTIFICATION, volumeNotifications, AudioManager.FLAG_PLAY_SOUND);
|
||||
|
||||
|
||||
if(Build.VERSION.SDK_INT >= 34)
|
||||
{
|
||||
if (changeVolumeRingtones)
|
||||
am.setStreamVolume(AudioManager.STREAM_RING, volumeRingtones, AudioManager.FLAG_PLAY_SOUND);
|
||||
}
|
||||
|
||||
if(changeVolumeAlarms)
|
||||
am.setStreamVolume(AudioManager.STREAM_ALARM, volumeAlarms, AudioManager.FLAG_PLAY_SOUND);
|
||||
|
||||
@@ -637,6 +666,15 @@ public class Profile implements Comparable<Profile>
|
||||
return false;
|
||||
}
|
||||
|
||||
if(Build.VERSION.SDK_INT >= 34)
|
||||
{
|
||||
if (changeVolumeRingtones)
|
||||
{
|
||||
if (am.getStreamVolume(AudioManager.STREAM_RING) != volumeRingtones)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (changeVolumeAlarms)
|
||||
{
|
||||
if (am.getStreamVolume(AudioManager.STREAM_ALARM) != volumeAlarms)
|
||||
|
@@ -148,6 +148,13 @@ public class XmlFileInterface
|
||||
serializer.startTag(null, "volumeNotifications");
|
||||
serializer.text(String.valueOf(Profile.getProfileCollection().get(i).getVolumeNotifications()));
|
||||
serializer.endTag(null, "volumeNotifications");
|
||||
|
||||
serializer.startTag(null, "changeVolumeRingtones");
|
||||
serializer.text(String.valueOf(Profile.getProfileCollection().get(i).getChangeVolumeRingtones()));
|
||||
serializer.endTag(null, "changeVolumeRingtones");//
|
||||
serializer.startTag(null, "volumeRingtones");
|
||||
serializer.text(String.valueOf(Profile.getProfileCollection().get(i).getVolumeRingtones()));
|
||||
serializer.endTag(null, "volumeRingtones");
|
||||
|
||||
serializer.startTag(null, "changeVolumeAlarms");
|
||||
serializer.text(String.valueOf(Profile.getProfileCollection().get(i).getChangeVolumeAlarms()));
|
||||
@@ -619,8 +626,12 @@ public class XmlFileInterface
|
||||
newProfile.setVolumeMusic(Integer.parseInt(readTag(parser, "volumeMusic")));
|
||||
else if (name.equals("changeVolumeNotifications"))
|
||||
newProfile.setChangeVolumeNotifications(Boolean.parseBoolean(readTag(parser, "changeVolumeNotifications")));
|
||||
else if (name.equals("changeVolumeRingtones"))
|
||||
newProfile.setChangeVolumeRingtones(Boolean.parseBoolean(readTag(parser, "changeVolumeRingtones")));
|
||||
else if (name.equals("volumeNotifications"))
|
||||
newProfile.setVolumeNotifications(Integer.parseInt(readTag(parser, "volumeNotifications")));
|
||||
else if (name.equals("volumeRingtones"))
|
||||
newProfile.setVolumeRingtones(Integer.parseInt(readTag(parser, "volumeRingtones")));
|
||||
else if (name.equals("changeVolumeAlarms"))
|
||||
newProfile.setChangeVolumeAlarms(Boolean.parseBoolean(readTag(parser, "changeVolumeAlarms")));
|
||||
else if (name.equals("volumeAlarms"))
|
||||
|
Reference in New Issue
Block a user