use of com.instructure.canvasapi2.models.Poll 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.Poll 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