FileDocCategorySizeDatePackage
DateView.javaAPI DocAndroid 1.5 API2144Wed May 06 22:42:00 BST 2009com.android.server.status

DateView

public final class DateView extends android.widget.TextView

Fields Summary
private static final String
TAG
private boolean
mUpdating
private android.content.BroadcastReceiver
mIntentReceiver
Constructors Summary
public DateView(android.content.Context context, android.util.AttributeSet attrs)


         
        super(context, attrs);
    
Methods Summary
protected intgetSuggestedMinimumWidth()

        // makes the large background bitmap not force us to full width
        return 0;
    
protected voidonAttachedToWindow()

        super.onAttachedToWindow();
    
protected voidonDetachedFromWindow()

        super.onDetachedFromWindow();
        setUpdates(false);
    
voidsetUpdates(boolean update)

        if (update != mUpdating) {
            mUpdating = update;
            if (update) {
                // Register for Intent broadcasts for the clock and battery
                IntentFilter filter = new IntentFilter();
                filter.addAction(Intent.ACTION_TIME_TICK);
                filter.addAction(Intent.ACTION_TIMEZONE_CHANGED);
                mContext.registerReceiver(mIntentReceiver, filter, null, null);
                updateClock();
            } else {
                mContext.unregisterReceiver(mIntentReceiver);
            }
        }
    
private final voidupdateClock()

        Date now = new Date();
        setText(DateFormat.getDateInstance(DateFormat.LONG).format(now));