Rename travel db helper and introduce settings for markers
This commit is contained in:
parent
d16f3ddebe
commit
263d3e764e
14 changed files with 51 additions and 29 deletions
|
@ -47,7 +47,7 @@ import net.osmand.plus.voice.CommandPlayer;
|
||||||
import net.osmand.plus.voice.CommandPlayerException;
|
import net.osmand.plus.voice.CommandPlayerException;
|
||||||
import net.osmand.plus.voice.MediaCommandPlayerImpl;
|
import net.osmand.plus.voice.MediaCommandPlayerImpl;
|
||||||
import net.osmand.plus.voice.TTSCommandPlayerImpl;
|
import net.osmand.plus.voice.TTSCommandPlayerImpl;
|
||||||
import net.osmand.plus.wikivoyage.data.WikivoyageDbHelper;
|
import net.osmand.plus.wikivoyage.data.TravelDbHelper;
|
||||||
import net.osmand.render.RenderingRulesStorage;
|
import net.osmand.render.RenderingRulesStorage;
|
||||||
import net.osmand.router.RoutingConfiguration;
|
import net.osmand.router.RoutingConfiguration;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
@ -445,7 +445,7 @@ public class AppInitializer implements IProgress {
|
||||||
app.mapMarkersDbHelper = startupInit(new MapMarkersDbHelper(app), MapMarkersDbHelper.class);
|
app.mapMarkersDbHelper = startupInit(new MapMarkersDbHelper(app), MapMarkersDbHelper.class);
|
||||||
app.mapMarkersHelper = startupInit(new MapMarkersHelper(app), MapMarkersHelper.class);
|
app.mapMarkersHelper = startupInit(new MapMarkersHelper(app), MapMarkersHelper.class);
|
||||||
app.searchUICore = startupInit(new QuickSearchHelper(app), QuickSearchHelper.class);
|
app.searchUICore = startupInit(new QuickSearchHelper(app), QuickSearchHelper.class);
|
||||||
app.wikivoyageDbHelper = startupInit(new WikivoyageDbHelper(app), WikivoyageDbHelper.class);
|
app.wikivoyageDbHelper = startupInit(new TravelDbHelper(app), TravelDbHelper.class);
|
||||||
|
|
||||||
initOpeningHoursParser();
|
initOpeningHoursParser();
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ import android.support.annotation.IntDef;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.support.v4.content.ContextCompat;
|
import android.support.v4.content.ContextCompat;
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.IndexConstants;
|
import net.osmand.IndexConstants;
|
||||||
import net.osmand.data.FavouritePoint;
|
import net.osmand.data.FavouritePoint;
|
||||||
|
@ -20,6 +19,8 @@ import net.osmand.plus.GeocodingLookupService.AddressLookupRequest;
|
||||||
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
||||||
import net.osmand.plus.mapmarkers.MapMarkersDbHelper;
|
import net.osmand.plus.mapmarkers.MapMarkersDbHelper;
|
||||||
import net.osmand.plus.mapmarkers.MarkersPlanRouteContext;
|
import net.osmand.plus.mapmarkers.MarkersPlanRouteContext;
|
||||||
|
import net.osmand.plus.wikivoyage.data.TravelDbHelper;
|
||||||
|
import net.osmand.plus.wikivoyage.data.WikivoyageArticle;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
import net.osmand.util.MapUtils;
|
import net.osmand.util.MapUtils;
|
||||||
|
|
||||||
|
@ -498,6 +499,26 @@ public class MapMarkersHelper {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
public List<MapMarkersGroup> getGroupsForSavedArticlesTravelBook() {
|
||||||
|
List<MapMarkersGroup> res = new ArrayList<>();
|
||||||
|
TravelDbHelper travelDbHelper = ctx.getTravelDbHelper();
|
||||||
|
if(travelDbHelper.getSelectedTravelBook() != null) {
|
||||||
|
List<WikivoyageArticle> savedArticles = travelDbHelper.getLocalDataHelper().getSavedArticles();
|
||||||
|
for (WikivoyageArticle art : savedArticles) {
|
||||||
|
String gpxName = travelDbHelper.getGPXName(art);
|
||||||
|
File path = ctx.getAppPath(IndexConstants.GPX_TRAVEL_DIR + gpxName);
|
||||||
|
MapMarkersGroup group = getOrCreateGroup(new File(path.getAbsolutePath()));
|
||||||
|
if (!isGroupSynced(group.getId())) {
|
||||||
|
group.disabled = true;
|
||||||
|
createHeaderInGroup(group);
|
||||||
|
res.add(group);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public MapMarker getMapMarker(WptPt wptPt) {
|
public MapMarker getMapMarker(WptPt wptPt) {
|
||||||
for (MapMarker marker : mapMarkers) {
|
for (MapMarker marker : mapMarkers) {
|
||||||
|
|
|
@ -56,7 +56,7 @@ import net.osmand.plus.resources.ResourceManager;
|
||||||
import net.osmand.plus.routing.RoutingHelper;
|
import net.osmand.plus.routing.RoutingHelper;
|
||||||
import net.osmand.plus.search.QuickSearchHelper;
|
import net.osmand.plus.search.QuickSearchHelper;
|
||||||
import net.osmand.plus.voice.CommandPlayer;
|
import net.osmand.plus.voice.CommandPlayer;
|
||||||
import net.osmand.plus.wikivoyage.data.WikivoyageDbHelper;
|
import net.osmand.plus.wikivoyage.data.TravelDbHelper;
|
||||||
import net.osmand.router.RoutingConfiguration;
|
import net.osmand.router.RoutingConfiguration;
|
||||||
import net.osmand.search.SearchUICore;
|
import net.osmand.search.SearchUICore;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
@ -119,7 +119,7 @@ public class OsmandApplication extends MultiDexApplication {
|
||||||
OsmandRegions regions;
|
OsmandRegions regions;
|
||||||
GeocodingLookupService geocodingLookupService;
|
GeocodingLookupService geocodingLookupService;
|
||||||
QuickSearchHelper searchUICore;
|
QuickSearchHelper searchUICore;
|
||||||
WikivoyageDbHelper wikivoyageDbHelper;
|
TravelDbHelper travelDbHelper;
|
||||||
|
|
||||||
RoutingConfiguration.Builder defaultRoutingConfig;
|
RoutingConfiguration.Builder defaultRoutingConfig;
|
||||||
private Locale preferredLocale = null;
|
private Locale preferredLocale = null;
|
||||||
|
@ -392,8 +392,8 @@ public class OsmandApplication extends MultiDexApplication {
|
||||||
return searchUICore;
|
return searchUICore;
|
||||||
}
|
}
|
||||||
|
|
||||||
public WikivoyageDbHelper getWikivoyageDbHelper() {
|
public TravelDbHelper getTravelDbHelper() {
|
||||||
return wikivoyageDbHelper;
|
return travelDbHelper;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CommandPlayer getPlayer() {
|
public CommandPlayer getPlayer() {
|
||||||
|
|
|
@ -63,7 +63,7 @@ import net.osmand.plus.views.MapControlsLayer;
|
||||||
import net.osmand.plus.views.MapTileLayer;
|
import net.osmand.plus.views.MapTileLayer;
|
||||||
import net.osmand.plus.views.OsmandMapTileView;
|
import net.osmand.plus.views.OsmandMapTileView;
|
||||||
import net.osmand.plus.wikivoyage.explore.WikivoyageExploreDialogFragment;
|
import net.osmand.plus.wikivoyage.explore.WikivoyageExploreDialogFragment;
|
||||||
import net.osmand.plus.wikivoyage.data.WikivoyageDbHelper;
|
import net.osmand.plus.wikivoyage.data.TravelDbHelper;
|
||||||
import net.osmand.router.GeneralRouter;
|
import net.osmand.router.GeneralRouter;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
@ -771,7 +771,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
.setListener(new ItemClickListener() {
|
.setListener(new ItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
|
public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) {
|
||||||
getMyApplication().getWikivoyageDbHelper().initTravelBooks();
|
getMyApplication().getTravelDbHelper().initTravelBooks();
|
||||||
MapActivity.clearPrevActivityIntent();
|
MapActivity.clearPrevActivityIntent();
|
||||||
WikivoyageExploreDialogFragment.showInstance(mapActivity.getSupportFragmentManager());
|
WikivoyageExploreDialogFragment.showInstance(mapActivity.getSupportFragmentManager());
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -93,6 +93,7 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
|
||||||
helper.updateGroups();
|
helper.updateGroups();
|
||||||
List<MapMarkersGroup> groups = new ArrayList<>(helper.getMapMarkersGroups());
|
List<MapMarkersGroup> groups = new ArrayList<>(helper.getMapMarkersGroups());
|
||||||
groups.addAll(helper.getGroupsForDisplayedGpx());
|
groups.addAll(helper.getGroupsForDisplayedGpx());
|
||||||
|
groups.addAll(helper.getGroupsForSavedArticlesTravelBook());
|
||||||
for (int i = 0; i < groups.size(); i++) {
|
for (int i = 0; i < groups.size(); i++) {
|
||||||
MapMarkersGroup group = groups.get(i);
|
MapMarkersGroup group = groups.get(i);
|
||||||
if (!group.isVisible()) {
|
if (!group.isVisible()) {
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class WikivoyageWebViewClient extends WebViewClient {
|
||||||
} catch (UnsupportedEncodingException e) {
|
} catch (UnsupportedEncodingException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
long articleId = app.getWikivoyageDbHelper().getArticleId(articleName, lang);
|
long articleId = app.getTravelDbHelper().getArticleId(articleName, lang);
|
||||||
if (articleId != 0) {
|
if (articleId != 0) {
|
||||||
WikivoyageArticleDialogFragment.showInstance(app, mFragmentManager,
|
WikivoyageArticleDialogFragment.showInstance(app, mFragmentManager,
|
||||||
articleId, lang);
|
articleId, lang);
|
||||||
|
|
|
@ -35,7 +35,7 @@ import net.osmand.plus.wikivoyage.WikivoyageBaseDialogFragment;
|
||||||
import net.osmand.plus.wikivoyage.WikivoyageShowPicturesDialogFragment;
|
import net.osmand.plus.wikivoyage.WikivoyageShowPicturesDialogFragment;
|
||||||
import net.osmand.plus.wikivoyage.WikivoyageWebViewClient;
|
import net.osmand.plus.wikivoyage.WikivoyageWebViewClient;
|
||||||
import net.osmand.plus.wikivoyage.data.WikivoyageArticle;
|
import net.osmand.plus.wikivoyage.data.WikivoyageArticle;
|
||||||
import net.osmand.plus.wikivoyage.data.WikivoyageDbHelper;
|
import net.osmand.plus.wikivoyage.data.TravelDbHelper;
|
||||||
import net.osmand.plus.wikivoyage.data.WikivoyageLocalDataHelper;
|
import net.osmand.plus.wikivoyage.data.WikivoyageLocalDataHelper;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ public class WikivoyageArticleDialogFragment extends WikivoyageBaseDialogFragmen
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final GPXFile gpx = article.getGpxFile();
|
final GPXFile gpx = article.getGpxFile();
|
||||||
WikivoyageDbHelper dbHelper = getMyApplication().getWikivoyageDbHelper();
|
TravelDbHelper dbHelper = getMyApplication().getTravelDbHelper();
|
||||||
File file = getMyApplication().getAppPath(IndexConstants.GPX_TRAVEL_DIR + dbHelper.getGPXName(article));
|
File file = getMyApplication().getAppPath(IndexConstants.GPX_TRAVEL_DIR + dbHelper.getGPXName(article));
|
||||||
|
|
||||||
GPXUtilities.writeGpxFile(file, gpx, getMyApplication());
|
GPXUtilities.writeGpxFile(file, gpx, getMyApplication());
|
||||||
|
@ -267,7 +267,7 @@ public class WikivoyageArticleDialogFragment extends WikivoyageBaseDialogFragmen
|
||||||
|
|
||||||
private void updateSaveButton() {
|
private void updateSaveButton() {
|
||||||
if (article != null) {
|
if (article != null) {
|
||||||
final WikivoyageLocalDataHelper helper = getMyApplication().getWikivoyageDbHelper().getLocalDataHelper();
|
final WikivoyageLocalDataHelper helper = getMyApplication().getTravelDbHelper().getLocalDataHelper();
|
||||||
final boolean saved = helper.isArticleSaved(article);
|
final boolean saved = helper.isArticleSaved(article);
|
||||||
Drawable icon = getActiveIcon(saved ? R.drawable.ic_action_read_later_fill : R.drawable.ic_action_read_later);
|
Drawable icon = getActiveIcon(saved ? R.drawable.ic_action_read_later_fill : R.drawable.ic_action_read_later);
|
||||||
saveBtn.setText(getString(saved ? R.string.shared_string_delete : R.string.shared_string_save));
|
saveBtn.setText(getString(saved ? R.string.shared_string_delete : R.string.shared_string_save));
|
||||||
|
@ -326,7 +326,7 @@ public class WikivoyageArticleDialogFragment extends WikivoyageBaseDialogFragmen
|
||||||
selectedLang = langs.get(0);
|
selectedLang = langs.get(0);
|
||||||
}
|
}
|
||||||
articleToolbarText.setText("");
|
articleToolbarText.setText("");
|
||||||
article = getMyApplication().getWikivoyageDbHelper().getArticle(cityId, selectedLang);
|
article = getMyApplication().getTravelDbHelper().getArticle(cityId, selectedLang);
|
||||||
if (article == null) {
|
if (article == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -335,7 +335,7 @@ public class WikivoyageArticleDialogFragment extends WikivoyageBaseDialogFragmen
|
||||||
trackButton.setText(getString(R.string.points) + " (" + article.getGpxFile().getPointsSize() +")");
|
trackButton.setText(getString(R.string.points) + " (" + article.getGpxFile().getPointsSize() +")");
|
||||||
}
|
}
|
||||||
|
|
||||||
WikivoyageLocalDataHelper ldh = getMyApplication().getWikivoyageDbHelper().getLocalDataHelper();
|
WikivoyageLocalDataHelper ldh = getMyApplication().getTravelDbHelper().getLocalDataHelper();
|
||||||
ldh.addToHistory(article);
|
ldh.addToHistory(article);
|
||||||
|
|
||||||
updateSaveButton();
|
updateSaveButton();
|
||||||
|
@ -387,7 +387,7 @@ public class WikivoyageArticleDialogFragment extends WikivoyageBaseDialogFragmen
|
||||||
@NonNull FragmentManager fm,
|
@NonNull FragmentManager fm,
|
||||||
long cityId,
|
long cityId,
|
||||||
@Nullable String selectedLang) {
|
@Nullable String selectedLang) {
|
||||||
ArrayList<String> langs = app.getWikivoyageDbHelper().getArticleLangs(cityId);
|
ArrayList<String> langs = app.getTravelDbHelper().getArticleLangs(cityId);
|
||||||
return showInstance(fm, cityId, langs, selectedLang);
|
return showInstance(fm, cityId, langs, selectedLang);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,9 +29,9 @@ import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
import gnu.trove.map.hash.TLongObjectHashMap;
|
import gnu.trove.map.hash.TLongObjectHashMap;
|
||||||
|
|
||||||
public class WikivoyageDbHelper {
|
public class TravelDbHelper {
|
||||||
|
|
||||||
private static final Log LOG = PlatformUtil.getLog(WikivoyageDbHelper.class);
|
private static final Log LOG = PlatformUtil.getLog(TravelDbHelper.class);
|
||||||
|
|
||||||
private static final String ARTICLES_TABLE_NAME = "wikivoyage_articles";
|
private static final String ARTICLES_TABLE_NAME = "wikivoyage_articles";
|
||||||
private static final String ARTICLES_COL_ID = "article_id";
|
private static final String ARTICLES_COL_ID = "article_id";
|
||||||
|
@ -79,7 +79,7 @@ public class WikivoyageDbHelper {
|
||||||
private boolean initialized = false;
|
private boolean initialized = false;
|
||||||
|
|
||||||
|
|
||||||
public WikivoyageDbHelper(OsmandApplication application) {
|
public TravelDbHelper(OsmandApplication application) {
|
||||||
this.application = application;
|
this.application = application;
|
||||||
collator = OsmAndCollator.primaryCollator();
|
collator = OsmAndCollator.primaryCollator();
|
||||||
if(application.getSettings().SELECTED_TRAVEL_BOOK.get() != null) {
|
if(application.getSettings().SELECTED_TRAVEL_BOOK.get() != null) {
|
|
@ -246,8 +246,8 @@ public class WikivoyageLocalDataHelper {
|
||||||
if (oldVersion < 3) {
|
if (oldVersion < 3) {
|
||||||
conn.execSQL("ALTER TABLE " + HISTORY_TABLE_NAME + " ADD " + HISTORY_COL_TRAVEL_BOOK + " TEXT");
|
conn.execSQL("ALTER TABLE " + HISTORY_TABLE_NAME + " ADD " + HISTORY_COL_TRAVEL_BOOK + " TEXT");
|
||||||
conn.execSQL("ALTER TABLE " + BOOKMARKS_TABLE_NAME + " ADD " + BOOKMARKS_COL_TRAVEL_BOOK + " TEXT");
|
conn.execSQL("ALTER TABLE " + BOOKMARKS_TABLE_NAME + " ADD " + BOOKMARKS_COL_TRAVEL_BOOK + " TEXT");
|
||||||
if(context.getWikivoyageDbHelper().getSelectedTravelBook() != null) {
|
if(context.getTravelDbHelper().getSelectedTravelBook() != null) {
|
||||||
Object[] args = new Object[]{context.getWikivoyageDbHelper().getSelectedTravelBook().getName()};
|
Object[] args = new Object[]{context.getTravelDbHelper().getSelectedTravelBook().getName()};
|
||||||
conn.execSQL("UPDATE " + HISTORY_TABLE_NAME + " SET " + HISTORY_COL_TRAVEL_BOOK + " = ?", args);
|
conn.execSQL("UPDATE " + HISTORY_TABLE_NAME + " SET " + HISTORY_COL_TRAVEL_BOOK + " = ?", args);
|
||||||
conn.execSQL("UPDATE " + BOOKMARKS_TABLE_NAME + " SET " + BOOKMARKS_COL_TRAVEL_BOOK + " = ?", args);
|
conn.execSQL("UPDATE " + BOOKMARKS_TABLE_NAME + " SET " + BOOKMARKS_COL_TRAVEL_BOOK + " = ?", args);
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,7 +191,7 @@ public class SavedArticlesRvAdapter extends RecyclerView.Adapter<RecyclerView.Vi
|
||||||
Object item = getItemByPosition();
|
Object item = getItemByPosition();
|
||||||
if (item != null && item instanceof WikivoyageArticle) {
|
if (item != null && item instanceof WikivoyageArticle) {
|
||||||
final WikivoyageArticle article = (WikivoyageArticle) item;
|
final WikivoyageArticle article = (WikivoyageArticle) item;
|
||||||
final WikivoyageLocalDataHelper ldh = app.getWikivoyageDbHelper().getLocalDataHelper();;
|
final WikivoyageLocalDataHelper ldh = app.getTravelDbHelper().getLocalDataHelper();;
|
||||||
ldh.removeArticleFromSaved(article);
|
ldh.removeArticleFromSaved(article);
|
||||||
Snackbar snackbar = Snackbar.make(itemView, R.string.article_removed, Snackbar.LENGTH_LONG)
|
Snackbar snackbar = Snackbar.make(itemView, R.string.article_removed, Snackbar.LENGTH_LONG)
|
||||||
.setAction(R.string.shared_string_undo, new View.OnClickListener() {
|
.setAction(R.string.shared_string_undo, new View.OnClickListener() {
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class SavedArticlesTabFragment extends BaseOsmAndFragment implements Wiki
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
final OsmandApplication app = getMyApplication();
|
final OsmandApplication app = getMyApplication();
|
||||||
dataHelper = app.getWikivoyageDbHelper().getLocalDataHelper();
|
dataHelper = app.getTravelDbHelper().getLocalDataHelper();
|
||||||
|
|
||||||
final View mainView = inflater.inflate(R.layout.fragment_saved_articles_tab, container, false);
|
final View mainView = inflater.inflate(R.layout.fragment_saved_articles_tab, container, false);
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithDescription;
|
||||||
import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem;
|
import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem;
|
||||||
import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerHalfItem;
|
import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerHalfItem;
|
||||||
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
|
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
|
||||||
import net.osmand.plus.wikivoyage.data.WikivoyageDbHelper;
|
import net.osmand.plus.wikivoyage.data.TravelDbHelper;
|
||||||
import net.osmand.plus.wikivoyage.data.WikivoyageLocalDataHelper;
|
import net.osmand.plus.wikivoyage.data.WikivoyageLocalDataHelper;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -35,7 +35,7 @@ public class WikivoyageOptionsBottomSheetDialogFragment extends MenuBottomSheetD
|
||||||
public void createMenuItems(Bundle savedInstanceState) {
|
public void createMenuItems(Bundle savedInstanceState) {
|
||||||
final OsmandApplication app = getMyApplication();
|
final OsmandApplication app = getMyApplication();
|
||||||
final OsmandSettings.CommonPreference<WikivoyageShowImages> showImagesPref = app.getSettings().WIKIVOYAGE_SHOW_IMAGES;
|
final OsmandSettings.CommonPreference<WikivoyageShowImages> showImagesPref = app.getSettings().WIKIVOYAGE_SHOW_IMAGES;
|
||||||
final WikivoyageDbHelper dbHelper = app.getWikivoyageDbHelper();
|
final TravelDbHelper dbHelper = app.getTravelDbHelper();
|
||||||
|
|
||||||
items.add(new TitleItem(getString(R.string.shared_string_options)));
|
items.add(new TitleItem(getString(R.string.shared_string_options)));
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ public class WikivoyageOptionsBottomSheetDialogFragment extends MenuBottomSheetD
|
||||||
.setOnClickListener(new View.OnClickListener() {
|
.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
WikivoyageLocalDataHelper ldh = getMyApplication().getWikivoyageDbHelper().getLocalDataHelper();
|
WikivoyageLocalDataHelper ldh = getMyApplication().getTravelDbHelper().getLocalDataHelper();
|
||||||
ldh.clearHistory();
|
ldh.clearHistory();
|
||||||
dismiss();
|
dismiss();
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,7 @@ public class WikivoyageOptionsBottomSheetDialogFragment extends MenuBottomSheetD
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void selectTravelBookDialog() {
|
protected void selectTravelBookDialog() {
|
||||||
final WikivoyageDbHelper dbHelper = getMyApplication().getWikivoyageDbHelper();
|
final TravelDbHelper dbHelper = getMyApplication().getTravelDbHelper();
|
||||||
final List<File> list = dbHelper.getExistingTravelBooks();
|
final List<File> list = dbHelper.getExistingTravelBooks();
|
||||||
String[] ls = new String[list.size()];
|
String[] ls = new String[list.size()];
|
||||||
for (int i = 0; i < ls.length; i++) {
|
for (int i = 0; i < ls.length; i++) {
|
||||||
|
|
|
@ -147,7 +147,7 @@ public class WikivoyageSearchDialogFragment extends WikivoyageBaseDialogFragment
|
||||||
|
|
||||||
private void setAdapterItems(@Nullable List<WikivoyageSearchResult> items) {
|
private void setAdapterItems(@Nullable List<WikivoyageSearchResult> items) {
|
||||||
if (items == null || items.isEmpty()) {
|
if (items == null || items.isEmpty()) {
|
||||||
WikivoyageLocalDataHelper ldh = getMyApplication().getWikivoyageDbHelper().getLocalDataHelper();
|
WikivoyageLocalDataHelper ldh = getMyApplication().getTravelDbHelper().getLocalDataHelper();
|
||||||
adapter.setHistoryItems(ldh.getAllHistory());
|
adapter.setHistoryItems(ldh.getAllHistory());
|
||||||
} else {
|
} else {
|
||||||
adapter.setItems(items);
|
adapter.setItems(items);
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class WikivoyageSearchHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isCancelled()) {
|
if (!isCancelled()) {
|
||||||
List<WikivoyageSearchResult> results = application.getWikivoyageDbHelper().search(query);
|
List<WikivoyageSearchResult> results = application.getTravelDbHelper().search(query);
|
||||||
if (!isCancelled()) {
|
if (!isCancelled()) {
|
||||||
rm.publish(results);
|
rm.publish(results);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue