Remove redundant code
This commit is contained in:
parent
5c7b4cf719
commit
c9f8057b13
1 changed files with 4 additions and 27 deletions
|
@ -16,7 +16,6 @@ import android.view.ViewGroup;
|
|||
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.Version;
|
||||
import net.osmand.plus.base.BaseOsmAndFragment;
|
||||
|
@ -207,22 +206,6 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadEv
|
|||
addNeededMapsCard();
|
||||
}
|
||||
|
||||
private boolean showUpdateCard() {
|
||||
OsmandSettings settings = getSettings();
|
||||
if (settings != null) {
|
||||
return settings.SHOW_TRAVEL_UPDATE_CARD.get();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean showNeededMapsCard() {
|
||||
OsmandSettings settings = getSettings();
|
||||
if (settings != null) {
|
||||
return settings.SHOW_TRAVEL_NEEDED_MAPS_CARD.get();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void addDownloadUpdateCard() {
|
||||
final OsmandApplication app = getMyApplication();
|
||||
if (app != null && adapter != null) {
|
||||
|
@ -231,7 +214,7 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadEv
|
|||
boolean outdated = mainIndexItem != null && mainIndexItem.isOutdated();
|
||||
File selectedTravelBook = app.getTravelDbHelper().getSelectedTravelBook();
|
||||
|
||||
if (selectedTravelBook == null || (outdated && showUpdateCard())) {
|
||||
if (selectedTravelBook == null || (outdated && app.getSettings().SHOW_TRAVEL_UPDATE_CARD.get())) {
|
||||
boolean showOtherMaps = false;
|
||||
if (selectedTravelBook == null) {
|
||||
List<IndexItem> items = downloadThread.getIndexes().getWikivoyageItems();
|
||||
|
@ -255,10 +238,7 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadEv
|
|||
downloadThread.cancelDownload(mainIndexItem);
|
||||
adapter.updateDownloadUpdateCard(false);
|
||||
} else if (!downloadUpdateCard.isDownload()) {
|
||||
OsmandSettings settings = getSettings();
|
||||
if (settings != null) {
|
||||
settings.SHOW_TRAVEL_UPDATE_CARD.set(false);
|
||||
}
|
||||
app.getSettings().SHOW_TRAVEL_UPDATE_CARD.set(false);
|
||||
removeDownloadUpdateCard();
|
||||
} else if (downloadUpdateCard.isShowOtherMapsBtn()) {
|
||||
Activity activity = getActivity();
|
||||
|
@ -279,7 +259,7 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadEv
|
|||
|
||||
private void addNeededMapsCard() {
|
||||
final OsmandApplication app = getMyApplication();
|
||||
if (app != null && !neededIndexItems.isEmpty() && adapter != null && showNeededMapsCard()) {
|
||||
if (app != null && !neededIndexItems.isEmpty() && adapter != null && app.getSettings().SHOW_TRAVEL_NEEDED_MAPS_CARD.get()) {
|
||||
neededMapsCard = new TravelNeededMapsCard(app, nightMode, neededIndexItems);
|
||||
neededMapsCard.setListener(new TravelNeededMapsCard.CardListener() {
|
||||
@Override
|
||||
|
@ -298,10 +278,7 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadEv
|
|||
adapter.updateNeededMapsCard(false);
|
||||
}
|
||||
} else {
|
||||
OsmandSettings settings = getSettings();
|
||||
if (settings != null) {
|
||||
settings.SHOW_TRAVEL_NEEDED_MAPS_CARD.set(false);
|
||||
}
|
||||
app.getSettings().SHOW_TRAVEL_NEEDED_MAPS_CARD.set(false);
|
||||
removeNeededMapsCard();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue