forked from organicmaps/organicmaps
Count EndResults marker in search.
This commit is contained in:
parent
eca7114aaf
commit
e56bf8f422
2 changed files with 28 additions and 14 deletions
|
@ -29,10 +29,18 @@ class SearchAdapter
|
|||
|
||||
void OnResults(search::Results const & res, int queryID)
|
||||
{
|
||||
if (m_fragment == 0)
|
||||
{
|
||||
// In case when fragment is destroyed, but search thread passed any results.
|
||||
return;
|
||||
}
|
||||
|
||||
JNIEnv * env = jni::GetEnv();
|
||||
|
||||
if (res.IsEndMarker())
|
||||
{
|
||||
/// @todo Process end markers for Android in future.
|
||||
/// It's not so necessary now because we store search ID's.
|
||||
jmethodID const methodId = jni::GetJavaMethodID(env, m_fragment, "endData", "()V");
|
||||
env->CallVoidMethod(m_fragment, methodId);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -41,12 +49,6 @@ class SearchAdapter
|
|||
{
|
||||
threads::MutexGuard guard(m_updateMutex);
|
||||
|
||||
if (m_fragment == 0)
|
||||
{
|
||||
// In case when fragment is destroyed, but search thread passed any results.
|
||||
return;
|
||||
}
|
||||
|
||||
// store current results
|
||||
m_storeResults = res;
|
||||
|
||||
|
@ -63,9 +65,6 @@ class SearchAdapter
|
|||
}
|
||||
}
|
||||
|
||||
// get new environment pointer here because of different thread
|
||||
JNIEnv * env = jni::GetEnv();
|
||||
|
||||
// post message to update ListView in UI thread
|
||||
jmethodID const id = jni::GetJavaMethodID(env, m_fragment, "updateData", "(II)V");
|
||||
env->CallVoidMethod(m_fragment, id,
|
||||
|
|
|
@ -6,6 +6,7 @@ import android.location.Location;
|
|||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
@ -353,9 +354,6 @@ public class SearchFragment extends BaseMwmListFragment implements View.OnClickL
|
|||
if (!isAdded())
|
||||
return;
|
||||
|
||||
if (isCurrentResult(resultId))
|
||||
displaySearchProgress(false);
|
||||
|
||||
if (!doShowCategories())
|
||||
{
|
||||
mAdapter.updateData(count, resultId);
|
||||
|
@ -366,6 +364,23 @@ public class SearchFragment extends BaseMwmListFragment implements View.OnClickL
|
|||
});
|
||||
}
|
||||
|
||||
// Called from native code
|
||||
@SuppressWarnings("unused")
|
||||
public void endData()
|
||||
{
|
||||
getActivity().runOnUiThread(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (!isAdded())
|
||||
return;
|
||||
|
||||
displaySearchProgress(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setSearchQuery(String query)
|
||||
{
|
||||
Utils.setTextAndCursorToEnd(mEtSearchQuery, query);
|
||||
|
|
Loading…
Add table
Reference in a new issue