diff options
29 files changed, 120 insertions, 130 deletions
diff --git a/.idea/inspectionProfiles/c_geo_standards.xml b/.idea/inspectionProfiles/c_geo_standards.xml index e839710..41a24a9 100644 --- a/.idea/inspectionProfiles/c_geo_standards.xml +++ b/.idea/inspectionProfiles/c_geo_standards.xml @@ -454,7 +454,7 @@ <inspection_tool class="UnnecessaryCallToStringValueOf" enabled="true" level="WARNING" enabled_by_default="true" /> <inspection_tool class="UnnecessaryConstructor" enabled="true" level="WARNING" enabled_by_default="true" /> <inspection_tool class="UnnecessaryEnumModifier" enabled="true" level="WARNING" enabled_by_default="true" /> - <inspection_tool class="UnnecessaryFullyQualifiedName" enabled="true" level="WARNING" enabled_by_default="true"> + <inspection_tool class="UnnecessaryFullyQualifiedName" enabled="true" level="WEAK WARNING" enabled_by_default="true"> <option name="m_ignoreJavadoc" value="false" /> </inspection_tool> <inspection_tool class="UnnecessaryInheritDoc" enabled="true" level="WARNING" enabled_by_default="true" /> diff --git a/cgeo-calendar/.settings/org.eclipse.jdt.ui.prefs b/cgeo-calendar/.settings/org.eclipse.jdt.ui.prefs index 7616a5b..06e562c 100644 --- a/cgeo-calendar/.settings/org.eclipse.jdt.ui.prefs +++ b/cgeo-calendar/.settings/org.eclipse.jdt.ui.prefs @@ -1,4 +1,3 @@ -#Wed Sep 14 20:41:07 CEST 2011 eclipse.preferences.version=1 editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true formatter_profile=_cgeo @@ -9,7 +8,7 @@ org.eclipse.jdt.ui.ondemandthreshold=99 org.eclipse.jdt.ui.staticondemandthreshold=99 sp_cleanup.add_default_serial_version_id=true sp_cleanup.add_generated_serial_version_id=false -sp_cleanup.add_missing_annotations=false +sp_cleanup.add_missing_annotations=true sp_cleanup.add_missing_deprecated_annotations=true sp_cleanup.add_missing_methods=false sp_cleanup.add_missing_nls_tags=false @@ -20,15 +19,17 @@ sp_cleanup.always_use_blocks=true sp_cleanup.always_use_parentheses_in_expressions=false sp_cleanup.always_use_this_for_non_static_field_access=false sp_cleanup.always_use_this_for_non_static_method_access=false -sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.convert_functional_interfaces=false +sp_cleanup.convert_to_enhanced_for_loop=true sp_cleanup.correct_indentation=false sp_cleanup.format_source_code=true sp_cleanup.format_source_code_changes_only=true -sp_cleanup.make_local_variable_final=false -sp_cleanup.make_parameters_final=false -sp_cleanup.make_private_fields_final=false +sp_cleanup.insert_inferred_type_arguments=false +sp_cleanup.make_local_variable_final=true +sp_cleanup.make_parameters_final=true +sp_cleanup.make_private_fields_final=true sp_cleanup.make_type_abstract_if_missing_method=false -sp_cleanup.make_variable_declarations_final=false +sp_cleanup.make_variable_declarations_final=true sp_cleanup.never_use_blocks=false sp_cleanup.never_use_parentheses_in_expressions=true sp_cleanup.on_save_use_additional_actions=true @@ -36,15 +37,16 @@ sp_cleanup.organize_imports=true sp_cleanup.qualify_static_field_accesses_with_declaring_class=false sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_with_declaring_class=true sp_cleanup.qualify_static_method_accesses_with_declaring_class=false sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_redundant_type_arguments=false sp_cleanup.remove_trailing_whitespaces=true sp_cleanup.remove_trailing_whitespaces_all=true sp_cleanup.remove_trailing_whitespaces_ignore_empty=false -sp_cleanup.remove_unnecessary_casts=false -sp_cleanup.remove_unnecessary_nls_tags=false -sp_cleanup.remove_unused_imports=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true sp_cleanup.remove_unused_local_variables=false sp_cleanup.remove_unused_private_fields=true sp_cleanup.remove_unused_private_members=false @@ -52,10 +54,13 @@ sp_cleanup.remove_unused_private_methods=true sp_cleanup.remove_unused_private_types=true sp_cleanup.sort_members=false sp_cleanup.sort_members_all=false -sp_cleanup.use_blocks=false +sp_cleanup.use_anonymous_class_creation=false +sp_cleanup.use_blocks=true sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_lambda=false sp_cleanup.use_parentheses_in_expressions=false sp_cleanup.use_this_for_non_static_field_access=false sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true sp_cleanup.use_this_for_non_static_method_access=false sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true +sp_cleanup.use_type_arguments=false diff --git a/cgeo-contacts/.settings/org.eclipse.jdt.ui.prefs b/cgeo-contacts/.settings/org.eclipse.jdt.ui.prefs index 7616a5b..06e562c 100644 --- a/cgeo-contacts/.settings/org.eclipse.jdt.ui.prefs +++ b/cgeo-contacts/.settings/org.eclipse.jdt.ui.prefs @@ -1,4 +1,3 @@ -#Wed Sep 14 20:41:07 CEST 2011 eclipse.preferences.version=1 editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true formatter_profile=_cgeo @@ -9,7 +8,7 @@ org.eclipse.jdt.ui.ondemandthreshold=99 org.eclipse.jdt.ui.staticondemandthreshold=99 sp_cleanup.add_default_serial_version_id=true sp_cleanup.add_generated_serial_version_id=false -sp_cleanup.add_missing_annotations=false +sp_cleanup.add_missing_annotations=true sp_cleanup.add_missing_deprecated_annotations=true sp_cleanup.add_missing_methods=false sp_cleanup.add_missing_nls_tags=false @@ -20,15 +19,17 @@ sp_cleanup.always_use_blocks=true sp_cleanup.always_use_parentheses_in_expressions=false sp_cleanup.always_use_this_for_non_static_field_access=false sp_cleanup.always_use_this_for_non_static_method_access=false -sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.convert_functional_interfaces=false +sp_cleanup.convert_to_enhanced_for_loop=true sp_cleanup.correct_indentation=false sp_cleanup.format_source_code=true sp_cleanup.format_source_code_changes_only=true -sp_cleanup.make_local_variable_final=false -sp_cleanup.make_parameters_final=false -sp_cleanup.make_private_fields_final=false +sp_cleanup.insert_inferred_type_arguments=false +sp_cleanup.make_local_variable_final=true +sp_cleanup.make_parameters_final=true +sp_cleanup.make_private_fields_final=true sp_cleanup.make_type_abstract_if_missing_method=false -sp_cleanup.make_variable_declarations_final=false +sp_cleanup.make_variable_declarations_final=true sp_cleanup.never_use_blocks=false sp_cleanup.never_use_parentheses_in_expressions=true sp_cleanup.on_save_use_additional_actions=true @@ -36,15 +37,16 @@ sp_cleanup.organize_imports=true sp_cleanup.qualify_static_field_accesses_with_declaring_class=false sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_with_declaring_class=true sp_cleanup.qualify_static_method_accesses_with_declaring_class=false sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_redundant_type_arguments=false sp_cleanup.remove_trailing_whitespaces=true sp_cleanup.remove_trailing_whitespaces_all=true sp_cleanup.remove_trailing_whitespaces_ignore_empty=false -sp_cleanup.remove_unnecessary_casts=false -sp_cleanup.remove_unnecessary_nls_tags=false -sp_cleanup.remove_unused_imports=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true sp_cleanup.remove_unused_local_variables=false sp_cleanup.remove_unused_private_fields=true sp_cleanup.remove_unused_private_members=false @@ -52,10 +54,13 @@ sp_cleanup.remove_unused_private_methods=true sp_cleanup.remove_unused_private_types=true sp_cleanup.sort_members=false sp_cleanup.sort_members_all=false -sp_cleanup.use_blocks=false +sp_cleanup.use_anonymous_class_creation=false +sp_cleanup.use_blocks=true sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_lambda=false sp_cleanup.use_parentheses_in_expressions=false sp_cleanup.use_this_for_non_static_field_access=false sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true sp_cleanup.use_this_for_non_static_method_access=false sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true +sp_cleanup.use_type_arguments=false diff --git a/main/.settings/org.eclipse.jdt.ui.prefs b/main/.settings/org.eclipse.jdt.ui.prefs index 4d4a905..d321d7d 100644 --- a/main/.settings/org.eclipse.jdt.ui.prefs +++ b/main/.settings/org.eclipse.jdt.ui.prefs @@ -12,7 +12,7 @@ org.eclipse.jdt.ui.overrideannotation=true org.eclipse.jdt.ui.staticondemandthreshold=99 sp_cleanup.add_default_serial_version_id=true sp_cleanup.add_generated_serial_version_id=false -sp_cleanup.add_missing_annotations=false +sp_cleanup.add_missing_annotations=true sp_cleanup.add_missing_deprecated_annotations=true sp_cleanup.add_missing_methods=false sp_cleanup.add_missing_nls_tags=false @@ -41,15 +41,15 @@ sp_cleanup.organize_imports=true sp_cleanup.qualify_static_field_accesses_with_declaring_class=false sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_with_declaring_class=true sp_cleanup.qualify_static_method_accesses_with_declaring_class=false sp_cleanup.remove_private_constructors=true sp_cleanup.remove_redundant_type_arguments=false sp_cleanup.remove_trailing_whitespaces=true sp_cleanup.remove_trailing_whitespaces_all=true sp_cleanup.remove_trailing_whitespaces_ignore_empty=false -sp_cleanup.remove_unnecessary_casts=false -sp_cleanup.remove_unnecessary_nls_tags=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true sp_cleanup.remove_unused_imports=true sp_cleanup.remove_unused_local_variables=false sp_cleanup.remove_unused_private_fields=true diff --git a/main/AndroidManifest.xml b/main/AndroidManifest.xml index ca3026a..28441fb 100644 --- a/main/AndroidManifest.xml +++ b/main/AndroidManifest.xml @@ -7,7 +7,7 @@ <uses-sdk android:minSdkVersion="9" - android:targetSdkVersion="19" /> + android:targetSdkVersion="21" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> diff --git a/main/project.properties b/main/project.properties index 4dc8ffb..4fed171 100644 --- a/main/project.properties +++ b/main/project.properties @@ -11,7 +11,7 @@ proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt:../play-services-base/proguard.txt:../play-services-location/proguard.txt # Project target. -target=Google Inc.:Google APIs:19 +target=Google Inc.:Google APIs:21 android.library.reference.1=../mapswithme-api android.library.reference.2=../android-support-v7-appcompat android.library.reference.3=../showcaseview diff --git a/main/res/values/changelog_master.xml b/main/res/values/changelog_master.xml index 1e3c3d4..0576519 100644 --- a/main/res/values/changelog_master.xml +++ b/main/res/values/changelog_master.xml @@ -2,5 +2,8 @@ <resources> <!-- changelog for the master branch --> <string name="changelog_master" translatable="false"> + <b>Next feature release:</b>\n + ยท Put features there\n + \n </string> </resources> diff --git a/main/src/cgeo/geocaching/AboutActivity.java b/main/src/cgeo/geocaching/AboutActivity.java index ceafc31..2f1c20a 100644 --- a/main/src/cgeo/geocaching/AboutActivity.java +++ b/main/src/cgeo/geocaching/AboutActivity.java @@ -190,6 +190,7 @@ public class AboutActivity extends AbstractViewPagerActivity<AboutActivity.Page> startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url))); } + @SuppressWarnings("deprecation") final void market() { final Intent marketIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + getPackageName())); marketIntent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); diff --git a/main/src/cgeo/geocaching/ImagesActivity.java b/main/src/cgeo/geocaching/ImagesActivity.java index b75e5eb..975a720 100644 --- a/main/src/cgeo/geocaching/ImagesActivity.java +++ b/main/src/cgeo/geocaching/ImagesActivity.java @@ -6,6 +6,7 @@ import cgeo.geocaching.ui.ImagesList; import cgeo.geocaching.ui.ImagesList.ImageType; import org.apache.commons.collections4.CollectionUtils; + import rx.Subscription; import android.content.Context; @@ -28,7 +29,7 @@ public class ImagesActivity extends AbstractActionBarActivity { private Subscription subscription; @Override - public void onCreate(Bundle savedInstanceState) { + public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); // get parameters @@ -78,11 +79,12 @@ public class ImagesActivity extends AbstractActionBarActivity { super.onStop(); } - public static void startActivityLogImages(final Context fromActivity, final String geocode, List<Image> logImages) { + public static void startActivityLogImages(final Context fromActivity, final String geocode, final List<Image> logImages) { startActivity(fromActivity, geocode, logImages, ImageType.LogImages); } - private static void startActivity(final Context fromActivity, final String geocode, List<Image> logImages, ImageType imageType) { + @SuppressWarnings("deprecation") + private static void startActivity(final Context fromActivity, final String geocode, final List<Image> logImages, final ImageType imageType) { final Intent logImgIntent = new Intent(fromActivity, ImagesActivity.class); // if resuming our app within this activity, finish it and return to the cache activity logImgIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET) @@ -95,18 +97,18 @@ public class ImagesActivity extends AbstractActionBarActivity { fromActivity.startActivity(logImgIntent); } - public static void startActivitySpoilerImages(final Context fromActivity, String geocode, List<Image> spoilers) { + public static void startActivitySpoilerImages(final Context fromActivity, final String geocode, final List<Image> spoilers) { startActivity(fromActivity, geocode, spoilers, ImageType.SpoilerImages); } @Override - public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { + public void onCreateContextMenu(final ContextMenu menu, final View v, final ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); imagesList.onCreateContextMenu(menu, v); } @Override - public boolean onContextItemSelected(MenuItem item) { + public boolean onContextItemSelected(final MenuItem item) { if (imagesList.onContextItemSelected(item)) { return true; } diff --git a/main/src/cgeo/geocaching/UsefulAppsActivity.java b/main/src/cgeo/geocaching/UsefulAppsActivity.java index dd92350..b218c84 100644 --- a/main/src/cgeo/geocaching/UsefulAppsActivity.java +++ b/main/src/cgeo/geocaching/UsefulAppsActivity.java @@ -45,6 +45,7 @@ public class UsefulAppsActivity extends AbstractActionBarActivity { this.packageName = packageName; } + @SuppressWarnings("deprecation") private void installFromMarket(final Activity activity) { try { // allow also opening pure http URLs in addition to market packages diff --git a/main/src/cgeo/geocaching/gcvote/GCVoteDialog.java b/main/src/cgeo/geocaching/gcvote/GCVoteDialog.java index e5717ab..0738274 100644 --- a/main/src/cgeo/geocaching/gcvote/GCVoteDialog.java +++ b/main/src/cgeo/geocaching/gcvote/GCVoteDialog.java @@ -87,9 +87,8 @@ public class GCVoteDialog { cache.setMyVote(rating); DataStore.saveChangedCache(cache); return true; - } else { - Log.w("GCVoteDialog.vote: could not send vote"); } + Log.w("GCVoteDialog.vote: could not send vote"); } } catch (final RuntimeException e) { Log.e("GCVoteDialog.vote: could not send vote", e); diff --git a/main/src/cgeo/geocaching/maps/CGeoMap.java b/main/src/cgeo/geocaching/maps/CGeoMap.java index 18826a4..0fdd038 100644 --- a/main/src/cgeo/geocaching/maps/CGeoMap.java +++ b/main/src/cgeo/geocaching/maps/CGeoMap.java @@ -989,7 +989,7 @@ public class CGeoMap extends AbstractMap implements ViewFactory { final boolean needsRepaintForHeading = needsRepaintForHeading(); if (needsRepaintForDistanceOrAccuracy) { - if (map.followMyLocation) { + if (CGeoMap.followMyLocation) { map.centerMap(new Geopoint(currentLocation)); } } diff --git a/main/src/cgeo/geocaching/sensors/RotationProvider.java b/main/src/cgeo/geocaching/sensors/RotationProvider.java index 02dbc8c..c63e39f 100644 --- a/main/src/cgeo/geocaching/sensors/RotationProvider.java +++ b/main/src/cgeo/geocaching/sensors/RotationProvider.java @@ -43,6 +43,7 @@ public class RotationProvider extends LooperCallbacks<Float> implements SensorEv return ((SensorManager) context.getSystemService(Context.SENSOR_SERVICE)).getDefaultSensor(Sensor.TYPE_ROTATION_VECTOR) != null; } + @TargetApi(19) public static boolean hasGeomagneticRotationSensor(final Context context) { return ((SensorManager) context.getSystemService(Context.SENSOR_SERVICE)).getDefaultSensor(Sensor.TYPE_GEOMAGNETIC_ROTATION_VECTOR) != null; } diff --git a/mapswithme-api/build.gradle b/mapswithme-api/build.gradle index 86d5c77..94cd14f 100644 --- a/mapswithme-api/build.gradle +++ b/mapswithme-api/build.gradle @@ -1,34 +1,19 @@ apply plugin: 'android-library' -dependencies { - compile fileTree(dir: 'libs', include: '*.jar') -} - android { - compileSdkVersion 19 - buildToolsVersion "21.1.2" - sourceSets { - main { - manifest.srcFile 'AndroidManifest.xml' - java.srcDirs = ['src'] - resources.srcDirs = ['src'] - aidl.srcDirs = ['src'] - renderscript.srcDirs = ['src'] - res.srcDirs = ['res'] - assets.srcDirs = ['assets'] - } + // Define these properties in the gradle.properties file in the root project folder + compileSdkVersion propTargetSdkVersion.toInteger() + buildToolsVersion propBuildToolsVersion - // Move the tests to tests/java, tests/res, etc... - instrumentTest.setRoot('tests') + defaultConfig { + minSdkVersion propMinSdkVersion.toInteger() + targetSdkVersion propTargetSdkVersion.toInteger() + } - // Move the build types to build-types/<type> - // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ... - // This moves them out of them default location under src/<type>/... which would - // conflict with src/ being used by the main source set. - // Adding new build types or product flavors should be accompanied - // by a similar customization. - debug.setRoot('build-types/debug') - release.setRoot('build-types/release') - } + sourceSets.main { + manifest.srcFile 'AndroidManifest.xml' + java.srcDirs = ['src'] + res.srcDirs = ['res'] + } } diff --git a/mapswithme-api/project.properties b/mapswithme-api/project.properties index 91d2b02..93c8c3c 100644 --- a/mapswithme-api/project.properties +++ b/mapswithme-api/project.properties @@ -11,5 +11,5 @@ #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt # Project target. -target=android-19 +target=android-21 android.library=true diff --git a/mapswithme-api/res/layout/dlg_install_mwm.xml b/mapswithme-api/res/layout/dlg_install_mwm.xml index 0d174a8..1858369 100644 --- a/mapswithme-api/res/layout/dlg_install_mwm.xml +++ b/mapswithme-api/res/layout/dlg_install_mwm.xml @@ -54,16 +54,6 @@ android:background="@drawable/btn_green_selector" android:text="@string/down_pro" /> - <Button - android:id="@+id/btn_lite" - style="@style/promoButton" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:layout_weight="1" - android:background="@drawable/btn_gray_selector" - android:padding="6dp" - android:text="@string/down_lite" /> - </LinearLayout> </ScrollView>
\ No newline at end of file diff --git a/mapswithme-api/res/values/strings.xml b/mapswithme-api/res/values/strings.xml index 1955847..d9e3f27 100644 --- a/mapswithme-api/res/values/strings.xml +++ b/mapswithme-api/res/values/strings.xml @@ -1,9 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <resources> - <string name="mwm_should_be_installed">Offline maps are required to proceed. We have partnered with MapsWithMe to provide you with offline maps of the entire world.\nTo continue please download the app:</string> - <string name="down_lite">Download MapsWithMe Lite (free)</string> - <string name="down_pro">Download MapsWithMe Pro</string> - - <string name="url_pro">http://mapswith.me/get</string> - <string name="url_lite">http://mapswith.me/app</string> + <string name="mwm_should_be_installed">Offline maps are required to proceed. We have partnered with MAPS.ME to provide you with offline maps of the entire world.\nTo continue please download the app:</string> + <string name="down_pro">Download MAPS.ME</string> + <string name="url_pro">http://maps.me/get</string> </resources>
\ No newline at end of file diff --git a/mapswithme-api/src/com/mapswithme/maps/api/DownloadMapsWithMeDialog.java b/mapswithme-api/src/com/mapswithme/maps/api/DownloadMapsWithMeDialog.java index 5670a5f..480bbe1 100644 --- a/mapswithme-api/src/com/mapswithme/maps/api/DownloadMapsWithMeDialog.java +++ b/mapswithme-api/src/com/mapswithme/maps/api/DownloadMapsWithMeDialog.java @@ -41,7 +41,6 @@ public class DownloadMapsWithMeDialog extends Dialog implements android.view.Vie requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.dlg_install_mwm); - findViewById(R.id.btn_lite).setOnClickListener(this); findViewById(R.id.btn_pro).setOnClickListener(this); setOwnerActivity(activity); @@ -59,7 +58,7 @@ public class DownloadMapsWithMeDialog extends Dialog implements android.view.Vie @Override public void onClick(View v) { - String url = getContext().getString(v.getId() == R.id.btn_lite ? R.string.url_lite : R.string.url_pro); + String url = getContext().getString(R.string.url_pro); onDownloadButtonClicked(url); } } diff --git a/play-services-base/project.properties b/play-services-base/project.properties index ad36a32..664c438 100644 --- a/play-services-base/project.properties +++ b/play-services-base/project.properties @@ -11,5 +11,5 @@ proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard.txt # Project target. -target=Google Inc.:Google APIs:19 +target=Google Inc.:Google APIs:21 android.library=true diff --git a/play-services-base/src/.gitkeep b/play-services-base/src/.gitkeep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/play-services-base/src/.gitkeep diff --git a/play-services-base/src/android/UnusedStub.java b/play-services-base/src/android/UnusedStub.java deleted file mode 100644 index 614f53b..0000000 --- a/play-services-base/src/android/UnusedStub.java +++ /dev/null @@ -1,8 +0,0 @@ -package android; - - -// unused file to avoid trouble with the empty src folder -public class UnusedStub { - -} - diff --git a/play-services-location/project.properties b/play-services-location/project.properties index 8a32119..51a7632 100644 --- a/play-services-location/project.properties +++ b/play-services-location/project.properties @@ -11,6 +11,6 @@ proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard.txt # Project target. -target=Google Inc.:Google APIs:19 +target=Google Inc.:Google APIs:21 android.library=true android.library.reference.1=../play-services-base diff --git a/play-services-location/src/.gitkeep b/play-services-location/src/.gitkeep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/play-services-location/src/.gitkeep diff --git a/play-services-location/src/android/UnusedStub.java b/play-services-location/src/android/UnusedStub.java deleted file mode 100644 index c28e572..0000000 --- a/play-services-location/src/android/UnusedStub.java +++ /dev/null @@ -1,7 +0,0 @@ -package android; - -// unused file to avoid trouble with the empty src folder -public class UnusedStub { - -} - diff --git a/tests/.settings/org.eclipse.jdt.ui.prefs b/tests/.settings/org.eclipse.jdt.ui.prefs index 1fda530..06e562c 100644 --- a/tests/.settings/org.eclipse.jdt.ui.prefs +++ b/tests/.settings/org.eclipse.jdt.ui.prefs @@ -8,7 +8,7 @@ org.eclipse.jdt.ui.ondemandthreshold=99 org.eclipse.jdt.ui.staticondemandthreshold=99 sp_cleanup.add_default_serial_version_id=true sp_cleanup.add_generated_serial_version_id=false -sp_cleanup.add_missing_annotations=false +sp_cleanup.add_missing_annotations=true sp_cleanup.add_missing_deprecated_annotations=true sp_cleanup.add_missing_methods=false sp_cleanup.add_missing_nls_tags=false @@ -20,16 +20,16 @@ sp_cleanup.always_use_parentheses_in_expressions=false sp_cleanup.always_use_this_for_non_static_field_access=false sp_cleanup.always_use_this_for_non_static_method_access=false sp_cleanup.convert_functional_interfaces=false -sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.convert_to_enhanced_for_loop=true sp_cleanup.correct_indentation=false sp_cleanup.format_source_code=true sp_cleanup.format_source_code_changes_only=true sp_cleanup.insert_inferred_type_arguments=false -sp_cleanup.make_local_variable_final=false -sp_cleanup.make_parameters_final=false -sp_cleanup.make_private_fields_final=false +sp_cleanup.make_local_variable_final=true +sp_cleanup.make_parameters_final=true +sp_cleanup.make_private_fields_final=true sp_cleanup.make_type_abstract_if_missing_method=false -sp_cleanup.make_variable_declarations_final=false +sp_cleanup.make_variable_declarations_final=true sp_cleanup.never_use_blocks=false sp_cleanup.never_use_parentheses_in_expressions=true sp_cleanup.on_save_use_additional_actions=true @@ -37,16 +37,16 @@ sp_cleanup.organize_imports=true sp_cleanup.qualify_static_field_accesses_with_declaring_class=false sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_with_declaring_class=true sp_cleanup.qualify_static_method_accesses_with_declaring_class=false sp_cleanup.remove_private_constructors=true sp_cleanup.remove_redundant_type_arguments=false sp_cleanup.remove_trailing_whitespaces=true sp_cleanup.remove_trailing_whitespaces_all=true sp_cleanup.remove_trailing_whitespaces_ignore_empty=false -sp_cleanup.remove_unnecessary_casts=false -sp_cleanup.remove_unnecessary_nls_tags=false -sp_cleanup.remove_unused_imports=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true sp_cleanup.remove_unused_local_variables=false sp_cleanup.remove_unused_private_fields=true sp_cleanup.remove_unused_private_members=false @@ -55,7 +55,7 @@ sp_cleanup.remove_unused_private_types=true sp_cleanup.sort_members=false sp_cleanup.sort_members_all=false sp_cleanup.use_anonymous_class_creation=false -sp_cleanup.use_blocks=false +sp_cleanup.use_blocks=true sp_cleanup.use_blocks_only_for_return_and_throw=false sp_cleanup.use_lambda=false sp_cleanup.use_parentheses_in_expressions=false diff --git a/tests/res/layout/cgeo_tests_activity.xml b/tests/res/layout/cgeo_tests_activity.xml index 43225ac..d035210 100644 --- a/tests/res/layout/cgeo_tests_activity.xml +++ b/tests/res/layout/cgeo_tests_activity.xml @@ -13,6 +13,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" android:layout_alignParentTop="true" android:layout_gravity="center_vertical" android:gravity="center_vertical" @@ -27,6 +28,7 @@ android:layout_height="fill_parent" android:layout_above="@+id/buttonRun" android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" android:layout_below="@+id/headline" > <TextView @@ -43,6 +45,7 @@ android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentLeft="false" + android:layout_alignParentStart="false" android:onClick="runTests" android:text="@string/run_tests" /> diff --git a/tests/src/cgeo/geocaching/location/GeocoderTest.java b/tests/src/cgeo/geocaching/location/GeocoderTest.java index 0cc1a79..937c75d 100644 --- a/tests/src/cgeo/geocaching/location/GeocoderTest.java +++ b/tests/src/cgeo/geocaching/location/GeocoderTest.java @@ -49,7 +49,8 @@ public class GeocoderTest extends CGeoTestCase { if (withAddress) { assertThat(StringUtils.lowerCase(address.getAddressLine(0))).as(describe("street address", geocoder)).startsWith("46 rue barrault"); assertThat(address.getLocality()).as(describe("locality", geocoder)).isEqualTo("Paris"); - assertThat(address.getCountryName()).as(describe("country name", geocoder)).isEqualTo("France"); + assertThat(address.getCountryCode()).as(describe("country code", geocoder)).isEqualTo("FR"); + // don't assert on country name, as this can be localized, e.g. with the mapquest geocoder } } diff --git a/tests/src/cgeo/geocaching/utils/ProcessUtilsTest.java b/tests/src/cgeo/geocaching/utils/ProcessUtilsTest.java index 2c6ed18..b442c8a 100644 --- a/tests/src/cgeo/geocaching/utils/ProcessUtilsTest.java +++ b/tests/src/cgeo/geocaching/utils/ProcessUtilsTest.java @@ -6,7 +6,7 @@ import junit.framework.TestCase; public class ProcessUtilsTest extends TestCase { public static void testIsInstalled() { - assertThat(ProcessUtils.isInstalled("com.android.launcher")).isTrue(); + assertThat(ProcessUtils.isInstalled("com.android.settings")).isTrue(); } public static void testIsInstalledNotLaunchable() { @@ -16,7 +16,7 @@ public class ProcessUtilsTest extends TestCase { } public static void testIsLaunchable() { - assertThat(ProcessUtils.isInstalled("com.android.settings")).isTrue(); + assertThat(ProcessUtils.isLaunchable("com.android.settings")).isTrue(); } } diff --git a/tests/src/cgeo/junit/CgeoTestRunner.java b/tests/src/cgeo/junit/CgeoTestRunner.java index 16a5f12..94803cf 100644 --- a/tests/src/cgeo/junit/CgeoTestRunner.java +++ b/tests/src/cgeo/junit/CgeoTestRunner.java @@ -11,10 +11,12 @@ import android.util.Log; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.security.AccessController; +import java.security.PrivilegedAction; /** * Test runner which derives from the newer Google instrumentation test runner used by the Espresso test framework. It - * adds junit report functionality by cloning the behaviour of the {@link JUnitReportTestRunner}. + * adds junit report functionality by cloning the behavior of the {@link JUnitReportTestRunner}. * */ public class CgeoTestRunner extends GoogleInstrumentationTestRunner { @@ -86,21 +88,32 @@ public class CgeoTestRunner extends GoogleInstrumentationTestRunner { @Override public void start() { - mListener = new JUnitReportListener(getContext(), getTargetContext(), mReportFile, mReportDir, mFilterTraces, mMultiFile); - try { - Class<?> c = getClass(); - Field bridgeTestRunner = c.getSuperclass().getDeclaredField("bridgeTestRunner"); - bridgeTestRunner.setAccessible(true); - Object obj = bridgeTestRunner.get(this); - Method m = obj.getClass().getDeclaredMethod("getAndroidTestRunner", (Class[]) null); - AndroidTestRunner androidTestRunner = (AndroidTestRunner) m.invoke(obj); - androidTestRunner.addTestListener(mListener); - } catch (NoSuchFieldException | InvocationTargetException | IllegalAccessException | NoSuchMethodException | SecurityException x) { - Log.e(LOG_TAG, x.toString()); - } + makeAndroidTestRunnerAccessible(); super.start(); } + private void makeAndroidTestRunnerAccessible() { + AccessController.doPrivileged(new PrivilegedAction<Void>() { + @Override + public Void run() { + mListener = new JUnitReportListener(getContext(), getTargetContext(), mReportFile, mReportDir, mFilterTraces, mMultiFile); + try { + Class<?> c = getClass(); + Field bridgeTestRunner = c.getSuperclass().getDeclaredField("bridgeTestRunner"); + bridgeTestRunner.setAccessible(true); + Object obj = bridgeTestRunner.get(this); + Method m = obj.getClass().getDeclaredMethod("getAndroidTestRunner", (Class[]) null); + AndroidTestRunner androidTestRunner = (AndroidTestRunner) m.invoke(obj); + androidTestRunner.addTestListener(mListener); + } catch (NoSuchFieldException | InvocationTargetException | IllegalAccessException + | NoSuchMethodException | SecurityException x) { + Log.e(LOG_TAG, x.toString()); + } + return null; + } + }); + } + @Override public void finish(int resultCode, Bundle results) { if (mListener != null) { |
