public Intent startChange() { if (mContentChangedModel.getType() == null) { Log.e(TAG, "type is null"); return null; } try { String extraUpdate = null; switch (mContentChangedModel.getType()) { case REMOVED: extraUpdate = removeContent(); break; case UPDATED: extraUpdate = updateContent(); break; case CREATED: extraUpdate = createNewContent(); break; } if (extraUpdate != null) { Intent intent = new Intent(); intent.setAction(IntentConsts.UPDATE_CONTENT); intent.putExtra(IntentConsts.Extra.CONTENT_TYPE, extraUpdate); } return null; } catch (RuntimeException e) { Log.e(TAG, "E= " + e.toString()); return null; } }
private String updateContent() { Log.e(TAG, "update = " + mContentChangedModel.toString()); if (!TextUtils.isEmpty(mContentChangedModel.episodeId)) { return updateEpisode(mContentChangedModel.episodeId); } if (!TextUtils.isEmpty(mContentChangedModel.sceneId)) { return updateScene(mContentChangedModel.sceneId); } if (!TextUtils.isEmpty(mContentChangedModel.taskId)) { return updateTask(mContentChangedModel.taskId); } return null; }
private String createNewContent() { Log.e(TAG, "create new = " + mContentChangedModel.toString()); if (!TextUtils.isEmpty(mContentChangedModel.taskId)) { return createNewTask(mContentChangedModel.taskId, mContentChangedModel.sceneId); } if (!TextUtils.isEmpty(mContentChangedModel.sceneId)) { return createNewScene(mContentChangedModel.sceneId, mContentChangedModel.episodeId); } if (!TextUtils.isEmpty(mContentChangedModel.episodeId)) { return createNewEpisode(mContentChangedModel.episodeId, mContentChangedModel.courseId); } return null; }