From 9afea87945e77abfe4a021724b290d46f9deaa5f Mon Sep 17 00:00:00 2001 From: Hernand Azevedo Date: Mon, 24 Aug 2020 11:28:15 -0300 Subject: [PATCH] :bug: Adds method to check if the activity have a server driven screen loaded (#800) Signed-off-by: Hernand Azevedo --- .../main/java/br/com/zup/beagle/android/view/BeagleActivity.kt | 2 ++ .../zup/beagle/sample/activities/SampleServerDrivenActivity.kt | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/android/beagle/src/main/java/br/com/zup/beagle/android/view/BeagleActivity.kt b/android/beagle/src/main/java/br/com/zup/beagle/android/view/BeagleActivity.kt index 50b683e1ed..6d82d6db90 100644 --- a/android/beagle/src/main/java/br/com/zup/beagle/android/view/BeagleActivity.kt +++ b/android/beagle/src/main/java/br/com/zup/beagle/android/view/BeagleActivity.kt @@ -158,6 +158,8 @@ abstract class BeagleActivity : AppCompatActivity() { } } + fun hasServerDrivenScreen(): Boolean = supportFragmentManager.backStackEntryCount > 0 + fun navigateTo(screenRequest: ScreenRequest, screen: Screen?) { fetch(screenRequest, screen?.toComponent()) } diff --git a/android/sample/src/main/java/br/com/zup/beagle/sample/activities/SampleServerDrivenActivity.kt b/android/sample/src/main/java/br/com/zup/beagle/sample/activities/SampleServerDrivenActivity.kt index edf121c16a..e6780bfe20 100644 --- a/android/sample/src/main/java/br/com/zup/beagle/sample/activities/SampleServerDrivenActivity.kt +++ b/android/sample/src/main/java/br/com/zup/beagle/sample/activities/SampleServerDrivenActivity.kt @@ -21,7 +21,6 @@ import android.view.View import android.widget.Button import android.widget.FrameLayout import android.widget.ProgressBar -import android.widget.Toast import androidx.appcompat.widget.Toolbar import br.com.zup.beagle.android.annotation.BeagleComponent import br.com.zup.beagle.android.view.BeagleActivity