Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Tiny changes

  • Loading branch information...
commit f55dcc4f011a21234c90aace5e07019c985e9b70 1 parent e1b6e93
@Todd-Davies authored
View
760 gen/com/todddavies/components/progressbar/R.java
@@ -1,380 +1,380 @@
-/* AUTO-GENERATED FILE. DO NOT MODIFY.
- *
- * This class was automatically generated by the
- * aapt tool from the resource data it found. It
- * should not be modified by hand.
- */
-
-package com.todddavies.components.progressbar;
-
-public final class R {
- public static final class attr {
- /** <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
-"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
-<p>This may also be a reference to a resource (in the form
-"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
-theme attribute (in the form
-"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
-containing a value of this type.
- */
- public static final int barColor=0x7f010003;
- /** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
-Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
-in (inches), mm (millimeters).
-<p>This may also be a reference to a resource (in the form
-"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
-theme attribute (in the form
-"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
-containing a value of this type.
- */
- public static final int barLength=0x7f01000b;
- /** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
-Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
-in (inches), mm (millimeters).
-<p>This may also be a reference to a resource (in the form
-"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
-theme attribute (in the form
-"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
-containing a value of this type.
- */
- public static final int barWidth=0x7f01000a;
- /** <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
-"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
-<p>This may also be a reference to a resource (in the form
-"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
-theme attribute (in the form
-"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
-containing a value of this type.
- */
- public static final int circleColor=0x7f010008;
- /** <p>Must be an integer value, such as "<code>100</code>".
-<p>This may also be a reference to a resource (in the form
-"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
-theme attribute (in the form
-"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
-containing a value of this type.
- */
- public static final int delayMillis=0x7f010007;
- /** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
-Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
-in (inches), mm (millimeters).
-<p>This may also be a reference to a resource (in the form
-"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
-theme attribute (in the form
-"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
-containing a value of this type.
- */
- public static final int radius=0x7f010009;
- /** <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
-"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
-<p>This may also be a reference to a resource (in the form
-"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
-theme attribute (in the form
-"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
-containing a value of this type.
- */
- public static final int rimColor=0x7f010004;
- /** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
-Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
-in (inches), mm (millimeters).
-<p>This may also be a reference to a resource (in the form
-"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
-theme attribute (in the form
-"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
-containing a value of this type.
- */
- public static final int rimWidth=0x7f010005;
- /** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
-Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
-in (inches), mm (millimeters).
-<p>This may also be a reference to a resource (in the form
-"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
-theme attribute (in the form
-"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
-containing a value of this type.
- */
- public static final int spinSpeed=0x7f010006;
- /** <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character.
-<p>This may also be a reference to a resource (in the form
-"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
-theme attribute (in the form
-"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
-containing a value of this type.
- */
- public static final int text=0x7f010000;
- /** <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
-"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
-<p>This may also be a reference to a resource (in the form
-"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
-theme attribute (in the form
-"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
-containing a value of this type.
- */
- public static final int textColor=0x7f010001;
- /** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
-Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
-in (inches), mm (millimeters).
-<p>This may also be a reference to a resource (in the form
-"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
-theme attribute (in the form
-"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
-containing a value of this type.
- */
- public static final int textSize=0x7f010002;
- }
- public static final class drawable {
- public static final int header=0x7f020000;
- public static final int ic_launcher=0x7f020001;
- public static final int icon=0x7f020002;
- public static final int login_gradient=0x7f020003;
- public static final int login_gradient_flip=0x7f020004;
- public static final int logo=0x7f020005;
- }
- public static final class id {
- public static final int RelativeLayout01=0x7f050005;
- public static final int btn_increment=0x7f050009;
- public static final int btn_spin=0x7f050008;
- public static final int iv_login_header_image=0x7f050001;
- public static final int progressBar=0x7f050004;
- public static final int progressBarFour=0x7f05000c;
- public static final int progressBarThree=0x7f05000b;
- public static final int progressBarTwo=0x7f05000a;
- public static final int progressImage=0x7f050006;
- public static final int rl_login_header=0x7f050000;
- public static final int tv_progressText=0x7f050007;
- public static final int v_login_gradient=0x7f050002;
- public static final int vf_login_flipper=0x7f050003;
- }
- public static final class layout {
- public static final int main=0x7f030000;
- public static final int progress_spinner=0x7f030001;
- public static final int progress_wheel_activity=0x7f030002;
- }
- public static final class string {
- public static final int app_name=0x7f040001;
- public static final int hello=0x7f040000;
- }
- public static final class styleable {
- /** Attributes that can be used with a ProgressWheel.
- <p>Includes the following attributes:</p>
- <table>
- <colgroup align="left" />
- <colgroup align="left" />
- <tr><th>Attribute</th><th>Description</th></tr>
- <tr><td><code>{@link #ProgressWheel_barColor com.todddavies.components.progressbar:barColor}</code></td><td></td></tr>
- <tr><td><code>{@link #ProgressWheel_barLength com.todddavies.components.progressbar:barLength}</code></td><td></td></tr>
- <tr><td><code>{@link #ProgressWheel_barWidth com.todddavies.components.progressbar:barWidth}</code></td><td></td></tr>
- <tr><td><code>{@link #ProgressWheel_circleColor com.todddavies.components.progressbar:circleColor}</code></td><td></td></tr>
- <tr><td><code>{@link #ProgressWheel_delayMillis com.todddavies.components.progressbar:delayMillis}</code></td><td></td></tr>
- <tr><td><code>{@link #ProgressWheel_radius com.todddavies.components.progressbar:radius}</code></td><td></td></tr>
- <tr><td><code>{@link #ProgressWheel_rimColor com.todddavies.components.progressbar:rimColor}</code></td><td></td></tr>
- <tr><td><code>{@link #ProgressWheel_rimWidth com.todddavies.components.progressbar:rimWidth}</code></td><td></td></tr>
- <tr><td><code>{@link #ProgressWheel_spinSpeed com.todddavies.components.progressbar:spinSpeed}</code></td><td></td></tr>
- <tr><td><code>{@link #ProgressWheel_text com.todddavies.components.progressbar:text}</code></td><td></td></tr>
- <tr><td><code>{@link #ProgressWheel_textColor com.todddavies.components.progressbar:textColor}</code></td><td></td></tr>
- <tr><td><code>{@link #ProgressWheel_textSize com.todddavies.components.progressbar:textSize}</code></td><td></td></tr>
- </table>
- @see #ProgressWheel_barColor
- @see #ProgressWheel_barLength
- @see #ProgressWheel_barWidth
- @see #ProgressWheel_circleColor
- @see #ProgressWheel_delayMillis
- @see #ProgressWheel_radius
- @see #ProgressWheel_rimColor
- @see #ProgressWheel_rimWidth
- @see #ProgressWheel_spinSpeed
- @see #ProgressWheel_text
- @see #ProgressWheel_textColor
- @see #ProgressWheel_textSize
- */
- public static final int[] ProgressWheel = {
- 0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003,
- 0x7f010004, 0x7f010005, 0x7f010006, 0x7f010007,
- 0x7f010008, 0x7f010009, 0x7f01000a, 0x7f01000b
- };
- /**
- <p>This symbol is the offset where the {@link com.todddavies.components.progressbar.R.attr#barColor}
- attribute's value can be found in the {@link #ProgressWheel} array.
-
-
- <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
-"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
-<p>This may also be a reference to a resource (in the form
-"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
-theme attribute (in the form
-"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
-containing a value of this type.
- @attr name android:barColor
- */
- public static final int ProgressWheel_barColor = 3;
- /**
- <p>This symbol is the offset where the {@link com.todddavies.components.progressbar.R.attr#barLength}
- attribute's value can be found in the {@link #ProgressWheel} array.
-
-
- <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
-Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
-in (inches), mm (millimeters).
-<p>This may also be a reference to a resource (in the form
-"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
-theme attribute (in the form
-"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
-containing a value of this type.
- @attr name android:barLength
- */
- public static final int ProgressWheel_barLength = 11;
- /**
- <p>This symbol is the offset where the {@link com.todddavies.components.progressbar.R.attr#barWidth}
- attribute's value can be found in the {@link #ProgressWheel} array.
-
-
- <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
-Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
-in (inches), mm (millimeters).
-<p>This may also be a reference to a resource (in the form
-"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
-theme attribute (in the form
-"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
-containing a value of this type.
- @attr name android:barWidth
- */
- public static final int ProgressWheel_barWidth = 10;
- /**
- <p>This symbol is the offset where the {@link com.todddavies.components.progressbar.R.attr#circleColor}
- attribute's value can be found in the {@link #ProgressWheel} array.
-
-
- <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
-"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
-<p>This may also be a reference to a resource (in the form
-"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
-theme attribute (in the form
-"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
-containing a value of this type.
- @attr name android:circleColor
- */
- public static final int ProgressWheel_circleColor = 8;
- /**
- <p>This symbol is the offset where the {@link com.todddavies.components.progressbar.R.attr#delayMillis}
- attribute's value can be found in the {@link #ProgressWheel} array.
-
-
- <p>Must be an integer value, such as "<code>100</code>".
-<p>This may also be a reference to a resource (in the form
-"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
-theme attribute (in the form
-"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
-containing a value of this type.
- @attr name android:delayMillis
- */
- public static final int ProgressWheel_delayMillis = 7;
- /**
- <p>This symbol is the offset where the {@link com.todddavies.components.progressbar.R.attr#radius}
- attribute's value can be found in the {@link #ProgressWheel} array.
-
-
- <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
-Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
-in (inches), mm (millimeters).
-<p>This may also be a reference to a resource (in the form
-"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
-theme attribute (in the form
-"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
-containing a value of this type.
- @attr name android:radius
- */
- public static final int ProgressWheel_radius = 9;
- /**
- <p>This symbol is the offset where the {@link com.todddavies.components.progressbar.R.attr#rimColor}
- attribute's value can be found in the {@link #ProgressWheel} array.
-
-
- <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
-"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
-<p>This may also be a reference to a resource (in the form
-"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
-theme attribute (in the form
-"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
-containing a value of this type.
- @attr name android:rimColor
- */
- public static final int ProgressWheel_rimColor = 4;
- /**
- <p>This symbol is the offset where the {@link com.todddavies.components.progressbar.R.attr#rimWidth}
- attribute's value can be found in the {@link #ProgressWheel} array.
-
-
- <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
-Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
-in (inches), mm (millimeters).
-<p>This may also be a reference to a resource (in the form
-"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
-theme attribute (in the form
-"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
-containing a value of this type.
- @attr name android:rimWidth
- */
- public static final int ProgressWheel_rimWidth = 5;
- /**
- <p>This symbol is the offset where the {@link com.todddavies.components.progressbar.R.attr#spinSpeed}
- attribute's value can be found in the {@link #ProgressWheel} array.
-
-
- <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
-Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
-in (inches), mm (millimeters).
-<p>This may also be a reference to a resource (in the form
-"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
-theme attribute (in the form
-"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
-containing a value of this type.
- @attr name android:spinSpeed
- */
- public static final int ProgressWheel_spinSpeed = 6;
- /**
- <p>This symbol is the offset where the {@link com.todddavies.components.progressbar.R.attr#text}
- attribute's value can be found in the {@link #ProgressWheel} array.
-
-
- <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character.
-<p>This may also be a reference to a resource (in the form
-"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
-theme attribute (in the form
-"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
-containing a value of this type.
- @attr name android:text
- */
- public static final int ProgressWheel_text = 0;
- /**
- <p>This symbol is the offset where the {@link com.todddavies.components.progressbar.R.attr#textColor}
- attribute's value can be found in the {@link #ProgressWheel} array.
-
-
- <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
-"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
-<p>This may also be a reference to a resource (in the form
-"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
-theme attribute (in the form
-"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
-containing a value of this type.
- @attr name android:textColor
- */
- public static final int ProgressWheel_textColor = 1;
- /**
- <p>This symbol is the offset where the {@link com.todddavies.components.progressbar.R.attr#textSize}
- attribute's value can be found in the {@link #ProgressWheel} array.
-
-
- <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
-Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
-in (inches), mm (millimeters).
-<p>This may also be a reference to a resource (in the form
-"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
-theme attribute (in the form
-"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
-containing a value of this type.
- @attr name android:textSize
- */
- public static final int ProgressWheel_textSize = 2;
- };
-}
+/* AUTO-GENERATED FILE. DO NOT MODIFY.
+ *
+ * This class was automatically generated by the
+ * aapt tool from the resource data it found. It
+ * should not be modified by hand.
+ */
+
+package com.todddavies.components.progressbar;
+
+public final class R {
+ public static final class attr {
+ /** <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
+"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
+<p>This may also be a reference to a resource (in the form
+"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
+theme attribute (in the form
+"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
+containing a value of this type.
+ */
+ public static final int barColor=0x7f010003;
+ /** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
+Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
+in (inches), mm (millimeters).
+<p>This may also be a reference to a resource (in the form
+"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
+theme attribute (in the form
+"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
+containing a value of this type.
+ */
+ public static final int barLength=0x7f01000b;
+ /** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
+Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
+in (inches), mm (millimeters).
+<p>This may also be a reference to a resource (in the form
+"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
+theme attribute (in the form
+"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
+containing a value of this type.
+ */
+ public static final int barWidth=0x7f01000a;
+ /** <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
+"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
+<p>This may also be a reference to a resource (in the form
+"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
+theme attribute (in the form
+"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
+containing a value of this type.
+ */
+ public static final int circleColor=0x7f010008;
+ /** <p>Must be an integer value, such as "<code>100</code>".
+<p>This may also be a reference to a resource (in the form
+"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
+theme attribute (in the form
+"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
+containing a value of this type.
+ */
+ public static final int delayMillis=0x7f010007;
+ /** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
+Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
+in (inches), mm (millimeters).
+<p>This may also be a reference to a resource (in the form
+"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
+theme attribute (in the form
+"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
+containing a value of this type.
+ */
+ public static final int radius=0x7f010009;
+ /** <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
+"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
+<p>This may also be a reference to a resource (in the form
+"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
+theme attribute (in the form
+"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
+containing a value of this type.
+ */
+ public static final int rimColor=0x7f010004;
+ /** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
+Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
+in (inches), mm (millimeters).
+<p>This may also be a reference to a resource (in the form
+"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
+theme attribute (in the form
+"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
+containing a value of this type.
+ */
+ public static final int rimWidth=0x7f010005;
+ /** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
+Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
+in (inches), mm (millimeters).
+<p>This may also be a reference to a resource (in the form
+"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
+theme attribute (in the form
+"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
+containing a value of this type.
+ */
+ public static final int spinSpeed=0x7f010006;
+ /** <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character.
+<p>This may also be a reference to a resource (in the form
+"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
+theme attribute (in the form
+"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
+containing a value of this type.
+ */
+ public static final int text=0x7f010000;
+ /** <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
+"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
+<p>This may also be a reference to a resource (in the form
+"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
+theme attribute (in the form
+"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
+containing a value of this type.
+ */
+ public static final int textColor=0x7f010001;
+ /** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
+Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
+in (inches), mm (millimeters).
+<p>This may also be a reference to a resource (in the form
+"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
+theme attribute (in the form
+"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
+containing a value of this type.
+ */
+ public static final int textSize=0x7f010002;
+ }
+ public static final class drawable {
+ public static final int header=0x7f020000;
+ public static final int ic_launcher=0x7f020001;
+ public static final int icon=0x7f020002;
+ public static final int login_gradient=0x7f020003;
+ public static final int login_gradient_flip=0x7f020004;
+ public static final int logo=0x7f020005;
+ }
+ public static final class id {
+ public static final int RelativeLayout01=0x7f050005;
+ public static final int btn_increment=0x7f050009;
+ public static final int btn_spin=0x7f050008;
+ public static final int iv_login_header_image=0x7f050001;
+ public static final int progressBar=0x7f050004;
+ public static final int progressBarFour=0x7f05000c;
+ public static final int progressBarThree=0x7f05000b;
+ public static final int progressBarTwo=0x7f05000a;
+ public static final int progressImage=0x7f050006;
+ public static final int rl_login_header=0x7f050000;
+ public static final int tv_progressText=0x7f050007;
+ public static final int v_login_gradient=0x7f050002;
+ public static final int vf_login_flipper=0x7f050003;
+ }
+ public static final class layout {
+ public static final int main=0x7f030000;
+ public static final int progress_spinner=0x7f030001;
+ public static final int progress_wheel_activity=0x7f030002;
+ }
+ public static final class string {
+ public static final int app_name=0x7f040001;
+ public static final int hello=0x7f040000;
+ }
+ public static final class styleable {
+ /** Attributes that can be used with a ProgressWheel.
+ <p>Includes the following attributes:</p>
+ <table>
+ <colgroup align="left" />
+ <colgroup align="left" />
+ <tr><th>Attribute</th><th>Description</th></tr>
+ <tr><td><code>{@link #ProgressWheel_barColor com.todddavies.components.progressbar:barColor}</code></td><td></td></tr>
+ <tr><td><code>{@link #ProgressWheel_barLength com.todddavies.components.progressbar:barLength}</code></td><td></td></tr>
+ <tr><td><code>{@link #ProgressWheel_barWidth com.todddavies.components.progressbar:barWidth}</code></td><td></td></tr>
+ <tr><td><code>{@link #ProgressWheel_circleColor com.todddavies.components.progressbar:circleColor}</code></td><td></td></tr>
+ <tr><td><code>{@link #ProgressWheel_delayMillis com.todddavies.components.progressbar:delayMillis}</code></td><td></td></tr>
+ <tr><td><code>{@link #ProgressWheel_radius com.todddavies.components.progressbar:radius}</code></td><td></td></tr>
+ <tr><td><code>{@link #ProgressWheel_rimColor com.todddavies.components.progressbar:rimColor}</code></td><td></td></tr>
+ <tr><td><code>{@link #ProgressWheel_rimWidth com.todddavies.components.progressbar:rimWidth}</code></td><td></td></tr>
+ <tr><td><code>{@link #ProgressWheel_spinSpeed com.todddavies.components.progressbar:spinSpeed}</code></td><td></td></tr>
+ <tr><td><code>{@link #ProgressWheel_text com.todddavies.components.progressbar:text}</code></td><td></td></tr>
+ <tr><td><code>{@link #ProgressWheel_textColor com.todddavies.components.progressbar:textColor}</code></td><td></td></tr>
+ <tr><td><code>{@link #ProgressWheel_textSize com.todddavies.components.progressbar:textSize}</code></td><td></td></tr>
+ </table>
+ @see #ProgressWheel_barColor
+ @see #ProgressWheel_barLength
+ @see #ProgressWheel_barWidth
+ @see #ProgressWheel_circleColor
+ @see #ProgressWheel_delayMillis
+ @see #ProgressWheel_radius
+ @see #ProgressWheel_rimColor
+ @see #ProgressWheel_rimWidth
+ @see #ProgressWheel_spinSpeed
+ @see #ProgressWheel_text
+ @see #ProgressWheel_textColor
+ @see #ProgressWheel_textSize
+ */
+ public static final int[] ProgressWheel = {
+ 0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003,
+ 0x7f010004, 0x7f010005, 0x7f010006, 0x7f010007,
+ 0x7f010008, 0x7f010009, 0x7f01000a, 0x7f01000b
+ };
+ /**
+ <p>This symbol is the offset where the {@link com.todddavies.components.progressbar.R.attr#barColor}
+ attribute's value can be found in the {@link #ProgressWheel} array.
+
+
+ <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
+"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
+<p>This may also be a reference to a resource (in the form
+"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
+theme attribute (in the form
+"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
+containing a value of this type.
+ @attr name android:barColor
+ */
+ public static final int ProgressWheel_barColor = 3;
+ /**
+ <p>This symbol is the offset where the {@link com.todddavies.components.progressbar.R.attr#barLength}
+ attribute's value can be found in the {@link #ProgressWheel} array.
+
+
+ <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
+Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
+in (inches), mm (millimeters).
+<p>This may also be a reference to a resource (in the form
+"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
+theme attribute (in the form
+"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
+containing a value of this type.
+ @attr name android:barLength
+ */
+ public static final int ProgressWheel_barLength = 11;
+ /**
+ <p>This symbol is the offset where the {@link com.todddavies.components.progressbar.R.attr#barWidth}
+ attribute's value can be found in the {@link #ProgressWheel} array.
+
+
+ <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
+Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
+in (inches), mm (millimeters).
+<p>This may also be a reference to a resource (in the form
+"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
+theme attribute (in the form
+"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
+containing a value of this type.
+ @attr name android:barWidth
+ */
+ public static final int ProgressWheel_barWidth = 10;
+ /**
+ <p>This symbol is the offset where the {@link com.todddavies.components.progressbar.R.attr#circleColor}
+ attribute's value can be found in the {@link #ProgressWheel} array.
+
+
+ <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
+"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
+<p>This may also be a reference to a resource (in the form
+"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
+theme attribute (in the form
+"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
+containing a value of this type.
+ @attr name android:circleColor
+ */
+ public static final int ProgressWheel_circleColor = 8;
+ /**
+ <p>This symbol is the offset where the {@link com.todddavies.components.progressbar.R.attr#delayMillis}
+ attribute's value can be found in the {@link #ProgressWheel} array.
+
+
+ <p>Must be an integer value, such as "<code>100</code>".
+<p>This may also be a reference to a resource (in the form
+"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
+theme attribute (in the form
+"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
+containing a value of this type.
+ @attr name android:delayMillis
+ */
+ public static final int ProgressWheel_delayMillis = 7;
+ /**
+ <p>This symbol is the offset where the {@link com.todddavies.components.progressbar.R.attr#radius}
+ attribute's value can be found in the {@link #ProgressWheel} array.
+
+
+ <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
+Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
+in (inches), mm (millimeters).
+<p>This may also be a reference to a resource (in the form
+"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
+theme attribute (in the form
+"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
+containing a value of this type.
+ @attr name android:radius
+ */
+ public static final int ProgressWheel_radius = 9;
+ /**
+ <p>This symbol is the offset where the {@link com.todddavies.components.progressbar.R.attr#rimColor}
+ attribute's value can be found in the {@link #ProgressWheel} array.
+
+
+ <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
+"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
+<p>This may also be a reference to a resource (in the form
+"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
+theme attribute (in the form
+"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
+containing a value of this type.
+ @attr name android:rimColor
+ */
+ public static final int ProgressWheel_rimColor = 4;
+ /**
+ <p>This symbol is the offset where the {@link com.todddavies.components.progressbar.R.attr#rimWidth}
+ attribute's value can be found in the {@link #ProgressWheel} array.
+
+
+ <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
+Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
+in (inches), mm (millimeters).
+<p>This may also be a reference to a resource (in the form
+"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
+theme attribute (in the form
+"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
+containing a value of this type.
+ @attr name android:rimWidth
+ */
+ public static final int ProgressWheel_rimWidth = 5;
+ /**
+ <p>This symbol is the offset where the {@link com.todddavies.components.progressbar.R.attr#spinSpeed}
+ attribute's value can be found in the {@link #ProgressWheel} array.
+
+
+ <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
+Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
+in (inches), mm (millimeters).
+<p>This may also be a reference to a resource (in the form
+"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
+theme attribute (in the form
+"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
+containing a value of this type.
+ @attr name android:spinSpeed
+ */
+ public static final int ProgressWheel_spinSpeed = 6;
+ /**
+ <p>This symbol is the offset where the {@link com.todddavies.components.progressbar.R.attr#text}
+ attribute's value can be found in the {@link #ProgressWheel} array.
+
+
+ <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character.
+<p>This may also be a reference to a resource (in the form
+"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
+theme attribute (in the form
+"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
+containing a value of this type.
+ @attr name android:text
+ */
+ public static final int ProgressWheel_text = 0;
+ /**
+ <p>This symbol is the offset where the {@link com.todddavies.components.progressbar.R.attr#textColor}
+ attribute's value can be found in the {@link #ProgressWheel} array.
+
+
+ <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
+"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
+<p>This may also be a reference to a resource (in the form
+"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
+theme attribute (in the form
+"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
+containing a value of this type.
+ @attr name android:textColor
+ */
+ public static final int ProgressWheel_textColor = 1;
+ /**
+ <p>This symbol is the offset where the {@link com.todddavies.components.progressbar.R.attr#textSize}
+ attribute's value can be found in the {@link #ProgressWheel} array.
+
+
+ <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
+Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
+in (inches), mm (millimeters).
+<p>This may also be a reference to a resource (in the form
+"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
+theme attribute (in the form
+"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
+containing a value of this type.
+ @attr name android:textSize
+ */
+ public static final int ProgressWheel_textSize = 2;
+ };
+}
View
800 src/com/todddavies/components/progressbar/ProgressWheel.java
@@ -1,400 +1,400 @@
-package com.todddavies.components.progressbar;
-
-import android.content.Context;
-import android.content.res.TypedArray;
-import android.graphics.Canvas;
-import android.graphics.Paint;
-import android.graphics.Paint.Style;
-import android.graphics.RectF;
-import android.graphics.Shader;
-import android.os.Handler;
-import android.os.Message;
-import android.util.AttributeSet;
-import android.view.View;
-
-/**
- * An indicator of progress, similar to Android's ProgressBar.
- * Can be used in 'spin mode' or 'increment mode'
- * @author Todd Davies
- *
- * Licensed under the Creative Commons Attribution 3.0 license see http://creativecommons.org/licenses/by/3.0/
- *
- */
-public class ProgressWheel extends View {
-
- //Sizes (with defaults)
- private int fullRadius = 100;
- private int circleRadius = 80;
- private int barLength = 60;
- private int barWidth = 20;
- private int rimWidth = 20;
- private int textSize = 20;
-
- //Padding (with defaults)
- private int paddingTop = 5;
- private int paddingBottom = 5;
- private int paddingLeft = 5;
- private int paddingRight = 5;
-
- //Colors (with defaults)
- private int barColor = 0xAA000000;
- private int circleColor = 0x00000000;
- private int rimColor = 0xAADDDDDD;
- private int textColor = 0xFF000000;
-
- //Paints
- private Paint barPaint = new Paint();
- private Paint circlePaint = new Paint();
- private Paint rimPaint = new Paint();
- private Paint textPaint = new Paint();
-
- //Rectangles
- @SuppressWarnings("unused")
- private RectF rectBounds = new RectF();
- private RectF circleBounds = new RectF();
-
- //Animation
- //The amount of pixels to move the bar by on each draw
- private int spinSpeed = 2;
- //The number of milliseconds to wait inbetween each draw
- private int delayMillis = 0;
- private Handler spinHandler = new Handler() {
- /**
- * This is the code that will increment the progress variable
- * and so spin the wheel
- */
- @Override
- public void handleMessage(Message msg) {
- invalidate();
- if(isSpinning) {
- progress+=spinSpeed;
- if(progress>360) {
- progress = 0;
- }
- spinHandler.sendEmptyMessageDelayed(0, delayMillis);
- }
- //super.handleMessage(msg);
- }
- };
- int progress = 0;
- boolean isSpinning = false;
-
- //Other
- private String text = "";
- private String[] splitText = {};
-
- /**
- * The constructor for the ProgressWheel
- * @param context
- * @param attrs
- */
- public ProgressWheel(Context context, AttributeSet attrs) {
- super(context, attrs);
-
- parseAttributes(context.obtainStyledAttributes(attrs,
- R.styleable.ProgressWheel));
- }
-
- //----------------------------------
- //Setting up stuff
- //----------------------------------
-
- /**
- * Now we know the dimensions of the view, setup the bounds and paints
- */
- @Override
- public void onAttachedToWindow() {
- super.onAttachedToWindow();
- setupBounds();
- setupPaints();
- invalidate();
- }
-
- /**
- * Set the properties of the paints we're using to
- * draw the progress wheel
- */
- private void setupPaints() {
- barPaint.setColor(barColor);
- barPaint.setAntiAlias(true);
- barPaint.setStyle(Style.STROKE);
- barPaint.setStrokeWidth(barWidth);
-
- rimPaint.setColor(rimColor);
- rimPaint.setAntiAlias(true);
- rimPaint.setStyle(Style.STROKE);
- rimPaint.setStrokeWidth(rimWidth);
-
- circlePaint.setColor(circleColor);
- circlePaint.setAntiAlias(true);
- circlePaint.setStyle(Style.FILL);
-
- textPaint.setColor(textColor);
- textPaint.setStyle(Style.FILL);
- textPaint.setAntiAlias(true);
- textPaint.setTextSize(textSize);
- }
-
- /**
- * Set the bounds of the component
- */
- private void setupBounds() {
- paddingTop = this.getPaddingTop();
- paddingBottom = this.getPaddingBottom();
- paddingLeft = this.getPaddingLeft();
- paddingRight = this.getPaddingRight();
-
- rectBounds = new RectF(paddingLeft,
- paddingTop,
- this.getLayoutParams().width - paddingRight,
- this.getLayoutParams().height - paddingBottom);
-
- circleBounds = new RectF(paddingLeft + barWidth,
- paddingTop + barWidth,
- this.getLayoutParams().width - paddingRight - barWidth,
- this.getLayoutParams().height - paddingBottom - barWidth);
-
- fullRadius = (this.getLayoutParams().width - paddingRight - barWidth)/2;
- circleRadius = (fullRadius - barWidth) + 1;
- }
-
- /**
- * Parse the attributes passed to the view from the XML
- * @param a the attributes to parse
- */
- private void parseAttributes(TypedArray a) {
- barWidth = (int) a.getDimension(R.styleable.ProgressWheel_barWidth, barWidth);
-
- rimWidth = (int) a.getDimension(R.styleable.ProgressWheel_rimWidth, rimWidth);
-
- spinSpeed = (int) a.getDimension(R.styleable.ProgressWheel_spinSpeed, spinSpeed);
-
- delayMillis = (int) a.getInteger(R.styleable.ProgressWheel_delayMillis, delayMillis);
- if(delayMillis<0) {
- delayMillis = 0;
- }
-
- barColor = a.getColor(R.styleable.ProgressWheel_barColor, barColor);
-
- barLength = (int) a.getDimension(R.styleable.ProgressWheel_barLength, barLength);
-
- textSize = (int) a.getDimension(R.styleable.ProgressWheel_textSize, textSize);
-
- textColor = (int) a.getColor(R.styleable.ProgressWheel_textColor, textColor);
-
- setText(a.getString(R.styleable.ProgressWheel_text));
-
- rimColor = (int) a.getColor(R.styleable.ProgressWheel_rimColor, rimColor);
-
- circleColor = (int) a.getColor(R.styleable.ProgressWheel_circleColor, circleColor);
- }
-
- //----------------------------------
- //Animation stuff
- //----------------------------------
-
- protected void onDraw(Canvas canvas) {
- super.onDraw(canvas);
- //Draw the rim
- canvas.drawArc(circleBounds, 360, 360, false, rimPaint);
- //Draw the bar
- if(isSpinning) {
- canvas.drawArc(circleBounds, progress - 90, barLength, false, barPaint);
- } else {
- canvas.drawArc(circleBounds, -90, progress, false, barPaint);
- }
- //Draw the inner circle
- canvas.drawCircle((circleBounds.width()/2) + rimWidth + paddingLeft,
- (circleBounds.height()/2) + rimWidth + paddingTop,
- circleRadius,
- circlePaint);
- //Draw the text (attempts to center it horizontally and vertically)
- int offsetNum = 0;
- for(String s : splitText) {
- float offset = textPaint.measureText(s) / 2;
- canvas.drawText(s, this.getWidth() / 2 - offset,
- this.getHeight() / 2 + (textSize*(offsetNum)) - ((splitText.length-1)*(textSize/2)), textPaint);
- offsetNum++;
- }
- }
-
- /**
- * Reset the count (in increment mode)
- */
- public void resetCount() {
- progress = 0;
- setText("0%");
- invalidate();
- }
-
- /**
- * Turn off spin mode
- */
- public void stopSpinning() {
- isSpinning = false;
- progress = 0;
- spinHandler.removeMessages(0);
- }
-
-
- /**
- * Puts the view on spin mode
- */
- public void spin() {
- isSpinning = true;
- spinHandler.sendEmptyMessage(0);
- }
-
- /**
- * Increment the progress by 1 (of 360)
- */
- public void incrementProgress() {
- isSpinning = false;
- progress++;
- setText(Math.round(((float)progress/360)*100) + "%");
- spinHandler.sendEmptyMessage(0);
- }
-
- //----------------------------------
- //Getters + setters
- //----------------------------------
-
- /**
- * Set the text in the progress bar
- * Doesn't invalidate the view
- * @param text the text to show ('\n' constitutes a new line)
- */
- public void setText(String text) {
- this.text = text;
- splitText = this.text.split("\n");
- }
-
- public int getCircleRadius() {
- return circleRadius;
- }
-
- public void setCircleRadius(int circleRadius) {
- this.circleRadius = circleRadius;
- }
-
- public int getBarLength() {
- return barLength;
- }
-
- public void setBarLength(int barLength) {
- this.barLength = barLength;
- }
-
- public int getBarWidth() {
- return barWidth;
- }
-
- public void setBarWidth(int barWidth) {
- this.barWidth = barWidth;
- }
-
- public int getTextSize() {
- return textSize;
- }
-
- public void setTextSize(int textSize) {
- this.textSize = textSize;
- }
-
- public int getPaddingTop() {
- return paddingTop;
- }
-
- public void setPaddingTop(int paddingTop) {
- this.paddingTop = paddingTop;
- }
-
- public int getPaddingBottom() {
- return paddingBottom;
- }
-
- public void setPaddingBottom(int paddingBottom) {
- this.paddingBottom = paddingBottom;
- }
-
- public int getPaddingLeft() {
- return paddingLeft;
- }
-
- public void setPaddingLeft(int paddingLeft) {
- this.paddingLeft = paddingLeft;
- }
-
- public int getPaddingRight() {
- return paddingRight;
- }
-
- public void setPaddingRight(int paddingRight) {
- this.paddingRight = paddingRight;
- }
-
- public int getBarColor() {
- return barColor;
- }
-
- public void setBarColor(int barColor) {
- this.barColor = barColor;
- }
-
- public int getCircleColor() {
- return circleColor;
- }
-
- public void setCircleColor(int circleColor) {
- this.circleColor = circleColor;
- }
-
- public int getRimColor() {
- return rimColor;
- }
-
- public void setRimColor(int rimColor) {
- this.rimColor = rimColor;
- }
-
-
- public Shader getRimShader() {
- return rimPaint.getShader();
- }
-
- public void setRimShader(Shader shader) {
- this.rimPaint.setShader(shader);
- }
-
- public int getTextColor() {
- return textColor;
- }
-
- public void setTextColor(int textColor) {
- this.textColor = textColor;
- }
-
- public int getSpinSpeed() {
- return spinSpeed;
- }
-
- public void setSpinSpeed(int spinSpeed) {
- this.spinSpeed = spinSpeed;
- }
-
- public int getRimWidth() {
- return rimWidth;
- }
-
- public void setRimWidth(int rimWidth) {
- this.rimWidth = rimWidth;
- }
-
- public int getDelayMillis() {
- return delayMillis;
- }
-
- public void setDelayMillis(int delayMillis) {
- this.delayMillis = delayMillis;
- }
-}
+package com.todddavies.components.progressbar;
+
+import android.content.Context;
+import android.content.res.TypedArray;
+import android.graphics.Canvas;
+import android.graphics.Paint;
+import android.graphics.Paint.Style;
+import android.graphics.RectF;
+import android.graphics.Shader;
+import android.os.Handler;
+import android.os.Message;
+import android.util.AttributeSet;
+import android.view.View;
+
+/**
+ * An indicator of progress, similar to Android's ProgressBar.
+ * Can be used in 'spin mode' or 'increment mode'
+ * @author Todd Davies
+ *
+ * Licensed under the Creative Commons Attribution 3.0 license see http://creativecommons.org/licenses/by/3.0/
+ *
+ */
+public class ProgressWheel extends View {
+
+ //Sizes (with defaults)
+ private int fullRadius = 100;
+ private int circleRadius = 80;
+ private int barLength = 60;
+ private int barWidth = 20;
+ private int rimWidth = 20;
+ private int textSize = 20;
+
+ //Padding (with defaults)
+ private int paddingTop = 5;
+ private int paddingBottom = 5;
+ private int paddingLeft = 5;
+ private int paddingRight = 5;
+
+ //Colors (with defaults)
+ private int barColor = 0xAA000000;
+ private int circleColor = 0x00000000;
+ private int rimColor = 0xAADDDDDD;
+ private int textColor = 0xFF000000;
+
+ //Paints
+ private Paint barPaint = new Paint();
+ private Paint circlePaint = new Paint();
+ private Paint rimPaint = new Paint();
+ private Paint textPaint = new Paint();
+
+ //Rectangles
+ @SuppressWarnings("unused")
+ private RectF rectBounds = new RectF();
+ private RectF circleBounds = new RectF();
+
+ //Animation
+ //The amount of pixels to move the bar by on each draw
+ private int spinSpeed = 2;
+ //The number of milliseconds to wait inbetween each draw
+ private int delayMillis = 0;
+ private Handler spinHandler = new Handler() {
+ /**
+ * This is the code that will increment the progress variable
+ * and so spin the wheel
+ */
+ @Override
+ public void handleMessage(Message msg) {
+ invalidate();
+ if(isSpinning) {
+ progress+=spinSpeed;
+ if(progress>360) {
+ progress = 0;
+ }
+ spinHandler.sendEmptyMessageDelayed(0, delayMillis);
+ }
+ //super.handleMessage(msg);
+ }
+ };
+ int progress = 0;
+ boolean isSpinning = false;
+
+ //Other
+ private String text = "";
+ private String[] splitText = {};
+
+ /**
+ * The constructor for the ProgressWheel
+ * @param context
+ * @param attrs
+ */
+ public ProgressWheel(Context context, AttributeSet attrs) {
+ super(context, attrs);
+
+ parseAttributes(context.obtainStyledAttributes(attrs,
+ R.styleable.ProgressWheel));
+ }
+
+ //----------------------------------
+ //Setting up stuff
+ //----------------------------------
+
+ /**
+ * Now we know the dimensions of the view, setup the bounds and paints
+ */
+ @Override
+ public void onAttachedToWindow() {
+ super.onAttachedToWindow();
+ setupBounds();
+ setupPaints();
+ invalidate();
+ }
+
+ /**
+ * Set the properties of the paints we're using to
+ * draw the progress wheel
+ */
+ private void setupPaints() {
+ barPaint.setColor(barColor);
+ barPaint.setAntiAlias(true);
+ barPaint.setStyle(Style.STROKE);
+ barPaint.setStrokeWidth(barWidth);
+
+ rimPaint.setColor(rimColor);
+ rimPaint.setAntiAlias(true);
+ rimPaint.setStyle(Style.STROKE);
+ rimPaint.setStrokeWidth(rimWidth);
+
+ circlePaint.setColor(circleColor);
+ circlePaint.setAntiAlias(true);
+ circlePaint.setStyle(Style.FILL);
+
+ textPaint.setColor(textColor);
+ textPaint.setStyle(Style.FILL);
+ textPaint.setAntiAlias(true);
+ textPaint.setTextSize(textSize);
+ }
+
+ /**
+ * Set the bounds of the component
+ */
+ private void setupBounds() {
+ paddingTop = this.getPaddingTop();
+ paddingBottom = this.getPaddingBottom();
+ paddingLeft = this.getPaddingLeft();
+ paddingRight = this.getPaddingRight();
+
+ rectBounds = new RectF(paddingLeft,
+ paddingTop,
+ this.getLayoutParams().width - paddingRight,
+ this.getLayoutParams().height - paddingBottom);
+
+ circleBounds = new RectF(paddingLeft + barWidth,
+ paddingTop + barWidth,
+ this.getLayoutParams().width - paddingRight - barWidth,
+ this.getLayoutParams().height - paddingBottom - barWidth);
+
+ fullRadius = (this.getLayoutParams().width - paddingRight - barWidth)/2;
+ circleRadius = (fullRadius - barWidth) + 1;
+ }
+
+ /**
+ * Parse the attributes passed to the view from the XML
+ * @param a the attributes to parse
+ */
+ private void parseAttributes(TypedArray a) {
+ barWidth = (int) a.getDimension(R.styleable.ProgressWheel_barWidth, barWidth);
+
+ rimWidth = (int) a.getDimension(R.styleable.ProgressWheel_rimWidth, rimWidth);
+
+ spinSpeed = (int) a.getDimension(R.styleable.ProgressWheel_spinSpeed, spinSpeed);
+
+ delayMillis = (int) a.getInteger(R.styleable.ProgressWheel_delayMillis, delayMillis);
+ if(delayMillis<0) {
+ delayMillis = 0;
+ }
+
+ barColor = a.getColor(R.styleable.ProgressWheel_barColor, barColor);
+
+ barLength = (int) a.getDimension(R.styleable.ProgressWheel_barLength, barLength);
+
+ textSize = (int) a.getDimension(R.styleable.ProgressWheel_textSize, textSize);
+
+ textColor = (int) a.getColor(R.styleable.ProgressWheel_textColor, textColor);
+
+ setText(a.getString(R.styleable.ProgressWheel_text));
+
+ rimColor = (int) a.getColor(R.styleable.ProgressWheel_rimColor, rimColor);
+
+ circleColor = (int) a.getColor(R.styleable.ProgressWheel_circleColor, circleColor);
+ }
+
+ //----------------------------------
+ //Animation stuff
+ //----------------------------------
+
+ protected void onDraw(Canvas canvas) {
+ super.onDraw(canvas);
+ //Draw the rim
+ canvas.drawArc(circleBounds, 360, 360, false, rimPaint);
+ //Draw the bar
+ if(isSpinning) {
+ canvas.drawArc(circleBounds, progress - 90, barLength, false, barPaint);
+ } else {
+ canvas.drawArc(circleBounds, -90, progress, false, barPaint);
+ }
+ //Draw the inner circle
+ canvas.drawCircle((circleBounds.width()/2) + rimWidth + paddingLeft,
+ (circleBounds.height()/2) + rimWidth + paddingTop,
+ circleRadius,
+ circlePaint);
+ //Draw the text (attempts to center it horizontally and vertically)
+ int offsetNum = 0;
+ for(String s : splitText) {
+ float offset = textPaint.measureText(s) / 2;
+ canvas.drawText(s, this.getWidth() / 2 - offset,
+ this.getHeight() / 2 + (textSize*(offsetNum)) - ((splitText.length-1)*(textSize/2)), textPaint);
+ offsetNum++;
+ }
+ }
+
+ /**
+ * Reset the count (in increment mode)
+ */
+ public void resetCount() {
+ progress = 0;
+ setText("0%");
+ invalidate();
+ }
+
+ /**
+ * Turn off spin mode
+ */
+ public void stopSpinning() {
+ isSpinning = false;
+ progress = 0;
+ spinHandler.removeMessages(0);
+ }
+
+
+ /**
+ * Puts the view on spin mode
+ */
+ public void spin() {
+ isSpinning = true;
+ spinHandler.sendEmptyMessage(0);
+ }
+
+ /**
+ * Increment the progress by 1 (of 360)
+ */
+ public void incrementProgress() {
+ isSpinning = false;
+ progress++;
+ setText(Math.round(((float)progress/360)*100) + "%");
+ spinHandler.sendEmptyMessage(0);
+ }
+
+ //----------------------------------
+ //Getters + setters
+ //----------------------------------
+
+ /**
+ * Set the text in the progress bar
+ * Doesn't invalidate the view
+ * @param text the text to show ('\n' constitutes a new line)
+ */
+ public void setText(String text) {
+ this.text = text;
+ splitText = this.text.split("\n");
+ }
+
+ public int getCircleRadius() {
+ return circleRadius;
+ }
+
+ public void setCircleRadius(int circleRadius) {
+ this.circleRadius = circleRadius;
+ }
+
+ public int getBarLength() {
+ return barLength;
+ }
+
+ public void setBarLength(int barLength) {
+ this.barLength = barLength;
+ }
+
+ public int getBarWidth() {
+ return barWidth;
+ }
+
+ public void setBarWidth(int barWidth) {
+ this.barWidth = barWidth;
+ }
+
+ public int getTextSize() {
+ return textSize;
+ }
+
+ public void setTextSize(int textSize) {
+ this.textSize = textSize;
+ }
+
+ public int getPaddingTop() {
+ return paddingTop;
+ }
+
+ public void setPaddingTop(int paddingTop) {
+ this.paddingTop = paddingTop;
+ }
+
+ public int getPaddingBottom() {
+ return paddingBottom;
+ }
+
+ public void setPaddingBottom(int paddingBottom) {
+ this.paddingBottom = paddingBottom;
+ }
+
+ public int getPaddingLeft() {
+ return paddingLeft;
+ }
+
+ public void setPaddingLeft(int paddingLeft) {
+ this.paddingLeft = paddingLeft;
+ }
+
+ public int getPaddingRight() {
+ return paddingRight;
+ }
+
+ public void setPaddingRight(int paddingRight) {
+ this.paddingRight = paddingRight;
+ }
+
+ public int getBarColor() {
+ return barColor;
+ }
+
+ public void setBarColor(int barColor) {
+ this.barColor = barColor;
+ }
+
+ public int getCircleColor() {
+ return circleColor;
+ }
+
+ public void setCircleColor(int circleColor) {
+ this.circleColor = circleColor;
+ }
+
+ public int getRimColor() {
+ return rimColor;
+ }
+
+ public void setRimColor(int rimColor) {
+ this.rimColor = rimColor;
+ }
+
+
+ public Shader getRimShader() {
+ return rimPaint.getShader();
+ }
+
+ public void setRimShader(Shader shader) {
+ this.rimPaint.setShader(shader);
+ }
+
+ public int getTextColor() {
+ return textColor;
+ }
+
+ public void setTextColor(int textColor) {
+ this.textColor = textColor;
+ }
+
+ public int getSpinSpeed() {
+ return spinSpeed;
+ }
+
+ public void setSpinSpeed(int spinSpeed) {
+ this.spinSpeed = spinSpeed;
+ }
+
+ public int getRimWidth() {
+ return rimWidth;
+ }
+
+ public void setRimWidth(int rimWidth) {
+ this.rimWidth = rimWidth;
+ }
+
+ public int getDelayMillis() {
+ return delayMillis;
+ }
+
+ public void setDelayMillis(int delayMillis) {
+ this.delayMillis = delayMillis;
+ }
+}
View
194 src/com/todddavies/components/progressbar/main.java
@@ -1,97 +1,97 @@
-package com.todddavies.components.progressbar;
-
-import android.app.Activity;
-import android.graphics.Bitmap;
-import android.graphics.BitmapShader;
-import android.graphics.Shader;
-import android.graphics.drawable.ShapeDrawable;
-import android.graphics.drawable.shapes.RectShape;
-import android.os.Bundle;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.Button;
-
-/**
- * A sample activity showing some of the functions of the progress bar
- */
-public class main extends Activity {
- boolean running;
- ProgressWheel pw_two;
- ProgressWheel pw_three;
- ProgressWheel pw_four;
- //ProgressWheel pw_five;
- int progress = 0;
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.progress_wheel_activity);
- pw_two = (ProgressWheel) findViewById(R.id.progressBarTwo);
- pw_three = (ProgressWheel) findViewById(R.id.progressBarThree);
- pw_four = (ProgressWheel) findViewById(R.id.progressBarFour);
- //pw_five = (ProgressWheel) findViewById(R.id.progressBarFive);
-
- ShapeDrawable bg = new ShapeDrawable(new RectShape());
- int[] pixels = new int[] { 0xFF2E9121, 0xFF2E9121, 0xFF2E9121,
- 0xFF2E9121, 0xFF2E9121, 0xFF2E9121, 0xFFFFFFFF, 0xFFFFFFFF};
- Bitmap bm = Bitmap.createBitmap(pixels, 8, 1, Bitmap.Config.ARGB_8888);
- Shader shader = new BitmapShader(bm,
- Shader.TileMode.REPEAT, Shader.TileMode.REPEAT);
- pw_three.setRimShader(shader);
-
- pw_three.spin();
- pw_four.spin();
-
- final Runnable r = new Runnable() {
- public void run() {
- running = true;
- while(progress<361) {
- pw_two.incrementProgress();
- progress++;
- try {
- Thread.sleep(15);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- running = false;
- }
- };
-
- Button spin = (Button) findViewById(R.id.btn_spin);
- spin.setOnClickListener(new OnClickListener() {
- public void onClick(View v) {
- if(!running) {
- if(pw_two.isSpinning) {
- pw_two.stopSpinning();
- }
- pw_two.resetCount();
- pw_two.setText("Loading...");
- pw_two.spin();
- }
- }
- });
-
- Button increment = (Button) findViewById(R.id.btn_increment);
- increment.setOnClickListener(new OnClickListener() {
- public void onClick(View v) {
- if(!running) {
- progress = 0;
- pw_two.resetCount();
- Thread s = new Thread(r);
- s.start();
- }
- }
- });
- }
-
- @Override
- public void onPause() {
- super.onPause();
- progress = 361;
- pw_two.stopSpinning();
- pw_two.resetCount();
- pw_two.setText("Click\none of the\nbuttons");
- }
-}
+package com.todddavies.components.progressbar;
+
+import android.app.Activity;
+import android.graphics.Bitmap;
+import android.graphics.BitmapShader;
+import android.graphics.Shader;
+import android.graphics.drawable.ShapeDrawable;
+import android.graphics.drawable.shapes.RectShape;
+import android.os.Bundle;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
+
+/**
+ * A sample activity showing some of the functions of the progress bar
+ */
+public class main extends Activity {
+ boolean running;
+ ProgressWheel pw_two;
+ ProgressWheel pw_three;
+ ProgressWheel pw_four;
+ //ProgressWheel pw_five;
+ int progress = 0;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.progress_wheel_activity);
+ pw_two = (ProgressWheel) findViewById(R.id.progressBarTwo);
+ pw_three = (ProgressWheel) findViewById(R.id.progressBarThree);
+ pw_four = (ProgressWheel) findViewById(R.id.progressBarFour);
+ //pw_five = (ProgressWheel) findViewById(R.id.progressBarFive);
+
+ ShapeDrawable bg = new ShapeDrawable(new RectShape());
+ int[] pixels = new int[] { 0xFF2E9121, 0xFF2E9121, 0xFF2E9121,
+ 0xFF2E9121, 0xFF2E9121, 0xFF2E9121, 0xFFFFFFFF, 0xFFFFFFFF};
+ Bitmap bm = Bitmap.createBitmap(pixels, 8, 1, Bitmap.Config.ARGB_8888);
+ Shader shader = new BitmapShader(bm,
+ Shader.TileMode.REPEAT, Shader.TileMode.REPEAT);
+ pw_three.setRimShader(shader);
+
+ pw_three.spin();
+ pw_four.spin();
+
+ final Runnable r = new Runnable() {
+ public void run() {
+ running = true;
+ while(progress<361) {
+ pw_two.incrementProgress();
+ progress++;
+ try {
+ Thread.sleep(15);
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ running = false;
+ }
+ };
+
+ Button spin = (Button) findViewById(R.id.btn_spin);
+ spin.setOnClickListener(new OnClickListener() {
+ public void onClick(View v) {
+ if(!running) {
+ if(pw_two.isSpinning) {
+ pw_two.stopSpinning();
+ }
+ pw_two.resetCount();
+ pw_two.setText("Loading...");
+ pw_two.spin();
+ }
+ }
+ });
+
+ Button increment = (Button) findViewById(R.id.btn_increment);
+ increment.setOnClickListener(new OnClickListener() {
+ public void onClick(View v) {
+ if(!running) {
+ progress = 0;
+ pw_two.resetCount();
+ Thread s = new Thread(r);
+ s.start();
+ }
+ }
+ });
+ }
+
+ @Override
+ public void onPause() {
+ super.onPause();
+ progress = 361;
+ pw_two.stopSpinning();
+ pw_two.resetCount();
+ pw_two.setText("Click\none of the\nbuttons");
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.