Skip to content

Commit 0e4ba6b

Browse files
committed
Add helper for getting number of orgs
1 parent 52b6b5f commit 0e4ba6b

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

app/src/main/java/com/github/mobile/ui/user/HomeDropdownListAdapter.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,23 @@ public HomeDropdownListAdapter(final Context context,
7878
setOrgs(orgs);
7979
}
8080

81+
/**
82+
* Get number of orgs
83+
*
84+
* @return org count
85+
*/
86+
private int getOrgCount() {
87+
return getCount() - NON_ORG_ITEMS;
88+
}
89+
8190
/**
8291
* Is the given position an org. selection position?
8392
*
8493
* @param position
8594
* @return true if org., false otherwise
8695
*/
8796
public boolean isOrgPosition(final int position) {
88-
return position < (getCount() - NON_ORG_ITEMS);
97+
return position < getOrgCount();
8998
}
9099

91100
/**
@@ -95,7 +104,7 @@ public boolean isOrgPosition(final int position) {
95104
* @return action id
96105
*/
97106
public int getAction(final int position) {
98-
return position - (getCount() - NON_ORG_ITEMS);
107+
return position - getOrgCount();
99108
}
100109

101110
/**

0 commit comments

Comments
 (0)