Added region name in Updates tab in DownloadActivity

This commit is contained in:
Denis 2014-11-19 13:28:11 +02:00
parent 3b3d8017a7
commit 99e8409e37
3 changed files with 22 additions and 3 deletions

View file

@ -18,6 +18,7 @@ import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.actionbarsherlock.view.Window;
import net.osmand.IndexConstants;
import net.osmand.access.AccessibleAlertBuilder;
import net.osmand.map.OsmandRegions;
import net.osmand.plus.*;
import net.osmand.plus.activities.FavouritesActivity;
import net.osmand.plus.activities.LocalIndexInfo;
@ -596,4 +597,20 @@ public class DownloadActivity extends SherlockFragmentActivity {
}
}
public static String getFullName(IndexItem e, OsmandApplication app, OsmandRegions osmandRegions) {
String eName;
List<IndexItem> forCat = new ArrayList<IndexItem>();
forCat.add(e);
List<IndexItemCategory> category = IndexItemCategory.categorizeIndexItems(app, forCat);
if (category.size() != 0){
eName = e.getVisibleDescription(app) + "\n"
+ category.get(0).name + " "
+ e.getVisibleName(app, osmandRegions);
} else {
eName = e.getVisibleDescription(app) + "\n"
+ e.getVisibleName(app, osmandRegions);
}
return eName;
}
}

View file

@ -961,8 +961,9 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment {
private String getNameToDisplay(LocalIndexInfo child) {
String mapDescr = getMapDescription(child.getFileName());
String mapName = FileNameTranslationHelper.getFileName(ctx, ((OsmandApplication) getDownloadActivity().getApplication()).getResourceManager().getOsmandRegions(), child.getFileName());
String mapName = FileNameTranslationHelper.getFileName(ctx,
((OsmandApplication) getDownloadActivity().getApplication()).getResourceManager().getOsmandRegions(),
child.getFileName());
if (mapDescr.length() > 0){
return mapDescr + " - " + mapName;
} else {

View file

@ -202,7 +202,8 @@ public class UpdatesIndexFragment extends SherlockListFragment {
TextView name = (TextView) v.findViewById(R.id.download_item);
TextView description = (TextView) v.findViewById(R.id.download_descr);
IndexItem e = items.get(position);
String eName = e.getVisibleDescription(getMyApplication()) + "\n" + e.getVisibleName(getMyApplication(), osmandRegions);
String eName = DownloadActivity.getFullName(e, getMyApplication(), osmandRegions);
name.setText(eName.trim()); //$NON-NLS-1$
String d = e.getDate(format) + "\n" + e.getSizeDescription(getMyApplication());
description.setText(d);