* feat(chat): add animated GIF rendering with tap-to-play animation Closes #721 * fix(#721): add missing GifImageThumbnail component and format ktlint * fix(analytics): resolve ktlint indentation error in itemsIndexed * feat(chat): add interactive play/pause toggle for animated GIFs * fix(chat): control GIF playback via Animatable start and stop
43 lines
1.5 KiB
Kotlin
43 lines
1.5 KiB
Kotlin
package com.m57.hermescontrol
|
|
|
|
import android.app.Application
|
|
import android.os.Build
|
|
import coil.ImageLoader
|
|
import coil.ImageLoaderFactory
|
|
import coil.decode.GifDecoder
|
|
import coil.decode.ImageDecoderDecoder
|
|
import com.m57.hermescontrol.data.local.AuthManager
|
|
import com.m57.hermescontrol.data.remote.NetworkMonitor
|
|
import com.m57.hermescontrol.data.remote.OkHttpProvider
|
|
import com.m57.hermescontrol.ui.analytics.AnalyticsPreloader
|
|
|
|
class HermesControlApp :
|
|
Application(),
|
|
ImageLoaderFactory {
|
|
override fun onCreate() {
|
|
super.onCreate()
|
|
AuthManager.init(this)
|
|
// Issue #478: guarantee a "Default" profile is always selected so there is no
|
|
// separate standalone/default code path anywhere in the app.
|
|
AuthManager.ensureDefaultProfile()
|
|
NetworkMonitor.init(this)
|
|
// Issue #537 follow-up (A): preload analytics in the background after launch
|
|
// so the tab renders instantly when opened (the usage endpoint is slow on a
|
|
// cold backend). Fire-and-forget; never blocks UI startup.
|
|
AnalyticsPreloader.preload(this)
|
|
}
|
|
|
|
override fun newImageLoader(): ImageLoader =
|
|
ImageLoader
|
|
.Builder(this)
|
|
.okHttpClient(OkHttpProvider.base)
|
|
.components {
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
|
add(ImageDecoderDecoder.Factory())
|
|
} else {
|
|
add(GifDecoder.Factory())
|
|
}
|
|
}.crossfade(true)
|
|
.build()
|
|
}
|