diff --git a/app/src/main/java/com/vansuita/pickimage/sample/act/BaseSampleActivity.java b/app/src/main/java/com/vansuita/pickimage/sample/act/BaseSampleActivity.java
index 44fbc7b..2037e8d 100644
--- a/app/src/main/java/com/vansuita/pickimage/sample/act/BaseSampleActivity.java
+++ b/app/src/main/java/com/vansuita/pickimage/sample/act/BaseSampleActivity.java
@@ -166,7 +166,7 @@ protected void customize(PickSetup setup) {
setup.setSystemDialog(getBool(R.string.key_system_dialog));
//setup.setWidth(800).setHeight(700);
-
+ //setup.setVideo(true);
if (getBool(R.string.key_colored_icons)) {
setup.setGalleryIcon(R.mipmap.gallery_colored);
diff --git a/library/src/main/java/com/vansuita/pickimage/bundle/PickSetup.java b/library/src/main/java/com/vansuita/pickimage/bundle/PickSetup.java
index 1291d12..ffcb3d1 100644
--- a/library/src/main/java/com/vansuita/pickimage/bundle/PickSetup.java
+++ b/library/src/main/java/com/vansuita/pickimage/bundle/PickSetup.java
@@ -50,6 +50,8 @@ public class PickSetup implements Serializable {
private boolean systemDialog;
+ private boolean video;
+
private boolean isCameraToPictures;
@OrientationMode
@@ -281,6 +283,14 @@ public PickSetup setIconGravityInt(int iconGravity) {
return this;
}
+ public boolean isVideo() {
+ return video;
+ }
+
+ public PickSetup setVideo(boolean video){
+ this.video = video;
+ return this;
+ }
public PickSetup() {
setTitle("Choose")
@@ -298,7 +308,8 @@ public PickSetup() {
.setCameraIcon(R.drawable.camera)
.setSystemDialog(false)
.setCameraToPictures(true)
- .setGalleryIcon(R.drawable.gallery);
+ .setGalleryIcon(R.drawable.gallery)
+ .setVideo(false);
}
}
diff --git a/library/src/main/java/com/vansuita/pickimage/dialog/PickImageBaseDialog.java b/library/src/main/java/com/vansuita/pickimage/dialog/PickImageBaseDialog.java
index 00d37e8..67406fb 100644
--- a/library/src/main/java/com/vansuita/pickimage/dialog/PickImageBaseDialog.java
+++ b/library/src/main/java/com/vansuita/pickimage/dialog/PickImageBaseDialog.java
@@ -57,9 +57,9 @@ public abstract class PickImageBaseDialog extends DialogFragment implements IPic
private Boolean validProviders = null;
- private IPickResult onPickResult;
- private IPickClick onClick;
- private IPickCancel onPickCancel;
+ private IPickResult onPickResult;
+ private IPickClick onClick;
+ private IPickCancel onPickCancel;
@Nullable
@@ -158,9 +158,8 @@ private void onBindViewListeners() {
private View.OnClickListener listener = new View.OnClickListener() {
@Override
- public void onClick(View view)
- {
- if (view.getId() == R.id.cancel) {
+ public void onClick(View view) {
+ if (view.getId() == R.id.cancel) {
onPickCancel.onCancelClick();
dismiss();
} else {
@@ -269,11 +268,10 @@ protected PickImageBaseDialog setOnClick(IPickClick onClick) {
}
- protected PickImageBaseDialog setOnPickCancel(IPickCancel onPickCancel)
- {
- this.onPickCancel = onPickCancel;
- return this;
- }
+ protected PickImageBaseDialog setOnPickCancel(IPickCancel onPickCancel) {
+ this.onPickCancel = onPickCancel;
+ return this;
+ }
protected AsyncImageResult getAsyncResult() {
diff --git a/library/src/main/java/com/vansuita/pickimage/resolver/IntentResolver.java b/library/src/main/java/com/vansuita/pickimage/resolver/IntentResolver.java
index 87a088d..0de6e4b 100644
--- a/library/src/main/java/com/vansuita/pickimage/resolver/IntentResolver.java
+++ b/library/src/main/java/com/vansuita/pickimage/resolver/IntentResolver.java
@@ -70,7 +70,11 @@ public boolean isCamerasAvailable() {
private Intent getCameraIntent() {
if (cameraIntent == null) {
- cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
+ if (setup.isVideo()) {
+ cameraIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
+ } else {
+ cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
+ }
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, cameraUriForProvider());
applyProviderPermission();
@@ -149,7 +153,11 @@ private Uri cameraUriForProvider() {
private Intent getGalleryIntent() {
if (galleryIntent == null) {
galleryIntent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
- galleryIntent.setType(activity.getString(R.string.image_content_type));
+ if (setup.isVideo()) {
+ galleryIntent.setType(activity.getString(R.string.video_content_type));
+ } else {
+ galleryIntent.setType(activity.getString(R.string.image_content_type));
+ }
}
return galleryIntent;
diff --git a/library/src/main/res/values/consts.xml b/library/src/main/res/values/consts.xml
index 2f43f68..d109db5 100644
--- a/library/src/main/res/values/consts.xml
+++ b/library/src/main/res/values/consts.xml
@@ -3,4 +3,5 @@
.com.vansuita.pickimage.provider
current
image/*
+ video/*
\ No newline at end of file