Example usage for android.view ViewGroup removeView

List of usage examples for android.view ViewGroup removeView

Introduction

In this page you can find the example usage for android.view ViewGroup removeView.

Prototype

@Override
public void removeView(View view) 

Source Link

Document

Note: do not invoke this method from #draw(android.graphics.Canvas) , #onDraw(android.graphics.Canvas) , #dispatchDraw(android.graphics.Canvas) or any related method.

Usage

From source file:com.tecnojin.timekiller.menuviews.GamePageAdapter.java

@Override
public void destroyItem(ViewGroup container, int position, Object object) {
    if (object instanceof View)
        container.removeView((View) object);
}

From source file:com.android.ted.sample.viewpager.MainPagerAdapter.java

@Override
public void destroyItem(ViewGroup container, int position, Object object) {
    if (mAllImageMap.containsKey(position)) {
        container.removeView(mAllImageMap.get(position));
    }/*from   w w w.  java  2 s  . c o  m*/
}

From source file:com.community.yuequ.bottombar.BottomBarBadge.java

private void wrapTabAndBadgeInSameContainer(final BottomBarTab tab) {
    ViewGroup tabContainer = (ViewGroup) tab.getParent();
    tabContainer.removeView(tab);

    final FrameLayout badgeContainer = new FrameLayout(getContext());
    badgeContainer.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT));

    badgeContainer.addView(tab);/* ww  w.  j  a  v a 2s  .co m*/
    badgeContainer.addView(this);

    tabContainer.addView(badgeContainer, tab.getIndexInTabContainer());

    badgeContainer.getViewTreeObserver()
            .addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
                @SuppressWarnings("deprecation")
                @Override
                public void onGlobalLayout() {
                    badgeContainer.getViewTreeObserver().removeGlobalOnLayoutListener(this);
                    adjustPositionAndSize(tab);
                }
            });
}

From source file:com.esminis.server.library.dialog.pager.DialogPagerAdapter.java

@Override
public void destroyItem(ViewGroup container, int position, Object object) {
    final DialogPagerPage page = pages.get(position);
    if (page == object) {
        pages.remove(position);//  w ww .j a v a 2 s.  c  om
        container.removeView(page.getLayout());
    }
}

From source file:is.hello.go99.example.view.InfoTooltipView.java

private void dismissNow() {
    final ViewGroup parent = (ViewGroup) getParent();
    if (parent != null) {
        parent.removeView(this);
    }/*w w  w.j av  a  2 s  .  c  o  m*/
}

From source file:jahirfiquitiva.iconshowcase.fragments.ZooperFragment.java

@Override
public View onCreateView(LayoutInflater inflater, final ViewGroup container, Bundle savedInstanceState) {

    context = getActivity();//from w w w  . j a v  a2s .  com

    if (layout != null) {
        ViewGroup parent = (ViewGroup) layout.getParent();
        if (parent != null) {
            parent.removeView(layout);
        }
    }
    try {
        layout = (ViewGroup) inflater.inflate(R.layout.zooper_section, container, false);
    } catch (InflateException e) {
        //Do nothing
    }

    return layout;
}

From source file:jahirfiquitiva.iconshowcase.fragments.IconsFragment.java

@Override
@SuppressWarnings("unchecked")
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    if (layout != null) {
        ViewGroup parent = (ViewGroup) layout.getParent();
        if (parent != null) {
            parent.removeView(layout);
        }//from   ww w.  j a va 2  s.c o  m
    }

    layout = (ViewGroup) inflater.inflate(R.layout.icons_grid, container, false);

    RecyclerView iconsGrid = (RecyclerView) layout.findViewById(R.id.iconsGrid);

    iconsGrid.setHasFixedSize(true);
    iconsGrid.setLayoutManager(
            new GridLayoutManager(getActivity(), getResources().getInteger(R.integer.icons_grid_width)));
    iconsGrid.addItemDecoration(
            new GridSpacingItemDecoration(getResources().getInteger(R.integer.icons_grid_width),
                    getResources().getDimensionPixelSize(R.dimen.lists_padding), true));
    // ?

    iconsList = new ArrayList<>();

    mAdapter = new IconsAdapter(getActivity(), iconsList);

    if (getArguments() != null) {
        IconsCategory category = getArguments().getParcelable("icons");
        if (category != null) {
            iconsList = category.getIconsArray();
        }
        mAdapter.setIcons(iconsList);
    }

    iconsGrid.setAdapter(mAdapter);

    RecyclerFastScroller fastScroller = (RecyclerFastScroller) layout.findViewById(R.id.rvFastScroller);
    fastScroller.attachRecyclerView(iconsGrid);

    return layout;
}

From source file:com.android.gallery3d.filtershow.editors.EditorPanel.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    FilterShowActivity activity = (FilterShowActivity) getActivity();
    if (mMainView != null) {
        if (mMainView.getParent() != null) {
            ViewGroup parent = (ViewGroup) mMainView.getParent();
            parent.removeView(mMainView);
        }//from   w w w .  j  a v  a  2 s.c  o m
        showImageStatePanel(activity.isShowingImageStatePanel());
        return mMainView;
    }
    mMainView = (LinearLayout) inflater.inflate(R.layout.filtershow_editor_panel, null);

    View actionControl = mMainView.findViewById(R.id.panelAccessoryViewList);
    View editControl = mMainView.findViewById(R.id.controlArea);
    ImageButton cancelButton = (ImageButton) mMainView.findViewById(R.id.cancelFilter);
    ImageButton applyButton = (ImageButton) mMainView.findViewById(R.id.applyFilter);
    Button editTitle = (Button) mMainView.findViewById(R.id.applyEffect);
    cancelButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            cancelCurrentFilter();
            FilterShowActivity activity = (FilterShowActivity) getActivity();
            activity.backToMain();
        }
    });

    Button toggleState = (Button) mMainView.findViewById(R.id.toggle_state);
    mEditor = activity.getEditor(mEditorID);
    if (mEditor != null) {
        mEditor.setUpEditorUI(actionControl, editControl, editTitle, toggleState);
        mEditor.reflectCurrentFilter();
        if (mEditor.useUtilityPanel()) {
            mEditor.openUtilityPanel((LinearLayout) actionControl);
        }
    }
    applyButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            FilterShowActivity activity = (FilterShowActivity) getActivity();
            mEditor.finalApplyCalled();
            activity.backToMain();
        }
    });

    showImageStatePanel(activity.isShowingImageStatePanel());
    return mMainView;
}

From source file:com.taobao.luaview.view.adapter.LVPagerAdapter.java

/**
 * remove item from container//from  w  w  w  .j  ava  2s .c  o m
 *
 * @param container
 * @param position
 * @param object
 */
private void removeItem(ViewGroup container, int position, Object object) {
    if (container != null && object instanceof View) {
        container.removeView((View) object);
    }
}

From source file:com.github.barteksc.pdfviewpager.adapter.PDFPagerAdapter.java

@Override
public void destroyItem(ViewGroup container, int position, Object object) {
    container.removeView((View) object);
    WeakReference<Bitmap> bitmapRef = bitmaps.get(position);
    if (bitmapRef != null) {
        recycleBitmap(position);//from   ww  w.j  a va2  s .com
    }
    cancelRenderTask(position);
}