Skip to content
This repository has been archived by the owner on Oct 12, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Joseph Cooper committed Feb 17, 2014
1 parent 579452f commit 150e79d
Showing 1 changed file with 34 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,43 +22,44 @@
import com.manuelpeinado.multichoiceadapter.MultiChoiceAdapterHelperBase;

public class MultiChoiceAdapterHelper extends MultiChoiceAdapterHelperBase {
private ActionMode actionMode;
private ActionMode actionMode;

protected MultiChoiceAdapterHelper(BaseAdapter owner) {
super(owner);
}
protected MultiChoiceAdapterHelper(BaseAdapter owner) {
super(owner);
}

@Override
protected void startActionMode() {
if (!(adapterView.getContext() instanceof SherlockActivity)) {
throw new IllegalStateException("List view must belong to a SherlockActivity");
}
if (!(owner instanceof ActionMode.Callback)) {
throw new IllegalStateException("Owner adapter must implement ActionMode.Callback");
}
SherlockActivity activity = (SherlockActivity) adapterView.getContext();
actionMode = activity.startActionMode((ActionMode.Callback)owner);
}
@Override
protected void startActionMode() {
if (!(adapterView.getContext() instanceof SherlockActivity)
&& !(adapterView.getContext() instanceof SherlockFragmentActivity)) {
throw new IllegalStateException("List view must belong to a SherlockActivity");
}
if (!(owner instanceof ActionMode.Callback)) {
throw new IllegalStateException("Owner adapter must implement ActionMode.Callback");
}
SherlockActivity activity = (SherlockActivity) adapterView.getContext();
actionMode = activity.startActionMode((ActionMode.Callback) owner);
}

@Override
protected void finishActionMode() {
if (actionMode != null) {
actionMode.finish();
}
}
@Override
protected void finishActionMode() {
if (actionMode != null) {
actionMode.finish();
}
}

@Override
protected void setActionModeTitle(String title) {
actionMode.setTitle(title);
}
@Override
protected void setActionModeTitle(String title) {
actionMode.setTitle(title);
}

@Override
protected boolean isActionModeStarted() {
return actionMode != null;
}
@Override
protected boolean isActionModeStarted() {
return actionMode != null;
}

@Override
protected void clearActionMode() {
actionMode = null;
}
@Override
protected void clearActionMode() {
actionMode = null;
}
}

0 comments on commit 150e79d

Please sign in to comment.