Skip to content

Commit

Permalink
Glimpse: Rename SearchFragment to LibraryFragment
Browse files Browse the repository at this point in the history
This fragment contains more options than just search.
Rename to better reflect this.

Change-Id: I7d22eae1977c178677607b952664d1f7c1dc4007
Signed-off-by: Aayush Gupta <[email protected]>
  • Loading branch information
theimpulson authored and mikeNG committed Jun 20, 2024
1 parent 0b5b957 commit bddb3bf
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ import org.lineageos.glimpse.utils.MediaStoreBuckets

/**
* 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 libraryNestedScrollView by getViewProperty<NestedScrollView>(R.id.libraryNestedScrollView)
private val searchBar by getViewProperty<SearchBar>(R.id.searchBar)
private val trashAlbumListItem by getViewProperty<ListItem>(R.id.trashAlbumListItem)
private val videosAlbumListItem by getViewProperty<ListItem>(R.id.videosAlbumListItem)
Expand All @@ -60,7 +60,7 @@ class SearchFragment : Fragment(R.layout.fragment_search) {
rightMargin = insets.right
}

searchNestedScrollView.updateLayoutParams<ViewGroup.MarginLayoutParams> {
libraryNestedScrollView.updateLayoutParams<ViewGroup.MarginLayoutParams> {
leftMargin = insets.left
rightMargin = insets.right
}
Expand Down Expand Up @@ -103,7 +103,7 @@ class SearchFragment : Fragment(R.layout.fragment_search) {
*
* @return A new instance of fragment SearchFragment.
*/
fun newInstance() = SearchFragment().apply {
fun newInstance() = LibraryFragment().apply {
arguments = createBundle()
}
}
Expand Down
15 changes: 15 additions & 0 deletions app/src/main/res/drawable/ic_library.xml
Original file line number Diff line number Diff line change
@@ -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>
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
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"
Expand All @@ -26,7 +26,7 @@
</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"
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/res/menu/fragment_main_bottom_app_bar.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
8 changes: 4 additions & 4 deletions app/src/main/res/navigation/main_fragment_navigation.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<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>
Expand Down

0 comments on commit bddb3bf

Please sign in to comment.