Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
4f88d92b61
16 changed files with 157 additions and 31 deletions
|
@ -33,6 +33,8 @@ public class IndexConstants {
|
|||
public static final String TTSVOICE_INDEX_EXT_ZIP = ".ttsvoice.zip"; //$NON-NLS-1$
|
||||
public static final String ANYVOICE_INDEX_EXT_ZIP = "voice.zip"; //$NON-NLS-1$ //to cactch both voices, .voice.zip and .ttsvoice.zip
|
||||
|
||||
public static final String FONT_INDEX_EXT = ".otf"; //$NON-NLS-1$
|
||||
public static final String FONT_INDEX_EXT_ZIP = ".otf.zip"; //$NON-NLS-1$
|
||||
|
||||
|
||||
public static final String RENDERER_INDEX_EXT = ".render.xml"; //$NON-NLS-1$
|
||||
|
@ -53,6 +55,7 @@ public class IndexConstants {
|
|||
public static final String ROADS_INDEX_DIR = "roads/"; //$NON-NLS-1$
|
||||
public static final String WIKI_INDEX_DIR = "wiki/"; //$NON-NLS-1$
|
||||
public static final String AV_INDEX_DIR = "avnotes/"; //$NON-NLS-1$
|
||||
public static final String FONT_INDEX_DIR = "fonts/"; //$NON-NLS-1$
|
||||
public static final String VOICE_INDEX_DIR = "voice/"; //$NON-NLS-1$
|
||||
public static final String RENDERERS_DIR = "rendering/"; //$NON-NLS-1$
|
||||
public static final String ROUTING_XML_FILE= "routing.xml";
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
||||
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
||||
-->
|
||||
<string name="fonts_header">Fonts for map</string>
|
||||
<string name="right_side_navigation">Right-hand driving</string>
|
||||
<string name="driving_region_automatic">Automatic</string>
|
||||
<string name="do_not_send_anonymous_app_usage">Do not send anonymous app usage</string>
|
||||
|
|
|
@ -89,6 +89,8 @@ public class LocalIndexHelper {
|
|||
info.setDescription(getInstalledDate(f));
|
||||
} else if (info.getType() == LocalIndexType.VOICE_DATA) {
|
||||
info.setDescription(getInstalledDate(f));
|
||||
} else if (info.getType() == LocalIndexType.FONT_DATA) {
|
||||
info.setDescription(getInstalledDate(f));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -210,6 +212,7 @@ public class LocalIndexHelper {
|
|||
loadWikiData(app.getAppPath(IndexConstants.WIKI_INDEX_DIR), result, loadTask);
|
||||
//loadVoiceData(app.getAppPath(IndexConstants.TTSVOICE_INDEX_EXT_ZIP), result, true, loadTask);
|
||||
loadVoiceData(app.getAppPath(IndexConstants.VOICE_INDEX_DIR), result, false, loadTask);
|
||||
loadFontData(app.getAppPath(IndexConstants.FONT_INDEX_DIR), result, false, loadTask);
|
||||
loadObfData(app.getAppPath(IndexConstants.BACKUP_INDEX_DIR), result, true, loadTask, loadedMaps);
|
||||
|
||||
return result;
|
||||
|
@ -255,6 +258,20 @@ public class LocalIndexHelper {
|
|||
}
|
||||
}
|
||||
|
||||
private void loadFontData(File fontDir, List<LocalIndexInfo> result, boolean backup, AbstractLoadLocalIndexTask loadTask) {
|
||||
if (fontDir.canRead()) {
|
||||
for (File fontFile : listFilesSorted(fontDir)) {
|
||||
if (fontFile.isFile() && fontFile.getName().endsWith(IndexConstants.FONT_INDEX_EXT)) {
|
||||
LocalIndexType lt = LocalIndexType.FONT_DATA;
|
||||
LocalIndexInfo info = new LocalIndexInfo(lt, fontFile, backup, app);
|
||||
updateDescription(info);
|
||||
result.add(info);
|
||||
loadTask.loadFile(info);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void loadTilesData(File tilesPath, List<LocalIndexInfo> result, boolean backup, AbstractLoadLocalIndexTask loadTask) {
|
||||
if (tilesPath.canRead()) {
|
||||
for (File tileFile : listFilesSorted(tilesPath)) {
|
||||
|
@ -342,6 +359,7 @@ public class LocalIndexHelper {
|
|||
WIKI_DATA(R.string.local_indexes_cat_wiki, R.drawable.ic_plugin_wikipedia, 50),
|
||||
TTS_VOICE_DATA(R.string.local_indexes_cat_tts, R.drawable.ic_action_volume_up, 20),
|
||||
VOICE_DATA(R.string.local_indexes_cat_voice, R.drawable.ic_action_volume_up, 30),
|
||||
FONT_DATA(R.string.fonts_header, R.drawable.ic_action_map_language, 35),
|
||||
DEACTIVATED(R.string.local_indexes_cat_backup, R.drawable.ic_type_archive, 1000);
|
||||
// AV_DATA(R.string.local_indexes_cat_av);;
|
||||
|
||||
|
@ -392,6 +410,13 @@ public class LocalIndexHelper {
|
|||
}
|
||||
return fileName.substring(0, l);
|
||||
}
|
||||
if (this == FONT_DATA) {
|
||||
int l = fileName.indexOf('.');
|
||||
if (l == -1) {
|
||||
l = fileName.length();
|
||||
}
|
||||
return fileName.substring(0, l).replace('_', ' ').replace('-', ' ');
|
||||
}
|
||||
int ls = fileName.lastIndexOf('_');
|
||||
if (ls >= 0) {
|
||||
return fileName.substring(0, ls);
|
||||
|
|
|
@ -2,6 +2,7 @@ package net.osmand.plus.download;
|
|||
|
||||
import android.Manifest;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.AsyncTask;
|
||||
|
@ -17,6 +18,7 @@ import android.support.v4.app.FragmentActivity;
|
|||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.support.v4.widget.Space;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.widget.AppCompatButton;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.view.LayoutInflater;
|
||||
|
@ -33,6 +35,7 @@ import android.widget.TextView;
|
|||
import android.widget.Toast;
|
||||
|
||||
import net.osmand.IProgress;
|
||||
import net.osmand.IndexConstants;
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.access.AccessibilityAssistant;
|
||||
import net.osmand.data.LatLon;
|
||||
|
@ -281,6 +284,19 @@ public class DownloadActivity extends AbstractDownloadActivity implements Downlo
|
|||
downloadItem = null;
|
||||
downloadTargetFileName = null;
|
||||
}
|
||||
if (!Algorithms.isEmpty(downloadTargetFileName) && downloadTargetFileName.endsWith(IndexConstants.FONT_INDEX_EXT)) {
|
||||
AlertDialog.Builder bld = new AlertDialog.Builder(this);
|
||||
bld.setMessage(R.string.restart_is_required);
|
||||
bld.setPositiveButton(R.string.shared_string_ok, new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
android.os.Process.killProcess(android.os.Process.myPid());
|
||||
}
|
||||
});
|
||||
bld.setNegativeButton(R.string.shared_string_cancel, null);
|
||||
bld.show();
|
||||
}
|
||||
for (WeakReference<Fragment> ref : fragSet) {
|
||||
Fragment f = ref.get();
|
||||
if (f instanceof DownloadEvents && f.isAdded()) {
|
||||
|
|
|
@ -33,17 +33,16 @@ public class DownloadActivityType {
|
|||
new DownloadActivityType(R.string.download_regular_maps, "map", 10);
|
||||
public static final DownloadActivityType VOICE_FILE =
|
||||
new DownloadActivityType(R.string.voices, R.drawable.ic_action_volume_up, "voice", 20);
|
||||
public static final DownloadActivityType FONT_FILE =
|
||||
new DownloadActivityType(R.string.fonts_header, R.drawable.ic_action_map_language, "fonts", 25);
|
||||
public static final DownloadActivityType ROADS_FILE =
|
||||
new DownloadActivityType(R.string.download_roads_only_maps, "road_map", 30);
|
||||
public static final DownloadActivityType SRTM_COUNTRY_FILE =
|
||||
new DownloadActivityType(R.string.download_srtm_maps,
|
||||
R.drawable.ic_plugin_srtm, "srtm_map", 40);
|
||||
new DownloadActivityType(R.string.download_srtm_maps, R.drawable.ic_plugin_srtm, "srtm_map", 40);
|
||||
public static final DownloadActivityType HILLSHADE_FILE =
|
||||
new DownloadActivityType(R.string.download_hillshade_maps,
|
||||
R.drawable.ic_action_hillshade_dark, "hillshade", 50);
|
||||
new DownloadActivityType(R.string.download_hillshade_maps, R.drawable.ic_action_hillshade_dark, "hillshade", 50);
|
||||
public static final DownloadActivityType WIKIPEDIA_FILE =
|
||||
new DownloadActivityType(R.string.download_wikipedia_maps,
|
||||
R.drawable.ic_plugin_wikipedia, "wikimap", 60);
|
||||
new DownloadActivityType(R.string.download_wikipedia_maps, R.drawable.ic_plugin_wikipedia, "wikimap", 60);
|
||||
public static final DownloadActivityType LIVE_UPDATES_FILE =
|
||||
new DownloadActivityType(R.string.download_live_updates, "live_updates", 70);
|
||||
private final int stringResource;
|
||||
|
@ -115,6 +114,8 @@ public class DownloadActivityType {
|
|||
return fileName.endsWith(addVersionToExt(IndexConstants.BINARY_ROAD_MAP_INDEX_EXT_ZIP, IndexConstants.BINARY_MAP_VERSION));
|
||||
} else if (VOICE_FILE == this) {
|
||||
return fileName.endsWith(addVersionToExt(IndexConstants.VOICE_INDEX_EXT_ZIP, IndexConstants.VOICE_VERSION));
|
||||
} else if (FONT_FILE == this) {
|
||||
return fileName.endsWith(IndexConstants.FONT_INDEX_EXT_ZIP);
|
||||
} else if (WIKIPEDIA_FILE == this) {
|
||||
return fileName.endsWith(addVersionToExt(IndexConstants.BINARY_WIKI_MAP_INDEX_EXT_ZIP,
|
||||
IndexConstants.BINARY_MAP_VERSION));
|
||||
|
@ -135,6 +136,8 @@ public class DownloadActivityType {
|
|||
return ctx.getAppPath(IndexConstants.MAPS_PATH);
|
||||
} else if (VOICE_FILE == this) {
|
||||
return ctx.getAppPath(IndexConstants.VOICE_INDEX_DIR);
|
||||
} else if (FONT_FILE == this) {
|
||||
return ctx.getAppPath(IndexConstants.FONT_INDEX_DIR);
|
||||
} else if (ROADS_FILE == this) {
|
||||
return ctx.getAppPath(IndexConstants.ROADS_INDEX_DIR);
|
||||
} else if (SRTM_COUNTRY_FILE == this) {
|
||||
|
@ -178,6 +181,8 @@ public class DownloadActivityType {
|
|||
return IndexConstants.BINARY_ROAD_MAP_INDEX_EXT;
|
||||
} else if (VOICE_FILE == this) {
|
||||
return "";
|
||||
} else if (FONT_FILE == this) {
|
||||
return IndexConstants.FONT_INDEX_EXT;
|
||||
} else if (SRTM_COUNTRY_FILE == this) {
|
||||
return IndexConstants.BINARY_SRTM_MAP_INDEX_EXT;
|
||||
} else if (WIKIPEDIA_FILE == this) {
|
||||
|
@ -206,9 +211,14 @@ public class DownloadActivityType {
|
|||
}
|
||||
|
||||
public String getBaseUrl(OsmandApplication ctx, String fileName) {
|
||||
if (this == FONT_FILE) {
|
||||
return "http://" + IndexConstants.INDEX_DOWNLOAD_DOMAIN + "/download?event=2&fonts=yes&"
|
||||
+ Version.getVersionAsURLParam(ctx) + "&file=" + encode(fileName);
|
||||
} else {
|
||||
return "http://" + IndexConstants.INDEX_DOWNLOAD_DOMAIN + "/download?event=2&"
|
||||
+ Version.getVersionAsURLParam(ctx) + "&file=" + encode(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected String encode(String fileName) {
|
||||
|
@ -268,6 +278,9 @@ public class DownloadActivityType {
|
|||
}
|
||||
return getBasename(indexItem);
|
||||
}
|
||||
if (this == FONT_FILE) {
|
||||
return FileNameTranslationHelper.getFontName(ctx, getBasename(indexItem));
|
||||
}
|
||||
final String basename = getBasename(indexItem);
|
||||
if (basename.endsWith(FileNameTranslationHelper.WIKI_NAME)){
|
||||
return FileNameTranslationHelper.getWikiName(ctx, basename);
|
||||
|
@ -300,6 +313,12 @@ public class DownloadActivityType {
|
|||
l = fileName.length();
|
||||
}
|
||||
return fileName.substring(0, l);
|
||||
} else if (this == FONT_FILE) {
|
||||
int l = fileName.indexOf('.');
|
||||
if (l == -1) {
|
||||
l = fileName.length();
|
||||
}
|
||||
return fileName.substring(0, l) + IndexConstants.FONT_INDEX_EXT;
|
||||
} else if (this == HILLSHADE_FILE) {
|
||||
return fileName.replace('_', ' ');
|
||||
} else if (this == LIVE_UPDATES_FILE) {
|
||||
|
@ -355,6 +374,13 @@ public class DownloadActivityType {
|
|||
}
|
||||
return fileName.substring(0, l);
|
||||
}
|
||||
if (this == FONT_FILE) {
|
||||
int l = fileName.indexOf('.');
|
||||
if (l == -1) {
|
||||
l = fileName.length();
|
||||
}
|
||||
return fileName.substring(0, l);
|
||||
}
|
||||
if (this == LIVE_UPDATES_FILE) {
|
||||
if(fileName.indexOf('.') > 0){
|
||||
return fileName.substring(0, fileName.indexOf('.'));
|
||||
|
|
|
@ -586,6 +586,7 @@ public class DownloadIndexesThread {
|
|||
}
|
||||
List<String> warnings = new ArrayList<String>();
|
||||
manager.indexVoiceFiles(this);
|
||||
manager.indexFontFiles(this);
|
||||
if (vectorMapsToReindex) {
|
||||
warnings = manager.indexingMaps(this);
|
||||
}
|
||||
|
|
|
@ -37,12 +37,15 @@ public class DownloadResourceGroup {
|
|||
// headers with voice items
|
||||
VOICE_HEADER_TTS(R.string.index_name_tts_voice),
|
||||
VOICE_HEADER_REC(R.string.index_name_voice),
|
||||
// headers with font items
|
||||
FONTS_HEADER(R.string.fonts_header),
|
||||
// headers with resources
|
||||
OTHER_MAPS_GROUP(R.string.download_select_map_types),
|
||||
VOICE_GROUP(R.string.voices),
|
||||
OTHER_GROUP(R.string.other_menu_group),
|
||||
SUBREGIONS(R.string.regions),
|
||||
// screen items
|
||||
VOICE_TTS(R.string.index_name_tts_voice),
|
||||
FONTS(R.string.fonts_header),
|
||||
VOICE_REC(R.string.index_name_voice),
|
||||
OTHER_MAPS(R.string.download_select_map_types),
|
||||
WORLD(-1),
|
||||
|
@ -56,7 +59,7 @@ public class DownloadResourceGroup {
|
|||
|
||||
public boolean isScreen() {
|
||||
return this == WORLD || this == REGION || this == VOICE_TTS
|
||||
|| this == VOICE_REC || this == OTHER_MAPS;
|
||||
|| this == VOICE_REC || this == OTHER_MAPS || this == FONTS;
|
||||
}
|
||||
|
||||
public String getDefaultId() {
|
||||
|
@ -68,18 +71,19 @@ public class DownloadResourceGroup {
|
|||
}
|
||||
|
||||
public boolean containsIndexItem() {
|
||||
return isHeader() && this != SUBREGIONS && this != VOICE_GROUP && this != OTHER_MAPS_GROUP;
|
||||
return isHeader() && this != SUBREGIONS && this != OTHER_GROUP && this != OTHER_MAPS_GROUP;
|
||||
}
|
||||
|
||||
public boolean isHeader() {
|
||||
return this == VOICE_HEADER_REC || this == VOICE_HEADER_TTS || this == SUBREGIONS
|
||||
|| this == WORLD_MAPS || this == REGION_MAPS || this == VOICE_GROUP
|
||||
|| this == WORLD_MAPS || this == REGION_MAPS || this == OTHER_GROUP
|
||||
|| this == HILLSHADE_HEADER || this == SRTM_HEADER
|
||||
|| this == OTHER_MAPS_HEADER || this == OTHER_MAPS_GROUP;
|
||||
|| this == OTHER_MAPS_HEADER || this == OTHER_MAPS_GROUP
|
||||
|| this == FONTS_HEADER;
|
||||
}
|
||||
|
||||
public static String getVoiceTTSId() {
|
||||
return "#" + VOICE_GROUP.name().toLowerCase() + "#" + VOICE_TTS.name().toLowerCase();
|
||||
return "#" + OTHER_GROUP.name().toLowerCase() + "#" + VOICE_TTS.name().toLowerCase();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -155,6 +155,8 @@ public class DownloadResources extends DownloadResourceGroup {
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if (item.getType() == DownloadActivityType.FONT_FILE) {
|
||||
oldItemSize = new File(app.getAppPath(IndexConstants.FONT_INDEX_DIR), item.getTargetFileName()).length();
|
||||
} else {
|
||||
oldItemSize = app.getAppPath(item.getTargetFileName()).length();
|
||||
}
|
||||
|
@ -244,11 +246,13 @@ public class DownloadResources extends DownloadResourceGroup {
|
|||
otherMapsScreen.addGroup(otherMaps);
|
||||
otherMapsGroup.addGroup(otherMapsScreen);
|
||||
|
||||
DownloadResourceGroup voiceGroup = new DownloadResourceGroup(this, DownloadResourceGroupType.VOICE_GROUP);
|
||||
DownloadResourceGroup voiceScreenTTS = new DownloadResourceGroup(voiceGroup, DownloadResourceGroupType.VOICE_TTS);
|
||||
DownloadResourceGroup voiceScreenRec = new DownloadResourceGroup(voiceGroup, DownloadResourceGroupType.VOICE_REC);
|
||||
DownloadResourceGroup voiceTTS = new DownloadResourceGroup(voiceGroup, DownloadResourceGroupType.VOICE_HEADER_TTS);
|
||||
DownloadResourceGroup voiceRec = new DownloadResourceGroup(voiceGroup, DownloadResourceGroupType.VOICE_HEADER_REC);
|
||||
DownloadResourceGroup otherGroup = new DownloadResourceGroup(this, DownloadResourceGroupType.OTHER_GROUP);
|
||||
DownloadResourceGroup voiceScreenTTS = new DownloadResourceGroup(otherGroup, DownloadResourceGroupType.VOICE_TTS);
|
||||
DownloadResourceGroup voiceScreenRec = new DownloadResourceGroup(otherGroup, DownloadResourceGroupType.VOICE_REC);
|
||||
DownloadResourceGroup fontScreen = new DownloadResourceGroup(otherGroup, DownloadResourceGroupType.FONTS);
|
||||
DownloadResourceGroup voiceTTS = new DownloadResourceGroup(otherGroup, DownloadResourceGroupType.VOICE_HEADER_TTS);
|
||||
DownloadResourceGroup voiceRec = new DownloadResourceGroup(otherGroup, DownloadResourceGroupType.VOICE_HEADER_REC);
|
||||
DownloadResourceGroup fonts = new DownloadResourceGroup(otherGroup, DownloadResourceGroupType.FONTS_HEADER);
|
||||
|
||||
DownloadResourceGroup worldMaps = new DownloadResourceGroup(this, DownloadResourceGroupType.WORLD_MAPS);
|
||||
Map<WorldRegion, List<IndexItem> > groupByRegion = new LinkedHashMap<WorldRegion, List<IndexItem>>();
|
||||
|
@ -262,6 +266,10 @@ public class DownloadResources extends DownloadResourceGroup {
|
|||
}
|
||||
continue;
|
||||
}
|
||||
if (ii.getType() == DownloadActivityType.FONT_FILE) {
|
||||
fonts.addItem(ii);
|
||||
continue;
|
||||
}
|
||||
String basename = ii.getBasename().toLowerCase();
|
||||
WorldRegion wg = regs.getRegionDataByDownloadName(basename);
|
||||
if (wg != null) {
|
||||
|
@ -322,9 +330,15 @@ public class DownloadResources extends DownloadResourceGroup {
|
|||
|
||||
voiceScreenTTS.addGroup(voiceTTS);
|
||||
voiceScreenRec.addGroup(voiceRec);
|
||||
voiceGroup.addGroup(voiceScreenTTS);
|
||||
voiceGroup.addGroup(voiceScreenRec);
|
||||
addGroup(voiceGroup);
|
||||
if (fonts.getIndividualResources() != null) {
|
||||
fontScreen.addGroup(fonts);
|
||||
}
|
||||
otherGroup.addGroup(voiceScreenTTS);
|
||||
otherGroup.addGroup(voiceScreenRec);
|
||||
if (fonts.getIndividualResources() != null) {
|
||||
otherGroup.addGroup(fontScreen);
|
||||
}
|
||||
addGroup(otherGroup);
|
||||
|
||||
createHillshadeSRTMGroups();
|
||||
trimEmptyGroups();
|
||||
|
|
|
@ -30,6 +30,8 @@ public class DownloadGroupViewHolder {
|
|||
if (group.getType() == DownloadResourceGroup.DownloadResourceGroupType.VOICE_REC
|
||||
|| group.getType() == DownloadResourceGroup.DownloadResourceGroupType.VOICE_TTS) {
|
||||
iconLeft = ctx.getMyApplication().getIconsCache().getThemedIcon(R.drawable.ic_action_volume_up);
|
||||
} else if (group.getType() == DownloadResourceGroup.DownloadResourceGroupType.FONTS) {
|
||||
iconLeft = ctx.getMyApplication().getIconsCache().getThemedIcon(R.drawable.ic_action_map_language);
|
||||
} else {
|
||||
IconsCache cache = ctx.getMyApplication().getIconsCache();
|
||||
if (isParentWorld(group) || isParentWorld(group.getParentGroup())) {
|
||||
|
|
|
@ -308,6 +308,8 @@ public class DownloadResourceGroupFragment extends DialogFragment implements Dow
|
|||
if (group.getType() == DownloadResourceGroupType.VOICE_REC
|
||||
|| group.getType() == DownloadResourceGroupType.VOICE_TTS) {
|
||||
iconLeft = ctx.getMyApplication().getIconsCache().getThemedIcon(R.drawable.ic_action_volume_up);
|
||||
} else if (group.getType() == DownloadResourceGroupType.FONTS) {
|
||||
iconLeft = ctx.getMyApplication().getIconsCache().getThemedIcon(R.drawable.ic_action_map_language);
|
||||
} else {
|
||||
IconsCache cache = ctx.getMyApplication().getIconsCache();
|
||||
if (isParentWorld(group) || isParentWorld(group.getParentGroup())) {
|
||||
|
|
|
@ -400,6 +400,8 @@ public class ItemViewHolder {
|
|||
tp = LocalIndexType.SRTM_DATA;
|
||||
} else if (indexItem.getType() == DownloadActivityType.WIKIPEDIA_FILE) {
|
||||
tp = LocalIndexType.MAP_DATA;
|
||||
} else if (indexItem.getType() == DownloadActivityType.FONT_FILE) {
|
||||
tp = LocalIndexType.FONT_DATA;
|
||||
} else if (indexItem.getType() == DownloadActivityType.VOICE_FILE) {
|
||||
tp = indexItem.getBasename().contains("tts") ? LocalIndexType.TTS_VOICE_DATA
|
||||
: LocalIndexType.VOICE_DATA;
|
||||
|
|
|
@ -197,7 +197,8 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
|
|||
.setListener(listener)
|
||||
.setPosition(2).createItem());
|
||||
}
|
||||
if (info.getType() != LocalIndexType.TTS_VOICE_DATA && info.getType() != LocalIndexType.VOICE_DATA) {
|
||||
if (info.getType() != LocalIndexType.TTS_VOICE_DATA && info.getType() != LocalIndexType.VOICE_DATA
|
||||
&& info.getType() != LocalIndexType.FONT_DATA) {
|
||||
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
||||
.setTitleId(R.string.shared_string_rename, getContext())
|
||||
.setListener(listener)
|
||||
|
@ -447,6 +448,8 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
|
|||
parent = getMyApplication().getAppPath(IndexConstants.VOICE_INDEX_DIR);
|
||||
} else if (i.getOriginalType() == LocalIndexType.VOICE_DATA) {
|
||||
parent = getMyApplication().getAppPath(IndexConstants.VOICE_INDEX_DIR);
|
||||
} else if (i.getOriginalType() == LocalIndexType.FONT_DATA) {
|
||||
parent = getMyApplication().getAppPath(IndexConstants.FONT_INDEX_DIR);
|
||||
}
|
||||
return new File(parent, i.getFileName());
|
||||
}
|
||||
|
|
|
@ -478,7 +478,8 @@ public class SearchDialogFragment extends DialogFragment implements DownloadEven
|
|||
// process other maps & voice prompts
|
||||
if (group.getType() == DownloadResourceGroupType.OTHER_MAPS_HEADER
|
||||
|| group.getType() == DownloadResourceGroupType.VOICE_HEADER_REC
|
||||
|| group.getType() == DownloadResourceGroupType.VOICE_HEADER_TTS) {
|
||||
|| group.getType() == DownloadResourceGroupType.VOICE_HEADER_TTS
|
||||
|| group.getType() == DownloadResourceGroupType.FONTS_HEADER) {
|
||||
if (group.getIndividualResources() != null) {
|
||||
for (IndexItem item : group.getIndividualResources()) {
|
||||
name = item.getVisibleName(ctx, osmandRegions, false).toLowerCase();
|
||||
|
|
|
@ -26,6 +26,8 @@ public class FileNameTranslationHelper {
|
|||
return getWikiName(ctx, basename);
|
||||
} else if (fileName.endsWith("tts")) { //tts files
|
||||
return getVoiceName(ctx, fileName);
|
||||
} else if (fileName.endsWith(IndexConstants.FONT_INDEX_EXT)) { //otf files
|
||||
return getFontName(ctx, basename);
|
||||
} else if (fileName.startsWith(HILL_SHADE)){
|
||||
return getHillShadeName(ctx, regions, basename);
|
||||
} else if (fileName.length() == 2) { //voice recorded files
|
||||
|
@ -75,9 +77,9 @@ public class FileNameTranslationHelper {
|
|||
return wikiName + " " + ctx.getString(R.string.amenity_type_osmwiki);
|
||||
}
|
||||
|
||||
public static String getVoiceName(Context ctx, String basename) {
|
||||
public static String getVoiceName(Context ctx, String fileName) {
|
||||
try {
|
||||
String nm = basename.replace('-', '_').replace(' ', '_');
|
||||
String nm = fileName.replace('-', '_').replace(' ', '_');
|
||||
if (nm.endsWith("_tts") || nm.endsWith("-tts")) {
|
||||
nm = nm.substring(0, nm.length() - 4);
|
||||
}
|
||||
|
@ -89,7 +91,11 @@ public class FileNameTranslationHelper {
|
|||
} catch (Exception e) {
|
||||
System.err.println(e.getMessage());
|
||||
}
|
||||
return basename;
|
||||
return fileName;
|
||||
}
|
||||
|
||||
public static String getFontName(Context ctx, String basename) {
|
||||
return basename.replace('-', ' ').replace('_', ' ');
|
||||
}
|
||||
|
||||
private static String getBasename(String fileName) {
|
||||
|
|
|
@ -513,6 +513,8 @@ public class MapDataMenuController extends MenuController {
|
|||
} else if (localIndexInfo.getOriginalType() == LocalIndexType.TTS_VOICE_DATA
|
||||
|| localIndexInfo.getOriginalType() == LocalIndexType.VOICE_DATA) {
|
||||
return DownloadActivityType.VOICE_FILE;
|
||||
} else if (localIndexInfo.getOriginalType() == LocalIndexType.FONT_DATA) {
|
||||
return DownloadActivityType.FONT_FILE;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -506,6 +506,7 @@ public class ResourceManager {
|
|||
// indexingImageTiles(progress);
|
||||
warnings.addAll(indexingMaps(progress));
|
||||
warnings.addAll(indexVoiceFiles(progress));
|
||||
warnings.addAll(indexFontFiles(progress));
|
||||
warnings.addAll(OsmandPlugin.onIndexingFiles(progress));
|
||||
warnings.addAll(indexAdditionalMaps(progress));
|
||||
return warnings;
|
||||
|
@ -539,6 +540,23 @@ public class ResourceManager {
|
|||
return warnings;
|
||||
}
|
||||
|
||||
public List<String> indexFontFiles(IProgress progress){
|
||||
File file = context.getAppPath(IndexConstants.FONT_INDEX_DIR);
|
||||
file.mkdirs();
|
||||
List<String> warnings = new ArrayList<String>();
|
||||
if (file.exists() && file.canRead()) {
|
||||
File[] lf = file.listFiles();
|
||||
if (lf != null) {
|
||||
for (File f : lf) {
|
||||
if (!f.isDirectory()) {
|
||||
indexFileNames.put(f.getName(), dateFormat.format(f.lastModified()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return warnings;
|
||||
}
|
||||
|
||||
private List<String> checkAssets(IProgress progress) {
|
||||
String fv = Version.getFullVersion(context);
|
||||
if (!fv.equalsIgnoreCase(context.getSettings().PREVIOUS_INSTALLED_VERSION.get())) {
|
||||
|
|
Loading…
Reference in a new issue