Add empty view
This commit is contained in:
parent
03e695ee1b
commit
849384a045
2 changed files with 15 additions and 0 deletions
|
@ -36,4 +36,9 @@
|
||||||
android:layout_marginRight="0dp"
|
android:layout_marginRight="0dp"
|
||||||
android:layout_marginTop="0dp"
|
android:layout_marginTop="0dp"
|
||||||
android:layout_weight="1"/>
|
android:layout_weight="1"/>
|
||||||
|
`
|
||||||
|
<ViewStub
|
||||||
|
android:id="@+id/empty_view_stub"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -18,9 +18,11 @@ import android.view.MenuInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.view.ViewStub;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
import android.widget.ImageView;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
@ -69,6 +71,7 @@ public class NotesFragment extends OsmAndListFragment {
|
||||||
private Set<Recording> selected = new HashSet<>();
|
private Set<Recording> selected = new HashSet<>();
|
||||||
|
|
||||||
private View footerView;
|
private View footerView;
|
||||||
|
private View emptyView;
|
||||||
|
|
||||||
private boolean selectionMode;
|
private boolean selectionMode;
|
||||||
|
|
||||||
|
@ -92,6 +95,12 @@ public class NotesFragment extends OsmAndListFragment {
|
||||||
|
|
||||||
View view = getActivity().getLayoutInflater().inflate(R.layout.update_index, container, false);
|
View view = getActivity().getLayoutInflater().inflate(R.layout.update_index, container, false);
|
||||||
view.findViewById(R.id.header_layout).setVisibility(View.GONE);
|
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;
|
return view;
|
||||||
}
|
}
|
||||||
|
@ -109,6 +118,7 @@ public class NotesFragment extends OsmAndListFragment {
|
||||||
List<Object> items = createItemsList();
|
List<Object> items = createItemsList();
|
||||||
ListView listView = getListView();
|
ListView listView = getListView();
|
||||||
listView.setDivider(null);
|
listView.setDivider(null);
|
||||||
|
listView.setEmptyView(emptyView);
|
||||||
if (items.size() > 0 && footerView == null) {
|
if (items.size() > 0 && footerView == null) {
|
||||||
footerView = getActivity().getLayoutInflater().inflate(R.layout.list_shadow_footer, null, false);
|
footerView = getActivity().getLayoutInflater().inflate(R.layout.list_shadow_footer, null, false);
|
||||||
listView.addFooterView(footerView);
|
listView.addFooterView(footerView);
|
||||||
|
|
Loading…
Reference in a new issue