bookmarks empty layout

This commit is contained in:
Jonathan Fisher 2020-11-11 16:31:29 +00:00
parent fac559bc90
commit 3ccbc5219e
2 changed files with 38 additions and 1 deletions

View File

@ -13,6 +13,7 @@ import kotlinx.android.synthetic.main.dialog_bookmarks.view.*
import oppen.ariane.R
import oppen.ariane.io.bookmarks.Bookmark
import oppen.ariane.io.bookmarks.BookmarksDatasource
import oppen.visible
class BookmarksDialog(
@ -73,7 +74,10 @@ class BookmarksDialog(
bookmarkDatasource.get { bookmarks ->
Handler(Looper.getMainLooper()).post {
bookmarksAdapter.update(bookmarks)
when {
bookmarks.isEmpty() -> view.bookmarks_empty_layout.visible(true)
else -> bookmarksAdapter.update(bookmarks)
}
}
}
}

View File

@ -17,5 +17,38 @@
android:layout_height="wrap_content"
android:layout_below="@+id/bookmarks_toolbar"/>
<RelativeLayout
android:id="@+id/bookmarks_empty_layout"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_centerInParent="true"
android:paddingBottom="60dp"
android:gravity="center_horizontal">
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:src="@drawable/vector_bookmarks"
/>
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="You don't have any bookmarks yet"
android:paddingTop="@dimen/default_margin_big"/>
</LinearLayout>
</RelativeLayout>
</RelativeLayout>