]> git.ktnx.net Git - mobile-ledger.git/commitdiff
fix setting null literal value for date components
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Mon, 1 Feb 2021 06:17:13 +0000 (08:17 +0200)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Mon, 1 Feb 2021 06:17:13 +0000 (08:17 +0200)
app/src/main/java/net/ktnx/mobileledger/ui/patterns/PatternDetailsAdapter.java

index c7f42ec178dc3026afc9c79f6284a3366c577514..4fd35a520173f9df5d5b14bca5401a240a85430d 100644 (file)
@@ -331,7 +331,9 @@ class PatternDetailsAdapter extends RecyclerView.Adapter<PatternDetailsAdapter.V
 
             if (header.hasLiteralDateYear()) {
                 b.patternDetailsYearSource.setText(R.string.pattern_details_source_literal);
-                b.patternDetailsDateYear.setText(String.valueOf(header.getDateYear()));
+                final Integer dateYear = header.getDateYear();
+                b.patternDetailsDateYear.setText(
+                        (dateYear == null) ? null : String.valueOf(dateYear));
                 b.patternDetailsDateYearLayout.setVisibility(View.VISIBLE);
             }
             else {
@@ -347,7 +349,9 @@ class PatternDetailsAdapter extends RecyclerView.Adapter<PatternDetailsAdapter.V
 
             if (header.hasLiteralDateMonth()) {
                 b.patternDetailsMonthSource.setText(R.string.pattern_details_source_literal);
-                b.patternDetailsDateMonth.setText(String.valueOf(header.getDateMonth()));
+                final Integer dateMonth = header.getDateMonth();
+                b.patternDetailsDateMonth.setText(
+                        (dateMonth == null) ? null : String.valueOf(dateMonth));
                 b.patternDetailsDateMonthLayout.setVisibility(View.VISIBLE);
             }
             else {
@@ -363,7 +367,8 @@ class PatternDetailsAdapter extends RecyclerView.Adapter<PatternDetailsAdapter.V
 
             if (header.hasLiteralDateDay()) {
                 b.patternDetailsDaySource.setText(R.string.pattern_details_source_literal);
-                b.patternDetailsDateDay.setText(String.valueOf(header.getDateDay()));
+                final Integer dateDay = header.getDateDay();
+                b.patternDetailsDateDay.setText((dateDay == null) ? null : String.valueOf(dateDay));
                 b.patternDetailsDateDayLayout.setVisibility(View.VISIBLE);
             }
             else {