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.antonicastejon.cryptodata.model | |
import io.reactivex.Single | |
/** | |
* Created by Antoni Castejón on 31/12/2017. | |
*/ | |
interface CoinMarketCapRepository { | |
fun getCryptoList(page:Int, limit:Int) : Single<List<Crypto>> |
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.antonicastejon.cryptodata.model | |
import io.reactivex.Single | |
/** | |
* Created by Antoni Castejón on 31/12/2017. | |
*/ | |
class CoinMarketCapDownloader(private val coinMarketCapApi: CoinMarketCapApi) : CoinMarketCapRepository { | |
override fun getCryptoList(page: Int, limit: Int): Single<List<Crypto>> = coinMarketCapApi.getCryptoList(page * limit, limit) |
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.antonicastejon.cryptodata.domain | |
import com.antonicastejon.cryptodata.model.CoinMarketCapRepository | |
import com.antonicastejon.cryptodata.model.Crypto | |
import io.reactivex.Single | |
/** | |
* Created by Antoni Castejón on 31/12/2017. | |
*/ |
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.antonicastejon.cryptodata.domain | |
import android.os.Parcel | |
import android.os.Parcelable | |
import io.reactivex.Single | |
/** | |
* Created by Antoni Castejón on 31/12/2017. | |
*/ | |
interface CryptoListUseCases { |
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.antonicastejon.cryptodata.presentation.main.crypto_list | |
import com.antonicastejon.cryptodata.domain.CryptoViewModel | |
/** | |
* Created by Antoni Castejón | |
* 20/01/2018. | |
*/ | |
sealed class CryptoListState { | |
abstract val pageNum:Int |
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.antonicastejon.cryptodata.presentation.main.crypto_list | |
import android.arch.lifecycle.MutableLiveData | |
import android.arch.lifecycle.ViewModel | |
import com.antonicastejon.cryptodata.di.SCHEDULER_IO | |
import com.antonicastejon.cryptodata.di.SCHEDULER_MAIN_THREAD | |
import com.antonicastejon.cryptodata.domain.CryptoListUseCases | |
import com.antonicastejon.cryptodata.domain.CryptoViewModel | |
import com.antonicastejon.cryptodata.domain.LIMIT_CRYPTO_LIST | |
import io.reactivex.Scheduler |
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.antonicastejon.cryptodata.presentation.main.crypto_list | |
import android.arch.lifecycle.Observer | |
import android.arch.lifecycle.ViewModelProvider | |
import android.arch.lifecycle.ViewModelProviders | |
import android.content.Context | |
import android.os.Bundle | |
import android.support.v4.app.Fragment | |
import android.support.v7.widget.LinearLayoutManager | |
import android.view.LayoutInflater |
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.antonicastejon.cryptodata.usecases | |
import android.arch.core.executor.testing.InstantTaskExecutorRule | |
import com.antonicastejon.cryptodata.common.cryptoPOJOmodel | |
import com.antonicastejon.cryptodata.common.cryptoViewModelFrom | |
import com.antonicastejon.cryptodata.common.mock | |
import com.antonicastejon.cryptodata.common.whenever | |
import com.antonicastejon.cryptodata.domain.CryptoListInteractor | |
import com.antonicastejon.cryptodata.model.CoinMarketCapRepository | |
import io.reactivex.Single |
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
fun limitCryptoListSizeArrayEmptyCryptoViewModel(): List<CryptoViewModel> = | |
ArrayList<CryptoViewModel>(Collections.nCopies(LIMIT_CRYPTO_LIST, CryptoViewModel())) | |
fun cryptoPOJOmodel() = | |
Crypto("1", "name", "sy", 10, "100", "0.1", "100", "1000", "0", "500", "5", "10", "-10", "") | |
fun cryptoViewModelFrom(crypto:Crypto) = | |
CryptoViewModel(crypto.id, crypto.name, crypto.symbol, crypto.rank, crypto.priceUsd.toFloat(), crypto.priceBtc.toFloat(), crypto.percentChange24h.toFloat()) |
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.antonicastejon.cryptodata.viewmodels | |
import android.arch.core.executor.testing.InstantTaskExecutorRule | |
import android.arch.lifecycle.Observer | |
import com.antonicastejon.cryptodata.common.limitCryptoListSizeArrayEmptyCryptoViewModel | |
import com.antonicastejon.cryptodata.common.mock | |
import com.antonicastejon.cryptodata.common.whenever | |
import com.antonicastejon.cryptodata.domain.CryptoListUseCases | |
import com.antonicastejon.cryptodata.domain.CryptoViewModel | |
import com.antonicastejon.cryptodata.presentation.main.crypto_list.* |
OlderNewer