[Samsung Epic 4G Touch] tdunham:
Ink Effect Mod 18 Colors for JB

Ripple effect must already be enabled for this mod to work.

This mod is pretty complex and requires a good deal of tedious work.

Fortunately, I've already done most of the hard stuff but there is still some left to do so let's get on it. ;)

If something is not clear, let me know and I will try to clarify. Tnx - TD

First of all, please download and extract the attached file.

Android.policy.jar smali edits

The android.policy.jar file edits are pretty straightforward. Just copy over the pre-modified smali files, replacing any existing files and recompile.

SecSettings.apk edits

Copy over the ink .png files over to the decompiled SecSettings.apk from the files download.

Add the following code to strings:

res/values/strings.xml

<string name="ink_effect_color_none">None</string>
<string name="ink_effect_color_yellow">Yellow</string>
<string name="ink_effect_color_lightblue">LightBlue</string>
<string name="ink_effect_color_pink">Pink</string>
<string name="ink_effect_color_dark_red">Dark Red</string>
<string name="ink_effect_color_pure_gold">Gold</string>
<string name="ink_effect_color_dark_green">Dark Green</string>
<string name="ink_effect_color_cyan">Cyan</string>
<string name="ink_effect_color_bright_red">Bright Red</string>
<string name="ink_effect_color_magenta">Magenta</string>
<string name="ink_effect_color_silver">Silver</string>

Compile SecSettings.apk and then DECOMPILE the new SecSettings.apk because we need to get the new values from res/public.xml.

Before we start working on the smali code for SecSettings, we now need to fill out the blank worksheet provided in the file below. A sample worksheet has already been included.

Here is an excerpt:

[COLOR="Blue"]Color[/COLOR] [COLOR="Blue"]Ink_effect_color[/COLOR] [COLOR="Blue"]Ink_color[/COLOR]
LockscreenSettings InkeffectPreview
None 7f090f48 7f0203ef
7f0203f0
Orange 7f090d67 7f0203f1
7f0203f2
Green 7f090d68 7f0203e9
7f0203ea
Red 7f090d66 7f0203f7
7f0203f8
Blue 7f090d6a 7f0203e5
7f0203e6
Navy 7f090d6b 7f0203ed
7f0203ee
Purple 7f090d6c 7f0203f5
7f0203f6
Light Blue 7f090f4a 7f0203eb
7f0203ec
Pink 7f090f4b 7f0203f3
7f0203f4
Yellow 7f090f49 7f0203f9
7f0203fa
Black 7f090d6d 7f0203e3
7f0203e4

Worksheet legend - by category

:

Color - 19 colors listed in the order they are programmed in.

- Note: NONE is considered a color since it has an image file and takes up a line of its own in all the arrays.

Ink_effect_color - values associated to the string values.

- For example: ink_effect_color_black - in public.xml value is represented as 7f090d6d

Ink_color - these are the drawable values that represent the .png image files we placed in the drawable-hdpi folder before compiling

- For example: ink_black in public.xml value is represented as 7f0203e3

__________________________________________

Fill out the Worksheet

Now, we are going to fill out the included blank worksheet and this will take a little time so be careful and patient.

Open SecSettings/res/values/public.xml in notepad+.

Also open Ink.template.blank in notepad+ so both files are open at the same time.

Ink_effect_color Category

Search res/values/public.xml for ink_effect_color and copy and paste the 8 character value (without the leading 0X) into the spreadsheet for the corresponding color and keep doing this until all colors have a value in the ink_effect_color category.

Ink_color Category

Search res/values/public.xml for ink_black. We have 2 entries, one for ink_black and one for ink_black_h like so:

<public type="drawable" name="ink_black" id="0x7f0203e3" />
<public type="drawable" name="ink_black_h" id="0x7f0203e4" />

Copy and paste ink_black value directly beneath the ink_color row and copy and paste the ink_black_h value offset as shown in the filled out example worksheet. Keep going through public.xml until you have filled out all the colors as shown in the example worksheet.

Black 7f090d6d 7f0203e3
[COLOR="Red"]7f0203e4[/COLOR]

Now that the worksheet is completely filled out, we can start editing the arrays.

You can see that the second row on the worksheet shows the file we will be editing for the corresponding values.

SecSettings Smali Edit:

com/android/settings/LockScreenSettings.smali

Before:

.line 262
.local v5, ps:Landroid/preference/PreferenceScreen;
iget-object v9, p0, Lcom/android/settings/LockScreenSettings;->mInkEffect:Landroid/preference/PreferenceScreen;

invoke-virtual {v5, v9}, Landroid/preference/PreferenceScreen;->removePreference(Landroid/preference/Preference;)Z

After:

.line 262
.local v5, ps:Landroid/preference/PreferenceScreen;
iget-object v9, p0, Lcom/android/settings/LockScreenSettings;->mInkEffect:Landroid/preference/PreferenceScreen;

[COLOR="Red"]# invoke-virtual {v5, v9}, Landroid/preference/PreferenceScreen;->removePreference(Landroid/preference/Preference;)Z[/COLOR]

Find array_10:

:array_10
.array-data 0x4
0x[COLOR="Blue"]48[/COLOR]t 0x[COLOR="Blue"]f[/COLOR]t 0x[COLOR="Blue"]9[/COLOR]t 0x[COLOR="Blue"]7f[/COLOR]t
0x67t 0xdt 0x9t 0x7ft
0x68t 0xdt 0x9t 0x7ft
0x66t 0xdt 0x9t 0x7ft
0x6at 0xdt 0x9t 0x7ft
0x6bt 0xdt 0x9t 0x7ft
0x6ct 0xdt 0x9t 0x7ft
0x6dt 0xdt 0x9t 0x7ft
0x4at 0xft 0x9t 0x7ft
0x4bt 0xft 0x9t 0x7ft
0x49t 0xft 0x9t 0x7ft
0x69t 0xdt 0x9t 0x7ft
0x4ct 0xft 0x9t 0x7ft
0x4dt 0xft 0x9t 0x7ft
0x4et 0xft 0x9t 0x7ft
0x4ft 0xft 0x9t 0x7ft
0x50t 0xft 0x9t 0x7ft
0x51t 0xft 0x9t 0x7ft
0x52t 0xft 0x9t 0x7ft
.end array-data
.end method

EVERY ARRAY IS ARRANGED IN THE SAME ORDER AS THE WORKSHEET

This is where it gets interesting. By my example worksheet, we can see that the value for None is 7f090f48, (that is the row in the worksheet we are using for this array).

Let's break down the array. The array has 4 vertical rows. You will notice that nearly all of the vertical rows except for rows #1 and rows #2 have the same values.

The first HORIZONTAL row is the value for NONE. The 7f090f48 is listed BACKWARDS 2 characters at a time. The same values are hightlighted blue in our array above for row 1. 48 is row1, f is row 2 (notice the leading zero drops off for rows 2 & 3), 9 is row 3, 7f is row 4.

Value listed backwards in groups of two, and corresponding first line of the array:

48 0f 09 7f
0x48t 0xft 0x9t 0x7ft

Now take the values listed in the worksheet you filled out and start putting the values in the array accordingly. The only values you should be inputting into this array are from the ink_effect_color category.

Note: More than likely you will not need to edit vertical rows 3 & 4 at all.

SecSettings Smali Edit:

com/android/settings/InkeffectPreview.smali

Find arrays 14 & 28:

.line 50
:array_14
.array-data 0x4
0xeft 0x3t 0x2t 0x7ft
0xf1t 0x3t 0x2t 0x7ft
0xe9t 0x3t 0x2t 0x7ft
0xf7t 0x3t 0x2t 0x7ft
0xe5t 0x3t 0x2t 0x7ft
0xedt 0x3t 0x2t 0x7ft
0xf5t 0x3t 0x2t 0x7ft
0xe3t 0x3t 0x2t 0x7ft
0xebt 0x3t 0x2t 0x7ft
0xf3t 0x3t 0x2t 0x7ft
0xf9t 0x3t 0x2t 0x7ft
0xe7t 0x3t 0x2t 0x7ft
0x01t 0x4t 0x2t 0x7ft
0x05t 0x4t 0x2t 0x7ft
0xfft 0x3t 0x2t 0x7ft
0xfdt 0x3t 0x2t 0x7ft
0xfbt 0x3t 0x2t 0x7ft
0x03t 0x4t 0x2t 0x7ft
0x07t 0x4t 0x2t 0x7ft
.end array-data

.line 59
:array_28
.array-data 0x4
0xf0t 0x3t 0x2t 0x7ft
0xf2t 0x3t 0x2t 0x7ft
0xeat 0x3t 0x2t 0x7ft
0xf8t 0x3t 0x2t 0x7ft
0xe6t 0x3t 0x2t 0x7ft
0xeet 0x3t 0x2t 0x7ft
0xf6t 0x3t 0x2t 0x7ft
0xe4t 0x3t 0x2t 0x7ft
0xect 0x3t 0x2t 0x7ft
0xf4t 0x3t 0x2t 0x7ft
0xfat 0x3t 0x2t 0x7ft
0xe8t 0x3t 0x2t 0x7ft
0x02t 0x4t 0x2t 0x7ft
0x06t 0x4t 0x2t 0x7ft
0x00t 0x4t 0x2t 0x7ft
0xfet 0x3t 0x2t 0x7ft
0xfct 0x3t 0x2t 0x7ft
0x04t 0x4t 0x2t 0x7ft
0x08t 0x4t 0x2t 0x7ft
.end array-data
.end method

We are going to do the same thing we did for the LockScreenSettings array here.

The first array (array_14) is going to get the values directly below the ink_color category.

The second array (array_28) is going to get the values that were offset beneath the same category.

Note: These offset values represent the drawable value of the colors with the _h at the end of their filename. That is the reason we separated them slightly for easier viewing. ;)

Find beginning of color selection menu:

.line 81
sget-object v2, Lcom/android/settings/InkeffectPreview;->mInkcolorItem:[Ljava/lang/String;

invoke-virtual {p0}, Lcom/android/settings/InkeffectPreview;->getResources()Landroid/content/res/Resources;

move-result-object v3

const v4, 0x[COLOR="Red"]7f090f48[/COLOR]

invoke-virtual {v3, v4}, Landroid/content/res/Resources;->getString(I)Ljava/lang/String;

const-string v3, [COLOR="Red"]"None"[/COLOR]

aput-object v3, v2, v7

.line 82
sget-object v2, Lcom/android/settings/InkeffectPreview;->mInkcolorItem:[Ljava/lang/String;

invoke-virtual {p0}, Lcom/android/settings/InkeffectPreview;->getResources()Landroid/content/res/Resources;

move-result-object v3

const v4, 0x[COLOR="Red"]7f090d67[/COLOR]

invoke-virtual {v3, v4}, Landroid/content/res/Resources;->getString(I)Ljava/lang/String;

const-string v3, [COLOR="Red"]"Orange"[/COLOR]

aput-object v3, v2, v6

.line 83
sget-object v2, Lcom/android/settings/InkeffectPreview;->mInkcolorItem:[Ljava/lang/String;

invoke-virtual {p0}, Lcom/android/settings/InkeffectPreview;->getResources()Landroid/content/res/Resources;

move-result-object v3

const v4, 0x[COLOR="Red"]7f090d68[/COLOR]

invoke-virtual {v3, v4}, Landroid/content/res/Resources;->getString(I)Ljava/lang/String;

const-string v3, [COLOR="Red"]"Green"[/COLOR]

aput-object v3, v2, v8

This edit is pretty straightforward. Go through and replace all 19 matching values in this section (remember NONE is still a color for coding purposes). The values are from our worksheet beneath the category Ink_effect_color.