Commit ae15cf50 authored by Wahyu Wibowo's avatar Wahyu Wibowo

fix main layout

parents 15dfc1de d7d90432
......@@ -23,7 +23,7 @@
android:name=".activities.CartActivity"
android:theme="@style/AppTheme2" />
<activity android:name=".activities.MainActivity" android:theme="@style/AppTheme2"/>
<activity android:name=".activities.ProductActivity" android:theme="@style/AppTheme2"/>
<meta-data
android:name="preloaded_fonts"
android:resource="@array/preloaded_fonts" />
......
......@@ -2,15 +2,27 @@ package com.example.yourcashiertest.activities;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import com.example.yourcashiertest.R;
public class CartActivity extends AppCompatActivity {
ImageView btnBack;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_cart);
btnBack = findViewById(R.id.ivBtnBack);
btnBack.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(CartActivity.this, MainActivity.class));
}
});
}
}
\ No newline at end of file
......@@ -2,7 +2,13 @@ package com.example.yourcashiertest.activities;
import androidx.appcompat.app.AppCompatActivity;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageView;
import android.widget.PopupMenu;
import com.example.yourcashiertest.R;
......@@ -12,5 +18,29 @@ public class MainActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ImageView iv_settings, ivCart;
ivCart = findViewById(R.id.ivCart);
iv_settings = findViewById(R.id.iv_settings);
ivCart.setOnClickListener(view -> startActivity(new Intent(MainActivity.this, CartActivity.class)));
iv_settings.setOnClickListener(view -> {
PopupMenu popupMenu = new PopupMenu(getApplicationContext(), iv_settings);
popupMenu.setOnMenuItemClickListener(item -> {
switch (item.getItemId()) {
case R.id.item_one:
// item one clicked
startActivity(new Intent(MainActivity.this, ProductActivity.class));
break;
case R.id.item_two:
// item two clicked
return true;
}
return false;
});
popupMenu.inflate(R.menu.settings_menu);
popupMenu.show();
});
}
}
\ No newline at end of file
package com.example.yourcashiertest.adapters;
public class ProductAdapter {
import android.view.LayoutInflater;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.databinding.DataBindingUtil;
import androidx.recyclerview.widget.RecyclerView;
import com.example.yourcashiertest.R;
import com.example.yourcashiertest.databinding.ItemListBinding;
import com.example.yourcashiertest.entities.Product;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.ArrayList;
import java.util.List;
public class ProductAdapter extends RecyclerView.Adapter<ProductAdapter.ViewHolder> {
private List<Product> products = new ArrayList<>();
public interface ProductListener {
void onUpdate(Product product);
void onDelete(Product product);
}
private ProductListener listener;
public void setListener(ProductListener listener) {
this.listener = listener;
}
public void setProducts(List<Product> products) {
this.products = products;
notifyDataSetChanged();
}
@NonNull
@Override
public ProductAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new ViewHolder(
DataBindingUtil.inflate(
LayoutInflater.from(parent.getContext()),
R.layout.item_product,
parent,
false
)
);
}
@Override
public void onBindViewHolder(@NonNull ProductAdapter.ViewHolder holder, int position) {
holder.bindData(products.get(position), listener);
}
@Override
public int getItemCount() {
return products.size();
}
public static class ViewHolder extends RecyclerView.ViewHolder {
private ItemListBinding binding;
public ViewHolder(@NonNull ItemListBinding binding) {
super(binding.getRoot());
this.binding = binding;
}
public void bindData(Product product, ProductListener listener) {
binding.setProduct(product);
DecimalFormat rupiah = (DecimalFormat) DecimalFormat.getCurrencyInstance();
DecimalFormatSymbols format = new DecimalFormatSymbols();
format.setCurrencySymbol("Rp. ");
format.setMonetaryDecimalSeparator(',');
format.setGroupingSeparator('.');
rupiah.setDecimalFormatSymbols(format);
binding.setPrice(rupiah.format(product.getPrice()));
binding.ivUpdate.setOnClickListener(view -> listener.onUpdate(product));
binding.ivDelete.setOnClickListener(view -> listener.onDelete(product));
}
}
}
\ No newline at end of file
package com.example.yourcashiertest.daos;
import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;
import androidx.room.Update;
import com.example.yourcashiertest.entities.Product;
import java.util.List;
@Dao
public interface ProductDao {
@Query("SELECT * FROM products ORDER BY id DESC")
public LiveData<List<Product>> getProducts();
@Query("SELECT * FROM products WHERE name LIKE :query ORDER BY id DESC")
public LiveData<List<Product>> getFilteredProducts(String query);
@Insert(onConflict = OnConflictStrategy.IGNORE)
public void insertProduct(Product product);
@Update
public void updateProduct(Product product);
@Delete
public void deleteProduct(Product product);
}
package com.example.yourcashiertest.databases;
public class LocalDatabase {
import android.content.Context;
import androidx.annotation.NonNull;
import androidx.room.Database;
import androidx.room.DatabaseConfiguration;
import androidx.room.InvalidationTracker;
import androidx.room.Room;
import androidx.room.RoomDatabase;
import androidx.sqlite.db.SupportSQLiteOpenHelper;
import com.example.yourcashiertest.daos.ProductDao;
import com.example.yourcashiertest.entities.Product;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@Database(entities = {Product.class}, version = 1, exportSchema = false)
public abstract class LocalDatabase extends RoomDatabase {
public abstract ProductDao productDao();
private static volatile LocalDatabase INSTANCE;
private static final int NUMBER_OF_THREADS = 4;
public static final ExecutorService databaseWriteExecutor =
Executors.newFixedThreadPool(NUMBER_OF_THREADS);
public static LocalDatabase getDatabase(Context context) {
if (INSTANCE == null) {
synchronized (LocalDatabase.class) {
if (INSTANCE == null) {
INSTANCE = Room.databaseBuilder(context.getApplicationContext(),
LocalDatabase.class, "pasarindo_database")
.build();
}
}
}
return INSTANCE;
}
@NonNull
@Override
protected SupportSQLiteOpenHelper createOpenHelper(DatabaseConfiguration config) {
return null;
}
@NonNull
@Override
protected InvalidationTracker createInvalidationTracker() {
return null;
}
@Override
public void clearAllTables() {
}
}
\ No newline at end of file
......@@ -8,6 +8,7 @@ import androidx.room.PrimaryKey;
@Entity(tableName = "products")
public class Product implements Parcelable {
@PrimaryKey(autoGenerate = true)
private long id;
......@@ -46,6 +47,14 @@ public class Product implements Parcelable {
}
};
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public long getPrice() {
return price;
}
......
package com.example.yourcashiertest.repositories;
import android.app.Application;
import androidx.lifecycle.LiveData;
import com.example.yourcashiertest.daos.ProductDao;
import com.example.yourcashiertest.databases.LocalDatabase;
import com.example.yourcashiertest.entities.Product;
import java.util.List;
public class ProductRepository {
private ProductDao productDao;
private LiveData<List<Product>> products;
public ProductRepository(Application application) {
LocalDatabase db = LocalDatabase.getDatabase(application);
productDao = db.productDao();
products = productDao.getProducts();
}
public void insert(Product product) {
LocalDatabase.databaseWriteExecutor.execute(() -> productDao.insertProduct(product));
}
public void update(Product product) {
LocalDatabase.databaseWriteExecutor.execute(() -> productDao.updateProduct(product));
}
public void delete(Product product) {
LocalDatabase.databaseWriteExecutor.execute(() -> productDao.deleteProduct(product));
}
public LiveData<List<Product>> filteredProducts(String s) {
return productDao.getFilteredProducts(s);
}
}
package com.example.yourcashiertest.viewmodels;
public class ProductViewModel {
import android.app.Application;
import android.text.TextUtils;
import androidx.annotation.NonNull;
import androidx.lifecycle.AndroidViewModel;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.Transformations;
import com.example.yourcashiertest.entities.Product;
import com.example.yourcashiertest.repositories.ProductRepository;
import java.io.File;
import java.util.List;
public class ProductViewModel extends AndroidViewModel {
private MutableLiveData<String> photo = new MutableLiveData<>("");
private MutableLiveData<String> query = new MutableLiveData<>("%");
private MutableLiveData<Product> product = new MutableLiveData<>();
private LiveData<List<Product>> products;
private ProductRepository repository;
public void setPhoto(String photo) {
this.photo.setValue(photo);
}
public void setProduct(Product product) {
this.product.setValue(product);
}
public LiveData<String> getPhoto() {
return photo;
}
public LiveData<List<Product>> getProducts() {
return products;
}
public ProductViewModel(@NonNull Application application) {
super(application);
repository = new ProductRepository(application);
products = Transformations.switchMap(query, s -> repository.filteredProducts(s));
}
public void filter(String s) {
String query = TextUtils.isEmpty(s) ? "%" : "%" + s + "%";
this.query.postValue(query);
}
public void insertProduct(Product product) {
repository.insert(product);
}
public void updateProduct(Product product) {
repository.update(product);
}
public void deleteProduct(Product product) {
File photo = new File(product.getPhoto());
if (photo.exists() && photo.delete())
System.out.println("DELETED: " + product.getPhoto());
repository.delete(product);
}
public MutableLiveData<Product> getProduct() {
return product;
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<corners
android:radius="50dp"/>
<stroke
android:width="0.5dp"
android:color="#45E1D1" />
<solid android:color="#45E1D1" />
</shape>
\ No newline at end of file
......@@ -7,7 +7,7 @@
<stroke
android:width="0.5dp"
android:color="#D8CFCF" />
android:color="#FFFFFF" />
<solid android:color="@color/color_white" />
......
<vector android:height="24dp" android:tint="#FFFFFF"
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="M11,9h2L13,6h3L16,4h-3L13,1h-2v3L8,4v2h3v3zM7,18c-1.1,0 -1.99,0.9 -1.99,2S5.9,22 7,22s2,-0.9 2,-2 -0.9,-2 -2,-2zM17,18c-1.1,0 -1.99,0.9 -1.99,2s0.89,2 1.99,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM7.17,14.75l0.03,-0.12 0.9,-1.63h7.45c0.75,0 1.41,-0.41 1.75,-1.03l3.86,-7.01L19.42,4h-0.01l-1.1,2 -2.76,5L8.53,11l-0.13,-0.27L6.16,6l-0.95,-2 -0.94,-2L1,2v2h2l3.6,7.59 -1.35,2.45c-0.16,0.28 -0.25,0.61 -0.25,0.96 0,1.1 0.9,2 2,2h12v-2L7.42,15c-0.13,0 -0.25,-0.11 -0.25,-0.25z"/>
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="380"
android:viewportHeight="384">
<path
android:fillColor="@android:color/white"
android:pathData="M64,341.333C64,364.907 83.093,384 106.667,384h170.667C300.907,384 320,364.907 320,341.333v-256H64V341.333z" />
<path
android:fillColor="@android:color/white"
android:pathData="M266.667,21.333l-21.334,-21.333l-106.666,0l-21.334,21.333l-74.666,0l0,42.667l298.666,0l0,-42.667z" />
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="348.882"
android:viewportHeight="348.882">
<path
android:fillColor="@android:color/white"
android:pathData="M333.988,11.758l-0.42,-0.383C325.538,4.04 315.129,0 304.258,0c-12.187,0 -23.888,5.159 -32.104,14.153L116.803,184.231c-1.416,1.55 -2.49,3.379 -3.154,5.37l-18.267,54.762c-2.112,6.331 -1.052,13.333 2.835,18.729c3.918,5.438 10.23,8.685 16.886,8.685c0,0 0.001,0 0.001,0c2.879,0 5.693,-0.592 8.362,-1.76l52.89,-23.138c1.923,-0.841 3.648,-2.076 5.063,-3.626L336.771,73.176C352.937,55.479 351.69,27.929 333.988,11.758zM130.381,234.247l10.719,-32.134l0.904,-0.99l20.316,18.556l-0.904,0.99L130.381,234.247zM314.621,52.943L182.553,197.53l-20.316,-18.556L294.305,34.386c2.583,-2.828 6.118,-4.386 9.954,-4.386c3.365,0 6.588,1.252 9.082,3.53l0.419,0.383C319.244,38.922 319.63,47.459 314.621,52.943z" />
<path
android:fillColor="@android:color/white"
android:pathData="M303.85,138.388c-8.284,0 -15,6.716 -15,15v127.347c0,21.034 -17.113,38.147 -38.147,38.147H68.904c-21.035,0 -38.147,-17.113 -38.147,-38.147V100.413c0,-21.034 17.113,-38.147 38.147,-38.147h131.587c8.284,0 15,-6.716 15,-15s-6.716,-15 -15,-15H68.904c-37.577,0 -68.147,30.571 -68.147,68.147v180.321c0,37.576 30.571,68.147 68.147,68.147h181.798c37.576,0 68.147,-30.571 68.147,-68.147V153.388C318.85,145.104 312.134,138.388 303.85,138.388z" />
</vector>
......@@ -2,7 +2,6 @@
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
xmlns:tools="http://schemas.android.com/tools"
android:width="360dp"
android:height="249dp"
android:viewportWidth="360"
......@@ -12,8 +11,8 @@
<group>
<clip-path
android:pathData="M10 0H350C355.523 0 360 4.47715 360 10V239C360 244.523 355.523 249 350 249H10C4.47715 249 0 244.523 0 239V10C0 4.47715 4.47715 0 10 0Z"
tools:ignore="VectorRaster" />
android:pathData="M0 0H360V249H0V0Z"
/>
<path
android:pathData="M0 0V249H360V0"
......
......@@ -9,7 +9,7 @@
<ImageView
android:id="@+id/imageView2"
android:id="@+id/ivBtnBack"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_baseline_arrow_back_ios_24"
......@@ -28,8 +28,8 @@
android:text="@string/cart"
android:textAppearance="@style/cart"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="@+id/imageView2"
app:layout_constraintTop_toBottomOf="@+id/imageView2"
app:layout_constraintStart_toStartOf="@+id/ivBtnBack"
app:layout_constraintTop_toBottomOf="@+id/ivBtnBack"
app:layout_constraintVertical_bias="0.061" />
<TextView
......
......@@ -11,18 +11,18 @@
<View
android:id="@+id/rectangle_4"
android:layout_width="454dp"
android:layout_height="274dp"
android:layout_width="match_parent"
android:layout_height="250dp"
android:background="@drawable/rectangle_4"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintBottom_toTopOf="@id/rvProducts"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.511"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<ImageView
android:id="@+id/imageView3"
android:id="@+id/ivCart"
android:layout_width="30dp"
android:layout_height="30dp"
app:layout_constraintBottom_toBottomOf="@+id/rectangle_4"
......@@ -34,25 +34,25 @@
app:srcCompat="@drawable/ic_baseline_shopping_cart_24" />
<TextView
android:id="@+id/textView"
android:id="@+id/tvCount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="3"
android:textColor="#EA0909"
app:layout_constraintBottom_toBottomOf="@+id/imageView3"
app:layout_constraintEnd_toEndOf="@+id/imageView3"
app:layout_constraintBottom_toBottomOf="@+id/ivCart"
app:layout_constraintEnd_toEndOf="@+id/ivCart"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/iv_settings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="@+id/imageView3"
app:layout_constraintBottom_toBottomOf="@+id/ivCart"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.444"
app:layout_constraintStart_toEndOf="@+id/imageView3"
app:layout_constraintTop_toTopOf="@+id/imageView3"
app:layout_constraintVertical_bias="1.0"
app:layout_constraintHorizontal_bias="0.462"
app:layout_constraintStart_toEndOf="@+id/ivCart"
app:layout_constraintTop_toTopOf="@+id/ivCart"
app:layout_constraintVertical_bias="0.0"
app:srcCompat="@drawable/ic_baseline_more_vert_24" />
<TextView
......@@ -67,7 +67,7 @@
app:layout_constraintEnd_toEndOf="@+id/rectangle_4"
app:layout_constraintHorizontal_bias="0.045"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imageView3"
app:layout_constraintTop_toBottomOf="@+id/ivCart"
app:layout_constraintVertical_bias="0.067" />
<TextView
......@@ -89,6 +89,7 @@
android:id="@+id/tilSearch"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
android:layout_width="match_parent"
android:padding="10dp"
android:layout_height="wrap_content"
android:layout_margin="@dimen/space_default"
app:layout_constraintBottom_toBottomOf="@+id/rectangle_4"
......@@ -107,4 +108,19 @@
android:textSize="@dimen/text_default" />
</com.google.android.material.textfield.TextInputLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvProducts"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintTop_toBottomOf="@id/rectangle_4"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:overScrollMode="never"
android:padding="@dimen/space_small"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:spanCount="2"
tools:listitem="@layout/item_product"
tools:ignore="MissingConstraints" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -7,12 +7,16 @@
<variable
name="photo"
type="String" />
<variable
name="viewModel"
type="com.example.yourcashiertest.viewmodels.ProductViewModel" />
</data>
<LinearLayout
android:layout_width="match_parent"
android:orientation="vertical"
android:background="@color/colorBackground"
android:background="@color/white"
android:layout_height="wrap_content">
<com.google.android.material.textview.MaterialTextView
android:id="@+id/tvHeadProduct"
......@@ -20,7 +24,7 @@
android:layout_height="wrap_content"
android:textSize="24dp"
android:layout_margin="@dimen/space_default"
android:text="Tambah Product"/>
android:text="ADD PRODUCT"/>
<ScrollView
android:layout_width="match_parent"
......@@ -160,12 +164,6 @@
app:cornerRadius="@dimen/space_default"
android:elevation="5dp" />
</RelativeLayout>
</ScrollView>
</LinearLayout>
</layout>
\ No newline at end of file
......@@ -58,7 +58,7 @@
app:layout_constraintVertical_bias="1.0" />
<View
android:id="@+id/rectangle_1"
android:id="@+id/v_add"
android:layout_width="78dp"
android:layout_height="40dp"
android:layout_alignParentLeft="true"
......@@ -77,9 +77,9 @@
android:layout_height="10dp"
android:layout_marginStart="8dp"
android:background="@drawable/minus"
app:layout_constraintBottom_toBottomOf="@+id/rectangle_1"
app:layout_constraintStart_toStartOf="@+id/rectangle_1"
app:layout_constraintTop_toTopOf="@+id/rectangle_1"
app:layout_constraintBottom_toBottomOf="@+id/v_add"
app:layout_constraintStart_toStartOf="@+id/v_add"
app:layout_constraintTop_toTopOf="@+id/v_add"
app:layout_constraintVertical_bias="0.566" />
<Button
......@@ -88,9 +88,9 @@
android:layout_height="10dp"
android:layout_marginEnd="8dp"
android:background="@drawable/plus"
app:layout_constraintBottom_toBottomOf="@+id/rectangle_1"
app:layout_constraintEnd_toEndOf="@+id/rectangle_1"
app:layout_constraintTop_toTopOf="@+id/rectangle_1"
app:layout_constraintBottom_toBottomOf="@+id/v_add"
app:layout_constraintEnd_toEndOf="@+id/v_add"
app:layout_constraintTop_toTopOf="@+id/v_add"
app:layout_constraintVertical_bias="0.533" />
<TextView
......@@ -98,10 +98,10 @@
android:layout_width="10dp"
android:layout_height="wrap_content"
android:text="2"
app:layout_constraintBottom_toBottomOf="@+id/rectangle_1"
app:layout_constraintBottom_toBottomOf="@+id/v_add"
app:layout_constraintEnd_toStartOf="@+id/btn_add"
app:layout_constraintStart_toEndOf="@+id/btn_min"
app:layout_constraintTop_toTopOf="@+id/rectangle_1" />
app:layout_constraintTop_toTopOf="@+id/v_add" />
<View
android:layout_width="match_parent"
......
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.card.MaterialCardView
xmlns:android="http://schemas.android.com/apk/res/android"
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
xmlns:tools="http://schemas.android.com/tools">
<data>
<variable
name="product"
type="com.example.yourcashiertest.entities.Product" />
<variable
name="price"
type="String" />
</data>
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="wrap_content">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:padding="10dp"
android:layout_height="match_parent">
<ImageView
android:id="@+id/imageView5"
android:layout_width="wrap_content"
android:id="@+id/iv_product"
android:adjustViewBounds="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/elips"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.452"
app:layout_constraintHorizontal_bias="0.526"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.026"
tools:srcCompat="@tools:sample/avatars" />
app:layout_constraintVertical_bias="0.075"
android:src="@drawable/burger"/>
<ImageView
android:id="@+id/ivUpdate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/space_small"
android:src="@drawable/ic_update"
app:layout_constraintBottom_toBottomOf="@+id/iv_product"
app:layout_constraintStart_toStartOf="@+id/iv_product"
app:layout_constraintTop_toTopOf="@+id/iv_product"
app:layout_constraintVertical_bias="0.0" />
<ImageView
android:id="@+id/ivDelete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:padding="@dimen/space_small"
android:src="@drawable/ic_delete"
app:layout_constraintBottom_toBottomOf="@+id/iv_product"
app:layout_constraintEnd_toEndOf="@+id/iv_product"
app:layout_constraintTop_toTopOf="@+id/iv_product"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/tv_name"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Burger Medium"
android:text="@string/name"
android:layout_margin="10dp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.45"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imageView5"
app:layout_constraintTop_toBottomOf="@+id/iv_product"
app:layout_constraintVertical_bias="0.089" />
<TextView
android:id="@+id/tv_desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="@string/deskripsi"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/tv_name"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="@+id/tv_name"
app:layout_constraintTop_toBottomOf="@+id/tv_name"
app:layout_constraintVertical_bias="0.045" />
<TextView
android:id="@+id/tv_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:text="@string/price"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="@+id/tv_desc"
app:layout_constraintTop_toBottomOf="@+id/tv_desc"
app:layout_constraintVertical_bias="0.37" />
<View
android:id="@+id/v_add"
android:layout_width="70dp"
android:layout_height="30dp"
android:background="@drawable/btn_shape"
app:layout_constraintBottom_toBottomOf="@+id/tv_price"
app:layout_constraintEnd_toEndOf="@+id/tv_name"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toEndOf="@+id/tv_price"
app:layout_constraintTop_toTopOf="@+id/tv_price"
app:layout_constraintVertical_bias="0.0" />
<ImageView
android:id="@+id/iv_add"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="@+id/v_add"
app:layout_constraintEnd_toEndOf="@+id/v_add"
app:layout_constraintStart_toStartOf="@+id/v_add"
app:layout_constraintTop_toTopOf="@+id/v_add"
app:srcCompat="@drawable/ic_baseline_add_shopping_cart_24" />
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
\ No newline at end of file
</com.google.android.material.card.MaterialCardView>
</layout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/item_one"
android:title="Add New Product"/>
<item
android:id="@+id/item_two"
android:title="Update / Delete Product"/>
</menu>
\ No newline at end of file
......@@ -17,4 +17,7 @@
<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>
</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