private SimpleCMObject updatedTask() { task.setClass(TaskAdapter.TASK_CLASS); task.add(TaskAdapter.IS_DONE, isDone()); task.add(TaskAdapter.TASK_NAME, taskName()); task.add(TaskAdapter.DUE_DATE, date()); task.add(TaskAdapter.PRIORITY, priority()); task.add(TaskAdapter.LOCATION, location()); return task; }
private void setPicture() { String pictureKey = task.getString(TaskAdapter.PICTURE); if (pictureKey != null) { service.asyncLoadFile( pictureKey, new FileLoadCallback(pictureKey) { @Override public void onCompletion(CMFile file) { byte[] pictureBytes = file.fileContents(); Bitmap asBitmap = BitmapFactory.decodeByteArray(pictureBytes, 0, pictureBytes.length); setImage(asBitmap); } }); } }
private void setIsDone() { CheckBox isDone = getIsDoneComponent(); isDone.setChecked(task.getBoolean(TaskAdapter.IS_DONE, false)); }
private void setPriority() { Spinner priority = getPriorityComponent(); priority.setSelection(task.getInteger(TaskAdapter.PRIORITY, 0), true); }
private void setTaskName() { EditText taskName = getTaskNameComponent(); taskName.setText(task.getString(TaskAdapter.TASK_NAME, "")); }
private CMGeoPoint location() { return task.getGeoPoint(TaskAdapter.LOCATION, CLOUD_MINE_OFFICE); }
private Date date() { return task.getDate(TaskAdapter.DUE_DATE, new Date()); }
private void updateTime(int hour, int minute) { Date updatedDate = new GregorianCalendar(year(), month(), day(), hour, minute).getTime(); task.add(TaskAdapter.DUE_DATE, updatedDate); setDueDate(); }