tasks.register("printR8Version") {
try {
println("R8 version: ${com.android.tools.r8.Version.getVersionString()}")
} catch (ignored: Exception) {
println("R8 version: unknown")
}
}
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
@Module | |
@InstallIn(SingletonComponent::class) | |
internal object DataStoreModule { | |
@Provides | |
@Singleton | |
fun provideMyCacheDataStore( | |
@ApplicationContext context: Context, | |
moshi: Moshi, | |
): DataStore<MyCachedDataClass> { |
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 String.formatIBAN(): String { | |
val iban = replace("\\s+".toRegex(), "").uppercase(Locale.getDefault()) | |
val maxLength = (iban.length * 1.25).roundToInt() | |
val result = StringBuilder(maxLength) | |
iban.forEachIndexed { index, c -> | |
when { | |
index > 0 && index % 4 == 0 -> result.append(" $c") | |
else -> result.append(c) | |
} | |
} |
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 com.squareup.moshi.Moshi | |
import io.reactivex.rxjava3.core.Completable | |
import io.reactivex.rxjava3.core.Flowable | |
import io.reactivex.rxjava3.core.Maybe | |
import io.reactivex.rxjava3.core.Observable | |
import io.reactivex.rxjava3.core.Scheduler | |
import io.reactivex.rxjava3.core.Single | |
import io.reactivex.rxjava3.schedulers.Schedulers | |
import retrofit2.Call | |
import retrofit2.CallAdapter |
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 com.google.android.gms.tasks.Task | |
import io.reactivex.rxjava3.core.Single | |
import java.util.concurrent.CancellationException | |
import java.util.concurrent.TimeUnit | |
fun <T : Any> Task<T>.toSingle(): Single<T> { | |
return if (isComplete) { | |
Single.fromCallable(::asRequired) | |
} else { | |
Single.create<T> { emitter -> |
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
configurations.configureEach { | |
if (this.name.contains("Compile") && !this.name.contains("TestCompile")) { | |
this.incoming.afterResolve { | |
this.resolutionResult.allComponents { | |
if (this.selectionReason.isConflictResolution && | |
this.moduleVersion?.version.let { | |
it != null && isNonStable(it) | |
} | |
) { | |
throw GradleException( |
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 GetLinkPreviewDataInteractorImpl @Inject constructor( | |
private val okHttpClient: OkHttpClient | |
) : GetLinkPreviewDataInteractor { | |
override fun execute(url: String): Single<LinkPreviewData> { | |
return Single.fromCallable { | |
okHttpClient.newCall(Builder().url(url).build()).execute().use { response -> | |
val requestedUrl = response.request.url.toString() | |
Jsoup.parse(response.body!!.string()).let { |
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.content.Context | |
import com.usabilla.sdk.ubform.Usabilla | |
import com.usabilla.sdk.ubform.UsabillaReadyCallback | |
import com.example.app.BuildConfig | |
import javax.inject.Inject | |
class UsabillaControllerImpl @Inject constructor() : UsabillaController, UsabillaReadyCallback { | |
@Inject | |
lateinit var context: Context |
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 buildplugins | |
import org.gradle.api.DefaultTask | |
import org.gradle.api.GradleException | |
import org.gradle.api.Plugin | |
import org.gradle.api.Project | |
import org.gradle.api.model.ObjectFactory | |
import org.gradle.api.plugins.HelpTasksPlugin.HELP_GROUP | |
import org.gradle.api.provider.Property | |
import org.gradle.api.tasks.Input |
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
git branch -m master main | |
git fetch origin | |
git branch -u origin/main main | |
git remote set-head origin -a |
NewerOlder