Skip to content

Commit

Permalink
bruh mast
Browse files Browse the repository at this point in the history
  • Loading branch information
rchtgpt committed Jan 22, 2020
1 parent dddba1a commit 036d68e
Show file tree
Hide file tree
Showing 5 changed files with 131 additions and 250 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package org.mifos.mobile.cn.data.models.beneficiaries

data class ListBeneficiaries(val name: String, val description: String, val price: String)
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
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.ListBeneficiaries

class BeneficiariesAdapter(val beneficiariesList: ArrayList<ListBeneficiaries>) : 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: ListBeneficiaries = 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
Expand Up @@ -6,7 +6,11 @@ import android.os.Bundle
import android.widget.Button
import android.widget.LinearLayout
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import org.mifos.mobile.cn.R
import org.mifos.mobile.cn.data.models.beneficiaries.ListBeneficiaries
import org.mifos.mobile.cn.ui.adapter.BeneficiariesAdapter

class BeneficiariesActivity : AppCompatActivity() {

Expand All @@ -19,6 +23,22 @@ class BeneficiariesActivity : AppCompatActivity() {
val layoutAddBeneficiaries = findViewById<LinearLayout>(R.id.mBtnAddFocused)
val btnAddBeneficiaries = findViewById<Button>(R.id.btnAddBeneficiary)
val btnListBeneficiaries = findViewById<Button>(R.id.btnListBeneficiary)
val beneficiariesRecyclerView = findViewById<RecyclerView>(R.id.beneficiariesRecyclerView)
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<ListBeneficiaries>()
items.add(ListBeneficiaries(name, description, price))
items.add(ListBeneficiaries(name, description, price))
items.add(ListBeneficiaries(name, description, price))
items.add(ListBeneficiaries(name, description, price))
items.add(ListBeneficiaries(name, description, price))

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

btnListBeneficiaries.setTextColor(ContextCompat.getColorStateList(getApplicationContext(), R.color.white))
btnAddBeneficiaries.setTextColor(ContextCompat.getColorStateList(getApplicationContext(), R.color.violet))
Expand All @@ -33,6 +53,7 @@ class BeneficiariesActivity : AppCompatActivity() {
btnListBeneficiaries.setBackgroundTintList(ContextCompat.getColorStateList(getApplicationContext(), R.color.white))
btnAddBeneficiaries.setBackgroundTintList(ContextCompat.getColorStateList(getApplicationContext(), R.color.violet))
}

btnListBeneficiaries.setOnClickListener {
layoutAddBeneficiaries.visibility = LinearLayout.INVISIBLE
layoutListBeneficiaries.visibility = LinearLayout.VISIBLE
Expand Down
250 changes: 0 additions & 250 deletions app/src/main/res/layout/activity_beneficiaries.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,256 +75,6 @@
android:orientation="vertical"
android:visibility="visible">

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

<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_30dp">

<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:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/name"
android:textSize="@dimen/text_size_20sp"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android: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:layout_width="match_parent"
android:layout_height="match_parent"
android: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>

<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_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:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/name"
android:textSize="@dimen/text_size_20sp"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android: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:layout_width="match_parent"
android:layout_height="match_parent"
android: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>

<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_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:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/name"
android:textSize="@dimen/text_size_20sp"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android: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:layout_width="match_parent"
android:layout_height="match_parent"
android: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>

<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_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:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/name"
android:textSize="@dimen/text_size_20sp"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android: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:layout_width="match_parent"
android:layout_height="match_parent"
android: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>

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/beneficiariesRecyclerView"
android:layout_width="match_parent"
Expand Down
Loading

0 comments on commit 036d68e

Please sign in to comment.