hướng dẫn mod recent apps phong cách sense ui cho các máy lg
các máy khác hoặc rom khác có thể làm tương tự vì cầu trúc gần giống nhau, khi mod có vấn đề gì cùng post lên đây thảo luận :d
cách decompile và recompile apk tham khảo tại đây http://lgviet.com/forum/threads/mot-vai-tip-co-ban-khi-chinh-sua-apk.2841/
1. ở framework-res.apk tìm res/values/dimens.xml
sửa
Mã:
<dimen name="thumbnail_height">145.0dip</dimen>
<dimen name="thumbnail_width">164.0dip</dimen>
thành
Mã:
<dimen name="thumbnail_height">267.0dip</dimen>
<dimen name="thumbnail_width">168.0dip</dimen>
2. sửa systemui
1. mở res/values/bools.xml
tìm
Mã:
<bool name="config_recents_thumbnail_image_fits_to_xy">false</bool>
sửa false thành true
mở res/values/dimens.xml sửa
status_bar_recents_thumbnail_width thành 168.0dip
status_bar_recents_thumbnail_height thành 267.0dip
2. mở res/values/strings/xml thêm dòng
Mã:
<string name="recent_apps_title">recent apps</string>
(có thể thay “recent apps” thành gì đó bạn muốn)
3. mở res/layout/status_bar_no_recent_apps.xml
tìm
Mã:
<textview android:textsize="20.0dip" android:textcolor="@*android:color/holo_blue_light" android:gravity="center_horizontal" android:layout_gravity="center" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/status_bar_no_recent_apps" />
sửa thành
Mã:
<textview android:textsize="20.0dip" android:textcolor="@*android:color/white" android:gravity="center_horizontal" android:layout_gravity="center" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/status_bar_no_recent_apps" />
4. mở res/layout-port/status_bar_recent_item.xml thay cả code thành
Mã:
<?xml version="1.0" encoding="utf-8"?>
<framelayout android:paddingleft="@dimen/status_bar_recents_item_padding" android:paddingright="@dimen/status_bar_recents_item_padding" android:layout_width="wrap_content" android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<relativelayout android:layout_gravity="center_vertical" android:id="@id/recent_item" android:paddingtop="@*android:dimen/status_bar_height" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerinparent="true">
<framelayout android:id="@id/app_thumbnail" android:android:visibility="invisible" android:layout_width="wrap_content" android:layout_height="wrap_content" android:foreground="#00000000" android:layout_centerinparent="true">
<imageview android:id="@id/app_thumbnail_image" android:paddingtop="60.0dip" android:layout_width="212.0dip" android:layout_height="455.0dip" android:layout_margintop="30.0dip" android:scaletype="centerinside" />
</framelayout>
<imageview android:gravity="center_horizontal" android:id="@id/app_icon" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_margintop="405.0dip" android:scaletype="centerinside" android:adjustviewbounds="true" android:maxwidth="@dimen/status_bar_recents_app_icon_max_width" android:maxheight="@dimen/status_bar_recents_app_icon_max_height" />
<textview android:textsize="@dimen/status_bar_recents_app_label_text_size" android:textcolor="@color/status_bar_recents_app_label_color" android:ellipsize="marquee" android:gravity="center_horizontal" android:id="@id/app_label" android:paddingtop="0.0dip" android:fadingedge="none" android:fadingedgelength="0.0dip" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_margintop="3.0dip" android:scrollhorizontally="true" android:singleline="true" android:layout_below="@id/app_icon" android:layout_alignparentbottom="true" />
<textview android:textsize="@dimen/status_bar_recents_app_description_text_size" android:ellipsize="marquee" android:id="@id/app_description" android:fadingedge="horizontal" android:fadingedgelength="@dimen/status_bar_recents_text_fading_edge_length" android:layout_width="@dimen/status_bar_recents_app_label_width" android:layout_height="wrap_content" android:layout_marginleft="@dimen/status_bar_recents_app_label_left_margin" android:layout_margintop="40.0dip" android:scrollhorizontally="true" android:singleline="true" android:layout_below="@id/app_label" android:layout_alignparentbottom="true" />
</relativelayout>
</framelayout>
5. res/layout-port/status_bar_recent_panel.xml
bỏ từ dòng có androidrientation="vertical" android:id="@id/recents_bg_protect"
đến hết dòng có </com.android.systemui.recent.recentsverticalscrollv iew>
thay bằng cái này
Mã:
<linearlayout android:orientation="vertical" android:id="@id/recents_bg_protect" android:android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignparentbottom="true">
<linearlayout android:orientation="horizontal" android:id="@id/recents_bg_linear" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1.0">
<framelayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignparentright="true">
<imageview android:id="@id/recents_transition_placeholder_icon" android:visibility="invisible" android:layout_width="wrap_content" android:layout_height="wrap_content" />
<com.android.systemui.recent.recentshorizontalscrollview android:layout_gravity="bottom|left|center" android:id="@id/recents_container" android:scrollbars="none" android:fadingedge="none" android:fadingedgelength="0.0dip" android:clipchildren="false" android:cliptopadding="false" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginright="0.0dip" android:stackfrombottom="true" android:divider="@null">
<linearlayout android:orientation="horizontal" android:id="@id/recents_linear_layout" android:clipchildren="false" android:cliptopadding="false" android:layout_width="fill_parent" android:layout_height="wrap_content" />
</com.android.systemui.recent.recentshorizontalscrollview>
<textview android:textsize="20.0dip" android:textcolor="@color/status_bar_recents_app_label_color" android:gravity="center_horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_margintop="5.0dip" android:text="@string/recent_apps_title" />
</framelayout>
</linearlayout>
(vì file này mỗi rom mỗi khác)
chú ý ở đầu dòng có android:id="@id/recents_bg_protect" nếu là <framelayout thì code thêm vào mở bằng <framelayout, nếu là <linearlayout thì thêm vào mở bằng <linearlayout
thêm xong sẽ như thế này
6. res/layout-land/status_bar_recent_item.xml thay cả file thành
Mã:
<?xml version="1.0" encoding="utf-8"?>
<framelayout android:paddingleft="@dimen/status_bar_recents_item_padding" android:paddingright="@dimen/status_bar_recents_item_padding" android:layout_width="wrap_content" android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<relativelayout android:layout_gravity="center_vertical" android:id="@id/recent_item" android:paddingtop="@*android:dimen/status_bar_height" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerinparent="true">
<framelayout android:id="@id/app_thumbnail" android:android:visibility="invisible" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginleft="15.0dip" android:layout_marginright="15.0dip" android:foreground="#00000000" android:layout_centerinparent="true">
<imageview android:id="@id/app_thumbnail_image" android:paddingtop="40.0dip" android:layout_width="305.0dip" android:layout_height="192.0dip" android:scaletype="centerinside" />
</framelayout>
<imageview android:gravity="center_horizontal" android:id="@id/app_icon" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_margintop="225.0dip" android:scaletype="centerinside" android:adjustviewbounds="true" android:maxwidth="20.0dip" android:maxheight="20.0dip" />
<textview android:textsize="12.0dip" android:textcolor="@color/status_bar_recents_app_label_color" android:ellipsize="marquee" android:gravity="center_horizontal" android:id="@id/app_label" android:paddingtop="0.0dip" android:fadingedge="none" android:fadingedgelength="0.0dip" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_margintop="0.0dip" android:scrollhorizontally="true" android:singleline="true" android:layout_below="@id/app_icon" android:layout_alignparentbottom="true" />
<textview android:textsize="@dimen/status_bar_recents_app_description_text_size" android:ellipsize="marquee" android:id="@id/app_description" android:fadingedge="none" android:fadingedgelength="0.0dip" android:layout_width="@dimen/status_bar_recents_app_label_width" android:layout_height="wrap_content" android:layout_marginleft="@dimen/status_bar_recents_app_label_left_margin" android:layout_margintop="3.0dip" android:scrollhorizontally="true" android:singleline="true" android:layout_below="@id/app_label" android:layout_alignparentbottom="true" />
</relativelayout>
</framelayout>
7. res/layout-land/status_bar_recent_panel cũng bỏ các dòng như file recent_panel ở layout-port
thêm mã này vào với chú ý như phần trên
Mã:
<linearlayout android:id="@id/recents_bg_protect" android:android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_centervertical="true">
<linearlayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1.0">
<linearlayout android:orientation="horizontal" android:id="@id/recents_bg_linear" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1.0">
<framelayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignparentright="true">
<imageview android:id="@id/recents_transition_placeholder_icon" android:visibility="invisible" android:layout_width="wrap_content" android:layout_height="wrap_content" />
<com.android.systemui.recent.recentshorizontalscrollview android:layout_gravity="bottom|left|center" android:id="@id/recents_container" android:scrollbars="none" android:fadingedge="none" android:fadingedgelength="0.0dip" android:clipchildren="false" android:cliptopadding="false" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginright="0.0dip" android:stackfrombottom="true" android:divider="@null">
<linearlayout android:orientation="horizontal" android:id="@id/recents_linear_layout" android:clipchildren="false" android:cliptopadding="false" android:layout_width="fill_parent" android:layout_height="wrap_content" />
</com.android.systemui.recent.recentshorizontalscrollview>
<textview android:textsize="20.0dip" android:textcolor="@color/status_bar_recents_app_label_color" android:gravity="center_horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_margintop="5.0dip" android:text="@string/recent_apps_title" />
</framelayout>
</linearlayout>
8. mở smali/com/android/systemui/recent/recentspanelview.smali tìm đoạn
(chỉ cần tìm dòng đầu rồi bỏ hết từ dòng đầu đến .end method nhìn thấy đầu tiên)
Mã:
.method private updatethumbnail(lcom/android/systemui/recent/recentspanelview$viewholder;landroid/graphics/bitmap;zz)v
.locals 5
.parameter "h"
.parameter "thumbnail"
.parameter "show"
.parameter "anim"
.prologue
.line 788
if-eqz p2, :cond_4
.line 792
iget-object v2, p1, lcom/android/systemui/recent/recentspanelview$viewholder;->thumbnailviewimage:landroid/widget/imageview;
invoke-virtual {v2, p2}, landroid/widget/imageview;->setimagebitmap(landroid/graphics/bitmap;)v
.line 796
iget-object v2, p1, lcom/android/systemui/recent/recentspanelview$viewholder;->thumbnailviewimagebitmap:landroid/graphics/bitmap;
if-eqz v2, :cond_0
iget-object v2, p1, lcom/android/systemui/recent/recentspanelview$viewholder;->thumbnailviewimagebitmap:landroid/graphics/bitmap;
invoke-virtual {v2}, landroid/graphics/bitmap;->getwidth()i
move-result v2
invoke-virtual {p2}, landroid/graphics/bitmap;->getwidth()i
move-result v3
if-ne v2, v3, :cond_0
iget-object v2, p1, lcom/android/systemui/recent/recentspanelview$viewholder;->thumbnailviewimagebitmap:landroid/graphics/bitmap;
invoke-virtual {v2}, landroid/graphics/bitmap;->getheight()i
move-result v2
invoke-virtual {p2}, landroid/graphics/bitmap;->getheight()i
move-result v3
if-eq v2, v3, :cond_1
.line 799
:cond_0
iget-boolean v2, p0, lcom/android/systemui/recent/recentspanelview;->mfitthumbnailtoxy:z
if-eqz v2, :cond_5
.line 800
iget-object v2, p1, lcom/android/systemui/recent/recentspanelview$viewholder;->thumbnailviewimage:landroid/widget/imageview;
sget-object v3, landroid/widget/imageview$scaletype;->fit_xy:landroid/widget/imageview$scaletype;
invoke-virtual {v2, v3}, landroid/widget/imageview;->setscaletype(landroid/widget/imageview$scaletype;)v
.line 809
:cond_1
:goto_0
if-eqz p3, :cond_3
iget-object v2, p1, lcom/android/systemui/recent/recentspanelview$viewholder;->thumbnailview:landroid/view/view;
invoke-virtual {v2}, landroid/view/view;->getvisibility()i
move-result v2
if-eqz v2, :cond_3
.line 810
if-eqz p4, :cond_2
.line 811
iget-object v2, p1, lcom/android/systemui/recent/recentspanelview$viewholder;->thumbnailview:landroid/view/view;
iget-object v3, p0, lcom/android/systemui/recent/recentspanelview;->mcontext:landroid/content/context;
const v4, 0x7f040018
invoke-static {v3, v4}, landroid/view/animation/animationutils;->loadanimation(landroid/content/context;i)landroid/view/animation/animation;
move-result-object v3
invoke-virtual {v2, v3}, landroid/view/view;->setanimation(landroid/view/animation/animation;)v
.line 814
:cond_2
iget-object v2, p1, lcom/android/systemui/recent/recentspanelview$viewholder;->thumbnailview:landroid/view/view;
const/4 v3, 0x0
invoke-virtual {v2, v3}, landroid/view/view;->setvisibility(i)v
.line 816
:cond_3
iput-object p2, p1, lcom/android/systemui/recent/recentspanelview$viewholder;->thumbnailviewimagebitmap:landroid/graphics/bitmap;
.line 818
:cond_4
return-void
.line 802
:cond_5
new-instance v1, landroid/graphics/matrix;
invoke-direct {v1}, landroid/graphics/matrix;-><init>()v
.line 803
.local v1, scalematrix:landroid/graphics/matrix;
iget v2, p0, lcom/android/systemui/recent/recentspanelview;->mthumbnailwidth:i
int-to-float v2, v2
invoke-virtual {p2}, landroid/graphics/bitmap;->getwidth()i
move-result v3
int-to-float v3, v3
div-float v0, v2, v3
.line 804
.local v0, scale:f
invoke-virtual {v1, v0, v0}, landroid/graphics/matrix;->setscale(ff)v
.line 805
iget-object v2, p1, lcom/android/systemui/recent/recentspanelview$viewholder;->thumbnailviewimage:landroid/widget/imageview;
sget-object v3, landroid/widget/imageview$scaletype;->matrix:landroid/widget/imageview$scaletype;
invoke-virtual {v2, v3}, landroid/widget/imageview;->setscaletype(landroid/widget/imageview$scaletype;)v
.line 806
iget-object v2, p1, lcom/android/systemui/recent/recentspanelview$viewholder;->thumbnailviewimage:landroid/widget/imageview;
invoke-virtual {v2, v1}, landroid/widget/imageview;->setimagematrix(landroid/graphics/matrix;)v
goto :goto_0
.end method
[/quote]
sửa như ở đây http://lgviet.com/forum/posts/354416/
chú ý: trong các rom khác, ví dụ cm, hoặc rom của các máy khác, khi mod có thể sẽ ko có thư mục layout-port. khi đó các file trong thư mục layout mặc định là của layout-port
vì thay framework-res.apk dễ gây bootloop, nên đóng file flashable rồi flash qua recovery. file mẫu ở file đính kèm, chỉ cần chép framework-res.apk vào system/framework, systemui.apk vào system/app trong file zip đính kèm rồi flash qua recovery ko wipe
chú ý: -thay file nào thì chép file đấy, ko cần chép cả 2
- mở theo đường dẫn meta-inf/com/google/android/ mở file updater-script bằng notepad ++
nếu chỉ thay systemui thì thêm 2 dòng
delete("/system/app/lgsystemui.apk");
delete("/system/app/lgsystemui.odex");
vào dưới dòng ui_print("deleting old files..."); (đủ dấu
nếu chỉ thay framework-res thì thêm 2 dòng
delete("/system/framework/framework-res.apk");
delete("/system/framework/framework-res.odex");
vào dưới dòng ui_print("deleting old files...");
nếu thay cả 2 thì thêm cả 2
Chủ đề cùng chuyên mục xem nhiều nhất:
Chủ đề cùng chuyên mục mới nhất:
Dự án cao cấp Altara Residences Quy Nhơn phát triển bởi Công ty CP Foodinco Quy Nhơn quản lý 5 sao không gian mở thuận lợi giao thông. Altara Residences Quy Nhơn quản lý 5 sao giá ưu đãi diện tích...
Altara Residences Quy Nhơn độc đáo bền vững khu công viên