aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main/AndroidManifest.xml6
-rw-r--r--main/res/layout-land/coords.xml30
-rw-r--r--main/res/layout/about.xml2
-rw-r--r--main/res/layout/auth.xml6
-rw-r--r--main/res/layout/cacheview_waypoints.xml2
-rw-r--r--main/res/layout/coords.xml30
-rw-r--r--main/res/layout/init.xml32
-rw-r--r--main/res/layout/point_controls.xml10
-rw-r--r--main/res/layout/search.xml30
-rw-r--r--main/res/layout/touch.xml10
-rw-r--r--main/res/layout/visit.xml14
-rw-r--r--main/res/layout/waypoint_new.xml14
-rw-r--r--main/res/values/strings.xml29
-rw-r--r--main/res/values/styles.xml47
-rw-r--r--main/res/values/themes.xml224
-rw-r--r--main/src/cgeo/geocaching/AbstractPopupActivity.java1
-rw-r--r--main/src/cgeo/geocaching/LiveMapInfo.java1
-rw-r--r--main/src/cgeo/geocaching/apps/cache/navi/AbstractPointNavigationApp.java56
-rw-r--r--main/src/cgeo/geocaching/apps/cache/navi/AbstractStaticMapsApp.java31
-rw-r--r--main/src/cgeo/geocaching/apps/cache/navi/CacheNavigationApp.java17
-rw-r--r--main/src/cgeo/geocaching/apps/cache/navi/CompassApp.java41
-rw-r--r--main/src/cgeo/geocaching/apps/cache/navi/DownloadStaticMapsApp.java22
-rw-r--r--main/src/cgeo/geocaching/apps/cache/navi/GeopointNavigationApp.java13
-rw-r--r--main/src/cgeo/geocaching/apps/cache/navi/GoogleMapsApp.java2
-rw-r--r--main/src/cgeo/geocaching/apps/cache/navi/GoogleNavigationApp.java37
-rw-r--r--main/src/cgeo/geocaching/apps/cache/navi/InternalMap.java39
-rw-r--r--main/src/cgeo/geocaching/apps/cache/navi/LocusApp.java37
-rw-r--r--main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java93
-rw-r--r--main/src/cgeo/geocaching/apps/cache/navi/NavigonApp.java2
-rw-r--r--main/src/cgeo/geocaching/apps/cache/navi/OruxMapsApp.java2
-rw-r--r--main/src/cgeo/geocaching/apps/cache/navi/RMapsApp.java52
-rw-r--r--main/src/cgeo/geocaching/apps/cache/navi/RadarApp.java2
-rw-r--r--main/src/cgeo/geocaching/apps/cache/navi/StaticMapApp.java22
-rw-r--r--main/src/cgeo/geocaching/apps/cache/navi/StreetviewApp.java2
-rw-r--r--main/src/cgeo/geocaching/apps/cache/navi/WaypointNavigationApp.java15
-rw-r--r--main/src/cgeo/geocaching/cgeocaches.java79
-rw-r--r--main/src/cgeo/geocaching/maps/CGeoMap.java84
-rw-r--r--main/src/cgeo/geocaching/ui/CacheListAdapter.java20
38 files changed, 561 insertions, 595 deletions
diff --git a/main/AndroidManifest.xml b/main/AndroidManifest.xml
index 0c6d922..648fbc0 100644
--- a/main/AndroidManifest.xml
+++ b/main/AndroidManifest.xml
@@ -56,7 +56,7 @@
<activity
android:name=".CachePopup"
android:label="@string/app_name"
- android:theme="@style/cgeo_transparent"
+ android:theme="@style/popup_dark"
android:windowSoftInputMode="stateHidden"
android:configChanges="keyboardHidden|orientation" >
</activity>
@@ -226,14 +226,14 @@
<activity
android:name=".LiveMapInfo"
android:label="@string/app_name"
- android:theme="@style/cgeo_transparent"
+ android:theme="@style/popup_dark"
android:configChanges="keyboardHidden|orientation" >
</activity>
<provider android:name=".apps.LocusDataStorageProvider"
android:authorities="cgeo.geocaching.apps.locusdatastorageprovider" />
<activity android:name="WaypointPopup"
android:label="@string/app_name"
- android:theme="@style/cgeo_transparent"
+ android:theme="@style/popup_dark"
android:windowSoftInputMode="stateHidden"
android:configChanges="keyboardHidden|orientation" >
</activity>
diff --git a/main/res/layout-land/coords.xml b/main/res/layout-land/coords.xml
index c25a2c0..c2dc9c5 100644
--- a/main/res/layout-land/coords.xml
+++ b/main/res/layout-land/coords.xml
@@ -31,8 +31,8 @@
android:layout_weight="1">
<TableRow android:id="@+id/tableRow1">
<Button android:id="@+id/ButtonLat"
- style="@style/button"/>
- <EditText style="@style/edittext"
+ style="@style/button_full"/>
+ <EditText style="@style/edittext_full"
android:id="@+id/EditTextLatDeg"
android:gravity="right"
android:inputType="number"
@@ -40,63 +40,63 @@
<TextView android:id="@+id/LatSeparator1"
android:text="°" />
<EditText android:id="@+id/EditTextLatMin"
- style="@style/edittext"
+ style="@style/edittext_full"
android:gravity="right"
android:inputType="number"
android:selectAllOnFocus="true" />
<TextView android:id="@+id/LatSeparator2"
android:text="," />
<EditText android:id="@+id/EditTextLatSec"
- style="@style/edittext"
+ style="@style/edittext_full"
android:gravity="right"
android:inputType="number"
android:selectAllOnFocus="true" />
<TextView android:id="@+id/LatSeparator3"
android:text="," />
<EditText android:id="@+id/EditTextLatSecFrac"
- style="@style/edittext"
+ style="@style/edittext_full"
android:inputType="number"
android:selectAllOnFocus="true" />
</TableRow>
<TableRow android:id="@+id/tableRow2">
<Button android:id="@+id/ButtonLon"
- style="@style/button"/>
+ style="@style/button_full"/>
<EditText android:id="@+id/EditTextLonDeg"
- style="@style/edittext"
+ style="@style/edittext_full"
android:gravity="right"
android:inputType="number"
android:selectAllOnFocus="true" />
<TextView android:id="@+id/LonSeparator1"
android:text="°" />
<EditText android:id="@+id/EditTextLonMin"
- style="@style/edittext"
+ style="@style/edittext_full"
android:gravity="right"
android:inputType="number"
android:selectAllOnFocus="true" />
<TextView android:id="@+id/LonSeparator2"
android:text="," />
<EditText android:id="@+id/EditTextLonSec"
- style="@style/edittext"
+ style="@style/edittext_full"
android:gravity="right"
android:inputType="number"
android:selectAllOnFocus="true" />
<TextView android:id="@+id/LonSeparator3"
android:text="," />
<EditText android:id="@+id/EditTextLonSecFrac"
- style="@style/edittext"
+ style="@style/edittext_full"
android:inputType="number"
android:selectAllOnFocus="true" />
</TableRow>
</TableLayout>
<EditText
android:id="@+id/latitude"
- style="@style/edittext"
+ style="@style/edittext_full"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="@string/latitude" />
<EditText
android:id="@+id/longitude"
- style="@style/edittext"
+ style="@style/edittext_full"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="@string/longitude" />
@@ -104,20 +104,20 @@
android:id="@+id/linearLayout2"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
- <Button style="@style/button"
+ <Button style="@style/button_full"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/current"
android:layout_weight="1"
android:text="@string/waypoint_my_coordinates" />
- <Button style="@style/button"
+ <Button style="@style/button_full"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/cache"
android:layout_weight="1"
android:text="@string/waypoint_cache_coordinates" />
</LinearLayout>
- <Button style="@style/button"
+ <Button style="@style/button_full"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/done"
diff --git a/main/res/layout/about.xml b/main/res/layout/about.xml
index 8439b35..f03d847 100644
--- a/main/res/layout/about.xml
+++ b/main/res/layout/about.xml
@@ -74,7 +74,7 @@
android:layout_marginTop="10dip"
android:orientation="horizontal"
android:gravity="center_horizontal" >
- <Button style="@style/button"
+ <Button style="@style/button_full"
android:id="@+id/donation_more"
android:layout_width="280dip"
android:singleLine="false"
diff --git a/main/res/layout/auth.xml b/main/res/layout/auth.xml
index 51c7d03..d94b08a 100644
--- a/main/res/layout/auth.xml
+++ b/main/res/layout/auth.xml
@@ -64,15 +64,15 @@
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="7dip" >
- <Button style="@style/button"
+ <Button style="@style/button_full"
android:id="@+id/start"
android:text="@string/auth_authorize" />
- <EditText style="@style/edittext"
+ <EditText style="@style/edittext_full"
android:id="@+id/pin"
android:visibility="gone"
android:inputType="number"
android:hint="@string/auth_pin_hint" />
- <Button style="@style/button"
+ <Button style="@style/button_full"
android:id="@+id/pin_button"
android:visibility="gone"
android:text="@string/auth_finish" />
diff --git a/main/res/layout/cacheview_waypoints.xml b/main/res/layout/cacheview_waypoints.xml
index 9ce5b57..faf90f5 100644
--- a/main/res/layout/cacheview_waypoints.xml
+++ b/main/res/layout/cacheview_waypoints.xml
@@ -18,7 +18,7 @@
<Button
android:id="@+id/add_waypoint"
- style="@style/button"
+ style="@style/button_full"
android:text="@string/cache_waypoints_add"
android:layout_marginTop="9dp" />
</LinearLayout>
diff --git a/main/res/layout/coords.xml b/main/res/layout/coords.xml
index d673d00..3adcb2a 100644
--- a/main/res/layout/coords.xml
+++ b/main/res/layout/coords.xml
@@ -31,8 +31,8 @@
android:layout_weight="1">
<TableRow android:id="@+id/tableRow1">
<Button android:id="@+id/ButtonLat"
- style="@style/button"/>
- <EditText style="@style/edittext"
+ style="@style/button_full"/>
+ <EditText style="@style/edittext_full"
android:id="@+id/EditTextLatDeg"
android:gravity="right"
android:inputType="number"
@@ -40,75 +40,75 @@
<TextView android:id="@+id/LatSeparator1"
android:text="°" />
<EditText android:id="@+id/EditTextLatMin"
- style="@style/edittext"
+ style="@style/edittext_full"
android:gravity="right"
android:inputType="number"
android:selectAllOnFocus="true" />
<TextView android:id="@+id/LatSeparator2"
android:text="," />
<EditText android:id="@+id/EditTextLatSec"
- style="@style/edittext"
+ style="@style/edittext_full"
android:gravity="right"
android:inputType="number"
android:selectAllOnFocus="true" />
<TextView android:id="@+id/LatSeparator3"
android:text="," />
<EditText android:id="@+id/EditTextLatSecFrac"
- style="@style/edittext"
+ style="@style/edittext_full"
android:inputType="number"
android:selectAllOnFocus="true" />
</TableRow>
<TableRow android:id="@+id/tableRow2">
<Button android:id="@+id/ButtonLon"
- style="@style/button"/>
+ style="@style/button_full"/>
<EditText android:id="@+id/EditTextLonDeg"
- style="@style/edittext"
+ style="@style/edittext_full"
android:gravity="right"
android:inputType="number"
android:selectAllOnFocus="true" />
<TextView android:id="@+id/LonSeparator1"
android:text="°" />
<EditText android:id="@+id/EditTextLonMin"
- style="@style/edittext"
+ style="@style/edittext_full"
android:gravity="right"
android:inputType="number"
android:selectAllOnFocus="true" />
<TextView android:id="@+id/LonSeparator2"
android:text="," />
<EditText android:id="@+id/EditTextLonSec"
- style="@style/edittext"
+ style="@style/edittext_full"
android:gravity="right"
android:inputType="number"
android:selectAllOnFocus="true" />
<TextView android:id="@+id/LonSeparator3"
android:text="," />
<EditText android:id="@+id/EditTextLonSecFrac"
- style="@style/edittext"
+ style="@style/edittext_full"
android:inputType="number"
android:selectAllOnFocus="true" />
</TableRow>
</TableLayout>
- <EditText style="@style/edittext"
+ <EditText style="@style/edittext_full"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/latitude"
android:hint="@string/latitude" />
- <EditText style="@style/edittext"
+ <EditText style="@style/edittext_full"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/longitude"
android:hint="@string/longitude" />
- <Button style="@style/button"
+ <Button style="@style/button_full"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/current"
android:text="@string/waypoint_my_coordinates" />
- <Button style="@style/button"
+ <Button style="@style/button_full"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/cache"
android:text="@string/waypoint_cache_coordinates" />
- <Button style="@style/button"
+ <Button style="@style/button_full"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/done"
diff --git a/main/res/layout/init.xml b/main/res/layout/init.xml
index bbcc33f..f5dbd2d 100644
--- a/main/res/layout/init.xml
+++ b/main/res/layout/init.xml
@@ -43,14 +43,14 @@
android:textColorLink="?text_color_link"
android:linksClickable="true"
android:text="@string/legal_note" />
- <EditText style="@style/edittext"
+ <EditText style="@style/edittext_full"
android:id="@+id/username"
android:hint="@string/init_username" />
- <EditText style="@style/edittext"
+ <EditText style="@style/edittext_full"
android:id="@+id/password"
android:hint="@string/init_password"
android:password="true" />
- <Button style="@style/button"
+ <Button style="@style/button_full"
android:id="@+id/log_me_in"
android:lines="2"
android:singleLine="false"
@@ -62,7 +62,7 @@
<TextView style="@style/separator_horizontal_headline"
android:text="@string/init_gcvote" />
</RelativeLayout>
- <EditText style="@style/edittext"
+ <EditText style="@style/edittext_full"
android:id="@+id/passvote"
android:hint="@string/init_passvote"
android:password="true" />
@@ -126,7 +126,7 @@
android:textColorLink="?text_color_link"
android:linksClickable="true"
android:text="@string/about_twitter" />
- <Button style="@style/button"
+ <Button style="@style/button_full"
android:id="@+id/authorize_twitter"
android:text="@string/init_twitter_authorize" />
<LinearLayout
@@ -157,7 +157,7 @@
<TextView style="@style/separator_horizontal_headline"
android:text="@string/init_signature" />
</RelativeLayout>
- <EditText style="@style/edittext"
+ <EditText style="@style/edittext_full"
android:id="@+id/signature"
android:hint="@string/init_signature"
android:singleLine="false"
@@ -167,13 +167,13 @@
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
- <Button style="@style/button"
+ <Button style="@style/button_full"
android:id="@+id/signature_template"
android:layout_width="wrap_content"
android:layout_weight="2"
android:textSize="14dip"
android:text="@string/init_signature_template_button" />
- <Button style="@style/button"
+ <Button style="@style/button_full"
android:id="@+id/signature_help"
android:layout_width="wrap_content"
android:layout_weight="1"
@@ -651,7 +651,7 @@
<TextView style="@style/separator_horizontal_headline"
android:text="@string/init_showwaypoints" />
</RelativeLayout>
- <EditText style="@style/edittext"
+ <EditText style="@style/edittext_full"
android:id="@+id/showwaypointsthreshold"
android:singleLine="true"
android:lines="1"
@@ -698,11 +698,11 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
- <Button style="@style/button"
+ <Button style="@style/button_full"
android:id="@+id/select_mapfile"
android:text="@string/init_select_mapfile"
android:layout_width="wrap_content" />
- <EditText style="@style/edittext"
+ <EditText style="@style/edittext_full"
android:id="@+id/mapfile"
android:singleLine="true"
android:lines="1"
@@ -715,7 +715,7 @@
<TextView style="@style/separator_horizontal_headline"
android:text="@string/init_altitude" />
</RelativeLayout>
- <EditText style="@style/edittext"
+ <EditText style="@style/edittext_full"
android:id="@+id/altitude"
android:singleLine="true"
android:lines="1"
@@ -795,7 +795,7 @@
android:textColorLink="?text_color_link"
android:linksClickable="true"
android:text="@string/init_sendToCgeo_name" />
- <EditText style="@style/edittext"
+ <EditText style="@style/edittext_full"
android:id="@+id/webDeviceName"
android:singleLine="true"
android:lines="1"
@@ -815,7 +815,7 @@
android:textColorLink="?text_color_link"
android:linksClickable="true"
android:text="@string/init_sendToCgeo_description" />
- <Button style="@style/button"
+ <Button style="@style/button_full"
android:id="@+id/sendToCgeo_register"
android:text="@string/init_sendToCgeo_register" />
<!-- ** -->
@@ -843,13 +843,13 @@
android:layout_margin="3dip"
android:orientation="horizontal"
android:padding="3dip" >
- <Button style="@style/button"
+ <Button style="@style/button_full"
android:id="@+id/backup_backup"
android:layout_width="0dip"
android:layout_weight="1"
android:text="@string/init_backup_backup"
android:onClick="backup" />
- <Button style="@style/button"
+ <Button style="@style/button_full"
android:id="@+id/backup_restore"
android:layout_width="0dip"
android:layout_weight="1"
diff --git a/main/res/layout/point_controls.xml b/main/res/layout/point_controls.xml
index 4ec685d..22d05c7 100644
--- a/main/res/layout/point_controls.xml
+++ b/main/res/layout/point_controls.xml
@@ -16,17 +16,17 @@
<Button
android:id="@+id/buttonLatitude"
- style="@style/button"
+ style="@style/button_full"
android:hint="@string/latitude" />
<Button
android:id="@+id/buttonLongitude"
- style="@style/button"
+ style="@style/button_full"
android:hint="@string/longitude" />
<Button
android:id="@+id/current"
- style="@style/button"
+ style="@style/button_full"
android:text="@string/waypoint_my_coordinates" />
<RelativeLayout style="@style/separator_horizontal_layout" >
@@ -40,7 +40,7 @@
<EditText
android:id="@+id/bearing"
- style="@style/edittext"
+ style="@style/edittext_full"
android:hint="@string/waypoint_bearing"
android:inputType="numberDecimal" />
@@ -51,7 +51,7 @@
<EditText
android:id="@+id/distance"
- style="@style/edittext"
+ style="@style/edittext_full"
android:layout_width="0dip"
android:layout_weight="1"
android:hint="@string/waypoint_distance"
diff --git a/main/res/layout/search.xml b/main/res/layout/search.xml
index 82fdac6..09fb886 100644
--- a/main/res/layout/search.xml
+++ b/main/res/layout/search.xml
@@ -30,13 +30,13 @@
<TextView style="@style/separator_horizontal_headline"
android:text="@string/search_coordinates" />
</RelativeLayout>
- <Button style="@style/button"
+ <Button style="@style/button_full"
android:hint="@string/latitude"
android:id="@+id/buttonLatitude"/>
- <Button style="@style/button"
+ <Button style="@style/button_full"
android:hint="@string/longitude"
android:id="@+id/buttonLongitude"/>
- <Button style="@style/button"
+ <Button style="@style/button_full"
android:id="@+id/search_coordinates"
android:text="@string/search_coordinates_button" />
<!-- ** -->
@@ -45,11 +45,11 @@
<TextView style="@style/separator_horizontal_headline"
android:text="@string/search_address" />
</RelativeLayout>
- <EditText style="@style/edittext"
+ <EditText style="@style/edittext_full"
android:id="@+id/address"
android:hint="@string/search_address"
android:imeOptions="actionGo" />
- <Button style="@style/button"
+ <Button style="@style/button_full"
android:id="@+id/search_address"
android:text="@string/search_address_button" />
<!-- ** -->
@@ -58,13 +58,13 @@
<TextView style="@style/separator_horizontal_headline"
android:text="@string/search_gc" />
</RelativeLayout>
- <AutoCompleteTextView style="@style/edittext"
+ <AutoCompleteTextView style="@style/edittext_full"
android:id="@+id/geocode"
android:hint="@string/search_gc"
android:imeOptions="actionGo"
android:text="GC"
android:inputType="textCapCharacters" />
- <Button style="@style/button"
+ <Button style="@style/button_full"
android:id="@+id/display_geocode"
android:text="@string/search_gc_button" />
<!-- ** -->
@@ -73,11 +73,11 @@
<TextView style="@style/separator_horizontal_headline"
android:text="@string/search_kw" />
</RelativeLayout>
- <EditText style="@style/edittext"
+ <EditText style="@style/edittext_full"
android:id="@+id/keyword"
android:hint="@string/search_kw_prefill"
android:imeOptions="actionGo" />
- <Button style="@style/button"
+ <Button style="@style/button_full"
android:id="@+id/search_keyword"
android:text="@string/search_kw_button" />
<!-- ** -->
@@ -86,11 +86,11 @@
<TextView style="@style/separator_horizontal_headline"
android:text="@string/search_fbu" />
</RelativeLayout>
- <EditText style="@style/edittext"
+ <EditText style="@style/edittext_full"
android:id="@+id/username"
android:hint="@string/search_fbu_prefill"
android:imeOptions="actionGo" />
- <Button style="@style/button"
+ <Button style="@style/button_full"
android:id="@+id/search_username"
android:text="@string/search_fbu_button" />
<!-- ** -->
@@ -99,11 +99,11 @@
<TextView style="@style/separator_horizontal_headline"
android:text="@string/search_hbu" />
</RelativeLayout>
- <EditText style="@style/edittext"
+ <EditText style="@style/edittext_full"
android:id="@+id/owner"
android:hint="@string/search_hbu_prefill"
android:imeOptions="actionGo" />
- <Button style="@style/button"
+ <Button style="@style/button_full"
android:id="@+id/search_owner"
android:text="@string/search_hbu_button" />
<!-- ** -->
@@ -112,12 +112,12 @@
<TextView style="@style/separator_horizontal_headline"
android:text="@string/search_tb" />
</RelativeLayout>
- <EditText style="@style/edittext"
+ <EditText style="@style/edittext_full"
android:id="@+id/trackable"
android:hint="@string/search_tb_hint"
android:imeOptions="actionGo"
android:inputType="textCapCharacters" />
- <Button style="@style/button"
+ <Button style="@style/button_full"
android:id="@+id/display_trackable"
android:text="@string/search_tb_button" />
</LinearLayout>
diff --git a/main/res/layout/touch.xml b/main/res/layout/touch.xml
index de17c3d..06a9d25 100644
--- a/main/res/layout/touch.xml
+++ b/main/res/layout/touch.xml
@@ -30,20 +30,20 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
- <Button style="@style/button"
+ <Button style="@style/button_full"
android:id="@+id/type"
android:layout_width="0dip"
android:layout_weight="1"/>
- <Button style="@style/button"
+ <Button style="@style/button_full"
android:id="@+id/date"
android:layout_width="0dip"
android:layout_weight="1"/>
</LinearLayout>
- <EditText style="@style/edittext"
+ <EditText style="@style/edittext_full"
android:id="@+id/tracking"
android:inputType="textCapCharacters"
android:hint="@string/trackable_code" />
- <EditText style="@style/edittext"
+ <EditText style="@style/edittext_full"
android:id="@+id/log"
android:hint="@string/log_new_log_text"
android:singleLine="false"
@@ -73,7 +73,7 @@
android:textColor="?text_color"
android:text="@string/visit_tweet" />
</LinearLayout>
- <Button style="@style/button"
+ <Button style="@style/button_full"
android:id="@+id/post"
android:text="@string/log_post" />
</LinearLayout>
diff --git a/main/res/layout/visit.xml b/main/res/layout/visit.xml
index 80a3a5c..8018d48 100644
--- a/main/res/layout/visit.xml
+++ b/main/res/layout/visit.xml
@@ -35,16 +35,16 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
- <Button style="@style/button"
+ <Button style="@style/button_full"
android:id="@+id/type"
android:layout_width="0dip"
android:layout_weight="1"/>
- <Button style="@style/button"
+ <Button style="@style/button_full"
android:id="@+id/date"
android:layout_width="0dip"
android:layout_weight="1"/>
</LinearLayout>
- <EditText style="@style/edittext"
+ <EditText style="@style/edittext_full"
android:id="@+id/log"
android:hint="@string/log_new_log_text"
android:singleLine="false"
@@ -75,7 +75,7 @@
android:textColor="?text_color"
android:text="@string/visit_tweet" />
</LinearLayout>
- <Button style="@style/button"
+ <Button style="@style/button_full"
android:id="@+id/post"
android:text="@string/log_post" />
<RelativeLayout style="@style/separator_horizontal_layout" >
@@ -87,12 +87,12 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
- <Button style="@style/button"
+ <Button style="@style/button_full"
android:id="@+id/save"
android:layout_width="0dip"
android:layout_weight="1"
android:text="@string/log_save" />
- <Button style="@style/button"
+ <Button style="@style/button_full"
android:id="@+id/clear"
android:layout_width="0dip"
android:layout_weight="1"
@@ -122,7 +122,7 @@
android:layout_height="wrap_content"
android:gravity="right"
android:orientation="vertical" >
- <Button style="@style/button"
+ <Button style="@style/button_full"
android:id="@+id/changebutton"
android:layout_width="wrap_content"
android:layout_weight="1"
diff --git a/main/res/layout/waypoint_new.xml b/main/res/layout/waypoint_new.xml
index b8237ea..397f0ee 100644
--- a/main/res/layout/waypoint_new.xml
+++ b/main/res/layout/waypoint_new.xml
@@ -37,17 +37,17 @@
<Button
android:id="@+id/buttonLatitude"
- style="@style/button"
+ style="@style/button_full"
android:hint="@string/latitude" />
<Button
android:id="@+id/buttonLongitude"
- style="@style/button"
+ style="@style/button_full"
android:hint="@string/longitude" />
<EditText
android:id="@+id/bearing"
- style="@style/edittext"
+ style="@style/edittext_full"
android:hint="@string/waypoint_bearing"
android:inputType="numberDecimal" />
@@ -58,7 +58,7 @@
<EditText
android:id="@+id/distance"
- style="@style/edittext"
+ style="@style/edittext_full"
android:hint="@string/waypoint_distance"
android:inputType="numberDecimal"
android:layout_width="0dip"
@@ -73,7 +73,7 @@
<AutoCompleteTextView
android:id="@+id/name"
- style="@style/edittext"
+ style="@style/edittext_full"
android:hint="@string/waypoint_name" />
<Spinner
@@ -83,7 +83,7 @@
<EditText
android:id="@+id/note"
- style="@style/edittext"
+ style="@style/edittext_full"
android:layout_height="wrap_content"
android:capitalize="sentences"
android:hint="@string/waypoint_note"
@@ -92,7 +92,7 @@
<Button
android:id="@+id/add_waypoint"
- style="@style/button"
+ style="@style/button_full"
android:text="@string/waypoint_save" />
</LinearLayout>
</ScrollView>
diff --git a/main/res/values/strings.xml b/main/res/values/strings.xml
index dcf4946..f0f5c44 100644
--- a/main/res/values/strings.xml
+++ b/main/res/values/strings.xml
@@ -1053,35 +1053,10 @@
<string name="changelog">\n
<b>Next release</b>\n\n
<b>New Features/Functions:</b>\n
- · Add/remove cache to/from Favorites\n
- · Export caches as GPX file\n
- · Filter for D/T in lists\n
- · Allow close of popup by click on map\n
- · Support of v0.3.0 mapsforge offline maps\n
- · Sorting of caches by store date\n
- · New popup for waypoints on live map\n
- · On-demand download of static maps\n
- · Upload fieldnotes to geocaching.com\n
- · Optionally move stored data to sd-card\n
- · Display time since last log on TB page\n
- · Popup on live map will give more details for unsaved caches\n
- · View all caches from different lists at once\n
+ · [template]\n
\n
<b>Bugfixing:</b>\n
- · Static maps download for waypoints now off by default\n
- · Waypoints on map do no longer disappear when moving map\n
- · Static map download improved\n
- · Distance information in nearby search corrected\n
- · Adaption to changes on geocaching.com\n
- · Warning displayed for incompatible or outdated map files\n
- · No change of font color in selection mode\n
- · List layout optimized for most efficient screen usage\n
- · Watchlist status shown correct\n
- · Faster reaction when opening popup on map\n
- · Hiding of found/owned caches on map corrected\n
- · Show all stored caches on map (limit of 500 caches removed)\n
- · Position marker now shown above cache icons\n
- · Wrong cache size in cache details corrected\n
+ · [template]\n
\n
<a href="https://github.com/cgeo/c-geo-opensource/issues?milestone=6&amp;state=closed">Detailed list of all changes</a>\n
\n
diff --git a/main/res/values/styles.xml b/main/res/values/styles.xml
index ad3fc8d..394e3d0 100644
--- a/main/res/values/styles.xml
+++ b/main/res/values/styles.xml
@@ -2,7 +2,6 @@
<resources>
<!-- system definitions -->
- <style name="cgeo" parent="android:Theme.NoTitleBar"></style>
<style name="button" parent="@android:style/Widget.Button">
<item name="android:padding">6dip</item>
@@ -13,9 +12,6 @@
<item name="android:textSize">22dip</item>
<item name="android:textColor">?text_color</item>
<item name="android:background">?button</item>
- <item name="android:focusable">true</item>
- <item name="android:clickable">true</item>
- <item name="android:gravity">center</item>
</style>
<style name="edittext" parent="@android:style/Widget.EditText">
@@ -26,7 +22,6 @@
<item name="android:textColor">?text_color</item>
<item name="android:textColorHint">?text_color_hint</item>
<item name="android:background">?input</item>
- <item name="android:focusable">true</item>
<item name="android:gravity">top|left</item>
<item name="android:capitalize">none</item>
</style>
@@ -92,7 +87,7 @@
</style>
<!-- button: full width -->
- <style name="button">
+ <style name="button_full" parent="button">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_marginLeft">10dip</item>
@@ -101,7 +96,7 @@
</style>
<!-- button: small -->
- <style name="button_small">
+ <style name="button_small" parent="button">
<item name="android:layout_width">125dip</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_gravity">right</item>
@@ -114,7 +109,7 @@
</style>
<!-- edittext -->
- <style name="edittext">
+ <style name="edittext_full" parent="edittext">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_marginLeft">10dip</item>
@@ -122,7 +117,7 @@
<item name="android:layout_marginBottom">5dip</item>
</style>
- <style name="edittext_dialog">
+ <style name="edittext_dialog" parent="edittext">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_marginLeft">10dip</item>
@@ -199,11 +194,10 @@
<item name="android:background">@drawable/icon_bcg</item>
</style>
- <style name="location_current_type">
+ <style name="location_current_style">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_alignParentBottom">true</item>
- <item name="android:layout_alignParentRight">true</item>
<item name="android:layout_gravity">right</item>
<item name="android:paddingLeft">3dip</item>
<item name="android:paddingRight">3dip</item>
@@ -215,36 +209,17 @@
<item name="android:textColor">@color/text_dark</item>
</style>
- <style name="location_current_accuracy">
- <item name="android:layout_width">wrap_content</item>
- <item name="android:layout_height">wrap_content</item>
- <item name="android:layout_alignParentBottom">true</item>
+ <style name="location_current_type" parent="location_current_style">
+ <item name="android:layout_alignParentRight">true</item>
+ </style>
+
+ <style name="location_current_accuracy" parent="location_current_style">
<item name="android:layout_centerHorizontal">true</item>
- <item name="android:layout_gravity">right</item>
- <item name="android:paddingLeft">3dip</item>
- <item name="android:paddingRight">3dip</item>
- <item name="android:lines">1</item>
- <item name="android:singleLine">true</item>
- <item name="android:scrollHorizontally">true</item>
- <item name="android:ellipsize">marquee</item>
- <item name="android:textSize">12dip</item>
- <item name="android:textColor">@color/text_dark</item>
</style>
- <style name="location_current_satellites">
- <item name="android:layout_width">wrap_content</item>
- <item name="android:layout_height">wrap_content</item>
- <item name="android:layout_alignParentBottom">true</item>
+ <style name="location_current_satellites" parent="location_current_style">
<item name="android:layout_alignParentLeft">true</item>
<item name="android:layout_gravity">left</item>
- <item name="android:paddingLeft">3dip</item>
- <item name="android:paddingRight">3dip</item>
- <item name="android:lines">1</item>
- <item name="android:singleLine">true</item>
- <item name="android:scrollHorizontally">true</item>
- <item name="android:ellipsize">marquee</item>
- <item name="android:textSize">12dip</item>
- <item name="android:textColor">@color/text_dark</item>
</style>
<!-- separators -->
diff --git a/main/res/values/themes.xml b/main/res/values/themes.xml
index 0c53d29..5c2c861 100644
--- a/main/res/values/themes.xml
+++ b/main/res/values/themes.xml
@@ -1,128 +1,124 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
- <style name="cgeo_main" parent="android:Theme.Wallpaper.NoTitleBar">
- <!-- system elements -->
- <item name="android:windowNoTitle">true</item>
- <item name="android:windowContentOverlay">@null</item>
- </style>
-
- <style name="cgeo" parent="android:Theme.NoTitleBar">
- <!-- system elements -->
- <item name="android:buttonStyle">@style/button</item>
- <item name="android:editTextStyle">@style/edittext</item>
- <item name="android:windowContentOverlay">@null</item>
- </style>
-
- <style name="cgeo_transparent" parent="android:Theme.Dialog">
- <!-- system elements -->
- <item name="android:buttonStyle">@style/button</item>
- <item name="android:editTextStyle">@style/edittext</item>
- <item name="android:windowNoTitle">true</item>
- <item name="android:windowIsTranslucent">true</item>
- </style>
-
- <style name="dark" parent="cgeo">
- <!-- system values -->
-
- <!-- own values: colors -->
- <item name="just_color">@color/just_black</item>
- <item name="text_color">@color/text_dark</item>
- <item name="text_color_headline">@color/text_headline_dark</item>
- <item name="text_color_grey">@color/text_grey_dark</item>
- <item name="text_color_hint">@color/text_hint_dark</item>
- <item name="text_color_link">@color/link</item>
- <item name="button_color_enabled">@color/button_enabled</item>
- <item name="button_color_disabled">@color/button_disabled</item>
- <item name="background_color">@color/background_dark</item>
- <item name="background_color_notice">@color/background_dark_notice</item>
- <item name="background_color_transparent">@color/background_dark_transparent</item>
- <item name="separator_color">@color/separator_dark</item>
-
- <!-- own values: drawables -->
- <item name="button">@drawable/action_button_dark</item>
- <item name="input">@drawable/input_bcg_dark</item>
- <item name="inventory">@drawable/inventory_background_dark</item>
- <item name="favourite">@drawable/favourite_background_dark</item>
- <item name="favourite_r">@drawable/favourite_background_red_dark</item>
- <item name="favourite_o">@drawable/favourite_background_orange_dark</item>
- <item name="favourite_g">@drawable/favourite_background_green_dark</item>
- <item name="close">@drawable/map_close_dark</item>
+
+ <style name="cgeo_main" parent="android:style/Theme.Wallpaper.NoTitleBar">
+ <!-- system elements -->
+ <item name="android:windowContentOverlay">@null</item>
+ </style>
+
+ <style name="cgeo" parent="android:style/Theme.NoTitleBar">
+ <!-- system elements -->
+ <item name="android:buttonStyle">@style/button</item>
+ <item name="android:editTextStyle">@style/edittext</item>
+ <item name="android:windowContentOverlay">@null</item>
+
+ <!-- own values: colors -->
+ <item name="just_color">@color/just_black</item>
+ <item name="text_color_link">@color/link</item>
+ <item name="button_color_enabled">@color/button_enabled</item>
+ <item name="button_color_disabled">@color/button_disabled</item>
+ </style>
+
+ <style name="dark" parent="cgeo">
+ <!-- system values -->
+
+ <!-- own values: colors -->
+ <item name="text_color">@color/text_dark</item>
+ <item name="text_color_headline">@color/text_headline_dark</item>
+ <item name="text_color_grey">@color/text_grey_dark</item>
+ <item name="text_color_hint">@color/text_hint_dark</item>
+ <item name="background_color">@color/background_dark</item>
+ <item name="background_color_notice">@color/background_dark_notice</item>
+ <item name="background_color_transparent">@color/background_dark_transparent</item>
+ <item name="separator_color">@color/separator_dark</item>
+
+ <!-- own values: drawables -->
+ <item name="button">@drawable/action_button_dark</item>
+ <item name="input">@drawable/input_bcg_dark</item>
+ <item name="inventory">@drawable/inventory_background_dark</item>
+ <item name="favourite">@drawable/favourite_background_dark</item>
+ <item name="favourite_r">@drawable/favourite_background_red_dark</item>
+ <item name="favourite_o">@drawable/favourite_background_orange_dark</item>
+ <item name="favourite_g">@drawable/favourite_background_green_dark</item>
+ <item name="close">@drawable/map_close_dark</item>
<item name="log_img_icon">@drawable/log_img_dark</item>
<item name="actionbar_compass">@drawable/actionbar_compass_dark</item>
-
<item name="progressSpinnerLarge">@android:style/Widget.ProgressBar.Large</item>
- <!-- own values: other -->
- <item name="compass">0</item>
- </style>
-
- <style name="light" parent="cgeo">
- <!-- system values -->
-
- <!-- own values: colors -->
- <item name="just_color">@color/just_black</item>
- <item name="text_color">@color/text_light</item>
- <item name="text_color_headline">@color/text_headline_light</item>
- <item name="text_color_grey">@color/text_grey_light</item>
- <item name="text_color_hint">@color/text_hint_light</item>
- <item name="text_color_link">@color/link</item>
- <item name="button_color_enabled">@color/button_enabled</item>
- <item name="button_color_disabled">@color/button_disabled</item>
- <item name="background_color">@color/background_light</item>
- <item name="background_color_notice">@color/background_light_notice</item>
- <item name="background_color_transparent">@color/background_light_transparent</item>
- <item name="separator_color">@color/separator_light</item>
-
- <!-- own values: drawables -->
- <item name="button">@drawable/action_button_light</item>
- <item name="input">@drawable/input_bcg_light</item>
- <item name="inventory">@drawable/inventory_background_light</item>
- <item name="favourite">@drawable/favourite_background_light</item>
- <item name="favourite_r">@drawable/favourite_background_red_light</item>
- <item name="favourite_o">@drawable/favourite_background_orange_light</item>
- <item name="favourite_g">@drawable/favourite_background_green_light</item>
- <item name="close">@drawable/map_close_light</item>
+ <!-- own values: other -->
+ <item name="compass">0</item>
+ </style>
+
+ <style name="light" parent="cgeo">
+ <!-- system values -->
+
+ <!-- own values: colors -->
+ <item name="text_color">@color/text_light</item>
+ <item name="text_color_headline">@color/text_headline_light</item>
+ <item name="text_color_grey">@color/text_grey_light</item>
+ <item name="text_color_hint">@color/text_hint_light</item>
+ <item name="background_color">@color/background_light</item>
+ <item name="background_color_notice">@color/background_light_notice</item>
+ <item name="background_color_transparent">@color/background_light_transparent</item>
+ <item name="separator_color">@color/separator_light</item>
+
+ <!-- own values: drawables -->
+ <item name="button">@drawable/action_button_light</item>
+ <item name="input">@drawable/input_bcg_light</item>
+ <item name="inventory">@drawable/inventory_background_light</item>
+ <item name="favourite">@drawable/favourite_background_light</item>
+ <item name="favourite_r">@drawable/favourite_background_red_light</item>
+ <item name="favourite_o">@drawable/favourite_background_orange_light</item>
+ <item name="favourite_g">@drawable/favourite_background_green_light</item>
+ <item name="close">@drawable/map_close_light</item>
<item name="log_img_icon">@drawable/log_img_light</item>
<item name="actionbar_compass">@drawable/actionbar_compass_light</item>
-
<item name="progressSpinnerLarge">@android:style/Widget.ProgressBar.Large.Inverse</item>
-
+
<!-- own values: other -->
- <item name="compass">1</item>
- </style>
-
- <style name="transparent" parent="cgeo_transparent">
- <!-- system values -->
-
- <!-- own values: colors -->
- <item name="just_color">@color/just_black</item>
- <item name="text_color">@color/text_dark</item>
- <item name="text_color_headline">@color/text_headline_dark</item>
- <item name="text_color_grey">@color/text_grey_dark</item>
- <item name="text_color_hint">@color/text_hint_dark</item>
- <item name="text_color_link">@color/link</item>
- <item name="button_color_enabled">@color/button_enabled</item>
- <item name="button_color_disabled">@color/button_disabled</item>
- <item name="background_color">@color/background_dark</item>
- <item name="background_color_notice">@color/background_dark_notice</item>
- <item name="background_color_transparent">@color/background_dark_transparent</item>
- <item name="separator_color">@color/separator_dark</item>
-
- <!-- own values: drawables -->
- <item name="button">@drawable/action_button_dark</item>
- <item name="input">@drawable/input_bcg_dark</item>
- <item name="inventory">@drawable/inventory_background_dark</item>
- <item name="favourite">@drawable/favourite_background_dark</item>
- <item name="favourite_r">@drawable/favourite_background_red_dark</item>
- <item name="favourite_o">@drawable/favourite_background_orange_dark</item>
- <item name="favourite_g">@drawable/favourite_background_green_dark</item>
- <item name="close">@drawable/map_close_dark</item>
+ <item name="compass">1</item>
+ </style>
+
+ <style name="cgeo_popup" parent="android:style/Theme.Dialog">
+ <!-- system elements -->
+ <item name="android:buttonStyle">@style/button</item>
+ <item name="android:editTextStyle">@style/edittext</item>
+ <item name="android:windowNoTitle">true</item>
+ </style>
+
+ <!-- TODO: Popup probably doesn't need all these fields set. Should delete unnecessary ones. -->
+ <style name="popup_dark" parent="cgeo_popup">
+ <!-- system values -->
+
+ <!-- own values: colors -->
+ <item name="just_color">@color/just_black</item>
+ <item name="text_color">@color/text_dark</item>
+ <item name="text_color_headline">@color/text_headline_dark</item>
+ <item name="text_color_grey">@color/text_grey_dark</item>
+ <item name="text_color_hint">@color/text_hint_dark</item>
+ <item name="text_color_link">@color/link</item>
+ <item name="button_color_enabled">@color/button_enabled</item>
+ <item name="button_color_disabled">@color/button_disabled</item>
+ <item name="background_color">@color/background_dark</item>
+ <item name="background_color_notice">@color/background_dark_notice</item>
+ <item name="background_color_transparent">@color/background_dark_transparent</item>
+ <item name="separator_color">@color/separator_dark</item>
+
+ <!-- own values: drawables -->
+ <item name="button">@drawable/action_button_dark</item>
+ <item name="input">@drawable/input_bcg_dark</item>
+ <item name="inventory">@drawable/inventory_background_dark</item>
+ <item name="favourite">@drawable/favourite_background_dark</item>
+ <item name="favourite_r">@drawable/favourite_background_red_dark</item>
+ <item name="favourite_o">@drawable/favourite_background_orange_dark</item>
+ <item name="favourite_g">@drawable/favourite_background_green_dark</item>
+ <item name="close">@drawable/map_close_dark</item>
<item name="log_img_icon">@drawable/log_img_dark</item>
<item name="actionbar_compass">@drawable/actionbar_compass_dark</item>
-
<item name="progressSpinnerLarge">@android:style/Widget.ProgressBar.Large</item>
-
+
<!-- own values: other -->
- <item name="compass">0</item>
- </style>
-</resources>
+ <item name="compass">0</item>
+ </style>
+
+</resources> \ No newline at end of file
diff --git a/main/src/cgeo/geocaching/AbstractPopupActivity.java b/main/src/cgeo/geocaching/AbstractPopupActivity.java
index 588ba2a..bf81d5c 100644
--- a/main/src/cgeo/geocaching/AbstractPopupActivity.java
+++ b/main/src/cgeo/geocaching/AbstractPopupActivity.java
@@ -142,7 +142,6 @@ public abstract class AbstractPopupActivity extends AbstractActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// set layout
- setTheme(R.style.transparent);
setContentView(layout);
setTitle(res.getString(R.string.detail));
diff --git a/main/src/cgeo/geocaching/LiveMapInfo.java b/main/src/cgeo/geocaching/LiveMapInfo.java
index 822fbf6..2fee940 100644
--- a/main/src/cgeo/geocaching/LiveMapInfo.java
+++ b/main/src/cgeo/geocaching/LiveMapInfo.java
@@ -13,7 +13,6 @@ public class LiveMapInfo extends AbstractActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setTheme(R.style.transparent);
setContentView(R.layout.livemapinfo);
final int showCount = Settings.getLiveMapHintShowCount();
diff --git a/main/src/cgeo/geocaching/apps/cache/navi/AbstractPointNavigationApp.java b/main/src/cgeo/geocaching/apps/cache/navi/AbstractPointNavigationApp.java
index 5817763..ca8c7db 100644
--- a/main/src/cgeo/geocaching/apps/cache/navi/AbstractPointNavigationApp.java
+++ b/main/src/cgeo/geocaching/apps/cache/navi/AbstractPointNavigationApp.java
@@ -2,14 +2,14 @@ package cgeo.geocaching.apps.cache.navi;
import cgeo.geocaching.cgCache;
import cgeo.geocaching.cgWaypoint;
-import cgeo.geocaching.geopoint.Geopoint;
+import cgeo.geocaching.apps.AbstractApp;
import android.app.Activity;
/**
* navigation app for simple point navigation (no differentiation between cache/waypoint/point)
*/
-abstract class AbstractPointNavigationApp extends AbstractNavigationApp {
+abstract class AbstractPointNavigationApp extends AbstractApp implements CacheNavigationApp, WaypointNavigationApp, GeopointNavigationApp {
protected AbstractPointNavigationApp(String name, String intent) {
super(name, intent);
@@ -20,46 +20,22 @@ abstract class AbstractPointNavigationApp extends AbstractNavigationApp {
}
@Override
- public final boolean invoke(Activity activity, cgCache cache, cgWaypoint waypoint, Geopoint coords) {
- if (cache == null && waypoint == null && coords == null) {
- return false;
- }
-
- try {
- if (isInstalled()) {
- final Geopoint point = getCoordinates(cache, waypoint, coords);
- if (point != null) {
- navigate(activity, point);
- return true;
- }
- }
- } catch (Exception e) {
- // nothing
- }
-
- return false;
+ public void navigate(Activity activity, cgCache cache) {
+ navigate(activity, cache.getCoords());
}
- protected abstract void navigate(Activity activity, Geopoint point);
-
- /**
- * Return the first of the cache coordinates, the waypoint coordinates or the extra coordinates. <code>null</code>
- * entities are skipped.
- *
- * @param cache a cache
- * @param waypoint a waypoint
- * @param coords extra coordinates
- * @return the first non-null coordinates, or null if none are set
- */
- private static Geopoint getCoordinates(final cgCache cache, final cgWaypoint waypoint, final Geopoint coords) {
- if (cache != null && cache.getCoords() != null) {
- return cache.getCoords();
- }
+ @Override
+ public void navigate(Activity activity, cgWaypoint waypoint) {
+ navigate(activity, waypoint.getCoords());
+ }
- if (waypoint != null && waypoint.getCoords() != null) {
- return waypoint.getCoords();
- }
+ @Override
+ public boolean isEnabled(cgCache cache) {
+ return cache.getCoords() != null;
+ }
- return coords;
+ @Override
+ public boolean isEnabled(cgWaypoint waypoint) {
+ return waypoint.getCoords() != null;
}
-} \ No newline at end of file
+}
diff --git a/main/src/cgeo/geocaching/apps/cache/navi/AbstractStaticMapsApp.java b/main/src/cgeo/geocaching/apps/cache/navi/AbstractStaticMapsApp.java
index ff61404..8e5d7d1 100644
--- a/main/src/cgeo/geocaching/apps/cache/navi/AbstractStaticMapsApp.java
+++ b/main/src/cgeo/geocaching/apps/cache/navi/AbstractStaticMapsApp.java
@@ -8,13 +8,13 @@ import cgeo.geocaching.cgCache;
import cgeo.geocaching.cgWaypoint;
import cgeo.geocaching.cgeoapplication;
import cgeo.geocaching.activity.ActivityMixin;
-import cgeo.geocaching.geopoint.Geopoint;
+import cgeo.geocaching.apps.AbstractApp;
import org.apache.commons.lang3.StringUtils;
import android.app.Activity;
-abstract class AbstractStaticMapsApp extends AbstractNavigationApp {
+abstract class AbstractStaticMapsApp extends AbstractApp implements CacheNavigationApp, WaypointNavigationApp {
public AbstractStaticMapsApp(String name) {
super(name, null);
}
@@ -25,27 +25,23 @@ abstract class AbstractStaticMapsApp extends AbstractNavigationApp {
}
protected static boolean hasStaticMap(cgCache cache) {
- if (cache != null) {
- String geocode = cache.getGeocode();
- if (StringUtils.isNotEmpty(geocode) && cgeoapplication.getInstance().isOffline(geocode, null)) {
- return StaticMapsProvider.doesExistStaticMapForCache(geocode);
- }
+ String geocode = cache.getGeocode();
+ if (StringUtils.isNotEmpty(geocode) && cgeoapplication.getInstance().isOffline(geocode, null)) {
+ return StaticMapsProvider.doesExistStaticMapForCache(geocode);
}
return false;
}
protected static boolean hasStaticMap(cgWaypoint waypoint) {
- if (waypoint != null) {
- String geocode = waypoint.getGeocode();
- int id = waypoint.getId();
- if (StringUtils.isNotEmpty(geocode) && cgeoapplication.getInstance().isOffline(geocode, null)) {
- return StaticMapsProvider.doesExistStaticMapForWaypoint(geocode, id);
- }
+ String geocode = waypoint.getGeocode();
+ int id = waypoint.getId();
+ if (StringUtils.isNotEmpty(geocode) && cgeoapplication.getInstance().isOffline(geocode, null)) {
+ return StaticMapsProvider.doesExistStaticMapForWaypoint(geocode, id);
}
return false;
}
- protected static boolean invoke(final Activity activity, final cgCache cache, final cgWaypoint waypoint, final boolean download) {
+ protected static boolean invokeStaticMaps(final Activity activity, final cgCache cache, final cgWaypoint waypoint, final boolean download) {
final ILogable logable = cache != null && cache.getListId() != 0 ? cache : waypoint;
final String geocode = logable.getGeocode().toUpperCase();
if (geocode == null) {
@@ -56,11 +52,4 @@ abstract class AbstractStaticMapsApp extends AbstractNavigationApp {
StaticMapsActivity.startActivity(activity, geocode, download, waypoint);
return true;
}
-
-
- @Override
- public boolean isEnabled(Geopoint geopoint) {
- return false;
- }
-
}
diff --git a/main/src/cgeo/geocaching/apps/cache/navi/CacheNavigationApp.java b/main/src/cgeo/geocaching/apps/cache/navi/CacheNavigationApp.java
new file mode 100644
index 0000000..e47150f
--- /dev/null
+++ b/main/src/cgeo/geocaching/apps/cache/navi/CacheNavigationApp.java
@@ -0,0 +1,17 @@
+package cgeo.geocaching.apps.cache.navi;
+
+import cgeo.geocaching.cgCache;
+import cgeo.geocaching.apps.App;
+
+import android.app.Activity;
+
+/**
+ * interface for navigation to a cache
+ *
+ */
+public interface CacheNavigationApp extends App {
+ void navigate(final Activity activity, final cgCache cache);
+
+ @Override
+ boolean isEnabled(final cgCache cache);
+} \ No newline at end of file
diff --git a/main/src/cgeo/geocaching/apps/cache/navi/CompassApp.java b/main/src/cgeo/geocaching/apps/cache/navi/CompassApp.java
index 1576617..da3d5f9 100644
--- a/main/src/cgeo/geocaching/apps/cache/navi/CompassApp.java
+++ b/main/src/cgeo/geocaching/apps/cache/navi/CompassApp.java
@@ -4,11 +4,12 @@ import cgeo.geocaching.R;
import cgeo.geocaching.cgCache;
import cgeo.geocaching.cgWaypoint;
import cgeo.geocaching.cgeonavigate;
+import cgeo.geocaching.apps.AbstractApp;
import cgeo.geocaching.geopoint.Geopoint;
import android.app.Activity;
-class CompassApp extends AbstractNavigationApp {
+class CompassApp extends AbstractApp implements CacheNavigationApp, WaypointNavigationApp, GeopointNavigationApp {
CompassApp() {
super(getString(R.string.compass_title), null);
@@ -20,22 +21,28 @@ class CompassApp extends AbstractNavigationApp {
}
@Override
- public boolean invoke(Activity activity, cgCache cache, cgWaypoint waypoint, final Geopoint coords) {
-
- if (cache != null && cache.getGeocode() != null) {
- cgeonavigate.startActivity(activity, cache.getGeocode(), cache.getName(), cache.getCoords(), null);
- return true;
- }
- if (waypoint != null && waypoint.getCoords() != null) {
- cgeonavigate.startActivity(activity, waypoint.getPrefix() + "/" + waypoint.getLookup(), waypoint.getName(), waypoint.getCoords(), null);
- return true;
- }
- if (coords != null) {
- cgeonavigate.startActivity(activity, getString(R.string.navigation_direct_navigation), getString(R.string.navigation_target), coords, null);
- return true;
- }
- // search is not handled here
- return false;
+ public void navigate(Activity activity, Geopoint coords) {
+ cgeonavigate.startActivity(activity, getString(R.string.navigation_direct_navigation), getString(R.string.navigation_target), coords, null);
+ }
+
+ @Override
+ public void navigate(Activity activity, cgWaypoint waypoint) {
+ cgeonavigate.startActivity(activity, waypoint.getPrefix() + "/" + waypoint.getLookup(), waypoint.getName(), waypoint.getCoords(), null);
+ }
+
+ @Override
+ public boolean isEnabled(cgWaypoint waypoint) {
+ return waypoint.getCoords() != null;
+ }
+
+ @Override
+ public void navigate(Activity activity, cgCache cache) {
+ cgeonavigate.startActivity(activity, cache.getGeocode(), cache.getName(), cache.getCoords(), null);
+ }
+
+ @Override
+ public boolean isEnabled(cgCache cache) {
+ return cache.getGeocode() != null;
}
} \ No newline at end of file
diff --git a/main/src/cgeo/geocaching/apps/cache/navi/DownloadStaticMapsApp.java b/main/src/cgeo/geocaching/apps/cache/navi/DownloadStaticMapsApp.java
index 1625ef7..f093937 100644
--- a/main/src/cgeo/geocaching/apps/cache/navi/DownloadStaticMapsApp.java
+++ b/main/src/cgeo/geocaching/apps/cache/navi/DownloadStaticMapsApp.java
@@ -3,7 +3,6 @@ package cgeo.geocaching.apps.cache.navi;
import cgeo.geocaching.R;
import cgeo.geocaching.cgCache;
import cgeo.geocaching.cgWaypoint;
-import cgeo.geocaching.geopoint.Geopoint;
import android.app.Activity;
@@ -14,23 +13,22 @@ class DownloadStaticMapsApp extends AbstractStaticMapsApp {
}
@Override
- public boolean invoke(Activity activity, cgCache cache, cgWaypoint waypoint, final Geopoint coords) {
- return invoke(activity, cache, waypoint, true);
- }
-
- @Override
public boolean isEnabled(cgCache cache) {
- if (cache == null) {
- return false;
- }
return !hasStaticMap(cache);
}
@Override
public boolean isEnabled(cgWaypoint waypoint) {
- if (waypoint == null) {
- return false;
- }
return !hasStaticMap(waypoint);
}
+
+ @Override
+ public void navigate(Activity activity, cgCache cache) {
+ invokeStaticMaps(activity, cache, null, true);
+ }
+
+ @Override
+ public void navigate(Activity activity, cgWaypoint waypoint) {
+ invokeStaticMaps(activity, null, waypoint, true);
+ }
}
diff --git a/main/src/cgeo/geocaching/apps/cache/navi/GeopointNavigationApp.java b/main/src/cgeo/geocaching/apps/cache/navi/GeopointNavigationApp.java
new file mode 100644
index 0000000..fe4fd5d
--- /dev/null
+++ b/main/src/cgeo/geocaching/apps/cache/navi/GeopointNavigationApp.java
@@ -0,0 +1,13 @@
+package cgeo.geocaching.apps.cache.navi;
+
+import cgeo.geocaching.geopoint.Geopoint;
+
+import android.app.Activity;
+
+/**
+ * interface for navigation to a coordinate. This one cannot be enabled/disabled.
+ *
+ */
+public interface GeopointNavigationApp {
+ void navigate(final Activity activity, final Geopoint coords);
+}
diff --git a/main/src/cgeo/geocaching/apps/cache/navi/GoogleMapsApp.java b/main/src/cgeo/geocaching/apps/cache/navi/GoogleMapsApp.java
index 4e6e62b..eac33cc 100644
--- a/main/src/cgeo/geocaching/apps/cache/navi/GoogleMapsApp.java
+++ b/main/src/cgeo/geocaching/apps/cache/navi/GoogleMapsApp.java
@@ -21,7 +21,7 @@ class GoogleMapsApp extends AbstractPointNavigationApp {
}
@Override
- protected void navigate(Activity activity, Geopoint point) {
+ public void navigate(Activity activity, Geopoint point) {
// INFO: q parameter works with Google Maps, but breaks cooperation with all other apps
try {
activity.startActivity(new Intent(Intent.ACTION_VIEW,
diff --git a/main/src/cgeo/geocaching/apps/cache/navi/GoogleNavigationApp.java b/main/src/cgeo/geocaching/apps/cache/navi/GoogleNavigationApp.java
index 31d99e9..7258e11 100644
--- a/main/src/cgeo/geocaching/apps/cache/navi/GoogleNavigationApp.java
+++ b/main/src/cgeo/geocaching/apps/cache/navi/GoogleNavigationApp.java
@@ -3,8 +3,6 @@ package cgeo.geocaching.apps.cache.navi;
import cgeo.geocaching.IGeoData;
import cgeo.geocaching.R;
import cgeo.geocaching.Settings;
-import cgeo.geocaching.cgCache;
-import cgeo.geocaching.cgWaypoint;
import cgeo.geocaching.cgeoapplication;
import cgeo.geocaching.activity.ActivityMixin;
import cgeo.geocaching.geopoint.Geopoint;
@@ -14,7 +12,7 @@ import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
-class GoogleNavigationApp extends AbstractNavigationApp {
+class GoogleNavigationApp extends AbstractPointNavigationApp {
GoogleNavigationApp() {
super(getString(R.string.cache_menu_tbt), null);
@@ -25,33 +23,8 @@ class GoogleNavigationApp extends AbstractNavigationApp {
return true;
}
- @Override
- public boolean invoke(final Activity activity, final cgCache cache, final cgWaypoint waypoint, final Geopoint coords) {
- if (activity == null) {
- return false;
- }
-
+ private static boolean navigateToCoordinates(Activity activity, final Geopoint coords) {
IGeoData geo = cgeoapplication.getInstance().currentGeo();
- boolean navigationResult = false;
- if (coords != null) {
- navigationResult = navigateToCoordinates(geo, activity, coords);
- }
- else if (waypoint != null) {
- navigationResult = navigateToCoordinates(geo, activity, waypoint.getCoords());
- }
- else if (cache != null) {
- navigationResult = navigateToCoordinates(geo, activity, cache.getCoords());
- }
-
- if (!navigationResult) {
- ActivityMixin.showToast(activity, getString(R.string.err_navigation_no));
- return false;
- }
-
- return true;
- }
-
- private static boolean navigateToCoordinates(IGeoData geo, Activity activity, final Geopoint coords) {
final Geopoint coordsNow = geo == null ? null : geo.getCoords();
// Google Navigation
@@ -89,4 +62,10 @@ class GoogleNavigationApp extends AbstractNavigationApp {
return false;
}
+ @Override
+ public void navigate(Activity activity, Geopoint coords) {
+ if (!navigateToCoordinates(activity, coords)) {
+ ActivityMixin.showToast(activity, getString(R.string.err_navigation_no));
+ }
+ }
} \ No newline at end of file
diff --git a/main/src/cgeo/geocaching/apps/cache/navi/InternalMap.java b/main/src/cgeo/geocaching/apps/cache/navi/InternalMap.java
index f1e03ed..8185f40 100644
--- a/main/src/cgeo/geocaching/apps/cache/navi/InternalMap.java
+++ b/main/src/cgeo/geocaching/apps/cache/navi/InternalMap.java
@@ -3,37 +3,46 @@ package cgeo.geocaching.apps.cache.navi;
import cgeo.geocaching.R;
import cgeo.geocaching.cgCache;
import cgeo.geocaching.cgWaypoint;
+import cgeo.geocaching.apps.AbstractApp;
import cgeo.geocaching.enumerations.WaypointType;
import cgeo.geocaching.geopoint.Geopoint;
import cgeo.geocaching.maps.CGeoMap;
import android.app.Activity;
-class InternalMap extends AbstractNavigationApp {
+class InternalMap extends AbstractApp implements CacheNavigationApp, WaypointNavigationApp, GeopointNavigationApp {
InternalMap() {
super(getString(R.string.cache_menu_map), null);
}
@Override
- public boolean invoke(Activity activity, cgCache cache, cgWaypoint waypoint, final Geopoint coords) {
- if (cache != null) {
- CGeoMap.startActivityGeoCode(activity, cache.getGeocode());
- // may need some code from CGeoMap.startActivitySearch(activity, search, cache != null ? cache.getGeocode() : null, true);
- }
- else if (waypoint != null) {
- CGeoMap.startActivityCoords(activity, waypoint.getCoords(), waypoint.getWaypointType(), waypoint.getName());
- }
- else if (coords != null) {
- CGeoMap.startActivityCoords(activity, coords, WaypointType.WAYPOINT, null);
- }
-
+ public boolean isInstalled() {
return true;
}
@Override
- public boolean isInstalled() {
- return true;
+ public void navigate(Activity activity, Geopoint coords) {
+ CGeoMap.startActivityCoords(activity, coords, WaypointType.WAYPOINT, null);
}
+ @Override
+ public void navigate(Activity activity, cgWaypoint waypoint) {
+ CGeoMap.startActivityCoords(activity, waypoint.getCoords(), waypoint.getWaypointType(), waypoint.getName());
+ }
+
+ @Override
+ public boolean isEnabled(cgWaypoint waypoint) {
+ return waypoint.getCoords() != null;
+ }
+
+ @Override
+ public void navigate(Activity activity, cgCache cache) {
+ CGeoMap.startActivityGeoCode(activity, cache.getGeocode());
+ }
+
+ @Override
+ public boolean isEnabled(cgCache cache) {
+ return cache.getCoords() != null;
+ }
}
diff --git a/main/src/cgeo/geocaching/apps/cache/navi/LocusApp.java b/main/src/cgeo/geocaching/apps/cache/navi/LocusApp.java
index d71a474..a20f2ce 100644
--- a/main/src/cgeo/geocaching/apps/cache/navi/LocusApp.java
+++ b/main/src/cgeo/geocaching/apps/cache/navi/LocusApp.java
@@ -3,45 +3,30 @@ package cgeo.geocaching.apps.cache.navi;
import cgeo.geocaching.cgCache;
import cgeo.geocaching.cgWaypoint;
import cgeo.geocaching.apps.AbstractLocusApp;
-import cgeo.geocaching.geopoint.Geopoint;
import android.app.Activity;
-import java.util.ArrayList;
+import java.util.Collections;
-class LocusApp extends AbstractLocusApp implements NavigationApp {
+class LocusApp extends AbstractLocusApp implements CacheNavigationApp, WaypointNavigationApp {
+
+ @Override
+ public boolean isEnabled(cgWaypoint waypoint) {
+ return waypoint.getCoords() != null;
+ }
/**
* Show a single cache with waypoints or a single waypoint in Locus.
* This method constructs a list of cache and waypoints only.
*
- * @see AbstractLocusApp#showInLocus
*/
@Override
- public boolean invoke(Activity activity, cgCache cache, cgWaypoint waypoint, final Geopoint coords) {
-
- final ArrayList<Object> points = new ArrayList<Object>();
-
- // add cache if present
- if (cache != null && cache.getCoords() != null) {
- points.add(cache);
- }
-
- // add waypoint if present
- if (waypoint != null && waypoint.getCoords() != null) {
- points.add(waypoint);
- }
-
- return showInLocus(points, true, false, activity);
- }
-
- @Override
- public boolean isEnabled(cgWaypoint waypoint) {
- return waypoint != null;
+ public void navigate(Activity activity, cgWaypoint waypoint) {
+ showInLocus(Collections.singletonList(waypoint), true, false, activity);
}
@Override
- public boolean isEnabled(Geopoint geopoint) {
- return geopoint != null;
+ public void navigate(Activity activity, cgCache cache) {
+ showInLocus(Collections.singletonList(cache), true, false, activity);
}
}
diff --git a/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java b/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java
index 95f6408..8219320 100644
--- a/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java
+++ b/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java
@@ -7,8 +7,8 @@ import cgeo.geocaching.cgWaypoint;
import cgeo.geocaching.cgeoapplication;
import cgeo.geocaching.activity.ActivityMixin;
import cgeo.geocaching.apps.AbstractAppFactory;
+import cgeo.geocaching.apps.App;
import cgeo.geocaching.geopoint.Geopoint;
-import cgeo.geocaching.utils.Log;
import android.app.Activity;
import android.app.AlertDialog;
@@ -48,7 +48,7 @@ public final class NavigationAppFactory extends AbstractAppFactory {
/** The external navigon app */
NAVIGON(new NavigonApp(), 10);
- NavigationAppsEnum(NavigationApp app, int id) {
+ NavigationAppsEnum(App app, int id) {
this.app = app;
this.id = id;
}
@@ -56,7 +56,7 @@ public final class NavigationAppFactory extends AbstractAppFactory {
/**
* The app instance to use
*/
- public final NavigationApp app;
+ public final App app;
/**
* The id - used in c:geo settings
*/
@@ -119,7 +119,17 @@ public final class NavigationAppFactory extends AbstractAppFactory {
for (NavigationAppsEnum navApp : getInstalledNavigationApps()) {
if ((showInternalMap || !(navApp.app instanceof InternalMap)) &&
(showDefaultNavigation || defaultNavigationTool != navApp.id)) {
- if (navApp.app.isEnabled(cache) || navApp.app.isEnabled(waypoint) || navApp.app.isEnabled(destination)) {
+ boolean add = false;
+ if (cache != null && navApp.app instanceof CacheNavigationApp && ((CacheNavigationApp) navApp.app).isEnabled(cache)) {
+ add = true;
+ }
+ if (waypoint != null && navApp.app instanceof WaypointNavigationApp && ((WaypointNavigationApp) navApp.app).isEnabled(waypoint)) {
+ add = true;
+ }
+ if (destination != null && navApp.app instanceof GeopointNavigationApp) {
+ add = true;
+ }
+ if (add) {
items.add(navApp);
}
}
@@ -134,7 +144,18 @@ public final class NavigationAppFactory extends AbstractAppFactory {
@Override
public void onClick(DialogInterface dialog, int item) {
NavigationAppsEnum selectedItem = adapter.getItem(item);
- selectedItem.app.invoke(activity, cache, waypoint, destination);
+ if (cache != null) {
+ CacheNavigationApp cacheApp = (CacheNavigationApp) selectedItem.app;
+ cacheApp.navigate(activity, cache);
+ }
+ else if (waypoint != null) {
+ WaypointNavigationApp waypointApp = (WaypointNavigationApp) selectedItem.app;
+ waypointApp.navigate(activity, waypoint);
+ }
+ else {
+ GeopointNavigationApp geopointApp = (GeopointNavigationApp) selectedItem.app;
+ geopointApp.navigate(activity, destination);
+ }
}
});
final AlertDialog alert = builder.create();
@@ -174,16 +195,22 @@ public final class NavigationAppFactory extends AbstractAppFactory {
*/
public static void addMenuItems(final Menu menu, final cgCache cache) {
for (NavigationAppsEnum navApp : getInstalledNavigationApps()) {
- if (navApp.app.isEnabled(cache)) {
- menu.add(0, MENU_ITEM_OFFSET + navApp.id, 0, navApp.app.getName());
+ if (navApp.app instanceof CacheNavigationApp) {
+ CacheNavigationApp cacheApp = (CacheNavigationApp) navApp.app;
+ if (cacheApp.isEnabled(cache)) {
+ menu.add(0, MENU_ITEM_OFFSET + navApp.id, 0, navApp.app.getName());
+ }
}
}
}
public static void addMenuItems(final Menu menu, final cgWaypoint waypoint) {
for (NavigationAppsEnum navApp : getInstalledNavigationApps()) {
- if (navApp.app.isEnabled(waypoint)) {
- menu.add(0, MENU_ITEM_OFFSET + navApp.id, 0, navApp.app.getName());
+ if (navApp.app instanceof WaypointNavigationApp) {
+ WaypointNavigationApp waypointApp = (WaypointNavigationApp) navApp.app;
+ if (waypointApp.isEnabled(waypoint)) {
+ menu.add(0, MENU_ITEM_OFFSET + navApp.id, 0, navApp.app.getName());
+ }
}
}
}
@@ -197,29 +224,37 @@ public final class NavigationAppFactory extends AbstractAppFactory {
* @return
*/
public static boolean onMenuItemSelected(final MenuItem item, Activity activity, cgCache cache) {
- return invokeApp(activity, cache, null, null, getAppFromMenuItem(item));
+ navigateCache(activity, cache, getAppFromMenuItem(item));
+ return true;
+ }
+
+ private static void navigateCache(Activity activity, cgCache cache, App app) {
+ if (app instanceof CacheNavigationApp) {
+ CacheNavigationApp cacheApp = (CacheNavigationApp) app;
+ cacheApp.navigate(activity, cache);
+ }
}
public static boolean onMenuItemSelected(final MenuItem item, Activity activity, cgWaypoint waypoint) {
- return invokeApp(activity, null, waypoint, null, getAppFromMenuItem(item));
+ navigateWaypoint(activity, waypoint, getAppFromMenuItem(item));
+ return true;
}
- private static boolean invokeApp(Activity activity, cgCache cache, cgWaypoint waypoint, final Geopoint destination, final NavigationApp app) {
- if (app == null) {
- return false;
+ private static void navigateWaypoint(Activity activity, cgWaypoint waypoint, App app) {
+ if (app instanceof WaypointNavigationApp) {
+ WaypointNavigationApp waypointApp = (WaypointNavigationApp) app;
+ waypointApp.navigate(activity, waypoint);
}
- if (cache == null && waypoint == null && destination == null) {
- return false;
- }
- try {
- return app.invoke(activity, cache, waypoint, destination);
- } catch (Exception e) {
- Log.e("NavigationAppFactory.onMenuItemSelected: " + e.toString());
+ }
+
+ private static void navigateGeopoint(Activity activity, Geopoint destination, App app) {
+ if (app instanceof GeopointNavigationApp) {
+ GeopointNavigationApp geopointApp = (GeopointNavigationApp) app;
+ geopointApp.navigate(activity, destination);
}
- return false;
}
- private static NavigationApp getAppFromMenuItem(MenuItem item) {
+ private static App getAppFromMenuItem(MenuItem item) {
final int id = item.getItemId();
for (NavigationAppsEnum navApp : NavigationAppsEnum.values()) {
if (MENU_ITEM_OFFSET + navApp.id == id) {
@@ -243,10 +278,10 @@ public final class NavigationAppFactory extends AbstractAppFactory {
return;
}
- invokeApp(activity, cache, null, null, getDefaultNavigationApplication(defaultNavigation));
+ navigateCache(activity, cache, getDefaultNavigationApplication(defaultNavigation));
}
- private static NavigationApp getDefaultNavigationApplication(int defaultNavigation) {
+ private static App getDefaultNavigationApplication(int defaultNavigation) {
if (defaultNavigation == 2) {
return getNavigationAppFromSetting(Settings.getDefaultNavigationTool2());
}
@@ -264,7 +299,7 @@ public final class NavigationAppFactory extends AbstractAppFactory {
ActivityMixin.showToast(activity, cgeoapplication.getInstance().getString(R.string.err_location_unknown));
return;
}
- invokeApp(activity, null, waypoint, null, getDefaultNavigationApplication(defaultNavigation));
+ navigateWaypoint(activity, waypoint, getDefaultNavigationApplication(defaultNavigation));
}
/**
@@ -279,7 +314,7 @@ public final class NavigationAppFactory extends AbstractAppFactory {
return;
}
- invokeApp(activity, null, null, destination, getDefaultNavigationApplication(defaultNavigation));
+ navigateGeopoint(activity, destination, getDefaultNavigationApplication(defaultNavigation));
}
/**
@@ -287,11 +322,11 @@ public final class NavigationAppFactory extends AbstractAppFactory {
*
* @return never <code>null</code>
*/
- public static NavigationApp getDefaultNavigationApplication() {
+ public static App getDefaultNavigationApplication() {
return getNavigationAppFromSetting(Settings.getDefaultNavigationTool());
}
- private static NavigationApp getNavigationAppFromSetting(final int defaultNavigationTool) {
+ private static App getNavigationAppFromSetting(final int defaultNavigationTool) {
final List<NavigationAppsEnum> installedNavigationApps = getInstalledNavigationApps();
for (NavigationAppsEnum navigationApp : installedNavigationApps) {
diff --git a/main/src/cgeo/geocaching/apps/cache/navi/NavigonApp.java b/main/src/cgeo/geocaching/apps/cache/navi/NavigonApp.java
index 69f63dc..7ea86fb 100644
--- a/main/src/cgeo/geocaching/apps/cache/navi/NavigonApp.java
+++ b/main/src/cgeo/geocaching/apps/cache/navi/NavigonApp.java
@@ -16,7 +16,7 @@ class NavigonApp extends AbstractPointNavigationApp {
}
@Override
- protected void navigate(Activity activity, Geopoint point) {
+ public void navigate(Activity activity, Geopoint point) {
final Intent intent = new Intent(INTENT);
/*
diff --git a/main/src/cgeo/geocaching/apps/cache/navi/OruxMapsApp.java b/main/src/cgeo/geocaching/apps/cache/navi/OruxMapsApp.java
index 27ec2fa..24ef81b 100644
--- a/main/src/cgeo/geocaching/apps/cache/navi/OruxMapsApp.java
+++ b/main/src/cgeo/geocaching/apps/cache/navi/OruxMapsApp.java
@@ -15,7 +15,7 @@ class OruxMapsApp extends AbstractPointNavigationApp {
}
@Override
- protected void navigate(Activity activity, Geopoint point) {
+ public void navigate(Activity activity, Geopoint point) {
final Intent intent = new Intent(INTENT);
intent.putExtra("latitude", point.getLatitude());//latitude, wgs84 datum
intent.putExtra("longitude", point.getLongitude());//longitude, wgs84 datum
diff --git a/main/src/cgeo/geocaching/apps/cache/navi/RMapsApp.java b/main/src/cgeo/geocaching/apps/cache/navi/RMapsApp.java
index 8044cc6..a481813 100644
--- a/main/src/cgeo/geocaching/apps/cache/navi/RMapsApp.java
+++ b/main/src/cgeo/geocaching/apps/cache/navi/RMapsApp.java
@@ -3,6 +3,7 @@ package cgeo.geocaching.apps.cache.navi;
import cgeo.geocaching.R;
import cgeo.geocaching.cgCache;
import cgeo.geocaching.cgWaypoint;
+import cgeo.geocaching.apps.AbstractApp;
import cgeo.geocaching.geopoint.Geopoint;
import cgeo.geocaching.geopoint.GeopointFormatter.Format;
@@ -11,7 +12,7 @@ import android.content.Intent;
import java.util.ArrayList;
-class RMapsApp extends AbstractNavigationApp {
+class RMapsApp extends AbstractApp implements CacheNavigationApp, WaypointNavigationApp, GeopointNavigationApp {
private static final String INTENT = "com.robert.maps.action.SHOW_POINTS";
@@ -20,29 +21,30 @@ class RMapsApp extends AbstractNavigationApp {
}
@Override
- public boolean invoke(Activity activity, cgCache cache, cgWaypoint waypoint, final Geopoint coords) {
- try {
- final ArrayList<String> locations = new ArrayList<String>();
- if (cache != null && cache.getCoords() != null) {
- locations.add(cache.getCoords().format(Format.LAT_LON_DECDEGREE_COMMA)
- + ";" + cache.getGeocode()
- + ";" + cache.getName());
- } else if (waypoint != null && waypoint.getCoords() != null) {
- locations.add(waypoint.getCoords().format(Format.LAT_LON_DECDEGREE_COMMA)
- + ";" + waypoint.getLookup()
- + ";" + waypoint.getName());
- }
-
- if (!locations.isEmpty()) {
- final Intent intent = new Intent(INTENT);
- intent.putStringArrayListExtra("locations", locations);
- activity.startActivity(intent);
- return true;
- }
- } catch (Exception e) {
- // nothing
- }
-
- return false;
+ public void navigate(Activity activity, cgWaypoint waypoint) {
+ navigate(activity, waypoint.getCoords(), waypoint.getLookup(), waypoint.getName());
+ }
+
+ private static void navigate(Activity activity, Geopoint coords, String code, String name) {
+ final ArrayList<String> locations = new ArrayList<String>();
+ locations.add(coords.format(Format.LAT_LON_DECDEGREE_COMMA) + ";" + code + ";" + name);
+ final Intent intent = new Intent(INTENT);
+ intent.putStringArrayListExtra("locations", locations);
+ activity.startActivity(intent);
+ }
+
+ @Override
+ public boolean isEnabled(cgWaypoint waypoint) {
+ return waypoint.getCoords() != null;
+ }
+
+ @Override
+ public void navigate(Activity activity, cgCache cache) {
+ navigate(activity, cache.getCoords(), cache.getGeocode(), cache.getName());
+ }
+
+ @Override
+ public void navigate(Activity activity, Geopoint coords) {
+ navigate(activity, coords, "", "");
}
}
diff --git a/main/src/cgeo/geocaching/apps/cache/navi/RadarApp.java b/main/src/cgeo/geocaching/apps/cache/navi/RadarApp.java
index 3374691..b01539c 100644
--- a/main/src/cgeo/geocaching/apps/cache/navi/RadarApp.java
+++ b/main/src/cgeo/geocaching/apps/cache/navi/RadarApp.java
@@ -16,7 +16,7 @@ class RadarApp extends AbstractPointNavigationApp {
}
@Override
- protected void navigate(Activity activity, Geopoint point) {
+ public void navigate(Activity activity, Geopoint point) {
final Intent radarIntent = new Intent(INTENT);
radarIntent.putExtra("latitude", (float) point.getLatitude());
radarIntent.putExtra("longitude", (float) point.getLongitude());
diff --git a/main/src/cgeo/geocaching/apps/cache/navi/StaticMapApp.java b/main/src/cgeo/geocaching/apps/cache/navi/StaticMapApp.java
index d805656..6be027f 100644
--- a/main/src/cgeo/geocaching/apps/cache/navi/StaticMapApp.java
+++ b/main/src/cgeo/geocaching/apps/cache/navi/StaticMapApp.java
@@ -3,7 +3,6 @@ package cgeo.geocaching.apps.cache.navi;
import cgeo.geocaching.R;
import cgeo.geocaching.cgCache;
import cgeo.geocaching.cgWaypoint;
-import cgeo.geocaching.geopoint.Geopoint;
import android.app.Activity;
@@ -14,23 +13,22 @@ class StaticMapApp extends AbstractStaticMapsApp {
}
@Override
- public boolean invoke(Activity activity, cgCache cache, cgWaypoint waypoint, final Geopoint coords) {
- return invoke(activity, cache, waypoint, false);
- }
-
- @Override
public boolean isEnabled(cgCache cache) {
- if (cache == null) {
- return false;
- }
return hasStaticMap(cache);
}
@Override
public boolean isEnabled(cgWaypoint waypoint) {
- if (waypoint == null) {
- return false;
- }
return hasStaticMap(waypoint);
}
+
+ @Override
+ public void navigate(Activity activity, cgCache cache) {
+ invokeStaticMaps(activity, cache, null, false);
+ }
+
+ @Override
+ public void navigate(Activity activity, cgWaypoint waypoint) {
+ invokeStaticMaps(activity, null, waypoint, false);
+ }
}
diff --git a/main/src/cgeo/geocaching/apps/cache/navi/StreetviewApp.java b/main/src/cgeo/geocaching/apps/cache/navi/StreetviewApp.java
index 41f958d..012b94f 100644
--- a/main/src/cgeo/geocaching/apps/cache/navi/StreetviewApp.java
+++ b/main/src/cgeo/geocaching/apps/cache/navi/StreetviewApp.java
@@ -22,7 +22,7 @@ class StreetviewApp extends AbstractPointNavigationApp {
}
@Override
- protected void navigate(Activity activity, Geopoint point) {
+ public void navigate(Activity activity, Geopoint point) {
try {
activity.startActivity(new Intent(Intent.ACTION_VIEW,
Uri.parse("google.streetview:cbll=" + point.getLatitude() + "," + point.getLongitude())));
diff --git a/main/src/cgeo/geocaching/apps/cache/navi/WaypointNavigationApp.java b/main/src/cgeo/geocaching/apps/cache/navi/WaypointNavigationApp.java
new file mode 100644
index 0000000..7d3a706
--- /dev/null
+++ b/main/src/cgeo/geocaching/apps/cache/navi/WaypointNavigationApp.java
@@ -0,0 +1,15 @@
+package cgeo.geocaching.apps.cache.navi;
+
+import cgeo.geocaching.cgWaypoint;
+
+import android.app.Activity;
+
+/**
+ * interface for navigation to a waypoint
+ *
+ */
+public interface WaypointNavigationApp {
+ void navigate(final Activity activity, final cgWaypoint waypoint);
+
+ boolean isEnabled(final cgWaypoint waypoint);
+}
diff --git a/main/src/cgeo/geocaching/cgeocaches.java b/main/src/cgeo/geocaching/cgeocaches.java
index 3af770e..5aaf0ce 100644
--- a/main/src/cgeo/geocaching/cgeocaches.java
+++ b/main/src/cgeo/geocaching/cgeocaches.java
@@ -45,6 +45,7 @@ import cgeo.geocaching.utils.Log;
import cgeo.geocaching.utils.RunnableWithArgument;
import ch.boye.httpclientandroidlib.HttpResponse;
+
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
@@ -141,7 +142,6 @@ public class cgeocaches extends AbstractListActivity {
private View listFooter = null;
private TextView listFooterText = null;
private final Progress progress = new Progress();
- private Float northHeading = 0f;
private String title = "";
private int detailTotal = 0;
private int detailProgress = 0;
@@ -151,41 +151,31 @@ public class cgeocaches extends AbstractListActivity {
private int listId = StoredList.TEMPORARY_LIST_ID;
private final GeoDirHandler geoDirHandler = new GeoDirHandler() {
- @Override
+ @Override
public void updateGeoData(final IGeoData geo) {
if (adapter == null) {
return;
}
- try {
- if (geo.getCoords() != null) {
- adapter.setActualCoordinates(geo.getCoords());
- }
-
- if (!Settings.isUseCompass() || geo.getSpeed() > 5) { // use GPS when speed is higher than 18 km/h
- if (!Settings.isUseCompass()) {
- adapter.setActualHeading(geo.getBearing());
- }
- if (northHeading != null) {
- adapter.setActualHeading(northHeading);
- }
- }
- } catch (Exception e) {
- Log.w("Failed to UpdateLocation location.");
+ if (geo.getCoords() != null) {
+ adapter.setActualCoordinates(geo.getCoords());
+ }
+ if (!Settings.isUseCompass() || geo.getSpeed() > 5) { // use GPS when speed is higher than 18 km/h
+ adapter.setActualHeading(geo.getBearing());
}
}
- @Override
- public void updateDirection(final float direction) {
- if (!Settings.isLiveList()) {
- return;
- }
+ @Override
+ public void updateDirection(final float direction) {
+ if (adapter == null || !Settings.isLiveList()) {
+ return;
+ }
- northHeading = DirectionProvider.getDirectionNow(cgeocaches.this, direction);
- if (northHeading != null && adapter != null && (app.currentGeo().getSpeed() <= 5)) { // use compass when speed is lower than 18 km/h) {
- adapter.setActualHeading(northHeading);
- }
- }
+ if (app.currentGeo().getSpeed() <= 5) { // use compass when speed is lower than 18 km/h) {
+ final float northHeading = DirectionProvider.getDirectionNow(cgeocaches.this, direction);
+ adapter.setActualHeading(northHeading);
+ }
+ }
};
private ContextMenuInfo lastMenuInfo;
@@ -248,11 +238,7 @@ public class cgeocaches extends AbstractListActivity {
return;
}
- final Geopoint coordsNow = app.currentGeo().getCoords();
- if (coordsNow != null) {
- adapter.setActualCoordinates(coordsNow);
- adapter.setActualHeading(northHeading);
- }
+ setAdapterCurrentCoordinates(false);
} catch (Exception e) {
showToast(res.getString(R.string.err_detail_cache_find_any));
Log.e("cgeocaches.loadCachesHandler: " + e.toString());
@@ -307,11 +293,7 @@ public class cgeocaches extends AbstractListActivity {
return;
}
- final Geopoint coordsNow = app.currentGeo().getCoords();
- if (coordsNow != null) {
- adapter.setActualCoordinates(coordsNow);
- adapter.setActualHeading(northHeading);
- }
+ setAdapterCurrentCoordinates(false);
} catch (Exception e) {
showToast(res.getString(R.string.err_detail_cache_find_next));
Log.e("cgeocaches.loadNextPageHandler: " + e.toString());
@@ -364,11 +346,7 @@ public class cgeocaches extends AbstractListActivity {
}
}
- final Geopoint coordsNow = app.currentGeo().getCoords();
- if (coordsNow != null) {
- adapter.setActualCoordinates(coordsNow);
- adapter.setActualHeading(northHeading);
- }
+ setAdapterCurrentCoordinates(false);
showProgress(false);
progress.dismiss();
@@ -657,12 +635,7 @@ public class cgeocaches extends AbstractListActivity {
if (adapter != null) {
adapter.setSelectMode(false);
- final Geopoint coordsNow = app.currentGeo().getCoords();
- if (coordsNow != null) {
- adapter.setActualCoordinates(coordsNow);
- adapter.setActualHeading(northHeading);
- adapter.forceSort();
- }
+ setAdapterCurrentCoordinates(true);
}
if (loadCachesHandler != null && search != null) {
@@ -678,6 +651,16 @@ public class cgeocaches extends AbstractListActivity {
}
}
+ private void setAdapterCurrentCoordinates(final boolean forceSort) {
+ final Geopoint coordsNow = app.currentGeo().getCoords();
+ if (coordsNow != null) {
+ adapter.setActualCoordinates(coordsNow);
+ if (forceSort) {
+ adapter.forceSort();
+ }
+ }
+ }
+
@Override
public void onDestroy() {
if (adapter != null) {
diff --git a/main/src/cgeo/geocaching/maps/CGeoMap.java b/main/src/cgeo/geocaching/maps/CGeoMap.java
index 40724f5..15e7960 100644
--- a/main/src/cgeo/geocaching/maps/CGeoMap.java
+++ b/main/src/cgeo/geocaching/maps/CGeoMap.java
@@ -83,6 +83,19 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
/** max. number of caches displayed in the Live Map */
public static final int MAX_CACHES = 500;
+ /**Controls the behaviour of the map*/
+ public enum MapMode {
+ /** Live Map where caches are loaded from online */
+ LIVE_ONLINE,
+ /** Live Map where caches are loaded only from database */
+ LIVE_OFFLINE,
+ /** Map around some coordinates */
+ COORDS,
+ /** Map with a single cache (no reload on move) */
+ SINGLE,
+ /** Map with a list of caches (no reload on move) */
+ LIST
+ }
/** Handler Messages */
private static final int HIDE_PROGRESS = 0;
private static final int SHOW_PROGRESS = 1;
@@ -97,6 +110,8 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
private static final String EXTRAS_WPTTYPE = "wpttype";
private static final String EXTRAS_MAPSTATE = "mapstate";
private static final String EXTRAS_SEARCH = "search";
+ private static final String EXTRAS_MAP_MODE = "map_mode";
+
private static final int MENU_SELECT_MAPVIEW = 1;
private static final int MENU_MAP_LIVE = 2;
private static final int MENU_STORE_CACHES = 3;
@@ -171,8 +186,11 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
private long detailProgressTime = 0L;
// views
private ImageSwitcher myLocSwitch = null;
+
+ /**Controls the map behaviour*/
+ private MapMode mapMode = null;
// other things
- private boolean live = true; // live map (live, dead) or rest (displaying caches on map)
+ // private boolean live = true; // live map (live, dead) or rest (displaying caches on map)
private boolean liveChanged = false; // previous state for loadTimer
private boolean centered = false; // if map is already centered
private boolean alreadyCentered = false; // -""- for setting my location
@@ -203,7 +221,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
// set title
final StringBuilder title = new StringBuilder();
- if (live) {
+ if (mapMode == MapMode.LIVE_ONLINE) {
title.append(res.getString(R.string.map_live));
} else {
title.append(mapTitle);
@@ -361,6 +379,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
// Get parameters from the intent
final Bundle extras = activity.getIntent().getExtras();
if (extras != null) {
+ mapMode = (MapMode) extras.get(EXTRAS_MAP_MODE);
searchIntent = (SearchResult) extras.getParcelable(EXTRAS_SEARCH);
geocodeIntent = extras.getString(EXTRAS_GEOCODE);
coordsIntent = (Geopoint) extras.getParcelable(EXTRAS_COORDS);
@@ -368,6 +387,9 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
mapStateIntent = extras.getIntArray(EXTRAS_MAPSTATE);
mapTitle = extras.getString(EXTRAS_MAP_TITLE);
}
+ else {
+ mapMode = Settings.isLiveMap() ? MapMode.LIVE_ONLINE : MapMode.LIVE_OFFLINE;
+ }
if (StringUtils.isBlank(mapTitle)) {
mapTitle = res.getString(R.string.map_map);
}
@@ -426,11 +448,8 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
mapView.getMapController().setZoom(Settings.getMapZoom());
- // live map, if no arguments are given
- live = (searchIntent == null && geocodeIntent == null && coordsIntent == null);
-
if (null == mapStateIntent) {
- followMyLocation = live;
+ followMyLocation = mapMode == MapMode.LIVE_OFFLINE || mapMode == MapMode.LIVE_ONLINE;
} else {
followMyLocation = 1 == mapStateIntent[3];
}
@@ -572,18 +591,16 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
}
item = menu.findItem(MENU_MAP_LIVE); // live map
- if (live) {
- if (Settings.isLiveMap()) {
- item.setTitle(res.getString(R.string.map_live_disable));
- } else {
- item.setTitle(res.getString(R.string.map_live_enable));
- }
+ 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));
}
- menu.findItem(MENU_STORE_CACHES).setEnabled(live && !isLoading() && CollectionUtils.isNotEmpty(caches) && app.hasUnsavedCaches(search));
+ menu.findItem(MENU_STORE_CACHES).setEnabled(isLiveMode() && !isLoading() && CollectionUtils.isNotEmpty(caches) && app.hasUnsavedCaches(search));
item = menu.findItem(MENU_CIRCLE_MODE); // show circles
if (overlayCaches != null && overlayCaches.getCircles()) {
@@ -593,9 +610,9 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
}
item = menu.findItem(MENU_AS_LIST);
- item.setEnabled(live && CollectionUtils.isNotEmpty(caches));
+ item.setEnabled(isLiveMode() && CollectionUtils.isNotEmpty(caches));
- menu.findItem(SUBMENU_STRATEGY).setEnabled(live);
+ menu.findItem(SUBMENU_STRATEGY).setEnabled(isLiveMode());
} catch (Exception e) {
Log.e("cgeomap.onPrepareOptionsMenu: " + e.toString());
}
@@ -603,6 +620,10 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
return true;
}
+ private boolean isLiveMode() {
+ return mapMode == MapMode.LIVE_OFFLINE || mapMode == MapMode.LIVE_ONLINE;
+ }
+
@Override
public boolean onOptionsItemSelected(MenuItem item) {
final int id = item.getItemId();
@@ -613,13 +634,14 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
return true;
case MENU_MAP_LIVE:
Settings.setLiveMap(!Settings.isLiveMap());
+ mapMode = Settings.isLiveMap() ? MapMode.LIVE_ONLINE : MapMode.LIVE_OFFLINE;
liveChanged = true;
search = null;
searchIntent = null;
ActivityMixin.invalidateOptionsMenu(activity);
return true;
case MENU_STORE_CACHES:
- if (live && !isLoading() && CollectionUtils.isNotEmpty(caches)) {
+ if (isLiveMode() && !isLoading() && CollectionUtils.isNotEmpty(caches)) {
final List<String> geocodes = new ArrayList<String>();
final List<cgCache> cachesProtected = caches.getAsList();
@@ -773,6 +795,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
}
mapIntent.putExtra(EXTRAS_WPTTYPE, waypointTypeIntent != null ? waypointTypeIntent.id : null);
mapIntent.putExtra(EXTRAS_MAP_TITLE, mapTitle);
+ mapIntent.putExtra(EXTRAS_MAP_MODE, mapMode);
final int[] mapState = currentMapState();
if (mapState != null) {
@@ -927,7 +950,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
if (liveChanged) {
moved = true;
- } else if (live && Settings.isLiveMap() && !downloaded) {
+ } else if (mapMode == MapMode.LIVE_ONLINE && !downloaded) {
moved = true;
} else if (viewport == null) {
moved = true;
@@ -1038,23 +1061,15 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
@Override
public void run() {
- /**
- * True if we are currently showing the live map or a single points through coordsIntent.
- */
- final boolean isLiveMapOrCoords = searchIntent == null && geocodeIntent == null;
-
try {
showProgressHandler.sendEmptyMessage(SHOW_PROGRESS);
loadThreadRun = System.currentTimeMillis();
// stage 1 - pull and render from the DB only for live map
- if (isLiveMapOrCoords) {
- // live map
- if (!live || !Settings.isLiveMap()) {
+ if (mapMode == MapMode.LIVE_ONLINE) {
search = new SearchResult(app.getStoredInViewport(viewport, Settings.getCacheType()));
- } else {
+ } else if (mapMode == MapMode.LIVE_OFFLINE) {
search = new SearchResult(app.getCachedInViewport(viewport, Settings.getCacheType()));
- }
} else {
// map started from another activity
search = new SearchResult(searchIntent);
@@ -1069,7 +1084,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
caches.addAll(cachesFromSearchResult);
}
- if (live) {
+ if (isLiveMode()) {
final boolean excludeMine = Settings.isExcludeMyCaches();
final boolean excludeDisabled = Settings.isExcludeDisabledCaches();
@@ -1084,7 +1099,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
countVisibleCaches();
if (cachesCnt < Settings.getWayPointsThreshold() || geocodeIntent != null) {
waypoints.clear();
- if (isLiveMapOrCoords) {
+ if (isLiveMode() || mapMode == MapMode.COORDS) {
//All visible waypoints
waypoints.addAll(app.getWaypointsInViewport(viewport, Settings.isExcludeMyCaches(), Settings.isExcludeDisabledCaches()));
} else {
@@ -1098,7 +1113,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
//render
displayExecutor.execute(new DisplayRunnable(viewport));
- if (live && Settings.isLiveMap()) {
+ if (mapMode == MapMode.LIVE_ONLINE) {
downloadExecutor.execute(new DownloadRunnable(viewport));
}
} finally {
@@ -1191,7 +1206,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
if (!cachesToDisplay.isEmpty()) {
// Only show waypoints for single view or setting
// when less than showWaypointsthreshold Caches shown
- if (cachesToDisplay.size() == 1 || (cachesCnt < Settings.getWayPointsThreshold())) {
+ if (mapMode == MapMode.SINGLE || (cachesCnt < Settings.getWayPointsThreshold())) {
for (cgWaypoint waypoint : waypointsToDisplay) {
if (waypoint.getCoords() == null) {
@@ -1556,6 +1571,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
public static void startActivitySearch(final Activity fromActivity, final SearchResult search, final String title) {
final Intent mapIntent = newIntent(fromActivity);
mapIntent.putExtra(EXTRAS_SEARCH, search);
+ mapIntent.putExtra(EXTRAS_MAP_MODE, MapMode.LIST);
if (StringUtils.isNotBlank(title)) {
mapIntent.putExtra(CGeoMap.EXTRAS_MAP_TITLE, title);
}
@@ -1563,11 +1579,14 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
}
public static void startActivityLiveMap(final Activity fromActivity) {
- fromActivity.startActivity(newIntent(fromActivity));
+ final Intent mapIntent = newIntent(fromActivity);
+ mapIntent.putExtra(EXTRAS_MAP_MODE, Settings.isLiveMap() ? MapMode.LIVE_ONLINE : MapMode.LIVE_OFFLINE);
+ fromActivity.startActivity(mapIntent);
}
public static void startActivityCoords(final Activity fromActivity, final Geopoint coords, final WaypointType type, final String title) {
final Intent mapIntent = newIntent(fromActivity);
+ mapIntent.putExtra(EXTRAS_MAP_MODE, MapMode.COORDS);
mapIntent.putExtra(EXTRAS_COORDS, coords);
if (type != null) {
mapIntent.putExtra(EXTRAS_WPTTYPE, type.id);
@@ -1580,6 +1599,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
public static void startActivityGeoCode(final Activity fromActivity, final String geocode) {
final Intent mapIntent = newIntent(fromActivity);
+ mapIntent.putExtra(EXTRAS_MAP_MODE, MapMode.SINGLE);
mapIntent.putExtra(EXTRAS_GEOCODE, geocode);
mapIntent.putExtra(EXTRAS_MAP_TITLE, geocode);
fromActivity.startActivity(mapIntent);
diff --git a/main/src/cgeo/geocaching/ui/CacheListAdapter.java b/main/src/cgeo/geocaching/ui/CacheListAdapter.java
index bcfdde7..b599290 100644
--- a/main/src/cgeo/geocaching/ui/CacheListAdapter.java
+++ b/main/src/cgeo/geocaching/ui/CacheListAdapter.java
@@ -263,19 +263,15 @@ public class CacheListAdapter extends ArrayAdapter<cgCache> {
notifyDataSetChanged();
}
- public void setActualCoordinates(final Geopoint coordsIn) {
- if (coordsIn == null) {
- return;
- }
-
- coords = coordsIn;
+ public void setActualCoordinates(final Geopoint coords) {
+ this.coords = coords;
updateSortByDistance();
for (final DistanceView distance : distances) {
- distance.update(coordsIn);
+ distance.update(coords);
}
for (final CompassMiniView compass : compasses) {
- compass.updateCurrentCoords(coordsIn);
+ compass.updateCurrentCoords(coords);
}
}
@@ -304,13 +300,13 @@ public class CacheListAdapter extends ArrayAdapter<cgCache> {
return cacheComparator == null || cacheComparator instanceof DistanceComparator;
}
- public void setActualHeading(Float directionNow) {
- if (directionNow == null) {
+ public void setActualHeading(final float direction) {
+ final float delta = (360 + azimuth - direction) % 360;
+ if (delta < 10 || delta > 350) {
return;
}
- azimuth = directionNow;
-
+ azimuth = direction;
for (final CompassMiniView compass : compasses) {
compass.updateAzimuth(azimuth);
}