From 849384a04553e20c27b8a1a2e5b352d2155e9f66 Mon Sep 17 00:00:00 2001 From: alex Date: Sun, 19 Nov 2017 00:12:04 +0200 Subject: [PATCH] Add empty view --- OsmAnd/res/layout/update_index.xml | 5 +++++ .../src/net/osmand/plus/audionotes/NotesFragment.java | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/OsmAnd/res/layout/update_index.xml b/OsmAnd/res/layout/update_index.xml index 4553c67375..a09d3a14ff 100644 --- a/OsmAnd/res/layout/update_index.xml +++ b/OsmAnd/res/layout/update_index.xml @@ -36,4 +36,9 @@ android:layout_marginRight="0dp" android:layout_marginTop="0dp" android:layout_weight="1"/> +` + \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/audionotes/NotesFragment.java b/OsmAnd/src/net/osmand/plus/audionotes/NotesFragment.java index ea3b620e38..d8f8c04944 100644 --- a/OsmAnd/src/net/osmand/plus/audionotes/NotesFragment.java +++ b/OsmAnd/src/net/osmand/plus/audionotes/NotesFragment.java @@ -18,9 +18,11 @@ import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; +import android.view.ViewStub; import android.view.inputmethod.InputMethodManager; import android.widget.ArrayAdapter; import android.widget.EditText; +import android.widget.ImageView; import android.widget.ListView; import android.widget.Toast; @@ -69,6 +71,7 @@ public class NotesFragment extends OsmAndListFragment { private Set selected = new HashSet<>(); private View footerView; + private View emptyView; private boolean selectionMode; @@ -92,6 +95,12 @@ public class NotesFragment extends OsmAndListFragment { View view = getActivity().getLayoutInflater().inflate(R.layout.update_index, container, false); view.findViewById(R.id.header_layout).setVisibility(View.GONE); + ViewStub emptyStub = (ViewStub) view.findViewById(R.id.empty_view_stub); + emptyStub.setLayoutResource(R.layout.empty_state_av_notes); + emptyView = emptyStub.inflate(); + int icRes = getMyApplication().getSettings().isLightContent() + ? R.drawable.ic_empty_state_av_notes_day : R.drawable.ic_empty_state_av_notes_night; + ((ImageView) emptyView.findViewById(R.id.empty_state_image_view)).setImageResource(icRes); return view; } @@ -109,6 +118,7 @@ public class NotesFragment extends OsmAndListFragment { List items = createItemsList(); ListView listView = getListView(); listView.setDivider(null); + listView.setEmptyView(emptyView); if (items.size() > 0 && footerView == null) { footerView = getActivity().getLayoutInflater().inflate(R.layout.list_shadow_footer, null, false); listView.addFooterView(footerView);