From wiki.ginstr.com
Jump to: navigation, search

GnChronometer

Widget XML tag
<com.ginstr.widgets.GnChronometer>
Description
GnChronometer inherits regular Android TextView widget and is used to display time elapsed.
It is controlled via actions gn:act_startChrono, gn:act_stopChrono, gn:act_resetChrono, gn:act_setChrono & gn:act_setDateTimeFormat.

XML Attributes Description

Attribute Description
gn:reverseMode Forces widget to count time elapsed backward

Can be

  • true
  • false
gn:negativeValueTextColor Represents color of text value when the value is less than 0

Can be

  • hardcoded
gn:setDateTimeFormat Represents date/time format used to display the value

Can be

  • @string
gn:stopAtZero Stops timer when it reaches zero value

Can be

  • true
  • false

Controlling Actions

Action Description
gn:act_startChrono Starts the chronometer to measure time
gn:act_stopChrono Stops (pauses) the chronometer time measuring
gn:act_resetChrono Resets the chronometer time to 0
gn:act_setChrono Sets chronometer to certain start time
gn:act_setDateTimeFormat Sets chronometer date/time format

Example

<com.ginstr.widgets.GnChronometer
  android:id="@+id/waitingTime"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:layout_marginLeft="5dp"
  android:background="#00000000"
  android:textColor="#000000"
  android:textSize="20sp" />