Skip to content
Permalink
Browse files

Update to ktlint 0.35.0

Required some code style fixes
  • Loading branch information
chrisbanes committed Nov 25, 2019
1 parent e1758cd commit 66662f93da058850adf314ad1e21588ae4756e18
Showing 350 changed files with 454 additions and 455 deletions.
@@ -37,4 +37,4 @@ class TiviApplication : DaggerApplication(), Configuration.Provider {
}

override fun getWorkManagerConfiguration(): Configuration = workConfiguration
}
}
@@ -27,4 +27,4 @@ class AppInitializers @Inject constructor(
it.init(application)
}
}
}
}
@@ -54,4 +54,4 @@ class ArchTaskExecutorInitializer @Inject constructor(
}
})
}
}
}
@@ -28,4 +28,4 @@ class ClearGlideCacheInitializer @Inject constructor(
val dir = File(application.cacheDir, "image_manager_disk_cache")
deleteFolder(DeleteFolder.Params(dir))
}
}
}
@@ -36,4 +36,4 @@ class EmojiInitializer @Inject constructor() : AppInitializer {

EmojiCompat.init(config)
}
}
}
@@ -26,4 +26,4 @@ class PreferencesInitializer @Inject constructor(
override fun init(application: Application) {
prefs.setup()
}
}
}
@@ -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
@@ -36,4 +36,4 @@ class ThreeTenBpInitializer @Inject constructor(
ZoneRulesProvider.getAvailableZoneIds()
}
}
}
}
@@ -25,4 +25,4 @@ class TimberInitializer @Inject constructor(
private val tiviLogger: TiviLogger
) : AppInitializer {
override fun init(application: Application) = tiviLogger.setup(BuildConfig.DEBUG)
}
}
@@ -26,4 +26,4 @@ class TmdbInitializer @Inject constructor(
override fun init(application: Application) {
updateTmdbConfig(Unit)
}
}
}
@@ -28,10 +28,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) { AuthorizationService(this) }
@@ -23,4 +23,4 @@ import com.airbnb.mvrx.MvRxState
data class HomeActivityViewState(
val user: TraktUser? = null,
val authState: TraktAuthState = TraktAuthState.LOGGED_OUT
) : MvRxState
) : MvRxState
@@ -24,4 +24,4 @@ internal class HomeAppNavigator(
override fun startLogin() {
activity.startLogin()
}
}
}
@@ -57,4 +57,4 @@ abstract class HomeModuleBinds {
@Binds
@PerActivity
abstract fun bindContext(activity: HomeActivity): Context
}
}
@@ -21,4 +21,4 @@ import dagger.Module

@AssistedModule
@Module(includes = [AssistedInject_AppAssistedModule::class])
abstract class AppAssistedModule
abstract class AppAssistedModule
@@ -19,6 +19,7 @@ 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
@@ -30,17 +31,16 @@ import app.tivi.util.AppCoroutineDispatchers
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 android.text.format.DateFormat as AndroidDateFormat
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import org.threeten.bp.ZoneId
import org.threeten.bp.format.DateTimeFormatter

@Module(includes = [AppModuleBinds::class])
class AppModule {
@@ -83,4 +83,4 @@ abstract class AppModuleBinds {
@Binds
@IntoSet
abstract fun provideClearGlideInitializer(bind: ClearGlideCacheInitializer): AppInitializer
}
}
@@ -19,8 +19,8 @@ package app.tivi.inject
import app.tivi.BuildConfig
import dagger.Module
import dagger.Provides
import okhttp3.logging.HttpLoggingInterceptor
import javax.inject.Singleton
import okhttp3.logging.HttpLoggingInterceptor

@Module
class NetworkModule {
@@ -33,4 +33,4 @@ class NetworkModule {
}
}
}
}
}
@@ -53,4 +53,4 @@ class ShowDetailsActivity : TiviActivity() {
NavHostFragment.create(R.navigation.show_details_nav_graph, intent.extras))
}
}
}
}
@@ -29,4 +29,4 @@ internal abstract class ShowDetailsBuilder {
EpisodeDetailsFragmentBuilder::class
])
internal abstract fun bindDetailsActivity(): ShowDetailsActivity
}
}
@@ -26,4 +26,4 @@ class ShowDetailsModule {
@Provides
@PerActivity
fun provideActivity(activity: ShowDetailsActivity): Context = activity
}
}
@@ -21,4 +21,4 @@ import android.app.PendingIntent
interface AppNavigator {
fun provideAuthHandleResponseIntent(requestCode: Int): PendingIntent
fun startLogin()
}
}
@@ -20,4 +20,4 @@ import android.app.Application

interface AppInitializer {
fun init(application: Application)
}
}
@@ -40,4 +40,4 @@ fun <T> LiveData<T>.asFlow(): Flow<T> {
removeObserver(observer)
}
}
}
}
@@ -22,4 +22,4 @@ fun MenuItem.setActionViewExpanded(expanded: Boolean) {
if (expanded != isActionViewExpanded) {
if (expanded) expandActionView() else collapseActionView()
}
}
}
@@ -61,4 +61,4 @@ class EventObserver<T>(private val onEventUnhandledContent: (T) -> Unit) : Obser

inline fun <T> LiveData<Event<T>>.observeEvent(owner: LifecycleOwner, crossinline observer: (T) -> Unit) {
observe(owner, EventObserver { observer(it) })
}
}
@@ -20,10 +20,10 @@ import android.text.format.DateUtils
import app.tivi.inject.MediumDate
import app.tivi.inject.MediumDateTime
import app.tivi.inject.ShortDate
import javax.inject.Inject
import org.threeten.bp.OffsetDateTime
import org.threeten.bp.format.DateTimeFormatter
import org.threeten.bp.temporal.Temporal
import javax.inject.Inject

class TiviDateFormatter @Inject constructor(
@ShortDate private val shortDateFormatter: DateTimeFormatter,
@@ -69,4 +69,4 @@ class TiviDateFormatter @Inject constructor(
}
}
}
}
}
@@ -19,9 +19,9 @@ package app.tivi.util
import android.os.Build
import android.util.Log
import com.crashlytics.android.Crashlytics
import timber.log.Timber
import java.util.regex.Pattern
import javax.inject.Inject
import timber.log.Timber

class TiviLogger @Inject constructor() : Logger {
fun setup(debugMode: Boolean) {
@@ -145,4 +145,4 @@ private class CrashlyticsTree : Timber.Tree() {
override fun log(priority: Int, tag: String?, message: String, t: Throwable?) {
Crashlytics.log(message)
}
}
}
@@ -21,4 +21,4 @@ interface ShowTasks {
fun syncFollowedShows()
fun syncFollowedShowsWhenIdle()
fun setupNightSyncs()
}
}
@@ -24,4 +24,4 @@ object InvokeStarted : InvokeStatus()
object InvokeSuccess : InvokeStatus()

data class InvokeError(val throwable: Throwable) : InvokeStatus()
object InvokeTimeout : InvokeStatus()
object InvokeTimeout : InvokeStatus()
@@ -27,4 +27,4 @@ data class Success<T>(val data: T, val responseModified: Boolean = true) : Resul
data class ErrorResult<T>(
val throwable: Throwable? = null,
val message: String? = null
) : Result<T>()
) : Result<T>()
@@ -18,4 +18,4 @@ package app.tivi.extensions

fun CharSequence?.isLongerThan(other: CharSequence?) = lengthOrZero() > other.lengthOrZero()

fun CharSequence?.lengthOrZero() = this?.length ?: 0
fun CharSequence?.lengthOrZero() = this?.length ?: 0
@@ -16,6 +16,8 @@

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
@@ -30,8 +32,6 @@ 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 <A, B> Collection<A>.parallelMap(
concurrency: Int = defaultConcurrency,
@@ -138,4 +138,4 @@ inline fun <T1, T2, T3, T4, T5, T6, R> combine(
args[4] as T5,
args[5] as T6
)
}
}
@@ -17,13 +17,13 @@
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
import app.tivi.data.entities.Result
import app.tivi.data.entities.Success

fun <T> Response<T>.bodyOrThrow(): T {
if (!isSuccessful) throw HttpException(this)
@@ -109,4 +109,4 @@ suspend fun <T, E> Response<T>.toResult(mapper: suspend (T) -> E): Result<E> {
} catch (e: Exception) {
ErrorResult(e)
}
}
}
@@ -25,4 +25,4 @@ inline fun <T> observable(
crossinline onChange: () -> Unit
): ReadWriteProperty<Any?, T> = object : ObservableProperty<T>(initialValue) {
override fun afterChange(property: KProperty<*>, oldValue: T, newValue: T) = onChange()
}
}
@@ -61,4 +61,4 @@ annotation class ApplicationId
@Retention(AnnotationRetention.RUNTIME)
@Qualifier
@MustBeDocumented
annotation class ProcessLifetime
annotation class ProcessLifetime
@@ -28,4 +28,4 @@ interface TiviPreferences {
BATTERY_SAVER_ONLY,
SYSTEM
}
}
}
@@ -22,4 +22,4 @@ data class AppCoroutineDispatchers(
val io: CoroutineDispatcher,
val computation: CoroutineDispatcher,
val main: CoroutineDispatcher
)
)
@@ -70,4 +70,4 @@ interface Logger {

/** Log an assert exception. */
fun wtf(t: Throwable)
}
}
@@ -17,7 +17,7 @@
package app.tivi.buildsrc

object Versions {
const val ktlint = "0.33.0"
const val ktlint = "0.35.0"
}

object Libs {
@@ -32,4 +32,4 @@ import app.tivi.ui.widget.PopupMenuButton
BindingMethod(type = PopupMenuButton::class, attribute = "popupMenuClickListener", method = "setMenuItemClickListener"),
BindingMethod(type = PopupMenuButton::class, attribute = "popupMenuListener", method = "setPopupMenuListener")
)
class TiviBindingMethods
class TiviBindingMethods
@@ -72,4 +72,4 @@ abstract class EntryGridEpoxyController<LI : EntryWithShow<out Entry>> :
return PosterGridItemBindingModel_()
.id("placeholder_$index")
}
}
}

0 comments on commit 66662f9

Please sign in to comment.
You can’t perform that action at this time.