Commit 0a5f2e73 authored by Alfansyah Fadlian's avatar Alfansyah Fadlian

Merge branch 'cart' of https://git.mdd.co.id:44195/muhammadsuryono/meser into dashboard2

parents baa6fb25 77e8387e
......@@ -11,7 +11,7 @@
android:roundIcon="@mipmap/ic_launcher"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".PaymentActivity"></activity>
<activity android:name=".PaymentActivity" android:theme="@style/AppTheme.appbar"></activity>
<activity android:name=".CartActivity" />
<activity android:name=".SplashScreen">
<intent-filter>
......
......@@ -2,6 +2,7 @@ package com.yono.messeripos;
import androidx.appcompat.app.AppCompatActivity;
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageButton;
......@@ -18,7 +19,7 @@ public class CartActivity extends AppCompatActivity {
TextInputEditText tiQty;
TextView tvQtyView, tvPrice, tvTotal;
private int counter;
public int counter, prices;
@Override
protected void onCreate(Bundle savedInstanceState) {
......@@ -35,8 +36,12 @@ public class CartActivity extends AppCompatActivity {
tvTotal = findViewById(R.id.tvTotal);
counter = Integer.parseInt(tvQtyView.getText().toString());
prices = Integer.parseInt(tvPrice.getText().toString());
tvTotal.setText(setToRp().format((double) Integer.parseInt(tvTotal.getText().toString())));
btMinus.setOnClickListener(new View.OnClickListener() {
@SuppressLint("SetTextI18n")
@Override
public void onClick(View view) {
if (counter > 1){
......@@ -46,11 +51,11 @@ public class CartActivity extends AppCompatActivity {
countTotal();
}
}
});
btPlus.setOnClickListener(new View.OnClickListener() {
@SuppressLint("SetTextI18n")
@Override
public void onClick(View view) {
counter++;
......@@ -63,19 +68,22 @@ public class CartActivity extends AppCompatActivity {
}
private void countTotal() {
int price = Integer.parseInt(tvPrice.getText().toString());
int price = prices;
int qtyView = Integer.parseInt(tvQtyView.getText().toString());
int count = price*qtyView;
String result = Integer.toString(price*qtyView);
// String result = Integer.toString(price*qtyView);
// set to view
tvTotal.setText(setToRp().format((double) count));
}
public void setRp() {
}
private NumberFormat setToRp() {
Locale ID = new Locale("in", "ID");
NumberFormat formatRp = NumberFormat.getCurrencyInstance(ID);
return formatRp;
return NumberFormat.getCurrencyInstance(ID);
}
}
\ No newline at end of file
......@@ -39,7 +39,8 @@ public class MainActivity extends AppCompatActivity {
int id = item.getItemId();
if (id == R.id.menu_cart){
startActivity(new Intent(MainActivity.this, CartActivity.class));
startActivity(new Intent(getApplicationContext(), PaymentActivity.class));
Toast.makeText(MainActivity.this, "Pesan cart", Toast.LENGTH_LONG).show();
}
return true;
}
......
......@@ -5,7 +5,9 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.os.Bundle;
import android.widget.Toolbar;
import com.google.android.material.appbar.MaterialToolbar;
import com.yono.messeripos.adapter.PaymentAdapter;
import com.yono.messeripos.response.PaymentResponse;
......@@ -14,12 +16,21 @@ import java.util.ArrayList;
public class PaymentActivity extends AppCompatActivity {
private ArrayList<PaymentResponse> paymentResponses = new ArrayList<>();
MaterialToolbar toolbars;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_payment);
MaterialToolbar toolbars = findViewById(R.id.appbar);
setSupportActionBar(toolbars);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setTitle("Payment");
toolbars.setNavigationOnClickListener(view -> onBackPressed());
RecyclerView rvPayment = findViewById(R.id.rvPayment);
LinearLayoutManager llm = new LinearLayoutManager(this);
......
//package com.yono.messeripos;
//
//import android.content.Context;
//
//import androidx.appcompat.app.AppCompatActivity;
//
//import com.google.android.material.appbar.MaterialToolbar;
//
//public class ToolbarApp {
//
// public ToolbarApp(Context context, int toolbar, String title) {
//
// MaterialToolbar toolbars = findViewById(toolbar);
// setSupportActionBar(toolbars);
// getSupportActionBar().setDisplayHomeAsUpEnabled(true);
// getSupportActionBar().setDisplayShowHomeEnabled(true);
// getSupportActionBar().setTitle(title);
// }
//}
package com.yono.messeripos.adapter;
import android.annotation.SuppressLint;
import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.cardview.widget.CardView;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.button.MaterialButton;
import androidx.databinding.DataBindingUtil;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.card.MaterialCardView;
import com.yono.messeripos.PaymentActivity;
import com.yono.messeripos.response.PaymentResponse;
import com.yono.messeripos.R;
......@@ -29,6 +36,11 @@ public class PaymentAdapter extends RecyclerView.Adapter<PaymentAdapter.ViewHold
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
// View view = LayoutInflater.from(parent.getContext())
// .inflate(R.layout.payment_list, parent, false);
//
// return new ViewHolder(view);
PaymentListBinding paymentListBinding = DataBindingUtil.inflate(
LayoutInflater.from(parent.getContext()),
R.layout.payment_list,
......@@ -45,7 +57,6 @@ public class PaymentAdapter extends RecyclerView.Adapter<PaymentAdapter.ViewHold
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
holder.binData(paymentResponses.get(position));
// holder.cardView.setTag(position);
// holder.radioButton.setChecked(position == getPosition);
// final PaymentModel paymentModel = paymentModels.get(position);
//
......@@ -57,23 +68,28 @@ public class PaymentAdapter extends RecyclerView.Adapter<PaymentAdapter.ViewHold
// .into(imageView);
}
@Override
public int getItemCount() {
return paymentResponses.size();
}
public class ViewHolder extends RecyclerView.ViewHolder {
MaterialCardView cardView;
PaymentListBinding binding;
public ViewHolder(@NonNull PaymentListBinding view) {
super(view.getRoot());
this.binding = view;
getPosition = getAdapterPosition();
Log.d("ViewHolder: ", String.valueOf(cardView));
}
@SuppressLint("ResourceAsColor")
public void binData(PaymentResponse paymentResponse){
binding.setPayment(paymentResponse);
}
binding.setLogo(paymentResponse.getUrl());
}
}
}
package com.yono.messeripos.response;
import android.widget.ImageView;
import androidx.databinding.BindingAdapter;
import com.bumptech.glide.Glide;
public class PaymentResponse {
private String url;
private String bank;
private boolean isSelected;
public boolean isSelected() {
return isSelected;
}
public void setSelected(boolean selected) {
isSelected = selected;
}
public PaymentResponse(String url, String bank) {
this.url = url;
......@@ -25,4 +40,11 @@ public class PaymentResponse {
public void setBank(String bank) {
this.bank = bank;
}
@BindingAdapter("logo_bank")
public static void loadImage(ImageView view, String url) {
Glide.with(view.getContext())
.load(url)
.into(view);
}
}
\ No newline at end of file
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>
......@@ -3,10 +3,10 @@
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<group android:scaleX="0.89914566"
android:scaleY="0.89914566"
android:translateX="26.61"
android:translateY="35.042187">
<group android:scaleX="0.92268676"
android:scaleY="0.92268676"
android:translateX="25.62"
android:translateY="34.272957">
<path
android:pathData="M8.5,28.182m-8.5,0a8.5,8.5 0,1 1,17 0a8.5,8.5 0,1 1,-17 0"
android:fillColor="#fff"/>
......
......@@ -4,14 +4,22 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp"
tools:context=".PaymentActivity">
<include
android:id="@+id/appbar"
layout="@layout/app_bar"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvPayment"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintTop_toTopOf="parent" />
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/appbar"/>
<com.google.android.material.button.MaterialButton
android:id="@+id/btnPay"
......
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/topAppBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="0dp"
style="@style/Widget.MaterialComponents.Toolbar.Primary"
xmlns:android="http://schemas.android.com/apk/res/android">
</com.google.android.material.appbar.MaterialToolbar>
......@@ -8,6 +8,10 @@
<variable
name="payment"
type="com.yono.messeripos.response.PaymentResponse" />
<variable
name="logo"
type="String" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
......@@ -45,6 +49,7 @@
android:layout_width="131dp"
android:layout_height="39dp"
android:src="@drawable/ic_bni_logo"
app:logo_bank="@{logo}"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
......
......@@ -2,5 +2,5 @@
<adaptive-icon
xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_meser"/>
<foreground android:drawable="@drawable/ic_launcher_new_icon_foreground"/>
</adaptive-icon>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_new_icon_foreground"/>
</adaptive-icon>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_new_icon_foreground"/>
</adaptive-icon>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_meser"/>
<foreground android:drawable="@drawable/ic_launcher_new_icon_foreground"/>
</adaptive-icon>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_new_icon_background">#5B4CFF</color>
</resources>
\ No newline at end of file
......@@ -14,6 +14,12 @@
<item name="actionBarStyle">@style/ThemeActionBar</item>
</style>
<style name="AppTheme.appbar" parent="Theme.MaterialComponents.Light.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="ThemeActionBar" parent="Widget.MaterialComponents.Light.ActionBar.Solid">
<item name="android:background"> @null </item>
<!-- Support library compatibility -->
......
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