diff --git a/astrid/AndroidManifest.xml b/astrid/AndroidManifest.xml index 233b37f79..b51db00b3 100644 --- a/astrid/AndroidManifest.xml +++ b/astrid/AndroidManifest.xml @@ -278,6 +278,10 @@ + + + diff --git a/astrid/plugin-src/com/todoroo/astrid/calls/MissedCallActivity.java b/astrid/plugin-src/com/todoroo/astrid/calls/MissedCallActivity.java new file mode 100644 index 000000000..11be3fee3 --- /dev/null +++ b/astrid/plugin-src/com/todoroo/astrid/calls/MissedCallActivity.java @@ -0,0 +1,47 @@ +package com.todoroo.astrid.calls; + +import android.app.Activity; +import android.content.res.Resources; +import android.os.Bundle; +import android.view.View; +import android.view.View.OnClickListener; +import android.widget.TextView; + +import com.timsu.astrid.R; +import com.todoroo.andlib.utility.AndroidUtilities; +import com.todoroo.astrid.service.ThemeService; + +public class MissedCallActivity extends Activity { + + public static final String EXTRA_NUMBER = "number"; //$NON-NLS-1$ + + private final OnClickListener dismissListener = new OnClickListener() { + @Override + public void onClick(View v) { + finish(); + AndroidUtilities.callOverridePendingTransition(MissedCallActivity.this, 0, android.R.anim.fade_out); + } + }; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + setContentView(R.layout.missed_call_activity); + int color = ThemeService.getThemeColor(); + + TextView returnCallButton = (TextView) findViewById(R.id.call_return); + TextView addTaskButton = (TextView) findViewById(R.id.call_add); + TextView ignoreButton = (TextView) findViewById(R.id.call_ignore); + View dismissView = findViewById(R.id.dismiss); + + Resources r = getResources(); + returnCallButton.setBackgroundColor(r.getColor(color)); + addTaskButton.setBackgroundColor(r.getColor(color)); + + ignoreButton.setOnClickListener(dismissListener); + dismissView.setOnClickListener(dismissListener); + + System.err.println("Should display notification for number: " + getIntent().getStringExtra(EXTRA_NUMBER)); + } +} diff --git a/astrid/plugin-src/com/todoroo/astrid/calls/PhoneStateChangedReceiver.java b/astrid/plugin-src/com/todoroo/astrid/calls/PhoneStateChangedReceiver.java index ceacadfa3..2930bfc71 100644 --- a/astrid/plugin-src/com/todoroo/astrid/calls/PhoneStateChangedReceiver.java +++ b/astrid/plugin-src/com/todoroo/astrid/calls/PhoneStateChangedReceiver.java @@ -42,8 +42,10 @@ public class PhoneStateChangedReceiver extends BroadcastReceiver { try { if (calls.getCount() > 0) { - calls.moveToFirst(); - System.err.println("Should display notification for number: " + lastNumber); + Intent missedCallIntent = new Intent(context, MissedCallActivity.class); + missedCallIntent.putExtra(MissedCallActivity.EXTRA_NUMBER, lastNumber); + missedCallIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + context.startActivity(missedCallIntent); } } finally { calls.close(); diff --git a/astrid/res/layout/astrid_missed_call_view.xml b/astrid/res/layout/astrid_missed_call_view.xml new file mode 100644 index 000000000..ec29b3c5f --- /dev/null +++ b/astrid/res/layout/astrid_missed_call_view.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/astrid/res/layout/missed_call_activity.xml b/astrid/res/layout/missed_call_activity.xml new file mode 100644 index 000000000..44a54f4b3 --- /dev/null +++ b/astrid/res/layout/missed_call_activity.xml @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file diff --git a/astrid/res/values/strings-core.xml b/astrid/res/values/strings-core.xml index 86e6ec114..4adc2da57 100644 --- a/astrid/res/values/strings-core.xml +++ b/astrid/res/values/strings-core.xml @@ -463,6 +463,21 @@ I Disagree + + + + Missed call! + + + Call back + + + Add to task list + + + Ignore + + diff --git a/astrid/src/com/todoroo/astrid/service/ThemeService.java b/astrid/src/com/todoroo/astrid/service/ThemeService.java index 127b1d5f1..4211aeb8f 100644 --- a/astrid/src/com/todoroo/astrid/service/ThemeService.java +++ b/astrid/src/com/todoroo/astrid/service/ThemeService.java @@ -65,6 +65,21 @@ public class ThemeService { return R.style.Theme_White_Blue; } + public static int getThemeColor() { + int theme = getTheme(); + switch(theme) { + case R.style.Theme: + case R.style.Theme_Transparent: + return R.color.blue_theme_color; + case R.style.Theme_White: + case R.style.Theme_TransparentWhite: + return R.color.red_theme_color; + case R.style.Theme_White_Blue: + default: + return R.color.dark_blue_theme_color; + } + } + public static int getEditDialogTheme() { int themeSetting = ThemeService.getTheme(); int theme;