本文整理汇总了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);
}