Commit 21e47254 authored by Alfansyah Fadlian's avatar Alfansyah Fadlian

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

parents b0c11049 928de6d8
...@@ -6,7 +6,7 @@ android { ...@@ -6,7 +6,7 @@ android {
defaultConfig { defaultConfig {
applicationId "com.yono.messeripos" applicationId "com.yono.messeripos"
minSdkVersion 23 minSdkVersion 22
targetSdkVersion 30 targetSdkVersion 30
versionCode 1 versionCode 1
versionName "1.0" versionName "1.0"
......
...@@ -51,7 +51,6 @@ public class CartActivity extends AppCompatActivity { ...@@ -51,7 +51,6 @@ public class CartActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_cart); setContentView(R.layout.activity_cart);
Window w = getWindow(); Window w = getWindow();
w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
...@@ -63,6 +62,7 @@ public class CartActivity extends AppCompatActivity { ...@@ -63,6 +62,7 @@ public class CartActivity extends AppCompatActivity {
toolbars.setNavigationOnClickListener(view -> onBackPressed()); toolbars.setNavigationOnClickListener(view -> onBackPressed());
recyclerView = findViewById(R.id.rvCart); recyclerView = findViewById(R.id.rvCart);
cartAdapter = new CartAdapter();
LinearLayoutManager llm = new LinearLayoutManager(this); LinearLayoutManager llm = new LinearLayoutManager(this);
recyclerView.setLayoutManager(llm); recyclerView.setLayoutManager(llm);
...@@ -76,12 +76,36 @@ public class CartActivity extends AppCompatActivity { ...@@ -76,12 +76,36 @@ public class CartActivity extends AppCompatActivity {
@Override @Override
public void onChanged(List<ProductCartModels> productCartModels) { public void onChanged(List<ProductCartModels> productCartModels) {
if (productCartModels != null){ if (productCartModels != null){
cartAdapter = new CartAdapter(CartActivity.this, productCartModels); cartAdapter.setCartAdapter(CartActivity.this, productCartModels);
recyclerView.setAdapter(cartAdapter); recyclerView.setAdapter(cartAdapter);
} }
} }
}); });
cartAdapter.setListener(new CartAdapter.CartListener() {
@Override
public void onDelete(ProductCartModels productCartModels) {
modelsCart.deleteCart(productCartModels);
}
@Override
public void onUpdateQuantityPlus(ProductCartModels productCartModels) {
}
@Override
public void onUpdateQuantityMinus(ProductCartModels productCartModels) {
}
@Override
public void onCheckout(ProductCartModels productCartModels) {
}
});
// //
// counter = Integer.parseInt(tvQtyView.getText().toString()); // counter = Integer.parseInt(tvQtyView.getText().toString());
// prices = Integer.parseInt(tvPrice.getText().toString()); // prices = Integer.parseInt(tvPrice.getText().toString());
......
...@@ -21,6 +21,7 @@ import android.widget.Toast; ...@@ -21,6 +21,7 @@ import android.widget.Toast;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.core.content.FileProvider; import androidx.core.content.FileProvider;
...@@ -150,12 +151,13 @@ public class FormProductActivity extends AppCompatActivity { ...@@ -150,12 +151,13 @@ public class FormProductActivity extends AppCompatActivity {
} }
// if (requestCode == REQUEST_IMAGE_CAPTURE && resultCode == RESULT_OK) { // if (requestCode == REQUEST_IMAGE_CAPTURE && resultCode == RESULT_OK) {
// Log.d("Get filepath photo", "" + file.getName()); // Log.d("Get filepath photo", "" + file.getAbsolutePath());
// binding.setPhoto(file.getAbsolutePath()); // binding.setPhoto(file.getAbsolutePath());
// productModels.setImageProduct(file.getName()); // productModels.setImageProduct(file.getName());
// } // }
} }
@RequiresApi(api = Build.VERSION_CODES.M)
@Override @Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults); super.onRequestPermissionsResult(requestCode, permissions, grantResults);
......
...@@ -14,7 +14,9 @@ import com.google.gson.Gson; ...@@ -14,7 +14,9 @@ import com.google.gson.Gson;
import com.yono.messeripos.R; import com.yono.messeripos.R;
import com.yono.messeripos.databinding.ItemCartBinding; import com.yono.messeripos.databinding.ItemCartBinding;
import com.yono.messeripos.models.CartModels; import com.yono.messeripos.models.CartModels;
import com.yono.messeripos.models.CategoryModels;
import com.yono.messeripos.models.ProductCartModels; import com.yono.messeripos.models.ProductCartModels;
import com.yono.messeripos.utils.Utils;
import java.text.NumberFormat; import java.text.NumberFormat;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -26,8 +28,25 @@ public class CartAdapter extends RecyclerView.Adapter<CartAdapter.MyViewHolder> ...@@ -26,8 +28,25 @@ public class CartAdapter extends RecyclerView.Adapter<CartAdapter.MyViewHolder>
private List<ProductCartModels> cartModels; private List<ProductCartModels> cartModels;
private int price; private int price;
Context context; Context context;
Utils utils = new Utils();
public CartAdapter(Context context, List<ProductCartModels> cartModels) { public interface CartListener {
void onDelete(ProductCartModels productCartModels);
void onUpdateQuantityPlus(ProductCartModels productCartModels);
void onUpdateQuantityMinus(ProductCartModels productCartModels);
void onCheckout(ProductCartModels productCartModels);
}
private CartListener listener;
public void setListener(CartListener listener) {
this.listener = listener;
}
public void setCartAdapter(Context context, List<ProductCartModels> cartModels) {
this.cartModels = cartModels; this.cartModels = cartModels;
this.context = context; this.context = context;
// String gs = new Gson().toJson(cartModels); // String gs = new Gson().toJson(cartModels);
...@@ -59,6 +78,7 @@ public class CartAdapter extends RecyclerView.Adapter<CartAdapter.MyViewHolder> ...@@ -59,6 +78,7 @@ public class CartAdapter extends RecyclerView.Adapter<CartAdapter.MyViewHolder>
} }
public class MyViewHolder extends RecyclerView.ViewHolder { public class MyViewHolder extends RecyclerView.ViewHolder {
private long subtotal = 0;
private ItemCartBinding binding; private ItemCartBinding binding;
public MyViewHolder(@NonNull ItemCartBinding binding) { public MyViewHolder(@NonNull ItemCartBinding binding) {
...@@ -68,14 +88,12 @@ public class CartAdapter extends RecyclerView.Adapter<CartAdapter.MyViewHolder> ...@@ -68,14 +88,12 @@ public class CartAdapter extends RecyclerView.Adapter<CartAdapter.MyViewHolder>
public void bindData(ProductCartModels cartModels) { public void bindData(ProductCartModels cartModels) {
binding.setCarts(cartModels); binding.setCarts(cartModels);
// price = binding.getPrice(); binding.setPrice(utils.convertPrice("Rp. ", cartModels.getPrice_orders()));
} subtotal = cartModels.getPrice_orders() * cartModels.getQuantity_orders();
private NumberFormat setToRp() { binding.setSubTotal(utils.convertPrice("Rp. ", subtotal));
Locale ID = new Locale("in", "ID");
return NumberFormat.getCurrencyInstance(ID); }
}
} }
} }
...@@ -12,6 +12,7 @@ import androidx.recyclerview.widget.RecyclerView; ...@@ -12,6 +12,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.yono.messeripos.R; import com.yono.messeripos.R;
import com.yono.messeripos.databinding.ItemCategoryBinding; import com.yono.messeripos.databinding.ItemCategoryBinding;
import com.yono.messeripos.models.CategoryModels; import com.yono.messeripos.models.CategoryModels;
import com.yono.messeripos.models.ProductModels;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -20,6 +21,17 @@ public class CategoryAdapter extends RecyclerView.Adapter<CategoryAdapter.MyView ...@@ -20,6 +21,17 @@ public class CategoryAdapter extends RecyclerView.Adapter<CategoryAdapter.MyView
private ArrayList<CategoryModels> categoryModels; private ArrayList<CategoryModels> categoryModels;
Context context; Context context;
public interface CategoryListener {
void onGetProduct(CategoryModels categoryModels);
}
private CategoryListener listener;
public void setListener(CategoryListener listener) {
this.listener = listener;
}
public void setCategoriAdapter(Context context, ArrayList<CategoryModels> categoryModels){ public void setCategoriAdapter(Context context, ArrayList<CategoryModels> categoryModels){
this.categoryModels = categoryModels; this.categoryModels = categoryModels;
this.context = context; this.context = context;
...@@ -58,12 +70,7 @@ public class CategoryAdapter extends RecyclerView.Adapter<CategoryAdapter.MyView ...@@ -58,12 +70,7 @@ public class CategoryAdapter extends RecyclerView.Adapter<CategoryAdapter.MyView
public void binData(CategoryModels categoryModels){ public void binData(CategoryModels categoryModels){
binding.setCategory(categoryModels); binding.setCategory(categoryModels);
binding.cvCategory.setOnClickListener(new View.OnClickListener() { binding.cvCategory.setOnClickListener(view -> listener.onGetProduct(categoryModels));
@Override
public void onClick(View view) {
binding.cvCategory.toggle();
}
});
} }
} }
} }
...@@ -28,6 +28,7 @@ import com.yono.messeripos.models.CartModels; ...@@ -28,6 +28,7 @@ import com.yono.messeripos.models.CartModels;
import com.yono.messeripos.models.MainViewModelsCart; import com.yono.messeripos.models.MainViewModelsCart;
import com.yono.messeripos.models.ProductCartModels; import com.yono.messeripos.models.ProductCartModels;
import com.yono.messeripos.models.ProductModels; import com.yono.messeripos.models.ProductModels;
import com.yono.messeripos.utils.Utils;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols; import java.text.DecimalFormatSymbols;
...@@ -37,6 +38,7 @@ public class ProductAdapter extends RecyclerView.Adapter<ProductAdapter.MyViewHo ...@@ -37,6 +38,7 @@ public class ProductAdapter extends RecyclerView.Adapter<ProductAdapter.MyViewHo
private ArrayList<ProductModels> productModels = new ArrayList<>(); private ArrayList<ProductModels> productModels = new ArrayList<>();
Context context; Context context;
MainViewModelsCart mainViewModelsCart; MainViewModelsCart mainViewModelsCart;
Utils utils = new Utils();
public interface ProductListener { public interface ProductListener {
void onUpdate(ProductModels product); void onUpdate(ProductModels product);
...@@ -97,21 +99,15 @@ public class ProductAdapter extends RecyclerView.Adapter<ProductAdapter.MyViewHo ...@@ -97,21 +99,15 @@ public class ProductAdapter extends RecyclerView.Adapter<ProductAdapter.MyViewHo
public void bindData(ProductModels products) { public void bindData(ProductModels products) {
binding.setProducts(products); binding.setProducts(products);
DecimalFormat rupiah = (DecimalFormat) DecimalFormat.getCurrencyInstance(); binding.setPrice(utils.convertPrice("Rp. ", products.getPriceProduct()));
DecimalFormatSymbols format = new DecimalFormatSymbols();
format.setCurrencySymbol("Rp. ");
format.setMonetaryDecimalSeparator(',');
format.setGroupingSeparator('.');
rupiah.setDecimalFormatSymbols(format);
binding.setPrice(rupiah.format(products.getPriceProduct()));
binding.setImage(products.getImageProduct()); binding.setImage(products.getImageProduct());
if (!MainActivity.status_update) { if (!MainActivity.status_update) {
binding.btnDelete.setVisibility(View.GONE); binding.btnDelete.setVisibility(View.GONE);
binding.btnEdit.setVisibility(View.GONE); binding.btnEdit.setVisibility(View.GONE);
}else{
binding.btnDelete.setVisibility(View.VISIBLE);
binding.btnEdit.setVisibility(View.VISIBLE);
} }
if (products.getStockProduct() == 0) { if (products.getStockProduct() == 0) {
......
...@@ -2,14 +2,20 @@ package com.yono.messeripos.api.service; ...@@ -2,14 +2,20 @@ package com.yono.messeripos.api.service;
import com.yono.messeripos.api.ApiHelper; import com.yono.messeripos.api.ApiHelper;
import com.yono.messeripos.models.CategoryModels; import com.yono.messeripos.models.CategoryModels;
import com.yono.messeripos.models.ProductModels;
import com.yono.messeripos.response.DataResponse; import com.yono.messeripos.response.DataResponse;
import java.util.List; import java.util.List;
import retrofit2.Call; import retrofit2.Call;
import retrofit2.http.GET; import retrofit2.http.GET;
import retrofit2.http.Path;
import retrofit2.http.Query;
public interface CategoryServise { public interface CategoryServise {
@GET(ApiHelper.VERSI_API_1+"categories") @GET(ApiHelper.VERSI_API_1+"categories")
Call<DataResponse<List<CategoryModels>>> getCategory(); Call<DataResponse<List<CategoryModels>>> getCategory();
@GET(ApiHelper.VERSI_API_1+"categories-join/{id}")
Call<DataResponse<List<CategoryModels<List<ProductModels>>>>> getCategoryById(@Path("id") int id);
} }
...@@ -25,9 +25,12 @@ public interface CartDaos { ...@@ -25,9 +25,12 @@ public interface CartDaos {
@Insert(onConflict = OnConflictStrategy.IGNORE) @Insert(onConflict = OnConflictStrategy.IGNORE)
public void insertProduct(ProductCartModels product); public void insertProduct(ProductCartModels product);
@Update @Update(onConflict = OnConflictStrategy.IGNORE)
public void updateProduct(ProductCartModels product); public void updateProduct(ProductCartModels product);
@Query("UPDATE carts SET quantity_orders = :qty WHERE id = :idCart")
public void updateCart (long qty, long idCart);
@Delete @Delete
public void deleteProduct(ProductCartModels product); public void deleteProduct(ProductCartModels product);
......
...@@ -2,13 +2,16 @@ package com.yono.messeripos.models; ...@@ -2,13 +2,16 @@ package com.yono.messeripos.models;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
public class CategoryModels { public class CategoryModels<T> {
@SerializedName("id") @SerializedName("id")
private int idCategory; private int idCategory;
@SerializedName("name") @SerializedName("name")
private String nameCategory; private String nameCategory;
@SerializedName("product")
private T productCategory;
public int getIdCategory() { public int getIdCategory() {
return idCategory; return idCategory;
} }
...@@ -24,4 +27,12 @@ public class CategoryModels { ...@@ -24,4 +27,12 @@ public class CategoryModels {
public void setNameCategory(String nameCategory) { public void setNameCategory(String nameCategory) {
this.nameCategory = nameCategory; this.nameCategory = nameCategory;
} }
public T getProductCategory() {
return productCategory;
}
public void setProductCategory(T productCategory) {
this.productCategory = productCategory;
}
} }
...@@ -2,6 +2,7 @@ package com.yono.messeripos.models; ...@@ -2,6 +2,7 @@ package com.yono.messeripos.models;
import android.util.Log; import android.util.Log;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData; import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel; import androidx.lifecycle.ViewModel;
...@@ -21,6 +22,7 @@ import retrofit2.Response; ...@@ -21,6 +22,7 @@ import retrofit2.Response;
public class MainViewModels extends ViewModel { public class MainViewModels extends ViewModel {
MutableLiveData<DataResponse<List<ProductModels<CategoryModels>>>> productList; MutableLiveData<DataResponse<List<ProductModels<CategoryModels>>>> productList;
MutableLiveData<List<CategoryModels<List<ProductModels>>>> productByCategory;
MutableLiveData<DataResponse<List<CategoryModels>>> categoryList; MutableLiveData<DataResponse<List<CategoryModels>>> categoryList;
MutableLiveData<DataResponse<UsersModels>> usersLogin; MutableLiveData<DataResponse<UsersModels>> usersLogin;
...@@ -29,18 +31,45 @@ public class MainViewModels extends ViewModel { ...@@ -29,18 +31,45 @@ public class MainViewModels extends ViewModel {
public MainViewModels(){ public MainViewModels(){
productList = new MutableLiveData<>(); productList = new MutableLiveData<>();
categoryList = new MutableLiveData<>(); categoryList = new MutableLiveData<>();
productByCategory = new MutableLiveData<>();
} }
public MutableLiveData<DataResponse<List<ProductModels<CategoryModels>>>> getProduct(){ public LiveData<DataResponse<List<ProductModels<CategoryModels>>>> getProduct(){
getProductList(); getProductList();
return productList; return productList;
} }
public MutableLiveData<DataResponse<List<CategoryModels>>> getCategory(){ public LiveData<DataResponse<List<CategoryModels>>> getCategory(){
getCategoryList(); getCategoryList();
return categoryList; return categoryList;
} }
public LiveData<List<CategoryModels<List<ProductModels>>>> getProductByCategory(int id){
getDataProductByCategory(id);
return productByCategory;
}
private void getDataProductByCategory(int id) {
CategoryServise categoryServise = client.Client(CategoryServise.class);
categoryServise.getCategoryById(id).enqueue(new Callback<DataResponse<List<CategoryModels<List<ProductModels>>>>>() {
@Override
public void onResponse(Call<DataResponse<List<CategoryModels<List<ProductModels>>>>> call,
Response<DataResponse<List<CategoryModels<List<ProductModels>>>>> response) {
String js = new Gson().toJson(response.body());
Log.i("Get data by category", "onResponse: "+js);
if (response != null){
productByCategory.setValue(response.body().getData());
}
}
@Override
public void onFailure(Call<DataResponse<List<CategoryModels<List<ProductModels>>>>> call, Throwable t) {
Log.e("Error!", "onFailure: ", t);
}
});
}
public MutableLiveData<DataResponse<UsersModels>> checkLogin(UsersModels usersModels){ public MutableLiveData<DataResponse<UsersModels>> checkLogin(UsersModels usersModels){
usersLogin = new MutableLiveData<>(); usersLogin = new MutableLiveData<>();
PeriksaLogin(usersModels); PeriksaLogin(usersModels);
...@@ -67,25 +96,24 @@ public class MainViewModels extends ViewModel { ...@@ -67,25 +96,24 @@ public class MainViewModels extends ViewModel {
}); });
} }
private void getProductList() { private void getProductList() {
ProductService productService = client.Client(ProductService.class); ProductService productService = client.Client(ProductService.class);
productService.getProducts().enqueue(new Callback<DataResponse<List<ProductModels<CategoryModels>>>>() { productService.getProducts().enqueue(new Callback<DataResponse<List<ProductModels<CategoryModels>>>>() {
@Override @Override
public void onResponse(Call<DataResponse<List<ProductModels<CategoryModels>>>> call, public void onResponse(Call<DataResponse<List<ProductModels<CategoryModels>>>> call, Response<DataResponse<List<ProductModels<CategoryModels>>>> response) {
Response<DataResponse<List<ProductModels<CategoryModels>>>> response) {
if (response.body() != null){ if (response.body() != null){
productList.setValue(response.body()); productList.setValue(response.body());
}else{ }else{
productList.setValue(null); productList.setValue(null);
} }
String js = new Gson().toJson(response.body());
Log.d("Get Data", "Response "+js);
} }
@Override @Override
public void onFailure(Call<DataResponse<List<ProductModels<CategoryModels>>>> call, Throwable t) { public void onFailure(Call<DataResponse<List<ProductModels<CategoryModels>>>> call, Throwable t) {
Log.e("Error get product", "Response "+t.getMessage()); Log.e("Error get product", "Response "+t.getMessage());
} }
}); });
} }
......
...@@ -42,6 +42,8 @@ public class MainViewModelsCart extends AndroidViewModel { ...@@ -42,6 +42,8 @@ public class MainViewModelsCart extends AndroidViewModel {
public void deleteCart(ProductCartModels productCartModels){cartRepositories.delete(productCartModels);} public void deleteCart(ProductCartModels productCartModels){cartRepositories.delete(productCartModels);}
public void updateQtyCart(long qty, long id){cartRepositories.updateQty(qty, id);}
public LiveData<List<ProductCartModels>> getCartById(long id){ public LiveData<List<ProductCartModels>> getCartById(long id){
return cartRepositories.getDataById(id); return cartRepositories.getDataById(id);
} }
......
...@@ -32,6 +32,10 @@ public class ProductCartModels implements Parcelable { ...@@ -32,6 +32,10 @@ public class ProductCartModels implements Parcelable {
@SerializedName("grand_total") @SerializedName("grand_total")
private int grand_total_orders; private int grand_total_orders;
public ProductCartModels(){
}
public ProductCartModels(int id_orders, public ProductCartModels(int id_orders,
long quantity_orders, long quantity_orders,
int id_product_orders, int id_product_orders,
......
...@@ -35,6 +35,10 @@ public class CartRepositories { ...@@ -35,6 +35,10 @@ public class CartRepositories {
LocalDatabase.databaseWriterExecutor.execute(() -> cartDaos.deleteProduct(productCartModels)); LocalDatabase.databaseWriterExecutor.execute(() -> cartDaos.deleteProduct(productCartModels));
} }
public void updateQty(long qty, long id){
LocalDatabase.databaseWriterExecutor.execute(() ->cartDaos.updateCart(qty, id));
}
public LiveData<List<ProductCartModels>> getDataById(long id){ public LiveData<List<ProductCartModels>> getDataById(long id){
return cartDaos.getCartById(id); return cartDaos.getCartById(id);
} }
......
package com.yono.messeripos.utils;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
public class Utils {
public String convertPrice(String mataUang, int nilai ){
DecimalFormat rupiah = (DecimalFormat) DecimalFormat.getCurrencyInstance();
DecimalFormatSymbols format = new DecimalFormatSymbols();
format.setCurrencySymbol(mataUang);
format.setMonetaryDecimalSeparator(',');
format.setGroupingSeparator('.');
rupiah.setDecimalFormatSymbols(format);
return rupiah.format(nilai);
}
public String convertPrice(String mataUang, long nilai ){
DecimalFormat rupiah = (DecimalFormat) DecimalFormat.getCurrencyInstance();
DecimalFormatSymbols format = new DecimalFormatSymbols();
format.setCurrencySymbol(mataUang);
format.setMonetaryDecimalSeparator(',');
format.setGroupingSeparator('.');
rupiah.setDecimalFormatSymbols(format);
return rupiah.format(nilai);
}
}
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".MainActivity"> tools:context=".MainActivity">
<com.google.android.material.appbar.AppBarLayout <com.google.android.material.appbar.AppBarLayout
android:id="@+id/topBar" android:id="@+id/topBar"
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -22,9 +24,20 @@ ...@@ -22,9 +24,20 @@
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
android:paddingTop="20dp" android:paddingTop="20dp"
android:paddingStart="15dp"
tools:ignore="RtlSymmetry"> tools:ignore="RtlSymmetry">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/appBarUpdate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="0dp"
android:paddingTop="0dp"
android:background="@drawable/gradient"
style="@style/Widget.MaterialComponents.Toolbar.Primary"
xmlns:android="http://schemas.android.com/apk/res/android">
</com.google.android.material.appbar.MaterialToolbar>
<com.google.android.material.appbar.MaterialToolbar <com.google.android.material.appbar.MaterialToolbar
android:id="@+id/topAppBar" android:id="@+id/topAppBar"
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -59,6 +72,25 @@ ...@@ -59,6 +72,25 @@
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
tools:listitem="@layout/item_category" /> tools:listitem="@layout/item_category" />
<ImageView
android:id="@+id/imgEmpty"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
android:src="@drawable/no"
app:layout_constraintTop_toBottomOf="@id/rvCategory"/>
<ProgressBar
android:id="@+id/pbLoading"
android:indeterminateTint="@color/colorAccent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:backgroundTint="@color/colorAccent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<!-- Scrollable content --> <!-- Scrollable content -->
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvProduct" android:id="@+id/rvProduct"
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
type="String" /> type="String" />
<variable <variable
name="product_name" name="subTotal"
type="String" /> type="String" />
</data> </data>
...@@ -88,7 +88,7 @@ ...@@ -88,7 +88,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:fontFamily="@font/roboto" android:fontFamily="@font/roboto"
android:text="@string/hint_price" android:text="@{subTotal}"
android:textFontWeight="600" android:textFontWeight="600"
android:textSize="16sp" android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="@id/tvQuantity" app:layout_constraintBottom_toBottomOf="@id/tvQuantity"
......
...@@ -19,6 +19,9 @@ ...@@ -19,6 +19,9 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:backgroundTint="#2041B8" android:backgroundTint="#2041B8"
android:clickable="true"
android:focusable="true"
android:checkable="true"
app:cardCornerRadius="40dp"> app:cardCornerRadius="40dp">
......
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