Commit b1f7fd02 authored by Muhammad Suryono's avatar Muhammad Suryono

Fix conflict cart

parents f2f46621 7c0c8a0b
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<DBN-PSQL>
<case-options enabled="true">
<option name="KEYWORD_CASE" value="lower" />
<option name="FUNCTION_CASE" value="lower" />
<option name="PARAMETER_CASE" value="lower" />
<option name="DATATYPE_CASE" value="lower" />
<option name="OBJECT_CASE" value="preserve" />
</case-options>
<formatting-settings enabled="false" />
</DBN-PSQL>
<DBN-SQL>
<case-options enabled="true">
<option name="KEYWORD_CASE" value="lower" />
<option name="FUNCTION_CASE" value="lower" />
<option name="PARAMETER_CASE" value="lower" />
<option name="DATATYPE_CASE" value="lower" />
<option name="OBJECT_CASE" value="preserve" />
</case-options>
<formatting-settings enabled="false">
<option name="STATEMENT_SPACING" value="one_line" />
<option name="CLAUSE_CHOP_DOWN" value="chop_down_if_statement_long" />
<option name="ITERATION_ELEMENTS_WRAPPING" value="chop_down_if_not_single" />
</formatting-settings>
</DBN-SQL>
<DBN-PSQL>
<case-options enabled="true">
<option name="KEYWORD_CASE" value="lower" />
......
......@@ -18,6 +18,7 @@
<activity
android:name=".CartActivity"
android:theme="@style/AppTheme.appbar" />
<activity android:name=".ProductActivity"></activity>
<activity android:name=".SplashScreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
......
......@@ -3,12 +3,14 @@ package com.yono.messeripos;
import androidx.appcompat.app.AppCompatActivity;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageButton;
import android.widget.TextView;
import com.google.android.material.appbar.MaterialToolbar;
import com.google.android.material.button.MaterialButton;
import com.google.android.material.textfield.TextInputEditText;
import java.text.NumberFormat;
......@@ -19,6 +21,7 @@ public class CartActivity extends AppCompatActivity {
ImageButton btMinus, btPlus, btDelete;
TextInputEditText tiQty;
TextView tvQtyView, tvPrice, tvTotal;
MaterialButton btnCheckout;
public int counter, prices;
......@@ -37,6 +40,7 @@ public class CartActivity extends AppCompatActivity {
btMinus = findViewById(R.id.btMinus);
btPlus = findViewById(R.id.btPlus);
btDelete = findViewById(R.id.btDelete);
btnCheckout = findViewById(R.id.btCheckout);
tiQty = findViewById(R.id.etQty);
tvQtyView = findViewById(R.id.tvQuantity);
......@@ -73,6 +77,14 @@ public class CartActivity extends AppCompatActivity {
countTotal();
}
});
btnCheckout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(CartActivity.this, PaymentActivity.class));
finish();
}
});
}
private void countTotal() {
......
package com.yono.messeripos;
import android.app.Notification;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.view.Window;
......@@ -10,20 +12,51 @@ import android.view.WindowManager;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.core.app.NotificationCompat;
import androidx.core.content.ContextCompat;
import androidx.databinding.DataBindingUtil;
import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProviders;
import androidx.recyclerview.widget.LinearLayoutManager;
import com.google.android.material.appbar.MaterialToolbar;
import com.yono.messeripos.adapter.ProductAdapter;
import com.yono.messeripos.databinding.ActivityMainBinding;
import com.yono.messeripos.models.MainViewModels;
import com.yono.messeripos.models.ProductModels;
import com.google.gson.Gson;
import com.yono.messeripos.adapter.CategoryAdapter;
import com.yono.messeripos.databinding.ActivityMainBinding;
import com.yono.messeripos.models.CategoryModels;
import com.yono.messeripos.models.MainViewModels;
import com.yono.messeripos.response.DataResponse;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
public class MainActivity extends AppCompatActivity {
MaterialToolbar toolbar;
MainViewModels mainViewModels;
ActivityMainBinding binding;
CategoryAdapter categoryAdapter;
ProductAdapter productAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ProductAdapter adapter = new ProductAdapter();
binding = DataBindingUtil.setContentView(this, R.layout.activity_main);
binding.rvProduct.setAdapter(adapter);
// setContentView(R.layout.activity_main);
categoryAdapter = new CategoryAdapter();
productAdapter = new ProductAdapter();
binding = DataBindingUtil.setContentView(this, R.layout.activity_main);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
......@@ -39,16 +72,55 @@ public class MainActivity extends AppCompatActivity {
@Override
public boolean onMenuItemClick(MenuItem item) {
int id = item.getItemId();
if (id == R.id.menu_cart){
if (id == R.id.menu_cart) {
startActivity(new Intent(getApplicationContext(), CartActivity.class));
}
return true;
}
});
MainViewModels mainViewModels = ViewModelProviders.of(this).get(MainViewModels.class);
mainViewModels.getProduct();
mainViewModels.getCategory();
mainViewModels = ViewModelProviders.of(this).get(MainViewModels.class);
mainViewModels.getCategory().observe(this, new Observer<DataResponse<List<CategoryModels>>>() {
@Override
public void onChanged(DataResponse<List<CategoryModels>> listDataResponse) {
if (listDataResponse != null) {
List<CategoryModels> categoryModels = listDataResponse.getData();
ArrayList<CategoryModels> categoryModelsArrayList = new ArrayList<>();
categoryModelsArrayList.addAll(categoryModels);
categoryAdapter.setCategoriAdapter(MainActivity.this, categoryModelsArrayList);
binding.rvCategory.setLayoutManager(new LinearLayoutManager(MainActivity.this, LinearLayoutManager.HORIZONTAL, false));
binding.rvCategory.setAdapter(categoryAdapter);
}
String js = new Gson().toJson(listDataResponse);
Log.d("Get data from category", "Response " + js);
}
});
mainViewModels = ViewModelProviders.of(this).get(MainViewModels.class);
mainViewModels.getProduct().observe(this, new Observer<DataResponse<List<ProductModels<CategoryModels>>>>() {
@Override
public void onChanged(DataResponse<List<ProductModels<CategoryModels>>> listDataResponse) {
if (listDataResponse != null) {
List<ProductModels<CategoryModels>> productModels = listDataResponse.getData();
ArrayList<ProductModels> productModelsArrayList = new ArrayList<>();
productModelsArrayList.addAll(productModels);
productAdapter.setProduct(MainActivity.this,productModelsArrayList );
binding.rvCategory.setLayoutManager(new LinearLayoutManager(MainActivity.this, LinearLayoutManager.HORIZONTAL, false));
binding.rvCategory.setAdapter(categoryAdapter);
}
String js = new Gson().toJson(listDataResponse);
Log.d("Get data from products", "Response " + js);
}
});
}
......
......@@ -36,6 +36,7 @@ public class PaymentActivity extends AppCompatActivity {
LinearLayoutManager llm = new LinearLayoutManager(this);
rvPayment.setLayoutManager(llm);
paymentResponses.add(new PaymentResponse("https://i.ibb.co/RjJQT9K/BNI-logo.png", "cash"));
paymentResponses.add(new PaymentResponse("https://i.ibb.co/XCsdmmT/Bank-Mandiri-logo.png", "mandiri"));
paymentResponses.add(new PaymentResponse("https://i.ibb.co/2n65nCT/bca-bank-central-asia.png", "bca"));
paymentResponses.add(new PaymentResponse("https://i.ibb.co/RjJQT9K/BNI-logo.png", "bni"));
......
package com.yono.messeripos;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class ProductActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_product);
}
}
\ No newline at end of file
//package com.yono.messeripos;
//
//import android.content.Context;
//
//import androidx.appcompat.app.AppCompatActivity;
//
//import com.google.android.material.appbar.MaterialToolbar;
//
//public class ToolbarApp {
//
// public ToolbarApp(Context context, int toolbar, String title) {
//
// MaterialToolbar toolbars = findViewById(toolbar);
// setSupportActionBar(toolbars);
// getSupportActionBar().setDisplayHomeAsUpEnabled(true);
// getSupportActionBar().setDisplayShowHomeEnabled(true);
// getSupportActionBar().setTitle(title);
// }
//}
package com.yono.messeripos;
import android.content.Context;
import com.google.android.material.appbar.MaterialToolbar;
public class ToolbarApp {
}
package com.yono.messeripos.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.databinding.DataBindingUtil;
import androidx.recyclerview.widget.RecyclerView;
import com.yono.messeripos.R;
import com.yono.messeripos.databinding.ItemCategoryBinding;
import com.yono.messeripos.models.CategoryModels;
import java.util.ArrayList;
public class CategoryAdapter extends RecyclerView.Adapter<CategoryAdapter.MyViewHolder> {
private ArrayList<CategoryModels> categoryModels;
Context context;
public void setCategoriAdapter(Context context, ArrayList<CategoryModels> categoryModels){
this.categoryModels = categoryModels;
this.context = context;
notifyDataSetChanged();
}
@NonNull
@Override
public CategoryAdapter.MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return null;
ItemCategoryBinding itemCategoryBinding = DataBindingUtil.inflate(
LayoutInflater.from(parent.getContext()),
R.layout.item_category,
parent,
false
);
return new MyViewHolder(itemCategoryBinding);
}
@Override
public void onBindViewHolder(@NonNull CategoryAdapter.MyViewHolder holder, int position) {
holder.binData(categoryModels.get(position));
}
@Override
public int getItemCount() {
return 0;
return categoryModels.size();
}
public class MyViewHolder extends RecyclerView.ViewHolder {
public MyViewHolder(@NonNull View itemView) {
super(itemView);
ItemCategoryBinding binding;
public MyViewHolder(@NonNull ItemCategoryBinding itemView) {
super(itemView.getRoot());
this.binding = itemView;
}
public void binData(CategoryModels categoryModels){
binding.setCategory(categoryModels);
binding.cvCategory.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
binding.cvCategory.toggle();
}
});
}
}
}
......@@ -6,6 +6,7 @@ import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.cardview.widget.CardView;
......@@ -77,6 +78,7 @@ public class PaymentAdapter extends RecyclerView.Adapter<PaymentAdapter.ViewHold
public class ViewHolder extends RecyclerView.ViewHolder {
MaterialCardView cardView;
PaymentListBinding binding;
public int position;
public ViewHolder(@NonNull PaymentListBinding view) {
super(view.getRoot());
this.binding = view;
......@@ -90,6 +92,15 @@ public class PaymentAdapter extends RecyclerView.Adapter<PaymentAdapter.ViewHold
binding.setPayment(paymentResponse);
binding.setLogo(paymentResponse.getUrl());
Log.d("Position ", ""+getAdapterPosition());
binding.cvPayment.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Log.d("Click VC", paymentResponse.getBank());
binding.cvPayment.toggle();
}
});
}
}
}
package com.yono.messeripos.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.databinding.DataBindingUtil;
import androidx.recyclerview.widget.RecyclerView;
import com.yono.messeripos.R;
import com.yono.messeripos.databinding.ItemCategoryBinding;
import com.yono.messeripos.databinding.ItemListBinding;
import com.yono.messeripos.models.CategoryModels;
import com.yono.messeripos.models.ProductModels;
import java.util.ArrayList;
import java.util.List;
public class ProductAdapter extends RecyclerView.Adapter<ProductAdapter.MyViewHolder> {
private ArrayList<ProductModels> productModels;
Context context;
public void setProduct(Context context, ArrayList<ProductModels> productModels){
this.productModels = productModels;
this.context = context;
notifyDataSetChanged();
}
@NonNull
@Override
public ProductAdapter.MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return null;
ItemListBinding itemListBinding = DataBindingUtil.inflate(
LayoutInflater.from(parent.getContext()),
R.layout.item_list,
parent,
false
);
return new MyViewHolder(itemListBinding);
}
@Override
public void onBindViewHolder(@NonNull ProductAdapter.MyViewHolder holder, int position) {
holder.bindData(productModels.get(position));
}
@Override
public int getItemCount() {
return 0;
return productModels.size();
}
public class MyViewHolder extends RecyclerView.ViewHolder {
public MyViewHolder(@NonNull View itemView) {
super(itemView);
private ItemListBinding binding;
public MyViewHolder(@NonNull ItemListBinding binding) {
super(binding.getRoot());
this.binding = binding;
}
public void bindData(ProductModels products) {
binding.setProducts(products);
}
}
}
package com.yono.messeripos.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.yono.messeripos.models.ProductCartModels;
import java.util.List;
@Dao
public interface CartDaos {
@Query("SELECT * FROM carts ORDER BY id DESC")
public LiveData<List<ProductCartModels>> getCart();
@Insert(onConflict = OnConflictStrategy.IGNORE)
public void insertProduct(ProductCartModels product);
@Update
public void updateProduct(ProductCartModels product);
@Delete
public void deleteProduct(ProductCartModels product);
}
package com.yono.messeripos.database;
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.yono.messeripos.daos.CartDaos;
import com.yono.messeripos.models.ProductCartModels;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@Database(entities = {ProductCartModels.class}, version = 1, exportSchema = false)
public abstract class LocalDatabase extends RoomDatabase {
......@@ -14,4 +24,37 @@ public abstract class LocalDatabase extends RoomDatabase {
private static volatile LocalDatabase INSTANCE;
private static final int NUMBER_OF_THREADS = 407;
public static final ExecutorService databaseWriterExecutor =
Executors.newFixedThreadPool(NUMBER_OF_THREADS);
public static LocalDatabase geDatabase(Context context){
if (INSTANCE == null){
synchronized (LocalDatabase.class){
if (INSTANCE == null){
INSTANCE = Room.databaseBuilder(context.getApplicationContext(),
LocalDatabase.class, "database_meser").build();
}
}
}
return INSTANCE;
}
@NonNull
@Override
protected SupportSQLiteOpenHelper createOpenHelper(DatabaseConfiguration config) {
return null;
}
@NonNull
@Override
protected InvalidationTracker createInvalidationTracker() {
return null;
}
@Override
public void clearAllTables() {
}
}
......@@ -19,14 +19,17 @@ import retrofit2.Callback;
import retrofit2.Response;
public class MainViewModels extends ViewModel {
MutableLiveData<DataResponse<List<ProductModels<List<CategoryModels>>>>> productList;
MutableLiveData<DataResponse<List<ProductModels<CategoryModels>>>> productList;
MutableLiveData<DataResponse<List<CategoryModels>>> categoryList;
Client client = new Client();
public MainViewModels(){ productList = new MutableLiveData<>();}
public MainViewModels(){
productList = new MutableLiveData<>();
categoryList = new MutableLiveData<>();
}
public MutableLiveData<DataResponse<List<ProductModels<List<CategoryModels>>>>> getProduct(){
public MutableLiveData<DataResponse<List<ProductModels<CategoryModels>>>> getProduct(){
getProductList();
return productList;
}
......@@ -43,6 +46,11 @@ public class MainViewModels extends ViewModel {
@Override
public void onResponse(Call<DataResponse<List<ProductModels<CategoryModels>>>> call,
Response<DataResponse<List<ProductModels<CategoryModels>>>> response) {
if (response.body() != null){
productList.setValue(response.body());
}else{
productList.setValue(null);
}
String js = new Gson().toJson(response.body());
Log.d("Get Data", "Response "+js);
}
......@@ -62,6 +70,11 @@ public class MainViewModels extends ViewModel {
public void onResponse(Call<DataResponse<List<CategoryModels>>> call, Response<DataResponse<List<CategoryModels>>> response) {
String js = new Gson().toJson(response.body());
Log.d("Get Data Category", "Response "+js);
if (response.body() != null){
categoryList.setValue(response.body());
}else {
categoryList.setValue(null);
}
}
@Override
......
package com.yono.messeripos.models;
import android.app.Application;
import androidx.annotation.NonNull;
import androidx.lifecycle.AndroidViewModel;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.Transformations;
import com.yono.messeripos.repositories.CartRepositories;
import java.util.List;
public class MainViewModelsCart extends AndroidViewModel {
private MutableLiveData<ProductCartModels> cart = new MutableLiveData<>();
private LiveData<List<ProductCartModels>> productsLive;
private CartRepositories cartRepositories;
public void setProduct(ProductCartModels product){this.cart.setValue(product);}
public LiveData<List<ProductCartModels>> getProduct(){return productsLive;}
public MainViewModelsCart(@NonNull Application application) {
super(application);
cartRepositories = new CartRepositories(application);
}
public void insertCart(ProductCartModels productCartModels){cartRepositories.insert(productCartModels);}
public void updateCart(ProductCartModels productCartModels){cartRepositories.update(productCartModels);}
public void deleteCart(ProductCartModels productCartModels){cartRepositories.delete(productCartModels);}
public MutableLiveData<ProductCartModels> getCart(){
return cart;
}
}
package com.yono.messeripos.repositories;
import android.app.Application;
import androidx.lifecycle.LiveData;
import com.yono.messeripos.daos.CartDaos;
import com.yono.messeripos.database.LocalDatabase;
import com.yono.messeripos.models.ProductCartModels;
import java.util.List;
public class CartRepositories {
private CartDaos cartDaos;
private LiveData<List<ProductCartModels>> products;
public CartRepositories(Application application){
LocalDatabase db = LocalDatabase.geDatabase(application);
cartDaos = db.cartDaos();
products = cartDaos.getCart();
}
public void insert(ProductCartModels productCartModels){
LocalDatabase.databaseWriterExecutor.execute(() -> cartDaos.insertProduct(productCartModels));
}
public void update(ProductCartModels productCartModels){
LocalDatabase.databaseWriterExecutor.execute(() -> cartDaos.insertProduct(productCartModels));
}
public void delete(ProductCartModels productCartModels){
LocalDatabase.databaseWriterExecutor.execute(() -> cartDaos.insertProduct(productCartModels));
}
}
<vector android:height="24dp" android:tint="#FC151B"
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="M18,16v-5c0,-3.07 -1.64,-5.64 -4.5,-6.32L13.5,4c0,-0.83 -0.67,-1.5 -1.5,-1.5s-1.5,0.67 -1.5,1.5v0.68C7.63,5.36 6,7.92 6,11v5l-2,2v1h16v-1l-2,-2zM13,16h-2v-2h2v2zM13,12h-2L11,8h2v4zM12,22c1.1,0 2,-0.9 2,-2h-4c0,1.1 0.89,2 2,2z"/>
</vector>
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
xmlns:tools="http://schemas.android.com/tools">
<include
android:id="@+id/topBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
layout="@layout/appbar_dashboard">
</include>
<data>
<variable
name="mainView"
type="com.yono.messeripos.models.MainViewModels" />
</data>
<include
android:id="@+id/category"
android:layout_marginTop="10dp"
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/topBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@+id/topBar"
layout="@layout/item_category"/>
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:paddingStart="15dp"
xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Scrollable content -->
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvProduct"
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/topAppBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:overScrollMode="never"
android:padding="12sp"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
app:spanCount="2"
app:layout_constraintTop_toBottomOf="@id/category"
tools:listitem="@layout/item_list" />
app:menu="@menu/home"
android:elevation="0dp"
app:navigationIcon="@drawable/ic_meser"
android:layout_marginTop="30dp"
style="@style/Widget.MaterialComponents.Toolbar.Primary"
>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#fff"
android:hint="Search"
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.appbar.AppBarLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvCategory"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginStart="5dp"
app:layout_constraintTop_toBottomOf="@id/topBar"
android:layout_marginTop="10dp"
tools:listitem="@layout/item_category" />
<!-- Scrollable content -->
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvProduct"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:overScrollMode="never"
android:padding="12sp"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
app:spanCount="2"
app:layout_constraintTop_toBottomOf="@id/rvCategory"
tools:listitem="@layout/item_list" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ProductActivity">
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.appbar.AppBarLayout
<com.google.android.material.appbar.AppBarLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:paddingStart="15dp"
xmlns:android="http://schemas.android.com/apk/res/android">
android:paddingStart="15dp">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/topAppBar"
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/topAppBar"
style="@style/Widget.MaterialComponents.Toolbar.Primary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:elevation="0dp"
app:menu="@menu/home"
app:navigationIcon="@drawable/ic_meser">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:menu="@menu/home"
android:elevation="0dp"
app:navigationIcon="@drawable/ic_meser"
android:layout_marginTop="30dp"
style="@style/Widget.MaterialComponents.Toolbar.Primary"
>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#fff"
android:hint="Search"
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>
android:drawableStart="@drawable/ic_baseline_search_24"
android:hint="Search"
android:outlineSpotShadowColor="#fff"
android:paddingStart="10dp"
android:textColor="#fff"
android:textColorHighlight="#fff"
android:textColorHint="#fff" />
</com.google.android.material.appbar.AppBarLayout>
</com.google.android.material.appbar.MaterialToolbar>
</com.google.android.material.appbar.AppBarLayout>
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<com.google.android.material.card.MaterialCardView
android:id="@+id/cvProduct"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_margin="10dp"
app:cardCornerRadius="80dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toTopOf="@id/tfName">
<ImageView
android:id="@+id/ivProduct"
android:layout_width="160dp"
android:layout_height="160dp"
android:scaleType="centerCrop"
android:src="@drawable/ic_meser_icon" />
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/tfName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:hint="@string/name"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
app:layout_constraintTop_toBottomOf="@+id/cvProduct"
tools:ignore="MissingConstraints">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/etName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/tfPrice"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:hint="@string/price"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
app:layout_constraintTop_toBottomOf="@id/tfName">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/etPrice"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/tfStock"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:hint="@string/stock"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
app:layout_constraintTop_toBottomOf="@id/tfPrice">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/etStock"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</com.google.android.material.textfield.TextInputLayout>
<Spinner
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/listCategory"
android:padding="15dp"
android:layout_margin="10dp"
app:layout_constraintTop_toBottomOf="@id/tfStock">
</Spinner>
<com.google.android.material.button.MaterialButton
android:id="@+id/btnAdd"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
app:layout_constraintTop_toBottomOf="@+id/listCategory"
android:text="@string/add"
tools:ignore="MissingConstraints" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<HorizontalScrollView
<layout xmlns:tools="http://schemas.android.com/tools"
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"
android:layout_height="60dp"
android:layout_width="match_parent"
android:scrollbars="none">
xmlns:app="http://schemas.android.com/apk/res-auto">
<LinearLayout
<data>
<variable
name="category"
type="com.yono.messeripos.models.CategoryModels" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_height="40dp"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:paddingStart="10dp"
android:paddingTop="5dp"
android:paddingEnd="10dp"
android:orientation="horizontal">
android:layout_marginEnd="5dp">
<com.google.android.material.card.MaterialCardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/cvCategory"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:backgroundTint="@color/ic_launcher_background"
app:cardCornerRadius="15dp">
app:cardCornerRadius="40dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
......@@ -29,52 +30,8 @@
android:id="@+id/image_cat"
android:layout_width="30dp"
android:layout_height="50dp"
android:src="@drawable/ic_meser"
android:layout_marginStart="10dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.06"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0"
tools:ignore="MissingConstraints" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/roboto"
android:text="Food"
android:textStyle="bold"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/image_cat"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginStart="10dp"
android:layout_marginEnd="40dp"
tools:ignore="MissingConstraints" />
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.card.MaterialCardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:backgroundTint="@color/ic_launcher_background"
android:layout_marginStart="20dp"
app:cardCornerRadius="15dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/image_cat1"
android:layout_width="30dp"
android:layout_height="50dp"
android:src="@drawable/ic_meser"
android:layout_marginStart="10dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.06"
......@@ -86,65 +43,25 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/roboto"
android:text="Food"
android:textStyle="bold"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/image_cat1"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginStart="10dp"
android:layout_marginEnd="40dp"
tools:ignore="MissingConstraints" />
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.card.MaterialCardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:backgroundTint="@color/ic_launcher_background"
android:layout_marginStart="20dp"
app:cardCornerRadius="15dp">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/image_cat2"
android:layout_width="30dp"
android:layout_height="50dp"
android:src="@drawable/ic_meser"
android:layout_marginStart="10dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.06"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0"
tools:ignore="MissingConstraints" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/roboto"
android:text="Food"
android:text="@{category.nameCategory}"
android:textStyle="bold"
android:textSize="20sp"
android:textColor="#fff"
tools:text="@tools:sample/full_names"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/image_cat2"
app:layout_constraintStart_toEndOf="@id/image_cat"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginStart="10dp"
android:layout_marginEnd="40dp"
tools:ignore="MissingConstraints" />
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
</LinearLayout>
</HorizontalScrollView>
\ No newline at end of file
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
......@@ -5,7 +5,7 @@
<data>
<variable
name="product"
name="products"
type="com.yono.messeripos.models.ProductModels" />
</data>
......
......@@ -21,11 +21,14 @@
<com.google.android.material.card.MaterialCardView
android:id="@+id/cvPayment"
android:clickable="true"
android:focusable="true"
android:checkable="true"
android:layout_height="wrap_content"
android:layout_width="match_parent"
app:layout_constraintTop_toTopOf="parent"
app:strokeWidth="1dp"
app:strokeColor="#22333333">
app:strokeColor="@color/color_stroke">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
......@@ -64,16 +67,6 @@
app:layout_constraintTop_toTopOf="parent"
/>
<com.google.android.material.radiobutton.MaterialRadioButton
android:id="@+id/rbPayment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:enabled="false"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="@id/ivLogo"
app:layout_constraintTop_toTopOf="@id/ivLogo"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
......
......@@ -5,4 +5,5 @@
<color name="colorAccent">#0f4c75</color>
<color name="colorWhite">#fff</color>
<color name="mtrl_textinput_default_box_stroke_color">#fff</color>
<color name="color_stroke">#22333333</color>
</resources>
\ No newline at end of file
......@@ -18,5 +18,9 @@
<string name="hint_description">Description</string>
<string name="username">Username</string>
<string name="password">password</string>
<string name="name">Name</string>
<string name="price">Price</string>
<string name="stock">Stock</string>
<string name="add">Add</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