Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redesign: Add Beneficiaries and Show Beneficiaries Screen #119

Open
wants to merge 1 commit into
base: redesign
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
<activity android:name=".ui.mifos.debtincomereport.DebtIncomeReportActivity"/>
<activity android:name=".ui.mifos.aboutus.AboutUsActivity"/>
<activity android:name=".ui.mifos.privacypolicy.PrivacyPolicyActivity"/>
<activity android:name=".ui.mifos.beneficiaries.BeneficiariesActivity" />
<activity
android:name="com.google.android.gms.oss.licenses.OssLicensesMenuActivity"
android:theme="@style/Theme.AppCompat.Light.DarkActionBar" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package org.mifos.mobile.cn.data.models.beneficiaries

data class Beneficiary(val name: String, val description: String, val price: String)
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package org.mifos.mobile.cn.ui.adapter

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import org.mifos.mobile.cn.R
import org.mifos.mobile.cn.data.models.beneficiaries.Beneficiary

class BeneficiariesAdapter(val beneficiariesList: ArrayList<Beneficiary>) : RecyclerView.Adapter<BeneficiariesAdapter.ViewHolder>() {

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
rchtgpt marked this conversation as resolved.
Show resolved Hide resolved
val v = LayoutInflater.from(parent.context).inflate(R.layout.item_beneficiaries, parent, false)
return ViewHolder(v)
}

override fun getItemCount(): Int {
return beneficiariesList.size
}

override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val list: Beneficiary = beneficiariesList[position]
holder.textViewName?.text = list.name
holder.textViewDescription?.text = list.description
holder.textViewPrice?.text = list.price
}

class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
val textViewName = itemView.findViewById<TextView>(R.id.tv_name)
val textViewDescription = itemView.findViewById<TextView>(R.id.tv_beneficiaries_decription)
val textViewPrice = itemView.findViewById<TextView>(R.id.tv_price)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package org.mifos.mobile.cn.ui.mifos.beneficiaries

import android.annotation.SuppressLint
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.LinearLayout
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import kotlinx.android.synthetic.main.activity_beneficiaries.*
import org.mifos.mobile.cn.R
import org.mifos.mobile.cn.data.models.beneficiaries.Beneficiary
import org.mifos.mobile.cn.ui.adapter.BeneficiariesAdapter

class BeneficiariesActivity : AppCompatActivity() {

@SuppressLint("ResourceAsColor")
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_beneficiaries)

val name: String = getString(R.string.name)
val description: String = getString(R.string.description)
val price: String = getString(R.string.dummy_price)

beneficiariesRecyclerView.layoutManager = LinearLayoutManager(this, RecyclerView.VERTICAL, false)

val items = ArrayList<Beneficiary>()
items.add(Beneficiary(name, description, price))
items.add(Beneficiary(name, description, price))
items.add(Beneficiary(name, description, price))
items.add(Beneficiary(name, description, price))
items.add(Beneficiary(name, description, price))
items.add(Beneficiary(name, description, price))
items.add(Beneficiary(name, description, price))
items.add(Beneficiary(name, description, price))
items.add(Beneficiary(name, description, price))
items.add(Beneficiary(name, description, price))

val adapter = BeneficiariesAdapter(items)
beneficiariesRecyclerView.adapter = adapter

btnListBeneficiary.setTextColor(ContextCompat.getColorStateList(getApplicationContext(), R.color.white))
btnAddBeneficiary.setTextColor(ContextCompat.getColorStateList(getApplicationContext(), R.color.violet))
btnAddBeneficiary.setBackgroundTintList(ContextCompat.getColorStateList(getApplicationContext(), R.color.white))
btnListBeneficiary.setBackgroundTintList(ContextCompat.getColorStateList(getApplicationContext(), R.color.violet))

btnAddBeneficiary.setOnClickListener {
mBtnAddFocused.visibility = LinearLayout.VISIBLE
mBtnListFocused.visibility = LinearLayout.INVISIBLE
btnListBeneficiary.setTextColor(ContextCompat.getColorStateList(getApplicationContext(), R.color.violet))
btnAddBeneficiary.setTextColor(ContextCompat.getColorStateList(getApplicationContext(), R.color.white))
btnListBeneficiary.setBackgroundTintList(ContextCompat.getColorStateList(getApplicationContext(), R.color.white))
btnAddBeneficiary.setBackgroundTintList(ContextCompat.getColorStateList(getApplicationContext(), R.color.violet))
}

btnListBeneficiary.setOnClickListener {
mBtnAddFocused.visibility = LinearLayout.INVISIBLE
mBtnListFocused.visibility = LinearLayout.VISIBLE
btnAddBeneficiary.setTextColor(ContextCompat.getColorStateList(getApplicationContext(), R.color.violet))
btnListBeneficiary.setTextColor(ContextCompat.getColorStateList(getApplicationContext(), R.color.white))
btnListBeneficiary.setBackgroundTintList(ContextCompat.getColorStateList(getApplicationContext(), R.color.violet))
btnAddBeneficiary.setBackgroundTintList(ContextCompat.getColorStateList(getApplicationContext(), R.color.white))
}
}
}
204 changes: 204 additions & 0 deletions app/src/main/res/layout/activity_beneficiaries.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/violet"
android:orientation="vertical">

<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="@dimen/layout_padding_30dp"
android:layout_marginLeft="@dimen/layout_padding_30dp"
android:layout_marginTop="@dimen/text_size_38sp"
android:text="@string/beneficiaries"
android:textColor="@color/white"
android:textSize="@dimen/text_size_30sp"
android:textStyle="bold" />

<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="@dimen/layout_padding_620dp"
android:layout_alignParentBottom="true"
android:layout_marginBottom="@dimen/layout_padding_negative30dp"
android:backgroundTint="@color/offwhite"
app:cardCornerRadius="@dimen/layout_padding_30dp">

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="@dimen/layout_padding_80dp"
android:layout_marginLeft="@dimen/layout_padding_40dp"
android:layout_marginTop="@dimen/layout_padding_20dp"
android:layout_marginRight="@dimen/layout_padding_40dp"
android:orientation="horizontal"
android:padding="@dimen/layout_padding_5dp">

<com.google.android.material.button.MaterialButton
android:id="@+id/btnListBeneficiary"
android:layout_width="@dimen/layout_padding_120dp"
android:layout_height="@dimen/layout_padding_50dp"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:layout_marginBottom="@dimen/layout_padding_10dp"
android:clickable="true"
android:focusable="true"
android:text="@string/list"
android:textAlignment="center"
android:textAllCaps="false"
app:cornerRadius="@dimen/layout_padding_20dp" />

<com.google.android.material.button.MaterialButton
android:id="@+id/btnAddBeneficiary"
android:layout_width="@dimen/layout_padding_120dp"
android:layout_height="@dimen/layout_padding_50dp"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginBottom="@dimen/layout_padding_10dp"
android:clickable="true"
android:focusable="true"
android:text="@string/add"
android:textAlignment="center"
android:textAllCaps="false"
app:cornerRadius="@dimen/layout_padding_20dp" />

</RelativeLayout>

<LinearLayout
android:id="@+id/mBtnListFocused"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/layout_padding_100dp"
android:layout_marginBottom="@dimen/layout_padding_20dp"
android:orientation="vertical"
android:visibility="visible">

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/beneficiariesRecyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_marginTop="@dimen/layout_padding_20dp"/>

</LinearLayout>

<LinearLayout
android:id="@+id/mBtnAddFocused"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/layout_padding_100dp"
android:layout_marginBottom="@dimen/layout_padding_18dp"
android:orientation="vertical"
android:visibility="gone">

<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="@dimen/layout_padding_64dp"
android:layout_marginStart="@dimen/layout_padding_50dp"
android:layout_marginLeft="@dimen/layout_padding_50dp"
android:layout_marginTop="@dimen/layout_padding_10dp"
android:layout_marginEnd="@dimen/layout_padding_40dp"
android:layout_marginRight="@dimen/layout_padding_40dp"
android:layout_marginBottom="@dimen/layout_padding_15dp"
android:textColorHint="@color/violet"
app:boxStrokeColor="@color/violet"
app:helperText="@string/savings_account_type">

<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="@dimen/layout_padding_40dp"
android:hint="@string/savings_account" />

</com.google.android.material.textfield.TextInputLayout>

<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="@dimen/layout_padding_64dp"
android:layout_marginStart="@dimen/layout_padding_50dp"
android:layout_marginLeft="@dimen/layout_padding_50dp"
android:layout_marginEnd="@dimen/layout_padding_40dp"
android:layout_marginRight="@dimen/layout_padding_40dp"
android:layout_marginBottom="@dimen/layout_padding_15dp"
app:boxStrokeColor="@color/violet"
app:helperText="@string/account_number">

<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="@dimen/layout_padding_40dp" />

</com.google.android.material.textfield.TextInputLayout>

<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="@dimen/layout_padding_64dp"
android:layout_marginStart="@dimen/layout_padding_50dp"
android:layout_marginLeft="@dimen/layout_padding_50dp"
android:layout_marginEnd="@dimen/layout_padding_40dp"
android:layout_marginRight="@dimen/layout_padding_40dp"
android:layout_marginBottom="@dimen/layout_padding_15dp"
app:boxStrokeColor="@color/violet"
app:helperText="@string/office_name">

<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="@dimen/layout_padding_40dp" />

</com.google.android.material.textfield.TextInputLayout>

<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="@dimen/layout_padding_64dp"
android:layout_marginStart="@dimen/layout_padding_50dp"
android:layout_marginLeft="@dimen/layout_padding_50dp"
android:layout_marginEnd="@dimen/layout_padding_40dp"
android:layout_marginRight="@dimen/layout_padding_40dp"
android:layout_marginBottom="18dp"
app:boxStrokeColor="@color/violet"
app:helperText="@string/transfer_limit">

<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="@dimen/layout_padding_40dp" />

</com.google.android.material.textfield.TextInputLayout>

<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="@dimen/layout_padding_64dp"
android:layout_marginStart="@dimen/layout_padding_50dp"
android:layout_marginLeft="@dimen/layout_padding_50dp"
android:layout_marginEnd="@dimen/layout_padding_40dp"
android:layout_marginRight="@dimen/layout_padding_40dp"
android:layout_marginBottom="@dimen/layout_padding_20dp"
app:boxStrokeColor="@color/violet"
app:helperText="@string/beneficiary_name">

<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="@dimen/layout_padding_40dp" />

</com.google.android.material.textfield.TextInputLayout>

<com.google.android.material.button.MaterialButton
android:layout_width="match_parent"
android:layout_height="@dimen/layout_padding_50dp"
android:layout_marginLeft="@dimen/layout_padding_50dp"
android:layout_marginRight="@dimen/layout_padding_50dp"
android:layout_marginBottom="@dimen/layout_padding_32dp"
android:backgroundTint="@color/violet"
android:text="@string/submit_beneficiary"
android:textSize="@dimen/text_size_16sp"
app:cornerRadius="@dimen/layout_padding_8dp" />

</LinearLayout>

</com.google.android.material.card.MaterialCardView>

</RelativeLayout>
74 changes: 74 additions & 0 deletions app/src/main/res/layout/item_beneficiaries.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="@dimen/layout_padding_64dp"
android:backgroundTint="@color/white"
android:layout_marginStart="@dimen/layout_padding_30dp"
android:layout_marginLeft="@dimen/layout_padding_30dp"
android:layout_marginRight="@dimen/layout_padding_30dp"
android:layout_marginEnd="@dimen/layout_padding_30dp"
app:cardCornerRadius="@dimen/layout_padding_10dp"
android:layout_marginTop="@dimen/layout_padding_10dp">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:baselineAligned="false"
android:orientation="horizontal"
android:padding="@dimen/layout_padding_10dp">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="2"
android:gravity="center_vertical"
android:orientation="vertical"
android:layout_marginStart="@dimen/layout_padding_15dp"
android:layout_marginLeft="@dimen/layout_padding_15dp">

<TextView
android:id="@+id/tv_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="@string/name"
android:textSize="@dimen/text_size_20sp"/>

<TextView
android:id="@+id/tv_beneficiaries_decription"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="@string/description"
android:textColor="@color/light_gray"
android:textSize="@dimen/text_size_14sp"/>

</LinearLayout>

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="7">

<TextView
android:id="@+id/tv_price"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:text="@string/dummy_price"
android:textColor="@color/violet"
android:textStyle="bold"
android:textSize="@dimen/text_size_22sp"
android:gravity="center"/>

</RelativeLayout>

</LinearLayout>

</com.google.android.material.card.MaterialCardView>

</LinearLayout>
Loading