diff options
| -rw-r--r-- | main/res/layout/init.xml | 2 | ||||
| -rw-r--r-- | main/res/values-cs/strings.xml | 6 | ||||
| -rw-r--r-- | main/res/values/strings.xml | 8 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/SettingsActivity.java | 8 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/cgeocaches.java | 28 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/connector/gc/Login.java | 12 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/maps/CGeoMap.java | 7 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/network/Network.java | 16 |
8 files changed, 54 insertions, 33 deletions
diff --git a/main/res/layout/init.xml b/main/res/layout/init.xml index f5dbd2d..6708bcc 100644 --- a/main/res/layout/init.xml +++ b/main/res/layout/init.xml @@ -688,6 +688,7 @@ android:textColor="?text_color" android:textColorLink="?text_color_link" android:linksClickable="true" + android:autoLink="web" android:text="@string/init_mapsources_description" /> <Spinner android:id="@+id/mapsource" android:layout_width="fill_parent" @@ -814,6 +815,7 @@ android:textColor="?text_color" android:textColorLink="?text_color_link" android:linksClickable="true" + android:autoLink="web" android:text="@string/init_sendToCgeo_description" /> <Button style="@style/button_full" android:id="@+id/sendToCgeo_register" diff --git a/main/res/values-cs/strings.xml b/main/res/values-cs/strings.xml index 45eb519..fd262e1 100644 --- a/main/res/values-cs/strings.xml +++ b/main/res/values-cs/strings.xml @@ -151,7 +151,7 @@ <string name="err_parse_lon">c:geo nemůže dopočítat délku.</string> <string name="err_parse_dist">c:geo nemůže dopočítat vzdálenost.</string> <string name="warn_save_nothing">není nic k uložení.</string> - <string name="warn_no_cache_coord">Nejní žádná keš se souřadnicemi.</string> + <string name="warn_no_cache_coord">Není k dispozici žádná keš se souřadnicemi.</string> <string name="warn_no_coordinates">Nezískány souřadnice</string> <string name="warn_no_keyword">žádná klíčová slova nenalezena</string> <string name="warn_no_username">žádné uživatelské jméno nenalezeno</string> @@ -523,8 +523,8 @@ <string name="map_view_map">pohled do mapy</string> <string name="map_trail_show">zobrazit záznam trasy</string> <string name="map_trail_hide">skrýt záznam trasy</string> - <string name="map_live_enable">povolit aktuální polohu</string> - <string name="map_live_disable">zakázat aktuální polohu</string> + <string name="map_live_enable">povolit aktivní mapu</string> + <string name="map_live_disable">zakázat aktivní mapu</string> <string name="map_static_title">statické mapy</string> <string name="map_static_loading">načítání statických map…</string> diff --git a/main/res/values/strings.xml b/main/res/values/strings.xml index 5e3db93..609fb76 100644 --- a/main/res/values/strings.xml +++ b/main/res/values/strings.xml @@ -1069,10 +1069,14 @@ <string name="changelog">\n <b>Next release</b>\n\n <b>New Features/Functions:</b>\n - · [template]\n + · Sort by found date in lists\n + · Title of archived caches now shown in red\n + · Display cache size and D/T-rating in compass\n \n <b>Bugfixing:</b>\n - · [template]\n + · Show as list from live map corrected to display the correct caches\n + · GPX import/export compatability improvements\n + · Use last known location on startup\n \n <a href="https://github.com/cgeo/c-geo-opensource/issues?milestone=7&state=closed">Detailed list of all changes</a>\n \n diff --git a/main/src/cgeo/geocaching/SettingsActivity.java b/main/src/cgeo/geocaching/SettingsActivity.java index dc4fd90..d70b300 100644 --- a/main/src/cgeo/geocaching/SettingsActivity.java +++ b/main/src/cgeo/geocaching/SettingsActivity.java @@ -58,6 +58,7 @@ public class SettingsActivity extends AbstractActivity { private ProgressDialog loginDialog = null; private ProgressDialog webDialog = null; + private boolean enableTemplatesMenu = false; private Handler logInHandler = new Handler() { @Override @@ -116,7 +117,6 @@ public class SettingsActivity extends AbstractActivity { init(); } }; - protected boolean enableTemplatesMenu = false; public SettingsActivity() { super("c:geo-configuration"); @@ -136,12 +136,6 @@ public class SettingsActivity extends AbstractActivity { } @Override - public void onResume() { - super.onResume(); - - } - - @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); diff --git a/main/src/cgeo/geocaching/cgeocaches.java b/main/src/cgeo/geocaching/cgeocaches.java index 0958096..737fe2c 100644 --- a/main/src/cgeo/geocaching/cgeocaches.java +++ b/main/src/cgeo/geocaching/cgeocaches.java @@ -163,8 +163,6 @@ public class cgeocaches extends AbstractListActivity { try { if (search != null) { setTitle(title + " [" + search.getCount() + ']'); - cacheList.clear(); - cacheList.addAll(search.getCachesFromSearchResult(LoadFlags.LOAD_CACHE_OR_DB)); } else { setTitle(title); } @@ -240,8 +238,7 @@ public class cgeocaches extends AbstractListActivity { try { if (search != null) { setTitle(title + " [" + search.getCount() + "]"); - cacheList.clear(); - cacheList.addAll(search.getCachesFromSearchResult(LoadFlags.LOAD_CACHE_OR_DB)); + replaceCacheListFromSearch(); if (adapter != null) { adapter.reFilter(); } @@ -278,6 +275,12 @@ public class cgeocaches extends AbstractListActivity { } } }; + + private void replaceCacheListFromSearch() { + cacheList.clear(); + cacheList.addAll(search.getCachesFromSearchResult(LoadFlags.LOAD_CACHE_OR_DB)); + } + private Handler loadDetailsHandler = new Handler() { @Override @@ -359,8 +362,7 @@ public class cgeocaches extends AbstractListActivity { adapter.setSelectMode(false); } - cacheList.clear(); - cacheList.addAll(search.getCachesFromSearchResult(LoadFlags.LOAD_CACHE_OR_DB)); + replaceCacheListFromSearch(); progress.dismiss(); } @@ -377,8 +379,7 @@ public class cgeocaches extends AbstractListActivity { refreshCurrentList(); - cacheList.clear(); - cacheList.addAll(search.getCachesFromSearchResult(LoadFlags.LOAD_CACHE_OR_DB)); + replaceCacheListFromSearch(); progress.dismiss(); } @@ -561,8 +562,8 @@ public class cgeocaches extends AbstractListActivity { title = res.getString(R.string.map_map); setTitle(title); showProgress(true); - SearchResult result = (SearchResult) extras.get(EXTRAS_SEARCH); - search = new SearchResult(result); + search = (SearchResult) extras.get(EXTRAS_SEARCH); + replaceCacheListFromSearch(); loadCachesHandler.sendMessage(Message.obtain()); break; default: @@ -620,6 +621,7 @@ public class cgeocaches extends AbstractListActivity { } if (loadCachesHandler != null && search != null) { + replaceCacheListFromSearch(); loadCachesHandler.sendEmptyMessage(0); } @@ -1267,6 +1269,7 @@ public class cgeocaches extends AbstractListActivity { @Override public void run() { search = cgeoapplication.getInstance().getBatchOfStoredCaches(true, coords, Settings.getCacheType(), listId); + replaceCacheListFromSearch(); loadCachesHandler.sendMessage(Message.obtain()); } } @@ -1275,6 +1278,7 @@ public class cgeocaches extends AbstractListActivity { @Override public void run() { search = cgeoapplication.getInstance().getHistoryOfCaches(true, coords != null ? Settings.getCacheType() : CacheType.ALL); + replaceCacheListFromSearch(); loadCachesHandler.sendMessage(Message.obtain()); } } @@ -1301,6 +1305,7 @@ public class cgeocaches extends AbstractListActivity { @Override public void runSearch() { search = GCParser.searchByCoords(coords, Settings.getCacheType(), Settings.isShowCaptcha()); + replaceCacheListFromSearch(); } } @@ -1315,6 +1320,7 @@ public class cgeocaches extends AbstractListActivity { @Override public void runSearch() { search = GCParser.searchByKeyword(keyword, Settings.getCacheType(), Settings.isShowCaptcha()); + replaceCacheListFromSearch(); } } @@ -1329,6 +1335,7 @@ public class cgeocaches extends AbstractListActivity { @Override public void runSearch() { search = GCParser.searchByUsername(username, Settings.getCacheType(), Settings.isShowCaptcha()); + replaceCacheListFromSearch(); } } @@ -1343,6 +1350,7 @@ public class cgeocaches extends AbstractListActivity { @Override public void runSearch() { search = GCParser.searchByOwner(username, Settings.getCacheType(), Settings.isShowCaptcha()); + replaceCacheListFromSearch(); } } diff --git a/main/src/cgeo/geocaching/connector/gc/Login.java b/main/src/cgeo/geocaching/connector/gc/Login.java index 5584ffe..39f81f0 100644 --- a/main/src/cgeo/geocaching/connector/gc/Login.java +++ b/main/src/cgeo/geocaching/connector/gc/Login.java @@ -30,7 +30,7 @@ import java.util.regex.Matcher; public abstract class Login { - private final static String ENGLISH = "English▼"; + private final static String ENGLISH = "<a href=\"#\">English▼</a>"; // false = not logged in private static boolean actualLoginStatus = false; @@ -39,6 +39,8 @@ public abstract class Login { private static String actualStatus = ""; private final static Map<String, SimpleDateFormat> gcCustomDateFormats; + public static final String LANGUAGE_CHANGE_URI = "http://www.geocaching.com/my/souvenirs.aspx"; + static { final String[] formats = new String[] { "MM/dd/yyyy", @@ -218,7 +220,7 @@ public abstract class Login { // get find count getLoginStatus(Network.getResponseData(Network.getRequest("http://www.geocaching.com/email/"))); } else { - final String page = Network.getResponseData(Network.getRequest("http://www.geocaching.com/default.aspx")); + final String page = Network.getResponseData(Network.getRequest(LANGUAGE_CHANGE_URI)); getLoginStatus(page); if (page == null) { Log.e("Failed to read viewstates to set geocaching.com language"); @@ -227,8 +229,10 @@ public abstract class Login { "__EVENTTARGET", "ctl00$uxLocaleList$uxLocaleList$ctl00$uxLocaleItem", // switch to english "__EVENTARGUMENT", ""); Login.transferViewstates(page, params); - final HttpResponse response = Network.postRequest("http://www.geocaching.com/default.aspx", params); - if (!Network.isSuccess(response)) { + final HttpResponse response = Network.postRequest(LANGUAGE_CHANGE_URI, params, new Parameters("Referer", LANGUAGE_CHANGE_URI)); + if (Network.isSuccess(response)) { + Log.i("changed language on geocaching.com to English"); + } else { Log.e("Failed to set geocaching.com language to English"); } } diff --git a/main/src/cgeo/geocaching/maps/CGeoMap.java b/main/src/cgeo/geocaching/maps/CGeoMap.java index 81fd510..79ea44a 100644 --- a/main/src/cgeo/geocaching/maps/CGeoMap.java +++ b/main/src/cgeo/geocaching/maps/CGeoMap.java @@ -598,10 +598,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto item = menu.findItem(MENU_MAP_LIVE); // live map if (mapMode == MapMode.LIVE_ONLINE) { item.setTitle(res.getString(R.string.map_live_disable)); - } else if (mapMode == MapMode.LIVE_OFFLINE) { - item.setTitle(res.getString(R.string.map_live_enable)); } else { - item.setEnabled(false); item.setTitle(res.getString(R.string.map_live_enable)); } @@ -1088,7 +1085,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto showProgressHandler.sendEmptyMessage(SHOW_PROGRESS); loadThreadRun = System.currentTimeMillis(); - SearchResult searchResult = null; + SearchResult searchResult; // stage 1 - pull and render from the DB only for live map if (mapMode == MapMode.LIVE_ONLINE) { searchResult = new SearchResult(app.getCachedInViewport(viewport, Settings.getCacheType())); @@ -1165,7 +1162,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto showProgressHandler.sendEmptyMessage(SHOW_PROGRESS); // show progress int count = 0; - SearchResult searchResult = null; + SearchResult searchResult; do { if (tokens == null) { diff --git a/main/src/cgeo/geocaching/network/Network.java b/main/src/cgeo/geocaching/network/Network.java index c73dd30..5911146 100644 --- a/main/src/cgeo/geocaching/network/Network.java +++ b/main/src/cgeo/geocaching/network/Network.java @@ -136,6 +136,18 @@ public abstract class Network { } /** + * POST HTTP request + * + * @param uri the URI to request + * @param params the parameters to add to the POST request + * @params headers the headers to add to the request + * @return the HTTP response, or null in case of an encoding error params + */ + public static HttpResponse postRequest(final String uri, final Parameters params, final Parameters headers) { + return request("POST", uri, params, headers, null); + } + + /** * Multipart POST HTTP request * * @param uri the URI to request @@ -173,9 +185,9 @@ public abstract class Network { * @param uri * the URI to request * @param params - * the parameters to add the the GET request + * the parameters to add to the URI * @param headers - * the headers to add to the GET request + * the headers to add to the request * @param cacheFile * the cache file used to cache this query * @return the HTTP response, or null in case of an encoding error in a POST request arguments |
