Merge "MessageView: EAS calendar meeting invite answer buttons."
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 282 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 282 B |
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/*
|
||||
**
|
||||
** Copyright 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.
|
||||
*/
|
||||
-->
|
||||
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_focused="false" android:state_pressed="false"
|
||||
android:drawable="@drawable/btn_maybe_off" />
|
||||
<item android:drawable="@drawable/btn_maybe_on" />
|
||||
</selector>
|
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/*
|
||||
**
|
||||
** Copyright 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.
|
||||
*/
|
||||
-->
|
||||
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_focused="false" android:state_pressed="false"
|
||||
android:drawable="@drawable/btn_no_off" />
|
||||
<item android:drawable="@drawable/btn_no_on" />
|
||||
</selector>
|
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/*
|
||||
**
|
||||
** Copyright 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.
|
||||
*/
|
||||
-->
|
||||
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_focused="false" android:state_pressed="false"
|
||||
android:drawable="@drawable/btn_yes_off" />
|
||||
<item android:drawable="@drawable/btn_yes_on" />
|
||||
</selector>
|
|
@ -14,52 +14,120 @@
|
|||
limitations under the License.
|
||||
-->
|
||||
|
||||
<RelativeLayout
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/invite_section"
|
||||
android:orientation="vertical"
|
||||
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>
|
||||
android:visibility="gone"
|
||||
>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/invite_link"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="end"
|
||||
android:text="@string/message_view_invite_title"
|
||||
android:textColor="?android:attr/textColorPrimaryInverse"
|
||||
android:drawableLeft="@drawable/ic_event_email"
|
||||
android:layout_marginLeft="6dip"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:gravity="center_vertical"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="end"
|
||||
android:text="@string/message_view_invite_view"
|
||||
android:textColor="?android:attr/textColorPrimaryInverse"
|
||||
android:layout_marginRight="6dip"
|
||||
android:layout_alignParentRight="true"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_gravity="center_vertical"
|
||||
/>
|
||||
</RelativeLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:background="#ff808080"
|
||||
/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_margin="2dip"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/invite_info"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginLeft="6dip"
|
||||
android:layout_marginRight="6dip"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="end"
|
||||
android:text="@string/message_view_invite_text"
|
||||
android:textColor="?android:attr/textColorPrimaryInverse"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/accept"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginRight="6dip"
|
||||
android:text="@string/message_view_invite_accept"
|
||||
android:singleLine="true"
|
||||
android:textColor="?android:attr/textColorPrimaryInverse"
|
||||
android:drawableLeft="@drawable/btn_invite_yes"
|
||||
android:gravity="center_vertical"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/maybe"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginRight="6dip"
|
||||
android:text="@string/message_view_invite_maybe"
|
||||
android:singleLine="true"
|
||||
android:textColor="?android:attr/textColorPrimaryInverse"
|
||||
android:drawableLeft="@drawable/btn_invite_maybe"
|
||||
android:gravity="center_vertical"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/decline"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/message_view_invite_decline"
|
||||
android:singleLine="true"
|
||||
android:textColor="?android:attr/textColorPrimaryInverse"
|
||||
android:drawableLeft="@drawable/btn_invite_no"
|
||||
android:gravity="center_vertical"
|
||||
/>
|
||||
|
||||
<View
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="0dip"
|
||||
android:layout_weight="5"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
|
|
@ -274,14 +274,26 @@
|
|||
<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>
|
||||
<!-- Calendar invitation, link to calendar.
|
||||
Preserve the chevron (unicode ») untranslated -->
|
||||
<string name="message_view_invite_view">View in Calendar »</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>
|
||||
<string name="message_view_invite_title">Calendar Invite</string>
|
||||
<!-- String shown with a calendar invitation. -->
|
||||
<string name="message_view_invite_text">Going?</string>
|
||||
<!-- Button text: Calendar invitation: Accept. The leading space is used for spacing -->
|
||||
<string name="message_view_invite_accept">" Yes"</string>
|
||||
<!-- Button text: Calendar invitation: Maybe. The leading space is used for spacing -->
|
||||
<string name="message_view_invite_maybe">" Maybe"</string>
|
||||
<!-- Button text: Calendar invitation: Decline. The leading space is used for spacing -->
|
||||
<string name="message_view_invite_decline">" No"</string>
|
||||
<!-- Toast shown following a meeting invite reply, accepted -->
|
||||
<string name="message_view_invite_toast_yes">You have accepted this invitation</string>
|
||||
<!-- Toast shown following a meeting invite reply, maybe -->
|
||||
<string name="message_view_invite_toast_maybe">
|
||||
You have replied \"maybe\" to this invitation</string>
|
||||
<!-- Toast shown following a meeting invite reply, declined -->
|
||||
<string name="message_view_invite_toast_no">You have declined this invitation</string>
|
||||
<!-- Toast shown briefly while deleting a message -->
|
||||
<plurals name="message_deleted_toast">
|
||||
<item quantity="one">Message deleted.</item>
|
||||
|
|
|
@ -21,6 +21,7 @@ import com.android.email.Email;
|
|||
import com.android.email.R;
|
||||
import com.android.email.Utility;
|
||||
import com.android.email.mail.Address;
|
||||
import com.android.email.mail.MeetingInfo;
|
||||
import com.android.email.mail.MessagingException;
|
||||
import com.android.email.mail.internet.EmailHtmlUtil;
|
||||
import com.android.email.mail.internet.MimeUtility;
|
||||
|
@ -127,6 +128,12 @@ public class MessageView extends Activity implements OnClickListener {
|
|||
private ProgressDialog mProgressDialog;
|
||||
private View mScrollView;
|
||||
|
||||
// calendar meeting invite answers
|
||||
private TextView mMeetingYes;
|
||||
private TextView mMeetingMaybe;
|
||||
private TextView mMeetingNo;
|
||||
private int mPreviousMeetingResponse = -1;
|
||||
|
||||
private long mAccountId;
|
||||
private long mMessageId;
|
||||
private long mMailboxId;
|
||||
|
@ -358,9 +365,15 @@ 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);
|
||||
|
||||
mMeetingYes = (TextView) findViewById(R.id.accept);
|
||||
mMeetingMaybe = (TextView) findViewById(R.id.maybe);
|
||||
mMeetingNo = (TextView) findViewById(R.id.decline);
|
||||
|
||||
mMeetingYes.setOnClickListener(this);
|
||||
mMeetingMaybe.setOnClickListener(this);
|
||||
mMeetingNo.setOnClickListener(this);
|
||||
findViewById(R.id.invite_link).setOnClickListener(this);
|
||||
|
||||
mMessageContentView.setVerticalScrollBarEnabled(false);
|
||||
mMessageContentView.getSettings().setBlockNetworkImage(true);
|
||||
|
@ -685,8 +698,16 @@ public class MessageView extends Activity implements OnClickListener {
|
|||
/**
|
||||
* 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 onAccept(int response, int toastResId) {
|
||||
// do not send twice in a row the same response
|
||||
if (mPreviousMeetingResponse != response) {
|
||||
mController.sendMeetingResponse(mMessageId, response, mControllerCallback);
|
||||
mPreviousMeetingResponse = response;
|
||||
}
|
||||
Toast.makeText(this, toastResId, Toast.LENGTH_SHORT).show();
|
||||
if (!moveToOlder() && !moveToNewer()) {
|
||||
finish(); // if this is the single message, move up to message-list.
|
||||
}
|
||||
}
|
||||
|
||||
private void onDownloadAttachment(AttachmentInfo attachment) {
|
||||
|
@ -761,13 +782,35 @@ public class MessageView extends Activity implements OnClickListener {
|
|||
onShowPictures();
|
||||
break;
|
||||
case R.id.accept:
|
||||
onAccept(EmailServiceConstants.MEETING_REQUEST_ACCEPTED);
|
||||
onAccept(EmailServiceConstants.MEETING_REQUEST_ACCEPTED,
|
||||
R.string.message_view_invite_toast_yes);
|
||||
break;
|
||||
case R.id.maybe:
|
||||
onAccept(EmailServiceConstants.MEETING_REQUEST_TENTATIVE);
|
||||
onAccept(EmailServiceConstants.MEETING_REQUEST_TENTATIVE,
|
||||
R.string.message_view_invite_toast_maybe);
|
||||
break;
|
||||
case R.id.decline:
|
||||
onAccept(EmailServiceConstants.MEETING_REQUEST_DECLINED);
|
||||
onAccept(EmailServiceConstants.MEETING_REQUEST_DECLINED,
|
||||
R.string.message_view_invite_toast_no);
|
||||
break;
|
||||
case R.id.invite_link:
|
||||
/*
|
||||
String startTime =
|
||||
new PackedString(mMessage.mMeetingInfo).get(MeetingInfo.MEETING_DTSTART);
|
||||
if (startTime != null) {
|
||||
long millis = CalendarUtilities.parseEmailDateTimeToMillis(startTime);
|
||||
}
|
||||
*/
|
||||
try {
|
||||
long epochTimeMillis = Long.valueOf(mMessage.mMeetingInfo);
|
||||
Uri uri = Uri.parse("content://com.android.calendar/time/" + epochTimeMillis);
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.setData(uri);
|
||||
intent.putExtra("VIEW", "DAY");
|
||||
startActivity(intent);
|
||||
} catch (NumberFormatException e) {
|
||||
Email.log("meetingInfo format " + mMessage.mMeetingInfo + ' ' + e);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|