|
@@ -21,7 +21,6 @@ import app.mar.utils.game.challenges.Question;
|
|
/**
|
|
/**
|
|
* A simple {@link Fragment} subclass.
|
|
* A simple {@link Fragment} subclass.
|
|
* Activities that contain this fragment must implement the
|
|
* Activities that contain this fragment must implement the
|
|
- * {@link QuestionFragment.OnFragmentInteractionListener} interface
|
|
|
|
* to handle interaction events.
|
|
* to handle interaction events.
|
|
* Use the {@link QuestionFragment#newInstance} factory method to
|
|
* Use the {@link QuestionFragment#newInstance} factory method to
|
|
* create an instance of this fragment.
|
|
* create an instance of this fragment.
|
|
@@ -38,7 +37,6 @@ public class QuestionFragment extends Fragment {
|
|
protected Question mQuestion=null;
|
|
protected Question mQuestion=null;
|
|
protected Game mGame;
|
|
protected Game mGame;
|
|
|
|
|
|
- private OnFragmentInteractionListener mListener;
|
|
|
|
|
|
|
|
public QuestionFragment() {
|
|
public QuestionFragment() {
|
|
// Required empty public constructor
|
|
// Required empty public constructor
|
|
@@ -94,42 +92,20 @@ public class QuestionFragment extends Fragment {
|
|
|
|
|
|
// TODO: Rename method, update argument and hook method into UI event
|
|
// TODO: Rename method, update argument and hook method into UI event
|
|
public void onButtonPressed(Uri uri) {
|
|
public void onButtonPressed(Uri uri) {
|
|
- if (mListener != null) {
|
|
|
|
- mListener.onFragmentInteraction(uri);
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void onAttach(Context context) {
|
|
public void onAttach(Context context) {
|
|
super.onAttach(context);
|
|
super.onAttach(context);
|
|
- if (context instanceof OnFragmentInteractionListener) {
|
|
|
|
- mListener = (OnFragmentInteractionListener) context;
|
|
|
|
- } else {
|
|
|
|
- throw new RuntimeException(context.toString()
|
|
|
|
- + " must implement OnFragmentInteractionListener");
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void onDetach() {
|
|
public void onDetach() {
|
|
super.onDetach();
|
|
super.onDetach();
|
|
- mListener = null;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- /**
|
|
|
|
- * This interface must be implemented by activities that contain this
|
|
|
|
- * fragment to allow an interaction in this fragment to be communicated
|
|
|
|
- * to the activity and potentially other fragments contained in that
|
|
|
|
- * activity.
|
|
|
|
- * <p>
|
|
|
|
- * See the Android Training lesson <a href=
|
|
|
|
- * "http://developer.android.com/training/basics/fragments/communicating.html"
|
|
|
|
- * >Communicating with Other Fragments</a> for more information.
|
|
|
|
- */
|
|
|
|
- public interface OnFragmentInteractionListener {
|
|
|
|
- // TODO: Update argument type and name
|
|
|
|
- void onFragmentInteraction(Uri uri);
|
|
|
|
- }
|
|
|
|
}
|
|
}
|