Example #1
0
        private void setBackground(android.widget.LinearLayout topPanel, android.widget.LinearLayout
                                   contentPanel, android.view.View customPanel, bool hasButtons, android.content.res.TypedArray
                                   a, bool hasTitle, android.view.View buttonPanel)
        {
            int fullDark = a.getResourceId([email protected]_fullDark
                                           , [email protected]_full_dark);
            int topDark = a.getResourceId([email protected]_topDark,
                                          [email protected]_top_dark);
            int centerDark = a.getResourceId([email protected]_centerDark
                                             , [email protected]_center_dark);
            int bottomDark = a.getResourceId([email protected]_bottomDark
                                             , [email protected]_bottom_dark);
            int fullBright = a.getResourceId([email protected]_fullBright
                                             , [email protected]_full_bright);
            int topBright = a.getResourceId([email protected]_topBright
                                            , [email protected]_top_bright);
            int centerBright = a.getResourceId([email protected]_centerBright
                                               , [email protected]_center_bright);
            int bottomBright = a.getResourceId([email protected]_bottomBright
                                               , [email protected]_bottom_bright);
            int bottomMedium = a.getResourceId([email protected]_bottomMedium
                                               , [email protected]_bottom_medium);

            android.view.View[] views  = new android.view.View[4];
            bool[]            light    = new bool[4];
            android.view.View lastView = null;
            bool lastLight             = false;
            int  pos = 0;

            if (hasTitle)
            {
                views[pos] = topPanel;
                light[pos] = false;
                pos++;
            }
            views[pos] = (contentPanel.getVisibility() == android.view.View.GONE) ? null : contentPanel;
            light[pos] = mListView != null;
            pos++;
            if (customPanel != null)
            {
                views[pos] = customPanel;
                light[pos] = mForceInverseBackground;
                pos++;
            }
            if (hasButtons)
            {
                views[pos] = buttonPanel;
                light[pos] = true;
            }
            bool setView_1 = false;

            for (pos = 0; pos < views.Length; pos++)
            {
                android.view.View v = views[pos];
                if (v == null)
                {
                    continue;
                }
                if (lastView != null)
                {
                    if (!setView_1)
                    {
                        lastView.setBackgroundResource(lastLight ? topBright : topDark);
                    }
                    else
                    {
                        lastView.setBackgroundResource(lastLight ? centerBright : centerDark);
                    }
                    setView_1 = true;
                }
                lastView  = v;
                lastLight = light[pos];
            }
            if (lastView != null)
            {
                if (setView_1)
                {
                    lastView.setBackgroundResource(lastLight ? (hasButtons ? bottomMedium : bottomBright
                                                                ) : bottomDark);
                }
                else
                {
                    lastView.setBackgroundResource(lastLight ? fullBright : fullDark);
                }
            }
            //        if (hasButtons && (mListView != null)) {
            //        }
            if ((mListView != null) && (mAdapter != null))
            {
                mListView.setAdapter(mAdapter);
                if (mCheckedItem > -1)
                {
                    mListView.setItemChecked(mCheckedItem, true);
                    mListView.setSelection(mCheckedItem);
                }
            }
        }