• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Themes [Android] TWRP Theme Porter

  • Thread starter Thread starter ModdingMyMind
  • Start date Start date
M

ModdingMyMind

Guest
I have put together a script called, TWRPPORTER, that will port both the images and the ui.xml file from one specified resolution to another specified resolution.

The ui porter will not port the keyboardtemplate so it must be dealt with manually, and it will not touch the font size since that tends to be a preference amongst different devices, but it will handle everything else.

The images known to be used for TWRP themes are .jpg, and .png so the script will search for the given extensions based on where you point it to and then determine the original width and height of each image. It will resize them accordingly and write back to that same image to prevent duplicates.

After the script has been ran and you adjust the font size, then manually port the keyboardtemplate, all you are required to do is zip it up and name it, ui.zip.

Inside your TWRP folder will be another foldered named, theme (lowercase). Place the ui.zip inside the theme folder and boot in to your TWRP Recovery. Voila.

Please, keep in mind, that if you come across a TWRP theme which you later port and some things are still slightly off it could be due to a few causes:

1. The original theme developer was sloppy with his own work so you must fix his mistakes.

2. You grabbed a Theme designed for a Tablet to use on a regular device or vice versa. - ( Please use common sense)

Both scripts require the use of busybox applets which have been symlinked.

The script also requires the use of GraphicsMagick (gm) when porting images. Which overall the utility is mainly known for being a Linux utility but I was able to cross compile it from source. GM has been embedded into the TWRPPORTER script. When you run the script it will give you the option to install GM if your device is found not to have it. Later, the script will also give you the option to uninstall it if you so choose to do so.

The TWRPPORTER script will save a person HOURS of their time while porting TWRP Themes, but don't be fooled as the user will still be expected to have some personal experience porting such themes. The TWRPUI script WILL have to echo on to your screen certain values which can be located within "variable names" inside the ui.xml file. These special case values are to be determined by the human mind whether they resemble width or height and at which the user will type and enter, w/W or h/H. These special case values cannot be automatically determined simply due to the fact that any given themer can call these variable names whatever they want if they deem it necessary to do so. However, I have implemented some checks in to the script to help reduce this as much as possible.

However, the script WILL hunt down all x=, y=, w=, h=, width=, and height= values then automatically modify them according to the base and port resolution given as info to the script.

Once the script finishes you will find a file called, PORT_UI.xml.

To get access to this TWRP Theme Porter you can find it on my repo provided within the below link. The README.md file will provide a little more information.

https://github.com/ModdingMyMind/TWRP_IMAGE_PORTER

TWRPIMAGE
ty8u3asu.jpg


TWRPUI
vy2a4a4y.jpg
 
Hey guys, been wanting to fix up the script to run some of it's internal functions parrallel with one another. Been having difficulties in regards to the VVALUE function being passed up. Anyone with experience on scripting please take a look and see if you can come up with an idea.

Merely looking to run the TWRPUI script at a much quicker pace.

It's currently working great and well stable, but I wish to improve it's speed overall.
 
https://github.com/ModdingMyMind/TWRP_IMAGE_PORTER/commit/3ef72ac1a43671f64cd69062fa0518ad21e49a98

Overhaul Update:
- Merged TWRPIMAGE and TWRPUI into one script called, TWRPPORTER
- Still kept old method but moved over to OLD folder.
- Updated root of README.md to reflect changes and instructions.
- Script will check system for gm and busybox. The script will inform you if neither are installed and then abort the script.
- Updated script to read and accept directory/filenames with spaces. The old method did not do this.
- Script will port the TWRP Images, or the TWRP ui, or BOTH based on the user's selection while running TWRPPORTER.
 
https://github.com/ModdingMyMind/TWRP_IMAGE_PORTER/commit/5df4977a68c0ad5de80ddcf8f3f1d37ced3efc30

NEW UPDATE:
- Bumped to version 3.0.
- GM binary has been embedded in to the TWRPPORTER script.
- TWRPORTER can install GM from extracting the embedded data itself as requested by the user.
- TWRPORTER can uninstall GM as requested by the user.
- If busybox is found not installed the script WILL abort after a quick warning to the user.
- Have added more checks to the script to keep it running smooth. Most is merely cosmetic work.
- At the end of the script is the GM binary data which has been embedded. DO NOT MESS WITH IT!
- GM will work for pre-jb devices and up. It is in compliance with Android L (current release). Initially compiled for ARM.
 
Back
Top Bottom