[android] Ask to update maps before search.

This commit is contained in:
vng 2012-06-22 18:23:35 -07:00 committed by Alex Zolotarev
parent d907bcc454
commit 37c71bed8d
2 changed files with 44 additions and 11 deletions

View file

@ -17,6 +17,7 @@
#include "../../../../../platform/platform.hpp"
#include "../../../../../platform/location.hpp"
#include "../../../../../platform/file_name_utils.hpp"
#include "../../../../../base/logging.hpp"
#include "../../../../../base/math.hpp"
@ -447,9 +448,20 @@ namespace android
if (v[i].find(WORLD_FILE_NAME) == string::npos &&
v[i].find(WORLD_COASTS_FILE_NAME) == string::npos)
{
FilesContainerR cont(pl.GetReader(v[i]));
if (!cont.IsReaderExist(SEARCH_INDEX_FILE_TAG))
out.push_back(v[i]);
try
{
FilesContainerR cont(pl.GetReader(v[i]));
if (!cont.IsReaderExist(SEARCH_INDEX_FILE_TAG))
{
pl::GetNameWithoutExt(v[i]);
out.push_back(m_work.GetCountryName(v[i]));
}
}
catch (Reader::Exception const & ex)
{
// sdcard can contain dummy _*.mwm files. Supress this errors.
LOG(LWARNING, ("Bad mwm file:", v[i], "Error:", ex.Msg()));
}
}
}
}

View file

@ -241,6 +241,11 @@ public class MWMActivity extends NvEventQueueActivity implements LocationService
.show();
}
private void runSearchActivity()
{
startActivity(new Intent(this, SearchActivity.class));
}
public void onSearchClicked(View v)
{
if (!nativeIsProVersion())
@ -249,33 +254,49 @@ public class MWMActivity extends NvEventQueueActivity implements LocationService
}
else
{
/*
final String[] maps = nativeGetMapsWithoutSearch();
if (maps.length != 0)
{
String msg = this.getString(R.string.search_update_maps) + ": ";
for (int i = 0; i < maps.length; ++i)
msg = msg + "\n" + maps[i];
new AlertDialog.Builder(getActivity())
.setMessage(R.string.search_update_maps)
.setCancelable(false)
.setPositiveButton(getString(R.string.later), new DialogInterface.OnClickListener()
.setMessage(msg)
.setPositiveButton(getString(R.string.download), new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface dlg, int which)
{
dlg.dismiss();
runDownloadActivity();
}
})
.setNegativeButton(getString(R.string.later), new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface dlg, int which)
{
dlg.dismiss();
runSearchActivity();
}
})
.create()
.show();
}
*/
startActivity(new Intent(this, SearchActivity.class));
else
runSearchActivity();
}
}
private void runDownloadActivity()
{
startActivity(new Intent(this, DownloadUI.class));
}
public void onDownloadClicked(View v)
{
startActivity(new Intent(this, DownloadUI.class));
runDownloadActivity();
}
@Override