コード例 #1
0
 public static void shareRoutine(long routineId) {
   try {
     DataCommunicator.sendGetDataToServer(SHARE_ROUTINE_URL + routineId);
   } catch (Exception e) {
     System.out.println(e);
   }
 }
コード例 #2
0
 public static void editRoutine(Routine routine) {
   try {
     String postPayload = gson.toJson(routine);
     DataCommunicator.sendPostDataToServer(EDIT_ROUTINE_URL, postPayload);
   } catch (Exception e) {
     System.out.println(e);
   }
 }
コード例 #3
0
  public static List<Routine> fetchRoutineList(String userName) {
    List<Routine> routineList = null;

    try {
      String response =
          Utils.convertStreamToString(
              DataCommunicator.sendGetDataToServer(GET_ROUTINE_URL + URLEncoder.encode(userName)));
      if (!Utils.isNullOrEmptyStr(response)) {
        RoutineResponse routineResp = gson.fromJson(response, RoutineResponse.class);
        if (routineResp != null) routineList = routineResp.list;
        else routineList = new ArrayList<Routine>();
      }
    } catch (Exception e) {
      e.printStackTrace();
      routineList = new ArrayList<Routine>();
    }
    return routineList;
  }