Merge "Minimal changes to make invite UI less broken"

This commit is contained in:
Ben Komalo 2011-08-16 16:00:16 -07:00 committed by Android (Google) Code Review
commit 5ef235193b
6 changed files with 335 additions and 72 deletions

View File

@ -0,0 +1,139 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2011 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.
-->
<!-- tablet -->
<LinearLayout
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="@color/message_view_info_back_color"
android:orientation="vertical"
>
<View
android:layout_width="match_parent"
style="@style/message_view_horizontal_divider"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="64dip"
android:orientation="horizontal"
>
<!-- TODO: The plan is to show a calendar icon here. -->
<ImageView
android:layout_width="64dip"
android:layout_height="64dip"
android:layout_weight="0"
android:src="@null"
android:visibility="gone"
/>
<LinearLayout
android:layout_width="200dip"
android:layout_weight="1"
android:layout_height="64dip"
android:orientation="horizontal"
android:divider="?android:attr/dividerVertical"
android:showDividers="middle"
android:dividerPadding="16dip"
>
<RelativeLayout
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight="1"
>
<CheckBox
android:id="@+id/accept"
android:layout_width="104dip"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_marginLeft="16dip"
android:text="@string/message_view_invite_accept"
android:textSize="14dip"
android:textColor="@color/text_primary_color"
android:singleLine="true"
android:ellipsize="end"
/>
<CheckBox
android:id="@+id/maybe"
android:layout_width="104dip"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_toRightOf="@id/accept"
android:layout_marginLeft="8dip"
android:text="@string/message_view_invite_maybe"
android:textSize="14dip"
android:textColor="@color/text_primary_color"
android:singleLine="true"
android:ellipsize="end"
/>
<CheckBox
android:id="@+id/decline"
android:layout_width="104dip"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_toRightOf="@id/maybe"
android:layout_marginLeft="8dip"
android:text="@string/message_view_invite_decline"
android:textSize="14dip"
android:textColor="@color/text_primary_color"
android:singleLine="true"
android:ellipsize="end"
/>
<!-- "Going?" -->
<TextView
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_above="@id/accept"
android:layout_marginLeft="16dip"
android:layout_marginRight="16dip"
android:singleLine="true"
android:ellipsize="end"
android:text="@string/message_view_invite_text"
android:textSize="18dip"
android:textColor="@color/text_primary_color"
android:gravity="left|bottom"
/>
</RelativeLayout>
<Button
android:id="@+id/invite_link"
android:layout_width="162dip"
android:layout_height="match_parent"
android:layout_marginLeft="8dip"
android:layout_marginRight="8dip"
style="@android:style/Widget.Holo.Button.Borderless"
android:padding="0dip"
android:text="@string/message_view_invite_view"
android:textSize="14dip"
android:textColor="@color/text_primary_color"
android:textStyle="bold"
android:singleLine="true"
android:ellipsize="end"
android:gravity="center"
/>
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
style="@style/message_view_horizontal_divider"
/>
</LinearLayout>

139
res/layout-sw800dp-port Normal file
View File

@ -0,0 +1,139 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2011 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.
-->
<!-- tablet -->
<LinearLayout
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="@color/message_view_info_back_color"
android:orientation="vertical"
>
<View
android:layout_width="match_parent"
style="@style/message_view_horizontal_divider"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="64dip"
android:orientation="horizontal"
>
<!-- TODO: The plan is to show a calendar icon here. -->
<ImageView
android:layout_width="64dip"
android:layout_height="64dip"
android:layout_weight="0"
android:src="@null"
android:visibility="gone"
/>
<LinearLayout
android:layout_width="200dip"
android:layout_weight="1"
android:layout_height="64dip"
android:orientation="horizontal"
android:divider="?android:attr/dividerVertical"
android:showDividers="middle"
android:dividerPadding="16dip"
>
<RelativeLayout
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight="1"
>
<CheckBox
android:id="@+id/accept"
android:layout_width="104dip"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_marginLeft="32dip"
android:text="@string/message_view_invite_accept"
android:textSize="14dip"
android:textColor="@color/text_primary_color"
android:singleLine="true"
android:ellipsize="end"
/>
<CheckBox
android:id="@+id/maybe"
android:layout_width="104dip"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_toRightOf="@id/accept"
android:layout_marginLeft="24dip"
android:text="@string/message_view_invite_maybe"
android:textSize="14dip"
android:textColor="@color/text_primary_color"
android:singleLine="true"
android:ellipsize="end"
/>
<CheckBox
android:id="@+id/decline"
android:layout_width="104dip"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_toRightOf="@id/maybe"
android:layout_marginLeft="24dip"
android:text="@string/message_view_invite_decline"
android:textSize="14dip"
android:textColor="@color/text_primary_color"
android:singleLine="true"
android:ellipsize="end"
/>
<!-- "Going?" -->
<TextView
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_above="@id/accept"
android:layout_marginLeft="32dip"
android:layout_marginRight="32dip"
android:singleLine="true"
android:ellipsize="end"
android:text="@string/message_view_invite_text"
android:textSize="18dip"
android:textColor="@color/text_primary_color"
android:gravity="left|bottom"
/>
</RelativeLayout>
<Button
android:id="@+id/invite_link"
android:layout_width="192dip"
android:layout_height="match_parent"
android:layout_marginLeft="16dip"
android:layout_marginRight="16dip"
style="@android:style/Widget.Holo.Button.Borderless"
android:padding="0dip"
android:text="@string/message_view_invite_view"
android:textSize="14dip"
android:textColor="@color/text_primary_color"
android:textStyle="bold"
android:singleLine="true"
android:ellipsize="end"
android:gravity="center"
/>
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
style="@style/message_view_horizontal_divider"
/>
</LinearLayout>

View File

@ -160,6 +160,9 @@
android:background="@android:color/white"
android:visibility="gone"
/>
<!-- TODO: remove these useless scroll views. They are carry-over
from an existing design and are no longer needed. -->
<!--
Even though the "invite" section is only for MessageViewFragment,
Its visibility is controlled by MessageViewFragmentBase for simplicity.
@ -170,6 +173,8 @@
android:layout_height="wrap_content"
android:layout_marginLeft="16dip"
android:layout_marginRight="16dip"
android:paddingTop="16dip"
android:paddingBottom="16dip"
android:visibility="gone"
>
<!--
@ -192,7 +197,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="4dip"
android:background="#ffffff"
android:background="@android:color/white"
/>
</ScrollView>
<!-- end of content area -->

View File

@ -28,7 +28,6 @@
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
>
<TextView
@ -37,11 +36,10 @@
android:singleLine="true"
android:ellipsize="end"
android:text="@string/message_view_invite_title"
android:textColor="?android:attr/textColorPrimaryInverse"
android:textAppearance="?android:attr/textAppearanceSmall"
android:drawableLeft="@drawable/ic_event_email"
android:layout_marginLeft="6dip"
android:layout_marginLeft="12dip"
android:layout_alignParentLeft="true"
android:gravity="center_vertical"
android:layout_centerVertical="true"
/>
@ -52,86 +50,82 @@
android:singleLine="true"
android:ellipsize="end"
android:text="@string/message_view_invite_view"
android:layout_marginRight="6dip"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_marginRight="3dip"
android:layout_alignParentRight="true"
android:gravity="center_vertical"
android:layout_gravity="center_vertical"
android:layout_centerVertical="true"
/>
</RelativeLayout>
<!-- Divider -->
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:background="#ff808080"
/>
<TextView
android:id="@+id/invite_info"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_marginTop="4dip"
android:layout_marginLeft="12dip"
android:layout_marginRight="6dip"
android:singleLine="true"
android:ellipsize="end"
android:text="@string/message_view_invite_text"
android:textAppearance="?android:attr/textAppearanceSmall"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="44dip"
android:orientation="horizontal"
android:gravity="center_vertical"
android:layout_margin="2dip"
android:layout_marginLeft="12dip"
android:layout_marginRight="6dip"
>
<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"
/>
<CheckBox
android:id="@+id/accept"
android:layout_width="wrap_content"
android:layout_width="0dip"
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:textAppearance="?android:attr/textAppearanceSmall"
android:drawableLeft="@drawable/btn_invite_yes"
android:gravity="center_vertical"
android:focusable="true"
/>
<CheckBox
<TextView
android:id="@+id/maybe"
android:layout_width="wrap_content"
android:layout_width="0dip"
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:textAppearance="?android:attr/textAppearanceSmall"
android:drawableLeft="@drawable/btn_invite_maybe"
android:gravity="center_vertical"
android:focusable="true"
/>
<CheckBox
<TextView
android:id="@+id/decline"
android:layout_width="wrap_content"
android:layout_width="0dip"
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:textAppearance="?android:attr/textAppearanceSmall"
android:drawableLeft="@drawable/btn_invite_no"
android:gravity="center_vertical"
android:focusable="true"
/>
<View
android:layout_width="0dip"
android:layout_height="0dip"
android:layout_weight="5"
/>
</LinearLayout>
</LinearLayout>

View File

@ -27,8 +27,6 @@ import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityEvent;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.PopupMenu;
import android.widget.PopupMenu.OnMenuItemClickListener;
@ -48,9 +46,7 @@ import com.android.emailcommon.utility.Utility;
* files").
*/
public class MessageViewFragment extends MessageViewFragmentBase
implements CheckBox.OnCheckedChangeListener,
MoveMessageToDialog.Callback,
OnMenuItemClickListener {
implements MoveMessageToDialog.Callback, OnMenuItemClickListener {
/** Argument name(s) */
private static final String ARG_MESSAGE_ID = "messageId";
@ -67,9 +63,9 @@ public class MessageViewFragment extends MessageViewFragmentBase
private View mMoreButton;
// calendar meeting invite answers
private CheckBox mMeetingYes;
private CheckBox mMeetingMaybe;
private CheckBox mMeetingNo;
private View mMeetingYes;
private View mMeetingMaybe;
private View mMeetingNo;
private Drawable mFavoriteIconOn;
private Drawable mFavoriteIconOff;
@ -194,9 +190,9 @@ public class MessageViewFragment extends MessageViewFragmentBase
mReplyButton = UiUtilities.getView(view, R.id.reply);
mReplyAllButton = UiUtilities.getViewOrNull(view, R.id.reply_all);
mForwardButton = UiUtilities.getViewOrNull(view, R.id.forward);
mMeetingYes = (CheckBox) UiUtilities.getView(view, R.id.accept);
mMeetingMaybe = (CheckBox) UiUtilities.getView(view, R.id.maybe);
mMeetingNo = (CheckBox) UiUtilities.getView(view, R.id.decline);
mMeetingYes = UiUtilities.getView(view, R.id.accept);
mMeetingMaybe = UiUtilities.getView(view, R.id.maybe);
mMeetingNo = UiUtilities.getView(view, R.id.decline);
mFavoriteIcon.setOnClickListener(this);
mReplyButton.setOnClickListener(this);
@ -207,9 +203,9 @@ public class MessageViewFragment extends MessageViewFragmentBase
mMoreButton = UiUtilities.getView(view, R.id.more);
mMoreButton.setOnClickListener(this);
}
mMeetingYes.setOnCheckedChangeListener(this);
mMeetingMaybe.setOnCheckedChangeListener(this);
mMeetingNo.setOnCheckedChangeListener(this);
mMeetingYes.setOnClickListener(this);
mMeetingMaybe.setOnClickListener(this);
mMeetingNo.setOnClickListener(this);
UiUtilities.getView(view, R.id.invite_link).setOnClickListener(this);
enableReplyForwardButtons(false);
@ -247,9 +243,6 @@ public class MessageViewFragment extends MessageViewFragmentBase
@Override
protected void resetView() {
super.resetView();
mMeetingYes.setChecked(false);
mMeetingNo.setChecked(false);
mMeetingMaybe.setChecked(false);
mPreviousMeetingResponse = EmailServiceConstants.MEETING_REQUEST_NOT_RESPONDED;
}
@ -379,6 +372,18 @@ public class MessageViewFragment extends MessageViewFragmentBase
onInviteLinkClicked();
return;
case R.id.accept:
onRespondToInvite(EmailServiceConstants.MEETING_REQUEST_ACCEPTED,
R.string.message_view_invite_toast_yes);
return;
case R.id.maybe:
onRespondToInvite(EmailServiceConstants.MEETING_REQUEST_TENTATIVE,
R.string.message_view_invite_toast_maybe);
return;
case R.id.decline:
onRespondToInvite(EmailServiceConstants.MEETING_REQUEST_DECLINED,
R.string.message_view_invite_toast_no);
case R.id.more: {
PopupMenu popup = new PopupMenu(getActivity(), mMoreButton);
popup.getMenuInflater().inflate(R.menu.message_header_overflow_menu,
@ -408,25 +413,6 @@ public class MessageViewFragment extends MessageViewFragmentBase
}
@Override
public void onCheckedChanged(CompoundButton view, boolean isChecked) {
if (!isChecked) return;
switch (view.getId()) {
case R.id.accept:
onRespondToInvite(EmailServiceConstants.MEETING_REQUEST_ACCEPTED,
R.string.message_view_invite_toast_yes);
return;
case R.id.maybe:
onRespondToInvite(EmailServiceConstants.MEETING_REQUEST_TENTATIVE,
R.string.message_view_invite_toast_maybe);
return;
case R.id.decline:
onRespondToInvite(EmailServiceConstants.MEETING_REQUEST_DECLINED,
R.string.message_view_invite_toast_no);
return;
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {