mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-23 18:02:15 -05:00
reimplement the "list widgets on the left?" preference I'd previously complained about as an account preference
This commit is contained in:
parent
6fdf69d45b
commit
cd7de68186
@ -6,14 +6,22 @@
|
||||
android:paddingRight="1dip"
|
||||
android:paddingTop="2dip"
|
||||
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
|
||||
android:id="@+id/chip"
|
||||
android:background="@drawable/appointment_indicator_leftside_1"
|
||||
android:layout_width="4dip"
|
||||
android:layout_height="20dip"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toLeftOf="@id/widgets_left"
|
||||
android:layout_alignParentLeft="true" />
|
||||
<include layout="@layout/message_list_widgets" android:id="@+id/widgets" />
|
||||
<TextView
|
||||
android:id="@+id/date"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
@ -24,7 +32,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="right|bottom"
|
||||
android:layout_alignWithParentIfMissing="true"
|
||||
android:layout_toLeftOf="@+id/widgets" />
|
||||
android:layout_toLeftOf="@+id/widgets_right" />
|
||||
<TextView
|
||||
android:id="@+id/from"
|
||||
android:ellipsize="end"
|
||||
@ -47,6 +55,6 @@
|
||||
android:paddingLeft="10dip"
|
||||
android:layout_marginRight="1dip"
|
||||
android:layout_alignWithParentIfMissing="true"
|
||||
android:layout_toRightOf="@+id/chip"
|
||||
android:layout_toRightOf="@+id/widgets_left"
|
||||
android:layout_toLeftOf="@+id/from" />
|
||||
</RelativeLayout>
|
||||
|
@ -7,13 +7,22 @@
|
||||
android:paddingTop="2dip"
|
||||
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
|
||||
android:id="@+id/chip"
|
||||
android:background="@drawable/appointment_indicator_leftside_1"
|
||||
android:layout_width="4dip"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_toLeftOf="@id/widgets_left"
|
||||
android:layout_centerVertical="true" />
|
||||
<include layout="@layout/message_list_widgets" android:id="@+id/widgets" />
|
||||
<TextView
|
||||
android:id="@+id/subject"
|
||||
android:ellipsize="end"
|
||||
@ -23,8 +32,8 @@
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="10dip"
|
||||
android:layout_toLeftOf="@id/widgets"
|
||||
android:layout_toRightOf="@+id/chip"
|
||||
android:layout_toLeftOf="@id/widgets_right"
|
||||
android:layout_toRightOf="@+id/widgets_left"
|
||||
android:layout_alignWithParentIfMissing="true"
|
||||
android:layout_marginRight="1dip" />
|
||||
<TextView
|
||||
@ -37,7 +46,7 @@
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@id/widgets"
|
||||
android:layout_toLeftOf="@id/widgets_right"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="@android:color/transparent"
|
||||
android:layout_alignWithParentIfMissing="true"
|
||||
@ -53,7 +62,7 @@
|
||||
android:paddingLeft="12dip"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_toLeftOf="@id/date"
|
||||
android:layout_toRightOf="@id/chip"
|
||||
android:layout_toRightOf="@id/widgets_left"
|
||||
/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/widgets"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_width="30dip"
|
||||
android:layout_height="30dip"
|
||||
|
@ -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_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_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_summary">Notify even for mail sent from an account identity</string>
|
||||
|
@ -42,6 +42,11 @@
|
||||
android:dialogTitle="@string/account_settings_mail_display_count_label" />
|
||||
</PreferenceCategory>
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="left_handed"
|
||||
android:title="@string/account_settings_left_handed_label" />
|
||||
|
||||
|
||||
<PreferenceCategory android:title="@string/account_settings_message_view">
|
||||
|
||||
<ListPreference
|
||||
|
@ -59,6 +59,8 @@ public class Account implements Serializable
|
||||
boolean mNotifySync;
|
||||
HideButtons mHideMessageViewButtons;
|
||||
boolean mIsSignatureBeforeQuotedText;
|
||||
boolean mLeftHanded;
|
||||
|
||||
List<Identity> identities;
|
||||
|
||||
public enum FolderMode
|
||||
@ -92,6 +94,7 @@ public class Account implements Serializable
|
||||
mNotifySync = true;
|
||||
mVibrate = false;
|
||||
mNotifySelfNewMail = true;
|
||||
mLeftHanded = false;
|
||||
mFolderDisplayMode = FolderMode.NOT_SECOND_CLASS;
|
||||
mFolderSyncMode = FolderMode.FIRST_CLASS;
|
||||
mFolderPushMode = FolderMode.FIRST_CLASS;
|
||||
@ -171,6 +174,7 @@ public class Account implements Serializable
|
||||
mTransportUri = Utility.base64Decode(preferences.getPreferences().getString(mUuid
|
||||
+ ".transportUri", null));
|
||||
mDescription = preferences.getPreferences().getString(mUuid + ".description", null);
|
||||
mLeftHanded = preferences.getPreferences().getBoolean(mUuid + ".leftHanded", false);
|
||||
mAlwaysBcc = preferences.getPreferences().getString(mUuid + ".alwaysBcc", mAlwaysBcc);
|
||||
mAutomaticCheckIntervalMinutes = preferences.getPreferences().getInt(mUuid
|
||||
+ ".automaticCheckIntervalMinutes", -1);
|
||||
@ -430,6 +434,16 @@ public class Account implements Serializable
|
||||
identities.get(0).setEmail(email);
|
||||
}
|
||||
|
||||
|
||||
public boolean getLeftHanded() {
|
||||
return mLeftHanded;
|
||||
}
|
||||
|
||||
public void setLeftHanded(boolean leftie)
|
||||
{
|
||||
mLeftHanded = leftie;
|
||||
}
|
||||
|
||||
public String getAlwaysBcc()
|
||||
{
|
||||
return mAlwaysBcc;
|
||||
@ -495,6 +509,7 @@ public class Account implements Serializable
|
||||
editor.remove(mUuid + ".name");
|
||||
editor.remove(mUuid + ".email");
|
||||
editor.remove(mUuid + ".alwaysBcc");
|
||||
editor.remove(mUuid + ".mLeftHanded");
|
||||
editor.remove(mUuid + ".automaticCheckIntervalMinutes");
|
||||
editor.remove(mUuid + ".lastAutomaticCheckTime");
|
||||
editor.remove(mUuid + ".notifyNewMail");
|
||||
@ -563,6 +578,7 @@ public class Account implements Serializable
|
||||
editor.putString(mUuid + ".transportUri", Utility.base64Encode(mTransportUri));
|
||||
editor.putString(mUuid + ".description", mDescription);
|
||||
editor.putString(mUuid + ".alwaysBcc", mAlwaysBcc);
|
||||
editor.putBoolean(mUuid + ".leftHanded", mLeftHanded);
|
||||
editor.putInt(mUuid + ".automaticCheckIntervalMinutes", mAutomaticCheckIntervalMinutes);
|
||||
editor.putInt(mUuid + ".displayCount", mDisplayCount);
|
||||
editor.putLong(mUuid + ".lastAutomaticCheckTime", mLastAutomaticCheckTime);
|
||||
|
@ -31,6 +31,7 @@ import android.view.ContextMenu.ContextMenuInfo;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ListView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
@ -148,6 +149,7 @@ public class MessageList
|
||||
|
||||
private boolean mStartup = false;
|
||||
|
||||
private boolean mLeftHanded = false;
|
||||
private int mSelectedCount = 0;
|
||||
|
||||
private View mBatchButtonArea;
|
||||
@ -437,6 +439,8 @@ public class MessageList
|
||||
*/
|
||||
colorChipResId = colorChipResIds[mAccount.getAccountNumber() % colorChipResIds.length];
|
||||
|
||||
mLeftHanded = mAccount.getLeftHanded();
|
||||
|
||||
mAdapter = new MessageListAdapter();
|
||||
|
||||
final Object previousData = getLastNonConfigurationInstance();
|
||||
@ -1753,6 +1757,17 @@ public class MessageList
|
||||
{
|
||||
view = mInflater.inflate(R.layout.message_list_item, parent, false);
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -57,6 +57,8 @@ public class AccountSettings extends K9PreferenceActivity
|
||||
private static final String PREFERENCE_TARGET_MODE = "folder_target_mode";
|
||||
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_LEFT_HANDED = "left_handed";
|
||||
|
||||
|
||||
private Account mAccount;
|
||||
|
||||
@ -77,6 +79,9 @@ public class AccountSettings extends K9PreferenceActivity
|
||||
private ListPreference mDeletePolicy;
|
||||
private Preference mAutoExpandFolder;
|
||||
|
||||
private CheckBoxPreference mLeftHanded;
|
||||
|
||||
|
||||
public static void actionSettings(Context context, Account account)
|
||||
{
|
||||
Intent i = new Intent(context, AccountSettings.class);
|
||||
@ -233,6 +238,10 @@ public class AccountSettings extends K9PreferenceActivity
|
||||
mAccountDefault.setChecked(
|
||||
mAccount.equals(Preferences.getPreferences(this).getDefaultAccount()));
|
||||
|
||||
|
||||
mLeftHanded = (CheckBoxPreference) findPreference(PREFERENCE_LEFT_HANDED);
|
||||
mLeftHanded.setChecked(mAccount.getLeftHanded());
|
||||
|
||||
mAccountHideButtons = (ListPreference) findPreference(PREFERENCE_HIDE_BUTTONS);
|
||||
mAccountHideButtons.setValue("" + mAccount.getHideMessageViewButtons());
|
||||
mAccountHideButtons.setSummary(mAccountHideButtons.getEntry());
|
||||
@ -351,6 +360,7 @@ public class AccountSettings extends K9PreferenceActivity
|
||||
mAccount.setRingtone(prefs.getString(PREFERENCE_RINGTONE, null));
|
||||
mAccount.setHideMessageViewButtons(Account.HideButtons.valueOf(mAccountHideButtons.getValue()));
|
||||
mAccount.setAutoExpandFolderName(reverseTranslateFolder(mAutoExpandFolder.getSummary().toString()));
|
||||
mAccount.setLeftHanded(mLeftHanded.isChecked());
|
||||
mAccount.save(Preferences.getPreferences(this));
|
||||
Email.setServicesEnabled(this);
|
||||
// TODO: refresh folder list here
|
||||
|
Loading…
Reference in New Issue
Block a user