package net.pokeranalytics.android.ui.fragment.components

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import kotlinx.android.synthetic.main.fragment_screen_slide_page.*
import net.pokeranalytics.android.R


class ScreenSlidePageFragment(var iconResId: Int, var titleResId: Int, var descriptionResId: Int) : PokerAnalyticsFragment() {

	override fun onCreateView(
		inflater: LayoutInflater,
		container: ViewGroup?,
		savedInstanceState: Bundle?
	): View = inflater.inflate(R.layout.fragment_screen_slide_page, container, false)

	override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
		super.onViewCreated(view, savedInstanceState)

		this.icon.setImageResource(this.iconResId)
		this.title.text = requireContext().getString(this.titleResId)
		this.description.text = requireContext().getString(this.descriptionResId)
	}

	/**
	 * Update views position
	 */
	fun updateViewsPosition(position: Float) {
		view?.findViewById<View>(R.id.title)?.translationX = position
		view?.findViewById<View>(R.id.icon)?.translationX = position
		view?.findViewById<View>(R.id.description)?.translationX = position * 2f

	}

}
