diff --git a/res/drawable/checkbox.xml b/res/drawable/checkbox.xml
new file mode 100644
index 000000000..a35336c26
--- /dev/null
+++ b/res/drawable/checkbox.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/res/drawable/checkbox_background.xml b/res/drawable/checkbox_background.xml
new file mode 100644
index 000000000..58db08ba0
--- /dev/null
+++ b/res/drawable/checkbox_background.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/res/drawable/checkbox_label_background.9.png b/res/drawable/checkbox_label_background.9.png
new file mode 100644
index 000000000..e6af4b073
Binary files /dev/null and b/res/drawable/checkbox_label_background.9.png differ
diff --git a/res/drawable/checkbox_off_background.png b/res/drawable/checkbox_off_background.png
new file mode 100644
index 000000000..6b2124f7e
Binary files /dev/null and b/res/drawable/checkbox_off_background.png differ
diff --git a/res/drawable/checkbox_off_background_focus_yellow.png b/res/drawable/checkbox_off_background_focus_yellow.png
new file mode 100644
index 000000000..ffde6f828
Binary files /dev/null and b/res/drawable/checkbox_off_background_focus_yellow.png differ
diff --git a/res/drawable/checkbox_on_background.png b/res/drawable/checkbox_on_background.png
new file mode 100644
index 000000000..56495fc1a
Binary files /dev/null and b/res/drawable/checkbox_on_background.png differ
diff --git a/res/drawable/checkbox_on_background_focus_yellow.png b/res/drawable/checkbox_on_background_focus_yellow.png
new file mode 100644
index 000000000..301800969
Binary files /dev/null and b/res/drawable/checkbox_on_background_focus_yellow.png differ
diff --git a/res/layout/message_list_item.xml b/res/layout/message_list_item.xml
index 8442d93ad..865539fcd 100644
--- a/res/layout/message_list_item.xml
+++ b/res/layout/message_list_item.xml
@@ -13,7 +13,6 @@
android:layout_width="4dip"
android:layout_height="fill_parent"
android:layout_centerVertical="true" />
-
+
+
diff --git a/src/com/android/email/activity/MessageList.java b/src/com/android/email/activity/MessageList.java
index 1c49ab11c..1f2e9e5ec 100644
--- a/src/com/android/email/activity/MessageList.java
+++ b/src/com/android/email/activity/MessageList.java
@@ -4,7 +4,6 @@ import java.text.DateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
-import java.util.Iterator;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -18,7 +17,6 @@ import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Handler;
-import android.os.Process;
import android.util.Config;
import android.util.Log;
import android.view.ContextMenu;
@@ -41,6 +39,9 @@ import android.widget.Toast;
import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.AdapterView.OnItemClickListener;
+import android.widget.CheckBox;
+import android.widget.CompoundButton;
+import android.widget.CompoundButton.OnCheckedChangeListener;
import com.android.email.K9ListActivity;
import com.android.email.Account;
import com.android.email.Email;
@@ -1438,6 +1439,10 @@ public class MessageList extends K9ListActivity {
});
holder.chip.setBackgroundResource(colorChipResId);
+ holder.selected = (CheckBox) view.findViewById(R.id.selected_checkbox);
+ if (holder.selected!=null) {
+ holder.selected.setOnCheckedChangeListener(holder);
+ }
view.setTag(holder);
}
@@ -1477,6 +1482,10 @@ public class MessageList extends K9ListActivity {
null, // top
message.hasAttachments ? mAttachmentIcon : null, // right
null); // bottom
+ holder.position = position;
+ if (holder.selected!=null) {
+ holder.selected.setChecked(message.selected);
+ }
} else {
holder.chip.getBackground().setAlpha(0);
holder.subject.setText("No subject");
@@ -1485,6 +1494,10 @@ public class MessageList extends K9ListActivity {
holder.from.setTypeface(null, Typeface.NORMAL);
holder.date.setText("No date");
holder.from.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null);
+ holder.position = -1;
+ if (holder.selected!=null) {
+ holder.selected.setChecked(false);
+ }
}
return view;
}
@@ -1564,11 +1577,15 @@ public class MessageList extends K9ListActivity {
public FolderInfoHolder folder;
+ public boolean selected;
// Empty constructor for comparison
- public MessageInfoHolder() {}
+ public MessageInfoHolder() {
+ this.selected = false;
+ }
public MessageInfoHolder(Message m, FolderInfoHolder folder) {
+ this();
populate(m, folder);
}
@@ -1686,14 +1703,25 @@ public class MessageList extends K9ListActivity {
}
}
-
- class MessageViewHolder {
+
+ class MessageViewHolder
+ implements OnCheckedChangeListener {
public TextView subject;
public TextView preview;
public TextView from;
public TextView date;
public CheckBox flagged;
public View chip;
+ public CheckBox selected;
+ public int position = -1;
+
+ @Override
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ if (position!=-1) {
+ MessageInfoHolder message = (MessageInfoHolder) mAdapter.getItem(position);
+ message.selected = isChecked;
+ }
+ }
}
class FooterViewHolder {