Example usage for android.widget LinearLayout getChildAt

List of usage examples for android.widget LinearLayout getChildAt

Introduction

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

Prototype

public View getChildAt(int index) 

Source Link

Document

Returns the view at the specified position in the group.

Usage

From source file:org.catrobat.paintroid.test.integration.BaseIntegrationTestClass.java

protected int getNumberOfNotVisibleTools() {
    LinearLayout toolsLayout = (LinearLayout) mSolo.getView(R.id.tools_layout);
    int toolCount = toolsLayout.getChildCount();
    int numberOfNotVisibleTools = 0;
    for (int i = 0; i < toolCount; i++) {
        View toolButton = toolsLayout.getChildAt(i);
        if (!toolButton.isShown())
            numberOfNotVisibleTools++;//from   ww w  .j  av a2s .  c  om
    }
    return numberOfNotVisibleTools;
}

From source file:com.qddagu.app.meetreader.ui.MainActivity.java

private void initView() {

    final LinearLayout ll = (LinearLayout) findViewById(R.id.bottom_bar);

    mPagerAdapter = new MainPagerAdapter(this, mFragmentManager);
    mViewPager = (ViewPager) findViewById(R.id.pager);
    mViewPager.setAdapter(mPagerAdapter);
    mViewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
        @Override/*from   w  ww .j a va 2  s . c  o m*/
        public void onPageSelected(int arg0) {
            for (int i = 0; i < ll.getChildCount(); i++) {
                ll.getChildAt(i).setSelected(false);
            }
            int i = arg0 < 2 ? arg0 : arg0 + 1;
            ll.getChildAt(i).setSelected(true);
        }

        @Override
        public void onPageScrolled(int arg0, float arg1, int arg2) {
        }

        @Override
        public void onPageScrollStateChanged(int arg0) {
        }
    });

    View.OnClickListener cl = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (v.getId() == R.id.btn_scan) {
                Intent intent = new Intent(MainActivity.this, CaptureActivity.class);
                startActivityForResult(intent, 0);
                return;
            }

            for (int i = 0; i < ll.getChildCount(); i++) {
                ll.getChildAt(i).setSelected(false);
            }
            v.setSelected(true);

            switch (v.getId()) {
            case R.id.btn_home:
                mViewPager.setCurrentItem(0, false);
                break;
            case R.id.btn_cloud:
                mViewPager.setCurrentItem(1, false);
                break;
            case R.id.btn_scan:
                Intent intent = new Intent(MainActivity.this, CaptureActivity.class);
                startActivityForResult(intent, 0);
                break;
            case R.id.btn_notice:
                mViewPager.setCurrentItem(2, false);
                break;
            case R.id.btn_more:
                mViewPager.setCurrentItem(3, false);
                break;
            }
        }
    };
    findViewById(R.id.btn_home).setSelected(true);
    findViewById(R.id.btn_home).setOnClickListener(cl);
    findViewById(R.id.btn_more).setOnClickListener(cl);
    findViewById(R.id.btn_scan).setOnClickListener(cl);
    findViewById(R.id.btn_cloud).setOnClickListener(cl);
    findViewById(R.id.btn_notice).setOnClickListener(cl);
}

From source file:com.research.widget.PagerSlidingTabStrip.java

public void hideMsgTip(int positon) {
    LinearLayout layout = (LinearLayout) tabsContainer.getChildAt(positon);
    TextView msgTv = (TextView) layout.getChildAt(1);
    msgTv.setText("");
    msgTv.setVisibility(View.GONE);
}

From source file:com.cssweb.android.quote.QHSCGridActivity.java

protected void initTitle(int pageNum, String[] cols, boolean nameOrCodeFlag) {
    TextView localView6 = (TextView) this.mLinerLock.getChildAt(0);
    TextView localView7 = (TextView) this.mLinerLock2.getChildAt(0);

    if (n2 == 0) {
        String str = (n1 == 0) ? cols[0] + low : (n1 == 1) ? cols[0] + top : cols[0];
        localView6.setText(str);/*from   w w  w. j  a va  2 s . c om*/
    } else {
        localView6.setText(cols[0]);
    }

    localView7.setText(cols[1]);

    LinearLayout localLinearLayout = (LinearLayout) this.mLinerHScroll.findViewWithTag(0);
    int i6 = localLinearLayout.getChildCount();
    for (int j = 0; j < i6; j++) {
        TextView localView8 = (TextView) localLinearLayout.getChildAt(j);
        if (n2 == -(j + 2)) {
            String str = (n1 == 0) ? cols[j + 2] + low : (n1 == 1) ? cols[j + 2] + top : cols[j + 2];
            localView8.setText(str);
        } else {
            localView8.setText(cols[j + 2]);
        }
    }
}

From source file:com.cssweb.android.quote.QHSCGridActivity.java

private void clearData(int scrollNum) {
    for (int i = 1; i <= scrollNum; i++) {
        TextView localView6 = (TextView) this.mLinerLock.findViewWithTag(i);
        TextView localView7 = (TextView) this.mLinerLock2.findViewWithTag(i);
        localView6.setText("");
        localView7.setText("");

        LinearLayout localLinearLayout = (LinearLayout) this.mLinerHScroll.findViewWithTag(i);
        int i6 = localLinearLayout.getChildCount();
        for (int j = 0; j < i6; j++) {
            TextView localView5 = (TextView) localLinearLayout.getChildAt(j);
            localView5.setText("");
        }/*w  w w  .j a v  a2 s.co m*/
    }
}

From source file:com.research.widget.PagerSlidingTabStrip.java

/**
 * ???/*  w w  w. j a v  a  2  s .c  om*/
 * @param tipCount ??
 * @param positon tab? 0
 */
public void setNewMsgTip(int tipCount, int positon) {
    if (tipCount == 0) {
        hideMsgTip(0);
        return;
    }

    LinearLayout layout = (LinearLayout) tabsContainer.getChildAt(positon);
    TextView msgTv = (TextView) layout.getChildAt(1);
    msgTv.setVisibility(View.VISIBLE);
    if (positon == 0) {
        String showCount = "";
        if (tipCount > 99) {
            showCount = "99";
        } else {
            showCount = tipCount + "";
        }
        msgTv.setText(showCount);
    }

}

From source file:no.digipost.android.gui.content.ThreadPerTaskExecutor.java

private void setupSearchView() {
    MenuItemCompat.setOnActionExpandListener(searchMenuItem, new MenuItemCompat.OnActionExpandListener() {
        @Override//from  w w w. j  a v  a  2s .c o m
        public boolean onMenuItemActionExpand(MenuItem menuItem) {
            searchModeOn();
            return true;
        }

        @Override
        public boolean onMenuItemActionCollapse(MenuItem menuItem) {
            searchModeOff();
            return true;
        }
    });

    searchView = (android.support.v7.widget.SearchView) searchMenuItem.getActionView();
    searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {

        @Override
        public boolean onQueryTextSubmit(String s) {
            if (!searchView.isIconified()) {
                searchView.setIconified(true);
            }
            searchMenuItem.collapseActionView();

            search(1, s);
            return true;
        }

        @Override
        public boolean onQueryTextChange(String s) {
            if (SearchTaskResult.get() != null && !s.equals(SearchTaskResult.get().txt)) {
                SearchTaskResult.set(null);
                mDocView.resetupChildren();
            }
            return true;
        }
    });

    try {

        Field searchField = SearchView.class.getDeclaredField("mSearchButton");
        searchField.setAccessible(true);
        android.widget.ImageView searchBtn = (android.widget.ImageView) searchField.get(searchView);
        searchBtn.setImageResource(R.drawable.white_search_48);
        searchField = SearchView.class.getDeclaredField("mSearchPlate");
        searchField.setAccessible(true);
        LinearLayout searchPlate = (LinearLayout) searchField.get(searchView);
        AutoCompleteTextView searchTextView = (AutoCompleteTextView) searchPlate.getChildAt(0);
        searchTextView.setTextColor(getResources().getColor(R.color.white));
        searchPlate.setBackgroundResource(R.drawable.search_background);
        searchTextView.setHintTextColor(getResources().getColor(R.color.searchbar_grey_hint));
        searchView.setQueryHint(getString(R.string.pdf_search_document));
        android.widget.ImageView searchViewClearButton = (android.widget.ImageView) searchPlate.getChildAt(1);
        searchViewClearButton.setImageResource(R.drawable.ic_clear_white);
    } catch (Exception e) {
        //Empty
    }
}

From source file:org.zywx.wbpalmstar.plugin.inputtextfieldview.ACEInputTextFieldView.java

private void updateCurrentPage(int index, LinearLayout layout) {
    for (int i = 0; i < layout.getChildCount(); i++) {
        View view = layout.getChildAt(i);
        if (i == index) {
            view.setBackgroundResource(CRes.plugin_inputtextfieldview_pages_pointer_focus);
        } else {/*from   w  w  w.  j  a  v  a2s  . c  o m*/
            view.setBackgroundResource(CRes.plugin_inputtextfieldview_pages_pointer_normal);
        }
    }
}

From source file:fr.cph.chicago.core.activity.StationActivity.java

public void hideAllArrivalViews() {
    Stream.of(station.getLines())
            .flatMap(trainLine -> Stream.of(TrainDirection.values())
                    .map(trainDirection -> trainLine.toString() + "_" + trainDirection.toString()))
            .forEach(key -> {/*from  w ww .j a v a2s.  co  m*/
                if (ids.containsKey(key)) {
                    final int id = ids.get(key);
                    final LinearLayout line3View = (LinearLayout) findViewById(id);
                    if (line3View != null) {
                        line3View.setVisibility(View.GONE);
                        if (line3View.getChildCount() > 0) {
                            Stream.range(0, line3View.getChildCount()).forEach(i -> {
                                final LinearLayout view = (LinearLayout) line3View.getChildAt(i);
                                final TextView timing = (TextView) view.getChildAt(1);
                                if (timing != null) {
                                    timing.setText("");
                                }
                            });
                        }
                    }
                }
            });
}

From source file:net.fengg.lib.tabsliding.TabSlidingView.java

private void updateTabStyles() {

    for (int i = 0; i < tabCount; i++) {

        View v = tabsContainer.getChildAt(i);

        v.setBackgroundResource(tabBackgroundResId);

        if (v instanceof TextView) {

            TextView tab = (TextView) v;
            tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize);
            tab.setTypeface(tabTypeface, tabTypefaceStyle);
            tab.setTextColor(tabTextColor);

            // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a
            // pre-ICS-build
            if (textAllCaps) {
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
                    tab.setAllCaps(true);
                } else {
                    tab.setText(tab.getText().toString().toUpperCase(locale));
                }//w w w. j  a v a2 s.c  o  m
            }
            if (i == selectedPosition) {
                tab.setTextColor(selectedTabTextColor);
            }
        } else if (v instanceof ImageButton) {
            ImageButton tab = (ImageButton) v;

            if (i == selectedPosition) {
                //?
                tab.setSelected(true);
            }
        } else {
            LinearLayout l = (LinearLayout) v;

            ImageButton icon = (ImageButton) l.getChildAt(0);
            icon.setBackgroundResource(tabBackgroundResId);
            icon.setSelected(false);
            if (i == selectedPosition) {
                icon.setSelected(true);
            }

            TextView text = (TextView) l.getChildAt(1);
            text.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize);
            text.setTypeface(tabTypeface, tabTypefaceStyle);
            text.setTextColor(tabTextColor);

            // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a
            // pre-ICS-build
            if (textAllCaps) {
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
                    text.setAllCaps(true);
                } else {
                    text.setText(text.getText().toString().toUpperCase(locale));
                }
            }
            if (i == selectedPosition) {
                text.setTextColor(selectedTabTextColor);
            }

        }
    }

}