Merge "Launch Calendar app when notification is touched."
This commit is contained in:
commit
642219502c
@ -28,6 +28,7 @@ import android.app.PendingIntent;
|
|||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.net.Uri;
|
||||||
import android.provider.Calendar;
|
import android.provider.Calendar;
|
||||||
import android.provider.ContactsContract;
|
import android.provider.ContactsContract;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@ -93,12 +94,9 @@ public class CalendarSyncEnabler {
|
|||||||
* be shown on the notification.
|
* be shown on the notification.
|
||||||
*/
|
*/
|
||||||
/* package for testing */ void showNotification(String emailAddresses) {
|
/* package for testing */ void showNotification(String emailAddresses) {
|
||||||
// TODO We don't have an intent to launch calendar yet. Change it when we have.
|
|
||||||
Intent calendarIntent = new Intent().setAction("TODO.change.this.to.launch.calendar");
|
|
||||||
|
|
||||||
// Launch Calendar app when clicked.
|
// Launch Calendar app when clicked.
|
||||||
PendingIntent launchCalendarPendingIntent = PendingIntent.getActivity(mContext, 0,
|
PendingIntent launchCalendarPendingIntent = PendingIntent.getActivity(mContext, 0,
|
||||||
calendarIntent, 0);
|
createLaunchCalendarIntent(), 0);
|
||||||
|
|
||||||
String tickerText = mContext.getString(R.string.notification_exchange_calendar_added);
|
String tickerText = mContext.getString(R.string.notification_exchange_calendar_added);
|
||||||
Notification n = new Notification(R.drawable.stat_notify_calendar,
|
Notification n = new Notification(R.drawable.stat_notify_calendar,
|
||||||
@ -110,4 +108,9 @@ public class CalendarSyncEnabler {
|
|||||||
(NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
|
(NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||||
nm.notify(MailService.NOTIFICATION_ID_EXCHANGE_CALENDAR_ADDED, n);
|
nm.notify(MailService.NOTIFICATION_ID_EXCHANGE_CALENDAR_ADDED, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @return {@link Intent} to launch the Calendar app. */
|
||||||
|
private Intent createLaunchCalendarIntent() {
|
||||||
|
return new Intent(Intent.ACTION_VIEW, Uri.parse("content://com.android.calendar/time"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user