Many fixes
This commit is contained in:
@ -196,7 +196,14 @@ public class ActivityMainRules extends ActivityGeneric
|
||||
{
|
||||
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
|
||||
alertDialogBuilder.setTitle(getResources().getString(R.string.whatToDoWithRule));
|
||||
alertDialogBuilder.setItems(new String[]{ getResources().getString(R.string.runManually), getResources().getString(R.string.edit), getResources().getString(R.string.deleteCapital), getResources().getString(R.string.clone) }, new DialogInterface.OnClickListener()
|
||||
|
||||
String toggleEnabled;
|
||||
if(ruleThisIsAbout.isRuleActive())
|
||||
toggleEnabled = getResources().getString(R.string.disable);
|
||||
else
|
||||
toggleEnabled = getResources().getString(R.string.enable);
|
||||
|
||||
alertDialogBuilder.setItems(new String[]{ getResources().getString(R.string.runManually), getResources().getString(R.string.edit), getResources().getString(R.string.deleteCapital), toggleEnabled, getResources().getString(R.string.clone) }, new DialogInterface.OnClickListener()
|
||||
{
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which)
|
||||
@ -248,6 +255,19 @@ public class ActivityMainRules extends ActivityGeneric
|
||||
deleteDialog.show();
|
||||
break;
|
||||
case 3:
|
||||
ruleToEdit = ruleThisIsAbout;
|
||||
if(ruleToEdit.isRuleActive())
|
||||
ruleToEdit.setRuleActive(false);
|
||||
else
|
||||
ruleToEdit.setRuleActive(true);
|
||||
|
||||
if(ruleToEdit.change(ActivityMainRules.this))
|
||||
{
|
||||
ruleToEdit = null; //clear cache
|
||||
updateListView();
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
ruleToEdit = ruleThisIsAbout;
|
||||
if(ruleToEdit.cloneRule(ActivityMainRules.this))
|
||||
{
|
||||
|
@ -592,16 +592,42 @@ public class Trigger
|
||||
|
||||
boolean checkHeadsetPlugged()
|
||||
{
|
||||
if(HeadphoneJackListener.isHeadsetConnected() != this.getTriggerParameter())
|
||||
return false;
|
||||
else
|
||||
if(this.getHeadphoneType() != 2 && this.getHeadphoneType() != HeadphoneJackListener.getHeadphoneType())
|
||||
/*
|
||||
Wenn verbunden:
|
||||
- either -> true
|
||||
- headphone -> true
|
||||
- mikro -> wenn tatsächlich mikro
|
||||
|
||||
Wenn nicht verbunden:
|
||||
- either -> true
|
||||
- headphone -> true
|
||||
- mikro -> true
|
||||
*/
|
||||
|
||||
if(HeadphoneJackListener.isHeadsetConnected()) // connection detected
|
||||
{
|
||||
Miscellaneous.logEvent("i", Miscellaneous.getAnyContext().getResources().getString(R.string.ruleCheckOf), String.format(Miscellaneous.getAnyContext().getResources().getString(R.string.ruleDoesntApplyWrongHeadphoneType), this.getParentRule().getName()), 3);
|
||||
return false;
|
||||
if(this.getTriggerParameter()) // connection demanded
|
||||
{
|
||||
if (this.getHeadphoneType() == 1)
|
||||
{
|
||||
if (this.getHeadphoneType() == HeadphoneJackListener.getHeadphoneType()) // Microphone demanded
|
||||
return true;
|
||||
else
|
||||
Miscellaneous.logEvent("i", Miscellaneous.getAnyContext().getResources().getString(R.string.ruleCheckOf), String.format(Miscellaneous.getAnyContext().getResources().getString(R.string.ruleDoesntApplyWrongHeadphoneType), this.getParentRule().getName()), 3);
|
||||
}
|
||||
else
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else // disconnection detected
|
||||
{
|
||||
// Type doesn't matter here
|
||||
|
||||
if(!this.getTriggerParameter()) // disconnection demanded
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean checkSubSystemState()
|
||||
|
@ -53,12 +53,14 @@ public class HeadphoneJackListener extends BroadcastReceiver implements Automati
|
||||
{
|
||||
try
|
||||
{
|
||||
/*Broadcast Action: Wired Headset plugged in or unplugged.
|
||||
The intent will have the following extra values:
|
||||
|
||||
state - 0 for unplugged, 1 for plugged.
|
||||
name - Headset type, human readable string
|
||||
microphone - 1 if headset has a microphone, 0 otherwise*/
|
||||
/*
|
||||
Broadcast Action: Wired Headset plugged in or unplugged.
|
||||
The intent will have the following extra values:
|
||||
|
||||
state - 0 for unplugged, 1 for plugged.
|
||||
name - Headset type, human readable string
|
||||
microphone - 1 if headset has a microphone, 0 otherwise
|
||||
*/
|
||||
|
||||
int state = intent.getExtras().getInt("state");
|
||||
String name = intent.getExtras().getString("name");
|
||||
|
@ -368,7 +368,7 @@
|
||||
<string name="headsetConnected">Headset (Art: %1$s) verbunden</string>
|
||||
<string name="headsetDisconnected">Headset (type: %1$s) getrennt</string>
|
||||
<string name="headphoneSimple">Kopfhörer</string>
|
||||
<string name="headphoneMicrophone">Mikrofon</string>
|
||||
<string name="headphoneMicrophone">mit Mikrofon</string>
|
||||
<string name="headphoneAny">Egal</string>
|
||||
<string name="headphoneSelectType">Kopfhörer Typ auswählen</string>
|
||||
<string name="whatsThis">Was ist das?</string>
|
||||
|
@ -32,7 +32,7 @@
|
||||
<string name="thursday">Jueves</string>
|
||||
<string name="friday">Viernes</string>
|
||||
<string name="saturday">Sábado</string>
|
||||
<string name="headphoneMicrophone">Micrófono</string>
|
||||
<string name="headphoneMicrophone">con micrófono</string>
|
||||
<string name="whatsThis">Qué es esto?</string>
|
||||
<string name="privacyLocationingTitle">Solo usar localización privada</string>
|
||||
<string name="volumeAlarms">Alarmas</string>
|
||||
|
@ -371,7 +371,7 @@
|
||||
<string name="headsetConnected">Écouteurs (type : %1$s) est connecté</string>
|
||||
<string name="headsetDisconnected">Écouteurs (type : %1$s) est déconnecté</string>
|
||||
<string name="headphoneSimple">Écouteurs</string>
|
||||
<string name="headphoneMicrophone">Microphone</string>
|
||||
<string name="headphoneMicrophone">avec microphone</string>
|
||||
<string name="headphoneAny">Tous</string>
|
||||
<string name="headphoneSelectType">Choisissez le type d’écouteurs</string>
|
||||
<string name="whatsThis">Qu’est ce que c’est ?</string>
|
||||
|
@ -219,7 +219,7 @@
|
||||
<string name="gpsComparison">Confronto del GPS</string>
|
||||
<string name="hapticFeedback">Riscontro tattile (vibra al tocco)</string>
|
||||
<string name="headphoneAny">Uno dei due</string>
|
||||
<string name="headphoneMicrophone">Microfono</string>
|
||||
<string name="headphoneMicrophone">con microfono</string>
|
||||
<string name="headphoneSelectType">Seleziona il tipo di auricolare</string>
|
||||
<string name="headphoneSimple">Auricolari</string>
|
||||
<string name="headsetConnected">"Connessi auricolari (tipo: %1$s) "</string>
|
||||
|
@ -365,8 +365,8 @@
|
||||
<string name="actionPlayMusic">Muziekspeler openen</string>
|
||||
<string name="headsetConnected">Headset (type: %1$s) aangesloten</string>
|
||||
<string name="headsetDisconnected">Headset (type: %1$s) ontkoppeld</string>
|
||||
<string name="headphoneSimple">Headphone</string>
|
||||
<string name="headphoneMicrophone">Microphone</string>
|
||||
<string name="headphoneSimple">hoofdtelefoon</string>
|
||||
<string name="headphoneMicrophone">met microfoon</string>
|
||||
<string name="headphoneAny">willekeurige</string>
|
||||
<string name="headphoneSelectType">Selecteer type hoofdtelefoon</string>
|
||||
<string name="whatsThis">Wat is dit?</string>
|
||||
|
@ -443,7 +443,7 @@
|
||||
<string name="headsetConnected">Zestaw słuchawkowy (typ: %1$s) podłączony</string>
|
||||
<string name="headsetDisconnected">Zestaw słuchawkowy (typ: %1$s) rozłączony</string>
|
||||
<string name="headphoneSimple">Słuchawki</string>
|
||||
<string name="headphoneMicrophone">Mikrofon</string>
|
||||
<string name="headphoneMicrophone">z mikrofonem</string>
|
||||
<string name="headphoneAny">Albo</string>
|
||||
<string name="headphoneSelectType">Wybierz typ słuchawek</string>
|
||||
<string name="ruleDoesntApplyWrongHeadphoneType" translatable="false">Rule \"%1$s\" doesn\'t apply. Wrong headphone type.</string>
|
||||
|
@ -412,7 +412,7 @@
|
||||
<string name="headsetConnected">Гарнитура (тип: %1$s) подключена</string>
|
||||
<string name="headsetDisconnected">Гарнитура (тип: %1$s) отключена</string>
|
||||
<string name="headphoneSimple">Наушники</string>
|
||||
<string name="headphoneMicrophone">Микрофон</string>
|
||||
<string name="headphoneMicrophone">с микрофоном</string>
|
||||
<string name="headphoneAny">Любой</string>
|
||||
<string name="headphoneSelectType">Выберите тип гарнитуры</string>
|
||||
<string name="ruleDoesntApplyWrongHeadphoneType" translatable="false">Правило %1$s не применится. Неверный тип гарнитуры.</string>
|
||||
|
@ -362,7 +362,7 @@
|
||||
<string name="headsetConnected">耳机(类型:%1$s)已连接</string>
|
||||
<string name="headsetDisconnected">耳机(类型:%1$s)已断开连接</string>
|
||||
<string name="headphoneSimple">无麦克风</string>
|
||||
<string name="headphoneMicrophone">有麦克风</string>
|
||||
<string name="headphoneMicrophone">带麦克风</string>
|
||||
<string name="headphoneAny">均可</string>
|
||||
<string name="headphoneSelectType">选择耳机类型</string>
|
||||
<string name="whatsThis">这是什么?</string>
|
||||
|
@ -444,7 +444,7 @@
|
||||
<string name="headsetConnected">Headset (type: %1$s) connected</string>
|
||||
<string name="headsetDisconnected">Headset (type: %1$s) disconnected</string>
|
||||
<string name="headphoneSimple">Headphone</string>
|
||||
<string name="headphoneMicrophone">Microphone</string>
|
||||
<string name="headphoneMicrophone">with microphone</string>
|
||||
<string name="headphoneAny">Either</string>
|
||||
<string name="headphoneSelectType">Select type of headphone</string>
|
||||
<string name="ruleDoesntApplyWrongHeadphoneType" translatable="false">Rule \"%1$s\" doesn\'t apply. Wrong headphone type.</string>
|
||||
@ -956,4 +956,6 @@
|
||||
<string name="locationPermissionRequired">Location permission is required to continue.</string>
|
||||
<string name="Android14TimePickerHint">Apparently there\'s a bug in Android 14 regarding a time picker dialog. If the following screen crashes when you try to use the up and down buttons next to a field, try inputting numbers with the keyboard instead. I did never find a solution for this and my app is not the only one affected. It looks like this was fixed in Android 15.</string>
|
||||
<string name="screenBrightGoogleComment">Because someone at Google seems to have been smoking something the screen brightness setting has been behaving very weird for some Android versions. This behavior has nothing to do with what you\'d think it does according to their own documentation. I\'ve tried to adapt to this as best as I could, but do not expect very precise settings. That means the resulting setting may deviate a bit from what you configure here.</string>
|
||||
<string name="disable">Disable</string>
|
||||
<string name="enable">Enable</string>
|
||||
</resources>
|
@ -8,5 +8,7 @@
|
||||
* Fixed: Bug in NFC trigger that affected only the Google Play version
|
||||
* Fixed: Examples URL fixed
|
||||
* Fixed: Service icon could not be hidden in Android 7 and below
|
||||
* Fixed: Headphone trigger was not correctly processed
|
||||
* Added: Variable checks can now be inverted. Also regular expressions are now supported.
|
||||
* Added: Setting to turn on/off console logging (logcat)
|
||||
* Added: Setting to turn on/off console logging (logcat)
|
||||
* Added: Rules can now be enabled/disabled from the context menu on the rules screen
|
Reference in New Issue
Block a user