本文整理匯總了Java中org.commcare.suite.model.DetailField.DIRECTION_DESCENDING屬性的典型用法代碼示例。如果您正苦於以下問題:Java DetailField.DIRECTION_DESCENDING屬性的具體用法?Java DetailField.DIRECTION_DESCENDING怎麽用?Java DetailField.DIRECTION_DESCENDING使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.commcare.suite.model.DetailField
的用法示例。
在下文中一共展示了DetailField.DIRECTION_DESCENDING屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: compare
@Override
public int compare(Entity<TreeReference> object1, Entity<TreeReference> object2) {
for (int fieldIndex : fieldIndicesToSortBy) {
boolean reverse = (detailFields[fieldIndex].getSortDirection() == DetailField.DIRECTION_DESCENDING) ^ reverseSort;
int cmp = getCmp(object1, object2, fieldIndex, reverse);
if (cmp != 0) {
return cmp;
}
}
return 0;
}
示例2: getSortOptionsList
private DialogChoiceItem[] getSortOptionsList() {
DetailField[] fields = session.getDetail(selectDatum.getShortDetail()).getFields();
List<String> namesList = new ArrayList<>();
final int[] keyArray = new int[fields.length];
int[] sorts = adapter.getCurrentSort();
int currentSort = sorts.length == 1 ? sorts[0] : -1;
boolean reversed = adapter.isCurrentSortReversed();
int added = 0;
for (int i = 0; i < fields.length; ++i) {
String result = fields[i].getHeader().evaluate();
if (!"".equals(result)) {
String prepend = "";
if (currentSort == -1) {
for (int j = 0; j < sorts.length; ++j) {
if (sorts[j] == i) {
prepend = (j + 1) + " " + (fields[i].getSortDirection() == DetailField.DIRECTION_DESCENDING ? "(v) " : "(^) ");
}
}
} else if (currentSort == i) {
prepend = reversed ^ fields[i].getSortDirection() == DetailField.DIRECTION_DESCENDING ? "(v) " : "(^) ";
}
namesList.add(prepend + result);
keyArray[added] = i;
added++;
}
}
DialogChoiceItem[] choiceItems = new DialogChoiceItem[namesList.size()];
for (int i = 0; i < namesList.size(); i++) {
final int index = i;
View.OnClickListener listener = new View.OnClickListener() {
@Override
public void onClick(View v) {
adapter.sortEntities(new int[]{keyArray[index]});
adapter.filterByString(entitySelectSearchUI.getSearchText().toString());
dismissAlertDialog();
}
};
DialogChoiceItem item = new DialogChoiceItem(namesList.get(i), -1, listener);
choiceItems[i] = item;
}
return choiceItems;
}
示例3: isSortAscending
/**
* Returns the orientation that the specified field should be sorted in
*
* @param fieldKey The key to be sorted
* @return true if the field should be sorted in ascending order. False otherwise
*/
public boolean isSortAscending(int index) {
return !(shortDetail.getFields()[index].getSortDirection() == DetailField.DIRECTION_DESCENDING);
}