[Galaxy S II Android Development] remuntada78:
it's my turn:D i need help

i'm trying to achieve the "switch button style" mod to change it in real time

in my framework-res.apk in res\value\attrs.xml i added these lines

<attr name="thumb1" format="reference" />
<attr name="track1" format="reference" />

then in res\value\styles i changed this code

<style name="Widget.DeviceDefault.CompoundButton.Switch" parent="@style/Widget.Holo.CompoundButton.Switch">
<item name="textSize">14.0dip</item>
<item name="thumb">@drawable/tw_switch_inner_holo_dark</item>
<item name="track">@drawable/tw_switch_track_holo_dark</item>
<item name="thumbTextPadding">12.0dip</item>
</style>

to this

<style name="Widget.DeviceDefault.CompoundButton.Switch" parent="@style/Widget.Holo.CompoundButton.Switch">
<item name="textSize">14.0dip</item>
<item name="thumb">@drawable/tw_switch_inner_holo_dark</item>
<item name="track">@drawable/tw_switch_track_holo_dark</item>
<item name="thumb1">@drawable/switch_inner_holo_dark</item>
<item name="track1">@drawable/switch_track_holo_dark</item>
<item name="thumbTextPadding">12.0dip</item>
</style>

tw_switch_inner_holo_dark.xml and tw_switch_track_holo_dark.xml define pngs for samsung style , switch_inner_holo_dark.xml and switch_track_holo_dark define pngs for google style

then in my framework2.jar in android/widget/ in Switch.smali in added the below red code

.line 198
iget-object v6, p0, Landroid/widget/Switch;->mTextPaint:Landroid/text/TextPaint;

invoke-virtual {v4}, Landroid/content/res/Resources;->getCompatibilityInfo()Landroid/content/res/CompatibilityInfo;

move-result-object v9

iget v9, v9, Landroid/content/res/CompatibilityInfo;->applicationScale:F

invoke-virtual {v6, v9}, Landroid/text/TextPaint;->setCompatibilityScaling(F)V

.line 200[COLOR="Red"]
invoke-virtual {p1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v1

const-string v2, "switch_button_style"

const/4 v3, 0x0

invoke-static {v1, v2, v3}, Landroid/provider/Settings$System;->getInt(Landroid/content/ContentResolver;Ljava/lang/String;I)I

move-result v1

const v2, 0x1

if-eq v1, v2, :cond_new

sget-object v6, Lcom/android/internal/R$styleable;->Switch:[I

goto :goto_new

:cond_new
sget-object v6, Lcom/android/internal/R$styleable;->Switch_google:[I

:goto_new[/COLOR]
invoke-virtual {p1, p2, v6, p3, v7}, Landroid/content/Context;->obtainStyledAttributes(Landroid/util/AttributeSet;[III)Landroid/content/res/TypedArray;

move-result-object v0

.line 203
.local v0, a:Landroid/content/res/TypedArray;
const/4 v6, 0x2

invoke-virtual {v0, v6}, Landroid/content/res/TypedArray;->getDrawable(I)Landroid/graphics/drawable/Drawable;

move-result-object v6

iput-object v6, p0, Landroid/widget/Switch;->mThumbDrawable:Landroid/graphics/drawable/Drawable;

.line 204
const/4 v6, 0x4

then in my framework.jar in com/android/internal/ in R$styleable.smali in added the below red lines

const/16 v0, 0x8

new-array v0, v0, [I

fill-array-data v0, :array_1018

sput-object v0, Lcom/android/internal/R$styleable;->Switch:[I
[COLOR="Red"]
const/16 v0, 0x8

new-array v0, v0, [I

fill-array-data v0, :array_google_switch

sput-object v0, Lcom/android/internal/R$styleable;->Switch_google:[I[/COLOR]

and

:array_1018
.array-data 0x4
0x24t 0x1t 0x1t 0x1t
0x25t 0x1t 0x1t 0x1t
0x42t 0x1t 0x1t 0x1t [COLOR="RoyalBlue"]<----- this is thumb id [/COLOR]
0x6et 0x3t 0x1t 0x1t
0x6ft 0x3t 0x1t 0x1t [COLOR="RoyalBlue"]<------this is track id [/COLOR]
0x70t 0x3t 0x1t 0x1t
0x71t 0x3t 0x1t 0x1t
0x72t 0x3t 0x1t 0x1t
.end array-data
[COLOR="Red"]
:array_google_switch
.array-data 0x4
0x24t 0x1t 0x1t 0x1t
0x25t 0x1t 0x1t 0x1t
0x76t 0x4t 0x1t 0x1t [COLOR="RoyalBlue"]<------this is thumb1 id [/COLOR]
0x6et 0x3t 0x1t 0x1t
0x77t 0x4t 0x1t 0x1t [COLOR="RoyalBlue"]<------this is track1 id [/COLOR]
0x70t 0x3t 0x1t 0x1t
0x71t 0x3t 0x1t 0x1t
0x72t 0x3t 0x1t 0x1t
.end array-data[/COLOR]

with samsung style no problem

but problem with google style

why it is resized ?