TrueAnalogClock

TrueAnalogClock Programming Interface

Interfaces

BeforeDrawFaceListener
public Boolean onBeforeDrawFace(TrueAnalogClock clock, Canvas canvas)
Called before drawing the face image and allows to draw face or it's parts from code manually. Return true to disable default drawing.

AfterDrawFaceListener
public void onAfterDrawFace(TrueAnalogClock clock, Canvas canvas)
Called after drawing the face image and allows to draw face or it's parts from code manually.

BeforeDrawGlassListener
public Boolean onBeforeDrawGlass(TrueAnalogClock clock, Canvas canvas)
Called before drawing the glass image and allows to draw glass or it's parts from code manually. Return true to disable default drawing.

AfterDrawGlassListener
public void onAfterDrawGlass(TrueAnalogClock clock, Canvas canvas)
Called after drawing the glass image and allows to draw glass or it's parts from code manually.

Methods

public void setBeforeDrawFaceListener(BeforeDrawFaceListener beforeDrawFaceListener)
Sets BeforeDrawFaceListener.

public void setAfterDrawFaceListener(BeforeDrawFaceListener beforeDrawFaceListener)
Sets AfterDrawFaceListener.

public void setBeforeDrawGlassListener(BeforeDrawGlassListener beforeDrawGlassListener)
Sets BeforeDrawGlassListener.

public void setAfterDrawGlassListener(BeforeDrawGlassListener beforeDrawGlassListener)
Sets AfterDrawGlassListener.

public boolean isUseSystemTime()
Returns true if clock uses current system time, otherwise false.

public void setUseSystemTime(boolean useSystemTime)
If true the clock must use the current system time, otherwise the internal time is used (see getTime/setTime).

public long getTime()
Returns current time in milliseconds (the value is returned by getTimeInMillis function of the internal calendar object).

public void setTime()
Sets internal clock time using the system current time.

public void setTime(long newTime)
public void setTime(int hour, int minute, int second)
public void setTime(int year, int month, int day, int hour, int minute, int second)
Sets internal clock time using the passed parameters.

public void setTimeOffset(long time)
public void setTimeOffset(int hour, int minute, int second)
Sets time offset using passed values. TrueAnalogClock class does not keep the value and just sets time offset for all contained hands.

public Bitmap getFace()
Returns current face image.

public void setFace(Bitmap face)
public void setFace(int id)
Sets face image using passed bitmap or drawable resource id.

public Bitmap getGlass()
Returns current glass image.

public void setGlass(Bitmap glass)
public void setGlass(int id)
Sets glass image using passed bitmap or drawable resource id.

public void addHand(TrueAnalogClockHand hand)
Adds new hand to hands list.

public void removeHand(TrueAnalogClockHand hand)
Removes passed hand from hands list.

public void removeAllHands()
Removes all hands from hands list.

public void rearrangeHands(TrueAnalogClockHand hand, int newIndex)
Change the position of the passed hand in the hands list.

public int getHandCount()
Returns the count of the hands list.

public TrueAnalogClockHand getHand(int index)
Returns the hands by the position in the hands list.

public Object[] findHands(String name)
Returns the list of the hands that have the passed name.

public void loadFromXmlResource(Activity activity, int id)
Loads the clock settings from the XML resource with passed resource id. XML resource must be placed to the res/xml folder.