From 15f5a43c98c2b94d5f12ae187f80970980ff85a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E4=BB=BB=E5=BD=A6?= Date: Mon, 25 Jun 2018 14:28:07 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E5=A2=9E=E5=8A=A0=E6=8B=8D=E7=85=A7?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E3=80=822=E3=80=81=E4=BD=BF=E7=94=A8Builder?= =?UTF-8?q?=E7=9A=84=E6=96=B9=E5=BC=8F=E8=B0=83=E7=94=A8=E7=9B=B8=E5=86=8C?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/AndroidManifest.xml | 14 ++ .../imageselectdemo/MainActivity.java | 33 +++- app/src/main/res/xml/file_paths.xml | 8 + .../imageselector/ClipImageActivity.java | 17 +- .../imageselector/ImageSelectorActivity.java | 162 ++++++++++++++---- .../imageselector/PreviewActivity.java | 20 +-- .../imageselector/adapter/ImageAdapter.java | 138 +++++++++++---- .../adapter/ImagePagerAdapter.java | 35 ++-- .../imageselector/constant/Constants.java | 20 --- .../imageselector/entry/Folder.java | 9 + .../imageselector/entry/Image.java | 20 ++- .../imageselector/model/ImageModel.java | 11 +- .../imageselector/utils/ImageSelector.java | 118 +++++++++++++ .../utils/ImageSelectorUtils.java | 7 +- .../imageselector/view/SquareImageView.java | 4 +- .../src/main/res/drawable-xhdpi/ic_gif.png | Bin 0 -> 993 bytes .../res/drawable-xhdpi/ic_photo_camera.png | Bin 0 -> 894 bytes .../src/main/res/layout/adapter_camera.xml | 17 ++ .../main/res/layout/adapter_images_item.xml | 13 +- 19 files changed, 511 insertions(+), 135 deletions(-) create mode 100644 app/src/main/res/xml/file_paths.xml delete mode 100644 imageselector/src/main/java/com/donkingliang/imageselector/constant/Constants.java create mode 100644 imageselector/src/main/java/com/donkingliang/imageselector/utils/ImageSelector.java create mode 100644 imageselector/src/main/res/drawable-xhdpi/ic_gif.png create mode 100644 imageselector/src/main/res/drawable-xhdpi/ic_photo_camera.png create mode 100644 imageselector/src/main/res/layout/adapter_camera.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index ce188dd..08f2232 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -2,7 +2,9 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/donkingliang/imageselectdemo/MainActivity.java b/app/src/main/java/com/donkingliang/imageselectdemo/MainActivity.java index 92a69c0..bad85b2 100644 --- a/app/src/main/java/com/donkingliang/imageselectdemo/MainActivity.java +++ b/app/src/main/java/com/donkingliang/imageselectdemo/MainActivity.java @@ -5,9 +5,11 @@ import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.RecyclerView; +import android.util.Log; import android.view.View; import com.donkingliang.imageselectdemo.adapter.ImageAdapter; +import com.donkingliang.imageselector.utils.ImageSelector; import com.donkingliang.imageselector.utils.ImageSelectorUtils; import java.util.ArrayList; @@ -39,7 +41,7 @@ protected void onCreate(Bundle savedInstanceState) { protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == REQUEST_CODE && data != null) { - ArrayList images = data.getStringArrayListExtra(ImageSelectorUtils.SELECT_RESULT); + ArrayList images = data.getStringArrayListExtra(ImageSelector.SELECT_RESULT); mAdapter.refresh(images); } } @@ -49,27 +51,48 @@ public void onClick(View v) { switch (v.getId()) { case R.id.btn_single: //单选 - ImageSelectorUtils.openPhoto(MainActivity.this, REQUEST_CODE, true, 0); +// ImageSelectorUtils.openPhoto(MainActivity.this, REQUEST_CODE, true, 0); + ImageSelector.builder() + .useCamera(true) // 设置是否使用拍照 + .setSingle(true) //设置是否单选 + .start(this, REQUEST_CODE); // 打开相册 break; case R.id.btn_limit: //多选(最多9张) - ImageSelectorUtils.openPhoto(MainActivity.this, REQUEST_CODE, false, 9); +// ImageSelectorUtils.openPhoto(MainActivity.this, REQUEST_CODE, false, 9); +// ImageSelector.builder().setSingle(true).start(this,REQUEST_CODE); // ImageSelectorUtils.openPhoto(MainActivity.this, REQUEST_CODE, false, 9, mAdapter.getImages()); // 把已选的传入。 + ImageSelector.builder() + .useCamera(true) // 设置是否使用拍照 + .setSingle(false) //设置是否单选 + .setMaxSelectCount(9) // 图片的最大选择数量,小于等于0时,不限数量。 + .start(this, REQUEST_CODE); // 打开相册 break; case R.id.btn_unlimited: //多选(不限数量) - ImageSelectorUtils.openPhoto(MainActivity.this, REQUEST_CODE); +// ImageSelectorUtils.openPhoto(MainActivity.this, REQUEST_CODE); // ImageSelectorUtils.openPhoto(MainActivity.this, REQUEST_CODE, mAdapter.getImages()); // 把已选的传入。 //或者 // ImageSelectorUtils.openPhoto(MainActivity.this, REQUEST_CODE, false, 0); // ImageSelectorUtils.openPhoto(MainActivity.this, REQUEST_CODE, false, 0, mAdapter.getImages()); // 把已选的传入。 + + ImageSelector.builder() + .useCamera(true) // 设置是否使用拍照 + .setSingle(false) //设置是否单选 + .setMaxSelectCount(0) // 图片的最大选择数量,小于等于0时,不限数量。 + .start(this, REQUEST_CODE); // 打开相册 break; case R.id.btn_clip: //单选并剪裁 - ImageSelectorUtils.openPhotoAndClip(MainActivity.this, REQUEST_CODE); +// ImageSelectorUtils.openPhotoAndClip(MainActivity.this, REQUEST_CODE); + ImageSelector.builder() + .useCamera(true) // 设置是否使用拍照 + .setCrop(true) // 设置是否使用图片剪切功能。 + .setSingle(true) //设置是否单选 + .start(this, REQUEST_CODE); // 打开相册 break; } } diff --git a/app/src/main/res/xml/file_paths.xml b/app/src/main/res/xml/file_paths.xml new file mode 100644 index 0000000..054c006 --- /dev/null +++ b/app/src/main/res/xml/file_paths.xml @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/imageselector/src/main/java/com/donkingliang/imageselector/ClipImageActivity.java b/imageselector/src/main/java/com/donkingliang/imageselector/ClipImageActivity.java index 683fb48..709da3d 100644 --- a/imageselector/src/main/java/com/donkingliang/imageselector/ClipImageActivity.java +++ b/imageselector/src/main/java/com/donkingliang/imageselector/ClipImageActivity.java @@ -12,7 +12,7 @@ import android.view.WindowManager; import android.widget.FrameLayout; -import com.donkingliang.imageselector.utils.ImageSelectorUtils; +import com.donkingliang.imageselector.utils.ImageSelector; import com.donkingliang.imageselector.utils.ImageUtil; import com.donkingliang.imageselector.utils.StringUtils; import com.donkingliang.imageselector.view.ClipImageView; @@ -33,10 +33,13 @@ protected void onCreate(Bundle savedInstanceState) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); setContentView(R.layout.activity_clip_image); - mRequestCode = getIntent().getIntExtra("requestCode", 0); + Intent intent = getIntent(); + mRequestCode = intent.getIntExtra("requestCode", 0); setStatusBarColor(); - ImageSelectorUtils.openPhoto(this, mRequestCode, true, 0); + ImageSelectorActivity.openActivity(this, mRequestCode, true, + intent.getBooleanExtra(ImageSelector.USE_CAMERA, true), 0, + intent.getStringArrayListExtra(ImageSelector.SELECTED)); initView(); } @@ -78,7 +81,7 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (data != null && requestCode == mRequestCode) { - ArrayList images = data.getStringArrayListExtra(ImageSelectorUtils.SELECT_RESULT); + ArrayList images = data.getStringArrayListExtra(ImageSelector.SELECT_RESULT); Bitmap bitmap = ImageUtil.decodeSampledBitmapFromFile(images.get(0), 720, 1080); if (bitmap != null) { imageView.setBitmapData(bitmap); @@ -102,15 +105,17 @@ private void confirm(Bitmap bitmap) { ArrayList selectImages = new ArrayList<>(); selectImages.add(imagePath); Intent intent = new Intent(); - intent.putStringArrayListExtra(ImageSelectorUtils.SELECT_RESULT, selectImages); + intent.putStringArrayListExtra(ImageSelector.SELECT_RESULT, selectImages); setResult(RESULT_OK, intent); } finish(); } - public static void openActivity(Activity context, int requestCode) { + public static void openActivity(Activity context, int requestCode, boolean useCamera, ArrayList selected) { Intent intent = new Intent(context, ClipImageActivity.class); intent.putExtra("requestCode", requestCode); + intent.putExtra(ImageSelector.USE_CAMERA, useCamera); + intent.putExtra(ImageSelector.SELECTED, selected); context.startActivityForResult(intent, requestCode); } } diff --git a/imageselector/src/main/java/com/donkingliang/imageselector/ImageSelectorActivity.java b/imageselector/src/main/java/com/donkingliang/imageselector/ImageSelectorActivity.java index aea3823..f9cc501 100644 --- a/imageselector/src/main/java/com/donkingliang/imageselector/ImageSelectorActivity.java +++ b/imageselector/src/main/java/com/donkingliang/imageselector/ImageSelectorActivity.java @@ -6,7 +6,6 @@ import android.animation.ObjectAnimator; import android.app.Activity; import android.app.AlertDialog; -import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.pm.PackageManager; @@ -17,15 +16,19 @@ import android.os.Bundle; import android.os.Environment; import android.os.Handler; +import android.provider.MediaStore; import android.provider.Settings; import android.support.annotation.Nullable; import android.support.v4.app.ActivityCompat; import android.support.v4.content.ContextCompat; +import android.support.v4.content.FileProvider; +import android.support.v4.os.EnvironmentCompat; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.SimpleItemAnimator; +import android.util.Log; import android.view.KeyEvent; import android.view.View; import android.view.Window; @@ -35,14 +38,18 @@ import com.donkingliang.imageselector.adapter.FolderAdapter; import com.donkingliang.imageselector.adapter.ImageAdapter; -import com.donkingliang.imageselector.constant.Constants; import com.donkingliang.imageselector.entry.Folder; import com.donkingliang.imageselector.entry.Image; import com.donkingliang.imageselector.model.ImageModel; import com.donkingliang.imageselector.utils.DateUtils; -import com.donkingliang.imageselector.utils.ImageSelectorUtils; +import com.donkingliang.imageselector.utils.ImageSelector; +import java.io.File; +import java.io.IOException; +import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Date; +import java.util.Locale; public class ImageSelectorActivity extends AppCompatActivity { @@ -61,8 +68,11 @@ public class ImageSelectorActivity extends AppCompatActivity { private ArrayList mFolders; private Folder mFolder; - private boolean isToSettings = false; - private static final int PERMISSION_REQUEST_CODE = 0X00000011; + private boolean applyLoadImage = false; + private static final int PERMISSION_WRITE_EXTERNAL_REQUEST_CODE = 0x00000011; + private static final int PERMISSION_CAMERA_REQUEST_CODE = 0x00000012; + + private static final int CAMERA_REQUEST_CODE = 0x00000010; private boolean isOpenFolder; private boolean isShowTime; @@ -70,6 +80,9 @@ public class ImageSelectorActivity extends AppCompatActivity { private boolean isSingle; private int mMaxCount; + private boolean useCamera = true; + private String mPhotoPath; + private Handler mHideHandler = new Handler(); private Runnable mHide = new Runnable() { @Override @@ -88,16 +101,19 @@ public void run() { * @param activity * @param requestCode * @param isSingle 是否单选 + * @param useCamera 是否使用拍照功能 * @param maxSelectCount 图片的最大选择数量,小于等于0时,不限数量,isSingle为false时才有用。 * @param selected 接收从外面传进来的已选择的图片列表。当用户原来已经有选择过图片,现在重新打开 * 选择器,允许用户把先前选过的图片传进来,并把这些图片默认为选中状态。 */ public static void openActivity(Activity activity, int requestCode, - boolean isSingle, int maxSelectCount, ArrayList selected) { + boolean isSingle, boolean useCamera, + int maxSelectCount, ArrayList selected) { Intent intent = new Intent(activity, ImageSelectorActivity.class); - intent.putExtra(Constants.MAX_SELECT_COUNT, maxSelectCount); - intent.putExtra(Constants.IS_SINGLE, isSingle); - intent.putStringArrayListExtra(Constants.SELECTED, selected); + intent.putExtra(ImageSelector.MAX_SELECT_COUNT, maxSelectCount); + intent.putExtra(ImageSelector.IS_SINGLE, isSingle); + intent.putExtra(ImageSelector.USE_CAMERA, useCamera); + intent.putStringArrayListExtra(ImageSelector.SELECTED, selected); activity.startActivityForResult(intent, requestCode); } @@ -107,9 +123,10 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { setContentView(R.layout.activity_image_select); Intent intent = getIntent(); - mMaxCount = intent.getIntExtra(Constants.MAX_SELECT_COUNT, 0); - isSingle = intent.getBooleanExtra(Constants.IS_SINGLE, false); - mSelectedImages = intent.getStringArrayListExtra(Constants.SELECTED); + mMaxCount = intent.getIntExtra(ImageSelector.MAX_SELECT_COUNT, 0); + isSingle = intent.getBooleanExtra(ImageSelector.IS_SINGLE, false); + useCamera = intent.getBooleanExtra(ImageSelector.USE_CAMERA, true); + mSelectedImages = intent.getStringArrayListExtra(ImageSelector.SELECTED); setStatusBarColor(); initView(); @@ -232,6 +249,11 @@ public void OnImageSelect(Image image, boolean isSelect, int selectCount) { public void OnItemClick(Image image, int position) { toPreviewActivity(mAdapter.getData(), position); } + + @Override + public void OnCameraClick() { + checkPermissionAndCamera(); + } }); } @@ -277,7 +299,7 @@ private void setFolder(Folder folder) { mFolder = folder; tvFolderName.setText(folder.getName()); rvImage.scrollToPosition(0); - mAdapter.refresh(folder.getImages()); + mAdapter.refresh(folder.getImages(), folder.isUseCamera()); } } @@ -366,8 +388,8 @@ private void showTime() { */ private void changeTime() { int firstVisibleItem = getFirstVisibleItem(); - if (firstVisibleItem >= 0 && firstVisibleItem < mAdapter.getData().size()) { - Image image = mAdapter.getData().get(firstVisibleItem); + Image image = mAdapter.getFirstVisibleImage(firstVisibleItem); + if (image != null) { String time = DateUtils.getImageTime(image.getTime() * 1000); tvTime.setText(time); showTime(); @@ -392,11 +414,14 @@ private void confirm() { } //点击确定,把选中的图片通过Intent传给上一个Activity。 + setResult(images); + finish(); + } + + private void setResult(ArrayList images) { Intent intent = new Intent(); - intent.putStringArrayListExtra(ImageSelectorUtils.SELECT_RESULT, images); + intent.putStringArrayListExtra(ImageSelector.SELECT_RESULT, images); setResult(RESULT_OK, intent); - - finish(); } private void toPreviewActivity(ArrayList images, int position) { @@ -409,8 +434,8 @@ private void toPreviewActivity(ArrayList images, int position) { @Override protected void onStart() { super.onStart(); - if (isToSettings) { - isToSettings = false; + if (applyLoadImage) { + applyLoadImage = false; checkPermissionAndLoadImages(); } } @@ -425,9 +450,8 @@ protected void onStart() { @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); - if (requestCode == Constants.RESULT_CODE) { - - if (data != null && data.getBooleanExtra(Constants.IS_CONFIRM, false)) { + if (requestCode == ImageSelector.RESULT_CODE) { + if (data != null && data.getBooleanExtra(ImageSelector.IS_CONFIRM, false)) { //如果用户在预览页点击了确定,就直接把用户选中的图片返回给用户。 confirm(); } else { @@ -435,6 +459,15 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) { mAdapter.notifyDataSetChanged(); setSelectImageCount(mAdapter.getSelectImages().size()); } + } else if (requestCode == CAMERA_REQUEST_CODE) { + if (resultCode == RESULT_OK) { + ArrayList images = new ArrayList<>(); + images.add(mPhotoPath); + setResult(images); + finish(); + } else { + Log.e("eee", "拍照取消"); + } } } @@ -467,15 +500,31 @@ private void checkPermissionAndLoadImages() { // Toast.makeText(this, "没有图片", Toast.LENGTH_LONG).show(); return; } - int hasWriteContactsPermission = ContextCompat.checkSelfPermission(getApplication(), + int hasWriteExternalPermission = ContextCompat.checkSelfPermission(getApplication(), Manifest.permission.WRITE_EXTERNAL_STORAGE); - if (hasWriteContactsPermission == PackageManager.PERMISSION_GRANTED) { + if (hasWriteExternalPermission == PackageManager.PERMISSION_GRANTED) { //有权限,加载图片。 loadImageForSDCard(); } else { //没有权限,申请权限。 ActivityCompat.requestPermissions(ImageSelectorActivity.this, - new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, PERMISSION_REQUEST_CODE); + new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, PERMISSION_WRITE_EXTERNAL_REQUEST_CODE); + } + } + + /** + * 检查权限并拍照。 + */ + private void checkPermissionAndCamera() { + int hasCameraPermission = ContextCompat.checkSelfPermission(getApplication(), + Manifest.permission.CAMERA); + if (hasCameraPermission == PackageManager.PERMISSION_GRANTED) { + //有调起相机拍照。 + openCamera(); + } else { + //没有权限,申请权限。 + ActivityCompat.requestPermissions(ImageSelectorActivity.this, + new String[]{Manifest.permission.CAMERA}, PERMISSION_CAMERA_REQUEST_CODE); } } @@ -488,14 +537,23 @@ private void checkPermissionAndLoadImages() { */ @Override public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { - if (requestCode == PERMISSION_REQUEST_CODE) { + if (requestCode == PERMISSION_WRITE_EXTERNAL_REQUEST_CODE) { if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { //允许权限,加载图片。 loadImageForSDCard(); } else { //拒绝权限,弹出提示框。 - showExceptionDialog(); + showExceptionDialog(true); + } + } else if (requestCode == PERMISSION_CAMERA_REQUEST_CODE) { + if (grantResults.length > 0 + && grantResults[0] == PackageManager.PERMISSION_GRANTED) { + //允许权限,有调起相机拍照。 + openCamera(); + } else { + //拒绝权限,弹出提示框。 + showExceptionDialog(false); } } } @@ -503,11 +561,11 @@ public void onRequestPermissionsResult(int requestCode, String[] permissions, in /** * 发生没有权限等异常时,显示一个提示dialog. */ - private void showExceptionDialog() { + private void showExceptionDialog(final boolean applyLoad) { new AlertDialog.Builder(this) .setCancelable(false) .setTitle("提示") - .setMessage("该相册需要赋予访问存储的权限,请到“设置”>“应用”>“权限”中配置权限。") + .setMessage("该相册需要赋予访问存储和拍照的权限,请到“设置”>“应用”>“权限”中配置权限。") .setNegativeButton("取消", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { @@ -519,7 +577,9 @@ public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) { dialog.cancel(); startAppSettings(); - isToSettings = true; + if (applyLoad) { + applyLoadImage = true; + } } }).show(); } @@ -537,6 +597,7 @@ public void onSuccess(ArrayList folders) { public void run() { if (mFolders != null && !mFolders.isEmpty()) { initFolderList(); + mFolders.get(0).setUseCamera(useCamera); setFolder(mFolders.get(0)); if (mSelectedImages != null && mAdapter != null) { mAdapter.setSelectedImages(mSelectedImages); @@ -549,6 +610,45 @@ public void run() { }); } + /** + * 调起相机拍照 + */ + private void openCamera() { + Intent captureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); + if (captureIntent.resolveActivity(getPackageManager()) != null) { + File photoFile = null; + try { + photoFile = createImageFile(); + } catch (IOException e) { + e.printStackTrace(); + } + + if (photoFile != null) { + mPhotoPath = photoFile.getAbsolutePath(); + //通过FileProvider创建一个content类型的Uri + Uri photoUri = FileProvider.getUriForFile(this, getPackageName() + ".fileprovider", photoFile); + captureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoUri); + captureIntent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION); + startActivityForResult(captureIntent, CAMERA_REQUEST_CODE); + } + } + } + + private File createImageFile() throws IOException { + String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.getDefault()).format(new Date()); + String imageFileName = String.format("JPEG_%s.jpg", timeStamp); + File storageDir = Environment.getExternalStoragePublicDirectory( + Environment.DIRECTORY_PICTURES); + if (!storageDir.exists()) { + storageDir.mkdir(); + } + File tempFile = new File(storageDir, imageFileName); + if (!Environment.MEDIA_MOUNTED.equals(EnvironmentCompat.getStorageState(tempFile))) { + return null; + } + return tempFile; + } + /** * 启动应用的设置 */ diff --git a/imageselector/src/main/java/com/donkingliang/imageselector/PreviewActivity.java b/imageselector/src/main/java/com/donkingliang/imageselector/PreviewActivity.java index 77b7aa7..6987f18 100644 --- a/imageselector/src/main/java/com/donkingliang/imageselector/PreviewActivity.java +++ b/imageselector/src/main/java/com/donkingliang/imageselector/PreviewActivity.java @@ -24,8 +24,8 @@ import android.widget.TextView; import com.donkingliang.imageselector.adapter.ImagePagerAdapter; -import com.donkingliang.imageselector.constant.Constants; import com.donkingliang.imageselector.entry.Image; +import com.donkingliang.imageselector.utils.ImageSelector; import com.donkingliang.imageselector.view.MyViewPager; import java.util.ArrayList; @@ -64,10 +64,10 @@ public static void openActivity(Activity activity, ArrayList images, tempImages = images; tempSelectImages = selectImages; Intent intent = new Intent(activity, PreviewActivity.class); - intent.putExtra(Constants.MAX_SELECT_COUNT, maxSelectCount); - intent.putExtra(Constants.IS_SINGLE, isSingle); - intent.putExtra(Constants.POSITION, position); - activity.startActivityForResult(intent, Constants.RESULT_CODE); + intent.putExtra(ImageSelector.MAX_SELECT_COUNT, maxSelectCount); + intent.putExtra(ImageSelector.IS_SINGLE, isSingle); + intent.putExtra(ImageSelector.POSITION, position); + activity.startActivityForResult(intent, ImageSelector.RESULT_CODE); } @Override @@ -82,8 +82,8 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { tempSelectImages = null; Intent intent = getIntent(); - mMaxCount = intent.getIntExtra(Constants.MAX_SELECT_COUNT, 0); - isSingle = intent.getBooleanExtra(Constants.IS_SINGLE, false); + mMaxCount = intent.getIntExtra(ImageSelector.MAX_SELECT_COUNT, 0); + isSingle = intent.getBooleanExtra(ImageSelector.IS_SINGLE, false); Resources resources = getResources(); Bitmap selectBitmap = BitmapFactory.decodeResource(resources, R.drawable.icon_image_select); @@ -101,7 +101,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { tvIndicator.setText(1 + "/" + mImages.size()); changeSelect(mImages.get(0)); - vpImage.setCurrentItem(intent.getIntExtra(Constants.POSITION, 0)); + vpImage.setCurrentItem(intent.getIntExtra(ImageSelector.POSITION, 0)); } private void initView() { @@ -313,8 +313,8 @@ private void setSelectImageCount(int count) { public void finish() { //Activity关闭时,通过Intent把用户的操作(确定/返回)传给ImageSelectActivity。 Intent intent = new Intent(); - intent.putExtra(Constants.IS_CONFIRM, isConfirm); - setResult(Constants.RESULT_CODE, intent); + intent.putExtra(ImageSelector.IS_CONFIRM, isConfirm); + setResult(ImageSelector.RESULT_CODE, intent); super.finish(); } } diff --git a/imageselector/src/main/java/com/donkingliang/imageselector/adapter/ImageAdapter.java b/imageselector/src/main/java/com/donkingliang/imageselector/adapter/ImageAdapter.java index 3e874c4..9611dcc 100644 --- a/imageselector/src/main/java/com/donkingliang/imageselector/adapter/ImageAdapter.java +++ b/imageselector/src/main/java/com/donkingliang/imageselector/adapter/ImageAdapter.java @@ -29,6 +29,11 @@ public class ImageAdapter extends RecyclerView.Adapter private int mMaxCount; private boolean isSingle; + private static final int TYPE_CAMERA = 1; + private static final int TYPE_IMAGE = 2; + + private boolean useCamera; + /** * @param maxCount 图片的最大选择数量,小于等于0时,不限数量,isSingle为false时才有用。 * @param isSingle 是否单选 @@ -42,48 +47,77 @@ public ImageAdapter(Context context, int maxCount, boolean isSingle) { @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { - View view = mInflater.inflate(R.layout.adapter_images_item, parent, false); - return new ViewHolder(view); + if (viewType == TYPE_IMAGE) { + View view = mInflater.inflate(R.layout.adapter_images_item, parent, false); + return new ViewHolder(view); + } else { + View view = mInflater.inflate(R.layout.adapter_camera, parent, false); + return new ViewHolder(view); + } } @Override public void onBindViewHolder(final ViewHolder holder, int position) { - final Image image = mImages.get(position); - Glide.with(mContext).load(new File(image.getPath())) - .apply(new RequestOptions().diskCacheStrategy(DiskCacheStrategy.NONE)) - .into(holder.ivImage); - - setItemSelect(holder, mSelectImages.contains(image)); - //点击选中/取消选中图片 - holder.ivSelectIcon.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - if (mSelectImages.contains(image)) { - //如果图片已经选中,就取消选中 - unSelectImage(image); - setItemSelect(holder, false); - } else if (isSingle) { - //如果是单选,就先清空已经选中的图片,再选中当前图片 - clearImageSelect(); - selectImage(image); - setItemSelect(holder, true); - } else if (mMaxCount <= 0 || mSelectImages.size() < mMaxCount) { - //如果不限制图片的选中数量,或者图片的选中数量 - // 还没有达到最大限制,就直接选中当前图片。 - selectImage(image); - setItemSelect(holder, true); + if (getItemViewType(position) == TYPE_IMAGE) { + final Image image = getImage(position); + Glide.with(mContext).load(new File(image.getPath())) + .apply(new RequestOptions().diskCacheStrategy(DiskCacheStrategy.NONE)) + .into(holder.ivImage); + + setItemSelect(holder, mSelectImages.contains(image)); + + holder.ivGif.setVisibility(image.isGif() ? View.VISIBLE : View.GONE); + + //点击选中/取消选中图片 + holder.ivSelectIcon.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (mSelectImages.contains(image)) { + //如果图片已经选中,就取消选中 + unSelectImage(image); + setItemSelect(holder, false); + } else if (isSingle) { + //如果是单选,就先清空已经选中的图片,再选中当前图片 + clearImageSelect(); + selectImage(image); + setItemSelect(holder, true); + } else if (mMaxCount <= 0 || mSelectImages.size() < mMaxCount) { + //如果不限制图片的选中数量,或者图片的选中数量 + // 还没有达到最大限制,就直接选中当前图片。 + selectImage(image); + setItemSelect(holder, true); + } } - } - }); + }); - holder.itemView.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - if (mItemClickListener != null) { - mItemClickListener.OnItemClick(image, holder.getAdapterPosition()); + holder.itemView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (mItemClickListener != null) { + int p = holder.getAdapterPosition(); + mItemClickListener.OnItemClick(image, useCamera ? p - 1 : p); + } } - } - }); + }); + } else if (getItemViewType(position) == TYPE_CAMERA) { + holder.itemView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (mItemClickListener != null) { + mItemClickListener.OnCameraClick(); + } + } + }); + } + } + + @Override + public int getItemViewType(int position) { + if (useCamera && position == 0) { + return TYPE_CAMERA; + } else { + return TYPE_IMAGE; + } } /** @@ -110,8 +144,13 @@ private void unSelectImage(Image image) { } } + @Override public int getItemCount() { + return useCamera ? getImageCount() + 1 : getImageCount(); + } + + private int getImageCount() { return mImages == null ? 0 : mImages.size(); } @@ -119,11 +158,27 @@ public ArrayList getData() { return mImages; } - public void refresh(ArrayList data) { + public void refresh(ArrayList data, boolean useCamera) { mImages = data; + this.useCamera = useCamera; notifyDataSetChanged(); } + private Image getImage(int position) { + return mImages.get(useCamera ? position - 1 : position); + } + + public Image getFirstVisibleImage(int firstVisibleItem) { + if (mImages != null) { + if (useCamera) { + return mImages.get(firstVisibleItem == 0 ? 0 : firstVisibleItem - 1); + } else { + return mImages.get(firstVisibleItem); + } + } + return null; + } + /** * 设置图片选中和未选中的效果 */ @@ -140,9 +195,9 @@ private void setItemSelect(ViewHolder holder, boolean isSelect) { private void clearImageSelect() { if (mImages != null && mSelectImages.size() == 1) { int index = mImages.indexOf(mSelectImages.get(0)); + mSelectImages.clear(); if (index != -1) { - mSelectImages.clear(); - notifyItemChanged(index); + notifyItemChanged(useCamera ? index + 1 : index); } } } @@ -194,12 +249,17 @@ static class ViewHolder extends RecyclerView.ViewHolder { ImageView ivImage; ImageView ivSelectIcon; ImageView ivMasking; + ImageView ivGif; + ImageView ivCamera; public ViewHolder(View itemView) { super(itemView); ivImage = itemView.findViewById(R.id.iv_image); ivSelectIcon = itemView.findViewById(R.id.iv_select); ivMasking = itemView.findViewById(R.id.iv_masking); + ivGif = itemView.findViewById(R.id.iv_gif); + + ivCamera = itemView.findViewById(R.id.iv_camera); } } @@ -209,5 +269,7 @@ public interface OnImageSelectListener { public interface OnItemClickListener { void OnItemClick(Image image, int position); + + void OnCameraClick(); } } diff --git a/imageselector/src/main/java/com/donkingliang/imageselector/adapter/ImagePagerAdapter.java b/imageselector/src/main/java/com/donkingliang/imageselector/adapter/ImagePagerAdapter.java index 008c8e3..2a1ab0c 100644 --- a/imageselector/src/main/java/com/donkingliang/imageselector/adapter/ImagePagerAdapter.java +++ b/imageselector/src/main/java/com/donkingliang/imageselector/adapter/ImagePagerAdapter.java @@ -72,21 +72,28 @@ public Object instantiateItem(ViewGroup container, final int position) { final PhotoView currentView = viewList.remove(0); final Image image = mImgList.get(position); container.addView(currentView); - Glide.with(mContext).asBitmap() - .apply(new RequestOptions().diskCacheStrategy(DiskCacheStrategy.NONE)) - .load(new File(image.getPath())).into(new SimpleTarget() { - @Override - public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition transition) { - int bw = resource.getWidth(); - int bh = resource.getHeight(); - if (bw > 8192 || bh > 8192) { - Bitmap bitmap = ImageUtil.zoomBitmap(resource, 8192, 8192); - setBitmap(currentView, bitmap); - } else { - setBitmap(currentView, resource); + if (image.isGif()) { + currentView.setScaleType(ImageView.ScaleType.FIT_CENTER); + Glide.with(mContext).load(new File(image.getPath())) + .apply(new RequestOptions().diskCacheStrategy(DiskCacheStrategy.NONE)) + .into(currentView); + } else { + Glide.with(mContext).asBitmap() + .apply(new RequestOptions().diskCacheStrategy(DiskCacheStrategy.NONE)) + .load(new File(image.getPath())).into(new SimpleTarget() { + @Override + public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition transition) { + int bw = resource.getWidth(); + int bh = resource.getHeight(); + if (bw > 8192 || bh > 8192) { + Bitmap bitmap = ImageUtil.zoomBitmap(resource, 8192, 8192); + setBitmap(currentView, bitmap); + } else { + setBitmap(currentView, resource); + } } - } - }); + }); + } currentView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { diff --git a/imageselector/src/main/java/com/donkingliang/imageselector/constant/Constants.java b/imageselector/src/main/java/com/donkingliang/imageselector/constant/Constants.java deleted file mode 100644 index 3c6606d..0000000 --- a/imageselector/src/main/java/com/donkingliang/imageselector/constant/Constants.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.donkingliang.imageselector.constant; - -/** - * 常量 - */ -public interface Constants { - - //最大的图片选择数 - String MAX_SELECT_COUNT = "max_select_count"; - //是否单选 - String IS_SINGLE = "is_single"; - //原来已选择的图片 - String SELECTED = "selected"; - //初始位置 - String POSITION = "position"; - - String IS_CONFIRM = "is_confirm"; - - int RESULT_CODE = 0x00000012; -} diff --git a/imageselector/src/main/java/com/donkingliang/imageselector/entry/Folder.java b/imageselector/src/main/java/com/donkingliang/imageselector/entry/Folder.java index 9f3b960..dba4c69 100644 --- a/imageselector/src/main/java/com/donkingliang/imageselector/entry/Folder.java +++ b/imageselector/src/main/java/com/donkingliang/imageselector/entry/Folder.java @@ -10,6 +10,7 @@ */ public class Folder { + private boolean useCamera; // 是否可以调用相机拍照。只有“全部”文件夹才可以拍照 private String name; private ArrayList images; @@ -38,6 +39,14 @@ public void setImages(ArrayList images) { this.images = images; } + public boolean isUseCamera() { + return useCamera; + } + + public void setUseCamera(boolean useCamera) { + this.useCamera = useCamera; + } + public void addImage(Image image) { if (image != null && StringUtils.isNotEmptyString(image.getPath())) { if (images == null) { diff --git a/imageselector/src/main/java/com/donkingliang/imageselector/entry/Image.java b/imageselector/src/main/java/com/donkingliang/imageselector/entry/Image.java index 3de1f2e..ed6e26e 100644 --- a/imageselector/src/main/java/com/donkingliang/imageselector/entry/Image.java +++ b/imageselector/src/main/java/com/donkingliang/imageselector/entry/Image.java @@ -11,11 +11,13 @@ public class Image implements Parcelable { private String path; private long time; private String name; + private String mimeType; - public Image(String path, long time, String name) { + public Image(String path, long time, String name,String mimeType) { this.path = path; this.time = time; this.name = name; + this.mimeType = mimeType; } public String getPath() { @@ -42,6 +44,18 @@ public void setName(String name) { this.name = name; } + public String getMimeType() { + return mimeType; + } + + public void setMimeType(String mimeType) { + this.mimeType = mimeType; + } + + public boolean isGif(){ + return "image/gif".equals(mimeType); + } + @Override public int describeContents() { return 0; @@ -52,15 +66,17 @@ public void writeToParcel(Parcel dest, int flags) { dest.writeString(this.path); dest.writeLong(this.time); dest.writeString(this.name); + dest.writeString(this.mimeType); } protected Image(Parcel in) { this.path = in.readString(); this.time = in.readLong(); this.name = in.readString(); + this.mimeType = in.readString(); } - public static final Creator CREATOR = new Creator() { + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { @Override public Image createFromParcel(Parcel source) { return new Image(source); diff --git a/imageselector/src/main/java/com/donkingliang/imageselector/model/ImageModel.java b/imageselector/src/main/java/com/donkingliang/imageselector/model/ImageModel.java index 98e6db7..f0d6703 100644 --- a/imageselector/src/main/java/com/donkingliang/imageselector/model/ImageModel.java +++ b/imageselector/src/main/java/com/donkingliang/imageselector/model/ImageModel.java @@ -5,6 +5,7 @@ import android.database.Cursor; import android.net.Uri; import android.provider.MediaStore; +import android.util.Log; import com.donkingliang.imageselector.entry.Folder; import com.donkingliang.imageselector.entry.Image; @@ -36,7 +37,8 @@ public void run() { MediaStore.Images.Media.DATA, MediaStore.Images.Media.DISPLAY_NAME, MediaStore.Images.Media.DATE_ADDED, - MediaStore.Images.Media._ID}, + MediaStore.Images.Media._ID, + MediaStore.Images.Media.MIME_TYPE}, null, null, MediaStore.Images.Media.DATE_ADDED); @@ -55,8 +57,13 @@ public void run() { //获取图片时间 long time = mCursor.getLong( mCursor.getColumnIndex(MediaStore.Images.Media.DATE_ADDED)); + + //获取图片类型 + String mimeType = mCursor.getString( + mCursor.getColumnIndex(MediaStore.Images.Media.MIME_TYPE)); + if (!"downloading".equals(getExtensionName(path))) { //过滤未下载完成的文件 - images.add(new Image(path, time, name)); + images.add(new Image(path, time, name, mimeType)); } } mCursor.close(); diff --git a/imageselector/src/main/java/com/donkingliang/imageselector/utils/ImageSelector.java b/imageselector/src/main/java/com/donkingliang/imageselector/utils/ImageSelector.java new file mode 100644 index 0000000..2c488c0 --- /dev/null +++ b/imageselector/src/main/java/com/donkingliang/imageselector/utils/ImageSelector.java @@ -0,0 +1,118 @@ +package com.donkingliang.imageselector.utils; + +import android.app.Activity; + +import com.donkingliang.imageselector.ClipImageActivity; +import com.donkingliang.imageselector.ImageSelectorActivity; + +import java.util.ArrayList; + +/** + * Depiction: + * Author:lry + * Date:2018/6/25 + */ +public class ImageSelector { + + //图片选择的结果 + public static final String SELECT_RESULT = "select_result"; + + //最大的图片选择数 + public static final String MAX_SELECT_COUNT = "max_select_count"; + //是否单选 + public static final String IS_SINGLE = "is_single"; + //是否使用拍照功能 + public static final String USE_CAMERA = "is_camera"; + //原来已选择的图片 + public static final String SELECTED = "selected"; + //初始位置 + public static final String POSITION = "position"; + + public static final String IS_CONFIRM = "is_confirm"; + + public static final int RESULT_CODE = 0x00000012; + + public static ImageSelectorBuilder builder() { + return new ImageSelectorBuilder(); + } + + public static class ImageSelectorBuilder { + + private boolean isCrop = false; + private boolean useCamera = true; + private boolean isSingle = false; + private int maxSelectCount; + private ArrayList selected; + + /** + * 是否使用图片剪切功能。默认false。如果使用了图片剪切功能,相册只能单选。 + * + * @param isCrop + * @return + */ + public ImageSelectorBuilder setCrop(boolean isCrop) { + this.isCrop = isCrop; + return this; + } + + /** + * 是否单选 + * + * @param isSingle + * @return + */ + public ImageSelectorBuilder setSingle(boolean isSingle) { + this.isSingle = isSingle; + return this; + } + + /** + * 是否使用拍照功能。 + * + * @param useCamera 默认为true + * @return + */ + public ImageSelectorBuilder useCamera(boolean useCamera) { + this.useCamera = useCamera; + return this; + } + + /** + * 图片的最大选择数量,小于等于0时,不限数量,isSingle为false时才有用。 + * + * @param maxSelectCount + * @return + */ + public ImageSelectorBuilder setMaxSelectCount(int maxSelectCount) { + this.maxSelectCount = maxSelectCount; + return this; + } + + /** + * 接收从外面传进来的已选择的图片列表。当用户原来已经有选择过图片,现在重新打开 + * 选择器,允许用户把先前选过的图片传进来,并把这些图片默认为选中状态。 + * + * @param selected + * @return + */ + public ImageSelectorBuilder setSelected(ArrayList selected) { + this.selected = selected; + return this; + } + + /** + * 打开相册 + * + * @param activity + * @param requestCode + */ + public void start(Activity activity, int requestCode) { + if (isCrop) { + ClipImageActivity.openActivity(activity, requestCode, useCamera, selected); + } else { + ImageSelectorActivity.openActivity(activity, requestCode, isSingle, useCamera, maxSelectCount, selected); + } + } + } + +} diff --git a/imageselector/src/main/java/com/donkingliang/imageselector/utils/ImageSelectorUtils.java b/imageselector/src/main/java/com/donkingliang/imageselector/utils/ImageSelectorUtils.java index 56876e0..80b31ec 100644 --- a/imageselector/src/main/java/com/donkingliang/imageselector/utils/ImageSelectorUtils.java +++ b/imageselector/src/main/java/com/donkingliang/imageselector/utils/ImageSelectorUtils.java @@ -10,10 +10,11 @@ /** * 提供给外界相册的调用的工具类 */ +@Deprecated public class ImageSelectorUtils { //图片选择的结果 - public static final String SELECT_RESULT = "select_result"; + public static final String SELECT_RESULT = ImageSelector.SELECT_RESULT; /** * 打开相册,选择图片,可多选,不限数量。 @@ -62,7 +63,7 @@ public static void openPhoto(Activity activity, int requestCode, */ public static void openPhoto(Activity activity, int requestCode, boolean isSingle, int maxSelectCount, ArrayList selected) { - ImageSelectorActivity.openActivity(activity, requestCode, isSingle, maxSelectCount, selected); + ImageSelectorActivity.openActivity(activity, requestCode, isSingle, true, maxSelectCount, selected); } /** @@ -72,6 +73,6 @@ public static void openPhoto(Activity activity, int requestCode, * @param requestCode */ public static void openPhotoAndClip(Activity activity, int requestCode) { - ClipImageActivity.openActivity(activity, requestCode); + ClipImageActivity.openActivity(activity, requestCode, true, null); } } diff --git a/imageselector/src/main/java/com/donkingliang/imageselector/view/SquareImageView.java b/imageselector/src/main/java/com/donkingliang/imageselector/view/SquareImageView.java index a8ee58a..624ec70 100644 --- a/imageselector/src/main/java/com/donkingliang/imageselector/view/SquareImageView.java +++ b/imageselector/src/main/java/com/donkingliang/imageselector/view/SquareImageView.java @@ -1,13 +1,13 @@ package com.donkingliang.imageselector.view; import android.content.Context; +import android.support.v7.widget.AppCompatImageView; import android.util.AttributeSet; -import android.widget.ImageView; /** * 正方形的ImageView */ -public class SquareImageView extends ImageView { +public class SquareImageView extends AppCompatImageView { public SquareImageView(Context context) { super(context); diff --git a/imageselector/src/main/res/drawable-xhdpi/ic_gif.png b/imageselector/src/main/res/drawable-xhdpi/ic_gif.png new file mode 100644 index 0000000000000000000000000000000000000000..ed2a70be64b73b78b3b11e2c2c288fca73fbffb7 GIT binary patch literal 993 zcmeAS@N?(olHy`uVBq!ia0vp^4nVBN!3-pwrE*sTDVB6cUq=Rpjs4tz5?L7-7$XCG zLR^93xBwp?A4JOA+uP62&)3%%$Yo<=gwX+;_mM5k&%(n(a~{naR~_t zNl8h$xw)mKrDbJhm6eq>H8l+l4Rv*Ojg5_MZEYPL9qsMyJv}|gjvedm?VT`T0+4a? zWy;K%Gw02lH)qbA1q&7|TC`}%k|oQRFJG}@#p>0o*REZ=VZ(;4 zTeoi8wr%(B-G>h!e*XM9#DueF&z?JX?!tu&moHzwdiCn{>(_7Hx^?HyoqPB0ef;fq_(8Ti4v$+6oM!_Kwc3?(QBblCwitUF)5#!mHRKA3bDuul~^5kXZ`kN7D`Lk zJd)ICQxM1;VBFa>sz9FBzbv8UzPYGj*@Z@<6v z$4bWT`SFT~iH~yEGsl!Qt(doW(*^;i84r$U23%n&hk98JoMIUsRh&Mj8% z2h1F1j5_t*TIMVzj2(ja?h8)&@mDHeiYbOcebd2gIq?URa=z!cXmbZ4@dLcfJA|4-XR*BaeTePO!ug!n<`w7E z2uKFLX+KhUan<~?Re$Uqa=p5%m%P0<_0oO+NRP}_OMX?h1kF0Wf8JXE%#**C+`87a zW!=sV85+5}r$pR2*}Zz7>C?IS26F`Our-%y@V0#ubMLNWkW%|`^Ub>zPN3Z9>FVdQ I&MBb@02;-$F#rGn literal 0 HcmV?d00001 diff --git a/imageselector/src/main/res/drawable-xhdpi/ic_photo_camera.png b/imageselector/src/main/res/drawable-xhdpi/ic_photo_camera.png new file mode 100644 index 0000000000000000000000000000000000000000..777658e95515ca47c9852d00621e2e6d45abc5c7 GIT binary patch literal 894 zcmV-^1A+XBP)zI9LJx5Cecy~F=}h8lwKtS@9n)MRxm2`AkqpItJs@p>)C(tu-V-#=CId=UD(s^ z#Zy@d`v;fOn~Tzu?OJHHNtIePI-lk`KN@Bx3G-g)`+Uz|m=FBkykXu`7K_DVu`~_~ z1Z4r$j3}CsFA0vr7p4ddb45K=_{;=>kNJmsIpZVU0%^)LLWz`4fe-nOMmgjIT>|g$ zGtFS1ZXE(|^ApYDN8W0_z#v8Txj;7;?6E~Um_R#sF$;$xalZoX{D6r(A?{D$E~c{O zM_>?haY%a$6fv1Q-U9oW%qwq!3ryzRTflV87q9|W;F{;GFv0){qSYiAAj>K*xHezl zfJJ&yHS#`7{A#YiA58NG$|F%`I5JV-9to7sbaLM;flIzZ1Lw!X3#^Fu{wYByi=R|$;R}qoTB8JI$kiVUUtqx1 zx=B!Su6`5*yii_yR9b4GhtSXus6)G54OU*Fzb<9Fuf)`*nQG!IEfB;+M}w za~X69{6e&@G0KTnj6*#FFeADVZuofoh-l4&E`cLDWuFO3wP#-rPc_|?^a;Rylnh;L z@)wd48zfOOJOnKQa*Rac43Xn8&v?osa%9ANUyhGPfeM+%FRSSkfU`OkhV}j2l~kBT z1bVSYwP7Nn+I` zNiohkFLCTaw-vAgjq*RZ@U(}??0O4qVKTS91=2W}ibKjn!0?Ng1(Y9wI8QK + + + + \ No newline at end of file diff --git a/imageselector/src/main/res/layout/adapter_images_item.xml b/imageselector/src/main/res/layout/adapter_images_item.xml index cdfd3a3..996af84 100644 --- a/imageselector/src/main/res/layout/adapter_images_item.xml +++ b/imageselector/src/main/res/layout/adapter_images_item.xml @@ -18,13 +18,22 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center" - android:background="#111212"/> + android:background="#111212" /> + + \ No newline at end of file