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();
					}
				}
			}
Exemple #2
0
		/// <summary>
		/// Add a view as a child and make sure it is measured (if necessary) and
		/// positioned properly.
		/// </summary>
		/// <remarks>
		/// Add a view as a child and make sure it is measured (if necessary) and
		/// positioned properly.
		/// </remarks>
		/// <param name="child">The view to add</param>
		/// <param name="position">The position of the view</param>
		/// <param name="y">The y position relative to which this view will be positioned</param>
		/// <param name="flow">
		/// if true, align top edge to y. If false, align bottom edge
		/// to y.
		/// </param>
		/// <param name="childrenLeft">Left edge where children should be positioned</param>
		/// <param name="selected">Is this position selected?</param>
		/// <param name="recycled">
		/// Has this view been pulled from the recycle bin? If so it
		/// does not need to be remeasured.
		/// </param>
		/// <param name="where">Where to add the item in the list</param>
		private void setupChild(android.view.View child, int position, int y, bool flow, 
			int childrenLeft, bool selected, bool recycled, int where)
		{
			bool isSelected_1 = selected && shouldShowSelector();
			bool updateChildSelected = isSelected_1 != child.isSelected();
			int mode = mTouchMode;
			bool isPressed_1 = mode > TOUCH_MODE_DOWN && mode < TOUCH_MODE_SCROLL && mMotionPosition
				 == position;
			bool updateChildPressed = isPressed_1 != child.isPressed();
			bool needToMeasure = !recycled || updateChildSelected || child.isLayoutRequested(
				);
			// Respect layout params that are already in the view. Otherwise make
			// some up...
			android.widget.AbsListView.LayoutParams p = (android.widget.AbsListView.LayoutParams
				)child.getLayoutParams();
			if (p == null)
			{
				p = new android.widget.AbsListView.LayoutParams(android.view.ViewGroup.LayoutParams
					.MATCH_PARENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT, 0);
			}
			p.viewType = mAdapter.getItemViewType(position);
			if (recycled && !p.forceAdd)
			{
				attachViewToParent(child, where, p);
			}
			else
			{
				p.forceAdd = false;
				addViewInLayout(child, where, p, true);
			}
			if (updateChildSelected)
			{
				child.setSelected(isSelected_1);
				if (isSelected_1)
				{
					requestFocus();
				}
			}
			if (updateChildPressed)
			{
				child.setPressed(isPressed_1);
			}
			if (mChoiceMode != CHOICE_MODE_NONE && mCheckStates != null)
			{
				if (child is android.widget.Checkable)
				{
					((android.widget.Checkable)child).setChecked(mCheckStates.get(position));
				}
				else
				{
					if (getContext().getApplicationInfo().targetSdkVersion >= android.os.Build.VERSION_CODES
						.HONEYCOMB)
					{
						child.setActivated(mCheckStates.get(position));
					}
				}
			}
			if (needToMeasure)
			{
				int childHeightSpec = android.view.ViewGroup.getChildMeasureSpec(android.view.View
					.MeasureSpec.makeMeasureSpec(0, android.view.View.MeasureSpec.UNSPECIFIED), 0, p
					.height);
				int childWidthSpec = android.view.ViewGroup.getChildMeasureSpec(android.view.View
					.MeasureSpec.makeMeasureSpec(mColumnWidth, android.view.View.MeasureSpec.EXACTLY
					), 0, p.width);
				child.measure(childWidthSpec, childHeightSpec);
			}
			else
			{
				cleanupLayoutState(child);
			}
			int w = child.getMeasuredWidth();
			int h = child.getMeasuredHeight();
			int childLeft;
			int childTop = flow ? y : y - h;
			int layoutDirection = getResolvedLayoutDirection();
			int absoluteGravity = android.view.Gravity.getAbsoluteGravity(mGravity, layoutDirection
				);
			switch (absoluteGravity & android.view.Gravity.HORIZONTAL_GRAVITY_MASK)
			{
				case android.view.Gravity.LEFT:
				{
					childLeft = childrenLeft;
					break;
				}

				case android.view.Gravity.CENTER_HORIZONTAL:
				{
					childLeft = childrenLeft + ((mColumnWidth - w) / 2);
					break;
				}

				case android.view.Gravity.RIGHT:
				{
					childLeft = childrenLeft + mColumnWidth - w;
					break;
				}

				default:
				{
					childLeft = childrenLeft;
					break;
				}
			}
			if (needToMeasure)
			{
				int childRight = childLeft + w;
				int childBottom = childTop + h;
				child.layout(childLeft, childTop, childRight, childBottom);
			}
			else
			{
				child.offsetLeftAndRight(childLeft - child.getLeft());
				child.offsetTopAndBottom(childTop - child.getTop());
			}
			if (mCachingStarted)
			{
				child.setDrawingCacheEnabled(true);
			}
			if (recycled && (((android.widget.AbsListView.LayoutParams)child.getLayoutParams(
				)).scrappedFromPosition) != position)
			{
				child.jumpDrawablesToCurrentState();
			}
		}