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.data.LatLon;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandSettings;
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.Version;
|
import net.osmand.plus.Version;
|
||||||
import net.osmand.plus.base.BaseOsmAndFragment;
|
import net.osmand.plus.base.BaseOsmAndFragment;
|
||||||
|
@ -207,22 +206,6 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadEv
|
||||||
addNeededMapsCard();
|
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() {
|
private void addDownloadUpdateCard() {
|
||||||
final OsmandApplication app = getMyApplication();
|
final OsmandApplication app = getMyApplication();
|
||||||
if (app != null && adapter != null) {
|
if (app != null && adapter != null) {
|
||||||
|
@ -231,7 +214,7 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadEv
|
||||||
boolean outdated = mainIndexItem != null && mainIndexItem.isOutdated();
|
boolean outdated = mainIndexItem != null && mainIndexItem.isOutdated();
|
||||||
File selectedTravelBook = app.getTravelDbHelper().getSelectedTravelBook();
|
File selectedTravelBook = app.getTravelDbHelper().getSelectedTravelBook();
|
||||||
|
|
||||||
if (selectedTravelBook == null || (outdated && showUpdateCard())) {
|
if (selectedTravelBook == null || (outdated && app.getSettings().SHOW_TRAVEL_UPDATE_CARD.get())) {
|
||||||
boolean showOtherMaps = false;
|
boolean showOtherMaps = false;
|
||||||
if (selectedTravelBook == null) {
|
if (selectedTravelBook == null) {
|
||||||
List<IndexItem> items = downloadThread.getIndexes().getWikivoyageItems();
|
List<IndexItem> items = downloadThread.getIndexes().getWikivoyageItems();
|
||||||
|
@ -255,10 +238,7 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadEv
|
||||||
downloadThread.cancelDownload(mainIndexItem);
|
downloadThread.cancelDownload(mainIndexItem);
|
||||||
adapter.updateDownloadUpdateCard(false);
|
adapter.updateDownloadUpdateCard(false);
|
||||||
} else if (!downloadUpdateCard.isDownload()) {
|
} else if (!downloadUpdateCard.isDownload()) {
|
||||||
OsmandSettings settings = getSettings();
|
app.getSettings().SHOW_TRAVEL_UPDATE_CARD.set(false);
|
||||||
if (settings != null) {
|
|
||||||
settings.SHOW_TRAVEL_UPDATE_CARD.set(false);
|
|
||||||
}
|
|
||||||
removeDownloadUpdateCard();
|
removeDownloadUpdateCard();
|
||||||
} else if (downloadUpdateCard.isShowOtherMapsBtn()) {
|
} else if (downloadUpdateCard.isShowOtherMapsBtn()) {
|
||||||
Activity activity = getActivity();
|
Activity activity = getActivity();
|
||||||
|
@ -279,7 +259,7 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadEv
|
||||||
|
|
||||||
private void addNeededMapsCard() {
|
private void addNeededMapsCard() {
|
||||||
final OsmandApplication app = getMyApplication();
|
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 = new TravelNeededMapsCard(app, nightMode, neededIndexItems);
|
||||||
neededMapsCard.setListener(new TravelNeededMapsCard.CardListener() {
|
neededMapsCard.setListener(new TravelNeededMapsCard.CardListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -298,10 +278,7 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadEv
|
||||||
adapter.updateNeededMapsCard(false);
|
adapter.updateNeededMapsCard(false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
OsmandSettings settings = getSettings();
|
app.getSettings().SHOW_TRAVEL_NEEDED_MAPS_CARD.set(false);
|
||||||
if (settings != null) {
|
|
||||||
settings.SHOW_TRAVEL_NEEDED_MAPS_CARD.set(false);
|
|
||||||
}
|
|
||||||
removeNeededMapsCard();
|
removeNeededMapsCard();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue