[new downloader][android] fix: Review fixes.

This commit is contained in:
Alexander Marchuk 2016-02-20 15:18:58 +03:00 committed by Sergey Yershov
parent 5a10b61a65
commit 1191c115d6
4 changed files with 10 additions and 14 deletions

View file

@ -149,7 +149,7 @@ static void UpdateItem(JNIEnv * env, jobject item, NodeAttrs const & attrs)
env->SetIntField(item, countryItemFieldProgress, static_cast<jint>(attrs.m_downloadingProgress.first));
}
static void PutItemsToList(JNIEnv * env, jobject const list, vector<TCountryId> const & children, int category)
static void PutItemsToList(JNIEnv * env, jobject const list, TCountriesVec const & children, int category)
{
static jmethodID const countryItemCtor = jni::GetConstructorID(env, g_countryItemClass, "(Ljava/lang/String;)V");
static jfieldID const countryItemFieldCategory = env->GetFieldID(g_countryItemClass, "category", "I");
@ -182,9 +182,9 @@ Java_com_mapswithme_maps_downloader_MapManager_nativeListItems(JNIEnv * env, jcl
if (parent)
{
vector<TCountryId> children;
TCountriesVec children;
storage.GetChildren(parentId, children);
PutItemsToList(env, result, children, parentId, ItemCategory::ALL);
PutItemsToList(env, result, children, ItemCategory::ALL);
}
else
{
@ -193,12 +193,12 @@ Java_com_mapswithme_maps_downloader_MapManager_nativeListItems(JNIEnv * env, jcl
// Downloaded
TCountriesVec downloaded, available;
storage.GetChildrenInGroups(parentId, downloaded, available);
PutItemsToList(env, result, downloaded, parentId, ItemCategory::DOWNLOADED);
PutItemsToList(env, result, downloaded, ItemCategory::DOWNLOADED);
// All
TCountriesVec children(downloaded.begin(), downloaded.end());
children.insert(children.end(), available.begin(), available.end());
PutItemsToList(env, result, children, parentId, ItemCategory::ALL);
PutItemsToList(env, result, children, ItemCategory::ALL);
}
}

View file

@ -173,7 +173,7 @@ extern "C"
if (isMapAndTable)
{
params.m_onResults = bind(&OnResults, _1, timestamp, isMapAndTable, false /* hasPosition */, 0, 0);
params.m_onResults = bind(&OnResults, _1, timestamp, isMapAndTable, false /* hasPosition */, 0.0, 0.0);
if (g_framework->NativeFramework()->Search(params))
g_queryTimestamp = timestamp;
}
@ -187,7 +187,7 @@ extern "C"
params.SetInputLocale(ReplaceDeprecatedLanguageCode(jni::ToNativeString(env, lang)));
params.SetForceSearch(true);
params.SetMode(search::Mode::World);
params.m_callback = bind(&OnResults, _1, timestamp, false /* isMapAndTable */, false /* hasPosition */, 0.0, 0.0);
params.m_onResults = bind(&OnResults, _1, timestamp, false /* isMapAndTable */, false /* hasPosition */, 0.0, 0.0);
g_framework->NativeFramework()->Search(params);
g_queryTimestamp = timestamp;

View file

@ -7,7 +7,6 @@ import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.util.SparseArray;
import android.util.SparseIntArray;
import android.view.LayoutInflater;
@ -350,11 +349,8 @@ class DownloaderAdapter extends RecyclerView.Adapter<DownloaderAdapter.ViewHolde
mName.setText(mItem.name);
String parent = mItem.parentId;
parent = (CountryItem.ROOT.equals(parent) ? "" : mItem.parentName);
mParentName.setText(parent);
UiUtils.showIf(!TextUtils.isEmpty(parent), mParentName);
String parent = (CountryItem.ROOT.equals(mItem.parentId) ? "" : mItem.parentName);
UiUtils.setTextAndHideIfEmpty(mParentName, parent);
mSizes.setText(StringUtils.getFileSizeString(mItem.totalSize));

View file

@ -56,7 +56,7 @@ public class DownloaderFragment extends BaseMwmRecyclerFragment
if (!mSearchRunning || timestamp != mCurrentSearch)
return;
for (SearchResult result: results)
for (SearchResult result : results)
{
String id = MapManager.nativeFindCountry(result.lat, result.lon);
if (!TextUtils.isEmpty(id) && !mResults.containsKey(id))