Thứ Bảy, 13 tháng 7, 2013

Mod lệnh gọi ứng dụng vào menu cài đặt!

Nhiều anh em việt hóa xong không thấy menu "Tiếng Việt" nằm trong ngôn ngữ lúc này chơi chép đè luôn tiếng việt lên Tiếng Anh, máy mất ngôn ngữ Tiếng Anh gốc.
vì nếu dùng Morelocal reset 1 phát mất morelocal ---> tạm thời mất tv phiền hà cho khách.

Cách đơn giản để giữ 2 ngôn ngữ là chép morelocal vào app set 644 tắt máy mở lại là xong.
Có thể tải Morelocal Việt Hóa http://www.mediafire.com/?bwlebgkc3chlmef

Nếu muốn Pro hơn thì làm theo tút dưới đây tích hợp lệnh gọi Morelocal vào luôn trong nhánh chọn ngôn ngữ.


+ Thêm 1 lệnh gọi ứng dụng vào bất kỳ nơi nào trên "Cài đặt"

This Guide will help you to add any application/options to Settings.apk. Well earlier My friend @sandy7 published a guide on how to add various options in Settings. So this extended guide will provide you the necessary knowledge on how to get resources about any app which needed to be added in Settings to include it as an option.

Requirements:
  • Any Tool that can Decompile & Recompile with it's requirements
  • Notepad++
1. Thêm 1 lệnh gọi ứng dụng vào menu cài đặt :
To add an app in Settings we need some resources of the app. This resources can be found by decompiling the app which we want to add & look for those in AndroidManifest.xml
Now, to add an app we need this resources to be added:

*android:targetPackage - the unique & original package name of the app
*android:action - the On click event of an app & it finds the activity of the app
*android:targetClass - the class which is called on calling Onclick action which opens the app when it is clicked
*android:title - the entry of the app in header & also in strings.xml
*android:icon - the icon which will be displayed for the app entry

Notes: android:targetClass, android:targetPackage & android:action can be found in AndroidManifest of the app. For some apps android:targetClass is not given directly. So it should be searched to find. I will tell you how to do that. android:title & android:icon can be written as per user.

As I explained a bit about the resources I will now move onto the main guide. I will take an app from playstore named "Rom Toolbox" as example & describe the ongoing process

i. 1st we need to decompile the Rom toolbox app & find the resources in AndroidManifest.xml

[IMG]

as we can see from the picture that I marked the android:targetPackage & android:targetClass. The target package is easy to find. Sometimes target class is also given directly. If it's not given directly like this app we will find it by searching for it in the lines which starts with <activity. Now if there's more than one activity search for the activity that matches with the target package to some extent. & one more thing I should make you clear about. In some apps you will find android:targetClass will just be a one word phrase. Like if we take Serajr's SystemUI Preference as example you will see that android:targetClass is ".SystemUIPreferencesActivity". In those cases we need to add the whole android:targetPackage before targetClass. For Serajr's SystemUI preference the android:targetPackage="com.serajr.systemui.prefere nces". So the android:targetClass="com.serajr.systemui.preferences.SystemUIPreferencesActivity". So here for Rom Toolbox app we find
Code:
android:targetPackage="com.jrummy.liberty.toolbox"
android:targetClass="com.jrummy.apps.rom.toolbox.RomToolboxActivity"
android:action="android.intent.action.MAIN"
android:action doesn't always needed to be found, you can always use "android.intent.action.MAIN" as the on click event

ii. Now decompile Settings.xml & go to res\xml & open settings_header.xml with notepad++. Now chose a place where you want to make the entry. If we want to add the app under advanced settings then we need to create a header 1st. We also need to create an android:title & android:icon entry for the app. So this will be the entry in settings_header
Code:
</header>
<header android:title="@string/header_category_advanced" />
<header android:icon="@drawable/ic_settings_rom" android:title="@string/rom_toolbox">
<intent android:targetPackage="com.jrummy.liberty.toolbox" android:action="android.intent.action.MAIN" android:targetClass="com.jrummy.apps.rom.toolbox.RomToolboxActivity" />
The 1st header is for the advanced settings header. We need to make an entry of the same name in strings.xml.
The 2nd header is for the app & icon. We need to write the exact entry as title in strings.xml like I wrote "rom_toolbox". You can write anything as title just make sure it matches the app itself so that you can find it easily. So the settings_header will look like this

[IMG]

Now save it

iii. Now go to res\values & open strings.xml. We need to create two strings here. One for the advanced settings & another for the app. We already chose the string name for header as "header_category_advanced" & "rom_toolbox" for the Rom Toolbox app. So the entries in strings.xml will be

Code:
<string name="header_category_advanced">ADVANCED SETTINGS</string>
<string name="rom_toolbox">ROM Toolbox</string>
You can write anything where I wrote "ADVANCED SETTINGS" & "ROM Toolbox" It depends on you what you would like to see in settings as header.

So the strings.xml should be like this

[IMG]

Now save it.

iv. Now we need to place a png for the app in drawable folder with the name "ic_settings_rom" as it is given in the header of android:icon. Depending on your settings you either should have drawable hdpi or drawable mdpi folder. On my case I have drawable hdpi folder. 1st we need to look at the resolutions of the pngs which starts with ic_settings name. Well generally for drawable hdpi it is 48x48 & for drawable mdpi it is 32x32. So we need to resize the png in any of this resolutions depending on our drawable folder. You can take the png from the original app & resize it. In my case I resized it in 48x48 & placed it in drawable-hdpi folder.

v. Now you are ready to recompile again. Then try your newly modified settings. I will post a screenshot of mine

[IMG]


2.Thêm vào trên nhánh của cài đặt ví dụ trong cài đặt màn hình :
Here I will take On-screen-buttons app for an example in the ongoing process. We will add it in display_settings. Now, we need an extra resource called android:key when we want to add any app in sub settings. android:key is the keystore when the app is extracted using any app tool when created by the developer. As we cannot find the original android:key of the app, we will enter a value as android:key & give it's reference in the ids.xml

i. 1st decompile the On screen button app & search for resources in AndroidManifest.xml.

[IMG]

So we find android:targetPackage="cn.kyle.gn.NavBar" & as only one line here starts with <activity it is really easy to find android:targetClass="cn.kyle.gn.NavBar.GnNavBarAct ivity". android:action="com.android.intent.MAIN" even if it is not written in the manifest.
Now we need to make android:title which can be anything,we just need to refer it into strings.xml, android:key can be anything, we need to refer it in ids.xml & another entry is optional here which is android:summary which is the sub-header of the app. I give you my example what I have written as values of those resources
Code:
android:title="navienable_title"
android:key="on_screen"
android:summary="on_screen_summary"


Now as we fixed every resource & their values we will put the entry in res\xml in display_settings.xml. The entry will look like this

Code:
<PreferenceScreen android:title="@string/navienable_title" android:key="on_screen" android:summary="@string/on_screen_summary">
<intent android:targetPackage="cn.kyle.gn.NavBar" android:action="android.intent.action.MAIN" android:targetClass="cn.kyle.gn.NavBar.GnNavBarActivity" />
</PreferenceScreen>


The display_settings will look like this

[IMG]

Now save it

ii. Now go to res/values & open strings.xml. We need to make two entries here. One for the android:title="@string/navienable_title" & another for the android:summary="@string/on_screen_summary". Now we make the entries

Code:
<string name="navienable_title">On-Screen-Buttons</string>
<string name="on_screen_summary">Enable/Disable On-Screen-Buttons</string>
as I said before you can write anything inside >......</string> it depends on you what text you would like to be seen

The screenshot from strings.xml

[IMG]

Now save it.

iii. Now go to res\values\ids.xml & open it. We need to make an entry for the entry we made in display_settings as android:key. So the entry will be with the same value

Code:
<item type="id" name="on_screen">false</item>
So the ids.xml should be like this

[IMG]

Save it & recompile your edited Settings.apk. Here is a screenshot of the Settings I edited

[IMG]



3. Đổi tên rom thành tên khác :
i. Decompile Settings.apk & go to res\xml & open device_info_settings.xml. Now choose a place where you want to show your Rom Name & Developer name. The entries you need here are similar with the one's that already exist in the xml. So you can copy one line of entry & press enter then paste it & you can edit it to make the new entries. We need android:title & android:summary which will be shown in strings.xml. We need android:key which you can keep same as android:title to eliminate difficulties, but we don't need an entry in ids.xml this time as it is not an app for which we are making the entry for. Last of all we need a style entry which will be the same as others. So I will write my Rom name & developer name under Kernel_version entry here. The entries will be

Code:
<Preference android:title="@string/rom_header" android:key="rom_header" android:summary="@string/rom_name" style="?android:preferenceInformationStyle" />
<Preference android:title="@string/author_header" android:key="author_header" android:summary="@string/author_name" style="?android:preferenceInformationStyle" />
The device_info_settings.xml will look like this

[IMG]

Now save it.

ii. Now go to res\values\strings.xml to make the entries here. We need two entries for the Rom Name, one is for "@string/rom_header" & another for "@string/rom_name". Same we need for Devloper name, one entry for "@string/author_header" & another for "@string/author_name". So the entries will be

Code:
<string name="rom_header">Rom Name</string>
<string name="rom_name">X Rom</string>
<string name="author_header">Developed By</string>
<string name="author_name">Saqib Nazm</string>
I give my Rom name as "X Rom" for example. You can type anything as you like on rom_name & author_name

The strings.xml should look like this

[IMG]

Now save it & recompile. Enjoy your freshly made new Settings.apk. Here is a screenshot about how it looks

[IMG]

Không có nhận xét nào:

Đăng nhận xét