diff --git a/EasyCameraAndGallery/src/main/java/dev/ahrsoft/easycameraandgallery/CameraActivity.kt b/EasyCameraAndGallery/src/main/java/dev/ahrsoft/easycameraandgallery/CameraActivity.kt index 699b8cf..782d16e 100644 --- a/EasyCameraAndGallery/src/main/java/dev/ahrsoft/easycameraandgallery/CameraActivity.kt +++ b/EasyCameraAndGallery/src/main/java/dev/ahrsoft/easycameraandgallery/CameraActivity.kt @@ -89,10 +89,10 @@ class CameraActivity : AppCompatActivity() { flashModeOptions(optionsCamera.flash) with(binding) { - galleryCaptureButton.setOnClickListener { + galleryCaptureButtonCamera.setOnClickListener { getPickImageIntent() } - cameraCaptureButton.setOnClickListener { + cameraCaptureButtonCamera.setOnClickListener { takePhoto() } ibFrontCamera.setOnClickListener { @@ -241,12 +241,12 @@ class CameraActivity : AppCompatActivity() { private fun hideUI(isCompleteSelect : Boolean){ if (isCompleteSelect){ binding.fabSendData.visibility = View.VISIBLE - binding.cameraCaptureButton.visibility = View.GONE - binding.galleryCaptureButton.visibility = View.GONE + binding.cameraCaptureButtonCamera.visibility = View.GONE + binding.galleryCaptureButtonCamera.visibility = View.GONE }else{ binding.fabSendData.visibility = View.GONE - binding.cameraCaptureButton.visibility = View.VISIBLE - binding.galleryCaptureButton.visibility = View.VISIBLE + binding.cameraCaptureButtonCamera.visibility = View.VISIBLE + binding.galleryCaptureButtonCamera.visibility = View.VISIBLE } } @@ -272,8 +272,8 @@ class CameraActivity : AppCompatActivity() { private fun setImageList(){ adapter = GalleryAdapter(this,imageList) - binding.rvGallery.layoutManager = LinearLayoutManager(this,LinearLayoutManager.HORIZONTAL, false) - binding.rvGallery.adapter = adapter + binding.rvGalleryCamera.layoutManager = LinearLayoutManager(this,LinearLayoutManager.HORIZONTAL, false) + binding.rvGalleryCamera.adapter = adapter adapter.setOnItemClickListener(object : GalleryAdapter.OnItemClickListener{ override fun onItemClick(position: Int) { val imageModel = imageList[position] @@ -530,7 +530,7 @@ class CameraActivity : AppCompatActivity() { try { cameraProvider.bindToLifecycle(this, cameraSelector, preview, imageCapture) - preview?.setSurfaceProvider(binding.viewFinder.surfaceProvider) + preview?.setSurfaceProvider(binding.viewFinderCamera.surfaceProvider) } catch (exc: Exception) { throw Exception("Use case fallo", exc) } diff --git a/EasyCameraAndGallery/src/main/java/dev/ahrsoft/easycameraandgallery/gallery/GalleryAdapter.kt b/EasyCameraAndGallery/src/main/java/dev/ahrsoft/easycameraandgallery/gallery/GalleryAdapter.kt index e842160..e68b9dd 100644 --- a/EasyCameraAndGallery/src/main/java/dev/ahrsoft/easycameraandgallery/gallery/GalleryAdapter.kt +++ b/EasyCameraAndGallery/src/main/java/dev/ahrsoft/easycameraandgallery/gallery/GalleryAdapter.kt @@ -14,8 +14,8 @@ class GalleryAdapter(private val context : Context, private val imageList : List with(binding){ Glide.with(context) .load(imageModel.image) - .into(image) - checkBox.isChecked = imageModel.isSelected + .into(imagePickerCamera) + checkBoxPickerCamera.isChecked = imageModel.isSelected } } } diff --git a/EasyCameraAndGallery/src/main/res/layout/activity_camera.xml b/EasyCameraAndGallery/src/main/res/layout/activity_camera.xml index 60ee719..64174fe 100644 --- a/EasyCameraAndGallery/src/main/res/layout/activity_camera.xml +++ b/EasyCameraAndGallery/src/main/res/layout/activity_camera.xml @@ -39,7 +39,7 @@ android:layout_marginEnd="16dp" android:layout_marginBottom="16dp" android:clickable="true" - app:layout_constraintBottom_toTopOf="@+id/rv.gallery" + app:layout_constraintBottom_toTopOf="@+id/rv.gallery.camera" app:layout_constraintEnd_toEndOf="parent" app:srcCompat="@drawable/ic_baseline_check_24" android:focusable="true" @@ -47,7 +47,7 @@ + app:layout_constraintTop_toTopOf="@+id/camera.capture.button.camera" /> + app:layout_constraintTop_toTopOf="@+id/imagePickerCamera" + app:layout_constraintEnd_toEndOf="@id/imagePickerCamera"/> \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 0c77c2a..8b34ac6 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -40,7 +40,6 @@ dependencies { implementation 'androidx.appcompat:appcompat:1.3.0' implementation 'com.google.android.material:material:1.4.0' implementation 'androidx.constraintlayout:constraintlayout:2.0.4' - implementation project(path: ':EasyCameraAndGallery') testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' diff --git a/app/src/main/java/dev/ahrsoft/cameralibrary/MainActivity.kt b/app/src/main/java/dev/ahrsoft/cameralibrary/MainActivity.kt index 6a8400f..bfe77fb 100644 --- a/app/src/main/java/dev/ahrsoft/cameralibrary/MainActivity.kt +++ b/app/src/main/java/dev/ahrsoft/cameralibrary/MainActivity.kt @@ -1,43 +1,17 @@ package dev.ahrsoft.cameralibrary -import android.app.Activity -import android.content.Intent + import androidx.appcompat.app.AppCompatActivity import android.os.Bundle -import androidx.activity.result.ActivityResultLauncher import dev.ahrsoft.cameralibrary.databinding.ActivityMainBinding -import dev.ahrsoft.easycameraandgallery.* class MainActivity : AppCompatActivity() { lateinit var binding: ActivityMainBinding - private lateinit var resultScan: ActivityResultLauncher override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) binding = ActivityMainBinding.inflate(layoutInflater) setContentView(binding.root) - initCall() - - val optionsCamera = OptionsCamera( - ratio = Ratio.RATIO_16_9, - path = "Evidences", - flash = Flash.Off, - count = 2 - ) - - binding.textInput.setOnClickListener { - EasyCamera.start(this, optionsCamera = optionsCamera, resultScan = resultScan) - } - } - - private fun initCall() { - resultScan = registerForActivityResult(androidx.activity.result.contract. - ActivityResultContracts.StartActivityForResult()) { result -> - if (result.resultCode == Activity.RESULT_OK) { - val list = result.data?.getStringArrayListExtra(EasyCamera.IMAGE_RESULTS) - print(list) - } - } } } \ No newline at end of file