Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
Your Cashier
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ahmad Abi Mulya
Your Cashier
Commits
1ec17828
Commit
1ec17828
authored
Aug 31, 2020
by
Trio Saputra
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://git.mdd.co.id:44195/abimulya/your-cashier
parents
83941788
a5fd849d
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
240 additions
and
124 deletions
+240
-124
ForgetPassword.java
...om/example/yourcashiertest/activities/ForgetPassword.java
+1
-0
LoginActivity.java
...com/example/yourcashiertest/activities/LoginActivity.java
+1
-0
MainActivity.java
.../com/example/yourcashiertest/activities/MainActivity.java
+9
-6
PaymentActivity.java
...m/example/yourcashiertest/activities/PaymentActivity.java
+19
-27
ProductActivity.java
...m/example/yourcashiertest/activities/ProductActivity.java
+0
-1
CartAdapter.java
...ava/com/example/yourcashiertest/adapters/CartAdapter.java
+0
-1
PaymentAdapter.java
.../com/example/yourcashiertest/adapters/PaymentAdapter.java
+85
-0
ProductDao.java
...ain/java/com/example/yourcashiertest/daos/ProductDao.java
+3
-0
ResponsePayment.java
...a/com/example/yourcashiertest/models/ResponsePayment.java
+49
-0
ProductRepository.java
...ample/yourcashiertest/repositories/ProductRepository.java
+1
-0
ProductViewModel.java
.../example/yourcashiertest/viewmodels/ProductViewModel.java
+0
-1
activity_payment.xml
app/src/main/res/layout/activity_payment.xml
+12
-80
category_item.xml
app/src/main/res/layout/category_item.xml
+10
-8
payment_item.xml
app/src/main/res/layout/payment_item.xml
+50
-0
No files found.
app/src/main/java/com/example/yourcashiertest/activities/ForgetPassword.java
View file @
1ec17828
...
@@ -43,6 +43,7 @@ public class ForgetPassword extends AppCompatActivity {
...
@@ -43,6 +43,7 @@ public class ForgetPassword extends AppCompatActivity {
password
.
setNewPassword
(
binding
.
etNewPw
.
getText
().
toString
());
password
.
setNewPassword
(
binding
.
etNewPw
.
getText
().
toString
());
userViewModel
.
resetPassword
(
users
.
get
(
i
).
getId
()
,
password
);
userViewModel
.
resetPassword
(
users
.
get
(
i
).
getId
()
,
password
);
binding
.
setLoading
(
false
);
binding
.
setLoading
(
false
);
Toast
.
makeText
(
ForgetPassword
.
this
,
"Reset Password Success"
,
Toast
.
LENGTH_LONG
).
show
();
startActivity
(
new
Intent
(
ForgetPassword
.
this
,
LoginActivity
.
class
));
startActivity
(
new
Intent
(
ForgetPassword
.
this
,
LoginActivity
.
class
));
finish
();
finish
();
return
;
return
;
...
...
app/src/main/java/com/example/yourcashiertest/activities/LoginActivity.java
View file @
1ec17828
...
@@ -44,6 +44,7 @@ public class LoginActivity extends AppCompatActivity {
...
@@ -44,6 +44,7 @@ public class LoginActivity extends AppCompatActivity {
binding
.
setLoading
(
true
);
binding
.
setLoading
(
true
);
viewModel
.
setListUser
();
viewModel
.
setListUser
();
launchMain
();
launchMain
();
finish
();
}
}
});
});
}
}
...
...
app/src/main/java/com/example/yourcashiertest/activities/MainActivity.java
View file @
1ec17828
...
@@ -10,11 +10,13 @@ import androidx.recyclerview.widget.LinearLayoutManager;
...
@@ -10,11 +10,13 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import
android.Manifest
;
import
android.Manifest
;
import
android.annotation.SuppressLint
;
import
android.annotation.SuppressLint
;
import
android.app.Application
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.content.SharedPreferences
;
import
android.content.SharedPreferences
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.text.Editable
;
import
android.text.Editable
;
import
android.text.TextWatcher
;
import
android.text.TextWatcher
;
import
android.util.Log
;
import
android.widget.PopupMenu
;
import
android.widget.PopupMenu
;
import
android.widget.Toast
;
import
android.widget.Toast
;
...
@@ -24,6 +26,7 @@ import com.example.yourcashiertest.adapters.ProductAdapter;
...
@@ -24,6 +26,7 @@ import com.example.yourcashiertest.adapters.ProductAdapter;
import
com.example.yourcashiertest.databinding.ActivityMainBinding
;
import
com.example.yourcashiertest.databinding.ActivityMainBinding
;
import
com.example.yourcashiertest.entities.Cart
;
import
com.example.yourcashiertest.entities.Cart
;
import
com.example.yourcashiertest.entities.Product
;
import
com.example.yourcashiertest.entities.Product
;
import
com.example.yourcashiertest.repositories.ProductRepository
;
import
com.example.yourcashiertest.viewmodels.CartViewModel
;
import
com.example.yourcashiertest.viewmodels.CartViewModel
;
import
com.example.yourcashiertest.viewmodels.ProductViewModel
;
import
com.example.yourcashiertest.viewmodels.ProductViewModel
;
...
@@ -117,16 +120,16 @@ public class MainActivity extends AppCompatActivity {
...
@@ -117,16 +120,16 @@ public class MainActivity extends AppCompatActivity {
binding
.
rvProducts
.
setAdapter
(
adapter
);
binding
.
rvProducts
.
setAdapter
(
adapter
);
viewModel
=
new
ViewModelProvider
(
this
).
get
(
ProductViewModel
.
class
);
viewModel
=
new
ViewModelProvider
(
this
).
get
(
ProductViewModel
.
class
);
viewModel
.
getProducts
().
observe
(
this
,
adapter:
:
setProducts
);
viewModel
.
getProducts
().
observe
(
this
,
products
->
{
viewModel
.
getProducts
().
observe
(
this
,
products
->
{
adapter
.
setProducts
(
products
);
List
<
String
>
category
=
new
ArrayList
<>();
List
<
String
>
list
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
products
.
size
();
i
++){
for
(
int
i
=
0
;
i
<
products
.
size
();
i
++){
list
.
add
(
products
.
get
(
i
).
getCategory
());
category
.
add
(
products
.
get
(
i
).
getCategory
().
toLowerCase
());
}
}
categoryAdapter
.
setCategories
(
list
);
categoryAdapter
.
setCategories
(
category
);
});
});
categoryAdapter
.
setListener
(
category
->
viewModel
.
filter
(
category
.
toLowerCase
()));
categoryAdapter
.
setListener
(
category
->
viewModel
.
filter
(
category
));
adapter
.
setListener
(
new
ProductAdapter
.
ProductListener
()
{
adapter
.
setListener
(
new
ProductAdapter
.
ProductListener
()
{
@Override
@Override
...
...
app/src/main/java/com/example/yourcashiertest/activities/PaymentActivity.java
View file @
1ec17828
...
@@ -4,6 +4,8 @@ import androidx.annotation.RequiresApi;
...
@@ -4,6 +4,8 @@ import androidx.annotation.RequiresApi;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.databinding.DataBindingUtil
;
import
androidx.databinding.DataBindingUtil
;
import
androidx.lifecycle.ViewModelProvider
;
import
androidx.lifecycle.ViewModelProvider
;
import
androidx.recyclerview.widget.LinearLayoutManager
;
import
androidx.recyclerview.widget.RecyclerView
;
import
android.annotation.SuppressLint
;
import
android.annotation.SuppressLint
;
import
android.content.Intent
;
import
android.content.Intent
;
...
@@ -13,20 +15,25 @@ import android.os.Bundle;
...
@@ -13,20 +15,25 @@ import android.os.Bundle;
import
android.text.TextUtils
;
import
android.text.TextUtils
;
import
android.view.View
;
import
android.view.View
;
import
com.example.yourcashiertest.R
;
import
com.example.yourcashiertest.R
;
import
com.example.yourcashiertest.adapters.PaymentAdapter
;
import
com.example.yourcashiertest.databinding.ActivityPaymentBinding
;
import
com.example.yourcashiertest.databinding.ActivityPaymentBinding
;
import
com.example.yourcashiertest.models.ResponsePayment
;
import
com.example.yourcashiertest.utils.Convert
;
import
com.example.yourcashiertest.utils.Convert
;
import
com.example.yourcashiertest.utils.ViewUtil
;
import
com.example.yourcashiertest.utils.ViewUtil
;
import
com.example.yourcashiertest.viewmodels.CartViewModel
;
import
com.example.yourcashiertest.viewmodels.CartViewModel
;
import
java.util.ArrayList
;
public
class
PaymentActivity
extends
AppCompatActivity
{
public
class
PaymentActivity
extends
AppCompatActivity
{
ActivityPaymentBinding
binding
;
ActivityPaymentBinding
binding
;
public
static
String
paymentMethod
=
""
;
public
static
String
REFUND
=
"refund"
;
public
static
String
REFUND
=
"refund"
;
public
int
refund
;
public
int
refund
;
public
int
amount
;
public
int
amount
;
CartViewModel
cartViewModel
;
CartViewModel
cartViewModel
;
public
String
payment
=
""
;
public
static
final
String
PAY_WITH
=
"pay_with"
;
public
static
final
String
PAY_WITH
=
"pay_with"
;
private
ArrayList
<
ResponsePayment
>
responsePayments
=
new
ArrayList
<>();
@SuppressLint
(
"ResourceAsColor"
)
@SuppressLint
(
"ResourceAsColor"
)
@RequiresApi
(
api
=
Build
.
VERSION_CODES
.
N
)
@RequiresApi
(
api
=
Build
.
VERSION_CODES
.
N
)
...
@@ -39,36 +46,23 @@ public class PaymentActivity extends AppCompatActivity {
...
@@ -39,36 +46,23 @@ public class PaymentActivity extends AppCompatActivity {
amount
=
getIntent
().
getIntExtra
(
CartActivity
.
PRICE
,
0
);
amount
=
getIntent
().
getIntExtra
(
CartActivity
.
PRICE
,
0
);
binding
.
setAmount
(
Convert
.
changeToCurrency
(
amount
));
binding
.
setAmount
(
Convert
.
changeToCurrency
(
amount
));
// binding.rvPayment.setLayoutManager(new LinearLayoutManager(this, RecyclerView.VERTICAL, false));
responsePayments
.
add
(
new
ResponsePayment
(
"https://i.ibb.co/yfcFMHc/undraw-wallet-aym5.png"
,
"Cash"
));
responsePayments
.
add
(
new
ResponsePayment
(
"https://i.ibb.co/qNnKh5n/undraw-Credit-card-re-blml.png"
,
"Card"
));
binding
.
cbCash
.
setOnClickListener
(
v
->
{
PaymentAdapter
adapter
=
new
PaymentAdapter
(
responsePayments
,
this
);
if
(
binding
.
getCheckCash
()){
binding
.
rvPayment
.
setAdapter
(
adapter
);
binding
.
setCheckCash
(
false
);
binding
.
cvCash
.
setCardBackgroundColor
(
0
);
payment
=
""
;
}
else
{
binding
.
setCheckCash
(
true
);
binding
.
cvCash
.
setCardBackgroundColor
(
R
.
color
.
blue
);
payment
=
"Cash"
;
}
});
binding
.
cbCard
.
setOnClickListener
(
v
->
{
if
(
binding
.
getCheckCard
()){
binding
.
setCheckCard
(
false
);
binding
.
cvCard
.
setCardBackgroundColor
(
0
);
payment
=
""
;
}
else
{
binding
.
setCheckCard
(
true
);
binding
.
cvCard
.
setCardBackgroundColor
(
R
.
color
.
blue
);
payment
=
"Card"
;
}
});
adapter
.
setListener
(
responsePayments
->
{
paymentMethod
=
responsePayments
.
getBank
();
binding
.
btnPay
.
setEnabled
(
true
);
});
}
}
public
void
btnPay
(
View
view
)
{
public
void
btnPay
(
View
view
)
{
if
(
TextUtils
.
isEmpty
(
binding
.
etAmountPaid
.
getText
().
toString
())){
if
(
TextUtils
.
isEmpty
(
binding
.
etAmountPaid
.
getText
().
toString
())){
ViewUtil
.
showMessage
(
view
,
"Please input Amount Paid by Customer!"
);
ViewUtil
.
showMessage
(
view
,
"Please input Amount Paid by Customer!"
);
}
else
if
(
payment
.
equals
(
""
)){
}
else
if
(
payment
Method
.
equals
(
""
)){
ViewUtil
.
showMessage
(
view
,
"Please choose type payment"
);
ViewUtil
.
showMessage
(
view
,
"Please choose type payment"
);
}
else
{
}
else
{
int
amountPaid
=
Integer
.
parseInt
(
binding
.
etAmountPaid
.
getText
().
toString
());
int
amountPaid
=
Integer
.
parseInt
(
binding
.
etAmountPaid
.
getText
().
toString
());
...
@@ -76,15 +70,13 @@ public class PaymentActivity extends AppCompatActivity {
...
@@ -76,15 +70,13 @@ public class PaymentActivity extends AppCompatActivity {
ViewUtil
.
showMessage
(
view
,
"AmountPaid doesn't less than total price"
);
ViewUtil
.
showMessage
(
view
,
"AmountPaid doesn't less than total price"
);
}
else
{
}
else
{
refund
=
amountPaid
-
amount
;
refund
=
amountPaid
-
amount
;
startActivity
(
new
Intent
(
PaymentActivity
.
this
,
StatusPayment
.
class
).
putExtra
(
REFUND
,
refund
).
putExtra
(
PAY_WITH
,
payment
));
startActivity
(
new
Intent
(
PaymentActivity
.
this
,
StatusPayment
.
class
).
putExtra
(
REFUND
,
refund
).
putExtra
(
PAY_WITH
,
payment
Method
));
cartViewModel
.
clear
();
cartViewModel
.
clear
();
finish
();
finish
();
}
}
}
}
}
}
@Override
@Override
protected
void
onDestroy
()
{
protected
void
onDestroy
()
{
super
.
onDestroy
();
super
.
onDestroy
();
...
...
app/src/main/java/com/example/yourcashiertest/activities/ProductActivity.java
View file @
1ec17828
...
@@ -15,7 +15,6 @@ import android.os.Environment;
...
@@ -15,7 +15,6 @@ import android.os.Environment;
import
android.provider.MediaStore
;
import
android.provider.MediaStore
;
import
android.text.TextUtils
;
import
android.text.TextUtils
;
import
android.util.Log
;
import
android.util.Log
;
import
com.example.yourcashiertest.R
;
import
com.example.yourcashiertest.R
;
import
com.example.yourcashiertest.databinding.ActivityProductBinding
;
import
com.example.yourcashiertest.databinding.ActivityProductBinding
;
import
com.example.yourcashiertest.entities.Product
;
import
com.example.yourcashiertest.entities.Product
;
...
...
app/src/main/java/com/example/yourcashiertest/adapters/CartAdapter.java
View file @
1ec17828
...
@@ -19,7 +19,6 @@ import java.util.List;
...
@@ -19,7 +19,6 @@ import java.util.List;
public
class
CartAdapter
extends
RecyclerView
.
Adapter
<
CartAdapter
.
ViewHolder
>
{
public
class
CartAdapter
extends
RecyclerView
.
Adapter
<
CartAdapter
.
ViewHolder
>
{
private
List
<
Cart
>
carts
=
new
ArrayList
<>();
private
List
<
Cart
>
carts
=
new
ArrayList
<>();
public
interface
CartListener
{
public
interface
CartListener
{
void
onIncrease
(
Cart
cart
);
void
onIncrease
(
Cart
cart
);
void
onDecrease
(
Cart
cart
);
void
onDecrease
(
Cart
cart
);
...
...
app/src/main/java/com/example/yourcashiertest/adapters/PaymentAdapter.java
0 → 100644
View file @
1ec17828
package
com
.
example
.
yourcashiertest
.
adapters
;
import
android.annotation.SuppressLint
;
import
android.content.Context
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.RadioButton
;
import
androidx.annotation.NonNull
;
import
androidx.databinding.DataBindingUtil
;
import
androidx.recyclerview.widget.RecyclerView
;
import
com.example.yourcashiertest.R
;
import
com.example.yourcashiertest.activities.PaymentActivity
;
import
com.example.yourcashiertest.databinding.PaymentItemBinding
;
import
com.example.yourcashiertest.models.ResponsePayment
;
import
java.util.ArrayList
;
public
class
PaymentAdapter
extends
RecyclerView
.
Adapter
<
PaymentAdapter
.
ViewHolder
>
{
private
ArrayList
<
ResponsePayment
>
responsePayments
;
Context
context
;
int
getPosition
=
-
1
;
public
interface
PaymentListener
{
void
onSelectPayment
(
ResponsePayment
responsePayment
);
}
private
PaymentListener
listener
;
public
void
setListener
(
PaymentListener
listener
)
{
this
.
listener
=
listener
;
}
public
PaymentAdapter
(
ArrayList
<
ResponsePayment
>
responsePayments
,
PaymentActivity
paymentActivity
)
{
this
.
responsePayments
=
responsePayments
;
this
.
context
=
paymentActivity
;
}
@NonNull
@Override
public
ViewHolder
onCreateViewHolder
(
@NonNull
ViewGroup
parent
,
int
viewType
)
{
PaymentItemBinding
paymentItemBinding
=
DataBindingUtil
.
inflate
(
LayoutInflater
.
from
(
parent
.
getContext
()),
R
.
layout
.
payment_item
,
parent
,
false
);
return
new
ViewHolder
(
paymentItemBinding
);
}
@Override
public
void
onBindViewHolder
(
@NonNull
PaymentAdapter
.
ViewHolder
holder
,
int
position
){
holder
.
binData
(
responsePayments
.
get
(
position
));
holder
.
radioButton
.
setChecked
(
position
==
getPosition
);
}
@Override
public
int
getItemCount
()
{
return
responsePayments
.
size
();
}
public
class
ViewHolder
extends
RecyclerView
.
ViewHolder
{
PaymentItemBinding
binding
;
RadioButton
radioButton
;
public
ViewHolder
(
@NonNull
PaymentItemBinding
itemView
)
{
super
(
itemView
.
getRoot
());
this
.
binding
=
itemView
;
this
.
radioButton
=
itemView
.
rbPayment
;
}
@SuppressLint
(
"ResourceAsColor"
)
public
void
binData
(
ResponsePayment
responsePayment
){
binding
.
setPayment
(
responsePayment
);
binding
.
setLogo
(
responsePayment
.
getUrl
());
binding
.
cvPayment
.
setOnClickListener
(
view
->{
getPosition
=
getAdapterPosition
();
notifyDataSetChanged
();
listener
.
onSelectPayment
(
responsePayment
);});
}
}
}
app/src/main/java/com/example/yourcashiertest/daos/ProductDao.java
View file @
1ec17828
...
@@ -17,6 +17,9 @@ public interface ProductDao {
...
@@ -17,6 +17,9 @@ public interface ProductDao {
@Query
(
"SELECT * FROM products ORDER BY id DESC"
)
@Query
(
"SELECT * FROM products ORDER BY id DESC"
)
public
LiveData
<
List
<
Product
>>
getProducts
();
public
LiveData
<
List
<
Product
>>
getProducts
();
// @Query("SELECT category FROM products")
// public LiveData<List<Product>> getAllCategory();
@Query
(
"SELECT * FROM products WHERE name LIKE :query OR category LIKE:query ORDER BY id DESC"
)
@Query
(
"SELECT * FROM products WHERE name LIKE :query OR category LIKE:query ORDER BY id DESC"
)
public
LiveData
<
List
<
Product
>>
getFilteredProducts
(
String
query
);
public
LiveData
<
List
<
Product
>>
getFilteredProducts
(
String
query
);
...
...
app/src/main/java/com/example/yourcashiertest/models/ResponsePayment.java
0 → 100644
View file @
1ec17828
package
com
.
example
.
yourcashiertest
.
models
;
import
android.widget.ImageView
;
import
androidx.databinding.BindingAdapter
;
import
com.bumptech.glide.Glide
;
public
class
ResponsePayment
{
private
String
url
;
private
String
bank
;
private
boolean
isSelected
;
public
boolean
isSelected
()
{
return
isSelected
;
}
public
void
setSelected
(
boolean
selected
)
{
isSelected
=
selected
;
}
public
ResponsePayment
(
String
url
,
String
bank
)
{
this
.
url
=
url
;
this
.
bank
=
bank
;
}
public
void
setUrl
(
String
url
)
{
this
.
url
=
url
;
}
public
String
getUrl
()
{
return
url
;
}
public
String
getBank
()
{
return
bank
;
}
public
void
setBank
(
String
bank
)
{
this
.
bank
=
bank
;
}
@BindingAdapter
(
"img_bank"
)
public
static
void
loadImage
(
ImageView
view
,
String
url
)
{
Glide
.
with
(
view
.
getContext
())
.
load
(
url
)
.
into
(
view
);
}
}
app/src/main/java/com/example/yourcashiertest/repositories/ProductRepository.java
View file @
1ec17828
...
@@ -37,5 +37,6 @@ public class ProductRepository {
...
@@ -37,5 +37,6 @@ public class ProductRepository {
public
LiveData
<
List
<
Product
>>
filteredProducts
(
String
s
)
{
public
LiveData
<
List
<
Product
>>
filteredProducts
(
String
s
)
{
return
productDao
.
getFilteredProducts
(
s
);
return
productDao
.
getFilteredProducts
(
s
);
}
}
}
}
app/src/main/java/com/example/yourcashiertest/viewmodels/ProductViewModel.java
View file @
1ec17828
...
@@ -19,7 +19,6 @@ public class ProductViewModel extends AndroidViewModel {
...
@@ -19,7 +19,6 @@ public class ProductViewModel extends AndroidViewModel {
private
MutableLiveData
<
String
>
photo
=
new
MutableLiveData
<>(
""
);
private
MutableLiveData
<
String
>
photo
=
new
MutableLiveData
<>(
""
);
private
MutableLiveData
<
String
>
query
=
new
MutableLiveData
<>(
"%"
);
private
MutableLiveData
<
String
>
query
=
new
MutableLiveData
<>(
"%"
);
private
MutableLiveData
<
String
>
category
=
new
MutableLiveData
<>(
"%"
);
private
MutableLiveData
<
Product
>
product
=
new
MutableLiveData
<>();
private
MutableLiveData
<
Product
>
product
=
new
MutableLiveData
<>();
private
LiveData
<
List
<
Product
>>
products
;
private
LiveData
<
List
<
Product
>>
products
;
...
...
app/src/main/res/layout/activity_payment.xml
View file @
1ec17828
...
@@ -32,7 +32,7 @@
...
@@ -32,7 +32,7 @@
android:gravity=
"top"
android:gravity=
"top"
android:text=
"@string/payment"
android:text=
"@string/payment"
android:textAppearance=
"@style/payment"
android:textAppearance=
"@style/payment"
app:layout_constraintBottom_toTopOf=
"@id/
cvCash
"
app:layout_constraintBottom_toTopOf=
"@id/
rvPayment
"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintHorizontal_bias=
"0.0"
app:layout_constraintHorizontal_bias=
"0.0"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
...
@@ -47,105 +47,37 @@
...
@@ -47,105 +47,37 @@
android:gravity=
"center"
android:gravity=
"center"
android:text=
"@{amount}"
android:text=
"@{amount}"
android:textSize=
"24dp"
android:textSize=
"24dp"
app:layout_constraintBottom_toTopOf=
"@id/rvPayment"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintHorizontal_bias=
"0.902"
app:layout_constraintHorizontal_bias=
"0.902"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/tvPayment"
app:layout_constraintTop_toBottomOf=
"@id/tvPayment"
app:layout_constraintVertical_bias=
"0.0"
/>
app:layout_constraintVertical_bias=
"0.0"
/>
<com.google.android.material.card.MaterialCardView
android:id=
"@+id/cvCash"
android:layout_width=
"match_parent"
android:layout_height=
"100dp"
android:layout_marginTop=
"20dp"
android:clickable=
"true"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/tvTotal"
>
<androidx.constraintlayout.widget.ConstraintLayout
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rvPayment"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"100dp"
android:paddingVertical=
"5dp"
>
<ImageView
android:id=
"@+id/iv_cash"
android:layout_width=
"150dp"
android:layout_height=
"0dp"
android:layout_marginStart=
"4dp"
android:src=
"@drawable/ic_undraw_wallet"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintVertical_bias=
"1.0"
/>
<CheckBox
android:id=
"@+id/cbCash"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginEnd=
"20dp"
android:padding=
"@dimen/space_small"
android:buttonTint=
"@color/black"
app:layoutManager=
"androidx.recyclerview.widget.LinearLayoutManager"
android:text=
"Cash"
android:checked=
"@{checkCash}"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
/>
</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_constraintEnd_toEndOf=
"parent"
app:layout_constraintBottom_toTopOf=
"@id/tvAmountPaid"
app:layout_constraintHorizontal_bias=
"0.666"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/cvCash"
tools:listitem=
"@layout/payment_item"
/>
app:layout_constraintVertical_bias=
"0.04000002"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:paddingVertical=
"5dp"
>
<ImageView
android:id=
"@+id/iv_card"
android:layout_width=
"150dp"
android:layout_height=
"0dp"
android:src=
"@drawable/ic_undraw_credit_card"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<CheckBox
android:id=
"@+id/cbCard"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginEnd=
"20dp"
android:buttonTint=
"@color/black"
android:text=
"Card"
android:checked=
"@{checkCard}"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
<TextView
<TextView
android:id=
"@+id/tvAmountPaid"
android:id=
"@+id/tvAmountPaid"
android:layout_width=
"100dp"
android:layout_width=
"100dp"
android:layout_height=
"30dp"
android:layout_height=
"30dp"
android:layout_marginTop=
"208dp"
android:layout_marginTop=
"208dp"
android:layout_marginBottom=
"
7
0dp"
android:layout_marginBottom=
"
2
0dp"
android:gravity=
"start"
android:gravity=
"start"
android:text=
"Amount paid"
android:text=
"Amount paid"
app:layout_constraintBottom_toTopOf=
"@id/etAmountPaid"
app:layout_constraintBottom_toTopOf=
"@id/etAmountPaid"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintHorizontal_bias=
"0.0"
app:layout_constraintHorizontal_bias=
"0.0"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
/>
app:layout_constraintTop_toBottomOf=
"@id/cvCard"
/>
<EditText
<EditText
android:id=
"@+id/etAmountPaid"
android:id=
"@+id/etAmountPaid"
...
...
app/src/main/res/layout/category_item.xml
View file @
1ec17828
...
@@ -18,30 +18,32 @@
...
@@ -18,30 +18,32 @@
<com.google.android.material.card.MaterialCardView
<com.google.android.material.card.MaterialCardView
android:id=
"@+id/cvCategory"
android:id=
"@+id/cvCategory"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"
wrap_content
"
android:layout_height=
"
30dp
"
android:backgroundTint=
"@color/colorPrimaryDark"
android:backgroundTint=
"@color/colorPrimaryDark"
android:checkable=
"true"
android:clickable=
"true"
android:clickable=
"true"
android:clipToPadding=
"true"
android:focusable=
"true"
android:focusable=
"true"
android:checkable=
"true"
app:cardCornerRadius=
"10dp"
app:cardCornerRadius=
"10dp"
android:clipToPadding=
"true"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraint
End_toEnd
Of=
"parent"
>
app:layout_constraint
Top_toTop
Of=
"parent"
>
<RelativeLayout
<RelativeLayout
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:paddingHorizontal=
"15dp"
>
android:paddingHorizontal=
"15dp"
>
<TextView
<TextView
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerInParent=
"true"
android:gravity=
"center"
android:text=
"@{category}"
android:text=
"@{category}"
android:textSize=
"18sp"
tools:text=
"@tools:sample/lorem"
android:textColor=
"#fff"
android:textColor=
"#fff"
android:layout_centerInParent=
"true"
/>
android:textSize=
"18sp"
tools:text=
"@tools:sample/lorem"
/>
</RelativeLayout>
</RelativeLayout>
</com.google.android.material.card.MaterialCardView>
</com.google.android.material.card.MaterialCardView>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
...
...
app/src/main/res/layout/payment_item.xml
0 → 100644
View file @
1ec17828
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<data>
<variable
name=
"logo"
type=
"String"
/>
<variable
name=
"payment"
type=
"com.example.yourcashiertest.models.ResponsePayment"
/>
</data>
<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"
android:layout_marginVertical=
"10dp"
android:layout_marginHorizontal=
"2dp"
app:layout_constraintTop_toTopOf=
"parent"
app:strokeWidth=
"1dp"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:padding=
"15dp"
>
<ImageView
android:id=
"@+id/ivLogo"
android:layout_width=
"120dp"
android:layout_height=
"100dp"
android:src=
"@drawable/ic_undraw_wallet"
app:img_bank=
"@{logo}"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
/>
<RadioButton
android:id=
"@+id/rbPayment"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:buttonTint=
"@color/colorPrimary"
android:enabled=
"false"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
</layout>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment