|
@@ -1,5 +1,6 @@
|
|
|
package com.example.david.libretasker;
|
|
package com.example.david.libretasker;
|
|
|
|
|
|
|
|
|
|
+import android.telephony.TelephonyManager;
|
|
|
import android.annotation.TargetApi;
|
|
import android.annotation.TargetApi;
|
|
|
import android.content.BroadcastReceiver;
|
|
import android.content.BroadcastReceiver;
|
|
|
import android.content.Context;
|
|
import android.content.Context;
|
|
@@ -14,6 +15,7 @@ import android.util.Log;
|
|
|
import com.example.david.libretasker.Actions.Actions;
|
|
import com.example.david.libretasker.Actions.Actions;
|
|
|
import com.example.david.libretasker.Events.Event;
|
|
import com.example.david.libretasker.Events.Event;
|
|
|
import com.example.david.libretasker.Events.NetworkEvent;
|
|
import com.example.david.libretasker.Events.NetworkEvent;
|
|
|
|
|
+import com.example.david.libretasker.Events.PhoneEvent;
|
|
|
import com.example.david.libretasker.Events.SMSEvent;
|
|
import com.example.david.libretasker.Events.SMSEvent;
|
|
|
import com.example.david.libretasker.Events.ScreenEvent;
|
|
import com.example.david.libretasker.Events.ScreenEvent;
|
|
|
import com.example.david.libretasker.Events.StateEvent;
|
|
import com.example.david.libretasker.Events.StateEvent;
|
|
@@ -60,6 +62,11 @@ public class EventReceiver extends BroadcastReceiver {
|
|
|
case Event.STATE_CHANGED:
|
|
case Event.STATE_CHANGED:
|
|
|
e = new StateEvent();
|
|
e = new StateEvent();
|
|
|
String s = intent.getDataString();
|
|
String s = intent.getDataString();
|
|
|
|
|
+
|
|
|
|
|
+ break;
|
|
|
|
|
+ case TelephonyManager.ACTION_PHONE_STATE_CHANGED:
|
|
|
|
|
+ e = new PhoneEvent();
|
|
|
|
|
+ data = UserData.getData("PhoneCall");
|
|
|
break;
|
|
break;
|
|
|
default:
|
|
default:
|
|
|
Log.d(TAG, intent.getAction());
|
|
Log.d(TAG, intent.getAction());
|
|
@@ -69,6 +76,9 @@ public class EventReceiver extends BroadcastReceiver {
|
|
|
if ( e == null )
|
|
if ( e == null )
|
|
|
return;
|
|
return;
|
|
|
|
|
|
|
|
|
|
+ if ( data == null )
|
|
|
|
|
+ throw new AssertionError("Data is null! WTF!");
|
|
|
|
|
+
|
|
|
actions = (ArrayList<HashMap<String, Object>>)data.get("Actions");
|
|
actions = (ArrayList<HashMap<String, Object>>)data.get("Actions");
|
|
|
eventData = (HashMap<String, Object>)data.get("Event");
|
|
eventData = (HashMap<String, Object>)data.get("Event");
|
|
|
eventData.put("Intent", intent);
|
|
eventData.put("Intent", intent);
|