Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
hds
flexin
android-app
Commits
e73c95e7
Commit
e73c95e7
authored
Dec 30, 2017
by
Nastuzzi Samy
Browse files
Variable price
Bug fix Better management More explicit views
parent
0d531246
Changes
4
Hide whitespace changes
Inline
Side-by-side
app/src/main/java/fr/utc/simde/jessy/EditActivity.java
View file @
e73c95e7
...
...
@@ -311,7 +311,7 @@ public class EditActivity extends ArticleGroupActivity {
StringBuilder
builder
=
new
StringBuilder
(
dest
);
builder
.
replace
(
dstart
,
dend
,
source
.
subSequence
(
start
,
end
).
toString
());
if
(!
builder
.
toString
().
matches
(
"(([1-9]{1})([0-9]{0,"
+(
maxDigitsBeforeDecimalPoint
-
1
)+
"})?)?(\\.[0-9]{0,"
+
maxDigitsAfterDecimalPoint
+
"})?"
))
{
if
(!
builder
.
toString
().
matches
(
"((
(
[1-9]{1})([0-9]{0,"
+(
maxDigitsBeforeDecimalPoint
-
1
)+
"})?)
|0)
?(\\.[0-9]{0,"
+
maxDigitsAfterDecimalPoint
+
"})?"
))
{
if
(
source
.
length
()
==
0
)
return
dest
.
subSequence
(
dstart
,
dend
);
return
""
;
...
...
@@ -444,7 +444,7 @@ public class EditActivity extends ArticleGroupActivity {
.
setTitle
(
R
.
string
.
configuration
)
.
setView
(
popupView
)
.
setCancelable
(
false
)
.
setPositiveButton
(
R
.
string
.
re
load
,
new
DialogInterface
.
OnClickListener
()
{
.
setPositiveButton
(
R
.
string
.
re
gister
,
new
DialogInterface
.
OnClickListener
()
{
public
void
onClick
(
DialogInterface
dialogInterface
,
int
id
)
{
if
(!
nameInput
.
getText
().
toString
().
equals
(
""
)
&&
(
radioVariablePrice
.
isChecked
()
||
!
priceInput
.
getText
().
toString
().
equals
(
""
)))
{
dialog
.
startLoading
(
EditActivity
.
this
,
getString
(
R
.
string
.
article_edit
),
getString
(
R
.
string
.
article_editing
));
...
...
app/src/main/java/fr/utc/simde/jessy/adapters/ArticlesAdapter.java
View file @
e73c95e7
...
...
@@ -84,8 +84,14 @@ public abstract class ArticlesAdapter extends BaseAdapter {
this
.
clickViewList
[
position
].
setAlpha
(
0.0f
);
}
else
{
this
.
clickViewList
[
position
].
setText
(
this
.
nbrList
[
position
]
%
100
==
0
?
Integer
.
toString
(
this
.
nbrList
[
position
]
/
100
)
:
Float
.
toString
(
this
.
nbrList
[
position
]
/
100.0f
));
this
.
clickViewList
[
position
].
setAlpha
(
1.0f
);
if
(
this
.
articleList
.
get
(
position
).
get
(
"variable_price"
).
booleanValue
())
{
this
.
clickViewList
[
position
].
setText
(
this
.
nbrList
[
position
]
%
100
==
0
?
Integer
.
toString
(
this
.
nbrList
[
position
]
/
100
)
:
Float
.
toString
(
this
.
nbrList
[
position
]
/
100.0f
)
+
"€"
);
this
.
clickViewList
[
position
].
setBackgroundColor
(
Color
.
argb
(
255
,
150
,
200
,
150
));
}
else
this
.
clickViewList
[
position
].
setText
(
this
.
nbrList
[
position
]
%
100
==
0
?
Integer
.
toString
(
this
.
nbrList
[
position
]
/
100
)
:
Float
.
toString
(
this
.
nbrList
[
position
]
/
100.0f
));
}
}
...
...
@@ -97,7 +103,7 @@ public abstract class ArticlesAdapter extends BaseAdapter {
String
text
;
if
(
articleList
.
get
(
position
).
get
(
"variable_price"
).
booleanValue
())
text
=
articleList
.
get
(
position
).
get
(
"name"
).
textValue
()
+
": "
+
activity
.
getString
(
R
.
string
.
price_variable
);
text
=
articleList
.
get
(
position
).
get
(
"name"
).
textValue
()
+
": "
+
(
getNbr
(
position
)
==
0
?
activity
.
getString
(
R
.
string
.
price_variable
)
:
Float
.
toString
(
getNbr
(
position
)
/
100.0f
)
+
'$'
)
;
else
if
(
articleList
.
get
(
position
).
has
(
"quantity"
))
text
=
Integer
.
toString
(
articleList
.
get
(
position
).
get
(
"quantity"
).
intValue
())
+
"x "
+
articleList
.
get
(
position
).
get
(
"name"
).
textValue
()
+
": "
+
Integer
.
toString
(
articleList
.
get
(
position
).
get
(
"quantity"
).
intValue
())
+
"x "
+
String
.
format
(
"%.2f"
,
new
Float
(
articleList
.
get
(
position
).
get
(
"price"
).
intValue
())
/
100.00f
)
+
"€"
;
else
...
...
app/src/main/java/fr/utc/simde/jessy/adapters/ListAdapater.java
View file @
e73c95e7
...
...
@@ -48,8 +48,12 @@ public class ListAdapater extends ArticlesAdapter {
if
(
article
.
get
(
"id"
).
intValue
()
==
-
1
)
priceText
.
setVisibility
(
View
.
GONE
);
else
{
if
(
article
.
get
(
"variable_price"
).
booleanValue
())
priceText
.
setText
(
"PV: "
+
String
.
format
(
"%.2f"
,
new
Float
(
articleList
.
get
(
position
).
get
(
"price"
).
intValue
())
/
100.00f
)
+
"€"
);
if
(
article
.
get
(
"variable_price"
).
booleanValue
())
{
if
(
articleList
.
get
(
position
).
has
(
"quantity"
))
priceText
.
setText
(
String
.
format
(
"%.2f"
,
articleList
.
get
(
position
).
get
(
"price"
).
intValue
()
*
articleList
.
get
(
position
).
get
(
"quantity"
).
intValue
()
/
100.00f
)
+
"€"
);
else
priceText
.
setText
(
R
.
string
.
price_variable
);
}
else
priceText
.
setText
((
article
.
has
(
"quantity"
)
?
Integer
.
toString
(
article
.
get
(
"quantity"
).
intValue
())
+
"x "
:
""
)
+
String
.
format
(
"%.2f"
,
new
Float
(
articleList
.
get
(
position
).
get
(
"price"
).
intValue
())
/
100.00f
)
+
"€"
);
}
...
...
app/src/main/java/fr/utc/simde/jessy/fragments/SellFragment.java
View file @
e73c95e7
...
...
@@ -89,7 +89,7 @@ public class SellFragment extends ArticleGroupFragment {
StringBuilder
builder
=
new
StringBuilder
(
dest
);
builder
.
replace
(
dstart
,
dend
,
source
.
subSequence
(
start
,
end
).
toString
());
if
(!
builder
.
toString
().
matches
(
"(([1-9]{1})([0-9]{0,"
+(
maxDigitsBeforeDecimalPoint
-
1
)+
"})?)?(\\.[0-9]{0,"
+
maxDigitsAfterDecimalPoint
+
"})?"
))
{
if
(!
builder
.
toString
().
matches
(
"((
(
[1-9]{1})([0-9]{0,"
+(
maxDigitsBeforeDecimalPoint
-
1
)+
"})?)
|0)
?(\\.[0-9]{0,"
+
maxDigitsAfterDecimalPoint
+
"})?"
))
{
if
(
source
.
length
()
==
0
)
return
dest
.
subSequence
(
dstart
,
dend
);
return
""
;
...
...
Write
Preview
Supports
Markdown
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