Merge branch 'lineage-21.0' of https://github.com/LineageOS/android_packages_apps_Glimpse into leaf-3.2

Change-Id: I103e5121a5ebc37706ed5132f29ee4c670cca5c5
diff --git a/app/Android.bp b/app/Android.bp
index 816036b..bd12b79 100644
--- a/app/Android.bp
+++ b/app/Android.bp
@@ -23,13 +23,14 @@
 
     overrides: [
         "Gallery",
-        "Gallery2",
         "Gallery3D",
         "GalleryNew3D",
     ],
 
     required: [
         "GlimpseFrameworksBaseOverlay",
+        "initial-package-stopped-states-org.leafos.glimpse",
+        "preinstalled-packages-org.leafos.glimpse",
     ],
 
     static_libs: [
@@ -65,3 +66,19 @@
         "org.leafos.glimpse",
     ],
 }
+
+prebuilt_etc {
+    name: "initial-package-stopped-states-org.leafos.glimpse",
+    product_specific: true,
+    sub_dir: "sysconfig",
+    src: "initial-package-stopped-states-org.leafos.glimpse.xml",
+    filename_from_src: true,
+}
+
+prebuilt_etc {
+    name: "preinstalled-packages-org.leafos.glimpse",
+    product_specific: true,
+    sub_dir: "sysconfig",
+    src: "preinstalled-packages-org.leafos.glimpse.xml",
+    filename_from_src: true,
+}
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index 30686ae..4ab7d1c 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -68,6 +68,10 @@
     kotlinOptions {
         jvmTarget = "1.8"
     }
+
+    lint {
+        lintConfig = file("lint.xml")
+    }
 }
 
 dependencies {
diff --git a/app/initial-package-stopped-states-org.leafos.glimpse.xml b/app/initial-package-stopped-states-org.leafos.glimpse.xml
new file mode 100644
index 0000000..707c0c6
--- /dev/null
+++ b/app/initial-package-stopped-states-org.leafos.glimpse.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     SPDX-FileCopyrightText: 2024 The LineageOS Project
+     SPDX-License-Identifier: Apache-2.0
+-->
+<config>
+    <initial-package-state package="org.leafos.glimpse" stopped="false"/>
+</config>
diff --git a/app/lint.xml b/app/lint.xml
new file mode 100644
index 0000000..a18d665
--- /dev/null
+++ b/app/lint.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+     SPDX-FileCopyrightText: 2024 The LineageOS Project
+     SPDX-License-Identifier: Apache-2.0
+-->
+<lint>
+    <issue id="MissingTranslation" severity="ignore" />
+</lint>
diff --git a/app/preinstalled-packages-org.leafos.glimpse.xml b/app/preinstalled-packages-org.leafos.glimpse.xml
new file mode 100644
index 0000000..76b7f3d
--- /dev/null
+++ b/app/preinstalled-packages-org.leafos.glimpse.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     SPDX-FileCopyrightText: 2024 The LineageOS Project
+     SPDX-License-Identifier: Apache-2.0
+-->
+<config>
+    <install-in-user-type package="org.leafos.glimpse">
+        <install-in user-type="FULL" />
+        <install-in user-type="PROFILE" />
+        <do-not-install-in user-type="android.os.usertype.profile.CLONE" />
+        <do-not-install-in user-type="android.os.usertype.profile.PRIVATE" />
+    </install-in-user-type>
+</config>
diff --git a/app/src/main/java/org/lineageos/glimpse/fragments/SearchFragment.kt b/app/src/main/java/org/lineageos/glimpse/fragments/LibraryFragment.kt
similarity index 83%
rename from app/src/main/java/org/lineageos/glimpse/fragments/SearchFragment.kt
rename to app/src/main/java/org/lineageos/glimpse/fragments/LibraryFragment.kt
index 327a756..ba9f58f 100644
--- a/app/src/main/java/org/lineageos/glimpse/fragments/SearchFragment.kt
+++ b/app/src/main/java/org/lineageos/glimpse/fragments/LibraryFragment.kt
@@ -16,7 +16,6 @@
 import androidx.fragment.app.Fragment
 import androidx.navigation.fragment.findNavController
 import com.google.android.material.appbar.AppBarLayout
-import com.google.android.material.search.SearchBar
 import com.google.android.material.shape.MaterialShapeDrawable
 import org.lineageos.glimpse.R
 import org.lineageos.glimpse.ext.getViewProperty
@@ -25,16 +24,15 @@
 
 /**
  * A fragment showing a search bar with categories.
- * Use the [SearchFragment.newInstance] factory method to
+ * Use the [LibraryFragment.newInstance] factory method to
  * create an instance of this fragment.
  */
-class SearchFragment : Fragment(R.layout.fragment_search) {
+class LibraryFragment : Fragment(R.layout.fragment_library) {
     // Views
     private val appBarLayout by getViewProperty<AppBarLayout>(R.id.appBarLayout)
     private val favoritesAlbumListItem by getViewProperty<ListItem>(R.id.favoritesAlbumListItem)
     private val photosAlbumListItem by getViewProperty<ListItem>(R.id.photosAlbumListItem)
-    private val searchNestedScrollView by getViewProperty<NestedScrollView>(R.id.searchNestedScrollView)
-    private val searchBar by getViewProperty<SearchBar>(R.id.searchBar)
+    private val libraryNestedScrollView by getViewProperty<NestedScrollView>(R.id.libraryNestedScrollView)
     private val trashAlbumListItem by getViewProperty<ListItem>(R.id.trashAlbumListItem)
     private val videosAlbumListItem by getViewProperty<ListItem>(R.id.videosAlbumListItem)
 
@@ -55,12 +53,7 @@
                 WindowInsetsCompat.Type.systemBars() or WindowInsetsCompat.Type.displayCutout()
             )
 
-            searchBar.updateLayoutParams<ViewGroup.MarginLayoutParams> {
-                leftMargin = insets.left
-                rightMargin = insets.right
-            }
-
-            searchNestedScrollView.updateLayoutParams<ViewGroup.MarginLayoutParams> {
+            libraryNestedScrollView.updateLayoutParams<ViewGroup.MarginLayoutParams> {
                 leftMargin = insets.left
                 rightMargin = insets.right
             }
@@ -103,7 +96,7 @@
          *
          * @return A new instance of fragment SearchFragment.
          */
-        fun newInstance() = SearchFragment().apply {
+        fun newInstance() = LibraryFragment().apply {
             arguments = createBundle()
         }
     }
diff --git a/app/src/main/res/drawable/ic_library.xml b/app/src/main/res/drawable/ic_library.xml
new file mode 100644
index 0000000..836d2e0
--- /dev/null
+++ b/app/src/main/res/drawable/ic_library.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     SPDX-FileCopyrightText: Material Design Authors / Google LLC
+     SPDX-License-Identifier: Apache-2.0
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="24dp"
+    android:height="24dp"
+    android:viewportWidth="960"
+    android:viewportHeight="960"
+    android:tint="?attr/colorControlNormal">
+  <path
+      android:fillColor="@android:color/white"
+      android:pathData="M320,640L800,640Q800,640 800,640Q800,640 800,640L800,160Q800,160 800,160Q800,160 800,160L720,160L720,440L620,380L520,440L520,160L320,160Q320,160 320,160Q320,160 320,160L320,640Q320,640 320,640Q320,640 320,640ZM320,720Q287,720 263.5,696.5Q240,673 240,640L240,160Q240,127 263.5,103.5Q287,80 320,80L800,80Q833,80 856.5,103.5Q880,127 880,160L880,640Q880,673 856.5,696.5Q833,720 800,720L320,720ZM160,880Q127,880 103.5,856.5Q80,833 80,800L80,240L160,240L160,800Q160,800 160,800Q160,800 160,800L720,800L720,880L160,880ZM520,160L520,160L620,160L720,160L720,160L520,160ZM320,160Q320,160 320,160Q320,160 320,160L320,160Q320,160 320,160Q320,160 320,160L520,160L520,160L620,160L720,160L720,160L800,160Q800,160 800,160Q800,160 800,160L800,160Q800,160 800,160Q800,160 800,160L320,160Z"/>
+</vector>
diff --git a/app/src/main/res/drawable/ic_search.xml b/app/src/main/res/drawable/ic_search.xml
deleted file mode 100644
index aa8f844..0000000
--- a/app/src/main/res/drawable/ic_search.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-     SPDX-FileCopyrightText: Material Design Authors / Google LLC
-     SPDX-License-Identifier: Apache-2.0
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
-    android:width="24dp"
-    android:height="24dp"
-    android:tint="#000000"
-    android:viewportWidth="24"
-    android:viewportHeight="24">
-    <path
-        android:fillColor="@android:color/white"
-        android:pathData="M15.5,14h-0.79l-0.28,-0.27C15.41,12.59 16,11.11 16,9.5 16,5.91 13.09,3 9.5,3S3,5.91 3,9.5 5.91,16 9.5,16c1.61,0 3.09,-0.59 4.23,-1.57l0.27,0.28v0.79l5,4.99L20.49,19l-4.99,-5zM9.5,14C7.01,14 5,11.99 5,9.5S7.01,5 9.5,5 14,7.01 14,9.5 11.99,14 9.5,14z" />
-</vector>
diff --git a/app/src/main/res/layout/fragment_search.xml b/app/src/main/res/layout/fragment_library.xml
similarity index 87%
rename from app/src/main/res/layout/fragment_search.xml
rename to app/src/main/res/layout/fragment_library.xml
index fe03199..78033ad 100644
--- a/app/src/main/res/layout/fragment_search.xml
+++ b/app/src/main/res/layout/fragment_library.xml
@@ -14,19 +14,19 @@
         android:layout_height="wrap_content"
         android:fitsSystemWindows="true"
         android:paddingHorizontal="16dp"
-        app:liftOnScrollTargetViewId="@+id/searchNestedScrollView">
+        app:liftOnScrollTargetViewId="@+id/libraryNestedScrollView">
 
-        <com.google.android.material.search.SearchBar
-            android:id="@+id/searchBar"
+        <com.google.android.material.appbar.MaterialToolbar
+            android:id="@+id/toolbar"
             android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginVertical="16dp"
-            app:defaultMarginsEnabled="false" />
+            android:layout_height="?attr/actionBarSize"
+            app:layout_scrollFlags="scroll|enterAlways|snap"
+            app:title="@string/library_title" />
 
     </com.google.android.material.appbar.AppBarLayout>
 
     <androidx.core.widget.NestedScrollView
-        android:id="@+id/searchNestedScrollView"
+        android:id="@+id/libraryNestedScrollView"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:orientation="vertical"
@@ -39,7 +39,7 @@
 
             <TextView
                 android:id="@+id/categoriesTitleTextView"
-                style="@style/TextAppearance.Material3.TitleLarge"
+                style="@style/TextAppearance.Material3.TitleMedium"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:layout_marginHorizontal="17dp"
diff --git a/app/src/main/res/menu/fragment_main_bottom_app_bar.xml b/app/src/main/res/menu/fragment_main_bottom_app_bar.xml
index 18d5b87..6c8f0bd 100644
--- a/app/src/main/res/menu/fragment_main_bottom_app_bar.xml
+++ b/app/src/main/res/menu/fragment_main_bottom_app_bar.xml
@@ -19,8 +19,8 @@
 
     <item
         style="@style/Theme.Glimpse.BottomAppBarOption"
-        android:id="@+id/searchFragment"
-        android:icon="@drawable/ic_search"
-        android:title="@string/search_title" />
+        android:id="@+id/libraryFragment"
+        android:icon="@drawable/ic_library"
+        android:title="@string/library_title" />
 
 </menu>
diff --git a/app/src/main/res/navigation/main_fragment_navigation.xml b/app/src/main/res/navigation/main_fragment_navigation.xml
index 888c9ab..65165cf 100644
--- a/app/src/main/res/navigation/main_fragment_navigation.xml
+++ b/app/src/main/res/navigation/main_fragment_navigation.xml
@@ -22,9 +22,9 @@
         tools:layout="@layout/fragment_albums" />
 
     <fragment
-        android:id="@+id/searchFragment"
-        android:name="org.lineageos.glimpse.fragments.SearchFragment"
-        android:label="@string/search_title"
-        tools:layout="@layout/fragment_search" />
+        android:id="@+id/libraryFragment"
+        android:name="org.lineageos.glimpse.fragments.LibraryFragment"
+        android:label="@string/library_title"
+        tools:layout="@layout/fragment_library" />
 
 </navigation>
diff --git a/app/src/main/res/values-in/strings.xml b/app/src/main/res/values-in/strings.xml
index 3c5a003..7e8daa7 100644
--- a/app/src/main/res/values-in/strings.xml
+++ b/app/src/main/res/values-in/strings.xml
@@ -7,9 +7,59 @@
     <string name="app_name">Galeri</string>
     <string name="app_permissions_toast">Izin tidak diberikan oleh pengguna</string>
     <string name="albums_title">Album</string>
+    <string name="search_title">Cari</string>
     <string name="categories_title">Kategori</string>
     <string name="album_favorites">Favorit</string>
+    <string name="album_trash">Sampah</string>
     <string name="album_videos">Video</string>
+    <plurals name="album_thumbnail_items">
+        <item quantity="other">%d item</item>
+    </plurals>
+    <plurals name="delete_file_forever_confirm_message">
+        <item quantity="other">Apakah Anda yakin ingin menghapus file ini secara permanen?</item>
+    </plurals>
+    <plurals name="delete_file_forever_successful">
+        <item quantity="other">File dihapus secara permanen</item>
+    </plurals>
+    <plurals name="delete_file_forever_unsuccessful">
+        <item quantity="other">File tidak dapat dihapus secara permanen</item>
+    </plurals>
+    <plurals name="move_file_to_trash_confirm_message">
+        <item quantity="other">Apakah Anda yakin ingin memindahkan satu file ke sampah?</item>
+    </plurals>
+    <plurals name="move_file_to_trash_successful">
+        <item quantity="other">File dipindahkan ke sampah</item>
+    </plurals>
+    <plurals name="move_file_to_trash_unsuccessful">
+        <item quantity="other">File tidak dapat dipindahkan ke sampah</item>
+    </plurals>
+    <plurals name="restore_file_from_trash_confirm_message">
+        <item quantity="other">Apakah Anda yakin ingin memulihkan satu file dari sampah?</item>
+    </plurals>
+    <plurals name="restore_file_from_trash_successful">
+        <item quantity="other">File dipulihkan dari sampah</item>
+    </plurals>
+    <plurals name="restore_file_from_trash_unsuccessful">
+        <item quantity="other">File tidak dapat dipulihkan dari sampah</item>
+    </plurals>
     <string name="media_info_unknown">Tak dikenal</string>
     <string name="media_info_add_description_hint">Tambahkan deskripsi</string>
+    <string name="media_info_location_loading_placeholder">Memuat...</string>
+    <string name="intent_media_not_found">Media tidak ditemukan</string>
+    <string name="file_action_move_to_trash">Pindah ke sampah</string>
+    <string name="file_action_remove_from_favorites">Hapus dari favorit</string>
+    <string name="file_action_restore_from_trash">Pulihkan dari sampah</string>
+    <string name="file_action_share">Bagikan</string>
+    <string name="file_action_use_as">Gunakan sebagai</string>
+    <string name="file_action_undo_action">Urungkan</string>
+    <plurals name="thumbnail_selection_count">
+        <item quantity="other">%d dipilih</item>
+    </plurals>
+    <string name="pick_a_photo">Pilih foto</string>
+    <string name="pick_a_video">Pilih video</string>
+    <string name="pick_a_media">Pilih media</string>
+    <string name="picker_done">Selesai</string>
+    <string name="set_wallpaper_label">Wallpaper</string>
+    <string name="set_wallpaper">Atur wallpaper</string>
+    <string name="set_wallpaper_home_screen">Layar beranda</string>
 </resources>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 78f18f9..b0e2716 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -12,8 +12,8 @@
     <!-- Titles -->
     <string name="reels_title">Reels</string>
     <string name="albums_title">Albums</string>
-    <string name="search_title">Search</string>
     <string name="categories_title">Categories</string>
+    <string name="library_title">Library</string>
 
     <!-- Album buckets -->
     <string name="album_favorites">Favorites</string>