package app.furmeet.events.system

import android.os.Bundle
import android.view.WindowManager
import app.furmeet.events.system.helper.fromCacheManagerToImageOf
import app.furmeet.events.system.helper.nullIfBlank
import app.furmeet.events.system.helper.resourcesAliased
import app.furmeet.events.system.helper.solved
import app.furmeet.events.system.schedule.managers.ScheduleManagerGetter
import app.furmeet.events.bff.databinding.ActivityAssetImageViewerBinding

//import kotlinx.android.synthetic.main.activity_asset_image_viewer.*

class AssetImageViewerActivity : TranslatableAppCompatActivityWithScheduleServiceWrapped() {

    lateinit var binding: ActivityAssetImageViewerBinding;

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = ActivityAssetImageViewerBinding.inflate(layoutInflater)
        val view = binding.root
        setContentView(view)
        window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION)
        window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
        window.addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS)
        resourcesAliased = this.resources
        val scheduleManager = ScheduleManagerGetter[this]
        val asset = intent.getStringExtra("asset")
                ?: scheduleManager.conventionSeries.defaultBanner.solved!!
        asset.nullIfBlank()?.fromCacheManagerToImageOf(binding.myZoomageView)
    }
}
