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

Add a new preference to let users select how many lines of message

preview show in message-preview mode.
This commit is contained in:
Jesse Vincent 2010-11-05 02:59:26 +00:00
parent d0e85ce43a
commit 9d69875246
7 changed files with 57 additions and 4 deletions

View File

@ -2,8 +2,9 @@
<RelativeLayout <RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="?android:attr/listPreferredItemHeight" android:layout_height="wrap_content"
android:paddingTop="2dip" android:paddingTop="3dip"
android:paddingBottom="3dip"
android:background="#ccc" > android:background="#ccc" >
<RelativeLayout <RelativeLayout
@ -75,7 +76,6 @@
android:layout_marginLeft="1dip" android:layout_marginLeft="1dip"
android:layout_marginRight="0dip" android:layout_marginRight="0dip"
android:singleLine="false" android:singleLine="false"
android:fadingEdge="vertical"
android:bufferType="spannable" android:bufferType="spannable"
android:textColor="?android:attr/textColorPrimary" android:textColor="?android:attr/textColorPrimary"
android:textAppearance="?android:attr/textAppearanceSmall" /> android:textAppearance="?android:attr/textAppearanceSmall" />

View File

@ -631,4 +631,23 @@
<item>apg</item> <item>apg</item>
</string-array> </string-array>
<string-array name="settings_preview_lines_values">
<item>2</item>
<item>3</item>
<item>4</item>
<item>5</item>
<item>6</item>
</string-array>
<string-array name="settings_preview_lines_entries">
<item>2</item>
<item>3</item>
<item>4</item>
<item>5</item>
<item>6</item>
</string-array>
</resources> </resources>

View File

@ -314,7 +314,7 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin
<string name="global_settings_checkbox_summary">Always show multi-select checkboxes</string> <string name="global_settings_checkbox_summary">Always show multi-select checkboxes</string>
<string name="global_settings_touchable_label">Message previews</string> <string name="global_settings_touchable_label">Message previews</string>
<string name="global_settings_touchable_summary">Roomier list items with message previews</string> <string name="global_settings_touchable_summary">Roomier list items with message previews</string>
<string name="global_settings_preview_lines_label">Preview lines</string>
<string name="global_settings_show_contact_name_label">Show contact names</string> <string name="global_settings_show_contact_name_label">Show contact names</string>
<string name="global_settings_show_contact_name_summary">Use recipient names from Contacts when available</string> <string name="global_settings_show_contact_name_summary">Use recipient names from Contacts when available</string>
<string name="global_settings_registered_name_color_label">Colorize contacts</string> <string name="global_settings_registered_name_color_label">Colorize contacts</string>

View File

@ -97,6 +97,16 @@
android:title="@string/global_settings_touchable_label" android:title="@string/global_settings_touchable_label"
android:summary="@string/global_settings_touchable_summary" /> android:summary="@string/global_settings_touchable_summary" />
<ListPreference
android:persistent="false"
android:key="messagelist_preview_lines"
android:title="@string/global_settings_preview_lines_label"
android:entries="@array/settings_preview_lines_entries"
android:entryValues="@array/settings_preview_lines_values"
android:dialogTitle="@string/global_settings_preview_lines_label"
android:dependency="messagelist_touchable" />
<CheckBoxPreference <CheckBoxPreference
android:persistent="false" android:persistent="false"
android:key="messagelist_stars" android:key="messagelist_stars"

View File

@ -140,6 +140,7 @@ public class K9 extends Application
private static boolean mMessageListStars = true; private static boolean mMessageListStars = true;
private static boolean mMessageListCheckboxes = false; private static boolean mMessageListCheckboxes = false;
private static boolean mMessageListTouchable = false; private static boolean mMessageListTouchable = false;
private static int mMessageListPreviewLines = 2;
private static boolean mShowContactName = false; private static boolean mShowContactName = false;
private static boolean mChangeContactNameColor = false; private static boolean mChangeContactNameColor = false;
@ -386,6 +387,7 @@ public class K9 extends Application
editor.putBoolean("messageListStars",mMessageListStars); editor.putBoolean("messageListStars",mMessageListStars);
editor.putBoolean("messageListCheckboxes",mMessageListCheckboxes); editor.putBoolean("messageListCheckboxes",mMessageListCheckboxes);
editor.putBoolean("messageListTouchable",mMessageListTouchable); editor.putBoolean("messageListTouchable",mMessageListTouchable);
editor.putInt("messageListPreviewLines",mMessageListPreviewLines);
editor.putBoolean("showContactName",mShowContactName); editor.putBoolean("showContactName",mShowContactName);
editor.putBoolean("changeRegisteredNameColor",mChangeContactNameColor); editor.putBoolean("changeRegisteredNameColor",mChangeContactNameColor);
@ -427,6 +429,8 @@ public class K9 extends Application
mMessageListStars = sprefs.getBoolean("messageListStars",true); mMessageListStars = sprefs.getBoolean("messageListStars",true);
mMessageListCheckboxes = sprefs.getBoolean("messageListCheckboxes",false); mMessageListCheckboxes = sprefs.getBoolean("messageListCheckboxes",false);
mMessageListTouchable = sprefs.getBoolean("messageListTouchable",false); mMessageListTouchable = sprefs.getBoolean("messageListTouchable",false);
mMessageListPreviewLines = sprefs.getInt("messageListPreviewLines", 2);
mMobileOptimizedLayout = sprefs.getBoolean("mobileOptimizedLayout", false); mMobileOptimizedLayout = sprefs.getBoolean("mobileOptimizedLayout", false);
mZoomControlsEnabled = sprefs.getBoolean("zoomControlsEnabled",false); mZoomControlsEnabled = sprefs.getBoolean("zoomControlsEnabled",false);
@ -705,6 +709,16 @@ public class K9 extends Application
mMessageListTouchable = touchy; mMessageListTouchable = touchy;
} }
public static int messageListPreviewLines()
{
return mMessageListPreviewLines;
}
public static void setMessageListPreviewLines(int lines)
{
mMessageListPreviewLines = lines;
}
public static boolean messageListStars() public static boolean messageListStars()
{ {
return mMessageListStars; return mMessageListStars;

View File

@ -264,6 +264,8 @@ public class MessageList
private ListView mListView; private ListView mListView;
private boolean mTouchView = true; private boolean mTouchView = true;
private int mPreviewLines = 0;
private MessageListAdapter mAdapter; private MessageListAdapter mAdapter;
@ -659,6 +661,7 @@ public class MessageList
// Only set "touchable" when we're first starting up the activity. // Only set "touchable" when we're first starting up the activity.
// Otherwise we get force closes when the user toggles it midstream. // Otherwise we get force closes when the user toggles it midstream.
mTouchView = K9.messageListTouchable(); mTouchView = K9.messageListTouchable();
mPreviewLines = K9.messageListPreviewLines();
String accountUuid = intent.getStringExtra(EXTRA_ACCOUNT); String accountUuid = intent.getStringExtra(EXTRA_ACCOUNT);
mAccount = Preferences.getPreferences(this).getAccount(accountUuid); mAccount = Preferences.getPreferences(this).getAccount(accountUuid);
@ -2647,6 +2650,7 @@ public class MessageList
if (mTouchView) if (mTouchView)
{ {
holder.preview.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageListSender()); holder.preview.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageListSender());
holder.preview.setLines(mPreviewLines);
} }
else else
{ {

View File

@ -51,6 +51,7 @@ public class Prefs extends K9PreferenceActivity
private static final String PREFERENCE_MEASURE_ACCOUNTS = "measure_accounts"; private static final String PREFERENCE_MEASURE_ACCOUNTS = "measure_accounts";
private static final String PREFERENCE_COUNT_SEARCH = "count_search"; private static final String PREFERENCE_COUNT_SEARCH = "count_search";
private static final String PREFERENCE_MESSAGELIST_TOUCHABLE = "messagelist_touchable"; private static final String PREFERENCE_MESSAGELIST_TOUCHABLE = "messagelist_touchable";
private static final String PREFERENCE_MESSAGELIST_PREVIEW_LINES = "messagelist_preview_lines";
private static final String PREFERENCE_MESSAGELIST_STARS = "messagelist_stars"; private static final String PREFERENCE_MESSAGELIST_STARS = "messagelist_stars";
private static final String PREFERENCE_MESSAGELIST_CHECKBOXES = "messagelist_checkboxes"; private static final String PREFERENCE_MESSAGELIST_CHECKBOXES = "messagelist_checkboxes";
private static final String PREFERENCE_MESSAGELIST_SHOW_CONTACT_NAME = "messagelist_show_contact_name"; private static final String PREFERENCE_MESSAGELIST_SHOW_CONTACT_NAME = "messagelist_show_contact_name";
@ -79,6 +80,7 @@ public class Prefs extends K9PreferenceActivity
private CheckBoxPreference mMeasureAccounts; private CheckBoxPreference mMeasureAccounts;
private CheckBoxPreference mCountSearch; private CheckBoxPreference mCountSearch;
private CheckBoxPreference mTouchable; private CheckBoxPreference mTouchable;
private ListPreference mPreviewLines;
private CheckBoxPreference mStars; private CheckBoxPreference mStars;
private CheckBoxPreference mCheckboxes; private CheckBoxPreference mCheckboxes;
private CheckBoxPreference mShowContactName; private CheckBoxPreference mShowContactName;
@ -180,6 +182,9 @@ public class Prefs extends K9PreferenceActivity
mTouchable = (CheckBoxPreference)findPreference(PREFERENCE_MESSAGELIST_TOUCHABLE); mTouchable = (CheckBoxPreference)findPreference(PREFERENCE_MESSAGELIST_TOUCHABLE);
mTouchable.setChecked(K9.messageListTouchable()); mTouchable.setChecked(K9.messageListTouchable());
mPreviewLines = setupListPreference(PREFERENCE_MESSAGELIST_PREVIEW_LINES,
Integer.toString(K9.messageListPreviewLines()));
mStars = (CheckBoxPreference)findPreference(PREFERENCE_MESSAGELIST_STARS); mStars = (CheckBoxPreference)findPreference(PREFERENCE_MESSAGELIST_STARS);
mStars.setChecked(K9.messageListStars()); mStars.setChecked(K9.messageListStars());
@ -266,6 +271,7 @@ public class Prefs extends K9PreferenceActivity
K9.setMeasureAccounts(mMeasureAccounts.isChecked()); K9.setMeasureAccounts(mMeasureAccounts.isChecked());
K9.setCountSearchMessages(mCountSearch.isChecked()); K9.setCountSearchMessages(mCountSearch.isChecked());
K9.setMessageListTouchable(mTouchable.isChecked()); K9.setMessageListTouchable(mTouchable.isChecked());
K9.setMessageListPreviewLines(Integer.parseInt(mPreviewLines.getValue()));
K9.setMessageListStars(mStars.isChecked()); K9.setMessageListStars(mStars.isChecked());
K9.setMessageListCheckboxes(mCheckboxes.isChecked()); K9.setMessageListCheckboxes(mCheckboxes.isChecked());
K9.setShowContactName(mShowContactName.isChecked()); K9.setShowContactName(mShowContactName.isChecked());