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

Search This thread

xenio2000

Senior Member
May 23, 2009
257
24
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)

zw0n4h.jpg



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=pl...70d24e7686305a7570d1300e738744e980384;hb=HEAD

Any help?
Xenio
 

Attachments

  • geesun_contacts_apk_patch.txt
    1.7 KB · Views: 357
  • cyanogen_update.zip
    291.9 KB · Views: 1,312
  • geesun_update.zip
    556.7 KB · Views: 552
Last edited:

akirah

Senior Member
Aug 27, 2007
231
4
Seattle / Warsaw
www.unixninja.eu
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
 
Last edited:

TemporalShadows

Senior Member
Feb 5, 2009
165
16
Hueytown, AL
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.
 

akirah

Senior Member
Aug 27, 2007
231
4
Seattle / Warsaw
www.unixninja.eu
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

Senior Member
May 23, 2009
257
24
@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
[B] 215         "photo_data", // 9[/B]
 216         People.TIMES_CONTACTED, // 10 (not displayed, but required for the order by to work)
 217     };
 

xenio2000

Senior Member
May 23, 2009
257
24
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
 

xenio2000

Senior Member
May 23, 2009
257
24
Yes it works... now we have to found how it was done and close the thread.

I'll check the cyanogen github.
 

bpmtri

Member
Aug 9, 2007
8
0
Yes it works... now we have to found how it was done and close the thread.

I'll check the cyanogen github.

I have just take a look at the ContactsListActivity.java source:

You should pay attention here:

Code:
static final String[] CONTACTS_PROJECTION = new String[] {
        People._ID, // 0
        NAME_COLUMN, // 1
        People.NUMBER, // 2
        People.TYPE, // 3
        People.LABEL, // 4
        People.STARRED, // 5
        People.PRIMARY_PHONE_ID, // 6
        People.PRIMARY_EMAIL_ID, // 7
        People.PRESENCE_STATUS, // 8
        SORT_STRING, // 9
    };

and

Code:
static final String[] STREQUENT_PROJECTION = new String[] {
        People._ID, // 0
        NAME_COLUMN, // 1
        People.NUMBER, // 2
        People.TYPE, // 3
        People.LABEL, // 4
        People.STARRED, // 5
        People.PRIMARY_PHONE_ID, // 6
        People.PRIMARY_EMAIL_ID, // 7
        People.PRESENCE_STATUS, // 8
        "photo_data", // 9
        People.TIMES_CONTACTED, // 10 (not displayed, but required for the order by to work)
    };

The second one has the "photo_data" column ;). Please try yourself because I cannot build the Contacts app now.
 

bpmtri

Member
Aug 9, 2007
8
0
I've tried to add new column, and to move columns. Doesn't work.
Standard cyanogen one doesn't seem to have photos at least from what I see in sourcecode, changes are done to BT contact send.

Hi akirah,

Please make sure you have:

Code:
static final int MODE_ALL_CONTACTS = 10 | MODE_MASK_SHOW_PHOTOS;

to show the default picture, and

Code:
static final String[] CONTACTS_PROJECTION = new String[] {
        People._ID, // 0
        NAME_COLUMN, // 1
        People.NUMBER, // 2
        People.TYPE, // 3
        People.LABEL, // 4
        People.STARRED, // 5
        People.PRIMARY_PHONE_ID, // 6
        People.PRIMARY_EMAIL_ID, // 7
        People.PRESENCE_STATUS, // 8
        "photo_data", // 9
        SORT_STRING, // 10
    };

to have "Photo data". "photo_data" column must have index = 9.

I just try to read the source code and suggest you. Hope this help you to make it work.
 

xenio2000

Senior Member
May 23, 2009
257
24
Yep last Cyanogen Mod from github does not have Photos I misunderstood the x140d4n post

Ok the Contacts.apk posted from x140d4n works and it came from here a Chinese site...thanks for it.

http://www.kugou.me/

You can translate with google...

Looks like the mod with the picture is added by geesun (I think) to the Cyanogen Mod and this is the mod cm 4.2.3.1-geesunmod, if you download it and extract the Contacts.apk it works very well a little slow the first time but it is nice.

I did'n found this tweak here in XDA, another site that x140d4n give to me is http://www.androidin.net

I did't found any source... just the zip with the apk...
Xenio

REMOVE THE .ZIP EXTENSION
 

Attachments

  • Contacts.apk.zip
    581 KB · Views: 105
Last edited:

johnnylicious

Senior Member
Nov 9, 2008
1,464
6
Yep last Cyanogen Mod from github does not have Photos I misunderstood the x140d4n post

Ok the Contacts.apk posted from x140d4n works and it came from here a Chinese site...thanks for it.

http://www.kugou.me/

You can translate with google...

Looks like the mod with the picture is added by geesun (I think) to the Cyanogen Mod and this is the mod cm 4.2.3.1-geesunmod, if you download it and extract the Contacts.apk it works very well a little slow the first time but it is nice.

I did'n found this tweak here in XDA, another site that x140d4n give to me is http://www.androidin.net

I did't found any source... just the zip with the apk...
Xenio

REMOVE THE .ZIP EXTENSION

i installed it but it didnt work force close on contacts i delete original Contacts.apk and dalvik-cache and rebooted

any ideas? im tryin to get original one and still having issues lol