Commit 152d4f10 authored by Muhammad Suryono's avatar Muhammad Suryono

Update Paymen adapter dan category

parent 6d594ba1
...@@ -3,12 +3,14 @@ package com.yono.messeripos; ...@@ -3,12 +3,14 @@ package com.yono.messeripos;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.view.View; import android.view.View;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.TextView; import android.widget.TextView;
import com.google.android.material.appbar.MaterialToolbar; import com.google.android.material.appbar.MaterialToolbar;
import com.google.android.material.button.MaterialButton;
import com.google.android.material.textfield.TextInputEditText; import com.google.android.material.textfield.TextInputEditText;
import java.text.NumberFormat; import java.text.NumberFormat;
...@@ -19,6 +21,7 @@ public class CartActivity extends AppCompatActivity { ...@@ -19,6 +21,7 @@ public class CartActivity extends AppCompatActivity {
ImageButton btMinus, btPlus, btDelete; ImageButton btMinus, btPlus, btDelete;
TextInputEditText tiQty; TextInputEditText tiQty;
TextView tvQtyView, tvPrice, tvTotal; TextView tvQtyView, tvPrice, tvTotal;
MaterialButton btnCheckout;
public int counter, prices; public int counter, prices;
...@@ -37,6 +40,7 @@ public class CartActivity extends AppCompatActivity { ...@@ -37,6 +40,7 @@ public class CartActivity extends AppCompatActivity {
btMinus = findViewById(R.id.btMinus); btMinus = findViewById(R.id.btMinus);
btPlus = findViewById(R.id.btPlus); btPlus = findViewById(R.id.btPlus);
btDelete = findViewById(R.id.btDelete); btDelete = findViewById(R.id.btDelete);
btnCheckout = findViewById(R.id.btCheckout);
tiQty = findViewById(R.id.etQty); tiQty = findViewById(R.id.etQty);
tvQtyView = findViewById(R.id.tvQuantity); tvQtyView = findViewById(R.id.tvQuantity);
...@@ -73,6 +77,14 @@ public class CartActivity extends AppCompatActivity { ...@@ -73,6 +77,14 @@ public class CartActivity extends AppCompatActivity {
countTotal(); countTotal();
} }
}); });
btnCheckout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(CartActivity.this, PaymentActivity.class));
finish();
}
});
} }
private void countTotal() { private void countTotal() {
......
package com.yono.messeripos; package com.yono.messeripos;
import android.app.Notification;
import android.content.Intent; import android.content.Intent;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
...@@ -11,6 +12,7 @@ import android.view.WindowManager; ...@@ -11,6 +12,7 @@ import android.view.WindowManager;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
import androidx.core.app.NotificationCompat;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.databinding.DataBindingUtil; import androidx.databinding.DataBindingUtil;
import androidx.lifecycle.Observer; import androidx.lifecycle.Observer;
......
...@@ -36,6 +36,7 @@ public class PaymentActivity extends AppCompatActivity { ...@@ -36,6 +36,7 @@ public class PaymentActivity extends AppCompatActivity {
LinearLayoutManager llm = new LinearLayoutManager(this); LinearLayoutManager llm = new LinearLayoutManager(this);
rvPayment.setLayoutManager(llm); rvPayment.setLayoutManager(llm);
paymentResponses.add(new PaymentResponse("https://i.ibb.co/RjJQT9K/BNI-logo.png", "cash"));
paymentResponses.add(new PaymentResponse("https://i.ibb.co/XCsdmmT/Bank-Mandiri-logo.png", "mandiri")); paymentResponses.add(new PaymentResponse("https://i.ibb.co/XCsdmmT/Bank-Mandiri-logo.png", "mandiri"));
paymentResponses.add(new PaymentResponse("https://i.ibb.co/2n65nCT/bca-bank-central-asia.png", "bca")); paymentResponses.add(new PaymentResponse("https://i.ibb.co/2n65nCT/bca-bank-central-asia.png", "bca"));
paymentResponses.add(new PaymentResponse("https://i.ibb.co/RjJQT9K/BNI-logo.png", "bni")); paymentResponses.add(new PaymentResponse("https://i.ibb.co/RjJQT9K/BNI-logo.png", "bni"));
......
...@@ -2,9 +2,9 @@ package com.yono.messeripos; ...@@ -2,9 +2,9 @@ package com.yono.messeripos;
import android.content.Context; import android.content.Context;
import com.google.android.material.appbar.MaterialToolbar;
public class ToolbarApp { public class ToolbarApp {
public ToolbarApp(Context context, int toolbar, String title) {
}
} }
...@@ -55,9 +55,15 @@ public class CategoryAdapter extends RecyclerView.Adapter<CategoryAdapter.MyView ...@@ -55,9 +55,15 @@ public class CategoryAdapter extends RecyclerView.Adapter<CategoryAdapter.MyView
super(itemView.getRoot()); super(itemView.getRoot());
this.binding = itemView; this.binding = itemView;
} }
public void binData(CategoryModels categoryModels){ public void binData(CategoryModels categoryModels){
binding.setCategory(categoryModels); binding.setCategory(categoryModels);
binding.cvCategory.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
binding.cvCategory.toggle();
}
});
} }
} }
} }
...@@ -6,6 +6,7 @@ import android.util.Log; ...@@ -6,6 +6,7 @@ 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.Toast;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.cardview.widget.CardView; import androidx.cardview.widget.CardView;
...@@ -77,6 +78,7 @@ public class PaymentAdapter extends RecyclerView.Adapter<PaymentAdapter.ViewHold ...@@ -77,6 +78,7 @@ public class PaymentAdapter extends RecyclerView.Adapter<PaymentAdapter.ViewHold
public class ViewHolder extends RecyclerView.ViewHolder { public class ViewHolder extends RecyclerView.ViewHolder {
MaterialCardView cardView; MaterialCardView cardView;
PaymentListBinding binding; PaymentListBinding binding;
public int position;
public ViewHolder(@NonNull PaymentListBinding view) { public ViewHolder(@NonNull PaymentListBinding view) {
super(view.getRoot()); super(view.getRoot());
this.binding = view; this.binding = view;
...@@ -90,6 +92,15 @@ public class PaymentAdapter extends RecyclerView.Adapter<PaymentAdapter.ViewHold ...@@ -90,6 +92,15 @@ public class PaymentAdapter extends RecyclerView.Adapter<PaymentAdapter.ViewHold
binding.setPayment(paymentResponse); binding.setPayment(paymentResponse);
binding.setLogo(paymentResponse.getUrl()); binding.setLogo(paymentResponse.getUrl());
Log.d("Position ", ""+getAdapterPosition());
binding.cvPayment.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Log.d("Click VC", paymentResponse.getBank());
binding.cvPayment.toggle();
}
});
} }
} }
} }
<vector android:height="24dp" android:tint="#FC151B"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M18,16v-5c0,-3.07 -1.64,-5.64 -4.5,-6.32L13.5,4c0,-0.83 -0.67,-1.5 -1.5,-1.5s-1.5,0.67 -1.5,1.5v0.68C7.63,5.36 6,7.92 6,11v5l-2,2v1h16v-1l-2,-2zM13,16h-2v-2h2v2zM13,12h-2L11,8h2v4zM12,22c1.1,0 2,-0.9 2,-2h-4c0,1.1 0.89,2 2,2z"/>
</vector>
...@@ -11,9 +11,11 @@ ...@@ -11,9 +11,11 @@
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_height="40dp" android:layout_height="40dp"
android:layout_width="wrap_content"> android:layout_width="wrap_content"
android:layout_marginEnd="5dp">
<com.google.android.material.card.MaterialCardView <com.google.android.material.card.MaterialCardView
android:id="@+id/cvCategory"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:backgroundTint="@color/ic_launcher_background" android:backgroundTint="@color/ic_launcher_background"
......
...@@ -21,11 +21,14 @@ ...@@ -21,11 +21,14 @@
<com.google.android.material.card.MaterialCardView <com.google.android.material.card.MaterialCardView
android:id="@+id/cvPayment" android:id="@+id/cvPayment"
android:clickable="true"
android:focusable="true"
android:checkable="true"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="match_parent" android:layout_width="match_parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:strokeWidth="1dp" app:strokeWidth="1dp"
app:strokeColor="#22333333"> app:strokeColor="@color/color_stroke">
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -64,16 +67,6 @@ ...@@ -64,16 +67,6 @@
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
/> />
<com.google.android.material.radiobutton.MaterialRadioButton
android:id="@+id/rbPayment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:enabled="false"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="@id/ivLogo"
app:layout_constraintTop_toTopOf="@id/ivLogo"/>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView> </com.google.android.material.card.MaterialCardView>
......
...@@ -4,4 +4,5 @@ ...@@ -4,4 +4,5 @@
<color name="colorPrimaryDark">#3498DB</color> <color name="colorPrimaryDark">#3498DB</color>
<color name="colorAccent">#0f4c75</color> <color name="colorAccent">#0f4c75</color>
<color name="colorWhite">#fff</color> <color name="colorWhite">#fff</color>
<color name="color_stroke">#22333333</color>
</resources> </resources>
\ 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