List of usage examples for android.widget LinearLayout removeAllViews
public void removeAllViews()
From source file:com.flipzu.flipzu.Recorder.java
@Override public void onCommentsReceived(Hashtable<String, String>[] comments) { debug.logV(TAG, "onCommentsReceived"); final LinearLayout cc = (LinearLayout) findViewById(R.id.comments_container); /* cleanup comments first */ cc.removeAllViews(); /* get pixel values for various DIPs */ final float scale = getResources().getDisplayMetrics().density; // final int pixel_10 = 10 / (int) (scale + 0.5f); final int pixel_5 = 5 / (int) (scale + 0.5f); // final int pixel_30 = 30 / (int) (scale + 0.5f); final LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); if (comments != null && comments.length > 0) { for (int i = 0; i < comments.length; i++) { LinearLayout cl = new LinearLayout(Recorder.this); cl.setOrientation(LinearLayout.HORIZONTAL); cl.setPadding(0, 0, 0, pixel_5); debug.logD(TAG, "Refresher comment " + comments[i]); /* comment */ TextView comment_tv = new TextView(Recorder.this); comment_tv.setLayoutParams(params); comment_tv.setText(comments[i].get("username") + ": " + comments[i].get("comment"), TextView.BufferType.SPANNABLE); comment_tv.setTextColor(Color.parseColor("#656565")); Spannable comment_span = (Spannable) comment_tv.getText(); comment_span.setSpan(new StyleSpan(android.graphics.Typeface.BOLD), 0, comment_tv.getText().length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); comment_span.setSpan(new ForegroundColorSpan(Color.parseColor("#182e5b")), 0, comments[i].get("username").length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); comment_tv.setText(comment_span); cl.addView(comment_tv);/* ww w . j a va2 s . c o m*/ cc.addView(cl); } } else { if (mState == recorderState.RECORDING) { String msg = "You're LIVE! Your broadcast can be heard at http://flipzu.com/" + mUser.getUsername(); showFlipzuTipsOffline(cc, params, msg); } else { String msg = "Pick a good and descriptive broadcast title. A great title will attract more listeners!"; showFlipzuTipsOffline(cc, params, msg); msg = "You can disable sharing in Twitter and Facebook by clicking the logo buttons. This is great for testing."; showFlipzuTipsOffline(cc, params, msg); msg = "Press the \"Start Broadcast\" button and let them hear you!"; showFlipzuTipsOffline(cc, params, msg); } } }
From source file:cz.muni.fi.japanesedictionary.fragments.DisplayTranslation.java
/** * Updates Fragment view acording to saved translation. *///from w w w . ja va2 s. co m public void updateTranslation(View view) { Log.i(LOG_TAG, " Update translation"); if (getActivity() == null || view == null) { return; } TextView layoutSelect = (TextView) view.findViewById(R.id.translation_select); LinearLayout layoutTranslation = (LinearLayout) view.findViewById(R.id.translation_container); if (mTranslation == null) { layoutSelect.setVisibility(View.VISIBLE); layoutTranslation.setVisibility(View.GONE); return; } Log.i(LOG_TAG, " Ruby: " + mTranslation.getRuby()); layoutSelect.setVisibility(View.GONE); layoutTranslation.setVisibility(View.VISIBLE); updateLanguages(); LinearLayout readWriteContainer = (LinearLayout) view .findViewById(R.id.translation_reading_writing_container); readWriteContainer.removeAllViews(); //Ruby: ,?;?;?;,??; String writeCharacters = null; StringBuilder alternativeStrBuilder = new StringBuilder(); if (mTranslation.getRuby() != null) { String ruby = mTranslation.getRuby(); String[] pairs = ruby.split(";"); for (String pair : pairs) { View viewReading = mInflater.inflate(R.layout.display_translation_reading_group, readWriteContainer, false); String[] parts = pair.split(","); TextView writing = (TextView) viewReading.findViewById(R.id.translation_write); writing.setText(parts[0]); if (parts.length == 2) { TextView reading = (TextView) viewReading.findViewById(R.id.translation_read); reading.setText(parts[1]); } readWriteContainer.addView(viewReading); } } else { View viewReading = mInflater.inflate(R.layout.display_translation_reading_group, readWriteContainer, false); TextView write = (TextView) viewReading.findViewById(R.id.translation_write); TextView read = (TextView) viewReading.findViewById(R.id.translation_read); if (mTranslation.getJapaneseKeb() != null && mTranslation.getJapaneseKeb().size() > 0) { writeCharacters = mTranslation.getJapaneseKeb().get(0); write.setText(writeCharacters); } else { write.setVisibility(View.GONE); } if (mTranslation.getJapaneseReb() != null) { String reading = mTranslation.getJapaneseReb().get(0); read.setText(reading); ((ActionBarActivity) getActivity()).getSupportActionBar().setTitle(reading); } else { read.setVisibility(View.GONE); } readWriteContainer.addView(viewReading); } if (mTranslation.getJapaneseReb() != null) { String reading = mTranslation.getJapaneseReb().get(0); ((ActionBarActivity) getActivity()).getSupportActionBar().setTitle(reading); DBAsyncTask saveTranslation = new DBAsyncTask(mCallbackTranslation.getDatabase()); saveTranslation.execute(mTranslation); TextView romaji = (TextView) view.findViewById(R.id.translation_romaji); romaji.setText(RomanizationEnum.Hepburn.toRomaji(reading)); int sizeReb = mTranslation.getJapaneseReb().size(); if (sizeReb > 1) { for (int i = 1; i < sizeReb; i++) { alternativeStrBuilder.append(mTranslation.getJapaneseReb().get(i)); if (i + 1 < sizeReb) { alternativeStrBuilder.append(", "); } } } } if (mTranslation.getJapaneseKeb() != null) { writeCharacters = mTranslation.getJapaneseKeb().get(0); int size_keb = mTranslation.getJapaneseKeb().size(); if (size_keb > 1) { if (alternativeStrBuilder.length() > 0) { alternativeStrBuilder.append(", "); } for (int i = 1; i < size_keb; i++) { alternativeStrBuilder.append(mTranslation.getJapaneseKeb().get(i)); if (i + 1 < size_keb) { alternativeStrBuilder.append(", "); } } } } TextView alternative = (TextView) view.findViewById(R.id.translation_alternative); if (alternativeStrBuilder.length() > 0) { alternative.setText(alternativeStrBuilder); view.findViewById(R.id.translation_alternative_container).setVisibility(View.VISIBLE); } else { view.findViewById(R.id.translation_alternative_container).setVisibility(View.GONE); } if (mInflater != null) { LinearLayout translationsContainer = (LinearLayout) getView() .findViewById(R.id.translation_translation_container); translationsContainer.removeAllViews(); if ((mEnglish || (!mFrench && !mDutch && !mGerman && !mRussian)) && mTranslation.getEnglishSense() != null && mTranslation.getEnglishSense().size() > 0) { View translationLanguage = mInflater.inflate(R.layout.translation_language, translationsContainer, false); TextView textView = (TextView) translationLanguage.findViewById(R.id.translation_language); if (!mFrench && !mDutch && !mGerman && !mRussian) { textView.setVisibility(View.GONE); } textView.setText(getString(R.string.language_english)); translationsContainer.addView(translationLanguage); for (List<String> tran : mTranslation.getEnglishSense()) { int tran_size = tran.size(); if (tran_size > 0) { int i = 0; StringBuilder strBuilder = new StringBuilder(); for (String str : tran) { strBuilder.append(str); i++; if (i < tran_size) { strBuilder.append(", "); } } View translation_ll = mInflater.inflate(R.layout.translation_line, translationsContainer, false); TextView tView = (TextView) translation_ll.findViewById(R.id.translation_translation); tView.setText(strBuilder.toString()); translationsContainer.addView(translation_ll); } } } if (mFrench && mTranslation.getFrenchSense() != null && mTranslation.getFrenchSense().size() > 0) { View translation_language = mInflater.inflate(R.layout.translation_language, translationsContainer, false); TextView textView = (TextView) translation_language.findViewById(R.id.translation_language); if (!mEnglish && !mDutch && !mGerman && !mRussian) { textView.setVisibility(View.GONE); } textView.setText(getString(R.string.language_french)); translationsContainer.addView(translation_language); for (List<String> tran : mTranslation.getFrenchSense()) { int tran_size = tran.size(); if (tran_size > 0) { int i = 0; StringBuilder strBuilder = new StringBuilder(); for (String str : tran) { strBuilder.append(str); i++; if (i < tran_size) { strBuilder.append(", "); } } View translation_ll = mInflater.inflate(R.layout.translation_line, translationsContainer, false); TextView tView = (TextView) translation_ll.findViewById(R.id.translation_translation); tView.setText(strBuilder.toString()); translationsContainer.addView(translation_ll); } } } if (mDutch && mTranslation.getDutchSense() != null && mTranslation.getDutchSense().size() > 0) { View translation_language = mInflater.inflate(R.layout.translation_language, translationsContainer, false); TextView textView = (TextView) translation_language.findViewById(R.id.translation_language); if (!mFrench && !mEnglish && !mGerman && !mRussian) { textView.setVisibility(View.GONE); } textView.setText(getString(R.string.language_dutch)); translationsContainer.addView(translation_language); for (List<String> tran : mTranslation.getDutchSense()) { int tran_size = tran.size(); if (tran_size > 0) { int i = 0; StringBuilder strBuilder = new StringBuilder(); for (String str : tran) { strBuilder.append(str); i++; if (i < tran_size) { strBuilder.append(", "); } } View translation_ll = mInflater.inflate(R.layout.translation_line, translationsContainer, false); TextView tView = (TextView) translation_ll.findViewById(R.id.translation_translation); tView.setText(strBuilder.toString()); translationsContainer.addView(translation_ll); } } } if (mGerman && mTranslation.getGermanSense() != null && mTranslation.getGermanSense().size() > 0) { View translation_language = mInflater.inflate(R.layout.translation_language, translationsContainer, false); TextView textView = (TextView) translation_language.findViewById(R.id.translation_language); if (!mFrench && !mDutch && !mEnglish && !mRussian) { textView.setVisibility(View.GONE); } textView.setText(getString(R.string.language_german)); translationsContainer.addView(translation_language); for (List<String> tran : mTranslation.getGermanSense()) { int tran_size = tran.size(); if (tran_size > 0) { int i = 0; StringBuilder strBuilder = new StringBuilder(); for (String str : tran) { strBuilder.append(str); i++; if (i < tran_size) { strBuilder.append(", "); } } View translation_ll = mInflater.inflate(R.layout.translation_line, translationsContainer, false); TextView tView = (TextView) translation_ll.findViewById(R.id.translation_translation); tView.setText(strBuilder.toString()); translationsContainer.addView(translation_ll); } } } if (mRussian && mTranslation.getRussianSense() != null && mTranslation.getRussianSense().size() > 0) { View translation_language = mInflater.inflate(R.layout.translation_language, translationsContainer, false); TextView textView = (TextView) translation_language.findViewById(R.id.translation_language); if (!mFrench && !mDutch && !mEnglish && !mGerman) { textView.setVisibility(View.GONE); } textView.setText(getString(R.string.language_russian)); translationsContainer.addView(translation_language); for (List<String> tran : mTranslation.getRussianSense()) { int tran_size = tran.size(); if (tran_size > 0) { int i = 0; StringBuilder strBuilder = new StringBuilder(); for (String str : tran) { strBuilder.append(str); i++; if (i < tran_size) { strBuilder.append(", "); } } View translation_ll = mInflater.inflate(R.layout.translation_line, translationsContainer, false); TextView tView = (TextView) translation_ll.findViewById(R.id.translation_translation); tView.setText(strBuilder.toString()); translationsContainer.addView(translation_ll); } } } view.findViewById(R.id.translation_kanji_container).setVisibility(View.GONE); mCharacters = null; if (writeCharacters != null) { // write single characters if (writeCharacters.length() > 0) { CharacterLoader charLoader = new CharacterLoader(getActivity().getApplicationContext(), this); charLoader.execute(writeCharacters); } } view.findViewById(R.id.detail_example_sentences_progress_bar).setVisibility(View.VISIBLE); view.findViewById(R.id.translation_tatoeba_container).setVisibility(View.VISIBLE); ViewGroup tatoebaContainer = (ViewGroup) view.findViewById(R.id.detail_example_sentences_container); tatoebaContainer.removeAllViews(); List<String> kebRebList = kebRebToList(mTranslation); if (kebRebList != null && kebRebList.size() > 0) { TatoebaSentenceLoader sentenceLoader = new TatoebaSentenceLoader( this.getActivity().getApplicationContext(), this); sentenceLoader.execute(kebRebList); } } else { Log.e(LOG_TAG, "inflater null"); } }
From source file:com.flipzu.flipzu.Player.java
private void cleanComments() { final LinearLayout com_layout = (LinearLayout) findViewById(R.id.comments_layout); com_layout.removeAllViews(); }
From source file:com.freeme.filemanager.view.FileViewFragment.java
private void buildVolumesList() { LinearLayout linearyLayout = (LinearLayout) mRootView.findViewById(R.id.dropdown_navigation_list); linearyLayout.removeAllViews(); ArrayList mountVolumeList = StorageHelper.getInstance(mActivity).getSortedMountVolumeList(); if (mountVolumeList == null || mountVolumeList.size() == 0) { return;//w w w . jav a2 s . c o m } Iterator iterator = mountVolumeList.iterator(); while (iterator.hasNext()) { storageVolume = (StorageVolume) iterator.next(); //Log.i("liuhaoran", "storageVolume = " + storageVolume); //*/ freeme.liuhaoran , 20160728 , adapter zhanxun M if (storageVolume.getStorageId() != 0) { linearyLayout.addView( createStorageVolumeItem(storageVolume.getPath(), storageVolume.getDescription(mActivity))); } //*/ } }
From source file:com.brq.wallet.activity.modern.AccountsFragment.java
private void update() { if (!isAdded()) { return;/*from ww w . jav a 2 s . c om*/ } LinearLayout llRecords = (LinearLayout) getView().findViewById(R.id.llRecords); llRecords.removeAllViews(); if (_mbwManager.isKeyManagementLocked()) { // Key management is locked getView().findViewById(R.id.svRecords).setVisibility(View.GONE); getView().findViewById(R.id.llLocked).setVisibility(View.VISIBLE); } else { // Make all the key management functionality available to experts getView().findViewById(R.id.svRecords).setVisibility(View.VISIBLE); getView().findViewById(R.id.llLocked).setVisibility(View.GONE); List<WalletAccount> activeHdAccounts = walletManager.getActiveMasterseedAccounts(); List<WalletAccount> activeOtherAccounts = walletManager.getActiveOtherAccounts(); List<WalletAccount> activeHdRecords = Utils.sortAccounts(activeHdAccounts, _storage); List<WalletAccount> activeOtherRecords = Utils.sortAccounts(activeOtherAccounts, _storage); List<WalletAccount> archivedRecords = Utils.sortAccounts(walletManager.getArchivedAccounts(), _storage); WalletAccount selectedAccount = _mbwManager.getSelectedAccount(); CurrencySum totalSpendableBalance = new CurrencySum(); String activeTitle = getString(R.string.active_hd_accounts_name) + (activeHdRecords.isEmpty() ? " " + getString(R.string.active_accounts_empty) : ""); CurrencySum spendableBalanceHdAccounts = getSpendableBalance(activeHdAccounts); LinearLayout activeHdAccountsView = createAccountViewList(activeTitle, activeHdRecords, selectedAccount, spendableBalanceHdAccounts); llRecords.addView(activeHdAccountsView); totalSpendableBalance.add(spendableBalanceHdAccounts); if (!activeOtherRecords.isEmpty()) { CurrencySum spendableBalanceOtherAccounts = getSpendableBalance(activeOtherAccounts); LinearLayout activeOtherAccountsView = createAccountViewList( getString(R.string.active_other_accounts_name), activeOtherRecords, selectedAccount, spendableBalanceOtherAccounts); llRecords.addView(activeOtherAccountsView); totalSpendableBalance.add(spendableBalanceOtherAccounts); // only show a totals row, if both account type exits LinearLayout activeOtherSum = createActiveAccountBalanceSumView(totalSpendableBalance); llRecords.addView(activeOtherSum); } if (archivedRecords.size() > 0) { LinearLayout archived = createAccountViewList(getString(R.string.archive_name), archivedRecords, selectedAccount, null); llRecords.addView(archived); } } }
From source file:com.mobicage.rogerthat.util.ui.SendMessageView.java
private void initImageButtonsNavigation() { final LinearLayout optionButtons = (LinearLayout) findViewById(R.id.imageButtons); optionButtons.removeAllViews(); boolean addPicture = true; boolean addVideo = true; boolean addButtons = true; boolean addPriority = false; boolean addSticky = false; if (SystemUtils.isFlagEnabled(mParentFlags, MessagingPlugin.FLAG_DYNAMIC_CHAT)) { if (!SystemUtils.isFlagEnabled(mParentFlags, MessagingPlugin.FLAG_ALLOW_CHAT_PICTURE)) { addPicture = false;//from w ww. j a v a 2 s . co m } if (!SystemUtils.isFlagEnabled(mParentFlags, MessagingPlugin.FLAG_ALLOW_CHAT_VIDEO)) { addVideo = false; } if (!SystemUtils.isFlagEnabled(mParentFlags, MessagingPlugin.FLAG_ALLOW_CHAT_BUTTONS)) { addButtons = false; } if (SystemUtils.isFlagEnabled(mParentFlags, MessagingPlugin.FLAG_ALLOW_CHAT_PRIORITY)) { addPriority = true; } if (SystemUtils.isFlagEnabled(mParentFlags, MessagingPlugin.FLAG_ALLOW_CHAT_STICKY)) { addSticky = true; } } mImageButtons = new ArrayList<Integer>(); mImageButtons.add(IMAGE_BUTTON_TEXT); if (addButtons) { mImageButtons.add(IMAGE_BUTTON_BUTTONS); } if (!mHasImageSelected && !mHasVideoSelected) { if (addPicture) { mImageButtons.add(IMAGE_BUTTON_PICTURE); } if (addVideo) { mImageButtons.add(IMAGE_BUTTON_VIDEO); } } if (addPriority) { mImageButtons.add(IMAGE_BUTTON_PRIORITY); } if (addSticky) { mImageButtons.add(IMAGE_BUTTON_STICKY); } if (mImageButtons.size() > mMaxImageButtonsOnScreen) { for (int i = 0; i < mMaxImageButtonsOnScreen - 1; i++) { int key = mImageButtons.get(i); ImageView iv = generateImageView(key, View.VISIBLE); optionButtons.addView(iv); } ImageView iv = generateImageView(IMAGE_BUTTON_MORE, View.VISIBLE); optionButtons.addView(iv); } else { for (int i = 0; i < mImageButtons.size(); i++) { int key = mImageButtons.get(i); ImageView iv = generateImageView(key, View.VISIBLE); optionButtons.addView(iv); } if (mImageButtons.size() < mMaxImageButtonsOnScreen) { for (int i = mMaxImageButtonsOnScreen - 1; i > mImageButtons.size(); i--) { L.i("Adding space"); ImageView iv = generateImageView(IMAGE_BUTTON_PADDING, View.INVISIBLE); optionButtons.addView(iv); } } } }
From source file:org.sirimangalo.meditationplus.ActivityMain.java
private void populateLog(JSONArray jsonLogged) { Calendar utc = Calendar.getInstance(TimeZone.getTimeZone("UTC")); int hour = utc.get(Calendar.HOUR_OF_DAY); int max_hour = 0; int max_height = 100; LinearLayout hll = (LinearLayout) findViewById(R.id.time_log); if (hll == null) return;//from ww w . ja v a 2 s . c o m hll.removeAllViews(); try { max_hour = jsonLogged.getInt(0); for (int i = 1; i < jsonLogged.length(); i++) { max_hour = Math.max(max_hour, jsonLogged.getInt(i)); } for (int i = 0; i < jsonLogged.length(); i++) { int height = (int) Math.ceil(max_height * jsonLogged.getInt(i) / max_hour); LinearLayout ll = (LinearLayout) context.getLayoutInflater().inflate(R.layout.list_item_log, null); ImageView iv = (ImageView) ll.findViewById(R.id.min_cell); iv.getLayoutParams().height = height; iv.getLayoutParams().width = hll.getWidth() / 24; TextView tv = (TextView) ll.findViewById(R.id.hour_no); tv.setText(i + ""); if (hour == i) tv.setBackgroundColor(0xFFFFFF33); ImageView sv = (ImageView) ll.findViewById(R.id.space_cell); sv.getLayoutParams().height = 100 - height; hll.addView(ll); } } catch (JSONException e) { e.printStackTrace(); } }
From source file:com.activiti.android.ui.fragments.task.TaskDetailsFoundationFragment.java
private void createHelpSection() { if (isEnded) { return;//w w w. j a v a2s . com } show(R.id.task_details_help_card); // DETAILS LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); LinearLayout helpContainer = (LinearLayout) viewById(R.id.task_details_help_card); helpContainer.removeAllViews(); View v = inflater.inflate(R.layout.card_task_help, helpContainer, false); // INVOLVE TwoLinesViewHolder vh = HolderUtils.configure(v.findViewById(R.id.help_details_involve), getString(R.string.task_help_add_people), null, R.drawable.ic_account_box_grey); HolderUtils.makeMultiLine(vh.topText, 3); v.findViewById(R.id.help_details_involve_container).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // Special case activiti.alfresco.com & tenantid == null // User must pick user via email only startInvolveAction(); } }); // ADD CONTENT vh = HolderUtils.configure(v.findViewById(R.id.help_details_add_content), getString(R.string.task_help_add_content), null, R.drawable.ic_insert_drive_file_grey); HolderUtils.makeMultiLine(vh.topText, 3); v.findViewById(R.id.help_details_add_content_container).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ContentTransferManager.requestGetContent(TaskDetailsFoundationFragment.this); } }); // COMMENT vh = HolderUtils.configure(v.findViewById(R.id.help_details_comment), getString(R.string.task_help_add_comment), null, R.drawable.ic_insert_comment_grey); HolderUtils.makeMultiLine(vh.topText, 3); v.findViewById(R.id.help_details_comment_container).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ((MainActivity) getActivity()) .setRightMenuVisibility(!((MainActivity) getActivity()).isRightMenuVisible()); } }); // CHECKLIST vh = HolderUtils.configure(v.findViewById(R.id.help_details_add_task_checklist), getString(R.string.task_help_add_checklist), null, R.drawable.ic_add_circle_grey); HolderUtils.makeMultiLine(vh.topText, 3); v.findViewById(R.id.help_details_add_task_checklist_container) .setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { CreateStandaloneTaskDialogFragment.with(getActivity()).taskId(taskRepresentation.getId()) .displayAsDialog(); } }); helpContainer.addView(v); }
From source file:com.activiti.android.ui.fragments.task.TaskDetailsFoundationFragment.java
protected void displayCheckList(List<TaskRepresentation> taskRepresentations) { if (getVersionNumber() < ActivitiVersionNumber.VERSION_1_3_0) { hide(R.id.task_details_checklist_card); return;/*w ww .java 2 s. c o m*/ } show(R.id.task_details_checklist_card); if (taskRepresentations == null || taskRepresentations.isEmpty() || isEnded) { hide(R.id.task_details_checklist_card); return; } LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); // TASKS LinearLayout activeTaskContainer = (LinearLayout) viewById(R.id.task_details_checklist_container); activeTaskContainer.removeAllViews(); View v; if (taskRepresentations == null || taskRepresentations.isEmpty()) { v = inflater.inflate(R.layout.row_single_line, activeTaskContainer, false); ((TextView) v.findViewById(R.id.toptext)).setText(R.string.task_help_add_first_checklist); HolderUtils.makeMultiLine(((TextView) v.findViewById(R.id.toptext)), 4); v.findViewById(R.id.icon).setVisibility(View.GONE); activeTaskContainer.addView(v); } else { TaskRepresentation taskCheckList; TwoLinesViewHolder vh; int max = (taskRepresentations.size() > TASKS_MAX_ITEMS) ? TASKS_MAX_ITEMS : taskRepresentations.size(); for (int i = 0; i < max; i++) { taskCheckList = taskRepresentations.get(i); v = inflater.inflate(R.layout.row_three_lines_caption_borderless, activeTaskContainer, false); v.setTag(taskCheckList); vh = HolderUtils.configure(v, taskCheckList.getName(), null, TaskAdapter.createAssigneeInfo(getActivity(), taskCheckList), TaskAdapter.createRelativeDateInfo(getActivity(), taskCheckList), R.drawable.ic_account_circle_grey); if (taskCheckList.getEndDate() != null) { vh.choose.setImageResource(R.drawable.ic_done_grey); } else { vh.choose.setImageResource(android.R.color.transparent); } vh.choose.setVisibility(View.VISIBLE); activeTaskContainer.addView(v); v.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { TaskDetailsFragment.with(getActivity()).task((TaskRepresentation) v.getTag()) .bindFragmentTag(getTag()).back(true).display(); } }); } } }
From source file:com.activiti.android.ui.fragments.task.TaskDetailsFoundationFragment.java
private void displayPeopleSection(List<LightUserRepresentation> people) { show(R.id.task_details_people_card); if (people.isEmpty() || isEnded) { hide(R.id.task_details_people_card); return;// w w w . j av a 2 s . c om } // USER INVOLVED LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); LinearLayout userContainer = (LinearLayout) viewById(R.id.task_details_people_container); userContainer.removeAllViews(); View v; if (people == null || people.isEmpty()) { v = inflater.inflate(R.layout.row_single_line, userContainer, false); ((TextView) v.findViewById(R.id.toptext)).setText(R.string.task_message_no_people_involved); v.findViewById(R.id.icon).setVisibility(View.GONE); userContainer.addView(v); } else { TwoLinesViewHolder vh; for (LightUserRepresentation user : people) { v = inflater.inflate(R.layout.row_two_lines_swipe, userContainer, false); v.setTag(user.getId()); String fullName = user.getFullname(); vh = HolderUtils.configure(v, fullName != null && !fullName.isEmpty() ? fullName : user.getEmail(), null, R.drawable.ic_account_circle_grey); if (picasso != null) { picasso.cancelRequest(vh.icon); picasso.load(getAPI().getUserGroupService().getPicture(user.getId())) .placeholder(R.drawable.ic_account_circle_grey).fit().transform(roundedTransformation) .into(vh.icon); } SwipeLayout swipeLayout = (SwipeLayout) v.findViewById(R.id.swipe_layout); swipeLayout.setShowMode(SwipeLayout.ShowMode.LayDown); swipeLayout.setDragEdge(SwipeLayout.DragEdge.Right); LinearLayout actions = (LinearLayout) swipeLayout.findViewById(R.id.bottom_wrapper); ImageButton action = (ImageButton) inflater.inflate(R.layout.form_swipe_action_, (LinearLayout) swipeLayout.findViewById(R.id.bottom_wrapper), false); action.setImageResource(R.drawable.ic_remove_circle_outline_white); action.setTag(user); action.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { removeInvolved(((LightUserRepresentation) v.getTag()), new InvolveTaskRepresentation(((LightUserRepresentation) v.getTag()).getId())); } }); actions.addView(action); userContainer.addView(v); } } if (!isEnded) { v = inflater.inflate(R.layout.footer_two_buttons_borderless, userContainer, false); Button b = (Button) v.findViewById(R.id.button_action_left); b.setVisibility(View.GONE); b = (Button) v.findViewById(R.id.button_action_right); b.setText(R.string.task_action_involve); b.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startInvolveAction(); } }); userContainer.addView(v); } }