本文整理汇总了Java中de.codecrafters.tableview.toolkit.SimpleTableHeaderAdapter类的典型用法代码示例。如果您正苦于以下问题:Java SimpleTableHeaderAdapter类的具体用法?Java SimpleTableHeaderAdapter怎么用?Java SimpleTableHeaderAdapter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SimpleTableHeaderAdapter类属于de.codecrafters.tableview.toolkit包,在下文中一共展示了SimpleTableHeaderAdapter类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SortableCarTableView
import de.codecrafters.tableview.toolkit.SimpleTableHeaderAdapter; //导入依赖的package包/类
public SortableCarTableView(final Context context, final AttributeSet attributes, final int styleAttributes) {
super(context, attributes, styleAttributes);
final SimpleTableHeaderAdapter simpleTableHeaderAdapter = new SimpleTableHeaderAdapter(context, R.string.brand, R.string.model, R.string.power, R.string.price);
simpleTableHeaderAdapter.setTextColor(ContextCompat.getColor(context, R.color.table_header_text));
setHeaderAdapter(simpleTableHeaderAdapter);
final int rowColorEven = ContextCompat.getColor(context, R.color.table_data_row_even);
final int rowColorOdd = ContextCompat.getColor(context, R.color.table_data_row_odd);
setDataRowBackgroundProvider(TableDataRowBackgroundProviders.alternatingRowColors(rowColorEven, rowColorOdd));
setHeaderSortStateViewProvider(SortStateViewProviders.brightArrows());
final TableColumnWeightModel tableColumnWeightModel = new TableColumnWeightModel(4);
tableColumnWeightModel.setColumnWeight(0, 2);
tableColumnWeightModel.setColumnWeight(1, 3);
tableColumnWeightModel.setColumnWeight(2, 3);
tableColumnWeightModel.setColumnWeight(3, 2);
setColumnModel(tableColumnWeightModel);
setColumnComparator(0, CarComparators.getCarProducerComparator());
setColumnComparator(1, CarComparators.getCarNameComparator());
setColumnComparator(2, CarComparators.getCarPowerComparator());
setColumnComparator(3, CarComparators.getCarPriceComparator());
}
示例2: updateSortTable
import de.codecrafters.tableview.toolkit.SimpleTableHeaderAdapter; //导入依赖的package包/类
/**
* Updating the sort strategy
*/
private void updateSortTable() {
SimpleTableHeaderAdapter simpleTableHeaderAdapter = new SimpleTableHeaderAdapter(getContext(), getContext().getString(R.string.date), getContext().getString(R.string.all), getContext().getString(R.string.to_from), getContext().getString(R.string.amount));
simpleTableHeaderAdapter.setPaddingLeft(getResources().getDimensionPixelSize(R.dimen.transactionsheaderpading));
transfersView.setHeaderAdapter(simpleTableHeaderAdapter);
transfersView.setHeaderSortStateViewProvider(SortStateViewProviders.darkArrows());
transfersView.setColumnWeight(0, 20);
transfersView.setColumnWeight(1, 12);
transfersView.setColumnWeight(2, 27);
transfersView.setColumnWeight(3, 22);
transfersView.setColumnComparator(0, new TransferDateComparator());
transfersView.setColumnComparator(1, new TransferSendReceiveComparator(new UserAccount(accountId)));
transfersView.setColumnComparator(3, new TransferAmountComparator());
}