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
| public interface PromotionService { | |
| @GET("/promotions") | |
| Observable<List<Promotion>> fetchPromotions(); | |
| @GET("/promotions/{promotion_id}/sales") | |
| Observable<List<Sale>> fetchSales(@Path("promotion_id") long promotionId); | |
| @GET("/promotions/{promotion_id}/ads") | |
| Observable<List<Ad>> fetchAds(@Path("promotion_id") long promotionId); |
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
| public class PromotionRepository { | |
| private PromotionService promotionService; | |
| @Inject | |
| public PromotionRepository(PromotionService promotionService) { | |
| this.promotionService = promotionService; | |
| } | |
| public Observable<List<Promotion>> fetchPromotions(){ |
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
| public class Optional<M> { | |
| /** | |
| * Common instance for {@code empty()}. | |
| */ | |
| private static final Optional<?> EMPTY = new Optional<>(null); | |
| private final M value; | |
| public Optional(@Nullable M value) { |
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
| public interface PromotionService { | |
| @GET("/promotions") | |
| Observable<Response<List<Promotion>>> fetchPromotions(); | |
| @GET("/promotions/{promotion_id}/sales") | |
| Observable<Response<List<Sale>>> fetchSales(@Path("promotion_id") long promotionId); | |
| @GET("/promotions/{promotion_id}/ads") | |
| Observable<Response<List<Ad>>> fetchAds(@Path("promotion_id") long promotionId); |
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
| public class PromotionPresenter implements PromotionContract.Presenter { | |
| PromotionContract.View view; | |
| PromotionRepository repository; | |
| private CompositeDisposable disposeBag; | |
| @Inject | |
| public PromotionPresenter(PromotionRepository repository){ | |
| this.repository = repository; |
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
| public class PromotionPresenter implements PromotionContract.Presenter { | |
| PromotionContract.View view; | |
| PromotionRepository repository; | |
| private CompositeDisposable disposeBag; | |
| @Inject | |
| public PromotionPresenter(PromotionRepository repository){ | |
| this.repository = repository; |
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
| public class PromotionRepository { | |
| private PromotionService promotionService; | |
| @Inject | |
| public PromotionRepository(PromotionService promotionService) { | |
| this.promotionService = promotionService; | |
| } | |
| public Observable<Optional<List<Promotion>>> fetchPromotions(){ |
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
| import io.reactivex.android.plugins.RxAndroidPlugins | |
| import io.reactivex.plugins.RxJavaPlugins | |
| import io.reactivex.schedulers.Schedulers | |
| import okhttp3.MediaType | |
| import okhttp3.ResponseBody | |
| import org.junit.Before | |
| import org.junit.Test | |
| import org.mockito.ArgumentMatchers.any | |
| import org.mockito.Mock | |
| import org.mockito.Mockito |
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
| { | |
| ConstraintSets: { | |
| start: { | |
| headerImage: { | |
| width: "spread", | |
| height: 250, | |
| top: ['parent', 'top'], | |
| start: ['parent', 'start'], | |
| end: ['parent', 'end'], | |
| translationY: 0, |
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 MainActivity : ComponentActivity() { | |
| override fun onCreate(savedInstanceState: Bundle?) { | |
| super.onCreate(savedInstanceState) | |
| setContent { | |
| MyApplicationTheme { | |
| // A surface container using the 'background' color from the theme | |
| Surface( | |
| modifier = Modifier.fillMaxSize(), | |
| color = MaterialTheme.colorScheme.background | |
| ) { |
OlderNewer