diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index db3b07b5..48b7fd4d 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -36,6 +36,7 @@ + diff --git a/app/src/main/kotlin/org/mifos/mobile/cn/data/models/beneficiaries/listBeneficiaries.kt b/app/src/main/kotlin/org/mifos/mobile/cn/data/models/beneficiaries/listBeneficiaries.kt new file mode 100644 index 00000000..0190f4fa --- /dev/null +++ b/app/src/main/kotlin/org/mifos/mobile/cn/data/models/beneficiaries/listBeneficiaries.kt @@ -0,0 +1,3 @@ +package org.mifos.mobile.cn.data.models.beneficiaries + +data class Beneficiary(val name: String, val description: String, val price: String) diff --git a/app/src/main/kotlin/org/mifos/mobile/cn/ui/adapter/BeneficiariesAdapter.kt b/app/src/main/kotlin/org/mifos/mobile/cn/ui/adapter/BeneficiariesAdapter.kt new file mode 100644 index 00000000..41652afc --- /dev/null +++ b/app/src/main/kotlin/org/mifos/mobile/cn/ui/adapter/BeneficiariesAdapter.kt @@ -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) : RecyclerView.Adapter() { + + 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(R.id.tv_name) + val textViewDescription = itemView.findViewById(R.id.tv_beneficiaries_decription) + val textViewPrice = itemView.findViewById(R.id.tv_price) + } +} diff --git a/app/src/main/kotlin/org/mifos/mobile/cn/ui/mifos/beneficiaries/BeneficiariesActivity.kt b/app/src/main/kotlin/org/mifos/mobile/cn/ui/mifos/beneficiaries/BeneficiariesActivity.kt new file mode 100644 index 00000000..08982a8b --- /dev/null +++ b/app/src/main/kotlin/org/mifos/mobile/cn/ui/mifos/beneficiaries/BeneficiariesActivity.kt @@ -0,0 +1,61 @@ +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() + 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)) + } + } +} diff --git a/app/src/main/res/layout/activity_beneficiaries.xml b/app/src/main/res/layout/activity_beneficiaries.xml new file mode 100644 index 00000000..3f007f01 --- /dev/null +++ b/app/src/main/res/layout/activity_beneficiaries.xml @@ -0,0 +1,203 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/item_beneficiaries.xml b/app/src/main/res/layout/item_beneficiaries.xml new file mode 100644 index 00000000..b5557033 --- /dev/null +++ b/app/src/main/res/layout/item_beneficiaries.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 6f612736..288c7e3e 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -1,5 +1,5 @@ - + #B2C1C8 @@ -9,6 +9,10 @@ #757575 #9F8E8E #FF4081 + + #4C56C0 + #EBECF0 + #AFADB5 #ffffff @@ -59,6 +63,7 @@ #eaeaea #c1c1c1 + #4C56C0 diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index bf778ce8..9e5dc05e 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -1,5 +1,6 @@ + -30dp 2dp 4dp 8dp @@ -8,11 +9,21 @@ 10dp 15dp 16dp + 18dp + 20dp 24dp 30dp + 32dp + 40dp 50dp + 60dp 64dp + 70dp 75dp + 80dp + 100dp + 120dp + 620dp 16dp 16dp @@ -28,6 +39,9 @@ 16sp 18sp 20sp + 22sp + 30sp + 38sp 24sp 20sp diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 6c055bf3..48023e48 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -311,5 +311,17 @@ https://openmf.github.io/privacy_policy_mifos_mobile.html Open Source licenses + + Add + List + Savings Account + Savings Account Type + Account Number + Office Name + Transfer Limit + Beneficiary Name + Submit Beneficiary + Name + $30 diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index d21617bc..2e27cfe8 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -1,7 +1,7 @@ -