示例#1
0
 /// <summary>Create a drawable by opening a given file path and decoding the bitmap.</summary>
 /// <remarks>Create a drawable by opening a given file path and decoding the bitmap.</remarks>
 public BitmapDrawable(android.content.res.Resources res, string filepath) : this(
         new android.graphics.drawable.BitmapDrawable.BitmapState(android.graphics.BitmapFactory
                                                                  .decodeFile(filepath)), null)
 {
     mBitmapState.mTargetDensity = mTargetDensity;
     if (mBitmap == null)
     {
         android.util.Log.w("BitmapDrawable", "BitmapDrawable cannot decode " + filepath);
     }
 }
示例#2
0
 internal LayerDrawable(android.graphics.drawable.LayerDrawable.LayerState state,
                        android.content.res.Resources res)
 {
     android.graphics.drawable.LayerDrawable.LayerState @as = createConstantState(state
                                                                                  , res);
     mLayerState = @as;
     if (@as.mNum > 0)
     {
         ensurePadding();
     }
 }
示例#3
0
 /// <summary>
 /// Creates the item view for the 'More' button which is used to switch to
 /// the expanded menu view.
 /// </summary>
 /// <remarks>
 /// Creates the item view for the 'More' button which is used to switch to
 /// the expanded menu view. This button is a special case since it does not
 /// have a MenuItemData backing it.
 /// </remarks>
 /// <returns>The IconMenuItemView for the 'More' button</returns>
 internal [email protected] createMoreItemView()
 {
     android.content.Context     context  = getContext();
     android.view.LayoutInflater inflater = android.view.LayoutInflater.from(context);
     [email protected] itemView = ([email protected]
                                                              )inflater.inflate([email protected]_menu_item_layout, null);
     android.content.res.Resources r = context.getResources();
     itemView.initialize(r.getText([email protected][email protected]_item_label), mMoreIcon
                         );
     itemView.setOnClickListener(new _OnClickListener_303(this));
     return(itemView);
 }
示例#4
0
 private AnimationDrawable(android.graphics.drawable.AnimationDrawable.AnimationState
                           state, android.content.res.Resources res)
 {
     android.graphics.drawable.AnimationDrawable.AnimationState @as = new android.graphics.drawable.AnimationDrawable
                                                                      .AnimationState(state, this, res);
     mAnimationState = @as;
     setConstantState(@as);
     if (state != null)
     {
         setFrame(0, true, false);
     }
 }
示例#5
0
        public override void inflate(android.content.res.Resources r, org.xmlpull.v1.XmlPullParser
                                     parser, android.util.AttributeSet attrs)
        {
            base.inflate(r, parser, attrs);
            android.content.res.TypedArray a = r.obtainAttributes(attrs, [email protected].
                                                                  styleable.ColorDrawable);
            int color = mState.mBaseColor;

            color             = a.getColor([email protected]_color, color);
            mState.mBaseColor = mState.mUseColor = color;
            a.recycle();
        }
示例#6
0
 protected virtual bool inflateTag(java.lang.String arg0, android.content.res.Resources arg1, org.xmlpull.v1.XmlPullParser arg2, android.util.AttributeSet arg3)
 {
     global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
     if (!IsClrObject)
     {
         return(@__env.CallBooleanMethod(this.JvmHandle, global::android.graphics.drawable.ShapeDrawable._inflateTag4206, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg2), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg3)));
     }
     else
     {
         return(@__env.CallNonVirtualBooleanMethod(this.JvmHandle, global::android.graphics.drawable.ShapeDrawable.staticClass, global::android.graphics.drawable.ShapeDrawable._inflateTag4206, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg2), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg3)));
     }
 }
示例#7
0
 public override void inflate(android.content.res.Resources arg0, org.xmlpull.v1.XmlPullParser arg1, android.util.AttributeSet arg2)
 {
     global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
     if (!IsClrObject)
     {
         @__env.CallVoidMethod(this.JvmHandle, global::android.graphics.drawable.ColorDrawable._inflate3901, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg2));
     }
     else
     {
         @__env.CallNonVirtualVoidMethod(this.JvmHandle, global::android.graphics.drawable.ColorDrawable.staticClass, global::android.graphics.drawable.ColorDrawable._inflate3901, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg2));
     }
 }
示例#8
0
 public MenuPopupHelper(android.content.Context context, [email protected]
                        menu, android.view.View anchorView, bool overflowOnly)
 {
     mContext      = context;
     mInflater     = android.view.LayoutInflater.from(context);
     mMenu         = menu;
     mOverflowOnly = overflowOnly;
     android.content.res.Resources res = context.getResources();
     mPopupMaxWidth = System.Math.Max(res.getDisplayMetrics().widthPixels / 2, res.getDimensionPixelSize
                                          ([email protected]_prefDialogWidth));
     mAnchorView = anchorView;
     menu.addMenuPresenter(this);
 }
示例#9
0
 /// <summary>Constructor to use when building a ScaleAnimation from code</summary>
 /// <param name="fromX">
 /// Horizontal scaling factor to apply at the start of the
 /// animation
 /// </param>
 /// <param name="toX">Horizontal scaling factor to apply at the end of the animation</param>
 /// <param name="fromY">
 /// Vertical scaling factor to apply at the start of the
 /// animation
 /// </param>
 /// <param name="toY">Vertical scaling factor to apply at the end of the animation</param>
 /// <param name="pivotXType">
 /// Specifies how pivotXValue should be interpreted. One of
 /// Animation.ABSOLUTE, Animation.RELATIVE_TO_SELF, or
 /// Animation.RELATIVE_TO_PARENT.
 /// </param>
 /// <param name="pivotXValue">
 /// The X coordinate of the point about which the object
 /// is being scaled, specified as an absolute number where 0 is the
 /// left edge. (This point remains fixed while the object changes
 /// size.) This value can either be an absolute number if pivotXType
 /// is ABSOLUTE, or a percentage (where 1.0 is 100%) otherwise.
 /// </param>
 /// <param name="pivotYType">
 /// Specifies how pivotYValue should be interpreted. One of
 /// Animation.ABSOLUTE, Animation.RELATIVE_TO_SELF, or
 /// Animation.RELATIVE_TO_PARENT.
 /// </param>
 /// <param name="pivotYValue">
 /// The Y coordinate of the point about which the object
 /// is being scaled, specified as an absolute number where 0 is the
 /// top edge. (This point remains fixed while the object changes
 /// size.) This value can either be an absolute number if pivotYType
 /// is ABSOLUTE, or a percentage (where 1.0 is 100%) otherwise.
 /// </param>
 public ScaleAnimation(float fromX, float toX, float fromY, float toY, int pivotXType
                       , float pivotXValue, int pivotYType, float pivotYValue)
 {
     mResources   = null;
     mFromX       = fromX;
     mToX         = toX;
     mFromY       = fromY;
     mToY         = toY;
     mPivotXValue = pivotXValue;
     mPivotXType  = pivotXType;
     mPivotYValue = pivotYValue;
     mPivotYType  = pivotYType;
 }
示例#10
0
 /// <summary>Constructor to use when building a ScaleAnimation from code</summary>
 /// <param name="fromX">
 /// Horizontal scaling factor to apply at the start of the
 /// animation
 /// </param>
 /// <param name="toX">Horizontal scaling factor to apply at the end of the animation</param>
 /// <param name="fromY">
 /// Vertical scaling factor to apply at the start of the
 /// animation
 /// </param>
 /// <param name="toY">Vertical scaling factor to apply at the end of the animation</param>
 /// <param name="pivotX">
 /// The X coordinate of the point about which the object is
 /// being scaled, specified as an absolute number where 0 is the left
 /// edge. (This point remains fixed while the object changes size.)
 /// </param>
 /// <param name="pivotY">
 /// The Y coordinate of the point about which the object is
 /// being scaled, specified as an absolute number where 0 is the top
 /// edge. (This point remains fixed while the object changes size.)
 /// </param>
 public ScaleAnimation(float fromX, float toX, float fromY, float toY, float pivotX
                       , float pivotY)
 {
     mResources   = null;
     mFromX       = fromX;
     mToX         = toX;
     mFromY       = fromY;
     mToY         = toY;
     mPivotXType  = ABSOLUTE;
     mPivotYType  = ABSOLUTE;
     mPivotXValue = pivotX;
     mPivotYValue = pivotY;
 }
示例#11
0
 internal BitmapDrawable(android.graphics.drawable.BitmapDrawable.BitmapState state
                         , android.content.res.Resources res)
 {
     mBitmapState = state;
     if (res != null)
     {
         mTargetDensity = res.getDisplayMetrics().densityDpi;
     }
     else
     {
         mTargetDensity = state.mTargetDensity;
     }
     setBitmap(state != null ? state.mBitmap : null);
 }
示例#12
0
        /// <summary>
        /// Create a ColorStateList from an XML document, given a set of
        /// <see cref="Resources">Resources</see>
        /// .
        /// </summary>
        /// <exception cref="org.xmlpull.v1.XmlPullParserException"></exception>
        /// <exception cref="System.IO.IOException"></exception>
        public static android.content.res.ColorStateList createFromXml(android.content.res.Resources
                                                                       r, org.xmlpull.v1.XmlPullParser parser)
        {
            android.util.AttributeSet attrs = android.util.Xml.asAttributeSet(parser);
            int type;

            while ((type = parser.next()) != org.xmlpull.v1.XmlPullParserClass.START_TAG && type
                   != org.xmlpull.v1.XmlPullParserClass.END_DOCUMENT)
            {
            }
            if (type != org.xmlpull.v1.XmlPullParserClass.START_TAG)
            {
                throw new org.xmlpull.v1.XmlPullParserException("No start tag found");
            }
            return(createFromXmlInner(r, parser, attrs));
        }
示例#13
0
        public override void inflate(android.content.res.Resources r, org.xmlpull.v1.XmlPullParser
                                     parser, android.util.AttributeSet attrs)
        {
            base.inflate(r, parser, attrs);
            int type;
            int innerDepth = parser.getDepth() + 1;
            int depth;

            while ((type = parser.next()) != org.xmlpull.v1.XmlPullParserClass.END_DOCUMENT &&
                   ((depth = parser.getDepth()) >= innerDepth || type != org.xmlpull.v1.XmlPullParserClass.END_TAG
                   ))
            {
                if (type != org.xmlpull.v1.XmlPullParserClass.START_TAG)
                {
                    continue;
                }
                if (depth > innerDepth || !parser.getName().Equals("item"))
                {
                    continue;
                }
                android.content.res.TypedArray a = r.obtainAttributes(attrs, [email protected].
                                                                      styleable.MipmapDrawableItem);
                int drawableRes = a.getResourceId([email protected]_drawable
                                                  , 0);
                a.recycle();
                android.graphics.drawable.Drawable dr;
                if (drawableRes != 0)
                {
                    dr = r.getDrawable(drawableRes);
                }
                else
                {
                    while ((type = parser.next()) == org.xmlpull.v1.XmlPullParserClass.TEXT)
                    {
                    }
                    if (type != org.xmlpull.v1.XmlPullParserClass.START_TAG)
                    {
                        throw new org.xmlpull.v1.XmlPullParserException(parser.getPositionDescription() +
                                                                        ": <item> tag requires a 'drawable' attribute or " + "child tag defining a drawable"
                                                                        );
                    }
                    dr = android.graphics.drawable.Drawable.createFromXmlInner(r, parser, attrs);
                }
                mMipmapContainerState.addDrawable(dr);
            }
            onDrawableAdded();
        }
示例#14
0
 /// <summary>Construct a new EdgeEffect with a theme appropriate for the provided context.
 ///     </summary>
 /// <remarks>Construct a new EdgeEffect with a theme appropriate for the provided context.
 ///     </remarks>
 /// <param name="context">Context used to provide theming and resource information for the EdgeEffect
 ///     </param>
 public EdgeEffect(android.content.Context context)
 {
     // Time it will take the effect to fully recede in ms
     // Time it will take before a pulled glow begins receding in ms
     // Time it will take in ms for a pulled glow to decay to partial strength before release
     // Minimum velocity that will be absorbed
     // How much dragging should effect the height of the edge image.
     // Number determined by user testing.
     // How much dragging should effect the height of the glow image.
     // Number determined by user testing.
     android.content.res.Resources res = context.getResources();
     mEdge     = res.getDrawable([email protected]_edge);
     mGlow     = res.getDrawable([email protected]_glow);
     mMinWidth = (int)(context.getResources().getDisplayMetrics().density *MIN_WIDTH
                       + 0.5f);
     mInterpolator = new android.view.animation.DecelerateInterpolator();
 }
示例#15
0
 internal LayerState(android.graphics.drawable.LayerDrawable.LayerState orig, android.graphics.drawable.LayerDrawable
                     owner, android.content.res.Resources res)
 {
     if (orig != null)
     {
         android.graphics.drawable.LayerDrawable.ChildDrawable[] origChildDrawable = orig.
                                                                                     mChildren;
         int N = orig.mNum;
         mNum      = N;
         mChildren = new android.graphics.drawable.LayerDrawable.ChildDrawable[N];
         mChangingConfigurations         = orig.mChangingConfigurations;
         mChildrenChangingConfigurations = orig.mChildrenChangingConfigurations;
         {
             for (int i = 0; i < N; i++)
             {
                 android.graphics.drawable.LayerDrawable.ChildDrawable r = mChildren[i] = new android.graphics.drawable.LayerDrawable
                                                                                          .ChildDrawable();
                 android.graphics.drawable.LayerDrawable.ChildDrawable or = origChildDrawable[i];
                 if (res != null)
                 {
                     r.mDrawable = or.mDrawable.getConstantState().newDrawable(res);
                 }
                 else
                 {
                     r.mDrawable = or.mDrawable.getConstantState().newDrawable();
                 }
                 r.mDrawable.setCallback(owner);
                 r.mInsetL = or.mInsetL;
                 r.mInsetT = or.mInsetT;
                 r.mInsetR = or.mInsetR;
                 r.mInsetB = or.mInsetB;
                 r.mId     = or.mId;
             }
         }
         mHaveOpacity          = orig.mHaveOpacity;
         mOpacity              = orig.mOpacity;
         mHaveStateful         = orig.mHaveStateful;
         mStateful             = orig.mStateful;
         mCheckedConstantState = mCanConstantState = true;
     }
     else
     {
         mNum      = 0;
         mChildren = null;
     }
 }
示例#16
0
 /// <summary>Subclasses override this to parse custom subelements.</summary>
 /// <remarks>
 /// Subclasses override this to parse custom subelements.
 /// If you handle it, return true, else return <em>super.inflateTag(...)</em>.
 /// </remarks>
 protected internal virtual bool inflateTag(string name, android.content.res.Resources
                                            r, org.xmlpull.v1.XmlPullParser parser, android.util.AttributeSet attrs)
 {
     if ("padding".Equals(name))
     {
         android.content.res.TypedArray a = r.obtainAttributes(attrs, [email protected].
                                                               styleable.ShapeDrawablePadding);
         setPadding(a.getDimensionPixelOffset([email protected]_left
                                              , 0), a.getDimensionPixelOffset([email protected]_top
                                                                              , 0), a.getDimensionPixelOffset([email protected]_right
                                                                                                              , 0), a.getDimensionPixelOffset([email protected]_bottom
                                                                                                                                              , 0));
         a.recycle();
         return(true);
     }
     return(false);
 }
示例#17
0
        /// <exception cref="org.xmlpull.v1.XmlPullParserException"></exception>
        /// <exception cref="System.IO.IOException"></exception>
        private static android.content.res.ColorStateList createFromXmlInner(android.content.res.Resources
                                                                             r, org.xmlpull.v1.XmlPullParser parser, android.util.AttributeSet attrs)
        {
            android.content.res.ColorStateList colorStateList;
            string name = parser.getName();

            if (name.Equals("selector"))
            {
                colorStateList = new android.content.res.ColorStateList();
            }
            else
            {
                throw new org.xmlpull.v1.XmlPullParserException(parser.getPositionDescription() +
                                                                ": invalid drawable tag " + name);
            }
            colorStateList.inflate(r, parser, attrs);
            return(colorStateList);
        }
示例#18
0
        public override void inflate(android.content.res.Resources r, org.xmlpull.v1.XmlPullParser
                                     parser, android.util.AttributeSet attrs)
        {
            base.inflate(r, parser, attrs);
            int type;

            android.content.res.TypedArray a = r.obtainAttributes(attrs, [email protected].
                                                                  styleable.ScaleDrawable);
            float sw = getPercent(a, [email protected]_scaleWidth);
            float sh = getPercent(a, [email protected]_scaleHeight);
            int   g  = a.getInt([email protected]_scaleGravity, android.view.Gravity
                                .LEFT);
            bool min = a.getBoolean([email protected]_useIntrinsicSizeAsMinimum
                                    , false);

            android.graphics.drawable.Drawable dr = a.getDrawable([email protected]
                                                                  .ScaleDrawable_drawable);
            a.recycle();
            int outerDepth = parser.getDepth();

            while ((type = parser.next()) != org.xmlpull.v1.XmlPullParserClass.END_DOCUMENT &&
                   (type != org.xmlpull.v1.XmlPullParserClass.END_TAG || parser.getDepth() > outerDepth
                   ))
            {
                if (type != org.xmlpull.v1.XmlPullParserClass.START_TAG)
                {
                    continue;
                }
                dr = android.graphics.drawable.Drawable.createFromXmlInner(r, parser, attrs);
            }
            if (dr == null)
            {
                throw new System.ArgumentException("No drawable specified for <scale>");
            }
            mScaleState.mDrawable              = dr;
            mScaleState.mScaleWidth            = sw;
            mScaleState.mScaleHeight           = sh;
            mScaleState.mGravity               = g;
            mScaleState.mUseIntrinsicSizeAsMin = min;
            if (dr != null)
            {
                dr.setCallback(this);
            }
        }
示例#19
0
 internal ClipState(android.graphics.drawable.ClipDrawable.ClipState orig, android.graphics.drawable.ClipDrawable
                    owner, android.content.res.Resources res)
 {
     if (orig != null)
     {
         if (res != null)
         {
             mDrawable = orig.mDrawable.getConstantState().newDrawable(res);
         }
         else
         {
             mDrawable = orig.mDrawable.getConstantState().newDrawable();
         }
         mDrawable.setCallback(owner);
         mOrientation          = orig.mOrientation;
         mGravity              = orig.mGravity;
         mCheckedConstantState = mCanConstantState = true;
     }
 }
示例#20
0
        public override void initForMenu(android.content.Context context, [email protected]
                                         menu)
        {
            base.initForMenu(context, menu);
            android.content.res.Resources res = context.getResources();
            if (!mReserveOverflowSet)
            {
                mReserveOverflow = !android.view.ViewConfiguration.get(context).hasPermanentMenuKey
                                       ();
            }
            if (!mWidthLimitSet)
            {
                mWidthLimit = res.getDisplayMetrics().widthPixels / 2;
            }
            // Measure for initial configuration
            if (!mMaxItemsSet)
            {
                mMaxItems = res.getInteger([email protected]_action_buttons);
            }
            int width = mWidthLimit;

            if (mReserveOverflow)
            {
                if (mOverflowButton == null)
                {
                    mOverflowButton = new android.view.@internal.menu.ActionMenuPresenter.OverflowMenuButton
                                          (this, mSystemContext);
                    int spec = android.view.View.MeasureSpec.makeMeasureSpec(0, android.view.View.MeasureSpec
                                                                             .UNSPECIFIED);
                    mOverflowButton.measure(spec, spec);
                }
                width -= mOverflowButton.getMeasuredWidth();
            }
            else
            {
                mOverflowButton = null;
            }
            mActionItemWidthLimit = width;
            mMinCellSize          = (int)([email protected]_CELL_SIZE * res
                                          .getDisplayMetrics().density);
            // Drop a scrap view as it may no longer reflect the proper context/config.
            mScrapActionButtonView = null;
        }
示例#21
0
        protected internal override ImageButton createDeviceButton()
        {
            ImageButton button   = (ImageButton)LayoutInflater.from(Context).inflate(R.layout.main_app_view, this, false);
            Drawable    drawable = this.mData.mInstanceIcon;

            if (drawable.IntrinsicHeight > mDeviceIconMaxSize)
            {
                drawable.setBounds(0, 0, mDeviceIconMaxSize, mDeviceIconMaxSize);
            }
            button.ImageDrawable = drawable;
            button.Clickable     = false;
            button.LongClickable = true;

            Resources res = Resources;

            perpendicular = res.getDimensionPixelSize(R.dimen.default_controlbar_widget);
            along         = res.getDimensionPixelSize(R.dimen.main_app_btn_length);
            return(button);
        }
 /// <summary>Allows enter key resources to be overridden</summary>
 /// <param name="res">resources to grab given items from</param>
 /// <param name="previewId">preview drawable shown on enter key</param>
 /// <param name="iconId">normal drawable shown on enter key</param>
 /// <param name="labelId">string shown on enter key</param>
 internal virtual void setEnterKeyResources(android.content.res.Resources res, int
                                            previewId, int iconId, int labelId)
 {
     if (mEnterKey != null)
     {
         // Reset some of the rarely used attributes.
         mEnterKey.popupCharacters = null;
         mEnterKey.popupResId      = 0;
         mEnterKey.text            = null;
         mEnterKey.iconPreview     = res.getDrawable(previewId);
         mEnterKey.icon            = res.getDrawable(iconId);
         mEnterKey.label           = res.getText(labelId);
         // Set the initial size of the preview icon
         if (mEnterKey.iconPreview != null)
         {
             mEnterKey.iconPreview.setBounds(0, 0, mEnterKey.iconPreview.getIntrinsicWidth(),
                                             mEnterKey.iconPreview.getIntrinsicHeight());
         }
     }
 }
示例#23
0
        internal void setNinePatchState(android.graphics.drawable.NinePatchDrawable.NinePatchState
                                        state, android.content.res.Resources res)
        {
            mNinePatchState = state;
            mNinePatch      = state.mNinePatch;
            mPadding        = state.mPadding;
            mTargetDensity  = res != null?res.getDisplayMetrics().densityDpi : state.mTargetDensity;

            //noinspection PointlessBooleanExpression
            if (state.mDither != DEFAULT_DITHER)
            {
                // avoid calling the setter unless we need to, since it does a
                // lazy allocation of a paint
                setDither(state.mDither);
            }
            if (mNinePatch != null)
            {
                computeBitmapSize();
            }
        }
示例#24
0
 /// <summary>Create a new instance.</summary>
 /// <remarks>Create a new instance.</remarks>
 /// <param name="context">The application environment.</param>
 /// <param name="attrs">A collection of attributes.</param>
 /// <param name="defStyle">The default style to apply to this view.</param>
 public ActivityChooserView(android.content.Context context, android.util.AttributeSet
                            attrs, int defStyle) : base(context, attrs, defStyle)
 {
     mModelDataSetOberver    = new _DataSetObserver_118(this);
     mOnGlobalLayoutListener = new _OnGlobalLayoutListener_132(this);
     android.content.res.TypedArray attributesArray = context.obtainStyledAttributes(attrs
                                                                                     , [email protected], defStyle, 0);
     mInitialActivityCount = attributesArray.getInt([email protected]_initialActivityCount
                                                    , android.widget.ActivityChooserView.ActivityChooserViewAdapter.MAX_ACTIVITY_COUNT_DEFAULT
                                                    );
     android.graphics.drawable.Drawable expandActivityOverflowButtonDrawable = attributesArray
                                                                               .getDrawable([email protected]_expandActivityOverflowButtonDrawable
                                                                                            );
     attributesArray.recycle();
     android.view.LayoutInflater inflater = android.view.LayoutInflater.from(mContext);
     inflater.inflate([email protected]_chooser_view, this, true);
     mCallbacks = new android.widget.ActivityChooserView.Callbacks(this);
     mActivityChooserContent = (android.widget.LinearLayout)findViewById([email protected]
                                                                         .id.activity_chooser_view_content);
     mActivityChooserContentBackground = mActivityChooserContent.getBackground();
     mDefaultActivityButton            = (android.widget.FrameLayout)findViewById([email protected]
                                                                                  .id.default_activity_button);
     mDefaultActivityButton.setOnClickListener(mCallbacks);
     mDefaultActivityButton.setOnLongClickListener(mCallbacks);
     mDefaultActivityButtonImage = (android.widget.ImageView)mDefaultActivityButton.findViewById
                                       ([email protected]);
     mExpandActivityOverflowButton = (android.widget.FrameLayout)findViewById([email protected]
                                                                              .id.expand_activities_button);
     mExpandActivityOverflowButton.setOnClickListener(mCallbacks);
     mExpandActivityOverflowButtonImage = (android.widget.ImageView)mExpandActivityOverflowButton
                                          .findViewById([email protected]);
     mExpandActivityOverflowButtonImage.setImageDrawable(expandActivityOverflowButtonDrawable
                                                         );
     mAdapter = new android.widget.ActivityChooserView.ActivityChooserViewAdapter(this
                                                                                  );
     mAdapter.registerDataSetObserver(new _DataSetObserver_239(this));
     android.content.res.Resources resources = context.getResources();
     mListPopupMaxWidth = System.Math.Max(resources.getDisplayMetrics().widthPixels /
                                          2, resources.getDimensionPixelSize([email protected]_prefDialogWidth
                                                                             ));
 }
示例#25
0
 public LoadedApk(android.app.ActivityThread activityThread, string name, android.content.Context
                  systemContext, android.content.pm.ApplicationInfo info, android.content.res.CompatibilityInfo
                  compatInfo)
 {
     mActivityThread              = activityThread;
     mApplicationInfo             = info != null ? info : new android.content.pm.ApplicationInfo();
     mApplicationInfo.packageName = name;
     mPackageName       = name;
     mAppDir            = null;
     mResDir            = null;
     mSharedLibraries   = null;
     mDataDir           = null;
     mDataDirFile       = null;
     mLibDir            = null;
     mBaseClassLoader   = null;
     mSecurityViolation = false;
     mIncludeCode       = true;
     mClassLoader       = systemContext.getClassLoader();
     mResources         = systemContext.getResources();
     mCompatibilityInfo.set(compatInfo);
 }
示例#26
0
 internal ScaleState(android.graphics.drawable.ScaleDrawable.ScaleState orig, android.graphics.drawable.ScaleDrawable
                     owner, android.content.res.Resources res)
 {
     if (orig != null)
     {
         if (res != null)
         {
             mDrawable = orig.mDrawable.getConstantState().newDrawable(res);
         }
         else
         {
             mDrawable = orig.mDrawable.getConstantState().newDrawable();
         }
         mDrawable.setCallback(owner);
         mScaleWidth            = orig.mScaleWidth;
         mScaleHeight           = orig.mScaleHeight;
         mGravity               = orig.mGravity;
         mUseIntrinsicSizeAsMin = orig.mUseIntrinsicSizeAsMin;
         mCheckedConstantState  = mCanConstantState = true;
     }
 }
示例#27
0
 private void initTabWidget()
 {
     setChildrenDrawingOrderEnabled(true);
     android.content.Context       context   = mContext;
     android.content.res.Resources resources = context.getResources();
     // Tests the target Sdk version, as set in the Manifest. Could not be set using styles.xml
     // in a values-v? directory which targets the current platform Sdk version instead.
     if (context.getApplicationInfo().targetSdkVersion <= android.os.Build.VERSION_CODES
         .DONUT)
     {
         // Donut apps get old color scheme
         if (mLeftStrip == null)
         {
             mLeftStrip = resources.getDrawable([email protected]_bottom_left_v4
                                                );
         }
         if (mRightStrip == null)
         {
             mRightStrip = resources.getDrawable([email protected]_bottom_right_v4
                                                 );
         }
     }
     else
     {
         // Use modern color scheme for Eclair and beyond
         if (mLeftStrip == null)
         {
             mLeftStrip = resources.getDrawable([email protected]_bottom_left);
         }
         if (mRightStrip == null)
         {
             mRightStrip = resources.getDrawable([email protected]_bottom_right
                                                 );
         }
     }
     // Deal with focus, as we don't want the focus to go by default
     // to a tab other than the current tab
     setFocusable(true);
     setOnFocusChangeListener(this);
 }
        protected internal override ImageButton createDeviceButton()
        {
            ImageButton button = (ImageButton)LayoutInflater.from(Context).inflate(R.layout.app_view, this, false);

            button.ImageDrawable = this.mData.mInstanceIcon;

            if (mData.mActionList.size() > 0)
            {
                button.OnClickListener = new OnClickListenerAnonymousInnerClassHelper(this);
            }
            else
            {
                button.OnClickListener = new OnClickListenerAnonymousInnerClassHelper2(this);
            }

            Resources res = Resources;

            perpendicular = res.getDimensionPixelSize(R.dimen.max_app_ic_size);
            along         = res.getDimensionPixelSize(R.dimen.max_app_ic_size);

            return(button);
        }
示例#29
0
        public override void inflate(android.content.res.Resources r, org.xmlpull.v1.XmlPullParser
                                     parser, android.util.AttributeSet attrs)
        {
            base.inflate(r, parser, attrs);
            android.content.res.TypedArray a = r.obtainAttributes(attrs, [email protected].
                                                                  styleable.ShapeDrawable);
            int color = mShapeState.mPaint.getColor();

            color = a.getColor([email protected]_color, color);
            mShapeState.mPaint.setColor(color);
            bool dither = a.getBoolean([email protected]_dither, false
                                       );

            mShapeState.mPaint.setDither(dither);
            setIntrinsicWidth((int)a.getDimension([email protected]_width
                                                  , 0f));
            setIntrinsicHeight((int)a.getDimension([email protected]_height
                                                   , 0f));
            a.recycle();
            int type;
            int outerDepth = parser.getDepth();

            while ((type = parser.next()) != org.xmlpull.v1.XmlPullParserClass.END_DOCUMENT &&
                   (type != org.xmlpull.v1.XmlPullParserClass.END_TAG || parser.getDepth() > outerDepth
                   ))
            {
                if (type != org.xmlpull.v1.XmlPullParserClass.START_TAG)
                {
                    continue;
                }
                string name = parser.getName();
                // call our subclass
                if (!inflateTag(name, r, parser, attrs))
                {
                    android.util.Log.w("drawable", "Unknown element: " + name + " for ShapeDrawable "
                                       + this);
                }
            }
        }
示例#30
0
        public override void inflate(android.content.res.Resources r, org.xmlpull.v1.XmlPullParser
                                     parser, android.util.AttributeSet attrs)
        {
            base.inflate(r, parser, attrs);
            int type;

            android.content.res.TypedArray a = r.obtainAttributes(attrs, [email protected].
                                                                  styleable.ClipDrawable);
            int orientation = a.getInt([email protected]_clipOrientation
                                       , HORIZONTAL);
            int g = a.getInt([email protected]_gravity, android.view.Gravity
                             .LEFT);

            android.graphics.drawable.Drawable dr = a.getDrawable([email protected]
                                                                  .ClipDrawable_drawable);
            a.recycle();
            int outerDepth = parser.getDepth();

            while ((type = parser.next()) != org.xmlpull.v1.XmlPullParserClass.END_DOCUMENT &&
                   (type != org.xmlpull.v1.XmlPullParserClass.END_TAG || parser.getDepth() > outerDepth
                   ))
            {
                if (type != org.xmlpull.v1.XmlPullParserClass.START_TAG)
                {
                    continue;
                }
                dr = android.graphics.drawable.Drawable.createFromXmlInner(r, parser, attrs);
            }
            if (dr == null)
            {
                throw new System.ArgumentException("No drawable specified for <clip>");
            }
            mClipState.mDrawable    = dr;
            mClipState.mOrientation = orientation;
            mClipState.mGravity     = g;
            dr.setCallback(this);
        }
示例#31
0
		public android.content.res.Resources getResources(android.app.ActivityThread mainThread
			)
		{
			if (mResources == null)
			{
				mResources = mainThread.getTopLevelResources(mResDir, this);
			}
			return mResources;
		}
示例#32
0
		public LoadedApk(android.app.ActivityThread activityThread, string name, android.content.Context
			 systemContext, android.content.pm.ApplicationInfo info, android.content.res.CompatibilityInfo
			 compatInfo)
		{
			mActivityThread = activityThread;
			mApplicationInfo = info != null ? info : new android.content.pm.ApplicationInfo();
			mApplicationInfo.packageName = name;
			mPackageName = name;
			mAppDir = null;
			mResDir = null;
			mSharedLibraries = null;
			mDataDir = null;
			mDataDirFile = null;
			mLibDir = null;
			mBaseClassLoader = null;
			mSecurityViolation = false;
			mIncludeCode = true;
			mClassLoader = systemContext.getClassLoader();
			mResources = systemContext.getResources();
			mCompatibilityInfo.set(compatInfo);
		}
示例#33
0
		/// <summary>Create a new ApplicationContext from an existing one.</summary>
		/// <remarks>
		/// Create a new ApplicationContext from an existing one.  The new one
		/// works and operates the same as the one it is copying.
		/// </remarks>
		/// <param name="context">Existing application context.</param>
		internal ContextImpl(android.app.ContextImpl context)
		{
			mPackageInfo = context.mPackageInfo;
			mBasePackageName = context.mBasePackageName;
			mResources = context.mResources;
			mMainThread = context.mMainThread;
			mContentResolver = context.mContentResolver;
			mOuterContext = this;
		}
示例#34
0
		/// <summary>Constructor to use when building a ScaleAnimation from code</summary>
		/// <param name="fromX">
		/// Horizontal scaling factor to apply at the start of the
		/// animation
		/// </param>
		/// <param name="toX">Horizontal scaling factor to apply at the end of the animation</param>
		/// <param name="fromY">
		/// Vertical scaling factor to apply at the start of the
		/// animation
		/// </param>
		/// <param name="toY">Vertical scaling factor to apply at the end of the animation</param>
		/// <param name="pivotXType">
		/// Specifies how pivotXValue should be interpreted. One of
		/// Animation.ABSOLUTE, Animation.RELATIVE_TO_SELF, or
		/// Animation.RELATIVE_TO_PARENT.
		/// </param>
		/// <param name="pivotXValue">
		/// The X coordinate of the point about which the object
		/// is being scaled, specified as an absolute number where 0 is the
		/// left edge. (This point remains fixed while the object changes
		/// size.) This value can either be an absolute number if pivotXType
		/// is ABSOLUTE, or a percentage (where 1.0 is 100%) otherwise.
		/// </param>
		/// <param name="pivotYType">
		/// Specifies how pivotYValue should be interpreted. One of
		/// Animation.ABSOLUTE, Animation.RELATIVE_TO_SELF, or
		/// Animation.RELATIVE_TO_PARENT.
		/// </param>
		/// <param name="pivotYValue">
		/// The Y coordinate of the point about which the object
		/// is being scaled, specified as an absolute number where 0 is the
		/// top edge. (This point remains fixed while the object changes
		/// size.) This value can either be an absolute number if pivotYType
		/// is ABSOLUTE, or a percentage (where 1.0 is 100%) otherwise.
		/// </param>
		public ScaleAnimation(float fromX, float toX, float fromY, float toY, int pivotXType
			, float pivotXValue, int pivotYType, float pivotYValue)
		{
			mResources = null;
			mFromX = fromX;
			mToX = toX;
			mFromY = fromY;
			mToY = toY;
			mPivotXValue = pivotXValue;
			mPivotXType = pivotXType;
			mPivotYValue = pivotYValue;
			mPivotYType = pivotYType;
		}
示例#35
0
		internal TypedArray(android.content.res.Resources resources, int[] data, int[] indices
			, int len)
		{
			mResources = resources;
			mData = data;
			mIndices = indices;
			mLength = len;
		}
示例#36
0
		public MenuBuilder(android.content.Context context)
		{
			mContext = context;
			mResources = context.getResources();
			mItems = new java.util.ArrayList<*****@*****.**>();
			mVisibleItems = new java.util.ArrayList<*****@*****.**>
				();
			mIsVisibleItemsStale = true;
			mActionItems = new java.util.ArrayList<*****@*****.**>(
				);
			mNonActionItems = new java.util.ArrayList<*****@*****.**
				>();
			mIsActionItemsStale = true;
			setShortcutsVisibleInner(true);
		}
示例#37
0
		internal void init(android.app.LoadedApk packageInfo, android.os.IBinder activityToken
			, android.app.ActivityThread mainThread, android.content.res.Resources container
			, string basePackageName)
		{
			mPackageInfo = packageInfo;
			mBasePackageName = basePackageName != null ? basePackageName : packageInfo.mPackageName;
			mResources = mPackageInfo.getResources(mainThread);
			if (mResources != null && container != null && container.getCompatibilityInfo().applicationScale
				 != mResources.getCompatibilityInfo().applicationScale)
			{
				mResources = mainThread.getTopLevelResources(mPackageInfo.getResDir(), container.
					getCompatibilityInfo());
			}
			mMainThread = mainThread;
			mContentResolver = new android.app.ContextImpl.ApplicationContentResolver(this, mainThread
				);
			setActivityToken(activityToken);
		}
示例#38
0
		internal void init(android.content.res.Resources resources, android.app.ActivityThread
			 mainThread)
		{
			mPackageInfo = null;
			mBasePackageName = null;
			mResources = resources;
			mMainThread = mainThread;
			mContentResolver = new android.app.ContextImpl.ApplicationContentResolver(this, mainThread
				);
		}
示例#39
0
		/// <summary>Creates the top level Resources for applications with the given compatibility info.
		/// 	</summary>
		/// <remarks>Creates the top level Resources for applications with the given compatibility info.
		/// 	</remarks>
		/// <param name="resDir">the resource directory.</param>
		/// <param name="compInfo">
		/// the compability info. It will use the default compatibility info when it's
		/// null.
		/// </param>
		internal android.content.res.Resources getTopLevelResources(string resDir, android.content.res.CompatibilityInfo
			 compInfo)
		{
			android.app.ActivityThread.ResourcesKey key = new android.app.ActivityThread.ResourcesKey
				(resDir, compInfo.applicationScale);
			android.content.res.Resources r;
			lock (mPackages)
			{
				// Resources is app scale dependent.
				if (false)
				{
					android.util.Slog.w(TAG, "getTopLevelResources: " + resDir + " / " + compInfo.applicationScale
						);
				}
				[email protected]<android.content.res.Resources> wr = mActiveResources
					.get(key);
				r = wr != null ? wr.get() : null;
				//if (r != null) Slog.i(TAG, "isUpToDate " + resDir + ": " + r.getAssets().isUpToDate());
				if (r != null && r.getAssets().isUpToDate())
				{
					if (false)
					{
						android.util.Slog.w(TAG, "Returning cached resources " + r + " " + resDir + ": appScale="
							 + r.getCompatibilityInfo().applicationScale);
					}
					return r;
				}
			}
			//if (r != null) {
			//    Slog.w(TAG, "Throwing away out-of-date resources!!!! "
			//            + r + " " + resDir);
			//}
			android.content.res.AssetManager assets = new android.content.res.AssetManager();
			if (assets.addAssetPath(resDir) == 0)
			{
				return null;
			}
			//Slog.i(TAG, "Resource: key=" + key + ", display metrics=" + metrics);
			android.util.DisplayMetrics metrics = getDisplayMetricsLocked(null, false);
			r = new android.content.res.Resources(assets, metrics, getConfiguration(), compInfo
				);
			if (false)
			{
				android.util.Slog.i(TAG, "Created app resources " + resDir + " " + r + ": " + r.getConfiguration
					() + " appScale=" + r.getCompatibilityInfo().applicationScale);
			}
			lock (mPackages)
			{
				[email protected]<android.content.res.Resources> wr = mActiveResources
					.get(key);
				android.content.res.Resources existing = wr != null ? wr.get() : null;
				if (existing != null && existing.getAssets().isUpToDate())
				{
					// Someone else already created the resources while we were
					// unlocked; go ahead and use theirs.
					r.getAssets().close();
					return existing;
				}
				// XXX need to remove entries when weak references go away
				mActiveResources.put(key, new [email protected]<android.content.res.Resources
					>(r));
				return r;
			}
		}
示例#40
0
		/// <summary>
		/// Create information about a new .apk
		/// NOTE: This constructor is called with ActivityThread's lock held,
		/// so MUST NOT call back out to the activity manager.
		/// </summary>
		/// <remarks>
		/// Create information about a new .apk
		/// NOTE: This constructor is called with ActivityThread's lock held,
		/// so MUST NOT call back out to the activity manager.
		/// </remarks>
		public LoadedApk(android.app.ActivityThread activityThread, android.content.pm.ApplicationInfo
			 aInfo, android.content.res.CompatibilityInfo compatInfo, android.app.ActivityThread
			 mainThread, java.lang.ClassLoader baseLoader, bool securityViolation, bool includeCode
			)
		{
			mActivityThread = activityThread;
			mApplicationInfo = aInfo;
			mPackageName = aInfo.packageName;
			mAppDir = aInfo.sourceDir;
			mResDir = aInfo.uid == android.os.Process.myUid() ? aInfo.sourceDir : aInfo.publicSourceDir;
			mSharedLibraries = aInfo.sharedLibraryFiles;
			mDataDir = aInfo.dataDir;
			mDataDirFile = mDataDir != null ? new java.io.File(mDataDir) : null;
			mLibDir = aInfo.nativeLibraryDir;
			mBaseClassLoader = baseLoader;
			mSecurityViolation = securityViolation;
			mIncludeCode = includeCode;
			mCompatibilityInfo.set(compatInfo);
			if (mAppDir == null)
			{
				if (android.app.ActivityThread.mSystemContext == null)
				{
					android.app.ActivityThread.mSystemContext = android.app.ContextImpl.createSystemContext
						(mainThread);
					android.app.ActivityThread.mSystemContext.getResources().updateConfiguration(mainThread
						.getConfiguration(), mainThread.getDisplayMetricsLocked(compatInfo, false), compatInfo
						);
				}
				//Slog.i(TAG, "Created system resources "
				//        + mSystemContext.getResources() + ": "
				//        + mSystemContext.getResources().getConfiguration());
				mClassLoader = android.app.ActivityThread.mSystemContext.getClassLoader();
				mResources = android.app.ActivityThread.mSystemContext.getResources();
			}
		}
示例#41
0
		/// <summary>Constructor used when a ScaleAnimation is loaded from a resource.</summary>
		/// <remarks>Constructor used when a ScaleAnimation is loaded from a resource.</remarks>
		/// <param name="context">Application context to use</param>
		/// <param name="attrs">Attribute set from which to read values</param>
		public ScaleAnimation(android.content.Context context, android.util.AttributeSet 
			attrs) : base(context, attrs)
		{
			mResources = context.getResources();
			android.content.res.TypedArray a = context.obtainStyledAttributes(attrs, [email protected]
				.styleable.ScaleAnimation);
			android.util.TypedValue tv = a.peekValue([email protected]_fromXScale
				);
			mFromX = 0.0f;
			if (tv != null)
			{
				if (tv.type == android.util.TypedValue.TYPE_FLOAT)
				{
					// This is a scaling factor.
					mFromX = tv.getFloat();
				}
				else
				{
					mFromXType = tv.type;
					mFromXData = tv.data;
				}
			}
			tv = a.peekValue([email protected]_toXScale);
			mToX = 0.0f;
			if (tv != null)
			{
				if (tv.type == android.util.TypedValue.TYPE_FLOAT)
				{
					// This is a scaling factor.
					mToX = tv.getFloat();
				}
				else
				{
					mToXType = tv.type;
					mToXData = tv.data;
				}
			}
			tv = a.peekValue([email protected]_fromYScale);
			mFromY = 0.0f;
			if (tv != null)
			{
				if (tv.type == android.util.TypedValue.TYPE_FLOAT)
				{
					// This is a scaling factor.
					mFromY = tv.getFloat();
				}
				else
				{
					mFromYType = tv.type;
					mFromYData = tv.data;
				}
			}
			tv = a.peekValue([email protected]_toYScale);
			mToY = 0.0f;
			if (tv != null)
			{
				if (tv.type == android.util.TypedValue.TYPE_FLOAT)
				{
					// This is a scaling factor.
					mToY = tv.getFloat();
				}
				else
				{
					mToYType = tv.type;
					mToYData = tv.data;
				}
			}
			android.view.animation.Animation.Description d = android.view.animation.Animation
				.Description.parseValue(a.peekValue([email protected]_pivotX
				));
			mPivotXType = d.type;
			mPivotXValue = d.value;
			d = android.view.animation.Animation.Description.parseValue(a.peekValue([email protected]
				.styleable.ScaleAnimation_pivotY));
			mPivotYType = d.type;
			mPivotYValue = d.value;
			a.recycle();
		}
示例#42
0
		/// <summary>Constructor to use when building a ScaleAnimation from code</summary>
		/// <param name="fromX">
		/// Horizontal scaling factor to apply at the start of the
		/// animation
		/// </param>
		/// <param name="toX">Horizontal scaling factor to apply at the end of the animation</param>
		/// <param name="fromY">
		/// Vertical scaling factor to apply at the start of the
		/// animation
		/// </param>
		/// <param name="toY">Vertical scaling factor to apply at the end of the animation</param>
		/// <param name="pivotX">
		/// The X coordinate of the point about which the object is
		/// being scaled, specified as an absolute number where 0 is the left
		/// edge. (This point remains fixed while the object changes size.)
		/// </param>
		/// <param name="pivotY">
		/// The Y coordinate of the point about which the object is
		/// being scaled, specified as an absolute number where 0 is the top
		/// edge. (This point remains fixed while the object changes size.)
		/// </param>
		public ScaleAnimation(float fromX, float toX, float fromY, float toY, float pivotX
			, float pivotY)
		{
			mResources = null;
			mFromX = fromX;
			mToX = toX;
			mFromY = fromY;
			mToY = toY;
			mPivotXType = ABSOLUTE;
			mPivotYType = ABSOLUTE;
			mPivotXValue = pivotX;
			mPivotYValue = pivotY;
		}
示例#43
0
		/// <summary>
		/// Return a global shared Resources object that provides access to only
		/// system resources (no application resources), and is not configured for
		/// the current screen (can not use dimension units, does not change based
		/// on orientation, etc).
		/// </summary>
		/// <remarks>
		/// Return a global shared Resources object that provides access to only
		/// system resources (no application resources), and is not configured for
		/// the current screen (can not use dimension units, does not change based
		/// on orientation, etc).
		/// </remarks>
		public static android.content.res.Resources getSystem()
		{
			lock (mSync)
			{
				android.content.res.Resources ret = mSystem;
				if (ret == null)
				{
					ret = new android.content.res.Resources();
					mSystem = ret;
				}
				return ret;
			}
		}
示例#44
0
		/// <summary>Constructor to use when building a ScaleAnimation from code</summary>
		/// <param name="fromX">
		/// Horizontal scaling factor to apply at the start of the
		/// animation
		/// </param>
		/// <param name="toX">Horizontal scaling factor to apply at the end of the animation</param>
		/// <param name="fromY">
		/// Vertical scaling factor to apply at the start of the
		/// animation
		/// </param>
		/// <param name="toY">Vertical scaling factor to apply at the end of the animation</param>
		public ScaleAnimation(float fromX, float toX, float fromY, float toY)
		{
			mResources = null;
			mFromX = fromX;
			mToX = toX;
			mFromY = fromY;
			mToY = toY;
			mPivotX = 0;
			mPivotY = 0;
		}