Displaying the activity in most of its awesomeness

pull/14/head
Sam Bosley 13 years ago
parent 040aca6d7c
commit 29c41bcffe

@ -278,6 +278,10 @@
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name="com.todoroo.astrid.calls.MissedCallActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar">
</activity>
<!-- tags --> <!-- tags -->
<receiver android:name="com.todoroo.astrid.tags.TagsPlugin"> <receiver android:name="com.todoroo.astrid.tags.TagsPlugin">
<intent-filter> <intent-filter>

@ -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));
}
}

@ -42,8 +42,10 @@ public class PhoneStateChangedReceiver extends BroadcastReceiver {
try { try {
if (calls.getCount() > 0) { if (calls.getCount() > 0) {
calls.moveToFirst(); Intent missedCallIntent = new Intent(context, MissedCallActivity.class);
System.err.println("Should display notification for number: " + lastNumber); missedCallIntent.putExtra(MissedCallActivity.EXTRA_NUMBER, lastNumber);
missedCallIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(missedCallIntent);
} }
} finally { } finally {
calls.close(); calls.close();

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/reminder_root"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip"
android:orientation="vertical"
android:background="@drawable/reminder_dialog_background">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="5dip"
android:layout_marginRight="5dip"
android:layout_marginBottom="20dip"
android:layout_marginLeft="5dip">
<TextView
android:id="@+id/reminder_title"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="20sp"
android:textColor="@android:color/white"
android:layout_weight="1"
android:text="@string/MCA_title"/>
<ImageView
android:id="@+id/dismiss"
android:layout_width="25dip"
android:layout_height="25dip"
android:scaleType="fitCenter"
android:src="@android:drawable/ic_menu_close_clear_cancel"/>
</LinearLayout>
<include layout="@layout/astrid_speech_bubble"/>
<TextView
android:id="@+id/call_return"
android:layout_width="fill_parent"
android:layout_height="35dip"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip"
android:layout_marginBottom="10dip"
android:textColor="@android:color/white"
android:textSize="20sp"
android:gravity="center"
android:text="@string/MCA_return_call"/>
<TextView
android:id="@+id/call_add"
android:layout_width="fill_parent"
android:layout_height="35dip"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip"
android:layout_marginBottom="10dip"
android:textColor="@android:color/white"
android:textSize="20sp"
android:gravity="center"
android:text="@string/MCA_add_task"/>
<TextView
android:id="@+id/call_ignore"
android:layout_width="fill_parent"
android:layout_height="35dip"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip"
android:layout_marginBottom="10dip"
android:textColor="@android:color/white"
android:textSize="20sp"
android:gravity="center"
android:text="@string/MCA_ignore"
android:background="#707070"/>
</LinearLayout>

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center">
<include layout="@layout/astrid_missed_call_view"/>
</LinearLayout>

@ -463,6 +463,21 @@
<!-- Button to disagree with EULA --> <!-- Button to disagree with EULA -->
<string name="InA_disagree">I Disagree</string> <string name="InA_disagree">I Disagree</string>
<!-- ===================================================== MissedCallActivity == -->
<!-- Missed call: return call -->
<string name="MCA_title">Missed call!</string>
<!-- Missed call: return call -->
<string name="MCA_return_call">Call back</string>
<!-- Missed call: return call -->
<string name="MCA_add_task">Add to task list</string>
<!-- Missed call: return call -->
<string name="MCA_ignore">Ignore</string>
<!-- ===================================================== HelpActivity == --> <!-- ===================================================== HelpActivity == -->
<!-- Help: Button to get support from our website --> <!-- Help: Button to get support from our website -->

@ -65,6 +65,21 @@ public class ThemeService {
return R.style.Theme_White_Blue; 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() { public static int getEditDialogTheme() {
int themeSetting = ThemeService.getTheme(); int themeSetting = ThemeService.getTheme();
int theme; int theme;

Loading…
Cancel
Save