Skip to content

Commit

Permalink
Design #17: Show folder name and icon in link lists
Browse files Browse the repository at this point in the history
  • Loading branch information
AmrDeveloper committed Feb 9, 2023
1 parent 86bbbf5 commit f1ee2ee
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class LinkListFragment : Fragment() {

private fun setupObservers() {
linkListViewModel.linksLiveData.observe(viewLifecycleOwner) {
binding.linksCountTxt.text = getString(R.string.links_count, it.size)
setupFolderHeaderInfo(it.size)
setupLinksListState(it)
}

Expand Down Expand Up @@ -101,6 +101,11 @@ class LinkListFragment : Fragment() {
}
}

private fun setupFolderHeaderInfo(size : Int) {
binding.folderInfoHeaderTxt.text = "${currentFolder.name}: ${size}"
binding.folderInfoHeaderTxt.setCompoundDrawablesWithIntrinsicBounds(currentFolder.folderColor.drawableId, 0, 0, 0)
}

override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
inflater.inflate(R.menu.menu_home, menu)

Expand Down
17 changes: 10 additions & 7 deletions app/src/main/res/layout/fragment_link_list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,22 @@
app:indicatorColor="@color/sky" />

<TextView
android:id="@+id/links_count_txt"
android:layout_below="@id/loading_indicator"
android:id="@+id/folder_info_header_txt"
android:layout_width="match_parent"
android:textSize="@dimen/dimen18sp"
android:padding="@dimen/dimen5dp"
tools:text="Links: 20"
android:layout_height="wrap_content"
android:layout_below="@id/loading_indicator"
android:drawablePadding="@dimen/dimen5dp"
android:ellipsize="middle"
android:fontFamily="serif"
android:padding="@dimen/dimen5dp"
android:singleLine="true"
android:textColor="@color/dark_sky"
android:layout_height="wrap_content"/>
android:textSize="@dimen/dimen18sp"
tools:text="Links: 20" />

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/link_list"
android:layout_below="@id/links_count_txt"
android:layout_below="@id/folder_info_header_txt"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:listitem="@layout/list_item_link" />
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values-ar/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@

<!--Counters-->
<string name="folder_count"> المجلدات %1$d</string>
<string name="links_count"> الروابط %1$d</string>
<string name="version"> الإصدار %1$s</string>

<!--Error Messages-->
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@

<!--Counters-->
<string name="folder_count">Folders: %1$d</string>
<string name="links_count">Links: %1$d</string>
<string name="version">Version %1$s</string>

<!--Error Messages-->
Expand Down

0 comments on commit f1ee2ee

Please sign in to comment.