Exemplo n.º 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();
					}
				}
			}
Exemplo n.º 2
0
		public override void addView(android.view.View child, int index, android.view.ViewGroup
			.LayoutParams @params)
		{
			base.addView(child, index, @params);
			int childId = child.getId();
			if (childId == CHRONOMETER_ID && child is android.widget.Chronometer)
			{
				mChronometer = (android.widget.Chronometer)child;
				mChronometer.setOnChronometerTickListener(this);
				// Check if Chronometer should move with with ProgressBar 
				mChronometerFollow = (@params.width == android.view.ViewGroup.LayoutParams.WRAP_CONTENT
					);
				mChronometerGravity = (mChronometer.getGravity() & android.view.Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK
					);
			}
			else
			{
				if (childId == PROGRESSBAR_ID && child is android.widget.ProgressBar)
				{
					mProgressBar = (android.widget.ProgressBar)child;
				}
			}
		}
Exemplo n.º 3
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;
		}
Exemplo n.º 4
0
		public virtual android.view.View onCreateView(android.view.View parent, string name
			, android.content.Context context, android.util.AttributeSet attrs)
		{
			if (!"fragment".Equals(name))
			{
				return onCreateView(name, context, attrs);
			}
			string fname = attrs.getAttributeValue(null, "class");
			android.content.res.TypedArray a = context.obtainStyledAttributes(attrs, [email protected]
				.styleable.Fragment);
			if (fname == null)
			{
				fname = a.getString([email protected]_name);
			}
			int id = a.getResourceId([email protected]_id, android.view.View
				.NO_ID);
			string tag = a.getString([email protected]_tag);
			a.recycle();
			int containerId = parent != null ? parent.getId() : 0;
			if (containerId == android.view.View.NO_ID && id == android.view.View.NO_ID && tag
				 == null)
			{
				throw new System.ArgumentException(attrs.getPositionDescription() + ": Must specify unique android:id, android:tag, or have a parent with an id for "
					 + fname);
			}
			android.app.Fragment fragment = id != android.view.View.NO_ID ? mFragments.findFragmentById
				(id) : null;
			if (fragment == null && tag != null)
			{
				fragment = mFragments.findFragmentByTag(tag);
			}
			if (fragment == null && containerId != android.view.View.NO_ID)
			{
				fragment = mFragments.findFragmentById(containerId);
			}
			if (android.app.FragmentManagerImpl.DEBUG)
			{
				android.util.Log.v(TAG, "onCreateView: id=0x" + Sharpen.Util.IntToHexString(id) +
					 " fname=" + fname + " existing=" + fragment);
			}
			if (fragment == null)
			{
				fragment = android.app.Fragment.instantiate(this, fname);
				fragment.mFromLayout = true;
				fragment.mFragmentId = id != 0 ? id : containerId;
				fragment.mContainerId = containerId;
				fragment.mTag = tag;
				fragment.mInLayout = true;
				fragment.mFragmentManager = mFragments;
				fragment.onInflate(this, attrs, fragment.mSavedFragmentState);
				mFragments.addFragment(fragment, true);
			}
			else
			{
				if (fragment.mInLayout)
				{
					throw new System.ArgumentException(attrs.getPositionDescription() + ": Duplicate id 0x"
						 + Sharpen.Util.IntToHexString(id) + ", tag " + tag + ", or parent id 0x" + Sharpen.Util.IntToHexString
						(containerId) + " with another fragment for " + fname);
				}
				else
				{
					fragment.mInLayout = true;
					if (!fragment.mRetaining)
					{
						fragment.onInflate(this, attrs, fragment.mSavedFragmentState);
					}
					mFragments.moveToState(fragment);
				}
			}
			if (fragment.mView == null)
			{
				throw new System.InvalidOperationException("Fragment " + fname + " did not create a view."
					);
			}
			if (id != 0)
			{
				fragment.mView.setId(id);
			}
			if (fragment.mView.getTag() == null)
			{
				fragment.mView.setTag(tag);
			}
			return fragment.mView;
		}
Exemplo n.º 5
0
			public bool onLongClick(android.view.View v)
			{
				this._enclosing.mInputText.clearFocus();
				if (v.getId() == [email protected])
				{
					this._enclosing.postChangeCurrentByOneFromLongPress(true);
				}
				else
				{
					this._enclosing.postChangeCurrentByOneFromLongPress(false);
				}
				return true;
			}
Exemplo n.º 6
0
			public void onClick(android.view.View v)
			{
				android.view.inputmethod.InputMethodManager inputMethodManager = android.view.inputmethod.InputMethodManager
					.peekInstance();
				if (inputMethodManager != null && inputMethodManager.isActive(this._enclosing.mInputText
					))
				{
					inputMethodManager.hideSoftInputFromWindow(this._enclosing.getWindowToken(), 0);
				}
				this._enclosing.mInputText.clearFocus();
				if (v.getId() == [email protected])
				{
					this._enclosing.changeCurrentByOne(true);
				}
				else
				{
					this._enclosing.changeCurrentByOne(false);
				}
			}
Exemplo n.º 7
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);
				}
			}
Exemplo n.º 8
0
			public virtual void onCheckedChanged(android.widget.CompoundButton buttonView, bool
				 isChecked)
			{
				// prevents from infinite recursion
				if (this._enclosing.mProtectFromCheckedChange)
				{
					return;
				}
				this._enclosing.mProtectFromCheckedChange = true;
				if (this._enclosing.mCheckedId != -1)
				{
					this._enclosing.setCheckedStateForView(this._enclosing.mCheckedId, false);
				}
				this._enclosing.mProtectFromCheckedChange = false;
				int id = buttonView.getId();
				this._enclosing.setCheckedId(id);
			}