This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "result": true, | |
| "data": { | |
| "id": 607, | |
| "title": "Identifier Service", | |
| "sequence": 3, | |
| "design": [ | |
| "info", | |
| "question", | |
| "info" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ViewPagerChapterAdapter( | |
| private val fragmentList: ArrayList<Fragment>, | |
| fragmentManager: FragmentManager, | |
| lifecycle: Lifecycle | |
| ) : FragmentStateAdapter(fragmentManager, lifecycle) { | |
| override fun getItemCount(): Int { | |
| return fragmentList.size | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @ExperimentalCoroutinesApi | |
| @AndroidEntryPoint | |
| class ViewPagerChapterFragment : | |
| BaseFragment<FragmentViewPagerChapterBinding, ViewPagerChapterViewModel>(R.layout.fragment_view_pager_chapter), | |
| OnRequestAction { | |
| // var region | |
| override val viewModel: ViewPagerChapterViewModel by viewModels() | |
| @Inject |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @HiltViewModel | |
| class ViewPagerChapterViewModel @Inject constructor( | |
| private val api: CourseRepository | |
| ) : | |
| BaseViewModel() { | |
| // live data | |
| private val _chapter = MutableLiveData<Resource<ChapterModel>>() | |
| val chapter: LiveData<Resource<ChapterModel>> | |
| get() = _chapter |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @ExperimentalCoroutinesApi | |
| @AndroidEntryPoint | |
| class ChapterQuestionFragment(private val question: Question) : | |
| BaseFragment<FragmentChapterQuestionBinding, ChapterQuestionViewModel>(R.layout.fragment_chapter_question) { | |
| //var region | |
| override val viewModel: ChapterQuestionViewModel by viewModels() | |
| private lateinit var mCallback: OnRequestAction | |
| //end region |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @HiltViewModel | |
| class ChapterQuestionViewModel @Inject constructor( | |
| private val api: CourseRepository | |
| ) : BaseViewModel() { | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @HiltViewModel | |
| class ChapterDescriptionViewModel @Inject constructor( | |
| private val api: CourseRepository | |
| ) : BaseViewModel() { | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * @param B: DataBinding class of fragment | |
| * @param VM: ViewModel class of fragment | |
| * @param layoutId: Layout resource id of fragment | |
| * | |
| * Base class for [Fragment] instances, all common processes will be handled based on this class. | |
| */ | |
| abstract class BaseFragment< | |
| B : ViewDataBinding, | |
| VM : BaseViewModel> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Base class for [ViewModel] instances, all common processes will be handled based on this class. | |
| */ | |
| abstract class BaseViewModel : ViewModel() { | |
| var showError = MutableLiveData<String?>() | |
| override fun onCleared() { | |
| LogUtils.d("$this") | |
| super.onCleared() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| interface OnRequestAction { | |
| fun nextPage() | |
| } |