From ac78d7a38ec1f77d122d4ae2e6f7aebe143d3077 Mon Sep 17 00:00:00 2001 From: PavelRatushny Date: Fri, 24 Nov 2017 10:29:08 +0200 Subject: [PATCH] Fix #4758 --- .../activities/FavoritesTreeFragment.java | 22 ++++++++++++------- .../plus/myplaces/AvailableGPXFragment.java | 16 +++++++++----- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java b/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java index e1cdd641c7..a57e1c5508 100644 --- a/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java @@ -167,12 +167,16 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment { ImageView emptyImageView = (ImageView) emptyView.findViewById(R.id.empty_state_image_view); emptyImageView.setImageResource(app.getSettings().isLightContent() ? R.drawable.ic_empty_state_favorites_day : R.drawable.ic_empty_state_favorites_night); Button importButton = (Button) emptyView.findViewById(R.id.import_button); - importButton.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - importFavourites(); - } - }); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { + importButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + importFavourites(); + } + }); + } else { + importButton.setVisibility(View.GONE); + } listView.setEmptyView(emptyView); listView.setAdapter(favouritesAdapter); setListView(listView); @@ -321,8 +325,10 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment { if (!MenuItemCompat.isActionViewExpanded(mi)) { - createMenuItem(menu, IMPORT_FAVOURITES_ID, R.string.shared_string_add_to_favorites, R.drawable.ic_action_plus, - R.drawable.ic_action_plus, MenuItemCompat.SHOW_AS_ACTION_ALWAYS); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { + createMenuItem(menu, IMPORT_FAVOURITES_ID, R.string.shared_string_add_to_favorites, R.drawable.ic_action_plus, + R.drawable.ic_action_plus, MenuItemCompat.SHOW_AS_ACTION_ALWAYS); + } createMenuItem(menu, SHARE_ID, R.string.shared_string_share, R.drawable.ic_action_gshare_dark, R.drawable.ic_action_gshare_dark, MenuItemCompat.SHOW_AS_ACTION_ALWAYS); if (getSettings().USE_MAP_MARKERS.get()) { diff --git a/OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java b/OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java index d50a6983ca..0579238c10 100644 --- a/OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java +++ b/OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java @@ -332,12 +332,16 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment { 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); Button importButton = (Button) emptyView.findViewById(R.id.import_button); - importButton.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - addTrack(); - } - }); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { + importButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + addTrack(); + } + }); + } else { + importButton.setVisibility(View.GONE); + } if (this.adapter != null) { listView.setAdapter(this.adapter); }