예제 #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();
					}
				}
			}
예제 #2
0
		private void bindView(int position, android.view.View view)
		{
			java.util.Map<string, object> dataSet = mData.get(position);
			if (dataSet == null)
			{
				return;
			}
			android.widget.SimpleAdapter.ViewBinder binder = mViewBinder;
			string[] from = mFrom;
			int[] to = mTo;
			int count = to.Length;
			{
				for (int i = 0; i < count; i++)
				{
					android.view.View v = view.findViewById(to[i]);
					if (v != null)
					{
						object data = dataSet.get(from[i]);
						string text = data == null ? string.Empty : data.ToString();
						if (text == null)
						{
							text = string.Empty;
						}
						bool bound = false;
						if (binder != null)
						{
							bound = binder.setViewValue(v, data, text);
						}
						if (!bound)
						{
							if (v is android.widget.Checkable)
							{
								if (data is bool)
								{
									((android.widget.Checkable)v).setChecked((bool)data);
								}
								else
								{
									if (v is android.widget.TextView)
									{
										// Note: keep the instanceof TextView check at the bottom of these
										// ifs since a lot of views are TextViews (e.g. CheckBoxes).
										setViewText((android.widget.TextView)v, text);
									}
									else
									{
										throw new System.InvalidOperationException(v.GetType().FullName + " should be bound to a Boolean, not a "
											 + (data == null ? "<unknown type>" : data.GetType().ToString()));
									}
								}
							}
							else
							{
								if (v is android.widget.TextView)
								{
									// Note: keep the instanceof TextView check at the bottom of these
									// ifs since a lot of views are TextViews (e.g. CheckBoxes).
									setViewText((android.widget.TextView)v, text);
								}
								else
								{
									if (v is android.widget.ImageView)
									{
										if (data is int)
										{
											setViewImage((android.widget.ImageView)v, (int)data);
										}
										else
										{
											setViewImage((android.widget.ImageView)v, text);
										}
									}
									else
									{
										throw new System.InvalidOperationException(v.GetType().FullName + " is not a " + 
											" view that can be bounds by this SimpleAdapter");
									}
								}
							}
						}
					}
				}
			}
		}
예제 #3
0
		public override void bindView(android.view.View view, android.content.Context context
			, android.database.Cursor cursor)
		{
			android.widget.SimpleCursorAdapter.ViewBinder binder = mViewBinder;
			int count = mTo.Length;
			int[] from = mFrom;
			int[] to = mTo;
			{
				for (int i = 0; i < count; i++)
				{
					android.view.View v = view.findViewById(to[i]);
					if (v != null)
					{
						bool bound = false;
						if (binder != null)
						{
							bound = binder.setViewValue(v, cursor, from[i]);
						}
						if (!bound)
						{
							string text = cursor.getString(from[i]);
							if (text == null)
							{
								text = string.Empty;
							}
							if (v is android.widget.TextView)
							{
								setViewText((android.widget.TextView)v, text);
							}
							else
							{
								if (v is android.widget.ImageView)
								{
									setViewImage((android.widget.ImageView)v, text);
								}
								else
								{
									throw new System.InvalidOperationException(v.GetType().FullName + " is not a " + 
										" view that can be bounds by this SimpleCursorAdapter");
								}
							}
						}
					}
				}
			}
		}
예제 #4
0
		private void bindView(android.view.View view, android.content.Context context, android.database.Cursor
			 cursor, int[] from, int[] to)
		{
			android.widget.SimpleCursorTreeAdapter.ViewBinder binder = mViewBinder;
			{
				for (int i = 0; i < to.Length; i++)
				{
					android.view.View v = view.findViewById(to[i]);
					if (v != null)
					{
						bool bound = false;
						if (binder != null)
						{
							bound = binder.setViewValue(v, cursor, from[i]);
						}
						if (!bound)
						{
							string text = cursor.getString(from[i]);
							if (text == null)
							{
								text = string.Empty;
							}
							if (v is android.widget.TextView)
							{
								setViewText((android.widget.TextView)v, text);
							}
							else
							{
								if (v is android.widget.ImageView)
								{
									setViewImage((android.widget.ImageView)v, text);
								}
								else
								{
									throw new System.InvalidOperationException("SimpleCursorTreeAdapter can bind values"
										 + " only to TextView and ImageView!");
								}
							}
						}
					}
				}
			}
		}
예제 #5
0
			public ChildViewCache(android.view.View v)
			{
				mText1 = (android.widget.TextView)v.findViewById([email protected]);
				mText2 = (android.widget.TextView)v.findViewById([email protected]);
				mIcon1 = (android.widget.ImageView)v.findViewById([email protected]);
				mIcon2 = (android.widget.ImageView)v.findViewById([email protected]);
				mIconRefine = (android.widget.ImageView)v.findViewById([email protected]_query
					);
			}
예제 #6
0
		private void init(android.view.View decor)
		{
			mContext = decor.getContext();
			mActionView = ([email protected])decor.findViewById([email protected]
				.id.action_bar);
			mContextView = ([email protected])decor.findViewById(
				[email protected]_context_bar);
			mContainerView = ([email protected])decor.findViewById(
				[email protected]_bar_container);
			mSplitView = ([email protected])decor.findViewById([email protected]
				.id.split_action_bar);
			if (mActionView == null || mContextView == null || mContainerView == null)
			{
				throw new System.InvalidOperationException(GetType().Name + " can only be used " 
					+ "with a compatible window decor layout");
			}
			mActionView.setContextView(mContextView);
			mContextDisplayMode = mActionView.isSplitActionBar() ? CONTEXT_DISPLAY_SPLIT : CONTEXT_DISPLAY_NORMAL;
			// Older apps get the home button interaction enabled by default.
			// Newer apps need to enable it explicitly.
			setHomeButtonEnabled(mContext.getApplicationInfo().targetSdkVersion < android.os.Build
				.VERSION_CODES.ICE_CREAM_SANDWICH);
			setHasEmbeddedTabs(mContext.getResources().getBoolean([email protected][email protected]_bar_embed_tabs
				));
		}