/** This method used to get featured article list. */ private void getFeaturedArticles() { final SeekBar proSeekBar = IjoomerUtilities.getLoadingDialog(getString(R.string.featured_progress_title)); articlesDataProvider.getFeaturedArticles( new WebCallListenerWithCacheInfo() { @Override public void onProgressUpdate(int progressCount) { proSeekBar.setProgress(progressCount); } @Override public void onCallComplete( final int responseCode, String errorMessage, ArrayList<HashMap<String, String>> data1, Object data2, int pageNo, int pageLimit, boolean isFromCache) { try { if (responseCode == 200) { prepareList(data1, false, isFromCache, pageNo, pageLimit); listAdapterWithHolder = getListAdapter(listData); listArticle.setAdapter(listAdapterWithHolder); } else { IjoomerUtilities.getCustomOkDialog( getString(R.string.articles), getString( getResources() .getIdentifier( "code" + responseCode, "string", getActivity().getPackageName())), getString(R.string.ok), R.layout.ijoomer_ok_dialog, new CustomAlertNeutral() { @Override public void NeutralMethod() {} }); } } catch (Exception e) { } } }); }
/** This method used to get entry list. */ private void getEntries() { proSeekBar = IjoomerUtilities.getLoadingDialog(getString(R.string.dialog_loading_sending_request)); categoriesDataProvider.getEntries( IN_SECTION_ID, IN_PARENT_ID, IN_FEATUREDFIRST, new WebCallListenerWithCacheInfo() { @Override public void onProgressUpdate(int progressCount) { proSeekBar.setProgress(progressCount); } @SuppressWarnings("unchecked") @Override public void onCallComplete( final int responseCode, String errorMessage, ArrayList<HashMap<String, String>> data1, Object data2, int pageNo, int pageLimit, boolean fromCache) { try { if (responseCode == 200) { if (data2 != null) { entryListData = (List<ArrayList<HashMap<String, String>>>) data2; sectionID = entryListData.get(0).get(0).get(SECTIONID); prepareList( (List<ArrayList<HashMap<String, String>>>) data2, false, fromCache, pageNo, pageLimit); listAdapterWithHolder = getListAdapter(listData); lstEntries.setAdapter(listAdapterWithHolder); } else { IjoomerUtilities.getCustomOkDialog( ((IjoomerSuperMaster) getActivity()).getScreenCaption(), getString( getResources() .getIdentifier("code204", "string", getActivity().getPackageName())), getString(R.string.ok), R.layout.ijoomer_ok_dialog, new CustomAlertNeutral() { @Override public void NeutralMethod() {} }); sectionID = data1.get(0).get(SECTIONID); } } else { IjoomerUtilities.getCustomOkDialog( ((IjoomerSuperMaster) getActivity()).getScreenCaption(), getString( getResources() .getIdentifier( "code" + responseCode, "string", getActivity().getPackageName())), getString(R.string.ok), R.layout.ijoomer_ok_dialog, new CustomAlertNeutral() { @Override public void NeutralMethod() {} }); } } catch (Exception e) { e.printStackTrace(); } } }); }
/** This method used to update group details. */ @SuppressWarnings("unchecked") private void updateGroupDetails() { boolean validationFlag = true; ArrayList<HashMap<String, String>> groupField = new ArrayList<HashMap<String, String>>(); int size = lnr_form.getChildCount(); for (int i = 0; i < size; i++) { View v = (LinearLayout) lnr_form.getChildAt(i); HashMap<String, String> field = new HashMap<String, String>(); field.putAll((HashMap<String, String>) v.getTag()); IjoomerEditText edtValue = null; Spinner spnrValue = null; IjoomerCheckBox chbValue = null; if (field != null) { if (field.get(TYPE).equals(TEXT)) { edtValue = (IjoomerEditText) ((LinearLayout) v.findViewById(R.id.lnrEdit)).findViewById(R.id.txtValue); } else if (field.get(TYPE).equals(TEXTAREA)) { edtValue = (IjoomerEditText) ((LinearLayout) v.findViewById(R.id.lnrEditArea)).findViewById(R.id.txtValue); } else if (field.get(TYPE).equals(DATETIME)) { edtValue = (IjoomerEditText) ((LinearLayout) v.findViewById(R.id.lnrEditClickable)) .findViewById(R.id.txtValue); } else if (field.get(TYPE).equals(MAP)) { edtValue = (IjoomerEditText) ((LinearLayout) v.findViewById(R.id.lnrEditMap)).findViewById(R.id.txtValue); } if (field.get(TYPE).equals(CHECKBOX)) { chbValue = (IjoomerCheckBox) ((LinearLayout) v.findViewById(R.id.lnrCheckbox)).findViewById(R.id.txtValue); field.put(VALUE, chbValue.isChecked() ? "1" : "0"); groupField.add(field); } else if (field.get(TYPE).equals(SELECT)) { spnrValue = (Spinner) ((LinearLayout) v.findViewById(R.id.lnrSpin)).findViewById(R.id.txtValue); try { JSONArray options = new JSONArray(field.get(OPTIONS)); field.put( VALUE, ((JSONObject) options.get(spnrValue.getSelectedItemPosition())).getString(VALUE)); } catch (Throwable e) { e.printStackTrace(); } groupField.add(field); } if (edtValue != null) { if (field.get(REQUIRED).equals("1") && edtValue.getText().toString().length() <= 0) { edtValue.setError(getString(R.string.validation_value_required)); validationFlag = false; } else { field.put(VALUE, edtValue.getText().toString().trim()); groupField.add(field); } } } } if (validationFlag) { final SeekBar proSeekBar = IjoomerUtilities.getLoadingDialog(getString(R.string.dialog_loading_sending_request)); new JomGroupDataProvider(JomGroupCreateActivity.this) .addOrEditGroupSubmit( IN_GROUP_ID, groupField, new WebCallListener() { @Override public void onProgressUpdate(int progressCount) { proSeekBar.setProgress(progressCount); } @Override public void onCallComplete( final int responseCode, String errorMessage, ArrayList<HashMap<String, String>> data1, Object data2) { if (responseCode == 200) { updateHeader(dataProvider.getNotificationData()); IjoomerApplicationConfiguration.setReloadRequired(true); finish(); } else { if (errorMessage != null && errorMessage.length() > 0 && !errorMessage.equals("null")) { IjoomerUtilities.getCustomOkDialog( getString(R.string.group), errorMessage, getString(R.string.ok), R.layout.ijoomer_ok_dialog, new CustomAlertNeutral() { @Override public void NeutralMethod() {} }); } else { IjoomerUtilities.getCustomOkDialog( getString(R.string.group), getString( getResources() .getIdentifier( "code" + responseCode, "string", getPackageName())), getString(R.string.ok), R.layout.ijoomer_ok_dialog, new CustomAlertNeutral() { @Override public void NeutralMethod() {} }); } } } }); } }