Пример #1
0
 /// <summary>Shows only the specified child.</summary>
 /// <remarks>
 /// Shows only the specified child. The other displays Views exit the screen,
 /// optionally with the with the
 /// <see cref="getOutAnimation()">out animation</see>
 /// and
 /// the specified child enters the screen, optionally with the
 /// <see cref="getInAnimation()">in animation</see>
 /// .
 /// </remarks>
 /// <param name="childIndex">The index of the child to be shown.</param>
 /// <param name="animate">
 /// Whether or not to use the in and out animations, defaults
 /// to true.
 /// </param>
 internal virtual void showOnly(int childIndex, bool animate_1)
 {
     int count = getChildCount();
     {
         for (int i = 0; i < count; i++)
         {
             android.view.View child = getChildAt(i);
             if (i == childIndex)
             {
                 if (animate_1 && mInAnimation != null)
                 {
                     child.startAnimation(mInAnimation);
                 }
                 child.setVisibility(android.view.View.VISIBLE);
                 mFirstTime = false;
             }
             else
             {
                 if (animate_1 && mOutAnimation != null && child.getVisibility() == android.view.View
                     .VISIBLE)
                 {
                     child.startAnimation(mOutAnimation);
                 }
                 else
                 {
                     if (child.getAnimation() == mInAnimation)
                     {
                         child.clearAnimation();
                     }
                 }
                 child.setVisibility(android.view.View.GONE);
             }
         }
     }
 }
Пример #2
0
 public override void addView(android.view.View child, int index, android.view.ViewGroup
                              .LayoutParams @params)
 {
     base.addView(child, index, @params);
     if (getChildCount() == 1)
     {
         child.setVisibility(android.view.View.VISIBLE);
     }
     else
     {
         child.setVisibility(android.view.View.GONE);
     }
 }
Пример #3
0
 /// <summary>Control whether the list is being displayed.</summary>
 /// <remarks>
 /// Control whether the list is being displayed.  You can make it not
 /// displayed if you are waiting for the initial data to show in it.  During
 /// this time an indeterminant progress indicator will be shown instead.
 /// </remarks>
 /// <param name="shown">
 /// If true, the list view is shown; if false, the progress
 /// indicator.  The initial value is true.
 /// </param>
 /// <param name="animate">
 /// If true, an animation will be used to transition to the
 /// new state.
 /// </param>
 private void setListShown(bool shown, bool animate)
 {
     ensureList();
     if (mProgressContainer == null)
     {
         throw new System.InvalidOperationException("Can't be used with a custom content view"
                                                    );
     }
     if (mListShown == shown)
     {
         return;
     }
     mListShown = shown;
     if (shown)
     {
         if (animate)
         {
             mProgressContainer.startAnimation(android.view.animation.AnimationUtils.loadAnimation
                                                   (getActivity(), android.R.anim.fade_out));
             mListContainer.startAnimation(android.view.animation.AnimationUtils.loadAnimation
                                               (getActivity(), android.R.anim.fade_in));
         }
         else
         {
             mProgressContainer.clearAnimation();
             mListContainer.clearAnimation();
         }
         mProgressContainer.setVisibility(android.view.View.GONE);
         mListContainer.setVisibility(android.view.View.VISIBLE);
     }
     else
     {
         if (animate)
         {
             mProgressContainer.startAnimation(android.view.animation.AnimationUtils.loadAnimation
                                                   (getActivity(), android.R.anim.fade_in));
             mListContainer.startAnimation(android.view.animation.AnimationUtils.loadAnimation
                                               (getActivity(), android.R.anim.fade_out));
         }
         else
         {
             mProgressContainer.clearAnimation();
             mListContainer.clearAnimation();
         }
         mProgressContainer.setVisibility(android.view.View.VISIBLE);
         mListContainer.setVisibility(android.view.View.GONE);
     }
 }
Пример #4
0
        private bool setupTitle(android.widget.LinearLayout topPanel)
        {
            bool hasTitle = true;

            if (mCustomTitleView != null)
            {
                // Add the custom title view directly to the topPanel layout
                android.widget.LinearLayout.LayoutParams lp = new android.widget.LinearLayout.LayoutParams
                                                                  (android.view.ViewGroup.LayoutParams.MATCH_PARENT, android.view.ViewGroup.LayoutParams
                                                                  .WRAP_CONTENT);
                topPanel.addView(mCustomTitleView, 0, lp);
                // Hide the title template
                android.view.View titleTemplate = mWindow.findViewById([email protected]_template
                                                                       );
                titleTemplate.setVisibility(android.view.View.GONE);
            }
            else
            {
                bool hasTextTitle = !android.text.TextUtils.isEmpty(mTitle);
                mIconView = (android.widget.ImageView)mWindow.findViewById([email protected]
                                                                           .icon);
                if (hasTextTitle)
                {
                    mTitleView = (android.widget.TextView)mWindow.findViewById([email protected]
                                                                               .alertTitle);
                    mTitleView.setText(mTitle);
                    if (mIconId > 0)
                    {
                        mIconView.setImageResource(mIconId);
                    }
                    else
                    {
                        if (mIcon != null)
                        {
                            mIconView.setImageDrawable(mIcon);
                        }
                        else
                        {
                            if (mIconId == 0)
                            {
                                mTitleView.setPadding(mIconView.getPaddingLeft(), mIconView.getPaddingTop(), mIconView
                                                      .getPaddingRight(), mIconView.getPaddingBottom());
                                mIconView.setVisibility(android.view.View.GONE);
                            }
                        }
                    }
                }
                else
                {
                    // Hide the title template
                    android.view.View titleTemplate = mWindow.findViewById([email protected]_template
                                                                           );
                    titleTemplate.setVisibility(android.view.View.GONE);
                    mIconView.setVisibility(android.view.View.GONE);
                    topPanel.setVisibility(android.view.View.GONE);
                    hasTitle = false;
                }
            }
            return(hasTitle);
        }
Пример #5
0
 /// <summary><p>Collapses or restores a given column.</p></summary>
 /// <param name="columnIndex">the index of the column</param>
 /// <param name="collapsed">
 /// true if the column must be collapsed, false otherwise
 /// <hide></hide>
 /// </param>
 internal virtual void setColumnCollapsed(int columnIndex, bool collapsed)
 {
     android.view.View child = getVirtualChildAt(columnIndex);
     if (child != null)
     {
         child.setVisibility(collapsed ? GONE : VISIBLE);
     }
 }
Пример #6
0
        private void showPermissions()
        {
            switch (mCurrentState)
            {
            case android.widget.AppSecurityPermissions.State.NO_PERMS:
            {
                displayNoPermissions();
                break;
            }

            case android.widget.AppSecurityPermissions.State.DANGEROUS_ONLY:
            {
                displayPermissions(true);
                break;
            }

            case android.widget.AppSecurityPermissions.State.NORMAL_ONLY:
            {
                displayPermissions(false);
                break;
            }

            case android.widget.AppSecurityPermissions.State.BOTH:
            {
                displayPermissions(true);
                if (mExpanded)
                {
                    displayPermissions(false);
                    mShowMoreIcon.setImageDrawable(mShowMaxIcon);
                    mShowMoreText.setText([email protected][email protected]_hide);
                    mNonDangerousList.setVisibility(android.view.View.VISIBLE);
                }
                else
                {
                    mShowMoreIcon.setImageDrawable(mShowMinIcon);
                    mShowMoreText.setText([email protected][email protected]_show_all);
                    mNonDangerousList.setVisibility(android.view.View.GONE);
                }
                mShowMore.setVisibility(android.view.View.VISIBLE);
                break;
            }
            }
        }
Пример #7
0
 private void centerButton(android.widget.Button button)
 {
     android.widget.LinearLayout.LayoutParams @params = (android.widget.LinearLayout.LayoutParams
                                                         )button.getLayoutParams();
     @params.gravity = android.view.Gravity.CENTER_HORIZONTAL;
     @params.weight  = 0.5f;
     button.setLayoutParams(@params);
     android.view.View leftSpacer = mWindow.findViewById([email protected]
                                                         );
     if (leftSpacer != null)
     {
         leftSpacer.setVisibility(android.view.View.VISIBLE);
     }
     android.view.View rightSpacer = mWindow.findViewById([email protected]
                                                          );
     if (rightSpacer != null)
     {
         rightSpacer.setVisibility(android.view.View.VISIBLE);
     }
 }
Пример #8
0
 public override void setVisibility(int visibility)
 {
     if (mInflatedViewRef != null)
     {
         android.view.View view = mInflatedViewRef.get();
         if (view != null)
         {
             view.setVisibility(visibility);
         }
         else
         {
             throw new System.InvalidOperationException("setVisibility called on un-referenced view"
                                                        );
         }
     }
     else
     {
         base.setVisibility(visibility);
         if (visibility == VISIBLE || visibility == INVISIBLE)
         {
             inflate();
         }
     }
 }
Пример #9
0
 public override android.view.View getItemView([email protected]
                                               item, android.view.View convertView, android.view.ViewGroup parent)
 {
     android.view.View actionView = item.getActionView();
     if (actionView == null || item.hasCollapsibleActionView())
     {
         if (!(convertView is [email protected]))
         {
             convertView = null;
         }
         actionView = base.getItemView(item, convertView, parent);
     }
     actionView.setVisibility(item.isActionViewExpanded() ? android.view.View.GONE : android.view.View
                              .VISIBLE);
     [email protected] menuParent = ([email protected]
                                                              )parent;
     android.view.ViewGroup.LayoutParams lp = actionView.getLayoutParams();
     if (!menuParent.checkLayoutParams(lp))
     {
         actionView.setLayoutParams((([email protected]
                                      )menuParent.generateLayoutParams(lp)));
     }
     return(actionView);
 }
Пример #10
0
        private void setupView()
        {
            android.widget.LinearLayout contentPanel = (android.widget.LinearLayout)mWindow.findViewById
                                                           ([email protected]);
            setupContent(contentPanel);
            bool hasButtons = setupButtons();

            android.widget.LinearLayout topPanel = (android.widget.LinearLayout)mWindow.findViewById
                                                       ([email protected]);
            android.content.res.TypedArray a = mContext.obtainStyledAttributes(null, [email protected]
                                                                               .styleable.AlertDialog, [email protected], 0);
            bool hasTitle = setupTitle(topPanel);

            android.view.View buttonPanel = mWindow.findViewById([email protected]
                                                                 );
            if (!hasButtons)
            {
                buttonPanel.setVisibility(android.view.View.GONE);
                mWindow.setCloseOnTouchOutsideIfNotSet(true);
            }
            android.widget.FrameLayout customPanel = null;
            if (mView != null)
            {
                customPanel = (android.widget.FrameLayout)mWindow.findViewById([email protected]
                                                                               .id.customPanel);
                android.widget.FrameLayout custom = (android.widget.FrameLayout)mWindow.findViewById
                                                        ([email protected]);
                custom.addView(mView, new android.view.ViewGroup.LayoutParams(android.view.ViewGroup
                                                                              .LayoutParams.MATCH_PARENT, android.view.ViewGroup.LayoutParams.MATCH_PARENT));
                if (mViewSpacingSpecified)
                {
                    custom.setPadding(mViewSpacingLeft, mViewSpacingTop, mViewSpacingRight, mViewSpacingBottom
                                      );
                }
                if (mListView != null)
                {
                    ((android.widget.LinearLayout.LayoutParams)customPanel.getLayoutParams()).weight
                        = 0;
                }
            }
            else
            {
                mWindow.findViewById([email protected]).setVisibility(android.view.View
                                                                                       .GONE);
            }
            if (hasTitle)
            {
                android.view.View divider = null;
                if (mMessage != null || mView != null || mListView != null)
                {
                    divider = mWindow.findViewById([email protected]);
                }
                else
                {
                    divider = mWindow.findViewById([email protected]);
                }
                if (divider != null)
                {
                    divider.setVisibility(android.view.View.VISIBLE);
                }
            }
            setBackground(topPanel, contentPanel, customPanel, hasButtons, a, hasTitle, buttonPanel
                          );
            a.recycle();
        }
Пример #11
0
 private void displayNoPermissions()
 {
     mNoPermsView.setVisibility(android.view.View.VISIBLE);
 }