Commit 083bfeb8 authored by Wahyu Wibowo's avatar Wahyu Wibowo

merging with abi

parents c81ee0c6 5500bf2e
......@@ -29,6 +29,7 @@
<activity
android:name=".activities.CartActivity"
android:theme="@style/AppTheme2" />
<<<<<<< HEAD
<activity android:name=".activities.MainActivity" android:theme="@style/AppTheme2"/>
<activity android:name=".activities.ProductActivity" android:theme="@style/AppTheme2"/>
......@@ -42,6 +43,11 @@
android:resource="@xml/file_path"/>
</provider>
=======
<activity android:name=".activities.MainActivity"/>
<activity android:name=".activities.ProductActivity"/>
<activity android:name=".activities.LoginActivity"/>
>>>>>>> 5500bf2eb4a0f6bfbdc181bfe395dd5e256a1959
<meta-data
android:name="preloaded_fonts"
android:resource="@array/preloaded_fonts" />
......
......@@ -12,11 +12,13 @@ import com.example.yourcashiertest.R;
public class CartActivity extends AppCompatActivity {
ImageView btnBack;
Button btnCheckout;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_cart);
btnCheckout = findViewById(R.id.btnCheckout);
btnBack = findViewById(R.id.ivBtnBack);
btnBack.setOnClickListener(new View.OnClickListener() {
@Override
......@@ -24,5 +26,12 @@ public class CartActivity extends AppCompatActivity {
startActivity(new Intent(CartActivity.this, MainActivity.class));
}
});
btnCheckout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(CartActivity.this, PaymentActivity.class));
}
});
}
}
\ No newline at end of file
......@@ -5,13 +5,14 @@ import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;
import com.example.yourcashiertest.R;
import com.google.android.material.button.MaterialButton;
import com.google.android.material.textfield.TextInputEditText;
public class LoginActivity extends AppCompatActivity {
TextInputEditText etUsername;
TextInputEditText etUsername, etPassword;
MaterialButton btnLogin;
@Override
......@@ -19,6 +20,7 @@ public class LoginActivity extends AppCompatActivity {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
etPassword = findViewById(R.id.etPassword);
etUsername = findViewById(R.id.etUsername);
btnLogin = findViewById(R.id.btnLogin);
......@@ -29,6 +31,17 @@ public class LoginActivity extends AppCompatActivity {
intent.putExtra("username", etUsername.getText().toString());
startActivity(intent);
finish();
if(etUsername.getText().toString().length() == 0 || etPassword.getText().toString().length() == 0){
Toast.makeText(getApplicationContext(), "Please input Username and Password", Toast.LENGTH_SHORT).show();
}else if(!etPassword.getText().toString().matches("[A-Za-z0-9]+")){
etPassword.setError("Passwords can only contain Alphanumeric");
}else if(etPassword.getText().toString().length() < 8) {
etPassword.setError("Password length cannot be less than 8 characters");
}else{
finish();
startActivity(intent);
}
}
});
......
......@@ -6,14 +6,11 @@ import androidx.databinding.DataBindingUtil;
import androidx.lifecycle.ViewModelProvider;
import android.Manifest;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageView;
import android.widget.PopupMenu;
import com.example.yourcashiertest.R;
......
......@@ -14,7 +14,7 @@ public class SplashActivity extends AppCompatActivity {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
new Handler(Looper.getMainLooper()).postDelayed(() -> {
startActivity(new Intent(this, MainActivity.class));
startActivity(new Intent(this, LoginActivity.class));
finish();
}, 3000);
}
......
......@@ -19,7 +19,10 @@ import java.util.List;
public class ProductAdapter extends RecyclerView.Adapter<ProductAdapter.ViewHolder> {
private List<Product> products = new ArrayList<>();
<<<<<<< HEAD
private Boolean visibility;
=======
>>>>>>> 5500bf2eb4a0f6bfbdc181bfe395dd5e256a1959
public interface ProductListener {
void onUpdate(Product product);
......@@ -45,7 +48,11 @@ public class ProductAdapter extends RecyclerView.Adapter<ProductAdapter.ViewHold
return new ViewHolder(
DataBindingUtil.inflate(
LayoutInflater.from(parent.getContext()),
<<<<<<< HEAD
R.layout.item_list,
=======
R.layout.item_product,
>>>>>>> 5500bf2eb4a0f6bfbdc181bfe395dd5e256a1959
parent,
false
)
......@@ -55,7 +62,10 @@ public class ProductAdapter extends RecyclerView.Adapter<ProductAdapter.ViewHold
@Override
public void onBindViewHolder(@NonNull ProductAdapter.ViewHolder holder, int position) {
holder.bindData(products.get(position), listener);
<<<<<<< HEAD
holder.binding.setVisibility(visibility);
=======
>>>>>>> 5500bf2eb4a0f6bfbdc181bfe395dd5e256a1959
}
@Override
......@@ -65,7 +75,11 @@ public class ProductAdapter extends RecyclerView.Adapter<ProductAdapter.ViewHold
public static class ViewHolder extends RecyclerView.ViewHolder {
private ItemListBinding binding;
<<<<<<< HEAD
private Boolean visibility;
=======
>>>>>>> 5500bf2eb4a0f6bfbdc181bfe395dd5e256a1959
public ViewHolder(@NonNull ItemListBinding binding) {
super(binding.getRoot());
......@@ -90,9 +104,12 @@ public class ProductAdapter extends RecyclerView.Adapter<ProductAdapter.ViewHold
binding.ivDelete.setOnClickListener(view -> listener.onDelete(product));
}
}
<<<<<<< HEAD
public void setVisibility(Boolean visibility){
this.visibility = visibility;
}
=======
>>>>>>> 5500bf2eb4a0f6bfbdc181bfe395dd5e256a1959
}
\ No newline at end of file
......@@ -32,7 +32,11 @@ public abstract class LocalDatabase extends RoomDatabase {
synchronized (LocalDatabase.class) {
if (INSTANCE == null) {
INSTANCE = Room.databaseBuilder(context.getApplicationContext(),
<<<<<<< HEAD
LocalDatabase.class, "yourcashier_database")
=======
LocalDatabase.class, "pasarindo_database")
>>>>>>> 5500bf2eb4a0f6bfbdc181bfe395dd5e256a1959
.build();
}
}
......
......@@ -13,7 +13,6 @@ import com.bumptech.glide.Glide;
import com.example.yourcashiertest.R;
import java.io.File;
@Entity(tableName = "products")
public class Product implements Parcelable {
......@@ -22,7 +21,6 @@ public class Product implements Parcelable {
private long price, quantity;
private String photo = "", name = "", description = "", category = "";
public Product(String photo, String name, long price, long quantity, String description, String category) {
this.price = price;
this.quantity = quantity;
......
......@@ -6,7 +6,11 @@
android:radius="200dp"/>
<stroke
<<<<<<< HEAD
android:width="0.5dp"
=======
android:width="10dp"
>>>>>>> 5500bf2eb4a0f6bfbdc181bfe395dd5e256a1959
android:color="#FFFFFF" />
<solid android:color="@color/color_white" />
......
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<gradient android:endColor="@color/colorPrimary" android:startColor="@color/white" android:angle="90"/>
</shape>
</item>
</selector>
\ No newline at end of file
......@@ -90,7 +90,7 @@
app:layout_constraintVertical_bias="0.071" />
<Button
android:id="@+id/button"
android:id="@+id/btnCheckout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/checkout"
......
......@@ -127,6 +127,5 @@
app:layoutManager="androidx.recyclerview.widget.StaggeredGridLayoutManager"
app:spanCount="2"
tools:ignore="MissingConstraints" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
\ No newline at end of file
</layout>
......@@ -4,111 +4,159 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="12dp"
tools:context=".activities.PaymentActivity">
<!-- Payment -->
<TextView
android:id="@+id/payment"
<com.google.android.material.textview.MaterialTextView
android:id="@+id/tvPayment"
android:layout_width="108dp"
android:layout_height="28dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_height="wrap_content"
android:gravity="top"
android:text="@string/payment"
android:textAppearance="@style/payment"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintBottom_toTopOf="@id/cvCash"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.115"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.044" />
app:layout_constraintVertical_bias="0.105" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/tvTotal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:elegantTextHeight="true"
android:gravity="center"
android:text="Rp. 500.000"
android:textSize="24dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.902"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvPayment"
app:layout_constraintVertical_bias="0.0" />
<com.google.android.material.card.MaterialCardView
android:layout_width="340dp"
android:id="@+id/cvCash"
android:layout_width="match_parent"
android:layout_height="100dp"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginTop="20dp"
android:clickable="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/payment"
app:layout_constraintVertical_bias="0.04000002">
app:layout_constraintTop_toBottomOf="@+id/tvTotal">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/iv_cash"
android:layout_width="wrap_content"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:src="@drawable/wallet"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.8"
tools:srcCompat="@tools:sample/avatars" />
app:layout_constraintVertical_bias="0.8" />
<TextView
android:id="@+id/cash"
android:layout_width="138dp"
android:layout_height="33dp"
android:gravity="center"
android:text="@string/cash"
android:textAppearance="@style/cash"
app:layout_constraintBottom_toBottomOf="@+id/iv_cash"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.189"
app:layout_constraintHorizontal_bias="0.324"
app:layout_constraintStart_toEndOf="@+id/iv_cash"
app:layout_constraintTop_toTopOf="@+id/iv_cash"
app:layout_constraintVertical_bias="0.0" />
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.507" />
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.card.MaterialCardView
android:id="@+id/cvCard"
android:layout_width="match_parent"
android:layout_height="100dp"
android:clickable="true"
android:layout_marginTop="20dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/cvCash"
app:layout_constraintVertical_bias="0.04000002">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/iv_card"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:src="@drawable/credit_card"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.8" />
<TextView
android:id="@+id/rp_500_000"
android:id="@+id/card"
android:layout_width="138dp"
android:layout_height="33dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:gravity="top"
android:text="@string/rp_500_000"
android:textAppearance="@style/rp_500_000"
app:layout_constraintBottom_toBottomOf="@+id/iv_cash"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.193"
app:layout_constraintStart_toEndOf="@+id/iv_cash"
app:layout_constraintTop_toBottomOf="@+id/cash"
app:layout_constraintVertical_bias="0.145" />
<View
android:id="@+id/rectangle_2"
android:layout_width="96dp"
android:layout_height="44dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:background="@drawable/rectangle_2"
android:backgroundTint="#45E1D1"
android:gravity="center"
android:text="@string/card"
android:textAppearance="@style/cash"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/rp_500_000"
app:layout_constraintVertical_bias="1.0" />
app:layout_constraintHorizontal_bias="0.324"
app:layout_constraintStart_toEndOf="@+id/iv_card"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.507" />
<TextView
android:id="@+id/pay"
android:layout_width="wrap_content"
android:layout_height="23dp"
android:text="@string/pay"
android:textAppearance="@style/pay"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@+id/rectangle_2"
app:layout_constraintEnd_toEndOf="@+id/rectangle_2"
app:layout_constraintStart_toStartOf="@+id/rectangle_2"
app:layout_constraintTop_toTopOf="@+id/rectangle_2" />
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.textview.MaterialTextView
android:id="@+id/tvAmountPaid"
android:layout_width="100dp"
android:layout_height="30dp"
android:layout_marginTop="208dp"
android:layout_marginBottom="90dp"
android:gravity="start"
android:text="Amount paid"
app:layout_constraintBottom_toTopOf="@id/etAmountPaid"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cvCard" />
<EditText
android:id="@+id/etAmountPaid"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="40dp"
android:gravity="center"
app:layout_constraintBottom_toTopOf="@id/btnPay"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.333"
app:layout_constraintStart_toStartOf="parent" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btnPay"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="PAY"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
tools:layout_editor_absoluteX="16dp"
tools:layout_editor_absoluteY="654dp" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -4,7 +4,6 @@
xmlns:tools="http://schemas.android.com/tools">
<data>
<variable
name="viewModel"
type="com.example.yourcashiertest.viewmodels.ProductViewModel" />
......@@ -20,10 +19,7 @@
android:id="@+id/tvHeadProduct"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/space_default"
android:fontFamily="@font/carter_one"
android:text="ADD PRODUCT"
android:textSize="24dp" />
android:layout_margin="@dimen/space_default"/>
<ScrollView
android:layout_width="match_parent"
......
......@@ -6,7 +6,7 @@
android:id="@+id/splash_scre"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/splash_scre"
android:background="@drawable/splash2"
tools:context=".activities.SplashActivity">
<ImageView
android:id="@+id/ivLogo"
......
......@@ -16,7 +16,6 @@
<variable
name="visibility"
type="Boolean" />
</data>
<com.google.android.material.card.MaterialCardView
......
......@@ -14,13 +14,17 @@
<string name="items">3 items</string>
<string name="payment">Payment</string>
<string name="cash">Cash</string>
<string name="card">Card</string>
<string name="rp_500_000">Rp. 500.000</string>
<string name="pay">Pay</string>
<string name="checkout">Checkout</string>
<string name="deskripsi">Burger medium with tomato and meet.</string>
<string name="name">Burger Medium</string>
<string name="price">$600.00</string>
<<<<<<< HEAD
<string name="btn_edit">Update Product</string>
<string name="form_error_message">Nama produk, harga, deskripsi, quantity tidak boleh kosong</string>
<string name="add_product">Tambah Produk</string>
=======
>>>>>>> 5500bf2eb4a0f6bfbdc181bfe395dd5e256a1959
</resources>
\ No newline at end of file
......@@ -11,7 +11,7 @@
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="colorAccent">#333</item>
</style>
<style name="burger_medi">
......@@ -65,7 +65,7 @@
<style name="payment">
<item name="android:textSize">
24sp
27sp
</item>
<item name="android:textColor">
......
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