-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Redesign: Add Beneficiaries and Show Beneficiaries Screen
- Loading branch information
Showing
10 changed files
with
415 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
app/src/main/kotlin/org/mifos/mobile/cn/data/models/beneficiaries/listBeneficiaries.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
34 changes: 34 additions & 0 deletions
34
app/src/main/kotlin/org/mifos/mobile/cn/ui/adapter/BeneficiariesAdapter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { | ||
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) | ||
} | ||
} |
66 changes: 66 additions & 0 deletions
66
app/src/main/kotlin/org/mifos/mobile/cn/ui/mifos/beneficiaries/BeneficiariesActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
Oops, something went wrong.