1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-12-25 09:08:49 -05:00

Major ergonomic changes to control buttons in the MessageView

1) Eliminate the top row Next Message and Previous Message

2) In the bottom buttons for portrait mode, replace Reply and Forward
   with Prev and Next
   Justification: if you're going to be replying or forwarding, you're
   about to embark on a lot of typing, anyway.  Having to hit Menu
   isn't an undue burden.

3) Prev goes to the adjacent *older* message, next goes to the
   adjacent *newer* message

4) In the bottom buttons for landscape mode, added Prev and Next as the
   outer buttons

5) Add Account option for hiding the bottom buttons when the keyboard
   is available.

Also, temporarily (hopefully!) reverted the instant delete from the
MessageView because it isn't working right.  The method here is slower
but safer.
This commit is contained in:
Daniel Applebaum 2009-01-19 14:54:05 +00:00
parent 7f2601df17
commit 4f5ed839ff
7 changed files with 107 additions and 38 deletions

View File

@ -22,11 +22,18 @@
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>
<LinearLayout <LinearLayout
android:id="@+id/bottom_buttons"
android:orientation="horizontal" android:orientation="horizontal"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="57px" android:layout_height="57px"
android:background="@drawable/ic_email_thread_open_bottom_default" android:background="@drawable/ic_email_thread_open_bottom_default"
android:gravity="center_vertical"> android:gravity="center_vertical">
<Button
android:id="@+id/previous"
android:text="@string/message_view_prev_action"
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="1" />
<Button <Button
android:id="@+id/reply" android:id="@+id/reply"
android:text="@string/reply_action" android:text="@string/reply_action"
@ -45,5 +52,11 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="0dip" android:layout_width="0dip"
android:layout_weight="1" /> android:layout_weight="1" />
<Button
android:id="@+id/next"
android:text="@string/message_view_next_action"
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="1" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>

View File

@ -16,7 +16,8 @@
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="0dip" android:layout_height="0dip"
android:layout_weight="1"> android:layout_weight="1">
<RelativeLayout <!-- <RelativeLayout
android:id="@+id/top_buttons"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="54px" android:layout_height="54px"
android:paddingTop="4px"> android:paddingTop="4px">
@ -37,23 +38,32 @@
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_centerVertical="true" /> android:layout_centerVertical="true" />
</RelativeLayout> </RelativeLayout>
-->
<include layout="@layout/message_view_header" /> <include layout="@layout/message_view_header" />
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>
<LinearLayout <LinearLayout
android:id="@+id/bottom_buttons"
android:orientation="horizontal" android:orientation="horizontal"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="57px" android:layout_height="57px"
android:background="@drawable/ic_email_thread_open_bottom_default" android:background="@drawable/ic_email_thread_open_bottom_default"
android:gravity="center_vertical"> android:gravity="center_vertical">
<Button <!-- <Button
android:id="@+id/reply" android:id="@+id/reply"
android:text="@string/reply_action" android:text="@string/reply_action"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="0dip" android:layout_width="0dip"
android:layout_weight="1" />-->
<Button
android:id="@+id/previous"
android:text="@string/message_view_prev_action"
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="1" /> android:layout_weight="1" />
<Button <Button
android:id="@+id/delete" android:id="@+id/delete"
android:text="@string/delete_action" android:text="@string/delete_action"
@ -61,10 +71,16 @@
android:layout_width="0dip" android:layout_width="0dip"
android:layout_weight="1" /> android:layout_weight="1" />
<Button <Button
android:id="@+id/next"
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:id="@+id/forward"
android:text="@string/forward_action" android:text="@string/forward_action"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="0dip" android:layout_width="0dip"
android:layout_weight="1" /> android:layout_weight="1" /> -->
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>

View File

@ -144,8 +144,8 @@ Welcome to K-9 Mail setup. K-9 is an open source email client for Android based
<string name="message_view_to_label">To:</string> <string name="message_view_to_label">To:</string>
<string name="message_view_attachment_view_action">Open</string> <string name="message_view_attachment_view_action">Open</string>
<string name="message_view_attachment_download_action">Save</string> <string name="message_view_attachment_download_action">Save</string>
<string name="message_view_prev_action">Prev message</string> <string name="message_view_prev_action">Prev</string>
<string name="message_view_next_action">Next message</string> <string name="message_view_next_action">Next</string>
<string name="message_view_datetime_fmt">MMM dd yyyy hh:mm a</string> <string name="message_view_datetime_fmt">MMM dd yyyy hh:mm a</string>
<string name="message_view_status_attachment_saved">Attachment saved to SD card as <xliff:g id="filename">%s</xliff:g>.</string> <string name="message_view_status_attachment_saved">Attachment saved to SD card as <xliff:g id="filename">%s</xliff:g>.</string>
<string name="message_view_status_attachment_not_saved">Unable to save attachment to SD card.</string> <string name="message_view_status_attachment_not_saved">Unable to save attachment to SD card.</string>
@ -282,6 +282,9 @@ 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_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_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_display_sync">Display and synchronization</string> <string name="account_settings_display_sync">Display and synchronization</string>
<string name="account_settings_mail_check_frequency_label">Email check frequency</string> <string name="account_settings_mail_check_frequency_label">Email check frequency</string>

View File

@ -38,6 +38,11 @@
android:entryValues="@array/account_settings_display_count_values" android:entryValues="@array/account_settings_display_count_values"
android:dialogTitle="@string/account_settings_mail_display_count_label" /> android:dialogTitle="@string/account_settings_mail_display_count_label" />
<CheckBoxPreference
android:key="hide_buttons"
android:title="@string/account_settings_hide_buttons_label"
android:summary="@string/account_settings_hide_buttons_summary" />
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory android:title="@string/account_settings_display_sync"> <PreferenceCategory android:title="@string/account_settings_display_sync">

View File

@ -52,6 +52,7 @@ public class Account implements Serializable {
boolean mVibrate; boolean mVibrate;
String mRingtoneUri; String mRingtoneUri;
boolean mNotifySync; boolean mNotifySync;
boolean mHideMessageViewButtons = false;
public enum FolderMode { public enum FolderMode {
ALL, FIRST_CLASS, FIRST_AND_SECOND_CLASS, NOT_SECOND_CLASS; ALL, FIRST_CLASS, FIRST_AND_SECOND_CLASS, NOT_SECOND_CLASS;
@ -121,6 +122,7 @@ public class Account implements Serializable {
"Outbox"); "Outbox");
mAccountNumber = preferences.mSharedPreferences.getInt(mUuid + ".accountNumber", 0); mAccountNumber = preferences.mSharedPreferences.getInt(mUuid + ".accountNumber", 0);
mVibrate = preferences.mSharedPreferences.getBoolean(mUuid + ".vibrate", false); mVibrate = preferences.mSharedPreferences.getBoolean(mUuid + ".vibrate", false);
mHideMessageViewButtons = preferences.mSharedPreferences.getBoolean(mUuid + ".hideButtons", false);
mRingtoneUri = preferences.mSharedPreferences.getString(mUuid + ".ringtone", mRingtoneUri = preferences.mSharedPreferences.getString(mUuid + ".ringtone",
"content://settings/system/notification_sound"); "content://settings/system/notification_sound");
try try
@ -258,6 +260,7 @@ public class Account implements Serializable {
editor.remove(mUuid + ".lastFullSync"); editor.remove(mUuid + ".lastFullSync");
editor.remove(mUuid + ".folderDisplayMode"); editor.remove(mUuid + ".folderDisplayMode");
editor.remove(mUuid + ".folderSyncMode"); editor.remove(mUuid + ".folderSyncMode");
editor.remove(mUuid + ".hideButtons");
editor.commit(); editor.commit();
} }
@ -319,6 +322,7 @@ public class Account implements Serializable {
editor.putString(mUuid + ".outboxFolderName", mOutboxFolderName); editor.putString(mUuid + ".outboxFolderName", mOutboxFolderName);
editor.putInt(mUuid + ".accountNumber", mAccountNumber); editor.putInt(mUuid + ".accountNumber", mAccountNumber);
editor.putBoolean(mUuid + ".vibrate", mVibrate); editor.putBoolean(mUuid + ".vibrate", mVibrate);
editor.putBoolean(mUuid + ".hideButtons", mHideMessageViewButtons);
editor.putString(mUuid + ".ringtone", mRingtoneUri); editor.putString(mUuid + ".ringtone", mRingtoneUri);
editor.putString(mUuid + ".folderDisplayMode", mFolderDisplayMode.name()); editor.putString(mUuid + ".folderDisplayMode", mFolderDisplayMode.name());
editor.putString(mUuid + ".folderSyncMode", mFolderSyncMode.name()); editor.putString(mUuid + ".folderSyncMode", mFolderSyncMode.name());
@ -520,4 +524,14 @@ public class Account implements Serializable {
this.mNotifySync = showOngoing; this.mNotifySync = showOngoing;
} }
public boolean isHideMessageViewButtons()
{
return mHideMessageViewButtons;
}
public void setHideMessageViewButtons(boolean hideMessageViewButtons)
{
mHideMessageViewButtons = hideMessageViewButtons;
}
} }

View File

@ -16,6 +16,7 @@ import org.apache.commons.io.IOUtils;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.media.MediaScannerConnection; import android.media.MediaScannerConnection;
@ -367,23 +368,43 @@ public class MessageView extends Activity
findSurroundingMessagesUid(); findSurroundingMessagesUid();
/*
* Next and Previous Message are not shown in landscape mode, so
* we need to check before we use them.
*/
if (next != null && previous != null) { if (next != null && previous != null) {
next.setOnClickListener(this); next.setOnClickListener(this);
previous.setOnClickListener(this); previous.setOnClickListener(this);
previous.setVisibility(mPreviousMessageUid != null ? View.VISIBLE : View.GONE); // previous.setVisibility(mPreviousMessageUid != null ? View.VISIBLE : View.GONE);
next.setVisibility(mNextMessageUid != 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); boolean goNext = intent.getBooleanExtra(EXTRA_NEXT, false);
if (goNext) { if (goNext) {
next.requestFocus(); next.requestFocus();
} }
} }
if (mAccount.isHideMessageViewButtons())
{
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);
// }
}
MessagingController.getInstance(getApplication()).addListener(mListener); MessagingController.getInstance(getApplication()).addListener(mListener);
new Thread() { new Thread() {
@ -415,11 +436,11 @@ public class MessageView extends Activity
String messageUid = mFolderUids.get(i); String messageUid = mFolderUids.get(i);
if (messageUid.equals(mMessageUid)) { if (messageUid.equals(mMessageUid)) {
if (i != 0) { if (i != 0) {
mPreviousMessageUid = mFolderUids.get(i - 1); mNextMessageUid = mFolderUids.get(i - 1);
} }
if (i != count - 1) { if (i != count - 1) {
mNextMessageUid = mFolderUids.get(i + 1); mPreviousMessageUid = mFolderUids.get(i + 1);
} }
break; break;
} }
@ -439,10 +460,12 @@ public class MessageView extends Activity
private void onDelete() { private void onDelete() {
if (mMessage != null) { if (mMessage != null) {
Message messageToDelete = mMessage;
String folderForDelete = mFolder;
Account accountForDelete = mAccount;
// Remove this message's Uid locally // Remove this message's Uid locally
mFolderUids.remove(mMessage.getUid()); mFolderUids.remove(messageToDelete.getUid());
findSurroundingMessagesUid(); findSurroundingMessagesUid();
@ -450,37 +473,25 @@ public class MessageView extends Activity
{ {
public void messageDeleted(Account account, String folder, Message message) public void messageDeleted(Account account, String folder, Message message)
{ {
// Toast.makeText(MessageView.this, R.string.message_deleted_toast, Toast.LENGTH_SHORT).show(); if (mNextMessageUid != null) {
// Check if we have previous/next messages available before choosing
// which one to display
if (mPreviousMessageUid != null) {
onPrevious();
} else if (mNextMessageUid != null) {
onNext(); onNext();
}
else if (mPreviousMessageUid != null) {
onPrevious();
} else { } else {
finish(); finish();
} }
} }
}; };
MessagingListener waitListener = null; MessagingListener waitListener = listener;
if (mPreviousMessageUid == null && mNextMessageUid == null)
{
// If we have no more messages to view, force the delete to be synchronous, so that
// when we return to the list, all of the localStore operations have completed.
waitListener = listener;
}
else
{
listener.messageDeleted(mAccount, mFolder, mMessage);
}
MessagingController.getInstance(getApplication()).deleteMessage( MessagingController.getInstance(getApplication()).deleteMessage(
mAccount, accountForDelete,
mFolder, folderForDelete,
mMessage, messageToDelete,
waitListener); waitListener);
} }
} }

View File

@ -27,6 +27,7 @@ public class AccountSettings extends PreferenceActivity {
private static final String PREFERENCE_FREQUENCY = "account_check_frequency"; private static final String PREFERENCE_FREQUENCY = "account_check_frequency";
private static final String PREFERENCE_DISPLAY_COUNT = "account_display_count"; private static final String PREFERENCE_DISPLAY_COUNT = "account_display_count";
private static final String PREFERENCE_DEFAULT = "account_default"; private static final String PREFERENCE_DEFAULT = "account_default";
private static final String PREFERENCE_HIDE_BUTTONS = "hide_buttons";
private static final String PREFERENCE_NOTIFY = "account_notify"; private static final String PREFERENCE_NOTIFY = "account_notify";
private static final String PREFERENCE_NOTIFY_SYNC = "account_notify_sync"; private static final String PREFERENCE_NOTIFY_SYNC = "account_notify_sync";
private static final String PREFERENCE_VIBRATE = "account_vibrate"; private static final String PREFERENCE_VIBRATE = "account_vibrate";
@ -44,6 +45,7 @@ public class AccountSettings extends PreferenceActivity {
private ListPreference mDisplayCount; private ListPreference mDisplayCount;
private CheckBoxPreference mAccountDefault; private CheckBoxPreference mAccountDefault;
private CheckBoxPreference mAccountNotify; private CheckBoxPreference mAccountNotify;
private CheckBoxPreference mAccountHideButtons;
private CheckBoxPreference mAccountNotifySync; private CheckBoxPreference mAccountNotifySync;
private CheckBoxPreference mAccountVibrate; private CheckBoxPreference mAccountVibrate;
private RingtonePreference mAccountRingtone; private RingtonePreference mAccountRingtone;
@ -150,6 +152,10 @@ public class AccountSettings extends PreferenceActivity {
mAccountDefault.setChecked( mAccountDefault.setChecked(
mAccount.equals(Preferences.getPreferences(this).getDefaultAccount())); mAccount.equals(Preferences.getPreferences(this).getDefaultAccount()));
mAccountHideButtons = (CheckBoxPreference) findPreference(PREFERENCE_HIDE_BUTTONS);
mAccountHideButtons.setChecked(mAccount.isHideMessageViewButtons());
mAccountNotify = (CheckBoxPreference) findPreference(PREFERENCE_NOTIFY); mAccountNotify = (CheckBoxPreference) findPreference(PREFERENCE_NOTIFY);
mAccountNotify.setChecked(mAccount.isNotifyNewMail()); mAccountNotify.setChecked(mAccount.isNotifyNewMail());
@ -213,6 +219,7 @@ public class AccountSettings extends PreferenceActivity {
mAccount.setDeletePolicy(Integer.parseInt(mDeletePolicy.getValue())); mAccount.setDeletePolicy(Integer.parseInt(mDeletePolicy.getValue()));
SharedPreferences prefs = mAccountRingtone.getPreferenceManager().getSharedPreferences(); SharedPreferences prefs = mAccountRingtone.getPreferenceManager().getSharedPreferences();
mAccount.setRingtone(prefs.getString(PREFERENCE_RINGTONE, null)); mAccount.setRingtone(prefs.getString(PREFERENCE_RINGTONE, null));
mAccount.setHideMessageViewButtons(mAccountHideButtons.isChecked());
mAccount.save(Preferences.getPreferences(this)); mAccount.save(Preferences.getPreferences(this));
Email.setServicesEnabled(this); Email.setServicesEnabled(this);
// TODO: refresh folder list here // TODO: refresh folder list here