Commit 354921dc authored by Varun Patil's avatar Varun Patil

Fix loading user fragment from back stack

parent c84de14a
......@@ -26,9 +26,9 @@ import app.insti.api.model.Body;
* Use the {@link BodyRecyclerViewFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class BodyRecyclerViewFragment extends Fragment {
public class BodyRecyclerViewFragment extends Fragment implements TransitionTargetFragment{
private static final String TAG = "BodyRecyclerViewFragment";
public Fragment parentFragment = null;
private RecyclerView recyclerView;
private BodyAdapter bodyAdapter;
......@@ -39,6 +39,13 @@ public class BodyRecyclerViewFragment extends Fragment {
// Required empty public constructor
}
@Override
public void transitionEnd() {
if (parentFragment instanceof TransitionTargetFragment) {
((TransitionTargetFragment) parentFragment).transitionEnd();
}
}
// TODO: Rename and change types and number of parameters
public static BodyRecyclerViewFragment newInstance(List<Body> bodyList) {
BodyRecyclerViewFragment fragment = new BodyRecyclerViewFragment();
......
......@@ -25,9 +25,9 @@ import app.insti.api.model.Event;
* Use the {@link EventRecyclerViewFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class EventRecyclerViewFragment extends Fragment {
public class EventRecyclerViewFragment extends Fragment implements TransitionTargetFragment {
private static final String TAG = "EventRecyclerViewFragment";
public Fragment parentFragment = null;
private RecyclerView recyclerView;
private FeedAdapter feedAdapter;
......@@ -38,6 +38,13 @@ public class EventRecyclerViewFragment extends Fragment {
// Required empty public constructor
}
@Override
public void transitionEnd() {
if (parentFragment instanceof TransitionTargetFragment) {
((TransitionTargetFragment) parentFragment).transitionEnd();
}
}
// TODO: Rename and change types and number of parameters
public static EventRecyclerViewFragment newInstance(List<Event> eventList) {
EventRecyclerViewFragment fragment = new EventRecyclerViewFragment();
......
......@@ -23,9 +23,9 @@ import app.insti.api.model.Role;
* Use the {@link RoleRecyclerViewFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class RoleRecyclerViewFragment extends Fragment {
public class RoleRecyclerViewFragment extends Fragment implements TransitionTargetFragment {
private static final String TAG = "RoleRecyclerViewFragment";
public Fragment parentFragment = null;
private RecyclerView recyclerView;
private RoleAdapter roleAdapter;
......@@ -36,6 +36,13 @@ public class RoleRecyclerViewFragment extends Fragment {
// Required empty public constructor
}
@Override
public void transitionEnd() {
if (parentFragment instanceof TransitionTargetFragment) {
((TransitionTargetFragment) parentFragment).transitionEnd();
}
}
// TODO: Rename and change types and number of parameters
public static RoleRecyclerViewFragment newInstance(List<Role> roleList) {
RoleRecyclerViewFragment fragment = new RoleRecyclerViewFragment();
......
......@@ -184,6 +184,11 @@ public class UserFragment extends BackHandledFragment implements TransitionTarge
RoleRecyclerViewFragment frag1 = RoleRecyclerViewFragment.newInstance(roleList);
BodyRecyclerViewFragment frag2 = BodyRecyclerViewFragment.newInstance(bodyList);
EventRecyclerViewFragment frag3 = EventRecyclerViewFragment.newInstance(eventList);
frag1.parentFragment = this;
frag2.parentFragment = this;
frag3.parentFragment = this;
TabAdapter tabAdapter = new TabAdapter(getChildFragmentManager());
tabAdapter.addFragment(frag1, "Associations");
tabAdapter.addFragment(frag2, "Following");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment