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
2dd2b703
Commit
2dd2b703
authored
Aug 28, 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
a28bae52
ef2faae8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
583 additions
and
370 deletions
+583
-370
CartActivity.java
.../com/example/yourcashiertest/activities/CartActivity.java
+7
-0
ForgetPassword.java
...om/example/yourcashiertest/activities/ForgetPassword.java
+44
-1
LoginActivity.java
...com/example/yourcashiertest/activities/LoginActivity.java
+38
-48
MainActivity.java
.../com/example/yourcashiertest/activities/MainActivity.java
+2
-2
PaymentActivity.java
...m/example/yourcashiertest/activities/PaymentActivity.java
+29
-37
PrefManager.java
...a/com/example/yourcashiertest/activities/PrefManager.java
+1
-1
ProductActivity.java
...m/example/yourcashiertest/activities/ProductActivity.java
+6
-1
RegisterActivity.java
.../example/yourcashiertest/activities/RegisterActivity.java
+16
-7
StatusPayment.java
...com/example/yourcashiertest/activities/StatusPayment.java
+3
-0
WelcomeActivity.java
...m/example/yourcashiertest/activities/WelcomeActivity.java
+4
-1
Password.java
...ain/java/com/example/yourcashiertest/models/Password.java
+25
-0
User.java
...rc/main/java/com/example/yourcashiertest/models/User.java
+14
-0
UserService.java
...ava/com/example/yourcashiertest/services/UserService.java
+7
-0
UserViewModel.java
...com/example/yourcashiertest/viewmodels/UserViewModel.java
+22
-0
ic_undraw_credit_card.xml
app/src/main/res/drawable/ic_undraw_credit_card.xml
+17
-17
activity_cart.xml
app/src/main/res/layout/activity_cart.xml
+12
-13
activity_forget_password.xml
app/src/main/res/layout/activity_forget_password.xml
+97
-92
activity_login.xml
app/src/main/res/layout/activity_login.xml
+124
-96
activity_main.xml
app/src/main/res/layout/activity_main.xml
+11
-2
activity_payment.xml
app/src/main/res/layout/activity_payment.xml
+40
-42
activity_product.xml
app/src/main/res/layout/activity_product.xml
+3
-0
activity_sk.xml
app/src/main/res/layout/activity_sk.xml
+2
-2
cart_item.xml
app/src/main/res/layout/cart_item.xml
+10
-7
category_item.xml
app/src/main/res/layout/category_item.xml
+49
-0
colors.xml
app/src/main/res/values/colors.xml
+0
-1
No files found.
app/src/main/java/com/example/yourcashiertest/activities/CartActivity.java
View file @
2dd2b703
...
...
@@ -2,6 +2,7 @@ package com.example.yourcashiertest.activities;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.databinding.DataBindingUtil
;
import
androidx.lifecycle.Observer
;
import
androidx.lifecycle.ViewModelProvider
;
import
androidx.recyclerview.widget.LinearLayoutManager
;
...
...
@@ -13,8 +14,12 @@ import com.example.yourcashiertest.R;
import
com.example.yourcashiertest.adapters.CartAdapter
;
import
com.example.yourcashiertest.databinding.ActivityCartBinding
;
import
com.example.yourcashiertest.entities.Cart
;
import
com.example.yourcashiertest.entities.Product
;
import
com.example.yourcashiertest.utils.Convert
;
import
com.example.yourcashiertest.viewmodels.CartViewModel
;
import
com.example.yourcashiertest.viewmodels.ProductViewModel
;
import
java.util.List
;
public
class
CartActivity
extends
AppCompatActivity
{
...
...
@@ -33,6 +38,8 @@ public class CartActivity extends AppCompatActivity {
binding
.
rvCartList
.
setLayoutManager
(
new
LinearLayoutManager
(
this
));
binding
.
rvCartList
.
setAdapter
(
adapter
);
ProductViewModel
viewModel
=
new
ViewModelProvider
(
this
).
get
(
ProductViewModel
.
class
);
CartViewModel
cartViewModel
=
new
ViewModelProvider
(
this
).
get
(
CartViewModel
.
class
);
cartViewModel
.
getCarts
().
observe
(
this
,
carts
->
adapter
.
setCartList
(
carts
));
...
...
app/src/main/java/com/example/yourcashiertest/activities/ForgetPassword.java
View file @
2dd2b703
package
com
.
example
.
yourcashiertest
.
activities
;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.databinding.DataBindingUtil
;
import
androidx.lifecycle.Observer
;
import
androidx.lifecycle.ViewModelProvider
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.util.Log
;
import
android.view.View
;
import
android.widget.Toast
;
import
com.example.yourcashiertest.R
;
import
com.example.yourcashiertest.databinding.ActivityForgetPasswordBinding
;
import
com.example.yourcashiertest.models.Password
;
import
com.example.yourcashiertest.models.User
;
import
com.example.yourcashiertest.utils.ViewUtil
;
import
com.example.yourcashiertest.viewmodels.UserViewModel
;
import
java.util.List
;
public
class
ForgetPassword
extends
AppCompatActivity
{
ActivityForgetPasswordBinding
binding
;
UserViewModel
userViewModel
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_forget_password
);
binding
=
DataBindingUtil
.
setContentView
(
this
,
R
.
layout
.
activity_forget_password
);
userViewModel
=
new
ViewModelProvider
(
this
,
new
ViewModelProvider
.
NewInstanceFactory
()).
get
(
UserViewModel
.
class
);
userViewModel
.
setListUser
();
binding
.
btnResetPw
.
setOnClickListener
(
v
->
{
resetPassword
();
binding
.
setLoading
(
true
);
});
}
public
void
resetPassword
()
{
userViewModel
.
getListUser
().
observe
(
this
,
users
->
{
for
(
int
i
=
0
;
i
<
users
.
size
();
i
++){
if
(
binding
.
etEmail
.
getText
().
toString
().
equals
(
users
.
get
(
i
).
getEmail
())){
Password
password
=
new
Password
();
password
.
setNewPassword
(
binding
.
etNewPw
.
getText
().
toString
());
userViewModel
.
resetPassword
(
users
.
get
(
i
).
getId
()
,
password
);
binding
.
setLoading
(
false
);
startActivity
(
new
Intent
(
ForgetPassword
.
this
,
LoginActivity
.
class
));
finish
();
return
;
}
}
binding
.
setLoading
(
false
);
Toast
.
makeText
(
ForgetPassword
.
this
,
"User Not Found!"
,
Toast
.
LENGTH_LONG
).
show
();
});
}
}
\ No newline at end of file
app/src/main/java/com/example/yourcashiertest/activities/LoginActivity.java
View file @
2dd2b703
package
com
.
example
.
yourcashiertest
.
activities
;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.
lifecycle.Observer
;
import
androidx.
databinding.DataBindingUtil
;
import
androidx.lifecycle.ViewModelProvider
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.SharedPreferences
;
import
android.os.Bundle
;
import
android.util.Log
;
import
android.view.View
;
import
android.widget.Toast
;
import
com.example.yourcashiertest.R
;
import
com.example.yourcashiertest.
models.User
;
import
com.example.yourcashiertest.
databinding.ActivityLoginBinding
;
import
com.example.yourcashiertest.viewmodels.UserViewModel
;
import
com.google.android.material.button.MaterialButton
;
import
com.google.android.material.textfield.TextInputEditText
;
import
java.util.List
;
public
class
LoginActivity
extends
AppCompatActivity
{
TextInputEditText
etUsername
,
etPassword
;
MaterialButton
btnLogin
;
ActivityLoginBinding
binding
;
public
static
final
String
DATA_LOGIN
=
"DATA_LOGIN"
;
public
static
Boolean
syarat
;
// SharedPreferences sharedPreferences;
// public static final String SESS_SYARAT = "syarat";
// public static final String my_shared = "session_status";
private
PrefManager
prefManager
;
UserViewModel
viewModel
;
...
...
@@ -34,59 +24,59 @@ public class LoginActivity extends AppCompatActivity {
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_login
);
// sharedPreferences = getSharedPreferences(my_shared, Context.MODE_PRIVATE);
// syarat = sharedPreferences.getBoolean(SESS_SYARAT, false);
binding
=
DataBindingUtil
.
setContentView
(
this
,
R
.
layout
.
activity_login
);
prefManager
=
new
PrefManager
(
this
);
Log
.
d
(
"login1"
,
""
+
prefManager
.
isFirstLogin
());
if
(!
prefManager
.
isFirstLogin
())
{
launchMain
();
Log
.
d
(
"login2"
,
""
+
prefManager
.
isFirstLogin
());
checkSession
();
finish
();
}
etPassword
=
findViewById
(
R
.
id
.
etPassword
);
etUsername
=
findViewById
(
R
.
id
.
etUsername
);
btnLogin
=
findViewById
(
R
.
id
.
btnLogin
);
viewModel
=
new
ViewModelProvider
(
this
,
new
ViewModelProvider
.
NewInstanceFactory
()).
get
(
UserViewModel
.
class
);
btnLogin
.
setOnClickListener
(
view
->
{
if
(
etUsername
.
getText
().
toString
().
length
()
==
0
||
etPassword
.
getText
().
toString
().
length
()
==
0
){
binding
.
btnLogin
.
setOnClickListener
(
view
->
{
if
(
binding
.
etUsername
.
getText
().
toString
().
length
()
==
0
||
binding
.
etPassword
.
getText
().
toString
().
length
()
==
0
){
Toast
.
makeText
(
getApplicationContext
(),
"Please input Username and Password"
,
Toast
.
LENGTH_SHORT
).
show
();
}
else
if
(!
etPassword
.
getText
().
toString
().
matches
(
"[A-Za-z0-9]+"
)){
etPassword
.
setError
(
"Passwords can only contain Alphanumeric"
);
}
else
if
(
etPassword
.
getText
().
toString
().
length
()
<
8
)
{
etPassword
.
setError
(
"Password length cannot be less than 8 characters"
);
}
else
if
(!
binding
.
etPassword
.
getText
().
toString
().
matches
(
"[A-Za-z0-9]+"
)){
binding
.
etPassword
.
setError
(
"Passwords can only contain Alphanumeric"
);
}
else
if
(
binding
.
etPassword
.
getText
().
toString
().
length
()
<
8
)
{
binding
.
etPassword
.
setError
(
"Password length cannot be less than 8 characters"
);
}
else
{
binding
.
setLoading
(
true
);
viewModel
.
setListUser
();
checkLog
in
();
launchMa
in
();
}
});
}
private
void
checkLogin
()
{
viewModel
.
getListUser
().
observe
(
this
,
users
->
{
for
(
int
i
=
0
;
i
<
users
.
size
();
i
++){
if
(
users
.
get
(
i
).
getEmail
().
equals
(
etUsername
.
getText
().
toString
())
&&
users
.
get
(
i
).
getPassword
().
equals
(
etPassword
.
getText
().
toString
())){
startActivity
(
new
Intent
(
LoginActivity
.
this
,
MainActivity
.
class
)
.
putExtra
(
DATA_LOGIN
,
users
.
get
(
i
).
getFullName
()));
}
}
// Toast.makeText(getApplication(), "Username or password wrong", Toast.LENGTH_LONG).show();
});
}
public
void
tvForgetPassword
(
View
view
)
{
startActivity
(
new
Intent
(
LoginActivity
.
this
,
ForgetPassword
.
class
));
}
public
void
tvSignUpHere
(
View
view
)
{
startActivity
(
new
Intent
(
LoginActivity
.
this
,
RegisterActivity
.
class
));
}
public
void
launchMain
()
{
try
{
viewModel
.
getListUser
().
observe
(
this
,
users
->
{
for
(
int
i
=
0
;
i
<
users
.
size
();
i
++)
{
if
(
binding
.
etUsername
.
getText
().
toString
().
equals
(
users
.
get
(
i
).
getEmail
())
&&
binding
.
etPassword
.
getText
().
toString
().
equals
(
users
.
get
(
i
).
getPassword
()))
{
prefManager
.
setFirstLogin
(
false
);
binding
.
setLoading
(
false
);
startActivity
(
new
Intent
(
LoginActivity
.
this
,
MainActivity
.
class
).
putExtra
(
DATA_LOGIN
,
users
.
get
(
i
).
getFullName
()).
addFlags
(
Intent
.
FLAG_ACTIVITY_CLEAR_TASK
).
addFlags
(
Intent
.
FLAG_ACTIVITY_CLEAR_TOP
));
finish
();
return
;
}
}
Toast
.
makeText
(
LoginActivity
.
this
,
"User Not Found!"
,
Toast
.
LENGTH_LONG
).
show
();
binding
.
setLoading
(
false
);
return
;
});
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
}
public
void
checkSession
(){
prefManager
.
setFirstLogin
(
false
);
startActivity
(
new
Intent
(
LoginActivity
.
this
,
MainActivity
.
class
));
startActivity
(
new
Intent
(
LoginActivity
.
this
,
MainActivity
.
class
)
.
addFlags
(
Intent
.
FLAG_ACTIVITY_CLEAR_TASK
).
addFlags
(
Intent
.
FLAG_ACTIVITY_CLEAR_TOP
)
);
finish
();
}
}
\ No newline at end of file
app/src/main/java/com/example/yourcashiertest/activities/MainActivity.java
View file @
2dd2b703
...
...
@@ -5,6 +5,7 @@ import androidx.appcompat.app.AppCompatActivity;
import
androidx.databinding.DataBindingUtil
;
import
androidx.lifecycle.Observer
;
import
androidx.lifecycle.ViewModelProvider
;
import
androidx.recyclerview.widget.LinearLayoutManager
;
import
android.Manifest
;
...
...
@@ -13,7 +14,6 @@ import android.content.SharedPreferences;
import
android.os.Bundle
;
import
android.text.Editable
;
import
android.text.TextWatcher
;
import
android.util.Log
;
import
android.widget.PopupMenu
;
import
android.widget.Toast
;
...
...
@@ -25,7 +25,6 @@ import com.example.yourcashiertest.entities.Product;
import
com.example.yourcashiertest.viewmodels.CartViewModel
;
import
com.example.yourcashiertest.viewmodels.ProductViewModel
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -100,6 +99,7 @@ public class MainActivity extends AppCompatActivity {
popupMenu
.
show
();
});
// binding.rvCategory.setLayoutManager(new LinearLayoutManager(MainActivity.this, LinearLayoutManager.HORIZONTAL, false));
binding
.
rvProducts
.
setAdapter
(
adapter
);
viewModel
=
new
ViewModelProvider
(
this
).
get
(
ProductViewModel
.
class
);
viewModel
.
getProducts
().
observe
(
this
,
adapter:
:
setProducts
);
...
...
app/src/main/java/com/example/yourcashiertest/activities/PaymentActivity.java
View file @
2dd2b703
...
...
@@ -6,14 +6,13 @@ import androidx.cardview.widget.CardView;
import
androidx.databinding.DataBindingUtil
;
import
androidx.lifecycle.ViewModelProvider
;
import
android.annotation.SuppressLint
;
import
android.content.Intent
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.text.TextUtils
;
import
android.view.MotionEvent
;
import
android.view.View
;
import
com.example.yourcashiertest.R
;
import
com.example.yourcashiertest.databinding.ActivityPaymentBinding
;
import
com.example.yourcashiertest.utils.Convert
;
...
...
@@ -27,8 +26,10 @@ public class PaymentActivity extends AppCompatActivity {
public
int
refund
;
public
int
amount
;
CartViewModel
cartViewModel
;
public
boolean
change
=
false
;
public
String
payment
=
""
;
public
static
final
String
PAY_WITH
=
"pay_with"
;
@SuppressLint
(
"ResourceAsColor"
)
@RequiresApi
(
api
=
Build
.
VERSION_CODES
.
N
)
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
...
...
@@ -40,55 +41,46 @@ public class PaymentActivity extends AppCompatActivity {
amount
=
getIntent
().
getIntExtra
(
CartActivity
.
PRICE
,
0
);
binding
.
setAmount
(
Convert
.
changeToCurrency
(
amount
));
binding
.
cvCash
.
setOnTouchListener
((
view
,
event
)
->
{
changeCvColor
(
event
,
binding
.
cvCash
);
return
true
;
binding
.
cbCash
.
setOnClickListener
(
v
->
{
if
(
binding
.
getCheckCash
()){
binding
.
setCheckCash
(
false
);
binding
.
cvCash
.
setCardBackgroundColor
(
0
);
payment
=
""
;
}
else
{
binding
.
setCheckCash
(
true
);
binding
.
cvCash
.
setCardBackgroundColor
(
R
.
color
.
blue
);
payment
=
"Cash"
;
}
});
binding
.
cvCard
.
setOnTouchListener
((
view
,
event
)
->
{
changeCvColor
(
event
,
binding
.
cvCard
);
return
true
;
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"
;
}
});
}
public
void
btnPay
(
View
view
)
{
if
(
TextUtils
.
isEmpty
(
binding
.
etAmountPaid
.
getText
().
toString
())){
ViewUtil
.
showMessage
(
view
,
"Amount paid not empty"
);
}
else
{
ViewUtil
.
showMessage
(
view
,
"Please input Amount Paid by Customer!"
);
}
else
if
(
payment
.
equals
(
""
)){
ViewUtil
.
showMessage
(
view
,
"Please choose type payment"
);
}
else
{
int
amountPaid
=
Integer
.
parseInt
(
binding
.
etAmountPaid
.
getText
().
toString
());
refund
=
amountPaid
-
amount
;
startActivity
(
new
Intent
(
PaymentActivity
.
this
,
StatusPayment
.
class
).
putExtra
(
REFUND
,
refund
));
startActivity
(
new
Intent
(
PaymentActivity
.
this
,
StatusPayment
.
class
).
putExtra
(
REFUND
,
refund
)
.
putExtra
(
PAY_WITH
,
payment
)
);
cartViewModel
.
clear
();
finish
();
}
}
public
void
changeCvColor
(
MotionEvent
event
,
CardView
cv
){
if
(
change
)
{
change
=
false
;
switch
(
event
.
getAction
())
{
case
MotionEvent
.
ACTION_DOWN
:
cv
.
setCardBackgroundColor
(
getResources
().
getColor
(
R
.
color
.
colorPrimary
));
break
;
case
MotionEvent
.
ACTION_UP
:
cv
.
setCardBackgroundColor
(
getResources
().
getColor
(
R
.
color
.
white
));
}
}
else
{
change
=
true
;
switch
(
event
.
getAction
())
{
case
MotionEvent
.
ACTION_DOWN
:
cv
.
setCardBackgroundColor
(
getResources
().
getColor
(
R
.
color
.
white
));
break
;
case
MotionEvent
.
ACTION_UP
:
cv
.
setCardBackgroundColor
(
getResources
().
getColor
(
R
.
color
.
colorPrimary
));
}
}
}
@Override
protected
void
onDestroy
()
{
super
.
onDestroy
();
...
...
app/src/main/java/com/example/yourcashiertest/activities/PrefManager.java
View file @
2dd2b703
...
...
@@ -12,7 +12,7 @@ public class PrefManager {
int
PRIVATE_MODE
=
0
;
// Shared preferences file name
private
static
final
String
PREF_NAME
=
"pref
erences
"
;
private
static
final
String
PREF_NAME
=
"pref
Welcome
"
;
private
static
final
String
IS_FIRST_WELCOME
=
"IsFirstWelcome"
;
private
static
final
String
IS_FIRST_LOGIN
=
"IsFirstLogin"
;
...
...
app/src/main/java/com/example/yourcashiertest/activities/ProductActivity.java
View file @
2dd2b703
...
...
@@ -14,6 +14,8 @@ import android.os.Bundle;
import
android.os.Environment
;
import
android.provider.MediaStore
;
import
android.text.TextUtils
;
import
android.util.Log
;
import
com.example.yourcashiertest.R
;
import
com.example.yourcashiertest.databinding.ActivityProductBinding
;
import
com.example.yourcashiertest.entities.Product
;
...
...
@@ -137,7 +139,7 @@ public class ProductActivity extends AppCompatActivity{
protected
void
onActivityResult
(
int
requestCode
,
int
resultCode
,
Intent
data
)
{
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
);
Uri
imageUri
;
if
(
resultCode
==
RESULT_OK
&&
requestCode
==
PICK_IMAGE
){
if
(
resultCode
==
RESULT_OK
&&
requestCode
==
PICK_IMAGE
){
//set image to image view
binding
.
ivProduct
.
setImageURI
(
data
.
getData
());
imageUri
=
data
.
getData
();
...
...
@@ -146,6 +148,9 @@ public class ProductActivity extends AppCompatActivity{
}
else
{
file
=
file
.
getAbsoluteFile
();
}
}
else
if
(
requestCode
==
REQUEST_IMAGE_CAPTURE
&&
resultCode
==
RESULT_OK
)
{
Log
.
d
(
"photo"
,
""
+
requestCode
);
binding
.
setPhoto
(
file
.
getAbsolutePath
());
}
}
public
String
getPath
(
Uri
uri
)
...
...
app/src/main/java/com/example/yourcashiertest/activities/RegisterActivity.java
View file @
2dd2b703
...
...
@@ -35,13 +35,22 @@ public class RegisterActivity extends AppCompatActivity {
binding
.
btnRegister
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
user
.
setEmail
(
binding
.
etEmail
.
getText
().
toString
());
user
.
setFullName
(
binding
.
etUsername
.
getText
().
toString
());
user
.
setPassword
(
binding
.
etPassword
.
getText
().
toString
());
user
.
setPhoneNumber
(
binding
.
etPhoneNumber
.
getText
().
toString
());
viewModel
.
registrasi
(
user
);
Toast
.
makeText
(
getApplicationContext
(),
"Register berhasil"
,
Toast
.
LENGTH_LONG
).
show
();
startActivity
(
new
Intent
(
getApplicationContext
(),
LoginActivity
.
class
));
if
(
binding
.
etUsername
.
getText
().
toString
().
length
()
==
0
||
binding
.
etPassword
.
getText
().
toString
().
length
()
==
0
||
binding
.
etEmail
.
getText
().
toString
().
length
()
==
0
||
binding
.
etPhoneNumber
.
getText
().
toString
().
length
()
==
0
){
Toast
.
makeText
(
getApplicationContext
(),
"Please input All Required Data"
,
Toast
.
LENGTH_SHORT
).
show
();
}
else
if
(!
binding
.
etPassword
.
getText
().
toString
().
matches
(
"[A-Za-z0-9]+"
)){
binding
.
etPassword
.
setError
(
"Passwords can only contain Alphanumeric"
);
}
else
if
(
binding
.
etPassword
.
getText
().
toString
().
length
()
<
8
)
{
binding
.
etPassword
.
setError
(
"Password length cannot be less than 8 characters"
);
}
else
{
user
.
setEmail
(
binding
.
etEmail
.
getText
().
toString
());
user
.
setFullName
(
binding
.
etUsername
.
getText
().
toString
());
user
.
setPassword
(
binding
.
etPassword
.
getText
().
toString
());
user
.
setPhoneNumber
(
binding
.
etPhoneNumber
.
getText
().
toString
());
viewModel
.
registrasi
(
user
);
Toast
.
makeText
(
getApplicationContext
(),
"Register Was Successful"
,
Toast
.
LENGTH_LONG
).
show
();
startActivity
(
new
Intent
(
getApplicationContext
(),
LoginActivity
.
class
));
}
}
});
}
...
...
app/src/main/java/com/example/yourcashiertest/activities/StatusPayment.java
View file @
2dd2b703
...
...
@@ -24,6 +24,9 @@ public class StatusPayment extends AppCompatActivity {
int
refund
=
getIntent
().
getIntExtra
(
PaymentActivity
.
REFUND
,
0
);
Log
.
d
(
"Tag"
,
String
.
valueOf
(
refund
));
binding
.
setRefund
(
Convert
.
changeToCurrency
(
refund
));
String
status_pay
=
getIntent
().
getStringExtra
(
PaymentActivity
.
PAY_WITH
);
binding
.
tvPaymentSuccess
.
setText
(
"Payment by "
+
status_pay
+
" was successful"
);
}
public
void
btnFinish
(
View
view
)
{
...
...
app/src/main/java/com/example/yourcashiertest/activities/WelcomeActivity.java
View file @
2dd2b703
...
...
@@ -6,6 +6,7 @@ import android.graphics.Color;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.text.Html
;
import
android.util.Log
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
...
...
@@ -36,11 +37,13 @@ public class WelcomeActivity extends AppCompatActivity {
// mengecek lauch activity - sebelum memanggil setContentView()
prefManager
=
new
PrefManager
(
this
);
Log
.
d
(
"welcome1"
,
""
+
prefManager
.
isFirstWelcome
());
if
(!
prefManager
.
isFirstWelcome
())
{
Log
.
d
(
"welcome2"
,
""
+
prefManager
.
isFirstWelcome
());
launchHomeScreen
();
finish
();
}
Log
.
d
(
"welcome3"
,
""
+
prefManager
.
isFirstWelcome
());
// membuat transparan notifikasi
if
(
Build
.
VERSION
.
SDK_INT
>=
21
)
{
getWindow
().
getDecorView
().
setSystemUiVisibility
(
View
.
SYSTEM_UI_FLAG_LAYOUT_STABLE
|
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
);
...
...
app/src/main/java/com/example/yourcashiertest/models/Password.java
0 → 100644
View file @
2dd2b703
package
com
.
example
.
yourcashiertest
.
models
;
import
com.google.gson.annotations.SerializedName
;
public
class
Password
{
@SerializedName
(
"new_password"
)
private
String
newPassword
;
public
void
setNewPassword
(
String
newPassword
)
{
this
.
newPassword
=
newPassword
;
}
public
String
getNewPassword
(){
return
newPassword
;
}
@Override
public
String
toString
(){
return
"{"
+
" \"new_password\" = '\""
+
newPassword
+
'\"'
+
"}"
;
}
}
app/src/main/java/com/example/yourcashiertest/models/User.java
View file @
2dd2b703
...
...
@@ -7,6 +7,9 @@ import com.google.gson.annotations.SerializedName;
public
class
User
implements
Parcelable
{
@SerializedName
(
"id"
)
private
int
id
;
@SerializedName
(
"password"
)
private
String
password
;
...
...
@@ -20,6 +23,7 @@ public class User implements Parcelable {
private
String
email
;
public
User
(
Parcel
in
)
{
id
=
in
.
readInt
();
password
=
in
.
readString
();
fullName
=
in
.
readString
();
phoneNumber
=
in
.
readString
();
...
...
@@ -42,6 +46,14 @@ public class User implements Parcelable {
}
public
int
getId
()
{
return
id
;
}
public
void
setId
(
int
id
)
{
this
.
id
=
id
;
}
public
void
setPassword
(
String
password
)
{
this
.
password
=
password
;
}
...
...
@@ -81,9 +93,11 @@ public class User implements Parcelable {
@Override
public
void
writeToParcel
(
Parcel
dest
,
int
flags
)
{
dest
.
writeInt
(
id
);
dest
.
writeString
(
password
);
dest
.
writeString
(
fullName
);
dest
.
writeString
(
phoneNumber
);
dest
.
writeString
(
email
);
}
}
\ No newline at end of file
app/src/main/java/com/example/yourcashiertest/services/UserService.java
View file @
2dd2b703
package
com
.
example
.
yourcashiertest
.
services
;
import
com.example.yourcashiertest.models.Password
;
import
com.example.yourcashiertest.models.ResponseUser
;
import
com.example.yourcashiertest.models.User
;
...
...
@@ -10,6 +11,8 @@ import retrofit2.http.Body;
import
retrofit2.http.GET
;
import
retrofit2.http.Headers
;
import
retrofit2.http.POST
;
import
retrofit2.http.PUT
;
import
retrofit2.http.Path
;
public
interface
UserService
{
...
...
@@ -20,4 +23,8 @@ public interface UserService {
@POST
(
"v1/customer"
)
Call
<
User
>
registerUser
(
@Body
User
user
);
@Headers
(
"Content-Type: application/json"
)
@PUT
(
"v1/change_password/{id}"
)
Call
<
Password
>
editPassword
(
@Path
(
"id"
)
int
id
,
@Body
Password
password
);
}
app/src/main/java/com/example/yourcashiertest/viewmodels/UserViewModel.java
View file @
2dd2b703
...
...
@@ -6,9 +6,11 @@ import androidx.lifecycle.MutableLiveData;
import
androidx.lifecycle.ViewModel
;
import
com.example.yourcashiertest.clients.ApiClient
;
import
com.example.yourcashiertest.models.Password
;
import
com.example.yourcashiertest.models.ResponseUser
;
import
com.example.yourcashiertest.models.User
;
import
com.example.yourcashiertest.services.UserService
;
import
com.google.gson.Gson
;
import
java.util.List
;
...
...
@@ -56,4 +58,24 @@ public class UserViewModel extends ViewModel {
});
}
public
void
resetPassword
(
int
id
,
Password
password
){
ApiClient
.
client
(
UserService
.
class
,
BASE_URL
)
.
editPassword
(
id
,
password
).
enqueue
(
new
Callback
<
Password
>()
{
@Override
public
void
onResponse
(
Call
<
Password
>
call
,
Response
<
Password
>
response
)
{
Log
.
d
(
"response"
,
response
.
message
());
}
@Override
public
void
onFailure
(
Call
<
Password
>
call
,
Throwable
t
)
{
}
});
}
public
String
toStringPassword
(
String
password
){
return
"{ new_password:"
+
password
+
"}"
;
}
}
app/src/main/res/drawable/ic_undraw_credit_card.xml
View file @
2dd2b703
...
...
@@ -2,26 +2,26 @@
android:viewportWidth=
"567.1704"
android:width=
"561dp"
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<path
android:fillColor=
"#3f3d56"
android:pathData=
"M13.551,186.032l475.239,-138.465l12.588,43.204l-475.239,138.465z"
/>
<path
android:fillColor=
"#3f3d56"
android:pathData=
"M70.329,384.481 L0.283,144.068a7,7 0,0 1,4.763 -8.679L468.764,0.281a7.006,7.006 0,0 1,8.679 4.762l62.056,212.989 -1.92,0.56L475.522,5.603a5.009,5.009 0,0 0,-6.199 -3.402L5.605,137.309a5,5 0,0 0,-3.402 6.199l70.047,240.413Z"
/>
<path
android:fillColor=
"#
E0A24
0"
android:pathData=
"M436.862,219.022a6.512,6.512 0,0 1,-6.243 -4.683l-11.749,-40.323a6.507,6.507 0,0 1,4.422 -8.059l40.323,-11.749a6.507,6.507 0,0 1,8.059 4.423L483.423,198.955a6.507,6.507 0,0 1,-4.422 8.059l-40.323,11.749A6.479,6.479 0,0 1,436.862 219.022Z"
/>
<path
android:fillColor=
"#
E0A24
0"
android:pathData=
"M69.246,144.812a11.691,11.691 0,0 0,-0.43 -1.22,12 12,0 0,0 -22.91,6.67 11.38,11.38 0,0 0,0.29 1.26,12.019 12.019,0 0,0 11.53,8.64 11.749,11.749 0,0 0,3.35 -0.48A12.013,12.013 0,0 0,69.246 144.812ZM60.516,157.762a10.013,10.013 0,0 1,-12.4 -6.8,11.435 11.435,0 0,1 -0.28,-1.26 9.997,9.997 0,0 1,19.04 -5.54,8.338 8.338,0 0,1 0.45,1.21A10.004,10.004 0,0 1,60.516 157.762Z"
/>
<path
android:fillColor=
"#
E0A24
0"
android:pathData=
"M39.814,153.382a11.002,11.002 0,0 1,4.208 -12.057,11 11,0 1,0 5.818,19.967A11.002,11.002 0,0 1,39.814 153.382Z"
/>
<path
android:fillColor=
"#
40e0d
0"
android:pathData=
"M436.862,219.022a6.512,6.512 0,0 1,-6.243 -4.683l-11.749,-40.323a6.507,6.507 0,0 1,4.422 -8.059l40.323,-11.749a6.507,6.507 0,0 1,8.059 4.423L483.423,198.955a6.507,6.507 0,0 1,-4.422 8.059l-40.323,11.749A6.479,6.479 0,0 1,436.862 219.022Z"
/>
<path
android:fillColor=
"#
40e0d
0"
android:pathData=
"M69.246,144.812a11.691,11.691 0,0 0,-0.43 -1.22,12 12,0 0,0 -22.91,6.67 11.38,11.38 0,0 0,0.29 1.26,12.019 12.019,0 0,0 11.53,8.64 11.749,11.749 0,0 0,3.35 -0.48A12.013,12.013 0,0 0,69.246 144.812ZM60.516,157.762a10.013,10.013 0,0 1,-12.4 -6.8,11.435 11.435,0 0,1 -0.28,-1.26 9.997,9.997 0,0 1,19.04 -5.54,8.338 8.338,0 0,1 0.45,1.21A10.004,10.004 0,0 1,60.516 157.762Z"
/>
<path
android:fillColor=
"#
40e0d
0"
android:pathData=
"M39.814,153.382a11.002,11.002 0,0 1,4.208 -12.057,11 11,0 1,0 5.818,19.967A11.002,11.002 0,0 1,39.814 153.382Z"
/>
<path
android:fillColor=
"#ccc"
android:pathData=
"M350.676,202.942a6.042,6.042 0,0 0,-7.45 -4.2L276.836,217.312l-7.15,2h44.9l7.15,-2 24.75,-6.92A6.049,6.049 0,0 0,350.676 202.942Z"
/>
<path
android:fillColor=
"#ccc"
android:pathData=
"M303.706,189.072a6.045,6.045 0,0 0,-7.45 -4.19l-99.62,27.86a6.068,6.068 0,0 0,-4.37 6.57h25.79l7.16,-2 74.3,-20.78A6.055,6.055 0,0 0,303.706 189.072Z"
/>
<path
android:fillColor=
"#3f3d56"
android:pathData=
"M560.17,217.31L77.17,217.31a7.008,7.008 0,0 0,-7 7v286a7.008,7.008 0,0 0,7 7L560.17,517.31a7.008,7.008 0,0 0,7 -7v-286A7.008,7.008 0,0 0,560.17 217.31ZM565.17,510.31a5.002,5.002 0,0 1,-5 5L77.17,515.31a5.002,5.002 0,0 1,-5 -5v-286a5.002,5.002 0,0 1,5 -5L560.17,219.31a5.002,5.002 0,0 1,5 5Z"
/>
<path
android:fillColor=
"#
E0A24
0"
android:pathData=
"M124.166,256.312a12,12 0,1 1,12 -12A12.014,12.014 0,0 1,124.166 256.312ZM124.166,234.312a10,10 0,1 0,10 10A10.011,10.011 0,0 0,124.166 234.312Z"
/>
<path
android:fillColor=
"#
E0A24
0"
android:pathData=
"M105.514,244.312a11.002,11.002 0,0 1,7.413 -10.399,11 11,0 1,0 0,20.797A11.002,11.002 0,0 1,105.514 244.312Z"
/>
<path
android:fillColor=
"#
E0A24
0"
android:pathData=
"M172.81,386.09a9.01,9.01 0,0 1,-9 -9v-27a9,9 0,0 1,18 0v27A9.01,9.01 0,0 1,172.81 386.09Z"
/>
<path
android:fillColor=
"#
E0A24
0"
android:pathData=
"M196.81,386.09a9.01,9.01 0,0 1,-9 -9v-27a9,9 0,0 1,18 0v27A9.01,9.01 0,0 1,196.81 386.09Z"
/>
<path
android:fillColor=
"#
E0A24
0"
android:pathData=
"M220.81,386.09a9.01,9.01 0,0 1,-9 -9v-27a9,9 0,0 1,18 0v27A9.01,9.01 0,0 1,220.81 386.09Z"
/>
<path
android:fillColor=
"#
E0A24
0"
android:pathData=
"M257.81,386.09a9.01,9.01 0,0 1,-9 -9v-27a9,9 0,0 1,18 0v27A9.01,9.01 0,0 1,257.81 386.09Z"
/>
<path
android:fillColor=
"#
E0A24
0"
android:pathData=
"M281.81,386.09a9.01,9.01 0,0 1,-9 -9v-27a9,9 0,0 1,18 0v27A9.01,9.01 0,0 1,281.81 386.09Z"
/>
<path
android:fillColor=
"#
E0A24
0"
android:pathData=
"M305.81,386.09a9.01,9.01 0,0 1,-9 -9v-27a9,9 0,0 1,18 0v27A9.01,9.01 0,0 1,305.81 386.09Z"
/>
<path
android:fillColor=
"#
E0A24
0"
android:pathData=
"M342.81,386.09a9.01,9.01 0,0 1,-9 -9v-27a9,9 0,0 1,18 0v27A9.01,9.01 0,0 1,342.81 386.09Z"
/>
<path
android:fillColor=
"#
E0A24
0"
android:pathData=
"M366.81,386.09a9.01,9.01 0,0 1,-9 -9v-27a9,9 0,0 1,18 0v27A9.01,9.01 0,0 1,366.81 386.09Z"
/>
<path
android:fillColor=
"#
E0A24
0"
android:pathData=
"M390.81,386.09a9.01,9.01 0,0 1,-9 -9v-27a9,9 0,0 1,18 0v27A9.01,9.01 0,0 1,390.81 386.09Z"
/>
<path
android:fillColor=
"#
E0A24
0"
android:pathData=
"M427.81,386.09a9.01,9.01 0,0 1,-9 -9v-27a9,9 0,0 1,18 0v27A9.01,9.01 0,0 1,427.81 386.09Z"
/>
<path
android:fillColor=
"#
E0A24
0"
android:pathData=
"M451.81,386.09a9.01,9.01 0,0 1,-9 -9v-27a9,9 0,0 1,18 0v27A9.01,9.01 0,0 1,451.81 386.09Z"
/>
<path
android:fillColor=
"#
E0A24
0"
android:pathData=
"M475.81,386.09a9.01,9.01 0,0 1,-9 -9v-27a9,9 0,0 1,18 0v27A9.01,9.01 0,0 1,475.81 386.09Z"
/>
<path
android:fillColor=
"#
40e0d
0"
android:pathData=
"M124.166,256.312a12,12 0,1 1,12 -12A12.014,12.014 0,0 1,124.166 256.312ZM124.166,234.312a10,10 0,1 0,10 10A10.011,10.011 0,0 0,124.166 234.312Z"
/>
<path
android:fillColor=
"#
40e0d
0"
android:pathData=
"M105.514,244.312a11.002,11.002 0,0 1,7.413 -10.399,11 11,0 1,0 0,20.797A11.002,11.002 0,0 1,105.514 244.312Z"
/>
<path
android:fillColor=
"#
40e0d
0"
android:pathData=
"M172.81,386.09a9.01,9.01 0,0 1,-9 -9v-27a9,9 0,0 1,18 0v27A9.01,9.01 0,0 1,172.81 386.09Z"
/>
<path
android:fillColor=
"#
40e0d
0"
android:pathData=
"M196.81,386.09a9.01,9.01 0,0 1,-9 -9v-27a9,9 0,0 1,18 0v27A9.01,9.01 0,0 1,196.81 386.09Z"
/>
<path
android:fillColor=
"#
40e0d
0"
android:pathData=
"M220.81,386.09a9.01,9.01 0,0 1,-9 -9v-27a9,9 0,0 1,18 0v27A9.01,9.01 0,0 1,220.81 386.09Z"
/>
<path
android:fillColor=
"#
40e0d
0"
android:pathData=
"M257.81,386.09a9.01,9.01 0,0 1,-9 -9v-27a9,9 0,0 1,18 0v27A9.01,9.01 0,0 1,257.81 386.09Z"
/>
<path
android:fillColor=
"#
40e0d
0"
android:pathData=
"M281.81,386.09a9.01,9.01 0,0 1,-9 -9v-27a9,9 0,0 1,18 0v27A9.01,9.01 0,0 1,281.81 386.09Z"
/>
<path
android:fillColor=
"#
40e0d
0"
android:pathData=
"M305.81,386.09a9.01,9.01 0,0 1,-9 -9v-27a9,9 0,0 1,18 0v27A9.01,9.01 0,0 1,305.81 386.09Z"
/>
<path
android:fillColor=
"#
40e0d
0"
android:pathData=
"M342.81,386.09a9.01,9.01 0,0 1,-9 -9v-27a9,9 0,0 1,18 0v27A9.01,9.01 0,0 1,342.81 386.09Z"
/>
<path
android:fillColor=
"#
40e0d
0"
android:pathData=
"M366.81,386.09a9.01,9.01 0,0 1,-9 -9v-27a9,9 0,0 1,18 0v27A9.01,9.01 0,0 1,366.81 386.09Z"
/>
<path
android:fillColor=
"#
40e0d
0"
android:pathData=
"M390.81,386.09a9.01,9.01 0,0 1,-9 -9v-27a9,9 0,0 1,18 0v27A9.01,9.01 0,0 1,390.81 386.09Z"
/>
<path
android:fillColor=
"#
40e0d
0"
android:pathData=
"M427.81,386.09a9.01,9.01 0,0 1,-9 -9v-27a9,9 0,0 1,18 0v27A9.01,9.01 0,0 1,427.81 386.09Z"
/>
<path
android:fillColor=
"#
40e0d
0"
android:pathData=
"M451.81,386.09a9.01,9.01 0,0 1,-9 -9v-27a9,9 0,0 1,18 0v27A9.01,9.01 0,0 1,451.81 386.09Z"
/>
<path
android:fillColor=
"#
40e0d
0"
android:pathData=
"M475.81,386.09a9.01,9.01 0,0 1,-9 -9v-27a9,9 0,0 1,18 0v27A9.01,9.01 0,0 1,475.81 386.09Z"
/>
<path
android:fillColor=
"#e6e6e6"
android:pathData=
"M233.828,486.257L104.388,486.257a6.047,6.047 0,1 1,0 -12.095L233.828,474.162a6.047,6.047 0,1 1,0 12.095Z"
/>
<path
android:fillColor=
"#e6e6e6"
android:pathData=
"M192.328,460.257L145.888,460.257a6.047,6.047 0,1 1,0 -12.095h46.44a6.047,6.047 0,1 1,0 12.095Z"
/>
<path
android:fillColor=
"#3f3d56"
android:pathData=
"M71.81,277.09h493v2h-493z"
/>
...
...
app/src/main/res/layout/activity_cart.xml
View file @
2dd2b703
...
...
@@ -39,7 +39,7 @@
<TextView
android:id=
"@+id/cart"
android:layout_width=
"
134
dp"
android:layout_width=
"
50
dp"
android:layout_height=
"36dp"
android:gravity=
"top"
android:text=
"@string/cart"
...
...
@@ -53,31 +53,30 @@
android:id=
"@+id/items"
android:layout_width=
"60dp"
android:layout_height=
"21dp"
android:layout_margin
End=
"5
dp"
android:layout_margin
Start=
"14
dp"
android:gravity=
"top"
app:layout_constraintBottom_toBottomOf=
"@+id/cart"
app:layout_constraintStart_toEndOf=
"@+id/cart"
app:layout_constraintEnd_toStartOf=
"@+id/amount"
app:layout_constraintTop_toTopOf=
"@+id/cart"
app:layout_constraintVertical_bias=
"0.466"
/>
app:layout_constraintBottom_toTopOf=
"@id/rvCartList"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/cart"
app:layout_constraintVertical_bias=
"0.375"
/>
<View
android:id=
"@+id/amount"
android:layout_width=
"100dp"
android:layout_height=
"50dp"
android:layout_width=
"150dp"
android:layout_height=
"60dp"
android:layout_marginTop=
"72dp"
android:layout_marginEnd=
"20dp"
android:background=
"@drawable/rectangle_1"
app:layout_constraintEnd_toEndOf=
"parent"
android:layout_marginTop=
"62dp"
android:layout_marginEnd=
"52dp"
app:layout_constraintStart_toEndOf=
"@+id/items"
app:layout_constraintTop_toTopOf=
"parent"
/>
<TextView
android:id=
"@+id/tvTotalPrice"
android:layout_width=
"wrap_content"
android:layout_height=
"
20dp
"
android:layout_height=
"
wrap_content
"
android:gravity=
"top"
android:textColor=
"#fff"
android:textSize=
"20sp"
android:textAppearance=
"@style/some_id"
app:layout_constraintBottom_toBottomOf=
"@+id/amount"
app:layout_constraintEnd_toEndOf=
"@+id/amount"
...
...
app/src/main/res/layout/activity_forget_password.xml
View file @
2dd2b703
<?xml version="1.0" encoding="utf-8"?>
<
androidx.constraintlayout.widget.ConstraintL
ayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<
l
ayout
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"
android:paddingHorizontal=
"10dp"
tools:context=
".activities.ForgetPassword"
>
<com.google.android.material.textview.MaterialTextView
android:id=
"@+id/tvResetPassword"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:textSize=
"25dp"
android:layout_marginStart=
"10dp"
android:layout_marginTop=
"50dp"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
android:textStyle=
"bold"
android:text=
"RESET PASSWORD"
/>
<com.google.android.material.textfield.TextInputLayout
android:id=
"@+id/tilEmail"
app:boxBackgroundColor=
"@color/white"
android:textColorHint=
"@color/grey"
style=
"@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
app:layout_constraintTop_toBottomOf=
"@id/tvResetPassword"
android:layout_marginTop=
"20dp"
android:layout_marginStart=
"@dimen/space_default"
android:layout_marginEnd=
"@dimen/space_default"
android:layout_marginBottom=
"@dimen/space_default"
>
xmlns:tools=
"http://schemas.android.com/tools"
>
<com.google.android.material.textfield.TextInputEditText
android:id=
"@+id/etEmail"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"Email"
android:inputType=
"textEmailAddress"
android:imeOptions=
"actionNext"
android:textSize=
"@dimen/text_default"
/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id=
"@+id/tilCrPw"
app:passwordToggleEnabled=
"true"
app:boxBackgroundColor=
"@color/white"
android:textColorHint=
"@color/grey"
style=
"@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
<data>
<import
type=
"android.view.View"
/>
<variable
name=
"loading"
type=
"boolean"
/>
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
app:layout_constraintTop_toBottomOf=
"@id/tilEmail"
android:layout_marginTop=
"20dp"
android:layout_marginStart=
"@dimen/space_default"
android:layout_marginEnd=
"@dimen/space_default"
android:layout_marginBottom=
"@dimen/space_default"
>
android:layout_height=
"match_parent"
android:paddingHorizontal=
"10dp"
tools:context=
".activities.ForgetPassword"
>
<com.google.android.material.textview.MaterialTextView
android:id=
"@+id/tvResetPassword"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:textSize=
"25dp"
android:layout_marginStart=
"10dp"
android:layout_marginTop=
"50dp"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
android:textStyle=
"bold"
android:text=
"RESET PASSWORD"
/>
<com.google.android.material.textfield.TextInputEditText
android:id=
"@+id/etCrPw"
<com.google.android.material.textfield.TextInputLayout
android:id=
"@+id/tilEmail"
app:boxBackgroundColor=
"@color/white"
android:textColorHint=
"@color/grey"
style=
"@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"Current Password"
android:imeOptions=
"actionNext"
android:inputType=
"text"
android:textSize=
"@dimen/text_default"
/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id=
"@+id/tilNewPw"
app:passwordToggleEnabled=
"true"
app:boxBackgroundColor=
"@color/white"
android:textColorHint=
"@color/grey"
style=
"@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
app:layout_constraintTop_toBottomOf=
"@id/tilCrPw"
android:layout_marginTop=
"20dp"
android:layout_marginStart=
"@dimen/space_default"
android:layout_marginEnd=
"@dimen/space_default"
android:layout_marginBottom=
"@dimen/space_default"
>
app:layout_constraintTop_toBottomOf=
"@id/tvResetPassword"
android:layout_marginTop=
"20dp"
android:layout_marginStart=
"@dimen/space_default"
android:layout_marginEnd=
"@dimen/space_default"
android:layout_marginBottom=
"@dimen/space_default"
>
<com.google.android.material.textfield.TextInputEditText
android:id=
"@+id/etNewPw"
<com.google.android.material.textfield.TextInputEditText
android:id=
"@+id/etEmail"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"Email"
android:inputType=
"textEmailAddress"
android:imeOptions=
"actionNext"
android:textSize=
"@dimen/text_default"
/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id=
"@+id/tilNewPw"
app:passwordToggleEnabled=
"true"
app:boxBackgroundColor=
"@color/white"
android:textColorHint=
"@color/grey"
style=
"@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
a
ndroid:hint=
"New Password
"
android:
inputType=
"text
"
android:
imeOptions=
"actionNex
t"
android:
textSize=
"@dimen/text_default"
/>
</com.google.android.material.textfield.TextInputLayout
>
a
pp:layout_constraintTop_toBottomOf=
"@id/tilEmail
"
android:
layout_marginTop=
"20dp
"
android:
layout_marginStart=
"@dimen/space_defaul
t"
android:
layout_marginEnd=
"@dimen/space_default"
android:layout_marginBottom=
"@dimen/space_default"
>
<com.google.android.material.button.MaterialButton
android:id=
"@+id/btnResetPw"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"20dp"
android:layout_marginEnd=
"4dp"
android:backgroundTint=
"@color/colorPrimary"
android:padding=
"@dimen/space_default"
android:text=
"RESET PASSWORD"
app:cornerRadius=
"@dimen/space_default"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/tilNewPw"
app:layout_constraintVertical_bias=
"0.008"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<com.google.android.material.textfield.TextInputEditText
android:id=
"@+id/etNewPw"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"New Password"
android:inputType=
"text"
android:imeOptions=
"actionNext"
android:textSize=
"@dimen/text_default"
/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.button.MaterialButton
android:id=
"@+id/btnResetPw"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"20dp"
android:layout_marginEnd=
"4dp"
android:backgroundTint=
"@color/colorPrimary"
android:padding=
"@dimen/space_default"
android:visibility=
"@{loading ? View.GONE : View.VISIBLE}"
android:text=
"RESET PASSWORD"
app:cornerRadius=
"@dimen/space_default"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/tilNewPw"
app:layout_constraintVertical_bias=
"0.008"
/>
<ProgressBar
android:id=
"@+id/pgLoading"
android:layout_width=
"35dp"
android:layout_height=
"wrap_content"
android:visibility=
"@{loading ? View.VISIBLE : View.GONE}"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"@+id/btnResetPw"
app:layout_constraintHorizontal_bias=
"0.519"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/tilNewPw"
app:layout_constraintVertical_bias=
"0.069"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
\ No newline at end of file
app/src/main/res/layout/activity_login.xml
View file @
2dd2b703
This diff is collapsed.
Click to expand it.
app/src/main/res/layout/activity_main.xml
View file @
2dd2b703
...
...
@@ -24,7 +24,7 @@
<View
android:id=
"@+id/rectangle_4"
android:layout_width=
"match_parent"
android:layout_height=
"
20
0dp"
android:layout_height=
"
15
0dp"
android:background=
"@drawable/rectangle_4"
app:layout_constraintBottom_toTopOf=
"@id/rvProducts"
app:layout_constraintEnd_toEndOf=
"parent"
...
...
@@ -113,7 +113,16 @@
android:imeOptions=
"actionSearch"
android:inputType=
"textCapWords"
android:textSize=
"@dimen/text_default"
/>
<!-- <androidx.recyclerview.widget.RecyclerView-->
<!-- android:id="@+id/rvCategory"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="0dp"-->
<!-- tools:listitem="@layout/category_item"-->
<!-- app:layout_constraintStart_toStartOf="parent"-->
<!-- app:layout_constraintEnd_toEndOf="parent"-->
<!-- app:layout_constraintTop_toBottomOf="@id/rectangle_4"-->
<!-- app:layout_constraintBottom_toTopOf="@id/rvProducts"-->
<!-- />-->
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rvProducts"
android:layout_width=
"match_parent"
...
...
app/src/main/res/layout/activity_payment.xml
View file @
2dd2b703
...
...
@@ -4,6 +4,14 @@
xmlns:tools=
"http://schemas.android.com/tools"
>
<data>
<variable
name=
"checkCash"
type=
"boolean"
/>
<variable
name=
"checkCard"
type=
"boolean"
/>
<variable
name=
"amount"
type=
"String"
/>
...
...
@@ -44,7 +52,6 @@
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/tvPayment"
app:layout_constraintVertical_bias=
"0.0"
/>
<com.google.android.material.card.MaterialCardView
android:id=
"@+id/cvCash"
android:layout_width=
"match_parent"
...
...
@@ -57,37 +64,32 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
android:layout_height=
"100dp"
android:paddingVertical=
"5dp"
>
<ImageView
android:id=
"@+id/iv_cash"
android:layout_width=
"200dp"
android:layout_height=
"wrap_content"
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_constraintEnd_toEndOf=
"parent"
app:layout_constraintHorizontal_bias=
"0.0"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintVertical_bias=
"
0.8
"
/>
<
TextView
android:id=
"@+id/cash"
android:layout_width=
"
138dp
"
android:layout_height=
"
33dp
"
android:
gravity=
"center
"
android:
text=
"@string/cash
"
android:text
Appearance=
"@style/c
ash"
a
pp:layout_constraintBottom_toBottomOf=
"parent
"
app:layout_constraintVertical_bias=
"
1.0
"
/>
<
CheckBox
android:id=
"@+id/c
bC
ash"
android:layout_width=
"
wrap_content
"
android:layout_height=
"
wrap_content
"
android:
layout_marginEnd=
"20dp
"
android:
buttonTint=
"@color/black
"
android:text
=
"C
ash"
a
ndroid:checked=
"@{checkCash}
"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintHorizontal_bias=
"0.324"
app:layout_constraintStart_toEndOf=
"@+id/iv_cash"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintVertical_bias=
"0.507"
/>
app:layout_constraintBottom_toBottomOf=
"parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.card.MaterialCardView
...
...
@@ -103,33 +105,29 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
android:layout_height=
"match_parent"
android:paddingVertical=
"5dp"
>
<ImageView
android:id=
"@+id/iv_card"
android:layout_width=
"
20
0dp"
android:layout_height=
"
wrap_content
"
android:layout_width=
"
15
0dp"
android:layout_height=
"
0dp
"
android:src=
"@drawable/ic_undraw_credit_card"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintHorizontal_bias=
"0.0"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintVertical_bias=
"0.8"
/>
<TextView
android:id=
"@+id/card"
android:layout_width=
"138dp"
android:layout_height=
"33dp"
android:gravity=
"center"
android:text=
"@string/card"
android:textAppearance=
"@style/cash"
app:layout_constraintBottom_toBottomOf=
"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_constraintHorizontal_bias=
"0.324"
app:layout_constraintStart_toEndOf=
"@+id/iv_card"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraint
Vertical_bias=
"0.507"
/>
app:layout_constraint
Bottom_toBottomOf=
"parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
...
...
@@ -140,7 +138,7 @@
android:layout_width=
"100dp"
android:layout_height=
"30dp"
android:layout_marginTop=
"208dp"
android:layout_marginBottom=
"
9
0dp"
android:layout_marginBottom=
"
7
0dp"
android:gravity=
"start"
android:text=
"Amount paid"
app:layout_constraintBottom_toTopOf=
"@id/etAmountPaid"
...
...
app/src/main/res/layout/activity_product.xml
View file @
2dd2b703
...
...
@@ -4,6 +4,9 @@
xmlns:tools=
"http://schemas.android.com/tools"
>
<data>
<variable
name=
"photo"
type=
"String"
/>
<variable
name=
"viewModel"
type=
"com.example.yourcashiertest.viewmodels.ProductViewModel"
/>
...
...
app/src/main/res/layout/activity_sk.xml
View file @
2dd2b703
...
...
@@ -15,8 +15,8 @@
<ProgressBar
android:id=
"@+id/pbLoading"
android:layout_width=
"
128
dp"
android:layout_height=
"
128
dp"
android:layout_width=
"
50
dp"
android:layout_height=
"
50
dp"
android:layout_centerInParent=
"true"
/>
</RelativeLayout>
\ No newline at end of file
app/src/main/res/layout/cart_item.xml
View file @
2dd2b703
...
...
@@ -19,11 +19,12 @@
</data>
<com.google.android.material.card.MaterialCardView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
android:layout_height=
"wrap_content"
android:layout_margin=
"5dp"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"
wrap_content
"
>
android:layout_height=
"
130dp
"
>
<!-- Burger Medium -->
...
...
@@ -31,8 +32,10 @@
<ImageView
android:id=
"@+id/imageView"
android:layout_width=
"107dp"
android:layout_height=
"110dp"
android:layout_height=
"0dp"
android:layout_margin=
"5dp"
app:file=
"@{cartProduct.image}"
android:scaleType=
"fitXY"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintHorizontal_bias=
"0.003"
...
...
@@ -54,13 +57,13 @@
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintHorizontal_bias=
"0.099"
app:layout_constraintStart_toEndOf=
"@+id/imageView"
app:layout_constraintTop_toTopOf=
"@+id/imageView"
app:layout_constraintVertical_bias=
"0.0"
/>
app:layout_constraintTop_toTopOf=
"@+id/imageView"
/>
<TextView
android:id=
"@+id/some_id"
android:layout_width=
"82dp"
android:layout_height=
"23dp"
android:layout_margin=
"5dp"
android:layout_alignParentLeft=
"true"
android:layout_alignParentTop=
"true"
android:gravity=
"top"
...
...
@@ -75,7 +78,7 @@
<View
android:id=
"@+id/v_add"
android:layout_width=
"
78
dp"
android:layout_width=
"
90
dp"
android:layout_height=
"40dp"
android:layout_alignParentLeft=
"true"
android:layout_alignParentTop=
"true"
...
...
@@ -115,7 +118,7 @@
<TextView
android:id=
"@+id/tv_qty"
android:layout_width=
"
10dp
"
android:layout_width=
"
wrap_content
"
android:layout_height=
"wrap_content"
android:text=
"@{cartProduct.qty + ``}"
app:layout_constraintBottom_toBottomOf=
"@+id/v_add"
...
...
app/src/main/res/layout/category_item.xml
0 → 100644
View file @
2dd2b703
<?xml version="1.0" encoding="utf-8"?>
<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"
>
<data>
<variable
name=
"category"
type=
"String"
/>
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_height=
"wrap_content"
android:layout_width=
"wrap_content"
android:paddingVertical=
"10dp"
android:layout_marginHorizontal=
"3dp"
>
<com.google.android.material.card.MaterialCardView
android:id=
"@+id/cvCategory"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:backgroundTint=
"@color/colorPrimaryDark"
android:clickable=
"true"
android:focusable=
"true"
android:checkable=
"true"
app:cardCornerRadius=
"10dp"
android:clipToPadding=
"true"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
>
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:paddingHorizontal=
"20dp"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Example"
android:textStyle=
"bold"
android:textSize=
"20sp"
android:textColor=
"#fff"
tools:text=
"elizabeth"
android:layout_centerInParent=
"true"
/>
</RelativeLayout>
</com.google.android.material.card.MaterialCardView>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
app/src/main/res/values/colors.xml
View file @
2dd2b703
...
...
@@ -12,7 +12,6 @@
<color
name=
"color_white"
>
#fff
</color>
<color
name=
"color_grey"
>
#fff
</color>
<color
name=
"blue"
>
#2196F3
</color>
<!-- dots inactive colors -->
<color
name=
"dot_dark_screen1"
>
#FFFFF0
</color>
<color
name=
"dot_dark_screen2"
>
#FFFFF0
</color>
...
...
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