1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 11:42:16 -05:00

get rid of the non-touchable version of the message list items. (The real difference was the capability to show previews)

This commit is contained in:
Jesse Vincent 2012-09-10 11:51:34 -04:00
parent f9630a3826
commit 8d928d20fa
8 changed files with 70 additions and 204 deletions

View File

@ -1,23 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingRight="1dip"
android:paddingTop="2dip"
android:paddingBottom="3dip"
android:gravity="center_vertical"
android:paddingTop="5dip"
android:paddingBottom="5dip"
android:paddingRight="3dip"
android:background="#ccc" >
<RelativeLayout
android:id="@+id/chip"
android:layout_width="16dip"
android:layout_height="16dip"
android:layout_centerVertical="true"
android:layout_alignTop="@+id/subject"
android:layout_alignParentLeft="true"
android:layout_marginRight="0dip"
android:layout_marginLeft="6dip"
android:layout_marginTop="6dip"
android:layout_marginRight="8dip"
android:layout_marginLeft="8dip"
android:background="@android:color/transparent" >
</RelativeLayout>
@ -25,72 +24,67 @@
<CheckBox
android:id="@+id/selected_checkbox"
android:layout_width="30dip"
android:paddingRight="5dip"
android:paddingLeft="7dip"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_height="fill_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:paddingRight="7dip"
android:paddingLeft="7dip"
android:paddingBottom="6dip"
android:focusable="false"
android:visibility="gone" />
<LinearLayout
android:layout_width="fill_parent"
<TextView
android:id="@+id/date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:paddingLeft="6dip" >
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginRight="3dip"
android:paddingLeft="5dip"
android:singleLine="true"
android:textColor="?android:attr/textColorSecondary"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="@+id/subject"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginRight="1dip"
android:layout_marginBottom="1dip"
android:gravity="center_vertical"
android:singleLine="true"
android:ellipsize="marquee"
android:textColor="?android:attr/textColorPrimary"
android:textAppearance="?android:attr/textAppearanceSmall" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/from"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingLeft="2dip"
android:singleLine="true"
android:ellipsize="end"
android:textColor="?android:attr/textColorSecondary"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="@+id/date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right|bottom"
android:paddingRight="5dip"
android:paddingLeft="5dip"
android:singleLine="true"
android:textColor="?android:attr/textColorSecondary"
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
</LinearLayout>
<CheckBox
android:id="@+id/flagged"
android:layout_height="20dip"
android:layout_width="23dip"
android:layout_marginLeft="3dip"
android:layout_marginRight="7dip"
android:layout_gravity="center_vertical"
android:button="@drawable/star"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:gravity="bottom"
android:layout_marginRight="3dip"
android:layout_below="@+id/date"
android:layout_marginTop="3dip"
style="?android:attr/starStyle"
android:focusable="false" />
</LinearLayout>
<TextView
android:id="@+id/subject"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toLeftOf="@+id/date"
android:layout_toRightOf="@+id/selected_checkbox"
android:layout_marginLeft="1dip"
android:layout_marginRight="1dip"
android:paddingBottom="1dip"
android:singleLine="true"
android:ellipsize="marquee"
android:textColor="?android:attr/textColorPrimary"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="@+id/preview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/subject"
android:layout_toLeftOf="@+id/flagged"
android:layout_toRightOf="@+id/selected_checkbox"
android:layout_marginLeft="1dip"
android:layout_marginRight="0dip"
android:singleLine="false"
android:bufferType="spannable"
android:textColor="?android:attr/textColorPrimary"
android:textAppearance="?android:attr/textAppearanceSmall" />
</RelativeLayout>

View File

@ -1,90 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingTop="5dip"
android:paddingBottom="5dip"
android:paddingRight="3dip"
android:background="#ccc" >
<RelativeLayout
android:id="@+id/chip"
android:layout_width="16dip"
android:layout_height="16dip"
android:layout_alignTop="@+id/subject"
android:layout_alignParentLeft="true"
android:layout_marginTop="6dip"
android:layout_marginRight="8dip"
android:layout_marginLeft="8dip"
android:background="@android:color/transparent" >
</RelativeLayout>
<CheckBox
android:id="@+id/selected_checkbox"
android:layout_width="30dip"
android:layout_height="fill_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:paddingRight="7dip"
android:paddingLeft="7dip"
android:paddingBottom="6dip"
android:focusable="false"
android:visibility="gone" />
<TextView
android:id="@+id/date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginRight="3dip"
android:paddingLeft="5dip"
android:singleLine="true"
android:textColor="?android:attr/textColorSecondary"
android:textAppearance="?android:attr/textAppearanceSmall" />
<CheckBox
android:id="@+id/flagged"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:gravity="bottom"
android:layout_marginRight="3dip"
android:layout_below="@+id/date"
android:layout_marginTop="3dip"
style="?android:attr/starStyle"
android:focusable="false" />
<TextView
android:id="@+id/subject"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toLeftOf="@+id/date"
android:layout_toRightOf="@+id/selected_checkbox"
android:layout_marginLeft="1dip"
android:layout_marginRight="1dip"
android:paddingBottom="1dip"
android:singleLine="true"
android:ellipsize="marquee"
android:textColor="?android:attr/textColorPrimary"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="@+id/preview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/subject"
android:layout_toLeftOf="@+id/flagged"
android:layout_toRightOf="@+id/selected_checkbox"
android:layout_marginLeft="1dip"
android:layout_marginRight="0dip"
android:singleLine="false"
android:bufferType="spannable"
android:textColor="?android:attr/textColorPrimary"
android:textAppearance="?android:attr/textAppearanceSmall" />
</RelativeLayout>

View File

@ -630,6 +630,7 @@
</string-array>
<string-array name="settings_preview_lines_values">
<item>1</item>
<item>2</item>
<item>3</item>
<item>4</item>
@ -638,6 +639,7 @@
</string-array>
<string-array name="settings_preview_lines_entries">
<item>1</item>
<item>2</item>
<item>3</item>
<item>4</item>

View File

@ -108,12 +108,6 @@
android:title="@string/messagelist_preferences"
android:key="messagelist_preferences">
<CheckBoxPreference
android:persistent="false"
android:key="messagelist_touchable"
android:title="@string/global_settings_touchable_label"
android:summary="@string/global_settings_touchable_summary" />
<ListPreference
android:persistent="false"
android:key="messagelist_preview_lines"
@ -121,7 +115,7 @@
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

View File

@ -169,7 +169,6 @@ public class K9 extends Application {
private static boolean mMessageListStars = true;
private static boolean mMessageListCheckboxes = true;
private static boolean mMessageListTouchable = true;
private static int mMessageListPreviewLines = 2;
private static boolean mShowCorrespondentNames = true;
@ -443,7 +442,6 @@ public class K9 extends Application {
editor.putBoolean("hideSpecialAccounts", mHideSpecialAccounts);
editor.putBoolean("messageListStars", mMessageListStars);
editor.putBoolean("messageListCheckboxes", mMessageListCheckboxes);
editor.putBoolean("messageListTouchable", mMessageListTouchable);
editor.putInt("messageListPreviewLines", mMessageListPreviewLines);
editor.putBoolean("showCorrespondentNames", mShowCorrespondentNames);
@ -597,7 +595,6 @@ public class K9 extends Application {
mHideSpecialAccounts = sprefs.getBoolean("hideSpecialAccounts", false);
mMessageListStars = sprefs.getBoolean("messageListStars", true);
mMessageListCheckboxes = sprefs.getBoolean("messageListCheckboxes", true);
mMessageListTouchable = sprefs.getBoolean("messageListTouchable", true);
mMessageListPreviewLines = sprefs.getInt("messageListPreviewLines", 2);
mMobileOptimizedLayout = sprefs.getBoolean("mobileOptimizedLayout", false);
@ -883,14 +880,6 @@ public class K9 extends Application {
mAnimations = animations;
}
public static boolean messageListTouchable() {
return mMessageListTouchable;
}
public static void setMessageListTouchable(boolean touchy) {
mMessageListTouchable = touchy;
}
public static int messageListPreviewLines() {
return mMessageListPreviewLines;
}

View File

@ -255,7 +255,6 @@ public class MessageList extends K9ListActivity implements OnItemClickListener,
private ListView mListView;
private boolean mTouchView = true;
private int mPreviewLines = 0;
@ -694,9 +693,6 @@ public class MessageList extends K9ListActivity implements OnItemClickListener,
initializeActionBar();
initializeLayout();
// Only set "touchable" when we're first starting up the activity.
// Otherwise we get force closes when the user toggles it midstream.
mTouchView = K9.messageListTouchable();
mPreviewLines = K9.messageListPreviewLines();
initializeMessageList(getIntent(), true);
@ -2103,13 +2099,8 @@ public class MessageList extends K9ListActivity implements OnItemClickListener,
if ((convertView != null) && (convertView.getId() == R.layout.message_list_item)) {
view = convertView;
} else {
if (mTouchView) {
view = mInflater.inflate(R.layout.message_list_item_touchable, parent, false);
view.setId(R.layout.message_list_item);
} else {
view = mInflater.inflate(R.layout.message_list_item, parent, false);
view.setId(R.layout.message_list_item);
}
view = mInflater.inflate(R.layout.message_list_item, parent, false);
view.setId(R.layout.message_list_item);
}
MessageViewHolder holder = (MessageViewHolder) view.getTag();
@ -2140,13 +2131,9 @@ public class MessageList extends K9ListActivity implements OnItemClickListener,
holder.subject.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageListSubject());
holder.date.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageListDate());
if (mTouchView) {
holder.preview.setLines(mPreviewLines);
holder.preview.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageListPreview());
holder.preview.setLines(mPreviewLines);
holder.preview.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageListPreview());
} else {
holder.from.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageListSender());
}
view.setTag(holder);
}
@ -2248,8 +2235,6 @@ public class MessageList extends K9ListActivity implements OnItemClickListener,
int senderTypeface = message.read ? Typeface.NORMAL : Typeface.BOLD;
if (holder.preview != null) {
/*
* In the touchable UI, we have previews. Otherwise, we
* have just a "from" line.
* Because text views can't wrap around each other(?) we
* compose a custom view containing the preview and the
* from.

View File

@ -61,7 +61,6 @@ public class Prefs extends K9PreferenceActivity {
private static final String PREFERENCE_MEASURE_ACCOUNTS = "measure_accounts";
private static final String PREFERENCE_COUNT_SEARCH = "count_search";
private static final String PREFERENCE_HIDE_SPECIAL_ACCOUNTS = "hide_special_accounts";
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_CHECKBOXES = "messagelist_checkboxes";
@ -105,7 +104,6 @@ public class Prefs extends K9PreferenceActivity {
private CheckBoxPreference mMeasureAccounts;
private CheckBoxPreference mCountSearch;
private CheckBoxPreference mHideSpecialAccounts;
private CheckBoxPreference mTouchable;
private ListPreference mPreviewLines;
private CheckBoxPreference mStars;
private CheckBoxPreference mCheckboxes;
@ -227,8 +225,6 @@ public class Prefs extends K9PreferenceActivity {
mHideSpecialAccounts = (CheckBoxPreference)findPreference(PREFERENCE_HIDE_SPECIAL_ACCOUNTS);
mHideSpecialAccounts.setChecked(K9.isHideSpecialAccounts());
mTouchable = (CheckBoxPreference)findPreference(PREFERENCE_MESSAGELIST_TOUCHABLE);
mTouchable.setChecked(K9.messageListTouchable());
mPreviewLines = setupListPreference(PREFERENCE_MESSAGELIST_PREVIEW_LINES,
Integer.toString(K9.messageListPreviewLines()));
@ -427,7 +423,6 @@ public class Prefs extends K9PreferenceActivity {
K9.setMeasureAccounts(mMeasureAccounts.isChecked());
K9.setCountSearchMessages(mCountSearch.isChecked());
K9.setHideSpecialAccounts(mHideSpecialAccounts.isChecked());
K9.setMessageListTouchable(mTouchable.isChecked());
K9.setMessageListPreviewLines(Integer.parseInt(mPreviewLines.getValue()));
K9.setMessageListStars(mStars.isChecked());
K9.setMessageListCheckboxes(mCheckboxes.isChecked());

View File

@ -155,9 +155,6 @@ public class GlobalSettings {
s.put("messageListStars", Settings.versions(
new V(1, new BooleanSetting(true))
));
s.put("messageListTouchable", Settings.versions(
new V(1, new BooleanSetting(false))
));
s.put("messageViewFixedWidthFont", Settings.versions(
new V(1, new BooleanSetting(false))
));