В чём ошибка? 2024-11-06 13:27:36.426 14248-14248 AndroidRuntime          today.maxi.mobile.dev                E  FATAL EXCEPTION: main
                                                                                                    Process: today.maxi.mobile.dev, PID: 14248
                                                                                                    java.lang.IllegalArgumentException: width and height must be > 0
                                                                                                    	at android.graphics.Bitmap.createBitmap(Bitmap.java:1257)
                                                                                                    	at android.graphics.Bitmap.createBitmap(Bitmap.java:1224)
                                                                                                    	at android.graphics.Bitmap.createBitmap(Bitmap.java:1174)
                                                                                                    	at android.graphics.Bitmap.createBitmap(Bitmap.java:1135)
                                                                                                    	at androidx.core.graphics.drawable.DrawableKt.toBitmap(Drawable.kt:68)
                                                                                                    	at androidx.core.graphics.drawable.DrawableKt.toBitmap$default(Drawable.kt:46)
                                                                                                    	at ru.maxi.mobile.base.ui.MvvmBaseFragment$BackgroundObserver.setupToolbarBlur(MvvmBaseFragment.kt:197)
                                                                                                    	at ru.maxi.mobile.base.ui.MvvmBaseFragment$BackgroundObserver.onBackgroundReady(MvvmBaseFragment.kt:184)
                                                                                                    	at ru.maxi.mobile.base.ui.MvvmBaseFragment$BackgroundObserver.access$onBackgroundReady(MvvmBaseFragment.kt:128)
                                                                                                    	at ru.maxi.mobile.base.ui.MvvmBaseFragment$BackgroundObserver$setBackground$1$invokeSuspend$lambda$2$lambda$1$$inlined$doOnNextLayout$1.onLayoutChange(View.kt:415)
                                                                                                    	at android.view.View.layout(View.java:22149)
                                                                                                    	at android.view.ViewGroup.layout(ViewGroup.java:6438)
                                                                                                    	at android.widget.FrameLayout.layoutChildren(FrameLayout.java:334)
                                                                                                    	at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
                                                                                                    	at android.view.View.layout(View.java:22131)
                                                                                                    	at android.view.ViewGroup.layout(ViewGroup.java:6438)
                                                                                                    	at android.widget.FrameLayout.layoutChildren(FrameLayout.java:334)
                                                                                                    	at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
                                                                                                    	at android.view.View.layout(View.java:22131)
                                                                                                    	at android.view.ViewGroup.layout(ViewGroup.java:6438)
                                                                                                    	at android.widget.FrameLayout.layoutChildren(FrameLayout.java:334)
                                                                                                    	at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
                                                                                                    	at android.view.View.layout(View.java:22131)
                                                                                                    	at android.view.ViewGroup.layout(ViewGroup.java:6438)
                                                                                                    	at com.google.android.material.appbar.HeaderScrollingViewBehavior.layoutChild(HeaderScrollingViewBehavior.java:149)
                                                                                                    	at com.google.android.material.appbar.ViewOffsetBehavior.onLayoutChild(ViewOffsetBehavior.java:43)
                                                                                                    	at com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior.onLayoutChild(AppBarLayout.java:2365)
                                                                                                    	at androidx.coordinatorlayout.widget.CoordinatorLayout.onLayout(CoordinatorLayout.java:953)
                                                                                                    	at android.view.View.layout(View.java:22131)
                                                                                                    	at android.view.ViewGroup.layout(ViewGroup.java:6438)
                                                                                                    	at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1857)
                                                                                                    	at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1701)
                                                                                                    	at android.widget.LinearLayout.onLayout(LinearLayout.java:1610)
                                                                                                    	at android.view.View.layout(View.java:22131)
                                                                                                    	at android.view.ViewGroup.layout(ViewGroup.java:6438)
                                                                                                    	at android.widget.FrameLayout.layoutChildren(FrameLayout.java:334)
                                                                                                    	at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
                                                                                                    	at android.view.View.layout(View.java:22131)
                                                                                                    	at android.view.ViewGroup.layout(ViewGroup.java:6438)
                                                                                                    	at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1857)
                                                                                                    	at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1701)
                                                                                                    	at android.widget.LinearLayout.onLayout(LinearLayout.java:1610)
                                                                                                    	at android.view.View.layout(View.java:22131)
                                                                                                    	at android.view.ViewGroup.layout(ViewGroup.java:6438)
                                                                                                    	at android.widget.FrameLayout.layoutChildren(FrameLayout.java:334)
                                                                                                    	at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
                                                                                                    	at android.view.View.layout(View.java:22131)
                                                                                                    	at android.view.ViewGroup.layout(ViewGroup.java:6438)
                                                                                                    	at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1857)
                                                                                                    	at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1701)
                                                                                                    	at android.widget.LinearLayout.onLayout(LinearLayout.java:1610)
                                                                                                    	at android.view.View.layout(View.java:22131)
                                                                                                    	at android.view.ViewGroup.layout(ViewGroup.java:6438)
                                                                                                    	at android.widget.FrameLayout.layoutChildren(FrameLayout.java:334)
                                                                                                    	at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
                                                                                                    	at com.android.internal.policy.DecorView.onLayout(DecorView.java:978)
                                                                                                    	at android.view.View.layout(View.java:22131)
                                                                                                    	at android.view.ViewGroup.layout(ViewGroup.java:6438)<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:background="@drawable/bg_achievements"
    android:orientation="vertical"
    android:theme="@style/ThemeOverlay.Achievements">

    <FrameLayout
        android:id="@+id/toolbar_blur_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:foreground="@color/advent_calendar_toolbar_tint"
        tools:layout_height="?attr/actionBarSize" />

    <ru.maxi.mobile.uikit.components.toggleGroup.ButtonToggleGroup
        android:id="@+id/tabs_button_container"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginHorizontal="@dimen/std_margin"
        android:layout_marginTop="@dimen/std_margin"
        android:layout_marginBottom="@dimen/std_half_margin">

        <Button
            android:id="@+id/balance_tab"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/chips_balance_tab_title" />

        <Button
            android:id="@+id/info_tab"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/chips_info_tab_title" />

    </ru.maxi.mobile.uikit.components.toggleGroup.ButtonToggleGroup>

    <Button
        android:id="@+id/info_dsasa"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginHorizontal="16dp"
        android:text="Активировать промокод" />

    <Button
        android:id="@+id/info_dsa"
        style="?attr/materialButtonOutlinedStyle"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="16dp"
        android:text="Закрыть" />


    <!--<androidx.viewpager2.widget.ViewPager2-->
    <!--    android:id="@+id/tabs_container"-->
    <!--    android:layout_width="match_parent"-->
    <!--    android:layout_height="0dp"-->
    <!--    android:layout_weight="1" />-->

    <ru.maxi.mobile.uikit.components.noDataView.NoDataView
        android:id="@+id/no_data_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:theme="@style/ThemeOverlay.Achievements.NoDataView"
        android:visibility="gone"
        app:description="Не удалось получить данные. Попробуйте позже"
        app:image="@drawable/ic_empty_cart"
        app:title="Что-то пошло не так" />


    <ru.maxi.mobile.uikit.components.noConnectionView.NoConnectionView
        android:id="@+id/no_connection_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:theme="@style/ThemeOverlay.Achievements.NoConnectionView"
        android:visibility="gone" />

    <ru.maxi.mobile.uikit.components.loaderWithBackground.LoaderWithBackground
        android:id="@+id/loader_view"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_marginTop="140dp"
        android:theme="@style/ThemeOverlay.Achievements.LoaderWithBackground"
        android:visibility="visible" />


</LinearLayout>package ru.maxi.mobile.feature.achievements.container

import android.os.Bundle
import android.view.View
import by.kirich1409.viewbindingdelegate.viewBinding
import dagger.hilt.android.AndroidEntryPoint
import ru.maxi.mobile.R
import ru.maxi.mobile.base.ui.MvvmBaseFragment
import ru.maxi.mobile.common.utils.android.screenArgs
import ru.maxi.mobile.databinding.FragmentAchievementsContainerBinding
import ru.maxi.mobile.feature.achievements.AchievementsScreens
import ru.maxi.mobile.uikit.utils.lifecycleAwareLazy

/**
 * [Fragment] контейнера экранов достижений
 */
@AndroidEntryPoint
class AchievementsContainerFragment : MvvmBaseFragment(R.layout.fragment_achievements_container) {

    private val screenArgs by screenArgs(AchievementsContainerArgs)

    private val viewBinding by viewBinding(FragmentAchievementsContainerBinding::bind)

    override val analyticsName: String? = null

    private val backgroundObserver by lifecycleAwareLazy {
        BackgroundObserver(
            bgSource = BackgroundSource.FromDrawable(R.drawable.bg_achievements),
            hideToolbar = false,
            toolbarBlurView = viewBinding.toolbarBlurView,
        )
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        actionBarManager.setTitle(R.string.achievements_screen_title)
        actionBarManager.showBackButton()

        if (screenArgs.achievementId != null) {
            val initialTabScreen = when (screenArgs.initialTab) {
                AchievementsScreens.ContainerTab.IN_PROGRESS_TAB -> "IN_PROGRESS_TAB"
                AchievementsScreens.ContainerTab.RECEIVED_TAB -> "RECEIVED_TAB"
            }
            // viewBinding.text.text = "$initialTabScreen with id = ${screenArgs.achievementId}"
        } else {
            val screen = when (screenArgs.initialTab) {
                AchievementsScreens.ContainerTab.IN_PROGRESS_TAB -> "IN_PROGRESS_TAB"
                AchievementsScreens.ContainerTab.RECEIVED_TAB -> "RECEIVED_TAB"
            }
            // viewBinding.text.text = "$screen"
        }
        backgroundObserver.attachTo(viewLifecycleOwner)


    }