Skip to content
This repository was archived by the owner on Jan 8, 2019. It is now read-only.

Commit 5ca12a2

Browse files
committed
- Added missing XML comments.
- Changed GetColor to ContextCompat call.
1 parent 25f4f5b commit 5ca12a2

File tree

11 files changed

+515
-20
lines changed

11 files changed

+515
-20
lines changed

Iconize/Plugin.Iconize.Droid/Controls/IconButton.cs

+65
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,53 @@
77

88
namespace Plugin.Iconize.Droid.Controls
99
{
10+
/// <summary>
11+
/// Defines the <see cref="IconButton" /> control.
12+
/// </summary>
13+
/// <seealso cref="Android.Support.V7.Widget.AppCompatButton" />
14+
/// <seealso cref="Plugin.Iconize.Droid.IHasOnViewAttachListener" />
1015
public class IconButton : AppCompatButton, IHasOnViewAttachListener
1116
{
1217
private HasOnViewAttachListenerDelegate _delegate;
1318

19+
/// <summary>
20+
/// Initializes a new instance of the <see cref="IconButton"/> class.
21+
/// </summary>
22+
/// <param name="context">The context.</param>
1423
public IconButton(Context context)
1524
: base(context)
1625
{
1726
Init();
1827
}
1928

29+
/// <summary>
30+
/// Initializes a new instance of the <see cref="IconButton"/> class.
31+
/// </summary>
32+
/// <param name="context">The context.</param>
33+
/// <param name="attrs">The attrs.</param>
2034
public IconButton(Context context, IAttributeSet attrs)
2135
: base(context, attrs)
2236
{
2337
Init();
2438
}
2539

40+
/// <summary>
41+
/// Initializes a new instance of the <see cref="IconButton"/> class.
42+
/// </summary>
43+
/// <param name="javaReference">The java reference.</param>
44+
/// <param name="transfer">The transfer.</param>
2645
public IconButton(IntPtr javaReference, JniHandleOwnership transfer)
2746
: base(javaReference, transfer)
2847
{
2948
Init();
3049
}
3150

51+
/// <summary>
52+
/// Initializes a new instance of the <see cref="IconButton"/> class.
53+
/// </summary>
54+
/// <param name="context">The context.</param>
55+
/// <param name="attrs">The attrs.</param>
56+
/// <param name="defStyleAttr">The definition style attribute.</param>
3257
public IconButton(Context context, IAttributeSet attrs, Int32 defStyleAttr)
3358
: base(context, attrs, defStyleAttr)
3459
{
@@ -40,24 +65,64 @@ private void Init()
4065
TransformationMethod = null;
4166
}
4267

68+
/// <summary>
69+
/// Sets the text.
70+
/// </summary>
71+
/// <param name="text">The text.</param>
72+
/// <param name="type">The type.</param>
4373
public override void SetText(ICharSequence text, BufferType type)
4474
{
4575
base.SetText(this.Compute(Context, text, TextSize), type);
4676
}
4777

78+
/// <summary>
79+
/// Sets the on view attach listener.
80+
/// </summary>
81+
/// <param name="listener">The listener.</param>
4882
public void SetOnViewAttachListener(IOnViewAttachListener listener)
4983
{
5084
if (_delegate == null)
5185
_delegate = new HasOnViewAttachListenerDelegate(this);
5286
_delegate.SetOnViewAttachListener(listener);
5387
}
5488

89+
/// <summary>
90+
/// This is called when the view is attached to a window.
91+
/// </summary>
92+
/// <remarks>
93+
/// <para tool="javadoc-to-mdoc">This is called when the view is attached to a window. At this point it
94+
/// has a Surface and will start drawing. Note that this function is
95+
/// guaranteed to be called before <c><see cref="M:Android.Views.View.OnDraw(Android.Graphics.Canvas)" /></c>,
96+
/// however it may be called any time before the first onDraw -- including
97+
/// before or after <c><see cref="M:Android.Views.View.OnMeasure(System.Int32, System.Int32)" /></c>.</para>
98+
/// <para tool="javadoc-to-mdoc">
99+
/// <format type="text/html">
100+
/// <a href="http://developer.android.com/reference/android/view/View.html#onAttachedToWindow()" target="_blank">[Android Documentation]</a>
101+
/// </format>
102+
/// </para>
103+
/// </remarks>
104+
/// <since version="Added in API level 1" />
105+
/// <altmember cref="M:Android.Views.View.OnDetachedFromWindow" />
55106
protected override void OnAttachedToWindow()
56107
{
57108
base.OnAttachedToWindow();
58109
_delegate.OnAttachedToWindow();
59110
}
60111

112+
/// <summary>
113+
/// This is called when the view is detached from a window.
114+
/// </summary>
115+
/// <remarks>
116+
/// <para tool="javadoc-to-mdoc">This is called when the view is detached from a window. At this point it
117+
/// no longer has a surface for drawing.</para>
118+
/// <para tool="javadoc-to-mdoc">
119+
/// <format type="text/html">
120+
/// <a href="http://developer.android.com/reference/android/view/View.html#onDetachedFromWindow()" target="_blank">[Android Documentation]</a>
121+
/// </format>
122+
/// </para>
123+
/// </remarks>
124+
/// <since version="Added in API level 1" />
125+
/// <altmember cref="M:Android.Views.View.OnAttachedToWindow" />
61126
protected override void OnDetachedFromWindow()
62127
{
63128
base.OnDetachedFromWindow();

Iconize/Plugin.Iconize.Droid/Controls/IconDrawable.cs

+94-1
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,24 @@
22
using Android.Content;
33
using Android.Graphics;
44
using Android.Graphics.Drawables;
5+
using Android.Support.V4.Content;
56
using Android.Text;
67
using Android.Util;
78
using R = Android.Resource;
89

910
namespace 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
}

Iconize/Plugin.Iconize.Droid/Controls/IconTextView.cs

+65
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,53 @@
77

88
namespace Plugin.Iconize.Droid.Controls
99
{
10+
/// <summary>
11+
/// Defines the <see cref="IconTextView" /> control.
12+
/// </summary>
13+
/// <seealso cref="Android.Widget.TextView" />
14+
/// <seealso cref="Plugin.Iconize.Droid.IHasOnViewAttachListener" />
1015
public class IconTextView : TextView, IHasOnViewAttachListener
1116
{
1217
private HasOnViewAttachListenerDelegate _delegate;
1318

19+
/// <summary>
20+
/// Initializes a new instance of the <see cref="IconTextView"/> class.
21+
/// </summary>
22+
/// <param name="context">The context.</param>
1423
public IconTextView(Context context)
1524
: base(context)
1625
{
1726
Init();
1827
}
1928

29+
/// <summary>
30+
/// Initializes a new instance of the <see cref="IconTextView"/> class.
31+
/// </summary>
32+
/// <param name="context">The context.</param>
33+
/// <param name="attrs">The attrs.</param>
2034
public IconTextView(Context context, IAttributeSet attrs)
2135
: base(context, attrs)
2236
{
2337
Init();
2438
}
2539

40+
/// <summary>
41+
/// Initializes a new instance of the <see cref="IconTextView"/> class.
42+
/// </summary>
43+
/// <param name="javaReference">The java reference.</param>
44+
/// <param name="transfer">The transfer.</param>
2645
public IconTextView(IntPtr javaReference, JniHandleOwnership transfer)
2746
: base(javaReference, transfer)
2847
{
2948
Init();
3049
}
3150

51+
/// <summary>
52+
/// Initializes a new instance of the <see cref="IconTextView"/> class.
53+
/// </summary>
54+
/// <param name="context">The context.</param>
55+
/// <param name="attrs">The attrs.</param>
56+
/// <param name="defStyleAttr">The definition style attribute.</param>
3257
public IconTextView(Context context, IAttributeSet attrs, Int32 defStyleAttr)
3358
: base(context, attrs, defStyleAttr)
3459
{
@@ -40,24 +65,64 @@ private void Init()
4065
TransformationMethod = null;
4166
}
4267

68+
/// <summary>
69+
/// Sets the text.
70+
/// </summary>
71+
/// <param name="text">The text.</param>
72+
/// <param name="type">The type.</param>
4373
public override void SetText(ICharSequence text, BufferType type)
4474
{
4575
base.SetText(this.Compute(Context, text, TextSize), type);
4676
}
4777

78+
/// <summary>
79+
/// Sets the on view attach listener.
80+
/// </summary>
81+
/// <param name="listener">The listener.</param>
4882
public void SetOnViewAttachListener(IOnViewAttachListener listener)
4983
{
5084
if (_delegate == null)
5185
_delegate = new HasOnViewAttachListenerDelegate(this);
5286
_delegate.SetOnViewAttachListener(listener);
5387
}
5488

89+
/// <summary>
90+
/// This is called when the view is attached to a window.
91+
/// </summary>
92+
/// <remarks>
93+
/// <para tool="javadoc-to-mdoc">This is called when the view is attached to a window. At this point it
94+
/// has a Surface and will start drawing. Note that this function is
95+
/// guaranteed to be called before <c><see cref="M:Android.Views.View.OnDraw(Android.Graphics.Canvas)" /></c>,
96+
/// however it may be called any time before the first onDraw -- including
97+
/// before or after <c><see cref="M:Android.Views.View.OnMeasure(System.Int32, System.Int32)" /></c>.</para>
98+
/// <para tool="javadoc-to-mdoc">
99+
/// <format type="text/html">
100+
/// <a href="http://developer.android.com/reference/android/view/View.html#onAttachedToWindow()" target="_blank">[Android Documentation]</a>
101+
/// </format>
102+
/// </para>
103+
/// </remarks>
104+
/// <since version="Added in API level 1" />
105+
/// <altmember cref="M:Android.Views.View.OnDetachedFromWindow" />
55106
protected override void OnAttachedToWindow()
56107
{
57108
base.OnAttachedToWindow();
58109
_delegate.OnAttachedToWindow();
59110
}
60111

112+
/// <summary>
113+
/// This is called when the view is detached from a window.
114+
/// </summary>
115+
/// <remarks>
116+
/// <para tool="javadoc-to-mdoc">This is called when the view is detached from a window. At this point it
117+
/// no longer has a surface for drawing.</para>
118+
/// <para tool="javadoc-to-mdoc">
119+
/// <format type="text/html">
120+
/// <a href="http://developer.android.com/reference/android/view/View.html#onDetachedFromWindow()" target="_blank">[Android Documentation]</a>
121+
/// </format>
122+
/// </para>
123+
/// </remarks>
124+
/// <since version="Added in API level 1" />
125+
/// <altmember cref="M:Android.Views.View.OnAttachedToWindow" />
61126
protected override void OnDetachedFromWindow()
62127
{
63128
base.OnDetachedFromWindow();

0 commit comments

Comments
 (0)