diff --git a/app/.gitignore b/app/.gitignore index 42afabf..b7ed7f2 100644 --- a/app/.gitignore +++ b/app/.gitignore @@ -1 +1,18 @@ -/build \ No newline at end of file +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +/.idea/deploymentTargetDropDown.xml +/.idea/gradle.xml +/.idea/misc.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties \ No newline at end of file diff --git a/navi-alfred/build.gradle b/navi-alfred/build.gradle index aa25cf3..c6984da 100644 --- a/navi-alfred/build.gradle +++ b/navi-alfred/build.gradle @@ -5,7 +5,7 @@ plugins { id 'maven-publish' } -def VERSION_NAME = "v1.0.1" +def VERSION_NAME = "v1.0.2" android { namespace 'com.navi.alfred' diff --git a/navi-alfred/src/main/java/com/navi/alfred/AlfredManager.kt b/navi-alfred/src/main/java/com/navi/alfred/AlfredManager.kt index 0bbf514..b1edec1 100644 --- a/navi-alfred/src/main/java/com/navi/alfred/AlfredManager.kt +++ b/navi-alfred/src/main/java/com/navi/alfred/AlfredManager.kt @@ -7,7 +7,6 @@ package com.navi.alfred -import android.annotation.SuppressLint import android.app.Dialog import android.content.Context import android.graphics.Bitmap @@ -80,8 +79,8 @@ import java.util.UUID import java.util.concurrent.Executors import kotlin.concurrent.fixedRateTimer import java.lang.Long.min +import java.lang.ref.WeakReference -@SuppressLint("StaticFieldLeak") object AlfredManager { lateinit var config: AlfredConfig @@ -102,7 +101,7 @@ object AlfredManager { private var isAppInBackground: Boolean = false private var hasRecordingStarted: Boolean = false var dialog: Dialog? = null - var cosmosBottomSheet: View? = null + private var reactBottomSheetView: WeakReference? = null private var timer: Timer? = null private var screenShotTimer: Timer? = null private var viewLayoutDelay: Long = 1000 @@ -172,9 +171,12 @@ object AlfredManager { bmpForCanvas = createBitmapForView(view) } try { - if (dialog != null || cosmosBottomSheet != null) { + val bottomSheetView = reactBottomSheetView?.get() + ?: dialog?.window?.decorView?.rootView + if (bottomSheetView != null) { captureBottomSheet( view, + bottomSheetView, context, currentScreenName, bmpForCanvas?.first, @@ -231,6 +233,7 @@ object AlfredManager { private suspend fun captureBottomSheet( view: View, + bottomSheetView: View, context: Context, screenName: String? = null, rootCanvas: Canvas? = null, @@ -240,11 +243,6 @@ object AlfredManager { if (config.getDisableDialogScreenShot()) { return } - val bottomSheetView = if (cosmosBottomSheet != null) { - cosmosBottomSheet - } else { - dialog?.window?.decorView?.rootView - } if (bottomSheetView != null) { val bottomSheetCanvasForBitmap = createBitmapForView(bottomSheetView) val bottomSheetScreenShot = @@ -282,6 +280,14 @@ object AlfredManager { } } + fun setBottomSheetView(view: View) { + reactBottomSheetView = WeakReference(view) + } + + fun clearBottomSheetView() { + reactBottomSheetView?.clear() + } + private fun checkDbBeforeStartRecording() { coroutineScope.launch(Dispatchers.IO) { if (screenShotDao.getScreenShotCount() > 0) {