[Android Themes] Kdio:
[MENTION=4894137]jlmvc[/MENTION] [MENTION=4607905]xxmrgreenxx[/MENTION] [MENTION=5282154]pas2001[/MENTION] and all

More one piece of the puzzle

XML Animation Generator

It uses Gimp but doesn't draw anything. Will only generate the XML necessary to produce the animation for use with the images you had already created with the other tools (or not).

The above set up shown in the screenshot will generate the code necessary to support the below animation:

For 62% level, it will be:

<item android:maxLevel="62">
<animation-list android:oneshot="false"
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:duration="250" android:drawable="@drawable/tw_stat_sys_battery_charge_anim62.png" />
<item android:duration="500" android:drawable="@drawable/tw_stat_sys_battery_charge_anim_a_62.png" />
<item android:duration="500" android:drawable="@drawable/tw_stat_sys_battery_charge_anim_b_62.png" />
<item android:duration="500" android:drawable="@drawable/tw_stat_sys_battery_charge_anim_a_62.png" />
<item android:duration="250" android:drawable="@drawable/tw_stat_sys_battery_charge_anim62.png" />
</animation-list>
</item>

Soon I will recompose the OP. For now, test it.

import os
from gimpfu import *

def xmlProcess(output_folder, battery_xml, icon_batt, steps, indexes, durations):

################################################
# Checking user inputs
################################################

battery_xml = battery_xml.strip()
if (battery_xml == ""):
pdb.gimp_message("A battery file name has to be supplied")
return

icon_batt = icon_batt.strip()
if (icon_batt == ""):
pdb.gimp_message("A battery name has to be supplied")
return

if (not ("<level>" in icon_batt)):
pdb.gimp_message("The sign '<level>' was not found in the battery name supplied")
return

if (not ("<index>" in icon_batt)):
pdb.gimp_message("The sign '<index>' was not found in the battery name supplied")
return

indexes = indexes.split(',')
if (not (len(indexes) == steps)):
pdb.gimp_message("The Indexes information supplied doesn't correspond to the quantity of Steps")
return

durations = durations.split(',')
if (not (len(durations) == steps)):
pdb.gimp_message("The Durations information supplied doesn't correspond to the quantity of Steps")
return

for duration in durations:
if (not (duration.isdigit())):
pdb.gimp_message("The Durations information supplied contain non-numeric information")
return
if (int(duration) < 100):
pdb.gimp_message("The Durations information supplied contain some step with less than 100ms")
return

################################################
# Creating the xml
################################################
xml = '<?xml version="1.0" encoding="utf-8"?>\n<level-list\n xmlns:android="http://schemas.android.com/apk/res/android">\n'

for level in range(0, 101):
xml += ' <item android:maxLevel="' + str(level) + '">\n <animation-list android:oneshot="false"\n xmlns:android="http://schemas.android.com/apk/res/android">\n'
for step in range(len(indexes)):
battName = icon_batt.replace('<index>', indexes[step])
battName = battName.replace('<level>', str(level))
xml += ' <item android:duration="' + str(durations[step]) + '" android:drawable="@drawable/' + battName + '" />\n'

xml += ' </animation-list>\n </item>\n'

xml += '</level-list>\n'

# Writing to file
f = open(os.path.join(output_folder, battery_xml), 'w')
f.write(xml)
f.close

register(
"Battery_XML_Generator",
"Generate XMLs for Animated Batteries",
"Generate XMLs for Animated Batteries",
"Kdio",
"Kdio",
"2014",
"Battery XML Generator...",
"",
[
(PF_DIRNAME, "output_folder", "_Output Folder", "c:/gimp/out"),
(PF_STRING, "battery_xml", "XML Battery", "tw_stat_sys_battery_charge_anim.xml"),
(PF_STRING, "icon_batt", "PNG Name", "tw_stat_sys_battery_charge_anim<index><level>.png"),
(PF_SPINNER, "steps", "Animation Steps", 5, (2, 10, 1)),
(PF_STRING, "indexes", "Indexes", ",a,b,a,"),
(PF_STRING, "durations", "Durations (ms)", "500,500,500,500,500"),
],
[],
xmlProcess,
menu="<Image>/The_ming",
)

main()