Source:
<code>private void editMessage(final Message message, final int position) { boolean isEditingAllowed = app. getSettings(). getBoolean(Constants.IS_EDITING_ALLOWED, Constants.DEFAULT_EDITING_ALLOWED); if (!isEditingAllowed) { Toast.makeText(getContext(), R.string.editing_message_disabled, Toast.LENGTH_SHORT).show(); return; } int maxMessageContentEditLimit = app. getSettings(). getInt(Constants.MAXIMUM_CONTENT_EDIT_LIMIT, Constants.DEFAULT_MAXIMUM_CONTENT_EDIT_LIMIT); int timeSinceMessageSend = (int) ((System.currentTimeMillis() - message.getTimestamp().getTime()) / 1000); if (timeSinceMessageSend > maxMessageContentEditLimit) { Toast.makeText(getContext(), R.string.maximum_time_limit_error, Toast.LENGTH_SHORT).show(); } else { final CommonProgressDialog commonProgressDialog = new CommonProgressDialog(getContext()); commonProgressDialog.showWithMessage(getString(R.string.fetch_edit_message)); app.getZulipServices() .fetchRawMessage(message.getID()) .enqueue(new Callback<RawMessageResponse>() { @Override public void onResponse(Call<RawMessageResponse> call, Response<RawMessageResponse> response) { RawMessageResponse messageResponse = response.body(); <START> if (!messageResponse.getResult().equalsIgnoreCase("success")) { <END> Toast.makeText(getContext(), (messageResponse.getMsg() == null || TextUtils.isEmpty(messageResponse.getMsg())) ? getString(R.string.message_edit_failed) : messageResponse.getMsg(), Toast.LENGTH_SHORT).show(); commonProgressDialog.dismiss(); return; } commonProgressDialog.dismiss(); showEditMessageDialog(message, messageResponse.getRawContent(), position); } @Override public void onFailure(Call<RawMessageResponse> call, Throwable t) { commonProgressDialog.dismiss(); Toast.makeText(getContext(), R.string.message_edit_failed, Toast.LENGTH_SHORT).show(); ZLog.logException(t); } }); } }</code><technical_language>response.isSuccessful() here; [DefaultCallback abstract class](<LINK_0></technical_language>

Target:
private void editMessage(final Message message, final int position) { boolean isEditingAllowed = app. getSettings(). getBoolean(Constants.IS_EDITING_ALLOWED, Constants.DEFAULT_EDITING_ALLOWED); if (!isEditingAllowed) { Toast.makeText(getContext(), R.string.editing_message_disabled, Toast.LENGTH_SHORT).show(); return; } int maxMessageContentEditLimit = app. getSettings(). getInt(Constants.MAXIMUM_CONTENT_EDIT_LIMIT, Constants.DEFAULT_MAXIMUM_CONTENT_EDIT_LIMIT); int timeSinceMessageSend = (int) ((System.currentTimeMillis() - message.getTimestamp().getTime()) / 1000); if (timeSinceMessageSend > maxMessageContentEditLimit) { Toast.makeText(getContext(), R.string.maximum_time_limit_error, Toast.LENGTH_SHORT).show(); } else { final CommonProgressDialog commonProgressDialog = new CommonProgressDialog(getContext()); commonProgressDialog.showWithMessage(getString(R.string.fetch_edit_message)); app.getZulipServices() .fetchRawMessage(message.getID()) .enqueue(new DefaultCallback<RawMessageResponse>() { @Override public void onSuccess(Call<RawMessageResponse> call, Response<RawMessageResponse> response) { RawMessageResponse messageResponse = response.body(); commonProgressDialog.dismiss(); showEditMessageDialog(message, messageResponse.getRawContent(), position); } @Override public void onError(Call<RawMessageResponse> call, Response<RawMessageResponse> response) { RawMessageResponse messageResponse = response.body(); if (messageResponse != null) { Toast.makeText(getActivity(), (TextUtils.isEmpty(messageResponse.getMsg())) ? getString(R.string.message_edit_failed) : messageResponse.getMsg(), Toast.LENGTH_SHORT).show(); } else { Toast.makeText(getActivity(), R.string.message_edit_failed, Toast.LENGTH_SHORT).show(); } commonProgressDialog.dismiss(); } @Override public void onFailure(Call<RawMessageResponse> call, Throwable t) { super.onFailure(call, t); commonProgressDialog.dismiss(); Toast.makeText(getActivity(), R.string.message_edit_failed, Toast.LENGTH_SHORT).show(); } }); } }