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
62ab64e2
Commit
62ab64e2
authored
Oct 28, 2017
by
Nastuzzi Samy
Browse files
GridLayout
parent
bef3688c
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/src/main/java/fr/utc/simde/payutc/fragments/ArticleGroupFragment.java
View file @
62ab64e2
...
...
@@ -25,18 +25,25 @@ public class ArticleGroupFragment implements TabHost.TabContentFactory {
private
LayoutInflater
layoutInflater
;
private
View
view
;
private
ScrollView
scrollView
;
private
GridLayout
gridView
;
private
GridLayout
gridLayout
;
private
int
nbrColumns
;
public
ArticleGroupFragment
(
final
Activity
activity
,
final
JsonNode
articleList
)
throws
Exception
{
this
.
layoutInflater
=
LayoutInflater
.
from
(
activity
);
this
.
view
=
this
.
layoutInflater
.
inflate
(
R
.
layout
.
fragment_article_group
,
null
);
this
.
gridView
=
this
.
view
.
findViewById
(
R
.
id
.
grid_articles
);
this
.
gridLayout
=
this
.
view
.
findViewById
(
R
.
id
.
grid_articles
);
setGridLayout
(
3
);
createGroups
(
activity
,
articleList
);
}
createArticles
(
activity
,
articleList
);
public
void
setGridLayout
(
final
int
nbrColumns
)
{
this
.
nbrColumns
=
nbrColumns
;
this
.
gridLayout
.
setColumnCount
(
nbrColumns
);
}
public
void
create
Article
s
(
final
Activity
activity
,
final
JsonNode
articleList
)
throws
Exception
{
public
void
create
Group
s
(
final
Activity
activity
,
final
JsonNode
articleList
)
throws
Exception
{
LinearLayout
linearLayout
=
new
LinearLayout
(
activity
);
linearLayout
.
setOrientation
(
LinearLayout
.
VERTICAL
);
...
...
@@ -47,10 +54,9 @@ public class ArticleGroupFragment implements TabHost.TabContentFactory {
if
(!
article
.
get
(
"active"
).
booleanValue
())
continue
;
linear
Layout
.
addView
(
new
ArticleFragment
(
activity
,
article
).
getView
());
this
.
grid
Layout
.
addView
(
new
ArticleFragment
(
activity
,
article
).
getView
());
}
this
.
gridView
.
addView
(
linearLayout
);
}
@Override
...
...
app/src/main/res/layout/fragment_article.xml
View file @
62ab64e2
...
...
@@ -3,6 +3,7 @@
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_rowWeight=
"1"
android:orientation=
"vertical"
android:rowCount=
"2"
>
...
...
@@ -18,8 +19,9 @@
</RelativeLayout>
<TextView
android:layout_rowWeight=
"1"
android:id=
"@+id/text_article"
android:layout_rowWeight=
"1"
android:gravity=
"center_horizontal"
android:text=
"@string/article"
/>
</GridLayout>
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