Fix contact loop on HTC and photo crash on 1.5
This commit is contained in:
parent
dd4b10f12d
commit
fa68b1911c
4 changed files with 21 additions and 19 deletions
|
@ -86,12 +86,12 @@
|
|||
<action android:name="android.intent.action.MAIN" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name="ContactPickerActivityNew">
|
||||
<activity android:name="ContactPickerActivityNew" android:launchMode="singleTop">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name="ContactPickerActivityOld">
|
||||
<activity android:name="ContactPickerActivityOld" android:launchMode="singleTop">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
</intent-filter>
|
||||
|
|
|
@ -21,8 +21,6 @@ package org.linphone;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.linphone.mediastream.Version;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
|
@ -77,6 +75,8 @@ public abstract class AbstractContactPickerActivity extends Activity implements
|
|||
setContentView(R.layout.contact_picker);
|
||||
createCustomPicker();
|
||||
}
|
||||
|
||||
onNewIntent(getIntent());
|
||||
}
|
||||
|
||||
|
||||
|
@ -135,6 +135,7 @@ public abstract class AbstractContactPickerActivity extends Activity implements
|
|||
builder.setTitle(String.format(getString(R.string.title_numbers_dialog),contactName));
|
||||
builder.setAdapter(pAdapter, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.dismiss();
|
||||
returnSelectedValues(pAdapter.getItem(which), contactName.toString(),getPhotoUri(id));
|
||||
}
|
||||
});
|
||||
|
@ -144,8 +145,7 @@ public abstract class AbstractContactPickerActivity extends Activity implements
|
|||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
AlertDialog dialog = builder.create();
|
||||
dialog.show();
|
||||
builder.create().show();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ import android.content.ContentUris;
|
|||
import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.provider.ContactsContract;
|
||||
import android.provider.ContactsContract.Contacts;
|
||||
import android.text.TextUtils;
|
||||
|
@ -131,15 +132,17 @@ public class ContactPickerActivityNew extends AbstractContactPickerActivity {
|
|||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
// Launch the native contact picker here in spite of onResume
|
||||
// in order to avoid a loop that sometime occurs on HTC phones.
|
||||
if (useNativePicker) {
|
||||
Uri uri = ContactsContract.Contacts.CONTENT_URI;
|
||||
//ContactsContract.CommonDataKinds.Phone.CONTENT_URI
|
||||
startActivityForResult(new Intent(Intent.ACTION_PICK, uri), 0);
|
||||
}
|
||||
super.onNewIntent(intent);
|
||||
}
|
||||
|
||||
protected void onActivityResult(int reqCode, int resultCode, Intent intent) {
|
||||
|
|
|
@ -32,22 +32,21 @@ public class ContactPickerActivityOld extends Activity {
|
|||
static final int PICK_CONTACT_REQUEST = 0;
|
||||
static final int PICK_PHONE_NUMBER_REQUEST = 1;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
onNewIntent(getIntent());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
startActivityForResult(new Intent(Intent.ACTION_PICK, Contacts.Phones.CONTENT_URI)
|
||||
,
|
||||
PICK_CONTACT_REQUEST);
|
||||
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
// Launch the native contact picker here in spite of onResume
|
||||
// in order to avoid a loop that sometime occurs on HTC phones.
|
||||
Uri uri = Contacts.Phones.CONTENT_URI;
|
||||
startActivityForResult(new Intent(Intent.ACTION_PICK,uri), PICK_CONTACT_REQUEST);
|
||||
super.onNewIntent(intent);
|
||||
}
|
||||
|
||||
|
||||
protected void onActivityResult(int requestCode, int resultCode,
|
||||
Intent data) {
|
||||
if (requestCode == PICK_CONTACT_REQUEST) {
|
||||
|
@ -66,7 +65,7 @@ public class ContactPickerActivityOld extends Activity {
|
|||
long id = lCur.getLong(lCur.getColumnIndex(People._ID));
|
||||
Uri personUri = ContentUris.withAppendedId(People.CONTENT_URI, id);
|
||||
Uri pictureUri = Uri.withAppendedPath(personUri, Contacts.Photos.CONTENT_DIRECTORY);
|
||||
if (!ContactHelper.testPhotoUri(getContentResolver(), pictureUri, Contacts.Photos.CONTENT_DIRECTORY)) {
|
||||
if (!ContactHelper.testPhotoUri(getContentResolver(), pictureUri, android.provider.Contacts.Photos.DATA)) {
|
||||
pictureUri = null;
|
||||
}
|
||||
// FIXME surprisingly all this picture stuff doesn't seem to work
|
||||
|
|
Loading…
Reference in a new issue