List of usage examples for android.app SearchManager SUGGEST_URI_PATH_QUERY
String SUGGEST_URI_PATH_QUERY
To view the source code for android.app SearchManager SUGGEST_URI_PATH_QUERY.
Click Source Link
From source file:android.support.v7.widget.SuggestionsAdapter.java
/** * Import of hidden method: SearchManager.getSuggestions(SearchableInfo, String, int). *//*from w w w. jav a2 s . c o m*/ Cursor getSearchManagerSuggestions(SearchableInfo searchable, String query, int limit) { if (searchable == null) { return null; } String authority = searchable.getSuggestAuthority(); if (authority == null) { return null; } Uri.Builder uriBuilder = new Uri.Builder().scheme(ContentResolver.SCHEME_CONTENT).authority(authority) .query("") // TODO: Remove, workaround for a bug in Uri.writeToParcel() .fragment(""); // TODO: Remove, workaround for a bug in Uri.writeToParcel() // if content path provided, insert it now final String contentPath = searchable.getSuggestPath(); if (contentPath != null) { uriBuilder.appendEncodedPath(contentPath); } // append standard suggestion query path uriBuilder.appendPath(SearchManager.SUGGEST_URI_PATH_QUERY); // get the query selection, may be null String selection = searchable.getSuggestSelection(); // inject query, either as selection args or inline String[] selArgs = null; if (selection != null) { // use selection if provided selArgs = new String[] { query }; } else { // no selection, use REST pattern uriBuilder.appendPath(query); } if (limit > 0) { uriBuilder.appendQueryParameter("limit", String.valueOf(limit)); } Uri uri = uriBuilder.build(); // finally, make the query return mContext.getContentResolver().query(uri, null, selection, selArgs, null); }
From source file:org.voidsink.anewjkuapp.update.ImportCalendarTask.java
private String getLocationExtra(VEvent event) { try {// www . j a va 2 s. c o m String name = event.getLocation().getValue().trim(); String formattedAddress = "Altenbergerstrae 69, 4040 Linz, sterreich"; double latitude = 48.33706; double longitude = 14.31960; String mapsClusterId = "CmRSAAAAEgnjqopJd0JVC22GrUK5G1fgukG3Q8gxwJ_4D-NdV1OZMP8oB3v_lA8GImeDVdqUR25xFAXHrRvR3QzA3U9i_OPDMh84Q0YFRX2IUXPhUTPfu1jp17f3APBlagpU-TNEEhAo0CzFCYccX9h60fY53upEGhROUkNAKVsKbGO2faMKyGvmc_26Ig"; if (name != null) { if (name.toUpperCase().startsWith("PE 00")) { formattedAddress = "Petrinumstrae 12, 4040 Linz, sterreich"; latitude = 48.319757; longitude = 14.275298; mapsClusterId = "CmRRAAAAVSgRGVv3PnjX7nWhyjLYOPA98MmrhhorKQHiTpKIALBSYkMMxTKTtvDr2KS3l6IKqhDqLicgeIwPl_uwmEN0aRokUojJa7Pryg-K7rLJ9ohiWXJow68suju9NfYzfJ3tEhDPlEQoguNvjwLjC8dXva7jGhTFyeDxDdfdZ8JY-dYjpPHqv_TXuQ"; } else if (name.toUpperCase().startsWith("KEP ")) { formattedAddress = "Altenbergerstrae 74, 4040 Linz, sterreich"; latitude = 48.3374066; longitude = 14.324123; mapsClusterId = "CmRSAAAA2F4LeVYCcAwT4VAT6mP3xqyDEZ40xdCIlUJZjJI0HRDrZYUTsCTrAQu0uXwdgE_Q2Yx-8kYiTg2XfA2pDpU5BkKgHfDKYPfh8_Zv6AiMgf9nxoAth1aUHlbp3iGMugauEhCUsVrMJImZyNojXWN_Nm8tGhQFqVEHQz2b5RCXc7cHik17JV1DCA"; } else if (name.toUpperCase().startsWith("KHG ")) { formattedAddress = "Mengerstrae 23, 4040 Linz, sterreich"; latitude = 48.33565830000001; longitude = 14.3171069; mapsClusterId = "CmRRAAAAzFi-w_zcsubNwMXG9-wpVfq6tFlTl2wxfR59QcybAQuF7k4kwNwTlFQWluOgyKKEtfi5-fP-zzJM_Jwv837jI-QTFQaDXfEpdaXKgHas9VNtHDjMbbTrh2YG5-8NZQz_EhAh0qirheebQ6QJROK39fNOGhQKPJEmyjv_S8iLlpIRtbskq_dThg"; } else if (name.toUpperCase().startsWith("ESH ")) { formattedAddress = "Julius-Raab-Strae 1-3, 4040 Linz, sterreich"; latitude = 48.32893189999999; longitude = 14.3220179; mapsClusterId = "CmRRAAAAztw2Q-pFchJnT32wqealtHgsRyNlzebFxGqFb_PZIRsqujQKfTNKYn0zA6mdGYelwDtmm-SIKH5srpkIGrZkwhckuYQhFo3UkpLsnFYV73hScFdrSvMJLmGuKLwRHW1bEhBTuKPtU_mvcMQplpxK-h6PGhSnVtoLUH37vZBXvWna051K_nC5PA"; } ContentResolver cr = mContext.getContentResolver(); Uri searchUri = PoiContentContract.CONTENT_URI.buildUpon() .appendPath(SearchManager.SUGGEST_URI_PATH_QUERY).appendPath(name).build(); Cursor c = cr.query(searchUri, ImportPoiTask.POI_PROJECTION, null, null, null); Poi p = null; if (c != null) { while (c.moveToNext()) { p = new Poi(c); if (p.getName().equalsIgnoreCase(name)) { break; } p = null; } c.close(); } if (p != null) { latitude = p.getLat(); longitude = p.getLon(); name = p.getName(); } } else { name = ""; } DecimalFormatSymbols dfs = DecimalFormatSymbols.getInstance(); dfs.setDecimalSeparator('.'); DecimalFormat df = new DecimalFormat("##0.0#############", dfs); return String.format( "{\"locations\":[{\"address\":{\"formattedAddress\":\"%s\"},\"geo\":{\"latitude\":%s,\"longitude\":%s},\"mapsClusterId\":\"%s\",\"name\":\"%s\",\"url\":\"http://maps.google.com/maps?q=loc:%s,%s+(%s)&z=19\n\"}]}", formattedAddress, df.format(latitude), df.format(longitude), mapsClusterId, name, df.format(latitude), df.format(longitude), name); } catch (Exception e) { Analytics.sendException(mContext, e, true); return ""; } }