mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-27 11:42:16 -05:00
replace checkboxes with a variant of the chip.
This commit is contained in:
parent
baf99b114b
commit
158c98b5af
@ -23,15 +23,6 @@
|
||||
android:layout_marginRight="10dip"
|
||||
android:background="@android:color/transparent" />
|
||||
</RelativeLayout>
|
||||
<CheckBox
|
||||
android:id="@+id/selected_checkbox"
|
||||
android:layout_width="36dip"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_height="fill_parent"
|
||||
android:focusable="false"
|
||||
android:gravity="bottom|center"
|
||||
android:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/subject"
|
||||
|
@ -117,12 +117,6 @@
|
||||
android:title="@string/global_settings_flag_label"
|
||||
android:summary="@string/global_settings_flag_summary" />
|
||||
|
||||
<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"
|
||||
|
@ -168,7 +168,6 @@ public class K9 extends Application {
|
||||
}
|
||||
|
||||
private static boolean mMessageListStars = true;
|
||||
private static boolean mMessageListCheckboxes = true;
|
||||
private static int mMessageListPreviewLines = 2;
|
||||
|
||||
private static boolean mShowCorrespondentNames = true;
|
||||
@ -438,7 +437,6 @@ public class K9 extends Application {
|
||||
editor.putBoolean("countSearchMessages", mCountSearchMessages);
|
||||
editor.putBoolean("hideSpecialAccounts", mHideSpecialAccounts);
|
||||
editor.putBoolean("messageListStars", mMessageListStars);
|
||||
editor.putBoolean("messageListCheckboxes", mMessageListCheckboxes);
|
||||
editor.putInt("messageListPreviewLines", mMessageListPreviewLines);
|
||||
|
||||
editor.putBoolean("showCorrespondentNames", mShowCorrespondentNames);
|
||||
@ -589,7 +587,6 @@ public class K9 extends Application {
|
||||
mCountSearchMessages = sprefs.getBoolean("countSearchMessages", true);
|
||||
mHideSpecialAccounts = sprefs.getBoolean("hideSpecialAccounts", false);
|
||||
mMessageListStars = sprefs.getBoolean("messageListStars", true);
|
||||
mMessageListCheckboxes = sprefs.getBoolean("messageListCheckboxes", true);
|
||||
mMessageListPreviewLines = sprefs.getInt("messageListPreviewLines", 2);
|
||||
|
||||
mMobileOptimizedLayout = sprefs.getBoolean("mobileOptimizedLayout", false);
|
||||
@ -890,13 +887,6 @@ public class K9 extends Application {
|
||||
public static void setMessageListStars(boolean stars) {
|
||||
mMessageListStars = stars;
|
||||
}
|
||||
public static boolean messageListCheckboxes() {
|
||||
return mMessageListCheckboxes;
|
||||
}
|
||||
|
||||
public static void setMessageListCheckboxes(boolean checkboxes) {
|
||||
mMessageListCheckboxes = checkboxes;
|
||||
}
|
||||
|
||||
public static boolean showCorrespondentNames() {
|
||||
return mShowCorrespondentNames;
|
||||
|
@ -36,7 +36,6 @@ import android.widget.AdapterView;
|
||||
import android.widget.AdapterView.OnItemClickListener;
|
||||
import android.widget.AdapterView.OnItemLongClickListener;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.CompoundButton.OnCheckedChangeListener;
|
||||
import android.widget.ImageButton;
|
||||
@ -297,7 +296,6 @@ public class MessageList extends K9ListActivity implements OnItemClickListener,
|
||||
private boolean mSortDateAscending = false;
|
||||
|
||||
private boolean mStars = true;
|
||||
private boolean mCheckboxes = true;
|
||||
private int mSelectedCount = 0;
|
||||
|
||||
private FontSizes mFontSizes = K9.getFontSizes();
|
||||
@ -818,7 +816,6 @@ public class MessageList extends K9ListActivity implements OnItemClickListener,
|
||||
StorageManager.getInstance(getApplication()).addListener(mStorageListener);
|
||||
|
||||
mStars = K9.messageListStars();
|
||||
mCheckboxes = K9.messageListCheckboxes();
|
||||
|
||||
// TODO Add support for pull to fresh on searches.
|
||||
if(mQueryString == null) {
|
||||
@ -2122,17 +2119,9 @@ public class MessageList extends K9ListActivity implements OnItemClickListener,
|
||||
holder.date = (TextView) view.findViewById(R.id.date);
|
||||
holder.chip = view.findViewById(R.id.chip);
|
||||
holder.preview = (TextView) view.findViewById(R.id.preview);
|
||||
holder.selected = (CheckBox) view.findViewById(R.id.selected_checkbox);
|
||||
holder.itemMenu = (ImageButton) view.findViewById(R.id.item_menu);
|
||||
holder.itemMenu.setOnClickListener(itemMenuClickListener);
|
||||
|
||||
if (mCheckboxes) {
|
||||
holder.selected.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
if (holder.selected != null) {
|
||||
holder.selected.setOnCheckedChangeListener(holder);
|
||||
}
|
||||
holder.subject.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageListSubject());
|
||||
holder.date.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageListDate());
|
||||
|
||||
@ -2175,11 +2164,6 @@ public class MessageList extends K9ListActivity implements OnItemClickListener,
|
||||
|
||||
//WARNING: Order of the next 2 lines matter
|
||||
holder.position = -1;
|
||||
holder.selected.setChecked(false);
|
||||
|
||||
if (!mCheckboxes) {
|
||||
holder.selected.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2210,15 +2194,17 @@ public class MessageList extends K9ListActivity implements OnItemClickListener,
|
||||
// So that the mSelectedCount is only incremented/decremented
|
||||
// when a user checks the checkbox (vs code)
|
||||
holder.position = -1;
|
||||
holder.selected.setChecked(message.selected);
|
||||
|
||||
if (!mCheckboxes) {
|
||||
holder.selected.setVisibility(message.selected ? View.VISIBLE : View.GONE);
|
||||
|
||||
if (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(), false, message.flagged).drawable());
|
||||
|
||||
}
|
||||
// TODO: Make these colors part of the theme
|
||||
|
||||
// if (K9.getK9Theme() == K9.THEME_LIGHT) {
|
||||
@ -2315,7 +2301,6 @@ public class MessageList extends K9ListActivity implements OnItemClickListener,
|
||||
public TextView time;
|
||||
public TextView date;
|
||||
public View chip;
|
||||
public CheckBox selected;
|
||||
public ImageButton itemMenu;
|
||||
public int position = -1;
|
||||
|
||||
@ -2324,9 +2309,6 @@ public class MessageList extends K9ListActivity implements OnItemClickListener,
|
||||
if (position != -1) {
|
||||
MessageInfoHolder message = (MessageInfoHolder) mAdapter.getItem(position);
|
||||
toggleMessageSelect(message);
|
||||
if (!mCheckboxes) {
|
||||
selected.setVisibility(isChecked ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -102,7 +102,6 @@ public class Prefs extends K9PreferenceActivity {
|
||||
private CheckBoxPreference mHideSpecialAccounts;
|
||||
private ListPreference mPreviewLines;
|
||||
private CheckBoxPreference mStars;
|
||||
private CheckBoxPreference mCheckboxes;
|
||||
private CheckBoxPreference mShowCorrespondentNames;
|
||||
private CheckBoxPreference mShowContactName;
|
||||
private CheckBoxPreference mChangeContactNameColor;
|
||||
@ -219,9 +218,6 @@ public class Prefs extends K9PreferenceActivity {
|
||||
mStars = (CheckBoxPreference)findPreference(PREFERENCE_MESSAGELIST_STARS);
|
||||
mStars.setChecked(K9.messageListStars());
|
||||
|
||||
mCheckboxes = (CheckBoxPreference)findPreference(PREFERENCE_MESSAGELIST_CHECKBOXES);
|
||||
mCheckboxes.setChecked(K9.messageListCheckboxes());
|
||||
|
||||
mShowCorrespondentNames = (CheckBoxPreference)findPreference(PREFERENCE_MESSAGELIST_SHOW_CORRESPONDENT_NAMES);
|
||||
mShowCorrespondentNames.setChecked(K9.showCorrespondentNames());
|
||||
|
||||
@ -409,7 +405,6 @@ public class Prefs extends K9PreferenceActivity {
|
||||
K9.setHideSpecialAccounts(mHideSpecialAccounts.isChecked());
|
||||
K9.setMessageListPreviewLines(Integer.parseInt(mPreviewLines.getValue()));
|
||||
K9.setMessageListStars(mStars.isChecked());
|
||||
K9.setMessageListCheckboxes(mCheckboxes.isChecked());
|
||||
K9.setShowCorrespondentNames(mShowCorrespondentNames.isChecked());
|
||||
K9.setShowContactName(mShowContactName.isChecked());
|
||||
K9.setChangeContactNameColor(mChangeContactNameColor.isChecked());
|
||||
|
@ -137,9 +137,6 @@ 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))
|
||||
));
|
||||
|
Loading…
Reference in New Issue
Block a user