diff --git a/CHANGELOG.md b/CHANGELOG.md index c37176b5..cbe4e285 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,18 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] + +## [1.8] - 2020-12-22 +### Added + * Added dialog dismiss listener (Special Thanks to [kibotu](https://github.com/kibotu)) + * Added text localization (Special Thanks to [yamin8000](https://github.com/yamin8000) and Jose Bravo) +### Changed + * Fixed crash issue on missing camera app [#69](https://github.com/Dhaval2404/ImagePicker/issues/69) + * Fixed issue selecting images from download folder [#86](https://github.com/Dhaval2404/ImagePicker/issues/86) + * Fixed exif information lost issue [#121](https://github.com/Dhaval2404/ImagePicker/issues/121) + * Fixed crash issue on large image crop [#122](https://github.com/Dhaval2404/ImagePicker/issues/122) + * Fixed saving image in cache issue [#127](https://github.com/Dhaval2404/ImagePicker/issues/127) + ## [1.7.5] - 2020-08-30 ### Changed * Added Polish text translation [#115](https://github.com/Dhaval2404/ImagePicker/issues/115) (Special Thanks to [MarcelKijanka](https://github.com/MarcelKijanka)) @@ -81,6 +93,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Retrieve Image Result as File, File Path as String or Uri object [Unreleased]: https://github.com/Dhaval2404/ImagePicker/compare/v2.0...HEAD +[1.8]: https://github.com/Dhaval2404/ImagePicker/compare/v1.7.5...v1.8 [1.7.5]: https://github.com/Dhaval2404/ImagePicker/compare/v1.7.4...v1.7.5 [1.7.4]: https://github.com/Dhaval2404/ImagePicker/compare/v1.7.3...v1.7.4 [1.7.3]: https://github.com/Dhaval2404/ImagePicker/compare/v1.7.2...v1.7.3 diff --git a/README.md b/README.md index 13af77ba..497c349a 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ Almost 90% of the app that I have developed has an Image upload feature. Along w * Capture Camera Image * Crop Image(Crop image based on provided aspect ratio or let user choose one) * Compress Image(Compress image based on provided resolution and size) -* Retrive Image Result as File, File Path as String or Uri object +* Retrieve Image Result as File, File Path as String or Uri object * Handle Runtime Permission for Camera and Storage # 🎬Preview @@ -54,7 +54,7 @@ Almost 90% of the app that I have developed has an Image upload feature. Along w ``` ```groovy - implementation 'com.github.dhaval2404:imagepicker:1.7.5' + implementation 'com.github.dhaval2404:imagepicker:1.8' ``` **If you are yet to Migrate on AndroidX, Use support build artifact:** @@ -214,6 +214,16 @@ Almost 90% of the app that I have developed has an Image upload feature. Along w } .start() ``` + * Intercept Dialog dismiss event + + ```kotlin + ImagePicker.with(this) + .setDismissListener { + // Handle dismiss event + Log.d("ImagePicker", "onDismiss"); + } + .start() + ``` * Specify Directory to store captured, cropped or compressed images @@ -266,6 +276,16 @@ Almost 90% of the app that I have developed has an Image upload feature. Along w # ✔️Changelog +### Version: 1.8 + + * Added dialog dismiss listener (Special Thanks to [kibotu](https://github.com/kibotu)) + * Added text localization (Special Thanks to [yamin8000](https://github.com/yamin8000) and Jose Bravo) + * Fixed crash issue on missing camera app [#69](https://github.com/Dhaval2404/ImagePicker/issues/69) + * Fixed issue selecting images from download folder [#86](https://github.com/Dhaval2404/ImagePicker/issues/86) + * Fixed exif information lost issue [#121](https://github.com/Dhaval2404/ImagePicker/issues/121) + * Fixed crash issue on large image crop [#122](https://github.com/Dhaval2404/ImagePicker/issues/122) + * Fixed saving image in cache issue [#127](https://github.com/Dhaval2404/ImagePicker/issues/127) + ### Version: 1.7 * Added option to limit MIME types while choosing a gallery image (Special Thanks to [Marchuck](https://github.com/Marchuck)) @@ -327,7 +347,7 @@ We'll be really happy if you sent us links to your projects where you use our co ## License - Copyright 2019, The Android Open Source Project + Copyright 2019-2020, Dhaval Patel Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/imagepicker/build.gradle b/imagepicker/build.gradle index 186c0875..eab645ef 100644 --- a/imagepicker/build.gradle +++ b/imagepicker/build.gradle @@ -13,8 +13,8 @@ android { defaultConfig { minSdkVersion 19 targetSdkVersion 28 - versionCode 13 - versionName "1.7.5" + versionCode 14 + versionName "1.8" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } @@ -49,7 +49,7 @@ dependencies { implementation "androidx.exifinterface:exifinterface:1.1.0" //More Info: https://github.com/Yalantis/uCrop - implementation 'com.github.yalantis:ucrop:2.2.5' + implementation 'com.github.yalantis:ucrop:2.2.6' //More Info: https://github.com/florent37/InlineActivityResult compileOnly 'com.github.florent37:inline-activity-result-kotlin:1.0.4' @@ -72,7 +72,7 @@ ext { siteUrl = 'https://github.com/Dhaval2404/ImagePicker/' gitUrl = 'https://github.com/Dhaval2404/ImagePicker.git' - libraryVersion = '1.7.5' + libraryVersion = '1.8' //If you are uploading new library try : gradlew install //If you are updating existing library then execute: gradlew bintrayUpload //In both the case don't forgot to put bintray credentials in local.properties file. diff --git a/imagepicker/src/main/kotlin/com/github/dhaval2404/imagepicker/ImagePicker.kt b/imagepicker/src/main/kotlin/com/github/dhaval2404/imagepicker/ImagePicker.kt index c1e03e6f..3cf4c597 100644 --- a/imagepicker/src/main/kotlin/com/github/dhaval2404/imagepicker/ImagePicker.kt +++ b/imagepicker/src/main/kotlin/com/github/dhaval2404/imagepicker/ImagePicker.kt @@ -7,6 +7,7 @@ import android.widget.Toast import androidx.appcompat.app.AppCompatActivity import androidx.fragment.app.Fragment import com.github.dhaval2404.imagepicker.constant.ImageProvider +import com.github.dhaval2404.imagepicker.listener.DismissListener import com.github.dhaval2404.imagepicker.listener.ResultListener import com.github.dhaval2404.imagepicker.util.DialogHelper import com.github.florent37.inlineactivityresult.kotlin.startForResult @@ -27,6 +28,8 @@ open class ImagePicker { const val RESULT_ERROR = 64 internal const val EXTRA_IMAGE_PROVIDER = "extra.image_provider" + internal const val EXTRA_CAMERA_DEVICE = "extra.camera_device" + internal const val EXTRA_IMAGE_MAX_SIZE = "extra.image_max_size" internal const val EXTRA_CROP = "extra.crop" internal const val EXTRA_CROP_X = "extra.crop_x" @@ -118,6 +121,11 @@ open class ImagePicker { private var imageProviderInterceptor: ((ImageProvider) -> Unit)? = null + /** + * Dialog dismiss event listener + */ + private var dismissListener: DismissListener? = null + /** * File Directory * @@ -249,6 +257,26 @@ open class ImagePicker { return this } + /** + * Sets the callback that will be called when the dialog is dismissed for any reason. + */ + fun setDismissListener(listener: DismissListener): Builder { + this.dismissListener = listener + return this + } + + /** + * Sets the callback that will be called when the dialog is dismissed for any reason. + */ + fun setDismissListener(listener: (() -> Unit)): Builder { + this.dismissListener = object : DismissListener { + override fun onDismiss() { + listener.invoke() + } + } + return this + } + /** * Start Image Picker Activity */ @@ -292,7 +320,7 @@ open class ImagePicker { startActivity(reqCode) } } - }) + }, dismissListener) } /** @@ -310,7 +338,7 @@ open class ImagePicker { completionHandler?.invoke(Activity.RESULT_CANCELED, intent) } } - }) + }, dismissListener) } /** diff --git a/imagepicker/src/main/kotlin/com/github/dhaval2404/imagepicker/listener/DismissListener.kt b/imagepicker/src/main/kotlin/com/github/dhaval2404/imagepicker/listener/DismissListener.kt new file mode 100644 index 00000000..b96d6ecc --- /dev/null +++ b/imagepicker/src/main/kotlin/com/github/dhaval2404/imagepicker/listener/DismissListener.kt @@ -0,0 +1,17 @@ +package com.github.dhaval2404.imagepicker.listener + +/** + * Interface used to allow the creator of a dialog to run some code when the + * dialog is dismissed. + * + * @author Dhaval Patel + * @version 1.8 + * @since 19 December 2020 + */ +interface DismissListener { + + /** + * This method will be invoked when the dialog is dismissed. + */ + fun onDismiss() +} diff --git a/imagepicker/src/main/kotlin/com/github/dhaval2404/imagepicker/provider/CameraProvider.kt b/imagepicker/src/main/kotlin/com/github/dhaval2404/imagepicker/provider/CameraProvider.kt index fb253b9d..66db91bd 100644 --- a/imagepicker/src/main/kotlin/com/github/dhaval2404/imagepicker/provider/CameraProvider.kt +++ b/imagepicker/src/main/kotlin/com/github/dhaval2404/imagepicker/provider/CameraProvider.kt @@ -66,7 +66,7 @@ class CameraProvider(activity: ImagePickerActivity) : BaseProvider(activity) { private var mFileDir: File? = null init { - val bundle = activity.intent.extras!! + val bundle = activity.intent.extras ?: Bundle() // Get File Directory val fileDir = bundle.getString(ImagePicker.EXTRA_SAVE_DIRECTORY) @@ -102,6 +102,11 @@ class CameraProvider(activity: ImagePickerActivity) : BaseProvider(activity) { * Start Camera Capture Intent */ fun startIntent() { + if (!IntentUtils.isCameraAppAvailable(this)) { + setError(R.string.error_camera_app_not_found) + return + } + checkPermission() } diff --git a/imagepicker/src/main/kotlin/com/github/dhaval2404/imagepicker/provider/CompressionProvider.kt b/imagepicker/src/main/kotlin/com/github/dhaval2404/imagepicker/provider/CompressionProvider.kt index 05dc72cb..f0a5585f 100644 --- a/imagepicker/src/main/kotlin/com/github/dhaval2404/imagepicker/provider/CompressionProvider.kt +++ b/imagepicker/src/main/kotlin/com/github/dhaval2404/imagepicker/provider/CompressionProvider.kt @@ -4,8 +4,10 @@ import android.annotation.SuppressLint import android.graphics.Bitmap import android.graphics.BitmapFactory import android.os.AsyncTask +import android.os.Bundle import com.github.dhaval2404.imagepicker.ImagePicker import com.github.dhaval2404.imagepicker.ImagePickerActivity +import com.github.dhaval2404.imagepicker.util.ExifDataCopier import com.github.dhaval2404.imagepicker.util.FileUriUtils import com.github.dhaval2404.imagepicker.util.FileUtil import com.github.dhaval2404.imagepicker.util.ImageUtil @@ -32,7 +34,7 @@ class CompressionProvider(activity: ImagePickerActivity) : BaseProvider(activity private var mFileDir: File? = null init { - val bundle = activity.intent.extras!! + val bundle = activity.intent.extras ?: Bundle() // Get Max Width/Height parameter from Intent mMaxWidth = bundle.getInt(ImagePicker.EXTRA_MAX_WIDTH, 0) @@ -143,6 +145,9 @@ class CompressionProvider(activity: ImagePickerActivity) : BaseProvider(activity } } while (isCompressionRequired(newFile!!)) + // Copy Exif Data + ExifDataCopier.copyExif(file, newFile) + return newFile } diff --git a/imagepicker/src/main/kotlin/com/github/dhaval2404/imagepicker/provider/CropProvider.kt b/imagepicker/src/main/kotlin/com/github/dhaval2404/imagepicker/provider/CropProvider.kt index fce5b405..73f842e3 100644 --- a/imagepicker/src/main/kotlin/com/github/dhaval2404/imagepicker/provider/CropProvider.kt +++ b/imagepicker/src/main/kotlin/com/github/dhaval2404/imagepicker/provider/CropProvider.kt @@ -43,7 +43,7 @@ class CropProvider(activity: ImagePickerActivity) : BaseProvider(activity) { private var mFileDir: File? = null init { - val bundle = activity.intent.extras!! + val bundle = activity.intent.extras ?: Bundle() // Get Max Width/Height parameter from Intent mMaxWidth = bundle.getInt(ImagePicker.EXTRA_MAX_WIDTH, 0) diff --git a/imagepicker/src/main/kotlin/com/github/dhaval2404/imagepicker/provider/GalleryProvider.kt b/imagepicker/src/main/kotlin/com/github/dhaval2404/imagepicker/provider/GalleryProvider.kt index 9820f391..0b180ffc 100644 --- a/imagepicker/src/main/kotlin/com/github/dhaval2404/imagepicker/provider/GalleryProvider.kt +++ b/imagepicker/src/main/kotlin/com/github/dhaval2404/imagepicker/provider/GalleryProvider.kt @@ -3,6 +3,7 @@ package com.github.dhaval2404.imagepicker.provider import android.Manifest import android.app.Activity import android.content.Intent +import android.os.Bundle import androidx.core.app.ActivityCompat.requestPermissions import com.github.dhaval2404.imagepicker.ImagePicker import com.github.dhaval2404.imagepicker.ImagePickerActivity @@ -38,7 +39,7 @@ class GalleryProvider(activity: ImagePickerActivity) : private val mimeTypes: Array init { - val bundle = activity.intent.extras!! + val bundle = activity.intent.extras ?: Bundle() mimeTypes = bundle.getStringArray(ImagePicker.EXTRA_MIME_TYPES) ?: emptyArray() } diff --git a/imagepicker/src/main/kotlin/com/github/dhaval2404/imagepicker/util/DialogHelper.kt b/imagepicker/src/main/kotlin/com/github/dhaval2404/imagepicker/util/DialogHelper.kt index ad116543..8375e261 100644 --- a/imagepicker/src/main/kotlin/com/github/dhaval2404/imagepicker/util/DialogHelper.kt +++ b/imagepicker/src/main/kotlin/com/github/dhaval2404/imagepicker/util/DialogHelper.kt @@ -5,6 +5,7 @@ import android.view.LayoutInflater import androidx.appcompat.app.AlertDialog import com.github.dhaval2404.imagepicker.R import com.github.dhaval2404.imagepicker.constant.ImageProvider +import com.github.dhaval2404.imagepicker.listener.DismissListener import com.github.dhaval2404.imagepicker.listener.ResultListener import kotlinx.android.synthetic.main.dialog_choose_app.view.* @@ -21,7 +22,11 @@ internal object DialogHelper { * Show Image Provide Picker Dialog. This will streamline the code to pick/capture image * */ - fun showChooseAppDialog(context: Context, listener: ResultListener) { + fun showChooseAppDialog( + context: Context, + listener: ResultListener, + dismissListener: DismissListener? + ) { val layoutInflater = LayoutInflater.from(context) val customView = layoutInflater.inflate(R.layout.dialog_choose_app, null) @@ -34,6 +39,9 @@ internal object DialogHelper { .setNegativeButton(R.string.action_cancel) { _, _ -> listener.onResult(null) } + .setOnDismissListener { + dismissListener?.onDismiss() + } .show() // Handle Camera option click diff --git a/imagepicker/src/main/kotlin/com/github/dhaval2404/imagepicker/util/ExifDataCopier.kt b/imagepicker/src/main/kotlin/com/github/dhaval2404/imagepicker/util/ExifDataCopier.kt new file mode 100644 index 00000000..0bc2dc88 --- /dev/null +++ b/imagepicker/src/main/kotlin/com/github/dhaval2404/imagepicker/util/ExifDataCopier.kt @@ -0,0 +1,52 @@ +package com.github.dhaval2404.imagepicker.util + +import android.util.Log +import androidx.exifinterface.media.ExifInterface +import java.io.File + +/** + * This file was taken from + * https://raw.githubusercontent.com/flutter/plugins/05879a3a4d8e582702227731ccdcf8b115f6b83d/packages/image_picker/image_picker/android/src/main/java/io/flutter/plugins/imagepicker/ExifDataCopier.java + */ +object ExifDataCopier { + + fun copyExif(filePathOri: File, filePathDest: File) { + try { + val oldExif = ExifInterface(filePathOri) + val newExif = ExifInterface(filePathDest) + val attributes: List = listOf( + "FNumber", + "ExposureTime", + "ISOSpeedRatings", + "GPSAltitude", + "GPSAltitudeRef", + "FocalLength", + "GPSDateStamp", + "WhiteBalance", + "GPSProcessingMethod", + "GPSTimeStamp", + "DateTime", + "Flash", + "GPSLatitude", + "GPSLatitudeRef", + "GPSLongitude", + "GPSLongitudeRef", + "Make", + "Model", + "Orientation" + ) + for (attribute in attributes) { + setIfNotNull(oldExif, newExif, attribute) + } + newExif.saveAttributes() + } catch (ex: Exception) { + Log.e("ExifDataCopier", "Error preserving Exif data on selected image: $ex") + } + } + + private fun setIfNotNull(oldExif: ExifInterface, newExif: ExifInterface, property: String) { + if (oldExif.getAttribute(property) != null) { + newExif.setAttribute(property, oldExif.getAttribute(property)) + } + } +} diff --git a/imagepicker/src/main/kotlin/com/github/dhaval2404/imagepicker/util/FileUriUtils.kt b/imagepicker/src/main/kotlin/com/github/dhaval2404/imagepicker/util/FileUriUtils.kt index bd13d8a5..c43e7021 100644 --- a/imagepicker/src/main/kotlin/com/github/dhaval2404/imagepicker/util/FileUriUtils.kt +++ b/imagepicker/src/main/kotlin/com/github/dhaval2404/imagepicker/util/FileUriUtils.kt @@ -64,10 +64,16 @@ object FileUriUtils { } else if (isDownloadsDocument(uri)) { val fileName = getFilePath(context, uri) if (fileName != null) { - return Environment.getExternalStorageDirectory().toString() + "/Download/" + fileName + val path = Environment.getExternalStorageDirectory().toString() + "/Download/" + fileName + if (File(path).exists()) { + return path + } } - val id = DocumentsContract.getDocumentId(uri) + var id = DocumentsContract.getDocumentId(uri) + if (id.contains(":")) { + id = id.split(":")[1] + } val contentUri = ContentUris.withAppendedId( Uri.parse("content://downloads/public_downloads"), java.lang.Long.valueOf(id) ) diff --git a/imagepicker/src/main/kotlin/com/github/dhaval2404/imagepicker/util/FileUtil.kt b/imagepicker/src/main/kotlin/com/github/dhaval2404/imagepicker/util/FileUtil.kt index 21c0f746..258cf169 100644 --- a/imagepicker/src/main/kotlin/com/github/dhaval2404/imagepicker/util/FileUtil.kt +++ b/imagepicker/src/main/kotlin/com/github/dhaval2404/imagepicker/util/FileUtil.kt @@ -98,5 +98,4 @@ object FileUtil { else -> Bitmap.CompressFormat.JPEG } } - } diff --git a/imagepicker/src/main/kotlin/com/github/dhaval2404/imagepicker/util/ImageUtil.kt b/imagepicker/src/main/kotlin/com/github/dhaval2404/imagepicker/util/ImageUtil.kt index 4c183c29..f9c7fe25 100644 --- a/imagepicker/src/main/kotlin/com/github/dhaval2404/imagepicker/util/ImageUtil.kt +++ b/imagepicker/src/main/kotlin/com/github/dhaval2404/imagepicker/util/ImageUtil.kt @@ -21,7 +21,6 @@ import android.graphics.Canvas import android.graphics.Matrix import android.graphics.Paint import android.os.Build -import androidx.exifinterface.media.ExifInterface import java.io.File import java.io.FileOutputStream import java.io.IOException @@ -143,25 +142,12 @@ object ImageUtil { middleY - bmp.height / 2, Paint(Paint.FILTER_BITMAP_FLAG) ) bmp.recycle() - val exif: ExifInterface - try { - exif = ExifInterface(imageFile.absolutePath) - val orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, 0) - val matrix = Matrix() - if (orientation == 6) { - matrix.postRotate(90f) - } else if (orientation == 3) { - matrix.postRotate(180f) - } else if (orientation == 8) { - matrix.postRotate(270f) - } - scaledBitmap = Bitmap.createBitmap( - scaledBitmap, 0, 0, scaledBitmap.width, - scaledBitmap.height, matrix, true - ) - } catch (e: IOException) { - e.printStackTrace() - } + + val matrix = Matrix() + scaledBitmap = Bitmap.createBitmap( + scaledBitmap, 0, 0, scaledBitmap.width, + scaledBitmap.height, matrix, true + ) return scaledBitmap } diff --git a/imagepicker/src/main/kotlin/com/github/dhaval2404/imagepicker/util/IntentUtils.kt b/imagepicker/src/main/kotlin/com/github/dhaval2404/imagepicker/util/IntentUtils.kt index 3c3f5206..be8dcde3 100644 --- a/imagepicker/src/main/kotlin/com/github/dhaval2404/imagepicker/util/IntentUtils.kt +++ b/imagepicker/src/main/kotlin/com/github/dhaval2404/imagepicker/util/IntentUtils.kt @@ -80,4 +80,14 @@ object IntentUtils { fun isCameraHardwareAvailable(context: Context): Boolean { return context.packageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA_ANY) } + + /** + * Check if Camera app is available or not + * + * @return true if Camera app is Available else return false + */ + fun isCameraAppAvailable(context: Context): Boolean { + val intent = Intent(MediaStore.ACTION_IMAGE_CAPTURE) + return intent.resolveActivity(context.packageManager) != null + } } diff --git a/imagepicker/src/main/res/values-es/strings.xml b/imagepicker/src/main/res/values-es/strings.xml new file mode 100644 index 00000000..25609496 --- /dev/null +++ b/imagepicker/src/main/res/values-es/strings.xml @@ -0,0 +1,37 @@ + + + + + Elegir + Cancelar + Galeria + Cámara + + Se necesitan permisos de Lectura de Datos Externos para seleccionar una imagen. Por favor activa los permisos seleccionados en Ajustes > Permisos. + Se necesitan permisos de Cámara y de Almacenamiento Externo para seleccionar una imagen. Denegar cualquier permiso no ayudará a que la aplicación funcione de manera correcta. Por favor activa todos los permisos solicitados en Ajustes > Permisos. + + Permisos.]]> + + Permisos.]]> + + Permisos.]]> + + Error al crear archivo de imagen de la Cámara + Error al elegir imagen de la galería + Error al recortar la imagen + Error al comprimir la imagen + Tarea cancelada + No se encontró la aplicación de la cámara + + + + Original + Editar Foto + + Cortar + Rotar + Escalar + Cortar + + + \ No newline at end of file diff --git a/imagepicker/src/main/res/values-fa/strings.xml b/imagepicker/src/main/res/values-fa/strings.xml index e8275a44..50e2de91 100644 --- a/imagepicker/src/main/res/values-fa/strings.xml +++ b/imagepicker/src/main/res/values-fa/strings.xml @@ -1,12 +1,13 @@ + + انتخاب عکس + انتخاب بیخیال گالری دوربین - .imagepicker.provider - برای انتخاب عکس دسترسی خواندن فضای خارجی لازم است. لطفا دسترسی درخواست شده را از تنظیمات فعال کنید > دسترسی ها برای گرفتن عکس دسترسی دوربین و فضای خارجی لازم است. غیرمجاز کردن این پرمیشن ها اجازه کارکرد صحیح برنامه را میگیرد. لطفا تمامی دسترسی های درخواست شده را از تنظیمات فعال کنید > دسترسی ها @@ -21,3 +22,15 @@ خطا در برش عکس خطا در فشرده سازی عکس عمل لغو شد + برنامه دوربین پیدا نشد + + + + اصلی + ویرایش عکس + برش + چرخش + مقیاس + برش + + diff --git a/imagepicker/src/main/res/values-gu/strings.xml b/imagepicker/src/main/res/values-gu/strings.xml new file mode 100644 index 00000000..00b63a73 --- /dev/null +++ b/imagepicker/src/main/res/values-gu/strings.xml @@ -0,0 +1,36 @@ + + + + + પસંદ કરો + રદ કરો + ગેલેરી + કૅમેરા + + છબીને પસંદ કરવા માટે બાહ્ય સ્ટોરેજ વાંચવાની પરવાનગી આવશ્યક છે. કૃપા કરીને સેટિંગ્સ>પરવાનગીથી તરફથી વિનંતી કરેલ પરવાનગી ચાલુ કરો. + છબીને કેપ્ચર કરવા માટે કૅમેરા અને બાહ્ય સ્ટોરેજ પરવાનગીની આવશ્યકતા છે. કોઈપણ પરવાનગી બંધ કરવાથી એપ્લિકેશન સરળતાથી ચાલવાની મંજૂરી આપશે નહીં. કૃપા કરીને સેટિંગ્સ>પરવાનગીથી બધી વિનંતી કરેલ મંજૂરીઓ ચાલુ કરો. + + પરવાનગીથી સ્ટોરેજ પરવાનગીની મંજૂરી આપો.]]> + + પરવાનગીથી વિનંતી કરેલ બંને પરવાનગીને મંજૂરી આપો.]]> + + પરવાનગીથી સ્ટોરેજ પરવાનગીની મંજૂરી આપો.]]> + + કૅમેરા છબી ફાઇલ બનાવવામાં નિષ્ફળ + ગેલેરી છબી પસંદ કરવામાં નિષ્ફળ + છબી કાપવામાં નિષ્ફળ + છબીને સંકુચિત કરવામાં નિષ્ફળ + કાર્ય રદ કરવામાં આવ્યું છે + કૅમેરા એપ્લિકેશન મળી નથી + + + + અસલ + ફોટો સંપાદિત કરો + કાપો + ફેરવો + સ્કેલ + કાપો + + + \ No newline at end of file diff --git a/imagepicker/src/main/res/values-hi/strings.xml b/imagepicker/src/main/res/values-hi/strings.xml new file mode 100644 index 00000000..644501a5 --- /dev/null +++ b/imagepicker/src/main/res/values-hi/strings.xml @@ -0,0 +1,36 @@ + + + + + चुनें + रद्द करें + गेलरी + कैमरा + + छवि का चयन करने के लिए बाहरी संग्रहण की अनुमति आवश्यक है। कृपया सेटिंग्स> अनुमतियों से अनुरोधित अनुमति को चालू करें। + इमेज कैप्चर करने के लिए कैमरा और स्टोरेज परमिशन की जरूरत होती है। किसी भी अनुमति को बंद करने से एप्लिकेशन आसानी से नहीं चल सकेगा। कृपया सेटिंग्स> अनुमतियों से सभी अनुरोधित अनुमतियों को चालू करें। + + अनुमतियों से संग्रहण की अनुमति दें।]]> + + अनुमतियां से दोनों अनुरोधित अनुमतियों को अनुमति दें।]]> + + अनुमतियों से भंडारण की अनुमति दें।]]> + + कैमरा चित्र बनाने में विफल + गैलरी की तस्वीर लेने में विफल + चित्र को काटना में विफल + छवि को संपीड़ित करने में विफल + कार्य रद्द कर दिया गया + कैमरा ऐप नहीं मिला + + + + मूल + फ़ोटो संपादित करें + काटना + घुमाएँ + स्केल + काटना + + + \ No newline at end of file diff --git a/imagepicker/src/main/res/values-pl/strings.xml b/imagepicker/src/main/res/values-pl/strings.xml index efd16246..4e180380 100644 --- a/imagepicker/src/main/res/values-pl/strings.xml +++ b/imagepicker/src/main/res/values-pl/strings.xml @@ -7,8 +7,6 @@ Galeria Aparat - .imagepicker.provider - Dostęp do pamięci zewnętrznej jest wymagany, aby móc wybrać obraz. Zmienić dostęp do pamięci można z poziomu Ustawień > Uprawnienia Dostęp do aparatu oraz zewnętrznej pamięci jest wymagany, aby przechwycić obraz. Zabranie uprawnień aplikacji może powodować błędy w jej działaniu. Zmienić dostęp do pamięci można z poziomu Ustawień > Uprawnienia @@ -23,15 +21,13 @@ Nie udało się zmienić rozmiarów obrazu Podczas kompresji obrazu wystąpił błąd Zadanie przerwane + Nie znaleziono aplikacji aparatu Oryginał Edytuj zdjęcie - Przytnij - URI wejścia i wyjścia musi być ustalone - Możesz nadpisać kolor w color resources (ucrop_color_toolbar_widget) w swojej aplikacji aby wspierać urządzenia przed Androidem L Obróć Skaluj Przytnij diff --git a/imagepicker/src/main/res/values/colors.xml b/imagepicker/src/main/res/values/colors.xml index 371454ff..f6488773 100644 --- a/imagepicker/src/main/res/values/colors.xml +++ b/imagepicker/src/main/res/values/colors.xml @@ -10,5 +10,6 @@ @color/ucrop_color_widget_active @color/ucrop_color_widget_active @color/ucrop_color_widget_active + #FFFFFF diff --git a/imagepicker/src/main/res/values/strings.xml b/imagepicker/src/main/res/values/strings.xml index 68693a04..b4a01539 100644 --- a/imagepicker/src/main/res/values/strings.xml +++ b/imagepicker/src/main/res/values/strings.xml @@ -1,15 +1,14 @@ - Image Picker + Image Picker + .imagepicker.provider Choose Cancel Gallery Camera - .imagepicker.provider - - Read External Storage permissions is needed to select Image. Please turn on requested permissions from Settings > Permissions. - Camera and External Storage permissions are needed to capture image. Turning off any permission won\'t allow application run smoothly. Please turn on all requested permissions from Settings > Permissions. + Read External Storage permission is needed to select Image. Please turn on the requested permission from Settings > Permissions. + Camera and External Storage permissions are needed to capture the image. Turning off any permission won\'t allow the application to run smoothly. Please turn on all requested permissions from Settings > Permissions. Permissions.]]> @@ -22,6 +21,6 @@ Failed to crop image Failed to compress image Task Cancelled - + Camera app not found diff --git a/imagepicker/src/main/res/xml/image_picker_provider_paths.xml b/imagepicker/src/main/res/xml/image_picker_provider_paths.xml index 25c7b21f..f531014d 100644 --- a/imagepicker/src/main/res/xml/image_picker_provider_paths.xml +++ b/imagepicker/src/main/res/xml/image_picker_provider_paths.xml @@ -6,4 +6,7 @@ + \ No newline at end of file diff --git a/sample/build.gradle b/sample/build.gradle index 88a09d5c..733e9e21 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -12,8 +12,8 @@ android { applicationId "com.github.dhaval2404.imagepicker.sample" minSdkVersion 19 targetSdkVersion 28 - versionCode 13 - versionName "1.7.5" + versionCode 14 + versionName "1.8" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true } diff --git a/sample/src/main/kotlin/com.github.dhaval2404.imagepicker/sample/MainActivity.kt b/sample/src/main/kotlin/com.github.dhaval2404.imagepicker/sample/MainActivity.kt index 60494da9..f7c31efa 100644 --- a/sample/src/main/kotlin/com.github.dhaval2404.imagepicker/sample/MainActivity.kt +++ b/sample/src/main/kotlin/com.github.dhaval2404.imagepicker/sample/MainActivity.kt @@ -11,14 +11,15 @@ import android.view.View import android.widget.Toast import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AppCompatActivity +import androidx.appcompat.app.AppCompatDelegate import com.github.dhaval2404.imagepicker.ImagePicker import com.github.dhaval2404.imagepicker.sample.util.FileUtil import com.github.dhaval2404.imagepicker.sample.util.IntentUtil +import java.io.File import kotlinx.android.synthetic.main.activity_main.* import kotlinx.android.synthetic.main.content_camera_only.* import kotlinx.android.synthetic.main.content_gallery_only.* import kotlinx.android.synthetic.main.content_profile.* -import java.io.File class MainActivity : AppCompatActivity() { @@ -36,6 +37,7 @@ class MainActivity : AppCompatActivity() { private var mProfileFile: File? = null override fun onCreate(savedInstanceState: Bundle?) { + AppCompatDelegate.setCompatVectorFromResourcesEnabled(true) super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) setSupportActionBar(toolbar) @@ -62,7 +64,10 @@ class MainActivity : AppCompatActivity() { // Crop Square image .cropSquare() .setImageProviderInterceptor { imageProvider -> // Intercept ImageProvider - Log.d("ImagePicker", "Selected ImageProvider: "+imageProvider.name) + Log.d("ImagePicker", "Selected ImageProvider: " + imageProvider.name) + } + .setDismissListener { + Log.d("ImagePicker", "Dialog Dismiss") } // Image resolution will be less than 512 x 512 .maxResultSize(512, 512) @@ -94,9 +99,9 @@ class MainActivity : AppCompatActivity() { .cameraOnly() // Image size will be less than 1024 KB .compress(1024) - .saveDir(Environment.getExternalStorageDirectory()) - // .saveDir(Environment.getExternalStorageDirectory().absolutePath+File.separator+"ImagePicker") - // .saveDir(getExternalFilesDir(null)!!) + .saveDir(File(Environment.getExternalStorageDirectory(), "ImagePicker")) + // .saveDir(File(cacheDir, "ImagePicker")) + // .saveDir(getExternalFilesDir("ImagePicker")!!) .start(CAMERA_IMAGE_REQ_CODE) } diff --git a/sample/src/main/res/layout/content_camera_only.xml b/sample/src/main/res/layout/content_camera_only.xml index f5c0c328..8f701dd8 100644 --- a/sample/src/main/res/layout/content_camera_only.xml +++ b/sample/src/main/res/layout/content_camera_only.xml @@ -12,43 +12,44 @@ tools:showIn="@layout/activity_main"> + android:layout_width="match_parent" + android:layout_height="match_parent"> + android:id="@+id/imgCameraCode" + style="@style/ImageButtonStyle" + android:layout_alignParentEnd="true" + android:onClick="showImageCode" + app:srcCompat="@drawable/outline_code_24" /> + android:id="@+id/imgCameraInfo" + style="@style/ImageButtonStyle" + android:layout_toStartOf="@id/imgCameraCode" + android:onClick="showImageInfo" + app:srcCompat="@drawable/outline_info_24" /> + android:id="@+id/txtCamera" + style="@style/TitleTextStyle" + android:layout_toStartOf="@id/imgCameraInfo" + android:text="@string/action_camera_only" /> + android:id="@+id/imgCamera" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_below="@id/txtCamera" + android:background="@color/grey_50" + android:onClick="showImage" + android:scaleType="centerCrop" /> + android:id="@+id/fab_add_camera_photo" + style="@style/FabStyle" + android:onClick="pickCameraImage" + app:srcCompat="@drawable/baseline_photo_camera_24" /> \ No newline at end of file diff --git a/sample/src/main/res/layout/content_gallery_only.xml b/sample/src/main/res/layout/content_gallery_only.xml index ad61c65f..f64e2e4f 100644 --- a/sample/src/main/res/layout/content_gallery_only.xml +++ b/sample/src/main/res/layout/content_gallery_only.xml @@ -1,54 +1,55 @@ + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="280dp" + android:layout_marginTop="24dp" + app:cardCornerRadius="12dp" + app:cardPreventCornerOverlap="false" + app:cardUseCompatPadding="true" + tools:context=".MainActivity" + tools:showIn="@layout/activity_main"> + android:layout_width="match_parent" + android:layout_height="match_parent"> + android:id="@+id/imgGalleryCode" + style="@style/ImageButtonStyle" + android:layout_alignParentEnd="true" + android:onClick="showImageCode" + app:srcCompat="@drawable/outline_code_24" /> + android:id="@+id/imgGalleryInfo" + style="@style/ImageButtonStyle" + android:layout_toStartOf="@id/imgGalleryCode" + android:onClick="showImageInfo" + app:srcCompat="@drawable/outline_info_24" /> + android:id="@+id/txtGallery" + style="@style/TitleTextStyle" + android:layout_toStartOf="@id/imgGalleryInfo" + android:text="@string/action_gallery_only" /> + android:id="@+id/imgGallery" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_below="@id/txtGallery" + android:background="@color/grey_50" + android:onClick="showImage" + android:scaleType="centerCrop" /> + android:id="@+id/fab_add_gallery_photo" + style="@style/FabStyle" + android:onClick="pickGalleryImage" + app:srcCompat="@drawable/baseline_photo_24" /> \ No newline at end of file diff --git a/sample/src/main/res/values/styles.xml b/sample/src/main/res/values/styles.xml index 65b5e343..f86cd93a 100644 --- a/sample/src/main/res/values/styles.xml +++ b/sample/src/main/res/values/styles.xml @@ -34,7 +34,6 @@