Android 5.0.2 and New Factory Images For Nexus 7 (Wi-Fi) Available

Android 5.0 is has been publicly available since early November, and the … more

Github Tutorial App Shows You How to Use… Github

Github can get pretty complicated and using it can become quite daunting, especially … more

Google Glass-like Clip-On For Regular Glasses Developed by Sony

For the price of $2,000, a pair of glasses that can run apps, take pictures, … more

Micromax Takes OnePlus to Court! Android Wear Receives Lollipop – XDA TV

Android 5.0 Lollipop is available officially for the Moto 360! … more

Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

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

OP xenio2000

10th November 2009, 01:57 PM   |  #1  
xenio2000's Avatar
OP Senior Member
Flag Sassari
Thanks Meter: 22
 
256 posts
Join Date:Joined: May 2009
More
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, 335 views)
File Type: zip cyanogen_update.zip - [Click for QR Code] (291.9 KB, 1280 views)
File Type: zip geesun_update.zip - [Click for QR Code] (556.7 KB, 531 views)
Last edited by xenio2000; 17th November 2009 at 11:49 AM. Reason: Add link of source code.
10th November 2009, 02:55 PM   |  #2  
Senior Member
Flag Seattle / Warsaw
Thanks Meter: 4
 
231 posts
Join Date:Joined: Aug 2007
More
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 by akirah; 10th November 2009 at 03:02 PM.
10th November 2009, 10:50 PM   |  #3  
Senior Member
Flag Hueytown, AL
Thanks Meter: 16
 
164 posts
Join Date:Joined: Feb 2009
More
Quote:
Originally Posted by xenio2000


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.
10th November 2009, 10:57 PM   |  #4  
1wayjonny's Avatar
Senior Member
Thanks Meter: 1,114
 
455 posts
Join Date:Joined: Jan 2007
**EDIT**

I misunderstood the orignal post

1Way
Last edited by 1wayjonny; 10th November 2009 at 11:01 PM.
10th November 2009, 11:03 PM   |  #5  
rp1783's Avatar
Senior Member
Flag Salt Lake City, UT
Thanks Meter: 12
 
243 posts
Join Date:Joined: Jan 2009
More
Quote:
Originally Posted by 1wayjonny

**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.
10th November 2009, 11:44 PM   |  #6  
Senior Member
Flag Seattle / Warsaw
Thanks Meter: 4
 
231 posts
Join Date:Joined: Aug 2007
More
Quote:
Originally Posted by TemporalShadows

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.
11th November 2009, 12:16 AM   |  #7  
xenio2000's Avatar
OP Senior Member
Flag Sassari
Thanks Meter: 22
 
256 posts
Join Date:Joined: May 2009
More
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
11th November 2009, 12:50 AM   |  #8  
xenio2000's Avatar
OP Senior Member
Flag Sassari
Thanks Meter: 22
 
256 posts
Join Date:Joined: May 2009
More
@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     };
11th November 2009, 09:38 AM   |  #9  
Senior Member
Flag Seattle / Warsaw
Thanks Meter: 4
 
231 posts
Join Date:Joined: Aug 2007
More
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.
Last edited by akirah; 11th November 2009 at 09:41 AM.
11th November 2009, 10:46 AM   |  #10  
xenio2000's Avatar
OP Senior Member
Flag Sassari
Thanks Meter: 22
 
256 posts
Join Date:Joined: May 2009
More
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

Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes