True Analog Clock Anatomy
Inside of True Analog Clock
TrueAnalogClock control operates with 4 virtual layers: hands with underFace attribute, face, regular hands and optional glass layer.
All the clock elements must be represented as drawable resources. Face resource is required. The clock is drawn in the maximal size within control bounds. All the drawable resources must be created in the same scale.
The layer drawing order:
- Hands with underFace attribute (on this example: day of month and day of week rings)
- Face (on this example: round image with windows for day of month and day of week)
- Hands without underFace attribute (on this example: hour, minute and second hands)
- Glass (on this example: some semi-transparent round image with gradient fill)
Glass layer can be used for drawing bezel, shadow and hotspots over face and hands and so on. It is optional.
TrueAnalogClock and TrueAnalogClockHand classes have listeners that allow to apply any custom drawing before and after default drawing of any clock element.
All the clock attributes (face, hands, glass) can be loaded from XML resource, stored in the res/xml folder as well as created in the Java code. TrueAnalogClock class has special methods for accessing all the included hands, so any added hand can be found by type or by name.
TrueAnalogClockHand class supports all the standard hand types (month, day of month, day of week, 24 hour, hour, minute and second). Hand with standard type does not require manual coding and calculate its position automatically. Each hand type supports many horological features like jumping and retrograde hands. Custom hand type allow to show any additional parameters on the clock face. Also custom hands can be used for creating any gauges.
TrueAnalogClockHand's key attributes are axis point and axis face point. The axis point (cyan circle on the hand) is a point of the rotating within hand image coordinates. The axis face point (green circle on the face) is a position of the hand axis point within face image coordinates.