diff options
4 files changed, 61 insertions, 13 deletions
diff --git a/app/src/main/java/it/niedermann/owncloud/notes/android/activity/NotesListViewActivity.java b/app/src/main/java/it/niedermann/owncloud/notes/android/activity/NotesListViewActivity.java index c8ec5a24..003778a7 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/android/activity/NotesListViewActivity.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/android/activity/NotesListViewActivity.java @@ -128,6 +128,8 @@ public class NotesListViewActivity extends AppCompatActivity implements ItemAdap RecyclerView listNavigationMenu; @BindView(R.id.recycler_view) RecyclerView listView; + @BindView(R.id.empty_content_view) + RelativeLayout emptyContentView; private ActionBarDrawerToggle drawerToggle; private ItemAdapter adapter = null; @@ -660,6 +662,11 @@ public class NotesListViewActivity extends AppCompatActivity implements ItemAdap LoadNotesListTask.NotesLoadedListener callback = (List<Item> notes, boolean showCategory) -> { adapter.setShowCategory(showCategory); adapter.setItemList(notes); + if(notes.size() > 0) { + emptyContentView.setVisibility(View.GONE); + } else { + emptyContentView.setVisibility(View.VISIBLE); + } if (scrollToTop) { listView.scrollToPosition(0); } diff --git a/app/src/main/res/layout/activity_notes_list_view.xml b/app/src/main/res/layout/activity_notes_list_view.xml index 95d63523..9ad1a561 100644 --- a/app/src/main/res/layout/activity_notes_list_view.xml +++ b/app/src/main/res/layout/activity_notes_list_view.xml @@ -26,16 +26,51 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/bg_normal" - tools:context="it.niedermann.owncloud.notes.android.activity.NotesListViewActivity" - tools:ignore="MergeRootFrame"> - - <androidx.recyclerview.widget.RecyclerView - android:id="@+id/recycler_view" + tools:context="it.niedermann.owncloud.notes.android.activity.NotesListViewActivity"> + <FrameLayout android:layout_width="match_parent" - android:layout_height="wrap_content" - android:background="@color/bg_highlighted" - android:scrollbars="vertical" /> + android:layout_height="match_parent"> + + <RelativeLayout + android:id="@+id/empty_content_view" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <ImageView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_above="@id/empty_content_view_title" + android:layout_centerHorizontal="true" + android:layout_marginBottom="20dp" + android:contentDescription="@null" + android:src="@mipmap/ic_launcher" /> + + <TextView + android:id="@+id/empty_content_view_title" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_centerInParent="true" + android:text="@string/no_notes_yet" + android:textSize="26sp" /> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_below="@+id/empty_content_view_title" + android:layout_centerHorizontal="true" + android:layout_marginTop="20dp" + android:text="@string/no_notes_yet_description" /> + + </RelativeLayout> + <androidx.recyclerview.widget.RecyclerView + android:id="@+id/recycler_view" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="@color/bg_highlighted" + android:scrollbars="vertical" + tools:listitem="@layout/fragment_notes_list_note_item"/> + </FrameLayout> </androidx.swiperefreshlayout.widget.SwipeRefreshLayout> </LinearLayout> diff --git a/app/src/main/res/layout/fragment_notes_list_note_item.xml b/app/src/main/res/layout/fragment_notes_list_note_item.xml index f0b96edf..6116312d 100644 --- a/app/src/main/res/layout/fragment_notes_list_note_item.xml +++ b/app/src/main/res/layout/fragment_notes_list_note_item.xml @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" android:id="@+id/noteSwipeFrame" android:layout_width="match_parent" android:layout_height="wrap_content" @@ -37,13 +38,13 @@ android:layout_width="wrap_content" android:layout_height="match_parent"> - <ImageView android:id="@+id/noteFavorite" android:contentDescription="@string/menu_favorite" android:padding="16dp" android:layout_width="wrap_content" - android:layout_height="match_parent" /> + android:layout_height="match_parent" + tools:src="@drawable/ic_star_yellow_24dp"/> <androidx.appcompat.widget.AppCompatImageView @@ -81,7 +82,8 @@ android:singleLine="true" android:layout_weight="1" android:textColor="@drawable/list_item_color_selector" - android:textSize="@dimen/primary_font_size" /> + android:textSize="@dimen/primary_font_size" + tools:text="The title of the note"/> </androidx.appcompat.widget.LinearLayoutCompat> @@ -103,7 +105,8 @@ android:paddingTop="1dp" android:layout_weight="1" android:textColor="@drawable/list_item_color_selector_low" - android:textSize="@dimen/secondary_font_size" /> + android:textSize="@dimen/secondary_font_size" + tools:text="This is the content of the first line."/> <TextView android:id="@+id/noteCategory" @@ -121,7 +124,8 @@ android:layout_marginLeft="8dp" android:singleLine="true" android:textColor="@drawable/list_item_color_selector" - android:textSize="@dimen/secondary_font_size" /> + android:textSize="@dimen/secondary_font_size" + tools:text="My fancy category"/> </androidx.appcompat.widget.LinearLayoutCompat> </androidx.appcompat.widget.LinearLayoutCompat> </androidx.appcompat.widget.LinearLayoutCompat> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index f1110c61..eef983ae 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -132,6 +132,8 @@ <string name="category_movie">Movie</string> <string name="category_work">Work</string> <string name="account_already_imported">Account has already been imported</string> + <string name="no_notes_yet">No notes yet</string> + <string name="no_notes_yet_description">Press + button to create a new note</string> <!-- Array: note modes --> <string-array name="noteMode_entries"> |