对于Android源码来讲,不管是Android4.X系统还是Android5.X系统,关机充电的流程是一样的。想从网上找关于修改关机充电UI的知识,发现基本没有,今天有时间就总结一下关于如何修改关机充电的UI界面。
首先,需要了解一下关机充电的流程:如下图
看不懂图没有关系 我们今天主要是修改上层的UI界面,所以底层的流程有个大概的了解就行。
好了,下面我们就在Android源码上把关机充电的样式改为LG手机充电的风格。就那本人之前修改过做一个总结。
一:首先要找到关机充电显示图片所在的位置:mediatek/custom/common/lk/logo
在这个目录下找到你的源码工程配置信息向对应的目录,我的工程对应的文件是cu_hd720 ,然后把需要的图片给替换掉
二.控制 图片代码的地方 mediatek/external/libshowlogo/show_animation_common.c
可以看出来 这是一个.C文件 那么如何实现图片之间相互交替出现呢。
void fill_animation_battery_ver_1(unsigned int capacity, void *fill_addr, void * dec_logo_addr, void * logo_addr, LCM_SCREEN_T phical_screen)
{
LOG_ANIM("[show_animation_common: %s %d]capacity : %d\n",__FUNCTION__,__LINE__, capacity);
charging_animation_index++;
if (capacity >= 100) {
fill_animation_logo(FULL_BATTERY_INDEX, fill_addr, dec_logo_addr, logo_addr,phical_screen);
charging_animation_index = 0;
} else if (capacity < 10) {LOG_ANIM("[show_animation_common: %s %d]charging_low_index = %d\n",__FUNCTION__,__LINE__, charging_low_index);
fill_animation_logo(LOW_BATTERY_INDEX, fill_addr, dec_logo_addr, logo_addr,phical_screen);
//add by lyj
fill_animation_number(NUMBER_PIC_START_0 + capacity, 1, fill_addr, logo_addr, phical_screen);
fill_animation_dynamic(NUMBER_PIC_PERCENT,percent_location_rect, fill_addr, percent_pic_addr, logo_addr, phical_screen);
if (charging_low_index >= 9) charging_low_index = 0;
charging_animation_index = 0;
} else {
// add by lyj 10-100
if(capacity >= 10 && capacity < 25){ //ONE_BATTERY_INDEX
int display = ONE_BATTERY_INDEX;
if(next_index == 0 && charging_animation_index > display_time_interval ){
next_index = 1;
display = TWO_BATTERY_INDEX;
charging_animation_index = 0;
}else if(next_index == 1 && charging_animation_index > display_time_interval ){
next_index = 0;
charging_animation_index = 0;
}
fill_animation_logo(display, fill_addr, dec_logo_addr, logo_addr,phical_screen);
}else if(capacity >= 25 && capacity < 40){ //TWO_BATTERY_INDEX
int display = TWO_BATTERY_INDEX;
if(next_index == 0 && charging_animation_index > display_time_interval ){
next_index = 1;
display = THREE_BATTERY_INDEX;
charging_animation_index = 0;
}else if(next_index == 1 && charging_animation_index > display_time_interval ){
next_index = 0;
charging_animation_index = 0;
}
fill_an