Merge photo dialogs into one. Hide "Use this photo" if not necessary
Renamed "icon" consistently to "photo"
Bug:3113345
Bug:2183730
Change-Id: I32cffc31b5ee425e6622db30b5199871e91337e1
diff --git a/res/values/strings.xml b/res/values/strings.xml
index b14a95e..e515002 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -253,8 +253,8 @@
<!-- Description in the dialog that appears if there are no pictures from which to create an icon for a contact -->
<string name="photoPickerNotFoundText">No pictures are available on the phone.</string>
- <!-- Description of the activity used to set a photo in the pictures application as the icon for a contact -->
- <string name="attachToContact">Contact icon</string>
+ <!-- Description of the dialog used to set a photo for a contact [CHAR LIMIT=50] -->
+ <string name="contact_photo_dialog_title">Contact photo</string>
<!-- Title of the dialog used to set a custom label for a contact detail, like a phone number or email address.
For example, this may be used to set a phone number's label to "Vaction house" -->
@@ -266,11 +266,8 @@
<!-- String used to indicate that a contact doesn't have a custom ringtone -->
<string name="default_ringtone">Default</string>
- <!-- The button/menu item that allows you to change an existing contact picture -->
- <string name="changePicture">Change icon</string>
-
- <!-- The menu item that allows you to remove a picture from a contact -->
- <string name="removePicture">Remove icon</string>
+ <!-- The menu item that allows you to remove a photo from a contact [CHAR LIMIT=50] -->
+ <string name="removePhoto">Remove photo</string>
<!-- The text displayed when the contacts list is empty while displaying all contacts -->
<string name="noContacts">No contacts.</string>
@@ -1194,12 +1191,18 @@
<!-- Button displayed underneath the list of filtered visible contacts -->
<string name="search_for_all_contacts">Search for all contacts</string>
- <!-- An option in the 'change photo' or 'pick photo' dialog -->
+ <!-- An option in the 'Contact photo' dialog, if there is no photo yet [CHAR LIMIT=50] -->
<string name="take_photo">Take photo</string>
- <!-- An option in the 'change photo' or 'pick photo' dialog -->
+ <!-- An option in the 'Contact photo' dialog, if there is already a photo [CHAR LIMIT=50] -->
+ <string name="take_new_photo">Take new photo</string>
+
+ <!-- An option in the 'Contact photo' dialog, if there is no photo yet [CHAR LIMIT=50] -->
<string name="pick_photo">Select photo from Gallery</string>
+ <!-- An option in the 'Contact photo' dialog, if there is already a photo [CHAR LIMIT=50] -->
+ <string name="pick_new_photo">Select new photo from Gallery</string>
+
<!-- Text shown in the contacts app while the background process updates contacts after a locale change -->
<string name="locale_change_in_progress">Contact list is being updated to reflect the change of language.\n\nPlease wait...</string>
diff --git a/src/com/android/contacts/views/editor/ContactEditorFragment.java b/src/com/android/contacts/views/editor/ContactEditorFragment.java
index 199c515..6b24f3a 100644
--- a/src/com/android/contacts/views/editor/ContactEditorFragment.java
+++ b/src/com/android/contacts/views/editor/ContactEditorFragment.java
@@ -93,9 +93,8 @@
import java.util.List;
public class ContactEditorFragment extends Fragment implements
- SplitContactConfirmationDialogFragment.Listener, PickPhotoDialogFragment.Listener,
- SelectAccountDialogFragment.Listener, ModifyPhotoDialogFragment.Listener,
- AggregationSuggestionEngine.Listener {
+ SplitContactConfirmationDialogFragment.Listener, PhotoDialogFragment.Listener,
+ SelectAccountDialogFragment.Listener, AggregationSuggestionEngine.Listener {
private static final String TAG = "ContactEditorFragment";
@@ -467,17 +466,31 @@
if (!hasValidState()) return;
if (request == EditorListener.REQUEST_PICK_PHOTO) {
- if (editor.hasSetPhoto()) {
- // There is an existing photo, offer to remove, replace, or promote to
- // primary
- final ModifyPhotoDialogFragment fragment =
- new ModifyPhotoDialogFragment(sourceReadOnly, rawContactId);
- fragment.setTargetFragment(ContactEditorFragment.this, 0);
- fragment.show(getFragmentManager(), ModifyPhotoDialogFragment.TAG);
- } else if (!sourceReadOnly) {
- // No photo set and not read-only, try to set the photo
- doPickPhotoAction(rawContactId);
+ // Determine mode
+ final int mode;
+ if (sourceReadOnly) {
+ if (editor.hasSetPhoto() && hasMoreThanOnePhoto()) {
+ mode = PhotoDialogFragment.MODE_READ_ONLY_ALLOW_PRIMARY;
+ } else {
+ // Read-only and either no photo or the only photo ==> no options
+ return;
+ }
+ } else {
+ if (editor.hasSetPhoto()) {
+ if (hasMoreThanOnePhoto()) {
+ mode = PhotoDialogFragment.MODE_PHOTO_ALLOW_PRIMARY;
+ } else {
+ mode = PhotoDialogFragment.MODE_PHOTO_DISALLOW_PRIMARY;
+ }
+ } else {
+ mode = PhotoDialogFragment.MODE_NO_PHOTO;
+ }
}
+
+ final PhotoDialogFragment fragment = new PhotoDialogFragment();
+ fragment.setArguments(mode, rawContactId);
+ fragment.setTargetFragment(ContactEditorFragment.this, 0);
+ fragment.show(getFragmentManager(), PhotoDialogFragment.TAG);
}
}
@@ -586,20 +599,6 @@
return true;
}
- /**
- * Pick a specific photo to be added under the currently selected tab.
- */
- /* package */ boolean doPickPhotoAction(long rawContactId) {
- if (!hasValidState()) return false;
-
- mRawContactIdRequestingPhoto = rawContactId;
- final PickPhotoDialogFragment dialogFragment = new PickPhotoDialogFragment();
- dialogFragment.setTargetFragment(this, 0);
- dialogFragment.show(getFragmentManager(), PickPhotoDialogFragment.TAG);
-
- return true;
- }
-
private boolean doSplitContactAction() {
if (!hasValidState()) return false;
@@ -1505,8 +1504,24 @@
return null;
}
- public Uri getLookupUri() {
- return mLookupUri;
+ /**
+ * Returns true if there is currently more than one photo on screen.
+ */
+ private boolean hasMoreThanOnePhoto() {
+ int count = mContent.getChildCount();
+ int countWithPicture = 0;
+ for (int i = 0; i < count; i++) {
+ final View childView = mContent.getChildAt(i);
+ if (childView instanceof BaseRawContactEditorView) {
+ final BaseRawContactEditorView editor = (BaseRawContactEditorView) childView;
+ if (editor.hasSetPhoto()) {
+ countWithPicture++;
+ if (countWithPicture > 1) return true;
+ }
+ }
+ }
+
+ return false;
}
/**
@@ -1571,55 +1586,6 @@
}
/**
- * Launches Camera to take a picture and store it in a file.
- */
- @Override
- public void onTakePhotoChosen() {
- try {
- // Launch camera to take photo for selected contact
- PHOTO_DIR.mkdirs();
- mCurrentPhotoFile = new File(PHOTO_DIR, getPhotoFileName());
- final Intent intent = getTakePickIntent(mCurrentPhotoFile);
-
- startActivityForResult(intent, REQUEST_CODE_CAMERA_WITH_DATA);
- } catch (ActivityNotFoundException e) {
- Toast.makeText(mContext, R.string.photoPickerNotFoundText, Toast.LENGTH_LONG).show();
- }
- }
-
- /**
- * Launches Gallery to pick a photo.
- */
- @Override
- public void onPickFromGalleryChosen() {
- try {
- // Launch picker to choose photo for selected contact
- final Intent intent = getPhotoPickIntent();
- startActivityForResult(intent, REQUEST_CODE_PHOTO_PICKED_WITH_DATA);
- } catch (ActivityNotFoundException e) {
- Toast.makeText(mContext, R.string.photoPickerNotFoundText, Toast.LENGTH_LONG).show();
- }
- }
-
- /**
- * Account was chosen in the selector. Create a RawContact for this account now
- */
- @Override
- public void onAccountChosen(Account account, boolean isNewContact) {
- createContact(account, isNewContact);
- }
-
- /**
- * The account selector has been aborted. If we are in "New" mode, we have to close now
- */
- @Override
- public void onAccountSelectorCancelled() {
- if (!hasValidState() && mListener != null) {
- mListener.onAccountSelectorAborted();
- }
- }
-
- /**
* User has chosen to set the selected photo as the (super) primary photo
*/
@Override
@@ -1657,11 +1623,53 @@
}
/**
- * User has chosen to change a picture
+ * Launches Camera to take a picture and store it in a file.
*/
@Override
- public void onChangePictureChosen(long rawContactId) {
- // Pick a new photo for the contact
- doPickPhotoAction(rawContactId);
+ public void onTakePhotoChosen(long rawContactId) {
+ mRawContactIdRequestingPhoto = rawContactId;
+ try {
+ // Launch camera to take photo for selected contact
+ PHOTO_DIR.mkdirs();
+ mCurrentPhotoFile = new File(PHOTO_DIR, getPhotoFileName());
+ final Intent intent = getTakePickIntent(mCurrentPhotoFile);
+
+ startActivityForResult(intent, REQUEST_CODE_CAMERA_WITH_DATA);
+ } catch (ActivityNotFoundException e) {
+ Toast.makeText(mContext, R.string.photoPickerNotFoundText, Toast.LENGTH_LONG).show();
+ }
+ }
+
+ /**
+ * Launches Gallery to pick a photo.
+ */
+ @Override
+ public void onPickFromGalleryChosen(long rawContactId) {
+ mRawContactIdRequestingPhoto = rawContactId;
+ try {
+ // Launch picker to choose photo for selected contact
+ final Intent intent = getPhotoPickIntent();
+ startActivityForResult(intent, REQUEST_CODE_PHOTO_PICKED_WITH_DATA);
+ } catch (ActivityNotFoundException e) {
+ Toast.makeText(mContext, R.string.photoPickerNotFoundText, Toast.LENGTH_LONG).show();
+ }
+ }
+
+ /**
+ * Account was chosen in the selector. Create a RawContact for this account now
+ */
+ @Override
+ public void onAccountChosen(Account account, boolean isNewContact) {
+ createContact(account, isNewContact);
+ }
+
+ /**
+ * The account selector has been aborted. If we are in "New" mode, we have to close now
+ */
+ @Override
+ public void onAccountSelectorCancelled() {
+ if (!hasValidState() && mListener != null) {
+ mListener.onAccountSelectorAborted();
+ }
}
}
diff --git a/src/com/android/contacts/views/editor/ModifyPhotoDialogFragment.java b/src/com/android/contacts/views/editor/ModifyPhotoDialogFragment.java
deleted file mode 100644
index 7c1d713..0000000
--- a/src/com/android/contacts/views/editor/ModifyPhotoDialogFragment.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-package com.android.contacts.views.editor;
-
-import com.android.contacts.R;
-
-import android.app.Activity;
-import android.app.AlertDialog;
-import android.app.Dialog;
-import android.app.DialogFragment;
-import android.app.Fragment;
-import android.content.DialogInterface;
-import android.os.Bundle;
-import android.widget.ArrayAdapter;
-import android.widget.ListAdapter;
-
-/**
- * Shows a dialog asking the user what to do with an existing photo.
- * The result is passed back to the Fragment that is configured by
- * {@link Fragment#setTargetFragment(Fragment, int)}, which
- * has to implement {@link ModifyPhotoDialogFragment.Listener}.
- * Does not perform any action by itself.
- */
-public class ModifyPhotoDialogFragment extends DialogFragment {
- public static final String TAG = "PhotoDialogFragment";
- private static final String BUNDLE_IS_READ_ONLY = "IS_READ_ONLY";
- private static final String BUNDLE_RAW_CONTACT_ID = "RAW_CONTACT_ID";
-
- private boolean mIsReadOnly;
- private long mRawContactId;
-
- public ModifyPhotoDialogFragment() {
- }
-
- public ModifyPhotoDialogFragment(boolean isReadOnly, long rawContactId) {
- mIsReadOnly = isReadOnly;
- mRawContactId = rawContactId;
- }
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- if (savedInstanceState != null) {
- mIsReadOnly = savedInstanceState.getBoolean(BUNDLE_IS_READ_ONLY);
- mRawContactId = savedInstanceState.getLong(BUNDLE_RAW_CONTACT_ID);
- }
- }
-
- @Override
- public void onSaveInstanceState(Bundle outState) {
- super.onSaveInstanceState(outState);
- outState.putBoolean(BUNDLE_IS_READ_ONLY, mIsReadOnly);
- outState.putLong(BUNDLE_RAW_CONTACT_ID, mRawContactId);
- }
-
- @Override
- public Dialog onCreateDialog(Bundle savedInstanceState) {
- // Wrap our context to inflate list items using correct theme
- final Activity context = getActivity();
-
- final String[] choices;
- if (mIsReadOnly) {
- choices = new String[1];
- choices[0] = context.getString(R.string.use_photo_as_primary);
- } else {
- choices = new String[3];
- choices[0] = context.getString(R.string.use_photo_as_primary);
- choices[1] = context.getString(R.string.removePicture);
- choices[2] = context.getString(R.string.changePicture);
- }
- final ListAdapter adapter = new ArrayAdapter<String>(context,
- android.R.layout.select_dialog_item, choices);
-
- final DialogInterface.OnClickListener clickListener =
- new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- dialog.dismiss();
-
- final Listener target = (Listener) getTargetFragment();
- switch (which) {
- case 0:
- target.onUseAsPrimaryChosen(mRawContactId);
- break;
- case 1:
- target.onRemovePictureChose(mRawContactId);
- break;
- case 2:
- target.onChangePictureChosen(mRawContactId);
- break;
- }
- }
- };
-
- final AlertDialog.Builder builder = new AlertDialog.Builder(context);
- builder.setTitle(R.string.attachToContact);
- builder.setSingleChoiceItems(adapter, -1, clickListener);
- return builder.create();
- }
-
- public interface Listener {
- void onUseAsPrimaryChosen(long rawContactId);
- void onRemovePictureChose(long rawContactId);
- void onChangePictureChosen(long rawContactId);
- }
-}
diff --git a/src/com/android/contacts/views/editor/PhotoDialogFragment.java b/src/com/android/contacts/views/editor/PhotoDialogFragment.java
new file mode 100644
index 0000000..634733b
--- /dev/null
+++ b/src/com/android/contacts/views/editor/PhotoDialogFragment.java
@@ -0,0 +1,165 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package com.android.contacts.views.editor;
+
+import com.android.contacts.R;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.app.DialogFragment;
+import android.app.Fragment;
+import android.content.DialogInterface;
+import android.os.Bundle;
+import android.widget.ArrayAdapter;
+import android.widget.ListAdapter;
+
+import java.util.ArrayList;
+
+/**
+ * Shows a dialog asking the user what to do for a photo. The dialog has to be
+ * configured by {@link #setArguments(int, long)}.
+ * The result is passed back to the Fragment that is configured by
+ * {@link Fragment#setTargetFragment(Fragment, int)}, which
+ * has to implement {@link PhotoDialogFragment.Listener}.
+ * Does not perform any action by itself.
+ */
+public class PhotoDialogFragment extends DialogFragment {
+ public static final String TAG = "PhotoDialogFragment";
+ private static final String BUNDLE_MODE = "MODE";
+ private static final String BUNDLE_RAW_CONTACT_ID = "RAW_CONTACT_ID";
+
+ public static final int MODE_NO_PHOTO = 0;
+ public static final int MODE_READ_ONLY_ALLOW_PRIMARY = 1;
+ public static final int MODE_PHOTO_DISALLOW_PRIMARY = 2;
+ public static final int MODE_PHOTO_ALLOW_PRIMARY = 3;
+
+ public PhotoDialogFragment() {
+ }
+
+ public void setArguments(int mode, long rawContactId) {
+ final Bundle bundle = new Bundle();
+ bundle.putInt(BUNDLE_MODE, mode);
+ bundle.putLong(BUNDLE_RAW_CONTACT_ID, rawContactId);
+ setArguments(bundle);
+ }
+
+ private int getMode() {
+ return getArguments().getInt(BUNDLE_MODE);
+ }
+
+ private long getRawContactId() {
+ return getArguments().getLong(BUNDLE_RAW_CONTACT_ID);
+ }
+
+ @Override
+ public Dialog onCreateDialog(Bundle savedInstanceState) {
+ // Wrap our context to inflate list items using correct theme
+ final Activity context = getActivity();
+
+ int mode = getMode();
+ // Build choices, depending on the current mode. We assume this Dialog is never called
+ // if there are NO choices (e.g. a read-only picture is already super-primary)
+ final ArrayList<ChoiceListItem> choices =
+ new ArrayList<PhotoDialogFragment.ChoiceListItem>(4);
+ // Use as Primary
+ if (mode == MODE_PHOTO_ALLOW_PRIMARY || mode == MODE_READ_ONLY_ALLOW_PRIMARY) {
+ choices.add(new ChoiceListItem(ChoiceListItem.ID_USE_AS_PRIMARY,
+ context.getString(R.string.use_photo_as_primary)));
+ }
+ // Remove
+ if (mode == MODE_PHOTO_DISALLOW_PRIMARY || mode == MODE_PHOTO_ALLOW_PRIMARY) {
+ choices.add(new ChoiceListItem(ChoiceListItem.ID_REMOVE,
+ context.getString(R.string.removePhoto)));
+ }
+ // Take photo (if there is already a photo, it says "Take new photo")
+ if (mode == MODE_NO_PHOTO || mode == MODE_PHOTO_ALLOW_PRIMARY
+ || mode == MODE_PHOTO_DISALLOW_PRIMARY) {
+ final int resId = mode == MODE_NO_PHOTO ? R.string.take_photo :R.string.take_new_photo;
+ choices.add(new ChoiceListItem(ChoiceListItem.ID_TAKE_PHOTO, context.getString(resId)));
+ }
+ // Select from Gallery (or "Select new from Gallery")
+ if (mode == MODE_NO_PHOTO || mode == MODE_PHOTO_ALLOW_PRIMARY
+ || mode == MODE_PHOTO_DISALLOW_PRIMARY) {
+ final int resId = mode == MODE_NO_PHOTO ? R.string.pick_photo :R.string.pick_new_photo;
+ choices.add(new ChoiceListItem(ChoiceListItem.ID_PICK_PHOTO, context.getString(resId)));
+ }
+ final ListAdapter adapter = new ArrayAdapter<ChoiceListItem>(context,
+ android.R.layout.select_dialog_item, choices);
+
+ final DialogInterface.OnClickListener clickListener =
+ new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ dialog.dismiss();
+ final ChoiceListItem choice = choices.get(which);
+
+ final Listener target = (Listener) getTargetFragment();
+ switch (choice.getId()) {
+ case ChoiceListItem.ID_USE_AS_PRIMARY:
+ target.onUseAsPrimaryChosen(getRawContactId());
+ break;
+ case ChoiceListItem.ID_REMOVE:
+ target.onRemovePictureChose(getRawContactId());
+ break;
+ case ChoiceListItem.ID_TAKE_PHOTO:
+ target.onTakePhotoChosen(getRawContactId());
+ break;
+ case ChoiceListItem.ID_PICK_PHOTO:
+ target.onPickFromGalleryChosen(getRawContactId());
+ break;
+ }
+ }
+ };
+
+ final AlertDialog.Builder builder = new AlertDialog.Builder(context);
+ builder.setTitle(R.string.contact_photo_dialog_title);
+ builder.setSingleChoiceItems(adapter, -1, clickListener);
+ return builder.create();
+ }
+
+ private static final class ChoiceListItem {
+ private final int mId;
+ private final String mCaption;
+
+ public static final int ID_USE_AS_PRIMARY = 0;
+ public static final int ID_TAKE_PHOTO = 1;
+ public static final int ID_PICK_PHOTO = 2;
+ public static final int ID_REMOVE = 3;
+
+ public ChoiceListItem(int id, String caption) {
+ mId = id;
+ mCaption = caption;
+ }
+
+ @Override
+ public String toString() {
+ return mCaption;
+ }
+
+ public int getId() {
+ return mId;
+ }
+ }
+
+ public interface Listener {
+ void onUseAsPrimaryChosen(long rawContactId);
+ void onRemovePictureChose(long rawContactId);
+ void onTakePhotoChosen(long rawContactId);
+ void onPickFromGalleryChosen(long rawContactId);
+ }
+}
diff --git a/src/com/android/contacts/views/editor/PickPhotoDialogFragment.java b/src/com/android/contacts/views/editor/PickPhotoDialogFragment.java
deleted file mode 100644
index 5f3dfd1..0000000
--- a/src/com/android/contacts/views/editor/PickPhotoDialogFragment.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-package com.android.contacts.views.editor;
-
-import com.android.contacts.R;
-
-import android.app.AlertDialog;
-import android.app.Dialog;
-import android.app.DialogFragment;
-import android.app.Fragment;
-import android.content.DialogInterface;
-import android.os.Bundle;
-import android.widget.ArrayAdapter;
-import android.widget.ListAdapter;
-
-/**
- * Shows a dialog asking the user whether to take a photo or pick a photo from the gallery.
- * The result is passed back to the Fragment that is configured by
- * {@link Fragment#setTargetFragment(Fragment, int)}, which
- * has to implement {@link PickPhotoDialogFragment.Listener}.
- * Does not perform any action by itself.
- */
-public class PickPhotoDialogFragment extends DialogFragment {
- public static final String TAG = "PickPhotoDialogFragment";
-
- public PickPhotoDialogFragment() {
- }
-
- @Override
- public Dialog onCreateDialog(Bundle savedInstanceState) {
- String[] choices = new String[2];
- choices[0] = getActivity().getString(R.string.take_photo);
- choices[1] = getActivity().getString(R.string.pick_photo);
- final ListAdapter adapter = new ArrayAdapter<String>(getActivity(),
- android.R.layout.select_dialog_item, choices);
-
- final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
- builder.setTitle(R.string.attachToContact);
- builder.setSingleChoiceItems(adapter, -1, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- dialog.dismiss();
- final Listener targetListener = (Listener) getTargetFragment();
- switch(which) {
- case 0:
- targetListener.onTakePhotoChosen();
- break;
- case 1:
- targetListener.onPickFromGalleryChosen();
- break;
- }
- }
- });
- return builder.create();
- }
-
- public interface Listener {
- void onTakePhotoChosen();
- void onPickFromGalleryChosen();
- }
-}