Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
meser
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
Muhammad Suryono
meser
Commits
9d892f4e
Commit
9d892f4e
authored
Aug 23, 2020
by
iman Fauzi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
abd5c081
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
8 deletions
+16
-8
misc.xml
.idea/misc.xml
+1
-1
CartActivity.java
app/src/main/java/com/yono/messeripos/CartActivity.java
+14
-6
MainActivity.java
app/src/main/java/com/yono/messeripos/MainActivity.java
+1
-1
No files found.
.idea/misc.xml
View file @
9d892f4e
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<project
version=
"4"
>
<component
name=
"ProjectRootManager"
version=
"2"
languageLevel=
"JDK_1_
8
"
project-jdk-name=
"1.8"
project-jdk-type=
"JavaSDK"
>
<component
name=
"ProjectRootManager"
version=
"2"
languageLevel=
"JDK_1_
7
"
project-jdk-name=
"1.8"
project-jdk-type=
"JavaSDK"
>
<output
url=
"file://$PROJECT_DIR$/build/classes"
/>
<output
url=
"file://$PROJECT_DIR$/build/classes"
/>
</component>
</component>
<component
name=
"ProjectType"
>
<component
name=
"ProjectType"
>
...
...
app/src/main/java/com/yono/messeripos/CartActivity.java
View file @
9d892f4e
...
@@ -2,6 +2,7 @@ package com.yono.messeripos;
...
@@ -2,6 +2,7 @@ package com.yono.messeripos;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.appcompat.app.AppCompatActivity
;
import
android.annotation.SuppressLint
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.view.View
;
import
android.view.View
;
import
android.widget.ImageButton
;
import
android.widget.ImageButton
;
...
@@ -18,7 +19,7 @@ public class CartActivity extends AppCompatActivity {
...
@@ -18,7 +19,7 @@ public class CartActivity extends AppCompatActivity {
TextInputEditText
tiQty
;
TextInputEditText
tiQty
;
TextView
tvQtyView
,
tvPrice
,
tvTotal
;
TextView
tvQtyView
,
tvPrice
,
tvTotal
;
p
rivate
int
counter
;
p
ublic
int
counter
,
prices
;
@Override
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
...
@@ -35,8 +36,12 @@ public class CartActivity extends AppCompatActivity {
...
@@ -35,8 +36,12 @@ public class CartActivity extends AppCompatActivity {
tvTotal
=
findViewById
(
R
.
id
.
tvTotal
);
tvTotal
=
findViewById
(
R
.
id
.
tvTotal
);
counter
=
Integer
.
parseInt
(
tvQtyView
.
getText
().
toString
());
counter
=
Integer
.
parseInt
(
tvQtyView
.
getText
().
toString
());
prices
=
Integer
.
parseInt
(
tvPrice
.
getText
().
toString
());
tvTotal
.
setText
(
setToRp
().
format
((
double
)
Integer
.
parseInt
(
tvTotal
.
getText
().
toString
())));
btMinus
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
btMinus
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@SuppressLint
(
"SetTextI18n"
)
@Override
@Override
public
void
onClick
(
View
view
)
{
public
void
onClick
(
View
view
)
{
if
(
counter
>
1
){
if
(
counter
>
1
){
...
@@ -46,11 +51,11 @@ public class CartActivity extends AppCompatActivity {
...
@@ -46,11 +51,11 @@ public class CartActivity extends AppCompatActivity {
countTotal
();
countTotal
();
}
}
}
}
});
});
btPlus
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
btPlus
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@SuppressLint
(
"SetTextI18n"
)
@Override
@Override
public
void
onClick
(
View
view
)
{
public
void
onClick
(
View
view
)
{
counter
++;
counter
++;
...
@@ -63,19 +68,22 @@ public class CartActivity extends AppCompatActivity {
...
@@ -63,19 +68,22 @@ public class CartActivity extends AppCompatActivity {
}
}
private
void
countTotal
()
{
private
void
countTotal
()
{
int
price
=
Integer
.
parseInt
(
tvPrice
.
getText
().
toString
())
;
int
price
=
prices
;
int
qtyView
=
Integer
.
parseInt
(
tvQtyView
.
getText
().
toString
());
int
qtyView
=
Integer
.
parseInt
(
tvQtyView
.
getText
().
toString
());
int
count
=
price
*
qtyView
;
int
count
=
price
*
qtyView
;
String
result
=
Integer
.
toString
(
price
*
qtyView
);
//
String result = Integer.toString(price*qtyView);
// set to view
// set to view
tvTotal
.
setText
(
setToRp
().
format
((
double
)
count
));
tvTotal
.
setText
(
setToRp
().
format
((
double
)
count
));
}
}
public
void
setRp
()
{
}
private
NumberFormat
setToRp
()
{
private
NumberFormat
setToRp
()
{
Locale
ID
=
new
Locale
(
"in"
,
"ID"
);
Locale
ID
=
new
Locale
(
"in"
,
"ID"
);
NumberFormat
formatRp
=
NumberFormat
.
getCurrencyInstance
(
ID
);
return
NumberFormat
.
getCurrencyInstance
(
ID
);
return
formatRp
;
}
}
}
}
\ No newline at end of file
app/src/main/java/com/yono/messeripos/MainActivity.java
View file @
9d892f4e
...
@@ -25,7 +25,7 @@ public class MainActivity extends AppCompatActivity {
...
@@ -25,7 +25,7 @@ public class MainActivity extends AppCompatActivity {
w
.
setFlags
(
WindowManager
.
LayoutParams
.
FLAG_LAYOUT_NO_LIMITS
,
WindowManager
.
LayoutParams
.
FLAG_LAYOUT_NO_LIMITS
);
w
.
setFlags
(
WindowManager
.
LayoutParams
.
FLAG_LAYOUT_NO_LIMITS
,
WindowManager
.
LayoutParams
.
FLAG_LAYOUT_NO_LIMITS
);
}
}
Toolbar
toolbar
=
findViewById
(
R
.
id
.
app_bar
);
//
Toolbar toolbar = findViewById(R.id.app_bar);
}
}
@Override
@Override
...
...
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