Major ergonomic re-work of MessageView controls. Provide options (in

Account settings) for scrolling the navigation buttons with the
message, or keeping the buttons on screen.  Scrolling mode can be
automatically switched based on availability of keyboard. (Issue 197
and Issue 194)

Add ability to flag/unflag message from options menu
This commit is contained in:
Daniel Applebaum 2009-01-24 18:58:40 +00:00
parent b6e9910e00
commit cf359c95ad
10 changed files with 321 additions and 115 deletions

View File

@ -7,19 +7,63 @@
android:background="@android:color/white">
<ScrollView
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_height="fill_parent"
android:layout_weight="1"
android:scrollbarStyle="outsideInset"
android:foregroundGravity="fill"
android:fillViewport="true"
android:fadingEdge="none">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_height="fill_parent"
android:layout_weight="1">
<include layout="@layout/message_view_header" />
<View
android:layout_width="fill_parent"
android:layout_height="0px"
android:layout_weight="1" />
<LinearLayout
android:id="@+id/scrolling_buttons"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="57px"
android:background="@drawable/ic_email_thread_open_bottom_default"
android:gravity="bottom">
<Button
android:id="@+id/previous_scrolling"
android:text="@string/message_view_prev_action"
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="1" />
<Button
android:id="@+id/reply_scrolling"
android:text="@string/reply_action"
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="1" />
<Button
android:id="@+id/delete_scrolling"
android:text="@string/delete_action"
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="1" />
<Button
android:id="@+id/forward_scrolling"
android:text="@string/forward_action"
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="1" />
<Button
android:id="@+id/next_scrolling"
android:text="@string/message_view_next_action"
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>
</ScrollView>
<LinearLayout
android:id="@+id/bottom_buttons"

View File

@ -10,38 +10,71 @@
android:layout_height="0dip"
android:layout_weight="1"
android:scrollbarStyle="outsideInset"
android:fillViewport="true"
android:fadingEdge="none">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1">
<!-- <RelativeLayout
android:id="@+id/top_buttons"
android:layout_width="fill_parent"
android:layout_height="54px"
android:paddingTop="4px">
<Button
android:id="@+id/previous"
android:text="@string/message_view_prev_action"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:minWidth="@dimen/button_minWidth"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true" />
<Button
android:id="@+id/next"
android:text="@string/message_view_next_action"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:minWidth="@dimen/button_minWidth"
android:layout_alignParentRight="true"
android:layout_centerVertical="true" />
</RelativeLayout>
-->
<include layout="@layout/message_view_header" />
<View
android:layout_width="fill_parent"
android:layout_height="0px"
android:layout_weight="1" />
<LinearLayout
android:id="@+id/extra_buttons"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="57px"
android:background="@drawable/ic_email_thread_open_bottom_default"
android:gravity="center_vertical">
<Button
android:id="@+id/reply"
android:text="@string/reply_action"
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="1" />
<Button
android:id="@+id/reply_all"
android:text="@string/reply_all_action"
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="1" />
<Button
android:id="@+id/forward"
android:text="@string/forward_action"
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="1" />
</LinearLayout>
<LinearLayout
android:id="@+id/scrolling_buttons"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="57px"
android:background="@drawable/ic_email_thread_open_bottom_default"
android:gravity="center_vertical">
<Button
android:id="@+id/previous_scrolling"
android:text="@string/message_view_prev_action"
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="1" />
<Button
android:id="@+id/delete_scrolling"
android:text="@string/delete_action"
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="1" />
<Button
android:id="@+id/next_scrolling"
android:text="@string/message_view_next_action"
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>
</ScrollView>
<LinearLayout
@ -51,12 +84,6 @@
android:layout_height="57px"
android:background="@drawable/ic_email_thread_open_bottom_default"
android:gravity="center_vertical">
<!-- <Button
android:id="@+id/reply"
android:text="@string/reply_action"
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="1" />-->
<Button
android:id="@+id/previous"
android:text="@string/message_view_prev_action"
@ -75,12 +102,6 @@
android:text="@string/message_view_next_action"
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="1" />
<!-- <Button
android:id="@+id/forward"
android:text="@string/forward_action"
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="1" /> -->
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>

View File

@ -1,11 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/forward"
android:alphabeticShortcut="f"
android:title="@string/forward_action"
android:icon="@drawable/ic_menu_forward_mail"
/>
<item
android:id="@+id/reply"
android:alphabeticShortcut="r"
@ -18,6 +12,12 @@
android:title="@string/reply_all_action"
android:icon="@drawable/ic_menu_reply_all"
/>
<item
android:id="@+id/forward"
android:alphabeticShortcut="f"
android:title="@string/forward_action"
android:icon="@drawable/ic_menu_forward_mail"
/>
<item
android:id="@+id/mark_as_unread"
android:alphabeticShortcut="u"
@ -29,6 +29,12 @@
android:alphabeticShortcut="q"
android:title="@string/delete_action"
android:icon="@drawable/ic_menu_delete"
/>
<item
android:id="@+id/flag"
android:alphabeticShortcut="s"
android:title="@string/flag_action"
android:icon="@drawable/ic_menu_forward_mail"
/>
<item
android:id="@+id/send_alternate"

View File

@ -63,6 +63,18 @@
<item>FIRST_AND_SECOND_CLASS</item>
<item>NOT_SECOND_CLASS</item>
</string-array>
<string-array name="account_settings_hide_buttons_entries">
<item>@string/account_settings_hide_buttons_never</item>
<item>@string/account_settings_hide_buttons_keyboard_avail</item>
<item>@string/account_settings_hide_buttons_always</item>
</string-array>
<string-array name="account_settings_hide_buttons_values">
<item>NEVER</item>
<item>KEYBOARD_AVAILABLE</item>
<item>ALWAYS</item>
</string-array>
<string-array name="account_settings_folder_sync_mode_entries">
<item>@string/account_settings_folder_sync_mode_all</item>

View File

@ -282,8 +282,10 @@ Welcome to K-9 Mail setup. K-9 is an open source email client for Android based
<string name="account_settings_notify_sync_summary">Notify in status bar while email is checked</string>
<string name="account_settings_show_combined_label">Show combined Inbox</string>
<string name="account_settings_hide_buttons_label">Hide buttons</string>
<string name="account_settings_hide_buttons_summary">While viewing message if keyboard is available</string>
<string name="account_settings_hide_buttons_label">Scroll navigation buttons</string>
<string name="account_settings_hide_buttons_never">Never</string>
<string name="account_settings_hide_buttons_keyboard_avail">When keyboard is available</string>
<string name="account_settings_hide_buttons_always">Always</string>
<string name="account_settings_display_sync">Display and synchronization</string>
@ -364,6 +366,6 @@ Welcome to K-9 Mail setup. K-9 is an open source email client for Android based
Message\u000AK, N - Next Message\u000AZ - Zoom Out\u000AShift-Z -
Zoom In\u000aG - Flag</string>
<string name="message_list_help_key">Del (or D) - Delete\u000AR -
Reply\u000AA - Reply All\u000AC - Compose\u000AF - Forward\\u000aG - Flagu000AQ
Reply\u000AA - Reply All\u000AC - Compose\u000AF - Forward\u000aG - Flag\u000AQ
- Return to Accounts</string>
</resources>

View File

@ -38,10 +38,12 @@
android:entryValues="@array/account_settings_display_count_values"
android:dialogTitle="@string/account_settings_mail_display_count_label" />
<CheckBoxPreference
android:key="hide_buttons"
<ListPreference
android:key="hide_buttons_enum"
android:title="@string/account_settings_hide_buttons_label"
android:summary="@string/account_settings_hide_buttons_summary" />
android:entries="@array/account_settings_hide_buttons_entries"
android:entryValues="@array/account_settings_hide_buttons_values"
android:dialogTitle="@string/account_settings_hide_buttons_label" />
</PreferenceCategory>

View File

@ -52,11 +52,15 @@ public class Account implements Serializable {
boolean mVibrate;
String mRingtoneUri;
boolean mNotifySync;
boolean mHideMessageViewButtons = false;
HideButtons mHideMessageViewButtons;
public enum FolderMode {
ALL, FIRST_CLASS, FIRST_AND_SECOND_CLASS, NOT_SECOND_CLASS;
}
public enum HideButtons {
NEVER, ALWAYS, KEYBOARD_AVAILABLE;
}
/**
* <pre>
@ -80,6 +84,7 @@ public class Account implements Serializable {
mVibrate = false;
mFolderDisplayMode = FolderMode.NOT_SECOND_CLASS;
mFolderSyncMode = FolderMode.FIRST_CLASS;
mHideMessageViewButtons = HideButtons.NEVER;
mRingtoneUri = "content://settings/system/notification_sound";
}
@ -122,7 +127,17 @@ public class Account implements Serializable {
"Outbox");
mAccountNumber = preferences.mSharedPreferences.getInt(mUuid + ".accountNumber", 0);
mVibrate = preferences.mSharedPreferences.getBoolean(mUuid + ".vibrate", false);
mHideMessageViewButtons = preferences.mSharedPreferences.getBoolean(mUuid + ".hideButtons", false);
try
{
mHideMessageViewButtons = HideButtons.valueOf(preferences.mSharedPreferences.getString(mUuid + ".hideButtonsEnum",
HideButtons.NEVER.name()));
}
catch (Exception e)
{
mHideMessageViewButtons = HideButtons.NEVER;
}
mRingtoneUri = preferences.mSharedPreferences.getString(mUuid + ".ringtone",
"content://settings/system/notification_sound");
try
@ -260,7 +275,7 @@ public class Account implements Serializable {
editor.remove(mUuid + ".lastFullSync");
editor.remove(mUuid + ".folderDisplayMode");
editor.remove(mUuid + ".folderSyncMode");
editor.remove(mUuid + ".hideButtons");
editor.remove(mUuid + ".hideButtonsEnum");
editor.commit();
}
@ -322,7 +337,7 @@ public class Account implements Serializable {
editor.putString(mUuid + ".outboxFolderName", mOutboxFolderName);
editor.putInt(mUuid + ".accountNumber", mAccountNumber);
editor.putBoolean(mUuid + ".vibrate", mVibrate);
editor.putBoolean(mUuid + ".hideButtons", mHideMessageViewButtons);
editor.putString(mUuid + ".hideButtonsEnum", mHideMessageViewButtons.name());
editor.putString(mUuid + ".ringtone", mRingtoneUri);
editor.putString(mUuid + ".folderDisplayMode", mFolderDisplayMode.name());
editor.putString(mUuid + ".folderSyncMode", mFolderSyncMode.name());
@ -524,12 +539,12 @@ public class Account implements Serializable {
this.mNotifySync = showOngoing;
}
public boolean isHideMessageViewButtons()
public HideButtons getHideMessageViewButtons()
{
return mHideMessageViewButtons;
}
public void setHideMessageViewButtons(boolean hideMessageViewButtons)
public void setHideMessageViewButtons(HideButtons hideMessageViewButtons)
{
mHideMessageViewButtons = hideMessageViewButtons;
}

View File

@ -148,6 +148,8 @@ public class Email extends Application {
public static final String BACKUP_DATE_FORMAT = "MM-dd-yyyy";
public static final String TIME_FORMAT_12 = "h:mm a";
public static final String TIME_FORMAT_24 = "H:mm";
public static final int FLAGGED_COLOR = 0xffff4444;
/**
* Called throughout the application when the number of accounts has changed. This method

View File

@ -19,6 +19,7 @@ import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.Drawable;
import android.media.MediaScannerConnection;
import android.media.MediaScannerConnection.MediaScannerConnectionClient;
import android.net.Uri;
@ -98,6 +99,8 @@ public class MessageView extends Activity
private DateFormat dateFormat = null;
private DateFormat timeFormat = null;
private Menu optionsMenu = null;
private DateFormat getDateFormat()
{
@ -178,6 +181,8 @@ public class MessageView extends Activity
private static final int MSG_ATTACHMENT_NOT_SAVED = 8;
private static final int MSG_SHOW_SHOW_PICTURES = 9;
private static final int MSG_FETCHING_ATTACHMENT = 10;
private static final int FLAG_FLAGGED = 1;
private static final int FLAG_ANSWERED = 2;
@Override
public void handleMessage(android.os.Message msg) {
@ -204,6 +209,22 @@ public class MessageView extends Activity
mDateView.setText(values[2]);
mToView.setText(values[3]);
mAttachmentIcon.setVisibility(msg.arg1 == 1 ? View.VISIBLE : View.GONE);
if ((msg.arg2 & FLAG_FLAGGED) != 0) {
mSubjectView.setTextColor(Email.FLAGGED_COLOR);
}
else {
mSubjectView.setTextColor(0xff000000);
}
if ((msg.arg2 & FLAG_ANSWERED) != 0) {
Drawable answeredIcon = getResources().getDrawable(
R.drawable.ic_mms_answered_small);
mSubjectView.setCompoundDrawablesWithIntrinsicBounds(
answeredIcon, // left
null, // top
null, // right
null); // bottom
}
break;
case MSG_NETWORK_ERROR:
Toast.makeText(MessageView.this,
@ -258,10 +279,15 @@ public class MessageView extends Activity
String from,
String date,
String to,
boolean hasAttachments) {
boolean hasAttachments,
boolean flagged,
boolean seen) {
android.os.Message msg = new android.os.Message();
msg.what = MSG_SET_HEADERS;
msg.arg1 = hasAttachments ? 1 : 0;
msg.arg2 += (flagged ? FLAG_FLAGGED : 0);
msg.arg2 += (seen ? FLAG_ANSWERED : 0);
msg.obj = new String[] { subject, from, date, to };
sendMessage(msg);
}
@ -345,8 +371,19 @@ public class MessageView extends Activity
mAttachmentIcon.setVisibility(View.GONE);
setOnClickListener(R.id.reply);
setOnClickListener(R.id.reply_all);
setOnClickListener(R.id.delete);
setOnClickListener(R.id.forward);
setOnClickListener(R.id.next);
setOnClickListener(R.id.previous);
setOnClickListener(R.id.reply_scrolling);
// setOnClickListener(R.id.reply_all_scrolling);
setOnClickListener(R.id.delete_scrolling);
setOnClickListener(R.id.forward_scrolling);
setOnClickListener(R.id.next_scrolling);
setOnClickListener(R.id.previous_scrolling);
setOnClickListener(R.id.show_pictures);
// UrlInterceptRegistry.registerHandler(this);
@ -366,45 +403,53 @@ public class MessageView extends Activity
View previous = findViewById(R.id.previous);
findSurroundingMessagesUid();
setOnClickListener(R.id.next);
setOnClickListener(R.id.previous);
if (next != null && previous != null) {
next.setOnClickListener(this);
previous.setOnClickListener(this);
// previous.setVisibility(mPreviousMessageUid != null ? View.VISIBLE : View.GONE);
previous.setEnabled(mPreviousMessageUid != null);
//next.setVisibility(mNextMessageUid != null ? View.VISIBLE : View.GONE);
next.setEnabled(mNextMessageUid != null );
boolean goNext = intent.getBooleanExtra(EXTRA_NEXT, false);
if (goNext) {
next.requestFocus();
}
next.setEnabled(mNextMessageUid != null );
previous.setEnabled(mPreviousMessageUid != null);
View next_scrolling = findViewById(R.id.next_scrolling);
if (next_scrolling != null) {
next_scrolling.setEnabled(mNextMessageUid != null );
}
if (mAccount.isHideMessageViewButtons())
View previous_scrolling = findViewById(R.id.previous_scrolling);
if (previous_scrolling != null) {
previous_scrolling.setEnabled(mPreviousMessageUid != null);
}
boolean goNext = intent.getBooleanExtra(EXTRA_NEXT, false);
if (goNext) {
next.requestFocus();
}
Account.HideButtons hideButtons = mAccount.getHideMessageViewButtons();
if (Account.HideButtons.ALWAYS == hideButtons)
{
final Configuration config = this.getResources().getConfiguration();
// Configuration config = new Configuration();
// android.provider.Settings.System.getConfiguration(getContentResolver(), config);
if (config.keyboardHidden == Configuration.KEYBOARDHIDDEN_NO )
{
View bottomButtons = findViewById(R.id.bottom_buttons);
if (bottomButtons != null) {
bottomButtons.setVisibility(View.GONE);
}
}
// View topButtons = findViewById(R.id.top_buttons);
// if (topButtons != null) {
// topButtons.setVisibility(View.GONE);
// }
hideButtons();
}
else if (Account.HideButtons.NEVER == hideButtons)
{
showButtons();
}
else // Account.HideButtons.KEYBOARD_AVAIL
{
final Configuration config = this.getResources().getConfiguration();
if (config.keyboardHidden == Configuration.KEYBOARDHIDDEN_NO )
{
hideButtons();
}
else
{
showButtons();
}
}
MessagingController.getInstance(getApplication()).addListener(mListener);
new Thread() {
public void run() {
@ -420,6 +465,21 @@ public class MessageView extends Activity
}
}.start();
}
private void showButtons()
{
View buttons = findViewById(R.id.scrolling_buttons);
if (buttons != null) {
buttons.setVisibility(View.GONE);
}
}
private void hideButtons()
{
View buttons = findViewById(R.id.bottom_buttons);
if (buttons != null) {
buttons.setVisibility(View.GONE);
}
}
private void setOnClickListener(int viewCode)
{
@ -456,7 +516,7 @@ public class MessageView extends Activity
super.onPause();
MessagingController.getInstance(getApplication()).removeListener(mListener);
}
private void onDelete() {
if (mMessage != null) {
Message messageToDelete = mMessage;
@ -522,6 +582,8 @@ public class MessageView extends Activity
try
{
mMessage.setFlag(Flag.FLAGGED, !mMessage.isSet(Flag.FLAGGED));
setHeaders(mAccount, mMessage.getFolder().getName(), mMessage.getUid(), mMessage);
setMenuFlag();
}
catch (MessagingException me)
{
@ -640,21 +702,26 @@ public class MessageView extends Activity
public void onClick(View view) {
switch (view.getId()) {
case R.id.reply:
case R.id.reply_scrolling:
onReply();
break;
case R.id.reply_all:
onReplyAll();
break;
case R.id.delete:
case R.id.delete_scrolling:
onDelete();
break;
case R.id.forward:
case R.id.forward_scrolling:
onForward();
break;
case R.id.next:
case R.id.next_scrolling:
onNext();
break;
case R.id.previous:
case R.id.previous_scrolling:
onPrevious();
break;
case R.id.download:
@ -689,6 +756,9 @@ public class MessageView extends Activity
case R.id.mark_as_unread:
onMarkAsUnread();
break;
case R.id.flag:
onFlag();
break;
default:
return super.onOptionsItemSelected(item);
}
@ -698,8 +768,23 @@ public class MessageView extends Activity
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
getMenuInflater().inflate(R.menu.message_view_option, menu);
optionsMenu = menu;
setMenuFlag();
return true;
}
private void setMenuFlag()
{
Menu menu = optionsMenu;
if (menu != null)
{
MenuItem flagItem = menu.findItem(R.id.flag);
if (flagItem != null)
{
flagItem.setTitle((mMessage.isSet(Flag.FLAGGED) ? R.string.unflag_action : R.string.flag_action));
}
}
}
public CacheResult service(String url, Map<String, String> headers) {
String prefix = "http://cid/";
@ -831,6 +916,25 @@ public class MessageView extends Activity
}
}
}
private void setHeaders(Account account, String folder, String uid,
final Message message) throws MessagingException
{
String subjectText = message.getSubject();
String fromText = Address.toFriendly(message.getFrom());
String dateText = Utility.isDateToday(message.getSentDate()) ?
getTimeFormat().format(message.getSentDate()) :
getDateFormat().format(message.getSentDate());
String toText = Address.toFriendly(message.getRecipients(RecipientType.TO));
boolean hasAttachments = ((LocalMessage) message).getAttachmentCount() > 0;
mHandler.setHeaders(subjectText,
fromText,
dateText,
toText,
hasAttachments,
message.isSet(Flag.FLAGGED),
message.isSet(Flag.ANSWERED));
}
class Listener extends MessagingListener {
@ -839,18 +943,7 @@ public class MessageView extends Activity
final Message message) {
MessageView.this.mMessage = message;
try {
String subjectText = message.getSubject();
String fromText = Address.toFriendly(message.getFrom());
String dateText = Utility.isDateToday(message.getSentDate()) ?
getTimeFormat().format(message.getSentDate()) :
getDateFormat().format(message.getSentDate());
String toText = Address.toFriendly(message.getRecipients(RecipientType.TO));
boolean hasAttachments = ((LocalMessage) message).getAttachmentCount() > 0;
mHandler.setHeaders(subjectText,
fromText,
dateText,
toText,
hasAttachments);
setHeaders(account, folder, uid, message);
}
catch (MessagingException me) {
if (Config.LOGV) {

View File

@ -27,7 +27,7 @@ public class AccountSettings extends PreferenceActivity {
private static final String PREFERENCE_FREQUENCY = "account_check_frequency";
private static final String PREFERENCE_DISPLAY_COUNT = "account_display_count";
private static final String PREFERENCE_DEFAULT = "account_default";
private static final String PREFERENCE_HIDE_BUTTONS = "hide_buttons";
private static final String PREFERENCE_HIDE_BUTTONS = "hide_buttons_enum";
private static final String PREFERENCE_NOTIFY = "account_notify";
private static final String PREFERENCE_NOTIFY_SYNC = "account_notify_sync";
private static final String PREFERENCE_VIBRATE = "account_vibrate";
@ -45,7 +45,7 @@ public class AccountSettings extends PreferenceActivity {
private ListPreference mDisplayCount;
private CheckBoxPreference mAccountDefault;
private CheckBoxPreference mAccountNotify;
private CheckBoxPreference mAccountHideButtons;
private ListPreference mAccountHideButtons;
private CheckBoxPreference mAccountNotifySync;
private CheckBoxPreference mAccountVibrate;
private RingtonePreference mAccountRingtone;
@ -152,10 +152,19 @@ public class AccountSettings extends PreferenceActivity {
mAccountDefault.setChecked(
mAccount.equals(Preferences.getPreferences(this).getDefaultAccount()));
mAccountHideButtons = (CheckBoxPreference) findPreference(PREFERENCE_HIDE_BUTTONS);
mAccountHideButtons.setChecked(mAccount.isHideMessageViewButtons());
mAccountHideButtons = (ListPreference) findPreference(PREFERENCE_HIDE_BUTTONS);
mAccountHideButtons.setValue("" + mAccount.getHideMessageViewButtons());
mAccountHideButtons.setSummary(mAccountHideButtons.getEntry());
mAccountHideButtons.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference preference, Object newValue) {
final String summary = newValue.toString();
int index = mAccountHideButtons.findIndexOfValue(summary);
mAccountHideButtons.setSummary(mAccountHideButtons.getEntries()[index]);
mAccountHideButtons.setValue(summary);
return false;
}
});
mAccountNotify = (CheckBoxPreference) findPreference(PREFERENCE_NOTIFY);
mAccountNotify.setChecked(mAccount.isNotifyNewMail());
@ -219,7 +228,7 @@ public class AccountSettings extends PreferenceActivity {
mAccount.setDeletePolicy(Integer.parseInt(mDeletePolicy.getValue()));
SharedPreferences prefs = mAccountRingtone.getPreferenceManager().getSharedPreferences();
mAccount.setRingtone(prefs.getString(PREFERENCE_RINGTONE, null));
mAccount.setHideMessageViewButtons(mAccountHideButtons.isChecked());
mAccount.setHideMessageViewButtons(Account.HideButtons.valueOf(mAccountHideButtons.getValue()));
mAccount.save(Preferences.getPreferences(this));
Email.setServicesEnabled(this);
// TODO: refresh folder list here