EvolveCameraX

Initial release

Screenshot_20211226-105603_EvolveCameraX
Screenshot_20211226-105612_EvolveCameraX

Install with Gradle

In you build.gradle app level.

dependencies {
	implementation 'com.github.saugatrai33:EvolveCameraX:$latest_version'
}

Then in you activity.

class MainActivity : AppCompatActivity() {

    private lateinit var image: ImageView

    private val evolveActivityResultLauncher: ActivityResultLauncher<Intent> =
        registerForActivityResult(
            ActivityResultContracts.StartActivityForResult()
        ) { result ->
            val photoUri: Uri? = result.data?.data
            if (photoUri != null) {
                // TODO:: work with image uri
            }
        }      .into(image)
        }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        image = findViewById(R.id.image)
        EvolveImagePicker.with(this)
            .start(evolveActivityResultLauncher)
    }
}

Start calling with

EvolveImagePicker
	.with(this)
        .start(evolveActivityResultLauncher)

Get the result as a uri

private val evolveActivityResultLauncher: ActivityResultLauncher<Intent> =
        registerForActivityResult(
            ActivityResultContracts.StartActivityForResult()
        ) { result ->
            val data = result.data!!.data
            Log.d("MainActivity::", "result: ${data.toString()}")
            Glide.with(this)
                .load(data)
                .apply(RequestOptions.centerCropTransform())
                .into(image)
        }

Requires two parameters: ‘context’ & ‘ActivityLauncher’

GitHub

View Github