aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/utils
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel.gultsch@rwth-aachen.de>2014-04-05 21:06:10 +0200
committerDaniel Gultsch <daniel.gultsch@rwth-aachen.de>2014-04-06 15:28:19 +0200
commit9fc7a1b980863955a139193ded0fef5edfbad296 (patch)
tree0784b7afce2872633acd7890c1d4f97f189e7741 /src/eu/siacs/conversations/utils
parent77491039097734ce746b5b46791464bd236d4703 (diff)
added button to open images
Diffstat (limited to 'src/eu/siacs/conversations/utils')
-rw-r--r--src/eu/siacs/conversations/utils/PhoneHelper.java23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/eu/siacs/conversations/utils/PhoneHelper.java b/src/eu/siacs/conversations/utils/PhoneHelper.java
index 5c652afe..dd3e0e19 100644
--- a/src/eu/siacs/conversations/utils/PhoneHelper.java
+++ b/src/eu/siacs/conversations/utils/PhoneHelper.java
@@ -13,18 +13,19 @@ import android.os.Bundle;
import android.os.Looper;
import android.provider.ContactsContract;
import android.provider.ContactsContract.Profile;
+import android.provider.MediaStore;
public class PhoneHelper {
-
- public static void loadPhoneContacts(Context context, final OnPhoneContactsLoadedListener listener) {
- if (Looper.myLooper()==null) {
+
+ public static void loadPhoneContacts(Context context,
+ final OnPhoneContactsLoadedListener listener) {
+ if (Looper.myLooper() == null) {
Looper.prepare();
}
final Looper mLooper = Looper.myLooper();
final Hashtable<String, Bundle> phoneContacts = new Hashtable<String, Bundle>();
-
- final String[] PROJECTION = new String[] {
- ContactsContract.Data._ID,
+
+ final String[] PROJECTION = new String[] { ContactsContract.Data._ID,
ContactsContract.Data.DISPLAY_NAME,
ContactsContract.Data.PHOTO_THUMBNAIL_URI,
ContactsContract.Data.LOOKUP_KEY,
@@ -35,7 +36,7 @@ public class PhoneHelper {
+ "\") AND (" + ContactsContract.CommonDataKinds.Im.PROTOCOL
+ "=\"" + ContactsContract.CommonDataKinds.Im.PROTOCOL_JABBER
+ "\")";
-
+
CursorLoader mCursorLoader = new CursorLoader(context,
ContactsContract.Data.CONTENT_URI, PROJECTION, SELECTION, null,
null);
@@ -55,14 +56,14 @@ public class PhoneHelper {
"photouri",
cursor.getString(cursor
.getColumnIndex(ContactsContract.Data.PHOTO_THUMBNAIL_URI)));
- contact.putString("lookup",cursor.getString(cursor
+ contact.putString("lookup", cursor.getString(cursor
.getColumnIndex(ContactsContract.Data.LOOKUP_KEY)));
phoneContacts.put(
cursor.getString(cursor
.getColumnIndex(ContactsContract.CommonDataKinds.Im.DATA)),
contact);
}
- if (listener!=null) {
+ if (listener != null) {
listener.onPhoneContactsLoaded(phoneContacts);
}
mLooper.quit();
@@ -77,12 +78,12 @@ public class PhoneHelper {
Cursor mProfileCursor = activity.getContentResolver().query(
Profile.CONTENT_URI, mProjection, null, null, null);
- if (mProfileCursor.getCount()==0) {
+ if (mProfileCursor.getCount() == 0) {
return null;
} else {
mProfileCursor.moveToFirst();
String uri = mProfileCursor.getString(1);
- if (uri==null) {
+ if (uri == null) {
return null;
} else {
return Uri.parse(uri);