TemplateDetailsItem.Header header = item.asHeaderItem();
Logger.debug(D_TEMPLATE_UI, "Binding to header " + header);
+ String groupNoText = b.getRoot()
+ .getResources()
+ .getString(R.string.template_item_match_group_source);
+
b.templateName.setText(header.getName());
b.pattern.setText(header.getPattern());
b.testText.setText(header.getTestText());
else {
b.templateDetailsDateYearLayout.setVisibility(View.GONE);
b.templateDetailsYearSource.setText(
- String.format(Locale.US, "Group %d (%s)", header.getDateYearMatchGroup(),
+ String.format(Locale.US, groupNoText, header.getDateYearMatchGroup(),
getMatchGroupText(header.getDateYearMatchGroup())));
}
- b.templateDetailsYearSourceLabel.setOnClickListener(v -> selectHeaderDetailSource(v, HeaderDetail.DATE_YEAR));
- b.templateDetailsYearSource.setOnClickListener(v -> selectHeaderDetailSource(v,
- HeaderDetail.DATE_YEAR));
+ b.templateDetailsYearSourceLabel.setOnClickListener(
+ v -> selectHeaderDetailSource(v, HeaderDetail.DATE_YEAR));
+ b.templateDetailsYearSource.setOnClickListener(
+ v -> selectHeaderDetailSource(v, HeaderDetail.DATE_YEAR));
if (header.hasLiteralDateMonth()) {
b.templateDetailsMonthSource.setText(R.string.template_details_source_literal);
else {
b.templateDetailsDateMonthLayout.setVisibility(View.GONE);
b.templateDetailsMonthSource.setText(
- String.format(Locale.US, "Group %d (%s)", header.getDateMonthMatchGroup(),
+ String.format(Locale.US, groupNoText, header.getDateMonthMatchGroup(),
getMatchGroupText(header.getDateMonthMatchGroup())));
}
b.templateDetailsMonthSourceLabel.setOnClickListener(v -> selectHeaderDetailSource(v,
else {
b.templateDetailsDateDayLayout.setVisibility(View.GONE);
b.templateDetailsDaySource.setText(
- String.format(Locale.US, "Group %d (%s)", header.getDateDayMatchGroup(),
+ String.format(Locale.US, groupNoText, header.getDateDayMatchGroup(),
getMatchGroupText(header.getDateDayMatchGroup())));
}
b.templateDetailsDaySourceLabel.setOnClickListener(v -> selectHeaderDetailSource(v, HeaderDetail.DATE_DAY));
}
else {
b.transactionDescriptionLayout.setVisibility(View.GONE);
- b.templateTransactionDescriptionSource.setText(
- String.format(Locale.US, "Group %d (%s)",
- header.getTransactionDescriptionMatchGroup(), getMatchGroupText(header.getTransactionDescriptionMatchGroup())));
+ b.templateTransactionDescriptionSource.setText(String.format(Locale.US, groupNoText,
+ header.getTransactionDescriptionMatchGroup(),
+ getMatchGroupText(header.getTransactionDescriptionMatchGroup())));
}
b.templateTransactionDescriptionSourceLabel.setOnClickListener(v -> selectHeaderDetailSource(v, HeaderDetail.DESCRIPTION));
}
else {
b.transactionCommentLayout.setVisibility(View.GONE);
- b.templateTransactionCommentSource.setText(String.format(Locale.US, "Group %d (%s)",
+ b.templateTransactionCommentSource.setText(String.format(Locale.US, groupNoText,
header.getTransactionCommentMatchGroup(),
getMatchGroupText(header.getTransactionCommentMatchGroup())));
}
@Override
void bind(TemplateDetailsItem item) {
+ String groupNoText = b.getRoot()
+ .getResources()
+ .getString(R.string.template_item_match_group_source);
+
TemplateDetailsItem.AccountRow accRow = item.asAccountRowItem();
if (accRow.hasLiteralAccountName()) {
b.templateDetailsAccountNameLayout.setVisibility(View.VISIBLE);
else {
b.templateDetailsAccountNameLayout.setVisibility(View.GONE);
b.templateDetailsAccountNameSource.setText(
- String.format(Locale.US, "Group %d (%s)", accRow.getAccountNameMatchGroup(),
+ String.format(Locale.US, groupNoText, accRow.getAccountNameMatchGroup(),
getMatchGroupText(accRow.getAccountNameMatchGroup())));
}
else {
b.templateDetailsAccountCommentLayout.setVisibility(View.GONE);
b.templateDetailsAccountCommentSource.setText(
- String.format(Locale.US, "Group %d (%s)",
- accRow.getAccountCommentMatchGroup(),
+ String.format(Locale.US, groupNoText, accRow.getAccountCommentMatchGroup(),
getMatchGroupText(accRow.getAccountCommentMatchGroup())));
}
}
else {
b.templateDetailsAccountAmountSource.setText(
- String.format(Locale.US, "Group %d (%s)", accRow.getAmountMatchGroup(),
+ String.format(Locale.US, groupNoText, accRow.getAmountMatchGroup(),
getMatchGroupText(accRow.getAmountMatchGroup())));
b.templateDetailsAccountAmountLayout.setVisibility(View.GONE);
b.negateAmountSwitch.setVisibility(View.VISIBLE);