diff --git a/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java b/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java index ac677519af..2cdb92c7fc 100644 --- a/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java @@ -162,9 +162,11 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment { listView.addFooterView(footerView); } View emptyView = view.findViewById(android.R.id.empty); - if (Build.VERSION.SDK_INT >= 18) { - ImageView emptyImageView = (ImageView) emptyView.findViewById(R.id.empty_state_image_view); + ImageView emptyImageView = (ImageView) emptyView.findViewById(R.id.empty_state_image_view); + if (Build.VERSION.SDK_INT >= 28) { emptyImageView.setImageResource(app.getSettings().isLightContent() ? R.drawable.ic_empty_state_favorites_day : R.drawable.ic_empty_state_favorites_night); + } else { + emptyImageView.setVisibility(View.GONE); } Button importButton = (Button) emptyView.findViewById(R.id.import_button); importButton.setOnClickListener(new View.OnClickListener() { diff --git a/OsmAnd/src/net/osmand/plus/audionotes/NotesFragment.java b/OsmAnd/src/net/osmand/plus/audionotes/NotesFragment.java index 76d3a9aa86..823120659a 100644 --- a/OsmAnd/src/net/osmand/plus/audionotes/NotesFragment.java +++ b/OsmAnd/src/net/osmand/plus/audionotes/NotesFragment.java @@ -96,16 +96,19 @@ 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(); + emptyView.setBackgroundColor(getResources().getColor(getMyApplication().getSettings() + .isLightContent() ? R.color.ctx_menu_info_view_bg_light : R.color.ctx_menu_info_view_bg_dark)); + ImageView emptyImageView = (ImageView) emptyView.findViewById(R.id.empty_state_image_view); if (Build.VERSION.SDK_INT >= 18) { - 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); - emptyView.setBackgroundColor(getResources().getColor(getMyApplication().getSettings() - .isLightContent() ? R.color.ctx_menu_info_view_bg_light : R.color.ctx_menu_info_view_bg_dark)); + emptyImageView.setImageResource(icRes); + } else { + emptyImageView.setVisibility(View.GONE); } return view; } diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersActiveFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersActiveFragment.java index 980d6d35be..520a46da12 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersActiveFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersActiveFragment.java @@ -126,9 +126,11 @@ public class MapMarkersActiveFragment extends Fragment implements OsmAndCompassL }); final View emptyView = mainView.findViewById(R.id.empty_view); + ImageView emptyImageView = (ImageView) emptyView.findViewById(R.id.empty_state_image_view); if (Build.VERSION.SDK_INT >= 18) { - ImageView emptyImageView = (ImageView) emptyView.findViewById(R.id.empty_state_image_view); emptyImageView.setImageResource(mapActivity.getMyApplication().getSettings().isLightContent() ? R.drawable.ic_empty_state_marker_list_day : R.drawable.ic_empty_state_marker_list_night); + } else { + emptyImageView.setVisibility(View.GONE); } recyclerView.setEmptyView(emptyView); recyclerView.setAdapter(adapter); diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersGroupsFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersGroupsFragment.java index 1db4d4da2d..7ede2f9670 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersGroupsFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersGroupsFragment.java @@ -304,9 +304,11 @@ public class MapMarkersGroupsFragment extends Fragment implements OsmAndCompassL openAddGroupMenu(); } }); + ImageView emptyImageView = (ImageView) emptyView.findViewById(R.id.empty_state_image_view); if (Build.VERSION.SDK_INT >= 18) { - ImageView emptyImageView = (ImageView) emptyView.findViewById(R.id.empty_state_image_view); emptyImageView.setImageResource(night ? R.drawable.ic_empty_state_marker_group_night : R.drawable.ic_empty_state_marker_group_day); + } else { + emptyImageView.setVisibility(View.GONE); } recyclerView.setEmptyView(emptyView); recyclerView.setAdapter(adapter); diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHistoryFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHistoryFragment.java index 05e17d9929..00eb30b67a 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHistoryFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHistoryFragment.java @@ -203,9 +203,11 @@ public class MapMarkersHistoryFragment extends Fragment implements MapMarkersHel } }); final View emptyView = mainView.findViewById(R.id.empty_view); + ImageView emptyImageView = (ImageView) emptyView.findViewById(R.id.empty_state_image_view); if (Build.VERSION.SDK_INT >= 18) { - ImageView emptyImageView = (ImageView) emptyView.findViewById(R.id.empty_state_image_view); emptyImageView.setImageResource(night ? R.drawable.ic_empty_state_marker_history_night : R.drawable.ic_empty_state_marker_history_day); + } else { + emptyImageView.setVisibility(View.GONE); } recyclerView.setEmptyView(emptyView); recyclerView.setAdapter(adapter); diff --git a/OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java b/OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java index b800c0d882..953dc214d0 100644 --- a/OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java +++ b/OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java @@ -332,9 +332,11 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment { footerView = inflater.inflate(R.layout.list_shadow_footer, null, false); listView.addFooterView(footerView); emptyView = v.findViewById(android.R.id.empty); + ImageView emptyImageView = (ImageView) emptyView.findViewById(R.id.empty_state_image_view); if (Build.VERSION.SDK_INT >= 18) { - ImageView emptyImageView = (ImageView) emptyView.findViewById(R.id.empty_state_image_view); emptyImageView.setImageResource(app.getSettings().isLightContent() ? R.drawable.ic_empty_state_trip_day : R.drawable.ic_empty_state_trip_night); + } else { + emptyImageView.setVisibility(View.GONE); } Button importButton = (Button) emptyView.findViewById(R.id.import_button); importButton.setOnClickListener(new View.OnClickListener() { diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsFragment.java index 69c3f0aa21..1b49ce42fa 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsFragment.java @@ -141,14 +141,16 @@ public class OsmEditsFragment extends OsmAndListFragment implements SendPoiDialo ViewStub emptyStub = (ViewStub) view.findViewById(R.id.empty_view_stub); emptyStub.setLayoutResource(R.layout.empty_state_osm_edits); emptyView = emptyStub.inflate(); + emptyView.setBackgroundColor(getResources().getColor(getMyApplication().getSettings() + .isLightContent() ? R.color.ctx_menu_info_view_bg_light : R.color.ctx_menu_info_view_bg_dark)); + ImageView emptyImageView = emptyView.findViewById(R.id.empty_state_image_view); if (Build.VERSION.SDK_INT >= 18) { int icRes = getMyApplication().getSettings().isLightContent() ? R.drawable.ic_empty_state_osm_edits_day : R.drawable.ic_empty_state_osm_edits_night; - ((ImageView) emptyView.findViewById(R.id.empty_state_image_view)).setImageResource(icRes); + emptyImageView.setImageResource(icRes); + } else { + emptyImageView.setVisibility(View.GONE); } - emptyView.setBackgroundColor(getResources().getColor(getMyApplication().getSettings() - .isLightContent() ? R.color.ctx_menu_info_view_bg_light : R.color.ctx_menu_info_view_bg_dark)); - FragmentManager fm = getChildFragmentManager(); Fragment optionsFragment = fm.findFragmentByTag(OsmEditOptionsBottomSheetDialogFragment.TAG); if (optionsFragment != null) {