Changing the default wallpaper in an Android build

The other day, God graciously allowed me to compile PAC-ROM MM for the T-Mobile Samsung Galaxy S4 (JFLTETMO SGH-M919). So there are a lot of great things about this rom, but there were also a few things that I thought were lacking in creativity. Simple things really. Like the background. It comes standard with the CyanogenMod background. Well, that just doesn’t seem very PacRomish. So, I downloaded a custom background and edited the jpg until it was the right shape and size. I typically use Gimp for that, and today was no exception. After making the jpg into a 1920×1280 jpg file, I then used my home built script to make all of the “default_wallpaper.jpg” files. Here is the script:

[CODE]
#!/bin/bash

echo “Changing name of jpg file.”
mv *.jpg 1920×1280.jpg

echo “Converting to 1080×960”
convert -resize 1080×960 1920×1280.jpg 1080×960.jpg
echo “Converting to 960×800”
convert -resize 960×800 1920×1280.jpg 960×800.jpg
echo “Converting to 1440×1280”
convert -resize 1440×1280 1920×1280.jpg 1440×1280.jpg
echo “Converting to 2160×1920”
convert -resize 2160×1920 1920×1280.jpg 2160×1920.jpg
echo “Converting to 2880×2560”
convert -resize 2880×2560 1920×1280.jpg 2880×2560.jpg

echo “making folders”
mkdir ./drawable-hdpi
mkdir ./drawable-nodpi
mkdir ./drawable-sw600dp-nodpi
mkdir ./drawable-sw720dp-nodpi
mkdir ./drawable-xhdpi
mkdir ./drawable-xxhdpi
mkdir ./drawable-xxxhdpi

echo “copying and renaming pictures”
cp ./1080×960.jpg ./drawable-hdpi/default_wallpaper.jpg
cp ./960×800.jpg ./drawable-nodpi/default_wallpaper.jpg
cp ./1920×1280.jpg ./drawable-sw600dp-nodpi/default_wallpaper.jpg
cp ./1920×1280.jpg ./drawable-sw720dp-nodpi/default_wallpaper.jpg
cp ./1440×1280.jpg ./drawable-xhdpi/default_wallpaper.jpg
cp ./2160×1920.jpg ./drawable-xxhdpi/default_wallpaper.jpg
cp ./2880×2560.jpg ./drawable-xxxhdpi/default_wallpaper.jpg

echo “Complete.”
echo “Move the drawable* folders to ‘vendor/pac/overlay/common/frameworks/base/core/res/res’ folder.”
[/CODE]

You have to have imagemagic installed on your machine to use this script. Then, simply place your jpg file in a folder by itself, add this script to the folder, and run it! Here is the output:

[CODE]
alaskalinuxuser@alaskalinuxuser-HP-Compaq-6715b-FY288UC-ABA:~/Documents/projects/phones/wallpapers/pacman/images$ ls
pacman.jpg picscriptphones.sh
alaskalinuxuser@alaskalinuxuser-HP-Compaq-6715b-FY288UC-ABA:~/Documents/projects/phones/wallpapers/pacman/images$ ./picscriptphones.sh
Changing name of jpg file.
Converting to 1080×960
Converting to 960×800
Converting to 1440×1280
Converting to 2160×1920
Converting to 2880×2560
making folders
copying and renaming pictures
Complete.
Move the drawable* folders to ‘vendor/pac/overlay/common/frameworks/base/core/res/res’ folder.
alaskalinuxuser@alaskalinuxuser-HP-Compaq-6715b-FY288UC-ABA:~/Documents/projects/phones/wallpapers/pacman/images$ ls
1080×960.jpg 2160×1920.jpg drawable-hdpi drawable-sw720dp-nodpi drawable-xxxhdpi
1440×1280.jpg 2880×2560.jpg drawable-nodpi drawable-xhdpi picscriptphones.sh
1920×1280.jpg 960×800.jpg drawable-sw600dp-nodpi drawable-xxhdpi
alaskalinuxuser@alaskalinuxuser-HP-Compaq-6715b-FY288UC-ABA:~/Documents/projects/phones/wallpapers/pacman/images$ ls drawable-hdpi/
default_wallpaper.jpg
alaskalinuxuser@alaskalinuxuser-HP-Compaq-6715b-FY288UC-ABA:~/Documents/projects/phones/wallpapers/pacman/images$
[/CODE]

Once I moved the drawable folders to the folder mentioned above, I simply re-ran the compiler:

[CODE]
$ brunch jfltetmo
…..Edited for space…..
===============================-Package complete-===============================
Zip: /home/alaskalinuxuser/Documents/projects/phones/compile/pac6/out/target/product/jfltetmo/pac_jfltetmo__20160616-055233.zip
MD5: 61321450dfd6eed47ac7702cb7da7b1a
Size: 294M
OTA Link: http://pac-rom.com/ota/?device=jfltetmo&version=pac_jfltetmo__20160616-055233&md5=61321450dfd6eed47ac7702cb7da7b1a
================================================================================
…..Edited for space…..
[/CODE]

Now even a simple change like the backgrounds takes a good bit of time. It took my slow computer 2 hours just to make this one change. So don’t be alarmed if it takes a while for you too!

Linux – keep it simple.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s