

ใน the view source file สุดท้ายเราจะเขียน the functions เพื่อแสดง the data บน the UI.
• ใน the
setADC function, เราจะเซ็ตค่า (ที่รับจาก the presenter) ให้กับ the Gauge.
• จากนั้น invalidate the gauge เพื่อให้การอัฟเดตมีผล.
ใน the
setAnimation function ก่อนอื่นเราจะเช็คว่า the animation กำลังรันอยู่หรือไม่.
• ถ้า the animation
ไม่ได้รันอยู่, และ the state เป็น true (button ถูกกด), ดังนั้นเราจะสตาร์ท the animation.
•
startAnimation ใช้พารามิเตอร์ต่อไปนี้
•
@rev กำหนดว่า the animation ควรถูกทำในลำดับย้อนกลับหรือไม่. ฉันได้เซ็ตมันเป็น
false •
@reset กำหนดว่า the animation ควรรีเซ็ตและสตาร์ทจากบิตแมปแรก (หรือสุดท้ายหากเรียงลำดับย้อนกลับ). มันถูกเซ็ตเป็น
false เนื่องจากฉันไม่ต้องการให้ the animation รีเซ็ตเมื่อไรก็ตามที่ the button ถูกกด.
•
@loop กำหนดว่า the animation ควรวนลูปหรือทำ a single animation. มันถูกเซ็ตเป็น
true เนื่องจากฉันต้องการให้ the
animation คงการวนลูปเมื่อ the button ถูกกด.
• ถ้า the animation กำลังรันอยู่และ the button ถูกปล่อย, เราจะหยุดค้าง the animation ชั่วคราว.
• The function
pauseAnimation() ถูกใช้เพือหยุดค้าง the animation ชั่วคราว.