[Sony Cross-Device General] Adi Aisiteru Reborn:
Guide Smali How to add Flip Animation Quick Settings

Flip Animation Quick Settings , Youtube https://www.youtube.com/watch?v=DBBEsLk6ti4&feature=youtu.be

REQUIREMENT :

- ApkTool RC

- Notepad++

- Xperia KitKat

- Brain

- Patient

- Experience

STEP -1

Decompile SystemUI.apk

Download attached resources and sources, merge to your decompiled systemui

STEP -2

SystemUI.apk/res/layout/

somc_statusbar_notification_tools_button.xml

or

status_bar_notification_tools_button.xml

add the red line

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:gravity="center" android:orientation="vertical" android:id="@id/tools_button_layout" android:background="@drawable/somc_quick_settings_tool_button_bg" [COLOR="Red"]android:clickable="true"[/COLOR] android:layout_width="wrap_content" android:layout_height="wrap_content" android:minHeight="1.0dip"
xmlns:android="http://schemas.android.com/apk/res/android">
<FrameLayout android:layout_width="wrap_content" android:layout_height="wrap_content">
<ImageView android:id="@id/tools_button_img" android:layout_width="@dimen/qs_tile_icon_size" android:layout_height="@dimen/qs_tile_icon_size" android:scaleType="center" android:contentDescription="@null" />
<ImageView android:id="@id/tools_button_anim" android:visibility="invisible" android:layout_width="fill_parent" android:layout_height="wrap_content" android:scaleType="center" android:contentDescription="@null" />
</FrameLayout>
<TextView android:textSize="@dimen/status_bar_tools_button_label_text_size" android:gravity="top|center" android:id="@id/tools_button_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="@dimen/status_bar_tools_button_margin_bottom" android:lines="2" android:scrollHorizontally="false" android:includeFontPadding="false" />
</LinearLayout>

go to

com/sonymobile/systemui/statusbar/tools/ToolsButton.smali

Add the red line

# static fields
.field private static final TAG:Ljava/lang/String;

# instance fields
[COLOR="Red"].field private mHandler:Landroid/os/Handler;[/COLOR]

.field private mAccentColor:I

.field private mAnimationFrames:Ljava/util/ArrayList;
.annotation system Ldalvik/annotation/Signature;

Add the red line and pay attention to the register number in blue hint, each device can be different ,

it can be v3, v2, .. you must adapt it.

.method public constructor <init>(Landroid/content/Context;)V
.locals 9
.param p1, "context" # Landroid/content/Context;

.prologue
const/4 v8, 0x1

const/4 v7, 0x0

const/4 v6, -0x1

const/4 v5, 0x0

invoke-direct {p0, p1}, Landroid/widget/FrameLayout;-><init>(Landroid/content/Context;)V

const/high16 v3, -0x80000000

iput v3, p0, Lcom/sonymobile/systemui/statusbar/tools/ToolsButton;->mState:I

iput v7, p0, Lcom/sonymobile/systemui/statusbar/tools/ToolsButton;->mCurrentAnimationImage:I

iput-object v5, p0, Lcom/sonymobile/systemui/statusbar/tools/ToolsButton;->mAnimationFrames:Ljava/util/ArrayList;

new-instance v3, Landroid/util/SparseArray;

const/16 v4, 0xa

invoke-direct {v3, v4}, Landroid/util/SparseArray;-><init>(I)V

iput-object v3, p0, Lcom/sonymobile/systemui/statusbar/tools/ToolsButton;->mBitmaps:Landroid/util/SparseArray;

iput-boolean v7, p0, Lcom/sonymobile/systemui/statusbar/tools/ToolsButton;->mButtonClicked:Z

iput v7, p0, Lcom/sonymobile/systemui/statusbar/tools/ToolsButton;->mButtonType:I

iput-object p1, p0, Lcom/sonymobile/systemui/statusbar/tools/ToolsButton;->mContext:Landroid/content/Context;

new-instance [COLOR="Blue"]v3[/COLOR], Landroid/util/SparseArray;

invoke-direct {[COLOR="Blue"]v3[/COLOR]}, Landroid/util/SparseArray;-><init>()V

iput-object [COLOR="Blue"]v3[/COLOR], p0, Lcom/sonymobile/systemui/statusbar/tools/ToolsButton;->mStateIcons:Landroid/util/SparseArray;

[COLOR="Red"]new-instance [COLOR="Blue"]v3[/COLOR], Landroid/os/Handler;

invoke-direct {[COLOR="Blue"]v3[/COLOR]}, Landroid/os/Handler;-><init>()V

iput-object [COLOR="Blue"]v3[/COLOR], p0, Lcom/sonymobile/systemui/statusbar/tools/ToolsButton;->mHandler:Landroid/os/Handler;[/COLOR]

new-instance [COLOR="Blue"]v3[/COLOR], Landroid/util/SparseIntArray;

invoke-direct {[COLOR="Blue"]v3[/COLOR]}, Landroid/util/SparseIntArray;-><init>()V

iput-object [COLOR="Blue"]v3[/COLOR], p0, Lcom/sonymobile/systemui/statusbar/tools/ToolsButton;->mStateContentDescription:Landroid/util/SparseIntArray;

new-instance v2, Landroid/widget/FrameLayout$LayoutParams;

invoke-direct {v2, v6, v6}, Landroid/widget/FrameLayout$LayoutParams;-><init>(II)V

.local v2, "params":Landroid/widget/FrameLayout$LayoutParams;
invoke-static {p1}, Landroid/view/LayoutInflater;->from(Landroid/content/Context;)Landroid/view/LayoutInflater;

move-result-object v1

.local v1, "inflater":Landroid/view/LayoutInflater;
const [COLOR="Blue"]v3[/COLOR], 0x7f04001d

invoke-virtual {v1, [COLOR="Blue"]v3[/COLOR], v5}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;)Landroid/view/View;

move-result-object [COLOR="Blue"]v3[/COLOR]

check-cast [COLOR="Blue"]v3[/COLOR], Landroid/widget/LinearLayout;

iput-object [COLOR="Blue"]v3[/COLOR], p0, Lcom/sonymobile/systemui/statusbar/tools/ToolsButton;->mVerticalLayout:Landroid/widget/LinearLayout;

[COLOR="Red"]iget-object [COLOR="Blue"]v3[/COLOR], p0, Lcom/sonymobile/systemui/statusbar/tools/ToolsButton;->mVerticalLayout:Landroid/widget/LinearLayout;

invoke-virtual {[COLOR="Blue"]v3[/COLOR], p0}, Landroid/widget/LinearLayout;->setOnClickListener(Landroid/view/View$OnClickListener;)V

iget-object [COLOR="Blue"]v3[/COLOR], p0, Lcom/sonymobile/systemui/statusbar/tools/ToolsButton;->mVerticalLayout:Landroid/widget/LinearLayout;

invoke-virtual {[COLOR="Blue"]v3[/COLOR], p0}, Landroid/widget/LinearLayout;->setOnLongClickListener(Landroid/view/View$OnLongClickListener;)V
[/COLOR]

Next

add the red mehod

.method private enableButton(Z)V
.locals 1
.param p1, "enable" # Z

.prologue
if-eqz p1, :cond_0

move-object v0, p0

.local v0, "enableButton":Lcom/sonymobile/systemui/statusbar/tools/ToolsButton;
:goto_0
invoke-virtual {p0, v0}, Landroid/view/View;->setOnClickListener(Landroid/view/View$OnClickListener;)V

invoke-virtual {p0, v0}, Landroid/view/View;->setOnLongClickListener(Landroid/view/View$OnLongClickListener;)V

invoke-virtual {p0, v0}, Landroid/view/View;->setOnTouchListener(Landroid/view/View$OnTouchListener;)V

return-void

.end local v0 # "enableButton":Lcom/sonymobile/systemui/statusbar/tools/ToolsButton;
:cond_0
const/4 v0, 0x0

goto :goto_0
.end method

[COLOR="Red"].method private mOnLongClickVerticalLayout()V
.locals 6

.prologue
iget-object v0, p0, Lcom/sonymobile/systemui/statusbar/tools/ToolsButton;->mVerticalLayout:Landroid/widget/LinearLayout;

return-void
.end method[/COLOR]

.method private setImageBitmap(Landroid/widget/ImageView;Landroid/graphics/Bitmap;Z)V
.locals 2
.param p1, "imageView" # Landroid/widget/ImageView;
.param p2, "bitmap" # Landroid/graphics/Bitmap;
.param p3, "colorize" # Z

.prologue

invoke-virtual {p1, p2}, Landroid/widget/ImageView;->setImageBitmap(Landroid/graphics/Bitmap;)V

const v0, -0x55555556

invoke-static {p3}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;

move-result-object v1

invoke-virtual {p1, v0, v1}, Landroid/view/View;->setTag(ILjava/lang/Object;)V

Next find this line

# virtual methods

and add all red method

# virtual methods
[COLOR="Red"].method public flip()V
.locals 2

.prologue
const/4 v0, 0x0

invoke-virtual {p0, v0}, Lcom/sonymobile/systemui/statusbar/tools/ToolsButton;->flipTile(I)V

return-void
.end method

.method public flipTile(I)V
.locals 1
.param p1, "delay" # I

.prologue
.line 159
const/4 v0, 0x1

invoke-virtual {p0, p1, v0}, Lcom/sonymobile/systemui/statusbar/tools/ToolsButton;->flipTile(IZ)V

.line 160
return-void
.end method

.method public flipTile(IZ)V
.locals 5
.param p1, "delay" # I
.param p2, "flipRight" # Z

.prologue
.line 163
invoke-virtual {p0}, Lcom/sonymobile/systemui/statusbar/tools/ToolsButton;->isFlipTilesEnabled()Z

move-result v2

if-nez v2, :cond_0

.line 190
:goto_0
return-void

.line 164
:cond_0
iget-object v3, p0, Lcom/sonymobile/systemui/statusbar/tools/ToolsButton;->mContext:Landroid/content/Context;

if-eqz p2, :cond_1

const v2, 0x7f05001c

:goto_1
invoke-static {v3, v2}, Landroid/animation/AnimatorInflater;->loadAnimator(Landroid/content/Context;I)Landroid/animation/Animator;

move-result-object v0

check-cast v0, Landroid/animation/AnimatorSet;

.line 167
.local v0, "anim":Landroid/animation/AnimatorSet;
iget-object v2, p0, Lcom/sonymobile/systemui/statusbar/tools/ToolsButton;->mVerticalLayout:Landroid/widget/LinearLayout;

invoke-virtual {v0, v2}, Landroid/animation/AnimatorSet;->setTarget(Ljava/lang/Object;)V

.line 168
const-wide/16 v2, 0xc8

invoke-virtual {v0, v2, v3}, Landroid/animation/AnimatorSet;->setDuration(J)Landroid/animation/AnimatorSet;

.line 169
new-instance v2, Lcom/sonymobile/systemui/statusbar/tools/ToolsButton$31;

invoke-direct {v2, p0}, Lcom/sonymobile/systemui/statusbar/tools/ToolsButton$31;-><init>(Lcom/sonymobile/systemui/statusbar/tools/ToolsButton;)V

invoke-virtual {v0, v2}, Landroid/animation/AnimatorSet;->addListener(Landroid/animation/Animator$AnimatorListener;)V

.line 182
new-instance v1, Lcom/sonymobile/systemui/statusbar/tools/ToolsButton$32;

invoke-direct {v1, p0, v0}, Lcom/sonymobile/systemui/statusbar/tools/ToolsButton$32;-><init>(Lcom/sonymobile/systemui/statusbar/tools/ToolsButton;Landroid/animation/AnimatorSet;)V

.line 189
.local v1, "doAnimation":Ljava/lang/Runnable;
iget-object v2, p0, Lcom/sonymobile/systemui/statusbar/tools/ToolsButton;->mHandler:Landroid/os/Handler;

int-to-long v3, p1

invoke-virtual {v2, v1, v3, v4}, Landroid/os/Handler;->postDelayed(Ljava/lang/Runnable;J)Z

goto :goto_0

.line 164
.end local v0 # "anim":Landroid/animation/AnimatorSet;
.end local v1 # "doAnimation":Ljava/lang/Runnable;
:cond_1
const v2, 0x7f05001b

goto :goto_1
.end method

.method public isFlipTilesEnabled()Z
.locals 3

.prologue
const/4 v0, 0x1

.line 154
iget-object v1, p0, Lcom/sonymobile/systemui/statusbar/tools/ToolsButton;->mContext:Landroid/content/Context;

invoke-virtual {v1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

move-result-object v1

const-string v2, "quick_settings_tiles_flip"

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

move-result v1

if-ne v1, v0, :cond_0

:goto_0
return v0

:cond_0
const/4 v0, 0x0

goto :goto_0
.end method[/COLOR]

.method protected varargs addState(ILjava/lang/Integer;Lcom/sonymobile/systemui/statusbar/tools/ToolsButton$ToolsIcon;[Lcom/sonymobile/systemui/statusbar/tools/ToolsButton$ToolsIcon;)V
.locals 2
.param p1, "stateId" # I
.param p2, "stringId" # Ljava/lang/Integer;
.param p3, "stateIcon" # Lcom/sonymobile/systemui/statusbar/tools/ToolsButton$ToolsIcon;
.param p4, "animationIcons" # [Lcom/sonymobile/systemui/statusbar/tools/ToolsButton$ToolsIcon;

.prologue

iget-object v0, p0, Lcom/sonymobile/systemui/statusbar/tools/ToolsButton;->mStateIcons:Landroid/util/SparseArray;

invoke-virtual {v0, p1, p3}, Landroid/util/SparseArray;->put(ILjava/lang/Object;)V

iget-object v0, p0, Lcom/sonymobile/systemui/statusbar/tools/ToolsButton;->mStateContentDescription:Landroid/util/SparseIntArray;

invoke-virtual {p2}, Ljava/lang/Integer;->intValue()I

next search this method and add the red line

.method public onClick(Landroid/view/View;)V
.locals 2
.param p1, "view" # Landroid/view/View;

.prologue
iget-object v0, p0, Lcom/sonymobile/systemui/statusbar/tools/ToolsButton;->mAnimationView:Landroid/widget/ImageView;

invoke-virtual {v0}, Landroid/view/View;->getVisibility()I

move-result v0

if-nez v0, :cond_0

iget v0, p0, Lcom/sonymobile/systemui/statusbar/tools/ToolsButton;->mButtonType:I

const/4 v1, 0x2

if-ne v0, v1, :cond_1

:cond_0
invoke-virtual {p0}, Lcom/sonymobile/systemui/statusbar/tools/ToolsButton;->onAction()V

[COLOR="Red"]invoke-virtual {p0}, Lcom/sonymobile/systemui/statusbar/tools/ToolsButton;->flip()V[/COLOR]

const/4 v0, 0x1

iput-boolean v0, p0, Lcom/sonymobile/systemui/statusbar/tools/ToolsButton;->mButtonClicked:Z

:cond_1
return-void
.end method

.method public onLongClick(Landroid/view/View;)Z
.locals 2
.param p1, "view" # Landroid/view/View;

.prologue
const/4 v0, 0x0

.local v0, "clickHandled":Z
iget-object v1, p0, Lcom/sonymobile/systemui/statusbar/tools/ToolsButton;->mAnimationView:Landroid/widget/ImageView;

invoke-virtual {v1}, Landroid/view/View;->getVisibility()I

move-result v1

if-eqz v1, :cond_0

invoke-virtual {p0}, Lcom/sonymobile/systemui/statusbar/tools/ToolsButton;->onLongClickPopup()Z

move-result v1

if-eqz v1, :cond_1

const/4 v0, 0x1

:cond_0
:goto_0
[COLOR="Red"]invoke-direct {p0}, Lcom/sonymobile/systemui/statusbar/tools/ToolsButton;->mOnLongClickVerticalLayout()V[/COLOR]

return v0

:cond_1
const/4 v0, 0x0

goto :goto_0
.end method

Compile your systemUI

STEP-3

Decompile the newly recompiled again

next go to systemui/res/values/public.xml

<public type="anim" name="wallpaper_recents_launch_from_launcher_exit" id="0x7f05001a" />
[COLOR="Blue"]<public type="anim" name="flip_left" id="[COLOR="Red"]0x7f??????[/COLOR]" />[/COLOR]
[COLOR="Blue"]<public type="anim" name="flip_right" id="[COLOR="Red"]0x7f??????[/COLOR]" />[/COLOR]
<public type="xml" name="somc_skin_permissions" id="0x7f060000" />

next go to

com/sonymobile/systemui/statusbar/tools/ToolsButton.smali

serach this method

.method public flipTile(IZ)V
.locals 5
.param p1, "delay" # I
.param p2, "flipRight" # Z

.prologue
.line 163
invoke-virtual {p0}, Lcom/sonymobile/systemui/statusbar/tools/ToolsButton;->isFlipTilesEnabled()Z

move-result v2

if-nez v2, :cond_0

.line 190
:goto_0
return-void

.line 164
:cond_0
iget-object v3, p0, Lcom/sonymobile/systemui/statusbar/tools/ToolsButton;->mContext:Landroid/content/Context;

if-eqz p2, :cond_1

const v2, [COLOR="Red"]0x7f05001c[/COLOR]

:goto_1
invoke-static {v3, v2}, Landroid/animation/AnimatorInflater;->loadAnimator(Landroid/content/Context;I)Landroid/animation/Animator;

move-result-object v0

check-cast v0, Landroid/animation/AnimatorSet;

.line 167
.local v0, "anim":Landroid/animation/AnimatorSet;
iget-object v2, p0, Lcom/sonymobile/systemui/statusbar/tools/ToolsButton;->mVerticalLayout:Landroid/widget/LinearLayout;

invoke-virtual {v0, v2}, Landroid/animation/AnimatorSet;->setTarget(Ljava/lang/Object;)V

.line 168
const-wide/16 v2, 0xc8

invoke-virtual {v0, v2, v3}, Landroid/animation/AnimatorSet;->setDuration(J)Landroid/animation/AnimatorSet;

.line 169
new-instance v2, Lcom/sonymobile/systemui/statusbar/tools/ToolsButton$31;

invoke-direct {v2, p0}, Lcom/sonymobile/systemui/statusbar/tools/ToolsButton$31;-><init>(Lcom/sonymobile/systemui/statusbar/tools/ToolsButton;)V

invoke-virtual {v0, v2}, Landroid/animation/AnimatorSet;->addListener(Landroid/animation/Animator$AnimatorListener;)V

.line 182
new-instance v1, Lcom/sonymobile/systemui/statusbar/tools/ToolsButton$32;

invoke-direct {v1, p0, v0}, Lcom/sonymobile/systemui/statusbar/tools/ToolsButton$32;-><init>(Lcom/sonymobile/systemui/statusbar/tools/ToolsButton;Landroid/animation/AnimatorSet;)V

.line 189
.local v1, "doAnimation":Ljava/lang/Runnable;
iget-object v2, p0, Lcom/sonymobile/systemui/statusbar/tools/ToolsButton;->mHandler:Landroid/os/Handler;

int-to-long v3, p1

invoke-virtual {v2, v1, v3, v4}, Landroid/os/Handler;->postDelayed(Ljava/lang/Runnable;J)Z

goto :goto_0

.line 164
.end local v0 # "anim":Landroid/animation/AnimatorSet;
.end local v1 # "doAnimation":Ljava/lang/Runnable;
:cond_1
const v2, [COLOR="Red"]0x7f05001b[/COLOR]

goto :goto_1
.end method

change the red value in the smali

according to the value you got in your own public.xml

const v2, 0x7f05001c

with

[COLOR="Blue"]<public type="anim" name="flip_right" id="[COLOR="Red"]0x7f??????[/COLOR]" />[/COLOR]

and

const v2, 0x7f05001b

with

[COLOR="Blue"]<public type="anim" name="flip_left" id="[COLOR="Red"]0x7f??????[/COLOR]" />[/COLOR]

Done and compile your systemUI

Credits :

- Sony

- Darck CM

- CyanogenMod