Permalink
Browse files

Add helper for getting number of orgs

  • Loading branch information...
1 parent 52b6b5f commit 0e4ba6b95e3f5680cae6a10611c288ce6879dabc @kevinsawicki kevinsawicki committed Sep 11, 2012
Showing with 11 additions and 2 deletions.
  1. +11 −2 app/src/main/java/com/github/mobile/ui/user/HomeDropdownListAdapter.java
@@ -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();
}
/**
@@ -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();
}
/**

0 comments on commit 0e4ba6b

Please sign in to comment.