[Guide] [JB, CM 10.1] How to enable multi-user support. - Galaxy Ace II General

Hi,
Jelly Bean has multi-user support, but it is turned off for phones by default. There are situations, though, when you might want it (e.g. I share my phone with a tester sometimes, it would be nice if he had his own environment). Because I want to share it with another dev, I'm going to enable developer options, too, which are disabled for other (restricted) users. Stay calm, though, this is safe: all not safe developer options are greyed out for a restricted (non-owner) user. (At least on CM 10.1.)
How to enable multiple phone users.
`adb pull /system/framework/framework-res.apk`,
decompile it with apktool,
edit framework-res/res/values/integers.xml changing config_multiuserMaximumUsers from 1 to, say, 8,
compile new .apk with apktool,
using 7-Zip replace resources.arsc in original .apk with resources.arsc from new .apk,
`adb push` modified original .apk from 7-Zip.
Some remarks:
I've just finished trying to position user switcher view on our portrait lock screen and failed; the display is just too small for me to come up with something creative; besides from no screen real estate for it, the switcher works great -- you can check that in landscape after enabling lock screen rotation (if you still want to try to add switcher to portrait lockscreen, take a look at framework-res/res/layout-port/keyguard_host_view.xml and compare it with analogous layout-land (the latter includes "@layout/keyguard_multi_user_selector"),
Enable user switching in power menu settings [Settings -> System -> Power menu -> User switcher] (you've got to switch somehow now without screen lock switcher!),
Adjust Superuser rights for other users [Settings -> Superuser -> [menu key] -> Settings].
How to enable "Developer options" in secondary (restricted) users.
(You should be able to do this with any other ROM, just remember to *increment* array length of SETTINGS_FOR_RESTRICTED, not blindly copy my 0x1b value. See original Settings.java for reference).
Pull and decompile /system/app/Settings.apk (you will need to do `apktool if framework-res.apk` first for decompilation to succeed).
Change Settings/smali/com/android/settings/Settings.smali as follows:
change SETTINGS_FOR_RESTRICTED array length from 0x1a (26 dec) to 0x1b (27 dec):
Code:
.line 103
const/16 v0, 0x1a
to:
Code:
.line 103
const/16 v0, 0x1b
Append development_settings id (found in Settings/smali/com/android/settings/R$id.smali):
Code:
0x5et 0x2t 0xdt 0x7ft
to allowed SETTINGS_FOR_RESTRICTED array data below:
Code:
.line 103
:array_0
.array-data 0x4
.
recompile,
using 7-Zip, copy /classes.dex from just compiled System.apk to original System.apk,
`adb push` your modified original version from 7-Zip.
Works for me.
Greetings,
Michał.

michalrus said:
Hi,
I'm wondering why I cannot switch JB users (created using "pm create-user <name>") with CM's User Switcher in Quick Settings?
Also, there's no "Users" tab in "Device" section of Settings.
Nor is there an option to switch users after holding power button or in the lock screen.
I certainly *can* switch using "am switch-user <id>" (and that's what I'm currently using), but I'd like to know if there's a simple way to make it more natural.
But the worst thing is I cannot go back to my Primary user, because there's no root access in secondary accounts. Therefore I need to reboot the phone to get back to "my" user. Normally, there's "Primary" item in power menu on multi-user Android. Not here, unfortunately...
I need this feature because I'm sometimes sharing my phone with apps tester (/me being a dev).
Greetings,
Michał.
Click to expand...
Click to collapse
try to follow this
http://forum.xda-developers.com/showthread.php?t=2063195

Related

[App, root] Clear missed call notification with "NotiGo"

Since Android 2.3, Google prohibited third party application (i.e. non-system app) to make use of MODIFY_PHONE_STATE permission. One of the consequences is that all 3rd party phone dialer application can no longer clear missed call icon at notification bar. (Even at Android 2.2 or older, we need undocumented API to do so)
With original Android phone dialer, the missed call indicator disappeared when call log page is shown. Third part applications on Android 2.3 cannot do so. It would be annoying that the missed call indicator keep showing. We may tap the "clear" button to clear all icons on notification bar. However, the missed call count remain. When the missed call indication appear again for one more missed call, the missed call count accumulate.
So, I write a small app, NotiGo, to solve this annoyance. It is to be installed as a system app on rooted device. Currently it works with Angel Dialer (Download at http://j.mp/iE5MJJ, discussed at http://j.mp/pC04fV) only. But other developers may invoke this app as well (see below)
*** Disclaimer 1: I am not responsible for any loss due to the following steps. Do not try if you disagree ***
*** Disclaimer 2: I tested it on Nexus One 2.3.4 only. Please let me know if it work or not work on your devices.
1. Download the file in this post.
2. put it in the SD card of your Android device.
3. Enter recovery mode of your Android device.
4. flash the zip file.
5. reboot.
After reboot, one more app "NotiGo" is in your system, but nothing is need to be done with it. If the installation is success, you will find one additional permission listed with Angel Dialer (Settings -> Applications -> Manage Applications -> "Angel Dialer") called "Clear Missed Call Notification" under "Phone Calls" category.
When Angel Dialer is launched with search page or call log page, the missed call indication is cleared, just like the original Android phone dialer.
Developer Info:
To make use of NotiGo with your app, add the following permission
<uses-permission android:name="thinkpanda.permission.CLEAR_MISSED_CALL"/>
and broadcast an intent with action "thinkpanda.notigo.CLEAR_MISSED_CALL"
Not sure what exactly it's supposed to do, it seems like if you have a newer gingerbread rom then you can just swipe the notification off? Or am I misinterpreting what this is made for?
qccoles said:
Not sure what exactly it's supposed to do, it seems like if you have a newer gingerbread rom then you can just swipe the notification off? Or am I misinterpreting what this is made for?
Click to expand...
Click to collapse
Android 2.3 does not allowed "normal" third party applications to clear the missed call notification. This app, installed as system app, provides an alternative way for other apps to clear missed call notification if needed.
This is fantastic! Thanks a lot
Thanks a lot.
I've used this to clear the notifications in Go Dialer EX - decompiled and inserted the intent call into the clearing procedure (that was intended to work only on 2.2 and below), and now it works.
Cool. Someone has to inform the developers of Go Dialer about this. This has been a major annoyance for me.
Already did - I wrote them a mail with suggestion and pointer to this thread. It might be better if more people write them, though.
By the way, I used it on Nexus One running latest MIUI based on Gingerbread 2.3.5.
Actually I can't get this working on my HTC Desire with AOSP ROM Oxygen. I have the APK installed in the system/app folder and Angel dialer has the permissions to clear missed calls.
The missed call notification does not disappear. What logs can I provide?
EDIT: IT DOESN'T WORK 100% OF THE TIME FOR ME, BUT OUT DOES WORK. ANY IDEAS?
Sent from my HTC Desire using XDA App
@Jack_R1, would you be so kind and send me or upload somewhere your modded Go Dialer EX app. I'm also using this app and was even trying to mod it myself but I don't know how to
and broadcast an intent with action "thinkpanda.notigo.CLEAR_MISSED_CALL"
Click to expand...
Click to collapse
I decompiled and added permission to AndroidManifest.xml but that's all I can do and have no idea with this broadcast...
TIA, andiss
mcampbellsmith said:
Actually I can't get this working on my HTC Desire with AOSP ROM Oxygen. I have the APK installed in the system/app folder and Angel dialer has the permissions to clear missed calls.
The missed call notification does not disappear. What logs can I provide?
EDIT: IT DOESN'T WORK 100% OF THE TIME FOR ME, BUT OUT DOES WORK. ANY IDEAS?
Sent from my HTC Desire using XDA App
Click to expand...
Click to collapse
If you see the additional permission, then the installation should be successful.
Angel Dialer make use of NotiGo to clear missed call notification only when showing the call log page or search page. Did you set the default page to other page like contact and favorite page?
thinkpanda said:
If you see the additional permission, then the installation should be successful.
Angel Dialer make use of NotiGo to clear missed call notification only when showing the call log page or search page. Did you set the default page to other page like contact and favorite page?
Click to expand...
Click to collapse
Angel Dialer goes direclty to the search page. See attachment.
What can I provide to get logs?
mcampbellsmith said:
Angel Dialer goes direclty to the search page. See attachment.
What can I provide to get logs?
Click to expand...
Click to collapse
Do you see the log with Tag "NotiGo" with message "Cleared missed call notification" when the search page is shown?
No I don't. I filtered in alogcat and don't see any reference to Notigo when opening Angel Dialer after a missed call.
Sent from my HTC Desire using XDA App
andiss said:
@Jack_R1, would you be so kind and send me or upload somewhere your modded Go Dialer EX app. I'm also using this app and was even trying to mod it myself but I don't know how to I decompiled and added permission to AndroidManifest.xml but that's all I can do and have no idea with this broadcast...
TIA, andiss
Click to expand...
Click to collapse
I'm not sure about my rights to post an altered app, even though it's free.
On the other hand, it's no different from Skype, etc. So I'm attaching it. It's version 2.0.1.
For anyone willing to decompile and change subsequent versions - this is the code that should be copy-pasted into the app:
AndroidManifest.xml :
Code:
<uses-permission android:name="thinkpanda.permission.CLEAR_MISSED_CALL"/>
smali\com\jbapps\contactpro\util\CallAndSmsUtil.smali :
Old code:
Code:
.method public static CleanMissedCallNotify(Landroid/content/Context;)V
.locals 3
.parameter
.prologue
.line 710
.line 713
:try_start_0
const-class v1, Landroid/telephony/TelephonyManager;
New code:
Code:
.method public static CleanMissedCallNotify(Landroid/content/Context;)V
.locals 3
.parameter
.prologue
.line 710
.line 713
:try_start_0
new-instance v1, Landroid/content/Intent;
const-string v2, "thinkpanda.notigo.CLEAR_MISSED_CALL"
invoke-direct {v1, v2}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V
invoke-virtual {p0, v1}, Landroid/content/Context;->sendBroadcast(Landroid/content/Intent;)V
const-class v1, Landroid/telephony/TelephonyManager;
Thanks Jack_R1. GO SMS works for me when Angel Dialer doesn't. Strange...
Any chance someone can hack a version of TouchPal Dialer with this? I would really appreciate it......
Sent from my HTC Desire using XDA App
With a LOT of help from Jack_R1, I modified Touchpal Dialer to include this patch.
This is what I did:
Edited the AndroidManifest.xml file to include the permissions as described in the first post
In the files CallLogActivity.smali and DialerActivity.smali, I replaced the calls to cancelMissedCallsNotification with the four lines of code Jack_R1 had in his example above:
DialerActivity.smali
OLD CODE
Code:
.line 264
invoke-interface {v1}, Lcom/android/internal/telephony/ITelephony;->cancelMissedCallsNotification()V
:try_end_0
NEW CODE
Code:
.line 264
new-instance v1, Landroid/content/Intent;
const-string v2, "thinkpanda.notigo.CLEAR_MISSED_CALL"
invoke-direct {v1, v2}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V
invoke-virtual {p0, v1}, Landroid/content/Context;->sendBroadcast(Landroid/content/Intent;)V
:try_end_0
CallLogActivity.smali
OLD CODE
Code:
.line 181
invoke-interface {v1}, Lcom/android/internal/telephony/ITelephony;->cancelMissedCallsNotification()V
:try_end_0
NEW CODE
Code:
.line 181
invoke-interface {v1}, Lcom/android/internal/telephony/ITelephony;->cancelMissedCallsNotification()V
:try_end_0
I've attached the modded APK. Please let me know if this is now allowed (Touchpal Dialer is a free app)
Wish wish wish pls
WOW
Guys this is a breakthorugh,
What about whatsapp?
Can we stop the whatsapp notification and message preview showing in the status bar in android and AUTO CLEAR it with this app?
I had this function in iphone where it can stop all notifications but for android the whole message of whatsapp is shown and remains uncleared. Can this be modified to auto clear the whatsapp notifications as soon as they arrive.
This only clears the phone notifications, that are coming from the system, thus requiring system permissions (root) to clear.
In Whatsapp, you can just turn off notifications in menu settings, most probably.
Nopes, you cant.
You see we can only switch off notifications in sms. For whatsapp the notifications come along with the message in the pull down status bar. There is absolutely no way to clear it.
If you google there are many people wanting this disabled.
How do you guys install this zip file? My recovery said amend scripting was no longer supported.

[RESOURCE] Modding Sense 6

So Sense 6 is finally here, and it brings with it another round of the cat and mouse game that HTC loves to play with XDA themers.
Veteran HTC themers will know that each version of Sense brings new challenges, and sadly Sense 6 is no exception. I had made a bunch of reference guides for Sense 5.5, but other than sending out the Dropbox link, never got around to doing much with them.
I figured this time I'd hit the ground running and create a central thread where we could all share what we've found, rather than scattered posts in various mod/theme/rom threads. The aim of this thread is to create a place to share our findings, rather than all trying to overcome Sense 6's idiosyncrasies individually. As such, it is not intended to be a How-to theme guide. Most of the information posted here will assume at least a basic knowledge of theming, xml editing and apk manipulation. There are lots of such guides already available on XDA, and are easily found with little effort. However, I have added a couple of links to the bottom of this post to get you started.
Please feel free to add any theming stuff you find while exploring Sense 6, requests for help etc. Pictures of your themes/mods are welcome, provided you are also explaining how you did them if the info isn't already posted in the thread.
INDEX
Post 2: General tips, pointers and observations
Working with Sense 6
Troublesome apks
Frameworks and tags
Public id's
Post 3: fisha21's Guide to HTC's built in themes
Sense 6 themes
What are they
Where are they
How to change them
How to add new themes
How to stop the 4x1 weather clock changing colour according to time of day
Post 4: Fringe theming - hosted by @Pneuma1985
Internalizing color in htcclockweatherwidget.apk & Inverting 4x1 clock
Change small / large weather icons to white in smali
Change the vertical divider in 4x1 clock to an image that can be themed
Removing the SystemUI notification drawer bg fade in/fade out..
Changing fonts selectively in any apps not causing a global change
Animate the status_bar_close_on and keep the carrier label at the same time
Add Operator_name to statusbar
Move signal_cluster to the left
Turn on spinning 3g icon in stock SystemUI
Post 5: Theming on the razor's edge - hosted by Raymond Ebertt
Transparent Prism Appdrawer Background
Custom Panels for the WeatherClockWidget.apk
Inverting Issues
Inverting Data Usage Background
Inverting Weather.apk Backgrounds
Background in Browser.apk when Navigating Tabs
Pop-up Window on HTC_IME - Word Correction
Theme controlled fontcolors - thanks @ineedone and @PuNkA.YaNoU
Change which weather icons sets are used for day and night clocks - thanks @2WildFirE
HTC app buttons - thanks @ineedone
Ok / cancel buttons in HTC apps - thanks @ViNOK16Bit
Entry field background in pop up Contact card - thanks @ineedone
Middle white box behind Phone, Message etc icons on pop up Contact card (when clicking on Contact's thumbnail in Phone, Messages, Mail etc (see screenshot for Entry field background) - thanks @Basil3
Remove On / Off labels from HTC settings toggles - thanks @ineedone
Moving signal cluster to lefthand side of statusbar - thanks @Pneuma1985
SIM PIN lock entry field in Settings - thanks @Onepagebook
Icon PSD's for HTC apps - thanks @Pfaffinator (the icon king!)
How to remove coloured overlays from Settings page icons - thanks @Basil3
HTC mini+ launch screen
Inverting the background for the Send SMS window you get, after declining a call - thanks @billbowers
Changing the colour of tab number in Browser - thanks @PuNkA.YaNoU
"Release to refresh" text colour (screenshot in post) - thanks @PuNkA.YaNoU
"Accounts and folders" header in HTC Mail app (screenshot in post) - thanks @PuNkA.YaNoU
Blinkfeed side menu issues with newer versions of Blinkfeed - thanks @Basil3 and @Raymond Ebertt
Redirect app drawer Playstore icon to within Prism.apk - thanks @[email protected]
Full-screen caller contact photo - thanks @Kiray1982
USEFUL RESOURCES FOR BEGINNERS
List of useful guides etc compiled by superthemer @pstevep - the parent thread is also well worth a read. Although some of the stuff refers to older versions of Sense, there are still some hugely useful tips and techniques in there. Of course I'm a little biased, since his thread was what inspired me to make this one
[GUIDE] Want to learn how to theme? - by @theimpaler747
VTS website - there are several tools you can use for apk/jar manipulation, but in my experience this is by far the most complete. The VTS website also has a bunch of tutorials on how to get started with VTS, and also how to get started with apk manipulation in general
Official Android developers' website
THINGS THAT STILL NEED FINDING
General tips
Working with Sense 6
By now people have found that Sense 6 apks are a little troublesome and it takes a bit of effort to decompile/recompile some of them. The main thing, as Raymond Ebertt stated in his post, is to make sure you are using the most up to date files. There is some conflict about which version of apktool to use, 1.4.2 or 2.0.0. It is complicated by the fact that the public release version of VTS doesn't yet work with apktool 2.0. Either version of apktool will work fine, but both might require a little tinkering with the apk. Now that the new version of VTS is out, it makes things a lot simpler, since apktool 2.x is now supported.
Those people using manual apktool, I would suggest making sure you use apktool 2.0.0beta9 - that's worked me for me where earlier versions of 2.0 failed.
As for smali, I have been using 2.0.3 since Sense 6 dropped, and not had any issues with that.
If you're using VTS, you need to put the updated binaries in the appropriate folders in C:\Program Files (or Program Files(x86))\Virtuous Ten Studio\External. The newest version of VTS ships with apktool 1.4.2 and 2.0beta9, and smali 1.5.2 and 2.0.3, so you shouldn't need to add any additional binaries.
There are also a few special-case apks:
Troublesome apks
You may have found that there are some apks that give you public.xml errors on trying to recompile them. The cause seems to be some broken images in the apk itself, and seem to affect the images used in the Sense 6 themes. You can see which ones they are by opening the apk as a zip archive and looking in the drawable-*dpi folders - the broken images all have a filesize of 0bytes.
The easiest way to fix this is to replace those images in the apk before decompiling it. Once you've done this, the apk should recompile without the above errors.
You can get all the required files from com.htc.resources.apk, but to make things a bit easier, I have zipped up the required files for most of the faulty apks.
You can download them here​
Note that these zips contain compiled 9.pngs, so you need to copy them into the apk before decompiling - they won't work properly if you put them into an already decompiled project.
If there are any problems with the zips, please let me know.
If your apk still fails to compile, just double check all the drawable-*dpi folders and make sure there are no 0byte images. If there aren't, then there is another issue with your project.
========​
Phone.apk. This app often fails to compile due to some issues with strings.xml. Basically, there is a special character (٪) that gets replaced with a normal % on decompiling.
You have 2 options to fix this:
1. use the error log to identify which symbols need replacing (the log will tell you which xml, and which line, needs fixing)
2. grab the fixed files I added to the folder I linked above - these are decompiled files, so will need to be placed into your decompiled apk
========​
There is another reason I've found for some apks not to compile. Some of the apks, eg Messages, have issues with apktool 2.0 whereby the package name of the apk gets altered.
If you get an error saying that it could not find resources for package com.htc, you need to check the AndroidManifest.xml - you'll find that package name has been changed to com.htc.
Two ways to deal with this - either re-edit the package name to the original (which can usually be found somewhere further down in the AndroidManifest.xml, or use apktool 1.4.2 to de/recompile the apk. Thanks to @hawknest for pointing out the cause of this one.
Frameworks and tags
Just a short note on frameworks, since many people seem to misunderstand them. When you install a framework, the resources.arsc is taken out of the file and put inside an .apk file in your C\:<User>\apktool\framework folder, where it essentially acts as a look up table for decoding the resources inside any given apk. By default, framework-res gets installed as 1.apk, com.htc.resources as 2.apk. Go take a look in your installed framework folder, you'll see what I mean.
The reason you need to install frameworks for each Android distro you're using is precisely because of their function as a look up table. Let's say you install AOSP frameworks - great, you can now decompile AOSP apks just fine. But what if you're using a MIUI rom, or Sense, or Touchwiz? These distro variants all contain resources that the stock Android doesn't and so when you try to decompile a Sense apk that has non-standard resources within, the AOSP frameworks will fail. Ok, no problem, install the Sense rom frameworks instead and it'll work just fine. Problem is, when you installed the Sense frameworks they overwrote the AOSP ones. So now, if you want to go to use an AOSP apk, you first need to reinstall those frameworks again. What a pain, right?
This is where tags come in. If you install the frameworks using a tag specific to the Android distro, in the apktool/framework folder you'd see 1-aosp.apk, 1-sense.apk, 1-miui.apk etc. Now, when you're decompiling apks from a particular distro, just use the tag you assigned the frameworks to let apktool know which set of frameworks to use. This way, you can have frameworks for multiple distros installed at the same time.
Just to clarify, all the frameworks from a given distro need to have the same tag. So, for example, your installed frameworks from AOSP would be called 1-AOSP.apk, 2-AOSP.apk, 127-AOSP.apk etc. When you decompile using a tag, you're telling apktool to use all the frameworks with that tag as reference tables for the decompile. If all your frameworks from one distro have different tags, apktool won't find all the references it needs, and you'll get an error about missing resources and a failed decompile.
As for when you need to install frameworks - as I said, the purpose of installing them is to provide a lookup table for decompiling resources. So you really only need a set of frameworks when you're working with something that's likely to have unique resources. This will either be when dealing with different distros - AOSP, MIUI, Sense etc - or when there has been a version change - 4.3 to 4.4, or Sense 5 to Sense 6 etc. If you're working with a Sense 6 build of one rom, say Renovate, and you want to decompile an apk from InsertCoin, you can use the same frameworks for both, since they are both based on Sense 6, and we rarely tend to add new resources to framework files.
Public id's
Public id's are how smali code call on a particular resource. Public.xml lists all the public ids for every resource contained within a particular apk. Pretty much all apks use a public id format of 0x7fxxxxxx, which means that the resource attached to that id can only be used by the apk it is contained in. So, if for example, you're looking in smali and you see the id 0x7f100000. You search public.xml and you see that 0x7f100000 is allocated to type="string" name="app_label". So you know that that bit of smali code is setting the app label. This can also work the other way round - say you have an image and you want to find the smali code that draws it on screen. Find the name of that image and look it up in public.xml. Say it has an id of 0x7f000010. So you just search all the smali for that reference and have a look at the resulting files.
This is true for all apks in HTC roms except for three. Since com.htc.resources.apk, framework-res.apk and framework-res-htc.apk act as central repositories of resources for other apps to use, they each have their own unique public ids so system apps know which one to call a resource from.
Code:
framework-res = 0x01xxxxxx
com.htc.resources = 0x02xxxxxx
framework-res-htc=0x03xxxxxx
So, next time you're looking in smali and you see an external reference with one of the above 3 formats, you'll know exactly which framework apk to look in
Note: the formats shown above are how they appear in the decompiled public.xml of that apk. When other apps call these public ids in smali, the first 0 after the x is dropped.
For example, say the clock widget wants to use an image from com.htc.resources. In com.htc.resources/public.xml, that image might have the public id 0x02000001. But in the clock widget smali where that image is called, the public id would be given as 0x2000001.
What are the Sense 6 themes?​
This is the easy bit! If you open Settings/Personalise/Theme, you'll be presented with the four built-in themes:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Where are the Sense 6 themes?​
This is where things get complicated.
There are four themes, each of which is split into five categories. The themes are called:
The system wide theme is controlled by hex colour codes located in colors.xml and styles.xml of com.htc.resources. This controls the majority of system apps.
If you look at com.htc.resources.apk/styles.xml line 2047 for example, you'll see that there are entries called:
Code:
etc, starting from line 2047
Categories 1-4 are represented by the four boxes along the top of the theme preview. The fifth category is defined by HTC within apks as Category 0, and this is the default category. It is used when the code within the apk doesn't specify which category to use (more on this later). With the default theme, you'll probably have noticed that various HTC apps have different coloured header bars, which correspond to the four boxes on the preview image:
So if you wanted to change the colour of the dialer, you'd edit the colour codes for HtcDeviceDefault.CategoryOne. If you were using the second theme, the orange one, you'd edit ThemeOne.CategoryOne to change dialer header, and so on...
I've managed to track down which category each HTC app uses, but if there are any I'm missing, please let me know
Category 0
HTC Backup
Internet
Settings
Setup
Tips & Help
Scribble
All apps launched while in Car mode
Category 1
Calendar
Contacts
Mail
Message
Tasks
Phone
Category 2
Calculator
Clock
Stocks
Voice recorder
Weather
Category 3
Camera
FM radio
Music
Category 4
Didn't actually find any apps that seemed to use this category
All of these apps use the specified category from com.htc.resources, so that's where you should edit it. There are some HTC apps that have seem to have their own internal themes:
Prism.apk
HMS_Gallery.apk
HTC-IME.apk
Video_Center.apk
HtcExtremePowerSaverLauncher.apk
EasyAccessService.apk
so they have their own specified themes and categories within the colors and styles.xml of their own apk. There may be other apks as well, I just haven't spotted them yet. They read the system flag to determine which Theme to use, but then use their own categories for various elements within the app.
So Prism for example will set the overall Theme according to what's been set in the Theme picker but then will use its own internal categories. From my testing so far, all aspects of Prism (app drawer header, Blinkfeed, app drawer icon overlay) seem to use Category 4 colours from within Prism.apk. Haven't looked into any of the other apps listed above!​
How are the Sense 6 themes used?​
So, which theme the system is using is determined by you, via the Theme Picker. As for which category an app uses, that is determined within the java code - thanks to @Mikanoshi for some more detailed info
Still not sure where the current theme flag is set, so that the other themed apps (Gallery, Prism etc) know which theme to use. I'm guessing framework2.jar or framework3.jar, though I guess it doesn't really matter!
As for the preview images, these are generated the first time the theme picker is opened, and then cached in /data/data/com.htc.home.personalize/files/themePreview/ - again, thanks to @Mikanoshi for more detailed info. The colour bar across the top of the previw image is the multiply_color from categories 1-4 of that theme.
If you want the Theme picker screen to show your edited themes, rather than the default ones, you'll need to delete these cached images. This can be done by full wiping, but obviously not so convenient. The other option is to add the following line
Code:
delete_recursive("/data/data/com.htc.home.personalize/files/themePreview");
somewhere in the updater-script of your rom/theme zip.​
How to add a new theme​
The four built in themes offer a great way to offer multiple variations of your theme. But what if 4 options aren't enough? Why not add a 5th?
To add your own theme, it's probably easiest to start with com.htc.resources as this requires the most edits. The two folders you'll need to focus on are drawable and values.
In values/styles.xml, the easiest thing to do will be to duplicate the whole block of Theme.Three entries, rename them all to Theme.Four and change the colours as you want them. You'll also need to duplicate all the htcprogress_themethree_*.xmls in the drawable folder, rename them to themefour and edit the colours,
The last step is to edit values/arrays.xmls. This will register your new theme as a usable resource. You need to
add your new theme to the multipleColorThemes array - this tells the system that ThemeFour now exists
add a new ThemeFourarray, which lists the 5 categories -
add a 5th entry to the wallpapersand wallpaper_themesarrays - this will set the default wallpaper for your theme (you can also edit this array if you want our default wallpapers to have a different filename or file type)
create new progressBarArrayarrays for ThemeFour and the four categories
If in doubt, just look for all the ThemeThree stuff, duplicate it and rename to ThemeFour. That's com.htc.resources done. Now you just need to add the ThemeFour stuff to the other 6 apps that use the theme system (see previous list). In each apk, you need to edit arrays.xml, add all the new htcprogress_themefour_*.xmls to the drawable folder, and the new ThemeFour stuff to styles.xml. If you don't add ThemeFour to an app, if you've applied your theme centrally and then open that app, the app will default to the stock green theme.
And that's it! Wipe the theme preview cache as previously mentioned, and your theme will show up nicely. Not sure if there is a limit to the number of new themes that can be added...maybe it just depends on how bored you get
There is one small issue that remains. As previously mentioned, the colour bar across the top of the preview is generated by the multiply_color entries of categories 1-4. However, for your new theme, you'll note that the colour bar remains green. Since the themes always revert to the green one when there is missing info relating to the new theme, I suspect there must be a smali array somewhere where the themes are also registered. Since the new theme is not declared there, the preview generator doesn't know to look for ThemeFour.
It is the only remaining bug, but it does annoy me! So if anyone finds where in smali these preview colours are generated, please do let me know!!​
Well, that's all for now. Apologies for the slightly wordy post, a consequence of me thinking out loud. I will say one more thing though. When Sense 6 first landed, I was not a fan of these new themes at all. But having spent time exploring and getting to know how they work, I actually really like them now. Overall, theming Sense 6 requires less smali edits than Sense 5/5.5 did, and the theme picker aspect is actually quite powerful....how else could you offer 4 variants of a theme so easily. I suspect that it's better for themers like myself, who theme specific roms, than it is for standalone themers.
Happy theming!!​
Article originally posted here
How to stop the 4x1 weather clock changing colour according to time of day
In Sense 6 the 4x1 weather clock widget has a white background for daytime clocks, and dark for night clocks. Pretty neat feature, but maybe it doesn't fit with a theme you're making?
If you open
Code:
HtcWeatherClockWidget.apk/smali/com/htc/widget/weatherclock/view/WeatherClock4x1View.smali
and search for
Code:
.method protected getControls
Scroll down and you'll see
Code:
const-string v2, "background_day"
const v3, 0x7f02004d
The 0x7f02004d is the public id for common_panel_light.9.png in the drawable-xxhdpi folder. Scroll a bit further down and you'll see
Code:
const-string v2, "background_night"
const v3, 0x2080100
The 0x2080100 is the public id for common_panel.9.png in com.htc.resources. If you want to use the same image for both day and night clocks, just replace 0x2080100 with 0x7f02004d, and the clock will use the common_panel_light.9.png image for both day and night clocks. Just theme that image how you want it to look, recompile and you're done
Fringe Theming...
Ok Since fisha is so awesome and got me a spot for number 4 I will be adding to this as we progress and figure other stuff out enjoy for now!
My Tutorials are not limited to any app or by anything! I will cover how do some crazy complex theming and I will try to be as cohesive as I possibly can, within the tutorials. My main goals are usually against the grain as far as theming goes: This is stuff you won't see in other sense themes! Enjoy
Updated all links so they properly work for everyone.
Internalizing color in htcclockweatherwidget.apk & Inverting 4x1 clock
No longer applies to the updated ota.
____________________________________________________________________________________________________________________
Change small weather icons to white in smali
Oh someone forgot to point out how to change the weather icon for the small weather widget
weatherview.smali line 77 if you have smali debugging turned on/ may be slightly different if you don't, possibly a few lines away.
Change both to dark.
Small Weather Icons:
Change large weather icons to white in smali
Yeah props to whoever found this not sure who but I'll add it to this as well.
goto: WeatherClock4x1View.smali
search for vectorgraphic_light_xl
change them both to vectorgraphic_dark_xl
Large Weather Icons:
____________________________________________________________________________________________________________________
Change the vertical divider in 4x1 clock to an image that can be themed, never using com.htc.resources calls to do it.
No longer applies to the recent versions of sense 6
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
Removing the SystemUI notification drawer bg fade in/fade out..
Ok guys I got another one i just figured out... If anyone figures out how to edit the transparency of the fade itself that would be awesome...
I tried but the only thing i could get it to do without crashing was removing it.
The main purpose of this is to expose the statusbar all the time which is only possible when disabling this animated smali fade method.
Any other questions about the ui feel free to ask.
In SystemUI.apk you'll be looking in PhoneStatusBarView.smali
Search for this:
Code:
.method public panelExpansionChanged
Delete that entire method from lines 581-875 (lines will match) - if you have smali debugging turned on which I always do when playing in smali enjoy.
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
CHANGING FONTS SELECTIVELY IN ANY APP NOT CAUSING A GLOBAL CHANGE
This tutorial is somewhat complex and not for the faint at heart!
Oh and I'm not responsible if you bootloop your phone from this; symlinking the wrong things can cause bootloops. So please pay close attention. And look at my .zip which I will be adding!
This is not a font pack or anything like that! There is only one other person we know has been able to do this @Ajthescot for NEVER telling us, lol no need though after a year of tinkering I figured it out.
Ok this is a special tutorial for the SystemUI, but can work anywhere in any app. I'm going to go over one of the most epic changes I have ever managed to accomplish. I managed to change a selective font that htc does not use, then call on its class/font-family within styles. Look at the clock font vs everything else. This change is selective not global, which is exactly what we are after!
Though if an app calls on monospace like a market app it will display this new font we are about to use. Like some apps specifically logcat apps like using monospace b/c its easier to see the code so keep that in mind before doing this and choose your font wisely!
Example:
First were going to need a font we want to use select any font you can find you may want to selectively use... I chose arame-regular.ttf
We are also going to need SystemUI.apk decompiled.
I'm gonna break-down how android font family's and how font styles work in general first b/c you need to have an understanding of them to change them selectively.
Htc uses a fontfamily known as sans-serif but in actuality those fonts are basically anything with droid as a prefix and both sans or serif as a suffix. Not that it uses all of them. Ok thats what base htc does right but through the updater script they manage to symlink them
Example of symlinking:
Code:
symlink("Roboto-Regular.ttf", "/system/fonts/DroidSans.ttf");
This essentially is saying: ok for every spot DroidSans.ttf would be used now Roboto-Regular will fall in its place.
Example and list of roboto styles that have been symlinked in sense 6.0
Code:
android:fontFamily="sans-serif" // roboto regular
android:fontFamily="sans-serif-light" // roboto light
android:fontFamily="sans-serif-condensed" // roboto condensed
android:fontFamily="sans-serif-thin" // roboto thin
Now each family has a style as you can see here
these are the 12 style variants that are possible: android:textStyle=" "
Regular
Italic
Bold
Bold-italic
Light
Light-italic
Thin
Thin-italic
Condensed regular
Condensed italic
Condensed bold
Condensed bold-italic
Ok enough of that lets get down to brass tacks... We need the SystemUI (the app i chose for demonstration) decompiled and an updater script and a .zip
Empty everything out of the .zip except the system/fonts folder and the meta-inf folder and the system/priv-app folder everything else delete it. Delete everything within the system/priv-app folder and then you can even delete all the fonts inside of the system/fonts folder as well.
I decided on a font family that htc does not use anywhere or any place its known as monospace the real font name is DroidSansMono.ttf. It's what we will be symlinking to.
Now that we have our .zip with nothing left in it except the meta-inf stuff and some empty folders we are going to add our custom font to the system/fonts folder make sure it is a standard .ttf font and make sure it has all the characters you'll be needing when you apply the font to wherever you want.
Then we are going to open our updater-script and simply delete everything (use your rom .zip and it's updater-script) its easier that way. We are going to add our symlink lines into it. I used a font called arame to do this but any true type font will suffice. This is how your updater-script should look the mount ext's may be different if your on the m8
Code:
ui_print("");
ui_print("............................................");
ui_print(": :");
ui_print(": Installing :");
ui_print("............................................");
ui_print("");
ui_print("");
set_progress(0.01);
ui_print("");
ui_print("");
ui_print(">>> Mounting partitions");
assert(mount("ext4", "EMMC", "/dev/block/mmcblk0p37", "/system") || ui_print("(system is mounted already)"));
assert(mount("ext4", "EMMC", "/dev/block/mmcblk0p39", "/data") || ui_print("(data is mounted already)"));
ui_print("");
ui_print("");
ui_print("");
ui_print("");
ui_print(">>> Writing Data & System");
package_extract_dir("data", "/data");
package_extract_dir("system", "/system");
ui_print("");
ui_print("");
ui_print("-- Creating additional symlinks");
symlink("Arame-Regular.ttf", "/system/fonts/DroidSansMono.ttf");
assert(unmount("/data") || ui_print("(Data is unmounted already)"));
assert(unmount("/system") || ui_print("(System is unmounted already)"));
set_progress(1.0);
ui_print("--");
ui_print("--Installation Complete!");
ui_print("--");
ui_print("--");
Ok now save and close you're updater-script and add it back into our .zip at META-INF\com\google\android\ overwriting the original.
Now lets switch gears and go back to the decompiled SystemUI.apk.
Lets open status_bar_expanded_header.xml if you look at line 5
you'll see the style I was after: highlighted:
Code:
@style/ExpandedClock
Now lets open that style Data/res/values/styles.xml Search for:
Code:
<style name="ExpandedClock" parent="@*android:style/TextAppearance">
Now were going to change the android:fontFamily for that given style: we are going to change it to monospace. It was originally sans-serif-light.. Your new style will look like:
Code:
<style name="ExpandedClock" parent="@*android:style/TextAppearance">
<item name="android:textSize">@dimen/clock_fontsize</item>
<item name="android:textStyle">normal</item>
<item name="android:textColor">@com.htc:color/cellitem_avatar_stroke</item>
<item name="android:fontFamily">monospace</item>
</style>
Recompile the systemUI.apk and either add it to your .zip in system/priv-app folder or push it to system/priv-app, but honestly if you didnt know that you probably shouldn't be doing this tutorial.
Flash the font tester.zip and push the ui
Changing the mono font and then selectively choosing it using the monospace font family. Now whenever you want to use your special font somewhere for design or whatever, you can use it just by either replacing the android:fontFamily with monospace or adding an android:fontFamily line, to the style you want to specifically change.
Here is my .zip: https://www.dropbox.com/s/2yohzroxz9ilsab/Font_Tester.zip
It took me a year to get this. Enjoy
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
Animate the status_bar_close_on and keep the carrier label at the same time.
Ok I stated above if you had any questions about the ui feel free to ask. This tutorial is a result of one of those questions.
Example:
I made several attempts at this and it was weird, it didnt want to work at first, but after I tried a few different ways, I got this way to work.
The methods we have used since ICS still work don't get me wrong but they dont work if you want to keep the carrier_label. The SB image itself will cover the carrier_label. If you try to move the carrierlabel process to expanded_layout or try adding and ImageView into either .xml like we've done in previous builds: Ics/jb/even kk. Just wanted to point that out.
Ok lets get down to it we are going to need a decompiled systemui.apk and VTS.
You will obviously need some knowledge of photoshop or after-effects or some program that will allow you to manipulate images within .9 patches.
Also for the second part or even the first you will need to know how to manipulate .9 images using the draw9patch tool provided in your android-sdk. Windows=ie:start/run/cmd/draw9patch hit enter if you have java properly in your paths it'll load the draw9patch tool. If you need I can cover .9 images in a different tutorial but there are enough tutorials on xda already about them please do some searching if you have any questions feel free to ask. Some images are very hard to patch given the complexity of the image. And depending on the animation in no way can the patch touch an abstract animation that isn't uniform so it can get crazy with the patches.
Ok lets get started we are gonna open two separate layouts
carrier_label_generic.xml
status_bar_close.xml
Ok first we're gonna go into carrier_label_generic.xml and change line 2:
From:
Code:
<com.android.systemui.statusbar.phone.CarrierLabel android:gravity="center" android:id="@id/handle" android:background= [user=3944923]@drawab[/user]le/status_bar_close_on" android:visibility="invisible" android:layout_width="fill_parent" android:layout_height="@dimen/close_handle_height"
To:
Code:
<com.android.systemui.statusbar.phone.CarrierLabel android:gravity="center" android:id="@id/handle" android:background= [user=3944923]@drawab[/user]le/status_bar_close" android:visibility="invisible" android:layout_width="fill_parent" android:layout_height="@dimen/close_handle_height"
We are changing the android:background from an image (status_bar_close_on.9.png) to (status_bar_close.xml)
If you want the results you saw in the first example you'll need to change your status_bar_close_off.9.png
Ok that in itself will animate between status_bar_close_on.9 and status_bar_close_off.9 but we can take it further than that if we want.
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
Add Operator_name to statusbar move signal_cluster to the left and then move wifi to the right of the signal itself
My findings:
Really I found that the real carrier_label id can't be called on in the status_bar without it crashing! The method they use in CM does not work and my guess is b/c the ID for handle is actually in some way tied to the carrier_label_generic id itself thus we can't call on it b/c it wants to expand the handle layouts as well. Makes sense since the handle ID is called right out of the com.android.systemui.statusbar.phone.CarrierLabel. I could be wrong though who know's maybe someone else will see something I didn't.
Please if you have any insight on how to get the actual process itself into the statusbar using sprint please let me know I've gotten as far as getting it to display the layout for it but no txt!
I'd also like to point out there are two way's of doing this: I figured this is the most simple method of the two... The other one requires adding a line to status_bar.xml where the plmn_label id lies now but turning that on doesnt work unless you give it a string value which is more adding vs modifying what is already there so I figured this way was easier hope you enjoy.
Oh and since the Id for plmnLabel is a textview in status_bar.xml and not the actual process call in smali: it doesnt act like carrier_label anyway so it's moot point!
Using the call for it <com.android.systemui.statusbar.phone.CarrierLabel will result in a ton of errors in logcat and multiple force closes.
RESULTS:
Ok your gonna need a decompiled SystemUI.apk - open status_bar.xml and signal_cluster_view_generic.xml also open values/strings
Were going to go into status_bar.xml first move the view_stub line so that is directly above the notification_icon_area id
Code:
<ViewStub android:id="@id/signal_cluster" android:inflatedId="@id/signal_cluster_tree" android:layout_width="wrap_content" android:layout_height="wrap_content" />
<LinearLayout android:orientation="horizontal" android:id="@id/notification_icon_area" android:layout_width="0.0dip" android:layout_height="fill_parent" android:layout_weight="1.0">
This will move the cluster to left now lets switch over to signal_cluster_view_generic.xml
we are gonna move some lines around
You're gonna move this line:
Code:
<ImageView android:id="@id/wifi_signal" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="@dimen/status_bar_system_icon_margin_left" android:layout_marginRight="@dimen/status_bar_system_icon_margin_right" android:scaleType="center" />
So that it falls right above the airplane ID at the bottom so move the whole line.
This will flipflop the wifi/signal cluster so that the wifi falls to the right of the signal bars themselves.
Next we're gonna turn on the operator name:
in signal_cluster_view_generic.xml you're going to see this line
Code:
<TextView android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:gravity="center_vertical" android:id="@id/operator_name" android:visibility="visible" android:layout_width="wrap_content" android:layout_height="fill_parent" android:text="@string/orange_fr_operator_name" android:paddingStart="2.0dip" android:paddingEnd="2.0dip" />
Move it to the top where wifi was before and set its visibility to visible... You turned on the operator name ID
Now lets goto string and look for orange_fr_operator_name goto that line and change orange F to your actual Service Provider and you're done. Save that and compile.
Here's my xml's if you want to use them and you still want the the clock back just set the visibility on the clock line to visible!
https://www.dropbox.com/s/0e3dxt32jh0axq8/status_bar.xml
https://www.dropbox.com/s/7dv9yxbtt2f22sk/signal_cluster_view_generic.xml
____________________________________________________________________________________________________________________
____________________________________________________________________________________________________________________
Making the header in prism/blinkfeed into an image instead of the multiply color
This could have been done several different ways this was just me trying to change it and this is how i eventually accomplished it.
Example:
think it was the second half of this that did it.!!!!
Step 1 add an image into drawable-xxhdpi mine looks like this I use a .9 but I imagine any image that fits the space will do...I made this .9 for 5.5 so it works... I will admit I did this slightly different than some would have you could also use the regular common_app_bkg_top_full.9.png in the app except yeah whatever, like i said it doesnt matter what image name you use.
Ok resize the common_app_bkg_top_full to a .9 that will suit the spot and image you want for the header... Im not going to get into how to .9 certain images but yeah you get the idea mine looks like this so there is no distortion in the gradient.
Ok Lets dig in... Open prism were gonna open a few things... Open values/styles.xml and values/drawables.xml you dont need to add an attr line for this like i believe someone else pointed out for resources this will carry either way...
First we are gonna edit line 5 in drawables.xml from
Code:
<item type="drawable" name="common_header" [user=3944923]@drawab[/user]le/zero_dummy_asset</item>
to
Code:
<item type="drawable" name="common_header" [user=3944923]@drawab[/user]le/common_app_bkg_top_full</item>
Then were gonna go to styles I edited a few lines in styles.
Then we goto
<style name="HtcActionBar">
change it from
Code:
<style name="HtcActionBar">
<item name="android:panelFullBackground" [user=3944923]@drawab[/user]le/common_app_bkg_top_full</item>
<item name="android:background">?multiply_color</item>
<item name="android:drawable" [user=3944923]@drawab[/user]le/common_app_bkg_top_full_land</item>
to
Code:
<style name="HtcActionBar">
<item name="android:panelFullBackground" [user=3944923]@drawab[/user]le/common_app_bkg_top_full</item>
<item name="android:background" [user=3944923]@drawab[/user]le/common_app_bkg_top_full</item>
<item name="android:drawable" [user=3944923]@drawab[/user]le/common_app_bkg_top_full_land</item>
Then do the same for
Code:
<style name="ActionBarActionMode" parent="@*android:style/Widget.DeviceDefault.Light.ActionMode.Inverse">
<item name="android:background">?multiply_color</item>
<item name="android:height">?android:actionBarSize</item>
<item name="android:titleTextStyle">@style/ab_primary_textview_style</item>
<item name="android:subtitleTextStyle">@style/ab_secondary_textview_style</item>
</style>
change that to
Code:
<style name="ActionBarActionMode" parent="@*android:style/Widget.DeviceDefault.Light.ActionMode.Inverse">
<item name="android:background" [user=3944923]@drawab[/user]le/common_app_bkg_top_full</item>
<item name="android:height">?android:actionBarSize</item>
<item name="android:titleTextStyle">@style/ab_primary_textview_style</item>
<item name="android:subtitleTextStyle">@style/ab_secondary_textview_style</item>
</style>
And thats how we change the multiplier header in prism from a color to an image hope you enjoy!
Add custom navbar to hotseat.xml
open values/ids.xml
and add a value to the bottom i named mine background name it whatever you want
prism.apk layout/hotseat.xml
Code:
<?xml version="1.0" encoding="utf-8"?>
<com.htc.launcher.hotseat.Hotseat android:clickable="true" launcher:cellCountX="@integer/hotseat_cell_count" launcher:cellCountY="1"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:launcher="http://schemas.android.com/apk/res/com.htc.launcher">
[COLOR="DeepSkyBlue"] <ImageView android:layout_gravity="bottom|center" android:id="@id/background" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src= [user=3944923]@drawab[/user]le/home_nav_bg" android:scaleType="fitXY" />[/COLOR]
<ImageView android:layout_gravity="bottom|center" android:id="@id/hotseat_gardient" android:layout_width="@dimen/button_bar_background_width" android:layout_height="@dimen/button_bar_background_height" android:src= [user=3944923]@drawab[/user]le/home_launcher_bg" android:scaleType="fitXY" />
<com.htc.launcher.CellLayout android:layout_gravity="center" android:id="@id/layout" android:paddingLeft="@dimen/button_bar_width_left_padding" android:paddingTop="@dimen/button_bar_height_top_padding" android:paddingRight="@dimen/button_bar_width_right_padding" android:paddingBottom="@dimen/button_bar_height_bottom_padding" android:layout_width="wrap_content" android:layout_height="fill_parent" launcher:cellWidth="@dimen/hotseat_cell_width" launcher:cellHeight="@dimen/hotseat_cell_height" launcher:widthGap="@dimen/hotseat_width_gap" launcher:heightGap="@dimen/hotseat_height_gap" launcher:maxGap="@dimen/workspace_max_gap" />
</com.htc.launcher.hotseat.Hotseat>
Ok small flaw I noticed with this which we are gonna fix. If you look closely you will see a divider in the navbar that shouldnt be there... You will also need to edit something in lockscreen to get rid of it there its at the bottom of the tutorial...
Example:
Ok now in prism.apk open main_launcher.xml
you're gonna change line 20 from
Code:
<ImageView android:layout_gravity="bottom|center" android:id="@id/nav_bar_div" android:paddingLeft="@dimen/margin_l" android:paddingRight="@dimen/margin_l" android:layout_width="fill_parent" android:layout_height="wrap_content" android:src= [user=3944923]@drawab[/user]le/common_b_div" android:scaleType="fitXY" />
To:
Code:
<ImageView android:layout_gravity="bottom|center" android:id="@id/nav_bar_div" android:paddingLeft="@dimen/margin_l" android:paddingRight="@dimen/margin_l" android:layout_width="fill_parent" android:layout_height="wrap_content" android:scaleType="fitXY" />
All we did was remove the src call android:src @drawable/common_b_div"
You could keep it for design purposes but this is just how to remove it..It obviously was interfering with my nav bar bg.
----------------------------------------------------------------------------------------------------------------------------------------------------------
Ok the divider in lockscreen lets take care of that
Example:
Ok open Htclockscreen.apk res/layouts/main_lockscreen_keyguard_host_view.xml
your gonna change one line in it: line 26
Code:
<com.htc.lockscreen.ui.footer.NavigationBarDivider android:layout_gravity="bottom" android:id="@id/navigation_bar_divider" android:background= [user=3944923]@drawab[/user]le/common_b_div" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="@dimen/navigation_bar_divider_height" android:layout_marginLeft="@dimen/common_dimen_m1" android:layout_marginRight="@dimen/common_dimen_m1" />
Remove the :android:background= @drawable/common_b_div" from that line no more grey divider...Enjoy
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Changing the call button in dailer to an stand alone themable image!
Ok I wont be going over how to theme the whole dialer others have explained certain aspects of it and my questions in some posts answer other questions if you have any feel free to ask there are tons of awesome devs that respond very quickly.
This took me forever to find since center_button id in the cmdbar.xml is very confusing when it comes to figuring this out... Its not the center_button id we are after its the phone_btn_call_rest in drawables.xml thats the actual id we are going to be replacing with an image id we will add...
Ok lets dig in decompile dialer if you havent already
make an image mine is 717x164 which is the exact width and height of the button in the standard dialer.
I did not make my image a .9 since I will only be using this specific image for only this spot.
Ok add the image into the drawable-xxhdpi folder and right click on the project open resource manager and add the id for it copy the id when it comes up and keep that safe...
Ok now were gonna open values/drawables.xml were gonna look at line 33 and find its public value
from:
Code:
<item type="drawable" name="phone_btn_call_rest">#ff000000</item>
I changed mine to and @drawable while testing,
but you dont have to since it has no effect on the outcome since we are changing this id in itself to something else in smali.
ok back into public.xml and search for the phone_btn_call_rest id for me its 0x7f020068
were gonna search for in ButtonGroup.smali
Code:
move-result-object v3
check-cast v3, Lcom/htc/htcdialer/widget/keypadbtn/HtcKeypadBgBtn;
const v0, 0x7f020068
Now simply change the phone_btn_call_rest Id to the new image id you created earlier for your new drawable. save and compile done Enjoy!
Example:
Hope you enjoy the tutorials.
Advanced Theming for Sense 6
I was fortunate enough to of had the opportunity to start theming Sense 6 before it even hit the stage as a custom ROM, but that does not give me an advantage at all. Sense 6 is a whole new concept in theming and at the best of times, an aggravated experience. So much has changed between Sense 5.5 and Sense 6 that I don’t even know where to begin. I honestly think that HTC had the common Sense kicked out of it. When life throws you lemons, you theme them….
These tutorials are designed for themers that have knowledge with xml and smali editing. There are several excellent threads that explain the concepts and the "how-to's" for these kinds of edits, therefore, I will only focus on theming issues.
The first thing that I found out was, I needed to update VTS in order to decompile any of the Sense 6 apks. My VTS was outdated and you should carefully check that you are up to date with smali, baksmali.jar’s and using a current version of apktool. Be sure to visit this page and download the latest versions of the smali.jar’s found here and replace them in the appropriate VTS folders. This will resolve most decompiling errors that you may encounter. The other errors, well it’s just the apk and way that it’s being decompiled at the moment. There’s not too much you can do other than getting a different apk and trying it.
Transparent Prism Appdrawer Background
Well, what I thought turned out to be an easy and wonderful edit, in fact, a little bug suddenly appeared.
It seems that the Search for Apps feature in the appdrawer shares the same background as the appdrawer itself. As as consequence, there is a double transparent background ontop of each other which I don't find appealing the least.
After a bit of investigating, I found that adding a custom color to isolate the appdrawer background fixed this problem.
Step 1
You're going to need to make a custom color edit in the color.xml of Prism. You can call it whatever you want and make your transparency to your choosing. For the dark_ap_background_color, you can leave it as it is or change it to your desired shade. I changed mine to a black/blue shade.
Step 2
Navigate to specific_all_apps_pagedview.xml
Within this string
Code:
<com.htc.launcher.pageview.AllAppsPagedViewHost android:id="@id/all_apps_paged_view_frame" android:background="?dark_ap_background_color" android:paddingTop="@dimen/all_apps_host_paddingTop" android:paddingRight="@dimen/all_apps_host_paddingRight" android:layout_width="fill_parent" android:layout_height="fill_parent"
search for
Code:
android:background="?dark_ap_background_color"
Replace ?dark_ap_background_color with your new color name such as @color/custom_color
Step 3
Using the search panel, you want to search within the smali folder for the following. The original thread can be found here. All credits to the authors.
Code:
com/android/htc/launcher/Launcher.smali
Search for this entry
Code:
.method public updateWallpaperVisibility(Z)V
If you see a const/high16 v2, 0x10 (not 0x100000 as shown) you need to update your smali.jar’s.
Edit 0x100000 to be
Code:
const/high16 v2, 0x0
Save your edits, compile and you’re finished.
Results
​
Custom Panels for the WeatherClockWidget.apk
Adding custom panels to the WeatherClockWidget.apk is fun. This procedure requires a bit of photo editing skills with Photoshop (or something slimar) and edits in layout and smali (if you want a custom 4x1 clock background).
Step 1.
Prepare a custom panel as shown. The dimensions are 1040 x 236 (my preference)
Save your panels in the drawable-xxhdpi folder. I prefer using a fixed name such as razor_clock_panel and razor_panel. It’s entirely your preference but don’t forget the name as you will need them for the next steps.
If you just want to add a panel for the weather conditions (1040x238), you will only need to edit the layout.xml.
Step 2
Edit the following string
Code:
xmlns:android="http://schemas.android.com/apk/res/android">
<ImageView android:id="@id/background_panel" android:background="@com.htc:drawable/common_panel" android:layout_width="@dimen/weatherclock_base_width" android:layout_height="@dimen/weatherclock_base_height" android:layout_marginLeft="@dimen/weatherclock_base_margin_left" android:layout_marginTop="@dimen/weatherclock_base_margin_top" />
You will need to change com.htc:drawable/common_panel" to the following
Code:
@drawable/razor_panel
It should now appear as this with your new panel name.
Code:
xmlns:android="http://schemas.android.com/apk/res/android">
<ImageView android:id="@id/background_panel" android:background="@[COLOR="Red"]drawable/razor_panel[/COLOR]" android:layout_width="@dimen/weatherclock_base_width" android:layout_height="@dimen/weatherclock_base_height" android:layout_marginLeft="@dimen/weatherclock_base_margin_left" android:layout_marginTop="@dimen/weatherclock_base_margin_top" />
Save your edit, compile, and you’re finished.
Results
Now if you want to add a custom 4x1 clock background as previously explained by @fisha21, the first thing you need to do is make your custom panel the same way as explained above at 1032x328 and save that in the drawable-xxhdpi folder.
Next
Compile your apk and place it on the desktop. Import the apk again and go to the Public.xml
Copy down the new Public ID for your custom panel. Follow the steps explained by fisha21. Instead of replacing the Public ID with the common_panel, use your new Public ID.
Save your edit, compile, and finished.
Results
​
Inverting Issues (Not intended for this Thread)
A lot of users are asking about inverting tips. I wasn’t going add any tutorials for that in this thread, but I figured I could do a couple until I get around to making a thread on it.
There are a few apks with Sense 6 that do not call on the resources colors. They do call on framework colors and if you don’t test your theme completely, you’ll probably find a disappointing background somewhere when you are finished. This tutorial will cover two elements that are not themed by resources, the call settings and mobile network settings background.
These two backgrounds call on the white color (line 4) in the framework color.xml. There are two ways to change the background for call settings and mobile network. The easiest way would be to redirect the color to another color in framework just as black as in my case. That’s great if you are running a black theme. Here’s the steps for that.
Step 1
Get the public ID for the white color in the Public.xml of frameworks which is 0x0106000b. Directly under that you’ll see the Public ID for black, 0x0106000c. Copy both down.
Step 2
Open the phone project and do a search for Public ID white 0x0106000b. NOTE: You need to remove the 0 after the x, so your search should be 0x106000b. You will be searching for this following smali and string.
Code:
com/android/phone/widget/ThemePreferenceActivity.smali
invoke-virtual {p0}, Lcom/htc/preference/HtcListActivity;->getHtcListView()Lcom/htc/widget/HtcListView;
move-result-object v3
const v4, 0x106000b
invoke-virtual {v3, v4}, Landroid/view/View;->setBackgroundResource(I)
Step 3
Edit the value indicated above. Compile and you’re finished.
If your background is a different color, let’s say light green, you’re going to need to make a custom colour.
Step 1
Go to the color.xml of the Phone apk. Copy one of the strings and paste it near the bottom or top. Rename the string to your custom name and change the colour hex.
Step 2
Build the apk, place on your desktop and import it again. Go to the Public.xml and copy your new ID for your custom colour. Now, repeat the steps above and search for the Public ID white 0x106000b and replace that with your new ID. Compile and you’re finished.
Results
​
Inverting Data Usage Background
The data usage background can be found in the Usage.apk. Once decompiled, you will need to go to the layout.xml.
Step 1
Search in the main_content.xml and look for this string.
Code:
<?xml version="1.0" encoding="utf-8"?>
<com.htc.usage.widget.MyFrameLayout android:id="@id/mycontent" android:background="[COLOR="Red"]#ff000000[/COLOR]" android:layout_width="fill_parent" android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android" />
For this quick tutorial, the edit has been done already in black. Make your backgound to the colour you prefer and compile. Finished.
Results
​
Inverting Weather.apk Backgrounds
Another theming disaster is the Weather.apk. This background can be changed by following the framework.apk Public ID for white method or making a new color reference in the Weather.apk, color.xml.
Step 1
If you just want a black background like I did, all you need to do is search the Weather.apk smali files for 0x106000b. There will be 4 hits and all refer to backgrounds.
Search for
Code:
0x106000b
Look for the following string in WeatherEntry$CityListAdaptor.smali
Code:
iget-object v14, v0, Lcom/htc/Weather/WeatherEntry$CityListAdapter;->mLayout:Landroid/widget/RelativeLayout;
const v15, 0x106000b
invoke-virtual {v14, v15}, Landroid/view/View;->setBackgroundResource(I)V
const v14, 0x106000b
invoke-virtual {v13, v14}, Landroid/view/View;->setBackgroundResource(I)V
Change 0x106000b to 0x106000c (My case I changed all 4 instances)
Step 2
If you need a different coloured background, you will need to make a custom colour in the color.xml of the Weather.apk. Please follow the instructions mentioned above on how to add a custom colour to the apk.
Background in Browser.apk when Nagivating Tabs
All credits for this edit go to @Basil3 as we double-teamed up on this one and he found it on the day-shift. Good on ya, mate.
Step 1
Get a pencil and copy this down
Step 2
Search smali in Browser.apk for
Code:
.method public constructor <init>(Lcom/htc/sense/browser/PhoneUi;Lcom/htc/sense/browser/htc/ui/CellList;)V
Within that search, you'll need to locate the following
Code:
# direct methods
.method public constructor <init>(Lcom/htc/sense/browser/PhoneUi;Lcom/htc/sense/browser/htc/ui/CellList;)V
.locals 10
const/16 v9, 0x11
const/4 v8, 0x0
const/4 v7, -0x1
const/4 v6, 0x1
const/4 v5, 0x0
invoke-virtual {p1}, Lcom/htc/sense/browser/BaseUi;->getActivity()Landroid/app/Activity;
move-result-object v2
Edit
Code:
const/4 v7, -0x1
Change to your desired smali color code. Remove the /4 from the string so that it shows
Code:
# direct methods
.method public constructor <init>(Lcom/htc/sense/browser/PhoneUi;Lcom/htc/sense/browser/htc/ui/CellList;)V
.locals 10
const/16 v9, 0x11
const/4 v8, 0x0
const v7, -0x1000000
const/4 v6, 0x1
const/4 v5, 0x0
invoke-virtual {p1}, Lcom/htc/sense/browser/BaseUi;->getActivity()Landroid/app/Activity;
move-result-object v2
Build and you're finished.
More Nasty Inverting Issues Resolved - HtcSetupWizard, HtcBackup, "Get Started Panel", Settings Issues Prism.apk
The following are inverting theme issues when dealing with HtcSetup and company apks. Each apk seems to have a specific edit so let’s start with the Prism.apk and the white panel “Get Started”
White box in Settings
There are a couple of nasty edits in the Prism.apk and I will be honest, it took me several days of trying and giving up only to get back on it again to find the fix. The first fix is a white box that you see when choosing new content in settings.
This fix is relatively easy. You need to theme the common_circle_pressed.png found in the xxhdpi folder in Prism.apk. That’s it.
White panel in Blinkfeed page “Get Started”
White panel in Blinkfeed page “Get Started” – This edit I want to recognize @Mikanoshi for providing some excellent clues on finding this edit as well as introducing me to an outstanding search tool. Cheers mate.
This was a tough one. This edit comes from the smali.
Code:
com.htc.libmosaicview.FeedGridViewText
You want to look around line 540 and search for
Code:
invoke-virtual {v0, v1, v2}, Lcom/htc/libfeedframework/FeedData;->getBooleanExtra(Ljava/lang/String;Z)Z
move-result v0
if-eqz v0, :cond_0
const v0, -0x1000000
invoke-virtual {p0, v0}, Lcom/htc/libmosaicview/FeedGridViewText;->setBackgroundColor(I)V
This edit has been done already. Don’t forget to delete the /4 after const. Build and you’re finished.
White Drop down panel – “Tap to see new stories”
This edit was strange as I seldom see this drop down panel. Any event, I found it in Prism.apk located in the
Code:
specific_feed_grid_view.xml
Look for
Code:
<TextView android:gravity="center" android:id="@id/notify_title" android:background="@color/razor_blue" android:layout_width="fill_parent" android:layout_height="@dimen/notification_bar_height" android:text="@string/notification_bar_title" style="@style/list_primary_s" />
For this specific edit, I decided to make a custom color and made the edit semi-transparent. Edit the color reference and you’re finished.
HtcBackup.apk – Background inverting fix.
If you are doing an inverted theme, you’re going to hit a couple of snags with the set up and back up apks. The HtcBackup.apk (for me) was relatively easy to do. Basically you are going to edit
Line 4: white:#ffffffff – change that to your desired color. Build and you’re finished.
Basil3 mentioned that his app was a data/app and that he had to do a different edit. Let me know if you have problems and I will add the additional fix later.
HtcSetupWizard.apk – Background inverting fix
Another issue came with this apk. With my buddy, @Basil3, we doubled teamed on my finding and fixed this mystery. The background and font are both controlled by the dark_primaryfont_color in resources. After some investigating, we found that the wizard.activity.xml contained a separate edit for the background
Code:
<?xml version="1.0" encoding="utf-8"?>
<com.htc.widget.HtcOverlapLayout android:orientation="vertical" android:id="@id/overlap_layout" android:layout_width="fill_parent" android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout android:orientation="vertical" android:id="@id/base_layout" android:background="#ff000000" android:layout_width="fill_parent" android:layout_height="fill_parent">
You will need to change the background: reference and add your desired hex code. The edit has been applied here already.
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>​
New Edits
Pop-up Window on HTC_IME - Word Correction
Thanks to @Mikanoshi for helping me find this edit. The pop-up window that appears when using the HTC_IME keyword after an error occurs when typing can be found the the framework.jar. You will need to look in the
Code:
Editor$SuggestionsPopupWindow.smali
Look around line 1131 and 1142 (that's where it's found in my framework)
You'll need to change the color reference indicated in your framework and make them your choice of color. I have made my around 75% transparent and it seems to look nice against a dark background.
The stock colors are smali -0x202021 (#ffdfdfdf) and -0x111112 (#ffeeeeee). I use #be000000 (-0x42000000) and that worked well for me.
Thanks for this. How will this effect creating a 4x5 home screen?
Sent from my HTC One using Tapatalk
So it guide me to change the letter and it work.. the weather control by pngs or smali too? Looking at the same smali you gave to change the background and letter.. but didn't found any related to weather icon?
Sent from my HTC One using Tapatalk
well done fisha21 this and really useful:good:
---------- Post added at 07:10 AM ---------- Previous post was at 07:09 AM ----------
nashshafrulrezza said:
So it guide me to change the letter and it work.. the weather control by pngs or smali too? Looking at the same smali you gave to change the background and letter.. but didn't found any related to weather icon?
Sent from my HTC One using Tapatalk
Click to expand...
Click to collapse
yooo Nash i love your skins remember one x time
maurydes said:
well done fisha21 this and really useful:good:
---------- Post added at 07:10 AM ---------- Previous post was at 07:09 AM ----------
yooo Nash i love your skins remember one x time
Click to expand...
Click to collapse
I'm really hoping the new theme engine working as the skin back then. too bad HTC prefer it other way. I'm trying too port back my classy transparent skin. Hopefully sense 6 would be easier. thanks btw.
Sent from my HTC One using Tapatalk
Will help here where i can !!! Awesome
another one to follow! :good:
Will add what i can, ty
Sent from my PC36100 using Tapatalk 2
Thanks fisha!! Amazing:thumbup:
Great thread thanks a lot
Powered by SkyDragon ROM
Nice
Sent from my PC36100 using Tapatalk 2
2WildFirE said:
Great thread thanks a lot
Powered by SkyDragon ROM
Click to expand...
Click to collapse
Have you deactivated the day/night color change? If yes how you do it.. can't find the solution yet.
Sent from my HTC One using Tapatalk
@nash here http://forum.xda-developers.com/showthread.php?p=51437526
And I using my common panel. 9png
Powered by SkyDragon ROM
2WildFirE said:
@nash here http://forum.xda-developers.com/showthread.php?p=51437526
And I using my common panel. 9png
Powered by SkyDragon ROM
Click to expand...
Click to collapse
Thanks.. but I don't mean the background.. see my screen shot.. the weather icon.. what control it to change at night and day..
Sent from my HTC One using Tapatalk
nashshafrulrezza said:
Thanks.. but I don't mean the background.. see my screen shot.. the weather icon.. what control it to change at night and day..
Sent from my HTC One using Tapatalk
Click to expand...
Click to collapse
Ah ok,sry i think we can change the same way with the icons if i remember editing this smali. I will look into the smali
I mean this here
.method protected getGraphicType(Z)Lcom/htc/weather/StateResources$GRAPHIC_TYPE;
.locals 1
if-eqz p1, :cond_0
sget-object v0, Lcom/htc/weather/StateResources$GRAPHIC_TYPE;->vectorgraphic_light_xl:Lcom/htc/weather/StateResources$GRAPHIC_TYPE;
:goto_0
return-object v0
:cond_0
sget-object v0, Lcom/htc/weather/StateResources$GRAPHIC_TYPE;->vectorgraphic_dark_xl:Lcom/htc/weather/StateResources$GRAPHIC_TYPE;
goto :goto_0
.end method
edit booth to light or dark, Nash has tryed, and it works.
2WildFirE said:
Ah ok,sry i think we can change the same way with the icons if i remember editing this smali. I will look into the smali
Click to expand...
Click to collapse
If you found it please let me know. That's the only thing I left for the clock.. thanks again.
@fisha21, you use vts for sense 6? I can't decompile any of sense 6 apk in vts.. any idea?
Sent from my HTC One using Tapatalk

[MOD][GUIDE] Change Air Command Apps

Hello,
This is an update to a mod I previously posted in the T-Mobile Note 3 forums, that will allow you to open any apps you want with Air Command.
This mod assumes that you have working knowledge of how to decompile/recompile apk and jar files. If you do not know how to do so, there are several threads on XDA that will teach you. This is not one of them.
This mod is for Kit-Kat only. Lollipop version will be up tomorrow, and will appear in the second post.
***Before proceeding any further, MAKE A BACKUP***
***I am not responsible for any loss of data or damaged devices***
***resulting from this mod.***​
Did you make a backup? Good....
The file we are primarily going to be working with is services.jar, found in /system/framework, so go ahead and pull yours from your phone, and decompile it.
Once you have it decompiled, download the attached file, navigate to /com/android/server/smartclip/ in your decompiled services.jar, and replace the existing SpenGestureManagerService$6.smali with the one you just downloaded.
Now, open that file and scroll all the way to the bottom, where you will see this:
Code:
:pswitch_data_234
.packed-switch 0x0
:pswitch_43
:pswitch_b7
:pswitch_120
:pswitch_19d
:pswitch_1f8
.end packed-switch
.end method
Each switch in that array corresponds to one of the Air Command functions. By default, they are as follows:
switch_43 = ACTION MEMO
switch_b7 = SCRAP BOOKER
switch_120 = SCREEN WRITE
switch_19d = S-FINDER
switch_1f8 = PEN WINDOW
In order to use different apps, you must find the internal package name of the app that you want to use, and the default activity of the app. These can be found by decompiling said app, and looking at the AndroidManifest file.
Once you have both of those, search the new SPenGestureManagerService$6.smali for "YOUR_APP_NAME1" and "YOUR_APP_ACTIVITY1" and replace them with the package name and activity name, respectively.
Repeat this for any additional apps you wish to use, searching instead for "YOUR_APP_NAME2" and "YOUR_APP_ACTIVITY2". I have included these up to "YOUR_APP_NAME5" and "YOUR_APP_ACTIVITY5" for the sake of convenience.
Now, back to that array...
For every custom app you add, you must replace one of the existing switch numbers. For the first app, that you added the package name and activity for above, you will use:
Code:
:pswitch_ms1
For the second,
Code:
:pswitch_ms2
And so on, up to
Code:
:pswitch_ms5
You can use any combination of the original switches and custom ones, in any order you wish, but you cannot add any more than 5.
Once you have finished making any changes, recompile your services.jar, push it back to your device, and enjoy!
To change the icons, so they match the new apps, decompile your framework-res.apk, and go to res/drawable-xxhdpi. The icons will all begin with "airbutton_global_icon". Simply find the one(s)
corresponding to the app(s) you've changed, and edit it however you want. Just be sure to keep the file name the same.
To change the text that appears when you hover over the icon in Air Command, go to your decompiled framework-res.apk
and open res/values/strings.xml. Locate the one(s) you want to change, change the content of the string(s), save, recompile, push to system/priv-app, set permissions, and reboot.
***Note: You may have to change them in res/values-en-rUS/strings.xml also.
RESERVED

[GUIDE][MOD][APP] Modify chomp SMS to make it look exactly as SGY SMS app

Introduction (skip it if you are in a hurry )
Is it newer always better than older? not always indeed...
For example, the transition from Windows XP to Windows Vista, or from Windows 7 to 8 is been for many a move backward in terms of user experience and performance.
I would say that also the new *security* features inplemented starting with Android KitKat, that highly limited the usage of the external physical SDcard and introduced a quite confusing virtual/emulated internal SDcard, gave to many users who switched to the newer Android OS a number of problems and limitations they didn't have before.
Beside operative systems, also on the applications world, of course, sometimes an older app is better than a newer.
I, for example, can't get used to the new Messaging app look, that I found on my new phone, once I for years happily and comfortably used the Messaging app that was available on my *old* Samsung Galaxy Y (with Android GingerBread 2.3.6) which was optimized for a small screen and therefore very essential but still complete and able to provide a good user experience.
Some of us, smartphone users, would like that switching to a bigger screen phone from a smaller one, would give us the chance to have bigger text, menus, labels, so that everything can be read easier than on previous smaller phone...
But that doesn't seem what developers (who are eventually very young and so their sight is still very good ) usually think when they have a chance to deal with a bigger screen... they rather think that a bigger screen should give the opportunity to display more things, than the same things as previously but bigger.
So, moving from my old and beloved Samsung Galaxy Y, 3inch screen, to a new Cloudfone (asian brand) 4inch smartphone didn't make me any easier to read the texts on the screen, but instead I found the screen filled of new "things" and even "empty spaces" that honestly I don't really feel the need and I found very questionable their presence... (I think that sometimes developers are just like some journalists that are in need of a "scoop", and that if they don't have one, they will try to make it out of a normal news... the marketing department usually pressure the developers to "invent" new things, a "different look" whatever it is, so that they can sell it to the public as "new"... because... you know... new is better. So it doesn't matter if "new" is really "useful", as it doesn't matter if a "scoop" is really "real").
So I tried to find an alternative SMS app on Google Play store, that looked as close as possible like my old Messaging app.
I didn't find any that looked as I wanted by default, but I found that "chomp SMS" was very customizable, featuring many "theme" options (I especially liked the option to remove the contact pics, which most of the time are just a useless box with the contact initials) that made it possible to have it looked similar, even though not same, to my previous SMS app.
Yet, the waste of screen space for empty areas, and the formats of date and time labels and other details made me willing to use my reverse engineering skills to modify "chomp SMS" so that it looks perfectly same as the SMS app I was using before.
Here below I'll show you what I've done, what I modified and where, so that you too can do your modifications at your will, if you like to.
Let's start!
This is how the default Messaging app on both the phones, the old smaller, and the bigger new, looks like.
"Conversation List" view (first pic) and "Conversation" view (second pic)
.
I then found, on Google Play Store, and installed "chomp SMS", which by default looks like this.
.
I then went into Settings and used all the available options to customize the app look and this is the best that I've been able to achieve.
.
Compare the above with this screenshots of the SGY original Messaging app that we'll use as reference
.
From now on the only thing to do is to modify the app resources and code so...
first of all, you need to know how to decompile, compile and sign an Android app package.
If you don't know how, the simplest way to do it is to use APK Studio, a nice IDE (Integrated Development Environment) application, running on Windows and Linux, made by XDA developers member vaibhavpandeyvpz
Read this http://www.xda-developers.com/decompile-edit-and-recompile-in-one-tool-with-apk-studio/
Unfortunately such software might not work due to an older embedded version of APK Tool.
So, well... you might want to use the below attacched zip file that contains my own batch files together with the latest version of APK Tool (v2.1.0) that I downloaded from here http://ibotpeaches.github.io/Apktool/install/
Just download the zip and expand the archive in your C: disk.
You need to have at least Java Runtime Environment (JRE) ver. 1.8.0 installed (http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html)
Simply copy the apk file to that C:/Decompression.chamber folder and drag it over the apktool_decomp batch file and release, to get the apk decompiled.
As result you'll have a new folder in C:/Decompression.chamber with the same name of the decompiled apk.
To compile and sign just drag the folder over the apkt_BuildNsign batch file and release... if everything will be fine you'll find a new file named out.apk inside C:/Decompression.chamber and that's the compiled and signed apk.
Now, get the chomp SMS apk file and decompile it. (can be downloaded from here http://www.apk4fun.com/apk/1180/)
Now you are ready to modify the app same as I did (or on your own different way )
1) Let's get rid of that waste of screen space...
at the sides of the message box bubbles in Conversation view.
.
Looking on the layout folder (C:\Decompression.chamber\com.p1.chompsms-1\res\layout) we can find a file name message.xml that contains the description of the elements that are visualized on the Conversation view (how I found it? I don't remember I guess I just spot it by reading all the names of the files in the layout folder)
The message.xml file begins with this row:
Code:
<?xml version="1.0" encoding="utf-8"?>
<com.p1.chompsms.views.Message a:orientation="vertical" a:paddingLeft="2.0dip" a:padding ...
We can understand then that the contents of this layout is dynamically controller by a piece of code (a "class"), of name com.p1.chompsms.views.Message, that we can read by opening the related smali file, of name Message.smali, that we can find in (C:\Decompression.chamber\com.p1.chompsms-1\smali)\com\p1\chompsms\views.
By looking inside Message.smali we can find a few rows of code like this:
Code:
invoke-virtual {v2, v1, v3, v4, v5}, Landroid/widget/RelativeLayout$LayoutParams;->setMargins(IIII)V
Those rows, obviously, will set the message layout margins, that means the outer distance from the message box and the "container" the screen borders.
Few lines of code above, you can find a couple of "const"ants, means "fixed values"
Those constants are set by this code instructions
Code:
const/high16 v3, 0x428c0000 # 70.0f
That means that the value stored on "v3" is equal to 70.0 (floating point number).
Actually 70.0dpi is exactly the big "margin" that we want to remove.
There's also another margin, on the opposite side, which is much smaller (but still a waste) and it's set to only 2.0dpi by instructions const/high16 v1, 0x40000000.
In order to remove those margins we need to set to zero those constants by searching and replacing all the occurrences of 0x428c0000 and 0x4000000 with 0x00000000
If you wonder how can be 0x428c0000 equal to 70.0 give a look to this useful webpage http://www.h-schmidt.net/FloatConverter/IEEE754.html
Here's the result of this first modification.
(first pic is "before", second is "after")
.
.
2) Let's put the timestamp inside the message box bubble
The timestamp position is defined inside the message.xml layout file (already mentioned above) located in C:\Decompression.chamber\com.p1.chompsms-1\res\layout.
Having a look to that file we can see a reference to the timestamp at row number 4, above everything else, and identified by the attribute a:id="@id/message_date_label"
Code:
<TextView a:textAppearance="?historyDateTextAppearance" a:layout_gravity="center_horizontal" a:id="@id/message_date_label" a:paddingLeft=...
In order to have it inside and at the bottom of the message box, we have to move that line down, exactly under the line identified by the label a:id="@id/message_field" so that this:
Code:
<com.p1.chompsms.views.LinearLayoutWithOverlay a:layout_gravity="bottom" a:orientation="vertical" a:id="@id/message_view" ....
<TextView a:textAppearance="?historyMessageTextAppearance" a:autoLink="phone|email|web" a:id="@id/message_field" ...
<ViewStub a:layout_gravity="center_horizontal" a:id="@id/mms_layout_view_stub" ...
</com.p1.chompsms.views.LinearLayoutWithOverlay>
become this:
Code:
<com.p1.chompsms.views.LinearLayoutWithOverlay a:layout_gravity="bottom" a:orientation="vertical" a:id="@id/message_view" ...
<TextView a:textAppearance="?historyMessageTextAppearance" a:autoLink="phone|email|web" a:id="@id/message_field" ...
<TextView a:textAppearance="?historyDateTextAppearance" a:layout_gravity="right" a:id="@id/message_date_label" ...
<ViewStub a:layout_gravity="center_horizontal" a:id="@id/mms_layout_view_stub" ...
</com.p1.chompsms.views.LinearLayoutWithOverlay>
As in the original layout the timestamp is set to be positioned on the center of the screen, we also need to change the a:layout_gravity attribute from "center_horizontal" to "right" so that it will be positioned at the bottom/right of the message text.
Here's the result of the second modification (I changed the timestamp color to black using the app theme settings)
.
3) Let's change the timestamp date and time format
In my opinion the timestamp format that chomp SMS developer had chosen is unnecessarily too long and a not immediately clear as in the Messaging app of the SGY.
Unfortunately find where in the app is defined the date and time format of the timestamp isn't that easy because the chomp SMS developer(s) didn't link the format to any "style" or attr or string or anything that can be found in the "values" folder within the "res" (resources) folder; instead the format is "set" in the programmig code, somewhere, in one of the 4143 smali files
Anyway the code must be "called" by Message.smali (mentioned above) somewhere as that's the part of the app that handle the contents of the Conversation view, including the timestamp.
By searching for the id message_date_label (which refers to the timestamp textview inside message.xml layout) inside Message.smali and for "date" I then found the method setDate(J)V
Code:
.method public setDate(J)V
.locals 3
.prologue
.line 264
iget-object v0, p0, Lcom/p1/chompsms/views/Message;->m:Landroid/widget/TextView;
new-instance v1, Ljava/util/Date;
invoke-direct {v1, p1, p2}, Ljava/util/Date;-><init>(J)V
iget-object v2, p0, Lcom/p1/chompsms/views/Message;->c:Landroid/content/Context;
invoke-static {v1, v2}, Lcom/p1/chompsms/util/cd;->b(Ljava/util/Date;Landroid/content/Context;)Ljava/lang/String;
move-result-object v1
invoke-virtual {v0, v1}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V
.line 265
return-void
.end method
Here we can see that "m", which earlier is been initialized as a pointer to the timestamp view, is read (iget-object) and stored in v0, then an object "date" and the object "c" are passed to a method "b" defined in com/p1/chompsms/util/cd that will return a "text" (stored in v1) that will be set (with setText) in v0, the timestamp view!
So we need to look at the code of (C:\Decompression.chamber\com.p1.chompsms-1\smali)\com\p1\chompsms\util\cd.smali.
In cd.smali, at the part of the code related to .method public static b(Ljava/util/Date;Landroid/content/Context called by setDate in Message.smali, we can find the instructions that are executed to "build" the timestamp string, with a space (const-string v1, " ") used as junction of the date and the time part of the timestamp text.... bingo!
So now we know that is inside cd.smali that the timestamp is "build"... but unfortunately the code there doesn't use any "string" to format the date and time but, instead, it just call/uses the standard format provided by the operative system
So things are getting more complicated.
In order to change the date and time format we actually need to add some "new" code in cd.smali that will set the format in the way we want.
Here is the code I've added.
In the beginning section # static fields I've added the following that define a couple of additional objetcs containers, "i" and "l" (l like lima)
Code:
.field private static final i:Ljava/text/SimpleDateFormat;
.field private static final l:Ljava/text/SimpleDateFormat;
More down after the marker .line 45 and the instruction
Code:
sput-object v0, Lcom/p1/chompsms/util/cd;->h:Ljava/text/SimpleDateFormat;
I've added the following that stores on "i" and "m" two different formats, one for the time and the other for the date
Code:
.line 99967
new-instance v0, Ljava/text/SimpleDateFormat;
const-string v1, "h:mma"
invoke-direct {v0, v1}, Ljava/text/SimpleDateFormat;-><init>(Ljava/lang/String;)V
sput-object v0, Lcom/p1/chompsms/util/cd;->i:Ljava/text/SimpleDateFormat;
new-instance v0, Ljava/text/SimpleDateFormat;
const-string v1, "d MMM"
invoke-direct {v0, v1}, Ljava/text/SimpleDateFormat;-><init>(Ljava/lang/String;)V
sput-object v0, Lcom/p1/chompsms/util/cd;->l:Ljava/text/SimpleDateFormat;
I then added the following code (which read the format from "i" and apply it to the date stored in p0) inside .method public static b(Ljava/util/Date;Landroid/content/Context
Code:
.line 999388
sget-object v1, Lcom/p1/chompsms/util/cd;->i:Ljava/text/SimpleDateFormat;
invoke-virtual {v1, p0}, Ljava/text/SimpleDateFormat;->format(Ljava/util/Date;)Ljava/lang/String;
move-result-object v1
.line 999395
which goes right above before this:
Code:
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v0
const-string v1, " "
then const-string v1, " " is been replaced with const-string v1, ", " (I added a comma)
More down, six lines down from const-string v1, ", " , soon after this
Code:
invoke-virtual {v1, p0}, Ljava/text/DateFormat;->format(Ljava/util/Date;)Ljava/lang/String;
move-result-object v1
I've added the following:
Code:
.line 999415
sget-object v1, Lcom/p1/chompsms/util/cd;->l:Ljava/text/SimpleDateFormat;
invoke-virtual {v1, p0}, Ljava/text/SimpleDateFormat;->format(Ljava/util/Date;)Ljava/lang/String;
move-result-object v1
.line 999422
And here is the result of all those modifications...
.
not bad ah?
4) Let's change the bubble style and make it same as in the SGY Messaging app
chomp SMS provides a number of different message box "bubble" styles but in my opinion non of them has the same nice proportions of corners radius and "tail" as seen in the SGY Messaging app.
The bubble styles are actually defined by some related images that are part of the app resources and are saved on (C:\Decompression.chamber\com.p1.chompsms-1\res)\drawable-????-v4, where ???? is anything like ldpi, mdpi, hdpi, etc...
What we need to do is to get the 9.patch (resizable) images from the SGY Messaging apk and save them in the chomp SMS resource folder with the same name of the images that are related to the chomp SMS bubble style that we want to replace
So, first we need to find the images on the SGY Messaging app.
We need to get the apk from an SGY stock firmware... actually the apk name isn't Messaging but Mms .apk. Once we have the apk we need to decompile it and look inside the res folder for any "drawable-????-v4" folder, then using the preview, scroll all the images till one that looks similar to the bubble style is found.
Here is what I've found in (C:\Decompression.chamber\Mms)\res\drawable-ldpi-v4
.
.
.
The images names are respectively: message_bubble_readmessage.9.png, message_bubble_readmessage_selected.9.png, message_bubble_sentmessage.9.png, message_bubble_sentmessage_selected.9.png
This images are very small, and indeed belong the "ldpi" drawable group, that is meant to be used on small screen devices; they can be used on phones with bigger screen too, but they will be scaled up and therefore the image will result blurred along the borders.
These are the images that I found that are related to one of the bubble styles available in chomp SMS and that I chose as the ones that will be replaced.
.
.
.
The images names are respectively,incoming_bubble_matte_retina.9.png, incoming_bubble_matte_retina_selected.9.png, outgoing_bubble_matte_retina.9.png, outgoing_bubble_matte_retina_selected.9.png
These images are available in both mdpi and hdpi versions so their "quality", their resolution is higher than the one available on the SGY Messaging app.
As we are going to copy the SGY Messaging app images in the (C:\Decompression.chamber\com.p1.chompsms-1)\res\drawable-ldpi-v4 folder of decompiled chomp SMS (it has to be the ldpi folder because is the one that match with the size of the images) but the chomp original images are in the mdpi and hdpi folders, we need to delete the original images so chomp SMS app is "forced" to get the images from the ldpi folder.
Then the images from the SGY Messaging app, once copied on the ldpi folder of chomp SMS, they need to be renamed with the same names of the original chomp SMS images, so that chomp SMS app can find them
Here is the final result of the images substitutions (bubble style selector, before and after)
.
Conversation view scaled to be comparable in real size with the screen of SGY
.
5) Let's fix padding and margins in Conversation view
As you might have observed on the above screenshot the relative position of the text inside the message box isn't optimal and anyway doesn't match at all with our reference, the SGY Messaging app.
Also the bubble round corners are clearly blurred due to the low resolution of the 9.patch (resizable) images taken from the SGY Messaging apk.
In order to fix this we need to adjust the 9.patch borders lines that "controls" the padding, the distance between the inside message text and the bubble image borders.
There's also need to make new, bigger size images so that a better quality "bubble" image can be displayed.
Additionally some paddings attributes related to the Conversation view, have to be adjusted.
So here is the old (the first on the left) and the *new* images.
.
.
.
.
.
.
As you might observe the fix of the padding has been done by changing the lenght of the bottom and right/vertical borders black lines (more on that can be read here https://developer.android.com/guide/topics/graphics/2d-graphics.html#nine-patch )
The bigger size images had to be made from scratch (I used GIMP as image editing application) using the original small as a reference. The tricky part was to properly reproduce the transparency (alpha channel) and the shadow.
The bigger images have exactly double the size as the original small one.
According to the Android developers documentations, ldpi images size relative factor is 0.75, mdpi is 1.0 and hdpi is 1.5, so that means that hdpi is 2.0 times than ldpi. By doubling the original small ldpi size the obtained image is suitable to be saved on the hdpi resources folder (C:\Decompression.chamber\com.p1.chompsms-1)\res\drawable-hdpi-v4; if the device is mdpi it will just scale down (by 0.66 factor) the hdpi image, but scaling down is much better than scaling up as it doesn't blur the image.
As the original chomp SMS hdpi versions of the bubble images have been already deleted, saving the new version on that folder won't be a file replacement, but it would have been if we didn't previously deleted the orginal images.
Padding and margins of message box and Conversation layout is also controlled by some values stored in (C:\Decompression.chamber\com.p1.chompsms-1)\res\layout\styles.xml; specifically this:
Code:
<style name="conversation_messageBubbles">
<item name="android:paddingLeft">3.0dip</item>
<item name="android:paddingRight">3.0dip</item>
The value of 3.0 has to be changed to 0.0
Also on (C:\Decompression.chamber\com.p1.chompsms-1)\res\layout\message.xml (that has been modified already above)
Change the attributes values according to this:
On row
Code:
<com.p1.chompsms.views.Message a:orientation="vertical"...
change:
paddingLeft="2.0dip" to 0.0
paddingRight="2.0dip" to 0.0
paddingBottom="8.0dip" to 6.0
On row
Code:
<LinearLayout a:orientation="horizontal" a:id="@id/message_view_wrapper" ...
change:
layout_marginBottom="4.0dip" to 0.0
On row
Code:
<TextView a:textAppearance="?historyDateTextAppearance" a:layout_gravity="right" a:id="@id/message_date_label" ...
replace:
layout_marginBottom="4.0dip" with layout_marginTop="3.0dip"
Once again, here is the achieved result...
.
Above: Conversation view scaled to be comparable in real size with the screen of SGY
Below: Close up of message bubble, before and after
.
Very close to perfect... isn't it?
The tutorial will continue on the following post...
6) Let's customize the "action bar"
The contact number shown in the action bar below the contact name is so ridiculously small that it can't be easily read, especially because a sequence of number is less likely to be visually recognized than a word that have "patterns" that our brain can use to recognize it.
Unfortunately chomp SMS, among the many theme settings, doesn't provide any related to the action bar contents, apart from the color.
So, once again, we need to find out where, in the app resources or code, are saved the values that controls the action bar contents appearance.
Looking at the content of the layout folder we can find a file named conversation.xml that likely will contain the description of the layout of the Conversation view and possibily has a reference to the action bar.
Indeed we can find, at row 5, the following
Code:
<FrameLayout a:id="@id/conversation_header_holder" a:background="?fakeActionBarBackground"
Still in layout folder we can find another file that might be related, with name action_bar_holder.xml
here we see that the second row contains this attribute
Code:
layout_height="?initialActionbarHeight"
The question mark tell use that the value is saved in the styles.xml files which can be found in (C:\Decompression.chamber\com.p1.chompsms-1)\values
Opening styles.xml file and searching for "initialActionbarHeight" we'll find the following:
Code:
<item name="initialActionbarHeight">@dimen/actionbar_height</item>
That means that the value of initialActionbarHeight is saved in dimens.xml file that can be found in the same value folder as styles.xml is.
Opening dimens.xml and searching for actionbar_height we'll find this:
Code:
<dimen name="actionbar_height">48.0dip</dimen>
bingo!
So, let's make the action bar bigger... let's change 48.0 in 52.0
Searching for "actionbar" inside styles.xml we can find a number of styles and values but with some analysis and trial and error attempts you can realize that styles that has "convo_actionbar_customview" in their name are the ones relevant.
Among them the follow two are the one that we are looking for:
Code:
<style name="convo_actionbar_customview_title" parent="@style/ActionBarTitle">
<item name="android:ellipsize">end</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:maxLines">1</item>
Code:
<style name="convo_actionbar_customview_subtitle" parent="@style/ActionBarTitle">
<item name="android:textSize">12.0sp</item>
<item name="android:ellipsize">end</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:maxLines">1</item>
Here we can see that the subtitle (which actually is the contact phone number, while the title is the contact name) has a textSize of 12.0sp... to have it bigger we need to, well... you know what!
Let's change it to 16.0sp and set a bit of free space at the bottom, to have it more vertically centered on the action bar, by adding the following line to the style
Code:
<item name="android:paddingBottom">3.0dip</item>
The convo_actionbar_customview_title style doesn't define its own textSize value, so it will just use the one set on the "parent" stlye ActionBarTitle, which is 18.0dip
Code:
<style name="ActionBarTitle" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Title">
<item name="android:textSize">18.0dip</item>
I tried to change it to 20.0dip but it turned out that the textSize changed only if the contact name was displayed alone without the phone number (without subtitle), but if the number is shown then the contact name text size was as small as the original.
Doing some more searches in the the styles.xml file I then found the following line that belong the definition of the DefaultTheme style.
Code:
<item name="convo_actionbar_customview_title_with_subtitle_textsize">@dimen/convo_actionbar_customview_title_with_subtitle_textsize</item>
That line tells us that the dimension of the phone number is saved in dimens.xml file (already mentioned above) and indeed there we can find this:
Code:
<dimen name="convo_actionbar_customview_title_with_subtitle_textsize">16.0dip</dimen>
By replacing the value of 16.0dip with 20.0dip, the contact name will become bigger and easier to read.
:highfive:
I've observed that there's a glitch on how the ellipsis (the shortening of a text with addition of the theree dots) is applied to the contact name... it's sometimes much shorter than the available space.
I found out that the glitch is fixed if the singleLine attribute is enabled.
So let's add the following line to the convo_actionbar_customview_title style.
Code:
<item name="android:singleLine">true</item>
As last thing I wanted to remove the call button on the action bar because it has appened more than once that while I had the phone on my pants pocket and the screen was unlocked (forgot to lock) then accidentally the call button was touched and a phone call initiated without me being aware of it.
To find where in the app is defined the visualization of the call button, I started with a search for word "call" inside all the files existing in the chomp SMS decompiled app folder (C:\Decompression.chamber\com.p1.chompsms-1)
I then found that the button icon image is saved as ic_call_icon.png both on xhdpi and and xxxhdpi drawable folders.
Searching for ic_call_icon text inside all the files, I found a layout name ic_call_icon_wrapper.xml that contain a reference to that image.
Searching for ic_call_icon_wrapper, I found a smali file, (C:\Decompression.chamber\com.p1.chompsms-1)\smali\com/p1/chompsms/activities/Conversation.smali that contain a reference to ic_call_icon_wrapper layout.
At line 8510 of Conversation.smali, inside .method public onCreateOptionsMenu(Landroid/view/Menu we can find
Code:
sget v2, Lcom/p1/chompsms/s$f;->ic_call_icon_wrapper:I
by analyzing the code a little above and below that row it's possible to spot the "section" that actually initialize the button and attach to it an "intent" the "action" to initiate a call.
To avoid the button to be displayed we can set a jump in the code that will make the execution to bypass that section.
So here it is how to add the jump:
After
Code:
.line 822
invoke-static {}, Lcom/p1/chompsms/util/Util;->g()Z
move-result v0
if-eqz v0, :cond_2
add
Code:
.line 9998500
goto :goto_9998531
Before
Code:
.line 830
const/16 v1, 0xd
add
Code:
:goto_9998531
And now... as usual... the final result!
.
Before... after
That's more than enough for what concern the Conversation view... mission accomplished!
7) Let's "fix" the "Conversation list", the "main" view, layout
Let's have again a look at the chomp SMS conversations and compare it to the SGY Messaging app.
.
First of all I don't understand why the date should be on the same line of the contact name thus shorting it, instead of being on the same line of the message preview as it is in the old SGY Messaging app.
Secondly... I don't like that date format! :silly:
So... let's fix it.
As usual the first thing to do is to find the layout file, or smali file that control the appearance of the conversation list view.
The first guess is the layout file main.xml in res\layout folder.
It indeed contains some references to a few parts of the view, but not in detail the parts that we are looking to modify, which are eventually described on another layout file.
Scrolling the files in layout folder another one seems very promising by its name: conversation_row.xml
Found! bingo!
in conversation_row.xml there' are clear references to the contact name, message row, and date
Here is the related lines
For contact name and date
Code:
<com.p1.chompsms.activities.search.SearchResultTextView a:id="@id/person_label" ...
<com.p1.chompsms.views.TextViewWithEllipsesFix a:id="@id/date_label"...
For message text
Code:
<com.p1.chompsms.activities.search.SearchResultTextView a:id="@id/subject_label"
The textview id attributes (id/person_label, id/subject_label, id/date_label) makes it very sure that those lines are the one that controls the positions of contact name, message text, and date.
So, in order to change the relative positions we just have to properly move those lines within the layout
Let's cut the date_label TextView line and paste it right below the subject_label TextView line, so that it looks like this
Code:
<LinearLayout a:orientation="horizontal" a:layout_width="fill_parent" a:layout_height="wrap_content">
<com.p1.chompsms.activities.search.SearchResultTextView a:id="@id/subject_label"...
<com.p1.chompsms.views.TextViewWithEllipsesFix a:id="@id/date_label" ...
<ImageView a:layout_gravity="bottom" a:id="@id/pinned_marker"...
That's enough to move the date from the above line with the contact name to the below line with the message text.
But we can see that in the same line of the date, now (actually at the right of the date) there's the placeholder for the image that is used to a conversation row as "pinned".
The three objects, message text, date and marker are listed in three rows one below the other, but they will actually be displayed on one horizontal row, one next the other, as the LinearLayout they belong is set as orientation="horizontal".
Is better to move the pinned marker on the same row of the contact name, so... cut and paste right below the person_label TextView line, so that it looks like this
Code:
<LinearLayout a:orientation="horizontal" a:layout_marginTop="-3.0dip" ...
<com.p1.chompsms.views.BaseLineImageView a:id="@id/unread_marker"...
<com.p1.chompsms.views.BaseLineImageView a:id="@id/no_notification"...
<com.p1.chompsms.activities.search.SearchResultTextView a:id="@id/person_label"...
<ImageView a:layout_gravity="bottom" a:id="@id/pinned_marker"...
Ok, that's done
Now the "hard" part... the modification of date formatting.
To find where in the 1672 smali files contained in (C:\Decompression.chamber\com.p1.chompsms-1)\smali\com\p1\chompsms is the piece of code that set the date format we can try to trace back the chain starting from the conversation_row.xml layout.
Here we see that the date TextView contents is "controlled" by com.p1.chompsms.views.TextViewWithEllipsesFix that can be found and read as a smali file of name TextViewWithEllipsesFix.smali saved in (C:\Decompression.chamber\com.p1.chompsms-1)\smali\com\p1\chompsms\views
Giving a look at the code of that smali file doesn't show anything related to the date format, so it means that there must be another place, another smali file, that does the date formatting and then pass the result to TextViewWithEllipsesFix; we need to find any smali file that has inside a call to TextViewWithEllipsesFix.
Unfortunately, there's not even one smali file that contains a reference to Lcom/p1/chompsms/views/TextViewWithEllipsesFix in order to pass some data to it or call any of its method.
Eventually the code we are looking for is in (C:\Decompression.chamber\com.p1.chompsms-1)\smali\com\p1\chompsms\views\ConversationRow.smali that is defined in conversation_row.xml layout as the root view, the main container.
By reading the contents of ConversationRow.smali, we can see that at the beginning is defined a variable "p" made to contain a date object
Code:
.field private p:Ljava/util/Date;
A few line below, inside the .method public constructor, the "date" , received by as argument p0, is saved in "p".
Code:
iput-object v0, p0, Lcom/p1/chompsms/views/ConversationRow;->p:Ljava/util/Date;
Searching for the string "->p:Ljava/util/Date" we can see that "p" is used only in the .method public final b(J)Ljava/util/Date;
The method "b(J)Ljava/util/Date" isn't called anywhere within ConversationRow.smali, so the parameters it receives and the results it returns must be related to some code in some other smali file.
Searching the whole chomp SMS smali folder for files containing the string "b(J)Ljava/util/Date" gave me as result two files:
com/p1/chompsms/activities/conversationlist/ConversationList$a.smali
com/p1/chompsms/activities/search/a.smali
In a.smali, in .method public final bindView, at row 171 there's the call to method "b(J)"
Code:
invoke-virtual {v3, v4, v5}, Lcom/p1/chompsms/views/ConversationRow;->b(J)Ljava/util/Date;
The result of the call, supposedly it's a date or time, is then saved to v4, then v5 and v9 are set to numeric value "1", then v0 is set equal to p2 (a parameter received by the bindView method) then v4, v0, v5, v9 are all used to make a call to method a(Ljava/util/Date;Landroid/content/Context;ZZ)Ljava/lang/String defined in com\p1\chompsms\util\cd.smali
Code:
invoke-static {v4, v0, v5, v9}, Lcom/p1/chompsms/util/cd;->a(Ljava/util/Date;Landroid/content/Context;ZZ)Ljava/lang/String;
util\cd.smali ?
But that's the same cd.smali that we had to modify earlier to change the format of time and date in the conversation message timestamp!
Let's have a look to method "a(Ljava/util/Date;Landroid/content..." in cd.smali
The method is quite long, but it's clear that is doing some kind of operations on the date that it has received when is been called by a.smali, which has received the date from method "b" in conversation_row.smali.
The "a" method calls the calendar
Code:
invoke-virtual {v2, v3}, Ljava/util/Calendar;->get(I)I
in order to know how many days are past from the given date and the present time.
It then choose if in place of a "text" containing a formatted date it has to return a string like "today" or "yesterday"
Code:
.line 78
:cond_1
sget v0, Lcom/p1/chompsms/s$l;->today:I
Code:
.line 82
sget v0, Lcom/p1/chompsms/s$l;->yesterday:I
But if it's not the case for "today" or "yesterday", but still the given date isn't past than more than three days, than the method code will format the date using the SimpleDateFormat stored in "a" variable!
Code:
sget-object v0, Lcom/p1/chompsms/util/cd;->a:Ljava/text/SimpleDateFormat;
invoke-virtual {v0, p0}, Ljava/text/SimpleDateFormat;->format(Ljava/util/Date;)Ljava/lang/String;
move-result-object v0
If we look at the very beginning of the cd.smali file we can see that the date format stored in "a" is in the form of "EEEE"
Code:
const-string v1, "EEEE"
invoke-direct {v0, v1}, Ljava/text/SimpleDateFormat;-><init>(Ljava/lang/String;)V
sput-object v0, Lcom/p1/chompsms/util/cd;->a:Ljava/text/SimpleDateFormat;
"EEEE" is the standard pattern letter that refers to the "day of the week" (for more info read here https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html) and as the "E" letters are four then the name will be in full, not abbreviated... like Sunday and Monday, instead of Sun, and Mon.
So if the date that has been received is same as the present date or is one day or two days old the result would be either "today", "yesterday" or the day of the week, but if it's older...
Code:
.line 89
:cond_4
invoke-static {p1}, Lcom/p1/chompsms/util/cd;->b(Landroid/content/Context;)Ljava/text/DateFormat;
The DateFormat returned by .method private static declared-synchronized b(Landroid/content/Context; )Ljava/text/DateFormat will be used.
Having a look to the contents of that method we can see that it retrieves the DateFormat by querying the System Settings
Code:
const-string v2, "date_format"
invoke-static {v0, v2}, Landroid/provider/Settings$System;->getString(Landroid/content/ContentResolver;Ljava/lang/String;)Ljava/lang/String;
That means that the Date Format will change (synchronized) accordingly with the current System settings.
Well... that's enough! Tiring ah? :silly:
So, we found it! :highfive:
But we still have to fix it... well... that's quite simple once we know where to put our hands
Let's just add a SimpleDateFormat as we already did before for the message TimeStamp and insert the code to force the use of that format instead of the one returned by method "b"
At the beginning of the cd.smali file, # static fields section, add
Code:
.field private static final m:Ljava/text/SimpleDateFormat;
At the end of .method static constructor <clinit>()V, below the code added before, add the following
Code:
new-instance v0, Ljava/text/SimpleDateFormat;
const-string v1, "d MMM yy"
invoke-direct {v0, v1}, Ljava/text/SimpleDateFormat;-><init>(Ljava/lang/String;)V
sput-object v0, Lcom/p1/chompsms/util/cd;->m:Ljava/text/SimpleDateFormat;
(note that "d MMM yy", is a pattern for a date format like 9 Sep 16)
Then, as last step, replace this
Code:
.line 89
:cond_4
invoke-static {p1}, Lcom/p1/chompsms/util/cd;->b(Landroid/content/Context;)Ljava/text/DateFormat;
move-result-object v0
invoke-virtual {v0, p0}, Ljava/text/DateFormat;->format(Ljava/util/Date;)Ljava/lang/String;
move-result-object v0
with this:
Code:
.line 89
:cond_4
sget-object v0, Lcom/p1/chompsms/util/cd;->m:Ljava/text/SimpleDateFormat;
invoke-virtual {v0, p0}, Ljava/text/SimpleDateFormat;->format(Ljava/util/Date;)Ljava/lang/String;
move-result-object v0
Job done! Congratulations! :highfive:
So, let's see how it looks the result of this hard work
.
8) The last touch
If you observe the above pictures you'll find that the Conversation list layout isn't as compact as in SGY Messaging app; moreover the divider line, for some reason, doesn't go all the way from one side to the other of the screen, but has a sort of "margin" distance on its left side.
In order to fine tuning the layout we need to change a few values here and there and add a few too
In values\styles.xml, style "conversationlist_row_content",
change android: paddingLeft value from 8.0 to 0.0
change android: paddingTop value from 10.0 to 7.0
change android: paddingRight value from 16.0 to 6.0
change android: paddingBottom value from 10.0 to 8.0
Code:
<style name="conversationlist_row_content">
<item name="android:paddingLeft">0.0dip</item>
<item name="android:paddingTop">7.0dip</item>
<item name="android:paddingRight">6.0dip</item>
<item name="android:paddingBottom">8.0dip</item>
In values\styles.xml, style "conversationlist_row_personlabel",
change android: paddingRight value from 6.0 to 0.0
add android:lineSpacingExtra with value -2.0dip
Code:
<style name="conversationlist_row_personlabel">
<item name="android:paddingRight">0.0dip</item>
<item name="android:lineSpacingExtra">-2.0dip</item>
In values\styles.xml, style "conversationlist_row_datelabel",
add android: paddingLeft with value from 6.0
Code:
<style name="conversationlist_row_datelabel">
<item name="android:paddingLeft">6.0dip</item>
In values\styles.xml, style "conversationlist_row_subjectlabel",
add android:singleLine with value "true" (to fix the glitch on the ellipsizing)
Code:
<style name="conversationlist_row_subjectlabel">
<item name="android:singleLine">true</item>
About the divider...
I hoped I could find any layout file or style attribute somewhere that was related to that left margin that prevents the divider to fill the screen from one side to the other... I couldn't... there's not such thing.
Once again, same as for the case of the message box margin, the divider left margin is "hardcoded".
By searching "divider" within all the smali files existing in (C:\Decompression.chamber\com.p1.chompsms-1)\smali\com\p1\chompsms, there are 27 smali files found but one of them has name ConversationList.smali that seems promising.
The file is located in (C:\Decompression.chamber\com.p1.chompsms-1)\smali\com\p1\chompsms\activities\conversationlist
Indeed... it's the right file!
It invokes setDivider...
Code:
invoke-virtual {v1, v0}, Lcom/p1/chompsms/activities/conversationlist/ConversationListListView;->setDivider(Landroid/graphics/drawable/Drawable;)V
... and setDividerHeight
Code:
invoke-virtual {v0, v1}, Lcom/p1/chompsms/activities/conversationlist/ConversationListListView;->setDividerHeight(I)V
Unlike what we found on com/p1/chompsms/views/Message.smali, in ConversationList.smali can't be found any call to setMargins method; there's instead a call to the InsetDrawable class.
Code:
invoke-direct/range {v0 .. v5}, Landroid/graphics/drawable/InsetDrawable;-><init>(Landroid/graphics/drawable/Drawable;IIII)V
Changing this
Code:
.line 678
:cond_0
const/high16 v1, 0x41800000 # 16.0f
To this
Code:
.line 678
:cond_0
const/high16 v1, 0x00000000 # 0.0f
Will get rid of the divider "margin"
Changing this
Code:
.line 683
iget-object v0, p0, Lcom/p1/chompsms/activities/conversationlist/ConversationList;->h:Lcom/p1/chompsms/activities/conversationlist/ConversationListListView;
const/high16 v1, 0x3f800000 # 1.0f
To this
Code:
.line 683
iget-object v0, p0, Lcom/p1/chompsms/activities/conversationlist/ConversationList;->h:Lcom/p1/chompsms/activities/conversationlist/ConversationListListView;
const/high16 v1, 0x3fc00000 # 1.0f
Will increase the divider thickness from 1.0dip to 1.5dip
So, now... it's showtime! :fingers-crossed:
.
Cherry on the cake
If the phone is connected to the Internet, every three times that the user "enter" one of the SMS conversations, chomp SMS will display an advertisment that will pin on top of the Conversation list... like this
and it will stay there untill the ad gets touched.
The ads are displayed according to their dedicated layouts; there are two different layouts: one generic and one specific for Facebook ads.
The two layouts are defined by two xml files: conversation_list_native_ad_row.xml and conversation_list_native_ad_row_facebook.xml
By adding the attribute a:visibility="gone" to the layouts, the ads won't be visibile anymore (please don't ask "how"... find it out yourself)
As cherry on the cake I decided to make a new app icon for the modified chomp SMS app; an icon that is a mix of the SGY Messaging icon and the original chomp SMS one.
+
=
The icon is of hdpi size and it's available for download as attachment to this post.
That's all folks!
If you have enjoyed to follow the tutorial your click on the thanks button here below will be highly appreciated
Thanks for reading
Reserved
good job. yes, apps keep getting worse. i guess the focus is now on getting your credit card number or harvesting your contacts for marketing, not with the user.
ok - somewhat unrelated, but i trust you'll know... - where does chomp SMS keep its blacklist? i need an SMS app that has an import function, but barring that, i could manipulate the file manually if it's text or XML.
hi, I never used the blacklist function so I didn't even never bother to know where it's saved.
Anyway usually apps have two preferred places where to save their data, one is the databases folder inside the app dedicated folder in the /data partition, the others is the shared_prefs also inside the app dedicated folder in /data/data.
After a quick check I found out that the blacklist is saved in the chompSMS Preferences.xml file.
Unfortunately the list is encoded so the numbers in the list aren't visibile and the app doesn't recognize the numbers if they aren't properly encoded.
You are so spot on with your comments in the first post. I have been using my old LG F3 for so long and the SMS worked so great with layout etc etc... I got a BLU Vivo last year because I needed a bigger screen for GPS driving...
I have just been using the larger phone for driving with my job, via a hotspot on the LG... but time had come to make the newer BLU phone my main phone...
And it has been drudgery finding a replacement app for the new phone, just getting the look and feel to the old phone which was perfect (stock SMS) circa 2013.
Chomp was close... I stumbled upon this post and I am stoked to try your work.
I've never done apk mods.. lots of other coding.. and I am excited to dive in with your examples as my first learning experience with apk.
Doing the date mod in the bubble, and removing wasted space in the bubble, is most important to me.
I am going to try to add an Icon for the "templates" somewhere on the screen, because I use them a lot.
If successful I'll get back and post the info.
Thanks a bunch for your work. I'm stoked !
Rob

[GUIDE] Fixes for Deadzone error (Consuming errant click) at Navigation bar

Hello,
Recently I've had problems with my Moto X Style (XT1575), where I wasn't able to use the navigation keys. A quick look at the logcat told me that the touch registered was being ignored. It was similar to this.
Code:
[DATE] DeadZone (1070, 1436): consuming errant click
Similar problems with other Nexus phones were found here
This seems to be a digitizer issue and most people under warranty were able to get replacements. Others, like me , were not so lucky.
The most obvious workaround is to use pie controls. But if you want to use the navigation controls again, there is one way. The deadzone spot extends to 1 cm above the screen, so, if the height of the navigation bar was altered, the controls would seemingly work again.
NOTE: This does not fix the dead spot in the screen. It will still be there until you change the digitizer. ROOT IS REQUIRED.
Method 1: Using apktool
-> Download Apktool.
-> Open cmd and navigate to adb folder
-> Pull framework res apk: adb pull /system/framework/framework-res.apk
-> Put both the files in adb folder (so that it'll be easy).
-> java -jar apktool.jar if framework-res.apk (Installation of framework).
-> java -jar apktool.jar d framework-res.apk (This will decompile the apk).
-> Navigate to /res/values/
-> Open dimens.xml with wordpad, notepad++, etc..
-> In search type navigation, it should show you the navigation, navigation landscape with the default dpi values (48 dpi).
-> Change this to 64 dpi and save.
-> java -jar apktool.jar b framework-res (This will recompile apk).
-> Put the application in system/framework.
Method 2: Using Xposed Framework
There is an app called Xperia V Mods for Xposed framework which offers the ability to change the NavBar height. Default is 48 dpi. Change it to 64 dpi. This may not work on all phones. But luckily, it worked on mine.

Categories

Resources