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.FragmentPagerAdapter
Class that handles questions lists used inMultiQuestionFragment
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
MULTIPLE_CHOICE_QUESTION
TheDefinition
type for multiple choice questionstatic java.lang.String
RATING_QUESTION
TheDefinition
type for rating questionstatic java.lang.String
TEXT_QUESTION
TheDefinition
type 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 boolean
completeAnswer()
Check if all questions have answersjava.util.List<Answer>
getAnswers()
Return answers to the questionsint
getCount()
androidx.fragment.app.Fragment
getItem(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
TheDefinition
type for text question- See Also:
- Constant Field Values
-
RATING_QUESTION
public static final java.lang.String RATING_QUESTION
TheDefinition
type for rating question- See Also:
- Constant Field Values
-
MULTIPLE_CHOICE_QUESTION
public static final java.lang.String MULTIPLE_CHOICE_QUESTION
TheDefinition
type 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 questionDefinition
fm
- instance ofFragmentManager
isSurveyQuiz
- 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:
getItem
in classandroidx.fragment.app.FragmentPagerAdapter
- Parameters:
position
- item position- Returns:
- instance of
QuestionFragment
-
getCount
public int getCount()
- Specified by:
getCount
in 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
-
-