List of usage examples for android.widget LinearLayout removeAllViews
public void removeAllViews()
From source file:eu.liveGov.libraries.livegovtoolkit.activities_fragments.MapFragment.java
@Override public void onDestroyView() { super.onDestroyView(); LinearLayout layout = (LinearLayout) getActivity().findViewById(R.id.mapview); if (layout != null) { layout.removeAllViews(); }//w ww . j a v a 2 s .c o m mOsmv.getTileProvider().clearTileCache(); System.gc(); }
From source file:de.enlightened.peris.ThemeEditor.java
private void updatePreview() { final SharedPreferences appPreferences = getSharedPreferences("prefs", 0); final boolean useShading = appPreferences.getBoolean("use_shading", false); final boolean useOpenSans = appPreferences.getBoolean("use_opensans", false); final int fontSize = appPreferences.getInt("font_size", 16); final boolean currentAvatarSetting = appPreferences.getBoolean("show_images", true); final TextView themeEditorPreviewAppbar = (TextView) findViewById(R.id.theme_editor_preview_appbar); themeEditorPreviewAppbar/*w ww. ja v a2 s . com*/ .setBackgroundColor(Color.parseColor(this.application.getSession().getServer().serverColor)); if (ThemeSetter.getForegroundDark(this.application.getSession().getServer().serverColor)) { themeEditorPreviewAppbar.setTextColor(Color.BLACK); } else { themeEditorPreviewAppbar.setTextColor(Color.WHITE); } final FrameLayout themeEditorPreview = (FrameLayout) findViewById(R.id.theme_editor_preview); final ImageView themeEditorPreviewWallpaper = (ImageView) findViewById(R.id.theme_editor_preview_wallpaper); final String forumWallpaper = this.application.getSession().getServer().serverWallpaper; final String forumBackground = this.application.getSession().getServer().serverBackground; if (forumWallpaper != null && forumWallpaper.contains("http")) { final String imageUrl = forumWallpaper; themeEditorPreviewWallpaper.setVisibility(View.VISIBLE); ImageLoader.getInstance().displayImage(imageUrl, themeEditorPreviewWallpaper); } else { themeEditorPreviewWallpaper.setVisibility(View.GONE); } if (forumBackground != null && forumBackground.contains("#") && forumBackground.length() == 7) { themeEditorPreview.setBackgroundColor(Color.parseColor(forumBackground)); } else { themeEditorPreview.setBackgroundColor(Color.parseColor(getString(R.string.default_background))); } final boolean useDivider = true; /* if (!(this.application.getSession().getServer().serverBackground.contentEquals(this.application.getSession().getServer().serverBoxColor) && this.application.getSession().getServer().serverBoxBorder.contentEquals("0"))) { useDivider = false; } */ final LinearLayout previewHolder = (LinearLayout) findViewById(R.id.theme_editor_preview_holder); previewHolder.removeAllViews(); final Category sampleCategory = Category.builder().name("Sample Category").build(); final Topic sampleTopic = Topic.builder().title("Thread Title").type(Topic.Type.Sticky).replyCount(2) .viewCount(7).authorName("Author Name").hasNewPosts(true) .authorIcon("http://localhost/author_icon.jpg").build(); final Post po = new Post(); po.author = "nezkeeeze"; po.body = "Hey guys I'm new. How do I get colored text? Can I be an admin? How do I start a new topic?<br /><br />" + this.application.getSession().getServer().serverTagline; po.avatar = "http://localhost/nezkeys.png"; final LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); final View vC = vi.inflate(R.layout.category, null); final View vT = vi.inflate(R.layout.thread, null); final View vP = vi.inflate(R.layout.post, null); ElementRenderer.renderCategory(vC, this.application, this, useOpenSans, useShading, sampleCategory, currentAvatarSetting); ElementRenderer.renderCategory(vT, this.application, this, useOpenSans, useShading, sampleTopic, currentAvatarSetting); ElementRenderer.renderPost(vP, this.application, 1, this, 0, useOpenSans, useShading, po, fontSize, currentAvatarSetting); previewHolder.addView(vC); if (useDivider) { final View d1 = vi.inflate(R.layout.preview_seperator, null); previewHolder.addView(d1); } previewHolder.addView(vT); if (useDivider) { final View d2 = vi.inflate(R.layout.preview_seperator, null); previewHolder.addView(d2); } previewHolder.addView(vP); if (useDivider) { final View d3 = vi.inflate(R.layout.preview_seperator, null); previewHolder.addView(d3); } }
From source file:itkach.aard2.SettingsListAdapter.java
private View getUserStylesView(View convertView, final ViewGroup parent) { View view;// ww w. j a va2 s. c o m LayoutInflater inflater = (LayoutInflater) parent.getContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); if (convertView != null) { view = convertView; } else { this.userStyleData = userStylePrefs.getAll(); this.userStyleNames = new ArrayList<String>(this.userStyleData.keySet()); Collections.sort(this.userStyleNames); view = inflater.inflate(R.layout.settings_user_styles_item, parent, false); ImageView btnAdd = (ImageView) view.findViewById(R.id.setting_btn_add_user_style); btnAdd.setImageDrawable(FontIconDrawable.inflate(context, R.xml.ic_list_add)); btnAdd.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_GET_CONTENT); intent.setType("text/*"); Intent chooser = Intent.createChooser(intent, "Select CSS file"); try { fragment.startActivityForResult(chooser, CSS_SELECT_REQUEST); } catch (ActivityNotFoundException e) { Log.d(TAG, "Not activity to get content", e); Toast.makeText(context, R.string.msg_no_activity_to_get_content, Toast.LENGTH_LONG).show(); } } }); } ; View emptyView = view.findViewById(R.id.setting_user_styles_empty); emptyView.setVisibility(userStyleNames.size() == 0 ? View.VISIBLE : View.GONE); LinearLayout userStyleListLayout = (LinearLayout) view.findViewById(R.id.setting_user_styles_list); userStyleListLayout.removeAllViews(); for (int i = 0; i < userStyleNames.size(); i++) { View styleItemView = inflater.inflate(R.layout.user_styles_list_item, parent, false); ImageView btnDelete = (ImageView) styleItemView.findViewById(R.id.user_styles_list_btn_delete); btnDelete.setImageDrawable(FontIconDrawable.inflate(context, R.xml.ic_list_trash)); btnDelete.setOnClickListener(onDeleteUserStyle); String name = userStyleNames.get(i); btnDelete.setTag(name); TextView nameView = (TextView) styleItemView.findViewById(R.id.user_styles_list_name); nameView.setText(name); userStyleListLayout.addView(styleItemView); } return view; }
From source file:com.fowlcorp.homebank4android.gui.AccountRecyclerAdapter.java
@Override public void onBindViewHolder(final OperationViewHolder holder, final int position) { final Operation operation = listOperation.get(position); final Calendar myDate = Calendar.getInstance(); myDate.clear();/*from ww w .j a v a2s . c o m*/ myDate.setTime(operation.getDate().getTime()); final SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy", Locale.FRANCE); holder.getRootLayout().setOnClickListener(new OnClickListener() { @SuppressWarnings("unchecked") @Override public void onClick(View v) { Intent intent = new Intent(activity.getApplicationContext(), DetailedCardActivity.class); Bundle bdl = new Bundle(); try { bdl.putString("Date", df.format(myDate.getTime())); } catch (Exception e) { } try { bdl.putString("Category", (operation.getCategory().getParent() == null ? "" : operation.getCategory().getParent().getName() + ": ") + operation.getCategory().getName()); } catch (Exception e) { } try { bdl.putString("Payee", operation.getPayee().getName()); } catch (Exception e) { } try { bdl.putString("Wording", operation.getWording()); } catch (Exception e) { } try { bdl.putString("Amount", String.valueOf(Round.roundAmount(operation.getAmount()))); } catch (Exception e) { } try { bdl.putInt("Type", operation.getPayMode()); } catch (Exception e) { } // try { // intent.putExtra("Info", operation.getInfo()); // } catch (Exception e) { // } try { bdl.putBoolean("Reconciled", operation.isReconciled()); } catch (Exception e) { } try { bdl.putBoolean("Remind", operation.isRemind()); } catch (Exception e) { } try { Log.d("Debug", String.valueOf(operation.isSplit())); bdl.putBoolean("Split", operation.isSplit()); } catch (Exception e) { } try { bdl.putSerializable("Couple", operation.getSplits()); } catch (Exception e) { e.printStackTrace(); } intent.putExtras(bdl); // Pair datePair = Pair.create(holder.getDate(), "date"); // Pair categoryPair = Pair.create(holder.getCategory(), "category"); // Pair wordingPair = Pair.create(holder.getWording(), "wording"); // Pair payeePair = Pair.create(holder.getPayee(), "payee"); // Pair amountPair = Pair.create(holder.getAmount(), "amount"); Pair<View, String> cardPair = Pair.create((View) holder.getCard(), "card"); // Pair iconPair = Pair.create(holder.getMode(), "icon"); ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(activity, cardPair); ActivityCompat.startActivity(activity, intent, options.toBundle()); //activity.startActivity(intent, ActivityOptions.makeSceneTransitionAnimation(activity).toBundle()); //activity.startActivity(intent); } }); try { holder.getDate().setText(activity.getString(R.string.Date) + " : " + df.format(myDate.getTime())); } catch (Exception e) { } try { holder.getPayee().setText(activity.getString(R.string.Payee) + " : " + operation.getPayee().getName()); } catch (Exception e) { } try { holder.getWording().setText(activity.getString(R.string.Wording) + " : " + operation.getWording()); } catch (Exception e) { } if (!operation.isSplit()) { holder.getSplitLinear().removeAllViews(); holder.getUnSplitLinear().setVisibility(LinearLayout.VISIBLE); try { holder.getCategory() .setText(activity.getString(R.string.Wording) + " : " + (operation.getCategory().getParent() == null ? "" : operation.getCategory().getParent().getName() + ": ") + operation.getCategory().getName()); } catch (Exception e) { } } else { holder.getUnSplitLinear().setVisibility(LinearLayout.GONE); LinearLayout splitLayout = holder.getSplitLinear(); splitLayout.removeAllViews(); LayoutInflater inflater = activity.getLayoutInflater(); for (Triplet subOp : operation.getSplits()) { View view = inflater.inflate(R.layout.split_layout, null); TextView category = (TextView) view.findViewById(R.id.splitLayout_category); TextView memo = (TextView) view.findViewById(R.id.splitLayout_memo); TextView amount = (TextView) view.findViewById(R.id.splitLayout_amount); //System.out.println(activity.getString(R.string.cardLayout_category) + " " + (subOp.getCategory().getParent() == null ? "" :subOp.getCategory().getParent().getName() + ": ") + subOp.getCategory().getName()); category.setText(activity.getString(R.string.Category) + " : " + (subOp.getCategory().getParent() == null ? "" : subOp.getCategory().getParent().getName() + ": ") + subOp.getCategory().getName()); amount.setText(colorText(activity.getString(R.string.Amount) + " : ", "" + Round.roundAmount(subOp.getAmount()))); memo.setText(activity.getString(R.string.Category) + " : " + operation.getWording()); splitLayout.addView(view); } } try { holder.getAmount().setText(colorText(activity.getString(R.string.Amount) + " : ", String.valueOf(Round.roundAmount(operation.getAmount())))); } catch (Exception e) { } try { holder.getBalance().setText(colorText(activity.getString(R.string.Balance) + " : ", String.valueOf(Round.roundAmount(operation.getBalanceAccount())))); } catch (Exception e) { } if (operation.isSplit()) { holder.getOption().setImageResource(R.drawable.split); } else if (operation.isRemind()) { holder.getOption().setImageResource(R.drawable.remind); holder.getCard().setCardBackgroundColor(Color.parseColor("#ffebee")); } else { holder.getOption().setImageDrawable(null); } if (!operation.isReconciled() && !operation.isRemind()) { holder.getCard().setCardBackgroundColor(Color.parseColor("#fff3e0")); } else if (operation.isReconciled()) { holder.getCard().setCardBackgroundColor(Color.parseColor("#ffffff")); } try { switch (operation.getPayMode()) { case PayMode.CREDIT_CARD: holder.getMode().setImageResource(R.drawable.mastercard); break; case PayMode.DEBIT_CARD: holder.getMode().setImageResource(R.drawable.card); break; case PayMode.CASH: holder.getMode().setImageResource(R.drawable.cash); break; case PayMode.TRANSFERT: holder.getMode().setImageResource(R.drawable.transfert); break; case PayMode.ELECTRONIC_PAYMENT: holder.getMode().setImageResource(R.drawable.nfc); break; case PayMode.CHEQUE: holder.getMode().setImageResource(R.drawable.cheque); break; default: holder.getMode().setImageDrawable(null); break; } } catch (Exception e) { } }
From source file:org.dpadgett.timer.CountdownFragment.java
private void restoreState() { final SharedPreferences prefs = getContext().getSharedPreferences("Countdown", Context.MODE_PRIVATE); timingState = new CountdownState((CountdownTextView) timerLayout.findViewById(R.id.countdownTimer), prefs); if (prefs.contains("countdownInputs")) { long countdownInputs = prefs.getLong("countdownInputs", 0L); countdownInputs /= 1000;/*from w w w. j a v a 2 s . c om*/ countdownSeconds.setValue((int) (countdownInputs % 60)); countdownInputs /= 60; countdownMinutes.setValue((int) (countdownInputs % 60)); countdownInputs /= 60; countdownHours.setValue((int) (countdownInputs % 100)); inputMode = !timingState.isRunning(); if (!inputMode) { // countdown view final LinearLayout inputs = (LinearLayout) rootView.findViewById(R.id.inputsLayout); final Button startButton = (Button) rootView.findViewById(R.id.startButton); inputs.removeAllViews(); inputs.addView(timerLayout); startButton.setText(getContext().getString(R.string.countdown_button_cancel)); // timing thread will auto start itself } } alarmSelector.restoreState(); }
From source file:in.animeshpathak.nextbus.NextBusMain.java
private void getBusTimings(BusLine selectedLine, BusStop selectedStop) { try {//from ww w . j a va 2s .c om // Clearing old data LinearLayout busTimingsViewContainer = (LinearLayout) this.findViewById(R.id.bus_section); busTimingsViewContainer.removeAllViews(); if (selectedLine.getName().startsWith("*")) { getMultipleBusTimings(selectedStop); } else { BusArrivalQuery query = BusArrivalQueryFactory.getInstance(selectedLine, selectedStop); new BusInfoGetterTask(this, query, 0).execute(taskExecutor); } } catch (Exception e) { Log.e(LOG_TAG, e.getMessage(), e); } }
From source file:com.hacktx.android.activities.EventDetailActivity.java
private void setupSpeakers() { LinearLayout speakersContainer = (LinearLayout) findViewById(R.id.speakerHolderLayout); ArrayList<ScheduleSpeaker> speakers = event.getSpeakerList(); speakersContainer.removeAllViews(); if (speakers.size() == 0) { View speakerTitle = findViewById(R.id.speakersTitle); speakerTitle.setVisibility(View.GONE); }/*from w ww . ja v a2s.c o m*/ for (int child = 0; child < speakers.size(); child++) { final ScheduleSpeaker speaker = speakers.get(child); View childView = LayoutInflater.from(speakersContainer.getContext()) .inflate(R.layout.event_detail_speaker, speakersContainer, false); CircularImageView speakerIcon = (CircularImageView) childView.findViewById(R.id.speakerIcon); Picasso.with(this).load(speaker.getImageUrl()).resize(150, 150).centerCrop() .placeholder(R.drawable.ic_profile).into(speakerIcon); ((TextView) childView.findViewById(R.id.speakerTitle)) .setText(speaker.getName() + " | " + speaker.getOrganization()); ((TextView) childView.findViewById(R.id.speakerDescription)).setText(speaker.getDescription()); speakersContainer.addView(childView); } }
From source file:com.geoffreybuttercrumbs.arewethereyet.DrawerFragment.java
private void clear() { LinearLayout SavedParent = (LinearLayout) V.findViewById(R.id.group_pinned); LinearLayout RecentParent = (LinearLayout) V.findViewById(R.id.group_recent); SavedParent.removeAllViews(); RecentParent.removeAllViews();/* ww w . j a va 2 s.c om*/ }
From source file:com.honeycomb.cocos2dx.Soccer.java
public void removeAd() { this.runOnUiThread(new Runnable() { @Override//from w ww . j a v a 2 s . c o m public void run() { LinearLayout layoutAdmobBottom = (LinearLayout) findViewById(com.honeycomb.cocos2dx.R.id.bottom); layoutAdmobBottom.removeAllViews(); LinearLayout layoutAdmobTop = (LinearLayout) findViewById(com.honeycomb.cocos2dx.R.id.top); layoutAdmobTop.removeAllViews(); } }); }
From source file:org.mifos.androidclient.main.AccountDetailsActivity.java
private void updateContent(AbstractAccountDetails details) { if (details != null) { mDetails = details;//from w w w .j a va 2s .c o m ViewBuilderFactory factory = new ViewBuilderFactory(this); AccountDetailsViewBuilder builder = factory.createAccountDetailsViewBuilder(details); LinearLayout tabContent = (LinearLayout) findViewById(R.id.account_overview); if (tabContent.getChildCount() > 0) { tabContent.removeAllViews(); } tabContent.addView(builder.buildOverviewView()); tabContent = (LinearLayout) findViewById(R.id.account_transaction); if (tabContent.getChildCount() > 0) { tabContent.removeAllViews(); } tabContent.addView(builder.buildTransactionView()); tabContent = (LinearLayout) findViewById(R.id.account_details); if (tabContent.getChildCount() > 0) { tabContent.removeAllViews(); } tabContent.addView(builder.buildDetailsView()); if (details.getClass() == SavingsAccountDetails.class) { if (((SavingsAccountDetails) details).getDepositTypeName() .equals(SavingsAccountDetails.MANDATORY_DEPOSIT)) { Button depositDueButton = (Button) findViewById(R.id.view_depositDueDetails_button); depositDueButton.setVisibility(View.VISIBLE); } } } }