3535import android .view .TouchDelegate ;
3636import android .view .View ;
3737import android .view .ViewGroup ;
38- import android .widget .CheckBox ;
39- import android .widget .CompoundButton ;
38+ import android .widget .*;
4039import android .widget .CompoundButton .OnCheckedChangeListener ;
41- import android .widget .ListView ;
42- import android .widget .TextView ;
4340import com .actionbarsherlock .app .ActionBar ;
4441import com .actionbarsherlock .app .SherlockListFragment ;
4542import com .actionbarsherlock .view .ActionMode ;
6562 *
6663 */
6764public class TransactionsListFragment extends SherlockListFragment implements
68- Refreshable , LoaderCallbacks <Cursor > {
65+ Refreshable , LoaderCallbacks <Cursor >, AdapterView . OnItemLongClickListener {
6966
7067 /**
7168 * Logging tag
@@ -76,7 +73,6 @@ public class TransactionsListFragment extends SherlockListFragment implements
7673 private SimpleCursorAdapter mCursorAdapter ;
7774 private ActionMode mActionMode = null ;
7875 private boolean mInEditMode = false ;
79- // private long mAccountID;
8076 private String mAccountUID ;
8177
8278 /**
@@ -162,6 +158,7 @@ public void onActivityCreated(Bundle savedInstanceState) {
162158 aBar .setDisplayHomeAsUpEnabled (true );
163159
164160 getListView ().setChoiceMode (ListView .CHOICE_MODE_MULTIPLE );
161+ getListView ().setOnItemLongClickListener (this );
165162 setHasOptionsMenu (true );
166163 }
167164
@@ -223,7 +220,16 @@ public void onListItemClick(ListView l, View v, int position, long id) {
223220 }
224221 mTransactionEditListener .editTransaction (mTransactionsDbAdapter .getUID (id ));
225222 }
226-
223+
224+ @ Override
225+ public boolean onItemLongClick (AdapterView <?> adapterView , View view , int position , long id ) {
226+ getListView ().setItemChecked (position , true );
227+ CheckBox checkbox = (CheckBox ) view .findViewById (R .id .checkbox_parent_account );
228+ checkbox .setChecked (true );
229+ startActionMode ();
230+ return true ;
231+ }
232+
227233 @ Override
228234 public void onCreateOptionsMenu (Menu menu , MenuInflater inflater ) {
229235 inflater .inflate (R .menu .transactions_list_actions , menu );
0 commit comments