├── jubako-sample ├── .gitignore ├── src │ └── main │ │ ├── res │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── layout │ │ │ ├── grid_cell.xml │ │ │ ├── simple_carousel.xml │ │ │ ├── grid_fill_progress.xml │ │ │ ├── carousel_item_movie.xml │ │ │ ├── simple_carousel_item_text.xml │ │ │ ├── simple_item_text.xml │ │ │ ├── simple_carousel_with_heading.xml │ │ │ ├── carousel_movies.xml │ │ │ ├── activity_grid_fill.xml │ │ │ ├── activity_jubako_recycler.xml │ │ │ ├── activity_home.xml │ │ │ └── item_movie_hero.xml │ │ ├── values │ │ │ ├── colors.xml │ │ │ ├── styles.xml │ │ │ └── strings.xml │ │ ├── mipmap-anydpi-v26 │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.xml │ │ ├── drawable │ │ │ ├── movie_hero_nav_gradient.xml │ │ │ ├── ic_add.xml │ │ │ ├── ic_play_arrow.xml │ │ │ ├── ic_info.xml │ │ │ ├── movie_hero_gradient.xml │ │ │ ├── ic_jubako_icon.xml │ │ │ └── ic_launcher_background.xml │ │ └── drawable-v24 │ │ │ └── ic_launcher_foreground.xml │ │ ├── assets │ │ ├── 1 │ │ │ ├── 4d-Man-03-movie-poster.webp │ │ │ ├── 3-stooges-1941-movie-poster.webp │ │ │ ├── 5-Element-Kung-Fu-01-movie-poster.webp │ │ │ ├── 5-Fingers-Of-Death-01-movie-poster.webp │ │ │ ├── 5-Fingers-Of-Death-02-movie-poster.webp │ │ │ └── 3stooges-movie-maniacs-1935-movie-poster.webp │ │ ├── 2 │ │ │ ├── 13-Ghosts-01-movie-poster.webp │ │ │ ├── Ace-High-01-0-movie-poster.webp │ │ │ ├── 13-rue-madeleine-1946-movie-poster.webp │ │ │ ├── 18-Weapons-Of-Kung-Fu-01-movie-poster.webp │ │ │ ├── 20-Million-Miles-To-Earth-01-movie-poster.webp │ │ │ └── abbott-and-costello-meet-frankenstein-1948-movie-poster.webp │ │ └── 3 │ │ │ ├── 5-Man-Army-01-movie-poster.webp │ │ │ ├── 7-Man-Army-01-movie-poster.webp │ │ │ ├── 10-To-Midnight-01-movie-poster.webp │ │ │ ├── 7th-Commandment-01-movie-poster.webp │ │ │ ├── 7-Faces-Of-Dr-Lao-01-movie-poster.webp │ │ │ └── 13-Frightened-Girls-01-movie-poster.webp │ │ ├── java │ │ └── com │ │ │ └── sample │ │ │ └── jubako │ │ │ ├── HelloJubakoActivity.kt │ │ │ ├── InfiniteHelloJubakoActivity.kt │ │ │ ├── SelfUpdatingItemsActivity.kt │ │ │ ├── HomeActivity.kt │ │ │ ├── RowUpdatesActivity.kt │ │ │ ├── SimpleCarouselsActivity.kt │ │ │ ├── LoadAsyncActivity.kt │ │ │ ├── MoviesActivity.kt │ │ │ ├── EnterpriseHelloJubakoActivity.kt │ │ │ └── GridFillActivity.kt │ │ └── AndroidManifest.xml ├── proguard-rules.pro └── build.gradle ├── jubako ├── .gitignore ├── src │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── res │ │ │ ├── values │ │ │ │ └── strings.xml │ │ │ └── layout │ │ │ │ └── default_progress.xml │ │ └── java │ │ │ ├── com │ │ │ └── justeat │ │ │ │ └── jubako │ │ │ │ ├── JubakoViewSpec.kt │ │ │ │ ├── data │ │ │ │ ├── EmptyLiveData.kt │ │ │ │ ├── InstantLiveData.kt │ │ │ │ ├── PaginatedDataState.kt │ │ │ │ └── PaginatedLiveData.kt │ │ │ │ ├── JubakoAssembler.kt │ │ │ │ ├── ContentDescriptionProvider.kt │ │ │ │ ├── extensions │ │ │ │ ├── JubakoLoadExtensions.kt │ │ │ │ └── JubakoAssembleExtensions.kt │ │ │ │ ├── SimpleJubakoAssembler.kt │ │ │ │ ├── ContentDescriptionCollection.kt │ │ │ │ ├── ContentDescription.kt │ │ │ │ └── Jubako.kt │ │ │ └── samples │ │ │ └── Samples.kt │ ├── androidTest │ │ ├── AndroidManifest.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── justeat │ │ │ │ └── jubako │ │ │ │ ├── platform │ │ │ │ ├── TestViewHolder.kt │ │ │ │ ├── TestViewHolderFactory.kt │ │ │ │ ├── TestConditionalContentAssembler.kt │ │ │ │ ├── TestContentDescriptionProvider.kt │ │ │ │ ├── TestJubakoActivity.kt │ │ │ │ ├── TestContentAssembler.kt │ │ │ │ └── RobustnessTestJubakoActivity.kt │ │ │ │ ├── util │ │ │ │ ├── IntentLauncher.java │ │ │ │ └── RecyclerViewExt.java │ │ │ │ ├── JubakoTests.kt │ │ │ │ ├── JubakoRobustnessTests.kt │ │ │ │ ├── steps │ │ │ │ └── JubakoSteps.kt │ │ │ │ └── screen │ │ │ │ └── JubakoScreen.kt │ │ └── res │ │ │ └── layout │ │ │ ├── item_simple.xml │ │ │ ├── activity_test_jubako.xml │ │ │ └── activity_test_robustness_jubakoi.xml │ └── test │ │ └── java │ │ └── com │ │ └── justeat │ │ └── jubako │ │ ├── SimpleJubakoAssemblerTest.kt │ │ ├── ContentDescriptionCollectionTest.kt │ │ ├── ContentDescriptionTest.kt │ │ ├── data │ │ └── PaginatedLiveDataTest.kt │ │ ├── PaginatedContentLoadingStrategyTest.kt │ │ └── JubakoTest.kt ├── proguard-rules.pro └── build.gradle ├── jubako-recyclerviews ├── .gitignore ├── consumer-rules.pro ├── src │ ├── main │ │ ├── res │ │ │ └── values │ │ │ │ └── strings.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── com │ │ │ └── justeat │ │ │ └── jubako │ │ │ └── recyclerviews │ │ │ ├── JubakoExtensions.kt │ │ │ ├── util │ │ │ ├── IJubakoScreenFiller.kt │ │ │ └── JubakoScreenFiller.kt │ │ │ ├── addHolder.kt │ │ │ ├── adapters │ │ │ ├── ProgressView.kt │ │ │ ├── ContentAdapterContentDescriptionCollectionListener.kt │ │ │ ├── DefaultProgressViewHolder.kt │ │ │ ├── StaticDataAdapter.kt │ │ │ ├── PaginatedDataAdapter.kt │ │ │ ├── JubakoRecyclerViewHolder.kt │ │ │ └── JubakoAdapter.kt │ │ │ ├── ContentLoadingStrategy.kt │ │ │ ├── widgets │ │ │ ├── JubakoCarouselRecyclerView.kt │ │ │ └── JubakoRecyclerView.kt │ │ │ ├── JubakoRecyclerViewExtensions.kt │ │ │ ├── JubakoViewHolder.kt │ │ │ └── JubakoViewContent.kt │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── justeat │ │ │ └── jubako │ │ │ └── recyclerviews │ │ │ └── ExampleUnitTest.kt │ └── androidTest │ │ └── java │ │ └── com │ │ └── justeat │ │ └── jubako │ │ └── recyclerviews │ │ └── ExampleInstrumentedTest.kt ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── gfx ├── jubako_logo.png ├── jubako_movies.png ├── jubako_logo.afdesign └── jubako_icon.svg ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── LICENSE ├── gradle.properties ├── gradlew.bat └── gradlew /jubako-sample/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /jubako/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | .idea 3 | -------------------------------------------------------------------------------- /jubako-recyclerviews/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /jubako-recyclerviews/consumer-rules.pro: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /jubako/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':jubako-sample', ':jubako', ':jubako-recyclerviews' 2 | -------------------------------------------------------------------------------- /gfx/jubako_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justeat/jubako/HEAD/gfx/jubako_logo.png -------------------------------------------------------------------------------- /gfx/jubako_movies.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justeat/jubako/HEAD/gfx/jubako_movies.png -------------------------------------------------------------------------------- /gfx/jubako_logo.afdesign: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justeat/jubako/HEAD/gfx/jubako_logo.afdesign -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justeat/jubako/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /jubako/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Jubako 3 | 4 | -------------------------------------------------------------------------------- /jubako/src/main/java/com/justeat/jubako/JubakoViewSpec.kt: -------------------------------------------------------------------------------- 1 | package com.justeat.jubako 2 | 3 | interface JubakoViewSpec 4 | -------------------------------------------------------------------------------- /jubako-recyclerviews/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Jubako RecyclerViews 3 | 4 | -------------------------------------------------------------------------------- /jubako-sample/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justeat/jubako/HEAD/jubako-sample/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /jubako-sample/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justeat/jubako/HEAD/jubako-sample/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /jubako-sample/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justeat/jubako/HEAD/jubako-sample/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /jubako-sample/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justeat/jubako/HEAD/jubako-sample/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /jubako-sample/src/main/assets/1/4d-Man-03-movie-poster.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justeat/jubako/HEAD/jubako-sample/src/main/assets/1/4d-Man-03-movie-poster.webp -------------------------------------------------------------------------------- /jubako-sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justeat/jubako/HEAD/jubako-sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /jubako-sample/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justeat/jubako/HEAD/jubako-sample/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /jubako-sample/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justeat/jubako/HEAD/jubako-sample/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /jubako-sample/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justeat/jubako/HEAD/jubako-sample/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /jubako-recyclerviews/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /jubako-sample/src/main/assets/1/3-stooges-1941-movie-poster.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justeat/jubako/HEAD/jubako-sample/src/main/assets/1/3-stooges-1941-movie-poster.webp -------------------------------------------------------------------------------- /jubako-sample/src/main/assets/2/13-Ghosts-01-movie-poster.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justeat/jubako/HEAD/jubako-sample/src/main/assets/2/13-Ghosts-01-movie-poster.webp -------------------------------------------------------------------------------- /jubako-sample/src/main/assets/2/Ace-High-01-0-movie-poster.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justeat/jubako/HEAD/jubako-sample/src/main/assets/2/Ace-High-01-0-movie-poster.webp -------------------------------------------------------------------------------- /jubako-sample/src/main/assets/3/5-Man-Army-01-movie-poster.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justeat/jubako/HEAD/jubako-sample/src/main/assets/3/5-Man-Army-01-movie-poster.webp -------------------------------------------------------------------------------- /jubako-sample/src/main/assets/3/7-Man-Army-01-movie-poster.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justeat/jubako/HEAD/jubako-sample/src/main/assets/3/7-Man-Army-01-movie-poster.webp -------------------------------------------------------------------------------- /jubako-sample/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justeat/jubako/HEAD/jubako-sample/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /jubako-sample/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justeat/jubako/HEAD/jubako-sample/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /jubako-sample/src/main/assets/3/10-To-Midnight-01-movie-poster.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justeat/jubako/HEAD/jubako-sample/src/main/assets/3/10-To-Midnight-01-movie-poster.webp -------------------------------------------------------------------------------- /jubako-sample/src/main/assets/3/7th-Commandment-01-movie-poster.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justeat/jubako/HEAD/jubako-sample/src/main/assets/3/7th-Commandment-01-movie-poster.webp -------------------------------------------------------------------------------- /jubako-sample/src/main/assets/1/5-Element-Kung-Fu-01-movie-poster.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justeat/jubako/HEAD/jubako-sample/src/main/assets/1/5-Element-Kung-Fu-01-movie-poster.webp -------------------------------------------------------------------------------- /jubako-sample/src/main/assets/1/5-Fingers-Of-Death-01-movie-poster.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justeat/jubako/HEAD/jubako-sample/src/main/assets/1/5-Fingers-Of-Death-01-movie-poster.webp -------------------------------------------------------------------------------- /jubako-sample/src/main/assets/1/5-Fingers-Of-Death-02-movie-poster.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justeat/jubako/HEAD/jubako-sample/src/main/assets/1/5-Fingers-Of-Death-02-movie-poster.webp -------------------------------------------------------------------------------- /jubako-sample/src/main/assets/2/13-rue-madeleine-1946-movie-poster.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justeat/jubako/HEAD/jubako-sample/src/main/assets/2/13-rue-madeleine-1946-movie-poster.webp -------------------------------------------------------------------------------- /jubako-sample/src/main/assets/3/7-Faces-Of-Dr-Lao-01-movie-poster.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justeat/jubako/HEAD/jubako-sample/src/main/assets/3/7-Faces-Of-Dr-Lao-01-movie-poster.webp -------------------------------------------------------------------------------- /jubako/src/main/java/com/justeat/jubako/data/EmptyLiveData.kt: -------------------------------------------------------------------------------- 1 | package com.justeat.jubako.data 2 | 3 | import androidx.lifecycle.LiveData 4 | 5 | class EmptyLiveData : LiveData() 6 | -------------------------------------------------------------------------------- /jubako-sample/src/main/assets/2/18-Weapons-Of-Kung-Fu-01-movie-poster.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justeat/jubako/HEAD/jubako-sample/src/main/assets/2/18-Weapons-Of-Kung-Fu-01-movie-poster.webp -------------------------------------------------------------------------------- /jubako-sample/src/main/assets/3/13-Frightened-Girls-01-movie-poster.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justeat/jubako/HEAD/jubako-sample/src/main/assets/3/13-Frightened-Girls-01-movie-poster.webp -------------------------------------------------------------------------------- /jubako-sample/src/main/assets/1/3stooges-movie-maniacs-1935-movie-poster.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justeat/jubako/HEAD/jubako-sample/src/main/assets/1/3stooges-movie-maniacs-1935-movie-poster.webp -------------------------------------------------------------------------------- /jubako-sample/src/main/assets/2/20-Million-Miles-To-Earth-01-movie-poster.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justeat/jubako/HEAD/jubako-sample/src/main/assets/2/20-Million-Miles-To-Earth-01-movie-poster.webp -------------------------------------------------------------------------------- /jubako-sample/src/main/res/layout/grid_cell.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /jubako-sample/src/main/assets/2/abbott-and-costello-meet-frankenstein-1948-movie-poster.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justeat/jubako/HEAD/jubako-sample/src/main/assets/2/abbott-and-costello-meet-frankenstein-1948-movie-poster.webp -------------------------------------------------------------------------------- /jubako/src/main/java/com/justeat/jubako/JubakoAssembler.kt: -------------------------------------------------------------------------------- 1 | package com.justeat.jubako 2 | 3 | interface JubakoAssembler { 4 | suspend fun assemble(): List> 5 | fun hasMore(): Boolean = false 6 | } -------------------------------------------------------------------------------- /jubako-recyclerviews/src/main/java/com/justeat/jubako/recyclerviews/JubakoExtensions.kt: -------------------------------------------------------------------------------- 1 | package com.justeat.jubako.recyclerviews 2 | 3 | fun pageSize(pageSize: Int) = com.justeat.jubako.recyclerviews.adapters.PaginatedContentLoadingStrategy(pageSize) 4 | -------------------------------------------------------------------------------- /jubako-sample/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #008577 4 | #00574B 5 | #D81B60 6 | 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | .idea 15 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sun Jun 23 00:09:16 BST 2019 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip 7 | -------------------------------------------------------------------------------- /jubako/src/main/java/com/justeat/jubako/data/InstantLiveData.kt: -------------------------------------------------------------------------------- 1 | package com.justeat.jubako.data 2 | 3 | import androidx.lifecycle.LiveData 4 | 5 | class InstantLiveData(private val data: DATA) : LiveData() { 6 | override fun onActive() { 7 | postValue(data) 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /jubako-sample/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /jubako-sample/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /jubako-sample/src/main/res/drawable/movie_hero_nav_gradient.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 8 | -------------------------------------------------------------------------------- /jubako-sample/src/main/res/drawable/ic_add.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /jubako-sample/src/main/res/layout/simple_carousel.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /jubako-sample/src/main/res/drawable/ic_play_arrow.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /jubako-sample/src/main/res/drawable/ic_info.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /jubako-sample/src/main/res/drawable/movie_hero_gradient.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 10 | -------------------------------------------------------------------------------- /jubako/src/main/java/samples/Samples.kt: -------------------------------------------------------------------------------- 1 | import com.justeat.jubako.data.PaginatedLiveData 2 | import kotlinx.coroutines.delay 3 | 4 | internal object Samples { 5 | internal fun samplePaginatedLiveData() { 6 | PaginatedLiveData { 7 | hasMore = { loaded.size < 100 } 8 | nextPage = { 9 | delay(100) 10 | listOf("Hello") 11 | } 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /jubako/src/androidTest/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /jubako-recyclerviews/src/main/java/com/justeat/jubako/recyclerviews/util/IJubakoScreenFiller.kt: -------------------------------------------------------------------------------- 1 | package com.justeat.jubako.recyclerviews.util 2 | 3 | import androidx.recyclerview.widget.RecyclerView 4 | 5 | interface IJubakoScreenFiller { 6 | fun attach(recyclerView: RecyclerView) 7 | 8 | companion object { 9 | val NOOP = object: IJubakoScreenFiller { 10 | override fun attach(recyclerView: RecyclerView) {} 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /jubako-recyclerviews/src/test/java/com/justeat/jubako/recyclerviews/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package com.justeat.jubako.recyclerviews 2 | 3 | import org.junit.Test 4 | 5 | import org.junit.Assert.* 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * See [testing documentation](http://d.android.com/tools/testing). 11 | */ 12 | class ExampleUnitTest { 13 | @Test 14 | fun addition_isCorrect() { 15 | assertEquals(4, 2 + 2) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /jubako-recyclerviews/src/main/java/com/justeat/jubako/recyclerviews/addHolder.kt: -------------------------------------------------------------------------------- 1 | package com.justeat.jubako.recyclerviews 2 | 3 | import com.justeat.jubako.ContentDescription 4 | import com.justeat.jubako.descriptionProvider 5 | import com.justeat.jubako.extensions.JubakoMutableList 6 | import com.justeat.jubako.extensions.add 7 | 8 | fun JubakoMutableList.addHolder(delegate: () -> JubakoViewHolder) { 9 | add(descriptionProvider { 10 | ContentDescription( 11 | viewSpec = viewHolderFactory { delegate.invoke() }) 12 | }) 13 | } 14 | -------------------------------------------------------------------------------- /jubako/src/main/java/com/justeat/jubako/ContentDescriptionProvider.kt: -------------------------------------------------------------------------------- 1 | package com.justeat.jubako 2 | 3 | /** 4 | * Produces an instances of [ContentDescription] 5 | */ 6 | interface ContentDescriptionProvider { 7 | fun createDescription(): ContentDescription 8 | } 9 | 10 | /** 11 | * Simple way to construct a [ContentDescriptionProvider] 12 | */ 13 | fun descriptionProvider(delegate: () -> ContentDescription): ContentDescriptionProvider { 14 | return object : ContentDescriptionProvider { 15 | override fun createDescription() = delegate() 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /jubako/src/main/java/com/justeat/jubako/data/PaginatedDataState.kt: -------------------------------------------------------------------------------- 1 | package com.justeat.jubako.data 2 | 3 | data class PaginatedDataState( 4 | var loaded: List, 5 | var page: List, 6 | var loading: Boolean = false, 7 | var error: Throwable? = null, 8 | var accepted: Boolean = false 9 | ) { 10 | fun accept(): Boolean { 11 | if (!accepted) { 12 | accepted = true 13 | return true 14 | } 15 | return false 16 | } 17 | } 18 | 19 | fun PaginatedDataState<*>?.ready(): Boolean { 20 | return this != null && !loading && error == null 21 | } 22 | -------------------------------------------------------------------------------- /jubako/src/androidTest/java/com/justeat/jubako/platform/TestViewHolder.kt: -------------------------------------------------------------------------------- 1 | package com.justeat.jubako.platform 2 | 3 | import android.view.View 4 | import android.widget.TextView 5 | import com.justeat.jubako.recyclerviews.JubakoViewHolder 6 | import com.justeat.jubako.test.R 7 | 8 | class TestViewHolder(view: View) : com.justeat.jubako.recyclerviews.JubakoViewHolder(view) { 9 | override fun bind(data: String?) { 10 | itemView.findViewById(R.id.itemText).apply { 11 | text = data 12 | setOnClickListener { 13 | reload() 14 | } 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2019 JUST EAT Holding Limited 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | 15 | -------------------------------------------------------------------------------- /jubako-sample/src/main/res/layout/grid_fill_progress.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 11 | 12 | 17 | -------------------------------------------------------------------------------- /jubako-sample/src/main/res/layout/carousel_item_movie.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 16 | -------------------------------------------------------------------------------- /jubako/src/androidTest/java/com/justeat/jubako/platform/TestViewHolderFactory.kt: -------------------------------------------------------------------------------- 1 | package com.justeat.jubako.platform 2 | 3 | import android.view.LayoutInflater 4 | import android.view.ViewGroup 5 | import com.justeat.jubako.recyclerviews.adapters.JubakoAdapter 6 | import com.justeat.jubako.recyclerviews.JubakoViewHolder 7 | import com.justeat.jubako.test.R 8 | 9 | class TestViewHolderFactory : com.justeat.jubako.recyclerviews.adapters.JubakoAdapter.HolderFactory { 10 | override fun createViewHolder(parent: ViewGroup): com.justeat.jubako.recyclerviews.JubakoViewHolder { 11 | val view = LayoutInflater.from(parent.context).inflate(R.layout.item_simple, parent, false) 12 | return TestViewHolder(view) 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /jubako-sample/src/main/res/layout/simple_carousel_item_text.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 18 | -------------------------------------------------------------------------------- /jubako-recyclerviews/src/main/java/com/justeat/jubako/recyclerviews/adapters/ProgressView.kt: -------------------------------------------------------------------------------- 1 | package com.justeat.jubako.recyclerviews.adapters 2 | 3 | /** 4 | * When providing a custom progress [RecyclerView.ViewHolder] they 5 | * must implement this interface so Jubako can communicate state to your view holder 6 | */ 7 | interface ProgressView { 8 | /** 9 | * WHen called you should show a progress indicator 10 | */ 11 | fun onProgress() 12 | 13 | /** 14 | * When called you should show an error button or similar 15 | */ 16 | fun onError(error: Throwable) 17 | 18 | /** 19 | * Gives you a callback that you can invoke with `retry.invoke()` when you 20 | * want to try loading again 21 | */ 22 | fun setRetryCallback(retry: () -> Unit) 23 | } 24 | -------------------------------------------------------------------------------- /jubako-sample/src/main/res/layout/simple_item_text.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 19 | -------------------------------------------------------------------------------- /jubako-sample/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /jubako/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /jubako/src/androidTest/res/layout/item_simple.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 18 | -------------------------------------------------------------------------------- /jubako/src/main/res/layout/default_progress.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 12 | 13 |