Example usage for android.view ViewGroup removeAllViewsInLayout

List of usage examples for android.view ViewGroup removeAllViewsInLayout

Introduction

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

Prototype

public void removeAllViewsInLayout() 

Source Link

Document

Called by a ViewGroup subclass to remove child views from itself, when it must first know its size on screen before it can calculate how many child views it will render.

Usage

From source file:at.alladin.rmbt.android.sync.RMBTSyncFragment.java

public void populateViewForOrientation(final LayoutInflater inflater, final ViewGroup container) {
    container.removeAllViewsInLayout();
    final View view = inflater.inflate(R.layout.sync, container);

    final Button buttonRequestCode = (Button) view.findViewById(R.id.requestCodeButton);

    buttonRequestCode.setOnClickListener(new OnClickListener() {
        @Override/* ww w.  j  ava2  s  .c  om*/
        public void onClick(final View v) {
            final FragmentManager fm = getFragmentManager();
            FragmentTransaction ft;

            ft = fm.beginTransaction();
            ft.replace(R.id.fragment_content, new RMBTSyncRequestCodeFragment(), "sync_request_code");
            ft.addToBackStack("sync_request_code");
            ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
            ft.commit();
        }
    });

    final Button buttonEnterCode = (Button) view.findViewById(R.id.enterCodeButton);

    buttonEnterCode.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(final View v) {
            final FragmentManager fm = getFragmentManager();
            FragmentTransaction ft;

            ft = fm.beginTransaction();
            ft.replace(R.id.fragment_content, new RMBTSyncEnterCodeFragment(), "sync_enter_code");
            ft.addToBackStack("sync_enter_code");
            ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
            ft.commit();
        }
    });
}

From source file:at.alladin.rmbt.android.fragments.result.RMBTResultPagerFragment.java

/**
 * //from  w w  w  . j  a  va  2s.  c  o  m
 * @param inflater
 * @param view
 */
private void populateViewForOrientation(LayoutInflater inflater, ViewGroup view) {
    int page = getViewPager().getCurrentItem();
    view.removeAllViewsInLayout();
    View v = inflater.inflate(R.layout.result_tabhost_pager, view);
    createView(v, inflater, page);
}

From source file:at.alladin.rmbt.android.about.RMBTAboutFragment.java

/**
 * //w ww . ja  va 2 s . c om
 * @param inflater
 * @param view
 */
private void populateViewForOrientation(LayoutInflater inflater, ViewGroup view) {
    view.removeAllViewsInLayout();
    View v = inflater.inflate(R.layout.about, view);
    createView(v, inflater);
}

From source file:com.customdatepicker.date.DatePickerDialog.java

@Override
public void onConfigurationChanged(final Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
    ViewGroup viewGroup = (ViewGroup) getView();
    if (viewGroup != null) {
        viewGroup.removeAllViewsInLayout();
        View view = onCreateView(getActivity().getLayoutInflater(), viewGroup, null);
        viewGroup.addView(view);/*from w  w  w  . ja v  a2  s  . c o m*/
    }
}

From source file:com.pdftron.pdf.controls.UserCropDialogFragment.java

@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);

    if (mCurrentJob != null && !mCurrentJob.isDone()) {
        mCurrentJob.cancelRasterizing();
    }/*from   www.j  a v a 2 s  .  co m*/

    mCurrentJob = null;

    //        if (mCropImageView.hasBitmap()) {
    //            updatePageCropFromImageView(mPageProperties[mCurrentPage], mCropImageView.getCropRectPercentageMargins());
    //            Bitmap bitmap = mCropImageView.getImageBitmapAndClear();
    //        }

    mImageCache.evictAll();

    if (mSpinnerAlphaAnimation != null && !mSpinnerAlphaAnimation.hasEnded()) {
        mSpinnerAlphaAnimation.cancel();
    }
    if (mDisablingOverlayShowing) {
        mDisablingOverlay.setVisibility(View.VISIBLE);
    }
    if (mSpinnerShowing) {
        mProgressBarHost.setVisibility(View.VISIBLE);
    }

    ViewGroup viewGroup = (ViewGroup) getView();
    viewGroup.removeAllViewsInLayout();
    View view = onCreateView(getActivity().getLayoutInflater(), viewGroup, null);
    viewGroup.addView(view);

}

From source file:at.alladin.rmbt.android.main.RMBTMainMenuFragment.java

/**
 * /*from w  w w .  j av a 2  s.c o  m*/
 * @param inflater
 * @param view
 */
private void populateViewForOrientation(LayoutInflater inflater, ViewGroup view) {
    int antennaResId = Integer.MIN_VALUE;
    if (antennaView != null && antennaView.getTag() != null) {
        antennaResId = (Integer) antennaView.getTag();
    }

    view.removeAllViewsInLayout();
    View v = inflater.inflate(R.layout.title_screen, view);

    createView(v, inflater, null);

    if (antennaResId != Integer.MIN_VALUE) {
        antennaView.setImageResource(antennaResId);
        antennaView.setVisibility(View.VISIBLE);
    }

    //restore all information now:
    infoCollector.refresh();
    infoCollector.dispatchInfoChangedEvent(InfoCollectorType.DL_TRAFFIC, null,
            TrafficClassificationEnum.classify(interfaceTrafficGatherer.getRxRate()));
    infoCollector.dispatchInfoChangedEvent(InfoCollectorType.UL_TRAFFIC, null,
            TrafficClassificationEnum.classify(interfaceTrafficGatherer.getTxRate()));

    if (startButtonText != null) {
        startButtonText.setText(ConfigHelper.isLoopMode(getActivity()) ? R.string.menu_button_loop
                : R.string.menu_button_start);
    }
}

From source file:at.alladin.rmbt.android.test.RMBTTestFragment.java

/**
 * // ww  w.  j a  va2 s  .co m
 * @param inflater
 * @param view
 */
private void populateViewForOrientation(final LayoutInflater inflater, final ViewGroup view) {

    System.out.println("RECREATING INSTANCE FOR ORIENTATION CHANGE");

    GroupCountView groupCountView = null;
    if (groupCountContainerView != null && groupCountContainerView.getChildAt(0) != null) {
        groupCountView = (GroupCountView) groupCountContainerView.getChildAt(0);
        groupCountContainerView.removeAllViews();
    }

    final String infoText = String.valueOf(textView.getText());
    final String header = testView.getHeaderString();

    final String subHeader = testView.getSubHeaderString();
    final String resultPing = testView.getResultPingString();
    final String resultDown = testView.getResultDownString();
    final String resultUp = testView.getResultUpString();

    final GraphData signalGraphData;
    final GraphData speedGraphData;

    final MinMax<Integer> currentSignalBounds;
    final List<GraphView.GraphLabel> graphLabelList;

    if (graphView != null) {
        graphLabelList = graphView.getLabelInfoVerticalList();
        currentSignalBounds = graphView.getSignalRange();
    } else {
        graphLabelList = null;
        currentSignalBounds = null;
    }

    if (signalGraph != null) {
        signalGraphData = signalGraph.getGraphData();
    } else {
        signalGraphData = null;
    }

    if (speedGraph != null) {
        speedGraphData = speedGraph.getGraphData();
    } else {
        speedGraphData = null;
    }

    view.removeAllViewsInLayout();
    final View v = inflater.inflate(R.layout.test, view);

    final Bundle options = new Bundle();
    options.putBoolean(OPTION_ON_CREATE_VIEW_CREATE_SIGNAL_GRAPH, false);
    options.putBoolean(OPTION_ON_CREATE_VIEW_CREATE_SPEED_GRAPH, false);

    createView(v, inflater, options);

    if (groupCountContainerView != null && groupCountView != null && qosProgressView != null) {
        groupCountContainerView.addView(groupCountView);
        qosProgressView.setVisibility(View.VISIBLE);
        //groupCountContainerView.setVisibility(View.VISIBLE);

        if (graphView != null) {
            graphView.setVisibility(View.GONE);
        }
        if (infoView != null) {
            infoView.setVisibility(View.GONE);
        }
    }

    if (testView != null) {
        testView.setHeaderString(header);
        testView.setSubHeaderString(subHeader);
        testView.setResultPingString(resultPing);
        testView.setResultDownString(resultDown);
        testView.setResultUpString(resultUp);
    }

    if (textView != null) {
        textView.setText(infoText);
    }

    if (graphView != null) {
        graphView.setRowLinesLabelList(ResultGraphView.SPEED_LABELS);

        if (signalGraphData != null) {
            signalGraph = SimpleGraph.addGraph(graphView, GRAPH_MAX_NSECS, signalGraphData);

            if (currentSignalBounds != null) {
                graphView.setLabelInfoVerticalList(graphLabelList);
                graphView.setSignalRange(currentSignalBounds.min, currentSignalBounds.max);
            }
        }
        if (speedGraphData != null) {
            speedGraph = SmoothGraph.addGraph(graphView, SMOOTHING_DATA_AMOUNT, SMOOTHING_FUNCTION, false,
                    speedGraphData);
            speedGraph.setMaxTime(GRAPH_MAX_NSECS);
        }
    }

}