forked from organicmaps/organicmaps
[codereview]
This commit is contained in:
parent
888239c75d
commit
c5465383da
2 changed files with 18 additions and 18 deletions
|
@ -777,21 +777,21 @@ extern "C"
|
|||
{
|
||||
vector<guides::GuideInfo> infos;
|
||||
g_framework->NativeFramework()->GetGuidesInfosWithDownloadedMaps(infos);
|
||||
const size_t mapsFound = infos.size();
|
||||
|
||||
LOG(LDEBUG, ("Got maps:", infos));
|
||||
|
||||
if (infos.size() > 0)
|
||||
if (mapsFound > 0)
|
||||
{
|
||||
const jclass giClass = env->FindClass("com/mapswithme/maps/guides/GuideInfo");
|
||||
const jmethodID methodID = env->GetMethodID(giClass, "<init>",
|
||||
"(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V");
|
||||
const string lang = languages::CurrentLanguage();
|
||||
|
||||
jobjectArray jInfos = env->NewObjectArray(infos.size(), giClass, NULL);
|
||||
jobjectArray jInfos = env->NewObjectArray(mapsFound, giClass, NULL);
|
||||
|
||||
for (int i = 0; i < infos.size(); ++i)
|
||||
for (size_t i = 0; i < mapsFound; ++i)
|
||||
{
|
||||
const guides::GuideInfo info = infos[i];
|
||||
const guides::GuideInfo & info = infos[i];
|
||||
jobject jGuideInfo = env->NewObject(giClass, methodID,
|
||||
jni::ToJavaString(env, info.GetAppID()),
|
||||
jni::ToJavaString(env, info.GetURL()), jni::ToJavaString(env, info.GetAdTitle(lang)),
|
||||
|
|
|
@ -279,21 +279,21 @@ public class DownloadResourcesActivity extends MapsWithMeBaseActivity
|
|||
private void tryAdvertiseGuides()
|
||||
{
|
||||
final GuideInfo[] gInfos = Framework.getGuideInfosForDownloadedMaps();
|
||||
if (gInfos != null)
|
||||
if (gInfos == null)
|
||||
return;
|
||||
|
||||
// iterate all guides until find not installed && not advertised one
|
||||
for (final GuideInfo info : gInfos)
|
||||
{
|
||||
// iterate all guides until find not installed && not advertised one
|
||||
for (final GuideInfo info : gInfos)
|
||||
if (GuidesUtils.isGuideInstalled(info.mAppId, this))
|
||||
Framework.setWasAdvertised(info.mAppId);
|
||||
else if (!Framework.wasAdvertised(info.mAppId))
|
||||
{
|
||||
if (!GuidesUtils.isGuideInstalled(info.mAppId, this) && !Framework.wasAdvertised(info.mAppId))
|
||||
{
|
||||
final Notifier noty = new Notifier(this);
|
||||
noty.placeGuideAvailable(info.mAppId, info.mTitle, info.mMessage);
|
||||
Framework.setWasAdvertised(info.mAppId);
|
||||
break;
|
||||
}
|
||||
// mark installed guides as advertised
|
||||
else if (GuidesUtils.isGuideInstalled(info.mAppId, this))
|
||||
Framework.setWasAdvertised(info.mAppId);
|
||||
final Notifier noty = new Notifier(this);
|
||||
noty.placeGuideAvailable(info.mAppId, info.mTitle, info.mMessage);
|
||||
Framework.setWasAdvertised(info.mAppId);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue