forked from organicmaps/organicmaps
[android] Added propagation of the 'isHotel' flag to the end search callback method to fix the showing the filter panel on the map
This commit is contained in:
parent
4d57f14eb2
commit
a1b8bf0598
5 changed files with 14 additions and 8 deletions
|
@ -389,12 +389,14 @@ void OnResults(Results const & results, vector<search::ProductInfo> const & prod
|
|||
jni::TScopedLocalObjectArrayRef jResults(
|
||||
env, BuildSearchResults(results, productInfo, hasPosition, lat, lon));
|
||||
env->CallVoidMethod(g_javaListener, g_updateResultsId, jResults.get(),
|
||||
static_cast<jlong>(timestamp), results.GetType() == Results::Type::Hotels);
|
||||
static_cast<jlong>(timestamp),
|
||||
static_cast<jboolean>(results.GetType() == Results::Type::Hotels));
|
||||
}
|
||||
|
||||
if (results.IsEndMarker())
|
||||
{
|
||||
env->CallVoidMethod(g_javaListener, g_endResultsId, static_cast<jlong>(timestamp));
|
||||
env->CallVoidMethod(g_javaListener, g_endResultsId, static_cast<jlong>(timestamp),
|
||||
static_cast<jboolean>(results.GetType() == Results::Type::Hotels));
|
||||
if (isMapAndTable && results.IsEndedNormal())
|
||||
g_framework->NativeFramework()->GetSearchAPI().PokeSearchInViewport();
|
||||
}
|
||||
|
@ -660,7 +662,7 @@ extern "C"
|
|||
g_javaListener = env->NewGlobalRef(thiz);
|
||||
g_updateResultsId = jni::GetMethodID(env, g_javaListener, "onResultsUpdate",
|
||||
"([Lcom/mapswithme/maps/search/SearchResult;JZ)V");
|
||||
g_endResultsId = jni::GetMethodID(env, g_javaListener, "onResultsEnd", "(J)V");
|
||||
g_endResultsId = jni::GetMethodID(env, g_javaListener, "onResultsEnd", "(JZ)V");
|
||||
g_resultClass = jni::GetGlobalClassRef(env, "com/mapswithme/maps/search/SearchResult");
|
||||
g_resultConstructor = jni::GetConstructorID(
|
||||
env, g_resultClass,
|
||||
|
|
|
@ -2207,8 +2207,10 @@ public class MwmActivity extends BaseMwmFragmentActivity
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onResultsEnd(long timestamp)
|
||||
public void onResultsEnd(long timestamp, boolean isHotel)
|
||||
{
|
||||
if (mFilterController != null)
|
||||
mFilterController.updateFilterButtonsVisibility(isHotel);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -11,11 +11,13 @@ public interface NativeSearchListener
|
|||
/**
|
||||
* @param results Search results.
|
||||
* @param timestamp Timestamp of search request.
|
||||
* @param isHotel Indicates that it's a hotel search result.
|
||||
*/
|
||||
void onResultsUpdate(@NonNull SearchResult[] results, long timestamp, boolean isHotel);
|
||||
|
||||
/**
|
||||
* @param timestamp Timestamp of search request.
|
||||
* @param isHotel Indicates that it's a hotel search result.
|
||||
*/
|
||||
void onResultsEnd(long timestamp);
|
||||
void onResultsEnd(long timestamp, boolean isHotel);
|
||||
}
|
||||
|
|
|
@ -44,13 +44,13 @@ public enum SearchEngine implements NativeSearchListener,
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onResultsEnd(final long timestamp)
|
||||
public void onResultsEnd(final long timestamp, final boolean isHotel)
|
||||
{
|
||||
UiThread.run(
|
||||
() ->
|
||||
{
|
||||
for (NativeSearchListener listener : mListeners)
|
||||
listener.onResultsEnd(timestamp);
|
||||
listener.onResultsEnd(timestamp, isHotel);
|
||||
mListeners.finishIterate();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -649,7 +649,7 @@ public class SearchFragment extends BaseMwmFragment
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onResultsEnd(long timestamp)
|
||||
public void onResultsEnd(long timestamp, boolean isHotel)
|
||||
{
|
||||
onSearchEnd();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue