[MOD] Recent App (Clear all, Setting, Card Stack) for Jelly Bean

Recent App bao gồm:

  1. Xóa tất cả ứng dụng đang chạy
  2. 1 nút để vào cài đặt
  3. Giao diện recent app dạng card stack (xếp chồng)

Bắt đầu mod:

Bước 1:

Decompile SystemUI.apk

Download file source mod, vào copy file source này vào SystemUI theo đúng đường dẫn, riêng folder layout, có 2 file xml, nên so sánh code rồi copy dòng code chưa có sang

Hướng dấn thêm chút:

res\layout\status_bar_rencent_item.xml

Chú ý các điểm sau:

android:rotationX=”-10.0″

android:textColor=”#ff243137″

… thôi nói chung copy giống hết đi :3

– SystemUI.apk/res/values/ids.xml

thêm được này trước </resource>

<item type="id" name="asteroid_recents_task_manager_button">false</item>
<item type="id" name="asteroid_recents_google_button">false</item>
<item type="id" name="asteroid_recents_clear_all_button">false</item>

SystemUI.apk/res/values/strings.xml
thêm được này trước </resource>
<string name="status_bar_recent_launch_task_manager_title">Task manager</string>
<string name="status_bar_recent_launch_google_button">Google</string>
<string name="status_bar_recent_remove_all_button">Remove all</string>

Recompile SystemUI.apk
Bước 2:
Decompile SystemUI.apk mới

đi đến res/values/public.xml và mở nó với notepad++
cứ để nó mở, lát sẽ cần

SystemUI.apk/smali/com/android/systemui/recent/RecentsPanelView.smali

Thêm dòng code đỏ
# instance fields
.field private mAnimateIconOfFirstTask:Z

.field private mFitThumbnailToXY:Z

.field private mGoogleButton:Landroid/widget/ImageButton;

.field private mHighEndGfx:Z
-----------------------------------------------------
.end annotation
.end field

.field private mRecentTasksLoader:Lcom/android/systemui/recent/RecentTasksLoader;

.field private mRecentsClearAllButton:Landroid/widget/ImageButton;

.field private mRecentsContainer:Landroid/view/ViewGroup;

.field private mRecentsNoApps:Landroid/view/View;

.field private mRecentsScrim:Landroid/view/View;

.field private mShowing:Z

.field private mStatusBarTouchProxy:Lcom/android/systemui/recent/StatusBarTouchProxy;

.field private mTaskManagerButton:Landroid/widget/ImageButton;

.field private mThumbnailWidth:I

.field private mWaitingForWindowAnimation:Z
--------------------------------------------
iput v1, p0, Lcom/android/systemui/recent/RecentsPanelView;->mRecentItemLayoutId:I

    .line 267
    invoke-static {p1}, Lcom/android/systemui/recent/RecentTasksLoader;->getInstance(Landroid/content/Context;)Lcom/android/systemui/recent/RecentTasksLoader;

    move-result-object v1

    iput-object v1, p0, Lcom/android/systemui/recent/RecentsPanelView;->mRecentTasksLoader:Lcom/android/systemui/recent/RecentTasksLoader;

    .line 268
    invoke-virtual {v0}, Landroid/content/res/TypedArray;->recycle()V

    .line 269
    return-void
.end method

.method private AsteroidClearAllRecentApps()V
    .locals 8

    .prologue
    const/4 v7, 0x1

    const/4 v6, 0x0

    iget-object v0, p0, Lcom/android/systemui/recent/RecentsPanelView;->mContext:Landroid/content/Context;

    const-string v1, "activity"

    invoke-virtual {v0, v1}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/app/ActivityManager;

    iget-object v1, p0, Lcom/android/systemui/recent/RecentsPanelView;->mRecentTaskDescriptions:Ljava/util/ArrayList;

    invoke-virtual {v1}, Ljava/util/ArrayList;->isEmpty()Z

    move-result v1

    if-nez v1, :cond_1

    iget-object v1, p0, Lcom/android/systemui/recent/RecentsPanelView;->mRecentTaskDescriptions:Ljava/util/ArrayList;

    invoke-virtual {v1}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator;

    move-result-object v2

    :goto_0
    invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z

    move-result v1

    if-eqz v1, :cond_0

    invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lcom/android/systemui/recent/TaskDescription;

    iget v3, v1, Lcom/android/systemui/recent/TaskDescription;->persistentTaskId:I

    invoke-virtual {v0, v3, v7}, Landroid/app/ActivityManager;->removeTask(II)Z

    iget-object v3, p0, Lcom/android/systemui/recent/RecentsPanelView;->mContext:Landroid/content/Context;

    const v4, 0x7f0b00a5

    new-array v5, v7, [Ljava/lang/Object;

    invoke-virtual {v1}, Lcom/android/systemui/recent/TaskDescription;->getLabel()Ljava/lang/CharSequence;

    move-result-object v1

    aput-object v1, v5, v6

    invoke-virtual {v3, v4, v5}, Landroid/content/Context;->getString(I[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {p0, v1}, Lcom/android/systemui/recent/RecentsPanelView;->setContentDescription(Ljava/lang/CharSequence;)V

    const/4 v1, 0x4

    invoke-virtual {p0, v1}, Lcom/android/systemui/recent/RecentsPanelView;->sendAccessibilityEvent(I)V

    const/4 v1, 0x0

    invoke-virtual {p0, v1}, Lcom/android/systemui/recent/RecentsPanelView;->setContentDescription(Ljava/lang/CharSequence;)V

    goto :goto_0

    :cond_0
    iget-object v0, p0, Lcom/android/systemui/recent/RecentsPanelView;->mRecentTaskDescriptions:Ljava/util/ArrayList;

    invoke-virtual {v0}, Ljava/util/ArrayList;->clear()V

    :cond_1
    invoke-virtual {p0}, Lcom/android/systemui/recent/RecentsPanelView;->dismissAndGoBack()V

    return-void
.end method

.method static synthetic access$177777700(Lcom/android/systemui/recent/RecentsPanelView;)V
    .locals 0
    .parameter "x0"

    .prologue
    .line 75
    invoke-direct {p0}, Lcom/android/systemui/recent/RecentsPanelView;->AsteroidClearAllRecentApps()V

    return-void
.end method

.method static synthetic access$000(Lcom/android/systemui/recent/RecentsPanelView;)Ljava/util/ArrayList;
    .locals 1
    .parameter "x0"

    .prologue
    .line 73
    iget-object v0, p0, Lcom/android/systemui/recent/RecentsPanelView;->mRecentTaskDescriptions:Ljava/util/ArrayList;

    return-object v0
.end method

.method static synthetic access$100(Lcom/android/systemui/recent/RecentsPanelView;)I
    .locals 1
    .parameter "x0"

    .prologue
    .line 73
    iget v0, p0, Lcom/android/systemui/recent/RecentsPanelView;->mRecentItemLayoutId:I
-------------------------------------
Đổi 0x7f0b00a5 với giá trị IDS có trong public.xml khi  nãy

<public type="string" name="accessibility_recents_item_dismissed" id="0x7f??????" />
Tiếp theo, tìm hàm này
.method protected onFinishInflate()V
kéo xuống trong hàm đó và add đoạn code đỏ trên return-void
invoke-virtual {v1, v2}, Landroid/view/View;->setBackground(Landroid/graphics/drawable/Drawable;)V

    .line 488
    :cond_0
    :goto_0
    const v1, 0x7f08012e

    invoke-virtual {p0, v1}, Lcom/android/systemui/recent/RecentsPanelView;->findViewById(I)Landroid/view/View;

    move-result-object v1

    check-cast v1, Landroid/widget/ImageButton;

    iput-object v1, p0, Lcom/android/systemui/recent/RecentsPanelView;->mRecentsClearAllButton:Landroid/widget/ImageButton;

    .line 499
    iget-object v1, p0, Lcom/android/systemui/recent/RecentsPanelView;->mRecentsClearAllButton:Landroid/widget/ImageButton;

    new-instance v2, Lcom/android/systemui/recent/RecentsPanelView$AsteroidClearAll;

    invoke-direct {v2, p0}, Lcom/android/systemui/recent/RecentsPanelView$AsteroidClearAll;-><init>(Lcom/android/systemui/recent/RecentsPanelView;)V

    invoke-virtual {v1, v2}, Landroid/widget/ImageButton;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    const v1, 0x7f08012c

    invoke-virtual {p0, v1}, Lcom/android/systemui/recent/RecentsPanelView;->findViewById(I)Landroid/view/View;

    move-result-object v1

    check-cast v1, Landroid/widget/ImageButton;

    iput-object v1, p0, Lcom/android/systemui/recent/RecentsPanelView;->mTaskManagerButton:Landroid/widget/ImageButton;

    iget-object v1, p0, Lcom/android/systemui/recent/RecentsPanelView;->mTaskManagerButton:Landroid/widget/ImageButton;

    new-instance v2, Lcom/android/systemui/recent/RecentsPanelView$AsteroidTaskManagerHelper;

    invoke-direct {v2, p0}, Lcom/android/systemui/recent/RecentsPanelView$AsteroidTaskManagerHelper;-><init>(Lcom/android/systemui/recent/RecentsPanelView;)V

    invoke-virtual {v1, v2}, Landroid/widget/ImageButton;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    const v1, 0x7f08012d

    invoke-virtual {p0, v1}, Lcom/android/systemui/recent/RecentsPanelView;->findViewById(I)Landroid/view/View;

    move-result-object v1

    check-cast v1, Landroid/widget/ImageButton;

    iput-object v1, p0, Lcom/android/systemui/recent/RecentsPanelView;->mGoogleButton:Landroid/widget/ImageButton;

    iget-object v1, p0, Lcom/android/systemui/recent/RecentsPanelView;->mGoogleButton:Landroid/widget/ImageButton;

    new-instance v2, Lcom/android/systemui/recent/RecentsPanelView$AsteroidGoogleHelper;

    invoke-direct {v2, p0}, Lcom/android/systemui/recent/RecentsPanelView$AsteroidGoogleHelper;-><init>(Lcom/android/systemui/recent/RecentsPanelView;)V

    invoke-virtual {v1, v2}, Landroid/widget/ImageButton;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    return-void

    .line 473
    .end local v0           #scrollView:Lcom/android/systemui/recent/RecentsPanelView$RecentsScrollView;
    :cond_1
    new-instance v1, Ljava/lang/IllegalArgumentException;

    const-string v2, "missing Recents[Horizontal]ScrollView"

    invoke-direct {v1, v2}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V

    throw v1

    .line 483
    .restart local v0       #scrollView:Lcom/android/systemui/recent/RecentsPanelView$RecentsScrollView;
----------------------
Change this 0x7f08012e
with the IDS value you got in your public.xml
<public type="id" name="asteroid_recents_clear_all_button" id="0x7f??????" />
--------------
this 0x7f08012c with
<public type="id" name="asteroid_recents_task_manager_button" id="0x7f??????" />
---------------
and this 0x7f08012d with
 <public type="id" name="asteroid_recents_google_button" id="0x7f??????" />
------------
- Xong, Recompile SystemUI.apk và sign nó
- copy Asteroid_taskmanager.apk, Quicksearcbox.apk, SystemUI.apk tới system/app nhớ set quyền 644 cho cả 3 file
- Khởi động lại và thưởng thức
Tested on ROM AOSP 4.2.2

tham khảo thông số này để card stack đẹp hơn
res/values/dimens.xml
<dimen name="status_bar_edge_ignore">5.0dip</dimen>
 <dimen name="status_bar_recents_app_icon_max_width">48.0dip</dimen>
 <dimen name="status_bar_recents_app_icon_max_height">48.0dip</dimen>
 <dimen name="status_bar_recents_thumbnail_width">260.0dip</dimen>
 <dimen name="status_bar_recents_thumbnail_height">170.0dip</dimen>
 <dimen name="status_bar_recents_thumbnail_bg_padding">4.0dip</dimen>
 <dimen name="status_bar_recents_app_label_text_size">14.0dip</dimen>
 <dimen name="status_bar_recents_app_description_text_size">14.0dip</dimen>
 <dimen name="status_bar_recents_text_fading_edge_length">20.0dip</dimen>
 <dimen name="status_bar_recents_scroll_fading_edge_length">10.0dip</dimen>
 <dimen name="status_bar_recents_right_glow_margin">100.0dip</dimen>
 <dimen name="status_bar_recents_thumbnail_left_margin">20.0dip</dimen>
 <dimen name="status_bar_recents_text_description_padding">8.0dip</dimen>
 <dimen name="status_bar_recents_app_label_width">0.0dip</dimen>
 <dimen name="status_bar_recents_app_label_left_margin">3.0dip</dimen>
 <dimen name="status_bar_recents_item_padding">0.0dip</dimen>
 <dimen name="status_bar_recents_app_icon_translate_distance">35.0dip</dimen>
 <dimen name="status_bar_recents_app_icon_left_margin">0.0dip</dimen>
 <dimen name="status_bar_recents_app_icon_top_margin">8.0dip</dimen>

 
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