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
b0bf33e1
Commit
b0bf33e1
authored
Aug 31, 2020
by
Trio Saputra
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new updated
parent
3e4baf10
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
10 deletions
+33
-10
ProductAdapter.java
.../com/example/yourcashiertest/adapters/ProductAdapter.java
+9
-0
item_list.xml
app/src/main/res/layout/item_list.xml
+24
-10
No files found.
app/src/main/java/com/example/yourcashiertest/adapters/ProductAdapter.java
View file @
b0bf33e1
package
com
.
example
.
yourcashiertest
.
adapters
;
package
com
.
example
.
yourcashiertest
.
adapters
;
import
android.graphics.Color
;
import
android.view.LayoutInflater
;
import
android.view.LayoutInflater
;
import
android.view.ViewGroup
;
import
android.view.ViewGroup
;
...
@@ -87,6 +88,14 @@ public class ProductAdapter extends RecyclerView.Adapter<ProductAdapter.ViewHold
...
@@ -87,6 +88,14 @@ public class ProductAdapter extends RecyclerView.Adapter<ProductAdapter.ViewHold
rupiah
.
setDecimalFormatSymbols
(
format
);
rupiah
.
setDecimalFormatSymbols
(
format
);
binding
.
setPrice
(
rupiah
.
format
(
product
.
getPrice
()));
binding
.
setPrice
(
rupiah
.
format
(
product
.
getPrice
()));
if
(
product
.
getQuantity
()
>
0
)
{
binding
.
setStock
(
"Available"
);
binding
.
tvStock
.
setTextColor
(
Color
.
parseColor
(
"#40e0d0"
));
}
else
{
binding
.
setStock
(
"Sold Out"
);
binding
.
tvStock
.
setTextColor
(
Color
.
parseColor
(
"#BD0303"
));
}
binding
.
ivUpdate
.
setOnClickListener
(
view
->
listener
.
onUpdate
(
product
));
binding
.
ivUpdate
.
setOnClickListener
(
view
->
listener
.
onUpdate
(
product
));
binding
.
ivDelete
.
setOnClickListener
(
view
->
listener
.
onDelete
(
product
));
binding
.
ivDelete
.
setOnClickListener
(
view
->
listener
.
onDelete
(
product
));
...
...
app/src/main/res/layout/item_list.xml
View file @
b0bf33e1
...
@@ -16,6 +16,10 @@
...
@@ -16,6 +16,10 @@
<variable
<variable
name=
"visibility"
name=
"visibility"
type=
"boolean"
/>
type=
"boolean"
/>
<variable
name=
"stock"
type=
"String"
/>
</data>
</data>
<com.google.android.material.card.MaterialCardView
<com.google.android.material.card.MaterialCardView
...
@@ -79,6 +83,7 @@
...
@@ -79,6 +83,7 @@
android:layout_marginTop=
"8dp"
android:layout_marginTop=
"8dp"
android:maxLength=
"20"
android:maxLength=
"20"
android:maxLines=
"1"
android:maxLines=
"1"
tools:text=
"Burger mekdi bk"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintHorizontal_bias=
"0.45"
app:layout_constraintHorizontal_bias=
"0.45"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
...
@@ -91,15 +96,12 @@
...
@@ -91,15 +96,12 @@
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@{product.description}"
android:text=
"@{product.description}"
android:layout_marginTop=
"8dp"
android:layout_marginTop=
"8dp"
android:layout_marginBottom=
"
8dp
"
android:layout_marginBottom=
"
@dimen/space_default
"
android:maxLength=
"40"
android:maxLength=
"40"
android:maxLines=
"2"
android:maxLines=
"2"
tools:text=
"@tools:sample/lorem"
app:layout_constraintTop_toBottomOf=
"@id/tv_name"
app:layout_constraintTop_toBottomOf=
"@id/tv_name"
app:layout_constraintBottom_toTopOf=
"@id/tv_price"
app:layout_constraintBottom_toTopOf=
"@id/tv_price"
/>
app:layout_constraintEnd_toEndOf=
"@+id/tv_name"
app:layout_constraintHorizontal_bias=
"0.0"
app:layout_constraintStart_toStartOf=
"@+id/tv_name"
app:layout_constraintVertical_bias=
"0.045"
/>
<TextView
<TextView
android:id=
"@+id/tv_price"
android:id=
"@+id/tv_price"
...
@@ -107,11 +109,22 @@
...
@@ -107,11 +109,22 @@
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@{price}"
android:text=
"@{price}"
android:textStyle=
"bold"
android:textStyle=
"bold"
tools:text=
"rp.200000"
android:layout_marginTop=
"@dimen/space_default"
app:layout_constraintTop_toBottomOf=
"@id/tv_desc"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintVertical_bias=
"0.0"
/>
<TextView
android:id=
"@+id/tvStock"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"@{stock}"
android:textStyle=
"bold"
tools:text=
"Available"
android:layout_marginTop=
"8dp"
android:layout_marginTop=
"8dp"
app:layout_constraint
Bottom_toTopOf=
"@id/v_add
"
app:layout_constraint
Top_toBottomOf=
"@+id/tv_price
"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintHorizontal_bias=
"0.0"
app:layout_constraintStart_toStartOf=
"@+id/tv_desc"
app:layout_constraintVertical_bias=
"0.0"
/>
app:layout_constraintVertical_bias=
"0.0"
/>
<com.google.android.material.button.MaterialButton
<com.google.android.material.button.MaterialButton
...
@@ -120,7 +133,8 @@
...
@@ -120,7 +133,8 @@
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"50dp"
android:layout_height=
"50dp"
android:padding=
"5dp"
android:padding=
"5dp"
android:layout_marginTop=
"8dp"
android:layout_marginTop=
"@dimen/space_default"
app:layout_constraintTop_toBottomOf=
"@+id/tvStock"
app:cornerRadius=
"5dp"
app:cornerRadius=
"5dp"
app:icon=
"@drawable/ic_baseline_add_shopping_cart_24"
app:icon=
"@drawable/ic_baseline_add_shopping_cart_24"
app:iconGravity=
"textStart"
app:iconGravity=
"textStart"
...
...
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