Update message header actions for phones.

- This creates a "more" icon in portrait and shows all three actions
(reply/replyall/forward) in landscape.
- also makes the star visible by default (hiding it in EML view)

Change-Id: Iefff7c0717cfda4dc91218b0d490775294c96103
This commit is contained in:
Ben Komalo 2011-07-14 17:23:21 -07:00
parent b507ece493
commit 08f068c9ce
8 changed files with 192 additions and 38 deletions

View File

@ -0,0 +1,49 @@
<?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.
-->
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<ImageView
android:id="@+id/favorite"
android:src="@drawable/btn_star_off_normal_email_holo_light"
android:layout_width="32dip"
android:layout_height="24dip"
android:layout_margin="8dip"
/>
<ImageView
android:id="@+id/reply"
android:src="@drawable/reply"
android:layout_width="32dip"
android:layout_height="24dip"
android:layout_margin="8dip"
android:baselineAlignBottom="true"
/>
<ImageView
android:id="@+id/reply_all"
android:src="@drawable/reply_all"
android:layout_width="32dip"
android:layout_height="24dip"
android:layout_margin="8dip"
android:baselineAlignBottom="true"
/>
<ImageView
android:id="@+id/forward"
android:src="@drawable/forward"
android:layout_width="32dip"
android:layout_height="24dip"
android:layout_margin="8dip"
android:baselineAlignBottom="true"
/>
</merge>

View File

@ -117,7 +117,6 @@
android:id="@+id/favorite"
android:layout_marginRight="16dip"
android:src="@drawable/btn_star_off_normal_email_holo_light"
android:visibility="gone"
style="@style/message_view_action_buttons"
/>
</LinearLayout>

View File

@ -62,7 +62,7 @@
android:layout_width="match_parent"
android:layout_height="48dip"
android:baselineAligned="true"
android:background="#3cb8e6"
android:background="@color/message_view_header_color"
android:gravity="center_vertical"
>
<ImageView
@ -107,23 +107,7 @@
android:ellipsize="end"
/>
</RelativeLayout>
<!-- Reply/Forward buttons are default gone for MessageFileView -->
<ImageView
android:id="@+id/reply"
android:src="@drawable/reply"
android:layout_width="32dip"
android:layout_height="24dip"
android:layout_margin="6dip"
android:baselineAlignBottom="true"
android:visibility="gone"
/>
<ImageView
android:id="@+id/favorite"
android:layout_width="32dip"
android:layout_height="24dip"
android:layout_margin="6dip"
android:src="@drawable/btn_star_off_normal_email_holo_light"
/>
<include layout="@layout/message_view_header_actions" />
</LinearLayout>
<!-- Addresses, timestamp, "show details" -->

View File

@ -0,0 +1,47 @@
<?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.
-->
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<ImageView
android:id="@+id/favorite"
android:src="@drawable/btn_star_off_normal_email_holo_light"
android:layout_width="32dip"
android:layout_height="24dip"
android:layout_margin="6dip"
/>
<ImageView
android:id="@+id/reply"
android:src="@drawable/reply"
android:layout_width="32dip"
android:layout_height="24dip"
android:layout_margin="6dip"
android:baselineAlignBottom="true"
/>
<View
android:layout_width="1dip"
android:layout_height="24dip"
android:layout_margin="3dip"
android:background="#ddd"
/>
<ImageView
android:id="@+id/more"
style="@android:style/Widget.Holo.ActionButton.Overflow"
android:layout_width="32dip"
android:layout_height="24dip"
android:layout_margin="6dip"
android:baselineAlignBottom="true"
/>
</merge>

View File

@ -0,0 +1,27 @@
<?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.
-->
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/reply_all"
android:title="@string/reply_all_action"
/>
<item
android:id="@+id/forward"
android:title="@string/forward_action"
/>
</menu>

View File

@ -60,6 +60,7 @@
<color name="widget_light_text_color">#ff666666</color>
<color name="message_view_info_back_color">#deecfa</color>
<color name="message_view_header_color">#3cb8e6</color>
<color name="error_bar_background">#ffff66</color>
</resources>

View File

@ -16,17 +16,20 @@
package com.android.email.activity;
import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.android.email.Email;
import com.android.email.R;
import com.android.emailcommon.Logging;
import com.android.emailcommon.provider.EmailContent.Message;
import com.android.emailcommon.utility.Utility;
import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
/**
* A {@link MessageViewFragmentBase} subclass for file based messages. (aka EML files)
*/
@ -48,6 +51,18 @@ public class MessageFileViewFragment extends MessageViewFragmentBase {
sFragmentCount++;
}
@Override
public View onCreateView(
LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View result = super.onCreateView(inflater, container, savedInstanceState);
// Star is not visible in this view.
UiUtilities.getView(result, R.id.favorite).setVisibility(View.GONE);
return result;
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);

View File

@ -16,16 +16,6 @@
package com.android.email.activity;
import com.android.email.Email;
import com.android.email.R;
import com.android.emailcommon.mail.MeetingInfo;
import com.android.emailcommon.mail.PackedString;
import com.android.emailcommon.provider.Account;
import com.android.emailcommon.provider.EmailContent.Message;
import com.android.emailcommon.provider.Mailbox;
import com.android.emailcommon.service.EmailServiceConstants;
import com.android.emailcommon.utility.Utility;
import android.app.Activity;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
@ -39,13 +29,26 @@ import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.PopupMenu;
import android.widget.PopupMenu.OnMenuItemClickListener;
import com.android.email.Email;
import com.android.email.R;
import com.android.emailcommon.mail.MeetingInfo;
import com.android.emailcommon.mail.PackedString;
import com.android.emailcommon.provider.EmailContent.Message;
import com.android.emailcommon.provider.Mailbox;
import com.android.emailcommon.service.EmailServiceConstants;
import com.android.emailcommon.utility.Utility;
/**
* A {@link MessageViewFragmentBase} subclass for regular email messages. (regular as in "not eml
* files").
*/
public class MessageViewFragment extends MessageViewFragmentBase
implements CheckBox.OnCheckedChangeListener, MoveMessageToDialog.Callback {
implements CheckBox.OnCheckedChangeListener,
MoveMessageToDialog.Callback,
OnMenuItemClickListener {
/** Argument name(s) */
private static final String ARG_MESSAGE_ID = "messageId";
@ -59,6 +62,9 @@ public class MessageViewFragment extends MessageViewFragmentBase
/* Nullable - not available on phone. */
private View mForwardButton;
private View mMoreButton;
// calendar meeting invite answers
private CheckBox mMeetingYes;
private CheckBox mMeetingMaybe;
@ -188,14 +194,14 @@ public class MessageViewFragment extends MessageViewFragmentBase
mMeetingMaybe = (CheckBox) UiUtilities.getView(view, R.id.maybe);
mMeetingNo = (CheckBox) UiUtilities.getView(view, R.id.decline);
// Star is only visible on this fragment (as opposed to MessageFileViewFragment.)
UiUtilities.getView(view, R.id.favorite).setVisibility(View.VISIBLE);
mFavoriteIcon.setOnClickListener(this);
mReplyButton.setOnClickListener(this);
if (mReplyAllButton != null) {
mReplyAllButton.setOnClickListener(this);
mForwardButton.setOnClickListener(this);
} else {
mMoreButton = UiUtilities.getView(view, R.id.more);
mMoreButton.setOnClickListener(this);
}
mMeetingYes.setOnCheckedChangeListener(this);
mMeetingMaybe.setOnCheckedChangeListener(this);
@ -333,10 +339,36 @@ public class MessageViewFragment extends MessageViewFragmentBase
case R.id.invite_link:
onInviteLinkClicked();
return;
case R.id.more: {
PopupMenu popup = new PopupMenu(getActivity(), mMoreButton);
popup.getMenuInflater().inflate(R.menu.message_header_overflow_menu,
popup.getMenu());
popup.setOnMenuItemClickListener(this);
popup.show();
break;
}
}
super.onClick(view);
}
@Override
public boolean onMenuItemClick(MenuItem item) {
if (isMessageOpen()) {
switch (item.getItemId()) {
case R.id.reply_all:
mCallback.onReplyAll();
return true;
case R.id.forward:
mCallback.onForward();
return true;
}
}
return false;
}
@Override
public void onCheckedChanged(CompoundButton view, boolean isChecked) {
if (!isChecked) return;