Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,772,052 Members 40,454 Now Online
XDA Developers Android and Mobile Development Forum

[Contacts.apk] [DONE] Contacts List with Photo in Donut

Tip us?
 
xenio2000
Old
(Last edited by xenio2000; 17th November 2009 at 10:49 AM.) Reason: Add link of source code.
#1  
xenio2000's Avatar
Senior Member - OP
Thanks Meter 22
Posts: 256
Join Date: May 2009
Location: Sassari
Default [Contacts.apk] [DONE] Contacts List with Photo in Donut

Updated:

Credits must go to Geesun for his patch to show Contacts Photo.


backup first...

the files in attachments are to be used in UPDATE on RECOVERY MODE.
cyanogen_update.zip -> Contacts.apk with 2.0 icons + Photo on Contact list
geesun_update.zip -> Contacts.apk with Photo on Contact list and much more (warning this is for chinese mod and there is some chinese text)
IF YOU WANT ONLY THE Contacts.apk just unzip the file and check inside App


Feature only in the Geesun Mod
from the Chinese site (translated):
Contacts to strengthen amended as follows
1. Intelligent IP dial-up, according to city contacts dial 17951 (can be set)
2. Display to / go to Electric City
3. According to contact numbers, display contact city,
4. Show a missed call city.
5. For international calls, you can display the name of the country
6. For fixed-line telephone, +86 and so on, can handle
7. For used phones, you can also display, such as 138001380000,10086,95528, etc.
8. The first time required to set up your own IP dial-up number and their phone numbers, default is 17951 / Shanghai
9. Database is small, query speed.
10. The database updated to 2009.5, all data come from the Internet, without encryption, you can free to use.
11. To contact data will not be damaged.
12. Have joined the contact picture.

Thanks
Xenio


SCREENSHOT FROM GEESUN MOD (Cyanogen mod have only Photos in Contacts)




direct link to Contacts.apk from Cyanogen
http://n0rp.chemlab.org/android/apps/Contacts.apk


Geesun Patch.
Code:
diff --git a/src/com/android/contacts/ContactsListActivity.java b/src/com/android/contacts/ContactsListActivity.java
index 2b74410..d0b6b94 100755
--- a/src/com/android/contacts/ContactsListActivity.java
+++ b/src/com/android/contacts/ContactsListActivity.java
@@ -178,8 +178,8 @@ public final class ContactsListActivity extends ListActivity
     static final int MODE_QUERY = 60 | MODE_MASK_NO_FILTER;
     /** Run a search query in PICK mode, but that still launches to VIEW */
     static final int MODE_QUERY_PICK_TO_VIEW = 65 | MODE_MASK_NO_FILTER | MODE_MASK_PICKER;
-
-    static final int DEFAULT_MODE = MODE_ALL_CONTACTS;
+    //Geesun
+    static final int DEFAULT_MODE = MODE_ALL_CONTACTS|MODE_MASK_SHOW_PHOTOS;
 
     /**
      * The type of data to display in the main contacts list.
@@ -1973,6 +1973,13 @@ public final class ContactsListActivity extends ListActivity
                             photo = BitmapFactory.decodeByteArray(photoData, 0,
                                     photoData.length);
                             mBitmapCache.put(pos, new SoftReference<Bitmap>(photo));
+                            //Geesun
+                            if(photo == null){
+                                int id = cursor.getInt(ID_COLUMN_INDEX);
+                                Uri uri = ContentUris.withAppendedId(People.CONTENT_URI, id);
+                                photo = People.loadContactPhoto(context, uri, R.drawable.ic_contact_list_picture, null);
+
+                            }
                         } catch (OutOfMemoryError e) {
                             // Not enough memory for the photo, use the default one instead
                             photo = null;
--------------------------------------------------------------------
OLD OP.
I am trying to modify the Contacts.apk source to get the Photo's
contact in the Contacts tab, (In Eclair this is already implemented, I
would like to have it in Donuts too).
In the Favorites tab the photos are already there, so tweak it must be simple.

This is what I get until now:

Contacts.apk source file ContactsListActivity.java

ORIGINAL
1653 private boolean mDisplayPhotos = false;
1654 private SparseArray<SoftReference<Bitmap>> mBitmapCache = null;
...
1658 super(context, R.layout.contacts_list_item, null, false);

CHANGED BY ME
1653 private boolean mDisplayPhotos = true;
1654 private SparseArray<SoftReference<Bitmap>> mBitmapCache = new SparseArray<SoftReference<Bitmap>>();
...
1658 super(context, R.layout.contacts_list_item_photo, null, false);

After this I get a GENERIC ICON with the droid on the left of the
contacts name.

That is all I get, I am not good in Java Programming...

If you want to get involved this is the code...
http://android.git.kernel.org/?p=pla...980384;hb=HEAD

Any help?
Xenio
Attached Files
File Type: txt geesun_contacts_apk_patch.txt - [Click for QR Code] (1.7 KB, 329 views)
File Type: zip cyanogen_update.zip - [Click for QR Code] (291.9 KB, 1278 views)
File Type: zip geesun_update.zip - [Click for QR Code] (556.7 KB, 528 views)
 
akirah
Old
(Last edited by akirah; 10th November 2009 at 02:02 PM.)
#2  
Senior Member
Thanks Meter 4
Posts: 231
Join Date: Aug 2007
Location: Seattle / Warsaw
Hi,

I've tried to set this another way using:

132 static final int MODE_ALL_CONTACTS = 10 | MODE_MASK_SHOW_PHOTOS;
133 /** Show all contacts with phone numbers, sorted alphabetically */

Same effect. I'll take a look on that Interesting subject

logcat shows:
D/skia ( 669): --- SkImageDecoder::Factory returned null
 
TemporalShadows
Old
#3  
Senior Member
Thanks Meter 12
Posts: 158
Join Date: Feb 2009
Location: Hueytown, AL
Quote:
Originally Posted by xenio2000 View Post

CHANGED BY ME
1653 private boolean mDisplayPhotos = true;
1654 private SparseArray<SoftReference<Bitmap>> mBitmapCache = new SparseArray<SoftReference<Bitmap>>();
...
1658 super(context, R.layout.contacts_list_item_photo, null, false);
So, at line 1654 you created an new instance so that it's not null...
But I'm not sure what 1658 does?
Since it already shows the pics in the Favorites tab, there should be a line that pulls the pic correctly...maybe you can look there for inspiration? I don't have a build environment or I'd probably look at helping with this.
Current: Galaxy S4 [VZW]
Past: Droid RAZR Maxx / Galaxy Nexus / Thunderbolt / Moto Droid / TMo G1
 
1wayjonny
Old
(Last edited by 1wayjonny; 10th November 2009 at 10:01 PM.)
#4  
1wayjonny's Avatar
Senior Member
Thanks Meter 1093
Posts: 454
Join Date: Jan 2007
**EDIT**

I misunderstood the orignal post

1Way
 
rp1783
Old
#5  
rp1783's Avatar
Senior Member
Thanks Meter 11
Posts: 240
Join Date: Jan 2009
Location: Salt Lake City, UT
Quote:
Originally Posted by 1wayjonny View Post
**EDIT**

I misunderstood the orignal post

1Way
They are talking about the main contacts tab in the donut builds. there is no picture displayed, until you select the contact.
 
akirah
Old
#6  
Senior Member
Thanks Meter 4
Posts: 231
Join Date: Aug 2007
Location: Seattle / Warsaw
Quote:
Originally Posted by TemporalShadows View Post
So, at line 1654 you created an new instance so that it's not null...
But I'm not sure what 1658 does?
Since it already shows the pics in the Favorites tab, there should be a line that pulls the pic correctly...maybe you can look there for inspiration? I don't have a build environment or I'd probably look at helping with this.
I'm pretty sure that problem is with database query.
 
xenio2000
Old
#7  
xenio2000's Avatar
Senior Member - OP
Thanks Meter 22
Posts: 256
Join Date: May 2009
Location: Sassari
For those that haven't a build enviroment... you can take a look at the java source here:

http://android.git.kernel.org/?p=pla...980384;hb=HEAD

I hope you can help us.
Thanks,
Xenio
 
xenio2000
Old
#8  
xenio2000's Avatar
Senior Member - OP
Thanks Meter 22
Posts: 256
Join Date: May 2009
Location: Sassari
@Akirah

I think you are right check from lines 187 to 217

Code:
 187     static final String[] CONTACTS_PROJECTION = new String[] {
 188         People._ID, // 0
 189         NAME_COLUMN, // 1
 190         People.NUMBER, // 2
 191         People.TYPE, // 3
 192         People.LABEL, // 4
 193         People.STARRED, // 5
 194         People.PRIMARY_PHONE_ID, // 6
 195         People.PRIMARY_EMAIL_ID, // 7
 196         People.PRESENCE_STATUS, // 8
 197         SORT_STRING, // 9
 198     };

 199     
 200     static final String[] SIMPLE_CONTACTS_PROJECTION = new String[] {
 201         People._ID, // 0
 202         NAME_COLUMN, // 1
 203     };
 204 
 205     static final String[] STREQUENT_PROJECTION = new String[] {
 206         People._ID, // 0
 207         NAME_COLUMN, // 1
 208         People.NUMBER, // 2
 209         People.TYPE, // 3
 210         People.LABEL, // 4
 211         People.STARRED, // 5
 212         People.PRIMARY_PHONE_ID, // 6
 213         People.PRIMARY_EMAIL_ID, // 7
 214         People.PRESENCE_STATUS, // 8
 215         "photo_data", // 9
 216         People.TIMES_CONTACTED, // 10 (not displayed, but required for the order by to work)
 217     };
 
akirah
Old
(Last edited by akirah; 11th November 2009 at 08:41 AM.)
#9  
Senior Member
Thanks Meter 4
Posts: 231
Join Date: Aug 2007
Location: Seattle / Warsaw
Yeah,

I've seen it and tried to modify columns columns order to add photo to it, but not luck.
It compiles, but photo is not retrieved.
 
xenio2000
Old
#10  
xenio2000's Avatar
Senior Member - OP
Thanks Meter 22
Posts: 256
Join Date: May 2009
Location: Sassari
Looks like someone did it before it is included in some modded rom.

I am looking for it now, we have to find it.
Xenio

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Google Chromecast Rootable Once Again!

Over the six months, theGoogle Chromecasthas gained a considerable amount of official functionality. … more

YAATA isn’t Just Another Android Texting App

Although our mobile devices today are capable of executingnearly every task we normally … more

MacroDroid Update Brings Android Wear Automation

A few months ago, we talked about MacroDroid. For those who don’t remember, MacroDroid … more

Droid X Receives KitKat Port, Upcoming Google Glass Firmware Improvements – XDA Developer TV

Android 4.4.3 lands on the European HTC … more