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
6b18875d
Commit
6b18875d
authored
Aug 28, 2020
by
Ahmad Abi Mulya
Browse files
Options
Browse Files
Download
Plain Diff
change size of progress bar in sk activity
parents
67c8bcb8
64f13bdc
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
46 additions
and
47 deletions
+46
-47
MainActivity.java
.../com/example/yourcashiertest/activities/MainActivity.java
+1
-1
PaymentActivity.java
...m/example/yourcashiertest/activities/PaymentActivity.java
+30
-42
StatusPayment.java
...com/example/yourcashiertest/activities/StatusPayment.java
+3
-0
activity_payment.xml
app/src/main/res/layout/activity_payment.xml
+10
-2
activity_sk.xml
app/src/main/res/layout/activity_sk.xml
+2
-2
No files found.
app/src/main/java/com/example/yourcashiertest/activities/MainActivity.java
View file @
6b18875d
...
...
@@ -100,7 +100,7 @@ public class MainActivity extends AppCompatActivity {
});
// binding.rvCategory.setLayoutManager(new LinearLayoutManager(MainActivity.this, LinearLayoutManager.HORIZONTAL, false));
//
binding.rvProducts.setAdapter(adapter);
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 @
6b18875d
...
...
@@ -6,17 +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
android.widget.RadioButton
;
import
android.widget.RadioGroup
;
import
android.widget.Toast
;
import
com.example.yourcashiertest.R
;
import
com.example.yourcashiertest.databinding.ActivityPaymentBinding
;
import
com.example.yourcashiertest.utils.Convert
;
...
...
@@ -30,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
)
{
...
...
@@ -43,56 +41,46 @@ public class PaymentActivity extends AppCompatActivity {
amount
=
getIntent
().
getIntExtra
(
CartActivity
.
PRICE
,
0
);
binding
.
setAmount
(
Convert
.
changeToCurrency
(
amount
));
// binding.cbCash.setOnTouchListener((view, event) -> {
// changeCvColor(event, binding.cvCash);
// return true;
// });
//
// binding.cbCard.setOnTouchListener((view, event) -> {
// changeCvColor(event, binding.cvCard);
// 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
.
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
,
"Please input Amount Paid by Customer!"
);
}
else
{
}
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.choose_payment));
// 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.choose_payment));
// }
// }
// }
@Override
protected
void
onDestroy
()
{
super
.
onDestroy
();
...
...
app/src/main/java/com/example/yourcashiertest/activities/StatusPayment.java
View file @
6b18875d
...
...
@@ -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/res/layout/activity_payment.xml
View file @
6b18875d
...
...
@@ -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"
/>
...
...
@@ -77,11 +85,10 @@
android:layout_marginEnd=
"20dp"
android:buttonTint=
"@color/black"
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>
...
...
@@ -117,6 +124,7 @@
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"
/>
...
...
app/src/main/res/layout/activity_sk.xml
View file @
6b18875d
...
...
@@ -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
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