Skip to content
GitLab
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
68826399
Commit
68826399
authored
Nov 06, 2017
by
Nastuzzi Samy
Browse files
Optimization
Correct grid and list views Fix list bug Fix text bug
parent
5f2047e9
Changes
7
Hide whitespace changes
Inline
Side-by-side
app/src/main/java/fr/utc/simde/payutc/ArticleKeyboardActivity.java
View file @
68826399
...
...
@@ -55,7 +55,7 @@ public class ArticleKeyboardActivity extends ArticleGroupActivity {
}
}
if
(!
in
)
if
(!
in
&&
config
.
getInGrid
()
)
articlesForThisKeyboard
.
add
(
new
ObjectMapper
().
createObjectNode
());
}
else
if
(
config
.
getInGrid
())
...
...
app/src/main/java/fr/utc/simde/payutc/articles/ArticlesAdapter.java
View file @
68826399
...
...
@@ -40,6 +40,8 @@ abstract class ArticlesAdapter extends BaseAdapter {
protected
Bitmap
[]
imageList
;
protected
Integer
[]
nbrClicksList
;
protected
View
[]
viewList
;
protected
TextView
[]
clickViewList
;
protected
ArrayNode
articleList
;
...
...
@@ -52,6 +54,8 @@ abstract class ArticlesAdapter extends BaseAdapter {
this
.
articleList
=
articleList
;
this
.
imageList
=
new
Bitmap
[
articleList
.
size
()];
this
.
nbrClicksList
=
new
Integer
[
articleList
.
size
()];
this
.
viewList
=
new
View
[
articleList
.
size
()];
this
.
clickViewList
=
new
TextView
[
articleList
.
size
()];
for
(
int
i
=
0
;
i
<
this
.
nbrClicksList
.
length
;
i
++)
...
...
app/src/main/java/fr/utc/simde/payutc/articles/GridAdapter.java
View file @
68826399
...
...
@@ -52,25 +52,24 @@ public class GridAdapter extends ArticlesAdapter {
public
View
getView
(
int
position
,
View
view
,
ViewGroup
viewGroup
)
{
JsonNode
article
=
this
.
articleList
.
get
(
position
);
if
(
view
==
null
)
{
if
(
this
.
viewList
[
position
]
==
null
)
{
LayoutInflater
layoutInflater
=
LayoutInflater
.
from
(
this
.
activity
);
view
=
layoutInflater
.
inflate
(
R
.
layout
.
fragment_article_grid
,
null
);
this
.
viewList
[
position
]
=
layoutInflater
.
inflate
(
R
.
layout
.
fragment_article_grid
,
null
);
ImageView
imageView
=
view
.
findViewById
(
R
.
id
.
image_article
);
ImageView
imageView
=
this
.
viewList
[
position
]
.
findViewById
(
R
.
id
.
image_article
);
RelativeLayout
.
LayoutParams
parms
=
new
RelativeLayout
.
LayoutParams
(
this
.
size
,
this
.
size
);
imageView
.
setLayoutParams
(
parms
);
if
(
article
==
null
||
article
.
size
()
==
0
)
view
.
setVisibility
(
View
.
INVISIBLE
);
this
.
viewList
[
position
]
.
setVisibility
(
View
.
INVISIBLE
);
else
{
if
(
clickViewList
[
position
]
==
null
)
clickViewList
[
position
]
=
view
.
findViewById
(
R
.
id
.
text_nbr_clicks
);
this
.
clickViewList
[
position
]
=
this
.
viewList
[
position
].
findViewById
(
R
.
id
.
text_nbr_clicks
);
TextView
textView
=
view
.
findViewById
(
R
.
id
.
text_article
);
TextView
textView
=
this
.
viewList
[
position
]
.
findViewById
(
R
.
id
.
text_article
);
textView
.
setText
(
article
.
get
(
"name"
).
textValue
());
ImageView
imageCotisant
=
view
.
findViewById
(
R
.
id
.
image_cotisant
);
ImageView
image18
=
view
.
findViewById
(
R
.
id
.
image_18
);
ImageView
imageCotisant
=
this
.
viewList
[
position
]
.
findViewById
(
R
.
id
.
image_cotisant
);
ImageView
image18
=
this
.
viewList
[
position
]
.
findViewById
(
R
.
id
.
image_18
);
LinearLayout
.
LayoutParams
imageParms
=
new
LinearLayout
.
LayoutParams
(
45
,
45
);
imageParms
.
setMargins
(
0
,
this
.
size
-
45
,
0
,
0
);
...
...
@@ -83,6 +82,6 @@ public class GridAdapter extends ArticlesAdapter {
}
}
return
view
;
return
this
.
viewList
[
position
]
;
}
}
app/src/main/java/fr/utc/simde/payutc/articles/GroupAdapter.java
View file @
68826399
...
...
@@ -61,7 +61,6 @@ public class GroupAdapter extends BaseAdapter {
((
LinearLayout
)
view
).
addView
(
checkBox
);
Log
.
d
(
LOG_TAG
,
Integer
.
toString
(
position
));
if
(
this
.
checkBoxList
[
position
]
==
null
)
this
.
checkBoxList
[
position
]
=
checkBox
;
}
...
...
app/src/main/java/fr/utc/simde/payutc/articles/ListAdapater.java
View file @
68826399
...
...
@@ -34,33 +34,31 @@ public class ListAdapater extends ArticlesAdapter {
public
ListAdapater
(
final
Activity
activity
,
final
ArrayNode
articleList
,
final
Boolean
printCotisant
,
final
Boolean
print18
)
throws
Exception
{
super
(
activity
,
articleList
,
printCotisant
,
print18
);
Log
.
d
(
LOG_TAG
,
articleList
.
toString
());
}
@Override
public
View
getView
(
int
position
,
View
view
,
ViewGroup
viewGroup
)
{
JsonNode
article
=
this
.
articleList
.
get
(
position
);
if
(
view
==
null
)
{
if
(
this
.
viewList
[
position
]
==
null
)
{
LayoutInflater
layoutInflater
=
LayoutInflater
.
from
(
this
.
activity
);
view
=
layoutInflater
.
inflate
(
R
.
layout
.
fragment_article_list
,
null
);
this
.
viewList
[
position
]
=
layoutInflater
.
inflate
(
R
.
layout
.
fragment_article_list
,
null
);
ImageView
imageView
=
view
.
findViewById
(
R
.
id
.
image_article
);
ImageView
imageView
=
this
.
viewList
[
position
]
.
findViewById
(
R
.
id
.
image_article
);
if
(
clickViewList
[
position
]
==
null
)
clickViewList
[
position
]
=
view
.
findViewById
(
R
.
id
.
text_nbr_clicks
);
clickViewList
[
position
]
=
this
.
viewList
[
position
].
findViewById
(
R
.
id
.
text_nbr_clicks
);
TextView
nameText
=
view
.
findViewById
(
R
.
id
.
text_article
);
TextView
nameText
=
this
.
viewList
[
position
]
.
findViewById
(
R
.
id
.
text_article
);
nameText
.
setText
(
article
.
get
(
"name"
).
textValue
());
TextView
priceText
=
view
.
findViewById
(
R
.
id
.
text_price
);
TextView
priceText
=
this
.
viewList
[
position
]
.
findViewById
(
R
.
id
.
text_price
);
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
)
+
"€"
);
ImageView
imageCotisant
=
view
.
findViewById
(
R
.
id
.
image_cotisant
);
ImageView
image18
=
view
.
findViewById
(
R
.
id
.
image_18
);
ImageView
imageCotisant
=
this
.
viewList
[
position
]
.
findViewById
(
R
.
id
.
image_cotisant
);
ImageView
image18
=
this
.
viewList
[
position
]
.
findViewById
(
R
.
id
.
image_18
);
if
(
article
.
has
(
"info"
))
{
TextView
infoText
=
view
.
findViewById
(
R
.
id
.
text_info
);
TextView
infoText
=
this
.
viewList
[
position
]
.
findViewById
(
R
.
id
.
text_info
);
infoText
.
setText
(
article
.
get
(
"info"
).
textValue
());
imageCotisant
.
setVisibility
(
View
.
GONE
);
...
...
@@ -78,7 +76,7 @@ public class ListAdapater extends ArticlesAdapter {
setClickView
(
position
);
}
return
view
;
return
this
.
viewList
[
position
]
;
}
public
void
toast
(
final
int
position
,
int
lengthLong
)
{
...
...
app/src/main/res/layout/dialog_group.xml
View file @
68826399
...
...
@@ -7,7 +7,6 @@
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"25dp"
android:layout_marginLeft=
"25dp"
android:layout_marginRight=
"25dp"
android:text=
"@string/filters"
/>
...
...
app/src/main/res/layout/fragment_article_grid.xml
View file @
68826399
...
...
@@ -66,7 +66,7 @@
<TextView
android:id=
"@+id/text_article"
android:layout_height=
"3
5
dp"
android:layout_height=
"3
6
dp"
android:layout_width=
"match_parent"
android:gravity=
"center_horizontal"
android:text=
"@string/article"
/>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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