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
package com.jshme.feature.home.adapter | |
import android.annotation.SuppressLint | |
import android.view.ViewGroup | |
import androidx.recyclerview.widget.DiffUtil | |
import androidx.recyclerview.widget.ListAdapter | |
import androidx.recyclerview.widget.RecyclerView | |
import androidx.viewbinding.ViewBinding | |
internal class HomeAdapter<T: HomeViewHolderModel> |
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
import android.annotation.SuppressLint | |
import android.view.MotionEvent | |
import android.view.View | |
import io.reactivex.android.schedulers.AndroidSchedulers | |
import io.reactivex.disposables.CompositeDisposable | |
import io.reactivex.rxkotlin.plusAssign | |
import io.reactivex.schedulers.Schedulers | |
import io.reactivex.subjects.BehaviorSubject | |
import java.util.* | |
import javax.inject.Inject |
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
sealed class Result<out R> { | |
data class Success<out T>(val data: T) : Result<T>() | |
data class Error(val exception: Exception) : Result<Nothing>() | |
} | |
fun <T>Result<T>.getValue(): T { | |
return if(this is Result.Success) { | |
this.data | |
} else { |
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 GetUserInfoUseCase ( | |
private val userRepository: UserRepository, | |
private val cardRepository: CardRepository | |
) { | |
suspend operator fun invoke(isUpdated: Boolean): Result<List<User>> { | |
return when (cardRepository.getCards(isUpdated)) { | |
is Result.Success -> userRepository.getUserInfo(isUpdated) | |
else -> Result.Error(Exception("Load Failed")) | |
} | |
} |
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
∧_∧ hi there..... | |
(。・ω・。)つ━☆・*。 | |
⊂ ノ ・゜ 。゚゚・。・゚゚。 | |
しーJ ° ゚。 。゚ | |
゚・。・゚ |