Fixes
This commit is contained in:
parent
be38b19e88
commit
a8655382ef
8 changed files with 42 additions and 47 deletions
|
@ -85,7 +85,7 @@ public class WorldRegion {
|
|||
|
||||
public void initWorld() {
|
||||
regionId = "";
|
||||
downloadsId= WORLD;
|
||||
downloadsId = WORLD;
|
||||
name = "";
|
||||
superregion = null;
|
||||
}
|
||||
|
@ -109,14 +109,6 @@ public class WorldRegion {
|
|||
return this;
|
||||
}
|
||||
|
||||
|
||||
private WorldRegion init(String regionId, String name) {
|
||||
this.regionId = regionId;
|
||||
this.downloadsId = regionId.toLowerCase() ;
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
private void addSubregion(WorldRegion subregion) {
|
||||
subregion.superregion = this;
|
||||
subregions.add(subregion);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package net.osmand.plus.download;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
@ -53,7 +54,7 @@ public class DownloadResourceGroup {
|
|||
}
|
||||
|
||||
public boolean containsIndexItem() {
|
||||
return isHeader() && this != SUBREGIONS;
|
||||
return isHeader() && this != SUBREGIONS && this != VOICE_GROUP;
|
||||
}
|
||||
|
||||
public boolean isHeader() {
|
||||
|
@ -203,8 +204,14 @@ public class DownloadResourceGroup {
|
|||
return null;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return id;
|
||||
public String getName(Context ctx) {
|
||||
if (region != null) {
|
||||
return region.getName();
|
||||
} else if (type != null && type.resId != -1) {
|
||||
return ctx.getString(type.resId);
|
||||
} else {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
||||
public String getUniqueId() {
|
||||
|
|
|
@ -170,10 +170,10 @@ public class DownloadResources extends DownloadResourceGroup {
|
|||
this.rawResources = resources;
|
||||
|
||||
DownloadResourceGroup voiceGroup = new DownloadResourceGroup(this, DownloadResourceGroupType.VOICE_GROUP);
|
||||
DownloadResourceGroup voiceScreenRec = new DownloadResourceGroup(this, DownloadResourceGroupType.VOICE_REC);
|
||||
DownloadResourceGroup voiceRec = new DownloadResourceGroup(this, DownloadResourceGroupType.VOICE_HEADER_REC);
|
||||
DownloadResourceGroup voiceTTS = new DownloadResourceGroup(this, DownloadResourceGroupType.VOICE_TTS);
|
||||
DownloadResourceGroup voiceScreenTTS = new DownloadResourceGroup(this, DownloadResourceGroupType.VOICE_HEADER_TTS);
|
||||
DownloadResourceGroup voiceScreenRec = new DownloadResourceGroup(voiceGroup, DownloadResourceGroupType.VOICE_REC);
|
||||
DownloadResourceGroup voiceScreenTTS = new DownloadResourceGroup(voiceGroup, DownloadResourceGroupType.VOICE_TTS);
|
||||
DownloadResourceGroup voiceRec = new DownloadResourceGroup(voiceGroup, DownloadResourceGroupType.VOICE_HEADER_REC, DownloadResourceGroupType.VOICE_REC.name().toLowerCase());
|
||||
DownloadResourceGroup voiceTTS = new DownloadResourceGroup(voiceGroup, DownloadResourceGroupType.VOICE_HEADER_TTS, DownloadResourceGroupType.VOICE_TTS.name().toLowerCase());
|
||||
voiceScreenTTS.addGroup(voiceTTS);
|
||||
voiceScreenRec.addGroup(voiceRec);
|
||||
voiceGroup.addGroup(voiceScreenRec);
|
||||
|
@ -194,6 +194,7 @@ public class DownloadResources extends DownloadResourceGroup {
|
|||
} else {
|
||||
voiceRec.addItem(ii);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
String basename = ii.getBasename().toLowerCase();
|
||||
WorldRegion wg = downloadIdForRegion.get(basename);
|
||||
|
@ -219,6 +220,7 @@ public class DownloadResources extends DownloadResourceGroup {
|
|||
DownloadResourceGroup parentGroup = parent.pollFirst();
|
||||
List<WorldRegion> subregions = reg.getSubregions();
|
||||
DownloadResourceGroup mainGrp = new DownloadResourceGroup(parentGroup, DownloadResourceGroupType.REGION, reg.getRegionId());
|
||||
mainGrp.region = reg;
|
||||
parentGroup.addGroup(mainGrp);
|
||||
DownloadResourceGroup subRegions = new DownloadResourceGroup(mainGrp, DownloadResourceGroupType.SUBREGIONS);
|
||||
mainGrp.addGroup(subRegions);
|
||||
|
|
|
@ -132,16 +132,19 @@ public class IndexItem implements Comparable<IndexItem> {
|
|||
|
||||
|
||||
public boolean isOutdated() {
|
||||
FIXME;
|
||||
//FIXME;
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getLocalDate() {
|
||||
FIXME;
|
||||
//FIXME;
|
||||
return "FIXME";
|
||||
}
|
||||
|
||||
|
||||
public boolean isDownloaded() {
|
||||
// return listAlreadyDownloaded.containsKey(getTargetFileName());
|
||||
/*
|
||||
Map<String,String> indexFileNames = context.getIndexFileNames();
|
||||
if (indexFileNames != null && indexItem.isAlreadyDownloaded(indexFileNames)) {
|
||||
boolean outdated = false;
|
||||
|
@ -155,6 +158,8 @@ public class IndexItem implements Comparable<IndexItem> {
|
|||
date = updatableResource ? indexActivatedFileNames.get(sfName) : indexFileNames.get(sfName);
|
||||
outdated = DownloadActivity.downloadListIndexThread.checkIfItemOutdated(indexItem);
|
||||
}
|
||||
*/
|
||||
return false; // FIXME
|
||||
}
|
||||
|
||||
public String getVisibleName(Context ctx, OsmandRegions osmandRegions) {
|
||||
|
|
|
@ -74,7 +74,7 @@ public class DownloadResourceGroupFragment extends DialogFragment implements Dow
|
|||
if (savedInstanceState != null) {
|
||||
groupId = savedInstanceState.getString(REGION_ID_DLG_KEY);
|
||||
}
|
||||
if (groupId == null) {
|
||||
if (groupId == null && getArguments() != null) {
|
||||
groupId = getArguments().getString(REGION_ID_DLG_KEY);
|
||||
}
|
||||
if (groupId == null) {
|
||||
|
@ -112,9 +112,7 @@ public class DownloadResourceGroupFragment extends DialogFragment implements Dow
|
|||
group = indexes.getGroupById(groupId);
|
||||
if (group != null) {
|
||||
listAdapter.update(group);
|
||||
if (group.getRegion() != null) {
|
||||
toolbar.setTitle(group.getRegion().getName());
|
||||
}
|
||||
toolbar.setTitle(group.getName(activity));
|
||||
}
|
||||
expandAllGroups();
|
||||
}
|
||||
|
@ -212,18 +210,14 @@ public class DownloadResourceGroupFragment extends DialogFragment implements Dow
|
|||
getDownloadActivity().getDownloadThread().runReloadIndexFiles();
|
||||
return true;
|
||||
case SEARCH_ID:
|
||||
getDownloadActivity().showDialog(getActivity(), SearchDialogFragment.createInstance(""));
|
||||
// FIXME
|
||||
//getDownloadActivity().showDialog(getActivity(), SearchDialogFragment.createInstance(""));
|
||||
return true;
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
|
||||
public void onRegionSelected(String regionId) {
|
||||
final DownloadResourceGroupFragment regionDialogFragment = createInstance(regionId);
|
||||
getDownloadActivity().showDialog(getActivity(), regionDialogFragment);
|
||||
}
|
||||
|
||||
public static DownloadResourceGroupFragment createInstance(String regionId) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(REGION_ID_DLG_KEY, regionId);
|
||||
|
@ -315,12 +309,8 @@ public class DownloadResourceGroupFragment extends DialogFragment implements Dow
|
|||
public void bindItem(DownloadResourceGroup group) {
|
||||
Drawable iconLeft = getIconForGroup(group);
|
||||
textView.setCompoundDrawablesWithIntrinsicBounds(iconLeft, null, null, null);
|
||||
String name = group.getName();
|
||||
WorldRegion region = group.getRegion();
|
||||
if (region != null) {
|
||||
name = region.getName();
|
||||
}
|
||||
textView.setText(name);
|
||||
String name = group.getName(ctx);
|
||||
textView.setText(name);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,16 +15,12 @@ import net.osmand.access.AccessibleToast;
|
|||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.Version;
|
||||
import net.osmand.plus.WorldRegion;
|
||||
import net.osmand.plus.download.DownloadActivity;
|
||||
import net.osmand.plus.download.DownloadActivityType;
|
||||
import net.osmand.plus.download.IndexItem;
|
||||
import net.osmand.plus.openseamapsplugin.NauticalMapsPlugin;
|
||||
import net.osmand.plus.srtmplugin.SRTMPlugin;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.util.Map;
|
||||
|
||||
// FIXME
|
||||
public class ItemViewHolder {
|
||||
|
||||
|
@ -49,7 +45,7 @@ public class ItemViewHolder {
|
|||
private RightButtonAction rightButtonAction;
|
||||
|
||||
private enum RightButtonAction {
|
||||
UNKNOWN,
|
||||
NONE,
|
||||
ASK_FOR_SEAMARKS_PLUGIN,
|
||||
ASK_FOR_SRTM_PLUGIN_PURCHASE,
|
||||
ASK_FOR_SRTM_PLUGIN_ENABLE,
|
||||
|
@ -90,7 +86,7 @@ public class ItemViewHolder {
|
|||
boolean showTypeInTitle, boolean showTypeInDesc) {
|
||||
initAppStatusVariables();
|
||||
boolean disabled = false;
|
||||
rightButtonAction = RightButtonAction.UNKNOWN;
|
||||
rightButtonAction = RightButtonAction.NONE;
|
||||
boolean downloading = context.getDownloadThread().isDownloading(indexItem);
|
||||
int progress = -1;
|
||||
if (context.getDownloadThread().getCurrentDownloadingItem() == indexItem) {
|
||||
|
@ -109,11 +105,13 @@ public class ItemViewHolder {
|
|||
nameTextView.setText(indexItem.getVisibleName(context,
|
||||
context.getMyApplication().getRegions(), false));
|
||||
} else {
|
||||
/* FIXME
|
||||
if (indexItem.getSimplifiedFileName().equals(WORLD_SEAMARKS_KEY)
|
||||
&& nauticalPluginDisabled) {
|
||||
rightButtonAction = RightButtonAction.ASK_FOR_SEAMARKS_PLUGIN;
|
||||
disabled = true;
|
||||
}
|
||||
*/
|
||||
if ((indexItem.getType() == DownloadActivityType.SRTM_COUNTRY_FILE ||
|
||||
indexItem.getType() == DownloadActivityType.HILLSHADE_FILE) && srtmDisabled) {
|
||||
OsmandPlugin srtmPlugin = OsmandPlugin.getPlugin(SRTMPlugin.class);
|
||||
|
@ -149,7 +147,6 @@ public class ItemViewHolder {
|
|||
rightImageButton.setImageDrawable(getContentIcon(context, R.drawable.ic_action_import));
|
||||
progressBar.setVisibility(View.GONE);
|
||||
|
||||
Map<String,String> indexFileNames = context.getIndexFileNames();
|
||||
if (indexItem.isDownloaded()) {
|
||||
String date = indexItem.getLocalDate();
|
||||
boolean outdated = indexItem.isOutdated();
|
||||
|
@ -178,7 +175,7 @@ public class ItemViewHolder {
|
|||
getContentIcon(context, R.drawable.ic_action_remove_dark));
|
||||
}
|
||||
|
||||
if (rightButtonAction != RightButtonAction.UNKNOWN) {
|
||||
if (rightButtonAction != RightButtonAction.NONE) {
|
||||
rightButton.setText(R.string.get_plugin);
|
||||
rightButton.setVisibility(View.VISIBLE);
|
||||
rightImageButton.setVisibility(View.GONE);
|
||||
|
@ -210,7 +207,7 @@ public class ItemViewHolder {
|
|||
AccessibleToast.makeText(context,
|
||||
context.getString(R.string.activate_srtm_plugin), Toast.LENGTH_SHORT).show();
|
||||
break;
|
||||
case UNKNOWN:
|
||||
case NONE:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -231,6 +228,6 @@ public class ItemViewHolder {
|
|||
}
|
||||
|
||||
public boolean isItemAvailable() {
|
||||
return rightButtonAction == RightButtonAction.UNKNOWN;
|
||||
return rightButtonAction == RightButtonAction.NONE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,12 +16,12 @@ import net.osmand.plus.R;
|
|||
import net.osmand.plus.download.DownloadActivity;
|
||||
import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents;
|
||||
|
||||
public class SearchDialogFragment extends DialogFragment implements DownloadEvents {
|
||||
public class SearchDialogFragment { /*extends DialogFragment implements DownloadEvents {
|
||||
|
||||
public static final String TAG = "SearchDialogFragment";
|
||||
private static final String SEARCH_TEXT_DLG_KEY = "search_text_dlg_key";
|
||||
private String searchText;
|
||||
SearchView search;
|
||||
private SearchView search;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -139,4 +139,5 @@ public class SearchDialogFragment extends DialogFragment implements DownloadEven
|
|||
fragment.setArguments(bundle);
|
||||
return fragment;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ import android.widget.Filter;
|
|||
import android.widget.Filterable;
|
||||
import android.widget.ListView;
|
||||
|
||||
public class SearchItemsFragment extends Fragment implements DownloadEvents {
|
||||
public class SearchItemsFragment { /*extends Fragment implements DownloadEvents {
|
||||
public static final String TAG = "SearchItemsFragment";
|
||||
|
||||
private SearchItemsAdapter listAdapter;
|
||||
|
@ -332,4 +332,5 @@ public class SearchItemsFragment extends Fragment implements DownloadEvents {
|
|||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue