remove imageView and emptyStub from api check

This commit is contained in:
Chumva 2018-03-28 17:23:17 +03:00
parent ed67b29bf0
commit 37dd9dd772
7 changed files with 31 additions and 16 deletions

View file

@ -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() {

View file

@ -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;
}

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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() {

View file

@ -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) {