Sony Addon SDK public class

TimeView

This project is no longer being supported and will not get any further updates.
extends TextView
  1. java.lang.Object
  2. TextView
  3. com.sonyericsson.extras.liveware.aef.widget.TimeView

Class Overview

This class represents a view with state that changes over time. It can be configured to show one of the supported periods represented by TimeView.TimeType. It needs to be nested in a TimeLayout to work.

It is by default configured to display a single state.

The appearance can be customized in mainly three ways:

  • Setting a custom font using the fontPath attribute
  • Setting the strings that are shown in the TimeView (e.g. "January", "February" etc) using the textArray attribute.
  • Setting the images that the TimeView should show using the background attribute. The background drawable set should be a LevelListDrawable resource with a number of drawables equal to TimeView's getTimeStateCount() .

XML Attributes

  • timeType: Sets the type of time interval and thus the number of states. Default type is Constant .
  • textSize: The font size. Use pixels to prevent scaling. MATCH_PARENT will make the view find a size that allows for the current text to fit within the parent.
  • fontPath: Path in the asset folder to custom font to use instead of the device default font. The font will not be rendered in the layout editor.
  • textArray: An array of strings that should be displayed over time. It should have the same number of strings as the number of states indicated by the TimeView's timeType.
  • template: DateFormat template for default values.


Summary

Nested Classes
enum TimeView.TimeType This enumeration represents the cyclic periods that the view supports.
Public Constructors
TimeView(Context context, AttributeSet attrs)
Protected Methods
void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
Public Methods
int getTimeStateCount()

Returns the number of states in the TimeType this View has, e.g.

TimeView.TimeType getTimeType()

Returns the TimeType that this view has been assigned, e.g.

java.lang.CharSequence[] getTextResArray()

Returns the text resources contained in this TimeView, e.g.

Public Constructors

public TimeView(Context context, AttributeSet attrs)

Parameters
context
attrs

Protected Methods

protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)

Parameters
widthMeasureSpec
heightMeasureSpec

Public Methods

public int getTimeStateCount()

Returns the number of states in the TimeType this View has, e.g. 60 if the View has a Minutes TimeType, 24 if Hours etc.

Returns

the number of states.

public TimeView.TimeType getTimeType()

Returns the TimeType that this view has been assigned, e.g. Minutes, Hours.

Returns

the configured time type.

public java.lang.CharSequence[] getTextResArray()

Returns the text resources contained in this TimeView, e.g. "January, February..."

Returns

the array of text resources if any, null otherwise