Add preliminary support for viewing events

Bug: 5011918

Change-Id: I573ed44b09f5e695d04fd081ea8af221fb396d94
This commit is contained in:
Marc Blank 2012-04-27 08:43:27 -07:00
parent a4d8ff2293
commit 597cfcf7ce
4 changed files with 71 additions and 12 deletions

View File

@ -117,6 +117,23 @@
</intent-filter>
</activity>
<activity
android:name=".activity.EventViewer"
android:label="@string/app_name"
android:theme="@android:style/Theme.Holo.Light"
>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category
android:name="android.intent.category.DEFAULT" />
<data
android:scheme="content"
android:host="ui.email2.android.com"
android:pathPrefix="/event"
/>
</intent-filter>
</activity>
<!-- TODO: this activity doesn't exist. Determine what to do here -->
<activity android:name=".ui.CreateShortcutActivity"
android:label="@string/activity_folder_selection" />

View File

@ -75,18 +75,6 @@ public final class ActivityHelper {
return result;
}
/**
* Open Calendar app with specific time
*/
public static void openCalendar(Activity activity, long epochEventStartTime) {
Uri uri = Uri.parse("content://com.android.calendar/time/" + epochEventStartTime);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(uri);
intent.putExtra("VIEW", "DAY");
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
activity.startActivity(intent);
}
/**
* If configured via debug flags, inhibit hardware graphics acceleration. Must be called
* early in onCreate().

View File

@ -0,0 +1,50 @@
/**
* Copyright (c) 2012, Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.email.activity;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import com.android.emailcommon.mail.MeetingInfo;
import com.android.emailcommon.mail.PackedString;
import com.android.emailcommon.provider.EmailContent.Message;
import com.android.emailcommon.utility.Utility;
public class EventViewer extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Uri uri = getIntent().getData();
long messageId = Long.parseLong(uri.getLastPathSegment());
Message msg = Message.restoreMessageWithId(this, messageId);
if (msg == null) {
finish();
} else {
PackedString info = new PackedString(msg.mMeetingInfo);
long time = Utility.parseEmailDateTimeToMillis(info.get(MeetingInfo.MEETING_DTSTART));
uri = Uri.parse("content://com.android.calendar/time/" + time);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(uri);
intent.putExtra("VIEW", "DAY");
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
startActivity(intent);
finish();
}
}
}

View File

@ -2289,6 +2289,10 @@ outer:
com.android.mail.providers.Attachment.toJSONArray(uiAtts));
}
}
if ((msg.mFlags & Message.FLAG_INCOMING_MEETING_INVITE) != 0) {
values.put(UIProvider.MessageColumns.EVENT_INTENT_URI,
"content://ui.email2.android.com/event/" + msg.mId);
}
StringBuilder sb = genSelect(sMessageViewMap, uiProjection, values);
sb.append(" FROM " + Message.TABLE_NAME + "," + Body.TABLE_NAME + " WHERE " +
Body.MESSAGE_KEY + "=" + Message.TABLE_NAME + "." + Message.RECORD_ID + " AND " +