mirror of
https://gitee.com/houstudio/Cdroid.git
synced 2024-11-30 03:08:12 +08:00
change analogclock's timer message to runnable
This commit is contained in:
parent
c42bc74405
commit
01f9f55aa5
@ -233,7 +233,7 @@ Done: ;
|
|||||||
{ // obtain handler
|
{ // obtain handler
|
||||||
MessageHandler* handler = messageEnvelope.handler;
|
MessageHandler* handler = messageEnvelope.handler;
|
||||||
Message message = messageEnvelope.message;
|
Message message = messageEnvelope.message;
|
||||||
mMessageEnvelopes.erase(mMessageEnvelopes.begin());//removeAt(0);
|
mMessageEnvelopes.pop_front();
|
||||||
mSendingMessage = true;
|
mSendingMessage = true;
|
||||||
mLock.unlock();
|
mLock.unlock();
|
||||||
|
|
||||||
|
@ -54,22 +54,18 @@ Drawable*AnalogClock::getClockDrawable(int id){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AnalogClock::onAttached(){
|
void AnalogClock::onAttached(){
|
||||||
//sendMessage(WM_TIMER,0,0,1000);
|
mRunner=[&](){
|
||||||
}
|
|
||||||
/*bool AnalogClock::onMessage(DWORD msg,DWORD wp,ULONG lp){
|
|
||||||
if(msg==WM_TIMER){
|
|
||||||
std::time_t t = std::time(NULL);
|
std::time_t t = std::time(NULL);
|
||||||
struct std::tm when= *std::localtime(&t);
|
struct std::tm when= *std::localtime(&t);
|
||||||
std::get_time(&when,"%R");
|
std::get_time(&when,"%R");
|
||||||
mHour=when.tm_hour;
|
mHour=when.tm_hour;
|
||||||
mMinutes=when.tm_min;
|
mMinutes=when.tm_min;
|
||||||
mSeconds=when.tm_sec;
|
mSeconds=when.tm_sec;
|
||||||
//sendMessage(msg,wp,lp,1000);
|
|
||||||
invalidate(nullptr);
|
invalidate(nullptr);
|
||||||
return true;
|
postDelayed(mRunner,800);
|
||||||
|
};
|
||||||
|
postDelayed(mRunner,800);
|
||||||
}
|
}
|
||||||
return View::onMessage(msg,wp,lp);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
void AnalogClock::onDraw(Canvas&canvas){
|
void AnalogClock::onDraw(Canvas&canvas){
|
||||||
View::onDraw(canvas);
|
View::onDraw(canvas);
|
||||||
|
@ -12,6 +12,7 @@ private:
|
|||||||
Drawable* mMinuteHand;
|
Drawable* mMinuteHand;
|
||||||
Drawable* mSecondHand;
|
Drawable* mSecondHand;
|
||||||
Drawable* mDial;
|
Drawable* mDial;
|
||||||
|
Runnable mRunner;
|
||||||
protected:
|
protected:
|
||||||
void onAttached();
|
void onAttached();
|
||||||
void onDraw(Canvas&canvas)override;
|
void onDraw(Canvas&canvas)override;
|
||||||
|
Loading…
Reference in New Issue
Block a user