Example #1
0
            public override android.view.View getView(int position, android.view.View convertView
                                                      , android.view.ViewGroup parent)
            {
                int itemViewType = this.getItemViewType(position);

                switch (itemViewType)
                {
                case ITEM_VIEW_TYPE_FOOTER:
                {
                    if (convertView == null || convertView.getId() != ITEM_VIEW_TYPE_FOOTER)
                    {
                        convertView = android.view.LayoutInflater.from(this._enclosing.getContext()).inflate
                                          ([email protected]_chooser_view_list_item, parent, false);
                        convertView.setId(ITEM_VIEW_TYPE_FOOTER);
                        android.widget.TextView titleView = (android.widget.TextView)convertView.findViewById
                                                                ([email protected]);
                        titleView.setText(java.lang.CharSequenceProxy.Wrap(this._enclosing.mContext.getString
                                                                               ([email protected][email protected]_chooser_view_see_all)));
                    }
                    return(convertView);
                }

                case ITEM_VIEW_TYPE_ACTIVITY:
                {
                    if (convertView == null || convertView.getId() != [email protected]_item)
                    {
                        convertView = android.view.LayoutInflater.from(this._enclosing.getContext()).inflate
                                          ([email protected]_chooser_view_list_item, parent, false);
                    }
                    android.content.pm.PackageManager packageManager = this._enclosing.mContext.getPackageManager
                                                                           ();
                    // Set the icon
                    android.widget.ImageView iconView = (android.widget.ImageView)convertView.findViewById
                                                            ([email protected]);
                    android.content.pm.ResolveInfo activity = (android.content.pm.ResolveInfo) this.getItem
                                                                  (position);
                    iconView.setImageDrawable(activity.loadIcon(packageManager));
                    // Set the title.
                    android.widget.TextView titleView_1 = (android.widget.TextView)convertView.findViewById
                                                              ([email protected]);
                    titleView_1.setText(activity.loadLabel(packageManager));
                    // Highlight the default.
                    if (this.mShowDefaultActivity && position == 0 && this.mHighlightDefaultActivity)
                    {
                        convertView.setActivated(true);
                    }
                    else
                    {
                        convertView.setActivated(false);
                    }
                    return(convertView);
                }

                default:
                {
                    throw new System.ArgumentException();
                }
                }
            }
Example #2
0
 public android.view.MenuItem setActionView(android.view.View view)
 {
     mActionView     = view;
     mActionProvider = null;
     if (view != null && view.getId() == android.view.View.NO_ID && mId > 0)
     {
         view.setId(mId);
     }
     mMenu.onItemActionRequestChanged(this);
     return(this);
 }
Example #3
0
 /// <summary>
 /// Inflates the layout resource identified by
 /// <see cref="getLayoutResource()">getLayoutResource()</see>
 /// and replaces this StubbedView in its parent by the inflated layout resource.
 /// </summary>
 /// <returns>The inflated layout resource.</returns>
 public android.view.View inflate()
 {
     android.view.ViewParent viewParent = getParent();
     if (viewParent != null && viewParent is android.view.ViewGroup)
     {
         if (mLayoutResource != 0)
         {
             android.view.ViewGroup      parent  = (android.view.ViewGroup)viewParent;
             android.view.LayoutInflater factory = android.view.LayoutInflater.from(mContext);
             android.view.View           view    = factory.inflate(mLayoutResource, parent, false);
             if (mInflatedId != NO_ID)
             {
                 view.setId(mInflatedId);
             }
             int index = parent.indexOfChild(this);
             parent.removeViewInLayout(this);
             android.view.ViewGroup.LayoutParams layoutParams = getLayoutParams();
             if (layoutParams != null)
             {
                 parent.addView(view, index, layoutParams);
             }
             else
             {
                 parent.addView(view, index);
             }
             mInflatedViewRef = new [email protected] <android.view.View>(view);
             if (mInflateListener != null)
             {
                 mInflateListener.onInflate(this, view);
             }
             return(view);
         }
         else
         {
             throw new System.ArgumentException("ViewStub must have a valid layoutResource");
         }
     }
     else
     {
         throw new System.InvalidOperationException("ViewStub must have a non-null ViewGroup viewParent"
                                                    );
     }
 }
Example #4
0
 public virtual void onChildViewAdded(android.view.View parent, android.view.View
                                      child)
 {
     if (parent == this._enclosing && child is android.widget.RadioButton)
     {
         int id = child.getId();
         // generates an id if it's missing
         if (id == android.view.View.NO_ID)
         {
             id = child.GetHashCode();
             child.setId(id);
         }
         ((android.widget.RadioButton)child).setOnCheckedChangeWidgetListener(this._enclosing
                                                                              .mChildOnCheckedChangeListener);
     }
     if (this.mOnHierarchyChangeListener != null)
     {
         this.mOnHierarchyChangeListener.onChildViewAdded(parent, child);
     }
 }