Use the color chip area as click target for the multi-select checkboxes
This commit is contained in:
parent
a485c4c0d1
commit
cb906ee6a4
1 changed files with 6 additions and 19 deletions
|
@ -53,8 +53,6 @@ import android.widget.AdapterView;
|
|||
import android.widget.AdapterView.AdapterContextMenuInfo;
|
||||
import android.widget.AdapterView.OnItemClickListener;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.CompoundButton.OnCheckedChangeListener;
|
||||
import android.widget.ListView;
|
||||
import android.widget.QuickContactBadge;
|
||||
import android.widget.TextView;
|
||||
|
@ -1817,12 +1815,9 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
|
|||
holder.threadCount = (TextView) view.findViewById(R.id.thread_count);
|
||||
|
||||
holder.selected = (CheckBox) view.findViewById(R.id.selected_checkbox);
|
||||
if (mCheckboxes) {
|
||||
holder.selected.setOnCheckedChangeListener(holder);
|
||||
holder.selected.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
holder.selected.setVisibility(View.GONE);
|
||||
}
|
||||
holder.selected.setVisibility((mCheckboxes) ? View.VISIBLE : View.GONE);
|
||||
|
||||
view.findViewById(R.id.chip_wrapper).setOnClickListener(holder);
|
||||
|
||||
view.setTag(holder);
|
||||
|
||||
|
@ -1890,17 +1885,9 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
|
|||
}
|
||||
|
||||
if (mCheckboxes) {
|
||||
// Set holder.position to -1 to avoid MessageViewHolder.onCheckedChanged() toggling
|
||||
// the selection state when setChecked() is called below.
|
||||
holder.position = -1;
|
||||
|
||||
// Only set the UI state, don't actually toggle the message selection.
|
||||
holder.selected.setChecked(selected);
|
||||
|
||||
// Now save the position so MessageViewHolder.onCheckedChanged() will know what
|
||||
// message to (de)select.
|
||||
holder.position = cursor.getPosition();
|
||||
}
|
||||
holder.position = cursor.getPosition();
|
||||
|
||||
if (holder.contactBadge != null) {
|
||||
holder.contactBadge.assignContactFromEmail(counterpartyAddress, true);
|
||||
|
@ -2035,7 +2022,7 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
|
|||
}
|
||||
}
|
||||
|
||||
class MessageViewHolder implements OnCheckedChangeListener {
|
||||
class MessageViewHolder implements View.OnClickListener {
|
||||
public TextView subject;
|
||||
public TextView preview;
|
||||
public TextView from;
|
||||
|
@ -2048,7 +2035,7 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
|
|||
public QuickContactBadge contactBadge;
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
public void onClick(View view) {
|
||||
if (position != -1) {
|
||||
toggleMessageSelectWithAdapterPosition(position);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue