From 615c7adc8691ece87702c04d8825e97cdb7050e9 Mon Sep 17 00:00:00 2001 From: Konrad Pozniak Date: Mon, 5 Dec 2022 19:15:58 +0100 Subject: [PATCH] hide "take photo" button when no Photo app is installed (#2997) --- .../keylesspalace/tusky/components/compose/ComposeActivity.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt b/app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt index 83531dc4..3a827e9b 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt @@ -30,6 +30,7 @@ import android.net.Uri import android.os.Build import android.os.Bundle import android.os.Parcelable +import android.provider.MediaStore import android.util.Log import android.view.KeyEvent import android.view.MenuItem @@ -511,6 +512,8 @@ class ComposeActivity : val pollIcon = IconicsDrawable(this, GoogleMaterial.Icon.gmd_poll).apply { colorInt = textColor; sizeDp = 18 } binding.addPollTextActionTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(pollIcon, null, null, null) + binding.actionPhotoTake.visible(Intent(MediaStore.ACTION_IMAGE_CAPTURE).resolveActivity(packageManager) != null) + binding.actionPhotoTake.setOnClickListener { initiateCameraApp() } binding.actionPhotoPick.setOnClickListener { onMediaPick() } binding.addPollTextActionTextView.setOnClickListener { openPollDialog() }