import android.widget.LinearLayout;
import android.widget.TextView;
+import net.ktnx.mobileledger.App;
import net.ktnx.mobileledger.R;
import net.ktnx.mobileledger.model.Data;
import net.ktnx.mobileledger.model.LedgerTransaction;
import net.ktnx.mobileledger.model.TransactionListItem;
import net.ktnx.mobileledger.utils.Colors;
import net.ktnx.mobileledger.utils.Globals;
-import net.ktnx.mobileledger.utils.MLDB;
import java.text.DateFormat;
import java.util.Date;
case TRANSACTION:
holder.vTransaction.setVisibility(View.VISIBLE);
holder.vDelimiter.setVisibility(View.GONE);
- holder.vTrailer.setVisibility(View.GONE);
LedgerTransaction tr = item.getTransaction();
- // Log.d("transactions", String.format("Filling position %d with %d accounts", position,
+ // debug("transactions", String.format("Filling position %d with %d accounts", position,
// tr.getAccounts().size()));
TransactionLoader loader = new TransactionLoader();
case DELIMITER:
Date date = item.getDate();
holder.vTransaction.setVisibility(View.GONE);
- holder.vTrailer.setVisibility(View.GONE);
holder.vDelimiter.setVisibility(View.VISIBLE);
holder.tvDelimiterDate.setText(DateFormat.getDateInstance().format(date));
if (item.isMonthShown()) {
holder.vDelimiterLine.setVisibility(View.VISIBLE);
holder.vDelimiterThick.setVisibility(View.GONE);
}
- break;
- case TRAILER:
- holder.vTransaction.setVisibility(View.GONE);
- holder.vTrailer.setVisibility(View.VISIBLE);
- holder.vDelimiter.setVisibility(View.GONE);
-
break;
}
}
@NonNull
@Override
public TransactionRowHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
-// Log.d("perf", "onCreateViewHolder called");
+// debug("perf", "onCreateViewHolder called");
View row = LayoutInflater.from(parent.getContext())
.inflate(R.layout.transaction_list_row, parent, false);
return new TransactionRowHolder(row);
@Override
public int getItemCount() {
- return Data.transactions.size() + 1;
+ return Data.transactions.size();
}
enum LoaderStep {HEAD, ACCOUNTS, DONE}
private static class TransactionLoader
LedgerTransaction tr = p[0].transaction;
boolean odd = p[0].odd;
- SQLiteDatabase db = MLDB.getDatabase();
+ SQLiteDatabase db = App.getDatabase();
tr.loadData(db);
publishProgress(new TransactionLoaderStep(p[0].holder, p[0].position, tr, odd));
int rowIndex = 0;
for (LedgerTransactionAccount acc : tr.getAccounts()) {
-// Log.d(c.getAccountName(), acc.getAmount()));
+// debug(c.getAccountName(), acc.getAmount()));
publishProgress(new TransactionLoaderStep(p[0].holder, acc, rowIndex++,
p[0].boldAccountName));
}
LedgerTransactionAccount acc = step.getAccount();
-// Log.d("tmp", String.format("showing acc row %d: %s %1.2f", rowIndex,
+// debug("tmp", String.format("showing acc row %d: %s %1.2f", rowIndex,
// acc.getAccountName(), acc.getAmount()));
String boldAccountName = step.getBoldAccountName();
holder.tableAccounts.getChildCount() - accCount);
}
-// Log.d("transactions",
+// debug("transactions",
// String.format("Position %d fill done", step.getPosition()));
}
}