22using Android . Content ;
33using Android . Graphics ;
44using Android . Graphics . Drawables ;
5+ using Android . Support . V4 . Content ;
56using Android . Text ;
67using Android . Util ;
78using R = Android . Resource ;
89
910namespace Plugin . Iconize . Droid . Controls
1011{
12+ /// <summary>
13+ /// Defines the <see cref="IconDrawable" /> drawable.
14+ /// </summary>
15+ /// <seealso cref="Android.Graphics.Drawables.Drawable" />
1116 public class IconDrawable : Drawable
1217 {
1318 #region Constants
1419
20+ /// <summary>
21+ /// The android actionbar icon size dp
22+ /// </summary>
1523 public const Int32 ANDROID_ACTIONBAR_ICON_SIZE_DP = 24 ;
1624
1725 #endregion Constants
@@ -32,12 +40,97 @@ public class IconDrawable : Drawable
3240
3341 #region Properties
3442
43+ /// <summary>
44+ /// Return the intrinsic height of the underlying drawable object.
45+ /// </summary>
46+ /// <value>
47+ /// To be added.
48+ /// </value>
49+ /// <remarks>
50+ /// <para tool="javadoc-to-mdoc">Return the intrinsic height of the underlying drawable object. Returns
51+ /// -1 if it has no intrinsic height, such as with a solid color.
52+ /// </para>
53+ /// <para tool="javadoc-to-mdoc">
54+ /// <format type="text/html">
55+ /// <a href="http://developer.android.com/reference/android/graphics/drawable/Drawable.html#getIntrinsicHeight()" target="_blank">[Android Documentation]</a>
56+ /// </format>
57+ /// </para>
58+ /// </remarks>
59+ /// <since version="Added in API level 1" />
3560 public override Int32 IntrinsicHeight => _size ;
3661
62+ /// <summary>
63+ /// Return the intrinsic width of the underlying drawable object.
64+ /// </summary>
65+ /// <value>
66+ /// To be added.
67+ /// </value>
68+ /// <remarks>
69+ /// <para tool="javadoc-to-mdoc">Return the intrinsic width of the underlying drawable object. Returns
70+ /// -1 if it has no intrinsic width, such as with a solid color.
71+ /// </para>
72+ /// <para tool="javadoc-to-mdoc">
73+ /// <format type="text/html">
74+ /// <a href="http://developer.android.com/reference/android/graphics/drawable/Drawable.html#getIntrinsicWidth()" target="_blank">[Android Documentation]</a>
75+ /// </format>
76+ /// </para>
77+ /// </remarks>
78+ /// <since version="Added in API level 1" />
3779 public override Int32 IntrinsicWidth => _size ;
3880
81+ /// <summary>
82+ /// Indicates whether this view will change its appearance based on state.
83+ /// </summary>
84+ /// <value>
85+ /// To be added.
86+ /// </value>
87+ /// <remarks>
88+ /// <para tool="javadoc-to-mdoc">Indicates whether this view will change its appearance based on state.
89+ /// Clients can use this to determine whether it is necessary to calculate
90+ /// their state and call setState.</para>
91+ /// <para tool="javadoc-to-mdoc">
92+ /// <format type="text/html">
93+ /// <a href="http://developer.android.com/reference/android/graphics/drawable/Drawable.html#isStateful()" target="_blank">[Android Documentation]</a>
94+ /// </format>
95+ /// </para>
96+ /// </remarks>
97+ /// <since version="Added in API level 1" />
98+ /// <altmember cref="M:Android.Graphics.Drawables.Drawable.SetState(System.Int32[])" />
3999 public override Boolean IsStateful => true ;
40100
101+ /// <summary>
102+ /// Return the opacity/transparency of this Drawable.
103+ /// </summary>
104+ /// <value>
105+ /// To be added.
106+ /// </value>
107+ /// <remarks>
108+ /// <para tool="javadoc-to-mdoc">Return the opacity/transparency of this Drawable. The returned value is
109+ /// one of the abstract format constants in
110+ /// <c><see cref="T:Android.Graphics.PixelFormat" /></c>:
111+ /// <c><see cref="F:Android.Graphics.Format.Unknown" /></c>,
112+ /// <c><see cref="F:Android.Graphics.Format.Translucent" /></c>,
113+ /// <c><see cref="F:Android.Graphics.Format.Transparent" /></c>, or
114+ /// <c><see cref="F:Android.Graphics.Format.Opaque" /></c>.
115+ /// </para>
116+ /// <para tool="javadoc-to-mdoc">Generally a Drawable should be as conservative as possible with the
117+ /// value it returns. For example, if it contains multiple child drawables
118+ /// and only shows one of them at a time, if only one of the children is
119+ /// TRANSLUCENT and the others are OPAQUE then TRANSLUCENT should be
120+ /// returned. You can use the method <c><see cref="M:Android.Graphics.Drawables.Drawable.ResolveOpacity(System.Int32, System.Int32)" /></c> to perform a
121+ /// standard reduction of two opacities to the appropriate single output.
122+ /// </para>
123+ /// <para tool="javadoc-to-mdoc">Note that the returned value does <i>not</i> take into account a
124+ /// custom alpha or color filter that has been applied by the client through
125+ /// the <c><see cref="M:Android.Graphics.Drawables.Drawable.SetAlpha(System.Int32)" /></c> or <c><see cref="M:Android.Graphics.Drawables.Drawable.SetColorFilter(Android.Graphics.ColorFilter)" /></c> methods.</para>
126+ /// <para tool="javadoc-to-mdoc">
127+ /// <format type="text/html">
128+ /// <a href="http://developer.android.com/reference/android/graphics/drawable/Drawable.html#getOpacity()" target="_blank">[Android Documentation]</a>
129+ /// </format>
130+ /// </para>
131+ /// </remarks>
132+ /// <since version="Added in API level 1" />
133+ /// <altmember cref="T:Android.Graphics.PixelFormat" />
41134 public override Int32 Opacity => _alpha ;
42135
43136 #endregion Properties
@@ -157,7 +250,7 @@ public IconDrawable Color(Int32 color)
157250 /// <returns>The current IconDrawable for chaining.</returns>
158251 public IconDrawable ColorRes ( Int32 colorRes )
159252 {
160- _paint . Color = _context . Resources . GetColor ( colorRes ) ;
253+ _paint . Color = new Color ( ContextCompat . GetColor ( _context , colorRes ) ) ;
161254 InvalidateSelf ( ) ;
162255 return this ;
163256 }
0 commit comments