@Override public void parseJson(int code, JSONObject respanse, String tag, int pos, Object data) throws JSONException { super.parseJson(code, respanse, tag, pos, data); if (tag.equals(urlFiles)) { if (code == 0) { hideProgressDialog(); JSONObject file = respanse.getJSONObject("data").getJSONObject("file"); mFiles = new AttachmentFileObject(file); String content = respanse.getJSONObject("data").optString("content"); textView.setText(content); invalidateOptionsMenu(); } else { if (code == ImagePagerFragment.HTTP_CODE_FILE_NOT_EXIST) { BlankViewDisplay.setBlank(0, this, true, blankLayout, null); } else { BlankViewDisplay.setBlank( 0, this, false, blankLayout, new View.OnClickListener() { @Override public void onClick(View v) { getFileUrlFromNetwork(); } }); } hideProgressDialog(); showErrorMsg(code, respanse); } } }
@Override public void parseJson(int code, JSONObject response, String tag, int pos, Object data) throws JSONException { if (tag.equals(urlFiles)) { if (code == 0) { fileUrlSuccess = true; invalidateOptionsMenu(); JSONObject file = response.getJSONObject("data").getJSONObject("file"); mFileObject = new AttachmentFileObject(file); mAttachmentFileObject = mFileObject; downloadId = downloadList.getLong(mFileObject.file_id, 0L); bindView(); if (mFile.exists() && mFile.isFile()) { Log.d(TAG, "mFile exists:"); if (downloadId != 0L) { updateView(); } showState(STATE_FINISHDOWNLOAD); } else { Log.d(TAG, "mFile not exists:"); showState(STATE_NEEDDOWNLOAD); } } else { hideProgressDialog(); showErrorMsg(code, response); if (code == ImagePagerFragment.HTTP_CODE_FILE_NOT_EXIST) { BlankViewDisplay.setBlank(0, this, true, blankLayout, null); } else { BlankViewDisplay.setBlank( 0, this, false, blankLayout, new View.OnClickListener() { @Override public void onClick(View v) { getFileUrlFromNetwork(); } }); } } } else if (tag.equals(HOST_FILE_DELETE)) { if (code == 0) { hideProgressDialog(); showButtomToast("删除完成"); Intent resultIntent = new Intent(); resultIntent.putExtra("mAttachmentFileObject", mAttachmentFileObject); setResult(RESULT_OK, resultIntent); finish(); } else { showErrorMsg(code, response); } } }
@Override public void parseJson(int code, JSONObject respanse, String tag, int pos, Object data) throws JSONException { if (tag.equals(HOST_GIT_TREEINFO)) { hideProgressDialog(); setRefreshing(false); if (code == 0) { if (isLoadingFirstPage(tag)) { mData.clear(); } JSONArray getFileInfos = respanse.getJSONObject("data").getJSONArray("infos"); for (int i = 0; i < getFileInfos.length(); ++i) { GitFileInfoObject fileInfoObject = new GitFileInfoObject(getFileInfos.getJSONObject(i)); mData.add(fileInfoObject); } adapter.notifyDataSetChanged(); } else { showErrorMsg(code, respanse); } } else if (tag.equals(HOST_GIT_TREE)) { if (code == 0) { host_git_treeinfo_url = String.format( HOST_GIT_TREEINFO, mProjectObject.owner_user_name, mProjectObject.name, pathStack.peek()); getNetwork(host_git_treeinfo_url, HOST_GIT_TREEINFO); } else { hideProgressDialog(); setRefreshing(false); BlankViewDisplay.setBlank(0, this, true, blankLayout, onClickRetry); } } }