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

import android.os.Bundle
import androidx.fragment.app.Fragment
import io.realm.Realm

open class PokerAnalyticsFragment: Fragment() {

	private lateinit var realm: Realm

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
	    realm = Realm.getDefaultInstance()
    }

    override fun onDestroyView() {
        super.onDestroyView()
	    realm.close()
    }

	/**
	 * Get the realm instance
 	 */
	fun getRealm(): Realm {
		return realm
	}

	/**
	 * Method called when the activity override onBackPressed and send the information to the fragment
	 */
	open fun onBackPressed(){}

}