diff --git a/app/src/main/java/app/tivi/appinitializers/EmojiInitializer.kt b/app/src/main/java/app/tivi/appinitializers/EmojiInitializer.kt index 3abb37bc8e..56f64f7a8a 100644 --- a/app/src/main/java/app/tivi/appinitializers/EmojiInitializer.kt +++ b/app/src/main/java/app/tivi/appinitializers/EmojiInitializer.kt @@ -29,7 +29,8 @@ class EmojiInitializer @Inject constructor() : AppInitializer { "com.google.android.gms.fonts", "com.google.android.gms", "Noto Color Emoji Compat", - R.array.com_google_android_gms_fonts_certs) + R.array.com_google_android_gms_fonts_certs + ) val config = FontRequestEmojiCompatConfig(application, fontRequest) .setReplaceAll(true) diff --git a/app/src/main/java/app/tivi/appinitializers/ThreeTenBpInitializer.kt b/app/src/main/java/app/tivi/appinitializers/ThreeTenBpInitializer.kt index 9c0910aeea..1667bfcaa2 100644 --- a/app/src/main/java/app/tivi/appinitializers/ThreeTenBpInitializer.kt +++ b/app/src/main/java/app/tivi/appinitializers/ThreeTenBpInitializer.kt @@ -19,10 +19,10 @@ package app.tivi.appinitializers import android.app.Application import app.tivi.util.AppCoroutineDispatchers import com.jakewharton.threetenabp.AndroidThreeTen -import javax.inject.Inject import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.launch import org.threeten.bp.zone.ZoneRulesProvider +import javax.inject.Inject class ThreeTenBpInitializer @Inject constructor( private val dispatchers: AppCoroutineDispatchers diff --git a/app/src/main/java/app/tivi/home/HomeActivity.kt b/app/src/main/java/app/tivi/home/HomeActivity.kt index a8e958650d..1bafa4a7ba 100644 --- a/app/src/main/java/app/tivi/home/HomeActivity.kt +++ b/app/src/main/java/app/tivi/home/HomeActivity.kt @@ -29,10 +29,10 @@ import app.tivi.extensions.hideSoftInput import app.tivi.extensions.setupWithNavController import app.tivi.trakt.TraktConstants import com.airbnb.mvrx.viewModel -import javax.inject.Inject import net.openid.appauth.AuthorizationException import net.openid.appauth.AuthorizationResponse import net.openid.appauth.AuthorizationService +import javax.inject.Inject class HomeActivity : TiviActivityMvRxView() { private val authService by lazy(LazyThreadSafetyMode.NONE) { diff --git a/app/src/main/java/app/tivi/home/HomeInject.kt b/app/src/main/java/app/tivi/home/HomeInject.kt index 25a36931ff..d564e35537 100644 --- a/app/src/main/java/app/tivi/home/HomeInject.kt +++ b/app/src/main/java/app/tivi/home/HomeInject.kt @@ -34,17 +34,19 @@ import dagger.android.ContributesAndroidInjector @Module internal abstract class HomeBuilder { - @ContributesAndroidInjector(modules = [ - HomeModule::class, - SearchBuilder::class, - DiscoverBuilder::class, - TrendingBuilder::class, - PopularBuilder::class, - WatchedBuilder::class, - FollowedBuilder::class, - RecommendedBuilder::class, - AccountUiBuilder::class - ]) + @ContributesAndroidInjector( + modules = [ + HomeModule::class, + SearchBuilder::class, + DiscoverBuilder::class, + TrendingBuilder::class, + PopularBuilder::class, + WatchedBuilder::class, + FollowedBuilder::class, + RecommendedBuilder::class, + AccountUiBuilder::class + ] + ) internal abstract fun homeActivity(): HomeActivity } diff --git a/app/src/main/java/app/tivi/inject/AppComponent.kt b/app/src/main/java/app/tivi/inject/AppComponent.kt index 636220df11..7cc351dd76 100644 --- a/app/src/main/java/app/tivi/inject/AppComponent.kt +++ b/app/src/main/java/app/tivi/inject/AppComponent.kt @@ -35,23 +35,25 @@ import dagger.android.support.AndroidSupportInjectionModule import javax.inject.Singleton @Singleton -@Component(modules = [ - AndroidSupportInjectionModule::class, - AppModule::class, - TasksModule::class, - AppAssistedModule::class, - DatabaseModule::class, - DataModule::class, - HomeBuilder::class, - ShowDetailsBuilder::class, - TraktModule::class, - TraktAuthModule::class, - TmdbModule::class, - NetworkModule::class, - ImageLoadingModule::class, - EpoxyModule::class, - SettingsPreferenceFragmentBuilder::class -]) +@Component( + modules = [ + AndroidSupportInjectionModule::class, + AppModule::class, + TasksModule::class, + AppAssistedModule::class, + DatabaseModule::class, + DataModule::class, + HomeBuilder::class, + ShowDetailsBuilder::class, + TraktModule::class, + TraktAuthModule::class, + TmdbModule::class, + NetworkModule::class, + ImageLoadingModule::class, + EpoxyModule::class, + SettingsPreferenceFragmentBuilder::class + ] +) interface AppComponent : AndroidInjector { @Component.Factory interface Factory { diff --git a/app/src/main/java/app/tivi/inject/AppModule.kt b/app/src/main/java/app/tivi/inject/AppModule.kt index fa62b63f9b..49a7d36e3d 100644 --- a/app/src/main/java/app/tivi/inject/AppModule.kt +++ b/app/src/main/java/app/tivi/inject/AppModule.kt @@ -19,7 +19,6 @@ package app.tivi.inject import android.content.Context import android.content.SharedPreferences import android.os.Build -import android.text.format.DateFormat as AndroidDateFormat import androidx.lifecycle.ProcessLifecycleOwner import androidx.lifecycle.coroutineScope import androidx.navigation.ui.AppBarConfiguration @@ -33,16 +32,17 @@ import com.google.firebase.crashlytics.FirebaseCrashlytics import dagger.Module import dagger.Provides import io.reactivex.disposables.CompositeDisposable +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers +import org.threeten.bp.ZoneId +import org.threeten.bp.format.DateTimeFormatter import java.io.File import java.text.SimpleDateFormat import java.util.concurrent.Executor import java.util.concurrent.Executors import javax.inject.Named import javax.inject.Singleton -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.Dispatchers -import org.threeten.bp.ZoneId -import org.threeten.bp.format.DateTimeFormatter +import android.text.format.DateFormat as AndroidDateFormat @Module(includes = [AppModuleBinds::class]) class AppModule { diff --git a/app/src/main/java/app/tivi/inject/NetworkModule.kt b/app/src/main/java/app/tivi/inject/NetworkModule.kt index 6671ac2d65..7026ca6b42 100644 --- a/app/src/main/java/app/tivi/inject/NetworkModule.kt +++ b/app/src/main/java/app/tivi/inject/NetworkModule.kt @@ -20,15 +20,15 @@ import android.content.Context import app.tivi.BuildConfig import dagger.Module import dagger.Provides -import java.io.File -import java.util.concurrent.TimeUnit -import javax.inject.Singleton import okhttp3.Cache import okhttp3.ConnectionPool import okhttp3.Dispatcher import okhttp3.OkHttpClient import okhttp3.logging.HttpLoggingInterceptor import okhttp3.logging.LoggingEventListener +import java.io.File +import java.util.concurrent.TimeUnit +import javax.inject.Singleton @Module class NetworkModule { @@ -75,10 +75,12 @@ class NetworkModule { // Adjust the Connection pool to account for historical use of 3 separate clients // but reduce the keepAlive to 2 minutes to avoid keeping radio open. .connectionPool(ConnectionPool(10, 2, TimeUnit.MINUTES)) - .dispatcher(Dispatcher().apply { - // Allow for high number of concurrent image fetches on same host. - maxRequestsPerHost = 15 - }) + .dispatcher( + Dispatcher().apply { + // Allow for high number of concurrent image fetches on same host. + maxRequestsPerHost = 15 + } + ) .build() } } diff --git a/app/src/main/java/app/tivi/settings/SettingsPreferenceFragment.kt b/app/src/main/java/app/tivi/settings/SettingsPreferenceFragment.kt index 0d74d98dd9..d396c4f8d9 100644 --- a/app/src/main/java/app/tivi/settings/SettingsPreferenceFragment.kt +++ b/app/src/main/java/app/tivi/settings/SettingsPreferenceFragment.kt @@ -35,9 +35,9 @@ import dagger.android.AndroidInjector import dagger.android.DispatchingAndroidInjector import dagger.android.HasAndroidInjector import dagger.android.support.AndroidSupportInjection -import javax.inject.Inject import kotlinx.coroutines.CancellationException import kotlinx.coroutines.flow.collect +import javax.inject.Inject internal class SettingsPreferenceFragment : PreferenceFragmentCompat(), HasAndroidInjector { @Inject lateinit var androidInjector: DispatchingAndroidInjector @@ -85,8 +85,10 @@ internal class SettingsPreferenceFragment : PreferenceFragmentCompat(), HasAndro } findPreference("version")?.apply { - summary = getString(R.string.settings_app_version_summary, - BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE) + summary = getString( + R.string.settings_app_version_summary, + BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE + ) } } } diff --git a/app/src/main/java/app/tivi/showdetails/ShowDetailsActivity.kt b/app/src/main/java/app/tivi/showdetails/ShowDetailsActivity.kt index 7c728ca8a4..d7221065ca 100644 --- a/app/src/main/java/app/tivi/showdetails/ShowDetailsActivity.kt +++ b/app/src/main/java/app/tivi/showdetails/ShowDetailsActivity.kt @@ -49,8 +49,10 @@ class ShowDetailsActivity : TiviActivity() { override fun handleIntent(intent: Intent) { supportFragmentManager.commit { - replace(R.id.details_content, - NavHostFragment.create(R.navigation.show_details_nav_graph, intent.extras)) + replace( + R.id.details_content, + NavHostFragment.create(R.navigation.show_details_nav_graph, intent.extras) + ) } } } diff --git a/app/src/main/java/app/tivi/showdetails/ShowDetailsBuilder.kt b/app/src/main/java/app/tivi/showdetails/ShowDetailsBuilder.kt index 0f332499bf..790bdfccb9 100644 --- a/app/src/main/java/app/tivi/showdetails/ShowDetailsBuilder.kt +++ b/app/src/main/java/app/tivi/showdetails/ShowDetailsBuilder.kt @@ -23,10 +23,12 @@ import dagger.android.ContributesAndroidInjector @Module internal abstract class ShowDetailsBuilder { - @ContributesAndroidInjector(modules = [ - ShowDetailsModule::class, - ShowDetailsFragmentBuilder::class, - EpisodeDetailsFragmentBuilder::class - ]) + @ContributesAndroidInjector( + modules = [ + ShowDetailsModule::class, + ShowDetailsFragmentBuilder::class, + EpisodeDetailsFragmentBuilder::class + ] + ) internal abstract fun bindDetailsActivity(): ShowDetailsActivity } diff --git a/app/src/main/java/app/tivi/util/AndroidPowerController.kt b/app/src/main/java/app/tivi/util/AndroidPowerController.kt index 2cc01ff17c..53fc3923b1 100644 --- a/app/src/main/java/app/tivi/util/AndroidPowerController.kt +++ b/app/src/main/java/app/tivi/util/AndroidPowerController.kt @@ -24,12 +24,12 @@ import android.os.PowerManager import androidx.annotation.RequiresApi import androidx.core.content.getSystemService import app.tivi.settings.TiviPreferences -import javax.inject.Inject -import javax.inject.Singleton import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.merge import kotlinx.coroutines.flow.onStart +import javax.inject.Inject +import javax.inject.Singleton @Singleton internal class AndroidPowerController @Inject constructor( diff --git a/base-android/src/main/java/app/tivi/extensions/datetime.kt b/base-android/src/main/java/app/tivi/extensions/datetime.kt index 1d2395a999..4cff17ee8e 100644 --- a/base-android/src/main/java/app/tivi/extensions/datetime.kt +++ b/base-android/src/main/java/app/tivi/extensions/datetime.kt @@ -16,8 +16,8 @@ package app.tivi.extensions -import java.text.SimpleDateFormat import org.threeten.bp.format.DateTimeFormatter +import java.text.SimpleDateFormat fun SimpleDateFormat.toThreeTenDateTimeFormatter(): DateTimeFormatter { return DateTimeFormatter.ofPattern(toPattern()) diff --git a/base-android/src/main/java/app/tivi/util/TiviDateFormatter.kt b/base-android/src/main/java/app/tivi/util/TiviDateFormatter.kt index 9b06ca7588..7ecce76243 100644 --- a/base-android/src/main/java/app/tivi/util/TiviDateFormatter.kt +++ b/base-android/src/main/java/app/tivi/util/TiviDateFormatter.kt @@ -21,12 +21,12 @@ import app.tivi.inject.MediumDate import app.tivi.inject.MediumDateTime import app.tivi.inject.ShortDate import app.tivi.inject.ShortTime -import javax.inject.Inject -import javax.inject.Singleton import org.threeten.bp.LocalTime import org.threeten.bp.OffsetDateTime import org.threeten.bp.format.DateTimeFormatter import org.threeten.bp.temporal.Temporal +import javax.inject.Inject +import javax.inject.Singleton @Singleton class TiviDateFormatter @Inject constructor( @@ -53,7 +53,8 @@ class TiviDateFormatter @Inject constructor( dateTime.toInstant().toEpochMilli(), System.currentTimeMillis(), DateUtils.MINUTE_IN_MILLIS, - DateUtils.FORMAT_SHOW_DATE).toString() + DateUtils.FORMAT_SHOW_DATE + ).toString() } else { // More than 7 days ago formatShortDate(dateTime) @@ -65,7 +66,8 @@ class TiviDateFormatter @Inject constructor( dateTime.toInstant().toEpochMilli(), System.currentTimeMillis(), DateUtils.MINUTE_IN_MILLIS, - DateUtils.FORMAT_SHOW_DATE).toString() + DateUtils.FORMAT_SHOW_DATE + ).toString() } else { // In the far future formatShortDate(dateTime) diff --git a/base-android/src/main/java/app/tivi/util/TiviLogger.kt b/base-android/src/main/java/app/tivi/util/TiviLogger.kt index 917d8a7eb4..595f63a7a5 100644 --- a/base-android/src/main/java/app/tivi/util/TiviLogger.kt +++ b/base-android/src/main/java/app/tivi/util/TiviLogger.kt @@ -19,9 +19,9 @@ package app.tivi.util import android.os.Build import android.util.Log import com.google.firebase.crashlytics.FirebaseCrashlytics +import timber.log.Timber import java.util.regex.Pattern import javax.inject.Inject -import timber.log.Timber class TiviLogger @Inject constructor( private val firebaseCrashlytics: FirebaseCrashlytics diff --git a/base/src/main/java/app/tivi/extensions/CoroutineExtensions.kt b/base/src/main/java/app/tivi/extensions/CoroutineExtensions.kt index 145372e7fc..227e5ca5b6 100644 --- a/base/src/main/java/app/tivi/extensions/CoroutineExtensions.kt +++ b/base/src/main/java/app/tivi/extensions/CoroutineExtensions.kt @@ -16,8 +16,6 @@ package app.tivi.extensions -import java.util.concurrent.ConcurrentHashMap -import java.util.concurrent.atomic.AtomicBoolean import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Deferred import kotlinx.coroutines.Job @@ -33,6 +31,8 @@ import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.map import kotlinx.coroutines.launch import kotlinx.coroutines.supervisorScope +import java.util.concurrent.ConcurrentHashMap +import java.util.concurrent.atomic.AtomicBoolean suspend fun Collection.parallelMap( concurrency: Int = defaultConcurrency, diff --git a/base/src/main/java/app/tivi/extensions/RetrofitExtensions.kt b/base/src/main/java/app/tivi/extensions/RetrofitExtensions.kt index ff3c5a2120..22752d8100 100644 --- a/base/src/main/java/app/tivi/extensions/RetrofitExtensions.kt +++ b/base/src/main/java/app/tivi/extensions/RetrofitExtensions.kt @@ -21,11 +21,11 @@ package app.tivi.extensions import app.tivi.data.entities.ErrorResult import app.tivi.data.entities.Result import app.tivi.data.entities.Success -import java.io.IOException import kotlinx.coroutines.delay import retrofit2.Call import retrofit2.HttpException import retrofit2.Response +import java.io.IOException inline fun Response.bodyOrThrow(): T { if (!isSuccessful) throw HttpException(this) diff --git a/build.gradle b/build.gradle index 9bc1c862e2..b9bd50b491 100644 --- a/build.gradle +++ b/build.gradle @@ -81,8 +81,6 @@ subprojects { targetExclude('bin/**/*.kt') ktlint(Versions.ktlint) - // Disable paren-spacing rule for NonParenthesizedAnnotationsOnFunctionalTypes - .userData(["disabled_rules": "paren-spacing"]) licenseHeaderFile rootProject.file('spotless/copyright.kt') } } diff --git a/buildSrc/src/main/java/app/tivi/buildsrc/dependencies.kt b/buildSrc/src/main/java/app/tivi/buildsrc/dependencies.kt index 9f634f2723..e55e9b8468 100644 --- a/buildSrc/src/main/java/app/tivi/buildsrc/dependencies.kt +++ b/buildSrc/src/main/java/app/tivi/buildsrc/dependencies.kt @@ -17,7 +17,7 @@ package app.tivi.buildsrc object Versions { - const val ktlint = "0.36.0" + const val ktlint = "0.37.0" } object Libs { diff --git a/common-entrygrid/src/main/java/app/tivi/util/EntryGridFragment.kt b/common-entrygrid/src/main/java/app/tivi/util/EntryGridFragment.kt index 7132d94c81..03952f6250 100644 --- a/common-entrygrid/src/main/java/app/tivi/util/EntryGridFragment.kt +++ b/common-entrygrid/src/main/java/app/tivi/util/EntryGridFragment.kt @@ -41,8 +41,8 @@ import app.tivi.ui.SpacingItemDecorator import app.tivi.ui.transitions.GridToGridTransitioner import com.airbnb.mvrx.withState import com.google.android.material.snackbar.Snackbar -import javax.inject.Inject import kotlinx.coroutines.flow.collect +import javax.inject.Inject @SuppressLint("ValidFragment") abstract class EntryGridFragment : TiviFragmentWithBinding() @@ -87,8 +87,10 @@ abstract class EntryGridFragment : TiviFragmentWithBinding : TiviFragmentWithBinding diff --git a/common-imageloading/src/main/java/app/tivi/common/imageloading/ImageLoadingBindingAdapters.kt b/common-imageloading/src/main/java/app/tivi/common/imageloading/ImageLoadingBindingAdapters.kt index 64e4a7fa7f..579a84287b 100644 --- a/common-imageloading/src/main/java/app/tivi/common/imageloading/ImageLoadingBindingAdapters.kt +++ b/common-imageloading/src/main/java/app/tivi/common/imageloading/ImageLoadingBindingAdapters.kt @@ -89,7 +89,8 @@ fun ImageView.loadImage( ) { if (oldImage == image && oldSaturateOnLoad == saturateOnLoad && - oldCornerRadius == cornerRadius) return + oldCornerRadius == cornerRadius + ) return loadAny(image) { transition(SaturatingTransformation()) diff --git a/common-imageloading/src/main/java/app/tivi/common/imageloading/SaturatingTransformation.kt b/common-imageloading/src/main/java/app/tivi/common/imageloading/SaturatingTransformation.kt index bd8bbfec73..1be4f06a8b 100644 --- a/common-imageloading/src/main/java/app/tivi/common/imageloading/SaturatingTransformation.kt +++ b/common-imageloading/src/main/java/app/tivi/common/imageloading/SaturatingTransformation.kt @@ -51,8 +51,10 @@ class SaturatingTransformation( suspendCancellableCoroutine { continuation -> when (result) { is SuccessResult -> { - val animator = saturateDrawableAnimator(result.drawable, - durationMillis, target.view) + val animator = saturateDrawableAnimator( + result.drawable, + durationMillis, target.view + ) animator.doOnEnd { continuation.resume(Unit) { animator.cancel() } } diff --git a/common-imageloading/src/main/java/app/tivi/common/imageloading/TmdbImageEntityCoilMapper.kt b/common-imageloading/src/main/java/app/tivi/common/imageloading/TmdbImageEntityCoilMapper.kt index a4aeb5755a..459549607e 100644 --- a/common-imageloading/src/main/java/app/tivi/common/imageloading/TmdbImageEntityCoilMapper.kt +++ b/common-imageloading/src/main/java/app/tivi/common/imageloading/TmdbImageEntityCoilMapper.kt @@ -24,10 +24,10 @@ import app.tivi.util.SaveData import coil.map.MeasuredMapper import coil.size.PixelSize import coil.size.Size -import javax.inject.Inject -import javax.inject.Provider import okhttp3.HttpUrl import okhttp3.HttpUrl.Companion.toHttpUrl +import javax.inject.Inject +import javax.inject.Provider class TmdbImageEntityCoilMapper @Inject constructor( private val tmdbImageUrlProvider: Provider, diff --git a/common-ui-compose/src/main/java/app/tivi/common/compose/PopupMenu.kt b/common-ui-compose/src/main/java/app/tivi/common/compose/PopupMenu.kt index bcf3c200b5..7d4faa2235 100644 --- a/common-ui-compose/src/main/java/app/tivi/common/compose/PopupMenu.kt +++ b/common-ui-compose/src/main/java/app/tivi/common/compose/PopupMenu.kt @@ -71,12 +71,12 @@ fun PopupMenu( text = item.title, style = MaterialTheme.typography.body1, modifier = Modifier.clickable( - onClick = { - item.onClick?.invoke() - visible.value = false - }, - enabled = item.enabled - ) + onClick = { + item.onClick?.invoke() + visible.value = false + }, + enabled = item.enabled + ) .padding(16.dp) ) } diff --git a/common-ui-compose/src/main/java/app/tivi/common/compose/swipedismiss.kt b/common-ui-compose/src/main/java/app/tivi/common/compose/swipedismiss.kt index df8eb1539d..366ec50304 100644 --- a/common-ui-compose/src/main/java/app/tivi/common/compose/swipedismiss.kt +++ b/common-ui-compose/src/main/java/app/tivi/common/compose/swipedismiss.kt @@ -48,8 +48,8 @@ fun SwipeToDismiss( onSwipeComplete: (SwipeDirection) -> Unit, swipeDirections: List = defaultDirections, swipeCompletePercentage: Float = 0.6f, - backgroundChildren: @Composable() (swipeProgress: Float, wouldCompleteOnRelease: Boolean) -> Unit, - swipeChildren: @Composable() (swipeProgress: Float, wouldCompleteOnRelease: Boolean) -> Unit + backgroundChildren: @Composable (swipeProgress: Float, wouldCompleteOnRelease: Boolean) -> Unit, + swipeChildren: @Composable (swipeProgress: Float, wouldCompleteOnRelease: Boolean) -> Unit ) = Stack { val position = animatedFloat(initVal = 0f).apply { setBounds(0f, 0f) } var progress by state { 0f } @@ -60,19 +60,23 @@ fun SwipeToDismiss( WithConstraints { // Update the drag bounds depending on the size - if (START in swipeDirections && END in swipeDirections) { - position.setBounds(-constraints.maxWidth.toFloat(), constraints.maxWidth.toFloat()) - } else if (START in swipeDirections && layoutDirection == LayoutDirection.Ltr || - END in swipeDirections && layoutDirection == LayoutDirection.Rtl) { - position.setBounds(-constraints.maxWidth.toFloat(), 0f) - } else if (END in swipeDirections && layoutDirection == LayoutDirection.Ltr || - START in swipeDirections && layoutDirection == LayoutDirection.Rtl) { - position.setBounds(0f, constraints.maxWidth.toFloat()) + when { + START in swipeDirections && END in swipeDirections -> { + position.setBounds(-constraints.maxWidth.toFloat(), constraints.maxWidth.toFloat()) + } + layoutDirection == LayoutDirection.Ltr && START in swipeDirections + || layoutDirection == LayoutDirection.Rtl && END in swipeDirections -> { + position.setBounds(-constraints.maxWidth.toFloat(), 0f) + } + layoutDirection == LayoutDirection.Ltr && END in swipeDirections + || layoutDirection == LayoutDirection.Rtl && START in swipeDirections -> { + position.setBounds(0f, constraints.maxWidth.toFloat()) + } } val draggable = Modifier.draggable( dragDirection = DragDirection.Horizontal, - onDragStopped = { _ -> + onDragStopped = { // TODO: look at using fling and velocity here if (position.max > 0f && position.value / position.max >= swipeCompletePercentage) { position.animateTo( diff --git a/common-ui-view/src/main/java/app/tivi/TiviMvRxViewModel.kt b/common-ui-view/src/main/java/app/tivi/TiviMvRxViewModel.kt index 5e902cf920..92d2efc7d7 100644 --- a/common-ui-view/src/main/java/app/tivi/TiviMvRxViewModel.kt +++ b/common-ui-view/src/main/java/app/tivi/TiviMvRxViewModel.kt @@ -30,11 +30,11 @@ import com.airbnb.mvrx.MvRxState import com.airbnb.mvrx.Success import io.reactivex.disposables.CompositeDisposable import io.reactivex.disposables.Disposable -import kotlin.reflect.KProperty1 import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.catch import kotlinx.coroutines.flow.collect import kotlinx.coroutines.flow.map +import kotlin.reflect.KProperty1 /** * Simple ViewModel which exposes a [CompositeDisposable] which is automatically cleared/stopped when @@ -64,8 +64,10 @@ abstract class TiviMvRxViewModel( return map { Success(mapper(it)) as Async } .catch { if (BuildConfig.DEBUG) { - Log.e(this@TiviMvRxViewModel::class.java.simpleName, - "Exception during observe", it) + Log.e( + this@TiviMvRxViewModel::class.java.simpleName, + "Exception during observe", it + ) } emit(Fail(it)) } diff --git a/common-ui-view/src/main/java/app/tivi/extensions/AnimatorExtensions.kt b/common-ui-view/src/main/java/app/tivi/extensions/AnimatorExtensions.kt index 78d15eebd3..5dbf88fa99 100644 --- a/common-ui-view/src/main/java/app/tivi/extensions/AnimatorExtensions.kt +++ b/common-ui-view/src/main/java/app/tivi/extensions/AnimatorExtensions.kt @@ -19,8 +19,8 @@ package app.tivi.extensions import android.animation.Animator import android.animation.AnimatorListenerAdapter import android.animation.AnimatorSet -import kotlin.coroutines.resume import kotlinx.coroutines.suspendCancellableCoroutine +import kotlin.coroutines.resume fun animatorSetOf(vararg animators: Animator, playTogether: Boolean = true) = AnimatorSet().apply { if (playTogether) { diff --git a/common-ui-view/src/main/java/app/tivi/extensions/MotionLayoutExtensions.kt b/common-ui-view/src/main/java/app/tivi/extensions/MotionLayoutExtensions.kt index 1654ef5542..ac970cebb8 100644 --- a/common-ui-view/src/main/java/app/tivi/extensions/MotionLayoutExtensions.kt +++ b/common-ui-view/src/main/java/app/tivi/extensions/MotionLayoutExtensions.kt @@ -20,11 +20,11 @@ import androidx.constraintlayout.motion.widget.MotionLayout import androidx.constraintlayout.motion.widget.TransitionAdapter import androidx.constraintlayout.widget.ConstraintSet import app.tivi.ui.widget.TiviMotionLayout -import kotlin.coroutines.resume import kotlinx.coroutines.CancellationException import kotlinx.coroutines.TimeoutCancellationException import kotlinx.coroutines.suspendCancellableCoroutine import kotlinx.coroutines.withTimeout +import kotlin.coroutines.resume /** * Applies the given function over each [ConstraintSet] @@ -71,7 +71,10 @@ suspend fun TiviMotionLayout.awaitTransitionComplete(transitionId: Int, timeout: // Transition didn't happen in time. Remove our listener and throw a cancellation // exception to let the coroutine know listener?.let(::removeTransitionListener) - throw CancellationException("Transition to state with id: $transitionId did not" + - " complete in timeout.", tex) + throw CancellationException( + "Transition to state with id: $transitionId did not" + + " complete in timeout.", + tex + ) } } diff --git a/common-ui-view/src/main/java/app/tivi/extensions/MultipleBackStackNavigationExtensions.kt b/common-ui-view/src/main/java/app/tivi/extensions/MultipleBackStackNavigationExtensions.kt index 5080b1fbfc..58f8259060 100644 --- a/common-ui-view/src/main/java/app/tivi/extensions/MultipleBackStackNavigationExtensions.kt +++ b/common-ui-view/src/main/java/app/tivi/extensions/MultipleBackStackNavigationExtensions.kt @@ -93,8 +93,10 @@ fun BottomNavigationView.setupWithNavController( val newlySelectedItemTag = graphIdToTagMap[item.itemId] if (selectedItemTag != newlySelectedItemTag) { // Pop everything above the first fragment (the "fixed start destination") - fragmentManager.popBackStack(firstFragmentTag, - FragmentManager.POP_BACK_STACK_INCLUSIVE) + fragmentManager.popBackStack( + firstFragmentTag, + FragmentManager.POP_BACK_STACK_INCLUSIVE + ) val selectedFragment = fragmentManager.findFragmentByTag(newlySelectedItemTag) as NavHostFragment @@ -174,7 +176,8 @@ private fun BottomNavigationView.setupDeepLinks( ) // Handle Intent if (navHostFragment.navController.handleDeepLink(intent) && - selectedItemId != navHostFragment.navController.graph.id) { + selectedItemId != navHostFragment.navController.graph.id + ) { this.selectedItemId = navHostFragment.navController.graph.id } } diff --git a/common-ui-view/src/main/java/app/tivi/extensions/RecyclerViewExtensions.kt b/common-ui-view/src/main/java/app/tivi/extensions/RecyclerViewExtensions.kt index 3855698f81..0d0e4d429e 100644 --- a/common-ui-view/src/main/java/app/tivi/extensions/RecyclerViewExtensions.kt +++ b/common-ui-view/src/main/java/app/tivi/extensions/RecyclerViewExtensions.kt @@ -20,8 +20,8 @@ import android.view.ViewGroup import androidx.recyclerview.widget.LinearSmoothScroller import androidx.recyclerview.widget.RecyclerView import app.tivi.ui.recyclerview.TiviLinearSmoothScroller -import kotlin.coroutines.resume import kotlinx.coroutines.suspendCancellableCoroutine +import kotlin.coroutines.resume fun RecyclerView.Adapter.createAndBind( parent: ViewGroup, diff --git a/common-ui-view/src/main/java/app/tivi/extensions/ViewExtensions.kt b/common-ui-view/src/main/java/app/tivi/extensions/ViewExtensions.kt index 30d769878b..e23a203c3e 100644 --- a/common-ui-view/src/main/java/app/tivi/extensions/ViewExtensions.kt +++ b/common-ui-view/src/main/java/app/tivi/extensions/ViewExtensions.kt @@ -22,8 +22,8 @@ import android.view.ViewGroup import androidx.core.view.OneShotPreDrawListener import androidx.transition.AutoTransition import androidx.transition.TransitionManager -import kotlin.coroutines.resume import kotlinx.coroutines.suspendCancellableCoroutine +import kotlin.coroutines.resume fun ViewGroup.beginDelayedTransition(duration: Long = 200) { TransitionManager.beginDelayedTransition(this, AutoTransition().apply { setDuration(duration) }) diff --git a/common-ui-view/src/main/java/app/tivi/home/HomeTextCreator.kt b/common-ui-view/src/main/java/app/tivi/home/HomeTextCreator.kt index 9a6fbd5fd3..d8246f655c 100644 --- a/common-ui-view/src/main/java/app/tivi/home/HomeTextCreator.kt +++ b/common-ui-view/src/main/java/app/tivi/home/HomeTextCreator.kt @@ -56,8 +56,10 @@ class HomeTextCreator @Inject constructor( show.firstAired?.also { firstAired -> append(" ") - inSpans(textAppearanceSpanForAttribute(context, R.attr.textAppearanceCaption), - TypefaceSpan(bodyTypeface)) { + inSpans( + textAppearanceSpanForAttribute(context, R.attr.textAppearanceCaption), + TypefaceSpan(bodyTypeface) + ) { append("(") append(firstAired.year.toString()) append(")") @@ -72,8 +74,10 @@ class HomeTextCreator @Inject constructor( fun followedShowEpisodeWatchStatus(stats: FollowedShowsWatchStats?): CharSequence { return if (stats != null && stats.watchedEpisodeCount < stats.episodeCount) { - context.getString(R.string.followed_watch_stats_to_watch, - stats.episodeCount - stats.watchedEpisodeCount).parseAsHtml() + context.getString( + R.string.followed_watch_stats_to_watch, + stats.episodeCount - stats.watchedEpisodeCount + ).parseAsHtml() } else if (stats != null && stats.watchedEpisodeCount > 0) { context.getString(R.string.followed_watch_stats_complete) } else { diff --git a/common-ui-view/src/main/java/app/tivi/ui/ScrimUtil.kt b/common-ui-view/src/main/java/app/tivi/ui/ScrimUtil.kt index 930ac03bc9..318465969c 100644 --- a/common-ui-view/src/main/java/app/tivi/ui/ScrimUtil.kt +++ b/common-ui-view/src/main/java/app/tivi/ui/ScrimUtil.kt @@ -65,8 +65,10 @@ object ScrimUtil { for (i in 0 until numStops) { val x = i * 1f / (numStops - 1) val opacity = x.toDouble().pow(3.0).toFloat() - stopColors[i] = ColorUtils.setAlphaComponent(baseColor, - (alpha * opacity).roundToInt().coerceIn(0, 255)) + stopColors[i] = ColorUtils.setAlphaComponent( + baseColor, + (alpha * opacity).roundToInt().coerceIn(0, 255) + ) } val x0: Float @@ -111,7 +113,8 @@ object ScrimUtil { height * y1, stopColors, null, - Shader.TileMode.CLAMP) + Shader.TileMode.CLAMP + ) } } cache.put(cacheKeyHash, paintDrawable) diff --git a/common-ui-view/src/main/java/app/tivi/ui/recyclerview/TiviLinearSmoothScroller.kt b/common-ui-view/src/main/java/app/tivi/ui/recyclerview/TiviLinearSmoothScroller.kt index eb653739cd..a315e66fac 100644 --- a/common-ui-view/src/main/java/app/tivi/ui/recyclerview/TiviLinearSmoothScroller.kt +++ b/common-ui-view/src/main/java/app/tivi/ui/recyclerview/TiviLinearSmoothScroller.kt @@ -43,7 +43,9 @@ class TiviLinearSmoothScroller( boxEnd: Int, snapPreference: Int ): Int { - return targetOffset + super.calculateDtToFit(viewStart, viewEnd, - boxStart, boxEnd, snapPreference) + return targetOffset + super.calculateDtToFit( + viewStart, viewEnd, + boxStart, boxEnd, snapPreference + ) } } diff --git a/common-ui-view/src/main/java/app/tivi/ui/transitions/BabySlide.kt b/common-ui-view/src/main/java/app/tivi/ui/transitions/BabySlide.kt index 2d63035fe7..ff357c9704 100644 --- a/common-ui-view/src/main/java/app/tivi/ui/transitions/BabySlide.kt +++ b/common-ui-view/src/main/java/app/tivi/ui/transitions/BabySlide.kt @@ -39,10 +39,12 @@ class BabySlide( setupTranslation(view) view.alpha = 0f - return ObjectAnimator.ofPropertyValuesHolder(view, + return ObjectAnimator.ofPropertyValuesHolder( + view, PropertyValuesHolder.ofFloat(View.TRANSLATION_X, 0f), PropertyValuesHolder.ofFloat(View.TRANSLATION_Y, 0f), - PropertyValuesHolder.ofFloat(View.ALPHA, 1f)) + PropertyValuesHolder.ofFloat(View.ALPHA, 1f) + ) } override fun onDisappear( @@ -51,9 +53,11 @@ class BabySlide( startValues: TransitionValues?, endValues: TransitionValues? ): Animator { - return ObjectAnimator.ofPropertyValuesHolder(view, + return ObjectAnimator.ofPropertyValuesHolder( + view, translatePropValForGravity(view), - PropertyValuesHolder.ofFloat(View.ALPHA, 0f)) + PropertyValuesHolder.ofFloat(View.ALPHA, 0f) + ) } private fun translatePropValForGravity(view: View): PropertyValuesHolder = diff --git a/common-ui-view/src/main/java/app/tivi/ui/transitions/ColumnedChangeBounds.kt b/common-ui-view/src/main/java/app/tivi/ui/transitions/ColumnedChangeBounds.kt index dece66b917..d65b9d5866 100644 --- a/common-ui-view/src/main/java/app/tivi/ui/transitions/ColumnedChangeBounds.kt +++ b/common-ui-view/src/main/java/app/tivi/ui/transitions/ColumnedChangeBounds.kt @@ -144,7 +144,8 @@ class ColumnedChangeBounds : ViewChangeBounds() { newEndRight - endBounds.width(), newEndTop, newEndRight, - newEndTop + endBounds.height()) + newEndTop + endBounds.height() + ) return createPointToPointAnimator(view, startBounds, newEndBounds, 1f, 0f, true) } @@ -160,9 +161,11 @@ class ColumnedChangeBounds : ViewChangeBounds() { val newEndLeft = prevEndBounds.right + endBounds.left val newEndTop = prevEndBounds.top - val newEndBounds = Rect(newEndLeft, newEndTop, + val newEndBounds = Rect( + newEndLeft, newEndTop, newEndLeft + endBounds.width(), - newEndTop + endBounds.height()) + newEndTop + endBounds.height() + ) return createPointToPointAnimator(view, startBounds, newEndBounds, 1f, 0f, true) } diff --git a/common-ui-view/src/main/java/app/tivi/ui/transitions/GridToGridTransitioner.kt b/common-ui-view/src/main/java/app/tivi/ui/transitions/GridToGridTransitioner.kt index 5ab3b8cd10..961b52ef56 100644 --- a/common-ui-view/src/main/java/app/tivi/ui/transitions/GridToGridTransitioner.kt +++ b/common-ui-view/src/main/java/app/tivi/ui/transitions/GridToGridTransitioner.kt @@ -50,16 +50,20 @@ object GridToGridTransitioner { */ fun setupFirstFragment(fragment: Fragment, vararg contentFadeElementIds: Int) { fragment.exitTransition = TransitionSet().apply { - addTransition(Fade().apply { - contentFadeElementIds.forEach { excludeTarget(it, true) } - interpolator = LINEAR_INTERPOLATOR - duration = CONTENT_TRANSITION_DURATION / 2 - }) - addTransition(Fade().apply { - contentFadeElementIds.forEach { addTarget(it) } - interpolator = LINEAR_INTERPOLATOR - duration = CONTENT_TRANSITION_DURATION - }) + addTransition( + Fade().apply { + contentFadeElementIds.forEach { excludeTarget(it, true) } + interpolator = LINEAR_INTERPOLATOR + duration = CONTENT_TRANSITION_DURATION / 2 + } + ) + addTransition( + Fade().apply { + contentFadeElementIds.forEach { addTarget(it) } + interpolator = LINEAR_INTERPOLATOR + duration = CONTENT_TRANSITION_DURATION + } + ) } fragment.reenterTransition = Fade().apply { interpolator = LINEAR_INTERPOLATOR @@ -87,14 +91,18 @@ object GridToGridTransitioner { duration = GRID_SHARED_ELEMENT_RETURN_DURATION } fragment.enterTransition = TransitionSet().apply { - addTransition(Fade().apply { - fadeElementIds.forEach { addTarget(it) } - interpolator = LINEAR_INTERPOLATOR - }) - addTransition(BabySlide().apply { - fadeElementIds.forEach { excludeTarget(it, true) } - interpolator = LINEAR_OUT_SLOW_IN_INTERPOLATOR - }) + addTransition( + Fade().apply { + fadeElementIds.forEach { addTarget(it) } + interpolator = LINEAR_INTERPOLATOR + } + ) + addTransition( + BabySlide().apply { + fadeElementIds.forEach { excludeTarget(it, true) } + interpolator = LINEAR_OUT_SLOW_IN_INTERPOLATOR + } + ) duration = CONTENT_TRANSITION_DURATION // We want this to end at the same time as the shared element transition so we delay it startDelay = GRID_SHARED_ELEMENT_ENTER_DURATION - CONTENT_TRANSITION_DURATION @@ -106,14 +114,18 @@ object GridToGridTransitioner { }) } fragment.returnTransition = TransitionSet().apply { - addTransition(Fade().apply { - fadeElementIds.forEach { addTarget(it) } - interpolator = LINEAR_INTERPOLATOR - }) - addTransition(BabySlide().apply { - fadeElementIds.forEach { excludeTarget(it, true) } - interpolator = FAST_OUT_LINEAR_IN_INTERPOLATOR - }) + addTransition( + Fade().apply { + fadeElementIds.forEach { addTarget(it) } + interpolator = LINEAR_INTERPOLATOR + } + ) + addTransition( + BabySlide().apply { + fadeElementIds.forEach { excludeTarget(it, true) } + interpolator = FAST_OUT_LINEAR_IN_INTERPOLATOR + } + ) duration = (CONTENT_TRANSITION_DURATION * RETURN_TRANSITION_FRACTION).toLong() } } diff --git a/common-ui-view/src/main/java/app/tivi/ui/transitions/ViewChangeBounds.kt b/common-ui-view/src/main/java/app/tivi/ui/transitions/ViewChangeBounds.kt index caca2b0fc8..c07906f222 100644 --- a/common-ui-view/src/main/java/app/tivi/ui/transitions/ViewChangeBounds.kt +++ b/common-ui-view/src/main/java/app/tivi/ui/transitions/ViewChangeBounds.kt @@ -129,7 +129,8 @@ open class ViewChangeBounds : Transition() { null, pathMotion.getPath( startBounds.left.toFloat(), startBounds.top.toFloat(), - endBounds.left.toFloat(), endBounds.top.toFloat()) + endBounds.left.toFloat(), endBounds.top.toFloat() + ) ) val outBottomRightPropVal = PropertyValuesHolder.ofObject( @@ -137,7 +138,8 @@ open class ViewChangeBounds : Transition() { null, pathMotion.getPath( startBounds.right.toFloat(), startBounds.bottom.toFloat(), - endBounds.right.toFloat(), endBounds.bottom.toFloat()) + endBounds.right.toFloat(), endBounds.bottom.toFloat() + ) ) val alphaPropVal = PropertyValuesHolder.ofFloat(ALPHA_PROPERTY, startAlpha, endAlpha) @@ -146,7 +148,8 @@ open class ViewChangeBounds : Transition() { bounds.setLeftTopRightBottom(startBounds.left, startBounds.top, startBounds.right, startBounds.bottom) - return ObjectAnimator.ofPropertyValuesHolder(bounds, + return ObjectAnimator.ofPropertyValuesHolder( + bounds, outTopLeftPropVal, outBottomRightPropVal, alphaPropVal diff --git a/common-ui-view/src/main/java/app/tivi/ui/transitions/ViewGroupUtils.kt b/common-ui-view/src/main/java/app/tivi/ui/transitions/ViewGroupUtils.kt index d19c9dc039..126d8bf188 100644 --- a/common-ui-view/src/main/java/app/tivi/ui/transitions/ViewGroupUtils.kt +++ b/common-ui-view/src/main/java/app/tivi/ui/transitions/ViewGroupUtils.kt @@ -27,8 +27,10 @@ private var sSuppressLayoutMethodFetched: Boolean = false fun ViewGroup.suppressLayoutInternal(suppress: Boolean) { if (!sSuppressLayoutMethodFetched) { try { - sSuppressLayoutMethod = ViewGroup::class.java.getDeclaredMethod("suppressLayout", - Boolean::class.javaPrimitiveType) + sSuppressLayoutMethod = ViewGroup::class.java.getDeclaredMethod( + "suppressLayout", + Boolean::class.javaPrimitiveType + ) sSuppressLayoutMethod!!.isAccessible = true } catch (e: NoSuchMethodException) { Log.i("ViewGroupTivi", "Failed to retrieve suppressLayout method", e) diff --git a/common-ui-view/src/main/java/app/tivi/ui/widget/BaselineGridTextView.kt b/common-ui-view/src/main/java/app/tivi/ui/widget/BaselineGridTextView.kt index d058f035e6..8b2ca9eedd 100644 --- a/common-ui-view/src/main/java/app/tivi/ui/widget/BaselineGridTextView.kt +++ b/common-ui-view/src/main/java/app/tivi/ui/widget/BaselineGridTextView.kt @@ -74,14 +74,17 @@ class BaselineGridTextView @JvmOverloads constructor( init { val a = context.obtainStyledAttributes( - attrs, R.styleable.BaselineGridTextView, defStyleAttr, 0) + attrs, R.styleable.BaselineGridTextView, defStyleAttr, 0 + ) // first check TextAppearance for line height & font attributes if (a.hasValue(R.styleable.BaselineGridTextView_android_textAppearance)) { val textAppearanceId = a.getResourceId( - R.styleable.BaselineGridTextView_android_textAppearance, android.R.style.TextAppearance) + R.styleable.BaselineGridTextView_android_textAppearance, android.R.style.TextAppearance + ) val ta = context.obtainStyledAttributes( - textAppearanceId, R.styleable.BaselineGridTextView) + textAppearanceId, R.styleable.BaselineGridTextView + ) parseTextAttrs(ta) ta.recycle() } @@ -124,7 +127,8 @@ class BaselineGridTextView @JvmOverloads constructor( } if (a.hasValue(R.styleable.BaselineGridTextView_lineHeightHint)) { lineHeightHint = a.getDimensionPixelSize( - R.styleable.BaselineGridTextView_lineHeightHint, 0) + R.styleable.BaselineGridTextView_lineHeightHint, 0 + ) } } diff --git a/common-ui-view/src/main/java/app/tivi/ui/widget/HeaderHolderFrameLayout.kt b/common-ui-view/src/main/java/app/tivi/ui/widget/HeaderHolderFrameLayout.kt index 3c369a8ac2..373a9c709a 100644 --- a/common-ui-view/src/main/java/app/tivi/ui/widget/HeaderHolderFrameLayout.kt +++ b/common-ui-view/src/main/java/app/tivi/ui/widget/HeaderHolderFrameLayout.kt @@ -54,13 +54,17 @@ class HeaderHolderFrameLayout @JvmOverloads constructor( } init { - context.obtainStyledAttributes(attrs, R.styleable.HeaderHolderFrameLayout, - defStyle, R.style.Widget_Tivi_HeaderHolderFrameLayout).use { + context.obtainStyledAttributes( + attrs, R.styleable.HeaderHolderFrameLayout, + defStyle, R.style.Widget_Tivi_HeaderHolderFrameLayout + ).use { dividerDrawable = it.getDrawable(R.styleable.HeaderHolderFrameLayout_dividerDrawable) dividerMarginStart = it.getDimensionPixelSize( - R.styleable.HeaderHolderFrameLayout_dividerMarginStart, 0) + R.styleable.HeaderHolderFrameLayout_dividerMarginStart, 0 + ) dividerMarginEnd = it.getDimensionPixelSize( - R.styleable.HeaderHolderFrameLayout_dividerMarginEnd, 0) + R.styleable.HeaderHolderFrameLayout_dividerMarginEnd, 0 + ) background = MaterialShapeDrawable.createWithElevationOverlay(context, elevation).apply { fillColor = it.getColorStateList(R.styleable.HeaderHolderFrameLayout_materialBackgroundColor) } diff --git a/common-ui-view/src/main/java/app/tivi/ui/widget/MaterialShapeConstraintLayout.kt b/common-ui-view/src/main/java/app/tivi/ui/widget/MaterialShapeConstraintLayout.kt index bb95b1c53b..d96413f296 100644 --- a/common-ui-view/src/main/java/app/tivi/ui/widget/MaterialShapeConstraintLayout.kt +++ b/common-ui-view/src/main/java/app/tivi/ui/widget/MaterialShapeConstraintLayout.kt @@ -40,12 +40,14 @@ class MaterialShapeConstraintLayout @JvmOverloads constructor( val builder = shapeAppearanceModel.toBuilder() val topLeft = ta.getDimension( - R.styleable.MaterialShapeConstraintLayout_materialBackgroundTopLeftRadius, 0f) + R.styleable.MaterialShapeConstraintLayout_materialBackgroundTopLeftRadius, 0f + ) if (topLeft > 0) { builder.setTopLeftCorner(CornerFamily.ROUNDED, topLeft) } val topRight = ta.getDimension( - R.styleable.MaterialShapeConstraintLayout_materialBackgroundTopRightRadius, 0f) + R.styleable.MaterialShapeConstraintLayout_materialBackgroundTopRightRadius, 0f + ) if (topRight > 0) { builder.setTopRightCorner(CornerFamily.ROUNDED, topRight) } diff --git a/common-ui-view/src/main/java/app/tivi/ui/widget/NestedChildMotionLayout.kt b/common-ui-view/src/main/java/app/tivi/ui/widget/NestedChildMotionLayout.kt index 3a4f709290..d131e252a1 100644 --- a/common-ui-view/src/main/java/app/tivi/ui/widget/NestedChildMotionLayout.kt +++ b/common-ui-view/src/main/java/app/tivi/ui/widget/NestedChildMotionLayout.kt @@ -81,8 +81,10 @@ class NestedChildMotionLayout @JvmOverloads constructor( if (dx != consumed[0] || dy != consumed[1]) { // If there is any dx/dy remaining, let MotionLayout handle it val innerConsumed = tmpArray - super.onNestedPreScroll(target, dx - consumed[0], dy - consumed[1], - innerConsumed, type) + super.onNestedPreScroll( + target, dx - consumed[0], dy - consumed[1], + innerConsumed, type + ) consumed[0] += innerConsumed[0] consumed[1] += innerConsumed[1] } @@ -97,14 +99,18 @@ class NestedChildMotionLayout @JvmOverloads constructor( type: Int, consumed: IntArray ) { - super.onNestedScroll(target, dxConsumed, dyConsumed, + super.onNestedScroll( + target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, - type, consumed) + type, consumed + ) - dispatchNestedScroll(dxConsumed, dyConsumed, + dispatchNestedScroll( + dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, null, - type, tmpArray) + type, tmpArray + ) } override fun onNestedPreFling( @@ -161,9 +167,11 @@ class NestedChildMotionLayout @JvmOverloads constructor( type: Int, consumed: IntArray ) { - helper.dispatchNestedScroll(dxConsumed, dyConsumed, + helper.dispatchNestedScroll( + dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, - offsetInWindow, type, consumed) + offsetInWindow, type, consumed + ) } override fun dispatchNestedScroll( @@ -173,8 +181,10 @@ class NestedChildMotionLayout @JvmOverloads constructor( dyUnconsumed: Int, offsetInWindow: IntArray?, type: Int - ) = helper.dispatchNestedScroll(dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, - offsetInWindow, type) + ) = helper.dispatchNestedScroll( + dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, + offsetInWindow, type + ) override fun dispatchNestedPreFling( velocityX: Float, diff --git a/common-ui-view/src/main/java/app/tivi/util/ObservableLoadingCounter.kt b/common-ui-view/src/main/java/app/tivi/util/ObservableLoadingCounter.kt index f25860f4e2..411aec9612 100644 --- a/common-ui-view/src/main/java/app/tivi/util/ObservableLoadingCounter.kt +++ b/common-ui-view/src/main/java/app/tivi/util/ObservableLoadingCounter.kt @@ -20,7 +20,6 @@ import app.tivi.base.InvokeError import app.tivi.base.InvokeStarted import app.tivi.base.InvokeStatus import app.tivi.base.InvokeSuccess -import java.util.concurrent.atomic.AtomicInteger import kotlinx.coroutines.channels.ConflatedBroadcastChannel import kotlinx.coroutines.channels.sendBlocking import kotlinx.coroutines.flow.Flow @@ -28,6 +27,7 @@ import kotlinx.coroutines.flow.asFlow import kotlinx.coroutines.flow.collect import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.map +import java.util.concurrent.atomic.AtomicInteger class ObservableLoadingCounter { private val count = AtomicInteger() diff --git a/data-android/src/main/java/app/tivi/data/DatabaseInject.kt b/data-android/src/main/java/app/tivi/data/DatabaseInject.kt index fb3f8712e1..4970aee963 100644 --- a/data-android/src/main/java/app/tivi/data/DatabaseInject.kt +++ b/data-android/src/main/java/app/tivi/data/DatabaseInject.kt @@ -24,11 +24,13 @@ import dagger.Module import dagger.Provides import javax.inject.Singleton -@Module(includes = [ - RoomDatabaseModule::class, - DatabaseModuleBinds::class, - DatabaseDaoModule::class -]) +@Module( + includes = [ + RoomDatabaseModule::class, + DatabaseModuleBinds::class, + DatabaseDaoModule::class + ] +) class DatabaseModule @Module diff --git a/data-android/src/main/java/app/tivi/data/FlowPagedListBuilder.kt b/data-android/src/main/java/app/tivi/data/FlowPagedListBuilder.kt index 5513f4bb67..747145a814 100644 --- a/data-android/src/main/java/app/tivi/data/FlowPagedListBuilder.kt +++ b/data-android/src/main/java/app/tivi/data/FlowPagedListBuilder.kt @@ -20,13 +20,13 @@ import android.annotation.SuppressLint import androidx.arch.core.executor.ArchTaskExecutor import androidx.paging.DataSource import androidx.paging.PagedList -import java.util.concurrent.Executor import kotlinx.coroutines.asCoroutineDispatcher import kotlinx.coroutines.channels.awaitClose import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.channelFlow import kotlinx.coroutines.launch import kotlinx.coroutines.withContext +import java.util.concurrent.Executor /** * Builder for `Flow` given a [DataSource.Factory] and a [PagedList.Config]. diff --git a/data-android/src/test/java/app/tivi/data/TestDatabaseInject.kt b/data-android/src/test/java/app/tivi/data/TestDatabaseInject.kt index 2398f122c3..a1bdb19f4d 100644 --- a/data-android/src/test/java/app/tivi/data/TestDatabaseInject.kt +++ b/data-android/src/test/java/app/tivi/data/TestDatabaseInject.kt @@ -44,14 +44,16 @@ import dagger.Component import dagger.Module import dagger.Provides import io.mockk.mockk -import javax.inject.Singleton import kotlinx.coroutines.CoroutineScope +import javax.inject.Singleton @Singleton -@Component(modules = [ - TestDataSourceModule::class, - TestDatabaseModule::class -]) +@Component( + modules = [ + TestDataSourceModule::class, + TestDatabaseModule::class + ] +) interface TestComponent { fun inject(test: SeasonsEpisodesRepositoryTest) fun inject(test: FollowedShowRepositoryTest) @@ -102,13 +104,15 @@ class TestDataSourceModule( fun provideStoreCoroutineScope(): CoroutineScope = storeScope } -@Module(includes = [ - TestRoomDatabaseModule::class, - DatabaseDaoModule::class, - TraktServiceModule::class, - ShowStoreModule::class, - ShowImagesStoreModule::class -]) +@Module( + includes = [ + TestRoomDatabaseModule::class, + DatabaseDaoModule::class, + TraktServiceModule::class, + ShowStoreModule::class, + ShowImagesStoreModule::class + ] +) class TestDatabaseModule { @Provides fun provideTrakt(): TraktV2 = TraktV2("fakefakefake") diff --git a/data-android/src/test/java/app/tivi/data/dao/EpisodeWatchEntryTest.kt b/data-android/src/test/java/app/tivi/data/dao/EpisodeWatchEntryTest.kt index 5dc85430b2..1faaa3324b 100644 --- a/data-android/src/test/java/app/tivi/data/dao/EpisodeWatchEntryTest.kt +++ b/data-android/src/test/java/app/tivi/data/dao/EpisodeWatchEntryTest.kt @@ -33,7 +33,6 @@ import app.tivi.utils.s1e1 import app.tivi.utils.s1e1w import app.tivi.utils.s1e1w_id import app.tivi.utils.showId -import javax.inject.Inject import kotlinx.coroutines.test.TestCoroutineScope import kotlinx.coroutines.test.runBlockingTest import org.hamcrest.CoreMatchers.`is` @@ -45,6 +44,7 @@ import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner +import javax.inject.Inject @RunWith(RobolectricTestRunner::class) class EpisodeWatchEntryTest { @@ -90,7 +90,8 @@ class EpisodeWatchEntryTest { @Test fun fetchEntries_WithPendingSendAction() = testScope.runBlockingTest { episodeWatchEntryDao.insertAll(s1e1w, episodeWatch2PendingSend) - assertThat(episodeWatchEntryDao.entriesForShowIdWithSendPendingActions(showId), + assertThat( + episodeWatchEntryDao.entriesForShowIdWithSendPendingActions(showId), `is`(listOf(episodeWatch2PendingSend)) ) } @@ -98,7 +99,8 @@ class EpisodeWatchEntryTest { @Test fun fetchEntries_WithPendingDeleteAction() = testScope.runBlockingTest { episodeWatchEntryDao.insertAll(s1e1w, episodeWatch2PendingDelete) - assertThat(episodeWatchEntryDao.entriesForShowIdWithDeletePendingActions(showId), + assertThat( + episodeWatchEntryDao.entriesForShowIdWithDeletePendingActions(showId), `is`(listOf(episodeWatch2PendingDelete)) ) } diff --git a/data-android/src/test/java/app/tivi/data/dao/EpisodesTest.kt b/data-android/src/test/java/app/tivi/data/dao/EpisodesTest.kt index dbb120e3c5..72dc7f5df1 100644 --- a/data-android/src/test/java/app/tivi/data/dao/EpisodesTest.kt +++ b/data-android/src/test/java/app/tivi/data/dao/EpisodesTest.kt @@ -30,7 +30,6 @@ import app.tivi.utils.s1e1 import app.tivi.utils.s1e2 import app.tivi.utils.s1e3 import app.tivi.utils.showId -import javax.inject.Inject import kotlinx.coroutines.flow.first import kotlinx.coroutines.runBlocking import kotlinx.coroutines.test.TestCoroutineScope @@ -44,6 +43,7 @@ import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner +import javax.inject.Inject @RunWith(RobolectricTestRunner::class) class EpisodesTest { @@ -109,17 +109,29 @@ class EpisodesTest { fun nextAiredEpisodeAfter() = testScope.runBlockingTest { episodeDao.insertAll(s1_episodes) - assertThat(episodeDao.observeNextEpisodeForShowAfter(showId, 0, 0) - .first()?.episode, `is`(s1e1)) - - assertThat(episodeDao.observeNextEpisodeForShowAfter(showId, 1, 0) - .first()?.episode, `is`(s1e2)) - - assertThat(episodeDao.observeNextEpisodeForShowAfter(showId, 1, 1) - .first()?.episode, `is`(s1e3)) - - assertThat(episodeDao.observeNextEpisodeForShowAfter(showId, 1, 2) - .first()?.episode, nullValue()) + assertThat( + episodeDao.observeNextEpisodeForShowAfter(showId, 0, 0) + .first()?.episode, + `is`(s1e1) + ) + + assertThat( + episodeDao.observeNextEpisodeForShowAfter(showId, 1, 0) + .first()?.episode, + `is`(s1e2) + ) + + assertThat( + episodeDao.observeNextEpisodeForShowAfter(showId, 1, 1) + .first()?.episode, + `is`(s1e3) + ) + + assertThat( + episodeDao.observeNextEpisodeForShowAfter(showId, 1, 2) + .first()?.episode, + nullValue() + ) } @After diff --git a/data-android/src/test/java/app/tivi/data/dao/SeasonsTest.kt b/data-android/src/test/java/app/tivi/data/dao/SeasonsTest.kt index 7b58bc8210..5473b3982b 100644 --- a/data-android/src/test/java/app/tivi/data/dao/SeasonsTest.kt +++ b/data-android/src/test/java/app/tivi/data/dao/SeasonsTest.kt @@ -29,7 +29,6 @@ import app.tivi.utils.s1 import app.tivi.utils.s1_id import app.tivi.utils.s2 import app.tivi.utils.showId -import javax.inject.Inject import kotlinx.coroutines.test.TestCoroutineScope import kotlinx.coroutines.test.runBlockingTest import org.hamcrest.CoreMatchers.`is` @@ -41,6 +40,7 @@ import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner +import javax.inject.Inject @RunWith(RobolectricTestRunner::class) class SeasonsTest { @@ -89,7 +89,8 @@ class SeasonsTest { seasonsDao.insert(s2) // Specials should always be last - assertThat(seasonsDao.seasonsForShowId(showId), + assertThat( + seasonsDao.seasonsForShowId(showId), `is`(listOf(s1, s2, s0)) ) } diff --git a/data-android/src/test/java/app/tivi/data/repositories/FollowedShowRepositoryTest.kt b/data-android/src/test/java/app/tivi/data/repositories/FollowedShowRepositoryTest.kt index 748a924cb7..dd2d639756 100644 --- a/data-android/src/test/java/app/tivi/data/repositories/FollowedShowRepositoryTest.kt +++ b/data-android/src/test/java/app/tivi/data/repositories/FollowedShowRepositoryTest.kt @@ -38,7 +38,6 @@ import app.tivi.utils.insertShow import app.tivi.utils.show import app.tivi.utils.show2 import io.mockk.coEvery -import javax.inject.Inject import kotlinx.coroutines.runBlocking import kotlinx.coroutines.test.TestCoroutineScope import kotlinx.coroutines.test.runBlockingTest @@ -50,6 +49,7 @@ import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner +import javax.inject.Inject @RunWith(RobolectricTestRunner::class) class FollowedShowRepositoryTest { @@ -90,8 +90,10 @@ class FollowedShowRepositoryTest { repository.syncFollowedShows() - assertThat(repository.getFollowedShows(), - `is`(listOf(followedShow1Local))) + assertThat( + repository.getFollowedShows(), + `is`(listOf(followedShow1Local)) + ) } @Test @@ -103,8 +105,10 @@ class FollowedShowRepositoryTest { repository.syncFollowedShows() - assertThat(repository.getFollowedShows(), - `is`(emptyList())) + assertThat( + repository.getFollowedShows(), + `is`(emptyList()) + ) } @Test @@ -116,8 +120,10 @@ class FollowedShowRepositoryTest { repository.syncFollowedShows() - assertThat(repository.getFollowedShows(), - `is`(listOf(followedShow2Local))) + assertThat( + repository.getFollowedShows(), + `is`(listOf(followedShow2Local)) + ) } @Test @@ -129,8 +135,10 @@ class FollowedShowRepositoryTest { repository.syncFollowedShows() - assertThat(repository.getFollowedShows(), - `is`(emptyList())) + assertThat( + repository.getFollowedShows(), + `is`(emptyList()) + ) } @Test @@ -142,8 +150,10 @@ class FollowedShowRepositoryTest { repository.syncFollowedShows() - assertThat(repository.getFollowedShows(), - `is`(listOf(followedShow1Local))) + assertThat( + repository.getFollowedShows(), + `is`(listOf(followedShow1Local)) + ) } @After diff --git a/data-android/src/test/java/app/tivi/data/repositories/SeasonsEpisodesRepositoryTest.kt b/data-android/src/test/java/app/tivi/data/repositories/SeasonsEpisodesRepositoryTest.kt index a68983a8bd..c1dee434de 100644 --- a/data-android/src/test/java/app/tivi/data/repositories/SeasonsEpisodesRepositoryTest.kt +++ b/data-android/src/test/java/app/tivi/data/repositories/SeasonsEpisodesRepositoryTest.kt @@ -41,7 +41,6 @@ import app.tivi.utils.s2_id import app.tivi.utils.s2e1 import app.tivi.utils.showId import io.mockk.coEvery -import javax.inject.Inject import kotlinx.coroutines.flow.produceIn import kotlinx.coroutines.runBlocking import kotlinx.coroutines.test.TestCoroutineScope @@ -57,6 +56,7 @@ import org.junit.Test import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner import org.threeten.bp.OffsetDateTime +import javax.inject.Inject @RunWith(RobolectricTestRunner::class) class SeasonsEpisodesRepositoryTest { diff --git a/data/src/main/java/app/tivi/data/DataModule.kt b/data/src/main/java/app/tivi/data/DataModule.kt index 6b18c6eeca..e9b679975d 100644 --- a/data/src/main/java/app/tivi/data/DataModule.kt +++ b/data/src/main/java/app/tivi/data/DataModule.kt @@ -27,20 +27,22 @@ import app.tivi.data.repositories.watchedshows.WatchedShowsModule import app.tivi.inject.ForStore import dagger.Module import dagger.Provides +import kotlinx.coroutines.CoroutineScope import javax.inject.Singleton import kotlin.coroutines.EmptyCoroutineContext -import kotlinx.coroutines.CoroutineScope -@Module(includes = [ - EpisodesModule::class, - ShowsModule::class, - ShowsImagesModule::class, - TrendingShowsModule::class, - WatchedShowsModule::class, - RecommendedShowsModule::class, - RelatedShowsModule::class, - PopularShowsModule::class -]) +@Module( + includes = [ + EpisodesModule::class, + ShowsModule::class, + ShowsImagesModule::class, + TrendingShowsModule::class, + WatchedShowsModule::class, + RecommendedShowsModule::class, + RelatedShowsModule::class, + PopularShowsModule::class + ] +) class DataModule { @ForStore @Singleton diff --git a/data/src/main/java/app/tivi/data/daos/EpisodeWatchEntryDao.kt b/data/src/main/java/app/tivi/data/daos/EpisodeWatchEntryDao.kt index b5f842c286..b5fdf098be 100644 --- a/data/src/main/java/app/tivi/data/daos/EpisodeWatchEntryDao.kt +++ b/data/src/main/java/app/tivi/data/daos/EpisodeWatchEntryDao.kt @@ -54,25 +54,29 @@ abstract class EpisodeWatchEntryDao : EntityDao() { return entriesForShowIdWithPendingAction(showId, PendingAction.DELETE.value) } - @Query(""" + @Query( + """ SELECT ew.* FROM episode_watch_entries AS ew INNER JOIN episodes AS eps ON ew.episode_id = eps.id INNER JOIN seasons AS s ON eps.season_id = s.id INNER JOIN shows ON s.show_id = shows.id WHERE shows.id = :showId AND ew.pending_action = :pendingAction - """) + """ + ) internal abstract suspend fun entriesForShowIdWithPendingAction( showId: Long, pendingAction: String ): List - @Query(""" + @Query( + """ SELECT ew.* FROM episode_watch_entries AS ew INNER JOIN episodes AS eps ON ew.episode_id = eps.id INNER JOIN seasons AS s ON eps.season_id = s.id INNER JOIN shows ON s.show_id = shows.id WHERE shows.id = :showId - """) + """ + ) abstract suspend fun entriesForShowId(showId: Long): List @Query("UPDATE episode_watch_entries SET pending_action = :pendingAction WHERE id IN (:ids)") diff --git a/data/src/main/java/app/tivi/data/daos/EpisodesDao.kt b/data/src/main/java/app/tivi/data/daos/EpisodesDao.kt index b2d15940a1..2434abb76d 100644 --- a/data/src/main/java/app/tivi/data/daos/EpisodesDao.kt +++ b/data/src/main/java/app/tivi/data/daos/EpisodesDao.kt @@ -52,10 +52,12 @@ abstract class EpisodesDao : EntityDao() { @Query("SELECT * from episodes WHERE id = :id") abstract fun episodeWithIdObservable(id: Long): Flow - @Query("SELECT shows.id FROM shows" + - " INNER JOIN seasons AS s ON s.show_id = shows.id" + - " INNER JOIN episodes AS eps ON eps.season_id = s.id" + - " WHERE eps.id = :episodeId") + @Query( + "SELECT shows.id FROM shows" + + " INNER JOIN seasons AS s ON s.show_id = shows.id" + + " INNER JOIN episodes AS eps ON eps.season_id = s.id" + + " WHERE eps.id = :episodeId" + ) abstract suspend fun showIdForEpisodeId(episodeId: Long): Long @Transaction @@ -82,7 +84,8 @@ abstract class EpisodesDao : EntityDao() { ): Flow companion object { - const val latestWatchedEpisodeForShowId = """ + const val latestWatchedEpisodeForShowId = + """ SELECT eps.*, (100 * s.number) + eps.number AS computed_abs_number FROM shows INNER JOIN seasons AS s ON shows.id = s.show_id @@ -95,7 +98,8 @@ abstract class EpisodesDao : EntityDao() { LIMIT 1 """ - const val nextEpisodeForShowIdAfter = """ + const val nextEpisodeForShowIdAfter = + """ SELECT eps.*, (1000 * s.number) + eps.number AS computed_abs_number FROM shows INNER JOIN seasons AS s ON shows.id = s.show_id @@ -108,7 +112,8 @@ abstract class EpisodesDao : EntityDao() { LIMIT 1 """ - const val nextAiredEpisodeForShowIdAfter = """ + const val nextAiredEpisodeForShowIdAfter = + """ SELECT eps.*, (1000 * s.number) + eps.number AS computed_abs_number FROM shows INNER JOIN seasons AS s ON shows.id = s.show_id diff --git a/data/src/main/java/app/tivi/data/daos/FollowedShowsDao.kt b/data/src/main/java/app/tivi/data/daos/FollowedShowsDao.kt index 03c75c978b..ad222d4a82 100644 --- a/data/src/main/java/app/tivi/data/daos/FollowedShowsDao.kt +++ b/data/src/main/java/app/tivi/data/daos/FollowedShowsDao.kt @@ -65,7 +65,8 @@ abstract class FollowedShowsDao : EntryDao @Transaction - @Query(""" + @Query( + """ SELECT myshows_entries.* FROM myshows_entries INNER JOIN seasons AS s ON s.show_id = myshows_entries.show_id INNER JOIN followed_next_to_watch AS next ON next.id = myshows_entries.id @@ -74,7 +75,8 @@ abstract class FollowedShowsDao : EntryDao @Query("DELETE FROM myshows_entries") @@ -94,11 +96,13 @@ abstract class FollowedShowsDao : EntryDao suspend fun entriesWithNoPendingAction() = entriesWithPendingAction(PendingAction.NOTHING.value) @@ -117,7 +121,8 @@ abstract class FollowedShowsDao : EntryDao): Int companion object { - private const val ENTRY_QUERY_SUPER_SORT = """ + private const val ENTRY_QUERY_SUPER_SORT = + """ SELECT fs.* FROM myshows_entries as fs INNER JOIN seasons AS s ON fs.show_id = s.show_id INNER JOIN episodes AS eps ON eps.season_id = s.id @@ -137,7 +142,8 @@ abstract class FollowedShowsDao : EntryDao() { @Query("SELECT * FROM seasons WHERE trakt_id = :traktId") abstract suspend fun seasonWithTraktId(traktId: Int): Season? - @Query(""" + @Query( + """ SELECT id from seasons WHERE show_id = (SELECT show_id from SEASONS WHERE id = :seasonId) AND number != $NUMBER_SPECIALS AND number < (SELECT number from SEASONS WHERE id = :seasonId) - """) + """ + ) abstract suspend fun showPreviousSeasonIds(seasonId: Long): LongArray @Query("UPDATE seasons SET ignored = :ignored WHERE id = :seasonId") diff --git a/data/src/main/java/app/tivi/data/daos/ShowFtsDao.kt b/data/src/main/java/app/tivi/data/daos/ShowFtsDao.kt index 27f5e88ead..6e13180cd2 100644 --- a/data/src/main/java/app/tivi/data/daos/ShowFtsDao.kt +++ b/data/src/main/java/app/tivi/data/daos/ShowFtsDao.kt @@ -24,7 +24,8 @@ import app.tivi.data.resultentities.ShowDetailed @Dao abstract class ShowFtsDao { @Transaction - @Query(""" + @Query( + """ SELECT s.* FROM shows as s INNER JOIN shows_fts AS fts ON s.id = fts.docid WHERE fts.title MATCH :filter diff --git a/data/src/main/java/app/tivi/data/daos/WatchedShowDao.kt b/data/src/main/java/app/tivi/data/daos/WatchedShowDao.kt index 2c299a7d59..4639f7bd1b 100644 --- a/data/src/main/java/app/tivi/data/daos/WatchedShowDao.kt +++ b/data/src/main/java/app/tivi/data/daos/WatchedShowDao.kt @@ -83,25 +83,29 @@ abstract class WatchedShowDao : EntryDao { diff --git a/data/src/main/java/app/tivi/data/mappers/TraktSeasonToSeason.kt b/data/src/main/java/app/tivi/data/mappers/TraktSeasonToSeason.kt index 368f71b613..a8da7a4dd4 100644 --- a/data/src/main/java/app/tivi/data/mappers/TraktSeasonToSeason.kt +++ b/data/src/main/java/app/tivi/data/mappers/TraktSeasonToSeason.kt @@ -17,9 +17,9 @@ package app.tivi.data.mappers import app.tivi.data.entities.Season -import com.uwetrottmann.trakt5.entities.Season as TraktSeason import javax.inject.Inject import javax.inject.Singleton +import com.uwetrottmann.trakt5.entities.Season as TraktSeason @Singleton class TraktSeasonToSeason @Inject constructor() : Mapper { diff --git a/data/src/main/java/app/tivi/data/mappers/TraktSeasonToSeasonWithEpisodes.kt b/data/src/main/java/app/tivi/data/mappers/TraktSeasonToSeasonWithEpisodes.kt index 060b2e0f16..745346a00a 100644 --- a/data/src/main/java/app/tivi/data/mappers/TraktSeasonToSeasonWithEpisodes.kt +++ b/data/src/main/java/app/tivi/data/mappers/TraktSeasonToSeasonWithEpisodes.kt @@ -18,9 +18,9 @@ package app.tivi.data.mappers import app.tivi.data.entities.Episode import app.tivi.data.entities.Season -import com.uwetrottmann.trakt5.entities.Season as TraktSeason import javax.inject.Inject import javax.inject.Singleton +import com.uwetrottmann.trakt5.entities.Season as TraktSeason @Singleton class TraktSeasonToSeasonWithEpisodes @Inject constructor( diff --git a/data/src/main/java/app/tivi/data/mappers/TraktShowToTiviShow.kt b/data/src/main/java/app/tivi/data/mappers/TraktShowToTiviShow.kt index 823225ad99..742f1e685c 100644 --- a/data/src/main/java/app/tivi/data/mappers/TraktShowToTiviShow.kt +++ b/data/src/main/java/app/tivi/data/mappers/TraktShowToTiviShow.kt @@ -18,13 +18,13 @@ package app.tivi.data.mappers import app.tivi.data.entities.TiviShow import com.uwetrottmann.trakt5.entities.Show -import java.util.Locale -import javax.inject.Inject -import javax.inject.Singleton import org.threeten.bp.DayOfWeek import org.threeten.bp.LocalTime import org.threeten.bp.ZoneId import org.threeten.bp.format.TextStyle +import java.util.Locale +import javax.inject.Inject +import javax.inject.Singleton @Singleton class TraktShowToTiviShow @Inject constructor( diff --git a/data/src/main/java/app/tivi/data/repositories/episodes/EpisodeWatchStore.kt b/data/src/main/java/app/tivi/data/repositories/episodes/EpisodeWatchStore.kt index 0b5e0036ce..1b0192d79a 100644 --- a/data/src/main/java/app/tivi/data/repositories/episodes/EpisodeWatchStore.kt +++ b/data/src/main/java/app/tivi/data/repositories/episodes/EpisodeWatchStore.kt @@ -22,8 +22,8 @@ import app.tivi.data.entities.EpisodeWatchEntry import app.tivi.data.entities.PendingAction import app.tivi.data.syncers.syncerForEntity import app.tivi.util.Logger -import javax.inject.Inject import kotlinx.coroutines.flow.Flow +import javax.inject.Inject class EpisodeWatchStore @Inject constructor( private val transactionRunner: DatabaseTransactionRunner, diff --git a/data/src/main/java/app/tivi/data/repositories/episodes/SeasonsEpisodesRepository.kt b/data/src/main/java/app/tivi/data/repositories/episodes/SeasonsEpisodesRepository.kt index 28a5fbd4ca..fa18995cb5 100644 --- a/data/src/main/java/app/tivi/data/repositories/episodes/SeasonsEpisodesRepository.kt +++ b/data/src/main/java/app/tivi/data/repositories/episodes/SeasonsEpisodesRepository.kt @@ -30,12 +30,12 @@ import app.tivi.extensions.asyncOrAwait import app.tivi.inject.Tmdb import app.tivi.inject.Trakt import app.tivi.trakt.TraktAuthState -import javax.inject.Inject -import javax.inject.Provider -import javax.inject.Singleton import kotlinx.coroutines.async import org.threeten.bp.Instant import org.threeten.bp.OffsetDateTime +import javax.inject.Inject +import javax.inject.Provider +import javax.inject.Singleton @Singleton class SeasonsEpisodesRepository @Inject constructor( @@ -253,7 +253,8 @@ class SeasonsEpisodesRepository @Inject constructor( if (watchesForEpisode.isNotEmpty()) { // First mark them as pending deletion episodeWatchStore.updateEntriesWithAction( - watchesForEpisode.map { it.id }, PendingAction.DELETE) + watchesForEpisode.map { it.id }, PendingAction.DELETE + ) syncEpisodeWatches(episodeId) } } diff --git a/data/src/main/java/app/tivi/data/repositories/episodes/SeasonsEpisodesStore.kt b/data/src/main/java/app/tivi/data/repositories/episodes/SeasonsEpisodesStore.kt index 4d900d4bf9..c694fd4738 100644 --- a/data/src/main/java/app/tivi/data/repositories/episodes/SeasonsEpisodesStore.kt +++ b/data/src/main/java/app/tivi/data/repositories/episodes/SeasonsEpisodesStore.kt @@ -25,9 +25,9 @@ import app.tivi.data.resultentities.EpisodeWithSeason import app.tivi.data.resultentities.SeasonWithEpisodesAndWatches import app.tivi.data.syncers.syncerForEntity import app.tivi.util.Logger -import javax.inject.Inject import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.flatMapLatest +import javax.inject.Inject class SeasonsEpisodesStore @Inject constructor( private val transactionRunner: DatabaseTransactionRunner, diff --git a/data/src/main/java/app/tivi/data/repositories/episodes/TraktSeasonsEpisodesDataSource.kt b/data/src/main/java/app/tivi/data/repositories/episodes/TraktSeasonsEpisodesDataSource.kt index 1e8f61f53d..df81323209 100644 --- a/data/src/main/java/app/tivi/data/repositories/episodes/TraktSeasonsEpisodesDataSource.kt +++ b/data/src/main/java/app/tivi/data/repositories/episodes/TraktSeasonsEpisodesDataSource.kt @@ -41,11 +41,11 @@ import com.uwetrottmann.trakt5.enums.HistoryType import com.uwetrottmann.trakt5.services.Seasons import com.uwetrottmann.trakt5.services.Sync import com.uwetrottmann.trakt5.services.Users +import org.threeten.bp.OffsetDateTime +import org.threeten.bp.ZoneOffset import java.lang.IllegalArgumentException import javax.inject.Inject import javax.inject.Provider -import org.threeten.bp.OffsetDateTime -import org.threeten.bp.ZoneOffset class TraktSeasonsEpisodesDataSource @Inject constructor( private val showIdToTraktIdMapper: ShowIdToTraktIdMapper, @@ -71,8 +71,10 @@ class TraktSeasonsEpisodesDataSource @Inject constructor( val showTraktId = showIdToTraktIdMapper.map(showId) ?: return ErrorResult(IllegalArgumentException("No Trakt ID for show with ID: $showId")) - return usersService.get().history(UserSlug.ME, HistoryType.SHOWS, showTraktId, - 0, 10000, Extended.NOSEASONS, since, null) + return usersService.get().history( + UserSlug.ME, HistoryType.SHOWS, showTraktId, + 0, 10000, Extended.NOSEASONS, since, null + ) .executeWithRetry() .toResult(pairMapperOf(episodeMapper, historyItemMapper)) } @@ -81,8 +83,10 @@ class TraktSeasonsEpisodesDataSource @Inject constructor( seasonId: Long, since: OffsetDateTime? ): Result>> { - return usersService.get().history(UserSlug.ME, HistoryType.SEASONS, seasonIdToTraktIdMapper.map(seasonId), - 0, 10000, Extended.NOSEASONS, since, null) + return usersService.get().history( + UserSlug.ME, HistoryType.SEASONS, seasonIdToTraktIdMapper.map(seasonId), + 0, 10000, Extended.NOSEASONS, since, null + ) .executeWithRetry() .toResult(pairMapperOf(episodeMapper, historyItemMapper)) } diff --git a/data/src/main/java/app/tivi/data/repositories/followedshows/FollowedShowsRepository.kt b/data/src/main/java/app/tivi/data/repositories/followedshows/FollowedShowsRepository.kt index e8433aad03..654836d062 100644 --- a/data/src/main/java/app/tivi/data/repositories/followedshows/FollowedShowsRepository.kt +++ b/data/src/main/java/app/tivi/data/repositories/followedshows/FollowedShowsRepository.kt @@ -26,11 +26,11 @@ import app.tivi.data.syncers.ItemSyncerResult import app.tivi.extensions.asyncOrAwait import app.tivi.trakt.TraktAuthState import app.tivi.util.Logger +import org.threeten.bp.Instant +import org.threeten.bp.OffsetDateTime import javax.inject.Inject import javax.inject.Provider import javax.inject.Singleton -import org.threeten.bp.Instant -import org.threeten.bp.OffsetDateTime @Singleton class FollowedShowsRepository @Inject constructor( diff --git a/data/src/main/java/app/tivi/data/repositories/followedshows/FollowedShowsStore.kt b/data/src/main/java/app/tivi/data/repositories/followedshows/FollowedShowsStore.kt index 4d663f645a..d9c00dbb6c 100644 --- a/data/src/main/java/app/tivi/data/repositories/followedshows/FollowedShowsStore.kt +++ b/data/src/main/java/app/tivi/data/repositories/followedshows/FollowedShowsStore.kt @@ -26,10 +26,10 @@ import app.tivi.data.resultentities.FollowedShowEntryWithShow import app.tivi.data.syncers.syncerForEntity import app.tivi.data.views.FollowedShowsWatchStats import app.tivi.util.Logger -import javax.inject.Inject -import javax.inject.Singleton import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.map +import javax.inject.Inject +import javax.inject.Singleton @Singleton class FollowedShowsStore @Inject constructor( diff --git a/data/src/main/java/app/tivi/data/repositories/followedshows/TraktFollowedShowsDataSource.kt b/data/src/main/java/app/tivi/data/repositories/followedshows/TraktFollowedShowsDataSource.kt index 5736da233c..cbd244e421 100644 --- a/data/src/main/java/app/tivi/data/repositories/followedshows/TraktFollowedShowsDataSource.kt +++ b/data/src/main/java/app/tivi/data/repositories/followedshows/TraktFollowedShowsDataSource.kt @@ -104,8 +104,10 @@ class TraktFollowedShowsDataSource @Inject constructor( } return try { - usersService.get().createList(UserSlug.ME, - TraktList().name(LIST_NAME).privacy(ListPrivacy.PRIVATE)) + usersService.get().createList( + UserSlug.ME, + TraktList().name(LIST_NAME).privacy(ListPrivacy.PRIVATE) + ) .executeWithRetry() .bodyOrThrow() .let { Success(it.ids.trakt) } diff --git a/data/src/main/java/app/tivi/data/repositories/popularshows/inject.kt b/data/src/main/java/app/tivi/data/repositories/popularshows/inject.kt index 62b319272c..553d8e54b8 100644 --- a/data/src/main/java/app/tivi/data/repositories/popularshows/inject.kt +++ b/data/src/main/java/app/tivi/data/repositories/popularshows/inject.kt @@ -25,8 +25,8 @@ import com.dropbox.android.external.store4.Store import com.dropbox.android.external.store4.StoreBuilder import dagger.Module import dagger.Provides -import javax.inject.Singleton import kotlinx.coroutines.CoroutineScope +import javax.inject.Singleton typealias PopularShowsStore = Store> diff --git a/data/src/main/java/app/tivi/data/repositories/recommendedshows/inject.kt b/data/src/main/java/app/tivi/data/repositories/recommendedshows/inject.kt index 51e70eedd8..f440f94ed5 100644 --- a/data/src/main/java/app/tivi/data/repositories/recommendedshows/inject.kt +++ b/data/src/main/java/app/tivi/data/repositories/recommendedshows/inject.kt @@ -25,8 +25,8 @@ import com.dropbox.android.external.store4.Store import com.dropbox.android.external.store4.StoreBuilder import dagger.Module import dagger.Provides -import javax.inject.Singleton import kotlinx.coroutines.CoroutineScope +import javax.inject.Singleton typealias RecommendedShowsStore = Store> diff --git a/data/src/main/java/app/tivi/data/repositories/relatedshows/inject.kt b/data/src/main/java/app/tivi/data/repositories/relatedshows/inject.kt index 1d1f5e39fe..7c13e7d3ae 100644 --- a/data/src/main/java/app/tivi/data/repositories/relatedshows/inject.kt +++ b/data/src/main/java/app/tivi/data/repositories/relatedshows/inject.kt @@ -25,8 +25,8 @@ import com.dropbox.android.external.store4.Store import com.dropbox.android.external.store4.StoreBuilder import dagger.Module import dagger.Provides -import javax.inject.Singleton import kotlinx.coroutines.CoroutineScope +import javax.inject.Singleton typealias RelatedShowsStore = Store> diff --git a/data/src/main/java/app/tivi/data/repositories/showimages/inject.kt b/data/src/main/java/app/tivi/data/repositories/showimages/inject.kt index 6dba786888..63e91182e2 100644 --- a/data/src/main/java/app/tivi/data/repositories/showimages/inject.kt +++ b/data/src/main/java/app/tivi/data/repositories/showimages/inject.kt @@ -28,8 +28,8 @@ import com.dropbox.android.external.store4.StoreBuilder import dagger.Binds import dagger.Module import dagger.Provides -import javax.inject.Singleton import kotlinx.coroutines.CoroutineScope +import javax.inject.Singleton @Module(includes = [ShowImagesModuleBinds::class, ShowImagesStoreModule::class]) class ShowsImagesModule diff --git a/data/src/main/java/app/tivi/data/repositories/shows/TraktShowDataSource.kt b/data/src/main/java/app/tivi/data/repositories/shows/TraktShowDataSource.kt index f080859208..4dfc143ea8 100644 --- a/data/src/main/java/app/tivi/data/repositories/shows/TraktShowDataSource.kt +++ b/data/src/main/java/app/tivi/data/repositories/shows/TraktShowDataSource.kt @@ -40,8 +40,10 @@ internal class TraktShowDataSource @Inject constructor( if (traktId == null && show.tmdbId != null) { // We need to fetch the search for the trakt id - val response = searchService.get().idLookup(IdType.TMDB, show.tmdbId.toString(), - Type.SHOW, Extended.NOSEASONS, 1, 1) + val response = searchService.get().idLookup( + IdType.TMDB, show.tmdbId.toString(), + Type.SHOW, Extended.NOSEASONS, 1, 1 + ) .execute() .toResult { it[0].show?.ids?.trakt } if (response is Success) { @@ -52,10 +54,12 @@ internal class TraktShowDataSource @Inject constructor( } if (traktId == null) { - val response = searchService.get().textQueryShow(show.title, null /* years */, null /* genres */, + val response = searchService.get().textQueryShow( + show.title, null /* years */, null /* genres */, null /* lang */, show.country /* countries */, null /* runtime */, null /* ratings */, null /* certs */, show.network /* networks */, null /* status */, - Extended.NOSEASONS, 1, 1) + Extended.NOSEASONS, 1, 1 + ) .execute() .toResult { it[0].show?.ids?.trakt } if (response is Success) { diff --git a/data/src/main/java/app/tivi/data/repositories/shows/inject.kt b/data/src/main/java/app/tivi/data/repositories/shows/inject.kt index a7981a77ed..8ce592c834 100644 --- a/data/src/main/java/app/tivi/data/repositories/shows/inject.kt +++ b/data/src/main/java/app/tivi/data/repositories/shows/inject.kt @@ -28,10 +28,10 @@ import com.dropbox.android.external.store4.StoreBuilder import dagger.Binds import dagger.Module import dagger.Provides -import javax.inject.Singleton import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.async import kotlinx.coroutines.coroutineScope +import javax.inject.Singleton @Module(includes = [ShowsModuleBinds::class, ShowStoreModule::class]) class ShowsModule diff --git a/data/src/main/java/app/tivi/data/repositories/traktusers/TraktUsersRepository.kt b/data/src/main/java/app/tivi/data/repositories/traktusers/TraktUsersRepository.kt index a23ac59d7a..ba1a0dbfc6 100644 --- a/data/src/main/java/app/tivi/data/repositories/traktusers/TraktUsersRepository.kt +++ b/data/src/main/java/app/tivi/data/repositories/traktusers/TraktUsersRepository.kt @@ -18,10 +18,10 @@ package app.tivi.data.repositories.traktusers import app.tivi.data.entities.Success import app.tivi.extensions.asyncOrAwait -import javax.inject.Inject -import javax.inject.Singleton import org.threeten.bp.Instant import org.threeten.bp.Period +import javax.inject.Inject +import javax.inject.Singleton @Singleton class TraktUsersRepository @Inject constructor( diff --git a/data/src/main/java/app/tivi/data/repositories/trendingshows/inject.kt b/data/src/main/java/app/tivi/data/repositories/trendingshows/inject.kt index 2af9384180..526330f027 100644 --- a/data/src/main/java/app/tivi/data/repositories/trendingshows/inject.kt +++ b/data/src/main/java/app/tivi/data/repositories/trendingshows/inject.kt @@ -25,8 +25,8 @@ import com.dropbox.android.external.store4.Store import com.dropbox.android.external.store4.StoreBuilder import dagger.Module import dagger.Provides -import javax.inject.Singleton import kotlinx.coroutines.CoroutineScope +import javax.inject.Singleton typealias TrendingShowsStore = Store> diff --git a/data/src/main/java/app/tivi/data/repositories/watchedshows/inject.kt b/data/src/main/java/app/tivi/data/repositories/watchedshows/inject.kt index 6704b22d27..7895a57e95 100644 --- a/data/src/main/java/app/tivi/data/repositories/watchedshows/inject.kt +++ b/data/src/main/java/app/tivi/data/repositories/watchedshows/inject.kt @@ -25,8 +25,8 @@ import com.dropbox.android.external.store4.Store import com.dropbox.android.external.store4.StoreBuilder import dagger.Module import dagger.Provides -import javax.inject.Singleton import kotlinx.coroutines.CoroutineScope +import javax.inject.Singleton typealias WatchedShowsStore = Store> diff --git a/data/src/main/java/app/tivi/data/resultentities/EpisodeWithWatches.kt b/data/src/main/java/app/tivi/data/resultentities/EpisodeWithWatches.kt index d23ebec78d..3e5eb08cc1 100644 --- a/data/src/main/java/app/tivi/data/resultentities/EpisodeWithWatches.kt +++ b/data/src/main/java/app/tivi/data/resultentities/EpisodeWithWatches.kt @@ -21,8 +21,8 @@ import androidx.room.Relation import app.tivi.data.entities.Episode import app.tivi.data.entities.EpisodeWatchEntry import app.tivi.data.entities.PendingAction -import java.util.Objects import org.threeten.bp.OffsetDateTime +import java.util.Objects class EpisodeWithWatches { @Embedded diff --git a/data/src/main/java/app/tivi/data/views/FollowedShowsLastWatched.kt b/data/src/main/java/app/tivi/data/views/FollowedShowsLastWatched.kt index 4e662e1938..ab302dccda 100644 --- a/data/src/main/java/app/tivi/data/views/FollowedShowsLastWatched.kt +++ b/data/src/main/java/app/tivi/data/views/FollowedShowsLastWatched.kt @@ -20,7 +20,9 @@ import androidx.room.DatabaseView import app.tivi.data.entities.Season import org.threeten.bp.OffsetDateTime -@DatabaseView(value = """ +@DatabaseView( + value = + """ SELECT fs.id, MAX(datetime(eps.first_aired)) as last_watched_air_date @@ -34,7 +36,9 @@ WHERE AND s.ignored = 0 GROUP BY fs.id -""", viewName = "followed_last_watched_airdate") +""", + viewName = "followed_last_watched_airdate" +) data class FollowedShowsLastWatched( val id: Long, val lastWatchedEpisodeAirDate: OffsetDateTime? diff --git a/data/src/main/java/app/tivi/data/views/FollowedShowsNextToWatch.kt b/data/src/main/java/app/tivi/data/views/FollowedShowsNextToWatch.kt index 5de4633299..3eb50834eb 100644 --- a/data/src/main/java/app/tivi/data/views/FollowedShowsNextToWatch.kt +++ b/data/src/main/java/app/tivi/data/views/FollowedShowsNextToWatch.kt @@ -20,7 +20,9 @@ import androidx.room.DatabaseView import app.tivi.data.entities.Season import org.threeten.bp.OffsetDateTime -@DatabaseView(value = """ +@DatabaseView( + value = + """ SELECT fs.id, MIN(datetime(eps.first_aired)) AS next_ep_to_watch_air_date @@ -38,7 +40,9 @@ WHERE AND datetime(first_aired) > datetime(last_watched_air_date) GROUP BY fs.id -""", viewName = "followed_next_to_watch") +""", + viewName = "followed_next_to_watch" +) data class FollowedShowsNextToWatch( val id: Long, val nextEpisodeToWatchAirDate: OffsetDateTime? diff --git a/data/src/main/java/app/tivi/data/views/FollowedShowsWatchStats.kt b/data/src/main/java/app/tivi/data/views/FollowedShowsWatchStats.kt index c4ce8b3a22..4b444ba979 100644 --- a/data/src/main/java/app/tivi/data/views/FollowedShowsWatchStats.kt +++ b/data/src/main/java/app/tivi/data/views/FollowedShowsWatchStats.kt @@ -19,7 +19,8 @@ package app.tivi.data.views import androidx.room.DatabaseView import app.tivi.data.entities.Season -@DatabaseView(""" +@DatabaseView( + """ SELECT fs.id, COUNT(*) as episodeCount, COUNT(ew.watched_at) as watchedEpisodeCount FROM myshows_entries as fs INNER JOIN seasons AS s ON fs.show_id = s.show_id @@ -30,7 +31,8 @@ import app.tivi.data.entities.Season AND s.number != ${Season.NUMBER_SPECIALS} AND s.ignored = 0 GROUP BY fs.id -""") +""" +) data class FollowedShowsWatchStats( val id: Long, val episodeCount: Int, diff --git a/domain/src/main/java/app/tivi/domain/Interactor.kt b/domain/src/main/java/app/tivi/domain/Interactor.kt index 929b487ce3..0fb016e530 100644 --- a/domain/src/main/java/app/tivi/domain/Interactor.kt +++ b/domain/src/main/java/app/tivi/domain/Interactor.kt @@ -22,7 +22,6 @@ import app.tivi.base.InvokeIdle import app.tivi.base.InvokeStarted import app.tivi.base.InvokeStatus import app.tivi.base.InvokeSuccess -import java.util.concurrent.TimeUnit import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.TimeoutCancellationException @@ -35,6 +34,7 @@ import kotlinx.coroutines.flow.flatMapLatest import kotlinx.coroutines.launch import kotlinx.coroutines.withContext import kotlinx.coroutines.withTimeout +import java.util.concurrent.TimeUnit abstract class Interactor { protected abstract val scope: CoroutineScope diff --git a/domain/src/main/java/app/tivi/domain/interactors/AddEpisodeWatch.kt b/domain/src/main/java/app/tivi/domain/interactors/AddEpisodeWatch.kt index f9df1fd01c..616490fede 100644 --- a/domain/src/main/java/app/tivi/domain/interactors/AddEpisodeWatch.kt +++ b/domain/src/main/java/app/tivi/domain/interactors/AddEpisodeWatch.kt @@ -20,10 +20,10 @@ import app.tivi.data.repositories.episodes.SeasonsEpisodesRepository import app.tivi.domain.Interactor import app.tivi.inject.ProcessLifetime import app.tivi.util.AppCoroutineDispatchers -import javax.inject.Inject import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.plus import org.threeten.bp.OffsetDateTime +import javax.inject.Inject class AddEpisodeWatch @Inject constructor( private val seasonsEpisodesRepository: SeasonsEpisodesRepository, diff --git a/domain/src/main/java/app/tivi/domain/interactors/ChangeSeasonFollowStatus.kt b/domain/src/main/java/app/tivi/domain/interactors/ChangeSeasonFollowStatus.kt index eb2340e5a2..a5727ede09 100644 --- a/domain/src/main/java/app/tivi/domain/interactors/ChangeSeasonFollowStatus.kt +++ b/domain/src/main/java/app/tivi/domain/interactors/ChangeSeasonFollowStatus.kt @@ -20,9 +20,9 @@ import app.tivi.data.repositories.episodes.SeasonsEpisodesRepository import app.tivi.domain.Interactor import app.tivi.inject.ProcessLifetime import app.tivi.util.AppCoroutineDispatchers -import javax.inject.Inject import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.plus +import javax.inject.Inject class ChangeSeasonFollowStatus @Inject constructor( private val seasonsEpisodesRepository: SeasonsEpisodesRepository, diff --git a/domain/src/main/java/app/tivi/domain/interactors/ChangeSeasonWatchedStatus.kt b/domain/src/main/java/app/tivi/domain/interactors/ChangeSeasonWatchedStatus.kt index 22cbce07e7..23921ce961 100644 --- a/domain/src/main/java/app/tivi/domain/interactors/ChangeSeasonWatchedStatus.kt +++ b/domain/src/main/java/app/tivi/domain/interactors/ChangeSeasonWatchedStatus.kt @@ -21,9 +21,9 @@ import app.tivi.data.repositories.episodes.SeasonsEpisodesRepository import app.tivi.domain.Interactor import app.tivi.inject.ProcessLifetime import app.tivi.util.AppCoroutineDispatchers -import javax.inject.Inject import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.plus +import javax.inject.Inject class ChangeSeasonWatchedStatus @Inject constructor( private val seasonsEpisodesRepository: SeasonsEpisodesRepository, diff --git a/domain/src/main/java/app/tivi/domain/interactors/ChangeShowFollowStatus.kt b/domain/src/main/java/app/tivi/domain/interactors/ChangeShowFollowStatus.kt index 07b8ce0886..ce018fe1aa 100644 --- a/domain/src/main/java/app/tivi/domain/interactors/ChangeShowFollowStatus.kt +++ b/domain/src/main/java/app/tivi/domain/interactors/ChangeShowFollowStatus.kt @@ -26,9 +26,9 @@ import app.tivi.data.repositories.shows.ShowStore import app.tivi.domain.Interactor import app.tivi.inject.ProcessLifetime import app.tivi.util.AppCoroutineDispatchers -import javax.inject.Inject import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.plus +import javax.inject.Inject class ChangeShowFollowStatus @Inject constructor( private val followedShowsRepository: FollowedShowsRepository, diff --git a/domain/src/main/java/app/tivi/domain/interactors/DeleteFolder.kt b/domain/src/main/java/app/tivi/domain/interactors/DeleteFolder.kt index 8f3f8720b9..16712c383b 100644 --- a/domain/src/main/java/app/tivi/domain/interactors/DeleteFolder.kt +++ b/domain/src/main/java/app/tivi/domain/interactors/DeleteFolder.kt @@ -19,10 +19,10 @@ package app.tivi.domain.interactors import app.tivi.domain.Interactor import app.tivi.inject.ProcessLifetime import app.tivi.util.AppCoroutineDispatchers -import java.io.File -import javax.inject.Inject import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.plus +import java.io.File +import javax.inject.Inject class DeleteFolder @Inject constructor( dispatchers: AppCoroutineDispatchers, diff --git a/domain/src/main/java/app/tivi/domain/interactors/GetEpisodeDetails.kt b/domain/src/main/java/app/tivi/domain/interactors/GetEpisodeDetails.kt index b975da0bd4..dece960fba 100644 --- a/domain/src/main/java/app/tivi/domain/interactors/GetEpisodeDetails.kt +++ b/domain/src/main/java/app/tivi/domain/interactors/GetEpisodeDetails.kt @@ -20,8 +20,8 @@ import app.tivi.data.entities.Episode import app.tivi.data.repositories.episodes.SeasonsEpisodesRepository import app.tivi.domain.ResultInteractor import app.tivi.util.AppCoroutineDispatchers -import javax.inject.Inject import kotlinx.coroutines.CoroutineDispatcher +import javax.inject.Inject class GetEpisodeDetails @Inject constructor( private val seasonsEpisodesRepository: SeasonsEpisodesRepository, diff --git a/domain/src/main/java/app/tivi/domain/interactors/RemoveEpisodeWatch.kt b/domain/src/main/java/app/tivi/domain/interactors/RemoveEpisodeWatch.kt index 2eea95e8c8..1b2bc50e4e 100644 --- a/domain/src/main/java/app/tivi/domain/interactors/RemoveEpisodeWatch.kt +++ b/domain/src/main/java/app/tivi/domain/interactors/RemoveEpisodeWatch.kt @@ -20,9 +20,9 @@ import app.tivi.data.repositories.episodes.SeasonsEpisodesRepository import app.tivi.domain.Interactor import app.tivi.inject.ProcessLifetime import app.tivi.util.AppCoroutineDispatchers -import javax.inject.Inject import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.plus +import javax.inject.Inject class RemoveEpisodeWatch @Inject constructor( private val seasonsEpisodesRepository: SeasonsEpisodesRepository, diff --git a/domain/src/main/java/app/tivi/domain/interactors/RemoveEpisodeWatches.kt b/domain/src/main/java/app/tivi/domain/interactors/RemoveEpisodeWatches.kt index 2e84b8f8ad..2ad5a6d8cf 100644 --- a/domain/src/main/java/app/tivi/domain/interactors/RemoveEpisodeWatches.kt +++ b/domain/src/main/java/app/tivi/domain/interactors/RemoveEpisodeWatches.kt @@ -20,9 +20,9 @@ import app.tivi.data.repositories.episodes.SeasonsEpisodesRepository import app.tivi.domain.Interactor import app.tivi.inject.ProcessLifetime import app.tivi.util.AppCoroutineDispatchers -import javax.inject.Inject import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.plus +import javax.inject.Inject class RemoveEpisodeWatches @Inject constructor( private val seasonsEpisodesRepository: SeasonsEpisodesRepository, diff --git a/domain/src/main/java/app/tivi/domain/interactors/SearchShows.kt b/domain/src/main/java/app/tivi/domain/interactors/SearchShows.kt index 9248f247b8..e8138dab84 100644 --- a/domain/src/main/java/app/tivi/domain/interactors/SearchShows.kt +++ b/domain/src/main/java/app/tivi/domain/interactors/SearchShows.kt @@ -21,8 +21,8 @@ import app.tivi.data.entities.SearchResults import app.tivi.data.repositories.search.SearchRepository import app.tivi.domain.SuspendingWorkInteractor import app.tivi.util.AppCoroutineDispatchers -import javax.inject.Inject import kotlinx.coroutines.CoroutineDispatcher +import javax.inject.Inject class SearchShows @Inject constructor( private val searchRepository: SearchRepository, @@ -35,10 +35,13 @@ class SearchShows @Inject constructor( val remoteResults = searchRepository.search(params.query) return when { remoteResults.isNotEmpty() -> SearchResults(params.query, remoteResults) - else -> SearchResults(params.query, when { - params.query.isNotBlank() -> showFtsDao.search("*$params.query*") - else -> emptyList() - }) + else -> SearchResults( + params.query, + when { + params.query.isNotBlank() -> showFtsDao.search("*$params.query*") + else -> emptyList() + } + ) } } diff --git a/domain/src/main/java/app/tivi/domain/interactors/UpdateEpisodeDetails.kt b/domain/src/main/java/app/tivi/domain/interactors/UpdateEpisodeDetails.kt index ff0f54984d..6a6be22d5e 100644 --- a/domain/src/main/java/app/tivi/domain/interactors/UpdateEpisodeDetails.kt +++ b/domain/src/main/java/app/tivi/domain/interactors/UpdateEpisodeDetails.kt @@ -20,9 +20,9 @@ import app.tivi.data.repositories.episodes.SeasonsEpisodesRepository import app.tivi.domain.Interactor import app.tivi.inject.ProcessLifetime import app.tivi.util.AppCoroutineDispatchers -import javax.inject.Inject import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.plus +import javax.inject.Inject class UpdateEpisodeDetails @Inject constructor( private val seasonsEpisodesRepository: SeasonsEpisodesRepository, diff --git a/domain/src/main/java/app/tivi/domain/interactors/UpdateFollowedShows.kt b/domain/src/main/java/app/tivi/domain/interactors/UpdateFollowedShows.kt index 351fb61e21..c8cc253895 100644 --- a/domain/src/main/java/app/tivi/domain/interactors/UpdateFollowedShows.kt +++ b/domain/src/main/java/app/tivi/domain/interactors/UpdateFollowedShows.kt @@ -28,10 +28,10 @@ import app.tivi.domain.Interactor import app.tivi.extensions.parallelForEach import app.tivi.inject.ProcessLifetime import app.tivi.util.AppCoroutineDispatchers -import javax.inject.Inject import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.coroutineScope import kotlinx.coroutines.plus +import javax.inject.Inject class UpdateFollowedShows @Inject constructor( private val followedShowsRepository: FollowedShowsRepository, diff --git a/domain/src/main/java/app/tivi/domain/interactors/UpdatePopularShows.kt b/domain/src/main/java/app/tivi/domain/interactors/UpdatePopularShows.kt index 575ef7a324..0a0f147c27 100644 --- a/domain/src/main/java/app/tivi/domain/interactors/UpdatePopularShows.kt +++ b/domain/src/main/java/app/tivi/domain/interactors/UpdatePopularShows.kt @@ -28,10 +28,10 @@ import app.tivi.domain.interactors.UpdatePopularShows.Params import app.tivi.extensions.parallelForEach import app.tivi.inject.ProcessLifetime import app.tivi.util.AppCoroutineDispatchers -import javax.inject.Inject import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.plus import org.threeten.bp.Period +import javax.inject.Inject class UpdatePopularShows @Inject constructor( private val popularShowStore: PopularShowsStore, diff --git a/domain/src/main/java/app/tivi/domain/interactors/UpdateRecommendedShows.kt b/domain/src/main/java/app/tivi/domain/interactors/UpdateRecommendedShows.kt index 2901da6b89..18dcca7c77 100644 --- a/domain/src/main/java/app/tivi/domain/interactors/UpdateRecommendedShows.kt +++ b/domain/src/main/java/app/tivi/domain/interactors/UpdateRecommendedShows.kt @@ -28,11 +28,11 @@ import app.tivi.inject.ProcessLifetime import app.tivi.trakt.TraktAuthState import app.tivi.trakt.TraktManager import app.tivi.util.AppCoroutineDispatchers -import javax.inject.Inject import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.flow.first import kotlinx.coroutines.plus import org.threeten.bp.Duration +import javax.inject.Inject class UpdateRecommendedShows @Inject constructor( private val recommendedShowsStore: RecommendedShowsStore, diff --git a/domain/src/main/java/app/tivi/domain/interactors/UpdateRelatedShows.kt b/domain/src/main/java/app/tivi/domain/interactors/UpdateRelatedShows.kt index fe9d8559cd..389b96b868 100644 --- a/domain/src/main/java/app/tivi/domain/interactors/UpdateRelatedShows.kt +++ b/domain/src/main/java/app/tivi/domain/interactors/UpdateRelatedShows.kt @@ -27,10 +27,10 @@ import app.tivi.domain.interactors.UpdateRelatedShows.Params import app.tivi.extensions.parallelForEach import app.tivi.inject.ProcessLifetime import app.tivi.util.AppCoroutineDispatchers -import javax.inject.Inject import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.plus import org.threeten.bp.Period +import javax.inject.Inject class UpdateRelatedShows @Inject constructor( private val relatedShowsStore: RelatedShowsStore, diff --git a/domain/src/main/java/app/tivi/domain/interactors/UpdateShowDetails.kt b/domain/src/main/java/app/tivi/domain/interactors/UpdateShowDetails.kt index bbfa2784de..a920f5ae08 100644 --- a/domain/src/main/java/app/tivi/domain/interactors/UpdateShowDetails.kt +++ b/domain/src/main/java/app/tivi/domain/interactors/UpdateShowDetails.kt @@ -23,10 +23,10 @@ import app.tivi.domain.Interactor import app.tivi.domain.interactors.UpdateShowDetails.Params import app.tivi.inject.ProcessLifetime import app.tivi.util.AppCoroutineDispatchers -import javax.inject.Inject import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.plus import org.threeten.bp.Period +import javax.inject.Inject class UpdateShowDetails @Inject constructor( private val showStore: ShowStore, diff --git a/domain/src/main/java/app/tivi/domain/interactors/UpdateShowImages.kt b/domain/src/main/java/app/tivi/domain/interactors/UpdateShowImages.kt index 6acfafd995..3f029884b7 100644 --- a/domain/src/main/java/app/tivi/domain/interactors/UpdateShowImages.kt +++ b/domain/src/main/java/app/tivi/domain/interactors/UpdateShowImages.kt @@ -22,10 +22,10 @@ import app.tivi.data.repositories.showimages.ShowImagesStore import app.tivi.domain.Interactor import app.tivi.inject.ProcessLifetime import app.tivi.util.AppCoroutineDispatchers -import javax.inject.Inject import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.plus import org.threeten.bp.Period +import javax.inject.Inject class UpdateShowImages @Inject constructor( private val showImagesStore: ShowImagesStore, diff --git a/domain/src/main/java/app/tivi/domain/interactors/UpdateShowSeasonData.kt b/domain/src/main/java/app/tivi/domain/interactors/UpdateShowSeasonData.kt index 2554e53b7a..b08ab8e2a3 100644 --- a/domain/src/main/java/app/tivi/domain/interactors/UpdateShowSeasonData.kt +++ b/domain/src/main/java/app/tivi/domain/interactors/UpdateShowSeasonData.kt @@ -22,9 +22,9 @@ import app.tivi.domain.Interactor import app.tivi.domain.interactors.UpdateShowSeasonData.Params import app.tivi.inject.ProcessLifetime import app.tivi.util.AppCoroutineDispatchers -import javax.inject.Inject import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.plus +import javax.inject.Inject class UpdateShowSeasonData @Inject constructor( private val seasonsEpisodesRepository: SeasonsEpisodesRepository, diff --git a/domain/src/main/java/app/tivi/domain/interactors/UpdateShowSeasons.kt b/domain/src/main/java/app/tivi/domain/interactors/UpdateShowSeasons.kt index be5284df4f..1b966c658d 100644 --- a/domain/src/main/java/app/tivi/domain/interactors/UpdateShowSeasons.kt +++ b/domain/src/main/java/app/tivi/domain/interactors/UpdateShowSeasons.kt @@ -21,9 +21,9 @@ import app.tivi.domain.Interactor import app.tivi.domain.interactors.UpdateShowSeasons.Params import app.tivi.inject.ProcessLifetime import app.tivi.util.AppCoroutineDispatchers -import javax.inject.Inject import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.plus +import javax.inject.Inject class UpdateShowSeasons @Inject constructor( private val seasonsEpisodesRepository: SeasonsEpisodesRepository, diff --git a/domain/src/main/java/app/tivi/domain/interactors/UpdateTmdbConfig.kt b/domain/src/main/java/app/tivi/domain/interactors/UpdateTmdbConfig.kt index d7beca6f29..5851d06696 100644 --- a/domain/src/main/java/app/tivi/domain/interactors/UpdateTmdbConfig.kt +++ b/domain/src/main/java/app/tivi/domain/interactors/UpdateTmdbConfig.kt @@ -20,9 +20,9 @@ import app.tivi.domain.Interactor import app.tivi.inject.ProcessLifetime import app.tivi.tmdb.TmdbManager import app.tivi.util.AppCoroutineDispatchers -import javax.inject.Inject import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.plus +import javax.inject.Inject class UpdateTmdbConfig @Inject constructor( private val tmdbManager: TmdbManager, diff --git a/domain/src/main/java/app/tivi/domain/interactors/UpdateTrendingShows.kt b/domain/src/main/java/app/tivi/domain/interactors/UpdateTrendingShows.kt index e7c7bdfe8c..b62245498b 100644 --- a/domain/src/main/java/app/tivi/domain/interactors/UpdateTrendingShows.kt +++ b/domain/src/main/java/app/tivi/domain/interactors/UpdateTrendingShows.kt @@ -28,10 +28,10 @@ import app.tivi.domain.interactors.UpdateTrendingShows.Params import app.tivi.extensions.parallelForEach import app.tivi.inject.ProcessLifetime import app.tivi.util.AppCoroutineDispatchers -import javax.inject.Inject import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.plus import org.threeten.bp.Duration +import javax.inject.Inject class UpdateTrendingShows @Inject constructor( private val trendingShowsStore: TrendingShowsStore, diff --git a/domain/src/main/java/app/tivi/domain/interactors/UpdateUserDetails.kt b/domain/src/main/java/app/tivi/domain/interactors/UpdateUserDetails.kt index 64c9e00547..2f89e6f915 100644 --- a/domain/src/main/java/app/tivi/domain/interactors/UpdateUserDetails.kt +++ b/domain/src/main/java/app/tivi/domain/interactors/UpdateUserDetails.kt @@ -21,9 +21,9 @@ import app.tivi.domain.Interactor import app.tivi.domain.interactors.UpdateUserDetails.Params import app.tivi.inject.ProcessLifetime import app.tivi.util.AppCoroutineDispatchers -import javax.inject.Inject import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.plus +import javax.inject.Inject class UpdateUserDetails @Inject constructor( private val repository: TraktUsersRepository, diff --git a/domain/src/main/java/app/tivi/domain/interactors/UpdateWatchedShows.kt b/domain/src/main/java/app/tivi/domain/interactors/UpdateWatchedShows.kt index b83587e9ed..cf226462bb 100644 --- a/domain/src/main/java/app/tivi/domain/interactors/UpdateWatchedShows.kt +++ b/domain/src/main/java/app/tivi/domain/interactors/UpdateWatchedShows.kt @@ -26,10 +26,10 @@ import app.tivi.domain.Interactor import app.tivi.extensions.parallelForEach import app.tivi.inject.ProcessLifetime import app.tivi.util.AppCoroutineDispatchers -import javax.inject.Inject import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.plus import org.threeten.bp.Duration +import javax.inject.Inject class UpdateWatchedShows @Inject constructor( private val watchedShowsStore: WatchedShowsStore, diff --git a/domain/src/main/java/app/tivi/domain/observers/ObserveEpisodeDetails.kt b/domain/src/main/java/app/tivi/domain/observers/ObserveEpisodeDetails.kt index a5a5058d4b..9610440030 100644 --- a/domain/src/main/java/app/tivi/domain/observers/ObserveEpisodeDetails.kt +++ b/domain/src/main/java/app/tivi/domain/observers/ObserveEpisodeDetails.kt @@ -20,9 +20,9 @@ import app.tivi.data.repositories.episodes.SeasonsEpisodesRepository import app.tivi.data.resultentities.EpisodeWithSeason import app.tivi.domain.SubjectInteractor import app.tivi.util.AppCoroutineDispatchers -import javax.inject.Inject import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.flow.Flow +import javax.inject.Inject class ObserveEpisodeDetails @Inject constructor( private val seasonsEpisodesRepository: SeasonsEpisodesRepository, diff --git a/domain/src/main/java/app/tivi/domain/observers/ObserveEpisodeWatches.kt b/domain/src/main/java/app/tivi/domain/observers/ObserveEpisodeWatches.kt index 5e1b315466..2e56de8dbb 100644 --- a/domain/src/main/java/app/tivi/domain/observers/ObserveEpisodeWatches.kt +++ b/domain/src/main/java/app/tivi/domain/observers/ObserveEpisodeWatches.kt @@ -20,9 +20,9 @@ import app.tivi.data.entities.EpisodeWatchEntry import app.tivi.data.repositories.episodes.SeasonsEpisodesRepository import app.tivi.domain.SubjectInteractor import app.tivi.util.AppCoroutineDispatchers -import javax.inject.Inject import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.flow.Flow +import javax.inject.Inject class ObserveEpisodeWatches @Inject constructor( private val seasonsEpisodesRepository: SeasonsEpisodesRepository, diff --git a/domain/src/main/java/app/tivi/domain/observers/ObserveNextShowEpisodeToWatch.kt b/domain/src/main/java/app/tivi/domain/observers/ObserveNextShowEpisodeToWatch.kt index 30c39f63d8..5c44aa2981 100644 --- a/domain/src/main/java/app/tivi/domain/observers/ObserveNextShowEpisodeToWatch.kt +++ b/domain/src/main/java/app/tivi/domain/observers/ObserveNextShowEpisodeToWatch.kt @@ -23,9 +23,9 @@ import app.tivi.domain.SubjectInteractor import app.tivi.extensions.flatMapLatestNullable import app.tivi.extensions.mapNullable import app.tivi.util.AppCoroutineDispatchers -import javax.inject.Inject import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.flow.Flow +import javax.inject.Inject class ObserveNextShowEpisodeToWatch @Inject constructor( private val followedShowsRepository: FollowedShowsRepository, diff --git a/domain/src/main/java/app/tivi/domain/observers/ObservePagedFollowedShows.kt b/domain/src/main/java/app/tivi/domain/observers/ObservePagedFollowedShows.kt index e9ef2fa2d0..2b2d7cb1fe 100644 --- a/domain/src/main/java/app/tivi/domain/observers/ObservePagedFollowedShows.kt +++ b/domain/src/main/java/app/tivi/domain/observers/ObservePagedFollowedShows.kt @@ -23,9 +23,9 @@ import app.tivi.data.repositories.followedshows.FollowedShowsRepository import app.tivi.data.resultentities.FollowedShowEntryWithShow import app.tivi.domain.PagingInteractor import app.tivi.util.AppCoroutineDispatchers -import javax.inject.Inject import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.flow.Flow +import javax.inject.Inject class ObservePagedFollowedShows @Inject constructor( dispatchers: AppCoroutineDispatchers, diff --git a/domain/src/main/java/app/tivi/domain/observers/ObservePagedPopularShows.kt b/domain/src/main/java/app/tivi/domain/observers/ObservePagedPopularShows.kt index a891f50b9e..d44b94cea6 100644 --- a/domain/src/main/java/app/tivi/domain/observers/ObservePagedPopularShows.kt +++ b/domain/src/main/java/app/tivi/domain/observers/ObservePagedPopularShows.kt @@ -22,9 +22,9 @@ import app.tivi.data.daos.PopularDao import app.tivi.data.resultentities.PopularEntryWithShow import app.tivi.domain.PagingInteractor import app.tivi.util.AppCoroutineDispatchers -import javax.inject.Inject import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.flow.Flow +import javax.inject.Inject class ObservePagedPopularShows @Inject constructor( dispatchers: AppCoroutineDispatchers, diff --git a/domain/src/main/java/app/tivi/domain/observers/ObservePagedRecommendedShows.kt b/domain/src/main/java/app/tivi/domain/observers/ObservePagedRecommendedShows.kt index ce521e0ee1..3297cc9b3c 100644 --- a/domain/src/main/java/app/tivi/domain/observers/ObservePagedRecommendedShows.kt +++ b/domain/src/main/java/app/tivi/domain/observers/ObservePagedRecommendedShows.kt @@ -22,9 +22,9 @@ import app.tivi.data.daos.RecommendedDao import app.tivi.data.resultentities.RecommendedEntryWithShow import app.tivi.domain.PagingInteractor import app.tivi.util.AppCoroutineDispatchers -import javax.inject.Inject import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.flow.Flow +import javax.inject.Inject class ObservePagedRecommendedShows @Inject constructor( dispatchers: AppCoroutineDispatchers, diff --git a/domain/src/main/java/app/tivi/domain/observers/ObservePagedTrendingShows.kt b/domain/src/main/java/app/tivi/domain/observers/ObservePagedTrendingShows.kt index 11ca52b04c..f6f49806d5 100644 --- a/domain/src/main/java/app/tivi/domain/observers/ObservePagedTrendingShows.kt +++ b/domain/src/main/java/app/tivi/domain/observers/ObservePagedTrendingShows.kt @@ -22,9 +22,9 @@ import app.tivi.data.daos.TrendingDao import app.tivi.data.resultentities.TrendingEntryWithShow import app.tivi.domain.PagingInteractor import app.tivi.util.AppCoroutineDispatchers -import javax.inject.Inject import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.flow.Flow +import javax.inject.Inject class ObservePagedTrendingShows @Inject constructor( dispatchers: AppCoroutineDispatchers, diff --git a/domain/src/main/java/app/tivi/domain/observers/ObservePagedWatchedShows.kt b/domain/src/main/java/app/tivi/domain/observers/ObservePagedWatchedShows.kt index 5a70f52766..05a74420f0 100644 --- a/domain/src/main/java/app/tivi/domain/observers/ObservePagedWatchedShows.kt +++ b/domain/src/main/java/app/tivi/domain/observers/ObservePagedWatchedShows.kt @@ -23,9 +23,9 @@ import app.tivi.data.entities.SortOption import app.tivi.data.resultentities.WatchedShowEntryWithShow import app.tivi.domain.PagingInteractor import app.tivi.util.AppCoroutineDispatchers -import javax.inject.Inject import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.flow.Flow +import javax.inject.Inject class ObservePagedWatchedShows @Inject constructor( dispatchers: AppCoroutineDispatchers, diff --git a/domain/src/main/java/app/tivi/domain/observers/ObservePopularShows.kt b/domain/src/main/java/app/tivi/domain/observers/ObservePopularShows.kt index 0b6574f764..4759b97e71 100644 --- a/domain/src/main/java/app/tivi/domain/observers/ObservePopularShows.kt +++ b/domain/src/main/java/app/tivi/domain/observers/ObservePopularShows.kt @@ -20,9 +20,9 @@ import app.tivi.data.daos.PopularDao import app.tivi.data.resultentities.PopularEntryWithShow import app.tivi.domain.SubjectInteractor import app.tivi.util.AppCoroutineDispatchers -import javax.inject.Inject import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.flow.Flow +import javax.inject.Inject class ObservePopularShows @Inject constructor( private val dispatchers: AppCoroutineDispatchers, diff --git a/domain/src/main/java/app/tivi/domain/observers/ObserveRecommendedShows.kt b/domain/src/main/java/app/tivi/domain/observers/ObserveRecommendedShows.kt index ca1b6a0a5f..4ac48cd246 100644 --- a/domain/src/main/java/app/tivi/domain/observers/ObserveRecommendedShows.kt +++ b/domain/src/main/java/app/tivi/domain/observers/ObserveRecommendedShows.kt @@ -20,9 +20,9 @@ import app.tivi.data.daos.RecommendedDao import app.tivi.data.resultentities.RecommendedEntryWithShow import app.tivi.domain.SubjectInteractor import app.tivi.util.AppCoroutineDispatchers -import javax.inject.Inject import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.flow.Flow +import javax.inject.Inject class ObserveRecommendedShows @Inject constructor( private val dispatchers: AppCoroutineDispatchers, diff --git a/domain/src/main/java/app/tivi/domain/observers/ObserveRelatedShows.kt b/domain/src/main/java/app/tivi/domain/observers/ObserveRelatedShows.kt index af21adac36..2032ab04b1 100644 --- a/domain/src/main/java/app/tivi/domain/observers/ObserveRelatedShows.kt +++ b/domain/src/main/java/app/tivi/domain/observers/ObserveRelatedShows.kt @@ -20,9 +20,9 @@ import app.tivi.data.daos.RelatedShowsDao import app.tivi.data.resultentities.RelatedShowEntryWithShow import app.tivi.domain.SubjectInteractor import app.tivi.util.AppCoroutineDispatchers -import javax.inject.Inject import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.flow.Flow +import javax.inject.Inject class ObserveRelatedShows @Inject constructor( private val dispatchers: AppCoroutineDispatchers, diff --git a/domain/src/main/java/app/tivi/domain/observers/ObserveShowDetails.kt b/domain/src/main/java/app/tivi/domain/observers/ObserveShowDetails.kt index 175348b3b4..c2239e3084 100644 --- a/domain/src/main/java/app/tivi/domain/observers/ObserveShowDetails.kt +++ b/domain/src/main/java/app/tivi/domain/observers/ObserveShowDetails.kt @@ -21,10 +21,10 @@ import app.tivi.data.repositories.shows.ShowStore import app.tivi.domain.SubjectInteractor import app.tivi.util.AppCoroutineDispatchers import com.dropbox.android.external.store4.StoreRequest -import javax.inject.Inject import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.map +import javax.inject.Inject class ObserveShowDetails @Inject constructor( private val showStore: ShowStore, diff --git a/domain/src/main/java/app/tivi/domain/observers/ObserveShowFollowStatus.kt b/domain/src/main/java/app/tivi/domain/observers/ObserveShowFollowStatus.kt index 23e43d3ee8..bedf670907 100644 --- a/domain/src/main/java/app/tivi/domain/observers/ObserveShowFollowStatus.kt +++ b/domain/src/main/java/app/tivi/domain/observers/ObserveShowFollowStatus.kt @@ -19,9 +19,9 @@ package app.tivi.domain.observers import app.tivi.data.repositories.followedshows.FollowedShowsRepository import app.tivi.domain.SubjectInteractor import app.tivi.util.AppCoroutineDispatchers -import javax.inject.Inject import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.flow.Flow +import javax.inject.Inject class ObserveShowFollowStatus @Inject constructor( private val dispatchers: AppCoroutineDispatchers, diff --git a/domain/src/main/java/app/tivi/domain/observers/ObserveShowImages.kt b/domain/src/main/java/app/tivi/domain/observers/ObserveShowImages.kt index 2cf5bd9af9..9d220e0f44 100644 --- a/domain/src/main/java/app/tivi/domain/observers/ObserveShowImages.kt +++ b/domain/src/main/java/app/tivi/domain/observers/ObserveShowImages.kt @@ -21,10 +21,10 @@ import app.tivi.data.repositories.showimages.ShowImagesStore import app.tivi.domain.SubjectInteractor import app.tivi.util.AppCoroutineDispatchers import com.dropbox.android.external.store4.StoreRequest -import javax.inject.Inject import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.map +import javax.inject.Inject class ObserveShowImages @Inject constructor( private val store: ShowImagesStore, diff --git a/domain/src/main/java/app/tivi/domain/observers/ObserveShowNextEpisodeToWatch.kt b/domain/src/main/java/app/tivi/domain/observers/ObserveShowNextEpisodeToWatch.kt index d4b73eb3f8..3ecc7ab0c9 100644 --- a/domain/src/main/java/app/tivi/domain/observers/ObserveShowNextEpisodeToWatch.kt +++ b/domain/src/main/java/app/tivi/domain/observers/ObserveShowNextEpisodeToWatch.kt @@ -20,8 +20,8 @@ import app.tivi.data.repositories.episodes.SeasonsEpisodesRepository import app.tivi.data.resultentities.EpisodeWithSeason import app.tivi.domain.SubjectInteractor import app.tivi.util.AppCoroutineDispatchers -import javax.inject.Inject import kotlinx.coroutines.flow.Flow +import javax.inject.Inject class ObserveShowNextEpisodeToWatch @Inject constructor( private val repository: SeasonsEpisodesRepository, diff --git a/domain/src/main/java/app/tivi/domain/observers/ObserveShowSeasonData.kt b/domain/src/main/java/app/tivi/domain/observers/ObserveShowSeasonData.kt index 181bce6554..8628a7324f 100644 --- a/domain/src/main/java/app/tivi/domain/observers/ObserveShowSeasonData.kt +++ b/domain/src/main/java/app/tivi/domain/observers/ObserveShowSeasonData.kt @@ -20,9 +20,9 @@ import app.tivi.data.repositories.episodes.SeasonsEpisodesRepository import app.tivi.data.resultentities.SeasonWithEpisodesAndWatches import app.tivi.domain.SubjectInteractor import app.tivi.util.AppCoroutineDispatchers -import javax.inject.Inject import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.flow.Flow +import javax.inject.Inject class ObserveShowSeasonData @Inject constructor( private val dispatchers: AppCoroutineDispatchers, diff --git a/domain/src/main/java/app/tivi/domain/observers/ObserveShowSeasons.kt b/domain/src/main/java/app/tivi/domain/observers/ObserveShowSeasons.kt index aebe987dc2..2c6c310e2d 100644 --- a/domain/src/main/java/app/tivi/domain/observers/ObserveShowSeasons.kt +++ b/domain/src/main/java/app/tivi/domain/observers/ObserveShowSeasons.kt @@ -20,9 +20,9 @@ import app.tivi.data.repositories.episodes.SeasonsEpisodesRepository import app.tivi.data.resultentities.SeasonWithEpisodesAndWatches import app.tivi.domain.SubjectInteractor import app.tivi.util.AppCoroutineDispatchers -import javax.inject.Inject import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.flow.Flow +import javax.inject.Inject class ObserveShowSeasons @Inject constructor( private val seasonsEpisodesRepository: SeasonsEpisodesRepository, diff --git a/domain/src/main/java/app/tivi/domain/observers/ObserveShowViewStats.kt b/domain/src/main/java/app/tivi/domain/observers/ObserveShowViewStats.kt index 6582ec74b7..3f3e3e41e5 100644 --- a/domain/src/main/java/app/tivi/domain/observers/ObserveShowViewStats.kt +++ b/domain/src/main/java/app/tivi/domain/observers/ObserveShowViewStats.kt @@ -20,8 +20,8 @@ import app.tivi.data.repositories.followedshows.FollowedShowsRepository import app.tivi.data.views.FollowedShowsWatchStats import app.tivi.domain.SubjectInteractor import app.tivi.util.AppCoroutineDispatchers -import javax.inject.Inject import kotlinx.coroutines.flow.Flow +import javax.inject.Inject class ObserveShowViewStats @Inject constructor( private val repository: FollowedShowsRepository, diff --git a/domain/src/main/java/app/tivi/domain/observers/ObserveTraktAuthState.kt b/domain/src/main/java/app/tivi/domain/observers/ObserveTraktAuthState.kt index 5a5dc74dd2..134f405c5f 100644 --- a/domain/src/main/java/app/tivi/domain/observers/ObserveTraktAuthState.kt +++ b/domain/src/main/java/app/tivi/domain/observers/ObserveTraktAuthState.kt @@ -20,9 +20,9 @@ import app.tivi.domain.SubjectInteractor import app.tivi.trakt.TraktAuthState import app.tivi.trakt.TraktManager import app.tivi.util.AppCoroutineDispatchers -import javax.inject.Inject import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.flow.Flow +import javax.inject.Inject class ObserveTraktAuthState @Inject constructor( dispatchers: AppCoroutineDispatchers, diff --git a/domain/src/main/java/app/tivi/domain/observers/ObserveTrendingShows.kt b/domain/src/main/java/app/tivi/domain/observers/ObserveTrendingShows.kt index 8d73771c93..d86cd5c534 100644 --- a/domain/src/main/java/app/tivi/domain/observers/ObserveTrendingShows.kt +++ b/domain/src/main/java/app/tivi/domain/observers/ObserveTrendingShows.kt @@ -20,9 +20,9 @@ import app.tivi.data.daos.TrendingDao import app.tivi.data.resultentities.TrendingEntryWithShow import app.tivi.domain.SubjectInteractor import app.tivi.util.AppCoroutineDispatchers -import javax.inject.Inject import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.flow.Flow +import javax.inject.Inject class ObserveTrendingShows @Inject constructor( private val dispatchers: AppCoroutineDispatchers, diff --git a/domain/src/main/java/app/tivi/domain/observers/ObserveUserDetails.kt b/domain/src/main/java/app/tivi/domain/observers/ObserveUserDetails.kt index a51ba0d136..0a8a316115 100644 --- a/domain/src/main/java/app/tivi/domain/observers/ObserveUserDetails.kt +++ b/domain/src/main/java/app/tivi/domain/observers/ObserveUserDetails.kt @@ -20,9 +20,9 @@ import app.tivi.data.entities.TraktUser import app.tivi.data.repositories.traktusers.TraktUsersRepository import app.tivi.domain.SubjectInteractor import app.tivi.util.AppCoroutineDispatchers -import javax.inject.Inject import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.flow.Flow +import javax.inject.Inject class ObserveUserDetails @Inject constructor( private val dispatchers: AppCoroutineDispatchers, diff --git a/tmdb/src/main/java/app/tivi/tmdb/TmdbManager.kt b/tmdb/src/main/java/app/tivi/tmdb/TmdbManager.kt index 51eecf26f7..0aa807a82a 100644 --- a/tmdb/src/main/java/app/tivi/tmdb/TmdbManager.kt +++ b/tmdb/src/main/java/app/tivi/tmdb/TmdbManager.kt @@ -21,14 +21,14 @@ import app.tivi.inject.ProcessLifetime import app.tivi.util.AppCoroutineDispatchers import com.uwetrottmann.tmdb2.Tmdb import com.uwetrottmann.tmdb2.entities.Configuration -import javax.inject.Inject -import javax.inject.Singleton import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.channels.ConflatedBroadcastChannel import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.asFlow import kotlinx.coroutines.launch import kotlinx.coroutines.withContext +import javax.inject.Inject +import javax.inject.Singleton @Singleton class TmdbManager @Inject constructor( diff --git a/tmdb/src/main/java/app/tivi/tmdb/TmdbModule.kt b/tmdb/src/main/java/app/tivi/tmdb/TmdbModule.kt index a642fcfb00..fd28ece60c 100644 --- a/tmdb/src/main/java/app/tivi/tmdb/TmdbModule.kt +++ b/tmdb/src/main/java/app/tivi/tmdb/TmdbModule.kt @@ -19,10 +19,10 @@ package app.tivi.tmdb import com.uwetrottmann.tmdb2.Tmdb import dagger.Module import dagger.Provides +import okhttp3.OkHttpClient import java.util.concurrent.TimeUnit import javax.inject.Named import javax.inject.Singleton -import okhttp3.OkHttpClient @Module class TmdbModule { diff --git a/trakt-auth/src/main/java/app/tivi/trakt/TraktAuthModule.kt b/trakt-auth/src/main/java/app/tivi/trakt/TraktAuthModule.kt index ccf8c8ce94..552790200d 100644 --- a/trakt-auth/src/main/java/app/tivi/trakt/TraktAuthModule.kt +++ b/trakt-auth/src/main/java/app/tivi/trakt/TraktAuthModule.kt @@ -23,8 +23,6 @@ import androidx.core.net.toUri import app.tivi.inject.ApplicationId import dagger.Module import dagger.Provides -import javax.inject.Named -import javax.inject.Singleton import kotlinx.coroutines.flow.first import kotlinx.coroutines.runBlocking import net.openid.appauth.AuthorizationRequest @@ -32,6 +30,8 @@ import net.openid.appauth.AuthorizationServiceConfiguration import net.openid.appauth.ClientAuthentication import net.openid.appauth.ClientSecretBasic import net.openid.appauth.ResponseTypeValues +import javax.inject.Named +import javax.inject.Singleton @Module class TraktAuthModule { @@ -41,7 +41,8 @@ class TraktAuthModule { return AuthorizationServiceConfiguration( Uri.parse("https://trakt.tv/oauth/authorize"), Uri.parse("https://trakt.tv/oauth/token"), - null) + null + ) } @Provides diff --git a/trakt-auth/src/main/java/app/tivi/trakt/TraktManager.kt b/trakt-auth/src/main/java/app/tivi/trakt/TraktManager.kt index 1863620e5a..7e16691d16 100644 --- a/trakt-auth/src/main/java/app/tivi/trakt/TraktManager.kt +++ b/trakt-auth/src/main/java/app/tivi/trakt/TraktManager.kt @@ -25,10 +25,6 @@ import app.tivi.util.AppCoroutineDispatchers import app.tivi.util.Logger import com.uwetrottmann.trakt5.TraktV2 import dagger.Lazy -import javax.inject.Inject -import javax.inject.Named -import javax.inject.Provider -import javax.inject.Singleton import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.channels.ConflatedBroadcastChannel import kotlinx.coroutines.flow.Flow @@ -43,6 +39,10 @@ import net.openid.appauth.AuthorizationResponse import net.openid.appauth.AuthorizationService import net.openid.appauth.ClientAuthentication import net.openid.appauth.TokenResponse +import javax.inject.Inject +import javax.inject.Named +import javax.inject.Provider +import javax.inject.Singleton @Singleton class TraktManager @Inject constructor( diff --git a/trakt/src/main/java/app/tivi/trakt/TraktModule.kt b/trakt/src/main/java/app/tivi/trakt/TraktModule.kt index e3e825bb34..86c420aa3e 100644 --- a/trakt/src/main/java/app/tivi/trakt/TraktModule.kt +++ b/trakt/src/main/java/app/tivi/trakt/TraktModule.kt @@ -19,10 +19,10 @@ package app.tivi.trakt import com.uwetrottmann.trakt5.TraktV2 import dagger.Module import dagger.Provides +import okhttp3.OkHttpClient import java.util.concurrent.TimeUnit import javax.inject.Named import javax.inject.Singleton -import okhttp3.OkHttpClient @Module(includes = [TraktServiceModule::class]) class TraktModule { diff --git a/ui-account-presenter/src/main/java/app/tivi/account/AccountUiViewModel.kt b/ui-account-presenter/src/main/java/app/tivi/account/AccountUiViewModel.kt index 52d4259e6b..b0e0e5a9ea 100644 --- a/ui-account-presenter/src/main/java/app/tivi/account/AccountUiViewModel.kt +++ b/ui-account-presenter/src/main/java/app/tivi/account/AccountUiViewModel.kt @@ -31,10 +31,10 @@ import com.airbnb.mvrx.MvRxViewModelFactory import com.airbnb.mvrx.ViewModelContext import com.squareup.inject.assisted.Assisted import com.squareup.inject.assisted.AssistedInject -import javax.inject.Provider import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.launch +import javax.inject.Provider class AccountUiViewModel @AssistedInject constructor( @Assisted initialState: AccountUiViewState, diff --git a/ui-account/src/main/java/app/tivi/account/AccountUiFragment.kt b/ui-account/src/main/java/app/tivi/account/AccountUiFragment.kt index ca43128d04..a03273e34a 100644 --- a/ui-account/src/main/java/app/tivi/account/AccountUiFragment.kt +++ b/ui-account/src/main/java/app/tivi/account/AccountUiFragment.kt @@ -28,10 +28,10 @@ import app.tivi.common.compose.observeWindowInsets import app.tivi.extensions.navigateToNavDestination import app.tivi.util.TiviDateFormatter import com.airbnb.mvrx.fragmentViewModel -import javax.inject.Inject import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.channels.sendBlocking import kotlinx.coroutines.launch +import javax.inject.Inject class AccountUiFragment : TiviBottomSheetFragment(), AccountUiViewModel.FactoryProvider { private val pendingActions = Channel() diff --git a/ui-account/src/main/java/app/tivi/account/AccountUiInject.kt b/ui-account/src/main/java/app/tivi/account/AccountUiInject.kt index 4757ad8fc6..c0665d0f78 100644 --- a/ui-account/src/main/java/app/tivi/account/AccountUiInject.kt +++ b/ui-account/src/main/java/app/tivi/account/AccountUiInject.kt @@ -21,8 +21,10 @@ import dagger.android.ContributesAndroidInjector @Module abstract class AccountUiBuilder { - @ContributesAndroidInjector(modules = [ - AccountUiPresenterAssistedModule::class - ]) + @ContributesAndroidInjector( + modules = [ + AccountUiPresenterAssistedModule::class + ] + ) abstract fun accountUiFragment(): AccountUiFragment } diff --git a/ui-discover/src/main/java/app/tivi/home/discover/DiscoverFragment.kt b/ui-discover/src/main/java/app/tivi/home/discover/DiscoverFragment.kt index 869d38ea16..1449eeaaa0 100644 --- a/ui-discover/src/main/java/app/tivi/home/discover/DiscoverFragment.kt +++ b/ui-discover/src/main/java/app/tivi/home/discover/DiscoverFragment.kt @@ -73,8 +73,10 @@ class DiscoverFragment : TiviFragmentWithBinding() { binding.followedAppBar.doOnSizeChange { binding.summaryRv.updatePadding(top = it.height) - binding.summarySwipeRefresh.setProgressViewOffset(true, 0, - it.height + binding.summarySwipeRefresh.progressCircleDiameter / 2) + binding.summarySwipeRefresh.setProgressViewOffset( + true, 0, + it.height + binding.summarySwipeRefresh.progressCircleDiameter / 2 + ) true } @@ -102,7 +104,8 @@ class DiscoverFragment : TiviFragmentWithBinding() { R.id.navigation_trending, null, null, - extras.toFragmentNavigatorExtras()) + extras.toFragmentNavigatorExtras() + ) } } @@ -114,7 +117,8 @@ class DiscoverFragment : TiviFragmentWithBinding() { R.id.navigation_popular, null, null, - extras.toFragmentNavigatorExtras()) + extras.toFragmentNavigatorExtras() + ) } } @@ -126,7 +130,8 @@ class DiscoverFragment : TiviFragmentWithBinding() { R.id.navigation_recommended, null, null, - extras.toFragmentNavigatorExtras()) + extras.toFragmentNavigatorExtras() + ) } } diff --git a/ui-discover/src/main/java/app/tivi/home/discover/DiscoverViewModel.kt b/ui-discover/src/main/java/app/tivi/home/discover/DiscoverViewModel.kt index 976dcaee73..76e8035fce 100644 --- a/ui-discover/src/main/java/app/tivi/home/discover/DiscoverViewModel.kt +++ b/ui-discover/src/main/java/app/tivi/home/discover/DiscoverViewModel.kt @@ -38,11 +38,11 @@ import com.airbnb.mvrx.MvRxViewModelFactory import com.airbnb.mvrx.ViewModelContext import com.squareup.inject.assisted.Assisted import com.squareup.inject.assisted.AssistedInject -import javax.inject.Provider import kotlinx.coroutines.flow.collect import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.launch +import javax.inject.Provider internal class DiscoverViewModel @AssistedInject constructor( @Assisted initialState: DiscoverViewState, diff --git a/ui-episodedetails-compose/src/main/java/app/tivi/episodedetails/EpisodeDetails.kt b/ui-episodedetails-compose/src/main/java/app/tivi/episodedetails/EpisodeDetails.kt index 776ef24a94..1f4094068f 100644 --- a/ui-episodedetails-compose/src/main/java/app/tivi/episodedetails/EpisodeDetails.kt +++ b/ui-episodedetails-compose/src/main/java/app/tivi/episodedetails/EpisodeDetails.kt @@ -107,8 +107,8 @@ import app.tivi.ui.animations.lerp import app.tivi.util.TiviDateFormatter import dev.chrisbanes.accompanist.coil.CoilImageWithCrossfade import dev.chrisbanes.accompanist.mdctheme.MaterialThemeFromMdcTheme -import kotlin.math.hypot import org.threeten.bp.OffsetDateTime +import kotlin.math.hypot /** * This is a bit of hack. I can't make `ui-episodedetails` depend on any of the compose libraries, @@ -291,8 +291,10 @@ private fun Backdrop( @Suppress("DEPRECATION") val locale = ConfigurationAmbient.current.locale Text( - text = stringResource(R.string.season_episode_number, - seasonNumber, epNumber).toUpperCase(locale), + text = stringResource( + R.string.season_episode_number, + seasonNumber, epNumber + ).toUpperCase(locale), style = MaterialTheme.typography.overline .copy(color = contentColor()) ) diff --git a/ui-episodedetails/src/main/java/app/tivi/episodedetails/EpisodeDetailsFragment.kt b/ui-episodedetails/src/main/java/app/tivi/episodedetails/EpisodeDetailsFragment.kt index 75f8b57dec..e392a378d3 100644 --- a/ui-episodedetails/src/main/java/app/tivi/episodedetails/EpisodeDetailsFragment.kt +++ b/ui-episodedetails/src/main/java/app/tivi/episodedetails/EpisodeDetailsFragment.kt @@ -28,10 +28,10 @@ import app.tivi.TiviBottomSheetFragment import app.tivi.common.compose.observeWindowInsets import app.tivi.util.TiviDateFormatter import com.airbnb.mvrx.fragmentViewModel -import javax.inject.Inject import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.channels.sendBlocking import kotlinx.coroutines.launch +import javax.inject.Inject class EpisodeDetailsFragment : TiviBottomSheetFragment(), EpisodeDetailsViewModel.FactoryProvider { companion object { diff --git a/ui-episodedetails/src/main/java/app/tivi/episodedetails/EpisodeDetailsFragmentInject.kt b/ui-episodedetails/src/main/java/app/tivi/episodedetails/EpisodeDetailsFragmentInject.kt index 2aad81ba8c..1e6c8b2a28 100644 --- a/ui-episodedetails/src/main/java/app/tivi/episodedetails/EpisodeDetailsFragmentInject.kt +++ b/ui-episodedetails/src/main/java/app/tivi/episodedetails/EpisodeDetailsFragmentInject.kt @@ -21,8 +21,10 @@ import dagger.android.ContributesAndroidInjector @Module abstract class EpisodeDetailsFragmentBuilder { - @ContributesAndroidInjector(modules = [ - EpisodeDetailsPresenterAssistedModule::class - ]) + @ContributesAndroidInjector( + modules = [ + EpisodeDetailsPresenterAssistedModule::class + ] + ) abstract fun episodeDetailsFragment(): EpisodeDetailsFragment } diff --git a/ui-followed/src/main/java/app/tivi/home/followed/FollowedFragment.kt b/ui-followed/src/main/java/app/tivi/home/followed/FollowedFragment.kt index a7840d23df..cd7ffe58c4 100644 --- a/ui-followed/src/main/java/app/tivi/home/followed/FollowedFragment.kt +++ b/ui-followed/src/main/java/app/tivi/home/followed/FollowedFragment.kt @@ -42,8 +42,8 @@ import app.tivi.ui.createSharedElementHelperForItem import app.tivi.ui.recyclerview.HideImeOnScrollListener import com.airbnb.mvrx.fragmentViewModel import com.airbnb.mvrx.withState -import javax.inject.Inject import kotlinx.coroutines.flow.collect +import javax.inject.Inject class FollowedFragment : TiviFragmentWithBinding() { private val viewModel: FollowedViewModel by fragmentViewModel() @@ -83,8 +83,10 @@ class FollowedFragment : TiviFragmentWithBinding() { binding.followedAppBar.doOnSizeChange { binding.followedRv.updatePadding(top = it.height) - binding.followedSwipeRefresh.setProgressViewOffset(true, 0, - it.height + binding.followedSwipeRefresh.progressCircleDiameter / 2) + binding.followedSwipeRefresh.setProgressViewOffset( + true, 0, + it.height + binding.followedSwipeRefresh.progressCircleDiameter / 2 + ) true } diff --git a/ui-followed/src/main/java/app/tivi/home/followed/FollowedInject.kt b/ui-followed/src/main/java/app/tivi/home/followed/FollowedInject.kt index 6bd357a19d..081ec7a6d8 100644 --- a/ui-followed/src/main/java/app/tivi/home/followed/FollowedInject.kt +++ b/ui-followed/src/main/java/app/tivi/home/followed/FollowedInject.kt @@ -22,9 +22,11 @@ import dagger.android.ContributesAndroidInjector @Module abstract class FollowedBuilder { - @ContributesAndroidInjector(modules = [ - FollowedAssistedModule::class - ]) + @ContributesAndroidInjector( + modules = [ + FollowedAssistedModule::class + ] + ) abstract fun followedFragment(): FollowedFragment } diff --git a/ui-followed/src/main/java/app/tivi/home/followed/FollowedViewModel.kt b/ui-followed/src/main/java/app/tivi/home/followed/FollowedViewModel.kt index 4944e04d97..92be297fa3 100644 --- a/ui-followed/src/main/java/app/tivi/home/followed/FollowedViewModel.kt +++ b/ui-followed/src/main/java/app/tivi/home/followed/FollowedViewModel.kt @@ -115,12 +115,14 @@ internal class FollowedViewModel @AssistedInject constructor( // Set the available sorting options setState { - copy(availableSorts = listOf( - SortOption.SUPER_SORT, - SortOption.LAST_WATCHED, - SortOption.ALPHABETICAL, - SortOption.DATE_ADDED - )) + copy( + availableSorts = listOf( + SortOption.SUPER_SORT, + SortOption.LAST_WATCHED, + SortOption.ALPHABETICAL, + SortOption.DATE_ADDED + ) + ) } // Subscribe to state changes, so update the observed data source @@ -175,7 +177,8 @@ internal class FollowedViewModel @AssistedInject constructor( changeShowFollowStatus( ChangeShowFollowStatus.Params( showSelection.getSelectedShowIds(), - ChangeShowFollowStatus.Action.UNFOLLOW) + ChangeShowFollowStatus.Action.UNFOLLOW + ) ) showSelection.clearSelection() } diff --git a/ui-popular/src/main/java/app/tivi/home/popular/PopularInject.kt b/ui-popular/src/main/java/app/tivi/home/popular/PopularInject.kt index 90e9f5108e..b52b04f4c1 100644 --- a/ui-popular/src/main/java/app/tivi/home/popular/PopularInject.kt +++ b/ui-popular/src/main/java/app/tivi/home/popular/PopularInject.kt @@ -22,9 +22,11 @@ import dagger.android.ContributesAndroidInjector @Module abstract class PopularBuilder { - @ContributesAndroidInjector(modules = [ - PopularAssistedModule::class - ]) + @ContributesAndroidInjector( + modules = [ + PopularAssistedModule::class + ] + ) internal abstract fun popularShowsFragment(): PopularShowsFragment } diff --git a/ui-popular/src/main/java/app/tivi/home/popular/PopularShowsFragment.kt b/ui-popular/src/main/java/app/tivi/home/popular/PopularShowsFragment.kt index e64fa5f6c4..699baf73cb 100644 --- a/ui-popular/src/main/java/app/tivi/home/popular/PopularShowsFragment.kt +++ b/ui-popular/src/main/java/app/tivi/home/popular/PopularShowsFragment.kt @@ -69,15 +69,19 @@ class PopularShowsFragment : EntryGridFragment() findNavController().navigate( "app.tivi://show/${show.id}".toUri(), null, - extras.toActivityNavigatorExtras(requireActivity())) + extras.toActivityNavigatorExtras(requireActivity()) + ) } } } diff --git a/ui-search/src/main/java/app/tivi/home/search/SearchInject.kt b/ui-search/src/main/java/app/tivi/home/search/SearchInject.kt index 3750f3a053..9d87e0f1d4 100644 --- a/ui-search/src/main/java/app/tivi/home/search/SearchInject.kt +++ b/ui-search/src/main/java/app/tivi/home/search/SearchInject.kt @@ -22,9 +22,11 @@ import dagger.android.ContributesAndroidInjector @Module abstract class SearchBuilder { - @ContributesAndroidInjector(modules = [ - SearchAssistedModule::class - ]) + @ContributesAndroidInjector( + modules = [ + SearchAssistedModule::class + ] + ) internal abstract fun searchFragment(): SearchFragment } diff --git a/ui-showdetails-presenter/src/main/java/app/tivi/showdetails/details/ShowDetailsFragmentViewModel.kt b/ui-showdetails-presenter/src/main/java/app/tivi/showdetails/details/ShowDetailsFragmentViewModel.kt index 774522c085..ae15ec3712 100644 --- a/ui-showdetails-presenter/src/main/java/app/tivi/showdetails/details/ShowDetailsFragmentViewModel.kt +++ b/ui-showdetails-presenter/src/main/java/app/tivi/showdetails/details/ShowDetailsFragmentViewModel.kt @@ -272,8 +272,10 @@ class ShowDetailsFragmentViewModel @AssistedInject constructor( private fun onUnfollowPreviousSeasonsFollowState(action: UnfollowPreviousSeasonsFollowedAction) { changeSeasonFollowStatus( - ChangeSeasonFollowStatus.Params(action.seasonId, - ChangeSeasonFollowStatus.Action.IGNORE_PREVIOUS) + ChangeSeasonFollowStatus.Params( + action.seasonId, + ChangeSeasonFollowStatus.Action.IGNORE_PREVIOUS + ) ).watchStatus() } diff --git a/ui-showdetails-view/src/main/java/app/tivi/showdetails/details/view/ShowDetails.kt b/ui-showdetails-view/src/main/java/app/tivi/showdetails/details/view/ShowDetails.kt index edd23fc7ca..b857c3cf5c 100644 --- a/ui-showdetails-view/src/main/java/app/tivi/showdetails/details/view/ShowDetails.kt +++ b/ui-showdetails-view/src/main/java/app/tivi/showdetails/details/view/ShowDetails.kt @@ -539,14 +539,18 @@ private fun TraktRatingInfoPanel( Column { Text( - text = stringResource(R.string.trakt_rating_text, - (show.traktRating ?: 0f) * 10f), + text = stringResource( + R.string.trakt_rating_text, + (show.traktRating ?: 0f) * 10f + ), style = MaterialTheme.typography.body2 ) Text( - text = stringResource(R.string.trakt_rating_votes, - (show.traktVotes ?: 0) / 1000f), + text = stringResource( + R.string.trakt_rating_votes, + (show.traktVotes ?: 0) / 1000f + ), style = MaterialTheme.typography.caption ) } @@ -667,8 +671,7 @@ private fun InfoPanels(show: TiviShow) { if (show.runtime != null) { RuntimeInfoPanel(show) } - if (show.airsDay != null && show.airsTime != null && - show.airsTimeZone != null) { + if (show.airsDay != null && show.airsTime != null && show.airsTimeZone != null) { AirsInfoPanel(show) } } @@ -709,7 +712,8 @@ private fun Seasons( seasons.forEach { val mod = if (pendingFocusSeasonUiEffect != null && pendingFocusSeasonUiEffect.seasonId == it.season.id && - !scrollerPosition.isAnimating) { + !scrollerPosition.isAnimating + ) { // Offset, to not scroll the item under the status bar, and leave a gap val offset = InsetsAmbient.current.top + @@ -899,9 +903,11 @@ private fun EpisodeWithWatchesRow( private fun VerticalDivider( modifier: Modifier = Modifier ) { - Box(modifier = modifier.preferredHeight(Dp.Hairline) - .fillMaxWidth() - .drawBackground(contentColor().copy(alpha = 0.15f))) + Box( + modifier = modifier.preferredHeight(Dp.Hairline) + .fillMaxWidth() + .drawBackground(contentColor().copy(alpha = 0.15f)) + ) } @Composable @@ -948,7 +954,8 @@ private fun SeasonRowOverflowMenu( } if (episodesWithWatches.numberWatched < episodesWithWatches.numberAired && - episodesWithWatches.numberAired < episodesWithWatches.size) { + episodesWithWatches.numberAired < episodesWithWatches.size + ) { items += PopupMenuItem( title = stringResource(id = R.string.popup_season_mark_watched_aired), onClick = { actioner(MarkSeasonWatchedAction(season.id, onlyAired = true)) } diff --git a/ui-showdetails-view/src/main/java/app/tivi/showdetails/details/view/ShowDetailsTextCreator.kt b/ui-showdetails-view/src/main/java/app/tivi/showdetails/details/view/ShowDetailsTextCreator.kt index 51a37dd197..8acbdab8d3 100644 --- a/ui-showdetails-view/src/main/java/app/tivi/showdetails/details/view/ShowDetailsTextCreator.kt +++ b/ui-showdetails-view/src/main/java/app/tivi/showdetails/details/view/ShowDetailsTextCreator.kt @@ -36,12 +36,12 @@ import app.tivi.data.views.FollowedShowsWatchStats import app.tivi.inject.PerActivity import app.tivi.ui.GenreStringer import app.tivi.util.TiviDateFormatter -import java.util.Locale -import javax.inject.Inject import org.threeten.bp.OffsetDateTime import org.threeten.bp.ZoneId import org.threeten.bp.ZonedDateTime import org.threeten.bp.format.TextStyle +import java.util.Locale +import javax.inject.Inject class ShowDetailsTextCreator @Inject constructor( @PerActivity private val context: Context, @@ -67,10 +67,12 @@ class ShowDetailsTextCreator @Inject constructor( val nextToAir = watches.nextToAir if (nextToAir?.firstAired != null) { text.append(". ") - text.append(context.getString( - R.string.next_prefix, - tiviDateFormatter.formatShortRelativeTime(nextToAir.firstAired!!) - )) + text.append( + context.getString( + R.string.next_prefix, + tiviDateFormatter.formatShortRelativeTime(nextToAir.firstAired!!) + ) + ) } } return text @@ -119,8 +121,10 @@ class ShowDetailsTextCreator @Inject constructor( fun followedShowEpisodeWatchStatus(stats: FollowedShowsWatchStats?): CharSequence { return if (stats != null && stats.watchedEpisodeCount < stats.episodeCount) { - context.getString(R.string.followed_watch_stats_to_watch, - stats.episodeCount - stats.watchedEpisodeCount).parseAsHtml() + context.getString( + R.string.followed_watch_stats_to_watch, + stats.episodeCount - stats.watchedEpisodeCount + ).parseAsHtml() } else if (stats != null && stats.watchedEpisodeCount > 0) { context.getString(R.string.followed_watch_stats_complete) } else { diff --git a/ui-showdetails/src/main/java/app/tivi/showdetails/details/ShowDetailsFragment.kt b/ui-showdetails/src/main/java/app/tivi/showdetails/details/ShowDetailsFragment.kt index 0b706715cf..1be272e832 100644 --- a/ui-showdetails/src/main/java/app/tivi/showdetails/details/ShowDetailsFragment.kt +++ b/ui-showdetails/src/main/java/app/tivi/showdetails/details/ShowDetailsFragment.kt @@ -34,10 +34,10 @@ import app.tivi.showdetails.details.view.composeShowDetails import app.tivi.util.TiviDateFormatter import com.airbnb.mvrx.fragmentViewModel import com.airbnb.mvrx.withState -import javax.inject.Inject import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.channels.sendBlocking import kotlinx.coroutines.launch +import javax.inject.Inject class ShowDetailsFragment : TiviFragment(), ShowDetailsFragmentViewModel.FactoryProvider { private val viewModel: ShowDetailsFragmentViewModel by fragmentViewModel() diff --git a/ui-showdetails/src/main/java/app/tivi/showdetails/details/ShowDetailsFragmentInject.kt b/ui-showdetails/src/main/java/app/tivi/showdetails/details/ShowDetailsFragmentInject.kt index e84d41d88f..999d5672c0 100644 --- a/ui-showdetails/src/main/java/app/tivi/showdetails/details/ShowDetailsFragmentInject.kt +++ b/ui-showdetails/src/main/java/app/tivi/showdetails/details/ShowDetailsFragmentInject.kt @@ -21,8 +21,10 @@ import dagger.android.ContributesAndroidInjector @Module abstract class ShowDetailsFragmentBuilder { - @ContributesAndroidInjector(modules = [ - ShowDetailsPresenterAssistedModule::class - ]) + @ContributesAndroidInjector( + modules = [ + ShowDetailsPresenterAssistedModule::class + ] + ) abstract fun showDetailsFragment(): ShowDetailsFragment } diff --git a/ui-trending/src/main/java/app/tivi/home/trending/TrendingInject.kt b/ui-trending/src/main/java/app/tivi/home/trending/TrendingInject.kt index 63dd0d4634..720e645f0a 100644 --- a/ui-trending/src/main/java/app/tivi/home/trending/TrendingInject.kt +++ b/ui-trending/src/main/java/app/tivi/home/trending/TrendingInject.kt @@ -22,9 +22,11 @@ import dagger.android.ContributesAndroidInjector @Module abstract class TrendingBuilder { - @ContributesAndroidInjector(modules = [ - TrendingAssistedModule::class - ]) + @ContributesAndroidInjector( + modules = [ + TrendingAssistedModule::class + ] + ) internal abstract fun trendingShowsFragment(): TrendingShowsFragment } diff --git a/ui-trending/src/main/java/app/tivi/home/trending/TrendingShowsFragment.kt b/ui-trending/src/main/java/app/tivi/home/trending/TrendingShowsFragment.kt index b59ea20aab..de85c18087 100644 --- a/ui-trending/src/main/java/app/tivi/home/trending/TrendingShowsFragment.kt +++ b/ui-trending/src/main/java/app/tivi/home/trending/TrendingShowsFragment.kt @@ -56,15 +56,19 @@ class TrendingShowsFragment : EntryGridFragment() { private val viewModel: WatchedViewModel by fragmentViewModel() @@ -86,8 +86,10 @@ class WatchedFragment : TiviFragmentWithBinding() { binding.watchedAppBar.doOnSizeChange { binding.watchedRv.updatePadding(top = it.height) - binding.watchedSwipeRefresh.setProgressViewOffset(true, 0, - it.height + binding.watchedSwipeRefresh.progressCircleDiameter / 2) + binding.watchedSwipeRefresh.setProgressViewOffset( + true, 0, + it.height + binding.watchedSwipeRefresh.progressCircleDiameter / 2 + ) true } diff --git a/ui-watched/src/main/java/app/tivi/home/watched/WatchedInject.kt b/ui-watched/src/main/java/app/tivi/home/watched/WatchedInject.kt index 20312ca1aa..6f25ef0b2b 100644 --- a/ui-watched/src/main/java/app/tivi/home/watched/WatchedInject.kt +++ b/ui-watched/src/main/java/app/tivi/home/watched/WatchedInject.kt @@ -22,9 +22,11 @@ import dagger.android.ContributesAndroidInjector @Module abstract class WatchedBuilder { - @ContributesAndroidInjector(modules = [ - WatchedAssistedModule::class - ]) + @ContributesAndroidInjector( + modules = [ + WatchedAssistedModule::class + ] + ) abstract fun fragment(): WatchedFragment } diff --git a/ui-watched/src/main/java/app/tivi/home/watched/WatchedViewModel.kt b/ui-watched/src/main/java/app/tivi/home/watched/WatchedViewModel.kt index 179d4dc66a..cd4e570264 100644 --- a/ui-watched/src/main/java/app/tivi/home/watched/WatchedViewModel.kt +++ b/ui-watched/src/main/java/app/tivi/home/watched/WatchedViewModel.kt @@ -173,7 +173,8 @@ internal class WatchedViewModel @AssistedInject constructor( ChangeShowFollowStatus.Params( showSelection.getSelectedShowIds(), ChangeShowFollowStatus.Action.FOLLOW, - deferDataFetch = true) + deferDataFetch = true + ) ) showSelection.clearSelection() } @@ -182,7 +183,8 @@ internal class WatchedViewModel @AssistedInject constructor( changeShowFollowStatus( ChangeShowFollowStatus.Params( showSelection.getSelectedShowIds(), - ChangeShowFollowStatus.Action.UNFOLLOW) + ChangeShowFollowStatus.Action.UNFOLLOW + ) ) showSelection.clearSelection() }