forked from organicmaps/organicmaps
[android] Do not delete countries before update downloading.
This commit is contained in:
parent
83a0276371
commit
7a8ffa56db
6 changed files with 31 additions and 28 deletions
|
@ -172,6 +172,27 @@ namespace android
|
|||
return m_work.GetCountryStatusDisplay();
|
||||
}
|
||||
|
||||
void Framework::ShowCountry(storage::TIndex const & idx)
|
||||
{
|
||||
storage::Country const & country = m_work.Storage().CountryByIndex(idx);
|
||||
m2::RectD const r = m_work.GetCountryBounds(country.GetFile().m_fileName);
|
||||
|
||||
m_doLoadState = false;
|
||||
|
||||
m_work.SkipLocationCentering();
|
||||
m_work.ShowRect(r);
|
||||
}
|
||||
|
||||
storage::TStatus Framework::GetCountryStatus(storage::TIndex const & idx) const
|
||||
{
|
||||
return m_work.GetCountryStatus(idx);
|
||||
}
|
||||
|
||||
void Framework::DeleteCountry(storage::TIndex const & idx)
|
||||
{
|
||||
m_work.DeleteCountry(idx);
|
||||
}
|
||||
|
||||
void Framework::Resize(int w, int h)
|
||||
{
|
||||
m_work.OnSize(w, h);
|
||||
|
@ -376,14 +397,6 @@ namespace android
|
|||
m_eventType = eventType;
|
||||
}
|
||||
|
||||
void Framework::ShowCountry(m2::RectD const & r)
|
||||
{
|
||||
m_doLoadState = false;
|
||||
|
||||
m_work.SkipLocationCentering();
|
||||
m_work.ShowRect(r);
|
||||
}
|
||||
|
||||
void Framework::ShowSearchResult(search::Result const & r)
|
||||
{
|
||||
m_doLoadState = false;
|
||||
|
|
|
@ -62,6 +62,10 @@ namespace android
|
|||
storage::Storage & Storage();
|
||||
CountryStatusDisplay * GetCountryStatusDisplay();
|
||||
|
||||
void ShowCountry(storage::TIndex const & idx);
|
||||
storage::TStatus GetCountryStatus(storage::TIndex const & idx) const;
|
||||
void DeleteCountry(storage::TIndex const & idx);
|
||||
|
||||
void OnLocationStatusChanged(int/* == location::TLocationStatus*/ newStatus);
|
||||
void OnLocationUpdated(uint64_t time, double lat, double lon, float accuracy);
|
||||
void OnCompassUpdated(uint64_t time, double magneticNorth, double trueNorth, double accuracy);
|
||||
|
@ -82,7 +86,6 @@ namespace android
|
|||
|
||||
/// Show rect from another activity. Ensure that no LoadState will be called,
|
||||
/// when maim map activity will become active.
|
||||
void ShowCountry(m2::RectD const & r);
|
||||
void ShowSearchResult(search::Result const & r);
|
||||
|
||||
bool Search(search::SearchParams const & params);
|
||||
|
|
|
@ -100,7 +100,7 @@ extern "C"
|
|||
JNIEXPORT jint JNICALL
|
||||
Java_com_mapswithme_maps_MapStorage_countryStatus(JNIEnv * env, jobject thiz, jobject idx)
|
||||
{
|
||||
return static_cast<jint>(g_framework->Storage().CountryStatus(IndexBinding(idx).toNative()));
|
||||
return static_cast<jint>(g_framework->GetCountryStatus(IndexBinding(idx).toNative()));
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
|
@ -112,16 +112,9 @@ extern "C"
|
|||
JNIEXPORT void JNICALL
|
||||
Java_com_mapswithme_maps_MapStorage_deleteCountry(JNIEnv * env, jobject thiz, jobject idx)
|
||||
{
|
||||
g_framework->Storage().DeleteCountry(IndexBinding(idx).toNative());
|
||||
g_framework->DeleteCountry(IndexBinding(idx).toNative());
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_mapswithme_maps_MapStorage_deleteCountryFiles(JNIEnv * env, jobject thiz, jobject idx)
|
||||
{
|
||||
g_framework->Storage().DeleteCountryFiles(IndexBinding(idx).toNative());
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jobject JNICALL
|
||||
Java_com_mapswithme_maps_MapStorage_findIndexByName(JNIEnv * env, jobject thiz, jstring name)
|
||||
{
|
||||
|
@ -140,8 +133,7 @@ extern "C"
|
|||
JNIEXPORT void JNICALL
|
||||
Java_com_mapswithme_maps_MapStorage_showCountry(JNIEnv * env, jobject thiz, jobject idx)
|
||||
{
|
||||
m2::RectD const rect = g_framework->Storage().CountryBounds(IndexBinding(idx).toNative());
|
||||
g_framework->ShowCountry(rect);
|
||||
g_framework->ShowCountry(IndexBinding(idx).toNative());
|
||||
}
|
||||
|
||||
void ReportChangeCountryStatus(shared_ptr<jobject> const & obj, storage::TIndex const & idx)
|
||||
|
|
|
@ -211,8 +211,6 @@ public class DownloadResourcesActivity extends Activity implements LocationServi
|
|||
|
||||
if (idx.isValid())
|
||||
{
|
||||
mMapStorage.deleteCountryFiles(idx);
|
||||
|
||||
mProgress.setMax((int)mMapStorage.countryRemoteSizeInBytes(idx));
|
||||
mProgress.setProgress(0);
|
||||
|
||||
|
|
|
@ -253,10 +253,7 @@ public class DownloadUI extends ListActivity implements MapStorage.Listener
|
|||
if (size > getFreeSpace())
|
||||
showNotEnoughFreeSpaceDialog(getSizeString(size), name);
|
||||
else
|
||||
{
|
||||
m_storage.deleteCountry(idx);
|
||||
m_storage.downloadCountry(idx);
|
||||
}
|
||||
|
||||
dlg.dismiss();
|
||||
}
|
||||
|
|
|
@ -4,14 +4,15 @@ public class MapStorage
|
|||
{
|
||||
public static final int GROUP = -2;
|
||||
public static final int COUNTRY = -1;
|
||||
|
||||
/// This constants should be equal with storage/storage.hpp, storage::TStatus
|
||||
public static final int ON_DISK = 0;
|
||||
public static final int NOT_DOWNLOADED = 1;
|
||||
public static final int DOWNLOAD_FAILED = 2;
|
||||
public static final int DOWNLOADING = 3;
|
||||
public static final int IN_QUEUE = 4;
|
||||
public static final int UNKNOWN = 5;
|
||||
public static final int GENERATING_INDEX = 6;
|
||||
public static final int ON_DISK_OUT_OF_DATE = 7;
|
||||
public static final int ON_DISK_OUT_OF_DATE = 6;
|
||||
|
||||
public interface Listener
|
||||
{
|
||||
|
@ -112,7 +113,6 @@ public class MapStorage
|
|||
|
||||
public native void downloadCountry(Index idx);
|
||||
public native void deleteCountry(Index idx);
|
||||
public native void deleteCountryFiles(Index idx);
|
||||
|
||||
public native Index findIndexByName(String name);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue