Commit 64bfc353 authored by iman Fauzi's avatar iman Fauzi

Merge branch 'dev' into cart

parents 9c1fea8b 5cb7044d
<?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
......@@ -8,13 +8,18 @@ import android.view.MenuItem;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Toast;
import android.widget.Toolbar;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.appbar.MaterialToolbar;
public class MainActivity extends AppCompatActivity {
MaterialToolbar toolbar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
......@@ -25,28 +30,18 @@ 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 = findViewById(R.id.topAppBar);
toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.home, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
public boolean onMenuItemClick(MenuItem item) {
int id = item.getItemId();
Log.i("Item seleced", ""+item.getItemId());
if (id == R.id.menu_cart){
Toast.makeText(MainActivity.this, "Pesan cart", Toast.LENGTH_LONG).show();
}else if (id == R.id.update){
Toast.makeText(MainActivity.this, "Pesan cart", Toast.LENGTH_LONG).show();
}
return super.onOptionsItemSelected(item);
return true;
}
});
}
}
\ No newline at end of file
<vector android:height="24dp" android:tint="#D6D6D6"
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="M15.5,14h-0.79l-0.28,-0.27C15.41,12.59 16,11.11 16,9.5 16,5.91 13.09,3 9.5,3S3,5.91 3,9.5 5.91,16 9.5,16c1.61,0 3.09,-0.59 4.23,-1.57l0.27,0.28v0.79l5,4.99L20.49,19l-4.99,-5zM9.5,14C7.01,14 5,11.99 5,9.5S7.01,5 9.5,5 14,7.01 14,9.5 11.99,14 9.5,14z"/>
</vector>
......@@ -6,55 +6,52 @@
android:layout_height="match_parent"
tools:context=".MainActivity">
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:elevation="0dp"
android:theme="@style/AppTheme.AppBarOverlay"
android:fitsSystemWindows="true"
tools:ignore="MissingConstraints">
<androidx.appcompat.widget.Toolbar
android:id="@+id/app_bar"
style="@style/Widget.Toolbar"
android:paddingStart="15dp">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/topAppBar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:paddingStart="12dp"
android:paddingLeft="12dp"
android:paddingEnd="12dp"
android:paddingRight="12dp"
app:contentInsetStart="0dp"
android:layout_marginTop="15dp"
android:fitsSystemWindows="true"
android:layout_height="wrap_content"
app:menu="@menu/home"
app:navigationIcon="@mipmap/ic_launcher_round"
app:popupTheme="@style/AppTheme.PopupOverlay">
android:elevation="0dp"
app:navigationIcon="@drawable/ic_meser"
android:layout_marginTop="20dp"
style="@style/Widget.MaterialComponents.Toolbar.Primary"
>
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.TextInputLayout"
android:id="@+id/password"
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:textColor="#fff"
android:hint="Search"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintVertical_bias="0.11">
android:paddingStart="10dp"
android:textColorHint="#fff"
android:outlineSpotShadowColor="#fff"
android:textColorHighlight="#fff"
android:drawableStart="@drawable/ic_baseline_search_24"/>
</com.google.android.material.appbar.MaterialToolbar>
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text"
android:imeOptions="actionSearch"
android:fitsSystemWindows="true"
android:background="#fff"
android:maxLines="1" />
</com.google.android.material.textfield.TextInputLayout>
</androidx.appcompat.widget.Toolbar>
</com.google.android.material.appbar.AppBarLayout>
<!-- Note: A RecyclerView can also be used -->
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<!-- Scrollable content -->
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</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