Commit 74011ad6 authored by iman Fauzi's avatar iman Fauzi

fix payment

parent 574af5e9
package com.yono.messeripos; package com.yono.messeripos;
import android.content.Context; import android.content.Context;
import android.content.Intent;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.RadioButton; import android.widget.RadioButton;
import android.widget.TextView; import android.widget.TextView;
...@@ -63,6 +65,7 @@ public class PaymentAdapter extends RecyclerView.Adapter<PaymentAdapter.ViewHold ...@@ -63,6 +65,7 @@ public class PaymentAdapter extends RecyclerView.Adapter<PaymentAdapter.ViewHold
public ImageView logoComp; public ImageView logoComp;
public RadioButton radioButton; public RadioButton radioButton;
public TextView textView; public TextView textView;
public Button btnPay;
public ViewHolder(@NonNull View itemView) { public ViewHolder(@NonNull View itemView) {
super(itemView); super(itemView);
...@@ -71,16 +74,16 @@ public class PaymentAdapter extends RecyclerView.Adapter<PaymentAdapter.ViewHold ...@@ -71,16 +74,16 @@ public class PaymentAdapter extends RecyclerView.Adapter<PaymentAdapter.ViewHold
logoComp = itemView.findViewById(R.id.ivLogo); logoComp = itemView.findViewById(R.id.ivLogo);
radioButton = itemView.findViewById(R.id.rbPayment); radioButton = itemView.findViewById(R.id.rbPayment);
textView = itemView.findViewById(R.id.tvPayment); textView = itemView.findViewById(R.id.tvPayment);
btnPay = itemView.findViewById(R.id.btnPay);
Log.d("ViewHolder: ", textView.toString());
cardView.setOnClickListener(new View.OnClickListener() { cardView.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
getPosition = getAdapterPosition(); getPosition = getAdapterPosition();
notifyDataSetChanged(); notifyDataSetChanged();
if (getPosition == Integer.parseInt(cardView.getTag().toString())) radioButton.setChecked(true); if (getPosition == Integer.parseInt(cardView.getTag().toString())) radioButton.setChecked(true); else radioButton.setChecked(false);
else radioButton.setChecked(false);
} }
}); });
} }
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:padding="10dp"
tools:context=".PaymentActivity"> tools:context=".PaymentActivity">
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
...@@ -12,4 +13,13 @@ ...@@ -12,4 +13,13 @@
android:layout_height="match_parent" android:layout_height="match_parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btnPay"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="pay"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment