#643 Empty state is shown even if there are notes

This commit is contained in:
stefan-niedermann 2019-12-29 08:38:42 +01:00
parent f0646a61a4
commit a14926bf81
2 changed files with 14 additions and 2 deletions

View file

@ -20,6 +20,7 @@ import android.view.View;
import android.view.ViewTreeObserver; import android.view.ViewTreeObserver;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
@ -130,6 +131,8 @@ public class NotesListViewActivity extends AppCompatActivity implements ItemAdap
RecyclerView listView; RecyclerView listView;
@BindView(R.id.empty_content_view) @BindView(R.id.empty_content_view)
RelativeLayout emptyContentView; RelativeLayout emptyContentView;
@BindView(R.id.progress_circular)
ProgressBar progressBar;
private ActionBarDrawerToggle drawerToggle; private ActionBarDrawerToggle drawerToggle;
private ItemAdapter adapter = null; private ItemAdapter adapter = null;
@ -640,6 +643,8 @@ public class NotesListViewActivity extends AppCompatActivity implements ItemAdap
adapter.removeAll(); adapter.removeAll();
return; return;
} }
emptyContentView.setVisibility(View.GONE);
progressBar.setVisibility(View.VISIBLE);
fabCreate.show(); fabCreate.show();
String subtitle; String subtitle;
if (navigationSelection.category != null) { if (navigationSelection.category != null) {
@ -662,6 +667,7 @@ public class NotesListViewActivity extends AppCompatActivity implements ItemAdap
LoadNotesListTask.NotesLoadedListener callback = (List<Item> notes, boolean showCategory) -> { LoadNotesListTask.NotesLoadedListener callback = (List<Item> notes, boolean showCategory) -> {
adapter.setShowCategory(showCategory); adapter.setShowCategory(showCategory);
adapter.setItemList(notes); adapter.setItemList(notes);
progressBar.setVisibility(View.GONE);
if(notes.size() > 0) { if(notes.size() > 0) {
emptyContentView.setVisibility(View.GONE); emptyContentView.setVisibility(View.GONE);
} else { } else {

View file

@ -34,7 +34,8 @@
<RelativeLayout <RelativeLayout
android:id="@+id/empty_content_view" android:id="@+id/empty_content_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:visibility="gone">
<ImageView <ImageView
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -63,9 +64,14 @@
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_marginTop="20dp" android:layout_marginTop="20dp"
android:text="@string/no_notes_yet_description" /> android:text="@string/no_notes_yet_description" />
</RelativeLayout> </RelativeLayout>
<ProgressBar
android:id="@+id/progress_circular"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"/>
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view" android:id="@+id/recycler_view"
android:layout_width="match_parent" android:layout_width="match_parent"