package app.furmeet.events.brasilfurfest

import android.os.Bundle
import android.view.WindowManager
import app.furmeet.events.brasilfurfest.helper.fromCacheManagerToImageOf
import app.furmeet.events.brasilfurfest.helper.nullIfBlank
import app.furmeet.events.brasilfurfest.helper.resourcesAliased
import app.furmeet.events.brasilfurfest.helper.solved
import app.furmeet.events.brasilfurfest.schedule.managers.ScheduleManagerGetter
import com.adlerosn.brasilfurfest.R
import kotlinx.android.synthetic.main.activity_asset_image_viewer.*

class AssetImageViewerActivity : TranslatableAppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        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)
        setContentView(R.layout.activity_asset_image_viewer)
        resourcesAliased = this.resources
        val scheduleManager = ScheduleManagerGetter[this]
        val asset = intent.getStringExtra("asset")
                ?: scheduleManager.conventionSeries.defaultBanner.solved!!
        asset.nullIfBlank()?.fromCacheManagerToImageOf(myZoomageView)
    }
}
