1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-23 18:02:15 -05:00

Bring back the checkboxes option for messagelist

This commit is contained in:
Jesse Vincent 2012-10-09 18:22:00 -04:00
parent 335c54575e
commit e9ae328164
6 changed files with 60 additions and 4 deletions

View File

@ -23,6 +23,16 @@
android:layout_marginLeft="8dip"
android:layout_marginRight="8dip"
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>
<TextView

View File

@ -109,6 +109,12 @@
android:entryValues="@array/settings_preview_lines_values"
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
android:persistent="false"
android:key="messagelist_show_correspondent_names"

View File

@ -167,6 +167,7 @@ public class K9 extends Application {
NEVER
}
private static boolean mMessageListCheckboxes = false;
private static int mMessageListPreviewLines = 2;
private static boolean mShowCorrespondentNames = true;
@ -440,7 +441,7 @@ public class K9 extends Application {
editor.putBoolean("messageListSenderAboveSubject", mMessageListSenderAboveSubject);
editor.putBoolean("hideSpecialAccounts", mHideSpecialAccounts);
editor.putInt("messageListPreviewLines", mMessageListPreviewLines);
editor.putBoolean("messageListCheckboxes", mMessageListCheckboxes);
editor.putBoolean("showCorrespondentNames", mShowCorrespondentNames);
editor.putBoolean("showContactName", mShowContactName);
editor.putBoolean("changeRegisteredNameColor", mChangeContactNameColor);
@ -590,6 +591,7 @@ public class K9 extends Application {
mCountSearchMessages = sprefs.getBoolean("countSearchMessages", true);
mHideSpecialAccounts = sprefs.getBoolean("hideSpecialAccounts", false);
mMessageListSenderAboveSubject = sprefs.getBoolean("messageListSenderAboveSubject", false);
mMessageListCheckboxes = sprefs.getBoolean("messageListCheckboxes", false);
mMessageListPreviewLines = sprefs.getInt("messageListPreviewLines", 2);
mMobileOptimizedLayout = sprefs.getBoolean("mobileOptimizedLayout", false);
@ -884,6 +886,15 @@ public class K9 extends Application {
mMessageListPreviewLines = lines;
}
public static boolean messageListCheckboxes() {
return mMessageListCheckboxes;
}
public static void setMessageListCheckboxes(boolean checkboxes) {
mMessageListCheckboxes = checkboxes;
}
public static boolean showCorrespondentNames() {
return mShowCorrespondentNames;
}

View File

@ -59,6 +59,7 @@ 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_CHECKBOXES = "messagelist_checkboxes";
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_SHOW_CORRESPONDENT_NAMES = "messagelist_show_correspondent_names";
@ -102,6 +103,7 @@ public class Prefs extends K9PreferenceActivity {
private CheckBoxPreference mHideSpecialAccounts;
private ListPreference mPreviewLines;
private CheckBoxPreference mSenderAboveSubject;
private CheckBoxPreference mCheckboxes;
private CheckBoxPreference mShowCorrespondentNames;
private CheckBoxPreference mShowContactName;
private CheckBoxPreference mChangeContactNameColor;
@ -218,6 +220,9 @@ public class Prefs extends K9PreferenceActivity {
mSenderAboveSubject = (CheckBoxPreference)findPreference(PREFERENCE_MESSAGELIST_SENDER_ABOVE_SUBJECT);
mSenderAboveSubject.setChecked(K9.messageListSenderAboveSubject());
mCheckboxes = (CheckBoxPreference)findPreference(PREFERENCE_MESSAGELIST_CHECKBOXES);
mCheckboxes.setChecked(K9.messageListCheckboxes());
mShowCorrespondentNames = (CheckBoxPreference)findPreference(PREFERENCE_MESSAGELIST_SHOW_CORRESPONDENT_NAMES);
mShowCorrespondentNames.setChecked(K9.showCorrespondentNames());
@ -408,6 +413,7 @@ public class Prefs extends K9PreferenceActivity {
K9.setCountSearchMessages(mCountSearch.isChecked());
K9.setHideSpecialAccounts(mHideSpecialAccounts.isChecked());
K9.setMessageListPreviewLines(Integer.parseInt(mPreviewLines.getValue()));
K9.setMessageListCheckboxes(mCheckboxes.isChecked());
K9.setShowCorrespondentNames(mShowCorrespondentNames.isChecked());
K9.setMessageListSenderAboveSubject(mSenderAboveSubject.isChecked());
K9.setShowContactName(mShowContactName.isChecked());

View File

@ -40,6 +40,7 @@ import android.widget.AdapterView;
import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.BaseAdapter;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.ListView;
@ -359,6 +360,7 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
private boolean mSortAscending = true;
private boolean mSortDateAscending = false;
private boolean mSenderAboveSubject = false;
private boolean mCheckboxes = true;
private int mSelectedCount = 0;
@ -691,6 +693,7 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
mController = MessagingController.getInstance(getActivity().getApplication());
mPreviewLines = K9.messageListPreviewLines();
mCheckboxes = K9.messageListCheckboxes();
decodeArguments();
}
@ -1915,7 +1918,16 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
holder = new MessageViewHolder();
holder.date = (TextView) view.findViewById(R.id.date);
holder.chip = view.findViewById(R.id.chip);
holder.selected = (CheckBox) view.findViewById(R.id.selected_checkbox);
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) {
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
holder.position = -1;
holder.selected.setChecked(false);
if (!mCheckboxes) {
holder.selected.setVisibility(View.GONE);
}
}
@ -2001,13 +2018,15 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
// when a user checks the checkbox (vs code)
holder.position = -1;
if (message.selected) {
holder.selected.setChecked(message.selected);
holder.chip.setBackgroundDrawable(message.message.getFolder().getAccount().getCheckmarkChip().drawable());
if (!mCheckboxes && message.selected) {
holder.chip.setBackgroundDrawable(message.message.getFolder().getAccount().getCheckmarkChip().drawable());
}
else {
holder.chip.setBackgroundDrawable(message.message.getFolder().getAccount().generateColorChip(message.read,message.message.toMe(), message.message.ccMe(), message.message.fromMe(), message.flagged).drawable());
holder.chip.setBackgroundDrawable(message.message.getFolder().getAccount().generateColorChip(message.read,message.message.toMe(), message.message.ccMe(), message.message.fromMe(), message.flagged).drawable());
}
@ -2132,6 +2151,7 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
public TextView time;
public TextView date;
public View chip;
public CheckBox selected;
public int position = -1;
@Override

View File

@ -137,6 +137,9 @@ public class GlobalSettings {
s.put("measureAccounts", Settings.versions(
new V(1, new BooleanSetting(true))
));
s.put("messageListCheckboxes", Settings.versions(
new V(1, new BooleanSetting(false))
));
s.put("messageListPreviewLines", Settings.versions(
new V(1, new IntegerRangeSetting(1, 100, 2))
));