diff options
author | Dima Zavin <dima@android.com> | 2011-10-31 16:53:41 -0700 |
---|---|---|
committer | Dima Zavin <dima@android.com> | 2011-10-31 17:04:33 -0700 |
commit | 9ec3f3e2e4ccb18ed85fa47015b0fa71985710c4 (patch) | |
tree | dd41242f8e0f06f669b048d72d46c0bf4e12ce1d /charger | |
parent | 604f52e31357a774ad49290e323976b1db5b9f38 (diff) | |
download | system_core-9ec3f3e2e4ccb18ed85fa47015b0fa71985710c4.zip system_core-9ec3f3e2e4ccb18ed85fa47015b0fa71985710c4.tar.gz system_core-9ec3f3e2e4ccb18ed85fa47015b0fa71985710c4.tar.bz2 |
charger: make the almost-full frame only show when it's current level
Change-Id: Id53de101dd3c211d376abfd748e7646e28291749
Signed-off-by: Dima Zavin <dima@android.com>
Diffstat (limited to 'charger')
-rw-r--r-- | charger/charger.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/charger/charger.c b/charger/charger.c index 03280bf..abf5517 100644 --- a/charger/charger.c +++ b/charger/charger.c @@ -87,6 +87,7 @@ struct frame { const char *name; int disp_time; int min_capacity; + bool level_only; gr_surface surface; }; @@ -157,6 +158,7 @@ static struct frame batt_anim_frames[] = { .name = "charger/battery_4", .disp_time = 750, .min_capacity = 80, + .level_only = true, }, { .name = "charger/battery_5", @@ -735,7 +737,14 @@ static void update_screen_state(struct charger *charger, int64_t now) * if necessary, advance cycle cntr, and reset frame cntr */ batt_anim->cur_frame++; - if (batt_anim->cur_frame == batt_anim->num_frames) { + + /* if the frame is used for level-only, that is only show it when it's + * the current level, skip it during the animation. + */ + while (batt_anim->cur_frame < batt_anim->num_frames && + batt_anim->frames[batt_anim->cur_frame].level_only) + batt_anim->cur_frame++; + if (batt_anim->cur_frame >= batt_anim->num_frames) { batt_anim->cur_cycle++; batt_anim->cur_frame = 0; |