Merge "Placeholder invite-accept UI"

This commit is contained in:
Andy Stadler 2010-02-16 22:05:55 -08:00 committed by Android (Google) Code Review
commit 5cb0ccc25b
4 changed files with 95 additions and 8 deletions

View File

@ -166,6 +166,7 @@
android:text="@string/message_view_show_pictures_action" />
</LinearLayout>
<!-- content area -->
<include layout="@layout/message_view_invitation" />
<WebView
android:id="@+id/message_content"
android:layout_height="wrap_content"

View File

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2010 The Android Open Source Project
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.
-->
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/invite_section"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/text_box"
android:gravity="center_vertical"
android:visibility="gone" >
<TextView
android:id="@+id/invite_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="6dip"
android:singleLine="true"
android:ellipsize="end"
android:text="@string/message_view_invite_text"
android:textColor="?android:attr/textColorPrimaryInverse"
android:layout_alignParentTop="true" />
<Button
android:id="@+id/decline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="?android:attr/buttonStyleSmall"
android:text="@string/message_view_invite_decline"
android:singleLine="true"
android:layout_alignParentRight="true"
android:layout_below="@id/invite_info"
android:layout_marginTop="6dip" />
<Button
android:id="@+id/maybe"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="?android:attr/buttonStyleSmall"
android:text="@string/message_view_invite_maybe"
android:singleLine="true"
android:layout_toLeftOf="@id/decline"
android:layout_below="@id/invite_info"
android:layout_marginTop="6dip" />
<Button
android:id="@+id/accept"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="?android:attr/buttonStyleSmall"
android:text="@string/message_view_invite_accept"
android:singleLine="true"
android:layout_toLeftOf="@id/maybe"
android:layout_below="@id/invite_info"
android:layout_marginTop="6dip" />
</RelativeLayout>

View File

@ -260,6 +260,14 @@
<string name="message_view_fetching_attachment_toast">Fetching attachment.</string>
<!-- Appears progress dialog for fetching attachment -->
<string name="message_view_fetching_attachment_progress">Fetching attachment <xliff:g id="filename">%s</xliff:g></string>
<!-- String shown with a calendar invitation. -->
<string name="message_view_invite_text">Accept invitation?</string>
<!-- Button text: Calendar invitation: Accept -->
<string name="message_view_invite_accept">Accept</string>
<!-- Button text: Calendar invitation: Maybe -->
<string name="message_view_invite_maybe">Maybe</string>
<!-- Button text: Calendar invitation: Decline -->
<string name="message_view_invite_decline">Decline</string>
<!-- Toast shown briefly while deleting a message -->
<plurals name="message_deleted_toast">
<item quantity="one">Message <xliff:g id="deleted.">deleted.</xliff:g></item>

View File

@ -122,6 +122,7 @@ public class MessageView extends Activity implements OnClickListener {
private ImageView mAttachmentIcon;
private ImageView mFavoriteIcon;
private View mShowPicturesSection;
private View mInviteSection;
private ImageView mSenderPresenceView;
private ProgressDialog mProgressDialog;
private View mScrollView;
@ -342,6 +343,7 @@ public class MessageView extends Activity implements OnClickListener {
mAttachmentIcon = (ImageView) findViewById(R.id.attachment);
mFavoriteIcon = (ImageView) findViewById(R.id.favorite);
mShowPicturesSection = findViewById(R.id.show_pictures_section);
mInviteSection = findViewById(R.id.invite_section);
mSenderPresenceView = (ImageView) findViewById(R.id.presence);
mMoveToNewer = findViewById(R.id.moveToNewer);
mMoveToOlder = findViewById(R.id.moveToOlder);
@ -356,6 +358,9 @@ public class MessageView extends Activity implements OnClickListener {
findViewById(R.id.reply_all).setOnClickListener(this);
findViewById(R.id.delete).setOnClickListener(this);
findViewById(R.id.show_pictures).setOnClickListener(this);
findViewById(R.id.accept).setOnClickListener(this);
findViewById(R.id.maybe).setOnClickListener(this);
findViewById(R.id.decline).setOnClickListener(this);
mMessageContentView.setVerticalScrollBarEnabled(false);
mMessageContentView.getSettings().setBlockNetworkImage(true);
@ -677,14 +682,11 @@ public class MessageView extends Activity implements OnClickListener {
return null;
}
// NOTE
// This is a placeholder for code used to accept a meeting invitation, and would presumably
// be called in response to a button press or menu selection
// The appropriate EmailServiceConstant would be changed to implement "decline" and
// "tentative" responses
private void onAccept() {
mController.sendMeetingResponse(mMessageId, EmailServiceConstants.MEETING_REQUEST_ACCEPTED,
mControllerCallback);
/**
* Send a service message indicating that a meeting invite button has been clicked.
*/
private void onAccept(int response) {
mController.sendMeetingResponse(mMessageId, response, mControllerCallback);
}
private void onDownloadAttachment(AttachmentInfo attachment) {
@ -758,6 +760,15 @@ public class MessageView extends Activity implements OnClickListener {
case R.id.show_pictures:
onShowPictures();
break;
case R.id.accept:
onAccept(EmailServiceConstants.MEETING_REQUEST_ACCEPTED);
break;
case R.id.maybe:
onAccept(EmailServiceConstants.MEETING_REQUEST_TENTATIVE);
break;
case R.id.decline:
onAccept(EmailServiceConstants.MEETING_REQUEST_DECLINED);
break;
}
}
@ -1277,6 +1288,8 @@ public class MessageView extends Activity implements OnClickListener {
mCcContainerView.setVisibility((friendlyCc != null) ? View.VISIBLE : View.GONE);
mAttachmentIcon.setVisibility(message.mAttachments != null ? View.VISIBLE : View.GONE);
mFavoriteIcon.setImageDrawable(message.mFlagFavorite ? mFavoriteIconOn : mFavoriteIconOff);
mInviteSection.setVisibility(!TextUtils.isEmpty(message.mMeetingInfo) ?
View.VISIBLE : View.GONE);
// Handle partially-loaded email, as follows:
// 1. Check value of message.mFlagLoaded