コード例 #1
0
 public void getAttendanceWebService(String date) {
   {
     type = RequestType.TYPE_GET;
     if (CommonUtils.isNetworkAvailable(this)) {
       Constants.showProgress(this);
       String postUrl = "/app/attendance/grade/v1/" + "5/a/" + date;
       postUrl = getString(R.string.base_url) + postUrl;
       Log.i("TimetableURL", postUrl);
       WebServiceCall call = new WebServiceCall(this);
       call.getCallRequest(postUrl);
       // httpConnectThread = new HttpConnectThread(this, null, this);
       //     String url = getString(R.string.base_url) + getString(R.string.url_teacher_deatils);
       // teacherName = "/" + StorageManager.readString(this, getString(R.string.pref_username),
       // "");
       // httpConnectThread.execute(postUrl);
     }
   }
 }
コード例 #2
0
 @Override
 public void onRequestCompletionError(String error) {
   CommonUtils.getLogs("Response::::" + error);
   Constants.stopProgress(this);
   Constants.showMessage(this, "Retry Again", error);
 }
コード例 #3
0
  @Override
  public void onRequestCompletion(JSONObject responseJson, JSONArray responseArray) {
    CommonUtils.getLogs("Response::::" + responseJson);
    if (responseJson != null && responseArray == null) {
      responseArray = new JSONArray();
      responseArray.put(responseJson);
    }
    JSONObject obj = null;
    if (responseArray != null) {
      switch (type) {
        case TYPE_GET:
          boolean hasClassList = false;
          try {
            JSONObject jsonObject = responseArray.getJSONObject(0);
            if (jsonObject.has("message")) {
              hasClassList =
                  jsonObject.getString("message").equals("No Class assigned as Class Teacher");
            }
          } catch (JSONException e) {
            e.printStackTrace();
          }

          if (!hasClassList) {
            teacherModel = AttendaceJsonParser.getInstance().getTeacherModel(responseArray);
            studentsList = teacherModel.getGradeModels().get(0).getStudentsModels();
            studentsSize = studentsList.size();
            if (AttendenceUpdateActivity.hasattendancedone) {
              studentsListabsent = teacherModel.getGradeModels().get(0).getAbsentStudentsModels();
              adapter =
                  new StudentsListAdapter(
                      this,
                      R.layout.select_student_list_item,
                      studentsList,
                      studentsListabsent,
                      true,
                      false);
              studentsListview.setAdapter(adapter);
              editTV.setVisibility(View.VISIBLE);
              doneTV.setVisibility(View.GONE);
            } else {
              adapter =
                  new StudentsListAdapter(this, R.layout.select_student_list_item, studentsList);
              studentsListview.setAdapter(adapter);
              editTV.setVisibility(View.GONE);
              doneTV.setVisibility(View.VISIBLE);
            }
            Constants.stopProgress(this);
            try {
              obj = (JSONObject) responseArray.get(0);

              if (obj.has("message")) {
                CommonUtils.getToastMessage(this, obj.getString("message"));
              }
            } catch (JSONException e) {
              e.printStackTrace();
            }
          } else {
            Constants.stopProgress(this);
            onBackPressed();
            Toast.makeText(this, "No Class assigned as Class Teacher", Toast.LENGTH_LONG).show();
          }
          break;
        case GET_POST:
          try {
            obj = responseJson;
            if (obj.has("message")) {
              CommonUtils.getToastMessage(this, obj.getString("message"));
            }
          } catch (JSONException e) {
            e.printStackTrace();
          }
      }
    } else {
      Constants.stopProgress(this);
      try {
        obj = responseJson;
        obj = responseJson;
        if (obj.has("message")) {
          CommonUtils.getToastMessage(this, obj.getString("message"));
        }
      } catch (JSONException e) {
        e.printStackTrace();
      }
    }
  }