diff options
Diffstat (limited to 'main')
154 files changed, 2696 insertions, 2386 deletions
diff --git a/main/.classpath b/main/.classpath index 79a19e9..d7bcabc 100644 --- a/main/.classpath +++ b/main/.classpath @@ -6,6 +6,16 @@ <attribute name="ignore_optional_problems" value="true"/> </attributes> </classpathentry> + <classpathentry kind="src" path="thirdparty"> + <attributes> + <attribute name="ignore_optional_problems" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="src" path="annotation_gen"> + <attributes> + <attribute name="ignore_optional_problems" value="true"/> + </attributes> + </classpathentry> <classpathentry exported="true" kind="lib" path="libs/commons-lang3-3.1.jar"/> <classpathentry kind="lib" path="libs/locus-api-4.0.jar"/> <classpathentry kind="lib" path="libs/commons-collections-3.2.1.jar"/> diff --git a/main/.factorypath b/main/.factorypath new file mode 100644 index 0000000..d54f9b4 --- /dev/null +++ b/main/.factorypath @@ -0,0 +1,3 @@ +<factorypath> + <factorypathentry kind="WKSPJAR" id="/cgeo/libs/butterknife-1.3.2.jar" enabled="true" runInBatchMode="false"/> +</factorypath> diff --git a/main/.settings/org.eclipse.jdt.apt.core.prefs b/main/.settings/org.eclipse.jdt.apt.core.prefs new file mode 100644 index 0000000..813e822 --- /dev/null +++ b/main/.settings/org.eclipse.jdt.apt.core.prefs @@ -0,0 +1,4 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.apt.aptEnabled=true +org.eclipse.jdt.apt.genSrcDir=annotation_gen +org.eclipse.jdt.apt.reconcileEnabled=true diff --git a/main/.settings/org.eclipse.jdt.core.prefs b/main/.settings/org.eclipse.jdt.core.prefs index 3c08e45..41c73f0 100644 --- a/main/.settings/org.eclipse.jdt.core.prefs +++ b/main/.settings/org.eclipse.jdt.core.prefs @@ -1,367 +1,368 @@ -eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.6
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.doc.comment.support=enabled
-org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
-org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
-org.eclipse.jdt.core.compiler.problem.deadCode=warning
-org.eclipse.jdt.core.compiler.problem.deprecation=warning
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
-org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
-org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
-org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
-org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
-org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
-org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
-org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
-org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
-org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=disabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=public
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
-org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
-org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=no_tag
-org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
-org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning
-org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
-org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.nullReference=warning
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
-org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
-org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
-org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
-org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning
-org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=warning
-org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=warning
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
-org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
-org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.unusedImport=warning
-org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
-org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
-org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning
-org.eclipse.jdt.core.compiler.problem.unusedParameter=warning
-org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
-org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.6
-org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=0
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=0
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=0
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=0
-org.eclipse.jdt.core.formatter.alignment_for_assignment=0
-org.eclipse.jdt.core.formatter.alignment_for_binary_expression=0
-org.eclipse.jdt.core.formatter.alignment_for_compact_if=0
-org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0
-org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
-org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=0
-org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0
-org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0
-org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_after_package=1
-org.eclipse.jdt.core.formatter.blank_lines_before_field=0
-org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
-org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
-org.eclipse.jdt.core.formatter.blank_lines_before_method=1
-org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
-org.eclipse.jdt.core.formatter.blank_lines_before_package=0
-org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
-org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
-org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
-org.eclipse.jdt.core.formatter.comment.format_block_comments=true
-org.eclipse.jdt.core.formatter.comment.format_header=true
-org.eclipse.jdt.core.formatter.comment.format_html=true
-org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
-org.eclipse.jdt.core.formatter.comment.format_line_comments=false
-org.eclipse.jdt.core.formatter.comment.format_source_code=true
-org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
-org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
-org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
-org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
-org.eclipse.jdt.core.formatter.comment.line_length=120
-org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
-org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
-org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
-org.eclipse.jdt.core.formatter.compact_else_if=true
-org.eclipse.jdt.core.formatter.continuation_indentation=2
-org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
-org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
-org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
-org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
-org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
-org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_empty_lines=false
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
-org.eclipse.jdt.core.formatter.indentation.size=4
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
-org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.join_lines_in_comments=false
-org.eclipse.jdt.core.formatter.join_wrapped_lines=false
-org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.lineSplit=120
-org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
-org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
-org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
-org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
-org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
-org.eclipse.jdt.core.formatter.tabulation.char=space
-org.eclipse.jdt.core.formatter.tabulation.size=4
-org.eclipse.jdt.core.formatter.use_on_off_tags=false
-org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
-org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
-org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
+eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.doc.comment.support=enabled +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning +org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning +org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=disabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=public +org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning +org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public +org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=no_tag +org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning +org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=warning +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=warning +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning +org.eclipse.jdt.core.compiler.problem.unusedParameter=warning +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.processAnnotations=enabled +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=0 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=0 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=true +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert +org.eclipse.jdt.core.formatter.comment.line_length=120 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=120 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=false +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/main/AndroidManifest.xml b/main/AndroidManifest.xml index e69af11..3fb5ff1 100644 --- a/main/AndroidManifest.xml +++ b/main/AndroidManifest.xml @@ -31,7 +31,7 @@ android:name="com.google.android.backup.api_key" android:value="AEdPqrEAAAAIsvD_aUSDMwWOf9NkwwxZ4kJJI_AG2EaxjSu2jw" /> <activity - android:name=".cgeo" + android:name=".MainActivity" android:label="@string/app_name" android:windowSoftInputMode="stateHidden" android:theme="@style/cgeo_main" @@ -43,7 +43,7 @@ </activity> <activity android:name=".SearchActivity" - android:label="@string/app_name" + android:label="@string/search" android:launchMode="singleTop" android:windowSoftInputMode="stateHidden" android:configChanges="keyboardHidden|orientation" > @@ -63,49 +63,49 @@ </activity> <activity android:name=".AboutActivity" - android:label="@string/app_name" + android:label="@string/about" android:windowSoftInputMode="stateHidden" android:configChanges="keyboardHidden|orientation" > </activity> <activity android:name=".UsefulAppsActivity" - android:label="@string/app_name" + android:label="@string/helper" android:windowSoftInputMode="stateHidden" android:configChanges="keyboardHidden|orientation" > </activity> <activity android:name=".twitter.TwitterAuthorizationActivity" - android:label="@string/app_name" + android:label="@string/auth_twitter" android:windowSoftInputMode="stateHidden" android:configChanges="keyboardHidden|orientation" > </activity> <activity android:name=".EditWaypointActivity" - android:label="@string/app_name" + android:label="@string/waypoint_edit_title" android:windowSoftInputMode="stateHidden" android:configChanges="keyboardHidden|orientation" > </activity> <activity android:name=".NavigateAnyPointActivity" - android:label="@string/app_name" + android:label="@string/search_destination" android:windowSoftInputMode="stateHidden" android:configChanges="keyboardHidden|orientation" > </activity> <activity android:name=".AddressListActivity" - android:label="@string/app_name" + android:label="@string/search_address_result" android:windowSoftInputMode="stateHidden" android:configChanges="keyboardHidden|orientation" > </activity> <activity android:name=".SettingsActivity" - android:label="@string/app_name" + android:label="@string/settings" android:windowSoftInputMode="stateHidden" android:configChanges="keyboardHidden|orientation" > </activity> <activity android:name=".cgeocaches" - android:label="@string/app_name" + android:label="@string/stored_caches_button" android:configChanges="keyboardHidden|orientation|screenSize" > <intent-filter> <action android:name="android.intent.action.VIEW" /> @@ -124,27 +124,27 @@ </activity> <activity android:name=".maps.google.GoogleMapActivity" - android:label="@string/app_name" > + android:label="@string/map_map" > </activity> <activity android:name=".maps.mapsforge.MapsforgeMapActivity" - android:label="@string/app_name" > + android:label="@string/map_map" > </activity> <activity android:name=".maps.mapsforge.v024.MapsforgeMapActivity024" - android:label="@string/app_name" > + android:label="@string/map_map" > </activity> <activity android:name=".StaticMapsActivity" - android:label="@string/app_name" > + android:label="@string/map_static_title" > </activity> <activity android:name=".VisitCacheActivity" - android:label="@string/app_name"> + android:label="@string/log_new_log"> </activity> <activity android:name=".LogTrackableActivity" - android:label="@string/app_name" + android:label="@string/trackable_touch" android:configChanges="keyboardHidden|orientation" > </activity> <activity @@ -154,7 +154,7 @@ </activity> <activity android:name=".CacheDetailActivity" - android:label="@string/app_name" + android:label="@string/cache" android:configChanges="keyboardHidden|orientation" > <intent-filter> <action android:name="wikitudeapi.arcallback" /> @@ -181,7 +181,7 @@ </activity> <activity android:name="cgeo.geocaching.TrackableActivity" - android:label="@string/app_name" + android:label="@string/trackable" android:configChanges="keyboardHidden|orientation" > <intent-filter> <action android:name="android.intent.action.VIEW" /> @@ -204,32 +204,32 @@ </activity> <activity android:name=".cgeonavigate" - android:label="@string/app_name_compass"> + android:label="@string/compass_title"> </activity> <activity android:name=".GpxFileListActivity" - android:label="@string/app_name" + android:label="@string/gpx_import_title" android:configChanges="keyboardHidden|orientation" > </activity> <activity android:name=".SelectMapfileActivity" - android:label="@string/app_name" + android:label="@string/map_file_select_title" 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:label="@string/waypoint" android:windowSoftInputMode="stateHidden" android:theme="@style/popup_dark" android:configChanges="keyboardHidden|orientation" > </activity> <activity android:name=".files.SimpleDirChooser" - android:label="@string/app_name"> + android:label="@string/simple_dir_chooser_title"> </activity> <activity android:name=".ImageSelectActivity" - android:label="@string/app_name"> + android:label="@string/log_image"> </activity> </application> </manifest> diff --git a/main/ant.properties b/main/ant.properties index c26774c..8216a77 100644 --- a/main/ant.properties +++ b/main/ant.properties @@ -17,3 +17,4 @@ proguard.config=proguard.cfg proguard.jar=support/proguard.jar +source.dir=src;thirdparty
\ No newline at end of file diff --git a/main/libs/butterknife-1.3.2.jar b/main/libs/butterknife-1.3.2.jar Binary files differnew file mode 100644 index 0000000..1bd6fe6 --- /dev/null +++ b/main/libs/butterknife-1.3.2.jar diff --git a/main/proguard.cfg b/main/proguard.cfg index ee4d81a..23d603d 100644 --- a/main/proguard.cfg +++ b/main/proguard.cfg @@ -63,3 +63,7 @@ -keepclassmembers class cgeo.geocaching.compatibility.AndroidLevel8 { public static <methods>; } + +# Butter knife view injection, see http://jakewharton.github.io/butterknife/ +-dontwarn butterknife.Views$InjectViewProcessor +-keepclassmembers class **$$ViewInjector {*;}
\ No newline at end of file diff --git a/main/project/attributes/iconlist.txt b/main/project/attributes/iconlist.txt index 046add1..8b75ab6 100644 --- a/main/project/attributes/iconlist.txt +++ b/main/project/attributes/iconlist.txt @@ -27,7 +27,7 @@ kids | 6 | 59 | x | PD | | ht onehour | 7 | | x | CC0 | The Noun Project | http://thenounproject.com/noun/clock/#icon-No2306 scenic | 8 | | | PD | USA National Park Service | http://thenounproject.com/noun/binoculars/#icon-No112 hiking | 9 | 25 | | PD | USA National Park Service | http://thenounproject.com/noun/hiker/#icon-No562 -climbing | 10 | 28 | | PD | USA National Park Service | http://thenounproject.com/noun/climbing/#icon-No526 +climbing | 10 | | | PD | USA National Park Service | http://thenounproject.com/noun/climbing/#icon-No526 wading | 11 | | x | PD | USA National Park Service | http://thenounproject.com/noun/wading/#icon-No581 swimming | 12 | 29 | | PD | USA National Park Service | http://thenounproject.com/noun/swimming/#icon-No226 available | 13 | 38 | x | PD | koem | selfmade @@ -86,6 +86,7 @@ railway | | 10 | | CC0 | | ht syringe | | 23 | | CC0 | Betovarg Jabib | http://thenounproject.com/noun/syringe/#icon-No1508 swamp | | 26 | x | CC0 | Megan Strickland | http://thenounproject.com/noun/hand/#icon-No1477 hills | | 27 | x | PD | koem | selfmade +easy_climbing | | 28 | x | PD | USA National Park Service | http://thenounproject.com/noun/climbing/#icon-No526 poi | | 30 | | PD | | http://thenounproject.com/noun/point-of-interest/#icon-No522 moving_target | | 31 | x | PD | | http://thenounproject.com/noun/running/#icon-No246 webcam | | 32 | | PD | | http://thenounproject.com/noun/video-camera/#icon-No637 diff --git a/main/project/attributes/svgs/easy_climbing.svg b/main/project/attributes/svgs/easy_climbing.svg new file mode 100644 index 0000000..682b053 --- /dev/null +++ b/main/project/attributes/svgs/easy_climbing.svg @@ -0,0 +1,84 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Generator: Adobe Illustrator 14.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 43363) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + version="1.0" + id="Layer_1" + x="0px" + y="0px" + width="96.114998" + height="94.002548" + viewBox="0 0 96.114999 94.002552" + enable-background="new 0 0 99.572 99.993" + xml:space="preserve" + inkscape:version="0.48.3.1 r9886" + sodipodi:docname="easy_climbing.svg"><metadata + id="metadata2876"><rdf:RDF><cc:Work + rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs + id="defs2874"><inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 49.996498 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="99.571999 : 49.996498 : 1" + inkscape:persp3d-origin="49.785999 : 33.330999 : 1" + id="perspective2878" /></defs><sodipodi:namedview + pagecolor="#009674" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="1" + inkscape:pageshadow="2" + inkscape:window-width="1317" + inkscape:window-height="744" + id="namedview2872" + showgrid="false" + inkscape:zoom="3.3377778" + inkscape:cx="46.452495" + inkscape:cy="45.214888" + inkscape:window-x="49" + inkscape:window-y="24" + inkscape:window-maximized="1" + inkscape:current-layer="Layer_1" + fit-margin-top="0" + fit-margin-left="0" + fit-margin-right="0" + fit-margin-bottom="0" /> + +<path + d="m 77.215999,51.217552 7.57,-1.002 6.642,-27.295 4.687,0.25 0,66.571 c 0,2.356 -1.904,4.261003 -4.26,4.261003 L 2.1299988,93.927555 -1.1822193e-6,84.804552 23.584999,79.566552 l 3.685,-8.748 21.756,-7.77 16.636,7.369 6.392,-2.081 5.162,-17.119 z" + id="path2866" + style="fill:#ffffff" + inkscape:connector-curvature="0" /> +<g + id="g2986" + transform="matrix(0.74143286,0,0,0.74143286,0.25199462,0)"><path + style="fill:#ffffff" + id="path2864" + d="m 11.271,42.81 c -0.451,0.927 -0.777,1.955 -0.952,3.058 -0.075,0.552 -0.126,1.103 -0.126,1.654 l 0.401,25.259 -8.723,18.798 c -0.301,0.552 -0.526,1.203 -0.626,1.88 -0.477,3.107 1.654,5.99 4.762,6.467 2.406,0.376 4.712,-0.853 5.815,-2.883 l 9.6,-20.553 c 0.2,-0.477 0.376,-0.978 0.451,-1.529 0.024,-0.25 0.05,-0.525 0.05,-0.776 l -0.075,-15.608 14.738,6.435 2.381,15.265 c 0.477,2.23 2.306,4.01 4.688,4.386 3.107,0.451 5.99,-1.679 6.466,-4.763 0.075,-0.525 0.075,-1.053 0.025,-1.553 L 47.238,59.93 c -0.352,-1.78 -1.529,-3.309 -3.184,-4.086 l -13.184,-5.865 8.396,-14.613 4.161,5.289 c 0.426,0.477 0.977,0.877 1.604,1.128 l 15.866,4.637 c 2.105,0.451 4.261,-0.652 5.088,-2.682 0.928,-2.306 -0.176,-4.913 -2.456,-5.84 -0.075,-0.025 -0.15,-0.05 -0.226,-0.075 L 49.517,33.762 39.143,21.305 C 37.588,19.651 35.508,18.473 33.102,18.097 28.891,17.47 24.906,19.475 22.8,22.884 L 11.271,42.81 z" + inkscape:connector-curvature="0" /><path + style="fill:#ffffff" + id="path2868" + d="m 38.24,16.994 c 4.687,0 8.496,-3.81 8.496,-8.497 C 46.736,3.81 42.927,0 38.24,0 c -4.688,0 -8.497,3.81 -8.497,8.497 0,4.687 3.81,8.497 8.497,8.497 z" + inkscape:connector-curvature="0" /></g> + +<g + transform="matrix(0.44375412,0,0,0.44375412,51.851618,11.258457)" + id="g2986-6"><path + inkscape:connector-curvature="0" + style="fill:#ffffff" + id="path2864-9" + d="m 11.271,42.81 c -0.451,0.927 -0.777,1.955 -0.952,3.058 -0.075,0.552 -0.126,1.103 -0.126,1.654 l 0.401,25.259 -8.723,18.798 c -0.301,0.552 -0.526,1.203 -0.626,1.88 -0.477,3.107 1.654,5.99 4.762,6.467 2.406,0.376 4.712,-0.853 5.815,-2.883 l 9.6,-20.553 c 0.2,-0.477 0.376,-0.978 0.451,-1.529 0.024,-0.25 0.05,-0.525 0.05,-0.776 l -0.075,-15.608 14.738,6.435 2.381,15.265 c 0.477,2.23 2.306,4.01 4.688,4.386 3.107,0.451 5.99,-1.679 6.466,-4.763 0.075,-0.525 0.075,-1.053 0.025,-1.553 L 47.238,59.93 c -0.352,-1.78 -1.529,-3.309 -3.184,-4.086 l -13.184,-5.865 8.396,-14.613 4.161,5.289 c 0.426,0.477 0.977,0.877 1.604,1.128 l 15.866,4.637 c 2.105,0.451 4.261,-0.652 5.088,-2.682 0.928,-2.306 -0.176,-4.913 -2.456,-5.84 -0.075,-0.025 -0.15,-0.05 -0.226,-0.075 L 49.517,33.762 39.143,21.305 C 37.588,19.651 35.508,18.473 33.102,18.097 28.891,17.47 24.906,19.475 22.8,22.884 L 11.271,42.81 z" /><path + inkscape:connector-curvature="0" + style="fill:#ffffff" + id="path2868-3" + d="m 38.24,16.994 c 4.687,0 8.496,-3.81 8.496,-8.497 C 46.736,3.81 42.927,0 38.24,0 c -4.688,0 -8.497,3.81 -8.497,8.497 0,4.687 3.81,8.497 8.497,8.497 z" /></g></svg>
\ No newline at end of file diff --git a/main/res/drawable-mdpi/attribute_easy_climbing.png b/main/res/drawable-mdpi/attribute_easy_climbing.png Binary files differnew file mode 100644 index 0000000..ecf10b8 --- /dev/null +++ b/main/res/drawable-mdpi/attribute_easy_climbing.png diff --git a/main/res/drawable/favourite_background_dark.xml b/main/res/drawable/favorite_background_dark.xml index b8aa8d3..b8aa8d3 100644 --- a/main/res/drawable/favourite_background_dark.xml +++ b/main/res/drawable/favorite_background_dark.xml diff --git a/main/res/drawable/favourite_background_green_dark.xml b/main/res/drawable/favorite_background_green_dark.xml index 3e1b545..3e1b545 100644 --- a/main/res/drawable/favourite_background_green_dark.xml +++ b/main/res/drawable/favorite_background_green_dark.xml diff --git a/main/res/drawable/favourite_background_green_light.xml b/main/res/drawable/favorite_background_green_light.xml index a2070e7..a2070e7 100644 --- a/main/res/drawable/favourite_background_green_light.xml +++ b/main/res/drawable/favorite_background_green_light.xml diff --git a/main/res/drawable/favourite_background_light.xml b/main/res/drawable/favorite_background_light.xml index 60c0b2c..60c0b2c 100644 --- a/main/res/drawable/favourite_background_light.xml +++ b/main/res/drawable/favorite_background_light.xml diff --git a/main/res/drawable/favourite_background_orange_dark.xml b/main/res/drawable/favorite_background_orange_dark.xml index 8730487..8730487 100644 --- a/main/res/drawable/favourite_background_orange_dark.xml +++ b/main/res/drawable/favorite_background_orange_dark.xml diff --git a/main/res/drawable/favourite_background_orange_light.xml b/main/res/drawable/favorite_background_orange_light.xml index 89ef726..89ef726 100644 --- a/main/res/drawable/favourite_background_orange_light.xml +++ b/main/res/drawable/favorite_background_orange_light.xml diff --git a/main/res/drawable/favourite_background_red_dark.xml b/main/res/drawable/favorite_background_red_dark.xml index 2fb580e..2fb580e 100644 --- a/main/res/drawable/favourite_background_red_dark.xml +++ b/main/res/drawable/favorite_background_red_dark.xml diff --git a/main/res/drawable/favourite_background_red_light.xml b/main/res/drawable/favorite_background_red_light.xml index b16cb92..b16cb92 100644 --- a/main/res/drawable/favourite_background_red_light.xml +++ b/main/res/drawable/favorite_background_red_light.xml diff --git a/main/res/layout-land/coords.xml b/main/res/layout-land/coords.xml index 1388187..30cc6b5 100644 --- a/main/res/layout-land/coords.xml +++ b/main/res/layout-land/coords.xml @@ -11,12 +11,7 @@ style="@style/action_bar_title" android:text="@string/cache_coordinates" /> - <View style="@style/action_bar_separator" /> - - <ImageView - android:id="@+id/actionBarManualbutton" - style="@style/action_bar_action" - android:src="@drawable/actionbar_manual" /> + <include layout="@layout/actionbar_button_manual"/> </LinearLayout> <ScrollView diff --git a/main/res/layout-land/navigate.xml b/main/res/layout-land/navigate.xml index aa8b2b4..d2f39b1 100644 --- a/main/res/layout-land/navigate.xml +++ b/main/res/layout-land/navigate.xml @@ -5,23 +5,7 @@ android:background="?background_color" android:orientation="vertical" > - <LinearLayout style="@style/action_bar" > - - <ImageView - style="@style/action_bar_action" - android:onClick="goHome" /> - - <View style="@style/action_bar_separator" /> - - <TextView style="@style/action_bar_title" /> - - <View style="@style/action_bar_separator" /> - - <ImageView - style="@style/action_bar_action" - android:onClick="goManual" - android:src="@drawable/actionbar_manual" /> - </LinearLayout> + <include layout="@layout/actionbar_with_manual" /> <LinearLayout android:layout_width="fill_parent" diff --git a/main/res/layout/about_activity.xml b/main/res/layout/about_activity.xml index 9325ea0..b0de7ea 100644 --- a/main/res/layout/about_activity.xml +++ b/main/res/layout/about_activity.xml @@ -5,16 +5,7 @@ android:background="?background_color" android:orientation="vertical" > - <LinearLayout style="@style/action_bar" > - - <ImageView - style="@style/action_bar_action" - android:onClick="goHome" /> - - <View style="@style/action_bar_separator" /> - - <TextView style="@style/action_bar_title" /> - </LinearLayout> + <include layout="@layout/actionbar"/> <ScrollView android:layout_width="fill_parent" diff --git a/main/res/layout/actionbar.xml b/main/res/layout/actionbar.xml new file mode 100644 index 0000000..9a3efa0 --- /dev/null +++ b/main/res/layout/actionbar.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + style="@style/action_bar" > + + <include layout="@layout/actionbar_title"/> +</LinearLayout>
\ No newline at end of file diff --git a/main/res/layout/actionbar_button_compass.xml b/main/res/layout/actionbar_button_compass.xml new file mode 100644 index 0000000..932444b --- /dev/null +++ b/main/res/layout/actionbar_button_compass.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="utf-8"?> +<merge xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" > + + <View style="@style/action_bar_separator" /> + + <ImageView + android:id="@+id/defaultNavigation" + style="@style/action_bar_action" + android:longClickable="true" + android:onClick="goDefaultNavigation" + android:src="@drawable/actionbar_compass_dark" /> + +</merge>
\ No newline at end of file diff --git a/main/res/layout/actionbar_button_manual.xml b/main/res/layout/actionbar_button_manual.xml new file mode 100644 index 0000000..86965f1 --- /dev/null +++ b/main/res/layout/actionbar_button_manual.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<merge xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" > + + <View style="@style/action_bar_separator" /> + + <ImageView + android:id="@+id/action_bar_manual" + style="@style/action_bar_action" + android:onClick="goManual" + android:src="@drawable/actionbar_manual" /> + +</merge>
\ No newline at end of file diff --git a/main/res/layout/actionbar_button_map.xml b/main/res/layout/actionbar_button_map.xml new file mode 100644 index 0000000..9b2138a --- /dev/null +++ b/main/res/layout/actionbar_button_map.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<merge xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" > + + <View style="@style/action_bar_separator" /> + + <ImageView + style="@style/action_bar_action" + android:onClick="goMap" + android:src="@drawable/actionbar_map" /> + +</merge>
\ No newline at end of file diff --git a/main/res/layout/actionbar_button_myposition.xml b/main/res/layout/actionbar_button_myposition.xml new file mode 100644 index 0000000..3604345 --- /dev/null +++ b/main/res/layout/actionbar_button_myposition.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<merge xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" > + + <View style="@style/action_bar_separator" /> + + <ImageSwitcher + android:id="@+id/my_position" + style="@style/action_bar_action" /> + +</merge>
\ No newline at end of file diff --git a/main/res/layout/actionbar_button_search.xml b/main/res/layout/actionbar_button_search.xml new file mode 100644 index 0000000..2aa1a50 --- /dev/null +++ b/main/res/layout/actionbar_button_search.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<merge xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" > + + <View style="@style/action_bar_separator" /> + + <ImageView + style="@style/action_bar_action" + android:onClick="goSearch" + android:src="@drawable/actionbar_search" /> + +</merge>
\ No newline at end of file diff --git a/main/res/layout/actionbar_progress.xml b/main/res/layout/actionbar_progress.xml new file mode 100644 index 0000000..a39d103 --- /dev/null +++ b/main/res/layout/actionbar_progress.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<ProgressBar xmlns:android="http://schemas.android.com/apk/res/android" + style="@style/action_bar_progress" + android:visibility="gone" android:id="@+id/actionbar_progress"/>
\ No newline at end of file diff --git a/main/res/layout/actionbar_title.xml b/main/res/layout/actionbar_title.xml new file mode 100644 index 0000000..4fa5348 --- /dev/null +++ b/main/res/layout/actionbar_title.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<merge xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" > + + <ImageView + style="@style/action_bar_action" + android:onClick="goHome" /> + + <View style="@style/action_bar_separator" /> + + <TextView + android:id="@+id/actionbar_title" + style="@style/action_bar_title" /> + +</merge>
\ No newline at end of file diff --git a/main/res/layout/actionbar_with_manual.xml b/main/res/layout/actionbar_with_manual.xml new file mode 100644 index 0000000..d56c14e --- /dev/null +++ b/main/res/layout/actionbar_with_manual.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + style="@style/action_bar" > + + <include layout="@layout/actionbar_title"/> + + <include layout="@layout/actionbar_button_manual"/> + +</LinearLayout>
\ No newline at end of file diff --git a/main/res/layout/addresses.xml b/main/res/layout/addresses.xml index 2be131d..08f5bc1 100644 --- a/main/res/layout/addresses.xml +++ b/main/res/layout/addresses.xml @@ -4,16 +4,7 @@ android:layout_height="fill_parent" android:orientation="vertical" > - <LinearLayout style="@style/action_bar" > - - <ImageView - style="@style/action_bar_action" - android:onClick="goHome" /> - - <View style="@style/action_bar_separator" /> - - <TextView style="@style/action_bar_title" /> - </LinearLayout> + <include layout="@layout/actionbar"/> <ListView android:id="@android:id/list" diff --git a/main/res/layout/cache_image_item.xml b/main/res/layout/cache_image_item.xml index 7ed4782..3e025e1 100644 --- a/main/res/layout/cache_image_item.xml +++ b/main/res/layout/cache_image_item.xml @@ -27,4 +27,10 @@ android:textSize="14dip" android:visibility="gone" /> + <ProgressBar + android:id="@+id/progress_bar" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + style="@android:style/Widget.ProgressBar.Small"/> + </LinearLayout>
\ No newline at end of file diff --git a/main/res/layout/caches.xml b/main/res/layout/caches.xml index 147a596..dea9357 100644 --- a/main/res/layout/caches.xml +++ b/main/res/layout/caches.xml @@ -6,34 +6,13 @@ <LinearLayout style="@style/action_bar" > - <ImageView - style="@style/action_bar_action" - android:onClick="goHome" /> + <include layout="@layout/actionbar_title" /> + + <include layout="@layout/actionbar_progress" /> + + <include layout="@layout/actionbar_button_map" /> - <View style="@style/action_bar_separator" /> - - <TextView - style="@style/action_bar_title" - android:clickable="true" - android:onClick="selectList" /> - - <ProgressBar - style="@style/action_bar_progress" - android:visibility="gone" /> - - <View style="@style/action_bar_separator" /> - - <ImageView - style="@style/action_bar_action" - android:onClick="goMap" - android:src="@drawable/actionbar_map" /> - - <View style="@style/action_bar_separator" /> - - <ImageView - style="@style/action_bar_action" - android:onClick="goManual" - android:src="@drawable/actionbar_manual" /> + <include layout="@layout/actionbar_button_manual" /> </LinearLayout> <include layout="@layout/filter_bar" /> diff --git a/main/res/layout/caches_item.xml b/main/res/layout/caches_item.xml index e3b861c..d4e7b27 100644 --- a/main/res/layout/caches_item.xml +++ b/main/res/layout/caches_item.xml @@ -159,14 +159,14 @@ android:src="@drawable/trackable_all" /> <TextView - android:id="@+id/favourite" + android:id="@+id/favorite" android:layout_width="35dip" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:layout_gravity="center" android:layout_marginTop="22dip" - android:background="?favourite" + android:background="?favorite" android:ellipsize="marquee" android:gravity="center" android:lines="1" diff --git a/main/res/layout/cacheview.xml b/main/res/layout/cacheview.xml index 89d7152..ec30672 100644 --- a/main/res/layout/cacheview.xml +++ b/main/res/layout/cacheview.xml @@ -8,29 +8,11 @@ <LinearLayout style="@style/action_bar" >
- <ImageView
- style="@style/action_bar_action"
- android:onClick="goHome" />
+ <include layout="@layout/actionbar_title" />
- <View style="@style/action_bar_separator" />
+ <include layout="@layout/actionbar_button_compass" />
- <TextView style="@style/action_bar_title" />
-
- <View style="@style/action_bar_separator" />
-
- <ImageView
- android:id="@+id/defaultNavigation"
- style="@style/action_bar_action"
- android:longClickable="true"
- android:onClick="startDefaultNavigation"
- android:src="@drawable/actionbar_compass_dark" />
-
- <View style="@style/action_bar_separator" />
-
- <ImageView
- style="@style/action_bar_action"
- android:onClick="goManual"
- android:src="@drawable/actionbar_manual" />
+ <include layout="@layout/actionbar_button_manual" />
</LinearLayout>
<android.support.v4.view.ViewPager
diff --git a/main/res/layout/coords.xml b/main/res/layout/coords.xml index ddb2f4e..229cffe 100644 --- a/main/res/layout/coords.xml +++ b/main/res/layout/coords.xml @@ -5,19 +5,7 @@ android:layout_height="wrap_content" android:orientation="vertical" > - <LinearLayout style="@style/action_bar" > - - <TextView - style="@style/action_bar_title" - android:text="@string/cache_coordinates" /> - - <View style="@style/action_bar_separator" /> - - <ImageView - android:id="@+id/actionBarManualbutton" - style="@style/action_bar_action" - android:src="@drawable/actionbar_manual" /> - </LinearLayout> + <include layout="@layout/actionbar_with_manual"/> <ScrollView android:id="@+id/scroller" diff --git a/main/res/layout/edit_waypoint_activity.xml b/main/res/layout/edit_waypoint_activity.xml index 3fbd19e..c2751d1 100644 --- a/main/res/layout/edit_waypoint_activity.xml +++ b/main/res/layout/edit_waypoint_activity.xml @@ -5,23 +5,7 @@ android:background="?background_color" android:orientation="vertical" > - <LinearLayout style="@style/action_bar" > - - <ImageView - style="@style/action_bar_action" - android:onClick="goHome" /> - - <View style="@style/action_bar_separator" /> - - <TextView style="@style/action_bar_title" /> - - <View style="@style/action_bar_separator" /> - - <ImageView - style="@style/action_bar_action" - android:onClick="goManual" - android:src="@drawable/actionbar_manual" /> - </LinearLayout> + <include layout="@layout/actionbar_with_manual"/> <ScrollView android:layout_width="fill_parent" diff --git a/main/res/layout/fragment_edit_note.xml b/main/res/layout/fragment_edit_note.xml new file mode 100644 index 0000000..68e2b2c --- /dev/null +++ b/main/res/layout/fragment_edit_note.xml @@ -0,0 +1,15 @@ +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/edit_note" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:orientation="vertical"> + + <EditText + android:id="@+id/note" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:inputType="text" + android:imeOptions="actionDone"/> +</LinearLayout> diff --git a/main/res/layout/gpx.xml b/main/res/layout/gpx.xml index 2be131d..08f5bc1 100644 --- a/main/res/layout/gpx.xml +++ b/main/res/layout/gpx.xml @@ -4,16 +4,7 @@ android:layout_height="fill_parent" android:orientation="vertical" > - <LinearLayout style="@style/action_bar" > - - <ImageView - style="@style/action_bar_action" - android:onClick="goHome" /> - - <View style="@style/action_bar_separator" /> - - <TextView style="@style/action_bar_title" /> - </LinearLayout> + <include layout="@layout/actionbar"/> <ListView android:id="@android:id/list" diff --git a/main/res/layout/init.xml b/main/res/layout/init.xml index 26137fc..c948629 100644 --- a/main/res/layout/init.xml +++ b/main/res/layout/init.xml @@ -5,23 +5,7 @@ android:background="?background_color" android:orientation="vertical" > - <LinearLayout style="@style/action_bar" > - - <ImageView - style="@style/action_bar_action" - android:onClick="goHome" /> - - <View style="@style/action_bar_separator" /> - - <TextView style="@style/action_bar_title" /> - - <View style="@style/action_bar_separator" /> - - <ImageView - style="@style/action_bar_action" - android:onClick="goManual" - android:src="@drawable/actionbar_manual" /> - </LinearLayout> + <include layout="@layout/actionbar_with_manual" /> <ScrollView android:layout_width="fill_parent" diff --git a/main/res/layout/main.xml b/main/res/layout/main.xml index 0f9aff0..e4aa9cc 100644 --- a/main/res/layout/main.xml +++ b/main/res/layout/main.xml @@ -13,19 +13,9 @@ <TextView style="@style/action_bar_title" /> - <View style="@style/action_bar_separator" /> + <include layout="@layout/actionbar_button_search"/> - <ImageView - style="@style/action_bar_action" - android:onClick="goSearch" - android:src="@drawable/actionbar_search" /> - - <View style="@style/action_bar_separator" /> - - <ImageView - style="@style/action_bar_action" - android:onClick="goManual" - android:src="@drawable/actionbar_manual" /> + <include layout="@layout/actionbar_button_manual"/> </LinearLayout> <fragment diff --git a/main/res/layout/map_google.xml b/main/res/layout/map_google.xml index 723b7157..7b116c9 100644 --- a/main/res/layout/map_google.xml +++ b/main/res/layout/map_google.xml @@ -6,30 +6,13 @@ <LinearLayout style="@style/action_bar" > - <ImageView - style="@style/action_bar_action" - android:onClick="goHome" /> + <include layout="@layout/actionbar_title"/> - <View style="@style/action_bar_separator" /> + <include layout="@layout/actionbar_progress" /> - <TextView style="@style/action_bar_title" /> - - <ProgressBar - style="@style/action_bar_progress" - android:visibility="gone" /> - - <View style="@style/action_bar_separator" /> - - <ImageSwitcher - android:id="@+id/my_position" - style="@style/action_bar_action" /> - - <View style="@style/action_bar_separator" /> - - <ImageView - style="@style/action_bar_action" - android:onClick="goManual" - android:src="@drawable/actionbar_manual" /> + <include layout="@layout/actionbar_button_myposition"/> + + <include layout="@layout/actionbar_button_manual"/> </LinearLayout> <include layout="@layout/filter_bar" /> diff --git a/main/res/layout/map_mapsforge.xml b/main/res/layout/map_mapsforge.xml index f3b183e..27d6e0d 100644 --- a/main/res/layout/map_mapsforge.xml +++ b/main/res/layout/map_mapsforge.xml @@ -6,30 +6,13 @@ <LinearLayout style="@style/action_bar" > - <ImageView - style="@style/action_bar_action" - android:onClick="goHome" /> + <include layout="@layout/actionbar_title"/> - <View style="@style/action_bar_separator" /> + <include layout="@layout/actionbar_progress" /> - <TextView style="@style/action_bar_title" /> + <include layout="@layout/actionbar_button_myposition"/> - <ProgressBar - style="@style/action_bar_progress" - android:visibility="gone" /> - - <View style="@style/action_bar_separator" /> - - <ImageSwitcher - android:id="@+id/my_position" - style="@style/action_bar_action" /> - - <View style="@style/action_bar_separator" /> - - <ImageView - style="@style/action_bar_action" - android:onClick="goManual" - android:src="@drawable/actionbar_manual" /> + <include layout="@layout/actionbar_button_manual"/> </LinearLayout> <include layout="@layout/filter_bar" /> diff --git a/main/res/layout/map_mapsforge_old.xml b/main/res/layout/map_mapsforge_old.xml index 44b3387..f2cb175 100644 --- a/main/res/layout/map_mapsforge_old.xml +++ b/main/res/layout/map_mapsforge_old.xml @@ -6,30 +6,13 @@ <LinearLayout style="@style/action_bar" > - <ImageView - style="@style/action_bar_action" - android:onClick="goHome" /> + <include layout="@layout/actionbar_title"/> - <View style="@style/action_bar_separator" /> + <include layout="@layout/actionbar_progress" /> - <TextView style="@style/action_bar_title" /> - - <ProgressBar - style="@style/action_bar_progress" - android:visibility="gone" /> - - <View style="@style/action_bar_separator" /> - - <ImageSwitcher - android:id="@+id/my_position" - style="@style/action_bar_action" /> - - <View style="@style/action_bar_separator" /> - - <ImageView - style="@style/action_bar_action" - android:onClick="goManual" - android:src="@drawable/actionbar_manual" /> + <include layout="@layout/actionbar_button_myposition"/> + + <include layout="@layout/actionbar_button_manual"/> </LinearLayout> <include layout="@layout/filter_bar" /> diff --git a/main/res/layout/map_static.xml b/main/res/layout/map_static.xml index ff0435c..edf6c6e 100644 --- a/main/res/layout/map_static.xml +++ b/main/res/layout/map_static.xml @@ -4,16 +4,7 @@ android:layout_height="fill_parent" android:orientation="vertical" > - <LinearLayout style="@style/action_bar" > - - <ImageView - style="@style/action_bar_action" - android:onClick="goHome" /> - - <View style="@style/action_bar_separator" /> - - <TextView style="@style/action_bar_title" /> - </LinearLayout> + <include layout="@layout/actionbar"/> <ScrollView android:layout_width="fill_parent" diff --git a/main/res/layout/navigate.xml b/main/res/layout/navigate.xml index 0c95958..4486884 100644 --- a/main/res/layout/navigate.xml +++ b/main/res/layout/navigate.xml @@ -5,23 +5,7 @@ android:background="?background_color" android:orientation="vertical" > - <LinearLayout style="@style/action_bar" > - - <ImageView - style="@style/action_bar_action" - android:onClick="goHome" /> - - <View style="@style/action_bar_separator" /> - - <TextView style="@style/action_bar_title" /> - - <View style="@style/action_bar_separator" /> - - <ImageView - style="@style/action_bar_action" - android:onClick="goManual" - android:src="@drawable/actionbar_manual" /> - </LinearLayout> + <include layout="@layout/actionbar_with_manual" /> <RelativeLayout android:layout_width="fill_parent" diff --git a/main/res/layout/point.xml b/main/res/layout/point.xml index 3c133d8..5297d6d 100644 --- a/main/res/layout/point.xml +++ b/main/res/layout/point.xml @@ -5,23 +5,7 @@ android:background="?background_color" android:orientation="vertical" > - <LinearLayout style="@style/action_bar" > - - <ImageView - style="@style/action_bar_action" - android:onClick="goHome" /> - - <View style="@style/action_bar_separator" /> - - <TextView style="@style/action_bar_title" /> - - <View style="@style/action_bar_separator" /> - - <ImageView - style="@style/action_bar_action" - android:onClick="goManual" - android:src="@drawable/actionbar_manual" /> - </LinearLayout> + <include layout="@layout/actionbar_with_manual" /> <ListView android:id="@+id/historyList" diff --git a/main/res/layout/popup.xml b/main/res/layout/popup.xml index ff64c91..97c1367 100644 --- a/main/res/layout/popup.xml +++ b/main/res/layout/popup.xml @@ -7,25 +7,13 @@ <LinearLayout style="@style/action_bar" > - <TextView style="@style/action_bar_title" /> - - <View style="@style/action_bar_separator" /> - - <ImageView - android:id="@+id/defaultNavigation" - style="@style/action_bar_action" - android:longClickable="true" - android:onClick="goDefaultNavigation" - android:src="@drawable/actionbar_compass_dark" /> - - <View - android:id="@+id/separator" - style="@style/action_bar_separator" /> - - <ImageView - style="@style/action_bar_action" - android:onClick="goManual" - android:src="@drawable/actionbar_manual" /> + <TextView + android:id="@+id/actionbar_title" + style="@style/action_bar_title" /> + + <include layout="@layout/actionbar_button_compass"/> + + <include layout="@layout/actionbar_button_manual"/> </LinearLayout> <ScrollView diff --git a/main/res/layout/search.xml b/main/res/layout/search.xml index 6d0bf91..449ad5d 100644 --- a/main/res/layout/search.xml +++ b/main/res/layout/search.xml @@ -6,23 +6,7 @@ android:background="?background_color" android:orientation="vertical" > - <LinearLayout style="@style/action_bar" > - - <ImageView - style="@style/action_bar_action" - android:onClick="goHome" /> - - <View style="@style/action_bar_separator" /> - - <TextView style="@style/action_bar_title" /> - - <View style="@style/action_bar_separator" /> - - <ImageView - style="@style/action_bar_action" - android:onClick="goManual" - android:src="@drawable/actionbar_manual" /> - </LinearLayout> + <include layout="@layout/actionbar_with_manual" /> <ScrollView android:layout_width="fill_parent" diff --git a/main/res/layout/spoilers.xml b/main/res/layout/spoilers.xml index 233972a..2027b7a 100644 --- a/main/res/layout/spoilers.xml +++ b/main/res/layout/spoilers.xml @@ -5,16 +5,7 @@ android:background="?background_color" android:orientation="vertical" > - <LinearLayout style="@style/action_bar" > - - <ImageView - style="@style/action_bar_action" - android:onClick="goHome" /> - - <View style="@style/action_bar_separator" /> - - <TextView style="@style/action_bar_title" /> - </LinearLayout> + <include layout="@layout/actionbar"/> <include layout="@layout/caches_images" /> diff --git a/main/res/layout/touch.xml b/main/res/layout/touch.xml index 09a8033..17553d1 100644 --- a/main/res/layout/touch.xml +++ b/main/res/layout/touch.xml @@ -7,24 +7,11 @@ <LinearLayout style="@style/action_bar" > - <ImageView - style="@style/action_bar_action" - android:onClick="goHome" /> + <include layout="@layout/actionbar_title"/> - <View style="@style/action_bar_separator" /> + <include layout="@layout/actionbar_progress" /> - <TextView style="@style/action_bar_title" /> - - <View style="@style/action_bar_separator" /> - - <ProgressBar - style="@style/action_bar_progress" - android:visibility="gone" /> - - <ImageView - style="@style/action_bar_action" - android:onClick="goManual" - android:src="@drawable/actionbar_manual" /> + <include layout="@layout/actionbar_button_manual"/> </LinearLayout> <ScrollView diff --git a/main/res/layout/trackable_activity.xml b/main/res/layout/trackable_activity.xml index fe61409..f0176fc 100644 --- a/main/res/layout/trackable_activity.xml +++ b/main/res/layout/trackable_activity.xml @@ -6,23 +6,7 @@ android:background="?background_color"
android:orientation="vertical" >
- <LinearLayout style="@style/action_bar" >
-
- <ImageView
- style="@style/action_bar_action"
- android:onClick="goHome" />
-
- <View style="@style/action_bar_separator" />
-
- <TextView style="@style/action_bar_title" />
-
- <View style="@style/action_bar_separator" />
-
- <ImageView
- style="@style/action_bar_action"
- android:onClick="goManual"
- android:src="@drawable/actionbar_manual" />
- </LinearLayout>
+ <include layout="@layout/actionbar_with_manual" />
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
diff --git a/main/res/layout/twitter_authorization_activity.xml b/main/res/layout/twitter_authorization_activity.xml index 97c2236..ec9aa8a 100644 --- a/main/res/layout/twitter_authorization_activity.xml +++ b/main/res/layout/twitter_authorization_activity.xml @@ -5,16 +5,7 @@ android:orientation="vertical" android:visibility="visible" > - <LinearLayout style="@style/action_bar" > - - <ImageView - style="@style/action_bar_action" - android:onClick="goHome" /> - - <View style="@style/action_bar_separator" /> - - <TextView style="@style/action_bar_title" /> - </LinearLayout> + <include layout="@layout/actionbar"/> <ScrollView android:layout_width="fill_parent" diff --git a/main/res/layout/useful_apps.xml b/main/res/layout/useful_apps.xml index 2a3d14e..8fd73bf 100644 --- a/main/res/layout/useful_apps.xml +++ b/main/res/layout/useful_apps.xml @@ -5,16 +5,7 @@ android:background="?background_color" android:orientation="vertical" > - <LinearLayout style="@style/action_bar" > - - <ImageView - style="@style/action_bar_action" - android:onClick="goHome" /> - - <View style="@style/action_bar_separator" /> - - <TextView style="@style/action_bar_title" /> - </LinearLayout> + <include layout="@layout/actionbar"/> <ScrollView android:layout_width="fill_parent" diff --git a/main/res/layout/visit.xml b/main/res/layout/visit.xml index 43a3308..ed32d25 100644 --- a/main/res/layout/visit.xml +++ b/main/res/layout/visit.xml @@ -7,24 +7,11 @@ <LinearLayout style="@style/action_bar" > - <ImageView - style="@style/action_bar_action" - android:onClick="goHome" /> + <include layout="@layout/actionbar_title"/> - <View style="@style/action_bar_separator" /> + <include layout="@layout/actionbar_progress" /> - <TextView style="@style/action_bar_title" /> - - <View style="@style/action_bar_separator" /> - - <ProgressBar - style="@style/action_bar_progress" - android:visibility="gone" /> - - <ImageView - style="@style/action_bar_action" - android:onClick="goManual" - android:src="@drawable/actionbar_manual" /> + <include layout="@layout/actionbar_button_manual"/> </LinearLayout> <ScrollView diff --git a/main/res/layout/visit_image.xml b/main/res/layout/visit_image.xml index 7997406..d39d5ae 100644 --- a/main/res/layout/visit_image.xml +++ b/main/res/layout/visit_image.xml @@ -7,24 +7,11 @@ <LinearLayout style="@style/action_bar" > - <ImageView - style="@style/action_bar_action" - android:onClick="goHome" /> + <include layout="@layout/actionbar_title"/> - <View style="@style/action_bar_separator" /> + <include layout="@layout/actionbar_progress" /> - <TextView style="@style/action_bar_title" /> - - <View style="@style/action_bar_separator" /> - - <ProgressBar - style="@style/action_bar_progress" - android:visibility="gone" /> - - <ImageView - style="@style/action_bar_action" - android:onClick="goManual" - android:src="@drawable/actionbar_manual" /> + <include layout="@layout/actionbar_button_manual"/> </LinearLayout> <ScrollView @@ -98,6 +85,13 @@ android:minLines="5" android:singleLine="false" /> + <Spinner + android:id="@+id/logImageScale" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:prompt="@string/log_image_scale" + android:entries="@array/log_image_scales"/> + <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" diff --git a/main/res/layout/waypoint_popup.xml b/main/res/layout/waypoint_popup.xml index 869ffa0..c2b2af8 100644 --- a/main/res/layout/waypoint_popup.xml +++ b/main/res/layout/waypoint_popup.xml @@ -7,25 +7,13 @@ <LinearLayout style="@style/action_bar" > - <TextView style="@style/action_bar_title" /> + <TextView + android:id="@+id/actionbar_title" + style="@style/action_bar_title" /> - <View style="@style/action_bar_separator" /> - - <ImageView - android:id="@+id/defaultNavigation" - style="@style/action_bar_action" - android:longClickable="true" - android:onClick="goDefaultNavigation" - android:src="@drawable/actionbar_compass_dark" /> - - <View - android:id="@+id/separator" - style="@style/action_bar_separator" /> - - <ImageView - style="@style/action_bar_action" - android:onClick="goManual" - android:src="@drawable/actionbar_manual" /> + <include layout="@layout/actionbar_button_compass"/> + + <include layout="@layout/actionbar_button_manual"/> </LinearLayout> <ScrollView diff --git a/main/res/values-cs/strings.xml b/main/res/values-cs/strings.xml index 5ea6fdd..ac75564 100644 --- a/main/res/values-cs/strings.xml +++ b/main/res/values-cs/strings.xml @@ -90,7 +90,7 @@ <string name="log_post">Odeslat Log</string> <string name="log_post_rate">Odeslat Log a hlasovat</string> <string name="log_post_no_rate">Odeslat Log a nehlasovat</string> - <string name="log_post_not_possible">Načítání stránky s Logy…</string> + <string name="log_post_not_possible">Načítání stránky s Logovacím formulářem…</string> <string name="log_add">Přidat</string> <string name="log_rating">Hodnocení</string> <string name="log_no_rating">Bez hodnocení</string> @@ -175,7 +175,7 @@ <string name="err_missing_device_name">Před registrací prosím zadej název zařízení.</string> <string name="err_favorite_failed">Označení oblíbenosti keše selhalo.</string> <string name="err_select_logimage_failed">Výběr obrázku pro zápis selhal.</string> - <string name="err_aquire_image_failed">Získání obrázku selhalo.</string> + <string name="err_acquire_image_failed">Získání obrázku selhalo.</string> <string name="err_tb_display">c:geo nemůže zobrazit sledovatelný předmět. Je to opravdu sledovatelný předmět?</string> <string name="err_tb_details_open">c:geo nemůže otevřít podrobnosti ke sledovatelnému předmětu.</string> @@ -323,7 +323,7 @@ <string name="caches_filter_track">Se sledovatelnými předměty</string> <string name="caches_filter_clear">Vymazat filtry</string> <string name="caches_filter_modified">S upravenými souřadnicemi</string> - <string name="caches_filter_origin">Originální</string> + <string name="caches_filter_origin">Původ keše</string> <string name="caches_removing_from_history">Čištění Historie…</string> <string name="caches_clear_offlinelogs">Smazat offline Logy</string> <string name="caches_clear_offlinelogs_progress">Mazání offline logů</string> @@ -409,7 +409,6 @@ <string name="init_offline_wp">Ukládat statické mapy k bodům trasy pro offline použití</string> <string name="init_save_log_img">Ukládat obrázky z logů</string> <string name="init_units">Používat imperiální jednotky vzdálenosti</string> - <string name="init_nav">Používat Google Navigaci</string> <string name="init_log_offline">Povolit Offline logování\n(Při logování nezobrazovat online logovací obrazovku a neodesílat Log na server)</string> <string name="init_choose_list">Ptát se na seznam pro uložení keše</string> <string name="init_livelist">Zobrazovat směr v seznamu keší</string> @@ -515,7 +514,6 @@ <string name="cache_attributes">Atributy</string> <string name="cache_inventory">Inventář</string> <string name="cache_log_offline">Offline Log</string> - <string name="cache_log_images_loading">Načítání obrázků z logů…</string> <string name="cache_log_images_title">Obrázky z Logů</string> <string name="cache_log_image_default_title">Fotografie</string> <string name="cache_personal_note">Osobní poznámka</string> @@ -554,7 +552,7 @@ <string name="cache_dialog_loading_details_status_gcvote">Načítání GCVote</string> <string name="cache_dialog_loading_details_status_elevation">Načítání údajů o nadmořské výšce</string> <string name="cache_dialog_loading_details_status_cache">Ukládání do mezipaměti</string> - <string name="cache_dialog_loading_details_status_render">Renderování zobrazení</string> + <string name="cache_dialog_loading_details_status_render">Vykreslování pohledu</string> <string name="cache_dialog_offline_save_title">Offline</string> <string name="cache_dialog_offline_save_message">Ukládání keše pro offline použití…</string> <string name="cache_dialog_offline_drop_title">Offline</string> @@ -565,10 +563,10 @@ <string name="cache_dialog_watchlist_add_message">Přidávání keše do tvého Watchlistu…</string> <string name="cache_dialog_watchlist_remove_title">Watchlist</string> <string name="cache_dialog_watchlist_remove_message">Odstraňování keše z tvého Watchlistu…</string> - <string name="cache_dialog_favourite_add_title">Oblíbené</string> - <string name="cache_dialog_favourite_add_message">Přidávání keše do Oblíbených…</string> - <string name="cache_dialog_favourite_remove_title">Oblíbené</string> - <string name="cache_dialog_favourite_remove_message">Odstraňování keše z Oblíbených…</string> + <string name="cache_dialog_favorite_add_title">Oblíbené</string> + <string name="cache_dialog_favorite_add_message">Přidávání keše do Oblíbených…</string> + <string name="cache_dialog_favorite_remove_title">Oblíbené</string> + <string name="cache_dialog_favorite_remove_message">Odstraňování keše z Oblíbených…</string> <string name="cache_menu_navigate">Navigovat</string> <string name="cache_menu_navigation_drive">Navigace (Řízení)</string> <string name="cache_menu_navigation_walk">Navigace (Chůze)</string> @@ -610,7 +608,7 @@ <string name="cache_rating">Hodnocení</string> <string name="cache_own_rating">Vlastní hodnocení</string> <string name="cache_rating_of">z</string> - <string name="cache_favourite">Oblíbená</string> + <string name="cache_favorite">Oblíbená</string> <string name="cache_owner">Zakladatel</string> <string name="cache_hidden">Skryta</string> <string name="cache_event">Datum</string> @@ -618,9 +616,7 @@ <string name="cache_coordinates">Souřadnice</string> <string name="cache_coordinates_original">Původní souřadnice</string> <string name="cache_spoiler_images_title">Obrázky s nápovědou</string> - <string name="cache_spoiler_images_loading">Načítání obrázků s nápovědou…</string> <string name="cache_images_title">Obrázky</string> - <string name="cache_images_loading">Načítání obrázků…</string> <string name="cache_log_types">Typy zápisů</string> <string name="cache_coordinates_no">Tato keš nemá souřadnice.</string> <string name="cache_clear_history">Vymazat historii</string> @@ -720,13 +716,6 @@ <string name="waypoint_coordinate_formats_plain">Prostý</string> - <!-- distance units --> - <string name="unit_m">m (Metry)</string> - <string name="unit_km">km (Kilometry)</string> - <string name="unit_ft">ft (Stopy)</string> - <string name="unit_yd">yd (Yardy)</string> - <string name="unit_mi">mi (Míle)</string> - <!-- visit --> <string name="visit_tweet">Oznámit nález na Twitteru</string> @@ -1062,7 +1051,6 @@ <string name="facebook">Facebook: <a href="http://www.facebook.com/pages/cgeo/297269860090">Stránka c:geo</a></string> <string name="twitter">Twitter: <a href="http://twitter.com/android_gc">@android_GC</a></string> <string name="nutshellmanual">Návod: <a href="http://manual.cgeo.org/">c:geo v Nutshell</a></string> - <string name="about_go4cache">Služba <b>Go 4 Cache</b> zobrazuje ostatní geokačery na mapě (v <b>c:geo</b> nebo v prohlížeči) v reálném čase. Může zobrazovat - na příklad - jakou keš zrovna hledají. Připojením se k <b>Go 4 Cache</b> získá aplikace <b>c:geo</b> povolení zveřejňovat tvou polohu při geocachingu (pouze když je <b>c:geo</b> spuštěno).</string> <string name="about_twitter">Má <b>c:geo</b> publikovat nový status na Twitteru vždy, když zaloguješ keš?</string> <string name="about_auth_1">Následující proces dovoluje aplikaci <b>c:geo</b> přístup na Twitter - pokud budeš souhlasit.</string> <string name="about_auth_2">Klepnutím na tlačítko \"Zahájit autorizaci\" bude proces zahájen. Tento proces otevře webový prohlížeč s Twitterem. Přihlaš se na této stránce a povol <b>c:geu</b> přístup k tvému účtu. Pokud je to povoleno, Twitter ti ukáže číselný PIN kód. Tento PIN kód musíš zadat do <b>c:geo</b> a potvrdit. To je vše.</string> diff --git a/main/res/values-de/strings.xml b/main/res/values-de/strings.xml index 87086ef..26fd2d3 100644 --- a/main/res/values-de/strings.xml +++ b/main/res/values-de/strings.xml @@ -125,7 +125,15 @@ <string name="log_image_camera">Neu</string> <string name="log_image_caption">Überschrift</string> <string name="log_image_description">Beschreibung</string> - + <string name="log_image_scale">Skalierung</string> + <string-array name="log_image_scales"> + <item>Keine Skalierung</item> + <item>512 px</item> + <item>640 px</item> + <item>800 px</item> + <item>1024 px</item> + </string-array> + <!-- translation --> <string name="translate_to_sys_lang">Übersetze in %s</string> <string name="translate_to_english">Übersetze in Englisch</string> @@ -502,7 +510,6 @@ <string name="cache_attributes">Attribute</string> <string name="cache_inventory">Inventar</string> <string name="cache_log_offline">Offline-Log</string> - <string name="cache_log_images_loading">Lade Logbild…</string> <string name="cache_log_images_title">Logbild</string> <string name="cache_log_image_default_title">Bild</string> <string name="cache_personal_note">Persönliche Notiz</string> @@ -551,10 +558,10 @@ <string name="cache_dialog_watchlist_add_message">Füge den Cache deiner Watchlist hinzu…</string> <string name="cache_dialog_watchlist_remove_title">Watchlist</string> <string name="cache_dialog_watchlist_remove_message">Entferne den Cache von deiner Watchlist…</string> - <string name="cache_dialog_favourite_add_title">Favorit</string> - <string name="cache_dialog_favourite_add_message">Füge den Cache als dein Favorit hinzu…</string> - <string name="cache_dialog_favourite_remove_title">Favorit</string> - <string name="cache_dialog_favourite_remove_message">Entferne den Cache von deinen Favoriten…</string> + <string name="cache_dialog_favorite_add_title">Favorit</string> + <string name="cache_dialog_favorite_add_message">Füge den Cache zu Favoriten hinzu…</string> + <string name="cache_dialog_favorite_remove_title">Favorit</string> + <string name="cache_dialog_favorite_remove_message">Entferne den Cache von deinen Favoriten…</string> <string name="cache_menu_navigate">Navigieren</string> <string name="cache_menu_navigation_drive">Navigation (Fahren)</string> <string name="cache_menu_navigation_walk">Navigation (Gehen)</string> @@ -585,6 +592,8 @@ <string name="cache_status_disabled">Deaktiviert</string> <string name="cache_status_premium">Nur für Premium-Mitglieder</string> <string name="cache_status_not_premium">Für alle Mitglieder</string> + <string name="cache_status_stored">Gespeichert</string> + <string name="cache_status_not_stored">Nicht gespeichert</string> <string name="cache_geocode">Geocode</string> <string name="cache_name">Name</string> <string name="cache_type">Typ</string> @@ -595,7 +604,7 @@ <string name="cache_rating">Bewertung</string> <string name="cache_own_rating">Eigene Bewertung</string> <string name="cache_rating_of">von</string> - <string name="cache_favourite">Favorit</string> + <string name="cache_favorite">Favorit</string> <string name="cache_owner">Besitzer</string> <string name="cache_hidden">Versteckt</string> <string name="cache_event">Zeitangabe</string> @@ -603,8 +612,6 @@ <string name="cache_coordinates">Koordinaten</string> <string name="cache_coordinates_original">Ursprüngliche Koordinaten</string> <string name="cache_spoiler_images_title">Hinweisbilder</string> - <string name="cache_spoiler_images_loading">Lade Hinweisbilder…</string> - <string name="cache_images_loading">Lade Bilder…</string> <string name="cache_log_types">Logs</string> <string name="cache_coordinates_no">Dieser Cache hat keine Koordinaten.</string> <string name="cache_clear_history">Verlauf leeren</string> @@ -704,13 +711,6 @@ <string name="waypoint_coordinate_formats_plain">Schlicht</string> -<!-- distance units --> - <string name="unit_m">m</string> - <string name="unit_km">km</string> - <string name="unit_ft">ft</string> - <string name="unit_yd">yd</string> - <string name="unit_mi">mi</string> - <!-- visit --> <string name="visit_tweet">Diesen Eintrag auf Twitter veröffentlichen</string> @@ -991,6 +991,8 @@ <string name="attribute_swamp_no">Nicht sumpfig / kein matschiges Gelände</string> <string name="attribute_hills_yes">Hügeliges Gelände</string> <string name="attribute_hills_no">Kein hügeliges Gelände</string> + <string name="attribute_easy_climbing_yes">Einfaches Klettern</string> + <string name="attribute_easy_climbing_no">Kein einfaches Klettern</string> <string name="attribute_poi_yes">Interessanter Ort</string> <string name="attribute_poi_no">Uninteressanter Ort</string> <string name="attribute_moving_target_yes">Bewegliches Ziel</string> diff --git a/main/res/values-es/strings.xml b/main/res/values-es/strings.xml index 7215d72..f029d9b 100644 --- a/main/res/values-es/strings.xml +++ b/main/res/values-es/strings.xml @@ -11,6 +11,8 @@ <string name="helpers">¿Qué instalar?</string> <string name="about">Sobre c:geo</string> <string name="helper">Si quieres aprender cosas sobre <b>c:geo</b>?\nEcha un ojo a nuestro manual.</string> + <string name="latitude">Latitud</string> + <string name="longitude">Longitud</string> <!-- actionbar --> <string name="action_bar_share_title">Compartir enlace a escondite</string> @@ -19,19 +21,20 @@ <string name="all_types">Todos los escondites</string> <string name="traditional">Tradicionales</string> <string name="multi">Multis</string> - <string name="mystery">Desconocidos</string> + <string name="mystery">Desconocidos/Mistery</string> <string name="letterbox">Buzón híbrido</string> - <string name="event">Por pistas</string> - <string name="mega">Mega-eventos</string> + <string name="event">Eventos</string> + <string name="mega">Mega-Eventos</string> <string name="earth">Educativos (Earth)</string> - <string name="cito">Limpieza de escondites</string> + <string name="cito">Eventos Limpieza(CITO)</string> <string name="webcam">Webcams</string> <string name="virtual">Virtuales</string> <string name="wherigo">Wherigo</string> - <string name="lostfound">Perdidos y encontrados</string> + <string name="lostfound">Eventos Perdidos y Encontrados</string> <string name="ape">Proyecto APE</string> <string name="gchq">Groundspeak HQ</string> - <string name="gps">Exhibición de escondites GPS </string> + <string name="gps">Exhibición de escondites GPS</string> + <string name="unknown">De tipo desconocido</string> <!-- cache sizes --> <string name="cache_size_micro">micro</string> @@ -46,36 +49,43 @@ <!-- waypoints --> <string name="wp_final">Ubicación final</string> <string name="wp_stage">Etapa de multi escondite</string> - <string name="wp_puzzle">Preguntar sin contestar</string> + <string name="wp_puzzle">Preguntar a contestar</string> <string name="wp_pkg">Zona de aparcamiento</string> <string name="wp_trailhead">Sendero</string> <string name="wp_waypoint">Punto de referencia</string> + <string name="wp_original">Coordenadas originales</string> <!-- logs --> <string name="log_found">Encontrado</string> <string name="log_dnf">No encontrado</string> <string name="log_note">Nota</string> <string name="log_published">Publicado</string> - <string name="log_enabled">Activo</string> - <string name="log_disabled">Inactivo</string> - <string name="log_attend">Iré</string> + <string name="log_enabled">Activado</string> + <string name="log_disabled">Desactivado</string> + <string name="log_attend">Asistiré</string> <string name="log_attended">Asistí</string> - <string name="log_retrieved">Obtenido</string> - <string name="log_placed">Colocado</string> - <string name="log_grabbed">Guardado en alguna parte</string> + <string name="log_retrieved">Recogido</string> + <string name="log_placed">Depositado</string> + <string name="log_grabbed">Recogido de alguna parte</string> + <string name="log_movecollection">Mover a la colección</string> + <string name="log_moveinventory">Mover al inventario</string> <string name="log_maintained">Mantenimiento efectuado</string> <string name="log_maintenance_needed">Necesita mantenimiento</string> <string name="log_update">Coordenadas actualizadas</string> <string name="log_archived">Archivado</string> + <string name="log_unarchived">Desarchivado</string> <string name="log_needs_archived">Necesita ser archivado</string> <string name="log_discovered">Descubierto</string> <string name="log_reviewer">Nota del revisor</string> + <string name="log_retractlisting">Retirar ficha del escondite</string> + <string name="log_marked_missing">Marcado como perdido</string> <string name="log_tb_nothing">No hacer nada</string> - <string name="log_tb_visit">Visita</string> - <string name="log_tb_drop">Colocar aquí</string> + <string name="log_tb_visit">Visitado</string> + <string name="log_tb_drop">Dejar aquí</string> <string name="log_tb_changeall">Cambiar todo</string> <string name="log_save">Guardar</string> - <string name="log_saving">Guardando registo…</string> + <string name="log_saving">Enviando registo…</string> + <string name="log_saving_and_uploading">Enviando registro y subiendo imagen…</string> <string name="log_clear">Limpiar</string> <string name="log_post">Enviar registro</string> <string name="log_post_rate">Enviar registro y puntuación</string> @@ -84,27 +94,45 @@ <string name="log_rating">Puntuación</string> <string name="log_no_rating">Sin puntuación</string> <string name="log_stars_1">1 estrella</string> -<string name="log_stars_15">1,5 estrellas</string> + <string name="log_stars_15">1,5 estrellas</string> <string name="log_stars_2">2 estrellas</string> - <string name="log_stars_25">2,5 estrellas</string> + <string name="log_stars_25">2,5 estrellas</string> <string name="log_stars_3">3 estrellas</string> - <string name="log_stars_35">3,5 estrellas</string> + <string name="log_stars_35">3,5 estrellas</string> <string name="log_stars_4">4 estrellas</string> - <string name="log_stars_45">4,5 estrellas</string> + <string name="log_stars_45">4,5 estrellas</string> <string name="log_stars_5">5 estrellas</string> -<string name="log_stars_1_description">poor</string> - <string name="log_stars_15_description">fairly poor</string> - <string name="log_stars_2_description">below average</string> - <string name="log_stars_25_description">not so bad</string> - <string name="log_stars_3_description">average </string> - <string name="log_stars_35_description">not bad at all</string> - <string name="log_stars_4_description">better than average</string> - <string name="log_stars_45_description">very good</string> - <string name="log_stars_5_description">awesome</string> + <string name="log_stars_1_description">malísimo</string> + <string name="log_stars_15_description">muy malo</string> + <string name="log_stars_2_description">malo</string> + <string name="log_stars_25_description">un poco malo</string> + <string name="log_stars_3_description">aceptable</string> + <string name="log_stars_35_description">algo bueno</string> + <string name="log_stars_4_description">bueno</string> + <string name="log_stars_45_description">muy bueno</string> + <string name="log_stars_5_description">buenísimo</string> <string name="log_webcam">Foto de webcam tomada</string> <string name="log_new_log">Registro</string> <string name="log_new_log_text">Texto del registro</string> <string name="log_announcement">Aviso</string> + <string name="log_today">Hoy</string> + <string name="log_yesterday">Ayer</string> + <string name="log_smilies">Emoticonos</string> + <string name="log_image">Imagen</string> + <string name="log_image_attach">Adjuntar imagen</string> + <string name="log_image_edit">Editar imagen</string> + <string name="log_image_stored">Galería</string> + <string name="log_image_camera">Tomar foto</string> + <string name="log_image_caption">Título</string> + <string name="log_image_description">Descripción</string> + <string name="log_image_scale">Redimensionamiento</string> + <string-array name="log_image_scales"> + <item>Sin redimensionar</item> + <item>512 px</item> + <item>640 px</item> + <item>800 px</item> + <item>1024 px</item> + </string-array> <!-- errors, warnings, info toasts --> <string name="err_none">Aceptar</string> @@ -251,6 +279,7 @@ <string name="caches_drop_all_ask">¿Quieres borrar todos los escondites guardados en el dispositivo?</string> <string name="caches_drop_stored">Descartar guardados</string> <string name="caches_drop_progress">Borrando escondites</string> + <string name="caches_drop_all_and_list">Descartar todos y borrar lista</string> <string name="caches_refresh_selected">Actualizar seleccionados</string> <string name="caches_refresh_all">Actualizar todos</string> <string name="caches_move_selected">Mover seleccionados</string> @@ -263,7 +292,7 @@ <string name="caches_recaptcha_continue">Continuar</string> <string name="caches_filter">Filtrar</string> <string name="caches_filter_title">Filtrar por</string> - <string name="caches_filter_size">tamaó</string> + <string name="caches_filter_size">tamaño</string> <string name="caches_filter_type">tipo</string> <string name="caches_filter_track">con rastreables</string> <string name="caches_filter_clear">limpiar filtros</string> @@ -401,8 +430,7 @@ <string name="cache_attributes">Atributos</string> <string name="cache_inventory">Inventario</string> <string name="cache_log_offline">Registro desconectado</string> - <string name="cache_log_images_loading">Cargando imagen de registro…</string> - <string name="cache_log_images_title">Imagen de resgistro</string> + <string name="cache_log_images_title">Imagen de registro</string> <string name="cache_log_image_default_title">Foto</string> <string name="cache_personal_note">Nota personal</string> <string name="cache_description">Descripción</string> @@ -457,14 +485,13 @@ <string name="cache_terrain">Terreno</string> <string name="cache_rating">Puntuación</string> <string name="cache_rating_of">de</string> - <string name="cache_favourite">Favorito</string> + <string name="cache_favorite">Favorito</string> <string name="cache_owner">Propietario</string> <string name="cache_hidden">Oculto</string> <string name="cache_event">Fecha</string> <string name="cache_location">Ubicación</string> <string name="cache_coordinates">Coordenadas</string> <string name="cache_spoiler_images_title">Imágenes reveladoras</string> - <string name="cache_spoiler_images_loading">Cargando imágenes reveladoras…</string> <string name="cache_log_types">Tipos de registro</string> <string name="cache_coordinates_no">Este escondite no tiene coordenadas.</string> <string name="cache_clear_history">Borrar historial</string> diff --git a/main/res/values-fr/strings.xml b/main/res/values-fr/strings.xml index 9de84ac..a0f86e6 100644 --- a/main/res/values-fr/strings.xml +++ b/main/res/values-fr/strings.xml @@ -175,7 +175,7 @@ <string name="err_missing_device_name">Veuillez saisir un nom pour votre appareil avant l\'enregistrement.</string> <string name="err_favorite_failed">c:geo ne peut pas changer le status de favori.</string> <string name="err_select_logimage_failed">La sélection d\'une image pour la note a échoué.</string> - <string name="err_aquire_image_failed">L\'acquisition d\'une nouvelle image pour la note a échoué.</string> + <string name="err_acquire_image_failed">L\'acquisition d\'une nouvelle image pour la note a échoué.</string> <string name="err_tb_display">"c:geo ne peut pas afficher l\'objet voyageur demandé. Est-ce vraiment un objet voyageur?</string> <string name="err_tb_details_open">c:geo ne peut pas ouvrir le détail de l\'objet voyageur.</string> @@ -512,7 +512,6 @@ <string name="cache_attributes">Attributs</string> <string name="cache_inventory">Inventaire</string> <string name="cache_log_offline">Visite hors-ligne</string> - <string name="cache_log_images_loading">Chargement de l\'image de la visite…</string> <string name="cache_log_images_title">Image de la visite</string> <string name="cache_log_image_default_title">Photo</string> <string name="cache_personal_note">Note personnelle</string> @@ -562,10 +561,10 @@ <string name="cache_dialog_watchlist_add_message">Ajout de la cache à votre liste de suivi…</string> <string name="cache_dialog_watchlist_remove_title">Liste de suivi</string> <string name="cache_dialog_watchlist_remove_message">Retrait de la cache de votre liste de suivi…</string> - <string name="cache_dialog_favourite_add_title">Favori</string> - <string name="cache_dialog_favourite_add_message">Ajout de la cache à vos favoris…</string> - <string name="cache_dialog_favourite_remove_title">Favori</string> - <string name="cache_dialog_favourite_remove_message">Suppression de la cache de vos favoris…</string> + <string name="cache_dialog_favorite_add_title">Favori</string> + <string name="cache_dialog_favorite_add_message">Ajout de la cache à vos favoris…</string> + <string name="cache_dialog_favorite_remove_title">Favori</string> + <string name="cache_dialog_favorite_remove_message">Suppression de la cache de vos favoris…</string> <string name="cache_menu_navigate">Navigation</string> <string name="cache_menu_navigation_drive">Navigation (voiture)</string> <string name="cache_menu_navigation_walk">Navigation (piéton)</string> @@ -607,7 +606,7 @@ <string name="cache_rating">Note</string> <string name="cache_own_rating">Note personnelle</string> <string name="cache_rating_of">de</string> - <string name="cache_favourite">Favori</string> + <string name="cache_favorite">Favori</string> <string name="cache_owner">Propriétaire</string> <string name="cache_hidden">Cachée</string> <string name="cache_event">Date</string> @@ -615,9 +614,7 @@ <string name="cache_coordinates">Coordonnées</string> <string name="cache_coordinates_original">Coordonnées d\'origine</string> <string name="cache_spoiler_images_title">Images indices</string> - <string name="cache_spoiler_images_loading">Chargement des images indices…</string> <string name="cache_images_title">Images</string> - <string name="cache_images_loading">Chargement des images…</string> <string name="cache_log_types">Types de visites</string> <string name="cache_coordinates_no">Cette cache n\'a pas de coordonnées.</string> <string name="cache_clear_history">Effacer l\'historique</string> @@ -717,13 +714,6 @@ <string name="waypoint_coordinate_formats_plain">Texte</string> - <!-- distance units --> - <string name="unit_m">m</string> - <string name="unit_km">km</string> - <string name="unit_ft">ft</string> - <string name="unit_yd">yd</string> - <string name="unit_mi">mi</string> - <!-- visit --> <string name="visit_tweet">Publier votre découverte sur Twitter</string> diff --git a/main/res/values-hu/strings.xml b/main/res/values-hu/strings.xml index ec5e06e..e7018f9 100644 --- a/main/res/values-hu/strings.xml +++ b/main/res/values-hu/strings.xml @@ -483,7 +483,6 @@ <string name="cache_attributes">Tulajdonságok</string> <string name="cache_inventory">Tárgyak</string> <string name="cache_log_offline">Offline bejegyzés</string> - <string name="cache_log_images_loading">Bejegyzés kép betöltése…</string> <string name="cache_log_images_title">Bejegyzés kép</string> <string name="cache_log_image_default_title">Fotó</string> <string name="cache_personal_note">Személyes megjegyzés</string> @@ -569,7 +568,7 @@ <string name="cache_rating">Osztályzat</string> <string name="cache_own_rating">Saját értékelés</string> <string name="cache_rating_of">/</string> - <string name="cache_favourite">Kedvenc</string> + <string name="cache_favorite">Kedvenc</string> <string name="cache_owner">Tulajdonos</string> <string name="cache_hidden">Elrejtve</string> <string name="cache_event">Dátum</string> @@ -577,9 +576,7 @@ <string name="cache_coordinates">Koordináták</string> <string name="cache_coordinates_original">Eredeti koordináták</string> <string name="cache_spoiler_images_title">Spoiler képek</string> - <string name="cache_spoiler_images_loading">Spoiler képek betöltése…</string> <string name="cache_images_title">Képek</string> - <string name="cache_images_loading">Képek betéltése…</string> <string name="cache_log_types">Bejegyzés típusok</string> <string name="cache_coordinates_no">Ennek a ládának nincsenek koordinátái.</string> <string name="cache_clear_history">Előzmények törlése</string> @@ -661,13 +658,6 @@ <string name="search_history_cleared">Előzmények törölve</string> <string name="waypoint_coordinate_formats_plain">Egyszerű</string> - - <!-- distance units --> - <string name="unit_m">m</string> - <string name="unit_km">km</string> - <string name="unit_ft">ft</string> - <string name="unit_yd">yd</string> - <string name="unit_mi">mi</string> <!-- visit --> <string name="visit_tweet">Twitteld ki ezt a megtalálást</string> diff --git a/main/res/values-it/strings.xml b/main/res/values-it/strings.xml index f7d29cb..9614526 100644 --- a/main/res/values-it/strings.xml +++ b/main/res/values-it/strings.xml @@ -85,6 +85,7 @@ <string name="log_tb_changeall">Cambia tutto</string> <string name="log_save">Salva</string> <string name="log_saving">Invio log…</string> + <string name="log_saving_and_uploading">Invio log e immagine…</string> <string name="log_clear">Azzera</string> <string name="log_post">Invia log</string> <string name="log_post_rate">Invia log + voto</string> @@ -118,6 +119,21 @@ <string name="log_today">Oggi</string> <string name="log_yesterday">Ieri</string> <string name="log_smilies">Smile</string> + <string name="log_image">Immagine</string> + <string name="log_image_attach">Aggiungi immagine</string> + <string name="log_image_edit">Modifica immagine</string> + <string name="log_image_stored">Esistente</string> + <string name="log_image_camera">Nuova</string> + <string name="log_image_caption">Didascalia</string> + <string name="log_image_description">Descrizione</string> + <string name="log_image_scale">Ridimensiona</string> + <string-array name="log_image_scales"> + <item>Dimensioni originali</item> + <item>512 px</item> + <item>640 px</item> + <item>800 px</item> + <item>1024 px</item> + </string-array> <!-- translation --> <string name="translate_to_sys_lang">Traduci in %s</string> @@ -167,6 +183,8 @@ <string name="err_missing_device_name">Per cortesia inserire il nome del dispositivo prima di registrarsi.</string> <string name="err_favorite_failed">Errore nella modifica dello stato preferiti.</string> + <string name="err_select_logimage_failed">La selezione dell\'immagine per il log è fallita.</string> + <string name="err_acquire_image_failed">Acquisizione immagine fallita.</string> <string name="err_tb_display">c:geo non riesce a visualizzare il trackable che vuoi. È veramente un trackable?</string> <string name="err_tb_details_open">c:geo non riesce ad aprire i dettagli del trackable.</string> @@ -189,6 +207,7 @@ <string name="err_log_load_data_still">c:geo sta ancora caricando i dati necessari per salvare il log. Per cortesia attendere ancora un pochino.</string> <string name="err_log_failed_server">c:geo non è riuscito ad inviare il log perché il server non risponde.</string> <string name="err_log_post_failed">Sembra che il log non sia stato inviato. Prego verificare su Geocaching.com.</string> + <string name="err_logimage_post_failed">Sembra la l\'immagine non sia stata caricata. Si prega di controllare su Geocaching.com.</string> <string name="err_search_address_forgot">c:geo ha dimenticato l\'indirizzo che vuoi trovare.</string> <string name="err_parse_lat">c:geo non riesce ad interpretare la latitudine.</string> @@ -218,6 +237,8 @@ <string name="info_log_saved">c:geo ha salvato il log.</string> <string name="info_log_cleared">Il log è stato azzerato.</string> <string name="info_log_type_changed">Il tipo di log è cambiato!</string> + <string name="info_select_logimage_cancelled">Selezione o cattura immagine annnulata.</string> + <string name="info_stored_image">Nuova immagine salvata su:</string> <string name="info_storing_static_maps">Tento di salvare la static map</string> @@ -293,7 +314,7 @@ <string name="caches_refresh_selected">Aggiorna i cache selezionati</string> <string name="caches_refresh_all">Aggiorna tutti</string> <string name="caches_move_selected">Muovi i cache selezionati</string> - <string name="caches_move_all">Muovi tutte</string> + <string name="caches_move_all">Muovi tutti</string> <string name="caches_map_locus">Locus</string> <string name="caches_map_locus_export">Esporta in Locus</string> <string name="caches_recaptcha_title">reCAPTCHA</string> @@ -307,7 +328,10 @@ <string name="caches_filter_track">Con oggetti trackables</string> <string name="caches_filter_clear">Rimuovi filtri</string> <string name="caches_filter_modified">Con coordinate modificate</string> + <string name="caches_filter_origin">Origine</string> <string name="caches_removing_from_history">Rimozione dalla cronologia…</string> + <string name="caches_clear_offlinelogs">Cancella i log offline</string> + <string name="caches_clear_offlinelogs_progress">Cancellazione logs offline</string> <!-- caches lists --> <string name="list_menu">Lista</string> @@ -340,6 +364,7 @@ <!-- init --> <string name="init_geocaching">Geocaching.com</string> + <string name="init_gc_activate">Attiva Geocaching.com su mappa live e nelle ricerche</string> <string name="init_oc">opencaching.de</string> <string name="init_oc_activate">Attiva opencaching.de su mappa live e nelle ricerche</string> <string name="init_oc_username_description">Inserisci il tuo utente opencaching.de per marcare i tuoi ritrovamenti.</string> @@ -386,7 +411,8 @@ <string name="init_offline_wp">Salva i waypoints delle mappe per uso offline</string> <string name="init_save_log_img">Salva immagini contenute nei log</string> <string name="init_units">Usa miglia/piedi</string> - <string name="init_log_offline">Quando salvi log, fallo sempre offline (non visualizzerà lo schermo di log online, non invierà subito il log)</string> + <string name="init_log_offline">Attiva log offline (non visualizzerà lo schermo di log online, non invierà subito il log)</string> + <string name="init_choose_list">Chiedi la lista quando salvi un cache</string> <string name="init_livelist">Visualizza in che direzione sono i cache, nelle liste</string> <string name="init_altitude">Correzione di altitudine</string> <string name="init_altitude_description">Se il GPS restituisce un\'errata altitudine, puoi correggerla inserendo un valore positivo o negativo, in metri.</string> @@ -437,6 +463,12 @@ <string name="init_plain_logs">Visualizza i LOG senza colori</string> <string name="init_use_native_ua">Identifica come browser Android. Risolve alcuni problemi di login con alcuni provider di rete.</string> <string name="init_rendertheme_folder">Cartella per i temi mappa personali off-line</string> + <!-- map sources --> + <string name="map_source_google_map">Google: Map</string> + <string name="map_source_google_satellite">Google: Satellite</string> + <string name="map_source_osm_mapnik">OSM: Mapnik</string> + <string name="map_source_osm_cyclemap">OSM: Cyclemap</string> + <string name="map_source_osm_offline">OSM: Offline</string> <string name="init_sendToCgeo">Send to c:geo</string> <string name="init_sendToCgeo_name">Nome dispositivo:</string> @@ -484,7 +516,6 @@ <string name="cache_attributes">Attributi</string> <string name="cache_inventory">Oggetti</string> <string name="cache_log_offline">Log Offline</string> - <string name="cache_log_images_loading">Caricamento immagini log…</string> <string name="cache_log_images_title">Immagini Log</string> <string name="cache_log_image_default_title">Foto</string> <string name="cache_personal_note">Note personali</string> @@ -499,6 +530,9 @@ <string name="cache_favpoint_not_on">Questo cache non è uno dei tuoi favoriti.</string> <string name="cache_favpoint_add">Aggiungi</string> <string name="cache_favpoint_remove">Rimuovi</string> + <string name="cache_list_text">Lista:</string> + <string name="cache_list_change">Sposta</string> + <string name="cache_list_unknown">Non in una lista</string> <string name="cache_images">Immagini</string> <string name="cache_waypoints">Waypoints</string> @@ -530,10 +564,10 @@ <string name="cache_dialog_watchlist_add_message">Aggiunto il cache alla watchlist in corso…</string> <string name="cache_dialog_watchlist_remove_title">Watchlist</string> <string name="cache_dialog_watchlist_remove_message">Rimozione dei cache dalla tua watchlist…</string> - <string name="cache_dialog_favourite_add_title">Preferiti</string> - <string name="cache_dialog_favourite_add_message">Aggiungi il cache ai tuoi preferiti…</string> - <string name="cache_dialog_favourite_remove_title">Preferiti</string> - <string name="cache_dialog_favourite_remove_message">Rimozione cache dai tuoi preferiti…</string> + <string name="cache_dialog_favorite_add_title">Preferiti</string> + <string name="cache_dialog_favorite_add_message">Aggiungi il cache ai tuoi preferiti…</string> + <string name="cache_dialog_favorite_remove_title">Preferiti</string> + <string name="cache_dialog_favorite_remove_message">Rimozione cache dai tuoi preferiti…</string> <string name="cache_menu_navigate">Naviga</string> <string name="cache_menu_navigation_drive">Naviga (in auto)</string> <string name="cache_menu_navigation_walk">Naviga (a piedi)</string> @@ -575,7 +609,7 @@ <string name="cache_rating">Voto</string> <string name="cache_own_rating">Il tuo voto</string> <string name="cache_rating_of">di</string> - <string name="cache_favourite">Popolarità</string> + <string name="cache_favorite">Popolarità</string> <string name="cache_owner">Proprietario</string> <string name="cache_hidden">Nascosto il</string> <string name="cache_event">Data</string> @@ -583,9 +617,7 @@ <string name="cache_coordinates">Coordinate</string> <string name="cache_coordinates_original">Coordinate originali</string> <string name="cache_spoiler_images_title">Immagini spoiler</string> - <string name="cache_spoiler_images_loading">Caricamento immagini spoiler…</string> <string name="cache_images_title">Immaginis</string> - <string name="cache_images_loading">Caricamento immagini…</string> <string name="cache_log_types">Tipi di Log</string> <string name="cache_coordinates_no">Questo cache non ha coordinate.</string> <string name="cache_clear_history">Cancella cronologia</string> @@ -656,6 +688,7 @@ <string name="waypoint_edit_title">Modifica waypoint</string> <string name="waypoint_add_title">Aggiungi waypoint</string> <string name="waypoint_note">Note</string> + <string name="waypoint_visited">Visitato</string> <string name="waypoint_save">Salva</string> <string name="waypoint_loading">Caricamento waypoint…</string> <string name="waypoint_do_not_touch_cache_coordinates">Nessuna modifica alle coordinate cache</string> @@ -683,13 +716,6 @@ <string name="waypoint_coordinate_formats_plain">Plain</string> - <!-- distance units --> - <string name="unit_m">m</string> - <string name="unit_km">km</string> - <string name="unit_ft">piedi</string> - <string name="unit_yd">iarde</string> - <string name="unit_mi">miglia</string> - <!-- visit --> <string name="visit_tweet">Segnala questo ritrovamento su Twitter</string> @@ -823,10 +849,7 @@ <string name="export_gpx_info">Il file GPX sarà esportato in %1$s con data ed ora correnti come nome file.</string> <string name="export_gpx_to">Invia il GPX esportato a</string> -<!-- attribute unknown --> - <string name="attribute_unknown_yes">(attributo sconosciuto) permesso</string> - <string name="attribute_unknown_no">(attributo sconosciuto) non permesso</string> - <!-- attributes (permissions -> allowed, not allowed) --> + <!-- GC attributes --> <string name="attribute_dogs_yes">Cani permessi</string> <string name="attribute_dogs_no">Cani NON permessi</string> <string name="attribute_bicycles_yes">Biciclette permesse</string> @@ -845,8 +868,6 @@ <string name="attribute_campfires_no">Fuochi da campo NON permessi</string> <string name="attribute_rv_yes">Camper/roulotte permessi</string> <string name="attribute_rv_no">Camper/roulotte NON permessi</string> - - <!-- attributes (conditions -> yes, no) --> <string name="attribute_kids_yes">Raccomandato per bambini</string> <string name="attribute_kids_no">Non raccomandato per bambini</string> <string name="attribute_onehour_yes">Richiede meno di un\'ora</string> @@ -899,8 +920,6 @@ <string name="attribute_landf_no">Non è un tour \"Lost and found\"</string> <string name="attribute_partnership_yes">Cache di gruppo</string> <string name="attribute_partnership_no">Cache non di gruppo</string> - - <!-- attributes (equipment -> required, not required) --> <string name="attribute_fee_yes">Accesso o parcheggio a pagamento</string> <string name="attribute_fee_no">Accesso o parcheggio non a pagamento</string> <string name="attribute_rappelling_yes">Richiesta attrezzatura da arrampicata</string> @@ -923,8 +942,6 @@ <string name="attribute_wirelessbeacon_no">Segnalatore radio non necessario</string> <string name="attribute_treeclimbing_yes">Richiede di salire su un albero</string> <string name="attribute_treeclimbing_no">Non richiede di salire su un albero</string> - - <!-- attributes (hazards -> present, not present) --> <string name="attribute_poisonoak_yes">Piante velenose</string> <string name="attribute_poisonoak_no">Piante non velenose</string> <string name="attribute_dangerousanimals_yes">Animali pericolosi</string> @@ -941,8 +958,6 @@ <string name="attribute_danger_no">Area non pericolosa</string> <string name="attribute_thorn_yes">Rovi</string> <string name="attribute_thorn_no">Senza rovi</string> - - <!-- attributes (facilities -> yes, no) --> <string name="attribute_wheelchair_yes">Accessibile con sedia a rotelle</string> <string name="attribute_wheelchair_no">Non accessibile con sedia a rotelle</string> <string name="attribute_parking_yes">Parcheggio</string> @@ -965,6 +980,67 @@ <string name="attribute_fuel_no">Lontano da pompa carburante</string> <string name="attribute_food_yes">Vicino a punto ristoro</string> <string name="attribute_food_no">Lontano da punti ristoro</string> + + <string name="attribute_oc_only_yes">Loggabile solo su Opencaching</string> + <string name="attribute_oc_only_no">Loggabile non solo su Opencaching</string> + <string name="attribute_link_only_yes">Hyperlink solo verso un altro portale di cache</string> + <string name="attribute_link_only_no">Non solo hyperlink ad un altro portale di cache</string> + <string name="attribute_letterbox_yes">Lettera (richiede francobollo)</string> + <string name="attribute_letterbox_no">No lettera (non richiede francobollo)</string> + <string name="attribute_railway_yes">Ferrovia attiva nelle vicinanze</string> + <string name="attribute_railway_no">Nessuna ferrovia nelle vicinanze</string> + <string name="attribute_syringe_yes">Pronto soccorso disponibile</string> + <string name="attribute_syringe_no">Pronto soccorso non disponibile</string> + <string name="attribute_swamp_yes">Paludoso</string> + <string name="attribute_swamp_no">Non paludoso</string> + <string name="attribute_hills_yes">Area collinare</string> + <string name="attribute_hills_no">Area non collinare</string> + <string name="attribute_easy_climbing_yes">Facile scalata</string> + <string name="attribute_easy_climbing_no">Nessuna facile scalata</string> + <string name="attribute_poi_yes">Punto di interesse</string> + <string name="attribute_poi_no">Nessun punto di interesse</string> + <string name="attribute_moving_target_yes">Obiettivo in movimento</string> + <string name="attribute_moving_target_no">Obiettivo non in movimento</string> + <string name="attribute_webcam_yes">Webcam</string> + <string name="attribute_webcam_no">No webcam</string> + <string name="attribute_inside_yes">Con aree interne (cave, edifici etc.)</string> + <string name="attribute_inside_no">Senza aree interne</string> + <string name="attribute_in_water_yes">In acqua</string> + <string name="attribute_in_water_no">Non in acqua</string> + <string name="attribute_no_gps_yes">Senza GPS (lettere, cistes, carta e bussola...)</string> + <string name="attribute_no_gps_no">Con GPS</string> + <string name="attribute_overnight_yes">Necessario permanere di notte</string> + <string name="attribute_overnight_no">Permanenza notturna non necessaria</string> + <string name="attribute_specific_times_yes">Disponibile solo in certi orari</string> + <string name="attribute_specific_times_no">Disponibile a tutte le ore</string> + <string name="attribute_day_yes">Solo di giorno</string> + <string name="attribute_day_no">Non solo di giorno</string> + <string name="attribute_tide_yes">Marea</string> + <string name="attribute_tide_no">Senza marea</string> + <string name="attribute_all_seasons_yes">Tutte le stagioni</string> + <string name="attribute_all_seasons_no">Non in tutte le stagioni</string> + <string name="attribute_breeding_yes">Stagione di riproduzione / natura protetta</string> + <string name="attribute_breeding_no">Disponibile anche in stagione di riproduzione / natura protetta</string> + <string name="attribute_snow_proof_yes">Nascondiglio a prova di neve</string> + <string name="attribute_snow_proof_no">Nascondiglio non a prova di neve</string> + <string name="attribute_compass_yes">Bussola</string> + <string name="attribute_compass_no">Senza bussola</string> + <string name="attribute_cave_yes">Equipaggiamento da caverna</string> + <string name="attribute_cave_no">Senza equipaggiamento da caverna</string> + <string name="attribute_aircraft_yes">Aircraft</string> + <string name="attribute_aircraft_no">Senza aircraft</string> + <string name="attribute_investigation_yes">Investigazione</string> + <string name="attribute_investigation_no">Senza investigazione</string> + <string name="attribute_puzzle_yes">Puzzle / Mystery</string> + <string name="attribute_puzzle_no">No puzzle / mystery</string> + <string name="attribute_arithmetic_yes">Problema aritmetico</string> + <string name="attribute_arithmetic_no">Problema non aritmetico</string> + <string name="attribute_other_cache_yes">Cache di altro tipo</string> + <string name="attribute_other_cache_no">Cache non di altro tipo</string> + <string name="attribute_ask_owner_yes">Chiedere al proprietario per le condizioni di partenza</string> + <string name="attribute_ask_owner_no">Non chiedere al proprietario per le condizioni di partenza</string> + <string name="attribute_unknown_yes">Attributo sconosciuto</string> + <string name="attribute_unknown_no">Senza attributo sconosciuto</string> <!-- next things --> <string name="legal_note">Per usare i servizi di Geocaching.com, si applicano i termini e le condizioni del <a href="http://www.geocaching.com/about/termsofuse.aspx">Contratto Groundspeak</a> che deve essere approvato dall\'utente.</string> diff --git a/main/res/values-ja/strings.xml b/main/res/values-ja/strings.xml index 126a03c..5d7759e 100644 --- a/main/res/values-ja/strings.xml +++ b/main/res/values-ja/strings.xml @@ -494,7 +494,6 @@ <string name="cache_attributes">属性</string> <string name="cache_inventory">目録</string> <string name="cache_log_offline">オフラインログ</string> - <string name="cache_log_images_loading">添付画像をロード中…</string> <string name="cache_log_images_title">ログの添付画像</string> <string name="cache_log_image_default_title">写真</string> <string name="cache_personal_note">パーソナルノート</string> @@ -541,10 +540,10 @@ <string name="cache_dialog_watchlist_add_message">ウォッチリストに追加中…</string> <string name="cache_dialog_watchlist_remove_title">ウォッチリスト</string> <string name="cache_dialog_watchlist_remove_message">ウォッチリストから削除中…</string> - <string name="cache_dialog_favourite_add_title">お気に入り</string> - <string name="cache_dialog_favourite_add_message">お気に入りに追加中…</string> - <string name="cache_dialog_favourite_remove_title">お気に入り</string> - <string name="cache_dialog_favourite_remove_message">お気に入りから削除中…</string> + <string name="cache_dialog_favorite_add_title">お気に入り</string> + <string name="cache_dialog_favorite_add_message">お気に入りに追加中…</string> + <string name="cache_dialog_favorite_remove_title">お気に入り</string> + <string name="cache_dialog_favorite_remove_message">お気に入りから削除中…</string> <string name="cache_menu_navigate">ナビゲーション</string> <string name="cache_menu_navigation_drive">ナビゲーション(自動車)</string> <string name="cache_menu_navigation_walk">ナビゲーション(徒歩)</string> @@ -587,7 +586,7 @@ <string name="cache_rating">評価</string> <string name="cache_own_rating">Own Rating</string> <string name="cache_rating_of">/</string> - <string name="cache_favourite">お気に入り</string> + <string name="cache_favorite">お気に入り</string> <string name="cache_owner">所有者</string> <string name="cache_hidden">隠した日</string> <string name="cache_event">イベント日付</string> @@ -595,9 +594,7 @@ <string name="cache_coordinates">座標</string> <string name="cache_coordinates_original">オリジナル座標</string> <!-- 「初公開時の座標」の方がいいかも --> <string name="cache_spoiler_images_title">スポイラー画像</string> - <string name="cache_spoiler_images_loading">スポイラー画像をロード中…</string> <string name="cache_images_title">画像</string> - <string name="cache_images_loading">画像をロード中…</string> <string name="cache_log_types">ログタイプ</string> <string name="cache_coordinates_no">このキャッシュに座標値はありません。</string> <string name="cache_clear_history">全履歴を削除</string> @@ -695,13 +692,6 @@ <string name="waypoint_coordinate_formats_plain">プレーン</string> - <!-- distance units --> - <string name="unit_m">m</string> - <string name="unit_km">km</string> - <string name="unit_ft">ft</string> - <string name="unit_yd">yd</string> - <string name="unit_mi">mi</string> - <!-- visit --> <string name="visit_tweet">この発見をTwitterでつぶやく</string> diff --git a/main/res/values-nl/strings.xml b/main/res/values-nl/strings.xml index 729c382..8ce95a5 100644 --- a/main/res/values-nl/strings.xml +++ b/main/res/values-nl/strings.xml @@ -497,7 +497,6 @@ <string name="cache_attributes">Attributen</string> <string name="cache_inventory">Inventaris</string> <string name="cache_log_offline">Offline log</string> - <string name="cache_log_images_loading">Laden van logafbeeldingen…</string> <string name="cache_log_images_title">Logafbeelding</string> <string name="cache_log_image_default_title">Foto</string> <string name="cache_personal_note">Persoonlijke aantekening</string> @@ -547,10 +546,10 @@ <string name="cache_dialog_watchlist_add_message">Voeg cache toe aan watchlist…</string> <string name="cache_dialog_watchlist_remove_title">Watchlist</string> <string name="cache_dialog_watchlist_remove_message">Verwijder cache van watchlist…</string> - <string name="cache_dialog_favourite_add_title">Favoriet</string> - <string name="cache_dialog_favourite_add_message">Voeg cache toe aan favorieten…</string> - <string name="cache_dialog_favourite_remove_title">Favoriet</string> - <string name="cache_dialog_favourite_remove_message">Verwijder cache van je favorieten…</string> + <string name="cache_dialog_favorite_add_title">Favoriet</string> + <string name="cache_dialog_favorite_add_message">Voeg cache toe aan favorieten…</string> + <string name="cache_dialog_favorite_remove_title">Favoriet</string> + <string name="cache_dialog_favorite_remove_message">Verwijder cache van je favorieten…</string> <string name="cache_menu_navigate">Navigeer</string> <string name="cache_menu_navigation_drive">Navigeer (rijden)</string> <string name="cache_menu_navigation_walk">Navigeer (lopen)</string> @@ -592,7 +591,7 @@ <string name="cache_rating">Waardering</string> <string name="cache_own_rating">Eigen waardering</string> <string name="cache_rating_of">van</string> - <string name="cache_favourite">Favoriet</string> + <string name="cache_favorite">Favoriet</string> <string name="cache_owner">Eigenaar</string> <string name="cache_hidden">Verstopt</string> <string name="cache_event">Datum</string> @@ -600,9 +599,7 @@ <string name="cache_coordinates">Coördinaten</string> <string name="cache_coordinates_original">Originele coordinaten</string> <string name="cache_spoiler_images_title">Spoiler afbeeldingen</string> - <string name="cache_spoiler_images_loading">Spoiler afbeeldingen laden…</string> <string name="cache_images_title">Afbeeldingen</string> - <string name="cache_images_loading">Afbeeldingen laden…</string> <string name="cache_log_types">Log types</string> <string name="cache_coordinates_no">Deze cache heeft geen coördinaten.</string> <string name="cache_clear_history">Maak geschiedenis leeg</string> @@ -701,13 +698,6 @@ <string name="waypoint_coordinate_formats_plain">Vlak</string> - <!-- distance units --> - <string name="unit_m">m</string> - <string name="unit_km">km</string> - <string name="unit_ft">ft</string> - <string name="unit_yd">yd</string> - <string name="unit_mi">mi</string> - <!-- visit --> <string name="visit_tweet">Post deze vondst op Twitter</string> diff --git a/main/res/values-pl/strings.xml b/main/res/values-pl/strings.xml index 4c3685f..b4fbca7 100644 --- a/main/res/values-pl/strings.xml +++ b/main/res/values-pl/strings.xml @@ -488,7 +488,6 @@ <string name="cache_attributes">Atrybuty</string> <string name="cache_inventory">Inwentarz</string> <string name="cache_log_offline">Wpis offline</string> - <string name="cache_log_images_loading">Trwa ładowanie zdjęć z wpisu…</string> <string name="cache_log_images_title">Zdjęcie z wpisu</string> <string name="cache_log_image_default_title">Zdjęcie</string> <string name="cache_personal_note">Notatka osobista</string> @@ -534,10 +533,10 @@ <string name="cache_dialog_watchlist_add_message">Dodaję skrzynkę do listy obserwowanych…</string> <string name="cache_dialog_watchlist_remove_title">Lista obserwowanych</string> <string name="cache_dialog_watchlist_remove_message">Usuwam skrzynkę z listy obserwowanych…</string> - <string name="cache_dialog_favourite_add_title">Ulubione</string> - <string name="cache_dialog_favourite_add_message">Dodaję skrzynkę do listy ulubionych…</string> - <string name="cache_dialog_favourite_remove_title">Ulubione</string> - <string name="cache_dialog_favourite_remove_message">Usuwam skrzynkę z listy ulubionych…</string> + <string name="cache_dialog_favorite_add_title">Ulubione</string> + <string name="cache_dialog_favorite_add_message">Dodaję skrzynkę do listy ulubionych…</string> + <string name="cache_dialog_favorite_remove_title">Ulubione</string> + <string name="cache_dialog_favorite_remove_message">Usuwam skrzynkę z listy ulubionych…</string> <string name="cache_menu_navigate">Nawiguj</string> <string name="cache_menu_navigation_drive">Nawigacja (jazda)</string> <string name="cache_menu_navigation_walk">Nawigacja (pieszo)</string> @@ -579,7 +578,7 @@ <string name="cache_rating">Ocena</string> <string name="cache_own_rating">Własna ocena</string> <string name="cache_rating_of">od</string> - <string name="cache_favourite">Ulubiona</string> + <string name="cache_favorite">Ulubiona</string> <string name="cache_owner">Właściciel</string> <string name="cache_hidden">Ukryta</string> <string name="cache_event">Data</string> @@ -587,9 +586,7 @@ <string name="cache_coordinates">Współrzędne</string> <string name="cache_coordinates_original">Oryginalne współrzędne</string> <string name="cache_spoiler_images_title">Zdjęcia spoiler</string> - <string name="cache_spoiler_images_loading">Ładuję zdjęcia spoiler…</string> <string name="cache_images_title">Zdjęcia</string> - <string name="cache_images_loading">Ładuję zdjęcia…</string> <string name="cache_log_types">Rodzaj wpisu</string> <string name="cache_coordinates_no">Ta skrzynka nie ma współrzędnych GPS.</string> <string name="cache_clear_history">Usuń historię</string> @@ -685,13 +682,6 @@ <string name="waypoint_coordinate_formats_plain">zwykłe</string> - <!-- distance units --> - <string name="unit_m">m</string> - <string name="unit_km">km</string> - <string name="unit_ft">stopy</string> - <string name="unit_yd">jardy</string> - <string name="unit_mi">mile</string> - <!-- visit --> <string name="visit_tweet">Wyślij informację do Twitter</string> diff --git a/main/res/values-pt/strings.xml b/main/res/values-pt/strings.xml index 5f67281..e4bcfd4 100644 --- a/main/res/values-pt/strings.xml +++ b/main/res/values-pt/strings.xml @@ -484,7 +484,6 @@ <string name="cache_attributes">Atributos</string> <string name="cache_inventory">Inventário</string> <string name="cache_log_offline">Registo Offline</string> - <string name="cache_log_images_loading">A carregar imagem do registo…</string> <string name="cache_log_images_title">Imagem do registo</string> <string name="cache_log_image_default_title">Foto</string> <string name="cache_personal_note">Nota pessoal</string> @@ -572,7 +571,7 @@ <string name="cache_rating">Pontuação</string> <string name="cache_own_rating">A minha pontuação</string> <string name="cache_rating_of">de</string> - <string name="cache_favourite">Favorita</string> + <string name="cache_favorite">Favorita</string> <string name="cache_owner">Dono</string> <string name="cache_hidden">Escondida</string> <string name="cache_event">Data</string> @@ -580,9 +579,7 @@ <string name="cache_coordinates">Coordenadas</string> <string name="cache_coordinates_original">Coordenadas originais</string> <string name="cache_spoiler_images_title">Imagens spoiler</string> - <string name="cache_spoiler_images_loading">A carregar imagens spoiler…</string> <string name="cache_images_title">Imagens</string> - <string name="cache_images_loading">A carregar as imagens…</string> <string name="cache_log_types">Tipos de log</string> <string name="cache_coordinates_no">Esta cache não tem coordenadas.</string> <string name="cache_clear_history">Apagar histórico</string> diff --git a/main/res/values-sk/strings.xml b/main/res/values-sk/strings.xml index cef88d4..616bd44 100644 --- a/main/res/values-sk/strings.xml +++ b/main/res/values-sk/strings.xml @@ -484,7 +484,6 @@ <string name="cache_attributes">Atribúty</string> <string name="cache_inventory">Obsah</string> <string name="cache_log_offline">Offline log</string> - <string name="cache_log_images_loading">Načítanie obrázku z logu…</string> <string name="cache_log_images_title">Obrázok z logu</string> <string name="cache_log_image_default_title">Fotografia</string> <string name="cache_personal_note">Osobná poznámka</string> @@ -571,7 +570,7 @@ <string name="cache_rating">Hodnotenie</string> <string name="cache_own_rating">Vlastné hodnotenie</string> <string name="cache_rating_of">z</string> - <string name="cache_favourite">Obľúbené</string> + <string name="cache_favorite">Obľúbené</string> <string name="cache_owner">Vlastník</string> <string name="cache_hidden">Skrytá</string> <string name="cache_event">Dátum</string> @@ -579,9 +578,7 @@ <string name="cache_coordinates">Súradnice</string> <string name="cache_coordinates_original">Pôvodné súradnice</string> <string name="cache_spoiler_images_title">Spoilerové obrázky</string> - <string name="cache_spoiler_images_loading">Načítanie spoilerových obrázkov…</string> <string name="cache_images_title">Obrázky</string> - <string name="cache_images_loading">Prebieha načítanie obrázkov…</string> <string name="cache_log_types">Typy záznamov</string> <string name="cache_coordinates_no">Táto skrýša nemá žiadne súradnice.</string> <string name="cache_clear_history">Vymazať históriu</string> @@ -665,13 +662,6 @@ <string name="waypoint_coordinate_formats_plain">Iba text</string> - <!-- distance units --> - <string name="unit_m">m</string> - <string name="unit_km">km</string> - <string name="unit_ft">ft</string> - <string name="unit_yd">yd</string> - <string name="unit_mi">mi</string> - <!-- visit --> <string name="visit_tweet">informovať o nájdení na Twitteri</string> diff --git a/main/res/values-sv/strings.xml b/main/res/values-sv/strings.xml index d3be9ff..0f23eed 100644 --- a/main/res/values-sv/strings.xml +++ b/main/res/values-sv/strings.xml @@ -176,7 +176,7 @@ <string name="err_favorite_failed">Misslyckades att ändra favoritstatus.</string> <string name="err_select_logimage_failed">Misslyckades att välja bild till loggen.</string> - <string name="err_aquire_image_failed">Hämtning av bilden misslyckades.</string> + <string name="err_acquire_image_failed">Hämtning av bilden misslyckades.</string> <string name="err_tb_display">Tyvärr kan c:geo inte visa den trackable du önskar. Är den verkligen trackable?</string> <string name="err_tb_details_open">Tyvärr kan c:geo inte öppna detaljer för trackable.</string> <string name="err_tb_forgot_saw">Tyvärr glömde c:geo vilken trackable du såg.</string> @@ -512,7 +512,6 @@ <string name="cache_attributes">Attribut</string> <string name="cache_inventory">Innehåll</string> <string name="cache_log_offline">Offline logg</string> - <string name="cache_log_images_loading">Laddar loggbilder…</string> <string name="cache_log_images_title">Loggbild</string> <string name="cache_log_image_default_title">Foto</string> <string name="cache_personal_note">Personlig anteckning</string> @@ -562,10 +561,10 @@ <string name="cache_dialog_watchlist_add_message">Lägger till cachen till din watchlist…</string> <string name="cache_dialog_watchlist_remove_title">Watchlist</string> <string name="cache_dialog_watchlist_remove_message">Tar bort cachen från din watchlist…</string> - <string name="cache_dialog_favourite_add_title">Favorit</string> - <string name="cache_dialog_favourite_add_message">Lägger till cachen till dina favoriter…</string> - <string name="cache_dialog_favourite_remove_title">Favorit</string> - <string name="cache_dialog_favourite_remove_message">Tar bort cachen från dina favoriter…</string> + <string name="cache_dialog_favorite_add_title">Favorit</string> + <string name="cache_dialog_favorite_add_message">Lägger till cachen till dina favoriter…</string> + <string name="cache_dialog_favorite_remove_title">Favorit</string> + <string name="cache_dialog_favorite_remove_message">Tar bort cachen från dina favoriter…</string> <string name="cache_menu_navigate">Navigera</string> <string name="cache_menu_navigation_drive">Navigering (med bil)</string> <string name="cache_menu_navigation_walk">Navigering (till fots)</string> @@ -607,7 +606,7 @@ <string name="cache_rating">Betyg</string> <string name="cache_own_rating">Eget betyg</string> <string name="cache_rating_of">av</string> - <string name="cache_favourite">Favorit</string> + <string name="cache_favorite">Favorit</string> <string name="cache_owner">Ägare</string> <string name="cache_hidden">Gömd</string> <string name="cache_event">Datum</string> @@ -615,9 +614,7 @@ <string name="cache_coordinates">Koordinater</string> <string name="cache_coordinates_original">Ursprungliga koordinater</string> <string name="cache_spoiler_images_title">Spoiler bilder</string> - <string name="cache_spoiler_images_loading">Laddar spoiler bilder…</string> <string name="cache_images_title">Bilder</string> - <string name="cache_images_loading">Laddar bilder…</string> <string name="cache_log_types">Loggtyper</string> <string name="cache_coordinates_no">Cachen saknar koordinater.</string> <string name="cache_clear_history">Rensa historik</string> diff --git a/main/res/values/attrs.xml b/main/res/values/attrs.xml index 558c353..092d307 100644 --- a/main/res/values/attrs.xml +++ b/main/res/values/attrs.xml @@ -22,10 +22,10 @@ <attr name="button" format="integer" /> <attr name="input" format="integer" /> <attr name="inventory" format="integer" /> - <attr name="favourite" format="integer" /> - <attr name="favourite_r" format="integer" /> - <attr name="favourite_o" format="integer" /> - <attr name="favourite_g" format="integer" /> + <attr name="favorite" format="integer" /> + <attr name="favorite_r" format="integer" /> + <attr name="favorite_o" format="integer" /> + <attr name="favorite_g" format="integer" /> <attr name="close" format="integer" /> <attr name="log_img_icon" format="integer" /> <attr name="actionbar_compass" format="integer" /> diff --git a/main/res/values/ids.xml b/main/res/values/ids.xml deleted file mode 100644 index cfb09cd..0000000 --- a/main/res/values/ids.xml +++ /dev/null @@ -1,5 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<resources> - <item type="id" name="actionbar_title" /> - <item type="id" name="actionbar_progress" /> -</resources> diff --git a/main/res/values/strings.xml b/main/res/values/strings.xml index 13926c5..42abb8f 100644 --- a/main/res/values/strings.xml +++ b/main/res/values/strings.xml @@ -126,6 +126,14 @@ <string name="log_image_camera">New</string> <string name="log_image_caption">Caption</string> <string name="log_image_description">Description</string> + <string name="log_image_scale">Scaling</string> + <string-array name="log_image_scales"> + <item>No scaling</item> + <item>512 px</item> + <item>640 px</item> + <item>800 px</item> + <item>1024 px</item> + </string-array> <!-- translation --> <string name="translate_to_sys_lang">Translate to %s</string> @@ -175,7 +183,7 @@ <string name="err_missing_device_name">Please enter a device name before registering.</string> <string name="err_favorite_failed">Changing favorite status failed.</string> <string name="err_select_logimage_failed">Selecting an image for the log failed.</string> - <string name="err_aquire_image_failed">Acquiring an image failed.</string> + <string name="err_acquire_image_failed">Acquiring an image failed.</string> <string name="err_tb_display">c:geo can\'t display trackable you want. Is it really a trackable?</string> <string name="err_tb_details_open">c:geo can\'t open trackable details.</string> @@ -512,7 +520,6 @@ <string name="cache_attributes">Attributes</string> <string name="cache_inventory">Inventory</string> <string name="cache_log_offline">Offline Log</string> - <string name="cache_log_images_loading">Loading Log images…</string> <string name="cache_log_images_title">Log images</string> <string name="cache_log_image_default_title">Photo</string> <string name="cache_personal_note">Personal note</string> @@ -562,10 +569,10 @@ <string name="cache_dialog_watchlist_add_message">Adding cache to your watchlist…</string> <string name="cache_dialog_watchlist_remove_title">Watchlist</string> <string name="cache_dialog_watchlist_remove_message">Removing cache from your watchlist…</string> - <string name="cache_dialog_favourite_add_title">Favourite</string> - <string name="cache_dialog_favourite_add_message">Adding cache to your favourites…</string> - <string name="cache_dialog_favourite_remove_title">Favourite</string> - <string name="cache_dialog_favourite_remove_message">Removing cache from your favourites…</string> + <string name="cache_dialog_favorite_add_title">Favorite</string> + <string name="cache_dialog_favorite_add_message">Adding cache to your favorites…</string> + <string name="cache_dialog_favorite_remove_title">Favorite</string> + <string name="cache_dialog_favorite_remove_message">Removing cache from your favorites…</string> <string name="cache_menu_navigate">Navigate</string> <string name="cache_menu_navigation_drive">Navigation (Driving)</string> <string name="cache_menu_navigation_walk">Navigation (Walking)</string> @@ -597,6 +604,8 @@ <string name="cache_status_disabled">Disabled</string> <string name="cache_status_premium">Premium Members only</string> <string name="cache_status_not_premium">All Members Access</string> + <string name="cache_status_stored">Stored</string> + <string name="cache_status_not_stored">Not stored</string> <string name="cache_geocode">Geo code</string> <string name="cache_name">Name</string> <string name="cache_type">Type</string> @@ -607,7 +616,7 @@ <string name="cache_rating">Rating</string> <string name="cache_own_rating">Own Rating</string> <string name="cache_rating_of">of</string> - <string name="cache_favourite">Favorite</string> + <string name="cache_favorite">Favorite</string> <string name="cache_owner">Owner</string> <string name="cache_hidden">Hidden</string> <string name="cache_event">Date</string> @@ -615,9 +624,7 @@ <string name="cache_coordinates">Coordinates</string> <string name="cache_coordinates_original">Original Coordinates</string> <string name="cache_spoiler_images_title">Spoiler images</string> - <string name="cache_spoiler_images_loading">Loading spoiler images…</string> <string name="cache_images_title">Images</string> - <string name="cache_images_loading">Loading images…</string> <string name="cache_log_types">Log types</string> <string name="cache_coordinates_no">This cache has no coordinates.</string> <string name="cache_clear_history">Clear history</string> @@ -717,13 +724,6 @@ <string name="waypoint_coordinate_formats_plain">Plain</string> - <!-- distance units --> - <string name="unit_m">m</string> - <string name="unit_km">km</string> - <string name="unit_ft">ft</string> - <string name="unit_yd">yd</string> - <string name="unit_mi">mi</string> - <!-- visit --> <string name="visit_tweet">Post this find to Twitter</string> @@ -1005,6 +1005,8 @@ <string name="attribute_swamp_no">No swamp or marsh</string> <string name="attribute_hills_yes">Hilly area</string> <string name="attribute_hills_no">No hilly area</string> + <string name="attribute_easy_climbing_yes">Lightweight climbing</string> + <string name="attribute_easy_climbing_no">No lightweight climbing</string> <string name="attribute_poi_yes">Point of interest</string> <string name="attribute_poi_no">No point of interest</string> <string name="attribute_moving_target_yes">Moving target</string> diff --git a/main/res/values/strings_not_translatable.xml b/main/res/values/strings_not_translatable.xml index 553c16a..7fde7a0 100644 --- a/main/res/values/strings_not_translatable.xml +++ b/main/res/values/strings_not_translatable.xml @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="waypoint_coordinate_formats" translatable="false">
<item>@string/waypoint_coordinate_formats_plain</item>
@@ -8,7 +8,14 @@ </string-array>
<!-- distance units -->
- <string-array name="distance_units">
+ <string name="unit_m" translatable="false">m</string>
+ <string name="unit_km" translatable="false">km</string>
+ <string name="unit_ft" translatable="false">ft</string>
+ <string name="unit_yd" translatable="false">yd</string>
+ <string name="unit_mi" translatable="false">mi</string>
+
+ <!-- distance units -->
+ <string-array name="distance_units" translatable="false">
<item>@string/unit_m</item>
<item>@string/unit_km</item>
<item>@string/unit_ft</item>
@@ -21,6 +28,15 @@ <string name="init_select_gpx_exportdir" translatable="false">…</string>
<string name="init_select_gpx_importdir" translatable="false">…</string>
+ <!-- upload image scaling -->
+ <integer-array name="log_image_scale_values">
+ <item>-1</item>
+ <item>512</item>
+ <item>640</item>
+ <item>800</item>
+ <item>1024</item>
+ </integer-array>
+
<!-- contributors -->
<string name="contributors" translatable="false">\n
· <a href="http://carnero.cc/">carnero</a> as the father of c:geo\n
@@ -80,40 +96,26 @@ <!-- changelog -->
<string name="changelog" translatable="false">\n
- <b>2013.04.03</b>\n\n
+ <b>Next release</b>\n\n
<b>New Features/Functions:</b>\n
- · Support of attaching pictures to logs\n
- · Support of opencaching.de online API in live map and nearby search\n
- · Support for searching opencaching.nl caches\n
- · Alphabetical sorting of OSM:Offline maps in map selection\n
- · Color markers also in trackable logbook\n
- · Edit cache type filter by clicking on filter bar\n
- · Inverse sorting of cache lists (hit the same menu again)\n
- · View pager for trackable activity\n
- · Menu item to delete past events\n
- · Settings: Option to ask for list to store caches\n
- · Change list in cache details\n
- · Ability to select \"All\" list from main screen\n
- · Default log type for event caches will be \"Attended\" if \"Will attend\" was logged before\n
- · Improved and extended cache type detection on live map\n
- · Waypoints can be marked as visited\n
- · Possibility to delete offline logs in lists\n
- · Support of language specific characters in log text equally to the website\n
+ · Log images can be scaled before upload to save traffic
+ · Improved online detection when refreshing caches\n
\n
<b>Bugfixing:</b>\n
- · Final flag icon lost when updating cache with self defined final\n
- · Bad selection in directory chooser\n
- · Log type \"Retract Listing\" now parsed correctly\n
- · Active cache detail page now remembered when rotating device\n
- · Replaced the term \"GC-Code\" by \"Geocode\"\n
- · Improvements for light theme\n
- · Share function uses short URL again\n
- · Offline log marker now shown after autosave of log\n
- · GPX export no longer exports waypoints without coordinates\n
- · Corrections for light scheme on Adnroid 2.x devices\n
- · Avoid crash if logging page is opened while not connected correctly\n
- \n
- <a href="https://github.com/cgeo/c-geo-opensource/issues?milestone=9&state=closed">Detailed list of all changes</a>\n
+ · Do not apply encryption/decryption when clicking on a link in a log\n
+ · Also show a picture attached to a log locally after sending the log\n
+ · Improved display of log text for OC-caches\n
+ · Improved performance of GPX exports\n
+ · GPX import option now also shown on all caches list\n
+ · OC.de attributes correction\n
+ · Reduce memory usage for images to avoid crashes\n
+ · Do not show short description if it is contained in long description for OC.de caches\n
+ · Do not allow setting the GPX dir to a not accessible directory\n
+ · Failure in waypoint projection for some languages corrected\n
+ · Avoid crashes when selecting images for logs\n
+ · Ignore hide setting when searching for owned caches\n
+ \n
+ <a href="https://github.com/cgeo/c-geo-opensource/issues?milestone=17&state=closed">Detailed list of all changes</a>\n
\n
<b>Known Limitations/Bugs:</b>\n
· Live map:\n
@@ -123,7 +125,6 @@ On low zoom owned/found caches may not be hidden anymore\n
· Other:\n
Log images with huge size cause a long loading time\n
- After uploading log images they are only shown in the logview after refreshing the cache\n
The personal note added to a cache is not synced to geocaching.com but will be overruled by personal notes on geocaching.com\n
On devices with HD display resolution OSM maps might not work. Please use Google maps in this case.\n
A huge amount of pictures on the image tab of a cache might cause a crash\n
diff --git a/main/res/values/styles.xml b/main/res/values/styles.xml index caa884a..0116577 100644 --- a/main/res/values/styles.xml +++ b/main/res/values/styles.xml @@ -81,7 +81,6 @@ </style> <style name="action_bar_progress" parent="@android:style/Widget.ProgressBar.Small"> - <item name="android:id">@id/actionbar_progress</item> <item name="android:layout_width">wrap_content</item> <item name="android:layout_height">wrap_content</item> <item name="android:layout_marginLeft">15dip</item> @@ -90,7 +89,6 @@ </style> <style name="action_bar_title"> - <item name="android:id">@id/actionbar_title</item> <item name="android:layout_width">0dip</item> <item name="android:layout_height">wrap_content</item> <item name="android:layout_weight">1</item> diff --git a/main/res/values/themes.xml b/main/res/values/themes.xml index fdc2eeb..655d9e1 100644 --- a/main/res/values/themes.xml +++ b/main/res/values/themes.xml @@ -36,10 +36,10 @@ <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="favorite">@drawable/favorite_background_dark</item> + <item name="favorite_r">@drawable/favorite_background_red_dark</item> + <item name="favorite_o">@drawable/favorite_background_orange_dark</item> + <item name="favorite_g">@drawable/favorite_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> @@ -67,10 +67,10 @@ <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="favorite">@drawable/favorite_background_light</item> + <item name="favorite_r">@drawable/favorite_background_red_light</item> + <item name="favorite_o">@drawable/favorite_background_orange_light</item> + <item name="favorite_g">@drawable/favorite_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> @@ -109,10 +109,10 @@ <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="favorite">@drawable/favorite_background_dark</item> + <item name="favorite_r">@drawable/favorite_background_red_dark</item> + <item name="favorite_o">@drawable/favorite_background_orange_dark</item> + <item name="favorite_g">@drawable/favorite_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> @@ -141,10 +141,10 @@ <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="favorite">@drawable/favorite_background_light</item> + <item name="favorite_r">@drawable/favorite_background_red_light</item> + <item name="favorite_o">@drawable/favorite_background_orange_light</item> + <item name="favorite_g">@drawable/favorite_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> diff --git a/main/src/cgeo/geocaching/AboutActivity.java b/main/src/cgeo/geocaching/AboutActivity.java index c154ffb..3b76b6c 100644 --- a/main/src/cgeo/geocaching/AboutActivity.java +++ b/main/src/cgeo/geocaching/AboutActivity.java @@ -1,5 +1,7 @@ package cgeo.geocaching; +import butterknife.InjectView; + import cgeo.geocaching.activity.AbstractActivity; import cgeo.geocaching.utils.Version; @@ -11,18 +13,17 @@ import android.view.View; import android.widget.TextView; public class AboutActivity extends AbstractActivity { + @InjectView(R.id.about_version_string) protected TextView version; + @InjectView(R.id.contributors) protected TextView contributors; + @InjectView(R.id.changelog) protected TextView changeLog; @Override public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - setTheme(); - setContentView(R.layout.about_activity); - setTitle(res.getString(R.string.about)); + super.onCreate(savedInstanceState, R.layout.about_activity); - ((TextView) findViewById(R.id.about_version_string)).setText(Version.getVersionName(this)); - ((TextView) findViewById(R.id.contributors)).setMovementMethod(LinkMovementMethod.getInstance()); - ((TextView) findViewById(R.id.changelog)).setMovementMethod(LinkMovementMethod.getInstance()); + version.setText(Version.getVersionName(this)); + contributors.setMovementMethod(LinkMovementMethod.getInstance()); + changeLog.setMovementMethod(LinkMovementMethod.getInstance()); } /** diff --git a/main/src/cgeo/geocaching/AbstractPopupActivity.java b/main/src/cgeo/geocaching/AbstractPopupActivity.java index f903d00..5ad89fb 100644 --- a/main/src/cgeo/geocaching/AbstractPopupActivity.java +++ b/main/src/cgeo/geocaching/AbstractPopupActivity.java @@ -67,12 +67,22 @@ public abstract class AbstractPopupActivity extends AbstractActivity { cacheDistance.setText(Units.getDistanceFromKilometers(geo.getCoords().distanceTo(cache.getCoords()))); cacheDistance.bringToFront(); } + onUpdateGeoData(geo); } catch (Exception e) { Log.w("Failed to UpdateLocation location."); } } }; + /** + * Callback to run when new location information is available. + * This may be overriden by deriving classes. The default implementation does nothing. + * + * @param geo the new data + */ + public void onUpdateGeoData(final IGeoData geo) { + } + protected AbstractPopupActivity(String helpTopic, int layout) { super(helpTopic); this.layout = layout; @@ -134,7 +144,6 @@ public abstract class AbstractPopupActivity extends AbstractActivity { this.setTheme(ActivityMixin.getDialogTheme()); // set layout setContentView(layout); - setTitle(res.getString(R.string.detail)); // get parameters final Bundle extras = getIntent().getExtras(); @@ -269,8 +278,8 @@ public abstract class AbstractPopupActivity extends AbstractActivity { aquireGCVote(); } - // favourite count - details.add(R.string.cache_favourite, cache.getFavoritePoints() + "×"); + // favorite count + details.add(R.string.cache_favorite, cache.getFavoritePoints() + "×"); // more details final Button buttonMore = (Button) findViewById(R.id.more_details); diff --git a/main/src/cgeo/geocaching/AddressListActivity.java b/main/src/cgeo/geocaching/AddressListActivity.java index b1de065..150bbc5 100644 --- a/main/src/cgeo/geocaching/AddressListActivity.java +++ b/main/src/cgeo/geocaching/AddressListActivity.java @@ -20,11 +20,7 @@ public class AddressListActivity extends AbstractListActivity { @Override public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - setTheme(); - setContentView(R.layout.addresses); - setTitle(res.getString(R.string.search_address_result)); + super.onCreate(savedInstanceState, R.layout.addresses); // get parameters final String keyword = getIntent().getStringExtra(Intents.EXTRA_KEYWORD); diff --git a/main/src/cgeo/geocaching/CacheDetailActivity.java b/main/src/cgeo/geocaching/CacheDetailActivity.java index 43ce65f..1e2377b 100644 --- a/main/src/cgeo/geocaching/CacheDetailActivity.java +++ b/main/src/cgeo/geocaching/CacheDetailActivity.java @@ -21,13 +21,14 @@ import cgeo.geocaching.network.Parameters; import cgeo.geocaching.ui.AbstractCachingPageViewCreator; import cgeo.geocaching.ui.AnchorAwareLinkMovementMethod; import cgeo.geocaching.ui.CacheDetailsCreator; +import cgeo.geocaching.ui.CoordinatesFormatSwitcher; import cgeo.geocaching.ui.DecryptTextClickListener; +import cgeo.geocaching.ui.EditNoteDialog; +import cgeo.geocaching.ui.EditNoteDialog.EditNoteDialogListener; import cgeo.geocaching.ui.Formatter; import cgeo.geocaching.ui.ImagesList; -import cgeo.geocaching.ui.ImagesList.ImageType; import cgeo.geocaching.ui.LoggingUI; import cgeo.geocaching.ui.WeakReferenceHandler; -import cgeo.geocaching.ui.dialog.EditorDialog; import cgeo.geocaching.utils.BaseUtils; import cgeo.geocaching.utils.CancellableHandler; import cgeo.geocaching.utils.ClipboardUtils; @@ -65,6 +66,7 @@ import android.os.AsyncTask; import android.os.Bundle; import android.os.Handler; import android.os.Message; +import android.support.v4.app.FragmentManager; import android.text.Editable; import android.text.Html; import android.text.Spannable; @@ -112,7 +114,8 @@ import java.util.regex.Pattern; * * e.g. details, description, logs, waypoints, inventory... */ -public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailActivity.Page> { +public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailActivity.Page> + implements EditNoteDialogListener { private static final int MENU_FIELD_COPY = 1; private static final int MENU_FIELD_TRANSLATE = 2; @@ -139,6 +142,8 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc private final Progress progress = new Progress(); private SearchResult search; + private EditNoteDialogListener editNoteDialogListener; + private final GeoDirHandler locationUpdater = new GeoDirHandler() { @Override public void updateGeoData(final IGeoData geo) { @@ -194,12 +199,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc @Override public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - // initialize the main view and set a default title - setTheme(); - setContentView(R.layout.cacheview); - setTitle(res.getString(R.string.cache)); + super.onCreate(savedInstanceState, R.layout.cacheview); String geocode = null; @@ -795,7 +795,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc /** * Wrapper for the referenced method in the xml-layout. */ - public void startDefaultNavigation(@SuppressWarnings("unused") View view) { + public void goDefaultNavigation(@SuppressWarnings("unused") View view) { startDefaultNavigation(); } @@ -899,7 +899,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc return; } imagesList = new ImagesList(this, cache.getGeocode()); - imagesList.loadImages(imageView, cache.getImages(), ImageType.AllImages, false); + imagesList.loadImages(imageView, cache.getImages(), false); } public static void startActivity(final Context context, final String geocode) { @@ -1163,7 +1163,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc // favorite count if (cache.getFavoritePoints() > 0) { - details.add(R.string.cache_favourite, cache.getFavoritePoints() + "×"); + details.add(R.string.cache_favorite, cache.getFavoritePoints() + "×"); } // own rating @@ -1202,23 +1202,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc // cache coordinates if (cache.getCoords() != null) { TextView valueView = details.add(R.string.cache_coordinates, cache.getCoords().toString()); - valueView.setOnClickListener(new View.OnClickListener() { - private int position = 0; - private GeopointFormatter.Format[] availableFormats = new GeopointFormatter.Format[] { - GeopointFormatter.Format.LAT_LON_DECMINUTE, - GeopointFormatter.Format.LAT_LON_DECSECOND, - GeopointFormatter.Format.LAT_LON_DECDEGREE - }; - - // rotate coordinate formats on click - @Override - public void onClick(View view) { - position = (position + 1) % availableFormats.length; - - final TextView valueView = (TextView) view.findViewById(R.id.value); - valueView.setText(cache.getCoords().format(availableFormats[position])); - } - }); + valueView.setOnClickListener(new CoordinatesFormatSwitcher(cache.getCoords())); registerForContextMenu(valueView); } @@ -1354,6 +1338,11 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc return; } + if (!Network.isNetworkConnected(getApplicationContext())) { + showToast(getString(R.string.err_server)); + return; + } + final RefreshCacheHandler refreshCacheHandler = new RefreshCacheHandler(); progress.show(CacheDetailActivity.this, res.getString(R.string.cache_dialog_refresh_title), res.getString(R.string.cache_dialog_refresh_message), true, refreshCacheHandler.cancelMessage()); @@ -1498,7 +1487,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc } } - /** Thread to add this cache to the favourite list of the user */ + /** Thread to add this cache to the favorite list of the user */ private class FavoriteAddThread extends Thread { private final Handler handler; @@ -1512,7 +1501,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc } } - /** Thread to remove this cache to the favourite list of the user */ + /** Thread to remove this cache to the favorite list of the user */ private class FavoriteRemoveThread extends Thread { private final Handler handler; @@ -1539,25 +1528,25 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc } /** - * Listener for "add to favourites" button + * Listener for "add to favorites" button */ private class FavoriteAddClickListener extends AbstractWatchlistClickListener { @Override public void onClick(View arg0) { - doExecute(R.string.cache_dialog_favourite_add_title, - R.string.cache_dialog_favourite_add_message, + doExecute(R.string.cache_dialog_favorite_add_title, + R.string.cache_dialog_favorite_add_message, new FavoriteAddThread(new FavoriteUpdateHandler())); } } /** - * Listener for "remove from favourites" button + * Listener for "remove from favorites" button */ private class FavoriteRemoveClickListener extends AbstractWatchlistClickListener { @Override public void onClick(View arg0) { - doExecute(R.string.cache_dialog_favourite_remove_title, - R.string.cache_dialog_favourite_remove_message, + doExecute(R.string.cache_dialog_favorite_remove_title, + R.string.cache_dialog_favorite_remove_message, new FavoriteRemoveThread(new FavoriteUpdateHandler())); } } @@ -1763,8 +1752,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc // cache short description if (StringUtils.isNotBlank(cache.getShortDescription())) { - new LoadDescriptionTask().execute(cache.getShortDescription(), view.findViewById(R.id.shortdesc), null); - registerForContextMenu(view.findViewById(R.id.shortdesc)); + new LoadDescriptionTask(cache.getShortDescription(), view.findViewById(R.id.shortdesc), null, null).execute(); } // long description @@ -1794,16 +1782,16 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc personalNoteEdit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - EditorDialog editor = new EditorDialog(CacheDetailActivity.this, personalNoteView.getText()); - editor.setOnEditorUpdate(new EditorDialog.EditorUpdate() { + editNoteDialogListener = new EditNoteDialogListener() { @Override - public void update(CharSequence editorText) { - cache.setPersonalNote(editorText.toString()); + public void onFinishEditNoteDialog(final String note) { + cache.setPersonalNote(note); setPersonalNote(personalNoteView); - cgData.saveCache(cache, EnumSet.of(SaveFlag.SAVE_DB)); - } - }); - editor.show(); + cgData.saveCache(cache, EnumSet.of(SaveFlag.SAVE_DB)); } + }; + final FragmentManager fm = getSupportFragmentManager(); + final EditNoteDialog dialog = new EditNoteDialog(cache.getPersonalNote()); + dialog.show(fm, "fragment_edit_note"); } }); } else { @@ -1866,8 +1854,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc personalNoteView.setText(personalNote, TextView.BufferType.SPANNABLE); if (StringUtils.isNotBlank(personalNote)) { personalNoteView.setVisibility(View.VISIBLE); - } - else { + } else { personalNoteView.setVisibility(View.GONE); } } @@ -1878,12 +1865,16 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc showDesc.setOnClickListener(null); view.findViewById(R.id.loading).setVisibility(View.VISIBLE); - new LoadDescriptionTask().execute(cache.getDescription(), view.findViewById(R.id.longdesc), view.findViewById(R.id.loading)); - registerForContextMenu(view.findViewById(R.id.longdesc)); + new LoadDescriptionTask(cache.getDescription(), view.findViewById(R.id.longdesc), view.findViewById(R.id.loading), view.findViewById(R.id.shortdesc)).execute(); } } + @Override + public void onFinishEditNoteDialog(final String note) { + editNoteDialogListener.onFinishEditNoteDialog(note); + } + private static class HtmlImageCounter implements Html.ImageGetter { private int imageCount = 0; @@ -1910,28 +1901,33 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc * </ol> */ private class LoadDescriptionTask extends AsyncTask<Object, Void, Void> { - private View loadingIndicatorView; - private TextView descriptionView; - private String descriptionString; + private final View loadingIndicatorView; + private final TextView descriptionView; + private final String descriptionString; private Spanned description; + private final View shortDescView; + public LoadDescriptionTask(final String description, final View descriptionView, final View loadingIndicatorView, final View shortDescView) { + this.descriptionString = description; + this.descriptionView = (TextView) descriptionView; + this.loadingIndicatorView = loadingIndicatorView; + this.shortDescView = shortDescView; + } @Override protected Void doInBackground(Object... params) { try { - descriptionString = ((String) params[0]); - descriptionView = (TextView) params[1]; - loadingIndicatorView = (View) params[2]; - // Fast preview: parse only HTML without loading any images HtmlImageCounter imageCounter = new HtmlImageCounter(); final UnknownTagsHandler unknownTagsHandler = new UnknownTagsHandler(); description = Html.fromHtml(descriptionString, imageCounter, unknownTagsHandler); publishProgress(); + + boolean needsRefresh = false; if (imageCounter.getImageCount() > 0) { // Complete view: parse again with loading images - if necessary ! If there are any images causing problems the user can see at least the preview description = Html.fromHtml(descriptionString, new HtmlImage(cache.getGeocode(), true, cache.getListId(), false), unknownTagsHandler); - publishProgress(); + needsRefresh = true; } // If description has an HTML construct which may be problematic to render, add a note at the end of the long description. @@ -1943,6 +1939,10 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc final Spanned tableNote = Html.fromHtml(res.getString(R.string.cache_description_table_note, "<a href=\"" + cache.getUrl() + "\">" + connector.getName() + "</a>")); ((Editable) description).append("\n\n").append(tableNote); ((Editable) description).setSpan(new StyleSpan(Typeface.ITALIC), startPos, description.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + needsRefresh = true; + } + + if (needsRefresh) { publishProgress(); } } catch (Exception e) { @@ -1951,25 +1951,40 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc return null; } - /* - * (non-Javadoc) - * - * @see android.os.AsyncTask#onProgressUpdate(Progress[]) - */ @Override protected void onProgressUpdate(Void... values) { - if (description != null) { - if (StringUtils.isNotBlank(descriptionString)) { - descriptionView.setText(description, TextView.BufferType.SPANNABLE); - descriptionView.setMovementMethod(AnchorAwareLinkMovementMethod.getInstance()); - fixBlackTextColor(descriptionView, descriptionString); - } - - descriptionView.setVisibility(View.VISIBLE); - } else { + if (description == null) { showToast(res.getString(R.string.err_load_descr_failed)); + return; } + if (StringUtils.isNotBlank(descriptionString)) { + descriptionView.setText(description, TextView.BufferType.SPANNABLE); + descriptionView.setMovementMethod(AnchorAwareLinkMovementMethod.getInstance()); + fixBlackTextColor(descriptionView, descriptionString); + descriptionView.setVisibility(View.VISIBLE); + registerForContextMenu(descriptionView); + hideDuplicatedShortDescription(); + } + } + + /** + * Hide the short description, if it is contained somewhere at the start of the long description. + */ + private void hideDuplicatedShortDescription() { + if (shortDescView != null) { + final String shortDescription = cache.getShortDescription(); + if (StringUtils.isNotBlank(shortDescription)) { + int index = descriptionString.indexOf(shortDescription); + if (index >= 0 && index < 200) { + shortDescView.setVisibility(View.GONE); + } + } + } + } + + @Override + protected void onPostExecute(Void result) { if (null != loadingIndicatorView) { loadingIndicatorView.setVisibility(View.GONE); } @@ -2095,7 +2110,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc if (imageCounter.getImageCount() > 0) { // Complete view: parse again with loading images - if necessary ! If there are any images causing problems the user can see at least the preview LogImageLoader loader = new LogImageLoader(holder); - loader.execute(new String[] { logText }); + loader.execute(logText); } } else { @@ -2206,6 +2221,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc // coordinates if (null != wpt.getCoords()) { final TextView coordinatesView = (TextView) waypointView.findViewById(R.id.coordinates); + coordinatesView.setOnClickListener(new CoordinatesFormatSwitcher(wpt.getCoords())); coordinatesView.setText(wpt.getCoords().toString()); coordinatesView.setVisibility(View.VISIBLE); } diff --git a/main/src/cgeo/geocaching/CachePopup.java b/main/src/cgeo/geocaching/CachePopup.java index e6d0148..d51f9f2 100644 --- a/main/src/cgeo/geocaching/CachePopup.java +++ b/main/src/cgeo/geocaching/CachePopup.java @@ -3,6 +3,7 @@ package cgeo.geocaching; import cgeo.geocaching.activity.Progress; import cgeo.geocaching.apps.cache.navi.NavigationAppFactory; import cgeo.geocaching.geopoint.Geopoint; +import cgeo.geocaching.network.Network; import cgeo.geocaching.ui.CacheDetailsCreator; import cgeo.geocaching.utils.CancellableHandler; import cgeo.geocaching.utils.Log; @@ -160,6 +161,11 @@ public class CachePopup extends AbstractPopupActivity { return; } + if (!Network.isNetworkConnected(getApplicationContext())) { + showToast(getString(R.string.err_server)); + return; + } + final RefreshCacheHandler refreshCacheHandler = new RefreshCacheHandler(); progress.show(CachePopup.this, res.getString(R.string.cache_dialog_refresh_title), res.getString(R.string.cache_dialog_refresh_message), true, refreshCacheHandler.cancelMessage()); new RefreshCacheThread(refreshCacheHandler).start(); diff --git a/main/src/cgeo/geocaching/EditWaypointActivity.java b/main/src/cgeo/geocaching/EditWaypointActivity.java index 7f011fc..b937ba0 100644 --- a/main/src/cgeo/geocaching/EditWaypointActivity.java +++ b/main/src/cgeo/geocaching/EditWaypointActivity.java @@ -1,5 +1,7 @@ package cgeo.geocaching; +import butterknife.InjectView; + import cgeo.geocaching.activity.AbstractActivity; import cgeo.geocaching.activity.ActivityMixin; import cgeo.geocaching.connector.ConnectorFactory; @@ -37,6 +39,7 @@ import android.widget.CompoundButton; import android.widget.CompoundButton.OnCheckedChangeListener; import android.widget.EditText; import android.widget.RadioButton; +import android.widget.RadioGroup; import android.widget.Spinner; import java.util.ArrayList; @@ -44,6 +47,19 @@ import java.util.EnumSet; import java.util.List; public class EditWaypointActivity extends AbstractActivity { + @InjectView(R.id.buttonLatitude) protected Button buttonLat; + @InjectView(R.id.buttonLongitude) protected Button buttonLon; + @InjectView(R.id.add_waypoint) protected Button addWaypoint; + @InjectView(R.id.note) protected EditText note; + @InjectView(R.id.wpt_visited_checkbox) protected CheckBox visitedCheckBox; + @InjectView(R.id.name) protected AutoCompleteTextView waypointName; + @InjectView(R.id.type) protected Spinner waypointTypeSelector; + @InjectView(R.id.distance) protected EditText distanceView; + @InjectView(R.id.modify_cache_coordinates_group) protected RadioGroup coordinatesGroup; + @InjectView(R.id.modify_cache_coordinates_local_and_remote) protected RadioButton modifyBoth; + @InjectView(R.id.distanceUnit) protected Spinner distanceUnitSelector; + @InjectView(R.id.bearing) protected EditText bearing; + @InjectView(R.id.modify_cache_coordinates_local) protected RadioButton modifyLocal; private String geocode = null; private int id = -1; @@ -78,15 +94,15 @@ public class EditWaypointActivity extends AbstractActivity { visited = waypoint.isVisited(); if (waypoint.getCoords() != null) { - ((Button) findViewById(R.id.buttonLatitude)).setText(waypoint.getCoords().format(GeopointFormatter.Format.LAT_DECMINUTE)); - ((Button) findViewById(R.id.buttonLongitude)).setText(waypoint.getCoords().format(GeopointFormatter.Format.LON_DECMINUTE)); + buttonLat.setText(waypoint.getCoords().format(GeopointFormatter.Format.LAT_DECMINUTE)); + buttonLon.setText(waypoint.getCoords().format(GeopointFormatter.Format.LON_DECMINUTE)); } - ((EditText) findViewById(R.id.name)).setText(Html.fromHtml(StringUtils.trimToEmpty(waypoint.getName())).toString()); + waypointName.setText(Html.fromHtml(StringUtils.trimToEmpty(waypoint.getName())).toString()); if (BaseUtils.containsHtml(waypoint.getNote())) { - ((EditText) findViewById(R.id.note)).setText(Html.fromHtml(StringUtils.trimToEmpty(waypoint.getNote())).toString()); + note.setText(Html.fromHtml(StringUtils.trimToEmpty(waypoint.getNote())).toString()); } else { - ((EditText) findViewById(R.id.note)).setText(StringUtils.trimToEmpty(waypoint.getNote())); + note.setText(StringUtils.trimToEmpty(waypoint.getNote())); } Geocache cache = cgData.loadCache(geocode, LoadFlags.LOAD_CACHE_ONLY); setCoordsModificationVisibility(ConnectorFactory.getConnector(geocode), cache); @@ -95,7 +111,7 @@ public class EditWaypointActivity extends AbstractActivity { if (own) { initializeWaypointTypeSelector(); } - ((CheckBox) findViewById(R.id.wpt_visited_checkbox)).setChecked(visited); + visitedCheckBox.setChecked(visited); initializeDistanceUnitSelector(); } catch (Exception e) { @@ -111,11 +127,7 @@ public class EditWaypointActivity extends AbstractActivity { @Override public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - setTheme(); - setContentView(R.layout.edit_waypoint_activity); - setTitle("waypoint"); + super.onCreate(savedInstanceState, R.layout.edit_waypoint_activity); // get parameters Bundle extras = getIntent().getExtras(); @@ -138,24 +150,19 @@ public class EditWaypointActivity extends AbstractActivity { setTitle(res.getString(R.string.waypoint_edit_title)); } - Button buttonLat = (Button) findViewById(R.id.buttonLatitude); buttonLat.setOnClickListener(new CoordDialogListener()); - Button buttonLon = (Button) findViewById(R.id.buttonLongitude); buttonLon.setOnClickListener(new CoordDialogListener()); - Button addWaypoint = (Button) findViewById(R.id.add_waypoint); addWaypoint.setOnClickListener(new CoordsListener()); List<String> wayPointNames = new ArrayList<String>(); for (WaypointType wpt : WaypointType.ALL_TYPES_EXCEPT_OWN_AND_ORIGINAL) { wayPointNames.add(wpt.getL10n()); } - AutoCompleteTextView textView = (AutoCompleteTextView) findViewById(R.id.name); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line, wayPointNames); - textView.setAdapter(adapter); + waypointName.setAdapter(adapter); if (id > 0) { - Spinner waypointTypeSelector = (Spinner) findViewById(R.id.type); waypointTypeSelector.setVisibility(View.GONE); waitDialog = ProgressDialog.show(this, null, res.getString(R.string.waypoint_loading), true); @@ -171,7 +178,6 @@ public class EditWaypointActivity extends AbstractActivity { IConnector con = ConnectorFactory.getConnector(geocode); setCoordsModificationVisibility(con, cache); } - CheckBox visitedCheckBox = ((CheckBox) findViewById(R.id.wpt_visited_checkbox)); visitedCheckBox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { @@ -181,16 +187,16 @@ public class EditWaypointActivity extends AbstractActivity { initializeDistanceUnitSelector(); - disableSuggestions((EditText) findViewById(R.id.distance)); + disableSuggestions(distanceView); } private void setCoordsModificationVisibility(IConnector con, Geocache cache) { if (cache != null && (cache.getType() == CacheType.MYSTERY || cache.getType() == CacheType.MULTI)) { - findViewById(R.id.modify_cache_coordinates_group).setVisibility(View.VISIBLE); - findViewById(R.id.modify_cache_coordinates_local_and_remote).setVisibility(con.supportsOwnCoordinates() ? View.VISIBLE : View.GONE); + coordinatesGroup.setVisibility(View.VISIBLE); + modifyBoth.setVisibility(con.supportsOwnCoordinates() ? View.VISIBLE : View.GONE); } else { - findViewById(R.id.modify_cache_coordinates_group).setVisibility(View.GONE); - findViewById(R.id.modify_cache_coordinates_local_and_remote).setVisibility(View.GONE); + coordinatesGroup.setVisibility(View.GONE); + modifyBoth.setVisibility(View.GONE); } } @@ -227,9 +233,6 @@ public class EditWaypointActivity extends AbstractActivity { } private void initializeWaypointTypeSelector() { - - Spinner waypointTypeSelector = (Spinner) findViewById(R.id.type); - wpTypes = new ArrayList<WaypointType>(WaypointType.ALL_TYPES_EXCEPT_OWN_AND_ORIGINAL); ArrayAdapter<WaypointType> wpAdapter = new ArrayAdapter<WaypointType>(this, android.R.layout.simple_spinner_item, wpTypes.toArray(new WaypointType[wpTypes.size()])); wpAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); @@ -247,9 +250,6 @@ public class EditWaypointActivity extends AbstractActivity { } private void initializeDistanceUnitSelector() { - - Spinner distanceUnitSelector = (Spinner) findViewById(R.id.distanceUnit); - if (StringUtils.isBlank(distanceUnit)) { if (Settings.isUseMetricUnits()) { distanceUnitSelector.setSelection(0); // m @@ -271,10 +271,8 @@ public class EditWaypointActivity extends AbstractActivity { } try { - Button bLat = (Button) findViewById(R.id.buttonLatitude); - Button bLon = (Button) findViewById(R.id.buttonLongitude); - bLat.setHint(geo.getCoords().format(GeopointFormatter.Format.LAT_DECMINUTE_RAW)); - bLon.setHint(geo.getCoords().format(GeopointFormatter.Format.LON_DECMINUTE_RAW)); + buttonLat.setHint(geo.getCoords().format(GeopointFormatter.Format.LAT_DECMINUTE_RAW)); + buttonLon.setHint(geo.getCoords().format(GeopointFormatter.Format.LON_DECMINUTE_RAW)); } catch (final Exception e) { Log.e("failed to update location", e); } @@ -311,8 +309,8 @@ public class EditWaypointActivity extends AbstractActivity { coordsDialog.setOnCoordinateUpdate(new CoordinatesInputDialog.CoordinateUpdate() { @Override public void update(final Geopoint gp) { - ((Button) findViewById(R.id.buttonLatitude)).setText(gp.format(GeopointFormatter.Format.LAT_DECMINUTE)); - ((Button) findViewById(R.id.buttonLongitude)).setText(gp.format(GeopointFormatter.Format.LON_DECMINUTE)); + buttonLat.setText(gp.format(GeopointFormatter.Format.LAT_DECMINUTE)); + buttonLon.setText(gp.format(GeopointFormatter.Format.LON_DECMINUTE)); if (waypoint != null) { waypoint.setCoords(gp); } else { @@ -378,11 +376,11 @@ public class EditWaypointActivity extends AbstractActivity { @Override public void onClick(View arg0) { - final String bearingText = ((EditText) findViewById(R.id.bearing)).getText().toString(); + final String bearingText = bearing.getText().toString(); // combine distance from EditText and distanceUnit saved from Spinner - final String distanceText = ((EditText) findViewById(R.id.distance)).getText().toString() + distanceUnit; - final String latText = ((Button) findViewById(R.id.buttonLatitude)).getText().toString(); - final String lonText = ((Button) findViewById(R.id.buttonLongitude)).getText().toString(); + final String distanceText = distanceView.getText().toString() + distanceUnit; + final String latText = buttonLat.getText().toString(); + final String lonText = buttonLon.getText().toString(); if (StringUtils.isBlank(bearingText) && StringUtils.isBlank(distanceText) && StringUtils.isBlank(latText) && StringUtils.isBlank(lonText)) { @@ -430,9 +428,9 @@ public class EditWaypointActivity extends AbstractActivity { } // if no name is given, just give the waypoint its number as name - final String givenName = ((EditText) findViewById(R.id.name)).getText().toString().trim(); + final String givenName = waypointName.getText().toString().trim(); final String name = StringUtils.isNotEmpty(givenName) ? givenName : res.getString(R.string.waypoint) + " " + (wpCount + 1); - final String note = ((EditText) findViewById(R.id.note)).getText().toString().trim(); + final String noteText = note.getText().toString().trim(); final Geopoint coordsToSave = coords; final ProgressDialog progress = ProgressDialog.show(EditWaypointActivity.this, getString(R.string.cache), getString(R.string.waypoint_being_saved), true); final Handler finishHandler = new Handler() { @@ -483,7 +481,7 @@ public class EditWaypointActivity extends AbstractActivity { waypoint.setPrefix(prefix); waypoint.setLookup(lookup); waypoint.setCoords(coordsToSave); - waypoint.setNote(note); + waypoint.setNote(noteText); waypoint.setVisited(visited); waypoint.setId(id); @@ -501,8 +499,6 @@ public class EditWaypointActivity extends AbstractActivity { StaticMapsProvider.storeWaypointStaticMap(cache, waypoint, false); } } - final RadioButton modifyLocal = (RadioButton) findViewById(R.id.modify_cache_coordinates_local); - final RadioButton modifyBoth = (RadioButton) findViewById(R.id.modify_cache_coordinates_local_and_remote); if (modifyLocal.isChecked() || modifyBoth.isChecked()) { if (!cache.hasUserModifiedCoords()) { final Waypoint origWaypoint = new Waypoint(cgeoapplication.getInstance().getString(R.string.cache_coordinates_original), WaypointType.ORIGINAL, false); diff --git a/main/src/cgeo/geocaching/Geocache.java b/main/src/cgeo/geocaching/Geocache.java index 836cccb..fe5de91 100644 --- a/main/src/cgeo/geocaching/Geocache.java +++ b/main/src/cgeo/geocaching/Geocache.java @@ -47,8 +47,8 @@ import java.util.Collections; import java.util.Date; import java.util.EnumSet; import java.util.HashMap; -import java.util.LinkedList; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.regex.Pattern; @@ -483,7 +483,7 @@ public class Geocache implements ICache, IWaypoint { } public List<LogType> getPossibleLogTypes() { - final List<LogType> logTypes = new LinkedList<LogType>(); + final List<LogType> logTypes = new ArrayList<LogType>(); if (isEventCache()) { logTypes.add(LogType.WILL_ATTEND); logTypes.add(LogType.NOTE); @@ -510,7 +510,6 @@ public class Geocache implements ICache, IWaypoint { logTypes.add(LogType.TEMP_DISABLE_LISTING); logTypes.add(LogType.ENABLE_LISTING); logTypes.add(LogType.ARCHIVE); - logTypes.remove(LogType.UPDATE_COORDINATES); } return logTypes; } @@ -710,10 +709,7 @@ public class Geocache implements ICache, IWaypoint { public String getPersonalNote() { // non premium members have no personal notes, premium members have an empty string by default. // map both to null, so other code doesn't need to differentiate - if (StringUtils.isBlank(personalNote)) { - return null; - } - return personalNote; + return StringUtils.defaultIfBlank(personalNote, null); } public boolean supportsUserActions() { @@ -765,8 +761,8 @@ public class Geocache implements ICache, IWaypoint { return favorite; } - public void setFavorite(boolean favourite) { - this.favorite = favourite; + public void setFavorite(boolean favorite) { + this.favorite = favorite; } @Override @@ -1360,6 +1356,9 @@ public class Geocache implements ICache, IWaypoint { return null; } + /** + * Detect coordinates in the personal note and convert them to user defined waypoints. Works by rule of thumb. + */ public void parseWaypointsFromNote() { try { if (StringUtils.isBlank(getPersonalNote())) { @@ -1378,7 +1377,8 @@ public class Geocache implements ICache, IWaypoint { ((point.getLatitudeE6() % 1000) != 0 || (point.getLongitudeE6() % 1000) != 0) && !hasIdenticalWaypoint(point)) { final String name = cgeoapplication.getInstance().getString(R.string.cache_personal_note) + " " + count; - final Waypoint waypoint = new Waypoint(name, WaypointType.WAYPOINT, false); + final String potentialWaypointType = note.substring(Math.max(0, matcher.start() - 15)); + final Waypoint waypoint = new Waypoint(name, parseWaypointType(potentialWaypointType), false); waypoint.setCoords(point); addOrChangeWaypoint(waypoint, false); count++; @@ -1395,6 +1395,25 @@ public class Geocache implements ICache, IWaypoint { } } + /** + * Detect waypoint types in the personal note text. It works by rule of thumb only. + */ + private static WaypointType parseWaypointType(final String input) { + final String lowerInput = StringUtils.substring(input, 0, 20).toLowerCase(Locale.getDefault()); + for (WaypointType wpType : WaypointType.values()) { + if (lowerInput.contains(wpType.getL10n().toLowerCase(Locale.getDefault()))) { + return wpType; + } + if (lowerInput.contains(wpType.id)) { + return wpType; + } + if (lowerInput.contains(wpType.name().toLowerCase(Locale.US))) { + return wpType; + } + } + return WaypointType.WAYPOINT; + } + private boolean hasIdenticalWaypoint(final Geopoint point) { for (final Waypoint waypoint: waypoints) { if (waypoint.getCoords().equals(point)) { diff --git a/main/src/cgeo/geocaching/GpxFileListActivity.java b/main/src/cgeo/geocaching/GpxFileListActivity.java index f12a30c..de0be21 100644 --- a/main/src/cgeo/geocaching/GpxFileListActivity.java +++ b/main/src/cgeo/geocaching/GpxFileListActivity.java @@ -31,14 +31,9 @@ public class GpxFileListActivity extends AbstractFileListActivity<GPXListAdapter return Collections.singletonList(new File(Settings.getGpxImportDir()));
}
- @Override
- protected void setTitle() {
- setTitle(res.getString(R.string.gpx_import_title));
- }
-
public static void startSubActivity(Activity fromActivity, int listId) {
final Intent intent = new Intent(fromActivity, GpxFileListActivity.class);
- intent.putExtra(Intents.EXTRA_LIST_ID, listId);
+ intent.putExtra(Intents.EXTRA_LIST_ID, StoredList.getConcreteList(listId));
fromActivity.startActivityForResult(intent, 0);
}
diff --git a/main/src/cgeo/geocaching/ImageSelectActivity.java b/main/src/cgeo/geocaching/ImageSelectActivity.java index 347cd86..7c8df5a 100644 --- a/main/src/cgeo/geocaching/ImageSelectActivity.java +++ b/main/src/cgeo/geocaching/ImageSelectActivity.java @@ -2,6 +2,7 @@ package cgeo.geocaching; import cgeo.geocaching.activity.AbstractActivity; import cgeo.geocaching.compatibility.Compatibility; +import cgeo.geocaching.utils.ImageHelper; import cgeo.geocaching.utils.Log; import org.apache.commons.lang3.StringUtils; @@ -10,14 +11,18 @@ import android.content.Intent; import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.BitmapFactory; +import android.graphics.drawable.BitmapDrawable; import android.net.Uri; import android.os.Bundle; import android.provider.MediaStore; import android.provider.MediaStore.MediaColumns; import android.view.View; +import android.widget.AdapterView; +import android.widget.AdapterView.OnItemSelectedListener; import android.widget.Button; import android.widget.EditText; import android.widget.ImageView; +import android.widget.Spinner; import java.io.File; import java.text.SimpleDateFormat; @@ -28,20 +33,24 @@ public class ImageSelectActivity extends AbstractActivity { static final String EXTRAS_CAPTION = "caption"; static final String EXTRAS_DESCRIPTION = "description"; static final String EXTRAS_URI_AS_STRING = "uri"; + static final String EXTRAS_SCALE = "scale"; private static final String SAVED_STATE_IMAGE_CAPTION = "cgeo.geocaching.saved_state_image_caption"; private static final String SAVED_STATE_IMAGE_DESCRIPTION = "cgeo.geocaching.saved_state_image_description"; private static final String SAVED_STATE_IMAGE_URI = "cgeo.geocaching.saved_state_image_uri"; + private static final String SAVED_STATE_IMAGE_SCALE = "cgeo.geocaching.saved_state_image_scale"; private static final int SELECT_NEW_IMAGE = 1; private static final int SELECT_STORED_IMAGE = 2; private EditText captionView; private EditText descriptionView; + private Spinner scaleView; // Data to be saved while reconfiguring private String imageCaption; private String imageDescription; + private int scaleChoiceIndex; private Uri imageUri; public ImageSelectActivity() { @@ -50,12 +59,9 @@ public class ImageSelectActivity extends AbstractActivity { @Override public void onCreate(final Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - setTheme(); - setContentView(R.layout.visit_image); - setTitle(res.getString(R.string.log_image)); + super.onCreate(savedInstanceState, R.layout.visit_image); + scaleChoiceIndex = Settings.getLogImageScale(); imageCaption = ""; imageDescription = ""; imageUri = Uri.EMPTY; @@ -66,6 +72,7 @@ public class ImageSelectActivity extends AbstractActivity { imageCaption = extras.getString(EXTRAS_CAPTION); imageDescription = extras.getString(EXTRAS_DESCRIPTION); imageUri = Uri.parse(extras.getString(EXTRAS_URI_AS_STRING)); + scaleChoiceIndex = extras.getInt(EXTRAS_SCALE, scaleChoiceIndex); } // Restore previous state @@ -73,6 +80,7 @@ public class ImageSelectActivity extends AbstractActivity { imageCaption = savedInstanceState.getString(SAVED_STATE_IMAGE_CAPTION); imageDescription = savedInstanceState.getString(SAVED_STATE_IMAGE_DESCRIPTION); imageUri = Uri.parse(savedInstanceState.getString(SAVED_STATE_IMAGE_URI)); + scaleChoiceIndex = savedInstanceState.getInt(SAVED_STATE_IMAGE_SCALE); } final Button cameraButton = (Button) findViewById(R.id.camera); @@ -103,6 +111,20 @@ public class ImageSelectActivity extends AbstractActivity { descriptionView.setText(imageDescription); } + scaleView = (Spinner) findViewById(R.id.logImageScale); + scaleView.setSelection(scaleChoiceIndex); + scaleView.setOnItemSelectedListener(new OnItemSelectedListener() { + @Override + public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) { + scaleChoiceIndex = scaleView.getSelectedItemPosition(); + Settings.setLogImageScale(scaleChoiceIndex); + } + + @Override + public void onNothingSelected(AdapterView<?> arg0) { + } + }); + final Button saveButton = (Button) findViewById(R.id.save); saveButton.setOnClickListener(new View.OnClickListener() { @@ -131,15 +153,19 @@ public class ImageSelectActivity extends AbstractActivity { outState.putString(SAVED_STATE_IMAGE_CAPTION, imageCaption); outState.putString(SAVED_STATE_IMAGE_DESCRIPTION, imageDescription); outState.putString(SAVED_STATE_IMAGE_URI, imageUri != null ? imageUri.getPath() : StringUtils.EMPTY); + outState.putInt(SAVED_STATE_IMAGE_SCALE, scaleChoiceIndex); } public void saveImageInfo(boolean saveInfo) { if (saveInfo) { + String filename = writeScaledImage(imageUri.getPath()); + imageUri = Uri.parse(filename); Intent intent = new Intent(); syncEditTexts(); intent.putExtra(EXTRAS_CAPTION, imageCaption); intent.putExtra(EXTRAS_DESCRIPTION, imageDescription); intent.putExtra(EXTRAS_URI_AS_STRING, imageUri.toString()); + intent.putExtra(EXTRAS_SCALE, scaleChoiceIndex); setResult(RESULT_OK, intent); } else { @@ -152,6 +178,7 @@ public class ImageSelectActivity extends AbstractActivity { private void syncEditTexts() { imageCaption = captionView.getText().toString(); imageDescription = descriptionView.getText().toString(); + scaleChoiceIndex = scaleView.getSelectedItemPosition(); } private void selectImageFromCamera() { @@ -231,8 +258,27 @@ public class ImageSelectActivity extends AbstractActivity { loadImagePreview(); } + /** + * Scales and writes the scaled image. + * + * @param filePath + * @return + */ + private String writeScaledImage(String filePath) { + Bitmap image = BitmapFactory.decodeFile(filePath); + scaleChoiceIndex = scaleView.getSelectedItemPosition(); + int maxXY = getResources().getIntArray(R.array.log_image_scale_values)[scaleChoiceIndex]; + String uploadFilename = filePath; + if (maxXY > 0) { + BitmapDrawable scaledImage = ImageHelper.scaleBitmapTo(image, maxXY, maxXY); + uploadFilename = getOutputImageFile().getPath(); + ImageHelper.storeBitmap(scaledImage.getBitmap(), Bitmap.CompressFormat.JPEG, 75, uploadFilename); + } + return uploadFilename; + } + private void showFailure() { - showToast(getResources().getString(R.string.err_aquire_image_failed)); + showToast(getResources().getString(R.string.err_acquire_image_failed)); } private void loadImagePreview() { diff --git a/main/src/cgeo/geocaching/ImagesActivity.java b/main/src/cgeo/geocaching/ImagesActivity.java index 24f699e..07ff734 100644 --- a/main/src/cgeo/geocaching/ImagesActivity.java +++ b/main/src/cgeo/geocaching/ImagesActivity.java @@ -19,10 +19,6 @@ import java.util.List; public class ImagesActivity extends AbstractActivity { - private static final String EXTRAS_IMAGES = "images"; - private static final String EXTRAS_TYPE = "type"; - private static final String EXTRAS_GEOCODE = "geocode"; - private boolean offline; private ArrayList<Image> imageNames; private ImagesList imagesList; @@ -37,8 +33,8 @@ public class ImagesActivity extends AbstractActivity { String geocode = null; if (extras != null) { - geocode = extras.getString(EXTRAS_GEOCODE); - imgType = (ImageType) extras.getSerializable(EXTRAS_TYPE); + geocode = extras.getString(Intents.EXTRA_GEOCODE); + imgType = (ImageType) extras.getSerializable(Intents.EXTRA_TYPE); } if (extras == null || geocode == null) { @@ -54,7 +50,7 @@ public class ImagesActivity extends AbstractActivity { imagesList = new ImagesList(this, geocode); - imageNames = extras.getParcelableArrayList(EXTRAS_IMAGES); + imageNames = extras.getParcelableArrayList(Intents.EXTRA_IMAGES); if (CollectionUtils.isEmpty(imageNames)) { showToast(res.getString(R.string.warn_load_images)); finish(); @@ -67,7 +63,7 @@ public class ImagesActivity extends AbstractActivity { @Override public void onStart() { super.onStart(); - imagesList.loadImages(findViewById(R.id.spoiler_list), imageNames, imgType, offline); + imagesList.loadImages(findViewById(R.id.spoiler_list), imageNames, offline); } @Override @@ -85,12 +81,12 @@ public class ImagesActivity extends AbstractActivity { 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) - .putExtra(EXTRAS_GEOCODE, geocode) - .putExtra(EXTRAS_TYPE, imageType); + .putExtra(Intents.EXTRA_GEOCODE, geocode) + .putExtra(Intents.EXTRA_TYPE, imageType); // avoid forcing the array list as parameter type final ArrayList<Image> arrayList = new ArrayList<Image>(logImages); - logImgIntent.putParcelableArrayListExtra(EXTRAS_IMAGES, arrayList); + logImgIntent.putParcelableArrayListExtra(Intents.EXTRA_IMAGES, arrayList); fromActivity.startActivity(logImgIntent); } diff --git a/main/src/cgeo/geocaching/Intents.java b/main/src/cgeo/geocaching/Intents.java index 7f0a004..a700451 100644 --- a/main/src/cgeo/geocaching/Intents.java +++ b/main/src/cgeo/geocaching/Intents.java @@ -9,10 +9,11 @@ public class Intents { private static final String PREFIX = "cgeo.geocaching.intent.extra."; public static final String EXTRA_ADDRESS = PREFIX + "address"; - public static final String EXTRAS_COORDS = PREFIX + "coords"; + public static final String EXTRA_COORDS = PREFIX + "coords"; public static final String EXTRA_COUNT = PREFIX + "count"; public static final String EXTRA_GEOCODE = PREFIX + "geocode"; public static final String EXTRA_GUID = PREFIX + "guid"; + public static final String EXTRA_IMAGES = PREFIX + "images"; public static final String EXTRA_ID = PREFIX + "id"; public static final String EXTRA_KEYWORD = PREFIX + "keyword"; public static final String EXTRA_KEYWORD_SEARCH = PREFIX + "keyword_search"; @@ -23,6 +24,7 @@ public class Intents { public static final String EXTRA_SEARCH = PREFIX + "search"; public static final String EXTRA_START_DIR = PREFIX + "start_dir"; public static final String EXTRA_TRACKING_CODE = PREFIX + "tracking_code"; + public static final String EXTRA_TYPE = PREFIX + "type"; public static final String EXTRA_USERNAME = PREFIX + "username"; public static final String EXTRA_WAYPOINT_ID = PREFIX + "waypoint_id"; public static final String EXTRA_CACHELIST = PREFIX + "cache_list"; diff --git a/main/src/cgeo/geocaching/LogTrackableActivity.java b/main/src/cgeo/geocaching/LogTrackableActivity.java index b8983ba..6b68225 100644 --- a/main/src/cgeo/geocaching/LogTrackableActivity.java +++ b/main/src/cgeo/geocaching/LogTrackableActivity.java @@ -110,11 +110,7 @@ public class LogTrackableActivity extends AbstractLoggingActivity implements Dat @Override public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - setTheme(); - setContentView(R.layout.touch); - setTitle(res.getString(R.string.trackable_touch)); + super.onCreate(savedInstanceState, R.layout.touch); // get parameters final Bundle extras = getIntent().getExtras(); diff --git a/main/src/cgeo/geocaching/cgeo.java b/main/src/cgeo/geocaching/MainActivity.java index 5680ff3..0843f66 100644 --- a/main/src/cgeo/geocaching/cgeo.java +++ b/main/src/cgeo/geocaching/MainActivity.java @@ -1,5 +1,8 @@ package cgeo.geocaching; +import butterknife.InjectView; +import butterknife.Views; + import cgeo.geocaching.activity.AbstractActivity; import cgeo.geocaching.activity.ActivityMixin; import cgeo.geocaching.connector.gc.Login; @@ -45,14 +48,27 @@ import java.util.Comparator; import java.util.List; import java.util.Locale; -public class cgeo extends AbstractActivity { +public class MainActivity extends AbstractActivity { + @InjectView(R.id.user_info) protected TextView userInfoView; + @InjectView(R.id.nav_satellites) protected TextView navSatellites; + @InjectView(R.id.helper) protected RelativeLayout helper; + @InjectView(R.id.filter_button_title)protected TextView filterTitle; + @InjectView(R.id.map) protected View findOnMap; + @InjectView(R.id.search_offline) protected View findByOffline; + @InjectView(R.id.advanced_button) protected View advanced; + @InjectView(R.id.any_button) protected View any; + @InjectView(R.id.filter_button) protected View filter; + @InjectView(R.id.nearest) protected View nearestView ; + @InjectView(R.id.nav_type) protected TextView navType ; + @InjectView(R.id.nav_accuracy) protected TextView navAccuracy ; + @InjectView(R.id.nav_location) protected TextView navLocation ; + @InjectView(R.id.offline_count) protected TextView countBubble ; private static final String SCAN_INTENT = "com.google.zxing.client.android.SCAN"; private static final int SCAN_REQUEST_CODE = 1; public static final int SEARCH_REQUEST_CODE = 2; private int version = 0; - private TextView filterTitle = null; private boolean cleanupRunning = false; private int countBubbleCnt = 0; private Geopoint addCoords = null; @@ -67,8 +83,6 @@ public class cgeo extends AbstractActivity { @Override public void handleMessage(Message msg) { - TextView userInfoView = (TextView) findViewById(R.id.user_info); - StringBuilder userInfo = new StringBuilder("geocaching.com").append(Formatter.SEPARATOR); if (Login.isActualLoginStatus()) { userInfo.append(Login.getActualUserName()); @@ -109,7 +123,6 @@ public class cgeo extends AbstractActivity { addCoords = app.currentGeo().getCoords(); - TextView navLocation = (TextView) findViewById(R.id.nav_location); navLocation.setText(addText.toString()); } } catch (Exception e) { @@ -137,7 +150,6 @@ public class cgeo extends AbstractActivity { satellitesFixed = data.getSatellitesFixed(); satellitesVisible = data.getSatellitesVisible(); - final TextView navSatellites = (TextView) findViewById(R.id.nav_satellites); if (gpsEnabled) { if (satellitesFixed > 0) { navSatellites.setText(res.getString(R.string.loc_sat) + ": " + satellitesFixed + '/' + satellitesVisible); @@ -169,13 +181,16 @@ public class cgeo extends AbstractActivity { } }; - public cgeo() { + public MainActivity() { super("c:geo-main-screen"); } @Override public void onCreate(Bundle savedInstanceState) { + // don't call the super implementation with the layout argument, as that would set the wrong theme super.onCreate(savedInstanceState); + setContentView(R.layout.main); + Views.inject(this); if ((getIntent().getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != 0) { // If we had been open already, start from the last used activity. @@ -183,7 +198,6 @@ public class cgeo extends AbstractActivity { return; } - setContentView(R.layout.main); setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL); // type to search version = Version.getVersionCode(this); @@ -191,7 +205,6 @@ public class cgeo extends AbstractActivity { try { if (!Settings.isHelpShown()) { - final RelativeLayout helper = (RelativeLayout) findViewById(R.id.helper); if (helper != null) { helper.setVisibility(View.VISIBLE); helper.setClickable(true); @@ -199,7 +212,7 @@ public class cgeo extends AbstractActivity { @Override public void onClick(View view) { - ActivityMixin.goManual(cgeo.this, "c:geo-intro"); + ActivityMixin.goManual(MainActivity.this, "c:geo-intro"); view.setVisibility(View.GONE); } }); @@ -311,6 +324,7 @@ public class cgeo extends AbstractActivity { @Override public void onActivityResult(int requestCode, int resultCode, Intent intent) { if (requestCode == SCAN_REQUEST_CODE) { + // Only handle positive results, don't do anything if cancelled. if (resultCode == RESULT_OK) { String scan = intent.getStringExtra("SCAN_RESULT"); if (StringUtils.isBlank(scan)) { @@ -318,8 +332,6 @@ public class cgeo extends AbstractActivity { } SearchActivity.startActivityScan(scan, this); - } else if (resultCode == RESULT_CANCELED) { - // do nothing } } else if (requestCode == SEARCH_REQUEST_CODE) { // SearchActivity activity returned without making a search @@ -338,9 +350,6 @@ public class cgeo extends AbstractActivity { } private void setFilterTitle() { - if (filterTitle == null) { - filterTitle = (TextView) findViewById(R.id.filter_button_title); - } filterTitle.setText(Settings.getCacheType().getL10n()); } @@ -358,7 +367,6 @@ public class cgeo extends AbstractActivity { (new FirstLoginThread()).start(); } - final View findOnMap = findViewById(R.id.map); findOnMap.setClickable(true); findOnMap.setOnClickListener(new OnClickListener() { @Override @@ -367,7 +375,6 @@ public class cgeo extends AbstractActivity { } }); - final View findByOffline = findViewById(R.id.search_offline); findByOffline.setClickable(true); findByOffline.setOnClickListener(new OnClickListener() { @Override @@ -379,12 +386,12 @@ public class cgeo extends AbstractActivity { @Override public boolean onLongClick(View v) { - new StoredList.UserInterface(cgeo.this).promptForListSelection(R.string.list_title, new RunnableWithArgument<Integer>() { + new StoredList.UserInterface(MainActivity.this).promptForListSelection(R.string.list_title, new RunnableWithArgument<Integer>() { @Override public void run(Integer selectedListId) { Settings.saveLastList(selectedListId); - cgeocaches.startActivityOffline(cgeo.this); + cgeocaches.startActivityOffline(MainActivity.this); } }); return true; @@ -392,7 +399,6 @@ public class cgeo extends AbstractActivity { }); findByOffline.setLongClickable(true); - final View advanced = findViewById(R.id.advanced_button); advanced.setClickable(true); advanced.setOnClickListener(new OnClickListener() { @Override @@ -401,7 +407,6 @@ public class cgeo extends AbstractActivity { } }); - final View any = findViewById(R.id.any_button); any.setClickable(true); any.setOnClickListener(new OnClickListener() { @Override @@ -410,7 +415,6 @@ public class cgeo extends AbstractActivity { } }); - final View filter = findViewById(R.id.filter_button); filter.setClickable(true); filter.setOnClickListener(new View.OnClickListener() { @Override @@ -501,7 +505,7 @@ public class cgeo extends AbstractActivity { public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); cgData.resetNewlyCreatedDatabase(); - app.restoreDatabase(cgeo.this); + app.restoreDatabase(MainActivity.this); } }) .setNegativeButton(getString(android.R.string.no), new DialogInterface.OnClickListener() { @@ -519,10 +523,6 @@ public class cgeo extends AbstractActivity { @Override public void updateGeoData(final IGeoData geo) { - final View nearestView = findViewById(R.id.nearest); - final TextView navType = (TextView) findViewById(R.id.nav_type); - final TextView navAccuracy = (TextView) findViewById(R.id.nav_accuracy); - final TextView navLocation = (TextView) findViewById(R.id.nav_location); try { if (geo.getCoords() != null) { if (!nearestView.isClickable()) { @@ -583,7 +583,7 @@ public class cgeo extends AbstractActivity { * unused here but needed since this method is referenced from XML layout */ public void cgeoFindOnMap(View v) { - findViewById(R.id.map).setPressed(true); + findOnMap.setPressed(true); CGeoMap.startActivityLiveMap(this); } @@ -596,7 +596,7 @@ public class cgeo extends AbstractActivity { return; } - findViewById(R.id.nearest).setPressed(true); + nearestView.setPressed(true); cgeocaches.startActivityNearest(this, app.currentGeo().getCoords()); } @@ -605,7 +605,7 @@ public class cgeo extends AbstractActivity { * unused here but needed since this method is referenced from XML layout */ public void cgeoFindByOffline(View v) { - findViewById(R.id.search_offline).setPressed(true); + findByOffline.setPressed(true); cgeocaches.startActivityOffline(this); } @@ -614,7 +614,7 @@ public class cgeo extends AbstractActivity { * unused here but needed since this method is referenced from XML layout */ public void cgeoSearch(View v) { - findViewById(R.id.advanced_button).setPressed(true); + advanced.setPressed(true); startActivity(new Intent(this, SearchActivity.class)); } @@ -623,7 +623,7 @@ public class cgeo extends AbstractActivity { * unused here but needed since this method is referenced from XML layout */ public void cgeoPoint(View v) { - findViewById(R.id.any_button).setPressed(true); + any.setPressed(true); startActivity(new Intent(this, NavigateAnyPointActivity.class)); } @@ -632,8 +632,8 @@ public class cgeo extends AbstractActivity { * unused here but needed since this method is referenced from XML layout */ public void cgeoFilter(View v) { - findViewById(R.id.filter_button).setPressed(true); - findViewById(R.id.filter_button).performClick(); + filter.setPressed(true); + filter.performClick(); } /** @@ -646,15 +646,10 @@ public class cgeo extends AbstractActivity { private class CountBubbleUpdateThread extends Thread { private Handler countBubbleHandler = new Handler() { - private TextView countBubble = null; @Override public void handleMessage(Message msg) { try { - if (countBubble == null) { - countBubble = (TextView) findViewById(R.id.offline_count); - } - if (countBubbleCnt == 0) { countBubble.setVisibility(View.GONE); } else { @@ -745,7 +740,7 @@ public class cgeo extends AbstractActivity { // invoke settings activity to insert login details if (status == StatusCode.NO_LOGIN_INFO_STORED) { - SettingsActivity.startActivity(cgeo.this); + SettingsActivity.startActivity(MainActivity.this); } } } @@ -765,7 +760,7 @@ public class cgeo extends AbstractActivity { addressObtaining = true; try { - final Geocoder geocoder = new Geocoder(cgeo.this, Locale.getDefault()); + final Geocoder geocoder = new Geocoder(MainActivity.this, Locale.getDefault()); final Geopoint coords = app.currentGeo().getCoords(); addresses = geocoder.getFromLocation(coords.getLatitude(), coords.getLongitude(), 1); } catch (Exception e) { diff --git a/main/src/cgeo/geocaching/NavigateAnyPointActivity.java b/main/src/cgeo/geocaching/NavigateAnyPointActivity.java index 74f656b..746842d 100644 --- a/main/src/cgeo/geocaching/NavigateAnyPointActivity.java +++ b/main/src/cgeo/geocaching/NavigateAnyPointActivity.java @@ -108,11 +108,7 @@ public class NavigateAnyPointActivity extends AbstractActivity { @Override public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - setTheme(); - setContentView(R.layout.point); - setTitle(res.getString(R.string.search_destination)); + super.onCreate(savedInstanceState, R.layout.point); createHistoryView(); diff --git a/main/src/cgeo/geocaching/SearchActivity.java b/main/src/cgeo/geocaching/SearchActivity.java index 6fdff5a..a3a0797 100644 --- a/main/src/cgeo/geocaching/SearchActivity.java +++ b/main/src/cgeo/geocaching/SearchActivity.java @@ -64,7 +64,6 @@ public class SearchActivity extends AbstractActivity { setTheme(); setContentView(R.layout.search); - setTitle(res.getString(R.string.search)); init(); } @@ -432,6 +431,6 @@ public class SearchActivity extends AbstractActivity { searchIntent.setAction(Intent.ACTION_SEARCH). putExtra(SearchManager.QUERY, scan). putExtra(Intents.EXTRA_KEYWORD_SEARCH, false); - fromActivity.startActivityForResult(searchIntent, cgeo.SEARCH_REQUEST_CODE); + fromActivity.startActivityForResult(searchIntent, MainActivity.SEARCH_REQUEST_CODE); } } diff --git a/main/src/cgeo/geocaching/SelectMapfileActivity.java b/main/src/cgeo/geocaching/SelectMapfileActivity.java index 9557f3e..aa6d46a 100644 --- a/main/src/cgeo/geocaching/SelectMapfileActivity.java +++ b/main/src/cgeo/geocaching/SelectMapfileActivity.java @@ -55,11 +55,6 @@ public class SelectMapfileActivity extends AbstractFileListActivity<FileSelectio } @Override - protected void setTitle() { - setTitle(res.getString(R.string.map_file_select_title)); - } - - @Override public String getCurrentFile() { return mapFile; } diff --git a/main/src/cgeo/geocaching/Settings.java b/main/src/cgeo/geocaching/Settings.java index 0c157e1..b5c8a6e 100644 --- a/main/src/cgeo/geocaching/Settings.java +++ b/main/src/cgeo/geocaching/Settings.java @@ -112,6 +112,7 @@ public final class Settings { private static final String KEY_MAP_DIRECTORY = "mapDirectory"; private static final String KEY_CONNECTOR_OC_ACTIVE = "connectorOCActive"; private static final String KEY_CONNECTOR_OC_USER = "connectorOCUser"; + private static final String KEY_LOG_IMAGE_SCALE = "logImageScale"; private final static int unitsMetric = 1; @@ -149,6 +150,7 @@ public final class Settings { // maps private static MapProvider mapProvider = null; + private static String cacheTwitterMessage = "I found [NAME] ([URL])"; private Settings() { // this class is not to be instantiated; @@ -1424,4 +1426,32 @@ public final class Settings { } }); } + + public static String getCacheTwitterMessage() { + // TODO make customizable from UI + return cacheTwitterMessage; + } + + public static String getTrackableTwitterMessage() { + // TODO make customizable from UI + return "I touched [NAME] ([URL])!"; + } + + public static void setCacheTwitterMessage(final String message) { + cacheTwitterMessage = message; + } + + public static int getLogImageScale() { + return sharedPrefs.getInt(KEY_LOG_IMAGE_SCALE, -1); + } + + public static void setLogImageScale(final int scale) { + editSharedSettings(new PrefRunnable() { + + @Override + public void edit(Editor edit) { + edit.putInt(KEY_LOG_IMAGE_SCALE, scale); + } + }); + } } diff --git a/main/src/cgeo/geocaching/SettingsActivity.java b/main/src/cgeo/geocaching/SettingsActivity.java index 0678617..d094358 100644 --- a/main/src/cgeo/geocaching/SettingsActivity.java +++ b/main/src/cgeo/geocaching/SettingsActivity.java @@ -129,13 +129,7 @@ public class SettingsActivity extends AbstractActivity { @Override public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - // init - - setTheme(); - setContentView(R.layout.init); - setTitle(res.getString(R.string.settings)); + super.onCreate(savedInstanceState, R.layout.init); init(); } diff --git a/main/src/cgeo/geocaching/StaticMapsActivity.java b/main/src/cgeo/geocaching/StaticMapsActivity.java index 005ee9e..3b32067 100644 --- a/main/src/cgeo/geocaching/StaticMapsActivity.java +++ b/main/src/cgeo/geocaching/StaticMapsActivity.java @@ -88,11 +88,7 @@ public class StaticMapsActivity extends AbstractActivity { @Override public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - setTheme(); - setContentView(R.layout.map_static); - setTitle(res.getString(R.string.map_static_title)); + super.onCreate(savedInstanceState, R.layout.map_static); // get parameters final Bundle extras = getIntent().getExtras(); diff --git a/main/src/cgeo/geocaching/StaticMapsProvider.java b/main/src/cgeo/geocaching/StaticMapsProvider.java index cd88071..9a4c00b 100644 --- a/main/src/cgeo/geocaching/StaticMapsProvider.java +++ b/main/src/cgeo/geocaching/StaticMapsProvider.java @@ -10,7 +10,6 @@ import cgeo.geocaching.utils.Log; import ch.boye.httpclientandroidlib.HttpResponse; -import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import android.content.Context; @@ -81,10 +80,6 @@ public class StaticMapsProvider { } public static void downloadMaps(Geocache cache) { - if (cache == null) { - Log.e("downloadMaps - missing input parameter cache"); - return; - } if ((!Settings.isStoreOfflineMaps() && !Settings.isStoreOfflineWpMaps()) || StringUtils.isBlank(cache.getGeocode())) { return; } @@ -96,8 +91,8 @@ public class StaticMapsProvider { } // clean old and download static maps for waypoints if one is missing - if (Settings.isStoreOfflineWpMaps() && CollectionUtils.isNotEmpty(cache.getWaypoints())) { - for (Waypoint waypoint : cache.getWaypoints()) { + if (Settings.isStoreOfflineWpMaps()) { + for (final Waypoint waypoint : cache.getWaypoints()) { if (!hasAllStaticMapsForWaypoint(cache.getGeocode(), waypoint)) { refreshAllWpStaticMaps(cache, edge); } @@ -167,10 +162,6 @@ public class StaticMapsProvider { } public static void storeCachePreviewMap(final Geocache cache) { - if (cache == null) { - Log.e("storeCachePreviewMap - missing input parameter cache"); - return; - } final String latlonMap = cache.getCoords().format(Format.LAT_LON_DECDEGREE_COMMA); final Display display = ((WindowManager) cgeoapplication.getInstance().getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); DisplayMetrics metrics = new DisplayMetrics(); @@ -183,12 +174,7 @@ public class StaticMapsProvider { private static int guessMaxDisplaySide() { Point displaySize = Compatibility.getDisplaySize(); - final int maxWidth = displaySize.x - 25; - final int maxHeight = displaySize.y - 25; - if (maxWidth > maxHeight) { - return maxWidth; - } - return maxHeight; + return Math.max(displaySize.x, displaySize.y) - 25; } private static void downloadMaps(final String geocode, final String markerUrl, final String prefix, final String latlonMap, final int edge, @@ -245,7 +231,7 @@ public class StaticMapsProvider { /** * Check if at least one map file exists for the given cache. - * + * * @param cache * @return <code>true</code> if at least one map file exists; <code>false</code> otherwise */ @@ -268,7 +254,7 @@ public class StaticMapsProvider { /** * Checks if at least one map file exists for the given geocode and waypoint ID. - * + * * @param geocode * @param waypoint * @return <code>true</code> if at least one map file exists; <code>false</code> otherwise @@ -287,7 +273,7 @@ public class StaticMapsProvider { /** * Checks if all map files exist for the given geocode and waypoint ID. - * + * * @param geocode * @param waypoint * @return <code>true</code> if all map files exist; <code>false</code> otherwise @@ -326,5 +312,4 @@ public class StaticMapsProvider { } return null; } - } diff --git a/main/src/cgeo/geocaching/StoredList.java b/main/src/cgeo/geocaching/StoredList.java index 5a6f132..c505e3c 100644 --- a/main/src/cgeo/geocaching/StoredList.java +++ b/main/src/cgeo/geocaching/StoredList.java @@ -12,7 +12,10 @@ import android.content.res.Resources; import android.view.View; import android.widget.EditText; +import java.text.Collator; import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; import java.util.List; public class StoredList { @@ -69,7 +72,7 @@ public class StoredList { } public void promptForListSelection(final int titleId, final RunnableWithArgument<Integer> runAfterwards, final boolean onlyMoveTargets, final int exceptListId) { - final List<StoredList> lists = cgData.getLists(); + final List<StoredList> lists = getSortedLists(); if (lists == null) { return; @@ -115,6 +118,19 @@ public class StoredList { builder.create().show(); } + private static List<StoredList> getSortedLists() { + final Collator collator = Collator.getInstance(); + final List<StoredList> lists = cgData.getLists(); + Collections.sort(lists, new Comparator<StoredList>() { + + @Override + public int compare(StoredList lhs, StoredList rhs) { + return collator.compare(lhs.getTitle(), rhs.getTitle()); + } + }); + return lists; + } + public void promptForListCreation(final RunnableWithArgument<Integer> runAfterwards) { handleListNameInput("", R.string.list_dialog_create_title, R.string.list_dialog_create, new RunnableWithArgument<String>() { @@ -176,4 +192,23 @@ public class StoredList { }); } } + + /** + * Get the list title. This method is not public by intention to make clients use the {@link UserInterface} class. + * + * @return + */ + protected String getTitle() { + return title; + } + + /** + * Return the given list, if it is a concrete list. Return the default list otherwise. + */ + public static int getConcreteList(int listId) { + if (listId == ALL_LIST_ID || listId == TEMPORARY_LIST_ID) { + return STANDARD_LIST_ID; + } + return listId; + } } diff --git a/main/src/cgeo/geocaching/TrackableActivity.java b/main/src/cgeo/geocaching/TrackableActivity.java index fea4521..9f71f69 100644 --- a/main/src/cgeo/geocaching/TrackableActivity.java +++ b/main/src/cgeo/geocaching/TrackableActivity.java @@ -114,11 +114,7 @@ public class TrackableActivity extends AbstractViewPagerActivity<TrackableActivi @Override public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - setTheme(); - setContentView(R.layout.trackable_activity); - setTitle(res.getString(R.string.trackable)); + super.onCreate(savedInstanceState, R.layout.trackable_activity); // get parameters Bundle extras = getIntent().getExtras(); diff --git a/main/src/cgeo/geocaching/UsefulAppsActivity.java b/main/src/cgeo/geocaching/UsefulAppsActivity.java index af643b3..ce8bbdd 100644 --- a/main/src/cgeo/geocaching/UsefulAppsActivity.java +++ b/main/src/cgeo/geocaching/UsefulAppsActivity.java @@ -1,5 +1,7 @@ package cgeo.geocaching; +import butterknife.InjectView; + import cgeo.geocaching.activity.AbstractActivity; import android.content.Intent; @@ -15,17 +17,11 @@ import java.util.Locale; public class UsefulAppsActivity extends AbstractActivity { - private LinearLayout parentLayout; + @InjectView(R.id.parent) protected LinearLayout parentLayout; @Override public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - // init - setTheme(); - setContentView(R.layout.useful_apps); - setTitle(res.getString(R.string.helpers)); - parentLayout = (LinearLayout) findViewById(R.id.parent); + super.onCreate(savedInstanceState, R.layout.useful_apps); final Locale loc = Locale.getDefault(); final String language = loc.getLanguage(); @@ -45,12 +41,6 @@ public class UsefulAppsActivity extends AbstractActivity { addApp(R.string.helper_barcode_title, R.string.helper_barcode_description, R.drawable.helper_barcode, "com.google.zxing.client.android"); } - @Override - public void onResume() { - super.onResume(); - - } - private void installFromMarket(String marketId) { try { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q=pname:" + marketId))); @@ -62,18 +52,18 @@ public class UsefulAppsActivity extends AbstractActivity { } private void addApp(final int titleId, final int descriptionId, final int imageId, final String marketUrl) { - final LinearLayout layout = (LinearLayout) getLayoutInflater().inflate(R.layout.useful_apps_item, null); - ((TextView) layout.findViewById(R.id.title)).setText(res.getString(titleId)); - ((ImageView) layout.findViewById(R.id.image)).setImageDrawable(res.getDrawable(imageId)); - ((TextView) layout.findViewById(R.id.description)).setText(res.getString(descriptionId)); - layout.findViewById(R.id.app_layout).setOnClickListener(new OnClickListener() { + final View appLayout = getLayoutInflater().inflate(R.layout.useful_apps_item, null); + ((TextView) appLayout.findViewById(R.id.title)).setText(res.getString(titleId)); + ((ImageView) appLayout.findViewById(R.id.image)).setImageDrawable(res.getDrawable(imageId)); + ((TextView) appLayout.findViewById(R.id.description)).setText(res.getString(descriptionId)); + appLayout.findViewById(R.id.app_layout).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { installFromMarket(marketUrl); } }); - parentLayout.addView(layout); + parentLayout.addView(appLayout); } } diff --git a/main/src/cgeo/geocaching/VisitCacheActivity.java b/main/src/cgeo/geocaching/VisitCacheActivity.java index dce0fbf..28c8440 100644 --- a/main/src/cgeo/geocaching/VisitCacheActivity.java +++ b/main/src/cgeo/geocaching/VisitCacheActivity.java @@ -12,6 +12,7 @@ import cgeo.geocaching.network.Parameters; import cgeo.geocaching.twitter.Twitter; import cgeo.geocaching.ui.Formatter; import cgeo.geocaching.ui.dialog.DateDialog; +import cgeo.geocaching.utils.AsyncTaskWithProgress; import cgeo.geocaching.utils.Log; import cgeo.geocaching.utils.LogTemplateProvider; import cgeo.geocaching.utils.LogTemplateProvider.LogContext; @@ -20,17 +21,15 @@ import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.ImmutablePair; +import android.app.Activity; import android.app.AlertDialog; import android.app.AlertDialog.Builder; import android.app.Dialog; -import android.app.ProgressDialog; import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; import android.content.Intent; import android.net.Uri; import android.os.Bundle; -import android.os.Handler; -import android.os.Message; import android.support.v4.app.LoaderManager; import android.support.v4.content.Loader; import android.util.SparseArray; @@ -67,7 +66,6 @@ public class VisitCacheActivity extends AbstractLoggingActivity implements DateD private LayoutInflater inflater = null; private Geocache cache = null; - private ProgressDialog waitDialog = null; private String cacheid = null; private String geocode = null; private String text = null; @@ -112,7 +110,6 @@ public class VisitCacheActivity extends AbstractLoggingActivity implements DateD viewstates = Login.getViewstates(page); trackables = GCParser.parseTrackableLog(page); possibleLogTypes = GCParser.parseTypes(page); - possibleLogTypes.remove(LogType.UPDATE_COORDINATES); if (possibleLogTypes.isEmpty()) { showErrorLoadingData(); @@ -240,45 +237,13 @@ public class VisitCacheActivity extends AbstractLoggingActivity implements DateD return res.getString(R.string.log_post_rate) + " " + ratingTextValue(rating) + "*"; } - private final Handler postLogHandler = new Handler() { - - @Override - public void handleMessage(final Message msg) { - if (waitDialog != null) { - waitDialog.dismiss(); - } - - final StatusCode error = (StatusCode) msg.obj; - if (error == StatusCode.NO_ERROR) { - showToast(res.getString(R.string.info_log_posted)); - // No need to save the log when quitting if it has been posted. - text = currentLogText(); - finish(); - } else if (error == StatusCode.LOG_SAVED) { - showToast(res.getString(R.string.info_log_saved)); - - if (waitDialog != null) { - waitDialog.dismiss(); - } - - finish(); - } else { - showToast(error.getErrorString(res)); - } - } - }; - public VisitCacheActivity() { super("c:geo-log"); } @Override public void onCreate(final Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - setTheme(); - setContentView(R.layout.visit); - setTitle(res.getString(R.string.log_new_log)); + super.onCreate(savedInstanceState, R.layout.visit); // Get parameters from intent and basic cache information from database final Bundle extras = getIntent().getExtras(); @@ -549,81 +514,79 @@ public class VisitCacheActivity extends AbstractLoggingActivity implements DateD private class PostListener implements View.OnClickListener { @Override public void onClick(View arg0) { - waitDialog = ProgressDialog.show(VisitCacheActivity.this, null, - res.getString(StringUtils.isBlank(imageUri.getPath()) ? R.string.log_saving : R.string.log_saving_and_uploading), true); - waitDialog.setCancelable(true); - - final Thread thread = new PostLogThread(postLogHandler, currentLogText()); - thread.start(); + final String message = res.getString(StringUtils.isBlank(imageUri.getPath()) ? + R.string.log_saving : + R.string.log_saving_and_uploading); + new Poster(VisitCacheActivity.this, message).execute(currentLogText()); } } - private class PostLogThread extends Thread { - - private final Handler handler; - private final String log; + private class Poster extends AsyncTaskWithProgress<String, StatusCode> { - public PostLogThread(Handler handlerIn, String logIn) { - super("Post log"); - handler = handlerIn; - log = logIn; + public Poster(final Activity activity, final String progressMessage) { + super(activity, null, progressMessage, true); } @Override - public void run() { - final StatusCode status = postLogFn(log); - handler.sendMessage(handler.obtainMessage(0, status)); - } - } - - public StatusCode postLogFn(String log) { - - StatusCode result = StatusCode.LOG_POST_ERROR; - - try { - - final ImmutablePair<StatusCode, String> logResult = GCParser.postLog(geocode, cacheid, viewstates, typeSelected, - date.get(Calendar.YEAR), (date.get(Calendar.MONTH) + 1), date.get(Calendar.DATE), - log, trackables); - - result = logResult.left; - - if (logResult.left == StatusCode.NO_ERROR) { - final LogEntry logNow = new LogEntry(date, typeSelected, log); - - cache.getLogs().add(0, logNow); - - if (typeSelected == LogType.FOUND_IT || typeSelected == LogType.ATTENDED) { - cache.setFound(true); + protected StatusCode doInBackgroundInternal(final String[] logTexts) { + final String log = logTexts[0]; + try { + final ImmutablePair<StatusCode, String> postResult = GCParser.postLog(geocode, cacheid, viewstates, typeSelected, + date.get(Calendar.YEAR), (date.get(Calendar.MONTH) + 1), date.get(Calendar.DATE), + log, trackables); + + if (postResult.left == StatusCode.NO_ERROR) { + final LogEntry logNow = new LogEntry(date, typeSelected, log); + + cache.getLogs().add(0, logNow); + + if (typeSelected == LogType.FOUND_IT || typeSelected == LogType.ATTENDED) { + cache.setFound(true); + } + + cgData.saveChangedCache(cache); + cgData.clearLogOffline(geocode); + + if (typeSelected == LogType.FOUND_IT) { + if (tweetCheck.isChecked() && tweetBox.getVisibility() == View.VISIBLE) { + Twitter.postTweetCache(geocode); + } + GCVote.setRating(cache, rating); + } + + if (StringUtils.isNotBlank(imageUri.getPath())) { + ImmutablePair<StatusCode, String> imageResult = GCParser.uploadLogImage(postResult.right, imageCaption, imageDescription, imageUri); + final String uploadedImageUrl = imageResult.right; + if (StringUtils.isNotEmpty(uploadedImageUrl)) { + logNow.addLogImage(new Image(uploadedImageUrl, imageCaption, imageDescription)); + cgData.saveChangedCache(cache); + } + return imageResult.left; + } } - cgData.saveChangedCache(cache); - } - - if (logResult.left == StatusCode.NO_ERROR) { - cgData.clearLogOffline(geocode); + return postResult.left; + } catch (Exception e) { + Log.e("cgeovisit.postLogFn", e); } - if (logResult.left == StatusCode.NO_ERROR && typeSelected == LogType.FOUND_IT && Settings.isUseTwitter() - && Settings.isTwitterLoginValid() - && tweetCheck.isChecked() && tweetBox.getVisibility() == View.VISIBLE) { - Twitter.postTweetCache(geocode); - } - - if (logResult.left == StatusCode.NO_ERROR && typeSelected == LogType.FOUND_IT && Settings.isGCvoteLogin()) { - GCVote.setRating(cache, rating); - } + return StatusCode.LOG_POST_ERROR; + } - if (logResult.left == StatusCode.NO_ERROR && StringUtils.isNotBlank(imageUri.getPath())) { - result = GCParser.uploadLogImage(logResult.right, imageCaption, imageDescription, imageUri); + @Override + protected void onPostExecuteInternal(final StatusCode status) { + if (status == StatusCode.NO_ERROR) { + showToast(res.getString(R.string.info_log_posted)); + // No need to save the log when quitting if it has been posted. + text = currentLogText(); + finish(); + } else if (status == StatusCode.LOG_SAVED) { + showToast(res.getString(R.string.info_log_saved)); + finish(); + } else { + showToast(status.getErrorString(res)); } - - return result; - } catch (Exception e) { - Log.e("cgeovisit.postLogFn", e); } - - return StatusCode.LOG_POST_ERROR; } private void saveLog(final boolean force) { diff --git a/main/src/cgeo/geocaching/Waypoint.java b/main/src/cgeo/geocaching/Waypoint.java index 48c9bc5..6112986 100644 --- a/main/src/cgeo/geocaching/Waypoint.java +++ b/main/src/cgeo/geocaching/Waypoint.java @@ -275,7 +275,7 @@ public class Waypoint implements IWaypoint, Comparable<Waypoint> { if (coords != null) { hash = coords.hashCode(); } - hash = hash ^ waypointType.markerId; + hash ^= waypointType.markerId; return (int) hash; } } diff --git a/main/src/cgeo/geocaching/WaypointPopup.java b/main/src/cgeo/geocaching/WaypointPopup.java index 766d43d..43a758f 100644 --- a/main/src/cgeo/geocaching/WaypointPopup.java +++ b/main/src/cgeo/geocaching/WaypointPopup.java @@ -2,6 +2,7 @@ package cgeo.geocaching; import cgeo.geocaching.apps.cache.navi.NavigationAppFactory; import cgeo.geocaching.geopoint.Geopoint; +import cgeo.geocaching.geopoint.Units; import cgeo.geocaching.ui.CacheDetailsCreator; import cgeo.geocaching.utils.Log; @@ -19,6 +20,7 @@ import android.widget.TextView; public class WaypointPopup extends AbstractPopupActivity { private int waypointId = 0; private Waypoint waypoint = null; + private TextView waypointDistance = null; public WaypointPopup() { super("c:geo-waypoint-info", R.layout.waypoint_popup); @@ -35,6 +37,14 @@ public class WaypointPopup extends AbstractPopupActivity { } @Override + public void onUpdateGeoData(IGeoData geo) { + if (geo.getCoords() != null && waypoint != null && waypoint.getCoords() != null) { + waypointDistance.setText(Units.getDistanceFromKilometers(geo.getCoords().distanceTo(waypoint.getCoords()))); + waypointDistance.bringToFront(); + } + } + + @Override protected void init() { super.init(); waypoint = cgData.loadWaypoint(waypointId); @@ -53,6 +63,9 @@ public class WaypointPopup extends AbstractPopupActivity { //Waypoint geocode details.add(R.string.cache_geocode, waypoint.getPrefix() + waypoint.getGeocode().substring(2)); + details.addDistance(waypoint, waypointDistance); + waypointDistance = details.getValueView(); + details.add(R.string.waypoint_note, waypoint.getNote()); // Edit Button final Button buttonEdit = (Button) findViewById(R.id.edit); diff --git a/main/src/cgeo/geocaching/activity/AbstractActivity.java b/main/src/cgeo/geocaching/activity/AbstractActivity.java index 557665e..ad65ca3 100644 --- a/main/src/cgeo/geocaching/activity/AbstractActivity.java +++ b/main/src/cgeo/geocaching/activity/AbstractActivity.java @@ -1,5 +1,7 @@ package cgeo.geocaching.activity; +import butterknife.Views; + import cgeo.geocaching.Settings; import cgeo.geocaching.cgeoapplication; import cgeo.geocaching.compatibility.Compatibility; @@ -43,15 +45,15 @@ public abstract class AbstractActivity extends FragmentActivity implements IAbst ActivityMixin.goManual(this, helpTopic); } - final public void setTitle(final String title) { + final protected void setTitle(final String title) { ActivityMixin.setTitle(this, title); } - final public void showProgress(final boolean show) { + final protected void showProgress(final boolean show) { ActivityMixin.showProgress(this, show); } - final public void setTheme() { + final protected void setTheme() { ActivityMixin.setTheme(this); } @@ -70,22 +72,14 @@ public abstract class AbstractActivity extends FragmentActivity implements IAbst ActivityMixin.helpDialog(this, title, message); } - public final void helpDialog(final String title, final String message, final Drawable icon) { + protected final void helpDialog(final String title, final String message, final Drawable icon) { ActivityMixin.helpDialog(this, title, message, icon); } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - - // init - res = this.getResources(); - app = (cgeoapplication) this.getApplication(); - - // Restore cookie store if needed - Cookies.restoreCookieStore(Settings.getCookieStore()); - - ActivityMixin.keepScreenOn(this, keepScreenOn); + initializeCommonFields(); } protected static void disableSuggestions(final EditText edit) { @@ -128,4 +122,34 @@ public abstract class AbstractActivity extends FragmentActivity implements IAbst editText.setSelection(newCursor, newCursor); } + protected void onCreate(final Bundle savedInstanceState, final int resourceLayoutID) { + super.onCreate(savedInstanceState); + + initializeCommonFields(); + + // non declarative part of layout + setTheme(); + setContentView(resourceLayoutID); + + // create view variables + Views.inject(this); + } + + private void initializeCommonFields() { + // initialize commonly used members + res = this.getResources(); + app = (cgeoapplication) this.getApplication(); + + // only needed in some activities, but implemented in super class nonetheless + Cookies.restoreCookieStore(Settings.getCookieStore()); + ActivityMixin.keepScreenOn(this, keepScreenOn); + } + + @Override + public void setContentView(int layoutResID) { + super.setContentView(layoutResID); + + // initialize the action bar title with the activity title for single source + ActivityMixin.setTitle(this, getTitle()); + } } diff --git a/main/src/cgeo/geocaching/activity/AbstractListActivity.java b/main/src/cgeo/geocaching/activity/AbstractListActivity.java index f96a769..ead47bd 100644 --- a/main/src/cgeo/geocaching/activity/AbstractListActivity.java +++ b/main/src/cgeo/geocaching/activity/AbstractListActivity.java @@ -71,7 +71,10 @@ public abstract class AbstractListActivity extends FragmentListActivity implemen @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + initializeCommonFields(); + } + private void initializeCommonFields() { // init res = this.getResources(); app = (cgeoapplication) this.getApplication(); @@ -79,7 +82,7 @@ public abstract class AbstractListActivity extends FragmentListActivity implemen ActivityMixin.keepScreenOn(this, keepScreenOn); } - final public void setTitle(final String title) { + final protected void setTitle(final String title) { ActivityMixin.setTitle(this, title); } @@ -87,4 +90,20 @@ public abstract class AbstractListActivity extends FragmentListActivity implemen public void invalidateOptionsMenuCompatible() { Compatibility.invalidateOptionsMenu(this); } + + public void onCreate(Bundle savedInstanceState, int resourceLayoutID) { + super.onCreate(savedInstanceState); + initializeCommonFields(); + + setTheme(); + setContentView(resourceLayoutID); + } + + @Override + public void setContentView(int layoutResID) { + super.setContentView(layoutResID); + + // initialize action bar title with activity title + ActivityMixin.setTitle(this, getTitle()); + } } diff --git a/main/src/cgeo/geocaching/activity/ActivityMixin.java b/main/src/cgeo/geocaching/activity/ActivityMixin.java index c97cb9a..bc524ec 100644 --- a/main/src/cgeo/geocaching/activity/ActivityMixin.java +++ b/main/src/cgeo/geocaching/activity/ActivityMixin.java @@ -1,8 +1,8 @@ package cgeo.geocaching.activity; +import cgeo.geocaching.MainActivity; import cgeo.geocaching.R; import cgeo.geocaching.Settings; -import cgeo.geocaching.cgeo; import cgeo.geocaching.compatibility.Compatibility; import org.apache.commons.lang3.StringUtils; @@ -26,7 +26,7 @@ import gnu.android.app.appmanualclient.AppManualReaderClient; public final class ActivityMixin { public final static void goHome(final Activity fromActivity) { - final Intent intent = new Intent(fromActivity, cgeo.class); + final Intent intent = new Intent(fromActivity, MainActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); fromActivity.startActivity(intent); @@ -48,7 +48,7 @@ public final class ActivityMixin { } } - public static void setTitle(final Activity activity, final String text) { + public static void setTitle(final Activity activity, final CharSequence text) { if (StringUtils.isBlank(text)) { return; } diff --git a/main/src/cgeo/geocaching/apps/AbstractApp.java b/main/src/cgeo/geocaching/apps/AbstractApp.java index c95e8b4..ef56f87 100644 --- a/main/src/cgeo/geocaching/apps/AbstractApp.java +++ b/main/src/cgeo/geocaching/apps/AbstractApp.java @@ -1,7 +1,7 @@ package cgeo.geocaching.apps; import cgeo.geocaching.Geocache; -import cgeo.geocaching.cgeo; +import cgeo.geocaching.MainActivity; import cgeo.geocaching.cgeoapplication; import cgeo.geocaching.utils.ProcessUtils; @@ -29,7 +29,7 @@ public abstract class AbstractApp implements App { if (ProcessUtils.isInstalled(packageName)) { return true; } - return cgeo.isIntentAvailable(intent); + return MainActivity.isIntentAvailable(intent); } protected Intent getLaunchIntent() { diff --git a/main/src/cgeo/geocaching/cgData.java b/main/src/cgeo/geocaching/cgData.java index 28485a5..d5002a0 100644 --- a/main/src/cgeo/geocaching/cgData.java +++ b/main/src/cgeo/geocaching/cgData.java @@ -33,6 +33,7 @@ import java.io.File; import java.io.FilenameFilter; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collection; import java.util.Collections; import java.util.Date; import java.util.EnumSet; @@ -85,7 +86,7 @@ public class cgData { private static int[] cacheColumnIndex; private static CacheCache cacheCache = new CacheCache(); private static SQLiteDatabase database = null; - private static final int dbVersion = 66; + private static final int dbVersion = 67; public static final int customListIdOffset = 10; private static final String dbName = "data"; private static final String dbTableCaches = "cg_caches"; @@ -107,7 +108,7 @@ public class cgData { + "detailedupdate long, " + "visiteddate long, " + "geocode text unique not null, " - + "reason integer not null default 0, " // cached, favourite... + + "reason integer not null default 0, " // cached, favorite... + "cacheid text, " + "guid text, " + "type text, " @@ -674,6 +675,16 @@ public class cgData { } } + // issue2662 OC: Leichtes Klettern / Easy climbing + if (oldVersion < 67) { + try { + db.execSQL("update " + dbTableAttributes + " set attribute = 'easy_climbing_yes' where geocode like 'OC%' and attribute = 'climbing_yes'"); + db.execSQL("update " + dbTableAttributes + " set attribute = 'easy_climbing_no' where geocode like 'OC%' and attribute = 'climbing_no'"); + } catch (Exception e) { + Log.e("Failed to upgrade to ver. 67", e); + + } + } } db.setTransactionSuccessful(); @@ -1396,7 +1407,7 @@ public class cgData { * @param geocodes * @return Set of loaded caches. Never null. */ - public static Set<Geocache> loadCaches(final Set<String> geocodes, final EnumSet<LoadFlag> loadFlags) { + public static Set<Geocache> loadCaches(final Collection<String> geocodes, final EnumSet<LoadFlag> loadFlags) { if (CollectionUtils.isEmpty(geocodes)) { return new HashSet<Geocache>(); } diff --git a/main/src/cgeo/geocaching/cgeoapplication.java b/main/src/cgeo/geocaching/cgeoapplication.java index a1fd7d1..b8f63ee 100644 --- a/main/src/cgeo/geocaching/cgeoapplication.java +++ b/main/src/cgeo/geocaching/cgeoapplication.java @@ -103,8 +103,8 @@ public class cgeoapplication extends Application { boolean restored = atomic.get(); String message = restored ? res.getString(R.string.init_restore_success) : res.getString(R.string.init_restore_failed); ActivityMixin.helpDialog(fromActivity, res.getString(R.string.init_backup_restore), message); - if (fromActivity instanceof cgeo) { - ((cgeo) fromActivity).updateCacheCounter(); + if (fromActivity instanceof MainActivity) { + ((MainActivity) fromActivity).updateCacheCounter(); } } }; diff --git a/main/src/cgeo/geocaching/cgeocaches.java b/main/src/cgeo/geocaching/cgeocaches.java index 61a32f1..811425c 100644 --- a/main/src/cgeo/geocaching/cgeocaches.java +++ b/main/src/cgeo/geocaching/cgeocaches.java @@ -39,6 +39,7 @@ import cgeo.geocaching.sorting.VisitComparator; import cgeo.geocaching.ui.CacheListAdapter; import cgeo.geocaching.ui.LoggingUI; import cgeo.geocaching.ui.WeakReferenceHandler; +import cgeo.geocaching.utils.AsyncTaskWithProgress; import cgeo.geocaching.utils.DateUtils; import cgeo.geocaching.utils.GeoDirHandler; import cgeo.geocaching.utils.Log; @@ -74,6 +75,7 @@ import android.widget.ListView; import android.widget.TextView; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.Date; import java.util.HashSet; @@ -373,21 +375,6 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity } } }; - private Handler dropDetailsHandler = new Handler() { - - @Override - public void handleMessage(Message msg) { - if (msg.what != MSG_CANCEL) { - adapter.setSelectMode(false); - - refreshCurrentList(); - - replaceCacheListFromSearch(); - - progress.dismiss(); - } - } - }; private Handler clearOfflineLogsHandler = new Handler() { @Override @@ -428,7 +415,7 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity if (extras != null) { Object typeObject = extras.get(Intents.EXTRA_LIST_TYPE); type = (typeObject instanceof CacheListType) ? (CacheListType) typeObject : CacheListType.OFFLINE; - coords = (Geopoint) extras.getParcelable(Intents.EXTRAS_COORDS); + coords = extras.getParcelable(Intents.EXTRA_COORDS); } else { extras = new Bundle(); @@ -440,6 +427,17 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity } } + // Add the list selection in code. This way we can leave the XML layout the same as for other activities. + final View titleBar = findViewById(R.id.actionbar_title); + titleBar.setClickable(true); + titleBar.setOnClickListener(new View.OnClickListener() { + + @Override + public void onClick(View v) { + selectList(v); + } + }); + setTitle(title); setAdapter(); @@ -625,8 +623,6 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity setVisible(menu, MENU_EXPORT, !isEmpty); setVisible(menu, MENU_REMOVE_FROM_HISTORY, !isEmpty); setVisible(menu, MENU_CLEAR_OFFLINE_LOGS, !isEmpty && containsOfflineLogs()); - setVisible(menu, MENU_IMPORT_GPX, isConcrete); - setVisible(menu, MENU_IMPORT_WEB, isConcrete); if (navigationMenu != null) { navigationMenu.setVisible(!isEmpty); @@ -794,7 +790,6 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity } public void deletePastEvents() { - progress.show(this, null, res.getString(R.string.caches_drop_progress), true, dropDetailsHandler.obtainMessage(MSG_CANCEL)); final List<Geocache> deletion = new ArrayList<Geocache>(); for (Geocache cache : adapter.getCheckedOrAllCaches()) { if (cache.isEventCache()) { @@ -804,7 +799,7 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity } } } - new DropDetailsThread(dropDetailsHandler, deletion).start(); + new DropDetailsTask(false).execute(deletion.toArray(new Geocache[deletion.size()])); } public void clearOfflineLogs() { @@ -1082,6 +1077,11 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity return; } + if (!Network.isNetworkConnected(getApplicationContext())) { + showToast(getString(R.string.err_server)); + return; + } + if (Settings.getChooseList() && type != CacheListType.OFFLINE) { // let user select list to store cache in new StoredList.UserInterface(this).promptForListSelection(R.string.list_title, @@ -1144,7 +1144,7 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity public void removeFromHistory() { final List<Geocache> caches = adapter.getCheckedOrAllCaches(); - final String geocodes[] = new String[caches.size()]; + final String[] geocodes = new String[caches.size()]; for (int i = 0; i < geocodes.length; i++) { geocodes[i] = caches.get(i).getGeocode(); } @@ -1177,10 +1177,7 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity @Override public void onClick(DialogInterface dialog, int id) { - dropSelected(); - if (removeListAfterwards) { - removeList(false); - } + dropSelected(removeListAfterwards); dialog.cancel(); } }); @@ -1196,9 +1193,9 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity alert.show(); } - public void dropSelected() { - progress.show(this, null, res.getString(R.string.caches_drop_progress), true, dropDetailsHandler.obtainMessage(MSG_CANCEL)); - new DropDetailsThread(dropDetailsHandler, adapter.getCheckedOrAllCaches()).start(); + public void dropSelected(boolean removeListAfterwards) { + final List<Geocache> selected = adapter.getCheckedOrAllCaches(); + new DropDetailsTask(removeListAfterwards).execute(selected.toArray(new Geocache[selected.size()])); } /** @@ -1309,7 +1306,7 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity public LoadFromWebThread(Handler handlerIn, int listId) { handler = handlerIn; - listIdLFW = listId; + listIdLFW = StoredList.getConcreteList(listId); } public void kill() { @@ -1383,24 +1380,35 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity } } - private class DropDetailsThread extends Thread { + private class DropDetailsTask extends AsyncTaskWithProgress<Geocache, Void> { - final private Handler handler; - final private List<Geocache> selected; + private final boolean removeListAfterwards; - public DropDetailsThread(Handler handlerIn, List<Geocache> selectedIn) { - handler = handlerIn; - selected = selectedIn; + public DropDetailsTask(boolean removeListAfterwards) { + super(cgeocaches.this, null, res.getString(R.string.caches_drop_progress), true); + this.removeListAfterwards = removeListAfterwards; } @Override - public void run() { + protected Void doInBackgroundInternal(Geocache[] caches) { removeGeoAndDir(); - cgData.markDropped(selected); - handler.sendEmptyMessage(MSG_DONE); - + cgData.markDropped(Arrays.asList(caches)); startGeoAndDir(); + return null; } + + @Override + protected void onPostExecuteInternal(Void result) { + // remove list in UI because of toast + if (removeListAfterwards) { + removeList(false); + } + + adapter.setSelectMode(false); + refreshCurrentList(); + replaceCacheListFromSearch(); + } + } private class ClearOfflineLogsThread extends Thread { @@ -1667,7 +1675,7 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity } final Intent cachesIntent = new Intent(context, cgeocaches.class); cachesIntent.putExtra(Intents.EXTRA_LIST_TYPE, CacheListType.NEAREST); - cachesIntent.putExtra(Intents.EXTRAS_COORDS, coordsNow); + cachesIntent.putExtra(Intents.EXTRA_COORDS, coordsNow); context.startActivity(cachesIntent); } @@ -1680,7 +1688,7 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity public static void startActivityAddress(final Context context, final Geopoint coords, final String address) { final Intent addressIntent = new Intent(context, cgeocaches.class); addressIntent.putExtra(Intents.EXTRA_LIST_TYPE, CacheListType.ADDRESS); - addressIntent.putExtra(Intents.EXTRAS_COORDS, coords); + addressIntent.putExtra(Intents.EXTRA_COORDS, coords); addressIntent.putExtra(Intents.EXTRA_ADDRESS, address); context.startActivity(addressIntent); } @@ -1691,7 +1699,7 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity } final Intent cachesIntent = new Intent(context, cgeocaches.class); cachesIntent.putExtra(Intents.EXTRA_LIST_TYPE, CacheListType.COORDINATE); - cachesIntent.putExtra(Intents.EXTRAS_COORDS, coords); + cachesIntent.putExtra(Intents.EXTRA_COORDS, coords); context.startActivity(cachesIntent); } @@ -1725,11 +1733,11 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity @Override public Loader<SearchResult> onCreateLoader(int type, Bundle extras) { - AbstractSearchLoader loader = null; if (type >= CacheListLoaderType.values().length) { throw new IllegalArgumentException("invalid loader type " + type); } CacheListLoaderType enumType = CacheListLoaderType.values()[type]; + AbstractSearchLoader loader = null; switch (enumType) { case OFFLINE: listId = Settings.getLastList(); diff --git a/main/src/cgeo/geocaching/cgeonavigate.java b/main/src/cgeo/geocaching/cgeonavigate.java index 17c2e20..b5205a6 100644 --- a/main/src/cgeo/geocaching/cgeonavigate.java +++ b/main/src/cgeo/geocaching/cgeonavigate.java @@ -52,18 +52,14 @@ public class cgeonavigate extends AbstractActivity { @Override public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - setTheme(); - setContentView(R.layout.navigate); - setTitle(res.getString(R.string.compass_title)); + super.onCreate(savedInstanceState, R.layout.navigate); // get parameters Bundle extras = getIntent().getExtras(); if (extras != null) { title = extras.getString(EXTRAS_GEOCODE); final String name = extras.getString(EXTRAS_NAME); - dstCoords = (Geopoint) extras.getParcelable(EXTRAS_COORDS); + dstCoords = extras.getParcelable(EXTRAS_COORDS); info = extras.getString(EXTRAS_CACHE_INFO); if (StringUtils.isNotBlank(name)) { diff --git a/main/src/cgeo/geocaching/connector/gc/GCConstants.java b/main/src/cgeo/geocaching/connector/gc/GCConstants.java index 4d27617..d8711cf 100644 --- a/main/src/cgeo/geocaching/connector/gc/GCConstants.java +++ b/main/src/cgeo/geocaching/connector/gc/GCConstants.java @@ -149,7 +149,7 @@ public final class GCConstants { public final static Pattern PATTERN_MAINTENANCE = Pattern.compile("<span id=\"ctl00_ContentBody_LogBookPanel1_lbConfirm\"[^>]*>([^<]*<font[^>]*>)?([^<]+)(</font>[^<]*)?</span>", Pattern.CASE_INSENSITIVE); public final static Pattern PATTERN_OK1 = Pattern.compile("<h2[^>]*>[^<]*<span id=\"ctl00_ContentBody_lbHeading\"[^>]*>[^<]*</span>[^<]*</h2>", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE); public final static Pattern PATTERN_OK2 = Pattern.compile("<div id=[\"|']ctl00_ContentBody_LogBookPanel1_ViewLogPanel[\"|']>", Pattern.CASE_INSENSITIVE); - public final static Pattern PATTERN_OK_IMAGEUPLOAD = Pattern.compile("<div id=[\"|']ctl00_ContentBody_ImageUploadControl1_uxUploadDonePanel[\"|']>", Pattern.CASE_INSENSITIVE); + public final static Pattern PATTERN_IMAGE_UPLOAD_URL = Pattern.compile("title=\"Click for Larger Image\"\\s*src=\"(.*?)\"", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE); public final static Pattern PATTERN_VIEWSTATEFIELDCOUNT = Pattern.compile("id=\"__VIEWSTATEFIELDCOUNT\"[^(value)]+value=\"(\\d+)\"[^>]+>", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE); public final static Pattern PATTERN_VIEWSTATES = Pattern.compile("id=\"__VIEWSTATE(\\d*)\"[^(value)]+value=\"([^\"]+)\"[^>]+>", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE); public final static Pattern PATTERN_USERTOKEN = Pattern.compile("userToken\\s*=\\s*'([^']+)'"); diff --git a/main/src/cgeo/geocaching/connector/gc/GCParser.java b/main/src/cgeo/geocaching/connector/gc/GCParser.java index 649ffa6..c8473a5 100644 --- a/main/src/cgeo/geocaching/connector/gc/GCParser.java +++ b/main/src/cgeo/geocaching/connector/gc/GCParser.java @@ -215,7 +215,7 @@ public abstract class GCParser { cache.setFavoritePoints(Integer.parseInt(result)); } } catch (NumberFormatException e) { - Log.w("GCParser.parseSearch: Failed to parse favourite count"); + Log.w("GCParser.parseSearch: Failed to parse favorite count"); } searchResult.addCache(cache); @@ -424,11 +424,11 @@ public abstract class GCParser { Log.w("GCParser.parseCache: Failed to parse cache hidden (event) date"); } - // favourite + // favorite try { cache.setFavoritePoints(Integer.parseInt(BaseUtils.getMatch(tableInside, GCConstants.PATTERN_FAVORITECOUNT, true, "0"))); } catch (NumberFormatException e) { - Log.e("Error parsing favourite count", e); + Log.e("Error parsing favorite count", e); } // cache size @@ -826,6 +826,15 @@ public abstract class GCParser { return searchByAny(cacheType, false, showCaptcha, params, recaptchaReceiver); } + private static boolean isSearchForMyCaches(final String userName) { + boolean my = false; + if (userName.equalsIgnoreCase(Settings.getLogin().left)) { + my = true; + Log.i("Overriding users choice because of self search, downloading all caches."); + } + return my; + } + public static SearchResult searchByUsername(final String userName, final CacheType cacheType, final boolean showCaptcha, RecaptchaReceiver recaptchaReceiver) { if (StringUtils.isBlank(userName)) { Log.e("GCParser.searchByUsername: No user name given"); @@ -834,13 +843,7 @@ public abstract class GCParser { final Parameters params = new Parameters("ul", userName); - boolean my = false; - if (userName.equalsIgnoreCase(Settings.getLogin().left)) { - my = true; - Log.i("GCParser.searchByUsername: Overriding users choice, downloading all caches."); - } - - return searchByAny(cacheType, my, showCaptcha, params, recaptchaReceiver); + return searchByAny(cacheType, isSearchForMyCaches(userName), showCaptcha, params, recaptchaReceiver); } public static SearchResult searchByOwner(final String userName, final CacheType cacheType, final boolean showCaptcha, RecaptchaReceiver recaptchaReceiver) { @@ -850,7 +853,7 @@ public abstract class GCParser { } final Parameters params = new Parameters("u", userName); - return searchByAny(cacheType, false, showCaptcha, params, recaptchaReceiver); + return searchByAny(cacheType, isSearchForMyCaches(userName), showCaptcha, params, recaptchaReceiver); } public static SearchResult searchByAddress(final String address, final CacheType cacheType, final boolean showCaptcha, RecaptchaReceiver recaptchaReceiver) { @@ -1059,7 +1062,7 @@ public abstract class GCParser { * the URI for the image to be uploaded * @return status code to indicate success or failure */ - public static StatusCode uploadLogImage(final String logId, final String caption, final String description, final Uri imageUri) { + public static ImmutablePair<StatusCode, String> uploadLogImage(final String logId, final String caption, final String description, final Uri imageUri) { final String uri = new Uri.Builder().scheme("http").authority("www.geocaching.com").path("/seek/upload.aspx").encodedQuery("LID=" + logId).build().toString(); String page = Network.getResponseData(Network.getRequest(uri)); @@ -1071,7 +1074,7 @@ public abstract class GCParser { page = Network.getResponseData(Network.getRequest(uri)); } else { Log.e("Image upload: No login (error: " + loginState + ')'); - return StatusCode.NOT_LOGGED_IN; + return ImmutablePair.of(StatusCode.NOT_LOGGED_IN, null); } } @@ -1088,18 +1091,23 @@ public abstract class GCParser { final File image = new File(imageUri.getPath()); final String response = Network.getResponseData(Network.postRequest(uri, uploadParams, "ctl00$ContentBody$ImageUploadControl1$uxFileUpload", "image/jpeg", image)); - MatcherWrapper matcherOK = new MatcherWrapper(GCConstants.PATTERN_OK_IMAGEUPLOAD, response); + MatcherWrapper matcherUrl = new MatcherWrapper(GCConstants.PATTERN_IMAGE_UPLOAD_URL, response); - if (matcherOK.find()) { + if (matcherUrl.find()) { Log.i("Logimage successfully uploaded."); - - return StatusCode.NO_ERROR; + final String uploadedImageUrl = matcherUrl.group(1); + return ImmutablePair.of(StatusCode.NO_ERROR, uploadedImageUrl); } Log.e("GCParser.uploadLogIMage: Failed to upload image because of unknown error"); - return StatusCode.LOGIMAGE_POST_ERROR; + return ImmutablePair.of(StatusCode.LOGIMAGE_POST_ERROR, null); } + /** + * Post a log to GC.com. + * + * @return status code of the upload and ID of the log + */ public static StatusCode postLogTrackable(final String tbid, final String trackingCode, final String[] viewstates, final LogType logType, final int year, final int month, final int day, final String log) { if (Login.isEmpty(viewstates)) { @@ -1581,15 +1589,8 @@ public abstract class GCParser { final List<LogType> types = new ArrayList<LogType>(); final MatcherWrapper typeBoxMatcher = new MatcherWrapper(GCConstants.PATTERN_TYPEBOX, page); - String typesText = null; - if (typeBoxMatcher.find()) { - if (typeBoxMatcher.groupCount() > 0) { - typesText = typeBoxMatcher.group(1); - } - } - - if (typesText != null) { - + if (typeBoxMatcher.find() && typeBoxMatcher.groupCount() > 0) { + String typesText = typeBoxMatcher.group(1); final MatcherWrapper typeMatcher = new MatcherWrapper(GCConstants.PATTERN_TYPE2, typesText); while (typeMatcher.find()) { if (typeMatcher.groupCount() > 1) { @@ -1605,6 +1606,9 @@ public abstract class GCParser { } } + // we don't support this log type + types.remove(LogType.UPDATE_COORDINATES); + return types; } diff --git a/main/src/cgeo/geocaching/connector/oc/OC11XMLParser.java b/main/src/cgeo/geocaching/connector/oc/OC11XMLParser.java index 621032f..d03062f 100644 --- a/main/src/cgeo/geocaching/connector/oc/OC11XMLParser.java +++ b/main/src/cgeo/geocaching/connector/oc/OC11XMLParser.java @@ -48,6 +48,8 @@ public class OC11XMLParser { private static Pattern LOCAL_URL = Pattern.compile("href=\"(.*)\""); private static final int CACHE_PARSE_LIMIT = 250; private static final Resources res = cgeoapplication.getInstance().getResources(); + private static final Pattern WHITESPACE = Pattern.compile("<p>(\\s| )*</p>"); + private static ImageHolder imageHolder = null; @@ -513,7 +515,7 @@ public class OC11XMLParser { @Override public void end(String body) { final String content = body.trim(); - descHolder.shortDesc = linkify(stripMarkup(content)); + descHolder.shortDesc = linkify(stripEmptyText(content)); } }); @@ -523,7 +525,7 @@ public class OC11XMLParser { @Override public void end(String body) { final String content = body.trim(); - descHolder.desc = linkify(stripMarkup(content)); + descHolder.desc = linkify(stripEmptyText(content)); } }); @@ -626,7 +628,7 @@ public class OC11XMLParser { @Override public void end(String logText) { - logHolder.logEntry.log = stripMarkup(logText); + logHolder.logEntry.log = stripEmptyText(logText); } }); @@ -728,14 +730,20 @@ public class OC11XMLParser { } /** - * Removes unneeded markup. Log texts are typically encapsulated in paragraph tags which lead to more empty space on - * rendering. + * Removes some unneeded markup and whitespace. Log texts are typically encapsulated in paragraph tags which lead to + * more empty space on rendering. */ - protected static String stripMarkup(String input) { - if (!StringUtils.startsWith(input, "<")) { - return input; + protected static String stripEmptyText(String input) { + final Matcher matcher = WHITESPACE.matcher(input); + String result = matcher.replaceAll("").trim(); + if (!StringUtils.startsWith(result, "<")) { + return result; } - String result = input.trim(); + return stripMarkup(result); + } + + private static String stripMarkup(final String input) { + String result = input; for (String tagName : MARKUP) { final String startTag = "<" + tagName + ">"; if (StringUtils.startsWith(result, startTag)) { diff --git a/main/src/cgeo/geocaching/enumerations/CacheAttribute.java b/main/src/cgeo/geocaching/enumerations/CacheAttribute.java index 530869f..339516b 100644 --- a/main/src/cgeo/geocaching/enumerations/CacheAttribute.java +++ b/main/src/cgeo/geocaching/enumerations/CacheAttribute.java @@ -12,8 +12,8 @@ import java.util.HashMap; import java.util.Map; public enum CacheAttribute { - // THIS LIST IS GENERATED: don't change anything here but in - // project/attributes/makeEnum.sh + // THIS LIST IS GENERATED: don't change anything here but read + // project/attributes/readme.txt DOGS(1, -1, "dogs", R.drawable.attribute_dogs, R.string.attribute_dogs_yes, R.string.attribute_dogs_no), BICYCLES(32, -1, "bicycles", R.drawable.attribute_bicycles, R.string.attribute_bicycles_yes, R.string.attribute_bicycles_no), MOTORCYCLES(33, -1, "motorcycles", R.drawable.attribute_motorcycles, R.string.attribute_motorcycles_yes, R.string.attribute_motorcycles_no), @@ -27,7 +27,7 @@ public enum CacheAttribute { ONEHOUR(7, -1, "onehour", R.drawable.attribute_onehour, R.string.attribute_onehour_yes, R.string.attribute_onehour_no), SCENIC(8, -1, "scenic", R.drawable.attribute_scenic, R.string.attribute_scenic_yes, R.string.attribute_scenic_no), HIKING(9, 25, "hiking", R.drawable.attribute_hiking, R.string.attribute_hiking_yes, R.string.attribute_hiking_no), - CLIMBING(10, 28, "climbing", R.drawable.attribute_climbing, R.string.attribute_climbing_yes, R.string.attribute_climbing_no), + CLIMBING(10, -1, "climbing", R.drawable.attribute_climbing, R.string.attribute_climbing_yes, R.string.attribute_climbing_no), WADING(11, -1, "wading", R.drawable.attribute_wading, R.string.attribute_wading_yes, R.string.attribute_wading_no), SWIMMING(12, 29, "swimming", R.drawable.attribute_swimming, R.string.attribute_swimming_yes, R.string.attribute_swimming_no), AVAILABLE(13, 38, "available", R.drawable.attribute_available, R.string.attribute_available_yes, R.string.attribute_available_no), @@ -86,6 +86,7 @@ public enum CacheAttribute { SYRINGE(-1, 23, "syringe", R.drawable.attribute_syringe, R.string.attribute_syringe_yes, R.string.attribute_syringe_no), SWAMP(-1, 26, "swamp", R.drawable.attribute_swamp, R.string.attribute_swamp_yes, R.string.attribute_swamp_no), HILLS(-1, 27, "hills", R.drawable.attribute_hills, R.string.attribute_hills_yes, R.string.attribute_hills_no), + EASY_CLIMBING(-1, 28, "easy_climbing", R.drawable.attribute_easy_climbing, R.string.attribute_easy_climbing_yes, R.string.attribute_easy_climbing_no), POI(-1, 30, "poi", R.drawable.attribute_poi, R.string.attribute_poi_yes, R.string.attribute_poi_no), MOVING_TARGET(-1, 31, "moving_target", R.drawable.attribute_moving_target, R.string.attribute_moving_target_yes, R.string.attribute_moving_target_no), WEBCAM(-1, 32, "webcam", R.drawable.attribute_webcam, R.string.attribute_webcam_yes, R.string.attribute_webcam_no), @@ -108,8 +109,8 @@ public enum CacheAttribute { OTHER_CACHE(-1, 57, "other_cache", R.drawable.attribute_other_cache, R.string.attribute_other_cache_yes, R.string.attribute_other_cache_no), ASK_OWNER(-1, 58, "ask_owner", R.drawable.attribute_ask_owner, R.string.attribute_ask_owner_yes, R.string.attribute_ask_owner_no), UNKNOWN(-1, -1, "unknown", R.drawable.attribute_unknown, R.string.attribute_unknown_yes, R.string.attribute_unknown_no); - // THIS LIST IS GENERATED: don't change anything here but in - // project/attributes/makeEnum.sh + // THIS LIST IS GENERATED: don't change anything here but read + // project/attributes/readme.txt private static final String INTERNAL_YES = "_yes"; private static final String INTERNAL_NO = "_no"; @@ -146,30 +147,20 @@ public enum CacheAttribute { } private final static Map<String, CacheAttribute> FIND_BY_GCRAWNAME; + private final static SparseArray<CacheAttribute> FIND_BY_GCID = new SparseArray<CacheAttribute>(); + private final static SparseArray<CacheAttribute> FIND_BY_OCID = new SparseArray<CacheAttribute>(); static { final HashMap<String, CacheAttribute> mapGcRawNames = new HashMap<String, CacheAttribute>(); for (CacheAttribute attr : values()) { mapGcRawNames.put(attr.rawName, attr); - } - FIND_BY_GCRAWNAME = Collections.unmodifiableMap(mapGcRawNames); - } - - private final static SparseArray<CacheAttribute> FIND_BY_GCID = new SparseArray<CacheAttribute>(); - static { - for (CacheAttribute attr : values()) { if (attr.gcid != NO_ID) { FIND_BY_GCID.put(attr.gcid, attr); } - } - } - - private final static SparseArray<CacheAttribute> FIND_BY_OCID = new SparseArray<CacheAttribute>(); - static { - for (CacheAttribute attr : values()) { if (attr.ocid != NO_ID) { FIND_BY_OCID.put(attr.ocid, attr); } } + FIND_BY_GCRAWNAME = Collections.unmodifiableMap(mapGcRawNames); } public static CacheAttribute getByRawName(final String rawName) { diff --git a/main/src/cgeo/geocaching/export/AbstractExport.java b/main/src/cgeo/geocaching/export/AbstractExport.java index 72ea544..e4ba5f0 100644 --- a/main/src/cgeo/geocaching/export/AbstractExport.java +++ b/main/src/cgeo/geocaching/export/AbstractExport.java @@ -1,5 +1,6 @@ package cgeo.geocaching.export; +import cgeo.geocaching.R; import cgeo.geocaching.cgeoapplication; abstract class AbstractExport implements Export { @@ -27,7 +28,7 @@ abstract class AbstractExport implements Export { /** * Generates a localized string from a resource id. - * + * * @param resourceId * the resource id of the string * @param params @@ -43,4 +44,8 @@ abstract class AbstractExport implements Export { // used in the array adapter of the dialog showing the exports return getName(); } + + protected String getProgressTitle() { + return getString(R.string.export) + ": " + getName(); + } } diff --git a/main/src/cgeo/geocaching/export/FieldnoteExport.java b/main/src/cgeo/geocaching/export/FieldnoteExport.java index 5e1805a..2900781 100644 --- a/main/src/cgeo/geocaching/export/FieldnoteExport.java +++ b/main/src/cgeo/geocaching/export/FieldnoteExport.java @@ -5,11 +5,11 @@ import cgeo.geocaching.LogEntry; import cgeo.geocaching.R; import cgeo.geocaching.cgData; import cgeo.geocaching.activity.ActivityMixin; -import cgeo.geocaching.activity.Progress; import cgeo.geocaching.connector.gc.Login; import cgeo.geocaching.enumerations.StatusCode; import cgeo.geocaching.network.Network; import cgeo.geocaching.network.Parameters; +import cgeo.geocaching.utils.AsyncTaskWithProgress; import cgeo.geocaching.utils.IOUtils; import cgeo.geocaching.utils.Log; @@ -20,7 +20,6 @@ import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; import android.content.DialogInterface; -import android.os.AsyncTask; import android.os.Environment; import android.view.ContextThemeWrapper; import android.view.View; @@ -57,18 +56,19 @@ class FieldnoteExport extends AbstractExport { } @Override - public void export(final List<Geocache> caches, final Activity activity) { + public void export(final List<Geocache> cachesList, final Activity activity) { + final Geocache[] caches = cachesList.toArray(new Geocache[cachesList.size()]); if (null == activity) { // No activity given, so no user interaction possible. // Start export with default parameters. - new ExportTask(caches, null, false, false).execute((Void) null); + new ExportTask(null, false, false).execute(caches); } else { // Show configuration dialog getExportOptionsDialog(caches, activity).show(); } } - private Dialog getExportOptionsDialog(final List<Geocache> caches, final Activity activity) { + private Dialog getExportOptionsDialog(final Geocache[] caches, final Activity activity) { AlertDialog.Builder builder = new AlertDialog.Builder(activity); // AlertDialog has always dark style, so we have to apply it as well always @@ -91,32 +91,27 @@ class FieldnoteExport extends AbstractExport { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); new ExportTask( - caches, activity, uploadOption.isChecked(), onlyNewOption.isChecked()) - .execute((Void) null); + .execute(caches); } }); return builder.create(); } - private class ExportTask extends AsyncTask<Void, Integer, Boolean> { - private final List<Geocache> caches; + private class ExportTask extends AsyncTaskWithProgress<Geocache, Boolean> { private final Activity activity; private final boolean upload; private final boolean onlyNew; - private final Progress progress = new Progress(); private File exportFile; private static final int STATUS_UPLOAD = -1; /** - * Instantiates and configurates the task for exporting field notes. + * Instantiates and configures the task for exporting field notes. * - * @param caches - * The {@link List} of {@link cgeo.geocaching.Geocache} to be exported * @param activity * optional: Show a progress bar and toasts * @param upload @@ -124,22 +119,15 @@ class FieldnoteExport extends AbstractExport { * @param onlyNew * Upload/export only new logs since last export */ - public ExportTask(final List<Geocache> caches, final Activity activity, final boolean upload, final boolean onlyNew) { - this.caches = caches; + public ExportTask(final Activity activity, final boolean upload, final boolean onlyNew) { + super(activity, getProgressTitle(), getString(R.string.export_fieldnotes_creating)); this.activity = activity; this.upload = upload; this.onlyNew = onlyNew; } @Override - protected void onPreExecute() { - if (null != activity) { - progress.show(activity, getString(R.string.export) + ": " + getName(), getString(R.string.export_fieldnotes_creating), true, null); - } - } - - @Override - protected Boolean doInBackground(Void... params) { + protected Boolean doInBackgroundInternal(Geocache[] caches) { final StringBuilder fieldNoteBuffer = new StringBuilder(); try { int i = 0; @@ -227,10 +215,8 @@ class FieldnoteExport extends AbstractExport { } @Override - protected void onPostExecute(Boolean result) { + protected void onPostExecuteInternal(Boolean result) { if (null != activity) { - progress.dismiss(); - if (result) { // if (onlyNew) { // // update last export time in settings when doing it ourself (currently we use the date check from gc.com) @@ -248,12 +234,12 @@ class FieldnoteExport extends AbstractExport { } @Override - protected void onProgressUpdate(Integer... status) { + protected void onProgressUpdateInternal(int status) { if (null != activity) { - if (STATUS_UPLOAD == status[0]) { - progress.setMessage(getString(R.string.export_fieldnotes_uploading)); + if (STATUS_UPLOAD == status) { + setMessage(getString(R.string.export_fieldnotes_uploading)); } else { - progress.setMessage(getString(R.string.export_fieldnotes_creating) + " (" + status[0] + ')'); + setMessage(getString(R.string.export_fieldnotes_creating) + " (" + status + ')'); } } } diff --git a/main/src/cgeo/geocaching/export/GpxExport.java b/main/src/cgeo/geocaching/export/GpxExport.java index c2a58b7..3e58276 100644 --- a/main/src/cgeo/geocaching/export/GpxExport.java +++ b/main/src/cgeo/geocaching/export/GpxExport.java @@ -6,11 +6,12 @@ import cgeo.geocaching.R; import cgeo.geocaching.Settings; import cgeo.geocaching.Waypoint; import cgeo.geocaching.cgData; +import cgeo.geocaching.cgeoapplication; import cgeo.geocaching.activity.ActivityMixin; -import cgeo.geocaching.activity.Progress; import cgeo.geocaching.enumerations.CacheAttribute; import cgeo.geocaching.enumerations.LoadFlags; import cgeo.geocaching.geopoint.Geopoint; +import cgeo.geocaching.utils.AsyncTaskWithProgress; import cgeo.geocaching.utils.BaseUtils; import cgeo.geocaching.utils.Log; import cgeo.geocaching.utils.XmlUtils; @@ -22,11 +23,9 @@ import org.xmlpull.v1.XmlSerializer; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; -import android.app.ProgressDialog; import android.content.DialogInterface; import android.content.Intent; import android.net.Uri; -import android.os.AsyncTask; import android.os.Environment; import android.view.ContextThemeWrapper; import android.view.View; @@ -38,9 +37,12 @@ import java.io.FileWriter; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; import java.util.Date; import java.util.List; import java.util.Locale; +import java.util.Set; class GpxExport extends AbstractExport { private static final SimpleDateFormat dateFormatZ = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US); @@ -48,24 +50,30 @@ class GpxExport extends AbstractExport { public static final String PREFIX_GPX = "http://www.topografix.com/GPX/1/0"; public static final String PREFIX_GROUNDSPEAK = "http://www.groundspeak.com/cache/1/0"; + /** + * During the export, only this number of geocaches is fully loaded into memory. + */ + public static final int CACHES_PER_BATCH = 100; + protected GpxExport() { super(getString(R.string.export_gpx)); } @Override public void export(final List<Geocache> caches, final Activity activity) { + String[] geocodes = getGeocodes(caches); if (null == activity) { // No activity given, so no user interaction possible. // Start export with default parameters. - new ExportTask(caches, null).execute((Void) null); + new ExportTask(null).execute(geocodes); } else { // Show configuration dialog - getExportDialog(caches, activity).show(); + getExportDialog(geocodes, activity).show(); } } - private Dialog getExportDialog(final List<Geocache> caches, final Activity activity) { + private Dialog getExportDialog(final String[] geocodes, final Activity activity) { AlertDialog.Builder builder = new AlertDialog.Builder(activity); // AlertDialog has always dark style, so we have to apply it as well always @@ -91,46 +99,47 @@ class GpxExport extends AbstractExport { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); - new ExportTask(caches, activity).execute((Void) null); + new ExportTask(activity).execute(geocodes); } }); return builder.create(); } - protected class ExportTask extends AsyncTask<Void, Integer, File> { - private final List<Geocache> caches; + private static String[] getGeocodes(final List<Geocache> caches) { + ArrayList<String> allGeocodes = new ArrayList<String>(caches.size()); + for (final Geocache geocache : caches) { + allGeocodes.add(geocache.getGeocode()); + } + return allGeocodes.toArray(new String[allGeocodes.size()]); + } + + protected class ExportTask extends AsyncTaskWithProgress<String, File> { private final Activity activity; - private final Progress progress = new Progress(); + private int countExported = 0; /** * Instantiates and configures the task for exporting field notes. * - * @param caches - * The {@link List} of {@link cgeo.geocaching.Geocache} to be exported * @param activity * optional: Show a progress bar and toasts */ - public ExportTask(final List<Geocache> caches, final Activity activity) { - this.caches = caches; + public ExportTask(final Activity activity) { + super(activity, getProgressTitle()); this.activity = activity; } @Override - protected void onPreExecute() { - if (null != activity) { - progress.show(activity, null, getString(R.string.export) + ": " + getName(), ProgressDialog.STYLE_HORIZONTAL, null); - progress.setMaxProgressAndReset(caches.size()); - } - } - - @Override - protected File doInBackground(Void... params) { + protected File doInBackgroundInternal(String[] geocodes) { // quick check for being able to write the GPX file if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { return null; } + List<String> allGeocodes = new ArrayList<String>(Arrays.asList(geocodes)); + + setMessage(cgeoapplication.getInstance().getResources().getQuantityString(R.plurals.cache_counts, allGeocodes.size(), allGeocodes.size())); + final SimpleDateFormat fileNameDateFormat = new SimpleDateFormat("yyyyMMddHHmmss", Locale.US); final File exportFile = new File(Settings.getGpxExportDir() + File.separatorChar + "export_" + fileNameDateFormat.format(new Date()) + ".gpx"); FileWriter writer = null; @@ -153,68 +162,17 @@ class GpxExport extends AbstractExport { PREFIX_GPX + " http://www.topografix.com/GPX/1/0/gpx.xsd " + PREFIX_GROUNDSPEAK + " http://www.groundspeak.com/cache/1/0/1/cache.xsd"); - for (int i = 0; i < caches.size(); i++) { - final Geocache cache = cgData.loadCache(caches.get(i).getGeocode(), LoadFlags.LOAD_ALL_DB_ONLY); - - gpx.startTag(PREFIX_GPX, "wpt"); - gpx.attribute("", "lat", Double.toString(cache.getCoords().getLatitude())); - gpx.attribute("", "lon", Double.toString(cache.getCoords().getLongitude())); - - final Date hiddenDate = cache.getHiddenDate(); - if (hiddenDate != null) { - XmlUtils.simpleText(gpx, PREFIX_GPX, "time", dateFormatZ.format(hiddenDate)); - } - - XmlUtils.multipleTexts(gpx, PREFIX_GPX, - "name", cache.getGeocode(), - "desc", cache.getName(), - "url", cache.getUrl(), - "urlname", cache.getName(), - "sym", cache.isFound() ? "Geocache Found" : "Geocache", - "type", "Geocache|" + cache.getType().pattern); - - gpx.startTag(PREFIX_GROUNDSPEAK, "cache"); - gpx.attribute("", "id", cache.getCacheId()); - gpx.attribute("", "available", !cache.isDisabled() ? "True" : "False"); - gpx.attribute("", "archives", cache.isArchived() ? "True" : "False"); - - XmlUtils.multipleTexts(gpx, PREFIX_GROUNDSPEAK, - "name", cache.getName(), - "placed_by", cache.getOwnerDisplayName(), - "owner", cache.getOwnerUserId(), - "type", cache.getType().pattern, - "container", cache.getSize().id, - "difficulty", Float.toString(cache.getDifficulty()), - "terrain", Float.toString(cache.getTerrain()), - "country", cache.getLocation(), - "state", "", - "encoded_hints", cache.getHint()); - - writeAttributes(gpx, cache); - - gpx.startTag(PREFIX_GROUNDSPEAK, "short_description"); - gpx.attribute("", "html", BaseUtils.containsHtml(cache.getShortDescription()) ? "True" : "False"); - gpx.text(cache.getShortDescription()); - gpx.endTag(PREFIX_GROUNDSPEAK, "short_description"); - - gpx.startTag(PREFIX_GROUNDSPEAK, "long_description"); - gpx.attribute("", "html", BaseUtils.containsHtml(cache.getDescription()) ? "True" : "False"); - gpx.text(cache.getDescription()); - gpx.endTag(PREFIX_GROUNDSPEAK, "long_description"); - - writeLogs(gpx, cache); - - gpx.endTag(PREFIX_GROUNDSPEAK, "cache"); - gpx.endTag(PREFIX_GPX, "wpt"); - - writeWaypoints(gpx, cache); - - publishProgress(i + 1); + // Split the overall set of geocodes into small chunks. That is a compromise between memory efficiency (because + // we don't load all caches fully into memory) and speed (because we don't query each cache separately). + while (!allGeocodes.isEmpty()) { + final List<String> batch = allGeocodes.subList(0, Math.min(CACHES_PER_BATCH, allGeocodes.size())); + exportBatch(gpx, batch); + batch.clear(); } gpx.endTag(PREFIX_GPX, "gpx"); gpx.endDocument(); - } catch (final IOException e) { + } catch (final Exception e) { Log.e("GpxExport.ExportTask export", e); if (writer != null) { @@ -235,6 +193,67 @@ class GpxExport extends AbstractExport { return exportFile; } + private void exportBatch(final XmlSerializer gpx, Collection<String> geocodesOfBatch) throws IOException { + Set<Geocache> caches = cgData.loadCaches(geocodesOfBatch, LoadFlags.LOAD_ALL_DB_ONLY); + for (Geocache cache : caches) { + gpx.startTag(PREFIX_GPX, "wpt"); + gpx.attribute("", "lat", Double.toString(cache.getCoords().getLatitude())); + gpx.attribute("", "lon", Double.toString(cache.getCoords().getLongitude())); + + final Date hiddenDate = cache.getHiddenDate(); + if (hiddenDate != null) { + XmlUtils.simpleText(gpx, PREFIX_GPX, "time", dateFormatZ.format(hiddenDate)); + } + + XmlUtils.multipleTexts(gpx, PREFIX_GPX, + "name", cache.getGeocode(), + "desc", cache.getName(), + "url", cache.getUrl(), + "urlname", cache.getName(), + "sym", cache.isFound() ? "Geocache Found" : "Geocache", + "type", "Geocache|" + cache.getType().pattern); + + gpx.startTag(PREFIX_GROUNDSPEAK, "cache"); + gpx.attribute("", "id", cache.getCacheId()); + gpx.attribute("", "available", !cache.isDisabled() ? "True" : "False"); + gpx.attribute("", "archives", cache.isArchived() ? "True" : "False"); + + XmlUtils.multipleTexts(gpx, PREFIX_GROUNDSPEAK, + "name", cache.getName(), + "placed_by", cache.getOwnerDisplayName(), + "owner", cache.getOwnerUserId(), + "type", cache.getType().pattern, + "container", cache.getSize().id, + "difficulty", Float.toString(cache.getDifficulty()), + "terrain", Float.toString(cache.getTerrain()), + "country", cache.getLocation(), + "state", "", + "encoded_hints", cache.getHint()); + + writeAttributes(gpx, cache); + + gpx.startTag(PREFIX_GROUNDSPEAK, "short_description"); + gpx.attribute("", "html", BaseUtils.containsHtml(cache.getShortDescription()) ? "True" : "False"); + gpx.text(cache.getShortDescription()); + gpx.endTag(PREFIX_GROUNDSPEAK, "short_description"); + + gpx.startTag(PREFIX_GROUNDSPEAK, "long_description"); + gpx.attribute("", "html", BaseUtils.containsHtml(cache.getDescription()) ? "True" : "False"); + gpx.text(cache.getDescription()); + gpx.endTag(PREFIX_GROUNDSPEAK, "long_description"); + + writeLogs(gpx, cache); + + gpx.endTag(PREFIX_GROUNDSPEAK, "cache"); + gpx.endTag(PREFIX_GPX, "wpt"); + + writeWaypoints(gpx, cache); + + countExported++; + publishProgress(countExported); + } + } + private void writeWaypoints(final XmlSerializer gpx, final Geocache cache) throws IOException { List<Waypoint> waypoints = cache.getWaypoints(); List<Waypoint> ownWaypoints = new ArrayList<Waypoint>(waypoints.size()); @@ -345,9 +364,8 @@ class GpxExport extends AbstractExport { } @Override - protected void onPostExecute(final File exportFile) { + protected void onPostExecuteInternal(final File exportFile) { if (null != activity) { - progress.dismiss(); if (exportFile != null) { ActivityMixin.showToast(activity, getName() + ' ' + getString(R.string.export_exportedto) + ": " + exportFile.toString()); if (Settings.getShareAfterExport()) { @@ -363,11 +381,5 @@ class GpxExport extends AbstractExport { } } - @Override - protected void onProgressUpdate(Integer... status) { - if (null != activity) { - progress.setProgress(status[0]); - } - } } } diff --git a/main/src/cgeo/geocaching/files/AbstractFileListActivity.java b/main/src/cgeo/geocaching/files/AbstractFileListActivity.java index 5ff0d91..8b02eeb 100644 --- a/main/src/cgeo/geocaching/files/AbstractFileListActivity.java +++ b/main/src/cgeo/geocaching/files/AbstractFileListActivity.java @@ -89,7 +89,6 @@ public abstract class AbstractFileListActivity<T extends ArrayAdapter<File>> ext setTheme(); setContentView(R.layout.gpx); - setTitle(); Bundle extras = getIntent().getExtras(); if (extras != null) { @@ -146,11 +145,6 @@ public abstract class AbstractFileListActivity<T extends ArrayAdapter<File>> ext */ protected abstract List<File> getBaseFolders(); - /** - * Triggers the deriving class to set the title - */ - protected abstract void setTitle(); - private class SearchFilesThread extends Thread { private final FileListSelector selector = new FileListSelector(); diff --git a/main/src/cgeo/geocaching/files/GPXImporter.java b/main/src/cgeo/geocaching/files/GPXImporter.java index b8dcbb3..ff81fe1 100644 --- a/main/src/cgeo/geocaching/files/GPXImporter.java +++ b/main/src/cgeo/geocaching/files/GPXImporter.java @@ -1,458 +1,462 @@ -package cgeo.geocaching.files;
-
-import cgeo.geocaching.Geocache;
-import cgeo.geocaching.R;
-import cgeo.geocaching.SearchResult;
-import cgeo.geocaching.Settings;
-import cgeo.geocaching.StaticMapsProvider;
-import cgeo.geocaching.cgData;
-import cgeo.geocaching.activity.IAbstractActivity;
-import cgeo.geocaching.activity.Progress;
-import cgeo.geocaching.enumerations.LoadFlags;
-import cgeo.geocaching.utils.CancellableHandler;
-import cgeo.geocaching.utils.Log;
-
-import org.apache.commons.lang3.StringUtils;
-
-import android.app.Activity;
-import android.app.ProgressDialog;
-import android.content.ContentResolver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.res.Resources;
-import android.net.Uri;
-import android.os.Handler;
-import android.os.Message;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.concurrent.CancellationException;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-
-public class GPXImporter {
- static final int IMPORT_STEP_START = 0;
- static final int IMPORT_STEP_READ_FILE = 1;
- static final int IMPORT_STEP_READ_WPT_FILE = 2;
- static final int IMPORT_STEP_STORE_STATIC_MAPS = 4;
- static final int IMPORT_STEP_FINISHED = 5;
- static final int IMPORT_STEP_FINISHED_WITH_ERROR = 6;
- static final int IMPORT_STEP_CANCEL = 7;
- static final int IMPORT_STEP_CANCELED = 8;
- static final int IMPORT_STEP_STATIC_MAPS_SKIPPED = 9;
-
- public static final String GPX_FILE_EXTENSION = ".gpx";
- public static final String ZIP_FILE_EXTENSION = ".zip";
- public static final String WAYPOINTS_FILE_SUFFIX = "-wpts";
- public static final String WAYPOINTS_FILE_SUFFIX_AND_EXTENSION = WAYPOINTS_FILE_SUFFIX + GPX_FILE_EXTENSION;
-
- private static final List<String> GPX_MIME_TYPES = Arrays.asList("text/xml", "application/xml");
- private static final List<String> ZIP_MIME_TYPES = Arrays.asList("application/zip", "application/x-compressed", "application/x-zip-compressed", "application/x-zip", "application/octet-stream");
-
- private Progress progress = new Progress(true);
-
- private Resources res;
- private int listId;
- private IAbstractActivity fromActivity;
- private Handler importFinishedHandler;
-
- public GPXImporter(final IAbstractActivity fromActivity, final int listId, final Handler importFinishedHandler) {
- this.listId = listId;
- this.fromActivity = fromActivity;
- res = ((Activity) fromActivity).getResources();
- this.importFinishedHandler = importFinishedHandler;
- }
-
- /**
- * Import GPX file. Currently supports *.gpx, *.zip (containing gpx files, e.g. PQ queries) or *.loc files.
- *
- * @param file
- * the file to import
- */
- public void importGPX(final File file) {
- if (StringUtils.endsWithIgnoreCase(file.getName(), GPX_FILE_EXTENSION)) {
- new ImportGpxFileThread(file, listId, importStepHandler, progressHandler).start();
- } else if (StringUtils.endsWithIgnoreCase(file.getName(), ZIP_FILE_EXTENSION)) {
- new ImportGpxZipFileThread(file, listId, importStepHandler, progressHandler).start();
- } else {
- new ImportLocFileThread(file, listId, importStepHandler, progressHandler).start();
- }
- }
-
- /**
- * Import GPX provided via intent of activity that instantiated this GPXImporter.
- */
- public void importGPX() {
- final ContentResolver contentResolver = ((Activity) fromActivity).getContentResolver();
- final Intent intent = ((Activity) fromActivity).getIntent();
- final Uri uri = intent.getData();
-
- String mimeType = intent.getType();
- // if mimetype can't be determined (e.g. for emulators email app), derive it from uri file extension
- // contentResolver.getType(uri) doesn't help but throws exception for emulators email app
- // Permission Denial: reading com.android.email.provider.EmailProvider uri
- // Google search says: there is no solution for this problem
- // Gmail doesn't work at all, see #967
- if (mimeType == null) {
- if (StringUtils.endsWithIgnoreCase(uri.getPath(), GPX_FILE_EXTENSION)) {
- mimeType = "application/xml";
- } else {
- // if we can't determine a better type, default to zip import
- // emulator email sends e.g. content://com.android.email.attachmentprovider/1/1/RAW, mimetype=null
- mimeType = "application/zip";
- }
- }
-
- Log.i("importGPX: " + uri + ", mimetype=" + mimeType);
- if (GPX_MIME_TYPES.contains(mimeType)) {
- new ImportGpxAttachmentThread(uri, contentResolver, listId, importStepHandler, progressHandler).start();
- } else if (ZIP_MIME_TYPES.contains(mimeType)) {
- new ImportGpxZipAttachmentThread(uri, contentResolver, listId, importStepHandler, progressHandler).start();
- } else {
- importFinished();
- }
- }
-
- static abstract class ImportThread extends Thread {
- final int listId;
- final Handler importStepHandler;
- final CancellableHandler progressHandler;
-
- protected ImportThread(int listId, Handler importStepHandler, CancellableHandler progressHandler) {
- this.listId = listId;
- this.importStepHandler = importStepHandler;
- this.progressHandler = progressHandler;
- }
-
- @Override
- public void run() {
- try {
- importStepHandler.sendMessage(importStepHandler.obtainMessage(IMPORT_STEP_START));
- final Collection<Geocache> caches = doImport();
- Log.i("Imported successfully " + caches.size() + " caches.");
-
- final SearchResult search = new SearchResult();
- for (Geocache cache : caches) {
- search.addCache(cache);
- }
-
- if (Settings.isStoreOfflineMaps() || Settings.isStoreOfflineWpMaps()) {
- importStepHandler.sendMessage(importStepHandler.obtainMessage(IMPORT_STEP_STORE_STATIC_MAPS, R.string.gpx_import_store_static_maps, search.getCount()));
- boolean finishedWithoutCancel = importStaticMaps(search);
- // Skip last message if static maps where canceled
- if (!finishedWithoutCancel) {
- return;
- }
- }
-
- importStepHandler.sendMessage(importStepHandler.obtainMessage(IMPORT_STEP_FINISHED, search.getCount(), 0, search));
- } catch (IOException e) {
- Log.i("Importing caches failed - error reading data: " + e.getMessage());
- importStepHandler.sendMessage(importStepHandler.obtainMessage(IMPORT_STEP_FINISHED_WITH_ERROR, R.string.gpx_import_error_io, 0, e.getLocalizedMessage()));
- } catch (ParserException e) {
- Log.i("Importing caches failed - data format error" + e.getMessage());
- importStepHandler.sendMessage(importStepHandler.obtainMessage(IMPORT_STEP_FINISHED_WITH_ERROR, R.string.gpx_import_error_parser, 0, e.getLocalizedMessage()));
- } catch (CancellationException e) {
- Log.i("Importing caches canceled");
- importStepHandler.sendMessage(importStepHandler.obtainMessage(IMPORT_STEP_CANCELED));
- } catch (Exception e) {
- Log.e("Importing caches failed - unknown error: ", e);
- importStepHandler.sendMessage(importStepHandler.obtainMessage(IMPORT_STEP_FINISHED_WITH_ERROR, R.string.gpx_import_error_unexpected, 0, e.getLocalizedMessage()));
- }
- }
-
- protected abstract Collection<Geocache> doImport() throws IOException, ParserException;
-
- private boolean importStaticMaps(final SearchResult importedCaches) {
- int storedCacheMaps = 0;
- for (String geocode : importedCaches.getGeocodes()) {
- Geocache cache = cgData.loadCache(geocode, LoadFlags.LOAD_WAYPOINTS);
- Log.d("GPXImporter.ImportThread.importStaticMaps start downloadMaps for cache " + geocode);
- StaticMapsProvider.downloadMaps(cache);
- storedCacheMaps++;
- if (progressHandler.isCancelled()) {
- return false;
- }
- progressHandler.sendMessage(progressHandler.obtainMessage(0, storedCacheMaps, 0));
- }
- return true;
- }
- }
-
- static class ImportLocFileThread extends ImportThread {
- private final File file;
-
- public ImportLocFileThread(final File file, int listId, Handler importStepHandler, CancellableHandler progressHandler) {
- super(listId, importStepHandler, progressHandler);
- this.file = file;
- }
-
- @Override
- protected Collection<Geocache> doImport() throws IOException, ParserException {
- Log.i("Import LOC file: " + file.getAbsolutePath());
- importStepHandler.sendMessage(importStepHandler.obtainMessage(IMPORT_STEP_READ_FILE, R.string.gpx_import_loading_caches, (int) file.length()));
- LocParser parser = new LocParser(listId);
- return parser.parse(file, progressHandler);
- }
- }
-
- static abstract class ImportGpxThread extends ImportThread {
-
- protected ImportGpxThread(int listId, Handler importStepHandler, CancellableHandler progressHandler) {
- super(listId, importStepHandler, progressHandler);
- }
-
- @Override
- protected Collection<Geocache> doImport() throws IOException, ParserException {
- try {
- // try to parse cache file as GPX 10
- return doImport(new GPX10Parser(listId));
- } catch (ParserException pe) {
- // didn't work -> lets try GPX11
- return doImport(new GPX11Parser(listId));
- }
- }
-
- protected abstract Collection<Geocache> doImport(GPXParser parser) throws IOException, ParserException;
- }
-
- static class ImportGpxFileThread extends ImportGpxThread {
- private final File cacheFile;
-
- public ImportGpxFileThread(final File file, int listId, Handler importStepHandler, CancellableHandler progressHandler) {
- super(listId, importStepHandler, progressHandler);
- this.cacheFile = file;
- }
-
- @Override
- protected Collection<Geocache> doImport(GPXParser parser) throws IOException, ParserException {
- Log.i("Import GPX file: " + cacheFile.getAbsolutePath());
- importStepHandler.sendMessage(importStepHandler.obtainMessage(IMPORT_STEP_READ_FILE, R.string.gpx_import_loading_caches, (int) cacheFile.length()));
- Collection<Geocache> caches = parser.parse(cacheFile, progressHandler);
-
- final String wptsFilename = getWaypointsFileNameForGpxFile(cacheFile);
- if (wptsFilename != null) {
- final File wptsFile = new File(cacheFile.getParentFile(), wptsFilename);
- if (wptsFile.canRead()) {
- Log.i("Import GPX waypoint file: " + wptsFile.getAbsolutePath());
- importStepHandler.sendMessage(importStepHandler.obtainMessage(IMPORT_STEP_READ_WPT_FILE, R.string.gpx_import_loading_waypoints, (int) wptsFile.length()));
- caches = parser.parse(wptsFile, progressHandler);
- }
- }
- return caches;
- }
- }
-
- static class ImportGpxAttachmentThread extends ImportGpxThread {
- private final Uri uri;
- private ContentResolver contentResolver;
-
- public ImportGpxAttachmentThread(Uri uri, ContentResolver contentResolver, int listId, Handler importStepHandler, CancellableHandler progressHandler) {
- super(listId, importStepHandler, progressHandler);
- this.uri = uri;
- this.contentResolver = contentResolver;
- }
-
- @Override
- protected Collection<Geocache> doImport(GPXParser parser) throws IOException, ParserException {
- Log.i("Import GPX from uri: " + uri);
- importStepHandler.sendMessage(importStepHandler.obtainMessage(IMPORT_STEP_READ_FILE, R.string.gpx_import_loading_caches, -1));
- InputStream is = contentResolver.openInputStream(uri);
- try {
- return parser.parse(is, progressHandler);
- } finally {
- is.close();
- }
- }
- }
-
- static abstract class ImportGpxZipThread extends ImportGpxThread {
-
- protected ImportGpxZipThread(int listId, Handler importStepHandler, CancellableHandler progressHandler) {
- super(listId, importStepHandler, progressHandler);
- }
-
- @Override
- protected Collection<Geocache> doImport(GPXParser parser) throws IOException, ParserException {
- Collection<Geocache> caches = Collections.emptySet();
- // can't assume that GPX file comes before waypoint file in zip -> so we need two passes
- // 1. parse GPX files
- ZipInputStream zis = new ZipInputStream(getInputStream());
- try {
- for (ZipEntry zipEntry = zis.getNextEntry(); zipEntry != null; zipEntry = zis.getNextEntry()) {
- if (StringUtils.endsWithIgnoreCase(zipEntry.getName(), GPX_FILE_EXTENSION)) {
- if (!StringUtils.endsWithIgnoreCase(zipEntry.getName(), WAYPOINTS_FILE_SUFFIX_AND_EXTENSION)) {
- importStepHandler.sendMessage(importStepHandler.obtainMessage(IMPORT_STEP_READ_FILE, R.string.gpx_import_loading_caches, (int) zipEntry.getSize()));
- caches = parser.parse(new NoCloseInputStream(zis), progressHandler);
- }
- } else {
- throw new ParserException("Imported zip is not a GPX zip file.");
- }
- zis.closeEntry();
- }
- } finally {
- zis.close();
- }
-
- // 2. parse waypoint files
- zis = new ZipInputStream(getInputStream());
- try {
- for (ZipEntry zipEntry = zis.getNextEntry(); zipEntry != null; zipEntry = zis.getNextEntry()) {
- if (StringUtils.endsWithIgnoreCase(zipEntry.getName(), WAYPOINTS_FILE_SUFFIX_AND_EXTENSION)) {
- importStepHandler.sendMessage(importStepHandler.obtainMessage(IMPORT_STEP_READ_WPT_FILE, R.string.gpx_import_loading_waypoints, (int) zipEntry.getSize()));
- caches = parser.parse(new NoCloseInputStream(zis), progressHandler);
- }
- zis.closeEntry();
- }
- } finally {
- zis.close();
- }
-
- return caches;
- }
-
- protected abstract InputStream getInputStream() throws IOException;
- }
-
- static class ImportGpxZipFileThread extends ImportGpxZipThread {
- private final File cacheFile;
-
- public ImportGpxZipFileThread(final File file, int listId, Handler importStepHandler, CancellableHandler progressHandler) {
- super(listId, importStepHandler, progressHandler);
- this.cacheFile = file;
- Log.i("Import zipped GPX: " + file);
- }
-
- @Override
- protected InputStream getInputStream() throws IOException {
- return new FileInputStream(cacheFile);
- }
- }
-
- static class ImportGpxZipAttachmentThread extends ImportGpxZipThread {
- private final Uri uri;
- private ContentResolver contentResolver;
-
- public ImportGpxZipAttachmentThread(Uri uri, ContentResolver contentResolver, int listId, Handler importStepHandler, CancellableHandler progressHandler) {
- super(listId, importStepHandler, progressHandler);
- this.uri = uri;
- this.contentResolver = contentResolver;
- Log.i("Import zipped GPX from uri: " + uri);
- }
-
- @Override
- protected InputStream getInputStream() throws IOException {
- return contentResolver.openInputStream(uri);
- }
- }
-
- final private CancellableHandler progressHandler = new CancellableHandler() {
- @Override
- public void handleRegularMessage(Message msg) {
- progress.setProgress(msg.arg1);
- }
- };
-
- final private Handler importStepHandler = new Handler() {
- private boolean showProgressAfterCancel = false;
-
- @Override
- public void handleMessage(Message msg) {
- switch (msg.what) {
- case IMPORT_STEP_START:
- Message cancelMessage = importStepHandler.obtainMessage(IMPORT_STEP_CANCEL);
- progress.show((Context) fromActivity, res.getString(R.string.gpx_import_title_reading_file), res.getString(R.string.gpx_import_loading_caches), ProgressDialog.STYLE_HORIZONTAL, cancelMessage);
- break;
-
- case IMPORT_STEP_READ_FILE:
- case IMPORT_STEP_READ_WPT_FILE:
- progress.setMessage(res.getString(msg.arg1));
- progress.setMaxProgressAndReset(msg.arg2);
- break;
-
- case IMPORT_STEP_STORE_STATIC_MAPS:
- progress.dismiss();
- Message skipMessage = importStepHandler.obtainMessage(IMPORT_STEP_STATIC_MAPS_SKIPPED, msg.arg2, 0);
- progress.show((Context) fromActivity, res.getString(R.string.gpx_import_title_static_maps), res.getString(R.string.gpx_import_store_static_maps), ProgressDialog.STYLE_HORIZONTAL, skipMessage);
- progress.setMaxProgressAndReset(msg.arg2);
- break;
-
- case IMPORT_STEP_STATIC_MAPS_SKIPPED:
- progress.dismiss();
- progressHandler.cancel();
- StringBuilder bufferSkipped = new StringBuilder(20);
- bufferSkipped.append(res.getString(R.string.gpx_import_static_maps_skipped)).append(", ").append(msg.arg1).append(' ').append(res.getString(R.string.gpx_import_caches_imported));
- fromActivity.helpDialog(res.getString(R.string.gpx_import_title_caches_imported), bufferSkipped.toString());
- importFinished();
- break;
-
- case IMPORT_STEP_FINISHED:
- progress.dismiss();
- fromActivity.helpDialog(res.getString(R.string.gpx_import_title_caches_imported), msg.arg1 + " " + res.getString(R.string.gpx_import_caches_imported));
- importFinished();
- break;
-
- case IMPORT_STEP_FINISHED_WITH_ERROR:
- progress.dismiss();
- fromActivity.helpDialog(res.getString(R.string.gpx_import_title_caches_import_failed), res.getString(msg.arg1) + "\n\n" + msg.obj);
- importFinished();
- break;
-
- case IMPORT_STEP_CANCEL:
- progress.dismiss();
- progressHandler.cancel();
- break;
-
- case IMPORT_STEP_CANCELED:
- StringBuilder bufferCanceled = new StringBuilder(20);
- bufferCanceled.append(res.getString(R.string.gpx_import_canceled));
- if (showProgressAfterCancel) {
- bufferCanceled.append(", ").append(progress.getProgress()).append(' ').append(res.getString(R.string.gpx_import_caches_imported));
- }
- fromActivity.showShortToast(bufferCanceled.toString());
- importFinished();
- break;
-
- default:
- break;
- }
- }
- };
-
- /**
- * @param gpxfile
- * the gpx file
- * @return the expected file name of the waypoints file
- */
- static String getWaypointsFileNameForGpxFile(final File gpxfile) {
- if (gpxfile == null || !gpxfile.canRead()) {
- return null;
- }
- final String gpxFileName = gpxfile.getName();
- File dir = gpxfile.getParentFile();
- String[] filenameList = dir.list();
- for (String filename : filenameList) {
- if (!StringUtils.containsIgnoreCase(filename, WAYPOINTS_FILE_SUFFIX)) {
- continue;
- }
- String expectedGpxFileName = StringUtils.substringBeforeLast(filename, WAYPOINTS_FILE_SUFFIX)
- + StringUtils.substringAfterLast(filename, WAYPOINTS_FILE_SUFFIX);
- if (gpxFileName.equals(expectedGpxFileName)) {
- return filename;
- }
- }
- return null;
- }
-
- protected void importFinished() {
- if (importFinishedHandler != null) {
- importFinishedHandler.sendEmptyMessage(0);
- }
- }
-}
+package cgeo.geocaching.files; + +import cgeo.geocaching.Geocache; +import cgeo.geocaching.R; +import cgeo.geocaching.SearchResult; +import cgeo.geocaching.Settings; +import cgeo.geocaching.StaticMapsProvider; +import cgeo.geocaching.cgData; +import cgeo.geocaching.activity.IAbstractActivity; +import cgeo.geocaching.activity.Progress; +import cgeo.geocaching.enumerations.LoadFlags; +import cgeo.geocaching.utils.CancellableHandler; +import cgeo.geocaching.utils.Log; + +import org.apache.commons.lang3.StringUtils; + +import android.app.Activity; +import android.app.ProgressDialog; +import android.content.ContentResolver; +import android.content.Context; +import android.content.Intent; +import android.content.res.Resources; +import android.net.Uri; +import android.os.Handler; +import android.os.Message; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.concurrent.CancellationException; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; + +public class GPXImporter { + static final int IMPORT_STEP_START = 0; + static final int IMPORT_STEP_READ_FILE = 1; + static final int IMPORT_STEP_READ_WPT_FILE = 2; + static final int IMPORT_STEP_STORE_STATIC_MAPS = 4; + static final int IMPORT_STEP_FINISHED = 5; + static final int IMPORT_STEP_FINISHED_WITH_ERROR = 6; + static final int IMPORT_STEP_CANCEL = 7; + static final int IMPORT_STEP_CANCELED = 8; + static final int IMPORT_STEP_STATIC_MAPS_SKIPPED = 9; + + public static final String GPX_FILE_EXTENSION = ".gpx"; + public static final String ZIP_FILE_EXTENSION = ".zip"; + public static final String WAYPOINTS_FILE_SUFFIX = "-wpts"; + public static final String WAYPOINTS_FILE_SUFFIX_AND_EXTENSION = WAYPOINTS_FILE_SUFFIX + GPX_FILE_EXTENSION; + + private static final List<String> GPX_MIME_TYPES = Arrays.asList("text/xml", "application/xml"); + private static final List<String> ZIP_MIME_TYPES = Arrays.asList("application/zip", "application/x-compressed", "application/x-zip-compressed", "application/x-zip", "application/octet-stream"); + + private Progress progress = new Progress(true); + + private Resources res; + private int listId; + private IAbstractActivity fromActivity; + private Handler importFinishedHandler; + + public GPXImporter(final IAbstractActivity fromActivity, final int listId, final Handler importFinishedHandler) { + this.listId = listId; + this.fromActivity = fromActivity; + res = ((Activity) fromActivity).getResources(); + this.importFinishedHandler = importFinishedHandler; + } + + /** + * Import GPX file. Currently supports *.gpx, *.zip (containing gpx files, e.g. PQ queries) or *.loc files. + * + * @param file + * the file to import + */ + public void importGPX(final File file) { + if (StringUtils.endsWithIgnoreCase(file.getName(), GPX_FILE_EXTENSION)) { + new ImportGpxFileThread(file, listId, importStepHandler, progressHandler).start(); + } else if (StringUtils.endsWithIgnoreCase(file.getName(), ZIP_FILE_EXTENSION)) { + new ImportGpxZipFileThread(file, listId, importStepHandler, progressHandler).start(); + } else { + new ImportLocFileThread(file, listId, importStepHandler, progressHandler).start(); + } + } + + /** + * Import GPX provided via intent of activity that instantiated this GPXImporter. + */ + public void importGPX() { + final ContentResolver contentResolver = ((Activity) fromActivity).getContentResolver(); + final Intent intent = ((Activity) fromActivity).getIntent(); + final Uri uri = intent.getData(); + + String mimeType = intent.getType(); + // if mimetype can't be determined (e.g. for emulators email app), derive it from uri file extension + // contentResolver.getType(uri) doesn't help but throws exception for emulators email app + // Permission Denial: reading com.android.email.provider.EmailProvider uri + // Google search says: there is no solution for this problem + // Gmail doesn't work at all, see #967 + if (mimeType == null) { + if (StringUtils.endsWithIgnoreCase(uri.getPath(), GPX_FILE_EXTENSION)) { + mimeType = "application/xml"; + } else { + // if we can't determine a better type, default to zip import + // emulator email sends e.g. content://com.android.email.attachmentprovider/1/1/RAW, mimetype=null + mimeType = "application/zip"; + } + } + + Log.i("importGPX: " + uri + ", mimetype=" + mimeType); + if (GPX_MIME_TYPES.contains(mimeType)) { + new ImportGpxAttachmentThread(uri, contentResolver, listId, importStepHandler, progressHandler).start(); + } else if (ZIP_MIME_TYPES.contains(mimeType)) { + new ImportGpxZipAttachmentThread(uri, contentResolver, listId, importStepHandler, progressHandler).start(); + } else { + importFinished(); + } + } + + static abstract class ImportThread extends Thread { + final int listId; + final Handler importStepHandler; + final CancellableHandler progressHandler; + + protected ImportThread(int listId, Handler importStepHandler, CancellableHandler progressHandler) { + this.listId = listId; + this.importStepHandler = importStepHandler; + this.progressHandler = progressHandler; + } + + @Override + public void run() { + try { + importStepHandler.sendMessage(importStepHandler.obtainMessage(IMPORT_STEP_START)); + final Collection<Geocache> caches = doImport(); + Log.i("Imported successfully " + caches.size() + " caches."); + + final SearchResult search = new SearchResult(); + for (Geocache cache : caches) { + search.addCache(cache); + } + + if (Settings.isStoreOfflineMaps() || Settings.isStoreOfflineWpMaps()) { + importStepHandler.sendMessage(importStepHandler.obtainMessage(IMPORT_STEP_STORE_STATIC_MAPS, R.string.gpx_import_store_static_maps, search.getCount())); + boolean finishedWithoutCancel = importStaticMaps(search); + // Skip last message if static maps where canceled + if (!finishedWithoutCancel) { + return; + } + } + + importStepHandler.sendMessage(importStepHandler.obtainMessage(IMPORT_STEP_FINISHED, search.getCount(), 0, search)); + } catch (IOException e) { + Log.i("Importing caches failed - error reading data: " + e.getMessage()); + importStepHandler.sendMessage(importStepHandler.obtainMessage(IMPORT_STEP_FINISHED_WITH_ERROR, R.string.gpx_import_error_io, 0, e.getLocalizedMessage())); + } catch (ParserException e) { + Log.i("Importing caches failed - data format error" + e.getMessage()); + importStepHandler.sendMessage(importStepHandler.obtainMessage(IMPORT_STEP_FINISHED_WITH_ERROR, R.string.gpx_import_error_parser, 0, e.getLocalizedMessage())); + } catch (CancellationException e) { + Log.i("Importing caches canceled"); + importStepHandler.sendMessage(importStepHandler.obtainMessage(IMPORT_STEP_CANCELED)); + } catch (Exception e) { + Log.e("Importing caches failed - unknown error: ", e); + importStepHandler.sendMessage(importStepHandler.obtainMessage(IMPORT_STEP_FINISHED_WITH_ERROR, R.string.gpx_import_error_unexpected, 0, e.getLocalizedMessage())); + } + } + + protected abstract Collection<Geocache> doImport() throws IOException, ParserException; + + private boolean importStaticMaps(final SearchResult importedCaches) { + int storedCacheMaps = 0; + for (final String geocode : importedCaches.getGeocodes()) { + final Geocache cache = cgData.loadCache(geocode, LoadFlags.LOAD_WAYPOINTS); + if (cache != null) { + Log.d("GPXImporter.ImportThread.importStaticMaps start downloadMaps for cache " + geocode); + StaticMapsProvider.downloadMaps(cache); + } else { + Log.d("GPXImporter.ImportThread.importStaticMaps: no data found for " + geocode); + } + storedCacheMaps++; + if (progressHandler.isCancelled()) { + return false; + } + progressHandler.sendMessage(progressHandler.obtainMessage(0, storedCacheMaps, 0)); + } + return true; + } + } + + static class ImportLocFileThread extends ImportThread { + private final File file; + + public ImportLocFileThread(final File file, int listId, Handler importStepHandler, CancellableHandler progressHandler) { + super(listId, importStepHandler, progressHandler); + this.file = file; + } + + @Override + protected Collection<Geocache> doImport() throws IOException, ParserException { + Log.i("Import LOC file: " + file.getAbsolutePath()); + importStepHandler.sendMessage(importStepHandler.obtainMessage(IMPORT_STEP_READ_FILE, R.string.gpx_import_loading_caches, (int) file.length())); + LocParser parser = new LocParser(listId); + return parser.parse(file, progressHandler); + } + } + + static abstract class ImportGpxThread extends ImportThread { + + protected ImportGpxThread(int listId, Handler importStepHandler, CancellableHandler progressHandler) { + super(listId, importStepHandler, progressHandler); + } + + @Override + protected Collection<Geocache> doImport() throws IOException, ParserException { + try { + // try to parse cache file as GPX 10 + return doImport(new GPX10Parser(listId)); + } catch (ParserException pe) { + // didn't work -> lets try GPX11 + return doImport(new GPX11Parser(listId)); + } + } + + protected abstract Collection<Geocache> doImport(GPXParser parser) throws IOException, ParserException; + } + + static class ImportGpxFileThread extends ImportGpxThread { + private final File cacheFile; + + public ImportGpxFileThread(final File file, int listId, Handler importStepHandler, CancellableHandler progressHandler) { + super(listId, importStepHandler, progressHandler); + this.cacheFile = file; + } + + @Override + protected Collection<Geocache> doImport(GPXParser parser) throws IOException, ParserException { + Log.i("Import GPX file: " + cacheFile.getAbsolutePath()); + importStepHandler.sendMessage(importStepHandler.obtainMessage(IMPORT_STEP_READ_FILE, R.string.gpx_import_loading_caches, (int) cacheFile.length())); + Collection<Geocache> caches = parser.parse(cacheFile, progressHandler); + + final String wptsFilename = getWaypointsFileNameForGpxFile(cacheFile); + if (wptsFilename != null) { + final File wptsFile = new File(cacheFile.getParentFile(), wptsFilename); + if (wptsFile.canRead()) { + Log.i("Import GPX waypoint file: " + wptsFile.getAbsolutePath()); + importStepHandler.sendMessage(importStepHandler.obtainMessage(IMPORT_STEP_READ_WPT_FILE, R.string.gpx_import_loading_waypoints, (int) wptsFile.length())); + caches = parser.parse(wptsFile, progressHandler); + } + } + return caches; + } + } + + static class ImportGpxAttachmentThread extends ImportGpxThread { + private final Uri uri; + private ContentResolver contentResolver; + + public ImportGpxAttachmentThread(Uri uri, ContentResolver contentResolver, int listId, Handler importStepHandler, CancellableHandler progressHandler) { + super(listId, importStepHandler, progressHandler); + this.uri = uri; + this.contentResolver = contentResolver; + } + + @Override + protected Collection<Geocache> doImport(GPXParser parser) throws IOException, ParserException { + Log.i("Import GPX from uri: " + uri); + importStepHandler.sendMessage(importStepHandler.obtainMessage(IMPORT_STEP_READ_FILE, R.string.gpx_import_loading_caches, -1)); + InputStream is = contentResolver.openInputStream(uri); + try { + return parser.parse(is, progressHandler); + } finally { + is.close(); + } + } + } + + static abstract class ImportGpxZipThread extends ImportGpxThread { + + protected ImportGpxZipThread(int listId, Handler importStepHandler, CancellableHandler progressHandler) { + super(listId, importStepHandler, progressHandler); + } + + @Override + protected Collection<Geocache> doImport(GPXParser parser) throws IOException, ParserException { + Collection<Geocache> caches = Collections.emptySet(); + // can't assume that GPX file comes before waypoint file in zip -> so we need two passes + // 1. parse GPX files + ZipInputStream zis = new ZipInputStream(getInputStream()); + try { + for (ZipEntry zipEntry = zis.getNextEntry(); zipEntry != null; zipEntry = zis.getNextEntry()) { + if (StringUtils.endsWithIgnoreCase(zipEntry.getName(), GPX_FILE_EXTENSION)) { + if (!StringUtils.endsWithIgnoreCase(zipEntry.getName(), WAYPOINTS_FILE_SUFFIX_AND_EXTENSION)) { + importStepHandler.sendMessage(importStepHandler.obtainMessage(IMPORT_STEP_READ_FILE, R.string.gpx_import_loading_caches, (int) zipEntry.getSize())); + caches = parser.parse(new NoCloseInputStream(zis), progressHandler); + } + } else { + throw new ParserException("Imported zip is not a GPX zip file."); + } + zis.closeEntry(); + } + } finally { + zis.close(); + } + + // 2. parse waypoint files + zis = new ZipInputStream(getInputStream()); + try { + for (ZipEntry zipEntry = zis.getNextEntry(); zipEntry != null; zipEntry = zis.getNextEntry()) { + if (StringUtils.endsWithIgnoreCase(zipEntry.getName(), WAYPOINTS_FILE_SUFFIX_AND_EXTENSION)) { + importStepHandler.sendMessage(importStepHandler.obtainMessage(IMPORT_STEP_READ_WPT_FILE, R.string.gpx_import_loading_waypoints, (int) zipEntry.getSize())); + caches = parser.parse(new NoCloseInputStream(zis), progressHandler); + } + zis.closeEntry(); + } + } finally { + zis.close(); + } + + return caches; + } + + protected abstract InputStream getInputStream() throws IOException; + } + + static class ImportGpxZipFileThread extends ImportGpxZipThread { + private final File cacheFile; + + public ImportGpxZipFileThread(final File file, int listId, Handler importStepHandler, CancellableHandler progressHandler) { + super(listId, importStepHandler, progressHandler); + this.cacheFile = file; + Log.i("Import zipped GPX: " + file); + } + + @Override + protected InputStream getInputStream() throws IOException { + return new FileInputStream(cacheFile); + } + } + + static class ImportGpxZipAttachmentThread extends ImportGpxZipThread { + private final Uri uri; + private ContentResolver contentResolver; + + public ImportGpxZipAttachmentThread(Uri uri, ContentResolver contentResolver, int listId, Handler importStepHandler, CancellableHandler progressHandler) { + super(listId, importStepHandler, progressHandler); + this.uri = uri; + this.contentResolver = contentResolver; + Log.i("Import zipped GPX from uri: " + uri); + } + + @Override + protected InputStream getInputStream() throws IOException { + return contentResolver.openInputStream(uri); + } + } + + final private CancellableHandler progressHandler = new CancellableHandler() { + @Override + public void handleRegularMessage(Message msg) { + progress.setProgress(msg.arg1); + } + }; + + final private Handler importStepHandler = new Handler() { + private boolean showProgressAfterCancel = false; + + @Override + public void handleMessage(Message msg) { + switch (msg.what) { + case IMPORT_STEP_START: + Message cancelMessage = importStepHandler.obtainMessage(IMPORT_STEP_CANCEL); + progress.show((Context) fromActivity, res.getString(R.string.gpx_import_title_reading_file), res.getString(R.string.gpx_import_loading_caches), ProgressDialog.STYLE_HORIZONTAL, cancelMessage); + break; + + case IMPORT_STEP_READ_FILE: + case IMPORT_STEP_READ_WPT_FILE: + progress.setMessage(res.getString(msg.arg1)); + progress.setMaxProgressAndReset(msg.arg2); + break; + + case IMPORT_STEP_STORE_STATIC_MAPS: + progress.dismiss(); + Message skipMessage = importStepHandler.obtainMessage(IMPORT_STEP_STATIC_MAPS_SKIPPED, msg.arg2, 0); + progress.show((Context) fromActivity, res.getString(R.string.gpx_import_title_static_maps), res.getString(R.string.gpx_import_store_static_maps), ProgressDialog.STYLE_HORIZONTAL, skipMessage); + progress.setMaxProgressAndReset(msg.arg2); + break; + + case IMPORT_STEP_STATIC_MAPS_SKIPPED: + progress.dismiss(); + progressHandler.cancel(); + StringBuilder bufferSkipped = new StringBuilder(20); + bufferSkipped.append(res.getString(R.string.gpx_import_static_maps_skipped)).append(", ").append(msg.arg1).append(' ').append(res.getString(R.string.gpx_import_caches_imported)); + fromActivity.helpDialog(res.getString(R.string.gpx_import_title_caches_imported), bufferSkipped.toString()); + importFinished(); + break; + + case IMPORT_STEP_FINISHED: + progress.dismiss(); + fromActivity.helpDialog(res.getString(R.string.gpx_import_title_caches_imported), msg.arg1 + " " + res.getString(R.string.gpx_import_caches_imported)); + importFinished(); + break; + + case IMPORT_STEP_FINISHED_WITH_ERROR: + progress.dismiss(); + fromActivity.helpDialog(res.getString(R.string.gpx_import_title_caches_import_failed), res.getString(msg.arg1) + "\n\n" + msg.obj); + importFinished(); + break; + + case IMPORT_STEP_CANCEL: + progress.dismiss(); + progressHandler.cancel(); + break; + + case IMPORT_STEP_CANCELED: + StringBuilder bufferCanceled = new StringBuilder(20); + bufferCanceled.append(res.getString(R.string.gpx_import_canceled)); + if (showProgressAfterCancel) { + bufferCanceled.append(", ").append(progress.getProgress()).append(' ').append(res.getString(R.string.gpx_import_caches_imported)); + } + fromActivity.showShortToast(bufferCanceled.toString()); + importFinished(); + break; + + default: + break; + } + } + }; + + /** + * @param gpxfile + * the gpx file + * @return the expected file name of the waypoints file + */ + static String getWaypointsFileNameForGpxFile(final File gpxfile) { + if (gpxfile == null || !gpxfile.canRead()) { + return null; + } + final String gpxFileName = gpxfile.getName(); + File dir = gpxfile.getParentFile(); + String[] filenameList = dir.list(); + for (String filename : filenameList) { + if (!StringUtils.containsIgnoreCase(filename, WAYPOINTS_FILE_SUFFIX)) { + continue; + } + String expectedGpxFileName = StringUtils.substringBeforeLast(filename, WAYPOINTS_FILE_SUFFIX) + + StringUtils.substringAfterLast(filename, WAYPOINTS_FILE_SUFFIX); + if (gpxFileName.equals(expectedGpxFileName)) { + return filename; + } + } + return null; + } + + protected void importFinished() { + if (importFinishedHandler != null) { + importFinishedHandler.sendEmptyMessage(0); + } + } +} diff --git a/main/src/cgeo/geocaching/files/SimpleDirChooser.java b/main/src/cgeo/geocaching/files/SimpleDirChooser.java index 7520e2e..6b2366c 100644 --- a/main/src/cgeo/geocaching/files/SimpleDirChooser.java +++ b/main/src/cgeo/geocaching/files/SimpleDirChooser.java @@ -2,11 +2,11 @@ package cgeo.geocaching.files; import cgeo.geocaching.Intents; import cgeo.geocaching.R; +import cgeo.geocaching.activity.AbstractListActivity; import cgeo.geocaching.activity.ActivityMixin; import org.apache.commons.lang3.StringUtils; -import android.app.ListActivity; import android.content.Context; import android.content.Intent; import android.net.Uri; @@ -31,7 +31,7 @@ import java.util.List; /** * Dialog for choosing a file or directory. */ -public class SimpleDirChooser extends ListActivity { +public class SimpleDirChooser extends AbstractListActivity { private static final String PARENT_DIR = ".. "; private File currentDir; private FileArrayAdapter adapter; @@ -46,7 +46,6 @@ public class SimpleDirChooser extends ListActivity { ActivityMixin.setTheme(this); setContentView(R.layout.simple_dir_chooser); - setTitle(this.getResources().getString(R.string.simple_dir_chooser_title)); fill(currentDir); @@ -106,13 +105,13 @@ public class SimpleDirChooser extends ListActivity { public class FileArrayAdapter extends ArrayAdapter<Option> { - private Context content; + private Context context; private int id; private List<Option> items; public FileArrayAdapter(Context context, int simpleDirItemResId, List<Option> objects) { super(context, simpleDirItemResId, objects); - this.content = context; + this.context = context; this.id = simpleDirItemResId; this.items = objects; } @@ -126,7 +125,7 @@ public class SimpleDirChooser extends ListActivity { public View getView(int position, View convertView, ViewGroup parent) { View v = convertView; if (v == null) { - LayoutInflater vi = (LayoutInflater) content.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + LayoutInflater vi = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = vi.inflate(id, null); } @@ -187,13 +186,12 @@ public class SimpleDirChooser extends ListActivity { if (currentOption != lastOption) { currentOption.setChecked(true); lastPosition = position; - okButton.setEnabled(true); - okButton.setVisibility(View.VISIBLE); } else { lastPosition = -1; - okButton.setEnabled(false); - okButton.setVisibility(View.INVISIBLE); } + final boolean enabled = currentOption.isChecked() && !currentOption.getName().equals(PARENT_DIR); + okButton.setEnabled(enabled); + okButton.setVisibility(enabled ? View.VISIBLE : View.INVISIBLE); adapter.notifyDataSetChanged(); } } @@ -238,7 +236,7 @@ public class SimpleDirChooser extends ListActivity { @Override public boolean accept(File dir, String filename) { File file = new File(dir, filename); - return file.isDirectory(); + return file.isDirectory() && file.canWrite(); } } diff --git a/main/src/cgeo/geocaching/filter/AttributeFilter.java b/main/src/cgeo/geocaching/filter/AttributeFilter.java index 4b6f382..cadcf49 100644 --- a/main/src/cgeo/geocaching/filter/AttributeFilter.java +++ b/main/src/cgeo/geocaching/filter/AttributeFilter.java @@ -1,16 +1,16 @@ package cgeo.geocaching.filter; -import cgeo.geocaching.R; import cgeo.geocaching.Geocache; +import cgeo.geocaching.R; import cgeo.geocaching.cgData; import cgeo.geocaching.cgeoapplication; import cgeo.geocaching.enumerations.LoadFlags.LoadFlag; -import org.apache.commons.lang3.StringUtils; - import android.content.res.Resources; import java.util.EnumSet; +import java.util.LinkedList; +import java.util.List; class AttributeFilter extends AbstractFilter { @@ -24,13 +24,7 @@ class AttributeFilter extends AbstractFilter { private static String getName(final String attribute, final Resources res, final String packageName) { // dynamically search for a translation of the attribute final int id = res.getIdentifier(attribute, "string", packageName); - if (id > 0) { - final String translated = res.getString(id); - if (StringUtils.isNotBlank(translated)) { - return translated; - } - } - return attribute; + return id > 0 ? res.getString(id) : attribute; } @Override @@ -45,14 +39,13 @@ class AttributeFilter extends AbstractFilter { public static class Factory implements IFilterFactory { @Override - public IFilter[] getFilters() { + public List<IFilter> getFilters() { final String packageName = cgeoapplication.getInstance().getBaseContext().getPackageName(); final Resources res = cgeoapplication.getInstance().getResources(); - final String[] ids = res.getStringArray(R.array.attribute_ids); - final IFilter[] filters = new IFilter[ids.length]; - for (int i = 0; i < ids.length; i++) { - filters[i] = new AttributeFilter(getName("attribute_" + ids[i], res, packageName), ids[i]); + final List<IFilter> filters = new LinkedList<IFilter>(); + for (final String id: res.getStringArray(R.array.attribute_ids)) { + filters.add(new AttributeFilter(getName("attribute_" + id, res, packageName), id)); } return filters; } diff --git a/main/src/cgeo/geocaching/filter/DifficultyFilter.java b/main/src/cgeo/geocaching/filter/DifficultyFilter.java index c0ec61a..8099a51 100644 --- a/main/src/cgeo/geocaching/filter/DifficultyFilter.java +++ b/main/src/cgeo/geocaching/filter/DifficultyFilter.java @@ -4,6 +4,7 @@ import cgeo.geocaching.Geocache; import cgeo.geocaching.R; import java.util.ArrayList; +import java.util.List; class DifficultyFilter extends AbstractRangeFilter { @@ -19,12 +20,12 @@ class DifficultyFilter extends AbstractRangeFilter { public static class Factory implements IFilterFactory { @Override - public IFilter[] getFilters() { + public List<IFilter> getFilters() { final ArrayList<IFilter> filters = new ArrayList<IFilter>(5); for (int difficulty = 1; difficulty <= 5; difficulty++) { filters.add(new DifficultyFilter(difficulty)); } - return filters.toArray(new IFilter[filters.size()]); + return filters; } } diff --git a/main/src/cgeo/geocaching/filter/FilterUserInterface.java b/main/src/cgeo/geocaching/filter/FilterUserInterface.java index be63a08..a1d42cc 100644 --- a/main/src/cgeo/geocaching/filter/FilterUserInterface.java +++ b/main/src/cgeo/geocaching/filter/FilterUserInterface.java @@ -16,6 +16,7 @@ import android.widget.ArrayAdapter; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; +import java.util.List; public final class FilterUserInterface { @@ -101,9 +102,9 @@ public final class FilterUserInterface { } private void selectFromFactory(final IFilterFactory factory, final String menuTitle, final RunnableWithArgument<IFilter> runAfterwards) { - final IFilter[] filters = factory.getFilters(); - if (filters.length == 1) { - runAfterwards.run(filters[0]); + final List<IFilter> filters = Collections.unmodifiableList(factory.getFilters()); + if (filters.size() == 1) { + runAfterwards.run(filters.get(0)); return; } @@ -114,7 +115,7 @@ public final class FilterUserInterface { builder.setAdapter(adapter, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int item) { - runAfterwards.run(filters[item]); + runAfterwards.run(filters.get(item)); } }); diff --git a/main/src/cgeo/geocaching/filter/IFilterFactory.java b/main/src/cgeo/geocaching/filter/IFilterFactory.java index 3491fd7..e750639 100644 --- a/main/src/cgeo/geocaching/filter/IFilterFactory.java +++ b/main/src/cgeo/geocaching/filter/IFilterFactory.java @@ -1,5 +1,7 @@ package cgeo.geocaching.filter; +import java.util.List; + interface IFilterFactory { - public IFilter[] getFilters(); + public List<? extends IFilter> getFilters(); } diff --git a/main/src/cgeo/geocaching/filter/ModifiedFilter.java b/main/src/cgeo/geocaching/filter/ModifiedFilter.java index f3e57de..74befda 100644 --- a/main/src/cgeo/geocaching/filter/ModifiedFilter.java +++ b/main/src/cgeo/geocaching/filter/ModifiedFilter.java @@ -4,6 +4,9 @@ import cgeo.geocaching.Geocache; import cgeo.geocaching.R; import cgeo.geocaching.cgeoapplication; +import java.util.Collections; +import java.util.List; + class ModifiedFilter extends AbstractFilter implements IFilterFactory { public ModifiedFilter() { @@ -17,7 +20,7 @@ class ModifiedFilter extends AbstractFilter implements IFilterFactory { } @Override - public IFilter[] getFilters() { - return new IFilter[] { this }; + public List<ModifiedFilter> getFilters() { + return Collections.singletonList(this); } } diff --git a/main/src/cgeo/geocaching/filter/OriginFilter.java b/main/src/cgeo/geocaching/filter/OriginFilter.java index a880092..bd4e41e 100644 --- a/main/src/cgeo/geocaching/filter/OriginFilter.java +++ b/main/src/cgeo/geocaching/filter/OriginFilter.java @@ -7,6 +7,7 @@ import cgeo.geocaching.connector.IConnector; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; +import java.util.List; public class OriginFilter extends AbstractFilter { @@ -25,7 +26,7 @@ public class OriginFilter extends AbstractFilter { public static final class Factory implements IFilterFactory { @Override - public IFilter[] getFilters() { + public List<OriginFilter> getFilters() { final ArrayList<OriginFilter> filters = new ArrayList<OriginFilter>(); for (IConnector connector : ConnectorFactory.getConnectors()) { filters.add(new OriginFilter(connector)); @@ -40,7 +41,7 @@ public class OriginFilter extends AbstractFilter { } }); - return filters.toArray(new OriginFilter[filters.size()]); + return filters; } } diff --git a/main/src/cgeo/geocaching/filter/SizeFilter.java b/main/src/cgeo/geocaching/filter/SizeFilter.java index 7a34c83..8ddc475 100644 --- a/main/src/cgeo/geocaching/filter/SizeFilter.java +++ b/main/src/cgeo/geocaching/filter/SizeFilter.java @@ -3,7 +3,8 @@ package cgeo.geocaching.filter; import cgeo.geocaching.Geocache; import cgeo.geocaching.enumerations.CacheSize; -import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; class SizeFilter extends AbstractFilter { private final CacheSize cacheSize; @@ -26,15 +27,15 @@ class SizeFilter extends AbstractFilter { public static class Factory implements IFilterFactory { @Override - public IFilter[] getFilters() { + public List<IFilter> getFilters() { final CacheSize[] cacheSizes = CacheSize.values(); - final ArrayList<SizeFilter> filters = new ArrayList<SizeFilter>(); + final List<IFilter> filters = new LinkedList<IFilter>(); for (CacheSize cacheSize : cacheSizes) { if (cacheSize != CacheSize.UNKNOWN) { filters.add(new SizeFilter(cacheSize)); } } - return filters.toArray(new SizeFilter[filters.size()]); + return filters; } } diff --git a/main/src/cgeo/geocaching/filter/StateFilter.java b/main/src/cgeo/geocaching/filter/StateFilter.java index 0df47c1..e18128d 100644 --- a/main/src/cgeo/geocaching/filter/StateFilter.java +++ b/main/src/cgeo/geocaching/filter/StateFilter.java @@ -9,6 +9,7 @@ import android.content.res.Resources; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; +import java.util.List; abstract class StateFilter extends AbstractFilter { @@ -86,17 +87,41 @@ abstract class StateFilter extends AbstractFilter { } } + static class StateStoredFilter extends StateFilter { + public StateStoredFilter() { + super(res.getString(R.string.cache_status_stored)); + } + + @Override + public boolean accepts(Geocache cache) { + return cache.isOffline(); + } + } + + static class StateNotStoredFilter extends StateFilter { + public StateNotStoredFilter() { + super(res.getString(R.string.cache_status_not_stored)); + } + + @Override + public boolean accepts(Geocache cache) { + return !cache.isOffline(); + } + } + public static class Factory implements IFilterFactory { @Override - public IFilter[] getFilters() { - final ArrayList<StateFilter> filters = new ArrayList<StateFilter>(); + public List<StateFilter> getFilters() { + final List<StateFilter> filters = new ArrayList<StateFilter>(6); filters.add(new StateFoundFilter()); filters.add(new StateArchivedFilter()); filters.add(new StateDisabledFilter()); filters.add(new StatePremiumFilter()); filters.add(new StateNonPremiumFilter()); filters.add(new StateOfflineLogFilter()); + filters.add(new StateStoredFilter()); + filters.add(new StateNotStoredFilter()); Collections.sort(filters, new Comparator<StateFilter>() { @@ -106,7 +131,7 @@ abstract class StateFilter extends AbstractFilter { } }); - return filters.toArray(new StateFilter[filters.size()]); + return filters; } } diff --git a/main/src/cgeo/geocaching/filter/TerrainFilter.java b/main/src/cgeo/geocaching/filter/TerrainFilter.java index f7703d5..87372c6 100644 --- a/main/src/cgeo/geocaching/filter/TerrainFilter.java +++ b/main/src/cgeo/geocaching/filter/TerrainFilter.java @@ -1,10 +1,10 @@ package cgeo.geocaching.filter; - -import cgeo.geocaching.R; import cgeo.geocaching.Geocache; +import cgeo.geocaching.R; import java.util.ArrayList; +import java.util.List; class TerrainFilter extends AbstractRangeFilter { @@ -19,12 +19,12 @@ class TerrainFilter extends AbstractRangeFilter { public static class Factory implements IFilterFactory { @Override - public IFilter[] getFilters() { + public List<IFilter> getFilters() { final ArrayList<IFilter> filters = new ArrayList<IFilter>(5); for (int terrain = 1; terrain <= 5; terrain++) { filters.add(new TerrainFilter(terrain)); } - return filters.toArray(new IFilter[filters.size()]); + return filters; } } diff --git a/main/src/cgeo/geocaching/filter/TrackablesFilter.java b/main/src/cgeo/geocaching/filter/TrackablesFilter.java index 3225daa..5eff8a7 100644 --- a/main/src/cgeo/geocaching/filter/TrackablesFilter.java +++ b/main/src/cgeo/geocaching/filter/TrackablesFilter.java @@ -1,9 +1,12 @@ package cgeo.geocaching.filter; -import cgeo.geocaching.R; import cgeo.geocaching.Geocache; +import cgeo.geocaching.R; import cgeo.geocaching.cgeoapplication; +import java.util.Collections; +import java.util.List; + class TrackablesFilter extends AbstractFilter implements IFilterFactory { public TrackablesFilter() { super(cgeoapplication.getInstance().getString(R.string.caches_filter_track)); @@ -15,8 +18,8 @@ class TrackablesFilter extends AbstractFilter implements IFilterFactory { } @Override - public IFilter[] getFilters() { - return new IFilter[] { this }; + public List<TrackablesFilter> getFilters() { + return Collections.singletonList(this); } } diff --git a/main/src/cgeo/geocaching/filter/TypeFilter.java b/main/src/cgeo/geocaching/filter/TypeFilter.java index eeab552..ea0ccff 100644 --- a/main/src/cgeo/geocaching/filter/TypeFilter.java +++ b/main/src/cgeo/geocaching/filter/TypeFilter.java @@ -3,7 +3,8 @@ package cgeo.geocaching.filter; import cgeo.geocaching.Geocache; import cgeo.geocaching.enumerations.CacheType; -import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; class TypeFilter extends AbstractFilter { private final CacheType cacheType; @@ -26,15 +27,15 @@ class TypeFilter extends AbstractFilter { public static class Factory implements IFilterFactory { @Override - public IFilter[] getFilters() { + public List<IFilter> getFilters() { final CacheType[] types = CacheType.values(); - final ArrayList<IFilter> filters = new ArrayList<IFilter>(types.length); + final List<IFilter> filters = new LinkedList<IFilter>(); for (CacheType cacheType : types) { if (cacheType != CacheType.ALL) { filters.add(new TypeFilter(cacheType)); } } - return filters.toArray(new IFilter[filters.size()]); + return filters; } } diff --git a/main/src/cgeo/geocaching/gcvote/GCVote.java b/main/src/cgeo/geocaching/gcvote/GCVote.java index a053f31..f6cfb84 100644 --- a/main/src/cgeo/geocaching/gcvote/GCVote.java +++ b/main/src/cgeo/geocaching/gcvote/GCVote.java @@ -173,12 +173,15 @@ public final class GCVote { /** * Transmit user vote to gcvote.com - * + * * @param cache * @param vote - * @return + * @return {@code true} if the rating was submitted successfully */ public static boolean setRating(Geocache cache, double vote) { + if (!Settings.isGCvoteLogin()) { + return false; + } if (!cache.supportsGCVote()) { return false; } diff --git a/main/src/cgeo/geocaching/maps/CGeoMap.java b/main/src/cgeo/geocaching/maps/CGeoMap.java index 30bbadf..111f384 100644 --- a/main/src/cgeo/geocaching/maps/CGeoMap.java +++ b/main/src/cgeo/geocaching/maps/CGeoMap.java @@ -382,9 +382,9 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto if (extras != null) { mapMode = (MapMode) extras.get(EXTRAS_MAP_MODE); isLiveEnabled = extras.getBoolean(EXTRAS_LIVE_ENABLED, false); - searchIntent = (SearchResult) extras.getParcelable(EXTRAS_SEARCH); + searchIntent = extras.getParcelable(EXTRAS_SEARCH); geocodeIntent = extras.getString(EXTRAS_GEOCODE); - coordsIntent = (Geopoint) extras.getParcelable(EXTRAS_COORDS); + coordsIntent = extras.getParcelable(EXTRAS_COORDS); waypointTypeIntent = WaypointType.findById(extras.getString(EXTRAS_WPTTYPE)); mapStateIntent = extras.getIntArray(EXTRAS_MAPSTATE); mapTitle = extras.getString(EXTRAS_MAP_TITLE); @@ -751,9 +751,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto @Override public void onClick(DialogInterface dialog, int newItem) { - if (newItem == selectedItem) { - // no change - } else { + if (newItem != selectedItem) { // Adjust index because of <default> selection if (newItem > 0) { Settings.setCustomRenderThemeFile(themeFiles[newItem - 1].getPath()); diff --git a/main/src/cgeo/geocaching/network/HtmlImage.java b/main/src/cgeo/geocaching/network/HtmlImage.java index a409750..45cdbb5 100644 --- a/main/src/cgeo/geocaching/network/HtmlImage.java +++ b/main/src/cgeo/geocaching/network/HtmlImage.java @@ -65,6 +65,7 @@ public class HtmlImage implements Html.ImageGetter { bfOptions = new BitmapFactory.Options(); bfOptions.inTempStorage = new byte[16 * 1024]; + bfOptions.inPreferredConfig = Bitmap.Config.RGB_565; Point displaySize = Compatibility.getDisplaySize(); this.maxWidth = displaySize.x - 25; @@ -193,7 +194,11 @@ public class HtmlImage implements Html.ImageGetter { if (file.exists()) { if (listId >= StoredList.STANDARD_LIST_ID || file.lastModified() > (new Date().getTime() - (24 * 60 * 60 * 1000)) || forceKeep) { setSampleSize(file); - return BitmapFactory.decodeFile(file.getPath(), bfOptions); + final Bitmap image = BitmapFactory.decodeFile(file.getPath(), bfOptions); + if (image == null) { + Log.e("Cannot decode bitmap from " + file.getPath()); + } + return image; } } return null; diff --git a/main/src/cgeo/geocaching/network/Network.java b/main/src/cgeo/geocaching/network/Network.java index eb6a6ac..5a8cbb2 100644 --- a/main/src/cgeo/geocaching/network/Network.java +++ b/main/src/cgeo/geocaching/network/Network.java @@ -40,6 +40,9 @@ import org.apache.commons.lang3.StringUtils; import org.json.JSONException; import org.json.JSONObject; +import android.content.Context; +import android.net.ConnectivityManager; +import android.net.NetworkInfo; import android.net.Uri; import java.io.File; @@ -471,4 +474,19 @@ public abstract class Network { return null; } + /** + * Checks if the device has network connection. + * + * @param context + * context of the application, cannot be null + * + * @return <code>true</code> if the device is connected to the network. + */ + public static boolean isNetworkConnected(Context context) { + ConnectivityManager conMan = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); + NetworkInfo activeNetwork = conMan.getActiveNetworkInfo(); + + return activeNetwork != null && activeNetwork.isConnected(); + } + } diff --git a/main/src/cgeo/geocaching/twitter/Twitter.java b/main/src/cgeo/geocaching/twitter/Twitter.java index f30830e..e3d3f77 100644 --- a/main/src/cgeo/geocaching/twitter/Twitter.java +++ b/main/src/cgeo/geocaching/twitter/Twitter.java @@ -15,7 +15,10 @@ import cgeo.geocaching.utils.Log; import ch.boye.httpclientandroidlib.HttpResponse; +import org.apache.commons.lang3.StringUtils; + public final class Twitter { + private static final String HASH_PREFIX_WITH_BLANK = " #"; public static final int MAX_TWEET_SIZE = 140; public static void postTweet(final cgeoapplication app, final String status, final Geopoint coords) { @@ -47,49 +50,56 @@ public final class Twitter { } } - public static String appendHashTag(final String status, final String tag) { - String result = status; - if (result.length() + 2 + tag.length() <= 140) { - result += " #" + tag; + public static void appendHashTag(final StringBuilder status, final String tag) { + if (status.length() + HASH_PREFIX_WITH_BLANK.length() + tag.length() <= MAX_TWEET_SIZE) { + final String tagWithPrefix = HASH_PREFIX_WITH_BLANK + tag; + if (status.indexOf(tagWithPrefix, 0) == -1) { + status.append(tagWithPrefix); + } } - return result; } public static void postTweetCache(String geocode) { - final Geocache cache = cgData.loadCache(geocode, LoadFlags.LOAD_CACHE_OR_DB); - String status; - final String url = cache.getUrl(); - if (url.length() >= 100) { - status = "I found " + url; + if (!Settings.isUseTwitter()) { + return; } - else { - String name = cache.getName(); - status = "I found " + name + " (" + url + ")"; - if (status.length() > MAX_TWEET_SIZE) { - name = name.substring(0, name.length() - (status.length() - MAX_TWEET_SIZE) - 1) + '…'; - } - status = "I found " + name + " (" + url + ")"; - status = appendHashTag(status, "cgeo"); - status = appendHashTag(status, "geocaching"); + if (!Settings.isTwitterLoginValid()) { + return; } + final Geocache cache = cgData.loadCache(geocode, LoadFlags.LOAD_CACHE_OR_DB); + postTweet(cgeoapplication.getInstance(), getStatusMessage(cache), null); + } + + static String getStatusMessage(Geocache cache) { + String name = cache.getName(); + if (name.length() > 100) { + name = name.substring(0, 100) + '…'; + } + final String url = StringUtils.defaultString(cache.getUrl()); + return fillTemplate(Settings.getCacheTwitterMessage(), name, url); + } - postTweet(cgeoapplication.getInstance(), status, null); + private static String fillTemplate(String template, String name, final String url) { + String result = StringUtils.replace(template, "[NAME]", name); + result = StringUtils.replace(result, "[URL]", url); + StringBuilder builder = new StringBuilder(result); + appendHashTag(builder, "cgeo"); + appendHashTag(builder, "geocaching"); + return builder.toString(); } public static void postTweetTrackable(String geocode) { final Trackable trackable = cgData.loadTrackable(geocode); + postTweet(cgeoapplication.getInstance(), getStatusMessage(trackable), null); + } + + static String getStatusMessage(Trackable trackable) { String name = trackable.getName(); if (name.length() > 82) { name = name.substring(0, 81) + '…'; } - StringBuilder builder = new StringBuilder("I touched "); - builder.append(name); - if (trackable.getUrl() != null) { - builder.append(" (").append(trackable.getUrl()).append(')'); - } - builder.append('!'); - String status = appendHashTag(builder.toString(), "cgeo"); - status = appendHashTag(status, "geocaching"); - postTweet(cgeoapplication.getInstance(), status, null); + String url = StringUtils.defaultString(trackable.getUrl()); + String status = Settings.getTrackableTwitterMessage(); + return fillTemplate(status, name, url); } } diff --git a/main/src/cgeo/geocaching/twitter/TwitterAuthorizationActivity.java b/main/src/cgeo/geocaching/twitter/TwitterAuthorizationActivity.java index 3d9f283..3bc1dec 100644 --- a/main/src/cgeo/geocaching/twitter/TwitterAuthorizationActivity.java +++ b/main/src/cgeo/geocaching/twitter/TwitterAuthorizationActivity.java @@ -89,21 +89,11 @@ public class TwitterAuthorizationActivity extends AbstractActivity { @Override public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - setTheme(); - setContentView(R.layout.twitter_authorization_activity); - setTitle(res.getString(R.string.auth_twitter)); + super.onCreate(savedInstanceState, R.layout.twitter_authorization_activity); init(); } - @Override - public void onResume() { - super.onResume(); - - } - private void init() { startButton = (Button) findViewById(R.id.start); pinEntry = (EditText) findViewById(R.id.pin); diff --git a/main/src/cgeo/geocaching/ui/CacheDetailsCreator.java b/main/src/cgeo/geocaching/ui/CacheDetailsCreator.java index e98bd77..80f01e2 100644 --- a/main/src/cgeo/geocaching/ui/CacheDetailsCreator.java +++ b/main/src/cgeo/geocaching/ui/CacheDetailsCreator.java @@ -2,6 +2,7 @@ package cgeo.geocaching.ui; import cgeo.geocaching.Geocache; import cgeo.geocaching.R; +import cgeo.geocaching.Waypoint; import cgeo.geocaching.cgeoapplication; import cgeo.geocaching.geopoint.Geopoint; import cgeo.geocaching.geopoint.Units; @@ -154,4 +155,24 @@ public final class CacheDetailsCreator { } add(R.string.cache_distance, text); } + + public void addDistance(final Waypoint wpt, final TextView waypointDistanceView) { + Float distance = null; + if (wpt.getCoords() != null) { + final Geopoint currentCoords = cgeoapplication.getInstance().currentGeo().getCoords(); + if (currentCoords != null) { + distance = currentCoords.distanceTo(wpt); + } + } + String text = "--"; + if (distance != null) { + text = Units.getDistanceFromKilometers(distance); + } + else if (waypointDistanceView != null) { + // if there is already a distance in waypointDistance, use it instead of resetting to default. + // this prevents displaying "--" while waiting for a new position update (See bug #1468) + text = waypointDistanceView.getText().toString(); + } + add(R.string.cache_distance, text); + } } diff --git a/main/src/cgeo/geocaching/ui/CacheListAdapter.java b/main/src/cgeo/geocaching/ui/CacheListAdapter.java index 4965e0b..b60586e 100644 --- a/main/src/cgeo/geocaching/ui/CacheListAdapter.java +++ b/main/src/cgeo/geocaching/ui/CacheListAdapter.java @@ -79,13 +79,13 @@ public class CacheListAdapter extends ArrayAdapter<Geocache> { private static final int[] RATING_BACKGROUND = new int[3]; static { if (Settings.isLightSkin()) { - RATING_BACKGROUND[0] = R.drawable.favourite_background_red_light; - RATING_BACKGROUND[1] = R.drawable.favourite_background_orange_light; - RATING_BACKGROUND[2] = R.drawable.favourite_background_green_light; + RATING_BACKGROUND[0] = R.drawable.favorite_background_red_light; + RATING_BACKGROUND[1] = R.drawable.favorite_background_orange_light; + RATING_BACKGROUND[2] = R.drawable.favorite_background_green_light; } else { - RATING_BACKGROUND[0] = R.drawable.favourite_background_red_dark; - RATING_BACKGROUND[1] = R.drawable.favourite_background_orange_dark; - RATING_BACKGROUND[2] = R.drawable.favourite_background_green_dark; + RATING_BACKGROUND[0] = R.drawable.favorite_background_red_dark; + RATING_BACKGROUND[1] = R.drawable.favorite_background_orange_dark; + RATING_BACKGROUND[2] = R.drawable.favorite_background_green_dark; } } @@ -97,7 +97,7 @@ public class CacheListAdapter extends ArrayAdapter<Geocache> { CheckBox checkbox; ImageView logStatusMark; TextView text; - TextView favourite; + TextView favorite; TextView info; ImageView inventory; RelativeLayout directionLayout; @@ -364,7 +364,7 @@ public class CacheListAdapter extends ArrayAdapter<Geocache> { holder.dirImgLayout = (RelativeLayout) v.findViewById(R.id.dirimg_layout); holder.dirImg = (ImageView) v.findViewById(R.id.dirimg); holder.inventory = (ImageView) v.findViewById(R.id.inventory); - holder.favourite = (TextView) v.findViewById(R.id.favourite); + holder.favorite = (TextView) v.findViewById(R.id.favorite); holder.info = (TextView) v.findViewById(R.id.info); v.setTag(holder); @@ -494,14 +494,14 @@ public class CacheListAdapter extends ArrayAdapter<Geocache> { } } - holder.favourite.setText(Integer.toString(cache.getFavoritePoints())); + holder.favorite.setText(Integer.toString(cache.getFavoritePoints())); int favoriteBack; // set default background, neither vote nor rating may be available if (lightSkin) { - favoriteBack = R.drawable.favourite_background_light; + favoriteBack = R.drawable.favorite_background_light; } else { - favoriteBack = R.drawable.favourite_background_dark; + favoriteBack = R.drawable.favorite_background_dark; } final float myVote = cache.getMyVote(); if (myVote > 0) { // use my own rating for display, if I have voted @@ -522,7 +522,7 @@ public class CacheListAdapter extends ArrayAdapter<Geocache> { favoriteBack = RATING_BACKGROUND[0]; } } - holder.favourite.setBackgroundResource(favoriteBack); + holder.favorite.setBackgroundResource(favoriteBack); if (cacheListType == CacheListType.HISTORY && cache.getVisitedDate() > 0) { holder.info.setText(Formatter.formatCacheInfoHistory(cache)); diff --git a/main/src/cgeo/geocaching/ui/CoordinatesFormatSwitcher.java b/main/src/cgeo/geocaching/ui/CoordinatesFormatSwitcher.java new file mode 100644 index 0000000..afadb33 --- /dev/null +++ b/main/src/cgeo/geocaching/ui/CoordinatesFormatSwitcher.java @@ -0,0 +1,38 @@ +package cgeo.geocaching.ui; + +import cgeo.geocaching.geopoint.Geopoint; +import cgeo.geocaching.geopoint.GeopointFormatter; + +import android.view.View; +import android.view.View.OnClickListener; +import android.widget.TextView; + +/** + * view click listener to automatically switch different coordinate formats + * + */ +public class CoordinatesFormatSwitcher implements OnClickListener { + + private static GeopointFormatter.Format[] availableFormats = new GeopointFormatter.Format[] { + GeopointFormatter.Format.LAT_LON_DECMINUTE, + GeopointFormatter.Format.LAT_LON_DECSECOND, + GeopointFormatter.Format.LAT_LON_DECDEGREE + }; + + private int position = 0; + + private final Geopoint coordinates; + + public CoordinatesFormatSwitcher(final Geopoint coordinates) { + this.coordinates = coordinates; + } + + @Override + public void onClick(View view) { + position = (position + 1) % availableFormats.length; + TextView textView = (TextView) view; + // rotate coordinate formats on click + textView.setText(coordinates.format(availableFormats[position])); + } + +}
\ No newline at end of file diff --git a/main/src/cgeo/geocaching/ui/DecryptTextClickListener.java b/main/src/cgeo/geocaching/ui/DecryptTextClickListener.java index 4ba88ae..f10e13a 100644 --- a/main/src/cgeo/geocaching/ui/DecryptTextClickListener.java +++ b/main/src/cgeo/geocaching/ui/DecryptTextClickListener.java @@ -16,6 +16,12 @@ public class DecryptTextClickListener implements View.OnClickListener { try {
final TextView logView = (TextView) view;
+
+ // do not run the click listener if a link was clicked
+ if (logView.getSelectionStart() != -1 || logView.getSelectionEnd() != -1) {
+ return;
+ }
+
CharSequence text = logView.getText();
if (text instanceof Spannable) {
Spannable span = (Spannable) text;
diff --git a/main/src/cgeo/geocaching/ui/EditNoteDialog.java b/main/src/cgeo/geocaching/ui/EditNoteDialog.java new file mode 100644 index 0000000..23e57f2 --- /dev/null +++ b/main/src/cgeo/geocaching/ui/EditNoteDialog.java @@ -0,0 +1,65 @@ +package cgeo.geocaching.ui; + +import cgeo.geocaching.R; +import cgeo.geocaching.R.string; + +import android.os.Bundle; +import android.support.v4.app.DialogFragment; +import android.view.KeyEvent; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.view.WindowManager.LayoutParams; +import android.view.inputmethod.EditorInfo; +import android.widget.EditText; +import android.widget.TextView; +import android.widget.TextView.OnEditorActionListener; + +public class EditNoteDialog extends DialogFragment implements OnEditorActionListener { + + public interface EditNoteDialogListener { + void onFinishEditNoteDialog(final String inputText); + } + + private EditText mEditText; + private String initialNote; + + public EditNoteDialog() { + // Empty constructor required for DialogFragment + } + + public EditNoteDialog(final String initialNote) { + this.initialNote = initialNote; + } + + @Override + public View onCreateView(final LayoutInflater inflater, final ViewGroup container, + final Bundle savedInstanceState) { + View view = inflater.inflate(R.layout.fragment_edit_note, container); + mEditText = (EditText) view.findViewById(R.id.note); + if (initialNote != null) { + mEditText.setText(initialNote); + initialNote = null; + } + getDialog().setTitle(string.cache_personal_note); + mEditText.requestFocus(); + getDialog().getWindow().setSoftInputMode( + LayoutParams.SOFT_INPUT_STATE_VISIBLE); + mEditText.setOnEditorActionListener(this); + + return view; + } + + @Override + public boolean onEditorAction(final TextView v, final int actionId, final KeyEvent event) { + if (EditorInfo.IME_ACTION_DONE == actionId) { + final EditNoteDialogListener activity = (EditNoteDialogListener) getActivity(); + activity.onFinishEditNoteDialog(mEditText.getText().toString()); + dismiss(); + return true; + } + return false; + } + + +} diff --git a/main/src/cgeo/geocaching/ui/ImagesList.java b/main/src/cgeo/geocaching/ui/ImagesList.java index 9464114..b2c819c 100644 --- a/main/src/cgeo/geocaching/ui/ImagesList.java +++ b/main/src/cgeo/geocaching/ui/ImagesList.java @@ -11,7 +11,6 @@ import cgeo.geocaching.utils.Log; import org.apache.commons.lang3.StringUtils; import android.app.Activity; -import android.app.ProgressDialog; import android.content.Intent; import android.content.res.Resources; import android.graphics.Bitmap; @@ -46,16 +45,14 @@ public class ImagesList { private Image currentImage; public enum ImageType { - LogImages(R.string.cache_log_images_title, R.string.cache_log_images_loading), - SpoilerImages(R.string.cache_spoiler_images_title, R.string.cache_spoiler_images_loading), - AllImages(R.string.cache_images_title, R.string.cache_images_loading); + LogImages(R.string.cache_log_images_title), + SpoilerImages(R.string.cache_spoiler_images_title), + AllImages(R.string.cache_images_title); private final int titleResId; - private final int loadingResId; - ImageType(final int title, final int loading) { + ImageType(final int title) { this.titleResId = title; - this.loadingResId = loading; } public int getTitle() { @@ -64,9 +61,6 @@ public class ImagesList { } private LayoutInflater inflater = null; - private ProgressDialog progressDialog = null; - private int count = 0; - private int countDone = 0; private final Activity activity; // We could use a Set here, but we will insert no duplicates, so there is no need to check for uniqueness. private final Collection<Bitmap> bitmaps = new LinkedList<Bitmap>(); @@ -83,18 +77,10 @@ public class ImagesList { inflater = activity.getLayoutInflater(); } - public void loadImages(final View parentView, final List<Image> images, ImageType imageType, final boolean offline) { + public void loadImages(final View parentView, final List<Image> images, final boolean offline) { imagesView = (LinearLayout) parentView.findViewById(R.id.spoiler_list); - count = images.size(); - progressDialog = new ProgressDialog(activity); - progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); - progressDialog.setMessage(activity.getString(imageType.loadingResId)); - progressDialog.setCancelable(true); - progressDialog.setMax(count); - progressDialog.show(); - for (final Image img : images) { LinearLayout rowView = (LinearLayout) inflater.inflate(R.layout.cache_image_item, null); @@ -154,19 +140,12 @@ public class ImagesList { imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); imageView.setLayoutParams(new LayoutParams(bounds.width(), bounds.height())); + view.findViewById(R.id.progress_bar).setVisibility(View.GONE); view.addView(imageView); imageView.setId(image.hashCode()); images.put(imageView.getId(), img); } - - synchronized (activity) { - countDone++; - progressDialog.setProgress(countDone); - if (progressDialog.getProgress() >= count) { - progressDialog.dismiss(); - } - } } } diff --git a/main/src/cgeo/geocaching/ui/dialog/CoordinatesInputDialog.java b/main/src/cgeo/geocaching/ui/dialog/CoordinatesInputDialog.java index dada8fd..63a9b09 100644 --- a/main/src/cgeo/geocaching/ui/dialog/CoordinatesInputDialog.java +++ b/main/src/cgeo/geocaching/ui/dialog/CoordinatesInputDialog.java @@ -74,7 +74,7 @@ public class CoordinatesInputDialog extends Dialog { setContentView(R.layout.coords); - findViewById(R.id.actionBarManualbutton).setOnClickListener(new View.OnClickListener() { + findViewById(R.id.action_bar_manual).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { diff --git a/main/src/cgeo/geocaching/ui/dialog/EditorDialog.java b/main/src/cgeo/geocaching/ui/dialog/EditorDialog.java deleted file mode 100644 index 4db69e5..0000000 --- a/main/src/cgeo/geocaching/ui/dialog/EditorDialog.java +++ /dev/null @@ -1,60 +0,0 @@ -package cgeo.geocaching.ui.dialog; - -import cgeo.geocaching.CacheDetailActivity; -import cgeo.geocaching.R; -import cgeo.geocaching.activity.ActivityMixin; - -import android.app.Dialog; -import android.os.Bundle; -import android.view.View; -import android.view.ViewGroup.LayoutParams; -import android.view.Window; -import android.widget.Button; -import android.widget.EditText; - -public class EditorDialog extends Dialog { - - private CharSequence editorText; - private EditorUpdate editorUpdate; - - public EditorDialog(CacheDetailActivity cacheDetailActivity, CharSequence editable) { - super(cacheDetailActivity, ActivityMixin.getTheme()); - this.editorText = editable; - } - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - requestWindowFeature(Window.FEATURE_NO_TITLE); - setContentView(R.layout.editor); - - final EditText editText = (EditText) findViewById(R.id.editorEditText); - editText.setText(editorText); - - final Button buttonSave = (Button) findViewById(R.id.editorSave); - buttonSave.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - editorUpdate.update(editText.getEditableText()); - EditorDialog.this.hide(); - } - }); - } - - public interface EditorUpdate { - public void update(CharSequence editorText); - } - - public void setOnEditorUpdate(EditorUpdate editorUpdate) { - this.editorUpdate = editorUpdate; - - } - - @Override - public void show() { - super.show(); - getWindow().setLayout(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); - } - -} diff --git a/main/src/cgeo/geocaching/utils/AsyncTaskWithProgress.java b/main/src/cgeo/geocaching/utils/AsyncTaskWithProgress.java new file mode 100644 index 0000000..7526d92 --- /dev/null +++ b/main/src/cgeo/geocaching/utils/AsyncTaskWithProgress.java @@ -0,0 +1,139 @@ +package cgeo.geocaching.utils; + +import cgeo.geocaching.activity.Progress; + +import android.app.Activity; +import android.app.ProgressDialog; +import android.os.AsyncTask; + +/** + * AsyncTask which automatically shows a progress dialog. Use it like the {@code AsyncTask} class, but leave away the + * middle template parameter. Override {@link #doInBackgroundInternal(Object[])} and related methods. + * <p> + * If no style is given, the progress dialog uses "determinate" style with known maximum. The progress maximum is + * automatically derived from the number of {@code Params} given to the task in {@link #execute(Object...)}. + * </p> + * + * @param <Params> + * @param <Result> + */ +public abstract class AsyncTaskWithProgress<Params, Result> extends AsyncTask<Params, Integer, Result> { + + private final Progress progress = new Progress(); + private final Activity activity; + private final String progressTitle; + private final String progressMessage; + private boolean indeterminate = false; + + /** + * Creates an AsyncTask with progress dialog. + * + * @param activity + * @param progressTitle + * @param progressMessage + */ + public AsyncTaskWithProgress(final Activity activity, final String progressTitle, final String progressMessage) { + this(activity, progressTitle, progressMessage, false); + } + + /** + * Creates an AsyncTask with progress dialog. + * + * @param activity + * @param progressTitle + */ + public AsyncTaskWithProgress(final Activity activity, final String progressTitle) { + this(activity, progressTitle, null); + } + + /** + * Creates an AsyncTask with progress dialog. + * + * @param activity + * @param progressTitle + * @param progressMessage + */ + public AsyncTaskWithProgress(final Activity activity, final String progressTitle, final String progressMessage, boolean indeterminate) { + this.activity = activity; + this.progressTitle = progressTitle; + this.progressMessage = progressMessage; + this.indeterminate = indeterminate; + } + + /** + * Creates an AsyncTask with progress dialog. + * + * @param activity + * @param progressTitle + */ + public AsyncTaskWithProgress(final Activity activity, final String progressTitle, boolean indeterminate) { + this(activity, progressTitle, null, indeterminate); + } + + @Override + protected final void onPreExecute() { + if (null != activity) { + if (indeterminate) { + progress.show(activity, progressTitle, progressMessage, true, null); + } + else { + progress.show(activity, progressTitle, progressMessage, ProgressDialog.STYLE_HORIZONTAL, null); + } + } + onPreExecuteInternal(); + } + + /** + * This method should typically be overridden by sub classes instead of {@link #onPreExecute()}. + */ + protected void onPreExecuteInternal() { + // empty by default + } + + @Override + protected final void onPostExecute(Result result) { + onPostExecuteInternal(result); + if (null != activity) { + progress.dismiss(); + } + } + + /** + * This method should typically be overridden by sub classes instead of {@link #onPostExecute(Object)}. + * + * @param result + */ + protected void onPostExecuteInternal(Result result) { + // empty by default + } + + @Override + protected final void onProgressUpdate(Integer... status) { + final int progressValue = status[0]; + if (null != activity && progressValue >= 0) { + progress.setProgress(progressValue); + } + onProgressUpdateInternal(progressValue); + } + + /** + * This method should by overridden by sub classes instead of {@link #onProgressUpdate(Integer...)}. + */ + protected void onProgressUpdateInternal(@SuppressWarnings("unused") int progress) { + // empty by default + } + + protected void setMessage(final String message) { + progress.setMessage(message); + } + + @Override + protected final Result doInBackground(Params... params) { + if (params != null) { + progress.setMaxProgressAndReset(params.length); + } + return doInBackgroundInternal(params); + } + + protected abstract Result doInBackgroundInternal(Params[] params); +} diff --git a/main/src/cgeo/geocaching/utils/ImageHelper.java b/main/src/cgeo/geocaching/utils/ImageHelper.java index 98cad64..ec77018 100644 --- a/main/src/cgeo/geocaching/utils/ImageHelper.java +++ b/main/src/cgeo/geocaching/utils/ImageHelper.java @@ -8,6 +8,9 @@ import android.graphics.Point; import android.graphics.Rect; import android.graphics.drawable.BitmapDrawable; +import java.io.BufferedOutputStream; +import java.io.FileOutputStream; + public class ImageHelper { // Do not let this class be instantiated, this is a utility class. @@ -22,11 +25,21 @@ public class ImageHelper { * @return BitmapDrawable The scaled image */ public static BitmapDrawable scaleBitmapToFitDisplay(final Bitmap image) { - final cgeoapplication app = cgeoapplication.getInstance(); Point displaySize = Compatibility.getDisplaySize(); final int maxWidth = displaySize.x - 25; final int maxHeight = displaySize.y - 25; + return scaleBitmapTo(image, maxWidth, maxHeight); + } + /** + * Scales a bitmap to the given bounds if it is larger, otherwise returns the original bitmap. + * + * @param image + * The bitmap to scale + * @return BitmapDrawable The scaled image + */ + public static BitmapDrawable scaleBitmapTo(final Bitmap image, final int maxWidth, final int maxHeight) { + final cgeoapplication app = cgeoapplication.getInstance(); Bitmap result = image; int width = image.getWidth(); int height = image.getHeight(); @@ -43,4 +56,27 @@ public class ImageHelper { return resultDrawable; } + /** + * Store a bitmap to file. + * + * @param bitmap + * The bitmap to store + * @param format + * The image format + * @param quality + * The image quality + * @param pathOfOutputImage + * Path to store to + */ + public static void storeBitmap(final Bitmap bitmap, final Bitmap.CompressFormat format, final int quality, final String pathOfOutputImage) { + try { + FileOutputStream out = new FileOutputStream(pathOfOutputImage); + BufferedOutputStream bos = new BufferedOutputStream(out); + bitmap.compress(format, quality, bos); + bos.flush(); + bos.close(); + } catch (Exception e) { + Log.e("Image", e); + } + } } diff --git a/main/src/android/support/v4/app/FragmentListActivity.java b/main/thirdparty/android/support/v4/app/FragmentListActivity.java index e3ed42c..e3ed42c 100644 --- a/main/src/android/support/v4/app/FragmentListActivity.java +++ b/main/thirdparty/android/support/v4/app/FragmentListActivity.java diff --git a/main/src/cgeo/org/kxml2/io/KXmlSerializer.java b/main/thirdparty/cgeo/org/kxml2/io/KXmlSerializer.java index 027ff53..027ff53 100644 --- a/main/src/cgeo/org/kxml2/io/KXmlSerializer.java +++ b/main/thirdparty/cgeo/org/kxml2/io/KXmlSerializer.java diff --git a/main/src/com/viewpagerindicator/PageIndicator.java b/main/thirdparty/com/viewpagerindicator/PageIndicator.java index 26414d8..26414d8 100644 --- a/main/src/com/viewpagerindicator/PageIndicator.java +++ b/main/thirdparty/com/viewpagerindicator/PageIndicator.java diff --git a/main/src/com/viewpagerindicator/TitlePageIndicator.java b/main/thirdparty/com/viewpagerindicator/TitlePageIndicator.java index 94ac962..94ac962 100644 --- a/main/src/com/viewpagerindicator/TitlePageIndicator.java +++ b/main/thirdparty/com/viewpagerindicator/TitlePageIndicator.java diff --git a/main/src/com/viewpagerindicator/TitleProvider.java b/main/thirdparty/com/viewpagerindicator/TitleProvider.java index 2a04b65..2a04b65 100644 --- a/main/src/com/viewpagerindicator/TitleProvider.java +++ b/main/thirdparty/com/viewpagerindicator/TitleProvider.java diff --git a/main/src/gnu/android/app/appmanualclient/AppManualReaderClient.java b/main/thirdparty/gnu/android/app/appmanualclient/AppManualReaderClient.java index af4c03e..af4c03e 100644 --- a/main/src/gnu/android/app/appmanualclient/AppManualReaderClient.java +++ b/main/thirdparty/gnu/android/app/appmanualclient/AppManualReaderClient.java diff --git a/main/src/org/openintents/intents/FileManagerIntents.java b/main/thirdparty/org/openintents/intents/FileManagerIntents.java index 8ff10c8..8ff10c8 100644 --- a/main/src/org/openintents/intents/FileManagerIntents.java +++ b/main/thirdparty/org/openintents/intents/FileManagerIntents.java |
