<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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:id="@+id/rootView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:clipChildren="false">

    <FrameLayout
        android:id="@+id/dimWallpaper"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <de.mm20.launcher2.ui.legacy.view.BatteryChargingView
        android:id="@+id/batteryAnimationView"
        android:layout_width="48dp"
        android:layout_height="96dp"
        android:layout_gravity="bottom|center_horizontal" />

    <FrameLayout
        android:id="@+id/container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true">


        <androidx.core.widget.NestedScrollView
            android:id="@+id/scrollView"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:clipChildren="false"
            android:clipToPadding="false"
            android:scrollbars="none"
            tools:context=".activity.LauncherActivity">

            <LinearLayout
                android:id="@+id/scrollContainer"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:animateLayoutChanges="true"
                android:clipChildren="false"
                android:clipToPadding="false"
                android:orientation="vertical"
                android:paddingStart="8dp"
                android:paddingTop="56dp"
                android:paddingEnd="8dp"
                android:paddingBottom="8dp">

                <LinearLayout
                    android:id="@+id/searchContainer"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:animateLayoutChanges="true"
                    android:clipChildren="false"
                    android:clipToPadding="false"
                    android:orientation="vertical"
                    android:visibility="gone">

                    <View
                        android:id="@+id/webSearchViewSpacer"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:visibility="gone" />

                    <de.mm20.launcher2.ui.legacy.component.FavoritesView
                        android:id="@+id/favoritesView"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:visibility="gone" />

                    <de.mm20.launcher2.ui.legacy.component.ApplicationView
                        android:id="@+id/applicationView"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:visibility="gone" />

                    <de.mm20.launcher2.ui.legacy.component.CalculatorView
                        android:id="@+id/calculatorView"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:visibility="gone" />

                    <de.mm20.launcher2.ui.legacy.component.ContactView
                        android:id="@+id/contactView"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:visibility="gone" />

                    <de.mm20.launcher2.ui.legacy.component.CalendarView
                        android:id="@+id/calendarView"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:visibility="gone" />

                    <de.mm20.launcher2.ui.legacy.component.UnitConverterView
                        android:id="@+id/unitConverterView"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:visibility="gone" />

                    <de.mm20.launcher2.ui.legacy.component.FileView
                        android:id="@+id/fileView"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:visibility="gone" />

                    <de.mm20.launcher2.ui.legacy.component.WebsiteView
                        android:id="@+id/websiteView"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:visibility="gone" />

                    <de.mm20.launcher2.ui.legacy.component.WikipediaView
                        android:id="@+id/wikipediaView"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:visibility="gone" />
                </LinearLayout>


                <LinearLayout
                    android:id="@+id/widgetContainer"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:animateLayoutChanges="true"
                    android:clipChildren="false"
                    android:clipToPadding="false"
                    android:orientation="vertical">

                    <de.mm20.launcher2.view.ElevationImageView
                        android:id="@+id/widgetSpacer"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:elevation="@dimen/card_elevation"
                        android:src="@drawable/ic_arrow_up"
                        android:tint="#fff" />

                    <de.mm20.launcher2.ui.legacy.widget.SmartWidget
                        android:id="@+id/smartWidget"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="8dp" />

                    <com.jmedeisis.draglinearlayout.DragLinearLayout
                        android:animateLayoutChanges="true"
                        android:id="@+id/widgetList"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:clipChildren="false"
                        android:clipToPadding="false"
                        android:orientation="vertical">

                        <!-- Widgets will be added here -->

                    </com.jmedeisis.draglinearlayout.DragLinearLayout>

                    <com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
                        android:id="@+id/fabEditWidget"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center_horizontal"
                        android:layout_marginTop="8dp"
                        android:layout_marginBottom="16dp"
                        android:text="@string/menu_edit_widgets"
                        android:textColor="@color/text_color_primary"
                        app:backgroundTint="?colorSurface"
                        app:icon="@drawable/ic_edit"
                        app:iconTint="@color/text_color_primary" />

                </LinearLayout>
            </LinearLayout>
        </androidx.core.widget.NestedScrollView>

        <de.mm20.launcher2.ui.legacy.component.SearchBar
            android:id="@+id/searchBar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="8dp"
            android:descendantFocusability="beforeDescendants"
            android:focusableInTouchMode="true"
            app:cardElevation="@dimen/card_elevation" />

        <com.google.android.material.appbar.MaterialToolbar
            android:id="@+id/editWidgetToolbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="?colorSurface"
            android:elevation="4dp"
            android:translationY="-56dp"
            android:visibility="gone"
            app:title="@string/menu_edit_widgets" />
    </FrameLayout>

    <View
        android:id="@+id/activityStartOverlay"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="center"
        android:background="@color/cardview_background"
        android:visibility="invisible" />

</FrameLayout>