<?xml version="1.0" encoding="utf-8"?>

 <!-- Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net)

      Licensed under the Apache License, Version 2.0 (the "License");
      you may not use this file except in compliance with the License.
      You may obtain a copy of the License at

           http://www.apache.org/licenses/LICENSE-2.0

      Unless required by applicable law or agreed to in writing, software
      distributed under the License is distributed on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      See the License for the specific language governing permissions and
      limitations under the License.
 -->

 <!-- DrawerLayout：支持侧栏滑动 -->
<androidx.drawerlayout.widget.DrawerLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     android:id="@+id/drawer_layout"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:background="@drawable/list_background">

     <!-- 主内容区域 -->
     <androidx.coordinatorlayout.widget.CoordinatorLayout
         android:layout_width="match_parent"
         android:layout_height="match_parent">

         <!-- AppBarLayout：替代传统 ActionBar -->
         <com.google.android.material.appbar.AppBarLayout
             android:id="@+id/appbar"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:theme="@style/ThemeOverlay.Material3.ActionBar">

             <!-- Toolbar：现代替代 ActionBar 的标准组件，带汉堡菜单按钮 -->
             <com.google.android.material.appbar.MaterialToolbar
                 android:id="@+id/toolbar"
                 android:layout_width="match_parent"
                 android:layout_height="?attr/actionBarSize"
                 app:title="@string/app_name"
                 app:navigationIcon="@android:drawable/ic_menu_sort_by_size"
                 app:layout_scrollFlags="scroll|enterAlways|snap" />

       </com.google.android.material.appbar.AppBarLayout>

           <!-- 便签列表：使用 NestedScrollView 包裹 ListView 以支持滚动 -->
          <androidx.core.widget.NestedScrollView
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:fillViewport="true"
              app:layout_behavior="@string/appbar_scrolling_view_behavior">

              <LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:orientation="vertical">

                  <!-- 面包屑导航：显示当前文件夹路径（在列表上方） -->
                  <include layout="@layout/breadcrumb_layout" />

                  <!-- 便签列表 -->
                  <ListView
                      android:id="@+id/notes_list"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:minHeight="200dp"
                      android:cacheColorHint="@null"
                      android:listSelector="@android:color/transparent"
                      android:divider="@null"
                      android:fadingEdge="@null" />

              </LinearLayout>

          </androidx.core.widget.NestedScrollView>

         <!-- 悬浮按钮：替代原来的底部按钮 -->
         <com.google.android.material.floatingactionbutton.FloatingActionButton
             android:id="@+id/btn_new_note"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_gravity="bottom|end"
             android:layout_margin="16dp"
             android:contentDescription="@string/notelist_menu_new"
             app:srcCompat="@android:drawable/ic_input_add" />

     </androidx.coordinatorlayout.widget.CoordinatorLayout>

     <!-- 侧栏 -->
     <fragment
         android:id="@+id/sidebar_fragment"
         android:name="net.micode.notes.ui.SidebarFragment"
         android:layout_width="280dp"
         android:layout_height="match_parent"
         android:layout_gravity="start"
         android:tag="sidebar" />

</androidx.drawerlayout.widget.DrawerLayout>
