diff --git a/app/src/apkFlavor/AndroidManifest.xml b/app/src/apkFlavor/AndroidManifest.xml
index b980844..7ec926c 100644
--- a/app/src/apkFlavor/AndroidManifest.xml
+++ b/app/src/apkFlavor/AndroidManifest.xml
@@ -142,7 +142,7 @@
-
+
-
+
-
+
pInfos = null;
public static Trigger resultingTrigger;
@@ -393,7 +394,5 @@ public class ActivityManageTriggerNotification extends Activity
progressDialog.dismiss();
getActionStartActivityDialog1().show();
}
-
-
}
}
diff --git a/app/src/main/java/com/jens/automation2/ActivityManageTriggerPhoneCall.java b/app/src/main/java/com/jens/automation2/ActivityManageTriggerPhoneCall.java
new file mode 100644
index 0000000..e00e783
--- /dev/null
+++ b/app/src/main/java/com/jens/automation2/ActivityManageTriggerPhoneCall.java
@@ -0,0 +1,143 @@
+package com.jens.automation2;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.ProgressDialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.pm.ActivityInfo;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.os.AsyncTask;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.ArrayAdapter;
+import android.widget.Button;
+import android.widget.CheckBox;
+import android.widget.CompoundButton;
+import android.widget.EditText;
+import android.widget.RadioButton;
+import android.widget.Spinner;
+import android.widget.TextView;
+
+import androidx.annotation.Nullable;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import static com.jens.automation2.Trigger.triggerParameter2Split;
+
+public class ActivityManageTriggerPhoneCall extends Activity
+{
+ public static Trigger editedPhoneCallTrigger;
+ boolean edit = false;
+ public static Trigger resultingTrigger;
+ ProgressDialog progressDialog = null;
+
+ EditText etTriggerPhoneCallPhoneNumber;
+ RadioButton rbTriggerPhoneCallStateAny, rbTriggerPhoneCallStateRinging, rbTriggerPhoneCallStateStarted, rbTriggerPhoneCallStateStopped, rbTriggerPhoneCallDirectionAny, rbTriggerPhoneCallDirectionIncoming, rbTriggerPhoneCallDirectionOutgoing;
+ Button bSaveTriggerPhoneCall, bTriggerPhoneCallImportFromContacts;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState)
+ {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_manage_trigger_notification);
+
+ etTriggerPhoneCallPhoneNumber = (EditText)findViewById(R.id.etTriggerPhoneCallPhoneNumber);
+ rbTriggerPhoneCallStateAny = (RadioButton)findViewById(R.id.rbTriggerPhoneCallStateAny);
+ rbTriggerPhoneCallStateRinging = (RadioButton)findViewById(R.id.rbTriggerPhoneCallStateRinging);
+ rbTriggerPhoneCallStateStarted = (RadioButton)findViewById(R.id.rbTriggerPhoneCallStateStarted);
+ rbTriggerPhoneCallStateStopped = (RadioButton)findViewById(R.id.rbTriggerPhoneCallStateStopped);
+ rbTriggerPhoneCallDirectionAny = (RadioButton)findViewById(R.id.rbTriggerPhoneCallDirectionAny);
+ rbTriggerPhoneCallDirectionIncoming = (RadioButton)findViewById(R.id.rbTriggerPhoneCallDirectionIncoming);
+ rbTriggerPhoneCallDirectionOutgoing = (RadioButton)findViewById(R.id.rbTriggerPhoneCallDirectionOutgoing);
+ bTriggerPhoneCallImportFromContacts = (Button) findViewById(R.id.bTriggerPhoneCallImportFromContacts);
+ bSaveTriggerPhoneCall = (Button) findViewById(R.id.bSaveTriggerPhoneCall);
+
+ bSaveTriggerPhoneCall.setOnClickListener(new View.OnClickListener()
+ {
+ @Override
+ public void onClick(View v)
+ {
+ String tp2Result = "";
+
+ if(rbTriggerPhoneCallStateAny.isChecked())
+ tp2Result += Trigger.triggerPhoneCallStateAny;
+ else if(rbTriggerPhoneCallStateRinging.isChecked())
+ tp2Result += Trigger.triggerPhoneCallStateRinging;
+ else if(rbTriggerPhoneCallStateStarted.isChecked())
+ tp2Result += Trigger.triggerPhoneCallStateStarted;
+ else if(rbTriggerPhoneCallStateStopped.isChecked())
+ tp2Result += Trigger.triggerPhoneCallStateStopped;
+
+ tp2Result += triggerParameter2Split;
+
+ if(rbTriggerPhoneCallDirectionAny.isChecked())
+ tp2Result += Trigger.triggerPhoneCallDirectionAny;
+ else if(rbTriggerPhoneCallDirectionIncoming.isChecked())
+ tp2Result += Trigger.triggerPhoneCallDirectionImcoming;
+ else if(rbTriggerPhoneCallDirectionOutgoing.isChecked())
+ tp2Result += Trigger.triggerPhoneCallDirectionOutgoing;
+
+ tp2Result += triggerParameter2Split;
+
+ if(etTriggerPhoneCallPhoneNumber.getText() != null && etTriggerPhoneCallPhoneNumber.getText().toString().length() > 0)
+ tp2Result += etTriggerPhoneCallPhoneNumber.getText().toString();
+ else
+ tp2Result += Trigger.triggerPhoneCallNumberAny;
+
+ if(edit)
+ {
+ editedPhoneCallTrigger.setTriggerParameter(false);
+ editedPhoneCallTrigger.setTriggerParameter2(tp2Result);
+ ActivityManageTriggerPhoneCall.this.setResult(RESULT_OK);
+ }
+ else
+ {
+ Intent data = new Intent();
+ data.putExtra("triggerParameter", false);
+ data.putExtra("triggerParameter2", tp2Result);
+ ActivityManageTriggerPhoneCall.this.setResult(RESULT_OK, data);
+ }
+
+ finish();
+ }
+ });
+
+ Intent i = getIntent();
+ if(i.getBooleanExtra("edit", false) == true)
+ {
+ edit = true;
+ loadValuesIntoGui();
+ }
+ }
+
+ private void loadValuesIntoGui()
+ {
+ String[] parts = editedPhoneCallTrigger.getTriggerParameter2().split(triggerParameter2Split);
+
+ if(parts[0].equals(Trigger.triggerPhoneCallStateAny))
+ rbTriggerPhoneCallStateAny.setChecked(true);
+ else if(parts[0].equals(Trigger.triggerPhoneCallStateRinging))
+ rbTriggerPhoneCallStateRinging.setChecked(true);
+ else if(parts[0].equals(Trigger.triggerPhoneCallStateStarted))
+ rbTriggerPhoneCallStateStarted.setChecked(true);
+ else if(parts[0].equals(Trigger.triggerPhoneCallStateStopped))
+ rbTriggerPhoneCallStateStopped.setChecked(true);
+
+ if(parts[1].equals(Trigger.triggerPhoneCallDirectionAny))
+ rbTriggerPhoneCallDirectionAny.setChecked(true);
+ else if(parts[0].equals(Trigger.triggerPhoneCallDirectionImcoming))
+ rbTriggerPhoneCallDirectionIncoming.setChecked(true);
+ else if(parts[0].equals(Trigger.triggerPhoneCallDirectionOutgoing))
+ rbTriggerPhoneCallDirectionOutgoing.setChecked(true);
+
+ if(!parts[2].equals(Trigger.triggerPhoneCallNumberAny))
+ etTriggerPhoneCallPhoneNumber.setText(parts[2]);
+ }
+}
diff --git a/app/src/main/java/com/jens/automation2/ActivityTriggerPhoneCall.java b/app/src/main/java/com/jens/automation2/ActivityTriggerPhoneCall.java
deleted file mode 100644
index 1ff96fa..0000000
--- a/app/src/main/java/com/jens/automation2/ActivityTriggerPhoneCall.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.jens.automation2;
-
-import android.app.Activity;
-import android.os.Bundle;
-
-import androidx.annotation.Nullable;
-
-public class ActivityTriggerPhoneCall extends Activity
-{
- @Override
- protected void onCreate(@Nullable Bundle savedInstanceState)
- {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_manage_trigger_phone_call);
- }
-}
diff --git a/app/src/main/java/com/jens/automation2/Trigger.java b/app/src/main/java/com/jens/automation2/Trigger.java
index 4b9b155..2c26d30 100644
--- a/app/src/main/java/com/jens/automation2/Trigger.java
+++ b/app/src/main/java/com/jens/automation2/Trigger.java
@@ -77,6 +77,15 @@ public class Trigger
private PointOfInterest pointOfInterest = null;
private TimeFrame timeFrame;
+ public static String triggerPhoneCallStateRinging = "ringing";
+ public static String triggerPhoneCallStateStarted = "started";
+ public static String triggerPhoneCallStateStopped = "stopped";
+ public static String triggerPhoneCallStateAny = "any";
+ public static String triggerPhoneCallDirectionImcoming = "incoming";
+ public static String triggerPhoneCallDirectionOutgoing = "outgoing";
+ public static String triggerPhoneCallDirectionAny = "any";
+ public static String triggerPhoneCallNumberAny = "any";
+
private double speed; //km/h
private long noiseLevelDb;
private String wifiName = "";
diff --git a/app/src/main/res/layout/activity_manage_trigger_phone_call.xml b/app/src/main/res/layout/activity_manage_trigger_phone_call.xml
index 74dbf98..994a0de 100644
--- a/app/src/main/res/layout/activity_manage_trigger_phone_call.xml
+++ b/app/src/main/res/layout/activity_manage_trigger_phone_call.xml
@@ -1,113 +1,186 @@
-
+ android:layout_height="wrap_content"
+ android:layout_margin="@dimen/default_margin" >
-
+ android:orientation="vertical" >
-
-
-
+ android:layout_height="wrap_content"
+ android:textAppearance="@style/TextAppearance.AppCompat.Headline"
+ android:text="@string/phoneCall" />
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
\ No newline at end of file
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml
index 2df1639..5ebe5ab 100644
--- a/app/src/main/res/values-de/strings.xml
+++ b/app/src/main/res/values-de/strings.xml
@@ -653,7 +653,7 @@
Keine Dateien konnten importiert werden.
Nicht alle passenden Dateien konnten importiert werden.
Webseite mit Beispielen öffnen
- Sie können eine bestimmte Nummer eingeben, aber müssen nicht. Wenn Sie eine angeben wollen, können Sie auch eine aus dem Adressbuch auswählen.
+ Sie können eine bestimmte Nummer eingeben, aber müssen nicht. Wenn Sie eine angeben wollen, können Sie auch eine aus dem Adressbuch auswählen. Außerdem können Sie reguläre Audrücke verwenden.
Fehler beim Importieren der Einstellungen.
Regeln und Orte wurden erfolgreich importiert.
Fehler beim Importieren der Regeln.
diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml
index adbec28..8b28bca 100644
--- a/app/src/main/res/values-es/strings.xml
+++ b/app/src/main/res/values-es/strings.xml
@@ -51,10 +51,10 @@
continuar
Regla
Enviar mensajes SMS
- Read contact data
- Regla \"%1$s\" requires this.
+ Leer directorio
+ Regla \"%1$s\" lo necesita.
Enviar mensaje SMS
- Import number from contacts
+ Importar numero del directorio
Edit
Texto de enviar
Contraseña
@@ -312,4 +312,5 @@
Valor del parámetro
Añadir pareja intento
Tipo del parámetro
+ Puedes entrar un numero, pero es opciónal. Si quieres usar un puedes elegir un de su directorio o entrar un manualmente. Adiciónalmente puedes usar expresiónes regulares.
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 4de33e7..7fd4a9d 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -644,7 +644,7 @@
Enter a valid action
Enter a valid package name.
State
- You can enter a specific phone number, but you don\'t have to. If you want to specify one you can either pick one from your address book or enter it manually.
+ You can enter a specific phone number, but you don\'t have to. If you want to specify one you can either pick one from your address book or enter it manually. In addition you may use regular expressions.
Import configuration
Export configuration
More settings
@@ -667,5 +667,6 @@
Package name
Activity/action name
Warning
+ ringing
\ No newline at end of file