Java Code Examples for android.widget.LinearLayout#removeViews()
The following examples show how to use
android.widget.LinearLayout#removeViews() .
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: ColorPickerPreference.java From GravityBox with Apache License 2.0 | 6 votes |
private void setPreviewColor() { if (mView == null) return; ImageView iView = new ImageView(getContext()); LinearLayout widgetFrameView = ((LinearLayout)mView.findViewById(android.R.id.widget_frame)); if (widgetFrameView == null) return; widgetFrameView.setVisibility(View.VISIBLE); widgetFrameView.setPadding( widgetFrameView.getPaddingLeft(), widgetFrameView.getPaddingTop(), (int)(mDensity * 8), widgetFrameView.getPaddingBottom() ); // remove already create preview image int count = widgetFrameView.getChildCount(); if (count > 0) { widgetFrameView.removeViews(0, count); } widgetFrameView.addView(iView); widgetFrameView.setMinimumWidth(0); iView.setBackground(new AlphaPatternDrawable((int)(5 * mDensity))); iView.setImageBitmap(getPreviewBitmap()); }
Example 2
Source File: ThemeListPreference.java From droidddle with Apache License 2.0 | 6 votes |
private void setPreviewColor() { if (mView == null) return; ImageView iView = new ImageView(getContext()); LinearLayout widgetFrameView = ((LinearLayout) mView.findViewById(android.R.id.widget_frame)); if (widgetFrameView == null) return; widgetFrameView.setVisibility(View.VISIBLE); widgetFrameView.setPadding(widgetFrameView.getPaddingLeft(), widgetFrameView.getPaddingTop(), (int) (mDensity * 8), widgetFrameView.getPaddingBottom()); // remove already create preview image int count = widgetFrameView.getChildCount(); if (count > 0) { widgetFrameView.removeViews(0, count); } widgetFrameView.addView(iView); widgetFrameView.setMinimumWidth(0); iView.setBackgroundDrawable(new AlphaPatternDrawable((int) (5 * mDensity))); iView.setImageBitmap(getPreviewBitmap(mDensity, colors[mEntryIndex])); }
Example 3
Source File: ColorPickerPreference.java From LyricHere with Apache License 2.0 | 6 votes |
private void setPreviewColor() { if (mView == null) return; ImageView iView = new ImageView(getContext()); LinearLayout widgetFrameView = ((LinearLayout) mView.findViewById(android.R.id.widget_frame)); if (widgetFrameView == null) return; widgetFrameView.setVisibility(View.VISIBLE); widgetFrameView.setPadding( widgetFrameView.getPaddingLeft(), widgetFrameView.getPaddingTop(), (int) (mDensity * 8), widgetFrameView.getPaddingBottom() ); // remove already create preview image int count = widgetFrameView.getChildCount(); if (count > 0) { widgetFrameView.removeViews(0, count); } widgetFrameView.addView(iView); widgetFrameView.setMinimumWidth(0); iView.setBackgroundDrawable(new AlphaPatternDrawable((int) (5 * mDensity))); iView.setImageBitmap(getPreviewBitmap()); }
Example 4
Source File: ColorPickerPreference.java From WiFiKeyView with Apache License 2.0 | 6 votes |
@SuppressWarnings("deprecation") private void setPreviewColor() { if (mView == null) return; ImageView iView = new ImageView(getContext()); LinearLayout widgetFrameView = ((LinearLayout) mView.findViewById(android.R.id.widget_frame)); if (widgetFrameView == null) return; widgetFrameView.setVisibility(View.VISIBLE); widgetFrameView.setPadding( widgetFrameView.getPaddingLeft(), widgetFrameView.getPaddingTop(), (int) (mDensity * 8), widgetFrameView.getPaddingBottom() ); // remove already create preview image int count = widgetFrameView.getChildCount(); if (count > 0) { widgetFrameView.removeViews(0, count); } widgetFrameView.addView(iView); widgetFrameView.setMinimumWidth(0); iView.setBackgroundDrawable(new AlphaPatternDrawable((int) (5 * mDensity))); iView.setImageBitmap(getPreviewBitmap()); }
Example 5
Source File: ColorPickerPreference.java From Hangar with GNU General Public License v3.0 | 6 votes |
private void setPreviewColor() { if (mView == null) return; ImageView iView = new ImageView(getContext()); LinearLayout widgetFrameView = ((LinearLayout)mView.findViewById(android.R.id.widget_frame)); if (widgetFrameView == null) return; widgetFrameView.setVisibility(View.VISIBLE); widgetFrameView.setPadding( widgetFrameView.getPaddingLeft(), widgetFrameView.getPaddingTop(), (int)(mDensity * 8), widgetFrameView.getPaddingBottom() ); // remove already create preview image int count = widgetFrameView.getChildCount(); if (count > 0) { widgetFrameView.removeViews(0, count); } widgetFrameView.addView(iView); widgetFrameView.setMinimumWidth(0); iView.setBackgroundDrawable(new AlphaPatternDrawable((int)(5 * mDensity))); iView.setImageBitmap(getPreviewBitmap()); }
Example 6
Source File: ColorPickerPreference.java From fanfouapp-opensource with Apache License 2.0 | 6 votes |
public void setPreviewColor() { if (this.mView == null) { return; } final ImageView iView = new ImageView(getContext()); final LinearLayout widgetFrameView = ((LinearLayout) this.mView .findViewById(android.R.id.widget_frame)); if (widgetFrameView == null) { return; } widgetFrameView.setPadding(widgetFrameView.getPaddingLeft(), widgetFrameView.getPaddingTop(), (int) (this.mDensity * 8), widgetFrameView.getPaddingBottom()); // remove already create preview image final int count = widgetFrameView.getChildCount(); if (count > 0) { widgetFrameView.removeViews(0, count); } widgetFrameView.addView(iView); iView.setBackgroundDrawable(new AlphaPatternDrawable( (int) (5 * this.mDensity))); iView.setImageBitmap(getPreviewBitmap()); }
Example 7
Source File: FormulaTerm.java From microMathematics with GNU General Public License v3.0 | 4 votes |
/** * Procedure deletes argument layout for given term and returns the previous term */ protected TermField deleteArgument(TermField owner, String sep, boolean storeUndoState) { // target layout where terms will be deleted View expandable = owner.getLayout(); if (expandable == null) { return null; } LinearLayout expandableLayout = (LinearLayout) expandable; // view index of the field within the parent layout int startIndex = ViewUtils.getViewIndex(expandableLayout, owner.getEditText()); if (startIndex < 0) { return null; } // how much views shall be deleted: int count = 1; { final String termKey = getContext().getResources().getString(R.string.formula_arg_term_key); final boolean firstTerm = owner.getTermKey().equals(termKey + String.valueOf(1)); if (firstTerm && startIndex + 1 < expandableLayout.getChildCount() && expandableLayout.getChildAt(startIndex + 1) instanceof CustomTextView) { final CustomTextView next = ((CustomTextView) expandableLayout.getChildAt(startIndex + 1)); if (next.getText().toString().equals(sep)) { count++; } } else if (!firstTerm && startIndex >= 1 && expandableLayout.getChildAt(startIndex - 1) instanceof CustomTextView) { final CustomTextView prev = ((CustomTextView) expandableLayout.getChildAt(startIndex - 1)); if (prev.getText().toString().equals(sep)) { startIndex--; count++; } } } if (storeUndoState && parentField != null) { getFormulaList().getUndoState().addEntry(parentField.getState()); } int prevIndex = terms.indexOf(owner); prevIndex--; terms.remove(owner); expandableLayout.removeViews(startIndex, count); reIndexTerms(); return (prevIndex >= 0) ? terms.get(prevIndex) : null; }