Java Code Examples for android.widget.LinearLayout#getVisibility()
The following examples show how to use
android.widget.LinearLayout#getVisibility() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DocActivityView.java From Mupdf with Apache License 2.0 | 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 2
Source File: ColorPickerView.java From styT with Apache License 2.0 | 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 = 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 3
Source File: ColorPickerView.java From java-n-IDE-for-Android with Apache License 2.0 | 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); } }); } }
Example 4
Source File: ColorPickerView.java From timecat with Apache License 2.0 | 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); } }); } }
Example 5
Source File: ColorPickerView.java From RxTools-master with Apache License 2.0 | 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); } }); } }
Example 6
Source File: RaceSetupFragment.java From Chorus-RF-Laptimer with MIT License | 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 7
Source File: RaceSetupFragment.java From Chorus-RF-Laptimer with MIT License | 5 votes |
private void toggleAdvancedControls(View rootView) { LinearLayout layout = (LinearLayout) rootView.findViewById(R.id.layoutAdvanced); boolean isVisible = layout.getVisibility() == View.VISIBLE; if (!isVisible) { layout.setVisibility(View.VISIBLE); } else if (!AppState.getInstance().shouldUseExperimentalFeatures && !AppState.getInstance().checkIsConnectionTestRunning()){ // only hide if experimental features are off and connection test is not running layout.setVisibility(View.GONE); } }
Example 8
Source File: ColorPickerView.java From javaide with GNU General Public License v3.0 | 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); } }); } }
Example 9
Source File: ColorPickerView.java From openlauncher with Apache License 2.0 | 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); } }); } }
Example 10
Source File: ColorPickerView.java From droidddle with Apache License 2.0 | 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); } }); } }
Example 11
Source File: CalcActivity.java From Equate with GNU General Public License v3.0 | 5 votes |
private void setUnitViewVisibility(UnitVisibility uv) { final LinearLayout mUnitContain = (LinearLayout) findViewById(R.id.unit_container); if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT){ if (uv == UnitVisibility.HIDDEN || mCalc.getUnitTypeSize() == 0 || (uv == UnitVisibility.TOGGLE && mUnitContain.getVisibility() == LinearLayout.VISIBLE)) mUnitContain.setVisibility(LinearLayout.GONE); else { mUnitContain.setVisibility(LinearLayout.VISIBLE); //update the screen to move result list up updateScreen(true, true); } } }
Example 12
Source File: DocActivityView.java From Mupdf with Apache License 2.0 | 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 13
Source File: RaceSetupFragment.java From Chorus-RF-Laptimer with MIT License | 4 votes |
private boolean areAdvancedControlsVisible(View rootView) { LinearLayout layout = (LinearLayout) rootView.findViewById(R.id.layoutAdvanced); return layout.getVisibility() == View.VISIBLE; }
Example 14
Source File: MLAlertController.java From NewXmPluginSDK with Apache License 2.0 | 4 votes |
private void setupView() { LinearLayout contentPanel = (LinearLayout) mWindow.findViewById(R.id.contentPanel); setupContent(contentPanel); boolean hasButtons = setupButtons(); LinearLayout topPanel = (LinearLayout) mWindow.findViewById(R.id.topPanel); boolean hasTitle = setupTitle(topPanel); View buttonPanel = mWindow.findViewById(R.id.buttonPanel); if (!hasButtons) { buttonPanel.setVisibility(View.GONE); } FrameLayout customPanel = (FrameLayout) mWindow.findViewById(R.id.customPanel); if (mView != null) { // 自定义dialog透明背景 // mWindow.findViewById(R.id.parentPanel).setBackgroundColor(mContext.getResources().getColor(android.R.color.transparent)); FrameLayout custom = (FrameLayout) mWindow.findViewById(R.id.custom); custom.addView(mView); if (mViewSpacingSpecified) { custom.setPadding(mViewSpacingLeft, mViewSpacingTop, mViewSpacingRight, mViewSpacingBottom); if (mCustomBgTransplant) mTransplantBg = true; } if (mListView != null) { ((LinearLayout.LayoutParams) customPanel.getLayoutParams()).weight = 0; } } else { customPanel.setVisibility(View.GONE); } if (mTransplantBg) { mWindow.findViewById(R.id.parentPanel).setBackgroundColor( mContext.getResources().getColor(android.R.color.transparent)); } else { // mWindow.findViewById(R.id.parentPanel).setBackgroundColor(0xffffffff); } if (mListView != null) { // Listview有分割线divider,因此header和listview需要显示分割线 mWindow.findViewById(R.id.title_divider_line).setVisibility(View.VISIBLE); mWindow.findViewById(R.id.title_divider_line_bottom).setVisibility(View.VISIBLE); } else { mWindow.findViewById(R.id.title_divider_line).setVisibility(View.GONE); mWindow.findViewById(R.id.title_divider_line_bottom).setVisibility(View.GONE); } /** * Add margin top for the button panel if we have not any panel */ if (topPanel.getVisibility() == View.GONE && contentPanel.getVisibility() == View.GONE && customPanel.getVisibility() == View.GONE && hasButtons) { buttonPanel.setPadding(buttonPanel.getPaddingLeft(), buttonPanel.getPaddingBottom(), buttonPanel.getPaddingRight(), buttonPanel.getPaddingBottom()); } /* * Only display the divider if we have a title and a custom view or a * message. */ if (hasTitle) { // View divider = null; // if (mMessage != null || mView != null || mListView != null) { // divider = mWindow.findViewById(R.id.titleDivider); // } else { // divider = mWindow.findViewById(R.id.titleDividerTop); // } // // if (divider != null) { // divider.setVisibility(View.VISIBLE); // } } setBackground(topPanel, contentPanel, customPanel, hasButtons, hasTitle, buttonPanel); if (TextUtils.isEmpty(mTitle) && TextUtils.isEmpty(mMessage)) { mWindow.findViewById(R.id.empty_view).setVisibility(View.GONE); } }
Example 15
Source File: MLAlertController.java From NewXmPluginSDK with Apache License 2.0 | 4 votes |
private void setBackground(LinearLayout topPanel, LinearLayout contentPanel, View customPanel, boolean hasButtons, boolean hasTitle, View buttonPanel) { if (mTransplantBg) { /* Get all the different background required */ int fullDark = mContext.getResources().getColor(android.R.color.transparent); int topDark = mContext.getResources().getColor(android.R.color.transparent); int centerDark = mContext.getResources().getColor(android.R.color.transparent); int bottomDark = mContext.getResources().getColor(android.R.color.transparent); int fullBright = mContext.getResources().getColor(android.R.color.transparent); int topBright = mContext.getResources().getColor(android.R.color.transparent); int centerBright = mContext.getResources().getColor(android.R.color.transparent); int bottomBright = mContext.getResources().getColor(android.R.color.transparent); int bottomMedium = mContext.getResources().getColor(android.R.color.transparent); /* * We now set the background of all of the sections of the alert. * First collect together each section that is being displayed along * with whether it is on a light or dark background, then run * through them setting their backgrounds. This is complicated * because we need to correctly use the full, top, middle, and * bottom graphics depending on how many views they are and where * they appear. */ View[] views = new View[4]; boolean[] light = new boolean[4]; View lastView = null; boolean lastLight = false; int pos = 0; if (hasTitle) { views[pos] = topPanel; light[pos] = false; pos++; } /* * The contentPanel displays either a custom text message or a * ListView. If it's text we should use the dark background for * ListView we should use the light background. If neither are there * the contentPanel will be hidden so set it as null. */ views[pos] = (contentPanel.getVisibility() == View.GONE) ? null : contentPanel; light[pos] = mListView != null; pos++; if (customPanel != null) { views[pos] = customPanel; light[pos] = mForceInverseBackground; pos++; } if (hasButtons) { views[pos] = buttonPanel; light[pos] = true; } boolean setView = false; for (pos = 0; pos < views.length; pos++) { View v = views[pos]; if (v == null) { continue; } if (lastView != null) { if (!setView) { lastView.setBackgroundResource(lastLight ? topBright : topDark); } else { lastView.setBackgroundResource(lastLight ? centerBright : centerDark); } setView = true; } lastView = v; lastLight = light[pos]; } if (lastView != null) { if (setView) { /* * ListViews will use the Bright background but buttons use * the Medium background. */ lastView.setBackgroundResource( lastLight ? (hasButtons ? bottomMedium : bottomBright) : bottomDark); } else { lastView.setBackgroundResource(lastLight ? fullBright : fullDark); } } } if ((mListView != null) && (mAdapter != null)) { mListView.setAdapter(mAdapter); if (mCheckedItem > -1) { mListView.setItemChecked(mCheckedItem, true); mListView.setSelection(mCheckedItem); } } }
Example 16
Source File: AddAccountAuthorizeClickListener.java From YiBo with Apache License 2.0 | 4 votes |
@Override public void onClick(View v) { ServiceProvider sp = context.getSp(); CheckBox cbMakeDefault = (CheckBox)context.findViewById(R.id.cbDefault); CheckBox cbFollowOffical = (CheckBox)context.findViewById(R.id.cbFollowOffical); boolean isMakeDefault = cbMakeDefault.isChecked(); boolean isFollowOffical = cbFollowOffical.isChecked(); if (sp == null) { Toast.makeText(context, R.string.msg_accounts_add_spSelect, Toast.LENGTH_LONG).show(); return; } //hide input method InputMethodManager inputMethodManager = (InputMethodManager)v.getContext(). getSystemService(Context.INPUT_METHOD_SERVICE); inputMethodManager.hideSoftInputFromWindow(cbMakeDefault.getWindowToken(), 0); Authorization auth = context.getAuth(); OAuthConfig oauthConfig = auth.getoAuthConfig(); LinearLayout llXAuthForm = (LinearLayout) context.findViewById(R.id.llXAuthForm); if (llXAuthForm.getVisibility() == View.VISIBLE) { xauthAuthorize(sp, isMakeDefault, isFollowOffical); return; } if (oauthConfig.getAuthVersion() == Authorization.AUTH_VERSION_OAUTH_1) { new OAuthRetrieveRequestTokenTask(context, sp, isMakeDefault, isFollowOffical).execute(); return; } try { OAuth2AuthorizeHelper authHelper = new OAuth2AuthorizeHelper(); Intent intent = new Intent(); intent.setClass(context, AuthorizeActivity.class); intent.putExtra("Authorization", auth); intent.putExtra("ServiceProvider", sp.toString()); String authorizeUrl = authHelper.getAuthorizeUrl(auth, GrantType.AUTHORIZATION_CODE, DisplayType.MOBILE); intent.putExtra("Authorize_Url", authorizeUrl); intent.putExtra("Callback_Url", oauthConfig.getCallbackUrl()); context.startActivityForResult(intent, Constants.REQUEST_CODE_OAUTH_AUTHORIZE); } catch (LibException e) { Logger.debug("error", e); } }