forked from organicmaps/organicmaps
Show all list item draft.
This commit is contained in:
parent
1c3891d439
commit
bef23fc3d6
7 changed files with 38 additions and 10 deletions
|
@ -437,7 +437,7 @@ namespace android
|
|||
m_mask = mask;
|
||||
}
|
||||
|
||||
void Framework::ShowSearchResult(search::Result const & r, size_t index)
|
||||
void Framework::ShowSearchResult(search::Result const & r, int index)
|
||||
{
|
||||
m_doLoadState = false;
|
||||
m_work.ShowSearchResult(r, index);
|
||||
|
|
|
@ -90,7 +90,7 @@ namespace android
|
|||
|
||||
/// Show rect from another activity. Ensure that no LoadState will be called,
|
||||
/// when maim map activity will become active.
|
||||
void ShowSearchResult(search::Result const & r, size_t index);
|
||||
void ShowSearchResult(search::Result const & r, int index);
|
||||
|
||||
bool Search(search::SearchParams const & params);
|
||||
string GetLastSearchQuery() { return m_searchQuery; }
|
||||
|
|
|
@ -162,8 +162,14 @@ public:
|
|||
//
|
||||
// ...
|
||||
// n -- last
|
||||
if (CheckPosition(position))
|
||||
g_framework->ShowSearchResult(m_results.GetResult(position), position - 1);
|
||||
const int positionInResults = position - 1;
|
||||
if (CheckPosition(positionInResults))
|
||||
{
|
||||
if (position == 0) // all result, first arguemnt does not matter
|
||||
g_framework->ShowSearchResult(m_results.GetResult(0), positionInResults);
|
||||
else
|
||||
g_framework->ShowSearchResult(m_results.GetResult(positionInResults), positionInResults);
|
||||
}
|
||||
}
|
||||
|
||||
search::Result const * GetResult(int position, int resultID)
|
||||
|
|
|
@ -451,6 +451,12 @@ public class MapObjectFragment extends Fragment
|
|||
|
||||
@Override
|
||||
public MapObjectType getType() { return mType; }
|
||||
|
||||
@Override
|
||||
public String getPoiTypeName()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -164,7 +164,7 @@ public class SearchActivity extends MapsWithMeBaseListActivity implements Locati
|
|||
else if (m_count < 0)
|
||||
return 0;
|
||||
else
|
||||
return (m_count == 0 ? 1 : m_count);
|
||||
return (m_count == 0 ? 1 : m_count + 1); // first additional item is "Show all result for"
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -319,6 +319,21 @@ public class SearchActivity extends MapsWithMeBaseListActivity implements Locati
|
|||
}
|
||||
else
|
||||
{
|
||||
// title item with "Show all" text
|
||||
if (position == 0)
|
||||
{
|
||||
holder.m_name.setText("TODO show all text");
|
||||
holder.m_country.setText(null);
|
||||
holder.m_amenity.setText(null);
|
||||
holder.m_distance.setText(null);
|
||||
holder.m_flag.clear();
|
||||
|
||||
return convertView;
|
||||
}
|
||||
// 0 index is for multiple result
|
||||
// so real result are from 1
|
||||
--position;
|
||||
|
||||
// Show search results.
|
||||
|
||||
final SearchResult r = m_context.getResult(position, m_resultID);
|
||||
|
|
|
@ -1221,16 +1221,16 @@ bool Framework::GetCurrentPosition(double & lat, double & lon) const
|
|||
else return false;
|
||||
}
|
||||
|
||||
void Framework::ShowSearchResult(search::Result const & res, size_t index)
|
||||
void Framework::ShowSearchResult(search::Result const & res, int index)
|
||||
{
|
||||
search::Results searchRes;
|
||||
GetSearchEngine()->GetResults(searchRes);
|
||||
|
||||
m_bmManager.AdditionalPoiLayerSetVisible();
|
||||
m_bmManager.AdditionalPoiLayerClear();
|
||||
|
||||
if (index == -1) // That means show all results
|
||||
{
|
||||
search::Results searchRes;
|
||||
GetSearchEngine()->GetResults(searchRes);
|
||||
|
||||
LOG(LDEBUG, ("MwmSearch", "All result,", index));
|
||||
|
||||
m2::RectD resultsRect(searchRes.GetResult(0).GetFeatureCenter(),
|
||||
|
@ -1250,6 +1250,7 @@ void Framework::ShowSearchResult(search::Result const & res, size_t index)
|
|||
else // single result
|
||||
{
|
||||
m_bmManager.AdditionalPoiLayerAddPoi(Bookmark(res.GetFeatureCenter(), res.GetString(), "api_pin"));
|
||||
|
||||
LOG(LDEBUG, ("MwmSearch", "Single result,", index));
|
||||
|
||||
int scale;
|
||||
|
|
|
@ -278,7 +278,7 @@ public:
|
|||
void PrepareSearch(bool hasPt, double lat = 0.0, double lon = 0.0);
|
||||
bool Search(search::SearchParams const & params);
|
||||
bool GetCurrentPosition(double & lat, double & lon) const;
|
||||
void ShowSearchResult(search::Result const & res, size_t index);
|
||||
void ShowSearchResult(search::Result const & res, int index);
|
||||
|
||||
/// Calculate distance and direction to POI for the given position.
|
||||
/// @param[in] point POI's position;
|
||||
|
|
Loading…
Add table
Reference in a new issue