use of com.instructure.canvasapi2.models.PollSession in project instructure-android by instructure.
the class ClosedPollListFragment method getRowViewForItem.
@Override
public View getRowViewForItem(PollSession item, View convertView, int childPosition) {
Poll poll = pollMap.get(item.getPoll_id());
String pollName = "";
if (poll != null) {
pollName = poll.getQuestion();
}
String courseName = "";
if (courseMap.containsKey(item.getCourse_id())) {
courseName = courseMap.get(item.getCourse_id()).getName();
}
return PollRowFactory.buildRowView(layoutInflater(), courseName, pollName, convertView, getActivity(), item.getCreated_at());
}
use of com.instructure.canvasapi2.models.PollSession in project instructure-android by instructure.
the class OpenPollExpandableListFragment method getRowViewForItem.
@Override
public View getRowViewForItem(PollSession item, View convertView, int groupPosition, int childPosition, boolean isLastRowInGroup, boolean isLastRow) {
Poll poll = pollMap.get(item.getPoll_id());
String pollName = "";
if (poll != null) {
pollName = poll.getQuestion();
}
String courseName = "";
if (courseMap.containsKey(item.getCourse_id())) {
courseName = courseMap.get(item.getCourse_id()).getName();
}
return PollRowFactory.buildRowView(layoutInflater(), courseName, pollName, convertView, getActivity(), item.getCreated_at());
}
use of com.instructure.canvasapi2.models.PollSession in project instructure-android by instructure.
the class PollSessionListFragment method onActivityCreated.
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
setHasOptionsMenu(true);
touchListener = new SwipeDismissListViewTouchListener(getListView(), new SwipeDismissListViewTouchListener.DismissCallbacks() {
@Override
public boolean canDismiss(int position) {
return true;
}
@Override
public void onDismiss(ListView listView, int[] reverseSortedPositions) {
for (int position : reverseSortedPositions) {
// set the poll that we want to remove after the api call returns successfully
PollSession pollSession = getItem(position);
// remove the item from the list
removeItem(pollSession);
// delete the poll from canvas
PollsManager.deletePollSession(poll.getId(), pollSession.getId(), responseCanvasCallback, true);
}
}
});
getListView().setOnTouchListener(touchListener);
getListView().setOnScrollListener(touchListener.makeScrollListener());
// set an animation for adding list items
LayoutAnimationController controller = AnimationUtils.loadLayoutAnimation(getActivity(), R.anim.list_layout_controller);
getListView().setLayoutAnimation(controller);
}
use of com.instructure.canvasapi2.models.PollSession in project instructure-android by instructure.
the class PollSessionListFragment method onActivityResult.
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == Constants.PUBLISH_POLL_SUCCESS || resultCode == Constants.PUBLISH_POLL_SUCCESS_MULTIPLE) {
if (data != null) {
PollSession session = data.getExtras().getParcelable(Constants.POLL_SESSION);
PollResultsFragment pollResultsFragment = new PollResultsFragment();
Bundle bundle = new Bundle();
bundle.putParcelable(Constants.POLL_DATA, poll);
bundle.putParcelable(Constants.POLL_SESSION, session);
pollResultsFragment.setArguments(bundle);
((FragmentManagerActivity) getActivity()).removeFragment(this);
((FragmentManagerActivity) getActivity()).swapFragments(pollResultsFragment, PollResultsFragment.class.getSimpleName());
return;
}
reloadData();
}
}
Aggregations