- if (item.getType() == TransactionListItem.Type.TRANSACTION) {
- holder.vTransaction.setVisibility(View.VISIBLE);
- holder.vDelimiter.setVisibility(View.GONE);
- LedgerTransaction tr = item.getTransaction();
-
-// Log.d("transactions", String.format("Filling position %d with %d accounts", position,
-// tr.getAccounts().size()));
-
- TransactionLoader loader = new TransactionLoader();
- loader.execute(new TransactionLoaderParams(tr, holder, position, boldAccountName,
- item.isOdd()));
-
- // WORKAROUND what seems to be a bug in CardHolder somewhere
- // when a view that was previously holding a delimiter is re-purposed
- // occasionally it stays too short (not high enough)
- holder.vTransaction.measure(View.MeasureSpec
- .makeMeasureSpec(holder.itemView.getWidth(), View.MeasureSpec.EXACTLY),
- View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
- }
- else {
- Date date = item.getDate();
- holder.vTransaction.setVisibility(View.GONE);
- holder.vDelimiter.setVisibility(View.VISIBLE);
- holder.tvDelimiterDate.setText(DateFormat.getDateInstance().format(date));
- if (item.isMonthShown()) {
- holder.tvDelimiterMonth.setText(Globals.monthNames[date.getMonth()]);
- holder.tvDelimiterMonth.setVisibility(View.VISIBLE);
-// holder.vDelimiterLine.setBackgroundResource(R.drawable.dashed_border_8dp);
- holder.vDelimiterLine.setVisibility(View.GONE);
- holder.vDelimiterThick.setVisibility(View.VISIBLE);
- }
- else {
- holder.tvDelimiterMonth.setVisibility(View.GONE);
-// holder.vDelimiterLine.setBackgroundResource(R.drawable.dashed_border_1dp);
- holder.vDelimiterLine.setVisibility(View.VISIBLE);
- holder.vDelimiterThick.setVisibility(View.GONE);
- }
+ switch (item.getType()) {
+ case TRANSACTION:
+ holder.vTransaction.setVisibility(View.VISIBLE);
+ holder.vDelimiter.setVisibility(View.GONE);
+ LedgerTransaction tr = item.getTransaction();
+
+ // debug("transactions", String.format("Filling position %d with %d accounts", position,
+ // tr.getAccounts().size()));
+
+ TransactionLoader loader = new TransactionLoader();
+ loader.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR,
+ new TransactionLoaderParams(tr, holder, position, Data.accountFilter.getValue(),
+ item.isOdd()));
+
+ // WORKAROUND what seems to be a bug in CardHolder somewhere
+ // when a view that was previously holding a delimiter is re-purposed
+ // occasionally it stays too short (not high enough)
+ holder.vTransaction.measure(View.MeasureSpec
+ .makeMeasureSpec(holder.itemView.getWidth(), View.MeasureSpec.EXACTLY),
+ View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
+ break;
+ case DELIMITER:
+ Date date = item.getDate();
+ holder.vTransaction.setVisibility(View.GONE);
+ holder.vDelimiter.setVisibility(View.VISIBLE);
+ holder.tvDelimiterDate.setText(DateFormat.getDateInstance().format(date));
+ if (item.isMonthShown()) {
+ GregorianCalendar cal = new GregorianCalendar(TimeZone.getDefault());
+ cal.setTime(date);
+ holder.tvDelimiterMonth
+ .setText(Globals.monthNames[cal.get(GregorianCalendar.MONTH)]);
+ holder.tvDelimiterMonth.setVisibility(View.VISIBLE);
+ // holder.vDelimiterLine.setBackgroundResource(R.drawable.dashed_border_8dp);
+ holder.vDelimiterLine.setVisibility(View.GONE);
+ holder.vDelimiterThick.setVisibility(View.VISIBLE);
+ }
+ else {
+ holder.tvDelimiterMonth.setVisibility(View.GONE);
+ // holder.vDelimiterLine.setBackgroundResource(R.drawable.dashed_border_1dp);
+ holder.vDelimiterLine.setVisibility(View.VISIBLE);
+ holder.vDelimiterThick.setVisibility(View.GONE);
+ }
+ break;