Skip to content

Commit

Permalink
Merge pull request #44 from zVolt/fix-account-ui
Browse files Browse the repository at this point in the history
Fix account UI
  • Loading branch information
zkhan93 authored Feb 9, 2022
2 parents aaca568 + b6e9b9b commit e55b6a3
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 74 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class AccountVH extends RecyclerView.ViewHolder implements View.OnClickLi
TextView balance;
ImageView updatedBy;
TextView updatedOn;
ImageButton menu;
TextView bankName;

private final Context context;
private final ItemInteractionListener<Account> itemInteractionListener;
Expand Down Expand Up @@ -75,6 +75,7 @@ public AccountVH(View itemView, ItemInteractionListener<Account> itemInteraction
name = itemView.findViewById(R.id.account_holder);
accountNumber = itemView.findViewById(R.id.account_number);
bank = itemView.findViewById(R.id.bank);
bankName = itemView.findViewById(R.id.bank_name);
ifsc = itemView.findViewById(R.id.ifsc);
balance = itemView.findViewById(R.id.balance);
updatedBy = itemView.findViewById(R.id.updated_by);
Expand All @@ -88,6 +89,7 @@ public AccountVH(View itemView, ItemInteractionListener<Account> itemInteraction
public void setAccount(Account account) {
this.account = account;
name.setText(account.getAccountHolder());
bankName.setText(account.getBank().toUpperCase());
accountNumber.setText(account.getAccountNumber());
FirebaseDatabase.getInstance()
.getReference("images")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import androidx.appcompat.widget.PopupMenu;
import androidx.recyclerview.widget.RecyclerView;

import io.github.zkhan93.familyfinance.R;
import io.github.zkhan93.familyfinance.models.AddonCard;
import io.github.zkhan93.familyfinance.models.CCard;
Expand All @@ -37,9 +38,7 @@ public class AddonCardVH extends RecyclerView.ViewHolder implements PopupMenu
TextView cvv;
ImageView updatedBy;
TextView updatedOn;
ImageButton menu;

private PopupMenu popup;
private AddonCard addonCard;
private final ItemInteractionListener itemInteractionListener;
private final Context context;
Expand All @@ -54,17 +53,10 @@ public AddonCardVH(View itemView, ItemInteractionListener itemInteractionListene
cvv = itemView.findViewById(R.id.cvv);
updatedBy = itemView.findViewById(R.id.updated_by);
updatedOn = itemView.findViewById(R.id.updated_on);
menu = itemView.findViewById(R.id.menu);
itemView.setOnLongClickListener(this);
itemView.findViewById(R.id.menu).setOnClickListener(view -> popup.show());
this.itemInteractionListener = itemInteractionListener;
popup = new PopupMenu(itemView.getContext(), menu);
MenuInflater inflater = popup.getMenuInflater();
popup.setOnMenuItemClickListener(this);
inflater.inflate(R.menu.addon_card, popup.getMenu());
updatedBy.setVisibility(View.GONE);
updatedOn.setVisibility(View.GONE);

}

@Override
Expand Down
119 changes: 55 additions & 64 deletions app/src/main/res/layout/listitem_account.xml
Original file line number Diff line number Diff line change
@@ -1,126 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="4dp"
android:layout_marginStart="@dimen/sides"
android:layout_marginTop="@dimen/small"
android:layout_marginEnd="@dimen/sides"
android:layout_marginBottom="@dimen/small"
android:clickable="true"
android:focusable="true"
android:foreground="?android:attr/selectableItemBackground"
app:cardCornerRadius="4dp">
app:cardCornerRadius="@dimen/cc_card_corner_radius"
app:cardElevation="@dimen/cardview_default_elevation"
app:cardPreventCornerOverlap="true">

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:orientation="vertical">
android:background="@drawable/ccard_bg_black_gradient"
android:orientation="vertical"
android:padding="@dimen/medium">

<TextView
android:id="@+id/account_holder"
style="@style/TextAppearance.AppCompat.Body2"
style="@style/AppTheme.Text.Light.Small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="-7dp"
android:layout_marginTop="0dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="Zeeshan Khan"/>

<ImageButton
android:id="@+id/menu"
style="@style/Base.Widget.AppCompat.ActionButton.Overflow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="0dp"
android:layout_marginTop="0dp"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
android:layout_marginTop="@dimen/small"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/account_number"
tools:text="Zeeshan Khan" />

<TextView
android:id="@+id/account_number"
style="@style/TextAppearance.AppCompat.Body2"
style="@style/AppTheme.Text.Light.Large"
android:layout_width="wrap_content"
android:layout_height="19dp"
android:layout_marginStart="8dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/small"
android:clickable="false"
android:textIsSelectable="true"
app:layout_constraintBottom_toBottomOf="@+id/bank"
app:layout_constraintLeft_toLeftOf="@+id/bank"
app:layout_constraintStart_toEndOf="@+id/bank"
app:layout_constraintTop_toTopOf="@+id/bank"
tools:text="xxxxxxxx6789"/>
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/bank"
tools:text="XXXX XXXX 6789" />

<ImageView
android:id="@+id/bank"
style="@style/TextAppearance.AppCompat.Body1"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginTop="8dp"
android:layout_width="@dimen/large"
android:layout_height="@dimen/large"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/account_holder"
app:layout_constraintTop_toTopOf="parent"
tools:src="@drawable/googleg_standard_color_18"
tools:text="ICICI"/>
tools:text="ICICI" />

<TextView
android:id="@+id/bank_name"
style="@style/AppTheme.Text.Light.Small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/small"
android:textIsSelectable="true"
app:layout_constraintBottom_toBottomOf="@+id/bank"
app:layout_constraintStart_toEndOf="@+id/bank"
app:layout_constraintTop_toTopOf="@+id/bank"
tools:text="ICICI Bank" />


<TextView
android:id="@+id/ifsc"
style="@style/TextAppearance.AppCompat.Body1"
style="@style/AppTheme.Text.Light.Small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="0dp"
android:layout_marginTop="4dp"
android:textIsSelectable="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@+id/bank"
tools:text="ICIC000855"/>
app:layout_constraintTop_toTopOf="@+id/bank_name"
tools:text="ICIC000855" />


<TextView
android:id="@+id/balance"
style="@style/TextAppearance.AppCompat.Body2"
android:layout_width="0dp"
style="@style/AppTheme.Text.Light.Small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginBottom="@dimen/small"
android:gravity="end"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/menu"
app:layout_constraintLeft_toRightOf="@+id/account_number"
app:layout_constraintTop_toBottomOf="@+id/menu"
app:layout_constraintVertical_bias="0.0"
tools:text="1,00,00,000 INR"/>

app:layout_constraintBottom_toTopOf="@+id/updated_on"
app:layout_constraintEnd_toEndOf="parent"
tools:text="1,00,00,000 INR" />

<ImageView
android:id="@+id/updated_by"
style="@style/TextAppearance.AppCompat.Caption"
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_marginBottom="0dp"
android:layout_marginEnd="0dp"
android:layout_marginTop="4dp"
android:layout_marginTop="@dimen/small"
android:layout_weight="1"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/balance"
tools:src="@color/md_orange_500"
tools:text="Bushra Rehman"/>
tools:text="Bushra Rehman" />

<TextView
android:id="@+id/updated_on"
style="@style/TextAppearance.AppCompat.Caption"
style="@style/AppTheme.Text.Light.Small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="0dp"
android:layout_marginEnd="8dp"
android:layout_marginTop="0dp"
android:layout_marginEnd="@dimen/small"
app:layout_constraintBottom_toBottomOf="@+id/updated_by"
app:layout_constraintRight_toLeftOf="@+id/updated_by"
app:layout_constraintTop_toTopOf="@+id/updated_by"
tools:text="3 minutes ago"/>
tools:text="3 minutes ago" />

</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
3 changes: 3 additions & 0 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@
<style name="AppTheme.Text.Light.Small">
<item name="android:textSize">@dimen/text_size_sm</item>
</style>
<style name="AppTheme.Text.Light.Medium">
<item name="android:textSize">@dimen/text_size_md</item>
</style>
<style name="AppTheme.Text.Light.Large">
<item name="android:textSize">@dimen/text_size_lg</item>
</style>
Expand Down

0 comments on commit e55b6a3

Please sign in to comment.