-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a40fbae
commit 746a8f8
Showing
6 changed files
with
25 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 1 addition & 27 deletions
28
app/src/main/java/dev/ahrsoft/cameralibrary/MainActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<Intent> | ||
|
||
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) | ||
} | ||
} | ||
} | ||
} |