Skip to content

Commit

Permalink
codinguser#876 - Enhance Code Quality
Browse files Browse the repository at this point in the history
  • Loading branch information
JeanGarf committed Mar 7, 2020
1 parent 8844002 commit cd0916b
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 84 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import org.gnucash.android.R;
import org.gnucash.android.export.ExportParams;
import org.gnucash.android.export.Exporter;
import org.gnucash.android.model.Account;
import org.gnucash.android.model.Split;
import org.gnucash.android.model.Transaction;
import org.gnucash.android.model.TransactionType;
Expand Down
7 changes: 1 addition & 6 deletions app/src/main/java/org/gnucash/android/model/AccountType.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public enum AccountType {
/**
* Display the balance of a transaction in a text view and format the text color to match the sign of the amount
* @param balanceTextView {@link android.widget.TextView} where balance is to be displayed
* @param balance {@link org.gnucash.android.model.Money} balance to display
* @param balance {@link org.gnucash.android.model.Money} balance (>0 or <0) to display
*/
public void displayBalance(final TextView balanceTextView,
final Money balance) {
Expand Down Expand Up @@ -97,11 +97,6 @@ public void displayBalance(final TextView balanceTextView,

final boolean isCreditBalance = balance.isNegative();

// fontColor = isCreditBalance
// ? context.getResources()
// .getColor(R.color.debit_red)
// : context.getResources()
// .getColor(R.color.credit_green);
fontColor = getAmountColor(isCreditBalance);
}

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/org/gnucash/android/model/Money.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public final class Money implements Comparable<Money>{
private Commodity mCommodity;

/**
* Amount value held by this object
* Amount value held by this object (can be > 0 or < 0)
*/
private BigDecimal mAmount;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,7 @@ private void initViews(final Split split) {

splitAmountEditText.setCommodity(split.getValue()
.getCommodity());

splitAmountEditText.setValue(split.getFormattedValue()
.asBigDecimal());

Expand Down
172 changes: 96 additions & 76 deletions app/src/main/res/layout/activity_transaction_detail.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">

<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:background="?attr/colorPrimary"
Expand All @@ -34,10 +35,12 @@
android:gravity="bottom"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" >

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<TextView android:id="@+id/trn_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand All @@ -64,94 +67,111 @@
android:textColor="@android:color/white"
tools:text="Expenses:Computer"/>
</LinearLayout>

</android.support.v7.widget.Toolbar>

<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<TableLayout android:id="@+id/fragment_transaction_details"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/dialog_padding"
android:layout_marginTop="20dp"
android:stretchColumns="1"
android:orientation="vertical" >

<TableRow android:layout_width="match_parent"
<TableLayout
android:id="@+id/fragment_transaction_details"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="5"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:layout_marginLeft="6dp">

<TextView
android:layout_width="0dp"
android:layout_weight="2"
android:layout_height="wrap_content"
android:gravity="center_vertical|right"
android:textSize="16sp"
android:textStyle="bold"
android:text="@string/account_balance"
android:textColor="@android:color/black" />

<TextView
android:id="@+id/balance_debit"
android:layout_width="0dp"
android:layout_weight="1.5"
android:layout_height="wrap_content"
android:gravity="right"
android:layout_gravity="center"
android:textSize="16sp"
android:textStyle="bold"
tools:text="$ 2000"
android:textColor="@android:color/black" />

<TextView
android:id="@+id/balance_credit"
android:layout_width="0dp"
android:layout_weight="1.5"
android:layout_height="wrap_content"
android:gravity="right"
android:layout_gravity="center"
android:textSize="16sp"
android:textStyle="bold"
tools:text="$ 2000"
android:textColor="@android:color/black" />
</TableRow>

<TableRow android:id="@+id/row_time_and_date"
android:padding="@dimen/dialog_padding"
android:layout_marginTop="20dp"
style="@style/FormRow" >

<ImageView style="@style/FormIcon"
android:src="@drawable/ic_action_time"/>

<TextView android:id="@+id/trn_time_and_date"
style="@style/TransactionInfo" />
</TableRow>

<TableRow android:id="@+id/row_trn_notes"
style="@style/FormRow">
<ImageView style="@style/FormIcon"
android:src="@drawable/ic_action_sort_by_size"/>

<TextView android:id="@+id/trn_notes"
style="@style/TransactionInfo" />
</TableRow>

<TableRow android:id="@+id/row_trn_recurrence"
style="@style/FormRow">

<ImageView style="@style/FormIcon"
android:src="@drawable/ic_action_rotate_right"/>
android:stretchColumns="1"
android:orientation="vertical">

<TextView android:id="@+id/trn_recurrence"
style="@style/TransactionInfo" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="5"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:layout_marginLeft="6dp">

<TextView
android:layout_width="0dp"
android:layout_weight="2"
android:layout_height="wrap_content"
android:gravity="center_vertical|right"
android:textSize="16sp"
android:textStyle="bold"
android:text="@string/account_balance"
android:textColor="@android:color/black" />

<TextView
android:id="@+id/balance_debit"
android:layout_width="0dp"
android:layout_weight="1.5"
android:layout_height="wrap_content"
android:gravity="right"
android:layout_gravity="center"
android:textSize="16sp"
android:textStyle="bold"
tools:text="$ 2000"
android:textColor="@android:color/black" />

<TextView
android:id="@+id/balance_credit"
android:layout_width="0dp"
android:layout_weight="1.5"
android:layout_height="wrap_content"
android:gravity="right"
android:layout_gravity="center"
android:textSize="16sp"
android:textStyle="bold"
tools:text="$ 2000"
android:textColor="@android:color/black" />
</TableRow>

<TableRow
android:id="@+id/row_time_and_date"
android:layout_marginTop="20dp"
style="@style/FormRow">

<ImageView
style="@style/FormIcon"
android:src="@drawable/ic_action_time" />

<TextView
android:id="@+id/trn_time_and_date"
style="@style/TransactionInfo" />
</TableRow>

<TableRow
android:id="@+id/row_trn_notes"
style="@style/FormRow">

<ImageView
style="@style/FormIcon"
android:src="@drawable/ic_action_sort_by_size" />

<TextView
android:id="@+id/trn_notes"
style="@style/TransactionInfo" />
</TableRow>

<TableRow
android:id="@+id/row_trn_recurrence"
style="@style/FormRow">

<ImageView
style="@style/FormIcon"
android:src="@drawable/ic_action_rotate_right" />

<TextView
android:id="@+id/trn_recurrence"
style="@style/TransactionInfo" />
</TableRow>

</TableLayout>

</TableLayout>
</ScrollView>

</LinearLayout>

<android.support.design.widget.FloatingActionButton
android:id="@+id/fab_edit_transaction"
android:layout_height="40dp"
Expand Down

0 comments on commit cd0916b

Please sign in to comment.