This file contains 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 FollowFragment : Fragment() { | |
private var _binding: FragmentFollowBinding? = null | |
private val binding get() = _binding!! | |
private var username: String? = null | |
private var position: Int? = null | |
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | |
super.onViewCreated(view, savedInstanceState) | |
arguments?.let { |
This file contains 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 GithubRepository private constructor( | |
private val favoriteDao: FavoriteDao | |
) { | |
suspend fun insertFavoriteUser(data: FavoriteUser) { | |
favoriteDao.insertFavorite(data) | |
} | |
suspend fun deleteFavoriteUser(username: String) { | |
favoriteDao.deleteFavorite(username) | |
} |
This file contains 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 ViewModelFactory private constructor( | |
private val githubRepository: GithubRepository | |
) : | |
ViewModelProvider.NewInstanceFactory() { | |
@Suppress("UNCHECKED_CAST") | |
override fun <T : ViewModel> create(modelClass: Class<T>): T { | |
if (modelClass.isAssignableFrom(DetailViewModel::class.java)) { | |
return DetailViewModel(githubRepository) as T | |
} |