Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
InstiApp
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
RAHUL SHARMA
InstiApp
Commits
49a4328c
Commit
49a4328c
authored
Jul 01, 2018
by
Varun Patil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Complete body page implementation
parent
bdb2f77f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
0 deletions
+39
-0
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/fragment/BodyFragment.java
...va/in/ac/iitb/gymkhana/iitbapp/fragment/BodyFragment.java
+39
-0
No files found.
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/fragment/BodyFragment.java
View file @
49a4328c
...
...
@@ -31,6 +31,7 @@ import in.ac.iitb.gymkhana.iitbapp.ItemClickListener;
import
in.ac.iitb.gymkhana.iitbapp.MainActivity
;
import
in.ac.iitb.gymkhana.iitbapp.R
;
import
in.ac.iitb.gymkhana.iitbapp.ShareURLMaker
;
import
in.ac.iitb.gymkhana.iitbapp.adapter.BodyAdapter
;
import
in.ac.iitb.gymkhana.iitbapp.adapter.FeedAdapter
;
import
in.ac.iitb.gymkhana.iitbapp.adapter.UserAdapter
;
import
in.ac.iitb.gymkhana.iitbapp.api.RetrofitInterface
;
...
...
@@ -218,6 +219,7 @@ public class BodyFragment extends Fragment {
eventRecyclerView
.
setAdapter
(
eventAdapter
);
eventRecyclerView
.
setLayoutManager
(
new
LinearLayoutManager
(
getContext
()));
/* Get users from roles */
final
List
<
Role
>
roles
=
body
.
getBodyRoles
();
final
List
<
User
>
users
=
new
ArrayList
();
for
(
Role
role
:
roles
)
{
...
...
@@ -228,6 +230,8 @@ public class BodyFragment extends Fragment {
}
}
}
/* Initialize People */
RecyclerView
userRecyclerView
=
(
RecyclerView
)
getActivity
().
findViewById
(
R
.
id
.
people_card_recycler_view
);
UserAdapter
userAdapter
=
new
UserAdapter
(
users
,
new
ItemClickListener
()
{
@Override
...
...
@@ -246,6 +250,41 @@ public class BodyFragment extends Fragment {
});
userRecyclerView
.
setAdapter
(
userAdapter
);
userRecyclerView
.
setLayoutManager
(
new
LinearLayoutManager
(
getContext
()));
/* Initialize Parent bodies */
RecyclerView
parentsRecyclerView
=
(
RecyclerView
)
getActivity
().
findViewById
(
R
.
id
.
parentorg_card_recycler_view
);
BodyAdapter
parentAdapter
=
new
BodyAdapter
(
body
.
getBodyParents
(),
new
ItemClickListener
()
{
@Override
public
void
onItemClick
(
View
v
,
int
position
)
{
openBody
(
body
.
getBodyParents
().
get
(
position
));
}
});
parentsRecyclerView
.
setAdapter
(
parentAdapter
);
parentsRecyclerView
.
setLayoutManager
(
new
LinearLayoutManager
(
getContext
()));
/* Initialize child bodies */
RecyclerView
childrenRecyclerView
=
(
RecyclerView
)
getActivity
().
findViewById
(
R
.
id
.
org_card_recycler_view
);
BodyAdapter
childrenAdapter
=
new
BodyAdapter
(
body
.
getBodyChildren
(),
new
ItemClickListener
()
{
@Override
public
void
onItemClick
(
View
v
,
int
position
)
{
openBody
(
body
.
getBodyChildren
().
get
(
position
));
}
});
childrenRecyclerView
.
setAdapter
(
childrenAdapter
);
childrenRecyclerView
.
setLayoutManager
(
new
LinearLayoutManager
(
getContext
()));
}
/** Open body fragment for a body */
private
void
openBody
(
Body
body
)
{
Bundle
bundle
=
new
Bundle
();
bundle
.
putString
(
Constants
.
BODY_JSON
,
new
Gson
().
toJson
(
body
));
BodyFragment
bodyFragment
=
new
BodyFragment
();
bodyFragment
.
setArguments
(
bundle
);
FragmentTransaction
ft
=
getActivity
().
getSupportFragmentManager
().
beginTransaction
();
ft
.
setCustomAnimations
(
R
.
anim
.
slide_in_left
,
R
.
anim
.
slide_out_left
,
R
.
anim
.
slide_in_right
,
R
.
anim
.
slide_out_right
);
ft
.
replace
(
R
.
id
.
framelayout_for_fragment
,
bodyFragment
,
bodyFragment
.
getTag
());
ft
.
addToBackStack
(
bodyFragment
.
getTag
());
ft
.
commit
();
}
private
class
updateDbBody
extends
AsyncTask
<
Body
,
Void
,
Integer
>
{
...
...
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