Skip to content
This repository was archived by the owner on May 3, 2023. It is now read-only.

Repeat click to fix the problem #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import android.database.Cursor;
import android.net.Uri;
import android.provider.ContactsContract;
import android.util.Log;

import java.util.HashMap;

Expand Down Expand Up @@ -41,14 +42,13 @@ private ContactPickerPlugin(Activity activity) {
@Override
public void onMethodCall(MethodCall call, Result result) {
if (call.method.equals("selectContact")) {
if (pendingResult != null) {
pendingResult.error("multiple_requests", "Cancelled by a second request.", null);
pendingResult = null;
if (pendingResult == null) {
pendingResult = result;
Intent i = new Intent(Intent.ACTION_PICK, ContactsContract.CommonDataKinds.Phone.CONTENT_URI);
activity.startActivityForResult(i, PICK_CONTACT);
} else {
Log.v("ContactPickerPlugin", "Multiple requests may have been made");
}
pendingResult = result;

Intent i = new Intent(Intent.ACTION_PICK, ContactsContract.CommonDataKinds.Phone.CONTENT_URI);
activity.startActivityForResult(i, PICK_CONTACT);
} else {
result.notImplemented();
}
Expand Down