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

reimplement the "list widgets on the left?" preference I'd previously complained about as an account preference

This commit is contained in:
Jesse Vincent 2009-12-08 07:08:05 +00:00
parent 6fdf69d45b
commit cd7de68186
8 changed files with 74 additions and 9 deletions

View File

@ -6,14 +6,22 @@
android:paddingRight="1dip" android:paddingRight="1dip"
android:paddingTop="2dip" android:paddingTop="2dip"
android:background="@drawable/message_list_item_background"> android:background="@drawable/message_list_item_background">
<LinearLayout android:id="@+id/widgets_right"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_alignParentRight="true"
/>
<LinearLayout android:id="@+id/widgets_left"
android:layout_width="wrap_content"
android:layout_height="fill_parent" />
<View <View
android:id="@+id/chip" android:id="@+id/chip"
android:background="@drawable/appointment_indicator_leftside_1" android:background="@drawable/appointment_indicator_leftside_1"
android:layout_width="4dip" android:layout_width="4dip"
android:layout_height="20dip" android:layout_height="20dip"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_toLeftOf="@id/widgets_left"
android:layout_alignParentLeft="true" /> android:layout_alignParentLeft="true" />
<include layout="@layout/message_list_widgets" android:id="@+id/widgets" />
<TextView <TextView
android:id="@+id/date" android:id="@+id/date"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
@ -24,7 +32,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="right|bottom" android:gravity="right|bottom"
android:layout_alignWithParentIfMissing="true" android:layout_alignWithParentIfMissing="true"
android:layout_toLeftOf="@+id/widgets" /> android:layout_toLeftOf="@+id/widgets_right" />
<TextView <TextView
android:id="@+id/from" android:id="@+id/from"
android:ellipsize="end" android:ellipsize="end"
@ -47,6 +55,6 @@
android:paddingLeft="10dip" android:paddingLeft="10dip"
android:layout_marginRight="1dip" android:layout_marginRight="1dip"
android:layout_alignWithParentIfMissing="true" android:layout_alignWithParentIfMissing="true"
android:layout_toRightOf="@+id/chip" android:layout_toRightOf="@+id/widgets_left"
android:layout_toLeftOf="@+id/from" /> android:layout_toLeftOf="@+id/from" />
</RelativeLayout> </RelativeLayout>

View File

@ -7,13 +7,22 @@
android:paddingTop="2dip" android:paddingTop="2dip"
android:background="#999999" android:background="#999999"
> >
<LinearLayout android:id="@+id/widgets_right"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_alignParentRight="true"
/>
<LinearLayout android:id="@+id/widgets_left"
android:layout_width="wrap_content"
android:layout_height="fill_parent" />
<View <View
android:id="@+id/chip" android:id="@+id/chip"
android:background="@drawable/appointment_indicator_leftside_1" android:background="@drawable/appointment_indicator_leftside_1"
android:layout_width="4dip" android:layout_width="4dip"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="@id/widgets_left"
android:layout_centerVertical="true" /> android:layout_centerVertical="true" />
<include layout="@layout/message_list_widgets" android:id="@+id/widgets" />
<TextView <TextView
android:id="@+id/subject" android:id="@+id/subject"
android:ellipsize="end" android:ellipsize="end"
@ -23,8 +32,8 @@
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="10dip" android:paddingLeft="10dip"
android:layout_toLeftOf="@id/widgets" android:layout_toLeftOf="@id/widgets_right"
android:layout_toRightOf="@+id/chip" android:layout_toRightOf="@+id/widgets_left"
android:layout_alignWithParentIfMissing="true" android:layout_alignWithParentIfMissing="true"
android:layout_marginRight="1dip" /> android:layout_marginRight="1dip" />
<TextView <TextView
@ -37,7 +46,7 @@
android:textColor="?android:attr/textColorSecondary" android:textColor="?android:attr/textColorSecondary"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_toLeftOf="@id/widgets" android:layout_toLeftOf="@id/widgets_right"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:background="@android:color/transparent" android:background="@android:color/transparent"
android:layout_alignWithParentIfMissing="true" android:layout_alignWithParentIfMissing="true"
@ -53,7 +62,7 @@
android:paddingLeft="12dip" android:paddingLeft="12dip"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_toLeftOf="@id/date" android:layout_toLeftOf="@id/date"
android:layout_toRightOf="@id/chip" android:layout_toRightOf="@id/widgets_left"
/> />
</RelativeLayout> </RelativeLayout>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout <LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/widgets"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_width="30dip" android:layout_width="30dip"
android:layout_height="30dip" android:layout_height="30dip"

View File

@ -383,6 +383,7 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin
<string name="account_settings_notify_summary">Notify in status bar when mail arrives</string> <string name="account_settings_notify_summary">Notify in status bar when mail arrives</string>
<string name="account_settings_notify_sync_summary">Notify in status bar while mail is checked</string> <string name="account_settings_notify_sync_summary">Notify in status bar while mail 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_left_handed_label">Show list widgets on the left</string>
<string name="account_settings_notify_self_label">Notify for mail I sent</string> <string name="account_settings_notify_self_label">Notify for mail I sent</string>
<string name="account_settings_notify_self_summary">Notify even for mail sent from an account identity</string> <string name="account_settings_notify_self_summary">Notify even for mail sent from an account identity</string>

View File

@ -42,6 +42,11 @@
android:dialogTitle="@string/account_settings_mail_display_count_label" /> android:dialogTitle="@string/account_settings_mail_display_count_label" />
</PreferenceCategory> </PreferenceCategory>
<CheckBoxPreference
android:key="left_handed"
android:title="@string/account_settings_left_handed_label" />
<PreferenceCategory android:title="@string/account_settings_message_view"> <PreferenceCategory android:title="@string/account_settings_message_view">
<ListPreference <ListPreference

View File

@ -59,6 +59,8 @@ public class Account implements Serializable
boolean mNotifySync; boolean mNotifySync;
HideButtons mHideMessageViewButtons; HideButtons mHideMessageViewButtons;
boolean mIsSignatureBeforeQuotedText; boolean mIsSignatureBeforeQuotedText;
boolean mLeftHanded;
List<Identity> identities; List<Identity> identities;
public enum FolderMode public enum FolderMode
@ -92,6 +94,7 @@ public class Account implements Serializable
mNotifySync = true; mNotifySync = true;
mVibrate = false; mVibrate = false;
mNotifySelfNewMail = true; mNotifySelfNewMail = true;
mLeftHanded = false;
mFolderDisplayMode = FolderMode.NOT_SECOND_CLASS; mFolderDisplayMode = FolderMode.NOT_SECOND_CLASS;
mFolderSyncMode = FolderMode.FIRST_CLASS; mFolderSyncMode = FolderMode.FIRST_CLASS;
mFolderPushMode = FolderMode.FIRST_CLASS; mFolderPushMode = FolderMode.FIRST_CLASS;
@ -171,6 +174,7 @@ public class Account implements Serializable
mTransportUri = Utility.base64Decode(preferences.getPreferences().getString(mUuid mTransportUri = Utility.base64Decode(preferences.getPreferences().getString(mUuid
+ ".transportUri", null)); + ".transportUri", null));
mDescription = preferences.getPreferences().getString(mUuid + ".description", null); mDescription = preferences.getPreferences().getString(mUuid + ".description", null);
mLeftHanded = preferences.getPreferences().getBoolean(mUuid + ".leftHanded", false);
mAlwaysBcc = preferences.getPreferences().getString(mUuid + ".alwaysBcc", mAlwaysBcc); mAlwaysBcc = preferences.getPreferences().getString(mUuid + ".alwaysBcc", mAlwaysBcc);
mAutomaticCheckIntervalMinutes = preferences.getPreferences().getInt(mUuid mAutomaticCheckIntervalMinutes = preferences.getPreferences().getInt(mUuid
+ ".automaticCheckIntervalMinutes", -1); + ".automaticCheckIntervalMinutes", -1);
@ -430,6 +434,16 @@ public class Account implements Serializable
identities.get(0).setEmail(email); identities.get(0).setEmail(email);
} }
public boolean getLeftHanded() {
return mLeftHanded;
}
public void setLeftHanded(boolean leftie)
{
mLeftHanded = leftie;
}
public String getAlwaysBcc() public String getAlwaysBcc()
{ {
return mAlwaysBcc; return mAlwaysBcc;
@ -495,6 +509,7 @@ public class Account implements Serializable
editor.remove(mUuid + ".name"); editor.remove(mUuid + ".name");
editor.remove(mUuid + ".email"); editor.remove(mUuid + ".email");
editor.remove(mUuid + ".alwaysBcc"); editor.remove(mUuid + ".alwaysBcc");
editor.remove(mUuid + ".mLeftHanded");
editor.remove(mUuid + ".automaticCheckIntervalMinutes"); editor.remove(mUuid + ".automaticCheckIntervalMinutes");
editor.remove(mUuid + ".lastAutomaticCheckTime"); editor.remove(mUuid + ".lastAutomaticCheckTime");
editor.remove(mUuid + ".notifyNewMail"); editor.remove(mUuid + ".notifyNewMail");
@ -563,6 +578,7 @@ public class Account implements Serializable
editor.putString(mUuid + ".transportUri", Utility.base64Encode(mTransportUri)); editor.putString(mUuid + ".transportUri", Utility.base64Encode(mTransportUri));
editor.putString(mUuid + ".description", mDescription); editor.putString(mUuid + ".description", mDescription);
editor.putString(mUuid + ".alwaysBcc", mAlwaysBcc); editor.putString(mUuid + ".alwaysBcc", mAlwaysBcc);
editor.putBoolean(mUuid + ".leftHanded", mLeftHanded);
editor.putInt(mUuid + ".automaticCheckIntervalMinutes", mAutomaticCheckIntervalMinutes); editor.putInt(mUuid + ".automaticCheckIntervalMinutes", mAutomaticCheckIntervalMinutes);
editor.putInt(mUuid + ".displayCount", mDisplayCount); editor.putInt(mUuid + ".displayCount", mDisplayCount);
editor.putLong(mUuid + ".lastAutomaticCheckTime", mLastAutomaticCheckTime); editor.putLong(mUuid + ".lastAutomaticCheckTime", mLastAutomaticCheckTime);

View File

@ -31,6 +31,7 @@ import android.view.ContextMenu.ContextMenuInfo;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.BaseAdapter; import android.widget.BaseAdapter;
import android.widget.ListView; import android.widget.ListView;
import android.widget.LinearLayout;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
@ -148,6 +149,7 @@ public class MessageList
private boolean mStartup = false; private boolean mStartup = false;
private boolean mLeftHanded = false;
private int mSelectedCount = 0; private int mSelectedCount = 0;
private View mBatchButtonArea; private View mBatchButtonArea;
@ -437,6 +439,8 @@ public class MessageList
*/ */
colorChipResId = colorChipResIds[mAccount.getAccountNumber() % colorChipResIds.length]; colorChipResId = colorChipResIds[mAccount.getAccountNumber() % colorChipResIds.length];
mLeftHanded = mAccount.getLeftHanded();
mAdapter = new MessageListAdapter(); mAdapter = new MessageListAdapter();
final Object previousData = getLastNonConfigurationInstance(); final Object previousData = getLastNonConfigurationInstance();
@ -1753,6 +1757,17 @@ public class MessageList
{ {
view = mInflater.inflate(R.layout.message_list_item, parent, false); view = mInflater.inflate(R.layout.message_list_item, parent, false);
view.setId(R.layout.message_list_item); view.setId(R.layout.message_list_item);
View widgetParent;
if (mLeftHanded == false )
{
widgetParent = view.findViewById(R.id.widgets_right);
}
else {
widgetParent = view.findViewById(R.id.widgets_left);
}
View widgets = mInflater.inflate(R.layout.message_list_widgets,parent,false);
widgets.setId(R.id.widgets);
((LinearLayout) widgetParent).addView(widgets);
} }

View File

@ -57,6 +57,8 @@ public class AccountSettings extends K9PreferenceActivity
private static final String PREFERENCE_TARGET_MODE = "folder_target_mode"; private static final String PREFERENCE_TARGET_MODE = "folder_target_mode";
private static final String PREFERENCE_DELETE_POLICY = "delete_policy"; private static final String PREFERENCE_DELETE_POLICY = "delete_policy";
private static final String PREFERENCE_AUTO_EXPAND_FOLDER = "account_setup_auto_expand_folder"; private static final String PREFERENCE_AUTO_EXPAND_FOLDER = "account_setup_auto_expand_folder";
private static final String PREFERENCE_LEFT_HANDED = "left_handed";
private Account mAccount; private Account mAccount;
@ -77,6 +79,9 @@ public class AccountSettings extends K9PreferenceActivity
private ListPreference mDeletePolicy; private ListPreference mDeletePolicy;
private Preference mAutoExpandFolder; private Preference mAutoExpandFolder;
private CheckBoxPreference mLeftHanded;
public static void actionSettings(Context context, Account account) public static void actionSettings(Context context, Account account)
{ {
Intent i = new Intent(context, AccountSettings.class); Intent i = new Intent(context, AccountSettings.class);
@ -233,6 +238,10 @@ public class AccountSettings extends K9PreferenceActivity
mAccountDefault.setChecked( mAccountDefault.setChecked(
mAccount.equals(Preferences.getPreferences(this).getDefaultAccount())); mAccount.equals(Preferences.getPreferences(this).getDefaultAccount()));
mLeftHanded = (CheckBoxPreference) findPreference(PREFERENCE_LEFT_HANDED);
mLeftHanded.setChecked(mAccount.getLeftHanded());
mAccountHideButtons = (ListPreference) findPreference(PREFERENCE_HIDE_BUTTONS); mAccountHideButtons = (ListPreference) findPreference(PREFERENCE_HIDE_BUTTONS);
mAccountHideButtons.setValue("" + mAccount.getHideMessageViewButtons()); mAccountHideButtons.setValue("" + mAccount.getHideMessageViewButtons());
mAccountHideButtons.setSummary(mAccountHideButtons.getEntry()); mAccountHideButtons.setSummary(mAccountHideButtons.getEntry());
@ -351,6 +360,7 @@ public class AccountSettings extends K9PreferenceActivity
mAccount.setRingtone(prefs.getString(PREFERENCE_RINGTONE, null)); mAccount.setRingtone(prefs.getString(PREFERENCE_RINGTONE, null));
mAccount.setHideMessageViewButtons(Account.HideButtons.valueOf(mAccountHideButtons.getValue())); mAccount.setHideMessageViewButtons(Account.HideButtons.valueOf(mAccountHideButtons.getValue()));
mAccount.setAutoExpandFolderName(reverseTranslateFolder(mAutoExpandFolder.getSummary().toString())); mAccount.setAutoExpandFolderName(reverseTranslateFolder(mAutoExpandFolder.getSummary().toString()));
mAccount.setLeftHanded(mLeftHanded.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