Example usage for android.widget LinearLayout getChildCount

List of usage examples for android.widget LinearLayout getChildCount

Introduction

In this page you can find the example usage for android.widget LinearLayout getChildCount.

Prototype

public int getChildCount() 

Source Link

Document

Returns the number of children in the group.

Usage

From source file:Main.java

public static void animateIn(View view) {
    if (view instanceof RelativeLayout) {
        RelativeLayout relativeLayout = (RelativeLayout) view;
        for (int i = 0; i < relativeLayout.getChildCount(); i++) {
            View child = relativeLayout.getChildAt(i);
            child.animate().setStartDelay(100 + i * DELAY).alpha(1).scaleX(1).scaleY(1);
        }/* w  w w .j  ava 2  s.  co  m*/
    } else {
        LinearLayout linearLayout = (LinearLayout) view;
        for (int i = 0; i < linearLayout.getChildCount(); i++) {
            View child = linearLayout.getChildAt(i);
            child.animate().setStartDelay(100 + i * DELAY).alpha(1).scaleX(1).scaleY(1);
        }
    }
}

From source file:Main.java

public static void animateOut(View view) {
    if (view instanceof RelativeLayout) {
        RelativeLayout relativeLayout = (RelativeLayout) view;
        for (int i = 0; i < relativeLayout.getChildCount(); i++) {
            View child = relativeLayout.getChildAt(i);
            child.animate().setStartDelay(i).alpha(0).scaleX(0f).scaleY(0f);
        }/*www. j  a  v a  2  s  .  com*/
    } else {
        LinearLayout linearLayout = (LinearLayout) view;
        for (int i = 0; i < linearLayout.getChildCount(); i++) {
            View child = linearLayout.getChildAt(i);
            child.animate().setStartDelay(i).alpha(0).scaleX(0f).scaleY(0f);
        }
    }

}

From source file:jsettlers.main.android.gameplay.ui.fragments.menus.selection.SoldiersSelectionFragment.java

private void goneIfEmpty(LinearLayout linearLayout) {
    if (linearLayout.getChildCount() == 0) {
        linearLayout.setVisibility(View.GONE);
    }/*  w w w. jav a2s  .c  o  m*/
}

From source file:org.ale.scanner.zotero.BibDetailJSONAdapter.java

public void fillLinearLayout(LinearLayout layout) {
    int childCount = layout.getChildCount();
    // Layout might not be the view we used last time, so
    // remove any views we won't need
    if (mNumFilledFields < childCount) {
        layout.removeViews(mNumFilledFields, layout.getChildCount() - mNumFilledFields);
    }//w w  w . ja v a2 s.co m

    // Edit any of the already attached views
    for (int entry = 0; entry < mNumFilledFields; entry++) {
        if (entry < childCount) {
            View v = layout.getChildAt(entry);
            getView(entry, v, layout);
        } else {
            layout.addView(getView(entry, null, layout));
        }
    }
}

From source file:com.example.toolbardemo.Fragment.MenuFragment.java

private void initItems(View v) {
    LinearLayout contentLayout = (LinearLayout) v.findViewById(R.id.drawer_view);
    int count = contentLayout.getChildCount();
    for (int i = 0; i < count; i++) {
        contentLayout.getChildAt(i).setOnClickListener(this);
    }/* w  w w .jav a  2  s . c om*/

}

From source file:com.github.tetravex_android.activity.HowToActivity.java

/**
 * Sets the page indicator dots at the bottom of the screen to indicate which page is displayed
 *
 * @param pageIndex the index of the page currently displayed
 *///  w w  w.  j a v a2  s  .  co m
private void setIndicatorDots(int pageIndex) {
    // set the indicator dot for the correct page
    LinearLayout dotGroup = (LinearLayout) findViewById(R.id.how_to_pager_dots);
    for (int i = 0; i < dotGroup.getChildCount(); i++) {
        ImageView view = (ImageView) dotGroup.getChildAt(i);
        String tagString = (String) view.getTag();
        int tagId = Integer.valueOf(tagString);

        if (tagId == pageIndex) {
            view.setImageResource(R.drawable.pager_dot_on);
        } else {
            view.setImageResource(R.drawable.pager_dot_off);
        }
    }
}

From source file:me.ziccard.secureit.fragment.MicrophoneFragment.java

@Override
public void onResume() {
    super.onResume();

    Log.i("MicrophoneFragment", "Resumed");

    microphoneText = (TextView) getActivity().findViewById(R.id.microphone);

    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
            LinearLayout.LayoutParams.WRAP_CONTENT);

    LinearLayout layout = (LinearLayout) getActivity().findViewById(R.id.linear_layout);
    if (layout.getChildCount() == 1) {
        picker = new MicrophoneVolumePicker(this.getActivity());
        picker.setNoiseThreshold(NOISE_THRESHOLD);
        layout.addView(picker, params);/*  w w w .  j a v a  2 s .co  m*/
    }

    //       if (microphone == null || microphone.isCancelled()) {
    //
    //       }
}

From source file:com.cmput301.recipebot.test.EditRecipeActivityTest.java

/**
 * Deletes all children from a linear layout
 *
 * @param layout//from  w  w  w . ja  v a 2s.c om
 */
private void clearList(LinearLayout layout) {
    int child_count = layout.getChildCount();
    for (int i = 0; i < child_count; i++) {
        final CheckBox child = (CheckBox) layout.getChildAt(0);
        instrumentation.runOnMainSync(new Runnable() {
            @Override
            public void run() {
                child.setChecked(true);
            }
        });
        instrumentation.waitForIdleSync();
        final View delete = activity.findViewById(R.id.menu_delete_item_from_list);
        instrumentation.runOnMainSync(new Runnable() {
            @Override
            public void run() {
                delete.performClick();
            }
        });
        instrumentation.waitForIdleSync();
    }
    assertThat(layout).hasChildCount(0);
    Spoon.screenshot(activity, "cleared");
}

From source file:com.github.tetravex_android.activity.HiScoreActivity.java

/**
 * Sets the page indicator dots at the bottom of the screen to indicate which page is displayed
 *
 * @param pageIndex the index of the page currently displayed
 *///from   w w  w .ja v  a  2 s  .  c om
private void setIndicatorDots(int pageIndex) {
    // set the indicator dot for the correct page
    LinearLayout dotGroup = (LinearLayout) findViewById(R.id.hi_score_dot_ll);
    for (int i = 0; i < dotGroup.getChildCount(); i++) {
        ImageView view = (ImageView) dotGroup.getChildAt(i);
        String tagString = (String) view.getTag();
        int tagId = Integer.valueOf(tagString);

        if (tagId == pageIndex) {
            view.setImageResource(R.drawable.pager_dot_on);
        } else {
            view.setImageResource(R.drawable.pager_dot_off);
        }
    }
}

From source file:org.kevoree.platform.android.boot.view.ManagerUI.java

@Override
public void removeView(View view) {

    if (view == null) {
        return;//  w ww .  j  a v  a  2 s.  c  om
    }

    Log.i("Request remove view", "");
    LinkedList<ActionBar.Tab> newtabs = new LinkedList<ActionBar.Tab>();
    for (ActionBar.Tab tab : tabs) {
        LinearLayout tabLayout = (LinearLayout) tab.getTag();
        int childcount = tabLayout.getChildCount();
        for (int i = 0; i < childcount; i++) {
            View v = tabLayout.getChildAt(i);
            if (v != null) {
                if (v.equals(view)) {
                    tabLayout.removeView(view);
                }
            }
        }
        Log.i("Remove view " + tab.getText(), " " + ((LinearLayout) tab.getTag()).getChildCount());
        if (((LinearLayout) tab.getTag()).getChildCount() == 0) {
            if (tab.getPosition() == selectedTab) {
                selectedTab = ktab;
            }
            ctx.getSupportActionBar().removeTab(tab);
        } else {
            newtabs.add(tab);
        }
    }
    tabs.clear();
    tabs.addAll(newtabs);
    notifyObservers(this);
}