Class MultiQuestionAdapter
- java.lang.Object
-
- androidx.viewpager.widget.PagerAdapter
-
- androidx.fragment.app.FragmentPagerAdapter
-
- com.cheetahdigital.challenges.ui.responses.multiquestion.MultiQuestionAdapter
-
public class MultiQuestionAdapter extends androidx.fragment.app.FragmentPagerAdapterClass that handles questions lists used inMultiQuestionFragment
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringMULTIPLE_CHOICE_QUESTIONTheDefinitiontype for multiple choice questionstatic java.lang.StringRATING_QUESTIONTheDefinitiontype for rating questionstatic java.lang.StringTEXT_QUESTIONTheDefinitiontype for text question
-
Constructor Summary
Constructors Constructor Description MultiQuestionAdapter(java.util.List<Definition> definitions, androidx.fragment.app.FragmentManager fm, boolean isSurveyQuiz)Default constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancompleteAnswer()Check if all questions have answersjava.util.List<Answer>getAnswers()Return answers to the questionsintgetCount()androidx.fragment.app.FragmentgetItem(int position)Create an instance ofQuestionFragment-
Methods inherited from class androidx.fragment.app.FragmentPagerAdapter
destroyItem, finishUpdate, getItemId, instantiateItem, isViewFromObject, restoreState, saveState, setPrimaryItem, startUpdate
-
-
-
-
Field Detail
-
TEXT_QUESTION
public static final java.lang.String TEXT_QUESTION
TheDefinitiontype for text question- See Also:
- Constant Field Values
-
RATING_QUESTION
public static final java.lang.String RATING_QUESTION
TheDefinitiontype for rating question- See Also:
- Constant Field Values
-
MULTIPLE_CHOICE_QUESTION
public static final java.lang.String MULTIPLE_CHOICE_QUESTION
TheDefinitiontype for multiple choice question- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MultiQuestionAdapter
public MultiQuestionAdapter(java.util.List<Definition> definitions, @NonNull androidx.fragment.app.FragmentManager fm, boolean isSurveyQuiz)
Default constructor- Parameters:
definitions- list of questionDefinitionfm- instance ofFragmentManagerisSurveyQuiz- true if the fragment was used as a survey quiz from view content challenges
-
-
Method Detail
-
getItem
@NonNull public androidx.fragment.app.Fragment getItem(int position)
Create an instance ofQuestionFragment- Specified by:
getItemin classandroidx.fragment.app.FragmentPagerAdapter- Parameters:
position- item position- Returns:
- instance of
QuestionFragment
-
getCount
public int getCount()
- Specified by:
getCountin classandroidx.viewpager.widget.PagerAdapter
-
getAnswers
public java.util.List<Answer> getAnswers()
Return answers to the questions- Returns:
- list of
Answer
-
completeAnswer
public boolean completeAnswer()
Check if all questions have answers- Returns:
- true if all questions have answer, false otherwise
-
-