Skip to content

Commit

Permalink
Add helper for getting number of orgs
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinsawicki committed Sep 11, 2012
1 parent 52b6b5f commit 0e4ba6b
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,23 @@ public HomeDropdownListAdapter(final Context context,
setOrgs(orgs);
}

/**
* Get number of orgs
*
* @return org count
*/
private int getOrgCount() {
return getCount() - NON_ORG_ITEMS;
}

/**
* Is the given position an org. selection position?
*
* @param position
* @return true if org., false otherwise
*/
public boolean isOrgPosition(final int position) {
return position < (getCount() - NON_ORG_ITEMS);
return position < getOrgCount();
}

/**
Expand All @@ -95,7 +104,7 @@ public boolean isOrgPosition(final int position) {
* @return action id
*/
public int getAction(final int position) {
return position - (getCount() - NON_ORG_ITEMS);
return position - getOrgCount();
}

/**
Expand Down

0 comments on commit 0e4ba6b

Please sign in to comment.