package me.texx.Texx import android.content.Context import android.os.Bundle import android.support.v4.app.Fragment import android.view.LayoutInflater import android.view.View import android.view.ViewGroup class EmojiSelectorFragment : Fragment() { private var listener: OnFragmentInteractionListener? = null override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { return inflater.inflate(R.layout.fragment_emoji_selector, container, false) } fun onButtonPressed(test: String) { listener?.onEmojiSelection(test) } override fun onAttach(context: Context) { super.onAttach(context) if (context is OnFragmentInteractionListener) { listener = context } else { throw RuntimeException(context.toString() + " must implement OnFragmentInteractionListener") } } override fun onDetach() { super.onDetach() listener = null } interface OnFragmentInteractionListener { fun onEmojiSelection(test: String) } companion object { fun newInstance() = EmojiSelectorFragment().apply {} } }