@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setHasOptionsMenu(true); // populateView(); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (Utilities.isHandset(getActivity())) { HOME_ITEMS = 5; } else { HOME_ITEMS = 6; } }
@Override public void decodeResponse(String stringResponse) { Log.d(LOG_VISIT_FRAGMENT, stringResponse); try { JSONObject resp = new JSONObject(stringResponse); if (resp.getString("method").equalsIgnoreCase(METHOD.SEND_START_VISIT.toString())) { RequestManager.dismissProgressDialog(); if (resp.getString("success").equalsIgnoreCase("true")) { Toast.makeText(getActivity(), "Visita iniciada satisfactoriamente", Toast.LENGTH_SHORT) .show(); setCheckIn2DB(true, resp.getString("id_visit_session")); } else if (resp.getString("success").equalsIgnoreCase("nointernet")) { RequestManager.sharedInstance() .showConfirmationDialogWithListener( "No fue posible enviar el Check In, se registrara en modo OFFLINE", getActivity(), this); setCheckIn2DB(false, "no_id_visit_session"); } else { if (resp.getString("error").contains("started")) { Toast.makeText(getActivity(), "La visita ya habia sido iniciada", Toast.LENGTH_SHORT) .show(); } else { Toast.makeText(getActivity(), "Error en el servicio", Toast.LENGTH_LONG).show(); RequestManager.sharedInstance() .showConfirmationDialogWithListener("Error en el servicio", getActivity(), this); } } // WorkPlan.updateCheckIn(getActivity(), visit_id, "checkin"); // Log.e("CHECKINS ", CheckIn.getAllInMaps(getActivity()).toString()); } else if (resp.getString("method").equalsIgnoreCase(METHOD.END_VISIT.toString())) { RequestManager.dismissProgressDialog(); if (resp.getString("success").equalsIgnoreCase("true")) { Toast.makeText(getActivity(), "Visita finalizada satisfactoriamente", Toast.LENGTH_SHORT) .show(); setCheckOut2DB(true); getActivity().onBackPressed(); } else if (resp.getString("success").equalsIgnoreCase("nointernet")) { RequestManager.sharedInstance() .showConfirmationDialogWithListener( "No fue posible enviar el Check Out, se registrara en modo OFFLINE", getActivity(), this); setCheckOut2DB(false); getActivity().onBackPressed(); } else { if (resp.getString("error").contains("ended")) { Toast.makeText(getActivity(), "La visita ya habia sido finalizada", Toast.LENGTH_SHORT) .show(); } else { RequestManager.sharedInstance() .showConfirmationDialogWithListener("Error en el servicio", getActivity(), this); } } } } catch (JSONException e) { e.printStackTrace(); } super.decodeResponse(stringResponse); }
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); }
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); menu.clear(); }
@Override public void onAttach(Activity activity) { super.onAttach(activity); }