Update cards layout

This commit is contained in:
Victor Shcherb 2014-12-09 20:20:21 +01:00
parent 10ea7ddf7c
commit 6002e7126e
2 changed files with 27 additions and 18 deletions

View file

@ -63,6 +63,10 @@ public class OsmandRegions {
return o.getNameByType(downloadNameType);
}
public Integer getNameEnType() {
return nameEnType;
}
public String getLocaleName(String downloadName) {
final String lc = downloadName.toLowerCase();
if(downloadNamesToLocaleNames.containsKey(lc)) {
@ -396,11 +400,16 @@ public class OsmandRegions {
List<BinaryMapDataObject> cs = or.query(MapUtils.get31TileNumberX(lon), MapUtils.get31TileNumberY(lat));
Set<String> expected = new TreeSet<String>(Arrays.asList(test));
Set<String> found = new TreeSet<String>();
for(BinaryMapDataObject b : cs) {
found.add(b.getName());
}
if(!found.equals(expected)) {
for (BinaryMapDataObject b : cs) {
String nm = b.getNameByType(or.nameEnType);
if(nm == null) {
nm = b.getName();
}
found.add(nm.toLowerCase());
}
if (!found.equals(expected)) {
throw new IllegalStateException(" Expected " + expected + " but was " + found);
}
System.out.println("Found " + expected + " in " + (System.currentTimeMillis() - t) + " ms");
@ -409,21 +418,20 @@ public class OsmandRegions {
public static void main(String[] args) throws IOException {
OsmandRegions or = new OsmandRegions();
or.setLocale("ru");
or.prepareFile("/home/victor/projects/osmand/repo/resources/countries-info/regions.ocbf");
// or.cacheAllCountries();
or.cacheAllCountries();
// long t = System.currentTimeMillis();
// or.cacheAllCountries();
// System.out.println("Init " + (System.currentTimeMillis() - t));
//testCountry(or, 15.8, 23.09, "chad");
testCountry(or, 52.10, 4.92, "netherlands");
testCountry(or, 52.15, 7.50, "nordrhein-westfalen");
testCountry(or, 40.0760, 9.2807, "italy", "sardegna");
testCountry(or, 52.10, 4.92, "the netherlands");
testCountry(or, 52.15, 7.50, "north rhine-westphalia");
testCountry(or, 40.0760, 9.2807, "italy", "sardinia");
testCountry(or, 28.8056, 29.9858, "africa", "egypt" );
testCountry(or, 35.7521, 139.7887, "japan");
testCountry(or, 46.5145, 102.2580, "mongolia");
testCountry(or, 62.54, 43.36, "arkhangelsk", "northwestern-federal-district");
testCountry(or, 62.54, 43.36, "arkhangelsk oblast", "northwestern federal district");
}

View file

@ -99,8 +99,8 @@ public class MainMenuActivity extends BaseDownloadActivity {
getSupportActionBar().setBackgroundDrawable(color);
getSupportActionBar().setIcon(android.R.color.transparent);
initApp(this, getMyApplication());
addFragments();
boolean firstTime = initApp(this, getMyApplication());
addFragments(firstTime);
}
@Override
@ -149,7 +149,7 @@ public class MainMenuActivity extends BaseDownloadActivity {
about.setMovementMethod(LinkMovementMethod.getInstance());
}
public void addFragments() {
public void addFragments(boolean firstTime) {
android.support.v4.app.FragmentManager manager = getSupportFragmentManager();
android.support.v4.app.FragmentTransaction fragmentTransaction = manager.beginTransaction();
//after rotation list of fragments in fragment transaction is not cleared
@ -158,6 +158,9 @@ public class MainMenuActivity extends BaseDownloadActivity {
DashMapFragment mapFragment = new DashMapFragment();
fragmentTransaction.add(R.id.content, mapFragment, DashMapFragment.TAG);
}
if(getMyApplication().getAppCustomization().checkExceptionsOnStart()){
checkPreviousRunsForExceptions(firstTime);
}
if (manager.findFragmentByTag(DashSearchFragment.TAG) == null){
DashSearchFragment searchFragment = new DashSearchFragment();
fragmentTransaction.add(R.id.content, searchFragment, DashSearchFragment.TAG);
@ -241,13 +244,13 @@ public class MainMenuActivity extends BaseDownloadActivity {
}
protected void initApp(final Activity activity, OsmandApplication app) {
protected boolean initApp(final Activity activity, OsmandApplication app) {
final OsmAndAppCustomization appCustomization = app.getAppCustomization();
// restore follow route mode
if(app.getSettings().FOLLOW_THE_ROUTE.get() && !app.getRoutingHelper().isRouteCalculated()){
final Intent mapIndent = new Intent(this, appCustomization.getMapActivity());
startActivityForResult(mapIndent, 0);
return;
return false;
}
boolean firstTime = false;
SharedPreferences pref = getPreferences(MODE_WORLD_WRITEABLE);
@ -285,9 +288,7 @@ public class MainMenuActivity extends BaseDownloadActivity {
}
}
if(appCustomization.checkExceptionsOnStart()){
checkPreviousRunsForExceptions(firstTime);
}
return firstTime;
}
private void applicationInstalledFirstTime() {