List of usage examples for android.widget LinearLayout removeView
@Override public void removeView(View view)
Note: do not invoke this method from #draw(android.graphics.Canvas) , #onDraw(android.graphics.Canvas) , #dispatchDraw(android.graphics.Canvas) or any related method.
From source file:com.todoroo.astrid.files.FilesControlSet.java
@Override protected void afterInflate() { LinearLayout fileList = (LinearLayout) getDialogView().findViewById(R.id.files_list); final LinearLayout finalList = fileList; fileList.removeAllViews();//from w w w . ja v a2 s. c o m LayoutParams lp = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT); for (final TaskAttachment m : files) { final View fileRow = inflater.inflate(R.layout.file_row, null); setUpFileRow(m, fileRow, fileList, lp); View name = fileRow.findViewById(R.id.file_text); View clearFile = fileRow.findViewById(R.id.remove_file); name.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { showFile(m); } }); clearFile.setVisibility(View.VISIBLE); clearFile.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dialogBuilder.newMessageDialog(R.string.premium_remove_file_confirm) .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (RemoteModel.isValidUuid(m.getUUID())) { // TODO: delete m.setDeletedAt(DateUtilities.now()); taskAttachmentDao.saveExisting(m); } else { taskAttachmentDao.delete(m.getId()); } if (m.containsNonNullValue(TaskAttachment.FILE_PATH)) { File f = new File(m.getFilePath()); f.delete(); } files.remove(m); refreshDisplayView(); finalList.removeView(fileRow); } }).setNegativeButton(android.R.string.cancel, null).show(); } }); } }
From source file:com.mobiletin.inputmethod.indic.LatinIME.java
@Override public void setInputView(final View view) { super.setInputView(view); mInputView = view;//ww w. ja va 2 s . co m mSuggestionStripView = (SuggestionStripView) view.findViewById(R.id.suggestion_strip_view); if (hasSuggestionStripView()) { mSuggestionStripView.setListener(this, view); } adView = (AdView) view.findViewById(R.id.adView); LinearLayout linearLayout = (LinearLayout) adView.getParent(); View frameLayout = new FrameLayout(this); frameLayout.getLayoutParams(); LayoutParams layoutParams = adView.getLayoutParams(); linearLayout.removeView(adView); linearLayout.removeView(frameLayout); final int layoutDirection = true ? ViewCompat.LAYOUT_DIRECTION_RTL : ViewCompat.LAYOUT_DIRECTION_LTR; ViewCompat.setLayoutDirection(adView, layoutDirection); linearLayout.addView(adView, layoutParams); AdRequest adRequest = new AdRequest.Builder().build(); adView.loadAd(adRequest); /* layoutParams = this.mCustomView.getLayoutParams(); layoutParams.height = 380; this.mCustomView.setLayoutParams(layoutParams);*/ mInputLogic.setTextDecoratorUi(new TextDecoratorUi(this, view)); }
From source file:com.android.calendar.EventInfoFragment.java
@Override public void onClick(View view) { // This must be a click on one of the "remove reminder" buttons LinearLayout reminderItem = (LinearLayout) view.getParent(); LinearLayout parent = (LinearLayout) reminderItem.getParent(); parent.removeView(reminderItem); mReminderViews.remove(reminderItem); mUserModifiedReminders = true;/*from w ww.j ava 2 s. c om*/ EventViewUtils.updateAddReminderButton(mView, mReminderViews, mMaxReminders); }
From source file:com.heath_bar.tvdb.SeriesOverview.java
protected void ShowHideEpisodes(View seasonRow) { // Get the linear layout that we will be adding/removing the episodes to/from LinearLayout epLinearLayout = (LinearLayout) seasonRow; if (epLinearLayout.getChildCount() == 1) { // if collapsed, expand (add) the seasons TextView seasonText = (TextView) seasonRow.findViewById(R.id.season_text); seasonText.setCompoundDrawablesWithIntrinsicBounds(getResources().getDrawable(R.drawable.arrow_down), null, null, null);/*www . j a v a2 s . c o m*/ LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); for (int i = 0; i < episodeList.size(); i++) { if (seasonRow.getId() == episodeList.get(i).getSeason()) { View episodeView = inflater.inflate(R.layout.episode_text_row, epLinearLayout, false); episodeView.setBackgroundColor( AppSettings.listBackgroundColors[i % AppSettings.listBackgroundColors.length]); TextView text = (TextView) episodeView.findViewById(R.id.text); String nameText = String.format("%02d", episodeList.get(i).getNumber()) + " " + episodeList.get(i).getName(); text.setText(nameText); text.setTextSize(textSize); text.setId(episodeList.get(i).getId()); episodeView.setOnClickListener(episodeListener); epLinearLayout.addView(episodeView); } } } else { // else season is expanded, collapse it TextView seasonText = (TextView) seasonRow.findViewById(R.id.season_text); seasonText.setCompoundDrawablesWithIntrinsicBounds(getResources().getDrawable(R.drawable.arrow_right), null, null, null); for (int i = epLinearLayout.getChildCount() - 1; i > 0; i--) { epLinearLayout.removeView(epLinearLayout.getChildAt(i)); } } }
From source file:dentex.youtube.downloader.DashboardActivity.java
public void hideSearchBar() { Utils.logger("d", "hiding searchbar...", DEBUG_TAG); LinearLayout layout = (LinearLayout) findViewById(R.id.dashboard); EditText inputSearch = (EditText) findViewById(999); // hide keyboard InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(inputSearch.getWindowToken(), 0); // store text and remove EditText searchText = inputSearch.getEditableText(); layout.removeView(inputSearch); Utils.reload(DashboardActivity.this); isSearchBarVisible = false;//from www .j a v a 2 s .c om }
From source file:com.narkii.security.info.BaseDataFragment.java
/** * viewLinearLayoutmodule_responser_manager_info * @param view/*from w w w. jav a2 s.c o m*/ */ private void addPersonInfoView(View view, Cursor cursor) { final LinearLayout parent = (LinearLayout) view.getParent().getParent(); LayoutInflater inflater = LayoutInflater.from(getActivity()); View subView = inflater.inflate(R.layout.module_responser_manager_info, null); EditText name = (EditText) subView.findViewById(R.id.text_person_name); EditText phone = (EditText) subView.findViewById(R.id.text_person_phone); EditText emial = (EditText) subView.findViewById(R.id.text_person_email); EditText safe = (EditText) subView.findViewById(R.id.text_license_secure); EditText issueDate = (EditText) subView.findViewById(R.id.text_date_deliver); EditText validDate = (EditText) subView.findViewById(R.id.text_date_validate); final Button delButton = (Button) subView.findViewById(R.id.delete_person); if (cursor != null) { name.setText(cursor.getString(cursor.getColumnIndex(EnterprisePerson.COLUMN_NAME))); name.setTag(cursor.getString(cursor.getColumnIndex(EnterprisePerson.COLUMN_NAME))); phone.setText(cursor.getString(cursor.getColumnIndex(EnterprisePerson.COLUMN_PHONE))); phone.setTag(cursor.getString(cursor.getColumnIndex(EnterprisePerson.COLUMN_PHONE))); emial.setText(cursor.getString(cursor.getColumnIndex(EnterprisePerson.COLUMN_EMAIL))); emial.setTag(cursor.getString(cursor.getColumnIndex(EnterprisePerson.COLUMN_EMAIL))); safe.setText(cursor.getString(cursor.getColumnIndex(EnterprisePerson.COLUMN_SAFE_PAPER))); safe.setTag(cursor.getString(cursor.getColumnIndex(EnterprisePerson.COLUMN_SAFE_PAPER))); issueDate.setText(cursor.getString(cursor.getColumnIndex(EnterprisePerson.COLUMN_ISSUE_DATE))); issueDate.setTag(cursor.getString(cursor.getColumnIndex(EnterprisePerson.COLUMN_ISSUE_DATE))); validDate.setText(cursor.getString(cursor.getColumnIndex(EnterprisePerson.COLUMN_VALID_DATE))); validDate.setTag(cursor.getString(cursor.getColumnIndex(EnterprisePerson.COLUMN_VALID_DATE))); delButton.setTag(cursor.getLong(cursor.getColumnIndex(EnterprisePerson._ID))); personViews.add(subView); } else { addPersonViews.add(subView); } //personui if (view.equals(addResponButton)) subView.setTag(1); else subView.setTag(2); parent.addView(subView); delButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Log.d(TAG, "delete person id:" + v.getTag()); if (v.getTag() != null) { deleteViews.add((Long) v.getTag()); personViews.remove((View) v.getParent().getParent()); } else { addPersonViews.remove((View) v.getParent().getParent()); } parent.removeView((View) v.getParent().getParent()); } }); }
From source file:com.java2s.intents4.IntentsDemo4Activity.java
void addRow(final LinearLayout layout, String label, String hintStr, boolean addRadioGroup) { LinearLayout.LayoutParams rowLayoutParams = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); LinearLayout.LayoutParams editTextLayoutParams = new LinearLayout.LayoutParams(400, LinearLayout.LayoutParams.WRAP_CONTENT, 1); if (addRadioGroup) { editTextLayoutParams = new LinearLayout.LayoutParams(400, LinearLayout.LayoutParams.WRAP_CONTENT, 1); }//w w w. j a v a2s. c o m LinearLayout.LayoutParams buttonLayoutParams = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT, 0); LinearLayout row = new LinearLayout(this); row.setOrientation(LinearLayout.HORIZONTAL); row.setGravity(Gravity.CENTER_VERTICAL); TextView textView = new TextView(this); textView.setText(label); row.addView(textView); EditText editText = new EditText(this); editText.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12); editText.setHint(hintStr); editText.setLayoutParams(editTextLayoutParams); if (!isFirstTime) { editText.requestFocus(); } row.addView(editText); if (addRadioGroup) { LinearLayout groupLayout = new LinearLayout(this); groupLayout.setOrientation(LinearLayout.VERTICAL); groupLayout.setGravity(Gravity.CENTER_HORIZONTAL); RadioGroup group = new RadioGroup(this); group.setLayoutParams(new RadioGroup.LayoutParams(RadioGroup.LayoutParams.WRAP_CONTENT, RadioGroup.LayoutParams.WRAP_CONTENT)); final Button patternButton = new Button(this); patternButton.setText(pathPatterns[0]); patternButton.setTextSize(8); patternButton.setLayoutParams(buttonLayoutParams); patternButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { String patternButtonText = patternButton.getText().toString().trim(); if (patternButtonText.equals(pathPatterns[0])) { patternButton.setText(pathPatterns[1]); } else if (patternButtonText.equals(pathPatterns[1])) { patternButton.setText(pathPatterns[2]); } else if (patternButtonText.equals(pathPatterns[2])) { patternButton.setText(pathPatterns[0]); } } }); groupLayout.addView(patternButton); row.addView(groupLayout); } Button button = new Button(this); button.setTextSize(10); button.setTypeface(null, Typeface.BOLD); button.setText("X"); button.setTypeface(Typeface.SANS_SERIF, Typeface.BOLD); button.setLayoutParams(buttonLayoutParams); button.setOnClickListener(new OnClickListener() { public void onClick(View view) { layout.removeView((LinearLayout) view.getParent()); } }); row.addView(button); row.setLayoutParams(rowLayoutParams); layout.addView(row); }
From source file:piuk.blockchain.android.ui.dialogs.TransactionSummaryDialog.java
@Override public Dialog onCreateDialog(final Bundle savedInstanceState) { super.onCreateDialog(savedInstanceState); final FragmentActivity activity = getActivity(); final LayoutInflater inflater = LayoutInflater.from(activity); final Builder dialog = new AlertDialog.Builder(new ContextThemeWrapper(activity, R.style.Theme_Dialog)) .setTitle(R.string.transaction_summary_title); final LinearLayout view = (LinearLayout) inflater.inflate(R.layout.transaction_summary_fragment, null); dialog.setView(view);/*from w ww . ja v a2 s .c o m*/ try { final MyRemoteWallet wallet = application.getRemoteWallet(); BigInteger totalOutputValue = BigInteger.ZERO; for (TransactionOutput output : tx.getOutputs()) { totalOutputValue = totalOutputValue.add(output.getValue()); } final TextView resultDescriptionView = (TextView) view.findViewById(R.id.result_description); final TextView toView = (TextView) view.findViewById(R.id.transaction_to); final TextView toViewLabel = (TextView) view.findViewById(R.id.transaction_to_label); final View toViewContainer = (View) view.findViewById(R.id.transaction_to_container); final TextView hashView = (TextView) view.findViewById(R.id.transaction_hash); final TextView transactionTimeView = (TextView) view.findViewById(R.id.transaction_date); final TextView confirmationsView = (TextView) view.findViewById(R.id.transaction_confirmations); final TextView noteView = (TextView) view.findViewById(R.id.transaction_note); final Button addNoteButton = (Button) view.findViewById(R.id.add_note_button); final TextView feeView = (TextView) view.findViewById(R.id.transaction_fee); final View feeViewContainer = view.findViewById(R.id.transaction_fee_container); final TextView valueNowView = (TextView) view.findViewById(R.id.transaction_value); final View valueNowContainerView = view.findViewById(R.id.transaction_value_container); String to = null; for (TransactionOutput output : tx.getOutputs()) { try { String toAddress = output.getScriptPubKey().getToAddress().toString(); if (!wallet.isAddressMine(toAddress)) { to = toAddress; } } catch (Exception e) { e.printStackTrace(); } } String from = null; for (TransactionInput input : tx.getInputs()) { try { String fromAddress = input.getFromAddress().toString(); if (!wallet.isAddressMine(fromAddress)) { from = fromAddress; } } catch (Exception e) { e.printStackTrace(); } } long realResult = 0; int confirmations = 0; if (tx instanceof MyTransaction) { MyTransaction myTx = (MyTransaction) tx; realResult = myTx.getResult().longValue(); if (wallet.getLatestBlock() != null) { confirmations = wallet.getLatestBlock().getHeight() - myTx.getHeight() + 1; } } else if (application.isInP2PFallbackMode()) { realResult = tx.getValue(application.bitcoinjWallet).longValue(); if (tx.getConfidence().getConfidenceType() == ConfidenceType.BUILDING) confirmations = tx.getConfidence().getDepthInBlocks(); } final long finalResult = realResult; if (realResult <= 0) { toViewLabel.setText(R.string.transaction_fragment_to); if (to == null) { ((LinearLayout) toViewContainer.getParent()).removeView(toViewContainer); } else { toView.setText(to); } } else { toViewLabel.setText(R.string.transaction_fragment_from); if (from == null) { ((LinearLayout) toViewContainer.getParent()).removeView(toViewContainer); } else { toView.setText(from); } } //confirmations view if (confirmations > 0) { confirmationsView.setText("" + confirmations); } else { confirmationsView.setText("Unconfirmed"); } //Hash String view final String hashString = new String(Hex.encode(tx.getHash().getBytes()), "UTF-8"); hashView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https:/" + Constants.BLOCKCHAIN_DOMAIN + "/tx/" + hashString)); startActivity(browserIntent); } }); //Notes View String note = wallet.getTxNotes().get(hashString); if (note == null) { addNoteButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dismiss(); AddNoteDialog.showDialog(getFragmentManager(), hashString); } }); view.removeView(noteView); } else { view.removeView(addNoteButton); noteView.setText(note); noteView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dismiss(); AddNoteDialog.showDialog(getFragmentManager(), hashString); } }); } addNoteButton.setEnabled(!application.isInP2PFallbackMode()); SpannableString content = new SpannableString(hashString); content.setSpan(new UnderlineSpan(), 0, content.length(), 0); hashView.setText(content); if (realResult > 0 && from != null) resultDescriptionView.setText(this.getString(R.string.transaction_fragment_amount_you_received, WalletUtils.formatValue(BigInteger.valueOf(realResult)))); else if (realResult < 0 && to != null) resultDescriptionView.setText(this.getString(R.string.transaction_fragment_amount_you_sent, WalletUtils.formatValue(BigInteger.valueOf(realResult)))); else resultDescriptionView.setText(this.getString(R.string.transaction_fragment_amount_you_moved, WalletUtils.formatValue(totalOutputValue))); final Date time = tx.getUpdateTime(); transactionTimeView.setText(dateFormat.format(time)); //These will be made visible again later once information is fetched from server feeViewContainer.setVisibility(View.GONE); valueNowContainerView.setVisibility(View.GONE); if (tx instanceof MyTransaction) { MyTransaction myTx = (MyTransaction) tx; final long txIndex = myTx.getTxIndex(); final Handler handler = new Handler(); new Thread(new Runnable() { @Override public void run() { try { final JSONObject obj = getTransactionSummary(txIndex, wallet.getGUID(), finalResult); handler.post(new Runnable() { @Override public void run() { try { if (obj.get("fee") != null) { feeViewContainer.setVisibility(View.VISIBLE); feeView.setText(WalletUtils.formatValue( BigInteger.valueOf(Long.valueOf(obj.get("fee").toString()))) + " BTC"); } if (obj.get("confirmations") != null) { int confirmations = ((Number) obj.get("confirmations")).intValue(); confirmationsView.setText("" + confirmations); } String result_local = (String) obj.get("result_local"); String result_local_historical = (String) obj .get("result_local_historical"); if (result_local != null && result_local.length() > 0) { valueNowContainerView.setVisibility(View.VISIBLE); if (result_local_historical == null || result_local_historical.length() == 0 || result_local_historical.equals(result_local)) { valueNowView.setText(result_local); } else { valueNowView.setText(getString(R.string.value_now_ten, result_local, result_local_historical)); } } } catch (Exception e) { e.printStackTrace(); } } }); } catch (Exception e) { e.printStackTrace(); } } }).start(); } } catch (Exception e) { e.printStackTrace(); } Dialog d = dialog.create(); WindowManager.LayoutParams lp = new WindowManager.LayoutParams(); lp.dimAmount = 0; lp.width = WindowManager.LayoutParams.FILL_PARENT; lp.height = WindowManager.LayoutParams.WRAP_CONTENT; d.show(); d.getWindow().setAttributes(lp); d.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); return d; }
From source file:br.org.funcate.dynamicforms.FragmentDetail.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.details, container, false); LinearLayout mainView = (LinearLayout) view.findViewById(R.id.form_linear); FragmentDetailActivity fragmentDetailActivity; try {/*w w w . ja v a 2 s . c o m*/ FragmentActivity activity = getActivity(); if (selectedFormName == null || sectionObject == null) { FragmentList fragmentList = (FragmentList) getFragmentManager().findFragmentById(R.id.listFragment); if (fragmentList != null) { selectedFormName = fragmentList.getSelectedItemName(); sectionObject = fragmentList.getSectionObject(); noteId = fragmentList.getNoteId(); } else { if (activity instanceof FragmentDetailActivity) { // case of portrait mode fragmentDetailActivity = (FragmentDetailActivity) activity; selectedFormName = fragmentDetailActivity.getFormName(); sectionObject = fragmentDetailActivity.getSectionObject(); noteId = fragmentDetailActivity.getNoteId(); workingDirectory = fragmentDetailActivity.getWorkingDirectory(); existingFeatureData = fragmentDetailActivity.getFeatureData(); } } } if (selectedFormName != null) { JSONObject formObject = TagsManager.getForm4Name(selectedFormName, sectionObject); key2WidgetMap.clear(); requestCodes2WidgetMap.clear(); int requestCode = 666; keyList.clear(); key2ConstraintsMap.clear(); if (formObject != null) {// Test to get form configuration to this layer JSONArray formItemsArray = TagsManager.getFormItems(formObject); int length = ((formItemsArray != null) ? (formItemsArray.length()) : (0)); for (int i = 0; i < length; i++) { JSONObject jsonObject = formItemsArray.getJSONObject(i); String key = "-"; //$NON-NLS-1$ if (jsonObject.has(TAG_KEY)) key = jsonObject.getString(TAG_KEY).trim(); String label = key; if (jsonObject.has(TAG_LABEL)) label = jsonObject.getString(TAG_LABEL).trim(); String type = FormUtilities.TYPE_STRING; if (jsonObject.has(TAG_TYPE)) { type = jsonObject.getString(TAG_TYPE).trim(); } boolean readonly = false; if (jsonObject.has(TAG_READONLY)) { String readonlyStr = jsonObject.getString(TAG_READONLY).trim(); readonly = Boolean.parseBoolean(readonlyStr); } // if attribute has a non printable char, force readonly mode. if (Utilities.existUnprintableCharacters(key)) { readonly = true; } Constraints constraints = new Constraints(); FormUtilities.handleConstraints(jsonObject, constraints); key2ConstraintsMap.put(key, constraints); String constraintDescription = constraints.getDescription(); Object o; GView addedView = null; if (type.equals(TYPE_STRING)) { o = getValueFromExtras(jsonObject, key); String value = ((String) o).trim(); addedView = FormUtilities.addEditText(activity, mainView, label, value, 0, 0, constraintDescription, readonly); } else if (type.equals(TYPE_STRINGAREA)) { o = getValueFromExtras(jsonObject, key); String value = ((String) o).trim(); addedView = FormUtilities.addEditText(activity, mainView, label, value, 0, 7, constraintDescription, readonly); } else if (type.equals(TYPE_DOUBLE)) { o = getValueFromExtras(jsonObject, key); String value = ((String) o).trim(); addedView = FormUtilities.addEditText(activity, mainView, label, value, 1, 0, constraintDescription, readonly); } else if (type.equals(TYPE_INTEGER)) { o = getValueFromExtras(jsonObject, key); String value = ((String) o).trim(); addedView = FormUtilities.addEditText(activity, mainView, label, value, 4, 0, constraintDescription, readonly); } else if (type.equals(TYPE_DATE)) { o = getValueFromExtras(jsonObject, key); String value = ((String) o).trim(); addedView = FormUtilities.addDateView(FragmentDetail.this, mainView, label, value, constraintDescription, readonly); } else if (type.equals(TYPE_TIME)) { o = getValueFromExtras(jsonObject, key); String value = ((String) o).trim(); addedView = FormUtilities.addTimeView(FragmentDetail.this, mainView, label, value, constraintDescription, readonly); } else if (type.equals(TYPE_LABEL)) { String size = "20"; //$NON-NLS-1$ if (jsonObject.has(TAG_SIZE)) size = jsonObject.getString(TAG_SIZE); String url = null; if (jsonObject.has(TAG_URL)) url = jsonObject.getString(TAG_URL); o = getValueFromExtras(jsonObject, key); String value = ((String) o).trim(); addedView = FormUtilities.addTextView(activity, mainView, value, size, false, url); } else if (type.equals(TYPE_LABELWITHLINE)) { String size = "20"; //$NON-NLS-1$ if (jsonObject.has(TAG_SIZE)) size = jsonObject.getString(TAG_SIZE); String url = null; if (jsonObject.has(TAG_URL)) url = jsonObject.getString(TAG_URL); o = getValueFromExtras(jsonObject, key); String value = ((String) o).trim(); addedView = FormUtilities.addTextView(activity, mainView, value, size, true, url); } else if (type.equals(TYPE_BOOLEAN)) { o = getValueFromExtras(jsonObject, key); String value = ((String) o).trim(); addedView = FormUtilities.addBooleanView(activity, mainView, label, value, constraintDescription, readonly); } else if (type.equals(TYPE_STRINGCOMBO)) { JSONArray comboItems = TagsManager.getComboItems(jsonObject); String[] itemsArray = TagsManager.comboItems2StringArray(comboItems); o = getValueFromExtras(jsonObject, key); String value = ((String) o).trim(); addedView = FormUtilities.addComboView(activity, mainView, label, value, itemsArray, constraintDescription); } else if (type.equals(TYPE_CONNECTEDSTRINGCOMBO)) { LinkedHashMap<String, List<String>> valuesMap = TagsManager .extractComboValuesMap(jsonObject); o = getValueFromExtras(jsonObject, key); String value = ((String) o).trim(); addedView = FormUtilities.addConnectedComboView(activity, mainView, label, value, valuesMap, constraintDescription); } else if (type.equals(TYPE_STRINGMULTIPLECHOICE)) { JSONArray comboItems = TagsManager.getComboItems(jsonObject); String[] itemsArray = TagsManager.comboItems2StringArray(comboItems); o = getValueFromExtras(jsonObject, key); String value = ((String) o).trim(); addedView = FormUtilities.addMultiSelectionView(activity, mainView, label, value, itemsArray, constraintDescription); } else if (type.equals(TYPE_PICTURES)) { o = getValueFromExtras(jsonObject, FormUtilities.IMAGE_MAP); Map<String, Map<String, String>> value = null; String clazz = o.getClass().getSimpleName(); if (("bundle").equalsIgnoreCase(clazz)) { Bundle imageMapBundle = (Bundle) o; Bundle imageMapThumbnailBundle = imageMapBundle.getBundle("thumbnail"); Bundle imageMapDisplayBundle = imageMapBundle.getBundle("display"); if (imageMapThumbnailBundle != null && imageMapDisplayBundle != null) { Set<String> keys = imageMapThumbnailBundle.keySet(); Iterator<String> itKeys = keys.iterator(); if (keys.size() > 0) { value = new HashMap<String, Map<String, String>>(keys.size()); while (itKeys.hasNext()) { String keyMap = itKeys.next(); Map<String, String> imagePaths = new HashMap<String, String>(2); imagePaths.put("thumbnail", (String) imageMapThumbnailBundle.get(keyMap)); imagePaths.put("display", (String) imageMapDisplayBundle.get(keyMap)); value.put(keyMap, imagePaths); } } } } addedView = FormUtilities.addPictureView(this, requestCode, mainView, label, value, constraintDescription); } /*else if (type.equals(TYPE_SKETCH)) { addedView = FormUtilities.addSketchView(noteId, this, requestCode, mainView, label, value, constraintDescription); } */ else { Toast.makeText(getActivity().getApplicationContext(), "Type non implemented yet: " + type, Toast.LENGTH_LONG).show(); } /* } else if (type.equals(TYPE_MAP)) { if (value.length() <= 0) { // need to read image File tempDir = ResourcesManager.getInstance(activity).getTempDir(); File tmpImage = new File(tempDir, LibraryConstants.TMPPNGIMAGENAME); if (tmpImage.exists()) { byte[][] imageAndThumbnailFromPath = ImageUtilities.getImageAndThumbnailFromPath(tmpImage.getAbsolutePath(), 1); Date date = new Date(); String mapImageName = ImageUtilities.getMapImageName(date); IImagesDbHelper imageHelper = DefaultHelperClasses.getDefaulfImageHelper(); long imageId = imageHelper.addImage(longitude, latitude, -1.0, -1.0, date.getTime(), mapImageName, imageAndThumbnailFromPath[0], imageAndThumbnailFromPath[1], noteId); value = "" + imageId; } } addedView = FormUtilities.addMapView(activity, mainView, label, value, constraintDescription); } else if (type.equals(TYPE_NFCUID)) { addedView = new GNfcUidView(this, null, requestCode, mainView, label, value, constraintDescription); } else { GPLog.addLogEntry(this, null, null, "Type non implemented yet: " + type); }*/ key2WidgetMap.put(key, addedView); keyList.add(key); requestCodes2WidgetMap.put(requestCode, addedView); requestCode++; } // end of the form items loop } else { String size = "20"; //$NON-NLS-1$ String url = null; String value = getResources().getString(R.string.error_while_loading_form_configuration); GView addedView = FormUtilities.addTextView(activity, mainView, value, size, true, url); String key = "-"; //$NON-NLS-1$ key2WidgetMap.put(key, addedView); keyList.add(key); requestCodes2WidgetMap.put(requestCode, addedView); } LinearLayout btnLinear = (LinearLayout) mainView.findViewById(R.id.btn_linear); if (keyList.size() == 1) { Button btnSave = (Button) btnLinear.findViewById(R.id.saveButton); btnSave.setEnabled(false); } mainView.removeView(btnLinear); mainView.addView(btnLinear); } } catch (ParseException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); Toast.makeText(getActivity().getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show(); } return view; }