Search in sources :

Example 1 with FragmentManagerActivity

use of com.instructure.androidpolling.app.activities.FragmentManagerActivity in project instructure-android by instructure.

the class PollSessionListFragment method onRowClick.

@Override
public boolean onRowClick(PollSession item, int position) {
    PollResultsFragment pollResultsFragment = new PollResultsFragment();
    Bundle bundle = new Bundle();
    bundle.putParcelable(Constants.POLL_DATA, poll);
    bundle.putParcelable(Constants.POLL_SESSION, item);
    pollResultsFragment.setArguments(bundle);
    ((FragmentManagerActivity) getActivity()).swapFragments(pollResultsFragment, PollResultsFragment.class.getSimpleName());
    return true;
}
Also used : Bundle(android.os.Bundle) FragmentManagerActivity(com.instructure.androidpolling.app.activities.FragmentManagerActivity)

Example 2 with FragmentManagerActivity

use of com.instructure.androidpolling.app.activities.FragmentManagerActivity in project instructure-android by instructure.

the class AddQuestionFragment method onActivityResult.

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (resultCode == Constants.PUBLISH_POLL_SUCCESS) {
        // try to go to the poll result
        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;
        }
        // if there are multiple poll sessions, go to the list
        getActivity().onBackPressed();
    } else if (resultCode == Constants.PUBLISH_POLL_SUCCESS_MULTIPLE) {
        PollSessionListFragment pollSessionListFragment = new PollSessionListFragment();
        Bundle bundle = new Bundle();
        bundle.putParcelable(Constants.POLL_DATA, poll);
        pollSessionListFragment.setArguments(bundle);
        ((FragmentManagerActivity) getActivity()).removeFragment(this);
        ((FragmentManagerActivity) getActivity()).swapFragments(pollSessionListFragment, PollResultsFragment.class.getSimpleName());
    }
}
Also used : PollSession(com.instructure.canvasapi2.models.PollSession) Bundle(android.os.Bundle) FragmentManagerActivity(com.instructure.androidpolling.app.activities.FragmentManagerActivity)

Example 3 with FragmentManagerActivity

use of com.instructure.androidpolling.app.activities.FragmentManagerActivity 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();
    }
}
Also used : PollSession(com.instructure.canvasapi2.models.PollSession) Bundle(android.os.Bundle) FragmentManagerActivity(com.instructure.androidpolling.app.activities.FragmentManagerActivity)

Example 4 with FragmentManagerActivity

use of com.instructure.androidpolling.app.activities.FragmentManagerActivity in project instructure-android by instructure.

the class QuestionListFragment method onRowClick.

@Override
public boolean onRowClick(Poll item) {
    // if the poll is in the draft section, we want to take the user to the edit poll screen
    if (!openSessions.containsKey(item.getId()) && !closedSessions.containsKey(item.getId())) {
        selectedPoll = item;
        pollChoiceArrayList.clear();
        PollsManager.getFirstPagePollChoices(selectedPoll.getId(), pollChoiceCallback, true);
        return true;
    }
    // send the poll data to the results screen
    PollSessionListFragment pollSessionListFragment = new PollSessionListFragment();
    Bundle bundle = new Bundle();
    bundle.putParcelable(Constants.POLL_DATA, item);
    pollSessionListFragment.setArguments(bundle);
    ((FragmentManagerActivity) getActivity()).swapFragments(pollSessionListFragment, PollSessionListFragment.class.getSimpleName());
    return true;
}
Also used : Bundle(android.os.Bundle) FragmentManagerActivity(com.instructure.androidpolling.app.activities.FragmentManagerActivity)

Aggregations

Bundle (android.os.Bundle)4 FragmentManagerActivity (com.instructure.androidpolling.app.activities.FragmentManagerActivity)4 PollSession (com.instructure.canvasapi2.models.PollSession)2