forked from upstream-mirrors/OpenTracks
Fix an issue when run SyncTest.
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
|
||||
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="gen"/>
|
||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
|
||||
<classpathentry kind="output" path="bin/classes"/>
|
||||
</classpath>
|
||||
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>MyTracksLib</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@@ -0,0 +1,401 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
|
||||
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=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
|
||||
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
|
||||
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
|
||||
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
|
||||
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
|
||||
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
|
||||
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
|
||||
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
|
||||
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
|
||||
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore
|
||||
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=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
|
||||
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
|
||||
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.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=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
|
||||
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=disabled
|
||||
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=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameter=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=disabled
|
||||
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_annotations_on_field=1585
|
||||
org.eclipse.jdt.core.formatter.alignment_for_annotations_on_field.count_dependent=1585|-1|1585
|
||||
org.eclipse.jdt.core.formatter.alignment_for_annotations_on_local_variable=1585
|
||||
org.eclipse.jdt.core.formatter.alignment_for_annotations_on_local_variable.count_dependent=1585|-1|1585
|
||||
org.eclipse.jdt.core.formatter.alignment_for_annotations_on_method=1585
|
||||
org.eclipse.jdt.core.formatter.alignment_for_annotations_on_method.count_dependent=1585|-1|1585
|
||||
org.eclipse.jdt.core.formatter.alignment_for_annotations_on_package=1585
|
||||
org.eclipse.jdt.core.formatter.alignment_for_annotations_on_package.count_dependent=1585|-1|1585
|
||||
org.eclipse.jdt.core.formatter.alignment_for_annotations_on_parameter=1040
|
||||
org.eclipse.jdt.core.formatter.alignment_for_annotations_on_parameter.count_dependent=1040|-1|1040
|
||||
org.eclipse.jdt.core.formatter.alignment_for_annotations_on_type=1585
|
||||
org.eclipse.jdt.core.formatter.alignment_for_annotations_on_type.count_dependent=1585|-1|1585
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression.count_dependent=16|-1|16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation.count_dependent=16|-1|16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=48
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant.count_dependent=16|-1|16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call.count_dependent=16|-1|16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation.count_dependent=16|-1|16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression.count_dependent=16|-1|16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
|
||||
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_binary_expression.count_dependent=16|-1|16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_cascading_method_invocation_with_arguments=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_cascading_method_invocation_with_arguments.count_dependent=16|-1|16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
|
||||
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=48
|
||||
org.eclipse.jdt.core.formatter.alignment_for_enum_constants.count_dependent=0|-1|0
|
||||
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer.count_dependent=16|-1|16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_field_declaration=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_for_statement=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_generic_type_arguments=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_generic_type_arguments.count_dependent=16|-1|16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_local_variable_declaration=16
|
||||
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_multiple_fields.count_dependent=16|-1|16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_new_anonymous_class=0
|
||||
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration.count_dependent=16|-1|16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration.count_dependent=16|-1|16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
|
||||
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation.count_dependent=16|-1|16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=48
|
||||
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration.count_dependent=16|-1|16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration.count_dependent=16|-1|16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration.count_dependent=16|-1|16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration.count_dependent=16|-1|16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
|
||||
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=true
|
||||
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=true
|
||||
org.eclipse.jdt.core.formatter.comment.format_block_comments=true
|
||||
org.eclipse.jdt.core.formatter.comment.format_header=false
|
||||
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=true
|
||||
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=do not insert
|
||||
org.eclipse.jdt.core.formatter.comment.line_length=80
|
||||
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.comment_new_line_at_start_of_html_paragraph=true
|
||||
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.force_if_else_statement_brace=false
|
||||
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=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not 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_comment_prefix=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_try=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_semicolon_in_try_resources=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_try=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_try=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_semicolon_in_try_resources=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=true
|
||||
org.eclipse.jdt.core.formatter.join_wrapped_lines=true
|
||||
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=100
|
||||
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.sort_local_variable_annotations=false
|
||||
org.eclipse.jdt.core.formatter.sort_member_annotations=false
|
||||
org.eclipse.jdt.core.formatter.sort_package_annotations=false
|
||||
org.eclipse.jdt.core.formatter.sort_parameter_annotations=false
|
||||
org.eclipse.jdt.core.formatter.sort_type_annotations=false
|
||||
org.eclipse.jdt.core.formatter.tabulation.char=space
|
||||
org.eclipse.jdt.core.formatter.tabulation.size=2
|
||||
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_before_or_operator_multicatch=true
|
||||
org.eclipse.jdt.core.formatter.wrap_comment_inline_tags=false
|
||||
org.eclipse.jdt.core.formatter.wrap_non_simple_local_variable_annotation=true
|
||||
org.eclipse.jdt.core.formatter.wrap_non_simple_member_annotation=true
|
||||
org.eclipse.jdt.core.formatter.wrap_non_simple_package_annotation=true
|
||||
org.eclipse.jdt.core.formatter.wrap_non_simple_parameter_annotation=false
|
||||
org.eclipse.jdt.core.formatter.wrap_non_simple_type_annotation=true
|
||||
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
|
||||
org.eclipse.jdt.core.formatter.wrap_prefer_two_fragments=false
|
||||
@@ -0,0 +1,61 @@
|
||||
#Tue Jul 17 10:22:31 PDT 2012
|
||||
eclipse.preferences.version=1
|
||||
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
|
||||
formatter_profile=_My Tracks
|
||||
formatter_settings_version=13
|
||||
org.eclipse.jdt.ui.ignorelowercasenames=true
|
||||
org.eclipse.jdt.ui.importorder=com;android;java;javax;org;
|
||||
org.eclipse.jdt.ui.ondemandthreshold=99
|
||||
org.eclipse.jdt.ui.staticondemandthreshold=99
|
||||
sp_cleanup.add_default_serial_version_id=true
|
||||
sp_cleanup.add_generated_serial_version_id=false
|
||||
sp_cleanup.add_missing_annotations=true
|
||||
sp_cleanup.add_missing_deprecated_annotations=true
|
||||
sp_cleanup.add_missing_methods=false
|
||||
sp_cleanup.add_missing_nls_tags=false
|
||||
sp_cleanup.add_missing_override_annotations=true
|
||||
sp_cleanup.add_missing_override_annotations_interface_methods=true
|
||||
sp_cleanup.add_serial_version_id=false
|
||||
sp_cleanup.always_use_blocks=true
|
||||
sp_cleanup.always_use_parentheses_in_expressions=false
|
||||
sp_cleanup.always_use_this_for_non_static_field_access=false
|
||||
sp_cleanup.always_use_this_for_non_static_method_access=false
|
||||
sp_cleanup.convert_to_enhanced_for_loop=false
|
||||
sp_cleanup.correct_indentation=false
|
||||
sp_cleanup.format_source_code=false
|
||||
sp_cleanup.format_source_code_changes_only=false
|
||||
sp_cleanup.make_local_variable_final=false
|
||||
sp_cleanup.make_parameters_final=false
|
||||
sp_cleanup.make_private_fields_final=true
|
||||
sp_cleanup.make_type_abstract_if_missing_method=false
|
||||
sp_cleanup.make_variable_declarations_final=true
|
||||
sp_cleanup.never_use_blocks=false
|
||||
sp_cleanup.never_use_parentheses_in_expressions=true
|
||||
sp_cleanup.on_save_use_additional_actions=false
|
||||
sp_cleanup.organize_imports=true
|
||||
sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
|
||||
sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
|
||||
sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
|
||||
sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
|
||||
sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
|
||||
sp_cleanup.remove_private_constructors=true
|
||||
sp_cleanup.remove_trailing_whitespaces=false
|
||||
sp_cleanup.remove_trailing_whitespaces_all=true
|
||||
sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
|
||||
sp_cleanup.remove_unnecessary_casts=true
|
||||
sp_cleanup.remove_unnecessary_nls_tags=false
|
||||
sp_cleanup.remove_unused_imports=false
|
||||
sp_cleanup.remove_unused_local_variables=false
|
||||
sp_cleanup.remove_unused_private_fields=true
|
||||
sp_cleanup.remove_unused_private_members=false
|
||||
sp_cleanup.remove_unused_private_methods=true
|
||||
sp_cleanup.remove_unused_private_types=true
|
||||
sp_cleanup.sort_members=false
|
||||
sp_cleanup.sort_members_all=false
|
||||
sp_cleanup.use_blocks=false
|
||||
sp_cleanup.use_blocks_only_for_return_and_throw=false
|
||||
sp_cleanup.use_parentheses_in_expressions=false
|
||||
sp_cleanup.use_this_for_non_static_field_access=false
|
||||
sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
|
||||
sp_cleanup.use_this_for_non_static_method_access=false
|
||||
sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
|
||||
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2010 Google Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.google.android.apps.mytracks.lib"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0" >
|
||||
|
||||
<!--
|
||||
THIS IS A LIBRARY PROJECT.
|
||||
See http://developer.android.com/guide/developing/eclipse-adt.html#libraryProject
|
||||
for details on what should go here vs in the application project.
|
||||
-->
|
||||
<uses-sdk
|
||||
android:minSdkVersion="8"
|
||||
android:targetSdkVersion="17" />
|
||||
|
||||
<application
|
||||
android:icon="@drawable/ic_launcher_my_tracks"
|
||||
android:label="@string/lib_name" >
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
Binary file not shown.
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<lint>
|
||||
<issue id="UnusedIds" severity="ignore" />
|
||||
<issue id="UnusedResources" severity="ignore" />
|
||||
</lint>
|
||||
@@ -0,0 +1,12 @@
|
||||
# This file is automatically generated by Android Tools.
|
||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||
#
|
||||
# This file must be checked in Version Control Systems.
|
||||
#
|
||||
# To customize properties used by the Ant build system use,
|
||||
# "ant.properties", and override values to adapt the script to your
|
||||
# project structure.
|
||||
|
||||
android.library=true
|
||||
# Project target.
|
||||
target=android-17
|
||||
@@ -0,0 +1,54 @@
|
||||
// Copyright 2010 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
// use this file except in compliance with the License. You may obtain a copy of
|
||||
// the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
// License for the specific language governing permissions and limitations under
|
||||
// the License.
|
||||
|
||||
package com.google.android.apps.mytracks.content;
|
||||
|
||||
option optimize_for = LITE_RUNTIME;
|
||||
|
||||
// An enumeration of the state of a single sensor.
|
||||
enum SensorState {
|
||||
// There is no sensor.
|
||||
NONE = 1;
|
||||
|
||||
// Now initiating an outgoing connection.
|
||||
CONNECTING = 2;
|
||||
|
||||
// Now connected to a remote device.
|
||||
CONNECTED = 3;
|
||||
|
||||
// A state where the sensor is not connected.
|
||||
DISCONNECTED = 4;
|
||||
|
||||
// This is the only state where the sensor data can be used.
|
||||
SENDING = 5;
|
||||
};
|
||||
|
||||
// The state and possible reading for one integer sensor.
|
||||
message SensorData {
|
||||
required SensorState state = 1 [default = NONE];
|
||||
|
||||
// Value is only defined if state = SENDING.
|
||||
optional int32 value = 2;
|
||||
};
|
||||
|
||||
// A message to encapsulate sensor readings associated with a track point.
|
||||
message SensorDataSet {
|
||||
// This is a required field.
|
||||
optional uint64 creation_time = 1 [default = 0];
|
||||
|
||||
optional SensorData heart_rate = 2;
|
||||
optional SensorData cadence = 3;
|
||||
optional SensorData power = 4;
|
||||
optional SensorData battery_level = 5;
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 42 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 40 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 42 KiB |
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2010 Google Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<resources>
|
||||
<!-- Do not translate -->
|
||||
<string name="lib_name">My Tracks Base Library</string>
|
||||
</resources>
|
||||
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2010 Google Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<resources>
|
||||
<!-- Do not translate -->
|
||||
<!-- Permissions, need to be in sync with the permissions in AndroidManifest.xml -->
|
||||
<string name="broadcast_notifications_permission">com.google.android.apps.mytracks.TRACK_NOTIFICATIONS</string>
|
||||
<string name="read_track_data_permission">com.google.android.apps.mytracks.READ_TRACK_DATA</string>
|
||||
<string name="write_track_data_permission">com.google.android.apps.mytracks.WRITE_TRACK_DATA</string>
|
||||
<!-- Broadcast -->
|
||||
<string name="track_id_broadcast_extra">com.google.android.apps.mytracks.TRACK_ID</string>
|
||||
<string name="track_paused_broadcast_action">com.google.android.apps.mytracks.TRACK_PAUSED</string>
|
||||
<string name="track_resumed_broadcast_action">com.google.android.apps.mytracks.TRACK_RESUMED</string>
|
||||
<string name="track_started_broadcast_action">com.google.android.apps.mytracks.TRACK_STARTED</string>
|
||||
<string name="track_stopped_broadcast_action">com.google.android.apps.mytracks.TRACK_STOPPED</string>
|
||||
<string name="track_update_broadcast_action">com.google.android.apps.mytracks.TRACK_UPDATE</string>
|
||||
<!-- My Tracks service -->
|
||||
<string name="mytracks_service_class">com.google.android.apps.mytracks.services.TrackRecordingService</string>
|
||||
<string name="mytracks_service_package">com.google.android.maps.mytracks</string>
|
||||
</resources>
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright 2010 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
|
||||
package com.google.android.apps.mytracks.content;
|
||||
|
||||
/**
|
||||
* Utilities for serializing primitive types.
|
||||
*
|
||||
* @author Rodrigo Damazio
|
||||
*/
|
||||
public class ContentTypeIds {
|
||||
|
||||
private ContentTypeIds() {}
|
||||
|
||||
public static final byte BOOLEAN_TYPE_ID = 0;
|
||||
public static final byte LONG_TYPE_ID = 1;
|
||||
public static final byte INT_TYPE_ID = 2;
|
||||
public static final byte FLOAT_TYPE_ID = 3;
|
||||
public static final byte DOUBLE_TYPE_ID = 4;
|
||||
public static final byte STRING_TYPE_ID = 5;
|
||||
public static final byte BLOB_TYPE_ID = 6;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright 2010 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
package com.google.android.apps.mytracks.content;
|
||||
|
||||
import com.google.android.apps.mytracks.stats.TripStatistics;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
* An interface for an object that can generate descriptions of track and
|
||||
* waypoint.
|
||||
*
|
||||
* @author Sandor Dornbush
|
||||
*/
|
||||
public interface DescriptionGenerator {
|
||||
|
||||
/**
|
||||
* Generates a track description.
|
||||
*
|
||||
* @param track the track
|
||||
* @param distances a vector of distances to generate the elevation chart
|
||||
* @param elevations a vector of elevations to generate the elevation chart
|
||||
* @param html true to output html, false to output plain text
|
||||
*/
|
||||
public String generateTrackDescription(
|
||||
Track track, Vector<Double> distances, Vector<Double> elevations, boolean html);
|
||||
|
||||
/**
|
||||
* Generate a waypoint description from a trip statistics.
|
||||
*
|
||||
* @param tripStatistics the trip statistics
|
||||
*/
|
||||
public String generateWaypointDescription(TripStatistics tripStatistics);
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright 2010 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
package com.google.android.apps.mytracks.content;
|
||||
|
||||
import com.google.android.apps.mytracks.content.Sensor.SensorDataSet;
|
||||
|
||||
import android.location.Location;
|
||||
|
||||
/**
|
||||
* This class extends the standard Android location with extra information.
|
||||
*
|
||||
* @author Sandor Dornbush
|
||||
*/
|
||||
public class MyTracksLocation extends Location {
|
||||
|
||||
private SensorDataSet sensorDataSet = null;
|
||||
|
||||
/**
|
||||
* The id of this location from the provider.
|
||||
*/
|
||||
private int id = -1;
|
||||
|
||||
public MyTracksLocation(Location location, Sensor.SensorDataSet sd) {
|
||||
super(location);
|
||||
this.sensorDataSet = sd;
|
||||
}
|
||||
|
||||
public MyTracksLocation(String provider) {
|
||||
super(provider);
|
||||
}
|
||||
|
||||
public SensorDataSet getSensorDataSet() {
|
||||
return sensorDataSet;
|
||||
}
|
||||
|
||||
public void setSensorDataSet(SensorDataSet sensorDataSet) {
|
||||
this.sensorDataSet = sensorDataSet;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
super.reset();
|
||||
sensorDataSet = null;
|
||||
id = -1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,395 @@
|
||||
/*
|
||||
* Copyright 2010 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
|
||||
package com.google.android.apps.mytracks.content;
|
||||
|
||||
import com.google.android.apps.mytracks.content.Waypoint.WaypointType;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.location.Location;
|
||||
import android.location.LocationManager;
|
||||
import android.net.Uri;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Utilities to access data from the My Tracks content provider.
|
||||
*
|
||||
* @author Rodrigo Damazio
|
||||
*/
|
||||
public interface MyTracksProviderUtils {
|
||||
|
||||
/**
|
||||
* The authority (the first part of the URI) for the My Tracks content
|
||||
* provider.
|
||||
*/
|
||||
public static final String AUTHORITY = "com.google.android.maps.mytracks";
|
||||
|
||||
/**
|
||||
* Clears a track. Removes waypoints and trackpoints. Only keeps the track id.
|
||||
*
|
||||
* @param trackId the track id
|
||||
*/
|
||||
public void clearTrack(long trackId);
|
||||
|
||||
/**
|
||||
* Creates a {@link Track} from a cursor.
|
||||
*
|
||||
* @param cursor the cursor pointing to the track
|
||||
*/
|
||||
public Track createTrack(Cursor cursor);
|
||||
|
||||
/**
|
||||
* Deletes all tracks (including waypoints and track points).
|
||||
*/
|
||||
public void deleteAllTracks();
|
||||
|
||||
/**
|
||||
* Deletes a track.
|
||||
*
|
||||
* @param trackId the track id
|
||||
*/
|
||||
public void deleteTrack(long trackId);
|
||||
|
||||
/**
|
||||
* Gets all the tracks. If no track exists, an empty list is returned.
|
||||
* <p>
|
||||
* Note that the returned tracks do not have any track points attached.
|
||||
*/
|
||||
public List<Track> getAllTracks();
|
||||
|
||||
/**
|
||||
* Gets the last track. Returns null if doesn't exist.
|
||||
*/
|
||||
public Track getLastTrack();
|
||||
|
||||
/**
|
||||
* Gets a track by a track id. Returns null if not found.
|
||||
* <p>
|
||||
* Note that the returned track doesn't have any track points attached.
|
||||
*
|
||||
* @param trackId the track id.
|
||||
*/
|
||||
public Track getTrack(long trackId);
|
||||
|
||||
/**
|
||||
* Gets a track cursor. The caller owns the returned cursor and is responsible
|
||||
* for closing it.
|
||||
*
|
||||
* @param selection the selection. Can be null
|
||||
* @param selectionArgs the selection arguments. Can be null
|
||||
* @param sortOrder the sort order. Can be null
|
||||
*/
|
||||
public Cursor getTrackCursor(String selection, String[] selectionArgs, String sortOrder);
|
||||
|
||||
/**
|
||||
* Inserts a track.
|
||||
* <p>
|
||||
* Note: This doesn't insert any track points.
|
||||
*
|
||||
* @param track the track
|
||||
* @return the content provider URI of the inserted track.
|
||||
*/
|
||||
public Uri insertTrack(Track track);
|
||||
|
||||
/**
|
||||
* Updates a track.
|
||||
* <p>
|
||||
* Note: This doesn't update any track points.
|
||||
*
|
||||
* @param track the track
|
||||
*/
|
||||
public void updateTrack(Track track);
|
||||
|
||||
/**
|
||||
* Creates a waypoint from a cursor.
|
||||
*
|
||||
* @param cursor the cursor pointing to the waypoint
|
||||
*/
|
||||
public Waypoint createWaypoint(Cursor cursor);
|
||||
|
||||
/**
|
||||
* Deletes a waypoint. If deleting a statistics waypoint, this will also
|
||||
* correct the next statistics waypoint after the deleted one to reflect the
|
||||
* deletion. The generator is used to update the next statistics waypoint.
|
||||
*
|
||||
* @param waypointId the waypoint id
|
||||
* @param descriptionGenerator the description generator. Can be null for
|
||||
* waypoint marker
|
||||
*/
|
||||
public void deleteWaypoint(long waypointId, DescriptionGenerator descriptionGenerator);
|
||||
|
||||
/**
|
||||
* Gets the first waypoint id for a track. The first waypoint is special as it
|
||||
* contains the stats for the track. Returns -1L if it doesn't exist.
|
||||
*
|
||||
* @param trackId the track id
|
||||
*/
|
||||
public long getFirstWaypointId(long trackId);
|
||||
|
||||
/**
|
||||
* Gets the last waypoint for a type. Returns null if it doesn't exist.
|
||||
*
|
||||
* @param trackId the track id
|
||||
* @param waypointType the waypoint type
|
||||
*/
|
||||
public Waypoint getLastWaypoint(long trackId, WaypointType waypointType);
|
||||
|
||||
/**
|
||||
* Gets the next waypoint number for a type. Returns -1 if not able to get the
|
||||
* next waypoint number.
|
||||
*
|
||||
* @param trackId the track id
|
||||
* @param waypointType the waypoint type
|
||||
*/
|
||||
public int getNextWaypointNumber(long trackId, WaypointType waypointType);
|
||||
|
||||
/**
|
||||
* Gets a waypoint from a waypoint id. Returns null if not found.
|
||||
*
|
||||
* @param waypointId the waypoint id
|
||||
*/
|
||||
public Waypoint getWaypoint(long waypointId);
|
||||
|
||||
/**
|
||||
* Gets a waypoint cursor. The caller owns the returned cursor and is
|
||||
* responsible for closing it.
|
||||
*
|
||||
* @param selection the selection. Can be null
|
||||
* @param selectionArgs the selection arguments. Can be null
|
||||
* @param sortOrder the sort order. Can be null
|
||||
* @param maxWaypoints the maximum number of waypoints to return. -1 for no
|
||||
* limit
|
||||
*/
|
||||
public Cursor getWaypointCursor(
|
||||
String selection, String[] selectionArgs, String sortOrder, int maxWaypoints);
|
||||
|
||||
/**
|
||||
* Gets a waypoint cursor for a track. The caller owns the returned cursor and
|
||||
* is responsible for closing it.
|
||||
*
|
||||
* @param trackId the track id
|
||||
* @param minWaypointId the minimum waypoint id. -1L to ignore
|
||||
* @param maxWaypoints the maximum number of waypoints to return. -1 for no
|
||||
* limit
|
||||
*/
|
||||
public Cursor getWaypointCursor(long trackId, long minWaypointId, int maxWaypoints);
|
||||
|
||||
/**
|
||||
* Inserts a waypoint.
|
||||
*
|
||||
* @param waypoint the waypoint
|
||||
* @return the content provider URI of the inserted waypoint.
|
||||
*/
|
||||
public Uri insertWaypoint(Waypoint waypoint);
|
||||
|
||||
/**
|
||||
* Updates a waypoint. Returns true if successful.
|
||||
*
|
||||
* @param waypoint the waypoint
|
||||
*/
|
||||
public boolean updateWaypoint(Waypoint waypoint);
|
||||
|
||||
/**
|
||||
* Inserts multiple track points.
|
||||
*
|
||||
* @param locations an array of locations
|
||||
* @param length the number of locations (from the beginning of the array) to
|
||||
* insert, or -1 for all of them
|
||||
* @param trackId the track id
|
||||
* @return the number of points inserted
|
||||
*/
|
||||
public int bulkInsertTrackPoint(Location[] locations, int length, long trackId);
|
||||
|
||||
/**
|
||||
* Creates a location object from a cursor.
|
||||
*
|
||||
* @param cursor the cursor pointing to the location
|
||||
*/
|
||||
public Location createTrackPoint(Cursor cursor);
|
||||
|
||||
/**
|
||||
* Gets the first location id for a track. Returns -1L if it doesn't exist.
|
||||
*
|
||||
* @param trackId the track id
|
||||
*/
|
||||
public long getFirstTrackPointId(long trackId);
|
||||
|
||||
/**
|
||||
* Gets the last location id for a track. Returns -1L if it doesn't exist.
|
||||
*
|
||||
* @param trackId the track id
|
||||
*/
|
||||
public long getLastTrackPointId(long trackId);
|
||||
|
||||
/**
|
||||
* Gets the track point id of a location.
|
||||
*
|
||||
* @param trackId the track id
|
||||
* @param location the location
|
||||
* @return track point id if the location is in the track. -1L otherwise.
|
||||
*/
|
||||
public long getTrackPointId(long trackId, Location location);
|
||||
|
||||
/**
|
||||
* Gets the first valid location for a track. Returns null if it doesn't
|
||||
* exist.
|
||||
*
|
||||
* @param trackId the track id
|
||||
*/
|
||||
public Location getFirstValidTrackPoint(long trackId);
|
||||
|
||||
/**
|
||||
* Gets the last valid location for a track. Returns null if it doesn't exist.
|
||||
*
|
||||
* @param trackId the track id
|
||||
*/
|
||||
public Location getLastValidTrackPoint(long trackId);
|
||||
|
||||
|
||||
/**
|
||||
* Gets the last valid location.
|
||||
*/
|
||||
public Location getLastValidTrackPoint();
|
||||
|
||||
/**
|
||||
* Creates a location cursor. The caller owns the returned cursor and is
|
||||
* responsible for closing it.
|
||||
*
|
||||
* @param trackId the track id
|
||||
* @param startTrackPointId the starting track point id. -1L to ignore
|
||||
* @param maxLocations maximum number of locations to return. -1 for no limit
|
||||
* @param descending true to sort the result in descending order (latest
|
||||
* location first)
|
||||
*/
|
||||
public Cursor getTrackPointCursor(
|
||||
long trackId, long startTrackPointId, int maxLocations, boolean descending);
|
||||
|
||||
/**
|
||||
* Creates a new read-only iterator over a given track's points. It provides a
|
||||
* lightweight way of iterating over long tracks without failing due to the
|
||||
* underlying cursor limitations. Since it's a read-only iterator,
|
||||
* {@link Iterator#remove()} always throws
|
||||
* {@link UnsupportedOperationException}. Each call to
|
||||
* {@link LocationIterator#next()} may advance to the next DB record, and if
|
||||
* so, the iterator calls {@link LocationFactory#createLocation()} and
|
||||
* populates it with information retrieved from the record. When done with
|
||||
* iteration, {@link LocationIterator#close()} must be called.
|
||||
*
|
||||
* @param trackId the track id
|
||||
* @param startTrackPointId the starting track point id. -1L to ignore
|
||||
* @param descending true to sort the result in descending order (latest
|
||||
* location first)
|
||||
* @param locationFactory the location factory
|
||||
*/
|
||||
public LocationIterator getTrackPointLocationIterator(
|
||||
long trackId, long startTrackPointId, boolean descending, LocationFactory locationFactory);
|
||||
|
||||
/**
|
||||
* Inserts a track point.
|
||||
*
|
||||
* @param location the location
|
||||
* @param trackId the track id
|
||||
* @return the content provider URI of the inserted track point
|
||||
*/
|
||||
public Uri insertTrackPoint(Location location, long trackId);
|
||||
|
||||
/**
|
||||
* A lightweight wrapper around the original {@link Cursor} with a method to
|
||||
* clean up.
|
||||
*/
|
||||
public interface LocationIterator extends Iterator<Location> {
|
||||
|
||||
/**
|
||||
* Gets the most recently retrieved track point id by {@link #next()}.
|
||||
*/
|
||||
public long getLocationId();
|
||||
|
||||
/**
|
||||
* Closes the iterator.
|
||||
*/
|
||||
public void close();
|
||||
}
|
||||
|
||||
/**
|
||||
* A factory for creating new {@link Location}.
|
||||
*/
|
||||
public interface LocationFactory {
|
||||
|
||||
/**
|
||||
* Creates a new {@link Location}. An implementation can create new
|
||||
* instances or reuse existing instances for optimization.
|
||||
*/
|
||||
public Location createLocation();
|
||||
}
|
||||
|
||||
/**
|
||||
* The default {@link LocationFactory} which creates a location each time.
|
||||
*/
|
||||
public LocationFactory DEFAULT_LOCATION_FACTORY = new LocationFactory() {
|
||||
@Override
|
||||
public Location createLocation() {
|
||||
return new MyTracksLocation(LocationManager.GPS_PROVIDER);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* A factory which can produce instances of {@link MyTracksProviderUtils}, and
|
||||
* can be overridden for testing.
|
||||
*/
|
||||
public static class Factory {
|
||||
|
||||
private static Factory instance = new Factory();
|
||||
|
||||
/**
|
||||
* Creates an instance of {@link MyTracksProviderUtils}.
|
||||
*
|
||||
* @param context the context
|
||||
*/
|
||||
public static MyTracksProviderUtils get(Context context) {
|
||||
return instance.newForContext(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the factory instance.
|
||||
*/
|
||||
public static Factory getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides the factory instance for testing. Don't forget to set it back
|
||||
* to the original value after testing.
|
||||
*
|
||||
* @param factory the factory
|
||||
*/
|
||||
public static void overrideInstance(Factory factory) {
|
||||
instance = factory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an instance of {@link MyTracksProviderUtils}. Allows subclasses
|
||||
* to override for testing.
|
||||
*
|
||||
* @param context the context
|
||||
*/
|
||||
protected MyTracksProviderUtils newForContext(Context context) {
|
||||
return new MyTracksProviderUtilsImpl(context.getContentResolver());
|
||||
}
|
||||
}
|
||||
}
|
||||
+1163
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,883 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: proto/sensor.proto
|
||||
|
||||
package com.google.android.apps.mytracks.content;
|
||||
|
||||
public final class Sensor {
|
||||
private Sensor() {}
|
||||
public static void registerAllExtensions(
|
||||
com.google.protobuf.ExtensionRegistryLite registry) {
|
||||
}
|
||||
public enum SensorState
|
||||
implements com.google.protobuf.Internal.EnumLite {
|
||||
NONE(0, 1),
|
||||
CONNECTING(1, 2),
|
||||
CONNECTED(2, 3),
|
||||
DISCONNECTED(3, 4),
|
||||
SENDING(4, 5),
|
||||
;
|
||||
|
||||
|
||||
public final int getNumber() { return value; }
|
||||
|
||||
public static SensorState valueOf(int value) {
|
||||
switch (value) {
|
||||
case 1: return NONE;
|
||||
case 2: return CONNECTING;
|
||||
case 3: return CONNECTED;
|
||||
case 4: return DISCONNECTED;
|
||||
case 5: return SENDING;
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static com.google.protobuf.Internal.EnumLiteMap<SensorState>
|
||||
internalGetValueMap() {
|
||||
return internalValueMap;
|
||||
}
|
||||
private static com.google.protobuf.Internal.EnumLiteMap<SensorState>
|
||||
internalValueMap =
|
||||
new com.google.protobuf.Internal.EnumLiteMap<SensorState>() {
|
||||
public SensorState findValueByNumber(int number) {
|
||||
return SensorState.valueOf(number)
|
||||
; }
|
||||
};
|
||||
|
||||
private final int index;
|
||||
private final int value;
|
||||
private SensorState(int index, int value) {
|
||||
this.index = index;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(enum_scope:com.google.android.apps.mytracks.content.SensorState)
|
||||
}
|
||||
|
||||
public static final class SensorData extends
|
||||
com.google.protobuf.GeneratedMessageLite {
|
||||
// Use SensorData.newBuilder() to construct.
|
||||
private SensorData() {
|
||||
initFields();
|
||||
}
|
||||
private SensorData(boolean noInit) {}
|
||||
|
||||
private static final SensorData defaultInstance;
|
||||
public static SensorData getDefaultInstance() {
|
||||
return defaultInstance;
|
||||
}
|
||||
|
||||
public SensorData getDefaultInstanceForType() {
|
||||
return defaultInstance;
|
||||
}
|
||||
|
||||
// required .com.google.android.apps.mytracks.content.SensorState state = 1 [default = NONE];
|
||||
public static final int STATE_FIELD_NUMBER = 1;
|
||||
private boolean hasState;
|
||||
private com.google.android.apps.mytracks.content.Sensor.SensorState state_;
|
||||
public boolean hasState() { return hasState; }
|
||||
public com.google.android.apps.mytracks.content.Sensor.SensorState getState() { return state_; }
|
||||
|
||||
// optional int32 value = 2;
|
||||
public static final int VALUE_FIELD_NUMBER = 2;
|
||||
private boolean hasValue;
|
||||
private int value_ = 0;
|
||||
public boolean hasValue() { return hasValue; }
|
||||
public int getValue() { return value_; }
|
||||
|
||||
private void initFields() {
|
||||
state_ = com.google.android.apps.mytracks.content.Sensor.SensorState.NONE;
|
||||
}
|
||||
public final boolean isInitialized() {
|
||||
if (!hasState) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void writeTo(com.google.protobuf.CodedOutputStream output)
|
||||
throws java.io.IOException {
|
||||
getSerializedSize();
|
||||
if (hasState()) {
|
||||
output.writeEnum(1, getState().getNumber());
|
||||
}
|
||||
if (hasValue()) {
|
||||
output.writeInt32(2, getValue());
|
||||
}
|
||||
}
|
||||
|
||||
private int memoizedSerializedSize = -1;
|
||||
public int getSerializedSize() {
|
||||
int size = memoizedSerializedSize;
|
||||
if (size != -1) return size;
|
||||
|
||||
size = 0;
|
||||
if (hasState()) {
|
||||
size += com.google.protobuf.CodedOutputStream
|
||||
.computeEnumSize(1, getState().getNumber());
|
||||
}
|
||||
if (hasValue()) {
|
||||
size += com.google.protobuf.CodedOutputStream
|
||||
.computeInt32Size(2, getValue());
|
||||
}
|
||||
memoizedSerializedSize = size;
|
||||
return size;
|
||||
}
|
||||
|
||||
public static com.google.android.apps.mytracks.content.Sensor.SensorData parseFrom(
|
||||
com.google.protobuf.ByteString data)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return newBuilder().mergeFrom(data).buildParsed();
|
||||
}
|
||||
public static com.google.android.apps.mytracks.content.Sensor.SensorData parseFrom(
|
||||
com.google.protobuf.ByteString data,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return newBuilder().mergeFrom(data, extensionRegistry)
|
||||
.buildParsed();
|
||||
}
|
||||
public static com.google.android.apps.mytracks.content.Sensor.SensorData parseFrom(byte[] data)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return newBuilder().mergeFrom(data).buildParsed();
|
||||
}
|
||||
public static com.google.android.apps.mytracks.content.Sensor.SensorData parseFrom(
|
||||
byte[] data,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return newBuilder().mergeFrom(data, extensionRegistry)
|
||||
.buildParsed();
|
||||
}
|
||||
public static com.google.android.apps.mytracks.content.Sensor.SensorData parseFrom(java.io.InputStream input)
|
||||
throws java.io.IOException {
|
||||
return newBuilder().mergeFrom(input).buildParsed();
|
||||
}
|
||||
public static com.google.android.apps.mytracks.content.Sensor.SensorData parseFrom(
|
||||
java.io.InputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws java.io.IOException {
|
||||
return newBuilder().mergeFrom(input, extensionRegistry)
|
||||
.buildParsed();
|
||||
}
|
||||
public static com.google.android.apps.mytracks.content.Sensor.SensorData parseDelimitedFrom(java.io.InputStream input)
|
||||
throws java.io.IOException {
|
||||
Builder builder = newBuilder();
|
||||
if (builder.mergeDelimitedFrom(input)) {
|
||||
return builder.buildParsed();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public static com.google.android.apps.mytracks.content.Sensor.SensorData parseDelimitedFrom(
|
||||
java.io.InputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws java.io.IOException {
|
||||
Builder builder = newBuilder();
|
||||
if (builder.mergeDelimitedFrom(input, extensionRegistry)) {
|
||||
return builder.buildParsed();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public static com.google.android.apps.mytracks.content.Sensor.SensorData parseFrom(
|
||||
com.google.protobuf.CodedInputStream input)
|
||||
throws java.io.IOException {
|
||||
return newBuilder().mergeFrom(input).buildParsed();
|
||||
}
|
||||
public static com.google.android.apps.mytracks.content.Sensor.SensorData parseFrom(
|
||||
com.google.protobuf.CodedInputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws java.io.IOException {
|
||||
return newBuilder().mergeFrom(input, extensionRegistry)
|
||||
.buildParsed();
|
||||
}
|
||||
|
||||
public static Builder newBuilder() { return Builder.create(); }
|
||||
public Builder newBuilderForType() { return newBuilder(); }
|
||||
public static Builder newBuilder(com.google.android.apps.mytracks.content.Sensor.SensorData prototype) {
|
||||
return newBuilder().mergeFrom(prototype);
|
||||
}
|
||||
public Builder toBuilder() { return newBuilder(this); }
|
||||
|
||||
public static final class Builder extends
|
||||
com.google.protobuf.GeneratedMessageLite.Builder<
|
||||
com.google.android.apps.mytracks.content.Sensor.SensorData, Builder> {
|
||||
private com.google.android.apps.mytracks.content.Sensor.SensorData result;
|
||||
|
||||
// Construct using com.google.android.apps.mytracks.content.Sensor.SensorData.newBuilder()
|
||||
private Builder() {}
|
||||
|
||||
private static Builder create() {
|
||||
Builder builder = new Builder();
|
||||
builder.result = new com.google.android.apps.mytracks.content.Sensor.SensorData();
|
||||
return builder;
|
||||
}
|
||||
|
||||
protected com.google.android.apps.mytracks.content.Sensor.SensorData internalGetResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public Builder clear() {
|
||||
if (result == null) {
|
||||
throw new IllegalStateException(
|
||||
"Cannot call clear() after build().");
|
||||
}
|
||||
result = new com.google.android.apps.mytracks.content.Sensor.SensorData();
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder clone() {
|
||||
return create().mergeFrom(result);
|
||||
}
|
||||
|
||||
public com.google.android.apps.mytracks.content.Sensor.SensorData getDefaultInstanceForType() {
|
||||
return com.google.android.apps.mytracks.content.Sensor.SensorData.getDefaultInstance();
|
||||
}
|
||||
|
||||
public boolean isInitialized() {
|
||||
return result.isInitialized();
|
||||
}
|
||||
public com.google.android.apps.mytracks.content.Sensor.SensorData build() {
|
||||
if (result != null && !isInitialized()) {
|
||||
throw newUninitializedMessageException(result);
|
||||
}
|
||||
return buildPartial();
|
||||
}
|
||||
|
||||
private com.google.android.apps.mytracks.content.Sensor.SensorData buildParsed()
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
if (!isInitialized()) {
|
||||
throw newUninitializedMessageException(
|
||||
result).asInvalidProtocolBufferException();
|
||||
}
|
||||
return buildPartial();
|
||||
}
|
||||
|
||||
public com.google.android.apps.mytracks.content.Sensor.SensorData buildPartial() {
|
||||
if (result == null) {
|
||||
throw new IllegalStateException(
|
||||
"build() has already been called on this Builder.");
|
||||
}
|
||||
com.google.android.apps.mytracks.content.Sensor.SensorData returnMe = result;
|
||||
result = null;
|
||||
return returnMe;
|
||||
}
|
||||
|
||||
public Builder mergeFrom(com.google.android.apps.mytracks.content.Sensor.SensorData other) {
|
||||
if (other == com.google.android.apps.mytracks.content.Sensor.SensorData.getDefaultInstance()) return this;
|
||||
if (other.hasState()) {
|
||||
setState(other.getState());
|
||||
}
|
||||
if (other.hasValue()) {
|
||||
setValue(other.getValue());
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder mergeFrom(
|
||||
com.google.protobuf.CodedInputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws java.io.IOException {
|
||||
while (true) {
|
||||
int tag = input.readTag();
|
||||
switch (tag) {
|
||||
case 0:
|
||||
return this;
|
||||
default: {
|
||||
if (!parseUnknownField(input, extensionRegistry, tag)) {
|
||||
return this;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 8: {
|
||||
int rawValue = input.readEnum();
|
||||
com.google.android.apps.mytracks.content.Sensor.SensorState value = com.google.android.apps.mytracks.content.Sensor.SensorState.valueOf(rawValue);
|
||||
if (value != null) {
|
||||
setState(value);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 16: {
|
||||
setValue(input.readInt32());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// required .com.google.android.apps.mytracks.content.SensorState state = 1 [default = NONE];
|
||||
public boolean hasState() {
|
||||
return result.hasState();
|
||||
}
|
||||
public com.google.android.apps.mytracks.content.Sensor.SensorState getState() {
|
||||
return result.getState();
|
||||
}
|
||||
public Builder setState(com.google.android.apps.mytracks.content.Sensor.SensorState value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
result.hasState = true;
|
||||
result.state_ = value;
|
||||
return this;
|
||||
}
|
||||
public Builder clearState() {
|
||||
result.hasState = false;
|
||||
result.state_ = com.google.android.apps.mytracks.content.Sensor.SensorState.NONE;
|
||||
return this;
|
||||
}
|
||||
|
||||
// optional int32 value = 2;
|
||||
public boolean hasValue() {
|
||||
return result.hasValue();
|
||||
}
|
||||
public int getValue() {
|
||||
return result.getValue();
|
||||
}
|
||||
public Builder setValue(int value) {
|
||||
result.hasValue = true;
|
||||
result.value_ = value;
|
||||
return this;
|
||||
}
|
||||
public Builder clearValue() {
|
||||
result.hasValue = false;
|
||||
result.value_ = 0;
|
||||
return this;
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(builder_scope:com.google.android.apps.mytracks.content.SensorData)
|
||||
}
|
||||
|
||||
static {
|
||||
defaultInstance = new SensorData(true);
|
||||
com.google.android.apps.mytracks.content.Sensor.internalForceInit();
|
||||
defaultInstance.initFields();
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(class_scope:com.google.android.apps.mytracks.content.SensorData)
|
||||
}
|
||||
|
||||
public static final class SensorDataSet extends
|
||||
com.google.protobuf.GeneratedMessageLite {
|
||||
// Use SensorDataSet.newBuilder() to construct.
|
||||
private SensorDataSet() {
|
||||
initFields();
|
||||
}
|
||||
private SensorDataSet(boolean noInit) {}
|
||||
|
||||
private static final SensorDataSet defaultInstance;
|
||||
public static SensorDataSet getDefaultInstance() {
|
||||
return defaultInstance;
|
||||
}
|
||||
|
||||
public SensorDataSet getDefaultInstanceForType() {
|
||||
return defaultInstance;
|
||||
}
|
||||
|
||||
// optional uint64 creation_time = 1 [default = 0];
|
||||
public static final int CREATION_TIME_FIELD_NUMBER = 1;
|
||||
private boolean hasCreationTime;
|
||||
private long creationTime_ = 0L;
|
||||
public boolean hasCreationTime() { return hasCreationTime; }
|
||||
public long getCreationTime() { return creationTime_; }
|
||||
|
||||
// optional .com.google.android.apps.mytracks.content.SensorData heart_rate = 2;
|
||||
public static final int HEART_RATE_FIELD_NUMBER = 2;
|
||||
private boolean hasHeartRate;
|
||||
private com.google.android.apps.mytracks.content.Sensor.SensorData heartRate_;
|
||||
public boolean hasHeartRate() { return hasHeartRate; }
|
||||
public com.google.android.apps.mytracks.content.Sensor.SensorData getHeartRate() { return heartRate_; }
|
||||
|
||||
// optional .com.google.android.apps.mytracks.content.SensorData cadence = 3;
|
||||
public static final int CADENCE_FIELD_NUMBER = 3;
|
||||
private boolean hasCadence;
|
||||
private com.google.android.apps.mytracks.content.Sensor.SensorData cadence_;
|
||||
public boolean hasCadence() { return hasCadence; }
|
||||
public com.google.android.apps.mytracks.content.Sensor.SensorData getCadence() { return cadence_; }
|
||||
|
||||
// optional .com.google.android.apps.mytracks.content.SensorData power = 4;
|
||||
public static final int POWER_FIELD_NUMBER = 4;
|
||||
private boolean hasPower;
|
||||
private com.google.android.apps.mytracks.content.Sensor.SensorData power_;
|
||||
public boolean hasPower() { return hasPower; }
|
||||
public com.google.android.apps.mytracks.content.Sensor.SensorData getPower() { return power_; }
|
||||
|
||||
// optional .com.google.android.apps.mytracks.content.SensorData battery_level = 5;
|
||||
public static final int BATTERY_LEVEL_FIELD_NUMBER = 5;
|
||||
private boolean hasBatteryLevel;
|
||||
private com.google.android.apps.mytracks.content.Sensor.SensorData batteryLevel_;
|
||||
public boolean hasBatteryLevel() { return hasBatteryLevel; }
|
||||
public com.google.android.apps.mytracks.content.Sensor.SensorData getBatteryLevel() { return batteryLevel_; }
|
||||
|
||||
private void initFields() {
|
||||
heartRate_ = com.google.android.apps.mytracks.content.Sensor.SensorData.getDefaultInstance();
|
||||
cadence_ = com.google.android.apps.mytracks.content.Sensor.SensorData.getDefaultInstance();
|
||||
power_ = com.google.android.apps.mytracks.content.Sensor.SensorData.getDefaultInstance();
|
||||
batteryLevel_ = com.google.android.apps.mytracks.content.Sensor.SensorData.getDefaultInstance();
|
||||
}
|
||||
public final boolean isInitialized() {
|
||||
if (hasHeartRate()) {
|
||||
if (!getHeartRate().isInitialized()) return false;
|
||||
}
|
||||
if (hasCadence()) {
|
||||
if (!getCadence().isInitialized()) return false;
|
||||
}
|
||||
if (hasPower()) {
|
||||
if (!getPower().isInitialized()) return false;
|
||||
}
|
||||
if (hasBatteryLevel()) {
|
||||
if (!getBatteryLevel().isInitialized()) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void writeTo(com.google.protobuf.CodedOutputStream output)
|
||||
throws java.io.IOException {
|
||||
getSerializedSize();
|
||||
if (hasCreationTime()) {
|
||||
output.writeUInt64(1, getCreationTime());
|
||||
}
|
||||
if (hasHeartRate()) {
|
||||
output.writeMessage(2, getHeartRate());
|
||||
}
|
||||
if (hasCadence()) {
|
||||
output.writeMessage(3, getCadence());
|
||||
}
|
||||
if (hasPower()) {
|
||||
output.writeMessage(4, getPower());
|
||||
}
|
||||
if (hasBatteryLevel()) {
|
||||
output.writeMessage(5, getBatteryLevel());
|
||||
}
|
||||
}
|
||||
|
||||
private int memoizedSerializedSize = -1;
|
||||
public int getSerializedSize() {
|
||||
int size = memoizedSerializedSize;
|
||||
if (size != -1) return size;
|
||||
|
||||
size = 0;
|
||||
if (hasCreationTime()) {
|
||||
size += com.google.protobuf.CodedOutputStream
|
||||
.computeUInt64Size(1, getCreationTime());
|
||||
}
|
||||
if (hasHeartRate()) {
|
||||
size += com.google.protobuf.CodedOutputStream
|
||||
.computeMessageSize(2, getHeartRate());
|
||||
}
|
||||
if (hasCadence()) {
|
||||
size += com.google.protobuf.CodedOutputStream
|
||||
.computeMessageSize(3, getCadence());
|
||||
}
|
||||
if (hasPower()) {
|
||||
size += com.google.protobuf.CodedOutputStream
|
||||
.computeMessageSize(4, getPower());
|
||||
}
|
||||
if (hasBatteryLevel()) {
|
||||
size += com.google.protobuf.CodedOutputStream
|
||||
.computeMessageSize(5, getBatteryLevel());
|
||||
}
|
||||
memoizedSerializedSize = size;
|
||||
return size;
|
||||
}
|
||||
|
||||
public static com.google.android.apps.mytracks.content.Sensor.SensorDataSet parseFrom(
|
||||
com.google.protobuf.ByteString data)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return newBuilder().mergeFrom(data).buildParsed();
|
||||
}
|
||||
public static com.google.android.apps.mytracks.content.Sensor.SensorDataSet parseFrom(
|
||||
com.google.protobuf.ByteString data,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return newBuilder().mergeFrom(data, extensionRegistry)
|
||||
.buildParsed();
|
||||
}
|
||||
public static com.google.android.apps.mytracks.content.Sensor.SensorDataSet parseFrom(byte[] data)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return newBuilder().mergeFrom(data).buildParsed();
|
||||
}
|
||||
public static com.google.android.apps.mytracks.content.Sensor.SensorDataSet parseFrom(
|
||||
byte[] data,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return newBuilder().mergeFrom(data, extensionRegistry)
|
||||
.buildParsed();
|
||||
}
|
||||
public static com.google.android.apps.mytracks.content.Sensor.SensorDataSet parseFrom(java.io.InputStream input)
|
||||
throws java.io.IOException {
|
||||
return newBuilder().mergeFrom(input).buildParsed();
|
||||
}
|
||||
public static com.google.android.apps.mytracks.content.Sensor.SensorDataSet parseFrom(
|
||||
java.io.InputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws java.io.IOException {
|
||||
return newBuilder().mergeFrom(input, extensionRegistry)
|
||||
.buildParsed();
|
||||
}
|
||||
public static com.google.android.apps.mytracks.content.Sensor.SensorDataSet parseDelimitedFrom(java.io.InputStream input)
|
||||
throws java.io.IOException {
|
||||
Builder builder = newBuilder();
|
||||
if (builder.mergeDelimitedFrom(input)) {
|
||||
return builder.buildParsed();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public static com.google.android.apps.mytracks.content.Sensor.SensorDataSet parseDelimitedFrom(
|
||||
java.io.InputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws java.io.IOException {
|
||||
Builder builder = newBuilder();
|
||||
if (builder.mergeDelimitedFrom(input, extensionRegistry)) {
|
||||
return builder.buildParsed();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public static com.google.android.apps.mytracks.content.Sensor.SensorDataSet parseFrom(
|
||||
com.google.protobuf.CodedInputStream input)
|
||||
throws java.io.IOException {
|
||||
return newBuilder().mergeFrom(input).buildParsed();
|
||||
}
|
||||
public static com.google.android.apps.mytracks.content.Sensor.SensorDataSet parseFrom(
|
||||
com.google.protobuf.CodedInputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws java.io.IOException {
|
||||
return newBuilder().mergeFrom(input, extensionRegistry)
|
||||
.buildParsed();
|
||||
}
|
||||
|
||||
public static Builder newBuilder() { return Builder.create(); }
|
||||
public Builder newBuilderForType() { return newBuilder(); }
|
||||
public static Builder newBuilder(com.google.android.apps.mytracks.content.Sensor.SensorDataSet prototype) {
|
||||
return newBuilder().mergeFrom(prototype);
|
||||
}
|
||||
public Builder toBuilder() { return newBuilder(this); }
|
||||
|
||||
public static final class Builder extends
|
||||
com.google.protobuf.GeneratedMessageLite.Builder<
|
||||
com.google.android.apps.mytracks.content.Sensor.SensorDataSet, Builder> {
|
||||
private com.google.android.apps.mytracks.content.Sensor.SensorDataSet result;
|
||||
|
||||
// Construct using com.google.android.apps.mytracks.content.Sensor.SensorDataSet.newBuilder()
|
||||
private Builder() {}
|
||||
|
||||
private static Builder create() {
|
||||
Builder builder = new Builder();
|
||||
builder.result = new com.google.android.apps.mytracks.content.Sensor.SensorDataSet();
|
||||
return builder;
|
||||
}
|
||||
|
||||
protected com.google.android.apps.mytracks.content.Sensor.SensorDataSet internalGetResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public Builder clear() {
|
||||
if (result == null) {
|
||||
throw new IllegalStateException(
|
||||
"Cannot call clear() after build().");
|
||||
}
|
||||
result = new com.google.android.apps.mytracks.content.Sensor.SensorDataSet();
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder clone() {
|
||||
return create().mergeFrom(result);
|
||||
}
|
||||
|
||||
public com.google.android.apps.mytracks.content.Sensor.SensorDataSet getDefaultInstanceForType() {
|
||||
return com.google.android.apps.mytracks.content.Sensor.SensorDataSet.getDefaultInstance();
|
||||
}
|
||||
|
||||
public boolean isInitialized() {
|
||||
return result.isInitialized();
|
||||
}
|
||||
public com.google.android.apps.mytracks.content.Sensor.SensorDataSet build() {
|
||||
if (result != null && !isInitialized()) {
|
||||
throw newUninitializedMessageException(result);
|
||||
}
|
||||
return buildPartial();
|
||||
}
|
||||
|
||||
private com.google.android.apps.mytracks.content.Sensor.SensorDataSet buildParsed()
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
if (!isInitialized()) {
|
||||
throw newUninitializedMessageException(
|
||||
result).asInvalidProtocolBufferException();
|
||||
}
|
||||
return buildPartial();
|
||||
}
|
||||
|
||||
public com.google.android.apps.mytracks.content.Sensor.SensorDataSet buildPartial() {
|
||||
if (result == null) {
|
||||
throw new IllegalStateException(
|
||||
"build() has already been called on this Builder.");
|
||||
}
|
||||
com.google.android.apps.mytracks.content.Sensor.SensorDataSet returnMe = result;
|
||||
result = null;
|
||||
return returnMe;
|
||||
}
|
||||
|
||||
public Builder mergeFrom(com.google.android.apps.mytracks.content.Sensor.SensorDataSet other) {
|
||||
if (other == com.google.android.apps.mytracks.content.Sensor.SensorDataSet.getDefaultInstance()) return this;
|
||||
if (other.hasCreationTime()) {
|
||||
setCreationTime(other.getCreationTime());
|
||||
}
|
||||
if (other.hasHeartRate()) {
|
||||
mergeHeartRate(other.getHeartRate());
|
||||
}
|
||||
if (other.hasCadence()) {
|
||||
mergeCadence(other.getCadence());
|
||||
}
|
||||
if (other.hasPower()) {
|
||||
mergePower(other.getPower());
|
||||
}
|
||||
if (other.hasBatteryLevel()) {
|
||||
mergeBatteryLevel(other.getBatteryLevel());
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder mergeFrom(
|
||||
com.google.protobuf.CodedInputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws java.io.IOException {
|
||||
while (true) {
|
||||
int tag = input.readTag();
|
||||
switch (tag) {
|
||||
case 0:
|
||||
return this;
|
||||
default: {
|
||||
if (!parseUnknownField(input, extensionRegistry, tag)) {
|
||||
return this;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 8: {
|
||||
setCreationTime(input.readUInt64());
|
||||
break;
|
||||
}
|
||||
case 18: {
|
||||
com.google.android.apps.mytracks.content.Sensor.SensorData.Builder subBuilder = com.google.android.apps.mytracks.content.Sensor.SensorData.newBuilder();
|
||||
if (hasHeartRate()) {
|
||||
subBuilder.mergeFrom(getHeartRate());
|
||||
}
|
||||
input.readMessage(subBuilder, extensionRegistry);
|
||||
setHeartRate(subBuilder.buildPartial());
|
||||
break;
|
||||
}
|
||||
case 26: {
|
||||
com.google.android.apps.mytracks.content.Sensor.SensorData.Builder subBuilder = com.google.android.apps.mytracks.content.Sensor.SensorData.newBuilder();
|
||||
if (hasCadence()) {
|
||||
subBuilder.mergeFrom(getCadence());
|
||||
}
|
||||
input.readMessage(subBuilder, extensionRegistry);
|
||||
setCadence(subBuilder.buildPartial());
|
||||
break;
|
||||
}
|
||||
case 34: {
|
||||
com.google.android.apps.mytracks.content.Sensor.SensorData.Builder subBuilder = com.google.android.apps.mytracks.content.Sensor.SensorData.newBuilder();
|
||||
if (hasPower()) {
|
||||
subBuilder.mergeFrom(getPower());
|
||||
}
|
||||
input.readMessage(subBuilder, extensionRegistry);
|
||||
setPower(subBuilder.buildPartial());
|
||||
break;
|
||||
}
|
||||
case 42: {
|
||||
com.google.android.apps.mytracks.content.Sensor.SensorData.Builder subBuilder = com.google.android.apps.mytracks.content.Sensor.SensorData.newBuilder();
|
||||
if (hasBatteryLevel()) {
|
||||
subBuilder.mergeFrom(getBatteryLevel());
|
||||
}
|
||||
input.readMessage(subBuilder, extensionRegistry);
|
||||
setBatteryLevel(subBuilder.buildPartial());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// optional uint64 creation_time = 1 [default = 0];
|
||||
public boolean hasCreationTime() {
|
||||
return result.hasCreationTime();
|
||||
}
|
||||
public long getCreationTime() {
|
||||
return result.getCreationTime();
|
||||
}
|
||||
public Builder setCreationTime(long value) {
|
||||
result.hasCreationTime = true;
|
||||
result.creationTime_ = value;
|
||||
return this;
|
||||
}
|
||||
public Builder clearCreationTime() {
|
||||
result.hasCreationTime = false;
|
||||
result.creationTime_ = 0L;
|
||||
return this;
|
||||
}
|
||||
|
||||
// optional .com.google.android.apps.mytracks.content.SensorData heart_rate = 2;
|
||||
public boolean hasHeartRate() {
|
||||
return result.hasHeartRate();
|
||||
}
|
||||
public com.google.android.apps.mytracks.content.Sensor.SensorData getHeartRate() {
|
||||
return result.getHeartRate();
|
||||
}
|
||||
public Builder setHeartRate(com.google.android.apps.mytracks.content.Sensor.SensorData value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
result.hasHeartRate = true;
|
||||
result.heartRate_ = value;
|
||||
return this;
|
||||
}
|
||||
public Builder setHeartRate(com.google.android.apps.mytracks.content.Sensor.SensorData.Builder builderForValue) {
|
||||
result.hasHeartRate = true;
|
||||
result.heartRate_ = builderForValue.build();
|
||||
return this;
|
||||
}
|
||||
public Builder mergeHeartRate(com.google.android.apps.mytracks.content.Sensor.SensorData value) {
|
||||
if (result.hasHeartRate() &&
|
||||
result.heartRate_ != com.google.android.apps.mytracks.content.Sensor.SensorData.getDefaultInstance()) {
|
||||
result.heartRate_ =
|
||||
com.google.android.apps.mytracks.content.Sensor.SensorData.newBuilder(result.heartRate_).mergeFrom(value).buildPartial();
|
||||
} else {
|
||||
result.heartRate_ = value;
|
||||
}
|
||||
result.hasHeartRate = true;
|
||||
return this;
|
||||
}
|
||||
public Builder clearHeartRate() {
|
||||
result.hasHeartRate = false;
|
||||
result.heartRate_ = com.google.android.apps.mytracks.content.Sensor.SensorData.getDefaultInstance();
|
||||
return this;
|
||||
}
|
||||
|
||||
// optional .com.google.android.apps.mytracks.content.SensorData cadence = 3;
|
||||
public boolean hasCadence() {
|
||||
return result.hasCadence();
|
||||
}
|
||||
public com.google.android.apps.mytracks.content.Sensor.SensorData getCadence() {
|
||||
return result.getCadence();
|
||||
}
|
||||
public Builder setCadence(com.google.android.apps.mytracks.content.Sensor.SensorData value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
result.hasCadence = true;
|
||||
result.cadence_ = value;
|
||||
return this;
|
||||
}
|
||||
public Builder setCadence(com.google.android.apps.mytracks.content.Sensor.SensorData.Builder builderForValue) {
|
||||
result.hasCadence = true;
|
||||
result.cadence_ = builderForValue.build();
|
||||
return this;
|
||||
}
|
||||
public Builder mergeCadence(com.google.android.apps.mytracks.content.Sensor.SensorData value) {
|
||||
if (result.hasCadence() &&
|
||||
result.cadence_ != com.google.android.apps.mytracks.content.Sensor.SensorData.getDefaultInstance()) {
|
||||
result.cadence_ =
|
||||
com.google.android.apps.mytracks.content.Sensor.SensorData.newBuilder(result.cadence_).mergeFrom(value).buildPartial();
|
||||
} else {
|
||||
result.cadence_ = value;
|
||||
}
|
||||
result.hasCadence = true;
|
||||
return this;
|
||||
}
|
||||
public Builder clearCadence() {
|
||||
result.hasCadence = false;
|
||||
result.cadence_ = com.google.android.apps.mytracks.content.Sensor.SensorData.getDefaultInstance();
|
||||
return this;
|
||||
}
|
||||
|
||||
// optional .com.google.android.apps.mytracks.content.SensorData power = 4;
|
||||
public boolean hasPower() {
|
||||
return result.hasPower();
|
||||
}
|
||||
public com.google.android.apps.mytracks.content.Sensor.SensorData getPower() {
|
||||
return result.getPower();
|
||||
}
|
||||
public Builder setPower(com.google.android.apps.mytracks.content.Sensor.SensorData value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
result.hasPower = true;
|
||||
result.power_ = value;
|
||||
return this;
|
||||
}
|
||||
public Builder setPower(com.google.android.apps.mytracks.content.Sensor.SensorData.Builder builderForValue) {
|
||||
result.hasPower = true;
|
||||
result.power_ = builderForValue.build();
|
||||
return this;
|
||||
}
|
||||
public Builder mergePower(com.google.android.apps.mytracks.content.Sensor.SensorData value) {
|
||||
if (result.hasPower() &&
|
||||
result.power_ != com.google.android.apps.mytracks.content.Sensor.SensorData.getDefaultInstance()) {
|
||||
result.power_ =
|
||||
com.google.android.apps.mytracks.content.Sensor.SensorData.newBuilder(result.power_).mergeFrom(value).buildPartial();
|
||||
} else {
|
||||
result.power_ = value;
|
||||
}
|
||||
result.hasPower = true;
|
||||
return this;
|
||||
}
|
||||
public Builder clearPower() {
|
||||
result.hasPower = false;
|
||||
result.power_ = com.google.android.apps.mytracks.content.Sensor.SensorData.getDefaultInstance();
|
||||
return this;
|
||||
}
|
||||
|
||||
// optional .com.google.android.apps.mytracks.content.SensorData battery_level = 5;
|
||||
public boolean hasBatteryLevel() {
|
||||
return result.hasBatteryLevel();
|
||||
}
|
||||
public com.google.android.apps.mytracks.content.Sensor.SensorData getBatteryLevel() {
|
||||
return result.getBatteryLevel();
|
||||
}
|
||||
public Builder setBatteryLevel(com.google.android.apps.mytracks.content.Sensor.SensorData value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
result.hasBatteryLevel = true;
|
||||
result.batteryLevel_ = value;
|
||||
return this;
|
||||
}
|
||||
public Builder setBatteryLevel(com.google.android.apps.mytracks.content.Sensor.SensorData.Builder builderForValue) {
|
||||
result.hasBatteryLevel = true;
|
||||
result.batteryLevel_ = builderForValue.build();
|
||||
return this;
|
||||
}
|
||||
public Builder mergeBatteryLevel(com.google.android.apps.mytracks.content.Sensor.SensorData value) {
|
||||
if (result.hasBatteryLevel() &&
|
||||
result.batteryLevel_ != com.google.android.apps.mytracks.content.Sensor.SensorData.getDefaultInstance()) {
|
||||
result.batteryLevel_ =
|
||||
com.google.android.apps.mytracks.content.Sensor.SensorData.newBuilder(result.batteryLevel_).mergeFrom(value).buildPartial();
|
||||
} else {
|
||||
result.batteryLevel_ = value;
|
||||
}
|
||||
result.hasBatteryLevel = true;
|
||||
return this;
|
||||
}
|
||||
public Builder clearBatteryLevel() {
|
||||
result.hasBatteryLevel = false;
|
||||
result.batteryLevel_ = com.google.android.apps.mytracks.content.Sensor.SensorData.getDefaultInstance();
|
||||
return this;
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(builder_scope:com.google.android.apps.mytracks.content.SensorDataSet)
|
||||
}
|
||||
|
||||
static {
|
||||
defaultInstance = new SensorDataSet(true);
|
||||
com.google.android.apps.mytracks.content.Sensor.internalForceInit();
|
||||
defaultInstance.initFields();
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(class_scope:com.google.android.apps.mytracks.content.SensorDataSet)
|
||||
}
|
||||
|
||||
|
||||
static {
|
||||
}
|
||||
|
||||
public static void internalForceInit() {}
|
||||
|
||||
// @@protoc_insertion_point(outer_class_scope)
|
||||
}
|
||||
@@ -0,0 +1,236 @@
|
||||
/*
|
||||
* Copyright 2008 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
|
||||
package com.google.android.apps.mytracks.content;
|
||||
|
||||
import com.google.android.apps.mytracks.stats.TripStatistics;
|
||||
|
||||
import android.location.Location;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* A track.
|
||||
*
|
||||
* @author Leif Hendrik Wilden
|
||||
* @author Rodrigo Damazio
|
||||
*/
|
||||
public class Track implements Parcelable {
|
||||
|
||||
private long id = -1L;
|
||||
private String name = "";
|
||||
private String description = "";
|
||||
private String category = "";
|
||||
private long startId = -1L;
|
||||
private long stopId = -1L;
|
||||
|
||||
/*
|
||||
* The number of location points (present even if the points themselves are
|
||||
* not loaded)
|
||||
*/
|
||||
private int numberOfPoints = 0;
|
||||
private String icon = "";
|
||||
private String driveId = "";
|
||||
private long modifiedTime = -1L;
|
||||
private boolean sharedWithMe = false;
|
||||
private String sharedOwner = "";
|
||||
|
||||
private TripStatistics tripStatistics = new TripStatistics();
|
||||
|
||||
// Location points (which may not have been loaded)
|
||||
private ArrayList<Location> locations = new ArrayList<Location>();
|
||||
|
||||
public Track() {}
|
||||
|
||||
private Track(Parcel in) {
|
||||
id = in.readLong();
|
||||
name = in.readString();
|
||||
description = in.readString();
|
||||
category = in.readString();
|
||||
startId = in.readLong();
|
||||
stopId = in.readLong();
|
||||
numberOfPoints = in.readInt();
|
||||
icon = in.readString();
|
||||
driveId = in.readString();
|
||||
modifiedTime = in.readLong();
|
||||
sharedWithMe = in.readByte() == 1;
|
||||
sharedOwner = in.readString();
|
||||
|
||||
ClassLoader classLoader = getClass().getClassLoader();
|
||||
tripStatistics = in.readParcelable(classLoader);
|
||||
|
||||
for (int i = 0; i < numberOfPoints; ++i) {
|
||||
Location location = in.readParcelable(classLoader);
|
||||
locations.add(location);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeLong(id);
|
||||
dest.writeString(name);
|
||||
dest.writeString(description);
|
||||
dest.writeString(category);
|
||||
dest.writeLong(startId);
|
||||
dest.writeLong(stopId);
|
||||
dest.writeInt(numberOfPoints);
|
||||
dest.writeString(icon);
|
||||
dest.writeString(driveId);
|
||||
dest.writeLong(modifiedTime);
|
||||
dest.writeByte((byte) (sharedWithMe ? 1 : 0));
|
||||
dest.writeString(sharedOwner);
|
||||
|
||||
dest.writeParcelable(tripStatistics, 0);
|
||||
for (int i = 0; i < numberOfPoints; ++i) {
|
||||
dest.writeParcelable(locations.get(i), 0);
|
||||
}
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<Track> CREATOR = new Parcelable.Creator<Track>() {
|
||||
@Override
|
||||
public Track createFromParcel(Parcel in) {
|
||||
return new Track(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Track[] newArray(int size) {
|
||||
return new Track[size];
|
||||
}
|
||||
};
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getCategory() {
|
||||
return category;
|
||||
}
|
||||
|
||||
public void setCategory(String category) {
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
public long getStartId() {
|
||||
return startId;
|
||||
}
|
||||
|
||||
public void setStartId(long startId) {
|
||||
this.startId = startId;
|
||||
}
|
||||
|
||||
public long getStopId() {
|
||||
return stopId;
|
||||
}
|
||||
|
||||
public void setStopId(long stopId) {
|
||||
this.stopId = stopId;
|
||||
}
|
||||
|
||||
public int getNumberOfPoints() {
|
||||
return numberOfPoints;
|
||||
}
|
||||
|
||||
public void setNumberOfPoints(int numberOfPoints) {
|
||||
this.numberOfPoints = numberOfPoints;
|
||||
}
|
||||
|
||||
public String getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
public void setIcon(String icon) {
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
public String getDriveId() {
|
||||
return driveId;
|
||||
}
|
||||
|
||||
public void setDriveId(String driveId) {
|
||||
this.driveId = driveId;
|
||||
}
|
||||
|
||||
public long getModifiedTime() {
|
||||
return modifiedTime;
|
||||
}
|
||||
|
||||
public void setModifiedTime(long modifiedTime) {
|
||||
this.modifiedTime = modifiedTime;
|
||||
}
|
||||
|
||||
public boolean isSharedWithMe() {
|
||||
return sharedWithMe;
|
||||
}
|
||||
|
||||
public void setSharedWithMe(boolean sharedWithMe) {
|
||||
this.sharedWithMe = sharedWithMe;
|
||||
}
|
||||
|
||||
public String getSharedOwner() {
|
||||
return sharedOwner;
|
||||
}
|
||||
|
||||
public void setSharedOwner(String sharedOwner) {
|
||||
this.sharedOwner = sharedOwner;
|
||||
}
|
||||
|
||||
public TripStatistics getTripStatistics() {
|
||||
return tripStatistics;
|
||||
}
|
||||
|
||||
public void setTripStatistics(TripStatistics tripStatistics) {
|
||||
this.tripStatistics = tripStatistics;
|
||||
}
|
||||
|
||||
public void addLocation(Location location) {
|
||||
locations.add(location);
|
||||
}
|
||||
|
||||
public ArrayList<Location> getLocations() {
|
||||
return locations;
|
||||
}
|
||||
|
||||
public void setLocations(ArrayList<Location> locations) {
|
||||
this.locations = locations;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Copyright 2008 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
|
||||
package com.google.android.apps.mytracks.content;
|
||||
|
||||
import static com.google.android.apps.mytracks.content.ContentTypeIds.BLOB_TYPE_ID;
|
||||
import static com.google.android.apps.mytracks.content.ContentTypeIds.FLOAT_TYPE_ID;
|
||||
import static com.google.android.apps.mytracks.content.ContentTypeIds.INT_TYPE_ID;
|
||||
import static com.google.android.apps.mytracks.content.ContentTypeIds.LONG_TYPE_ID;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.provider.BaseColumns;
|
||||
|
||||
/**
|
||||
* Constants for the track points table.
|
||||
*
|
||||
* @author Leif Hendrik Wilden
|
||||
*/
|
||||
public interface TrackPointsColumns extends BaseColumns {
|
||||
|
||||
public static final String TABLE_NAME = "trackpoints";
|
||||
public static final Uri CONTENT_URI = Uri.parse(
|
||||
"content://com.google.android.maps.mytracks/trackpoints");
|
||||
public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.google.trackpoint";
|
||||
public static final String CONTENT_ITEMTYPE = "vnd.android.cursor.item/vnd.google.trackpoint";
|
||||
public static final String DEFAULT_SORT_ORDER = "_id";
|
||||
|
||||
// Columns
|
||||
public static final String TRACKID = "trackid"; // track id
|
||||
public static final String LONGITUDE = "longitude"; // longitude
|
||||
public static final String LATITUDE = "latitude"; // latitude
|
||||
public static final String TIME = "time"; // time
|
||||
public static final String ALTITUDE = "elevation"; // altitude
|
||||
public static final String ACCURACY = "accuracy"; // accuracy
|
||||
public static final String SPEED = "speed"; // speed
|
||||
public static final String BEARING = "bearing"; // bearing
|
||||
public static final String SENSOR = "sensor"; // sensor
|
||||
|
||||
public static final String CREATE_TABLE = "CREATE TABLE " + TABLE_NAME + " ("
|
||||
+ _ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
|
||||
+ TRACKID + " INTEGER, "
|
||||
+ LONGITUDE + " INTEGER, "
|
||||
+ LATITUDE + " INTEGER, "
|
||||
+ TIME + " INTEGER, "
|
||||
+ ALTITUDE + " FLOAT, "
|
||||
+ ACCURACY + " FLOAT, "
|
||||
+ SPEED + " FLOAT, "
|
||||
+ BEARING + " FLOAT, "
|
||||
+ SENSOR + " BLOB"
|
||||
+ ");";
|
||||
|
||||
public static final String[] COLUMNS = {
|
||||
_ID,
|
||||
TRACKID,
|
||||
LONGITUDE,
|
||||
LATITUDE,
|
||||
TIME,
|
||||
ALTITUDE,
|
||||
ACCURACY,
|
||||
SPEED,
|
||||
BEARING,
|
||||
SENSOR
|
||||
};
|
||||
|
||||
public static final byte[] COLUMN_TYPES = {
|
||||
LONG_TYPE_ID, // id
|
||||
LONG_TYPE_ID, // track id
|
||||
INT_TYPE_ID, // longitude
|
||||
INT_TYPE_ID, // latitude
|
||||
LONG_TYPE_ID, // time
|
||||
FLOAT_TYPE_ID, // altitude
|
||||
FLOAT_TYPE_ID, // accuracy
|
||||
FLOAT_TYPE_ID, // speed
|
||||
FLOAT_TYPE_ID, // bearing
|
||||
BLOB_TYPE_ID // sensor
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,195 @@
|
||||
/*
|
||||
* Copyright 2008 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
|
||||
package com.google.android.apps.mytracks.content;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.provider.BaseColumns;
|
||||
|
||||
/**
|
||||
* Constants for the tracks table.
|
||||
*
|
||||
* @author Leif Hendrik Wilden
|
||||
*/
|
||||
public interface TracksColumns extends BaseColumns {
|
||||
|
||||
public static final String TABLE_NAME = "tracks";
|
||||
|
||||
/**
|
||||
* Tracks provider uri.
|
||||
*/
|
||||
public static final Uri CONTENT_URI = Uri.parse(
|
||||
"content://com.google.android.maps.mytracks/tracks");
|
||||
|
||||
/**
|
||||
* Track content type.
|
||||
*/
|
||||
public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.google.track";
|
||||
|
||||
/**
|
||||
* Track id content type.
|
||||
*/
|
||||
public static final String CONTENT_ITEMTYPE = "vnd.android.cursor.item/vnd.google.track";
|
||||
|
||||
/**
|
||||
* Tracks table default sort order.
|
||||
*/
|
||||
public static final String DEFAULT_SORT_ORDER = "_id";
|
||||
|
||||
// Columns
|
||||
public static final String NAME = "name"; // track name
|
||||
public static final String DESCRIPTION = "description"; // track description
|
||||
public static final String CATEGORY = "category"; // track activity type
|
||||
public static final String STARTID = "startid"; // first track point id
|
||||
public static final String STOPID = "stopid"; // last track point id
|
||||
public static final String STARTTIME = "starttime"; // track start time
|
||||
public static final String STOPTIME = "stoptime"; // track stop time
|
||||
public static final String NUMPOINTS = "numpoints"; // number of track points
|
||||
public static final String TOTALDISTANCE = "totaldistance"; // total distance
|
||||
public static final String TOTALTIME = "totaltime"; // total time
|
||||
public static final String MOVINGTIME = "movingtime"; // moving time
|
||||
public static final String MINLAT = "minlat"; // minimum latitude
|
||||
public static final String MAXLAT = "maxlat"; // maximum latitude
|
||||
public static final String MINLON = "minlon"; // minimum longitude
|
||||
public static final String MAXLON = "maxlon"; // maximum longitude
|
||||
public static final String AVGSPEED = "avgspeed"; // average speed
|
||||
|
||||
// average moving speed
|
||||
public static final String AVGMOVINGSPEED = "avgmovingspeed";
|
||||
public static final String MAXSPEED = "maxspeed"; // maximum speed
|
||||
public static final String MINELEVATION = "minelevation"; // minimum elevation
|
||||
public static final String MAXELEVATION = "maxelevation"; // maximum elevation
|
||||
public static final String ELEVATIONGAIN = "elevationgain"; // elevation gain
|
||||
public static final String MINGRADE = "mingrade"; // minimum grade
|
||||
public static final String MAXGRADE = "maxgrade"; // maximum grade
|
||||
public static final String MAPID = "mapid"; // Google Maps id
|
||||
public static final String TABLEID = "tableid"; // Google Fusion Tables id
|
||||
public static final String ICON = "icon"; // track activity type icon
|
||||
public static final String DRIVEID = "driveid"; // Google Drive file id
|
||||
|
||||
// Google drive file modified time
|
||||
public static final String MODIFIEDTIME = "modifiedtime";
|
||||
|
||||
// 1 if the Google Drive file is from the "Shared with me" directory
|
||||
public static final String SHAREDWITHME = "sharedwithme";
|
||||
|
||||
// The owner of the shared with me track
|
||||
public static final String SHAREDOWNER = "sharedOwner";
|
||||
|
||||
// Calorie burned of the track
|
||||
public static final String CALORIE = "calorie";
|
||||
|
||||
public static final String CREATE_TABLE = "CREATE TABLE " + TABLE_NAME + " (" // table
|
||||
+ _ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " // id
|
||||
+ NAME + " STRING, " // name
|
||||
+ DESCRIPTION + " STRING, " // description
|
||||
+ CATEGORY + " STRING, " // category
|
||||
+ STARTID + " INTEGER, " // start id
|
||||
+ STOPID + " INTEGER, " // stop id
|
||||
+ STARTTIME + " INTEGER, " // start time
|
||||
+ STOPTIME + " INTEGER, " // stop time
|
||||
+ NUMPOINTS + " INTEGER, " // num points
|
||||
+ TOTALDISTANCE + " FLOAT, " // total distance
|
||||
+ TOTALTIME + " INTEGER, " // total time
|
||||
+ MOVINGTIME + " INTEGER, " // moving time
|
||||
+ MINLAT + " INTEGER, " // min latitude
|
||||
+ MAXLAT + " INTEGER, " // max latitude
|
||||
+ MINLON + " INTEGER, " // min longitude
|
||||
+ MAXLON + " INTEGER, " // max longitude
|
||||
+ AVGSPEED + " FLOAT, " // average speed
|
||||
+ AVGMOVINGSPEED + " FLOAT, " // average moving speed
|
||||
+ MAXSPEED + " FLOAT, " // max speed
|
||||
+ MINELEVATION + " FLOAT, " // min elevation
|
||||
+ MAXELEVATION + " FLOAT, " // max elevation
|
||||
+ ELEVATIONGAIN + " FLOAT, " // elevation gain
|
||||
+ MINGRADE + " FLOAT, " // min grade
|
||||
+ MAXGRADE + " FLOAT, " // max grade
|
||||
+ MAPID + " STRING, " // map id
|
||||
+ TABLEID + " STRING, " // table id
|
||||
+ ICON + " STRING, " // icon
|
||||
+ DRIVEID + " STRING, " // drive id
|
||||
+ MODIFIEDTIME + " INTEGER, " // modified time
|
||||
+ SHAREDWITHME + " INTEGER, " // shared with me
|
||||
+ SHAREDOWNER + " STRING, " // shared owner
|
||||
+ CALORIE + " INTEGER);"; // calorie
|
||||
|
||||
public static final String[] COLUMNS = { _ID, // id
|
||||
NAME, // name
|
||||
DESCRIPTION, // description
|
||||
CATEGORY, // category
|
||||
STARTID, // start id
|
||||
STOPID, // stop id
|
||||
STARTTIME, // start time
|
||||
STOPTIME, // stop time
|
||||
NUMPOINTS, // num points
|
||||
TOTALDISTANCE, // total distance
|
||||
TOTALTIME, // total time
|
||||
MOVINGTIME, // moving time
|
||||
MINLAT, // min latitude
|
||||
MAXLAT, // max latitude
|
||||
MINLON, // min longitude
|
||||
MAXLON, // max longitude
|
||||
AVGSPEED, // average speed
|
||||
AVGMOVINGSPEED, // average moving speed
|
||||
MAXSPEED, // max speed
|
||||
MINELEVATION, // min elevation
|
||||
MAXELEVATION, // max elevation
|
||||
ELEVATIONGAIN, // elevation gain
|
||||
MINGRADE, // min grade
|
||||
MAXGRADE, // max grade
|
||||
MAPID, // map id
|
||||
TABLEID, // table id
|
||||
ICON, // icon
|
||||
DRIVEID, // drive id
|
||||
MODIFIEDTIME, // modified time
|
||||
SHAREDWITHME, // shared with me
|
||||
SHAREDOWNER,// shared owner
|
||||
CALORIE }; // calorie
|
||||
|
||||
public static final byte[] COLUMN_TYPES = { ContentTypeIds.LONG_TYPE_ID, // id
|
||||
ContentTypeIds.STRING_TYPE_ID, // name
|
||||
ContentTypeIds.STRING_TYPE_ID, // description
|
||||
ContentTypeIds.STRING_TYPE_ID, // category
|
||||
ContentTypeIds.LONG_TYPE_ID, // start id
|
||||
ContentTypeIds.LONG_TYPE_ID, // stop id
|
||||
ContentTypeIds.LONG_TYPE_ID, // start time
|
||||
ContentTypeIds.LONG_TYPE_ID, // stop time
|
||||
ContentTypeIds.INT_TYPE_ID, // num points
|
||||
ContentTypeIds.FLOAT_TYPE_ID, // total distance
|
||||
ContentTypeIds.LONG_TYPE_ID, // total time
|
||||
ContentTypeIds.LONG_TYPE_ID, // moving time
|
||||
ContentTypeIds.INT_TYPE_ID, // min latitude
|
||||
ContentTypeIds.INT_TYPE_ID, // max latitude
|
||||
ContentTypeIds.INT_TYPE_ID, // min longitude
|
||||
ContentTypeIds.INT_TYPE_ID, // max longitude
|
||||
ContentTypeIds.FLOAT_TYPE_ID, // average speed
|
||||
ContentTypeIds.FLOAT_TYPE_ID, // average moving speed
|
||||
ContentTypeIds.FLOAT_TYPE_ID, // max speed
|
||||
ContentTypeIds.FLOAT_TYPE_ID, // min elevation
|
||||
ContentTypeIds.FLOAT_TYPE_ID, // max elevation
|
||||
ContentTypeIds.FLOAT_TYPE_ID, // elevation gain
|
||||
ContentTypeIds.FLOAT_TYPE_ID, // min grade
|
||||
ContentTypeIds.FLOAT_TYPE_ID, // max grade
|
||||
ContentTypeIds.STRING_TYPE_ID, // map id
|
||||
ContentTypeIds.STRING_TYPE_ID, // table id
|
||||
ContentTypeIds.STRING_TYPE_ID, // icon
|
||||
ContentTypeIds.STRING_TYPE_ID, // drive id
|
||||
ContentTypeIds.LONG_TYPE_ID, // modified time
|
||||
ContentTypeIds.BOOLEAN_TYPE_ID, // shared with me
|
||||
ContentTypeIds.STRING_TYPE_ID, // shared owner
|
||||
ContentTypeIds.INT_TYPE_ID // calorie
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
package com.google.android.apps.mytracks.content;
|
||||
parcelable Waypoint;
|
||||
@@ -0,0 +1,249 @@
|
||||
/*
|
||||
* Copyright 2009 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
|
||||
package com.google.android.apps.mytracks.content;
|
||||
|
||||
import com.google.android.apps.mytracks.stats.TripStatistics;
|
||||
|
||||
import android.location.Location;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
/**
|
||||
* A waypoint.
|
||||
*
|
||||
* @author Leif Hendrik Wilden
|
||||
* @author Rodrigo Damazio
|
||||
*/
|
||||
public final class Waypoint implements Parcelable {
|
||||
|
||||
public static enum WaypointType {
|
||||
WAYPOINT, STATISTICS;
|
||||
}
|
||||
|
||||
private long id = -1L;
|
||||
private String name = "";
|
||||
private String description = "";
|
||||
private String category = "";
|
||||
private String icon = "";
|
||||
private long trackId = -1L;
|
||||
private WaypointType type = WaypointType.WAYPOINT;
|
||||
private double length = 0.0;
|
||||
private long duration = 0;
|
||||
private long startId = -1L;
|
||||
private long stopId = -1L;
|
||||
private Location location = null;
|
||||
private TripStatistics tripStatistics = null;
|
||||
private String photoUrl = "";
|
||||
|
||||
public Waypoint() {}
|
||||
|
||||
public Waypoint(String name, String description, String category, String icon, long trackId,
|
||||
WaypointType type, double length, long duration, long startId, long stopId, Location location,
|
||||
TripStatistics tripStatistics, String photoUrl) {
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.category = category;
|
||||
this.icon = icon;
|
||||
this.trackId = trackId;
|
||||
this.type = type;
|
||||
this.length = length;
|
||||
this.duration = duration;
|
||||
this.startId = startId;
|
||||
this.stopId = stopId;
|
||||
this.location = location;
|
||||
this.tripStatistics = tripStatistics;
|
||||
this.photoUrl = photoUrl;
|
||||
}
|
||||
|
||||
private Waypoint(Parcel source) {
|
||||
id = source.readLong();
|
||||
name = source.readString();
|
||||
description = source.readString();
|
||||
category = source.readString();
|
||||
icon = source.readString();
|
||||
trackId = source.readLong();
|
||||
type = WaypointType.values()[source.readInt()];
|
||||
length = source.readDouble();
|
||||
duration = source.readLong();
|
||||
startId = source.readLong();
|
||||
stopId = source.readLong();
|
||||
|
||||
ClassLoader classLoader = getClass().getClassLoader();
|
||||
byte hasLocation = source.readByte();
|
||||
if (hasLocation > 0) {
|
||||
location = source.readParcelable(classLoader);
|
||||
}
|
||||
byte hasStats = source.readByte();
|
||||
if (hasStats > 0) {
|
||||
tripStatistics = source.readParcelable(classLoader);
|
||||
}
|
||||
photoUrl = source.readString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeLong(id);
|
||||
dest.writeString(name);
|
||||
dest.writeString(description);
|
||||
dest.writeString(category);
|
||||
dest.writeString(icon);
|
||||
dest.writeLong(trackId);
|
||||
dest.writeInt(type.ordinal());
|
||||
dest.writeDouble(length);
|
||||
dest.writeLong(duration);
|
||||
dest.writeLong(startId);
|
||||
dest.writeLong(stopId);
|
||||
dest.writeByte(location == null ? (byte) 0 : (byte) 1);
|
||||
if (location != null) {
|
||||
dest.writeParcelable(location, 0);
|
||||
}
|
||||
dest.writeByte(tripStatistics == null ? (byte) 0 : (byte) 1);
|
||||
if (tripStatistics != null) {
|
||||
dest.writeParcelable(tripStatistics, 0);
|
||||
}
|
||||
dest.writeString(photoUrl);
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<Waypoint> CREATOR = new Parcelable.Creator<Waypoint>() {
|
||||
@Override
|
||||
public Waypoint createFromParcel(Parcel in) {
|
||||
return new Waypoint(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Waypoint[] newArray(int size) {
|
||||
return new Waypoint[size];
|
||||
}
|
||||
};
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getCategory() {
|
||||
return category;
|
||||
}
|
||||
|
||||
public void setCategory(String category) {
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
public String getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
public void setIcon(String icon) {
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
public long getTrackId() {
|
||||
return trackId;
|
||||
}
|
||||
|
||||
public void setTrackId(long trackId) {
|
||||
this.trackId = trackId;
|
||||
}
|
||||
|
||||
public WaypointType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(WaypointType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public double getLength() {
|
||||
return length;
|
||||
}
|
||||
|
||||
public void setLength(double length) {
|
||||
this.length = length;
|
||||
}
|
||||
|
||||
public long getDuration() {
|
||||
return duration;
|
||||
}
|
||||
|
||||
public void setDuration(long duration) {
|
||||
this.duration = duration;
|
||||
}
|
||||
|
||||
public long getStartId() {
|
||||
return startId;
|
||||
}
|
||||
|
||||
public void setStartId(long startId) {
|
||||
this.startId = startId;
|
||||
}
|
||||
|
||||
public long getStopId() {
|
||||
return stopId;
|
||||
}
|
||||
|
||||
public void setStopId(long stopId) {
|
||||
this.stopId = stopId;
|
||||
}
|
||||
|
||||
public Location getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public void setLocation(Location location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public TripStatistics getTripStatistics() {
|
||||
return tripStatistics;
|
||||
}
|
||||
|
||||
public void setTripStatistics(TripStatistics tripStatistics) {
|
||||
this.tripStatistics = tripStatistics;
|
||||
}
|
||||
|
||||
public String getPhotoUrl() {
|
||||
return photoUrl;
|
||||
}
|
||||
|
||||
public void setPhotoUrl(String photoUrl) {
|
||||
this.photoUrl = photoUrl;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
package com.google.android.apps.mytracks.content;
|
||||
parcelable WaypointCreationRequest;
|
||||
+126
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
* Copyright 2010 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
package com.google.android.apps.mytracks.content;
|
||||
|
||||
import com.google.android.apps.mytracks.content.Waypoint.WaypointType;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
/**
|
||||
* A request for the service to create a waypoint at the current location.
|
||||
*
|
||||
* @author Sandor Dornbush
|
||||
*/
|
||||
public class WaypointCreationRequest implements Parcelable {
|
||||
|
||||
private WaypointType type;
|
||||
// true if this marker contains the track statistics
|
||||
private boolean isTrackStatistics;
|
||||
private String name;
|
||||
private String category;
|
||||
private String description;
|
||||
private String iconUrl;
|
||||
private String photoUrl;
|
||||
|
||||
public final static WaypointCreationRequest DEFAULT_WAYPOINT = new WaypointCreationRequest(
|
||||
WaypointType.WAYPOINT, false);
|
||||
public final static WaypointCreationRequest DEFAULT_STATISTICS = new WaypointCreationRequest(
|
||||
WaypointType.STATISTICS, false);
|
||||
public final static WaypointCreationRequest DEFAULT_START_TRACK = new WaypointCreationRequest(
|
||||
WaypointType.STATISTICS, true);
|
||||
|
||||
private WaypointCreationRequest(WaypointType type, boolean isTrackStatistics) {
|
||||
this(type, isTrackStatistics, null, null, null, null, null);
|
||||
}
|
||||
|
||||
public WaypointCreationRequest(WaypointType type, boolean isTrackStatistics, String name,
|
||||
String category, String description, String iconUrl, String photoUrl) {
|
||||
this.type = type;
|
||||
this.isTrackStatistics = isTrackStatistics;
|
||||
this.name = name;
|
||||
this.category = category;
|
||||
this.description = description;
|
||||
this.iconUrl = iconUrl;
|
||||
this.photoUrl = photoUrl;
|
||||
}
|
||||
|
||||
public static class Creator implements Parcelable.Creator<WaypointCreationRequest> {
|
||||
|
||||
@Override
|
||||
public WaypointCreationRequest createFromParcel(Parcel source) {
|
||||
WaypointCreationRequest request = new WaypointCreationRequest(
|
||||
WaypointType.values()[source.readInt()],
|
||||
source.readByte() == 1,
|
||||
source.readString(),
|
||||
source.readString(),
|
||||
source.readString(),
|
||||
source.readString(),
|
||||
source.readString());
|
||||
return request;
|
||||
}
|
||||
|
||||
public WaypointCreationRequest[] newArray(int size) {
|
||||
return new WaypointCreationRequest[size];
|
||||
}
|
||||
}
|
||||
|
||||
public static final Creator CREATOR = new Creator();
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel parcel, int arg1) {
|
||||
parcel.writeInt(type.ordinal());
|
||||
parcel.writeByte((byte) (isTrackStatistics ? 1 : 0));
|
||||
parcel.writeString(name);
|
||||
parcel.writeString(category);
|
||||
parcel.writeString(description);
|
||||
parcel.writeString(iconUrl);
|
||||
parcel.writeString(photoUrl);
|
||||
}
|
||||
|
||||
public WaypointType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public boolean isTrackStatistics() {
|
||||
return isTrackStatistics;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getCategory() {
|
||||
return category;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public String getIconUrl() {
|
||||
return iconUrl;
|
||||
}
|
||||
|
||||
public String getPhotoUrl() {
|
||||
return photoUrl;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
/*
|
||||
* Copyright 2009 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
|
||||
package com.google.android.apps.mytracks.content;
|
||||
|
||||
import static com.google.android.apps.mytracks.content.ContentTypeIds.FLOAT_TYPE_ID;
|
||||
import static com.google.android.apps.mytracks.content.ContentTypeIds.INT_TYPE_ID;
|
||||
import static com.google.android.apps.mytracks.content.ContentTypeIds.LONG_TYPE_ID;
|
||||
import static com.google.android.apps.mytracks.content.ContentTypeIds.STRING_TYPE_ID;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.provider.BaseColumns;
|
||||
|
||||
/**
|
||||
* Constants for waypoints table.
|
||||
*
|
||||
* @author Leif Hendrik Wilden
|
||||
*/
|
||||
public interface WaypointsColumns extends BaseColumns {
|
||||
|
||||
public static final String TABLE_NAME = "waypoints";
|
||||
public static final Uri CONTENT_URI = Uri.parse(
|
||||
"content://com.google.android.maps.mytracks/waypoints");
|
||||
public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.google.waypoint";
|
||||
public static final String CONTENT_ITEMTYPE = "vnd.android.cursor.item/vnd.google.waypoint";
|
||||
public static final String DEFAULT_SORT_ORDER = "_id";
|
||||
|
||||
// Columns
|
||||
public static final String NAME = "name"; // waypoint name
|
||||
public static final String DESCRIPTION = "description"; // waypoint description
|
||||
public static final String CATEGORY = "category"; // waypoint category
|
||||
public static final String ICON = "icon"; // waypoint icon
|
||||
public static final String TRACKID = "trackid"; // track id
|
||||
public static final String TYPE = "type"; // type
|
||||
public static final String LENGTH = "length"; // length of the track (without smoothing)
|
||||
public static final String DURATION = "duration"; // total duration of the track (not from last waypoint)
|
||||
public static final String STARTTIME = "starttime"; // start time of the trip statistics
|
||||
public static final String STARTID = "startid"; // start track point id
|
||||
public static final String STOPID = "stopid"; // stop track point id
|
||||
|
||||
public static final String LONGITUDE = "longitude"; // longitude
|
||||
public static final String LATITUDE = "latitude"; // latitude
|
||||
public static final String TIME = "time"; // time
|
||||
public static final String ALTITUDE = "elevation"; // altitude
|
||||
public static final String ACCURACY = "accuracy"; // accuracy
|
||||
public static final String SPEED = "speed"; // speed
|
||||
public static final String BEARING = "bearing"; // bearing
|
||||
|
||||
public static final String TOTALDISTANCE = "totaldistance"; // total distance
|
||||
public static final String TOTALTIME = "totaltime"; // total time
|
||||
public static final String MOVINGTIME = "movingtime"; // moving time
|
||||
public static final String AVGSPEED = "avgspeed"; // average speed
|
||||
public static final String AVGMOVINGSPEED = "avgmovingspeed"; // average moving speed
|
||||
public static final String MAXSPEED = "maxspeed"; // max speed
|
||||
public static final String MINELEVATION = "minelevation"; // min elevation
|
||||
public static final String MAXELEVATION = "maxelevation"; // max elevation
|
||||
public static final String ELEVATIONGAIN = "elevationgain"; // elevation gain
|
||||
public static final String MINGRADE = "mingrade"; // min grade
|
||||
public static final String MAXGRADE = "maxgrade"; // max grade
|
||||
|
||||
public static final String PHOTOURL = "photoUrl"; // url for the photo
|
||||
|
||||
public static final String CREATE_TABLE = "CREATE TABLE " + TABLE_NAME + " ("
|
||||
+ _ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
|
||||
+ NAME + " STRING, "
|
||||
+ DESCRIPTION + " STRING, "
|
||||
+ CATEGORY + " STRING, "
|
||||
+ ICON + " STRING, "
|
||||
+ TRACKID + " INTEGER, "
|
||||
+ TYPE + " INTEGER, "
|
||||
+ LENGTH + " FLOAT, "
|
||||
+ DURATION + " INTEGER, "
|
||||
+ STARTTIME + " INTEGER, "
|
||||
+ STARTID + " INTEGER, "
|
||||
+ STOPID + " INTEGER, "
|
||||
+ LONGITUDE + " INTEGER, "
|
||||
+ LATITUDE + " INTEGER, "
|
||||
+ TIME + " INTEGER, "
|
||||
+ ALTITUDE + " FLOAT, "
|
||||
+ ACCURACY + " FLOAT, "
|
||||
+ SPEED + " FLOAT, "
|
||||
+ BEARING + " FLOAT, "
|
||||
+ TOTALDISTANCE + " FLOAT, "
|
||||
+ TOTALTIME + " INTEGER, "
|
||||
+ MOVINGTIME + " INTEGER, "
|
||||
+ AVGSPEED + " FLOAT, "
|
||||
+ AVGMOVINGSPEED + " FLOAT, "
|
||||
+ MAXSPEED + " FLOAT, "
|
||||
+ MINELEVATION + " FLOAT, "
|
||||
+ MAXELEVATION + " FLOAT, "
|
||||
+ ELEVATIONGAIN + " FLOAT, "
|
||||
+ MINGRADE + " FLOAT, "
|
||||
+ MAXGRADE + " FLOAT, "
|
||||
+ PHOTOURL + " STRING"
|
||||
+ ");";
|
||||
|
||||
public static final String[] COLUMNS = {
|
||||
_ID,
|
||||
NAME,
|
||||
DESCRIPTION,
|
||||
CATEGORY,
|
||||
ICON,
|
||||
TRACKID,
|
||||
TYPE,
|
||||
LENGTH,
|
||||
DURATION,
|
||||
STARTTIME,
|
||||
STARTID,
|
||||
STOPID,
|
||||
LONGITUDE,
|
||||
LATITUDE,
|
||||
TIME,
|
||||
ALTITUDE,
|
||||
ACCURACY,
|
||||
SPEED,
|
||||
BEARING,
|
||||
TOTALDISTANCE,
|
||||
TOTALTIME,
|
||||
MOVINGTIME,
|
||||
AVGSPEED,
|
||||
AVGMOVINGSPEED,
|
||||
MAXSPEED,
|
||||
MINELEVATION,
|
||||
MAXELEVATION,
|
||||
ELEVATIONGAIN,
|
||||
MINGRADE,
|
||||
MAXGRADE,
|
||||
PHOTOURL
|
||||
};
|
||||
|
||||
public static final byte[] COLUMN_TYPES = {
|
||||
LONG_TYPE_ID, // id
|
||||
STRING_TYPE_ID, // name
|
||||
STRING_TYPE_ID, // description
|
||||
STRING_TYPE_ID, // category
|
||||
STRING_TYPE_ID, // icon
|
||||
LONG_TYPE_ID, // track id
|
||||
INT_TYPE_ID, // type
|
||||
FLOAT_TYPE_ID, // length
|
||||
LONG_TYPE_ID, // duration
|
||||
LONG_TYPE_ID, // start time
|
||||
LONG_TYPE_ID, // start id
|
||||
LONG_TYPE_ID, // stop id
|
||||
INT_TYPE_ID, // longitude
|
||||
INT_TYPE_ID, // latitude
|
||||
LONG_TYPE_ID, // time
|
||||
FLOAT_TYPE_ID, // altitude
|
||||
FLOAT_TYPE_ID, // accuracy
|
||||
FLOAT_TYPE_ID, // speed
|
||||
FLOAT_TYPE_ID, // bearing
|
||||
FLOAT_TYPE_ID, // total distance
|
||||
LONG_TYPE_ID, // total time
|
||||
LONG_TYPE_ID, // moving time
|
||||
FLOAT_TYPE_ID, // average speed
|
||||
FLOAT_TYPE_ID, // average moving speed
|
||||
FLOAT_TYPE_ID, // max speed
|
||||
FLOAT_TYPE_ID, // min elevation
|
||||
FLOAT_TYPE_ID, // max elevation
|
||||
FLOAT_TYPE_ID, // elevation gain
|
||||
FLOAT_TYPE_ID, // min grade
|
||||
FLOAT_TYPE_ID, // max grade
|
||||
STRING_TYPE_ID // photo url
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright 2010 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
package com.google.android.apps.mytracks.lib;
|
||||
|
||||
/**
|
||||
* Constants for the My Tracks common library.
|
||||
* These constants should ideally not be used by third-party applications.
|
||||
*
|
||||
* @author Rodrigo Damazio
|
||||
*/
|
||||
public class MyTracksLibConstants {
|
||||
public static final String TAG = "MyTracksLib";
|
||||
|
||||
private MyTracksLibConstants() {}
|
||||
}
|
||||
+114
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
* Copyright 2008 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
package com.google.android.apps.mytracks.services;
|
||||
|
||||
import com.google.android.apps.mytracks.content.WaypointCreationRequest;
|
||||
|
||||
/**
|
||||
* MyTracks service.
|
||||
* This service is the process that actually records and manages tracks.
|
||||
*/
|
||||
interface ITrackRecordingService {
|
||||
|
||||
/**
|
||||
* Starts gps.
|
||||
*/
|
||||
void startGps();
|
||||
|
||||
/**
|
||||
* Stops gps.
|
||||
*/
|
||||
void stopGps();
|
||||
|
||||
/**
|
||||
* Starts recording a new track.
|
||||
*
|
||||
* @return the track ID of the new track.
|
||||
*/
|
||||
long startNewTrack();
|
||||
|
||||
/**
|
||||
* Pauses the current recording track.
|
||||
*/
|
||||
void pauseCurrentTrack();
|
||||
|
||||
/**
|
||||
* Resumes the current recording track.
|
||||
*/
|
||||
void resumeCurrentTrack();
|
||||
|
||||
/**
|
||||
* Ends the current recording track.
|
||||
*/
|
||||
void endCurrentTrack();
|
||||
|
||||
/**
|
||||
* Returns true if currently recording a track.
|
||||
*/
|
||||
boolean isRecording();
|
||||
|
||||
/**
|
||||
* Returns true if the current recording track is paused. Returns true if not recording.
|
||||
*/
|
||||
boolean isPaused();
|
||||
|
||||
/**
|
||||
* Gets the current recording track ID. Returns -1 if not recording.
|
||||
*/
|
||||
long getRecordingTrackId();
|
||||
|
||||
/**
|
||||
* Gets the total time for the current recording track. Returns 0 if not recording.
|
||||
*/
|
||||
long getTotalTime();
|
||||
|
||||
/**
|
||||
* Inserts a waypoint in the current recording track.
|
||||
*
|
||||
* @param request the details of the waypoint to be inserted
|
||||
* @return the ID of the inserted waypoint
|
||||
*/
|
||||
long insertWaypoint(in WaypointCreationRequest request);
|
||||
|
||||
/**
|
||||
* Inserts a track point in the current recording track.
|
||||
*
|
||||
* When recording a track, GPS locations are automatically inserted. This is used for
|
||||
* inserting special track points or for testing.
|
||||
*
|
||||
* @param location the track point to be inserted
|
||||
*/
|
||||
void insertTrackPoint(in Location location);
|
||||
|
||||
/**
|
||||
* Gets the current sensor data. Returns null if there is no data.
|
||||
|
||||
* @return a byte array of the binary version of the Sensor.SensorDataSet object.
|
||||
*/
|
||||
byte[] getSensorData();
|
||||
|
||||
/**
|
||||
* Gets the current sensor manager state.
|
||||
*
|
||||
* return a Sensor.SensorState enum value.
|
||||
*/
|
||||
int getSensorState();
|
||||
|
||||
/**
|
||||
* Updates the calorie of current recording track.
|
||||
*/
|
||||
void updateCalorie();
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
* Copyright 2009 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
|
||||
package com.google.android.apps.mytracks.stats;
|
||||
|
||||
/**
|
||||
* A helper class that tracks a minimum and a maximum of a variable.
|
||||
*
|
||||
* @author Sandor Dornbush
|
||||
*/
|
||||
public class ExtremityMonitor {
|
||||
|
||||
// The smallest value seen so far.
|
||||
private double min;
|
||||
|
||||
// The largest value seen so far.
|
||||
private double max;
|
||||
|
||||
public ExtremityMonitor() {
|
||||
reset();
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets this object to it's initial state where the min and max are unknown.
|
||||
*/
|
||||
public void reset() {
|
||||
min = Double.POSITIVE_INFINITY;
|
||||
max = Double.NEGATIVE_INFINITY;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the minimum value seen.
|
||||
*/
|
||||
public double getMin() {
|
||||
return min;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the maximum value seen.
|
||||
*/
|
||||
public double getMax() {
|
||||
return max;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the min and the max with a new value.
|
||||
*
|
||||
* @param value the new value
|
||||
* @return true if an extremity was found
|
||||
*/
|
||||
public boolean update(double value) {
|
||||
boolean changed = false;
|
||||
if (value < min) {
|
||||
min = value;
|
||||
changed = true;
|
||||
}
|
||||
if (value > max) {
|
||||
max = value;
|
||||
changed = true;
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the minimum and maximum values.
|
||||
*
|
||||
* @param min the minimum value
|
||||
* @param max the maximum value
|
||||
*/
|
||||
public void set(double min, double max) {
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the minimum value.
|
||||
*
|
||||
* @param min the minimum value
|
||||
*/
|
||||
public void setMin(double min) {
|
||||
this.min = min;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the maximum value.
|
||||
*
|
||||
* @param max the maximum value
|
||||
*/
|
||||
public void setMax(double max) {
|
||||
this.max = max;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if has data.
|
||||
*/
|
||||
public boolean hasData() {
|
||||
return min != Double.POSITIVE_INFINITY && max != Double.NEGATIVE_INFINITY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Min: " + min + " Max: " + max;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
package com.google.android.apps.mytracks.stats;
|
||||
parcelable TripStatistics;
|
||||
@@ -0,0 +1,598 @@
|
||||
/*
|
||||
* Copyright 2010 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
|
||||
package com.google.android.apps.mytracks.stats;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
/**
|
||||
* Statistical data about a trip. The data in this class should be filled out by
|
||||
* TripStatisticsBuilder.
|
||||
* <p>
|
||||
* TODO: hashCode and equals
|
||||
*
|
||||
* @author Rodrigo Damazio
|
||||
*/
|
||||
public class TripStatistics implements Parcelable {
|
||||
|
||||
// The trip start time. This is the system time, might not match the GPs time.
|
||||
private long startTime = -1L;
|
||||
|
||||
// The trip stop time. This is the system time, might not match the GPS time.
|
||||
private long stopTime = -1L;
|
||||
|
||||
// The total trip distance (meters).
|
||||
private double totalDistance;
|
||||
|
||||
// The total time (ms). Updated when new points are received, may be stale.
|
||||
private long totalTime;
|
||||
|
||||
// The total moving time (ms). Based on when we believe the user is traveling.
|
||||
private long movingTime;
|
||||
|
||||
// The min and max latitude seen in this trip.
|
||||
private final ExtremityMonitor latitudeExtremities = new ExtremityMonitor();
|
||||
|
||||
// The min and max longitude seen in this trip.
|
||||
private final ExtremityMonitor longitudeExtremities = new ExtremityMonitor();
|
||||
|
||||
// The maximum speed (meters/second) that we believe is valid.
|
||||
private double maxSpeed;
|
||||
|
||||
// The min and max elevation (meters) seen on this trip.
|
||||
private final ExtremityMonitor elevationExtremities = new ExtremityMonitor();
|
||||
|
||||
// The total elevation gained (meters).
|
||||
private double totalElevationGain;
|
||||
|
||||
// The min and max grade seen on this trip.
|
||||
private final ExtremityMonitor gradeExtremities = new ExtremityMonitor();
|
||||
|
||||
// The calorie of current track.
|
||||
private double calorie = 0.0;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public TripStatistics() {}
|
||||
|
||||
/**
|
||||
* Copy constructor.
|
||||
*
|
||||
* @param other another statistics data object to copy from
|
||||
*/
|
||||
public TripStatistics(TripStatistics other) {
|
||||
startTime = other.startTime;
|
||||
stopTime = other.stopTime;
|
||||
totalDistance = other.totalDistance;
|
||||
totalTime = other.totalTime;
|
||||
movingTime = other.movingTime;
|
||||
latitudeExtremities.set(other.latitudeExtremities.getMin(), other.latitudeExtremities.getMax());
|
||||
longitudeExtremities.set(
|
||||
other.longitudeExtremities.getMin(), other.longitudeExtremities.getMax());
|
||||
maxSpeed = other.maxSpeed;
|
||||
elevationExtremities.set(
|
||||
other.elevationExtremities.getMin(), other.elevationExtremities.getMax());
|
||||
totalElevationGain = other.totalElevationGain;
|
||||
gradeExtremities.set(other.gradeExtremities.getMin(), other.gradeExtremities.getMax());
|
||||
calorie = other.calorie;
|
||||
}
|
||||
|
||||
/**
|
||||
* Combines these statistics with those from another object. This assumes that
|
||||
* the time periods covered by each do not intersect.
|
||||
*
|
||||
* @param other another statistics data object
|
||||
*/
|
||||
public void merge(TripStatistics other) {
|
||||
startTime = Math.min(startTime, other.startTime);
|
||||
stopTime = Math.max(stopTime, other.stopTime);
|
||||
totalDistance += other.totalDistance;
|
||||
totalTime += other.totalTime;
|
||||
movingTime += other.movingTime;
|
||||
if (other.latitudeExtremities.hasData()) {
|
||||
latitudeExtremities.update(other.latitudeExtremities.getMin());
|
||||
latitudeExtremities.update(other.latitudeExtremities.getMax());
|
||||
}
|
||||
if (other.longitudeExtremities.hasData()) {
|
||||
longitudeExtremities.update(other.longitudeExtremities.getMin());
|
||||
longitudeExtremities.update(other.longitudeExtremities.getMax());
|
||||
}
|
||||
maxSpeed = Math.max(maxSpeed, other.maxSpeed);
|
||||
if (other.elevationExtremities.hasData()) {
|
||||
elevationExtremities.update(other.elevationExtremities.getMin());
|
||||
elevationExtremities.update(other.elevationExtremities.getMax());
|
||||
}
|
||||
totalElevationGain += other.totalElevationGain;
|
||||
if (other.gradeExtremities.hasData()) {
|
||||
gradeExtremities.update(other.gradeExtremities.getMin());
|
||||
gradeExtremities.update(other.gradeExtremities.getMax());
|
||||
}
|
||||
calorie += other.calorie;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the trip start time. The number of milliseconds since epoch.
|
||||
*/
|
||||
public long getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the trip start time.
|
||||
*
|
||||
* @param startTime the trip start time in milliseconds since the epoch
|
||||
*/
|
||||
public void setStartTime(long startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the trip stop time. The number of milliseconds since epoch.
|
||||
*/
|
||||
public long getStopTime() {
|
||||
return stopTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the trip stop time.
|
||||
*
|
||||
* @param stopTime the stop time in milliseconds since the epoch
|
||||
*/
|
||||
public void setStopTime(long stopTime) {
|
||||
this.stopTime = stopTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the total distance the user traveled in meters.
|
||||
*/
|
||||
public double getTotalDistance() {
|
||||
return totalDistance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the total trip distance.
|
||||
*
|
||||
* @param totalDistance the trip distance in meters
|
||||
*/
|
||||
public void setTotalDistance(double totalDistance) {
|
||||
this.totalDistance = totalDistance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds to the current total distance.
|
||||
*
|
||||
* @param distance the distance to add in meters
|
||||
*/
|
||||
public void addTotalDistance(double distance) {
|
||||
totalDistance += distance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the total time in milliseconds that this track has been active. This
|
||||
* statistic is only updated when a new point is added to the statistics, so
|
||||
* it may be off. If you need to calculate the proper total time, use
|
||||
* {@link #getStartTime} with the current time.
|
||||
*/
|
||||
public long getTotalTime() {
|
||||
return totalTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the trip total time.
|
||||
*
|
||||
* @param totalTime the trip total time in milliseconds
|
||||
*/
|
||||
public void setTotalTime(long totalTime) {
|
||||
this.totalTime = totalTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the moving time in milliseconds.
|
||||
*/
|
||||
public long getMovingTime() {
|
||||
return movingTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the trip total moving time.
|
||||
*
|
||||
* @param movingTime the trip total moving time in milliseconds
|
||||
*/
|
||||
public void setMovingTime(long movingTime) {
|
||||
this.movingTime = movingTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds to the trip total moving time.
|
||||
*
|
||||
* @param time the time in milliseconds
|
||||
*/
|
||||
public void addMovingTime(long time) {
|
||||
movingTime += time;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the topmost position (highest latitude) of the track, in signed
|
||||
* degrees.
|
||||
*/
|
||||
public double getTopDegrees() {
|
||||
return latitudeExtremities.getMax();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the topmost position (highest latitude) of the track, in signed
|
||||
* millions of degrees.
|
||||
*/
|
||||
public int getTop() {
|
||||
return (int) (latitudeExtremities.getMax() * 1E6);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the bottommost position (lowest latitude) of the track, in signed
|
||||
* degrees.
|
||||
*/
|
||||
public double getBottomDegrees() {
|
||||
return latitudeExtremities.getMin();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the bottommost position (lowest latitude) of the track, in signed
|
||||
* millions of degrees.
|
||||
*/
|
||||
public int getBottom() {
|
||||
return (int) (latitudeExtremities.getMin() * 1E6);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the leftmost position (lowest longitude) of the track, in signed
|
||||
* degrees.
|
||||
*/
|
||||
public double getLeftDegrees() {
|
||||
return longitudeExtremities.getMin();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the leftmost position (lowest longitude) of the track, in signed
|
||||
* millions of degrees.
|
||||
*/
|
||||
public int getLeft() {
|
||||
return (int) (longitudeExtremities.getMin() * 1E6);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the rightmost position (highest longitude) of the track, in signed
|
||||
* degrees.
|
||||
*/
|
||||
public double getRightDegrees() {
|
||||
return longitudeExtremities.getMax();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the rightmost position (highest longitude) of the track, in signed
|
||||
* millions of degrees.
|
||||
*/
|
||||
public int getRight() {
|
||||
return (int) (longitudeExtremities.getMax() * 1E6);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the mean latitude position of the track, in signed degrees.
|
||||
*/
|
||||
public double getMeanLatitude() {
|
||||
return (getBottomDegrees() + getTopDegrees()) / 2.0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the mean longitude position of the track, in signed degrees.
|
||||
*/
|
||||
public double getMeanLongitude() {
|
||||
return (getLeftDegrees() + getRightDegrees()) / 2.0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the bounding box for this trip. The unit for all parameters is signed
|
||||
* millions of degree (degrees * 1E6).
|
||||
*
|
||||
* @param leftE6 the leftmost longitude reached
|
||||
* @param topE6 the topmost latitude reached
|
||||
* @param rightE6 the rightmost longitude reached
|
||||
* @param bottomE6 the bottommost latitude reached
|
||||
*/
|
||||
public void setBounds(int leftE6, int topE6, int rightE6, int bottomE6) {
|
||||
latitudeExtremities.set(bottomE6 / 1E6, topE6 / 1E6);
|
||||
longitudeExtremities.set(leftE6 / 1E6, rightE6 / 1E6);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates a new latitude value.
|
||||
*
|
||||
* @param latitude the latitude value in signed decimal degrees
|
||||
*/
|
||||
public void updateLatitudeExtremities(double latitude) {
|
||||
latitudeExtremities.update(latitude);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates a new longitude value.
|
||||
*
|
||||
* @param longitude the longitude value in signed decimal degrees
|
||||
*/
|
||||
public void updateLongitudeExtremities(double longitude) {
|
||||
longitudeExtremities.update(longitude);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the average speed in meters/second. This calculation only takes into
|
||||
* account the displacement until the last point that was accounted for in
|
||||
* statistics.
|
||||
*/
|
||||
public double getAverageSpeed() {
|
||||
if (totalTime == 0L) {
|
||||
return 0.0;
|
||||
}
|
||||
return totalDistance / ((double) totalTime / 1000.0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the average moving speed in meters/second.
|
||||
*/
|
||||
public double getAverageMovingSpeed() {
|
||||
if (movingTime == 0L) {
|
||||
return 0.0;
|
||||
}
|
||||
return totalDistance / ((double) movingTime / 1000.0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the maximum speed in meters/second.
|
||||
*/
|
||||
public double getMaxSpeed() {
|
||||
return Math.max(maxSpeed, getAverageMovingSpeed());
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the maximum speed.
|
||||
*
|
||||
* @param maxSpeed the maximum speed in meters/second
|
||||
*/
|
||||
public void setMaxSpeed(double maxSpeed) {
|
||||
this.maxSpeed = maxSpeed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the minimum elevation. This is calculated from the smoothed elevation
|
||||
* so this can actually be more than the current elevation.
|
||||
*/
|
||||
public double getMinElevation() {
|
||||
return elevationExtremities.getMin();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the minimum elevation.
|
||||
*
|
||||
* @param elevation the minimum elevation in meters
|
||||
*/
|
||||
public void setMinElevation(double elevation) {
|
||||
elevationExtremities.setMin(elevation);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the maximum elevation. This is calculated from the smoothed elevation
|
||||
* so this can actually be less than the current elevation.
|
||||
*/
|
||||
public double getMaxElevation() {
|
||||
return elevationExtremities.getMax();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the maximum elevation.
|
||||
*
|
||||
* @param elevation the maximum elevation in meters
|
||||
*/
|
||||
public void setMaxElevation(double elevation) {
|
||||
elevationExtremities.setMax(elevation);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates a new elevation.
|
||||
*
|
||||
* @param elevation the elevation value in meters
|
||||
*/
|
||||
public void updateElevationExtremities(double elevation) {
|
||||
elevationExtremities.update(elevation);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the total elevation gain in meters. This is calculated as the sum of
|
||||
* all positive differences in the smoothed elevation.
|
||||
*/
|
||||
public double getTotalElevationGain() {
|
||||
return totalElevationGain;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the total elevation gain.
|
||||
*
|
||||
* @param totalElevationGain the elevation gain in meters
|
||||
*/
|
||||
public void setTotalElevationGain(double totalElevationGain) {
|
||||
this.totalElevationGain = totalElevationGain;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds to the total elevation gain.
|
||||
*
|
||||
* @param gain the elevation gain in meters
|
||||
*/
|
||||
public void addTotalElevationGain(double gain) {
|
||||
totalElevationGain += gain;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the minimum grade for this trip.
|
||||
*/
|
||||
public double getMinGrade() {
|
||||
return gradeExtremities.getMin();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the maximum grade.
|
||||
*
|
||||
* @param grade the grade as a fraction (1.0 would mean vertical upwards)
|
||||
*/
|
||||
public void setMaxGrade(double grade) {
|
||||
gradeExtremities.setMax(grade);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the maximum grade for this trip.
|
||||
*/
|
||||
public double getMaxGrade() {
|
||||
return gradeExtremities.getMax();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the minimum grade.
|
||||
*
|
||||
* @param grade the grade as a fraction (-1.0 would mean vertical downwards)
|
||||
*/
|
||||
public void setMinGrade(double grade) {
|
||||
gradeExtremities.setMin(grade);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates a new grade value.
|
||||
*
|
||||
* @param grade the grade value as a fraction
|
||||
*/
|
||||
public void updateGradeExtremities(double grade) {
|
||||
gradeExtremities.update(grade);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TripStatistics { Start Time: " + getStartTime() + "; Stop Time: " + getStopTime()
|
||||
+ "; Total Distance: " + getTotalDistance() + "; Total Time: " + getTotalTime()
|
||||
+ "; Moving Time: " + getMovingTime() + "; Min Latitude: " + getBottomDegrees()
|
||||
+ "; Max Latitude: " + getTopDegrees() + "; Min Longitude: " + getLeftDegrees()
|
||||
+ "; Max Longitude: " + getRightDegrees() + "; Max Speed: " + getMaxSpeed()
|
||||
+ "; Min Elevation: " + getMinElevation() + "; Max Elevation: " + getMaxElevation()
|
||||
+ "; Elevation Gain: " + getTotalElevationGain() + "; Min Grade: " + getMinGrade()
|
||||
+ "; Max Grade: " + getMaxGrade() + "; Calorie: " + getCalorie()
|
||||
+ "}";
|
||||
}
|
||||
|
||||
/**
|
||||
* Creator of statistics data from parcels.
|
||||
*/
|
||||
public static class Creator implements Parcelable.Creator<TripStatistics> {
|
||||
|
||||
@Override
|
||||
public TripStatistics createFromParcel(Parcel source) {
|
||||
TripStatistics data = new TripStatistics();
|
||||
|
||||
data.startTime = source.readLong();
|
||||
data.stopTime = source.readLong();
|
||||
data.totalDistance = source.readDouble();
|
||||
data.totalTime = source.readLong();
|
||||
data.movingTime = source.readLong();
|
||||
|
||||
double minLat = source.readDouble();
|
||||
double maxLat = source.readDouble();
|
||||
data.latitudeExtremities.set(minLat, maxLat);
|
||||
|
||||
double minLong = source.readDouble();
|
||||
double maxLong = source.readDouble();
|
||||
data.longitudeExtremities.set(minLong, maxLong);
|
||||
|
||||
data.maxSpeed = source.readDouble();
|
||||
|
||||
double minElev = source.readDouble();
|
||||
double maxElev = source.readDouble();
|
||||
data.elevationExtremities.set(minElev, maxElev);
|
||||
data.totalElevationGain = source.readDouble();
|
||||
|
||||
double minGrade = source.readDouble();
|
||||
double maxGrade = source.readDouble();
|
||||
data.gradeExtremities.set(minGrade, maxGrade);
|
||||
|
||||
data.calorie = source.readDouble();
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TripStatistics[] newArray(int size) {
|
||||
return new TripStatistics[size];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creator of {@link TripStatistics} from parcels.
|
||||
*/
|
||||
public static final Creator CREATOR = new Creator();
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeLong(startTime);
|
||||
dest.writeLong(stopTime);
|
||||
dest.writeDouble(totalDistance);
|
||||
dest.writeLong(totalTime);
|
||||
dest.writeLong(movingTime);
|
||||
dest.writeDouble(latitudeExtremities.getMin());
|
||||
dest.writeDouble(latitudeExtremities.getMax());
|
||||
dest.writeDouble(longitudeExtremities.getMin());
|
||||
dest.writeDouble(longitudeExtremities.getMax());
|
||||
dest.writeDouble(maxSpeed);
|
||||
dest.writeDouble(elevationExtremities.getMin());
|
||||
dest.writeDouble(elevationExtremities.getMax());
|
||||
dest.writeDouble(totalElevationGain);
|
||||
dest.writeDouble(gradeExtremities.getMin());
|
||||
dest.writeDouble(gradeExtremities.getMax());
|
||||
dest.writeDouble(calorie);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds calorie value.
|
||||
*
|
||||
* @param calorieAdded add the value to the total calorie
|
||||
*/
|
||||
public void addCalorie(double calorieAdded) {
|
||||
calorie += calorieAdded;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets calorie value.
|
||||
*
|
||||
* @param calorie the new value of calorie
|
||||
*/
|
||||
public void setCalorie(double calorie) {
|
||||
this.calorie = calorie;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets calorie value.
|
||||
*/
|
||||
public double getCalorie() {
|
||||
return calorie;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,274 @@
|
||||
/*
|
||||
* Copyright 2010 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
package com.google.android.apps.mytracks.util;
|
||||
|
||||
import android.os.Environment;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* Utilities for dealing with files.
|
||||
*
|
||||
* @author Rodrigo Damazio
|
||||
*/
|
||||
public class FileUtils {
|
||||
|
||||
private FileUtils() {}
|
||||
|
||||
/**
|
||||
* The backups directory under the My Tracks external storage directory.
|
||||
*/
|
||||
public static final String BACKUPS_DIR = "backups";
|
||||
|
||||
/**
|
||||
* The pictures directory under the My Tracks external storage directory.
|
||||
*/
|
||||
public static final String PICTURES_DIR = "pictures";
|
||||
|
||||
/**
|
||||
* The My Tracks external storage directory.
|
||||
*/
|
||||
static final String SDCARD_TOP_DIR = "MyTracks";
|
||||
|
||||
/**
|
||||
* The maximum FAT32 path length. See the FAT32 spec at
|
||||
* http://msdn.microsoft.com/en-us/windows/hardware/gg463080
|
||||
*/
|
||||
static final int MAX_FAT32_PATH_LENGTH = 260;
|
||||
|
||||
/**
|
||||
* The play tracks directory under the My Tracks cache directory.
|
||||
*/
|
||||
public static final String PLAY_TRACKS_DIR = "temp";
|
||||
|
||||
/**
|
||||
* The temp files directory under the My Tracks cache directory.
|
||||
*/
|
||||
public static final String TEMP_FILES_DIR = "temp_files";
|
||||
|
||||
/**
|
||||
* Returns true if the external storage is available.
|
||||
*/
|
||||
public static boolean isExternalStorageAvailable() {
|
||||
String state = Environment.getExternalStorageState();
|
||||
return Environment.MEDIA_MOUNTED.equals(state)
|
||||
|| Environment.MEDIA_MOUNTED_READ_ONLY.equals(state);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the external storage is writable.
|
||||
*/
|
||||
public static boolean isExternalStorageWriteable() {
|
||||
String state = Environment.getExternalStorageState();
|
||||
return Environment.MEDIA_MOUNTED.equals(state);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the directory exists.
|
||||
*
|
||||
* @param dir the directory
|
||||
*/
|
||||
public static boolean isDirectory(File dir) {
|
||||
return dir.exists() && dir.isDirectory();
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures the directory exists by creating it and its parents if necessary.
|
||||
*
|
||||
* @return whether the directory exists (either already existed or was
|
||||
* successfully created)
|
||||
*/
|
||||
public static boolean ensureDirectoryExists(File dir) {
|
||||
if (isDirectory(dir)) {
|
||||
return true;
|
||||
}
|
||||
return dir.mkdirs();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the display name for a path on the external storage.
|
||||
*
|
||||
* @param components the components
|
||||
*/
|
||||
public static String getPathDisplayName(String... components) {
|
||||
StringBuilder dirNameBuilder = new StringBuilder();
|
||||
dirNameBuilder.append(File.separatorChar);
|
||||
dirNameBuilder.append(SDCARD_TOP_DIR);
|
||||
for (String component : components) {
|
||||
dirNameBuilder.append(File.separatorChar);
|
||||
dirNameBuilder.append(component);
|
||||
}
|
||||
return dirNameBuilder.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a path on the external storage.
|
||||
*
|
||||
* @param components the components
|
||||
*/
|
||||
public static String getPath(String... components) {
|
||||
StringBuilder dirNameBuilder = new StringBuilder();
|
||||
dirNameBuilder.append(Environment.getExternalStorageDirectory());
|
||||
dirNameBuilder.append(getPathDisplayName(components));
|
||||
return dirNameBuilder.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a filename with the given base name (prefix) and the given
|
||||
* extension, possibly adding a suffix to ensure the file doesn't exist.
|
||||
*
|
||||
* @param directory the directory the file will live in
|
||||
* @param fileBaseName the prefix for the file name
|
||||
* @param extension the file's extension
|
||||
* @return the complete file name, without the directory
|
||||
*/
|
||||
public static synchronized String buildUniqueFileName(
|
||||
File directory, String fileBaseName, String extension) {
|
||||
return buildUniqueFileName(directory, fileBaseName, extension, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name from a file name, without the extension.
|
||||
*
|
||||
* @param fileName the file name
|
||||
*/
|
||||
public static String getName(String fileName) {
|
||||
int index = fileName.lastIndexOf('.');
|
||||
if (index == -1) {
|
||||
return fileName;
|
||||
}
|
||||
return fileName.substring(0, index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the extension from a file name. Returns null if there is no extension.
|
||||
*
|
||||
* @param fileName the file name
|
||||
*/
|
||||
public static String getExtension(String fileName) {
|
||||
int index = fileName.lastIndexOf('.');
|
||||
if (index == -1) {
|
||||
return null;
|
||||
}
|
||||
return fileName.substring(index + 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a filename with the given base and the given extension, possibly
|
||||
* adding a suffix to ensure the file doesn't exist.
|
||||
*
|
||||
* @param directory the directory the filename will be located in
|
||||
* @param base the base for the filename
|
||||
* @param extension the extension for the filename
|
||||
* @param suffix the first numeric suffix to try to use, or 0 for none
|
||||
* @return the complete filename, without the directory
|
||||
*/
|
||||
private static String buildUniqueFileName(
|
||||
File directory, String base, String extension, int suffix) {
|
||||
String suffixName = "";
|
||||
if (suffix > 0) {
|
||||
suffixName += "(" + Integer.toString(suffix) + ")";
|
||||
}
|
||||
suffixName += "." + extension;
|
||||
|
||||
String baseName = sanitizeFileName(base);
|
||||
baseName = truncateFileName(directory, baseName, suffixName);
|
||||
String fullName = baseName + suffixName;
|
||||
|
||||
if (!new File(directory, fullName).exists()) {
|
||||
return fullName;
|
||||
}
|
||||
return buildUniqueFileName(directory, base, extension, suffix + 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitizes the name as a valid fat32 filename. For simplicity, fat32
|
||||
* filename characters may be any combination of letters, digits, or
|
||||
* characters with code point values greater than 127. Replaces the invalid
|
||||
* characters with "_" and collapses multiple "_" together.
|
||||
*
|
||||
* @param name name
|
||||
*/
|
||||
static String sanitizeFileName(String name) {
|
||||
StringBuffer buffer = new StringBuffer(name.length());
|
||||
for (int i = 0; i < name.length(); i++) {
|
||||
int codePoint = name.codePointAt(i);
|
||||
char character = name.charAt(i);
|
||||
if (Character.isLetterOrDigit(character) || codePoint > 127 || isSpecialFat32(character)) {
|
||||
buffer.appendCodePoint(codePoint);
|
||||
} else {
|
||||
buffer.append("_");
|
||||
}
|
||||
}
|
||||
String result = buffer.toString();
|
||||
return result.replaceAll("_+", "_");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if it is a special FAT32 character.
|
||||
*
|
||||
* @param character the character
|
||||
*/
|
||||
private static boolean isSpecialFat32(char character) {
|
||||
switch (character) {
|
||||
case '$':
|
||||
case '%':
|
||||
case '\'':
|
||||
case '-':
|
||||
case '_':
|
||||
case '@':
|
||||
case '~':
|
||||
case '`':
|
||||
case '!':
|
||||
case '(':
|
||||
case ')':
|
||||
case '{':
|
||||
case '}':
|
||||
case '^':
|
||||
case '#':
|
||||
case '&':
|
||||
case '+':
|
||||
case ',':
|
||||
case ';':
|
||||
case '=':
|
||||
case '[':
|
||||
case ']':
|
||||
case ' ':
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Truncates the name if necessary so the filename path length (directory +
|
||||
* name + suffix) meets the Fat32 path limit.
|
||||
*
|
||||
* @param directory directory
|
||||
* @param name name
|
||||
* @param suffix suffix
|
||||
*/
|
||||
static String truncateFileName(File directory, String name, String suffix) {
|
||||
// 1 at the end accounts for the FAT32 filename trailing NUL character
|
||||
int requiredLength = directory.getPath().length() + suffix.length() + 1;
|
||||
if (name.length() + requiredLength > MAX_FAT32_PATH_LENGTH) {
|
||||
int limit = MAX_FAT32_PATH_LENGTH - requiredLength;
|
||||
return name.substring(0, limit);
|
||||
} else {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user