forked from organicmaps/organicmaps
[android] Fixed search results acquiring.
This commit is contained in:
parent
554d5b5ab3
commit
2f98749ea8
3 changed files with 16 additions and 16 deletions
|
@ -76,13 +76,16 @@ class SearchAdapter
|
|||
{
|
||||
// Grab last results.
|
||||
threads::MutexGuard guard(m_updateMutex);
|
||||
m_results.Swap(m_storeResults);
|
||||
m_ID = m_storeID;
|
||||
if (m_ID != m_storeID)
|
||||
{
|
||||
m_results.Swap(m_storeResults);
|
||||
m_ID = m_storeID;
|
||||
}
|
||||
}
|
||||
|
||||
if (resultID != m_ID)
|
||||
{
|
||||
// It happens when search engine is reconnected.
|
||||
// It happens when acquiring obsolete results.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -298,17 +298,15 @@ public class SearchActivity extends MapsWithMeBaseListActivity implements Locati
|
|||
UiUtils.setTextAndShow(holder.m_name, m_context.getString(R.string.no_search_results_found));
|
||||
UiUtils.setTextEx(holder.m_countryAndType, getWarningForEmptyResults());
|
||||
}
|
||||
else
|
||||
else if (position == 0)
|
||||
{
|
||||
// title item with "Show all" text
|
||||
if (position == 0)
|
||||
{
|
||||
UiUtils.setTextAndShow(holder.m_name, m_context.getString(R.string.search_show_on_map));
|
||||
UiUtils.clearTextAndHide(holder.m_countryAndType);
|
||||
UiUtils.clearTextAndHide(holder.m_distance);
|
||||
return convertView;
|
||||
}
|
||||
|
||||
UiUtils.setTextAndShow(holder.m_name, m_context.getString(R.string.search_show_on_map));
|
||||
UiUtils.clearTextAndHide(holder.m_countryAndType);
|
||||
UiUtils.clearTextAndHide(holder.m_distance);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 0 index is for multiple result
|
||||
// so real result are from 1
|
||||
--position;
|
||||
|
@ -361,7 +359,6 @@ public class SearchActivity extends MapsWithMeBaseListActivity implements Locati
|
|||
{
|
||||
if (isShowCategories())
|
||||
{
|
||||
|
||||
final String category = getCategoryName(m_categories[position]);
|
||||
Statistics.INSTANCE.trackSearchCategoryClicked(m_context, category);
|
||||
|
||||
|
@ -398,7 +395,6 @@ public class SearchActivity extends MapsWithMeBaseListActivity implements Locati
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// close activity in case of any error
|
||||
return null;
|
||||
}
|
||||
|
@ -411,7 +407,7 @@ public class SearchActivity extends MapsWithMeBaseListActivity implements Locati
|
|||
|
||||
private boolean isShowCategories()
|
||||
{
|
||||
return (getSearchString().length() == 0);
|
||||
return getSearchString().isEmpty();
|
||||
}
|
||||
|
||||
private LocationService m_location;
|
||||
|
|
|
@ -14,6 +14,7 @@ import android.graphics.Color;
|
|||
import android.graphics.Paint;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.animation.Animation;
|
||||
|
@ -234,7 +235,7 @@ public final class UiUtils
|
|||
checkNotNull(tv);
|
||||
|
||||
tv.setText(text);
|
||||
tv.setVisibility((text == null || text.length() == 0) ? View.GONE : View.VISIBLE);
|
||||
tv.setVisibility(TextUtils.isEmpty(text) ? View.GONE : View.VISIBLE);
|
||||
}
|
||||
|
||||
// utility class
|
||||
|
|
Loading…
Add table
Reference in a new issue