int rowIndex = step.getAccountPosition();
Context ctx = holder.row.getContext();
LinearLayout row = (LinearLayout) holder.tableAccounts.getChildAt(rowIndex);
- TextView accName, accAmount;
if (row == null) {
- row = new LinearLayout(ctx);
- row.setLayoutParams(new LinearLayout.LayoutParams(
- LinearLayout.LayoutParams.MATCH_PARENT,
- LinearLayout.LayoutParams.WRAP_CONTENT));
- row.setGravity(Gravity.CENTER_VERTICAL);
- row.setOrientation(LinearLayout.HORIZONTAL);
- row.setPaddingRelative(dp2px(ctx, 8), 0, 0, 0);
- accName = new AppCompatTextView(ctx);
- accName.setLayoutParams(new LinearLayout.LayoutParams(0,
- LinearLayout.LayoutParams.WRAP_CONTENT, 5f));
- accName.setTextAlignment(View.TEXT_ALIGNMENT_VIEW_START);
- row.addView(accName);
- accAmount = new AppCompatTextView(ctx);
- LinearLayout.LayoutParams llp = new LinearLayout.LayoutParams(
- LinearLayout.LayoutParams.WRAP_CONTENT,
- LinearLayout.LayoutParams.WRAP_CONTENT);
- llp.setMarginEnd(0);
- accAmount.setLayoutParams(llp);
- accAmount.setTextAlignment(View.TEXT_ALIGNMENT_VIEW_END);
- accAmount.setMinWidth(dp2px(ctx, 60));
- row.addView(accAmount);
- holder.tableAccounts.addView(row);
- }
- else {
- accName = (TextView) row.getChildAt(0);
- accAmount = (TextView) row.getChildAt(1);
+ LayoutInflater inflater = ((Activity) ctx).getLayoutInflater();
+ row = (LinearLayout) inflater.inflate(
+ R.layout.transaction_list_row_accounts_table_row,
+ holder.tableAccounts);
}
+ TextView accName = row.findViewById(R.id.transaction_list_acc_row_acc_name);
+ TextView accComment =
+ row.findViewById(R.id.transaction_list_acc_row_acc_comment);
+ TextView accAmount = row.findViewById(R.id.transaction_list_acc_row_acc_amount);
LedgerTransactionAccount acc = step.getAccount();
accAmount.setTextColor(Colors.defaultTextColor);
accName.setText(acc.getAccountName());
}
+
+ String comment = acc.getComment();
+ if (comment != null && !comment.isEmpty()) {
+ accComment.setText(comment);
+ accComment.setVisibility(View.VISIBLE);
+ }
+ else {
+ accComment.setVisibility(View.GONE);
+ }
accAmount.setText(acc.toString());
break;
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
- android:visibility="gone"
+ android:visibility="visible"
app:cardCornerRadius="16dp"
app:cardElevation="4dp"
app:cardUseCompatPadding="false"
android:id="@+id/transaction_row_header_border"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:background="@drawable/dashed_border_1dp"
android:alpha="0.3"
+ android:background="@drawable/dashed_border_1dp"
android:minHeight="2dp"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/transaction_row_header_border">
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="center_vertical"
- android:orientation="horizontal"
- android:paddingStart="8dp"
- android:paddingEnd="0dp">
-
- <TextView
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_weight="5"
- android:text="---"
- android:textAlignment="viewStart"
- tools:ignore="HardcodedText" />
-
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginEnd="0dp"
- android:minWidth="60dp"
- android:text="€ --,--"
- android:textAlignment="viewEnd"
- tools:ignore="HardcodedText" />
- </LinearLayout>
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="center_vertical"
- android:orientation="horizontal"
- android:paddingStart="8dp"
- android:paddingEnd="0dp">
-
- <TextView
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_weight="5"
- android:text="---"
- android:textAlignment="viewStart"
- tools:ignore="HardcodedText" />
-
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginEnd="0dp"
- android:minWidth="60dp"
- android:text="---,--"
- android:textAlignment="viewEnd"
- tools:ignore="HardcodedText" />
- </LinearLayout>
+ <include layout="@layout/transaction_list_row_accounts_table_row"/>
+ <include layout="@layout/transaction_list_row_accounts_table_row"/>
+
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
android:layout_height="16dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
- android:background="@drawable/dashed_border_1dp"
android:alpha="0.3"
+ android:background="@drawable/dashed_border_1dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/transaction_delimiter_date"
app:layout_constraintStart_toEndOf="@id/transaction_delimiter_month"
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?><!--
+ ~ Copyright © 2020 Damyan Ivanov.
+ ~ This file is part of MoLe.
+ ~ MoLe is free software: you can distribute it and/or modify it
+ ~ under the term of the GNU General Public License as published by
+ ~ the Free Software Foundation, either version 3 of the License, or
+ ~ (at your opinion), any later version.
+ ~
+ ~ MoLe is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ~ GNU General Public License terms for details.
+ ~
+ ~ You should have received a copy of the GNU General Public License
+ ~ along with MoLe. If not, see <https://www.gnu.org/licenses/>.
+ -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_vertical"
+ android:orientation="horizontal"
+ android:paddingStart="8dp"
+ android:paddingEnd="0dp">
+
+ <LinearLayout
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="5"
+ android:orientation="vertical">
+
+ <TextView
+ android:id="@+id/transaction_list_acc_row_acc_name"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="another acc name"
+ android:textAlignment="viewStart"
+ tools:ignore="HardcodedText" />
+
+ <TextView
+ android:id="@+id/transaction_list_acc_row_acc_comment"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:alpha="0.75"
+ android:text="account comment"
+ android:textAlignment="viewStart"
+ android:textStyle="italic"
+ tools:ignore="HardcodedText" />
+ </LinearLayout>
+
+ <TextView
+ android:id="@+id/transaction_list_acc_row_acc_amount"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="top"
+ android:layout_marginEnd="0dp"
+ android:minWidth="60dp"
+ android:text="---,--"
+ android:textAlignment="viewEnd"
+ tools:ignore="HardcodedText" />
+</LinearLayout>