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.alibaba.android.layoutmanager.RecyclablePagerAdapter.java

@Override
public void destroyItem(ViewGroup container, int position, Object object) {
    if (object instanceof RecyclerView.ViewHolder) {
        RecyclerView.ViewHolder holder = (RecyclerView.ViewHolder) object;
        container.removeView(holder.itemView);
        mRecycledViewPool.putRecycledView(holder);
    }/*from  w  ww  . j  a  v a  2 s  . co  m*/
}

From source file:com.manaschaudhari.android_mvvm.adapters.ViewPagerAdapter.java

@Override
public void destroyItem(ViewGroup container, int position, Object object) {
    ViewDataBinding binding = (ViewDataBinding) object;
    binder.bind(binding, null);//from  w  w w .j av  a 2s .c om
    binding.executePendingBindings();
    container.removeView(binding.getRoot());
}

From source file:com.barcamppenang2013.tabfragment.HomeFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if (scrollView != null) {
        ViewGroup parent = (ViewGroup) scrollView.getParent();
        if (parent != null)
            parent.removeView(scrollView);
    }/*from  w  ww.  j  av a 2 s  . c  om*/
    scrollView = (ScrollView) inflater.inflate(R.layout.home_layout, container, false);
    LinearLayout linearLayout = (LinearLayout) scrollView.findViewById(R.id.home_linear_layout);
    // linearLayout.setBackgroundColor(Color.WHITE);
    mTextViewDay = (TextView) linearLayout.findViewById(R.id.count_down_day);
    mTextViewHour = (TextView) linearLayout.findViewById(R.id.count_down_hour);
    mImageViewClickMe = (Button) linearLayout.findViewById(R.id.map_fullscreen_button);
    mImageViewClickMe.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (getActivity() == null)
                return;
            MainActivity fca = (MainActivity) getActivity();
            fca.getSupportActionBar().setDisplayHomeAsUpEnabled(true);
            fca.switchContent(new MapFragment());
        }
    });
    // mTextView.setBackgroundResource(R.drawable.info_countdown);
    Date date = new Date(113, 6, 27); // 2013/July/27
    // year the year, 0 is 1900.
    // month the month, 0 - 11.
    // day the day of the month, 1 - 31.
    long dtMili = System.currentTimeMillis();
    Date dateNow = new Date(dtMili);
    long remain = date.getTime() - dateNow.getTime();

    new CountDownTimer(remain, 1000) {

        public void onTick(long millisUntilFinished) {
            // mTextView.setText("seconds remaining: " + millisUntilFinished
            // / 1000);
            mTextViewDay.setText(timeDay(millisUntilFinished / 1000));
            mTextViewHour.setText(timeHour(millisUntilFinished / 1000));
        }

        public void onFinish() {
            // mTextView.setText("done!");
        }
    }.start();

    return scrollView;
}

From source file:it.andreale.mdatetimepicker.date.MonthAdapter.java

@Override
public void destroyItem(ViewGroup collection, int position, Object view) {
    MonthView monthView = (MonthView) view;
    monthView.unregisterController();/*from  w  ww  . j a v a 2 s  .  c o m*/
    collection.removeView(monthView);
}

From source file:com.cranberrygame.cordova.plugin.ad.admob.AdmobSplit.java

protected void removeBannerViewOverlap() {
    if (bannerView == null)
        return;//from  ww w  .j a  va  2s . c om

    ViewGroup parentView = (ViewGroup) bannerView.getParent();
    if (parentView != null) {
        parentView.removeView(bannerView);
        bannerView.destroy();
        bannerView = null;
    }
}

From source file:org.telegram.ui.Views.BaseFragment.java

public void finishFragment(boolean bySwipe) {
    if (isFinish || animationInProgress) {
        return;//from  www .  jav  a  2  s .co m
    }
    isFinish = true;
    if (parentActivity == null) {
        ApplicationLoader.fragmentsStack.remove(this);
        onFragmentDestroy();
        return;
    }
    ((ApplicationActivity) parentActivity).finishFragment(bySwipe);
    if (getActivity() == null) {
        if (fragmentView != null) {
            ViewGroup parent = (ViewGroup) fragmentView.getParent();
            if (parent != null) {
                parent.removeView(fragmentView);
            }
            fragmentView = null;
        }
        parentActivity = null;
    } else {
        removeParentOnDestroy = true;
    }
}

From source file:org.telegram.ui.Views.BaseFragment.java

public void removeSelfFromStack() {
    if (isFinish) {
        return;//  w w  w.  j a  v  a  2  s.c  o  m
    }
    isFinish = true;
    if (parentActivity == null) {
        ApplicationLoader.fragmentsStack.remove(this);
        onFragmentDestroy();
        return;
    }
    ((ApplicationActivity) parentActivity).removeFromStack(this);
    if (getActivity() == null) {
        if (fragmentView != null) {
            ViewGroup parent = (ViewGroup) fragmentView.getParent();
            if (parent != null) {
                parent.removeView(fragmentView);
            }
            fragmentView = null;
        }
        parentActivity = null;
    } else {
        removeParentOnDestroy = true;
    }
}

From source file:com.ran.pics.activity.fragment.ImageClassifiGridFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if (rootView != null) {
        ViewGroup parent = (ViewGroup) rootView.getParent();
        if (parent != null) {
            parent.removeView(rootView);
        }//from  w  w w.j  a va  2 s . co m
    } else {
        initView(inflater);
        initEvent();
        initData();
    }

    loadClassify();
    return rootView;
}

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

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

    context = getActivity();/* w  w w . j av a  2s . c o  m*/

    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
    }

    setupFAB();

    return layout;
}

From source file:com.serenegiant.aceparrot.ConfigPagerAdapter.java

@Override
public synchronized void destroyItem(final ViewGroup container, final int position, final Object object) {
    if (DEBUG)/*from www.  jav  a2s .co  m*/
        Log.v(TAG, "destroyItem:position=" + position);
    if (object instanceof View) {
        container.removeView((View) object);
    }
}