Skip to content

Commit cc23f45

Browse files
committed
Did eclipse auto formatting
1 parent 4a67afe commit cc23f45

File tree

1 file changed

+38
-28
lines changed

1 file changed

+38
-28
lines changed

Android/ContactView/ContactView.java

Lines changed: 38 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -37,38 +37,48 @@ public void onActivityResult(int reqCode, int resultCode, Intent data) {
3737
String name = null;
3838
String number = null;
3939
switch (reqCode) {
40-
case (PICK_CONTACT):
41-
if (resultCode == Activity.RESULT_OK) {
42-
Uri contactData = data.getData();
43-
Cursor c = this.ctx.managedQuery(contactData, null, null, null, null);
44-
if (c.moveToFirst()) {
45-
String ContactID = c.getString(c.getColumnIndex(ContactsContract.Contacts._ID));
46-
String hasPhone =c.getString(
47-
c.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER));
48-
49-
if(Integer.parseInt(hasPhone) == 1){
50-
Cursor phoneCursor = this.ctx.managedQuery(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
51-
null,
52-
ContactsContract.CommonDataKinds.Phone.CONTACT_ID+"='"+ContactID+"'",
53-
null, null);
54-
while(phoneCursor.moveToNext()){
55-
number = phoneCursor.getString(phoneCursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
56-
}
57-
}
58-
59-
name = c.getString(c.getColumnIndexOrThrow(ContactsContract.Contacts.DISPLAY_NAME));
60-
JSONObject contactObject = new JSONObject();
61-
try {
62-
contactObject.put("name", name);
63-
contactObject.put("phone", number);
64-
} catch (JSONException e) {
65-
e.printStackTrace();
40+
case (PICK_CONTACT):
41+
if (resultCode == Activity.RESULT_OK) {
42+
Uri contactData = data.getData();
43+
Cursor c = this.ctx.managedQuery(contactData, null, null, null,
44+
null);
45+
if (c.moveToFirst()) {
46+
String ContactID = c.getString(c
47+
.getColumnIndex(ContactsContract.Contacts._ID));
48+
String hasPhone = c
49+
.getString(c
50+
.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER));
51+
52+
if (Integer.parseInt(hasPhone) == 1) {
53+
Cursor phoneCursor = this.ctx
54+
.managedQuery(
55+
ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
56+
null,
57+
ContactsContract.CommonDataKinds.Phone.CONTACT_ID
58+
+ "='" + ContactID + "'", null,
59+
null);
60+
while (phoneCursor.moveToNext()) {
61+
number = phoneCursor
62+
.getString(phoneCursor
63+
.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
6664
}
65+
}
6766

68-
this.success(new PluginResult(PluginResult.Status.OK, contactObject),this.callback);
67+
name = c.getString(c
68+
.getColumnIndexOrThrow(ContactsContract.Contacts.DISPLAY_NAME));
69+
JSONObject contactObject = new JSONObject();
70+
try {
71+
contactObject.put("name", name);
72+
contactObject.put("phone", number);
73+
} catch (JSONException e) {
74+
e.printStackTrace();
6975
}
76+
77+
this.success(new PluginResult(PluginResult.Status.OK,
78+
contactObject), this.callback);
7079
}
71-
break;
7280
}
81+
break;
7382
}
7483
}
84+
}

0 commit comments

Comments
 (0)