Commit 9d892f4e authored by iman Fauzi's avatar iman Fauzi

update

parent abd5c081
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
......
......@@ -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
......@@ -25,7 +25,7 @@ public class MainActivity extends AppCompatActivity {
w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
}
Toolbar toolbar = findViewById(R.id.app_bar);
// Toolbar toolbar = findViewById(R.id.app_bar);
}
@Override
......
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