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.jakewharton.retrofit2.adapter.kotlin.coroutines | |
import com.nytimes.android.external.store3.base.DiskRead | |
import com.nytimes.android.external.store3.base.DiskWrite | |
import com.nytimes.android.external.store3.base.Fetcher | |
import com.nytimes.android.external.store3.base.impl.RealStoreBuilder | |
import com.nytimes.android.external.store3.base.impl.Store | |
import com.nytimes.android.external.store3.base.impl.StoreBuilder | |
import com.nytimes.android.sample.data.remote.Persister | |
import com.nytimes.android.sample.data.remote.RefershOnStale |
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 RxPaging { | |
var page = 1 | |
val cache = CacheBuilder.newBuilder().build<Any, Single<List<Single<Int>>>>() | |
@Test | |
fun getPages() { | |
val tab1 = pagedList().blockingGet().iterator() | |
val tab2 = pagedList().blockingGet().iterator() |
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
@Entity | |
data class User( | |
@PrimaryKey(autoGenerate = true) var uid: Int = 0, | |
val name: String, | |
val lastName: String) | |
@Dao | |
interface UserDao { |
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
1. Create a bundle with Android Studio 3.2 alpha 15: Build->Build Bundles/Apks->Build Bundle | |
2. Download Bundle Tool https://github.com/google/bundletool/releases | |
3. Create bundletool.sh with contents: | |
#!/bin/bash | |
java -jar ~/downloads/bundletool.jar "$@" | |
5. Run equivalant of following command (or add to path and run just `bundletool`) | |
./bundletool.sh build-apks --bundle=/Users/mnakhi/projects/high-tops/app/build/outputs/bundle/debug/bundle.aab --output=/Users/mnakhi/projects/high-tops/debug2.apks --ks=PATHTOYOURKEY --ks-key-alias=YOURKEYALIAS |
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
-injars /home/mike/projects/wink-demo-android/library/build/intermediates/classes/release(**.class) | |
-injars /home/mike/projects/wink-demo-android/library/build/intermediates/transforms/mergeJavaRes/release/0.jar(!**.class) | |
-outjars /home/mike/projects/wink-demo-android/library/build/intermediates/transforms/proguard/release/0.jar | |
-libraryjars /home/mike/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.0.aar/0dcc15c5e84912bbd38089bf47f79dc6/jars/classes.jar(**.class) | |
-libraryjars /home/mike/.gradle/caches/transforms-1/files-1.1/recyclerview-v7-27.1.0.aar/2081647001ebfaa8b47970d209d73c43/jars/classes.jar(**.class) | |
-libraryjars /home/mike/.gradle/caches/transforms-1/files-1.1/play-services-ads-11.4.0.aar/ea990ffceac804b4d3cf95eaaa903438/jars/classes.jar(**.class) | |
-libraryjars /home/mike/.gradle/caches/transforms-1/files-1.1/android-database-sqlcipher-3.5.9.aar/4ff610a8024309757b4974af1c7d7607/jars/classes.jar(**.class) | |
-libraryjars /home/mike/.gradle/caches/modules-2/files-2.1/com.google.code.gson/gson/2 |
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
//Main Idea: Rather than declaring subcomponents you declare Scopes which contain modules | |
//Holster is a processor which will generate a subcomponent for each scope and | |
//allows you to get a reference to each component through a generated Locator. | |
//Difference with Dagger Android is that we create the child/parent component | |
//relationship in the scope annotation rather than depending on @ContributesAndroidInjector/HasInjector | |
@MyActivityScope(ActivityModule::class, child=MyViewScope::class) | |
class MyActivity{ | |
@inject aDep:ADep | |
onCreate(){ 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
data class Transition(toAnim:Animation=null, fromAnim:Animation, | |
direction:String=Forward, shouldDispatch=true) | |
sealed class Screen : State() { | |
data class MyScreen(var data: Data, layoutID:Int, transition:Transition) : Screen() | |
data class Ar(var data: Data, layoutID:Int, transition:Transition) : Screen() | |
} | |
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 ScreenModule(){ | |
@Binds | |
@IntoSet | |
Presenter()=LandingPresenter; | |
@Binds | |
@IntoSet | |
Presenter()=SuccessPresenter; | |
} | |
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
dispatcher.backStackEmpty().subscribe { finish() } | |
... | |
override fun onBackPressed() { | |
dispatcher.goBack() | |
} |
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 Dispatcher.goBack() { | |
popLastShowingState()//current state is what we are currently showing | |
dispatchShow(popLastShowingState()) | |
} | |
fun popLastShowingState(): State { | |
if(!showEvents.empty()) Timber.d("popping "+showEvents.peek()) | |
return if (showEvents.isEmpty()) State.BackStackEmpty else showEvents.pop() | |
} |