package com.refactorizado.barfastic.presentation.food.view

import android.os.Bundle
import com.refactorizado.barfastic.R
import com.refactorizado.barfastic.presentation.common.ActivityBase

class FoodListActivity : ActivityBase() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_food_list)

        // savedInstanceState is non-null when there is fragment state
        // saved from previous configurations of this activity
        // (e.g. when rotating the screen from portrait to landscape).
        // In this case, the fragment will automatically be re-added
        // to its container so we don't need to manually add it.
        // For more information, see the Fragments API guide at:
        //
        // http://developer.android.com/guide/components/fragments.html
        if (savedInstanceState == null) {
            addListFragment()
        }
    }

    private fun addListFragment() {
        supportFragmentManager
                .beginTransaction()
                .add(R.id.food_list_placeholder, FoodListFragment())
                .commit()
    }
}
