Java Code Examples for android.widget.LinearLayout.getVisibility()

The following are Jave code examples for showing how to use getVisibility() of the android.widget.LinearLayout class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: Bigbang   File: ColorPickerView.java   Source Code and License Vote up 6 votes
public void setColorPreview(LinearLayout colorPreview, Integer selectedColor) {
	if (colorPreview == null)
		return;
	this.colorPreview = colorPreview;
	if (selectedColor == null)
		selectedColor = 0;
	int children = colorPreview.getChildCount();
	if (children == 0 || colorPreview.getVisibility() != View.VISIBLE)
		return;

	for (int i = 0; i < children; i++) {
		View childView = colorPreview.getChildAt(i);
		if (!(childView instanceof LinearLayout))
			continue;
		LinearLayout childLayout = (LinearLayout) childView;
		if (i == selectedColor) {
			childLayout.setBackgroundColor(Color.WHITE);
		}
		ImageView childImage = (ImageView) childLayout.findViewById(R.id.image_preview);
		childImage.setClickable(true);
		childImage.setTag(i);
		childImage.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				if (v == null)
					return;
				Object tag = v.getTag();
				if (tag == null || !(tag instanceof Integer))
					return;
				setSelectedColor((int) tag);
			}
		});
	}
}
 
Example 2
Project: mupdf-android-viewer-nui   File: DocActivityView.java   Source Code and License Vote up 6 votes
protected void hidePages()
{
	LinearLayout pages = (LinearLayout) findViewById(R.id.pages_container);
	if (null == pages)
		return;

	if (pages.getVisibility() == View.GONE)
		return;

	pages.setVisibility(View.GONE);
	ViewTreeObserver observer = mDocView.getViewTreeObserver();
	observer.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener()
	{
		@Override
		public void onGlobalLayout()
		{
			mDocView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
			mDocView.onHidePages();
		}
	});
}
 
Example 3
Project: Chorus-RF-Laptimer   File: RaceSetupFragment.java   Source Code and License Vote up 5 votes
private void toggleVoltageAdjustmentControls(View rootView) {
    boolean isEnabled = AppState.getInstance().isLiPoMonitorEnabled;
    LinearLayout layout = (LinearLayout) rootView.findViewById(R.id.adjustmentLayout);
    boolean isVisible = layout.getVisibility() == View.VISIBLE;
    if (!isVisible) {
        if (isEnabled) {
            layout.setVisibility(View.VISIBLE);
        }
    } else {
        layout.setVisibility(View.GONE);
    }
}
 
Example 4
Project: mupdf-android-viewer-nui   File: DocActivityView.java   Source Code and License Vote up 5 votes
protected void showPages()
{
	LinearLayout pages = (LinearLayout) findViewById(R.id.pages_container);
	if (null == pages)
		return;

	if (pages.getVisibility() == View.VISIBLE)
		return;

	pages.setVisibility(View.VISIBLE);

	final ViewTreeObserver observer = mDocView.getViewTreeObserver();
	observer.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener()
	{
		@Override
		public void onGlobalLayout()
		{
			observer.removeOnGlobalLayoutListener(this);
			mDocView.onShowPages();
		}
	});

	final ViewTreeObserver observer2 = getViewTreeObserver();
	observer2.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener()
	{
		@Override
		public void onGlobalLayout()
		{
			observer2.removeOnGlobalLayoutListener(this);
			mDocPagesView.onOrientationChange();
			int page = mDocView.getMostVisiblePage();
			mDocPagesView.setCurrentPage(page);
			mDocPagesView.scrollToPage(page);
		}
	});
}
 
Example 5
Project: javaide   File: ColorPickerView.java   Source Code and License Vote up 5 votes
public void setColorPreview(LinearLayout colorPreview, Integer selectedColor) {
	if (colorPreview == null)
		return;
	this.colorPreview = colorPreview;
	if (selectedColor == null)
		selectedColor = 0;
	int children = colorPreview.getChildCount();
	if (children == 0 || colorPreview.getVisibility() != View.VISIBLE)
		return;

	for (int i = 0; i < children; i++) {
		View childView = colorPreview.getChildAt(i);
		if (!(childView instanceof LinearLayout))
			continue;
		LinearLayout childLayout = (LinearLayout) childView;
		if (i == selectedColor) {
			childLayout.setBackgroundColor(Color.WHITE);
		}
		ImageView childImage = (ImageView) childLayout.findViewById(R.id.image_preview);
		childImage.setClickable(true);
		childImage.setTag(i);
		childImage.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				if (v == null)
					return;
				Object tag = v.getTag();
				if (tag == null || !(tag instanceof Integer))
					return;
				setSelectedColor((int) tag);
			}
		});
	}
}