1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-12-24 08:38:51 -05:00

Added option to return to the message list after deleting a message in the message view activity. Patch provided by fiouzy (Thanks!)

Fixes issue 1634
This commit is contained in:
cketti 2010-06-20 12:15:29 +00:00
parent a5c5aaa054
commit e529bed259
5 changed files with 35 additions and 5 deletions

View File

@ -298,6 +298,8 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin
<string name="global_settings_messageview_fixedwidth_label">Fixed-width fonts</string>
<string name="global_settings_messageview_fixedwidth_summary">Use a fixed-width font when showing plain-text messages</string>
<string name="global_settings_messageview_return_to_list_label">Return to list after delete</string>
<string name="global_settings_messageview_return_to_list_summary">Return to message list after message deletion</string>
<string name="account_setup_basics_title">Set up a new account</string>
<string name="account_setup_basics_instructions">Enter this account\'s email address:</string>

View File

@ -90,12 +90,17 @@
</PreferenceCategory>
<PreferenceCategory android:title="@string/messageview_preferences" android:key="messageview_preferences">
<CheckBoxPreference
android:key="messageview_fixedwidth_font"
android:title="@string/global_settings_messageview_fixedwidth_label"
android:summary="@string/global_settings_messageview_fixedwidth_summary"
android:summary="@string/global_settings_messageview_fixedwidth_summary" />
<CheckBoxPreference
android:key="messageview_return_to_list"
android:title="@string/global_settings_messageview_return_to_list_label"
android:summary="@string/global_settings_messageview_return_to_list_summary" />
/>
</PreferenceCategory>
<PreferenceCategory android:title="@string/operational_preferences" android:key="operational_preferences">

View File

@ -10,7 +10,6 @@ import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.net.Uri;
import android.os.Environment;
import android.util.Log;
import android.webkit.WebSettings;
@ -80,6 +79,7 @@ public class K9 extends Application
private static boolean mMessageListTouchable = false;
private static boolean mMessageViewFixedWidthFont = false;
private static boolean mMessageViewReturnToList = false;
private static boolean mGesturesEnabled = true;
private static boolean mManageBack = false;
@ -309,6 +309,7 @@ public class K9 extends Application
editor.putBoolean("messageListTouchable",mMessageListTouchable);
editor.putBoolean("messageViewFixedWidthFont",mMessageViewFixedWidthFont);
editor.putBoolean("messageViewReturnToList", mMessageViewReturnToList);
editor.putInt("theme", theme);
editor.putBoolean("useGalleryBugWorkaround", useGalleryBugWorkaround);
@ -338,6 +339,7 @@ public class K9 extends Application
mMessageListTouchable = sprefs.getBoolean("messageListTouchable",false);
mMessageViewFixedWidthFont = sprefs.getBoolean("messageViewFixedWidthFont", false);
mMessageViewReturnToList = sprefs.getBoolean("messageViewReturnToList", false);
useGalleryBugWorkaround = sprefs.getBoolean("useGalleryBugWorkaround", K9.isGalleryBuggy());
@ -524,6 +526,16 @@ public class K9 extends Application
mMessageViewFixedWidthFont = fixed;
}
public static boolean messageViewReturnToList()
{
return mMessageViewReturnToList;
}
public static void setMessageViewReturnToList(boolean messageViewReturnToList)
{
mMessageViewReturnToList = messageViewReturnToList;
}
private static Method getMethod(Class<?> classObject, String methodName)
{
try

View File

@ -863,7 +863,14 @@ public class MessageView extends K9Activity implements OnClickListener
{
Message messageToDelete = mMessage;
showNextMessage();
if (K9.messageViewReturnToList())
{
finish();
}
else
{
showNextMessage();
}
MessagingController.getInstance(getApplication()).deleteMessages(
new Message[] { messageToDelete },

View File

@ -18,7 +18,6 @@ import com.fsck.k9.service.MailService;
public class Prefs extends K9PreferenceActivity
{
private static final String PREFERENCE_THEME = "theme";
private static final String PREFERENCE_FONT_SIZE = "font_size";
private static final String PREFERENCE_DATE_FORMAT = "dateFormat";
@ -34,6 +33,7 @@ public class Prefs extends K9PreferenceActivity
private static final String PREFERENCE_MESSAGELIST_TOUCHABLE = "messagelist_touchable";
private static final String PREFERENCE_MESSAGEVIEW_FIXEDWIDTH = "messageview_fixedwidth_font";
private static final String PREFERENCE_MESSAGEVIEW_RETURN_TO_LIST = "messageview_return_to_list";
private static final String PREFERENCE_MEASURE_ACCOUNTS = "measure_accounts";
private static final String PREFERENCE_COUNT_SEARCH = "count_search";
@ -51,6 +51,7 @@ public class Prefs extends K9PreferenceActivity
private CheckBoxPreference mTouchable;
private CheckBoxPreference mFixedWidth;
private CheckBoxPreference mReturnToList;
private CheckBoxPreference mMeasureAccounts;
private CheckBoxPreference mCountSearch;
@ -169,6 +170,8 @@ public class Prefs extends K9PreferenceActivity
mFixedWidth = (CheckBoxPreference)findPreference(PREFERENCE_MESSAGEVIEW_FIXEDWIDTH);
mFixedWidth.setChecked(K9.messageViewFixedWidthFont());
mReturnToList = (CheckBoxPreference) findPreference(PREFERENCE_MESSAGEVIEW_RETURN_TO_LIST);
mReturnToList.setChecked(K9.messageViewReturnToList());
mMeasureAccounts = (CheckBoxPreference)findPreference(PREFERENCE_MEASURE_ACCOUNTS);
mMeasureAccounts.setChecked(K9.measureAccounts());
@ -202,6 +205,7 @@ public class Prefs extends K9PreferenceActivity
K9.setMessageListTouchable(mTouchable.isChecked());
K9.setMessageViewFixedWidthFont(mFixedWidth.isChecked());
K9.setMessageViewReturnToList(mReturnToList.isChecked());
K9.setMeasureAccounts(mMeasureAccounts.isChecked());
K9.setCountSearchMessages(mCountSearch.isChecked());