Skip to content

Commit

Permalink
Merge pull request #10603 from woocommerce/fix/10563-duplicated-toolbar
Browse files Browse the repository at this point in the history
Avoid displaying my store expanded toolbar on campaign preview screen
  • Loading branch information
0nko authored Jan 24, 2024
2 parents 31b91c4 + 6dadcd8 commit a8c552e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ import com.woocommerce.android.ui.appwidgets.WidgetUpdater
import com.woocommerce.android.ui.base.BaseFragment
import com.woocommerce.android.ui.base.TopLevelFragment
import com.woocommerce.android.ui.base.UIMessageResolver
import com.woocommerce.android.ui.blaze.creation.preview.BlazeCampaignCreationPreviewFragment
import com.woocommerce.android.ui.compose.theme.WooThemeWithBackground
import com.woocommerce.android.ui.feedback.SurveyType
import com.woocommerce.android.ui.login.LoginActivity
Expand Down Expand Up @@ -206,9 +207,12 @@ class MainActivity :
override fun onFragmentViewCreated(fm: FragmentManager, f: Fragment, v: View, savedInstanceState: Bundle?) {
if (f is DialogFragment) return

if (f is BlazeCampaignCreationPreviewFragment) // Context on why this is needed check GH issue #10563
animatorHelper.cancelToolbarAnimation()

when (val appBarStatus = (f as? BaseFragment)?.activityAppBarStatus ?: AppBarStatus.Visible()) {
is AppBarStatus.Visible -> {
showToolbar(f is TopLevelFragment)
showToolbar(animate = f is TopLevelFragment)
// re-expand the AppBar when returning to top level fragment,
// collapse it when entering a child fragment
if (f is TopLevelFragment) {
Expand Down Expand Up @@ -327,6 +331,7 @@ class MainActivity :
}
)
}

override fun hideProgressDialog() {
progressDialog?.apply {
if (isShowing) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ class MainAnimatorHelper @Inject constructor(private val resourceProvider: Resou
}
}

fun cancelToolbarAnimation() {
toolbarAnimator.cancel()
}

private companion object {
private const val COLLAPSING_ANIMATION_DURATION = 200L
private const val TOOLBAR_ANIMATION_DURATION = 300L
Expand Down

0 comments on commit a8c552e

Please sign in to comment.