Skip to content

Commit

Permalink
capture image button added
Browse files Browse the repository at this point in the history
  • Loading branch information
sarkerrabi committed Feb 4, 2020
1 parent 38231c6 commit 0d99c8f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@ class MainActivity : AppCompatActivity(), View.OnClickListener {

private fun initViews() {
findViewById<Button>(R.id.btChooseImg).setOnClickListener(this)
findViewById<Button>(R.id.btCaptureImg).setOnClickListener(this)
imgView = findViewById<ImageView>(R.id.ivChooseImage)
resultView = findViewById<TextView>(R.id.tvResultMessage)
}

override fun onClick(v: View?) {
if (v?.id != R.id.btChooseImg) {
if (v?.id == R.id.btChooseImg) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) ==
PackageManager.PERMISSION_DENIED
Expand All @@ -59,7 +60,7 @@ class MainActivity : AppCompatActivity(), View.OnClickListener {
//system OS is < Marshmallow
pickImageFromGallery()
}
} else {
} else if (v?.id == R.id.btCaptureImg) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (checkSelfPermission(Manifest.permission.CAMERA) ==
PackageManager.PERMISSION_DENIED
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,19 @@
android:padding="@dimen/_5sdp"
app:srcCompat="@drawable/pick_image" />

<Button
android:id="@+id/btCaptureImg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/btChooseImg"
android:layout_centerHorizontal="true"
android:layout_marginBottom="@dimen/_10sdp"
android:background="@drawable/choose_image_bg"
android:paddingLeft="@dimen/_40sdp"
android:paddingRight="@dimen/_40sdp"
android:text="Capture IMAGE"
android:textColor="@android:color/white" />

<Button
android:id="@+id/btChooseImg"
android:layout_width="wrap_content"
Expand Down
2 changes: 1 addition & 1 deletion Malaria-Detection-App/app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
Expand Down

0 comments on commit 0d99c8f

Please sign in to comment.