mirror of
https://gitee.com/houstudio/Cdroid.git
synced 2024-11-29 18:59:14 +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
|
||||
MessageHandler* handler = messageEnvelope.handler;
|
||||
Message message = messageEnvelope.message;
|
||||
mMessageEnvelopes.erase(mMessageEnvelopes.begin());//removeAt(0);
|
||||
mMessageEnvelopes.pop_front();
|
||||
mSendingMessage = true;
|
||||
mLock.unlock();
|
||||
|
||||
|
@ -54,22 +54,18 @@ Drawable*AnalogClock::getClockDrawable(int id){
|
||||
}
|
||||
|
||||
void AnalogClock::onAttached(){
|
||||
//sendMessage(WM_TIMER,0,0,1000);
|
||||
}
|
||||
/*bool AnalogClock::onMessage(DWORD msg,DWORD wp,ULONG lp){
|
||||
if(msg==WM_TIMER){
|
||||
mRunner=[&](){
|
||||
std::time_t t = std::time(NULL);
|
||||
struct std::tm when= *std::localtime(&t);
|
||||
std::get_time(&when,"%R");
|
||||
mHour=when.tm_hour;
|
||||
mMinutes=when.tm_min;
|
||||
mSeconds=when.tm_sec;
|
||||
//sendMessage(msg,wp,lp,1000);
|
||||
invalidate(nullptr);
|
||||
return true;
|
||||
postDelayed(mRunner,800);
|
||||
};
|
||||
postDelayed(mRunner,800);
|
||||
}
|
||||
return View::onMessage(msg,wp,lp);
|
||||
}*/
|
||||
|
||||
void AnalogClock::onDraw(Canvas&canvas){
|
||||
View::onDraw(canvas);
|
||||
|
@ -12,6 +12,7 @@ private:
|
||||
Drawable* mMinuteHand;
|
||||
Drawable* mSecondHand;
|
||||
Drawable* mDial;
|
||||
Runnable mRunner;
|
||||
protected:
|
||||
void onAttached();
|
||||
void onDraw(Canvas&canvas)override;
|
||||
|
Loading…
Reference in New Issue
Block a user