Skip to content
This repository was archived by the owner on Oct 9, 2020. It is now read-only.

Commit 92e6338

Browse files
committed
refactor changes
1 parent d6ecf50 commit 92e6338

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

android/app/src/main/java/org/fossasia/openevent/core/discount/DiscountViewHolder.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,25 +57,24 @@ public void bindDiscountCode(DiscountCode discountCode) {
5757
int maxQuantity = discountCode.getMax_quantity();
5858
float value = discountCode.getValue();
5959

60-
setStringField(discountCodeTextView, code, "");
61-
setStringField(discountCodeValue, "Value : "+value, "");
62-
setStringField(discountMinQuantity, "Minimum Quantity : "+minQuantity, "");
63-
setStringField(discountMaxQuantity, "Maximum Quantity :"+maxQuantity, "");
64-
setStringField(discountTicket, tickets, "Tickets : ");
65-
setStringField(discountUsedFor, usedFor, "Used For : ");
66-
setStringField(this.discountUrl, discountUrl, "Discount URL : ");
60+
setStringFieldWithPrefix(discountCodeTextView, code, "");
61+
setStringFieldWithPrefix(discountCodeValue, "Value : "+value, "");
62+
setStringFieldWithPrefix(discountMinQuantity, "Minimum Quantity : "+minQuantity, "");
63+
setStringFieldWithPrefix(discountMaxQuantity, "Maximum Quantity :"+maxQuantity, "");
64+
setStringFieldWithPrefix(discountTicket, tickets, "Tickets : ");
65+
setStringFieldWithPrefix(discountUsedFor, usedFor, "Used For : ");
66+
setStringFieldWithPrefix(this.discountUrl, discountUrl, "Discount URL : ");
6767

6868
}
6969

7070

71-
private void setStringField(TextView textView, String field, String prefix) {
71+
private void setStringFieldWithPrefix(TextView textView, String field, String prefix) {
7272
if (textView == null)
7373
return;
7474

7575
if (!TextUtils.isEmpty(field.trim())) {
7676
textView.setVisibility(View.VISIBLE);
77-
field = prefix + field;
78-
textView.setText(field);
77+
textView.setText(prefix + field);
7978
} else {
8079
textView.setVisibility(View.GONE);
8180
}

0 commit comments

Comments
 (0)