FORUMS
Remove All Ads from XDA

[MOD][XPOSED][4.0+] Smiley Replacer 1.3 (17.02.2013)

2,559 posts
Thanks Meter: 67,200
 
By rovo89, XDA Ad-Free Senior Recognized Developer on 7th February 2013, 11:51 PM
Post Reply Email Thread
This isn't compatible with most KitKat ROMs!

Not sure how many of you are using the MMS/SMS app that comes with AOSP, CM and most other ROMs. It's good enough for my usage (don't text much), but I never liked those smileys. I do love the ones I use in Miranda though (from Kolobok).

So here is a solution to that problem, at least if you have root access. I developed a module for my Xposed framework. For those who haven't seen it yet, it can do many modifications to the system and apps in memory, without modifying any APKs. This makes it easy to try out and many modules can work for a broad range of ROMs.

I you want to try it, follow these steps:
1. Install the Xposed framework as described in this thread (REQUIRES ROOT!)
2. Install the attached APK and activate the module in the Xposed installer (this is also described in the framework thread)
3. Reboot

Then, download at least one smiley pack to your phone (see second post) and follow these steps to use it:
4. Import the smiley pack into the app
4a. Start the Smiley Replacer app
4b. Click "Choose a smiley pack"
4c. Click the "add" button (you might need to press the menu key if there is no such button)
4d. Use your favorite file browser to select the smiley pack
4e. Click "Start import"
5. Choose the smiley pack you just imported from the list
6. Restart the MMS/SMS app (there is a button for that which makes sure that the app is properly killed before)

This will only work for 4.0+ ROMs and only for the standard MMS/SMS app, assuming it's based on AOSP and the smiley renderer is not drastically modified. For example, I'm using CM10.1 (Android 4.2.1), but it also worked for Tungstwenty on a Samsung stock ROM with Android 4.0.3. Even though we both have a Galaxy S2, this module will also work on other devices. It only depends on a small subset of the MMS/SMS app code. So I hope this is the correct subforum (if not, feel free to move it).

Some things to note:
- This module doesn't include any smileys itself. You will need a smiley pack, which is easy to create (see second post)
- Smileys can be animated gif files. This makes it different from simply replacing the images. Please note that this requires many refreshes of the UI. On my phone, the CPU load is still ok, but maybe for some devices with less performance will have problems.
- Source code: https://github.com/rovo89/Smiley-Replacer

Changelog:
1.0: Initial version [116 downloads]
1.1: Fix cut-off smileys and MMS/SMS restart, add size selector [21 downloads]
1.2: Added an option to disable auto-resizing [10 downloads]
1.3: Fixed: Static smileys were still resized even when this was disabled
Attached Thumbnails
Click image for larger version

Name:	Screenshot_2013-02-07-22-39-37.jpg
Views:	52892
Size:	29.9 KB
ID:	1712203   Click image for larger version

Name:	Screenshot_2013-02-07-22-39-48.jpg
Views:	44864
Size:	28.2 KB
ID:	1712204  
Attached Files
File Type: apk SmileyReplacer_1.3.apk - [Click for QR Code] (86.0 KB, 11574 views)
The Following 122 Users Say Thank You to rovo89 For This Useful Post: [ View ]
 
 
7th February 2013, 11:51 PM |#2  
rovo89's Avatar
OP Senior Recognized Developer
Thanks Meter: 67,200
 
Donate to Me
More
Example smiley packs / Format description
Smiley packsAnd a bit special, for those who don't want to have any smileys at all:
No smileys by m477m

File format
General
A smiley pack is a zip file consisting of a few text files for the metadata and of course the images, all directly in the zip (no subfolders).

I recommend to use "xyz.smileys.zip". Files ending with ".smileys.zip" can be opened and imported directly (unless your file browser insists on opending zip files itself).

In case you want to use characters like umlauts, you need to use UTF-8 character encoding without Byte Order Mark (BOM). I'm using Notepad++, where you can easily select this from the menu.

There is no limit of smileys, however keep in mind that quantity is not everything and that the smileys are local to the phone where the smiley pack is installed. Limit yourself to smileys you and your conversation partners actually send.

Images
I recommend to use png for static smileys and gif for animated smileys. In theory, other file formats like bmp should be supported, but it's untested and probably doesn't add any value. Transparency has to be included in the file itself, i.e. you should see it in the Windows image preview or whatever you are using.

The image size should be something between 20-30px, close to what they are normally display. The images are scaled automatically to match the text height.

info.txt
The first line of this file is the title of the smiley pack. All following lines are the summary.

codes.txt
This file contains a mapping between the images and the codes they replace. There is one line per smiley, empty lines and lines starting with a hash (#) are ignored. Each line has to start with the filename, then one or more blanks, then the main code (which is displayed in the "insert smiley" dialog), then optionally further codes, separated by one or more blanks. For example:
Code:
smile.gif   :) :) =)
This would define a smiley with the (animated) image smile.gif, the main code ":)" as well as further codes ":)" and "=)". Any occurences of these codes will be replaced with the smiley image.

Only smileys defined in this file will be considered, any other images will be ignored. This file also defines the order of the smileys in various lists. The first smiley in this file will be used for the preview in the "choose smiley pack" screen.

descriptions.txt
Here, the texts displayed next to the smileys are defined. The format is similar to the one of codes.txt. The first field is again the filename, which is followed by one or more blanks. Everything after that is the smiley text. If no description is given for a smiley, the filename without extension will be used.

I recommend to re-use the texts of the builtin smileys if possible. You can do that with the dummy description "DEFAULT:XYZ", where XYZ stands for default smiley. Have a look at the AOSP smileys for a list of all supported smileys and the corresponding texts. As the texts will be taken from the installed MMS/SMS app, the text might vary slightly. But the good thing is: Translations are applied as well, so you profit from a wide range of supported languages.

Examples:
Code:
smile.gif I'm so happy
sad.gif   DEFAULT:SAD
Translations
As mentioned in the previous section, the easiest way to get translations is using "DEFAULT:XYZ" whenever possible. However, you might want to add completely new smileys. If you just add the text to descriptions.txt, it will be used for all languages.

To add translations for selected smileys, you can create files like "descriptions-de.txt" (language) and "descriptions-pt-rBR" (language and region). This is the same naming convention as used for Android resources. In these files, you use the same format as in descriptions.txt, however you should only include those smileys which you want to translate. Other texts are inherited from more general files, which means that everything not translated in e.g. descriptions-pt-rBR.txt will be taken from descriptions-pt.txt. If it doesn't exist there either, it's taken from descriptions.txt. The last fallback is the filename without extension as mentioned before. So you don't need to repeat the text from those general files, especially not the "DEFAULT:XYZ" texts.


That's it, I think that should cover it all. For examples, look at existing smiley packs. If you have created a new smiley pack, ping me and I will add a link in this post.
Attached Files
File Type: zip aosp42.smileys.zip - [Click for QR Code] (23.4 KB, 3771 views)
File Type: zip kolobok.smileys.zip - [Click for QR Code] (85.6 KB, 5815 views)
The Following 46 Users Say Thank You to rovo89 For This Useful Post: [ View ]
8th February 2013, 12:54 AM |#3  
liquidguru's Avatar
Senior Member
Flag Ambon, Indonesia
Thanks Meter: 225
 
More
Re: [MOD][XPOSED][4.0+] Smiley Replacer
Working perfectly on stock based 4.1.2 Samsung ROM, on my Note 2. Amazing work, thanks

sent from somewhere
8th February 2013, 03:30 AM |#4  
Froid's Avatar
Senior Member
Flag somewhere
Thanks Meter: 1,313
 
Donate to Me
More
Re: [MOD][XPOSED][4.0+] Smiley Replacer
Great job man
8th February 2013, 04:10 AM |#5  
Hardcore69er's Avatar
Senior Member
Flag Columbia, South Carolina
Thanks Meter: 145
 
More
Re: [MOD][XPOSED][4.0+] Smiley Replacer
what about iPhone emoji which is basically what the droidified ones represent ?

Sent from my HTC Sensation using xda app-developers app
8th February 2013, 09:00 AM |#6  
rovo89's Avatar
OP Senior Recognized Developer
Thanks Meter: 67,200
 
Donate to Me
More
Emoji are left untouched by this mod. I haven't looked into them for a couple of reasons:
- Both sender and receiver need a phone that supports emoji
- For you to see an icon, the sender needs to actually insert an emoji, so you don't have the control yourself
- I have never sent or received an emoji
- I think emoji are a bit more standardized than smileys, so I'm not sure if they should be changed too much
The Following 3 Users Say Thank You to rovo89 For This Useful Post: [ View ]
9th February 2013, 06:16 PM |#7  
rovo89's Avatar
OP Senior Recognized Developer
Thanks Meter: 67,200
 
Donate to Me
More
I just added the file format descriptions to the second post for anyone who would like to create their own smiley pack.
The Following User Says Thank You to rovo89 For This Useful Post: [ View ]
9th February 2013, 07:14 PM |#8  
noooooo's Avatar
Senior Member
Thanks Meter: 240
 
More
Confirmed working on 4.2! Great work man! I had been looking for something similar for ages! 2proposal if i can say them:
1 maybe add a facebook and sense 4.5 static pack
2 maybe make them quite bigger
however, fantastic work!
The Following User Says Thank You to noooooo For This Useful Post: [ View ] Gift noooooo Ad-Free
9th February 2013, 07:43 PM |#9  
rovo89's Avatar
OP Senior Recognized Developer
Thanks Meter: 67,200
 
Donate to Me
More
I love the Kolobok smileys, so I'm not gonna use any others. But opinions differ, that's why I chose not to hardcode my preferred smileys but created a file format that is open and it doesn't require any programming skills. Create whatever you like and please share the results.

About smiley sizes: I thought it would be good that they are just as high as the text around them, so that the line height and the space between the lines is unchanged. I have just tried and applied a hardcoded scaling factor - it works, but to me it doesn't look nice because the line spacing is uneven.
The Following 2 Users Say Thank You to rovo89 For This Useful Post: [ View ]
9th February 2013, 08:51 PM |#10  
noooooo's Avatar
Senior Member
Thanks Meter: 240
 
More
Quote:
Originally Posted by rovo89

I love the Kolobok smileys, so I'm not gonna use any others. But opinions differ, that's why I chose not to hardcode my preferred smileys but created a file format that is open and it doesn't require any programming skills. Create whatever you like and please share the results.

About smiley sizes: I thought it would be good that they are just as high as the text around them, so that the line height and the space between the lines is unchanged. I have just tried and applied a hardcoded scaling factor - it works, but to me it doesn't look nice because the line spacing is uneven.

I've tried to make an xperia mod pack but it recognises only the smileys i haven't changed, can you help me?
Attached Files
File Type: zip noooooo.zip - [Click for QR Code] (133.0 KB, 556 views)
The Following 2 Users Say Thank You to noooooo For This Useful Post: [ View ] Gift noooooo Ad-Free
9th February 2013, 10:31 PM |#11  
rovo89's Avatar
OP Senior Recognized Developer
Thanks Meter: 67,200
 
Donate to Me
More
You are using many png files, but all of the smileys in codes.txt are .gif. You have changed descriptions.txt, but most important is codes.txt: "Only smileys defined in this file will be considered, any other images will be ignored."
The Following 2 Users Say Thank You to rovo89 For This Useful Post: [ View ]
Post Reply Subscribe to Thread

Tags
emoticons, smileys, xposed

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes