English | Site Directory

Android - An Open Handset Alliance Project

android.webkit
public class

android.webkit.DateSorter

java.lang.Object
android.webkit.DateSorter

Sorts dates into the following groups: Today Yesterday day two days ago ("Saturday") day three days ago ("Friday") older than three days ago ("Before Friday")

Summary

Constants

      Value  
int  DAY_COUNT  must be >= 3   0x00000005 

Public Constructors

          DateSorter(Context context)

Public Methods

        long  getBoundary(int index)
        int  getIndex(long time)
        String  getLabel(int index)
        String  today()
Get the name of today's day.
        String  yesterday()
Get the name of yesterday's day.
Methods inherited from class java.lang.Object

Details

Constants

public static final int DAY_COUNT

must be >= 3
Constant Value: 5 (0x00000005)

Public Constructors

public DateSorter(Context context)

Parameters

context Application context

Public Methods

public long getBoundary(int index)

Parameters

index date bin index as returned by getIndex()

Returns

  • date boundary at given index

public int getIndex(long time)

Parameters

time time since the Epoch in milliseconds, such as that returned by Calendar.getTimeInMillis()

Returns

  • an index from 0 to (DAY_COUNT - 1) that identifies which date bin this date belongs to

public String getLabel(int index)

Parameters

index date bin index as returned by getIndex()

Returns

  • string label suitable for display to user

public String today()

Get the name of today's day.

Returns

  • String Today's day of the week.

public String yesterday()

Get the name of yesterday's day.

Returns

  • String Yesterday's day of the week.
Build m5-rc15i - 10 Jun 2008 13:54