mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-15 22:15:15 -05:00
Bring back the checkboxes option for messagelist
This commit is contained in:
parent
335c54575e
commit
e9ae328164
@ -23,6 +23,16 @@
|
|||||||
android:layout_marginLeft="8dip"
|
android:layout_marginLeft="8dip"
|
||||||
android:layout_marginRight="8dip"
|
android:layout_marginRight="8dip"
|
||||||
android:background="@android:color/transparent" />
|
android:background="@android:color/transparent" />
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/selected_checkbox"
|
||||||
|
android:layout_width="36dip"
|
||||||
|
android:layout_below="@+id/chip"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:focusable="false"
|
||||||
|
android:gravity="bottom|center"
|
||||||
|
android:visibility="gone" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
@ -109,6 +109,12 @@
|
|||||||
android:entryValues="@array/settings_preview_lines_values"
|
android:entryValues="@array/settings_preview_lines_values"
|
||||||
android:dialogTitle="@string/global_settings_preview_lines_label"
|
android:dialogTitle="@string/global_settings_preview_lines_label"
|
||||||
/>
|
/>
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:persistent="false"
|
||||||
|
android:key="messagelist_checkboxes"
|
||||||
|
android:title="@string/global_settings_checkbox_label"
|
||||||
|
android:summary="@string/global_settings_checkbox_summary" />
|
||||||
|
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:persistent="false"
|
android:persistent="false"
|
||||||
android:key="messagelist_show_correspondent_names"
|
android:key="messagelist_show_correspondent_names"
|
||||||
|
@ -167,6 +167,7 @@ public class K9 extends Application {
|
|||||||
NEVER
|
NEVER
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean mMessageListCheckboxes = false;
|
||||||
private static int mMessageListPreviewLines = 2;
|
private static int mMessageListPreviewLines = 2;
|
||||||
|
|
||||||
private static boolean mShowCorrespondentNames = true;
|
private static boolean mShowCorrespondentNames = true;
|
||||||
@ -440,7 +441,7 @@ public class K9 extends Application {
|
|||||||
editor.putBoolean("messageListSenderAboveSubject", mMessageListSenderAboveSubject);
|
editor.putBoolean("messageListSenderAboveSubject", mMessageListSenderAboveSubject);
|
||||||
editor.putBoolean("hideSpecialAccounts", mHideSpecialAccounts);
|
editor.putBoolean("hideSpecialAccounts", mHideSpecialAccounts);
|
||||||
editor.putInt("messageListPreviewLines", mMessageListPreviewLines);
|
editor.putInt("messageListPreviewLines", mMessageListPreviewLines);
|
||||||
|
editor.putBoolean("messageListCheckboxes", mMessageListCheckboxes);
|
||||||
editor.putBoolean("showCorrespondentNames", mShowCorrespondentNames);
|
editor.putBoolean("showCorrespondentNames", mShowCorrespondentNames);
|
||||||
editor.putBoolean("showContactName", mShowContactName);
|
editor.putBoolean("showContactName", mShowContactName);
|
||||||
editor.putBoolean("changeRegisteredNameColor", mChangeContactNameColor);
|
editor.putBoolean("changeRegisteredNameColor", mChangeContactNameColor);
|
||||||
@ -590,6 +591,7 @@ public class K9 extends Application {
|
|||||||
mCountSearchMessages = sprefs.getBoolean("countSearchMessages", true);
|
mCountSearchMessages = sprefs.getBoolean("countSearchMessages", true);
|
||||||
mHideSpecialAccounts = sprefs.getBoolean("hideSpecialAccounts", false);
|
mHideSpecialAccounts = sprefs.getBoolean("hideSpecialAccounts", false);
|
||||||
mMessageListSenderAboveSubject = sprefs.getBoolean("messageListSenderAboveSubject", false);
|
mMessageListSenderAboveSubject = sprefs.getBoolean("messageListSenderAboveSubject", false);
|
||||||
|
mMessageListCheckboxes = sprefs.getBoolean("messageListCheckboxes", false);
|
||||||
mMessageListPreviewLines = sprefs.getInt("messageListPreviewLines", 2);
|
mMessageListPreviewLines = sprefs.getInt("messageListPreviewLines", 2);
|
||||||
|
|
||||||
mMobileOptimizedLayout = sprefs.getBoolean("mobileOptimizedLayout", false);
|
mMobileOptimizedLayout = sprefs.getBoolean("mobileOptimizedLayout", false);
|
||||||
@ -884,6 +886,15 @@ public class K9 extends Application {
|
|||||||
mMessageListPreviewLines = lines;
|
mMessageListPreviewLines = lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static boolean messageListCheckboxes() {
|
||||||
|
return mMessageListCheckboxes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setMessageListCheckboxes(boolean checkboxes) {
|
||||||
|
mMessageListCheckboxes = checkboxes;
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean showCorrespondentNames() {
|
public static boolean showCorrespondentNames() {
|
||||||
return mShowCorrespondentNames;
|
return mShowCorrespondentNames;
|
||||||
}
|
}
|
||||||
|
@ -59,6 +59,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_HIDE_SPECIAL_ACCOUNTS = "hide_special_accounts";
|
private static final String PREFERENCE_HIDE_SPECIAL_ACCOUNTS = "hide_special_accounts";
|
||||||
|
private static final String PREFERENCE_MESSAGELIST_CHECKBOXES = "messagelist_checkboxes";
|
||||||
private static final String PREFERENCE_MESSAGELIST_PREVIEW_LINES = "messagelist_preview_lines";
|
private static final String PREFERENCE_MESSAGELIST_PREVIEW_LINES = "messagelist_preview_lines";
|
||||||
private static final String PREFERENCE_MESSAGELIST_SENDER_ABOVE_SUBJECT = "messagelist_sender_above_subject";
|
private static final String PREFERENCE_MESSAGELIST_SENDER_ABOVE_SUBJECT = "messagelist_sender_above_subject";
|
||||||
private static final String PREFERENCE_MESSAGELIST_SHOW_CORRESPONDENT_NAMES = "messagelist_show_correspondent_names";
|
private static final String PREFERENCE_MESSAGELIST_SHOW_CORRESPONDENT_NAMES = "messagelist_show_correspondent_names";
|
||||||
@ -102,6 +103,7 @@ public class Prefs extends K9PreferenceActivity {
|
|||||||
private CheckBoxPreference mHideSpecialAccounts;
|
private CheckBoxPreference mHideSpecialAccounts;
|
||||||
private ListPreference mPreviewLines;
|
private ListPreference mPreviewLines;
|
||||||
private CheckBoxPreference mSenderAboveSubject;
|
private CheckBoxPreference mSenderAboveSubject;
|
||||||
|
private CheckBoxPreference mCheckboxes;
|
||||||
private CheckBoxPreference mShowCorrespondentNames;
|
private CheckBoxPreference mShowCorrespondentNames;
|
||||||
private CheckBoxPreference mShowContactName;
|
private CheckBoxPreference mShowContactName;
|
||||||
private CheckBoxPreference mChangeContactNameColor;
|
private CheckBoxPreference mChangeContactNameColor;
|
||||||
@ -218,6 +220,9 @@ public class Prefs extends K9PreferenceActivity {
|
|||||||
|
|
||||||
mSenderAboveSubject = (CheckBoxPreference)findPreference(PREFERENCE_MESSAGELIST_SENDER_ABOVE_SUBJECT);
|
mSenderAboveSubject = (CheckBoxPreference)findPreference(PREFERENCE_MESSAGELIST_SENDER_ABOVE_SUBJECT);
|
||||||
mSenderAboveSubject.setChecked(K9.messageListSenderAboveSubject());
|
mSenderAboveSubject.setChecked(K9.messageListSenderAboveSubject());
|
||||||
|
mCheckboxes = (CheckBoxPreference)findPreference(PREFERENCE_MESSAGELIST_CHECKBOXES);
|
||||||
|
mCheckboxes.setChecked(K9.messageListCheckboxes());
|
||||||
|
|
||||||
|
|
||||||
mShowCorrespondentNames = (CheckBoxPreference)findPreference(PREFERENCE_MESSAGELIST_SHOW_CORRESPONDENT_NAMES);
|
mShowCorrespondentNames = (CheckBoxPreference)findPreference(PREFERENCE_MESSAGELIST_SHOW_CORRESPONDENT_NAMES);
|
||||||
mShowCorrespondentNames.setChecked(K9.showCorrespondentNames());
|
mShowCorrespondentNames.setChecked(K9.showCorrespondentNames());
|
||||||
@ -408,6 +413,7 @@ public class Prefs extends K9PreferenceActivity {
|
|||||||
K9.setCountSearchMessages(mCountSearch.isChecked());
|
K9.setCountSearchMessages(mCountSearch.isChecked());
|
||||||
K9.setHideSpecialAccounts(mHideSpecialAccounts.isChecked());
|
K9.setHideSpecialAccounts(mHideSpecialAccounts.isChecked());
|
||||||
K9.setMessageListPreviewLines(Integer.parseInt(mPreviewLines.getValue()));
|
K9.setMessageListPreviewLines(Integer.parseInt(mPreviewLines.getValue()));
|
||||||
|
K9.setMessageListCheckboxes(mCheckboxes.isChecked());
|
||||||
K9.setShowCorrespondentNames(mShowCorrespondentNames.isChecked());
|
K9.setShowCorrespondentNames(mShowCorrespondentNames.isChecked());
|
||||||
K9.setMessageListSenderAboveSubject(mSenderAboveSubject.isChecked());
|
K9.setMessageListSenderAboveSubject(mSenderAboveSubject.isChecked());
|
||||||
K9.setShowContactName(mShowContactName.isChecked());
|
K9.setShowContactName(mShowContactName.isChecked());
|
||||||
|
@ -40,6 +40,7 @@ import android.widget.AdapterView;
|
|||||||
import android.widget.AdapterView.AdapterContextMenuInfo;
|
import android.widget.AdapterView.AdapterContextMenuInfo;
|
||||||
import android.widget.AdapterView.OnItemClickListener;
|
import android.widget.AdapterView.OnItemClickListener;
|
||||||
import android.widget.BaseAdapter;
|
import android.widget.BaseAdapter;
|
||||||
|
import android.widget.CheckBox;
|
||||||
import android.widget.CompoundButton;
|
import android.widget.CompoundButton;
|
||||||
import android.widget.CompoundButton.OnCheckedChangeListener;
|
import android.widget.CompoundButton.OnCheckedChangeListener;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
@ -359,6 +360,7 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
|
|||||||
private boolean mSortAscending = true;
|
private boolean mSortAscending = true;
|
||||||
private boolean mSortDateAscending = false;
|
private boolean mSortDateAscending = false;
|
||||||
private boolean mSenderAboveSubject = false;
|
private boolean mSenderAboveSubject = false;
|
||||||
|
private boolean mCheckboxes = true;
|
||||||
|
|
||||||
private int mSelectedCount = 0;
|
private int mSelectedCount = 0;
|
||||||
|
|
||||||
@ -691,6 +693,7 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
|
|||||||
mController = MessagingController.getInstance(getActivity().getApplication());
|
mController = MessagingController.getInstance(getActivity().getApplication());
|
||||||
|
|
||||||
mPreviewLines = K9.messageListPreviewLines();
|
mPreviewLines = K9.messageListPreviewLines();
|
||||||
|
mCheckboxes = K9.messageListCheckboxes();
|
||||||
|
|
||||||
decodeArguments();
|
decodeArguments();
|
||||||
}
|
}
|
||||||
@ -1915,7 +1918,16 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
|
|||||||
holder = new MessageViewHolder();
|
holder = new MessageViewHolder();
|
||||||
holder.date = (TextView) view.findViewById(R.id.date);
|
holder.date = (TextView) view.findViewById(R.id.date);
|
||||||
holder.chip = view.findViewById(R.id.chip);
|
holder.chip = view.findViewById(R.id.chip);
|
||||||
|
holder.selected = (CheckBox) view.findViewById(R.id.selected_checkbox);
|
||||||
holder.preview = (TextView) view.findViewById(R.id.preview);
|
holder.preview = (TextView) view.findViewById(R.id.preview);
|
||||||
|
if (mCheckboxes) {
|
||||||
|
holder.selected.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (holder.selected != null) {
|
||||||
|
holder.selected.setOnCheckedChangeListener(holder);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (mSenderAboveSubject) {
|
if (mSenderAboveSubject) {
|
||||||
holder.from = (TextView) view.findViewById(R.id.subject);
|
holder.from = (TextView) view.findViewById(R.id.subject);
|
||||||
@ -1969,6 +1981,11 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
|
|||||||
|
|
||||||
//WARNING: Order of the next 2 lines matter
|
//WARNING: Order of the next 2 lines matter
|
||||||
holder.position = -1;
|
holder.position = -1;
|
||||||
|
holder.selected.setChecked(false);
|
||||||
|
|
||||||
|
if (!mCheckboxes) {
|
||||||
|
holder.selected.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2001,7 +2018,9 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
|
|||||||
// when a user checks the checkbox (vs code)
|
// when a user checks the checkbox (vs code)
|
||||||
holder.position = -1;
|
holder.position = -1;
|
||||||
|
|
||||||
if (message.selected) {
|
holder.selected.setChecked(message.selected);
|
||||||
|
|
||||||
|
if (!mCheckboxes && message.selected) {
|
||||||
|
|
||||||
holder.chip.setBackgroundDrawable(message.message.getFolder().getAccount().getCheckmarkChip().drawable());
|
holder.chip.setBackgroundDrawable(message.message.getFolder().getAccount().getCheckmarkChip().drawable());
|
||||||
}
|
}
|
||||||
@ -2132,6 +2151,7 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
|
|||||||
public TextView time;
|
public TextView time;
|
||||||
public TextView date;
|
public TextView date;
|
||||||
public View chip;
|
public View chip;
|
||||||
|
public CheckBox selected;
|
||||||
public int position = -1;
|
public int position = -1;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -137,6 +137,9 @@ public class GlobalSettings {
|
|||||||
s.put("measureAccounts", Settings.versions(
|
s.put("measureAccounts", Settings.versions(
|
||||||
new V(1, new BooleanSetting(true))
|
new V(1, new BooleanSetting(true))
|
||||||
));
|
));
|
||||||
|
s.put("messageListCheckboxes", Settings.versions(
|
||||||
|
new V(1, new BooleanSetting(false))
|
||||||
|
));
|
||||||
s.put("messageListPreviewLines", Settings.versions(
|
s.put("messageListPreviewLines", Settings.versions(
|
||||||
new V(1, new IntegerRangeSetting(1, 100, 2))
|
new V(1, new IntegerRangeSetting(1, 100, 2))
|
||||||
));
|
));
|
||||||
|
Loading…
Reference in New Issue
Block a user