List of usage examples for android.view ViewGroup setVisibility
@RemotableViewMethod public void setVisibility(@Visibility int visibility)
From source file:org.alfresco.mobile.android.application.ui.form.FormManager.java
private void createPropertyFields(FieldGroupConfig group, ViewGroup hookView, LayoutInflater li, boolean isEdition) { ViewGroup groupview = hookView;/* w ww. j av a2 s.c o m*/ ViewGroup grouprootview = null; // Header if (!TextUtils.isEmpty(group.getLabel())) { grouprootview = (ViewGroup) li.inflate(R.layout.form_header, null); TextView tv = (TextView) grouprootview.findViewById(R.id.title); tv.setText(group.getLabel()); groupview = (ViewGroup) grouprootview.findViewById(R.id.group_panel); hookView.addView(grouprootview); } // For each properties, display the line associated for (FieldConfig fieldConfig : group.getItems()) { if (fieldConfig instanceof FieldGroupConfig) { createPropertyFields((FieldGroupConfig) fieldConfig, groupview, li, isEdition); continue; } // Retrieve the Field builder based on config Property nodeProp = node.getProperty(fieldConfig.getModelIdentifier()); View fieldView = null; BaseField field = generateField(nodeProp, fieldConfig, groupview, isEdition); if (field == null) { continue; } fieldsOrderIndex.add(field); fieldsIndex.put(fieldConfig.getModelIdentifier(), field); // Mark All fields in edition mode if (isEdition) { // Mark required Field if (field.isRequired()) { mandatoryFields.add(field); } } // If requires fragment for pickers. if (field.isPickerRequired()) { field.setFragment(fr); } if (field.requireExtra()) { Bundle b = new Bundle(); b.putSerializable(PathField.EXTRA_PARENT_FOLDER, parentFolder); field.setExtra(b); } // If requires Async if (field.requireAsync() && !modelRequested.contains(fieldConfig.getModelIdentifier())) { String requestId = Operator.with(getActivity()).load(field.requestData(node)); RequestHolder holder = new RequestHolder(field, fieldConfig.getModelIdentifier(), requestId); modelRequested.add(fieldConfig.getModelIdentifier()); operationFieldIndex.put(requestId, holder); } } if (groupview.getChildCount() == 0 && grouprootview != null) { grouprootview.setVisibility(View.GONE); } }
From source file:android.support.v7.app.AlertController.java
private void setupTitle(ViewGroup topPanel) { if (mCustomTitleView != null) { // Add the custom title view directly to the topPanel layout LayoutParams lp = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); topPanel.addView(mCustomTitleView, 0, lp); // Hide the title template View titleTemplate = mWindow.findViewById(R.id.title_template); titleTemplate.setVisibility(View.GONE); } else {/*from w w w. j ava 2 s .com*/ mIconView = (ImageView) mWindow.findViewById(android.R.id.icon); final boolean hasTextTitle = !TextUtils.isEmpty(mTitle); if (hasTextTitle) { // Display the title if a title is supplied, else hide it. mTitleView = (TextView) mWindow.findViewById(R.id.alertTitle); mTitleView.setText(mTitle); // Do this last so that if the user has supplied any icons we // use them instead of the default ones. If the user has // specified 0 then make it disappear. if (mIconId != 0) { mIconView.setImageResource(mIconId); } else if (mIcon != null) { mIconView.setImageDrawable(mIcon); } else { // Apply the padding from the icon to ensure the title is // aligned correctly. mTitleView.setPadding(mIconView.getPaddingLeft(), mIconView.getPaddingTop(), mIconView.getPaddingRight(), mIconView.getPaddingBottom()); mIconView.setVisibility(View.GONE); } } else { // Hide the title template final View titleTemplate = mWindow.findViewById(R.id.title_template); titleTemplate.setVisibility(View.GONE); mIconView.setVisibility(View.GONE); topPanel.setVisibility(View.GONE); } } }
From source file:com.plusot.senselib.SenseMain.java
private void toggleLarge(View view) { int id = view.getId() - SenseMain.VIEW_ID_BASE; if (id < 0 || id > 7) return;/* w ww . ja v a 2 s .c o m*/ large[id] ^= true; for (View tempView : valueViews) { if (view != tempView && tempView != null) { if (large[id]) tempView.setVisibility(View.GONE); else tempView.setVisibility(View.VISIBLE); } } for (ViewGroup vg : vgs) { if (vg.getChildAt(0) == view || vg.getChildAt(1) == view) { } else { if (large[id]) { vg.setVisibility(View.GONE); } else if (vg.getChildCount() > 0) { vg.setVisibility(View.VISIBLE); } } } }
From source file:com.google.android.apps.iosched.ui.SessionDetailFragment.java
private void onSpeakersQueryComplete(Cursor cursor) { try {//from w w w.j a va 2 s . c o m mSpeakersCursor = true; // TODO: remove any existing speakers from layout, since this cursor // might be from a data change notification. final ViewGroup speakersGroup = (ViewGroup) mRootView.findViewById(R.id.session_speakers_block); final LayoutInflater inflater = getActivity().getLayoutInflater(); boolean hasSpeakers = false; while (cursor.moveToNext()) { final String speakerName = cursor.getString(SpeakersQuery.SPEAKER_NAME); if (TextUtils.isEmpty(speakerName)) { continue; } final String speakerImageUrl = cursor.getString(SpeakersQuery.SPEAKER_IMAGE_URL); final String speakerCompany = cursor.getString(SpeakersQuery.SPEAKER_COMPANY); final String speakerUrl = cursor.getString(SpeakersQuery.SPEAKER_URL); final String speakerAbstract = cursor.getString(SpeakersQuery.SPEAKER_ABSTRACT); String speakerHeader = speakerName; if (!TextUtils.isEmpty(speakerCompany)) { speakerHeader += ", " + speakerCompany; } final View speakerView = inflater.inflate(R.layout.speaker_detail, speakersGroup, false); final TextView speakerHeaderView = (TextView) speakerView.findViewById(R.id.speaker_header); final ImageView speakerImgView = (ImageView) speakerView.findViewById(R.id.speaker_image); final TextView speakerUrlView = (TextView) speakerView.findViewById(R.id.speaker_url); final TextView speakerAbstractView = (TextView) speakerView.findViewById(R.id.speaker_abstract); if (!TextUtils.isEmpty(speakerImageUrl)) { BitmapUtils.fetchImage(getActivity(), speakerImageUrl, null, null, new BitmapUtils.OnFetchCompleteListener() { public void onFetchComplete(Object cookie, Bitmap result) { if (result != null) { speakerImgView.setImageBitmap(result); } } }); } speakerHeaderView.setText(speakerHeader); UIUtils.setTextMaybeHtml(speakerAbstractView, speakerAbstract); if (!TextUtils.isEmpty(speakerUrl)) { UIUtils.setTextMaybeHtml(speakerUrlView, speakerUrl); speakerUrlView.setVisibility(View.VISIBLE); } else { speakerUrlView.setVisibility(View.GONE); } speakersGroup.addView(speakerView); hasSpeakers = true; mHasSummaryContent = true; } speakersGroup.setVisibility(hasSpeakers ? View.VISIBLE : View.GONE); // Show empty message when all data is loaded, and nothing to show if (mSessionCursor && !mHasSummaryContent) { mRootView.findViewById(android.R.id.empty).setVisibility(View.VISIBLE); } } finally { if (null != cursor) { cursor.close(); } } }
From source file:com.vuze.android.remote.fragment.TorrentListFragment.java
private void setupExpando(View view, int id_header, int id_body) { ViewGroup vgHeader = (ViewGroup) view.findViewById(id_header); final ViewGroup vgBody = (ViewGroup) view.findViewById(id_body); if (vgBody == null || vgHeader == null) { return;//from w w w. jav a 2 s .co m } listHeaderViewGroups.add(vgHeader); vgHeader.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { sidelistInFocus = true; // Consume touch event if user clicked the active sidelist view to // expand it // Otherwise, the active sidelist content would be collaped return expandSideListWidth(true) && sidebarViewActive == vgBody; } }); vgHeader.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (!sidelistIsExpanded && canSideListExpand()) { return; } boolean same = sidebarViewActive == vgBody; if (sidebarViewActive != null) { sidebarViewActive.setVisibility(View.GONE); } if (same) { sidebarViewActive = null; if (hideUnselectedSideHeaders) { for (ViewGroup vgHeader : listHeaderViewGroups) { vgHeader.setVisibility(View.VISIBLE); } } } else { vgBody.setVisibility(View.VISIBLE); sidebarViewActive = vgBody; if (hideUnselectedSideHeaders) { for (ViewGroup vgHeader : listHeaderViewGroups) { vgHeader.setVisibility(vgHeader == v ? View.VISIBLE : View.GONE); } } } if (tvSideFilterText != null && listSideFilter != null) { tvSideFilterText.setVisibility(tvSideFilterText.getText().length() == 0 && ((View) listSideFilter).getVisibility() == View.GONE ? View.GONE : View.VISIBLE); } } }); }
From source file:net.abcdroid.devfest12.ui.SessionDetailFragment.java
private void onSpeakersQueryComplete(Cursor cursor) { mSpeakersCursor = true;//ww w .j a va 2 s . co m // TODO: remove existing speakers from layout, since this cursor might be from a data change final ViewGroup speakersGroup = (ViewGroup) mRootView.findViewById(R.id.session_speakers_block); final LayoutInflater inflater = getActivity().getLayoutInflater(); boolean hasSpeakers = false; while (cursor.moveToNext()) { final String speakerName = cursor.getString(SpeakersQuery.SPEAKER_NAME); if (TextUtils.isEmpty(speakerName)) { continue; } final String speakerImageUrl = cursor.getString(SpeakersQuery.SPEAKER_IMAGE_URL); final String speakerCompany = cursor.getString(SpeakersQuery.SPEAKER_COMPANY); final String speakerUrl = cursor.getString(SpeakersQuery.SPEAKER_URL); final String speakerAbstract = cursor.getString(SpeakersQuery.SPEAKER_ABSTRACT); String speakerHeader = speakerName; if (!TextUtils.isEmpty(speakerCompany)) { speakerHeader += ", " + speakerCompany; } final View speakerView = inflater.inflate(R.layout.speaker_detail, speakersGroup, false); final TextView speakerHeaderView = (TextView) speakerView.findViewById(R.id.speaker_header); final ImageView speakerImageView = (ImageView) speakerView.findViewById(R.id.speaker_image); final TextView speakerAbstractView = (TextView) speakerView.findViewById(R.id.speaker_abstract); if (!TextUtils.isEmpty(speakerImageUrl)) { mImageFetcher.loadThumbnailImage(speakerImageUrl, speakerImageView, R.drawable.person_image_empty); } speakerHeaderView.setText(speakerHeader); speakerImageView.setContentDescription(getString(R.string.speaker_googleplus_profile, speakerHeader)); UIUtils.setTextMaybeHtml(speakerAbstractView, speakerAbstract); if (!TextUtils.isEmpty(speakerUrl)) { speakerImageView.setEnabled(true); speakerImageView.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { Intent speakerProfileIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(speakerUrl)); speakerProfileIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); UIUtils.preferPackageForIntent(getActivity(), speakerProfileIntent, UIUtils.GOOGLE_PLUS_PACKAGE_NAME); UIUtils.safeOpenLink(getActivity(), speakerProfileIntent); } }); } else { speakerImageView.setEnabled(false); speakerImageView.setOnClickListener(null); } speakersGroup.addView(speakerView); hasSpeakers = true; mHasSummaryContent = true; } speakersGroup.setVisibility(hasSpeakers ? View.VISIBLE : View.GONE); // Show empty message when all data is loaded, and nothing to show if (mSessionCursor && !mHasSummaryContent) { mRootView.findViewById(android.R.id.empty).setVisibility(View.VISIBLE); } }
From source file:com.conferenceengineer.android.iosched.ui.SessionDetailFragment.java
private void onSpeakersQueryComplete(Cursor cursor) { mSpeakersCursor = true;// w ww .jav a 2 s . co m final ViewGroup speakersGroup = (ViewGroup) mRootView.findViewById(R.id.session_speakers_block); // Remove all existing speakers (everything but first child, which is the header) for (int i = speakersGroup.getChildCount() - 1; i >= 1; i--) { speakersGroup.removeViewAt(i); } final LayoutInflater inflater = getActivity().getLayoutInflater(); boolean hasSpeakers = false; while (cursor.moveToNext()) { final String speakerName = cursor.getString(SpeakersQuery.SPEAKER_NAME); if (TextUtils.isEmpty(speakerName)) { continue; } final String speakerImageUrl = cursor.getString(SpeakersQuery.SPEAKER_IMAGE_URL); final String speakerCompany = cursor.getString(SpeakersQuery.SPEAKER_COMPANY); final String speakerUrl = cursor.getString(SpeakersQuery.SPEAKER_URL); final String speakerAbstract = cursor.getString(SpeakersQuery.SPEAKER_ABSTRACT); String speakerHeader = speakerName; if (!TextUtils.isEmpty(speakerCompany)) { speakerHeader += ", " + speakerCompany; } final View speakerView = inflater.inflate(R.layout.speaker_detail, speakersGroup, false); final TextView speakerHeaderView = (TextView) speakerView.findViewById(R.id.speaker_header); final ImageView speakerImageView = (ImageView) speakerView.findViewById(R.id.speaker_image); final TextView speakerAbstractView = (TextView) speakerView.findViewById(R.id.speaker_abstract); if (!TextUtils.isEmpty(speakerImageUrl) && mImageLoader != null) { mImageLoader.get(UIUtils.getConferenceImageUrl(speakerImageUrl), speakerImageView); } speakerHeaderView.setText(speakerHeader); speakerImageView.setContentDescription(getString(R.string.speaker_googleplus_profile, speakerHeader)); UIUtils.setTextMaybeHtml(speakerAbstractView, speakerAbstract); if (!TextUtils.isEmpty(speakerUrl)) { speakerImageView.setEnabled(true); speakerImageView.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { Intent speakerProfileIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(speakerUrl)); speakerProfileIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); startActivity(speakerProfileIntent); } }); } else { speakerImageView.setEnabled(false); speakerImageView.setOnClickListener(null); } speakersGroup.addView(speakerView); hasSpeakers = true; mHasSummaryContent = true; } speakersGroup.setVisibility(hasSpeakers ? View.VISIBLE : View.GONE); // Show empty message when all data is loaded, and nothing to show if (mSessionCursor && !mHasSummaryContent) { mRootView.findViewById(android.R.id.empty).setVisibility(View.VISIBLE); } }
From source file:com.gdgdevfest.android.apps.devfestbcn.ui.SessionDetailFragment.java
private void onSpeakersQueryComplete(Cursor cursor) { mSpeakersCursor = true;//from w ww . j av a2 s . c om final ViewGroup speakersGroup = (ViewGroup) mRootView.findViewById(R.id.session_speakers_block); // Remove all existing speakers (everything but first child, which is the header) for (int i = speakersGroup.getChildCount() - 1; i >= 1; i--) { speakersGroup.removeViewAt(i); } final LayoutInflater inflater = getActivity().getLayoutInflater(); boolean hasSpeakers = false; while (cursor.moveToNext()) { final String speakerName = cursor.getString(SpeakersQuery.SPEAKER_NAME); if (TextUtils.isEmpty(speakerName)) { continue; } final String speakerImageUrl = cursor.getString(SpeakersQuery.SPEAKER_IMAGE_URL); final String speakerCompany = cursor.getString(SpeakersQuery.SPEAKER_COMPANY); final String speakerUrl = cursor.getString(SpeakersQuery.SPEAKER_URL); final String speakerAbstract = cursor.getString(SpeakersQuery.SPEAKER_ABSTRACT); String speakerHeader = speakerName; if (!TextUtils.isEmpty(speakerCompany)) { speakerHeader += ", " + speakerCompany; } final View speakerView = inflater.inflate(R.layout.speaker_detail, speakersGroup, false); final TextView speakerHeaderView = (TextView) speakerView.findViewById(R.id.speaker_header); final ImageView speakerImageView = (ImageView) speakerView.findViewById(R.id.speaker_image); final TextView speakerAbstractView = (TextView) speakerView.findViewById(R.id.speaker_abstract); if (!TextUtils.isEmpty(speakerImageUrl) && mImageLoader != null) { mImageLoader.get(UIUtils.getConferenceImageUrl(speakerImageUrl), speakerImageView); } speakerHeaderView.setText(speakerHeader); speakerImageView.setContentDescription(getString(R.string.speaker_googleplus_profile, speakerHeader)); UIUtils.setTextMaybeHtml(speakerAbstractView, speakerAbstract); if (!TextUtils.isEmpty(speakerUrl)) { speakerImageView.setEnabled(true); speakerImageView.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { Intent speakerProfileIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(speakerUrl)); speakerProfileIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); UIUtils.preferPackageForIntent(getActivity(), speakerProfileIntent, UIUtils.GOOGLE_PLUS_PACKAGE_NAME); startActivity(speakerProfileIntent); } }); } else { speakerImageView.setEnabled(false); speakerImageView.setOnClickListener(null); } speakersGroup.addView(speakerView); hasSpeakers = true; mHasSummaryContent = true; } speakersGroup.setVisibility(hasSpeakers ? View.VISIBLE : View.GONE); // Show empty message when all data is loaded, and nothing to show if (mSessionCursor && !mHasSummaryContent) { mRootView.findViewById(android.R.id.empty).setVisibility(View.VISIBLE); } }
From source file:com.ncode.android.apps.schedo.ui.EventDetailActivity.java
private void onSpeakersQueryComplete(Cursor cursor) { mSpeakersCursor = true;/*from w w w . java2s .c o m*/ final ViewGroup speakersGroup = (ViewGroup) findViewById(R.id.session_speakers_block); // Remove all existing speakers (everything but first child, which is the header) for (int i = speakersGroup.getChildCount() - 1; i >= 1; i--) { speakersGroup.removeViewAt(i); } final LayoutInflater inflater = getLayoutInflater(); boolean hasSpeakers = false; cursor.moveToPosition(-1); // move to just before first record while (cursor.moveToNext()) { final String speakerName = cursor.getString(SpeakersQuery.SPEAKER_NAME); if (TextUtils.isEmpty(speakerName)) { continue; } final String speakerImageUrl = cursor.getString(SpeakersQuery.SPEAKER_IMAGE_URL); final String speakerCompany = cursor.getString(SpeakersQuery.SPEAKER_COMPANY); final String speakerUrl = cursor.getString(SpeakersQuery.SPEAKER_URL); final String speakerAbstract = cursor.getString(SpeakersQuery.SPEAKER_ABSTRACT); String speakerHeader = speakerName; if (!TextUtils.isEmpty(speakerCompany)) { speakerHeader += ", " + speakerCompany; } final View speakerView = inflater.inflate(R.layout.speaker_detail, speakersGroup, false); final TextView speakerHeaderView = (TextView) speakerView.findViewById(R.id.speaker_header); final ImageView speakerImageView = (ImageView) speakerView.findViewById(R.id.speaker_image); final TextView speakerAbstractView = (TextView) speakerView.findViewById(R.id.speaker_abstract); if (!TextUtils.isEmpty(speakerImageUrl) && mSpeakersImageLoader != null) { mSpeakersImageLoader.loadImage(speakerImageUrl, speakerImageView); } speakerHeaderView.setText(speakerHeader); speakerImageView.setContentDescription(getString(R.string.speaker_googleplus_profile, speakerHeader)); UIUtils.setTextMaybeHtml(speakerAbstractView, speakerAbstract); if (!TextUtils.isEmpty(speakerUrl)) { speakerImageView.setEnabled(true); speakerImageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent speakerProfileIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(speakerUrl)); speakerProfileIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); UIUtils.preferPackageForIntent(EventDetailActivity.this, speakerProfileIntent, UIUtils.GOOGLE_PLUS_PACKAGE_NAME); startActivity(speakerProfileIntent); } }); } else { speakerImageView.setEnabled(false); speakerImageView.setOnClickListener(null); } speakersGroup.addView(speakerView); hasSpeakers = true; mHasSummaryContent = true; } speakersGroup.setVisibility(hasSpeakers ? View.VISIBLE : View.GONE); updateEmptyView(); }
From source file:com.google.samples.apps.iosched.ui.SessionDetailActivity.java
private void onSpeakersQueryComplete(Cursor cursor) { mSpeakersCursor = true;/*from w ww . ja v a 2 s . c om*/ final ViewGroup speakersGroup = (ViewGroup) findViewById(R.id.session_speakers_block); // Remove all existing speakers (everything but first child, which is the header) for (int i = speakersGroup.getChildCount() - 1; i >= 1; i--) { speakersGroup.removeViewAt(i); } final LayoutInflater inflater = getLayoutInflater(); boolean hasSpeakers = false; cursor.moveToPosition(-1); // move to just before first record while (cursor.moveToNext()) { final String speakerName = cursor.getString(SpeakersQuery.SPEAKER_NAME); if (TextUtils.isEmpty(speakerName)) { continue; } final String speakerImageUrl = cursor.getString(SpeakersQuery.SPEAKER_IMAGE_URL); final String speakerCompany = cursor.getString(SpeakersQuery.SPEAKER_COMPANY); final String speakerUrl = cursor.getString(SpeakersQuery.SPEAKER_URL); final String speakerAbstract = cursor.getString(SpeakersQuery.SPEAKER_ABSTRACT); String speakerHeader = speakerName; if (!TextUtils.isEmpty(speakerCompany)) { speakerHeader += ", " + speakerCompany; } final View speakerView = inflater.inflate(R.layout.speaker_detail, speakersGroup, false); final TextView speakerHeaderView = (TextView) speakerView.findViewById(R.id.speaker_header); final ImageView speakerImageView = (ImageView) speakerView.findViewById(R.id.speaker_image); final TextView speakerAbstractView = (TextView) speakerView.findViewById(R.id.speaker_abstract); if (!TextUtils.isEmpty(speakerImageUrl) && mSpeakersImageLoader != null) { mSpeakersImageLoader.loadImage(speakerImageUrl, speakerImageView); } speakerHeaderView.setText(speakerHeader); speakerImageView.setContentDescription(getString(R.string.speaker_googleplus_profile, speakerHeader)); UIUtils.setTextMaybeHtml(speakerAbstractView, speakerAbstract); if (!TextUtils.isEmpty(speakerUrl)) { speakerImageView.setEnabled(true); speakerImageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent speakerProfileIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(speakerUrl)); speakerProfileIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); UIUtils.preferPackageForIntent(SessionDetailActivity.this, speakerProfileIntent, UIUtils.GOOGLE_PLUS_PACKAGE_NAME); startActivity(speakerProfileIntent); } }); } else { speakerImageView.setEnabled(false); speakerImageView.setOnClickListener(null); } speakersGroup.addView(speakerView); hasSpeakers = true; mHasSummaryContent = true; } speakersGroup.setVisibility(hasSpeakers ? View.VISIBLE : View.GONE); updateEmptyView(); }