forked from organicmaps/organicmaps
[android] Fixed issue with missing "Clear" button in search view. Fixed missing map invalidates when clearing search view.
This commit is contained in:
parent
38050e23a8
commit
6fd8ef6a55
6 changed files with 35 additions and 29 deletions
|
@ -451,10 +451,13 @@ namespace android
|
|||
|
||||
void Framework::CleanSearchLayerOnMap()
|
||||
{
|
||||
NativeFramework()->GetBalloonManager().RemovePin();
|
||||
NativeFramework()->GetBalloonManager().Dismiss();
|
||||
NativeFramework()->GetBookmarkManager().AdditionalPoiLayerClear();
|
||||
NativeFramework()->Invalidate();
|
||||
::Framework * f = NativeFramework();
|
||||
|
||||
// Call ClearXXX first, then RemovePin (Framework::Invalidate is called inside).
|
||||
f->GetBookmarkManager().AdditionalPoiLayerClear();
|
||||
f->GetBalloonManager().RemovePin();
|
||||
f->GetBalloonManager().Dismiss();
|
||||
f->Invalidate();
|
||||
}
|
||||
|
||||
bool Framework::Search(search::SearchParams const & params)
|
||||
|
|
|
@ -259,7 +259,7 @@ public class DownloadResourcesActivity extends MapsWithMeBaseActivity
|
|||
// Intent.FLAG_ACTIVITY_REORDER_TO_FRONT
|
||||
mwmActivityIntent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
|
||||
//add task to forward
|
||||
// Add saved task to forward to map activity.
|
||||
if (mMapTaskToForward != null)
|
||||
{
|
||||
mwmActivityIntent.putExtra(MWMActivity.EXTRA_TASK, mMapTaskToForward);
|
||||
|
@ -686,9 +686,12 @@ public class DownloadResourcesActivity extends MapsWithMeBaseActivity
|
|||
final String apiUrl = intent.getStringExtra(Const.EXTRA_URL);
|
||||
if (apiUrl != null)
|
||||
{
|
||||
Framework.cleanSearchLayerOnMap();
|
||||
|
||||
final ParsedMmwRequest request = ParsedMmwRequest.extractFromIntent(intent, getApplicationContext());
|
||||
ParsedMmwRequest.setCurrentRequest(request);
|
||||
Statistics.INSTANCE.trackApiCall(request);
|
||||
|
||||
if (!request.isPickPointMode())
|
||||
mMapTaskToForward = new OpenUrlTask(apiUrl);
|
||||
return true;
|
||||
|
|
|
@ -33,6 +33,7 @@ import com.mapswithme.maps.location.LocationService;
|
|||
import com.mapswithme.maps.search.SearchController;
|
||||
import com.mapswithme.util.InputUtils;
|
||||
import com.mapswithme.util.Language;
|
||||
import com.mapswithme.util.StringUtils;
|
||||
import com.mapswithme.util.UiUtils;
|
||||
import com.mapswithme.util.Utils;
|
||||
import com.mapswithme.util.statistics.Statistics;
|
||||
|
@ -322,7 +323,7 @@ public class SearchActivity extends MapsWithMeBaseListActivity implements Locati
|
|||
String dist = null;
|
||||
if (r.m_type == 1)
|
||||
{
|
||||
type = Utils.joinSkipEmpty(", ", Utils.asObjectArray(r.m_country, r.m_amenity));
|
||||
type = StringUtils.joinSkipEmpty(", ", Utils.asObjectArray(r.m_country, r.m_amenity));
|
||||
dist = r.m_distance;
|
||||
}
|
||||
|
||||
|
|
|
@ -58,13 +58,13 @@ public class SearchController implements OnClickListener
|
|||
if (ParsedMmwRequest.hasRequest())
|
||||
mSearchQueryTV.setText(ParsedMmwRequest.getCurrentRequest().getTitle());
|
||||
else
|
||||
mSearchQueryTV.setText(getQuery());
|
||||
mSearchQueryTV.setText(getQuery());
|
||||
|
||||
mSearchQueryTV.setFocusable(false);
|
||||
UiUtils.hide(mSearchProgress);
|
||||
UiUtils.hide(mVoiceInput);
|
||||
|
||||
UiUtils.showIf(isSearching(), mClearView);
|
||||
UiUtils.showIf(!TextUtils.isEmpty(mSearchQueryTV.getText()), mClearView);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -78,11 +78,14 @@ public class SearchController implements OnClickListener
|
|||
}
|
||||
else if (R.id.search_image_clear == id)
|
||||
{
|
||||
// Clear API points first, then clear additional layer
|
||||
// (Framework::Invalidate is called inside).
|
||||
cancelApiCall();
|
||||
|
||||
Framework.cleanSearchLayerOnMap();
|
||||
|
||||
mSearchQueryTV.setText(null);
|
||||
UiUtils.hide(mClearView);
|
||||
|
||||
cancelApiCall();
|
||||
}
|
||||
else
|
||||
throw new IllegalArgumentException("Unknown id");
|
||||
|
@ -112,10 +115,4 @@ public class SearchController implements OnClickListener
|
|||
setQuery(null);
|
||||
Framework.cleanSearchLayerOnMap();
|
||||
}
|
||||
|
||||
public boolean isSearching()
|
||||
{
|
||||
return !TextUtils.isEmpty(mQuery);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -40,4 +40,18 @@ public class StringUtils
|
|||
{
|
||||
return String.format(Locale.US, pattern, args);
|
||||
}
|
||||
|
||||
public static String joinSkipEmpty(String delim, Object[] arr)
|
||||
{
|
||||
String res = null;
|
||||
for (int i = 0; i < arr.length; ++i)
|
||||
{
|
||||
String s = (arr[i] != null) ? arr[i].toString() : null;
|
||||
if (s != null && !s.isEmpty())
|
||||
res = (res == null) ? s : res + delim + s;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
private StringUtils() {}
|
||||
}
|
||||
|
|
|
@ -201,18 +201,6 @@ final public class Utils
|
|||
return args;
|
||||
}
|
||||
|
||||
public static String joinSkipEmpty(String delim, Object[] arr)
|
||||
{
|
||||
String res = null;
|
||||
for (int i = 0; i < arr.length; ++i)
|
||||
{
|
||||
String s = (arr[i] != null) ? arr[i].toString() : null;
|
||||
if (s != null && !s.isEmpty())
|
||||
res = (res == null) ? s : res + delim + s;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
// utility class
|
||||
private Utils() {};
|
||||
private Utils() {}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue