# HG changeset patch
# User nikita@nikita-lab
# Date 1245504522 -7200
# Node ID cc4c230b5bd2aef8bd2f239fb2e01a72f0e59fd8
# Parent 17422d221dc1ddcbfa07c23f0931aebca0f393f3# Parent 7c67ea0a501c7b399f4ed4bd022a1c518112c796
merge
diff -r 17422d221dc1 -r cc4c230b5bd2 .settings/org.eclipse.jdt.core.prefs
--- a/.settings/org.eclipse.jdt.core.prefs Sat Jun 20 15:27:14 2009 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,337 +0,0 @@
-#Tue May 26 10:33:43 CEST 2009
-eclipse.preferences.version=1
-org.eclipse.jdt.core.builder.cleanOutputFolder=clean
-org.eclipse.jdt.core.builder.duplicateResourceTask=warning
-org.eclipse.jdt.core.builder.invalidClasspath=abort
-org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore
-org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
-org.eclipse.jdt.core.circularClasspath=error
-org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
-org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.6
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.maxProblemPerUnit=100
-org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
-org.eclipse.jdt.core.compiler.problem.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.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
-org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
-org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=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=ignore
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=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=ignore
-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.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=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.unusedImport=ignore
-org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
-org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
-org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
-org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.6
-org.eclipse.jdt.core.formatter.align_type_members_on_columns=true
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=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_compact_if=16
-org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
-org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
-org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
-org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
-org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=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=1
-org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
-org.eclipse.jdt.core.formatter.blank_lines_before_method=1
-org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
-org.eclipse.jdt.core.formatter.blank_lines_before_package=0
-org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
-org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
-org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=true
-org.eclipse.jdt.core.formatter.comment.format_block_comments=true
-org.eclipse.jdt.core.formatter.comment.format_header=true
-org.eclipse.jdt.core.formatter.comment.format_html=true
-org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
-org.eclipse.jdt.core.formatter.comment.format_line_comments=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=insert
-org.eclipse.jdt.core.formatter.comment.line_length=100
-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.format_guardian_clause_on_one_line=false
-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=false
-org.eclipse.jdt.core.formatter.indentation.size=4
-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_member=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_opening_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
-org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.lineSplit=120
-org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
-org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
-org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
-org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
-org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
-org.eclipse.jdt.core.formatter.tabulation.char=mixed
-org.eclipse.jdt.core.formatter.tabulation.size=8
-org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=true
-org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
-org.eclipse.jdt.core.incompatibleJDKLevel=ignore
-org.eclipse.jdt.core.incompleteClasspath=error
diff -r 17422d221dc1 -r cc4c230b5bd2 .settings/org.eclipse.jdt.ui.prefs
--- a/.settings/org.eclipse.jdt.ui.prefs Sat Jun 20 15:27:14 2009 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,109 +0,0 @@
-#Tue May 26 10:35:42 CEST 2009
-cleanup.add_default_serial_version_id=true
-cleanup.add_generated_serial_version_id=false
-cleanup.add_missing_annotations=true
-cleanup.add_missing_deprecated_annotations=true
-cleanup.add_missing_methods=false
-cleanup.add_missing_nls_tags=false
-cleanup.add_missing_override_annotations=true
-cleanup.add_serial_version_id=false
-cleanup.always_use_blocks=true
-cleanup.always_use_parentheses_in_expressions=false
-cleanup.always_use_this_for_non_static_field_access=false
-cleanup.always_use_this_for_non_static_method_access=false
-cleanup.convert_to_enhanced_for_loop=false
-cleanup.correct_indentation=false
-cleanup.format_source_code=true
-cleanup.format_source_code_changes_only=false
-cleanup.make_local_variable_final=true
-cleanup.make_parameters_final=false
-cleanup.make_private_fields_final=true
-cleanup.make_type_abstract_if_missing_method=false
-cleanup.make_variable_declarations_final=false
-cleanup.never_use_blocks=false
-cleanup.never_use_parentheses_in_expressions=true
-cleanup.organize_imports=true
-cleanup.qualify_static_field_accesses_with_declaring_class=false
-cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
-cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
-cleanup.qualify_static_member_accesses_with_declaring_class=true
-cleanup.qualify_static_method_accesses_with_declaring_class=false
-cleanup.remove_private_constructors=true
-cleanup.remove_trailing_whitespaces=true
-cleanup.remove_trailing_whitespaces_all=true
-cleanup.remove_trailing_whitespaces_ignore_empty=false
-cleanup.remove_unnecessary_casts=true
-cleanup.remove_unnecessary_nls_tags=true
-cleanup.remove_unused_imports=true
-cleanup.remove_unused_local_variables=false
-cleanup.remove_unused_private_fields=true
-cleanup.remove_unused_private_members=false
-cleanup.remove_unused_private_methods=true
-cleanup.remove_unused_private_types=true
-cleanup.sort_members=true
-cleanup.sort_members_all=false
-cleanup.use_blocks=false
-cleanup.use_blocks_only_for_return_and_throw=false
-cleanup.use_parentheses_in_expressions=false
-cleanup.use_this_for_non_static_field_access=false
-cleanup.use_this_for_non_static_field_access_only_if_necessary=true
-cleanup.use_this_for_non_static_method_access=false
-cleanup.use_this_for_non_static_method_access_only_if_necessary=true
-cleanup_profile=_beem
-cleanup_settings_version=2
-eclipse.preferences.version=1
-editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
-formatter_profile=_beem
-formatter_settings_version=11
-org.eclipse.jdt.ui.text.custom_code_templates=
-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_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=true
-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=true
-sp_cleanup.organize_imports=false
-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=true
-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=true
-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=true
-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
diff -r 17422d221dc1 -r cc4c230b5bd2 .settings/org.eclipse.ltk.core.refactoring.prefs
--- a/.settings/org.eclipse.ltk.core.refactoring.prefs Sat Jun 20 15:27:14 2009 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-#Tue May 26 10:03:53 CEST 2009
-eclipse.preferences.version=1
-org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false
diff -r 17422d221dc1 -r cc4c230b5bd2 AndroidManifest.xml
--- a/AndroidManifest.xml Sat Jun 20 15:27:14 2009 +0200
+++ b/AndroidManifest.xml Sat Jun 20 15:28:42 2009 +0200
@@ -3,10 +3,9 @@
package="com.beem.project.beem" android:versionCode="1"
android:versionName="1.0">
+ android:icon="@drawable/signal" android:theme="@style/Theme.BEEM.Default">
+ android:launchMode="singleTask">
@@ -14,17 +13,19 @@
-
-
+
+
-
+
-
-
-
-
-
-
+
+
+
+
+
+
diff -r 17422d221dc1 -r cc4c230b5bd2 res/layout/login.xml
--- a/res/layout/login.xml Sat Jun 20 15:27:14 2009 +0200
+++ b/res/layout/login.xml Sat Jun 20 15:28:42 2009 +0200
@@ -1,19 +1,15 @@
-
-
-
-
-
\ No newline at end of file
+
+
+
+
+
+
\ No newline at end of file
diff -r 17422d221dc1 -r cc4c230b5bd2 res/values/strings.xml
--- a/res/values/strings.xml Sat Jun 20 15:27:14 2009 +0200
+++ b/res/values/strings.xml Sat Jun 20 15:28:42 2009 +0200
@@ -69,6 +69,7 @@
Account created
+ Beem - Add contact
Login:
Alias:
Group:
@@ -78,6 +79,7 @@
+ Beem - Chat
%s says :\n
You say :\n
Tip text here
@@ -90,6 +92,7 @@
Type here your status message :
+ Beem - Change status
Add new contact
Beem Project
diff -r 17422d221dc1 -r cc4c230b5bd2 src/com/beem/project/beem/BeemApplication.java
--- a/src/com/beem/project/beem/BeemApplication.java Sat Jun 20 15:27:14 2009 +0200
+++ b/src/com/beem/project/beem/BeemApplication.java Sat Jun 20 15:28:42 2009 +0200
@@ -8,7 +8,6 @@
import android.app.Activity;
import android.app.Application;
-import android.app.ProgressDialog;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
@@ -31,114 +30,7 @@
*/
public class BeemApplication extends Application {
- /**
- * Connection listener use to hide the progress dialog.
- *
- * @author darisk
- */
- private class ConnectionListener extends IBeemConnectionListener.Stub {
-
- /**
- * Constructor.
- */
- public ConnectionListener() {
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void connectionClosed() throws RemoteException {
- Log.e(TAG, "Connection Close");
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void connectionClosedOnError() throws RemoteException {
- mBeemApp.mProgressDialog.setMessage("Connection closed on error");
- Log.e(TAG, "ConnectionClosedOnError");
- // TODO afficher une notification et reafficher le progress dialog
- }
-
- @Override
- public void connectionFailed(String errorMsg) throws RemoteException {
- Log.i(TAG, "Connection Failed");
- ConnectionRunnable cRun = new ConnectionRunnable(errorMsg);
- mBeemApp.mActivity.runOnUiThread(cRun);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void onConnect() throws RemoteException {
- // TODO Auto-generated method stub
- mProgressDialog.dismiss();
- // TODO recuperer les informations de status dans les preferences
- mFacade.changeStatus(Status.CONTACT_STATUS_AVAILABLE, null);
- synchronized (mQueue) {
- for (Message msg : mQueue) {
- msg.sendToTarget();
- }
- mQueue.clear();
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void reconnectingIn(int seconds) throws RemoteException {
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void reconnectionFailed() throws RemoteException {
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void reconnectionSuccessful() throws RemoteException {
- }
-
- }
-
- private class ConnectionRunnable implements Runnable {
-
- private String mErrorMsg;
-
- public ConnectionRunnable(String string) {
- this.mErrorMsg = string;
- }
-
- /**
- * @return the mErrorMsg
- */
- public String getMErrorMsg() {
- return mErrorMsg;
- }
-
- @Override
- public void run() {
- mBeemApp.mProgressDialog.setMessage(mErrorMsg);
- }
-
- /**
- * @param mErrorMsg
- * the mErrorMsg to set
- */
- public void setMErrorMsg(String mErrorMsg) {
- this.mErrorMsg = mErrorMsg;
- }
-
- }
-
+
private static final Intent SERVICE_INTENT = new Intent();
private static BeemApplication mBeemApp;
static {
@@ -157,16 +49,10 @@
mBeemApp = new BeemApplication();
}
mBeemApp.mActivity = activity;
- mBeemApp.mProgressDialog = new ProgressDialog(activity);
- mBeemApp.mProgressDialog.setTitle("Beem");
- mBeemApp.mProgressDialog.setIcon(R.drawable.signal);
- mBeemApp.mProgressDialog.setMessage("Connecting...");
- mBeemApp.mProgressDialog.setCancelable(true);
mBeemApp.mApplicationContext = activity.getApplication();
activity.getResources();
mBeemApp.onCreate();
- // mBeemApp.mProgressDialog.show();
return mBeemApp;
}
@@ -180,8 +66,6 @@
private IXmppConnection mConnection;
- private ProgressDialog mProgressDialog;
-
private final ConnectionListener mConnectionListener = new ConnectionListener();
private final ServiceConnection mServConn = new ServiceConnection() {
@@ -199,7 +83,6 @@
mApplicationContext
.startService(BeemApplication.SERVICE_INTENT);
} else {
- mProgressDialog.dismiss();
synchronized (mQueue) {
for (Message msg : mQueue) {
msg.sendToTarget();
@@ -223,7 +106,6 @@
* Constructor.
*/
public BeemApplication() {
- mIsConnected = false;
}
/**
@@ -296,4 +178,110 @@
}
}
+ /**
+ * Connection listener use to hide the progress dialog.
+ *
+ * @author darisk
+ */
+ private class ConnectionListener extends IBeemConnectionListener.Stub {
+
+ /**
+ * Constructor.
+ */
+ public ConnectionListener() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void connectionClosed() throws RemoteException {
+ Log.e(TAG, "Connection Close");
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void connectionClosedOnError() throws RemoteException {
+ Log.e(TAG, "ConnectionClosedOnError");
+ // TODO afficher une notification et reafficher le progress dialog
+ }
+
+ @Override
+ public void connectionFailed(String errorMsg) throws RemoteException {
+ Log.i(TAG, "Connection Failed");
+ ConnectionRunnable cRun = new ConnectionRunnable(errorMsg);
+ mBeemApp.mActivity.runOnUiThread(cRun);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void onConnect() throws RemoteException {
+ // TODO Auto-generated method stub
+ // TODO recuperer les informations de status dans les preferences
+ mFacade.changeStatus(Status.CONTACT_STATUS_AVAILABLE, null);
+ synchronized (mQueue) {
+ for (Message msg : mQueue) {
+ msg.sendToTarget();
+ }
+ mQueue.clear();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void reconnectingIn(int seconds) throws RemoteException {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void reconnectionFailed() throws RemoteException {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void reconnectionSuccessful() throws RemoteException {
+ }
+
+ }
+
+ private class ConnectionRunnable implements Runnable {
+
+ private String mErrorMsg;
+
+ public ConnectionRunnable(String string) {
+ this.mErrorMsg = string;
+ }
+
+ /**
+ * @return the mErrorMsg
+ */
+ public String getMErrorMsg() {
+ return mErrorMsg;
+ }
+
+ @Override
+ public void run() {
+ }
+
+ /**
+ * @param mErrorMsg
+ * the mErrorMsg to set
+ */
+ public void setMErrorMsg(String mErrorMsg) {
+ this.mErrorMsg = mErrorMsg;
+ }
+
+ }
+
+
}
diff -r 17422d221dc1 -r cc4c230b5bd2 src/com/beem/project/beem/BeemService.java
--- a/src/com/beem/project/beem/BeemService.java Sat Jun 20 15:27:14 2009 +0200
+++ b/src/com/beem/project/beem/BeemService.java Sat Jun 20 15:28:42 2009 +0200
@@ -10,6 +10,7 @@
import org.jivesoftware.smack.packet.Presence;
import org.jivesoftware.smack.proxy.ProxyInfo;
import org.jivesoftware.smack.proxy.ProxyInfo.ProxyType;
+
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
@@ -108,19 +109,19 @@
@Override
public void connectionClosed() throws RemoteException {
- // TODO Auto-generated method stub
+ Log.i("BeemService", "connectionClosed()");
}
@Override
public void connectionClosedOnError() throws RemoteException {
- // TODO Auto-generated method stub
+ Log.i("BeemService", "connectionClosedOnError()");
}
@Override
public void connectionFailed(String errorMsg) throws RemoteException {
- // TODO Auto-generated method stub
+ Log.i("BeemService", "connectionFailed()");
}
@@ -158,24 +159,24 @@
sendNotification(id, notif);
}
}, filter);
-
+ Log.i("BeemService", "onConnect()");
}
@Override
public void reconnectingIn(int seconds) throws RemoteException {
- // TODO Auto-generated method stub
+ Log.i("BeemService", "reconnectingIn()");
}
@Override
public void reconnectionFailed() throws RemoteException {
- // TODO Auto-generated method stub
+ Log.i("BeemService", "reconnectionFailed()");
}
@Override
public void reconnectionSuccessful() throws RemoteException {
- // TODO Auto-generated method stub
+ Log.i("BeemService", "reconnectionSuccessful()");
PacketFilter filter = new PacketFilter() {
@Override
@@ -227,10 +228,6 @@
mHost = mSettings.getString(getString(R.string.settings_key_xmpp_server), "");
mPort = Integer.parseInt(mSettings.getString(getString(R.string.settings_key_xmpp_port), "5222"));
- Log.i("BEEMSERVICE", mLogin);
- Log.i("BEEMSERVICE", mPassword);
- Log.i("BEEMSERVICE", mHost);
- Log.i("BEEMSERVICE", "" + mPort + "");
if (mHost.equals("talk.google.com"))
mService = "gmail.com";
else
diff -r 17422d221dc1 -r cc4c230b5bd2 src/com/beem/project/beem/service/BeemChatManager.java
--- a/src/com/beem/project/beem/service/BeemChatManager.java Sat Jun 20 15:27:14 2009 +0200
+++ b/src/com/beem/project/beem/service/BeemChatManager.java Sat Jun 20 15:28:42 2009 +0200
@@ -113,7 +113,7 @@
listener.processMessage(newchat, new com.beem.project.beem.service.Message(message));
}
mRemoteMessageListeners.finishBroadcast();
- if (!newchat.isOpen()) {
+ if (!newchat.isOpen() && message.getBody() != null) {
notifyNewChat(newchat);
}
} catch (RemoteException e) {
diff -r 17422d221dc1 -r cc4c230b5bd2 src/com/beem/project/beem/service/RosterAdapter.java
--- a/src/com/beem/project/beem/service/RosterAdapter.java Sat Jun 20 15:27:14 2009 +0200
+++ b/src/com/beem/project/beem/service/RosterAdapter.java Sat Jun 20 15:28:42 2009 +0200
@@ -181,7 +181,7 @@
* {@inheritDoc}
*/
@Override
- public void addConnectionListener(IBeemRosterListener listen) throws RemoteException {
+ public void addRosterListener(IBeemRosterListener listen) throws RemoteException {
if (listen != null)
mRemoteRosListeners.register(listen);
}
@@ -257,7 +257,7 @@
* {@inheritDoc}
*/
@Override
- public void removeConnectionListener(IBeemRosterListener listen) throws RemoteException {
+ public void removeRosterListener(IBeemRosterListener listen) throws RemoteException {
if (listen != null)
mRemoteRosListeners.unregister(listen);
}
diff -r 17422d221dc1 -r cc4c230b5bd2 src/com/beem/project/beem/service/XmppFacade.java
--- a/src/com/beem/project/beem/service/XmppFacade.java Sat Jun 20 15:27:14 2009 +0200
+++ b/src/com/beem/project/beem/service/XmppFacade.java Sat Jun 20 15:28:42 2009 +0200
@@ -58,7 +58,6 @@
mStatusNotification.defaults = Notification.DEFAULT_ALL;
mStatusNotification.flags = Notification.FLAG_NO_CLEAR;
- // mStatusNotification.contentView = ;
mStatusNotification.setLatestEventInfo(mBeemService, "Beem Status", text, PendingIntent.getActivity(
mBeemService, 0, new Intent(mBeemService, ChangeStatus.class), 0));
mBeemService.sendNotification(BeemService.NOTIFICATION_STATUS_ID, mStatusNotification);
diff -r 17422d221dc1 -r cc4c230b5bd2 src/com/beem/project/beem/service/aidl/IRoster.aidl
--- a/src/com/beem/project/beem/service/aidl/IRoster.aidl Sat Jun 20 15:27:14 2009 +0200
+++ b/src/com/beem/project/beem/service/aidl/IRoster.aidl Sat Jun 20 15:28:42 2009 +0200
@@ -18,7 +18,7 @@
List getGroupsNames();
- void addConnectionListener(in IBeemRosterListener listen);
- void removeConnectionListener(in IBeemRosterListener listen);
+ void addRosterListener(in IBeemRosterListener listen);
+ void removeRosterListener(in IBeemRosterListener listen);
}
\ No newline at end of file
diff -r 17422d221dc1 -r cc4c230b5bd2 src/com/beem/project/beem/ui/AddContact.java
--- a/src/com/beem/project/beem/ui/AddContact.java Sat Jun 20 15:27:14 2009 +0200
+++ b/src/com/beem/project/beem/ui/AddContact.java Sat Jun 20 15:28:42 2009 +0200
@@ -7,7 +7,11 @@
import java.util.List;
import android.app.Activity;
+import android.content.ComponentName;
+import android.content.Intent;
+import android.content.ServiceConnection;
import android.os.Bundle;
+import android.os.IBinder;
import android.os.RemoteException;
import android.view.View;
import android.view.View.OnClickListener;
@@ -15,7 +19,7 @@
import android.widget.EditText;
import android.widget.Toast;
-import com.beem.project.beem.BeemApplication;
+import com.beem.project.beem.BeemService;
import com.beem.project.beem.R;
import com.beem.project.beem.service.aidl.IXmppFacade;
@@ -24,55 +28,50 @@
*/
public class AddContact extends Activity {
- protected static final String TAG = "AddContact";
- private String mLogin;
- private String mAlias;
- private final List mGroup = new ArrayList();
- private IXmppFacade mService;
+ protected static final String TAG = "AddContact";
+ private String mLogin;
+ private String mAlias;
+ private final List mGroup = new ArrayList();
+ private IXmppFacade xmppFacade;
+ private final ServiceConnection mServConn = new BeemServiceConnection();
- private final OnClickListener mOkListener = new OnClickListener() {
+ private final OnClickListener mOkListener = new OnClickListener() {
- @Override
- public void onClick(View v) {
- boolean valid = true;
- if (getWidgetText(R.id.addc_login).length() == 0) {
- valid = false;
- } else {
- mLogin = getWidgetText(R.id.addc_login);
- }
- if (getWidgetText(R.id.addc_alias).length() == 0) {
- valid = false;
- } else {
- mAlias = getWidgetText(R.id.addc_alias);
- }
- if (getWidgetText(R.id.addc_group).length() == 0) {
- valid = false;
- } else {
- mGroup.add(getWidgetText(R.id.addc_group));
- }
- if (valid) {
- try {
- mService.getRoster().addContact(mLogin, mAlias,
- mGroup.toArray(new String[mGroup.size()]));
- Toast.makeText(AddContact.this,
- getString(R.string.AddCContactAdded),
- Toast.LENGTH_SHORT).show();
- finish();
- } catch (RemoteException e) {
- Toast.makeText(AddContact.this, e.getMessage(),
- Toast.LENGTH_SHORT).show();
- e.printStackTrace();
- }
- setResult(RESULT_OK);
- } else {
- Toast.makeText(AddContact.this,
- getString(R.string.AddCBadForm), Toast.LENGTH_SHORT)
- .show();
- setResult(RESULT_CANCELED);
- }
+ @Override
+ public void onClick(View v) {
+ boolean valid = true;
+ if (getWidgetText(R.id.addc_login).length() == 0) {
+ valid = false;
+ } else {
+ mLogin = getWidgetText(R.id.addc_login);
+ }
+ if (getWidgetText(R.id.addc_alias).length() == 0) {
+ valid = false;
+ } else {
+ mAlias = getWidgetText(R.id.addc_alias);
+ }
+ if (getWidgetText(R.id.addc_group).length() == 0) {
+ valid = false;
+ } else {
+ mGroup.add(getWidgetText(R.id.addc_group));
+ }
+ if (valid) {
+ try {
+ xmppFacade.getRoster().addContact(mLogin, mAlias, mGroup.toArray(new String[mGroup.size()]));
+ Toast.makeText(AddContact.this, getString(R.string.AddCContactAdded), Toast.LENGTH_SHORT).show();
+ finish();
+ } catch (RemoteException e) {
+ Toast.makeText(AddContact.this, e.getMessage(), Toast.LENGTH_SHORT).show();
+ e.printStackTrace();
+ }
+ setResult(RESULT_OK);
+ } else {
+ Toast.makeText(AddContact.this, getString(R.string.AddCBadForm), Toast.LENGTH_SHORT).show();
+ setResult(RESULT_CANCELED);
+ }
- }
- };
+ }
+ };
private String getWidgetText(int id) {
EditText widget = (EditText) this.findViewById(id);
@@ -85,6 +84,19 @@
setContentView(R.layout.addcontact);
Button ok = (Button) findViewById(R.id.addc_ok);
ok.setOnClickListener(mOkListener);
- mService = BeemApplication.getApplication(this).getXmppFacade();
+ bindService(new Intent(this, BeemService.class), mServConn, BIND_AUTO_CREATE);
+ }
+
+ private class BeemServiceConnection implements ServiceConnection {
+
+ @Override
+ public void onServiceConnected(ComponentName name, IBinder service) {
+ xmppFacade = IXmppFacade.Stub.asInterface(service);
+ }
+
+ @Override
+ public void onServiceDisconnected(ComponentName name) {
+ xmppFacade = null;
+ }
}
}
diff -r 17422d221dc1 -r cc4c230b5bd2 src/com/beem/project/beem/ui/ChangeStatus.java
--- a/src/com/beem/project/beem/ui/ChangeStatus.java Sat Jun 20 15:27:14 2009 +0200
+++ b/src/com/beem/project/beem/ui/ChangeStatus.java Sat Jun 20 15:28:42 2009 +0200
@@ -1,13 +1,14 @@
package com.beem.project.beem.ui;
import android.app.Activity;
+import android.content.ComponentName;
import android.content.Intent;
+import android.content.ServiceConnection;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.Bundle;
-import android.os.Handler;
+import android.os.IBinder;
import android.os.RemoteException;
-import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
@@ -16,7 +17,6 @@
import android.widget.TextView;
import android.widget.Toast;
-import com.beem.project.beem.BeemApplication;
import com.beem.project.beem.BeemService;
import com.beem.project.beem.R;
import com.beem.project.beem.service.aidl.IXmppFacade;
@@ -24,80 +24,26 @@
public class ChangeStatus extends Activity {
- private TextView mStatusText;
- private Button mOk;
- private Button mClear;
- private Handler mHandler;
- private BeemApplication mBeemApplication;
- private IXmppFacade mService = null;
- private Spinner mSpinner;
- private static final String[] STATUS = { "Available for chat", "Available", "Busy", "Away",
- "Unavailable", "Disconnected" };
- private static final int DISCONNECTED_IDX = 5;
- private static final int AVAILABLE_FOR_CHAT_IDX = 0;
- private static final int AVAILABLE_IDX = 1;
- private static final int BUSY_IDX = 2;
- private static final int AWAY_IDX = 3;
- private static final int UNAVAILABLE_IDX = 4;
- private SharedPreferences mSettings;
- private ArrayAdapter mAdapter;
- private Toast mToast;
- private static Integer nb = 0;
-
- private final OnClickListener mOnClickOk = new OnClickListener() {
-
- public void onClick(View v) {
- if (v == mOk) {
- if (textHasChanged() || statusHasChanged()) {
- String msg = mStatusText.getText().toString();
- int status = getStatusForService((String) mSpinner
- .getSelectedItem());
- Editor edit = mSettings.edit();
- edit
- .putString(
- getString(R.string.PreferenceStatusText),
- msg);
- edit.putInt(
- getString(R.string.PreferenceStatus),
- mSpinner.getSelectedItemPosition());
- edit.commit();
- if (status == Status.CONTACT_STATUS_DISCONNECT) {
- stopService(new Intent(ChangeStatus.this,
- BeemService.class));
- } else {
- try {
- mService.changeStatus(status, msg
- .toString());
- } catch (RemoteException e) {
- // TODO
- // Auto-generated
- // catch block
- e.printStackTrace();
- }
- mToast.show();
- }
- }
- ChangeStatus.this.finish();
- } else if (v == mClear) {
- mStatusText.setText(null);
- }
-
- }
-
- private boolean statusHasChanged() {
- return (mSettings.getInt(
- getString(R.string.PreferenceStatus), 0) != mSpinner
- .getSelectedItemPosition());
- }
-
- private boolean textHasChanged() {
- return (!mStatusText
- .getText()
- .toString()
- .equals(
- getPreferenceString(R.string.PreferenceStatusText)));
- }
- };
+ private TextView mStatusText;
+ private Toast mToast;
+ private Button mOk;
+ private Button mClear;
+ private Spinner mSpinner;
+
+ private static final String[] STATUS = { "Available for chat", "Available", "Busy", "Away", "Unavailable",
+ "Disconnected" };
+ private static final int DISCONNECTED_IDX = 5;
+ private static final int AVAILABLE_FOR_CHAT_IDX = 0;
+ private static final int AVAILABLE_IDX = 1;
+ private static final int BUSY_IDX = 2;
+ private static final int AWAY_IDX = 3;
+ private static final int UNAVAILABLE_IDX = 4;
+
+ private SharedPreferences mSettings;
+ private ArrayAdapter mAdapter;
+ private IXmppFacade xmppFacade = null;
+ private final ServiceConnection mServConn = new BeemServiceConnection();
+ private final OnClickListener mOnClickOk = new MyOnClickListener();
private int getPreferenceStatusIndex() {
return mSettings.getInt(getString(R.string.PreferenceStatus), 0);
@@ -113,21 +59,21 @@
String str = ChangeStatus.STATUS[i];
if (str.equals(item)) {
switch (i) {
- case ChangeStatus.DISCONNECTED_IDX:
- return Status.CONTACT_STATUS_DISCONNECT;
- case ChangeStatus.AVAILABLE_FOR_CHAT_IDX:
- return Status.CONTACT_STATUS_AVAILABLE_FOR_CHAT;
- case ChangeStatus.AVAILABLE_IDX:
- return Status.CONTACT_STATUS_AVAILABLE;
- case ChangeStatus.AWAY_IDX:
- return Status.CONTACT_STATUS_AWAY;
- case ChangeStatus.BUSY_IDX:
- return Status.CONTACT_STATUS_BUSY;
- case ChangeStatus.UNAVAILABLE_IDX:
- return Status.CONTACT_STATUS_UNAVAILABLE;
- default:
- res = Status.CONTACT_STATUS_AVAILABLE;
- break;
+ case ChangeStatus.DISCONNECTED_IDX:
+ return Status.CONTACT_STATUS_DISCONNECT;
+ case ChangeStatus.AVAILABLE_FOR_CHAT_IDX:
+ return Status.CONTACT_STATUS_AVAILABLE_FOR_CHAT;
+ case ChangeStatus.AVAILABLE_IDX:
+ return Status.CONTACT_STATUS_AVAILABLE;
+ case ChangeStatus.AWAY_IDX:
+ return Status.CONTACT_STATUS_AWAY;
+ case ChangeStatus.BUSY_IDX:
+ return Status.CONTACT_STATUS_BUSY;
+ case ChangeStatus.UNAVAILABLE_IDX:
+ return Status.CONTACT_STATUS_UNAVAILABLE;
+ default:
+ res = Status.CONTACT_STATUS_AVAILABLE;
+ break;
}
}
}
@@ -138,12 +84,6 @@
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- nb++;
- Log.i("nb de oncreate changestatus", nb.toString());
- // Beem Application specific
- mHandler = new Handler();
- mBeemApplication = BeemApplication.getApplication(this);
-
setContentView(R.layout.changestatus);
mStatusText = (TextView) findViewById(R.id.ChangeStatusText);
mOk = (Button) findViewById(R.id.ChangeStatusOk);
@@ -163,25 +103,13 @@
@Override
protected void onDestroy() {
super.onDestroy();
- mBeemApplication.unbindBeemService();
+ unbindService(mServConn);
}
@Override
protected void onResume() {
super.onResume();
- mBeemApplication.callWhenConnectedToServer(mHandler, new Runnable() {
-
- @Override
- public void run() {
- mService = mBeemApplication.getXmppFacade();
- }
- });
- }
-
- @Override
- protected void onStart() {
- super.onStart();
- mBeemApplication.startBeemService();
+ bindService(new Intent(this, BeemService.class), mServConn, BIND_AUTO_CREATE);
}
private void showSettings() {
@@ -189,4 +117,57 @@
mSpinner.setSelection(getPreferenceStatusIndex());
}
+ private class BeemServiceConnection implements ServiceConnection {
+
+ @Override
+ public void onServiceConnected(ComponentName name, IBinder service) {
+ xmppFacade = IXmppFacade.Stub.asInterface(service);
+ }
+
+ @Override
+ public void onServiceDisconnected(ComponentName name) {
+ xmppFacade = null;
+ }
+ }
+
+ private class MyOnClickListener implements OnClickListener {
+
+ @Override
+ public void onClick(View v) {
+ if (v == mOk) {
+ if (textHasChanged() || statusHasChanged()) {
+ String msg = mStatusText.getText().toString();
+ int status = getStatusForService((String) mSpinner.getSelectedItem());
+ Editor edit = mSettings.edit();
+ edit.putString(getString(R.string.PreferenceStatusText), msg);
+ edit.putInt(getString(R.string.PreferenceStatus), mSpinner.getSelectedItemPosition());
+ edit.commit();
+ if (status == Status.CONTACT_STATUS_DISCONNECT) {
+ stopService(new Intent(ChangeStatus.this, BeemService.class));
+ } else {
+ try {
+ xmppFacade.changeStatus(status, msg.toString());
+ } catch (RemoteException e) {
+ // TODO
+ // Auto-generated
+ // catch block
+ e.printStackTrace();
+ }
+ mToast.show();
+ }
+ }
+ ChangeStatus.this.finish();
+ } else if (v == mClear) {
+ mStatusText.setText(null);
+ }
+ }
+ private boolean statusHasChanged() {
+ return (mSettings.getInt(getString(R.string.PreferenceStatus), 0) != mSpinner.getSelectedItemPosition());
+ }
+
+ private boolean textHasChanged() {
+ return (!mStatusText.getText().toString().equals(getPreferenceString(R.string.PreferenceStatusText)));
+ }
+ }
+
}
diff -r 17422d221dc1 -r cc4c230b5bd2 src/com/beem/project/beem/ui/ContactDialog.java
--- a/src/com/beem/project/beem/ui/ContactDialog.java Sat Jun 20 15:27:14 2009 +0200
+++ b/src/com/beem/project/beem/ui/ContactDialog.java Sat Jun 20 15:28:42 2009 +0200
@@ -4,14 +4,18 @@
import android.app.Activity;
import android.app.Dialog;
+import android.app.Service;
+import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
+import android.content.ServiceConnection;
+import android.os.IBinder;
import android.os.RemoteException;
import android.util.Log;
import android.view.View;
import android.widget.Button;
-import com.beem.project.beem.BeemApplication;
+import com.beem.project.beem.BeemService;
import com.beem.project.beem.R;
import com.beem.project.beem.service.Contact;
import com.beem.project.beem.service.PresenceAdapter;
@@ -19,6 +23,34 @@
public class ContactDialog extends Dialog {
+ public static final String TAG = "Option Dialog";
+ private final Contact mContact;
+ private final Context mContext;
+ private IXmppFacade xmppFacade = null;
+ private final ServiceConnection mServConn = new BeemServiceConnection();
+
+ public ContactDialog(final Context context, Contact curContact) {
+ super(context);
+ mContext = context;
+
+ setContentView(R.layout.contactdialog);
+ mContact = curContact;
+ setTitle(curContact.getJID());
+
+ Button button = (Button) findViewById(R.id.CDChat);
+ button.setOnClickListener(new chatListener());
+ button = (Button) findViewById(R.id.CDAlias);
+ button.setOnClickListener(new aliasListener());
+ button = (Button) findViewById(R.id.CDGroup);
+ button.setOnClickListener(new groupListener());
+ button = (Button) findViewById(R.id.CDResend);
+ button.setOnClickListener(new resendListener());
+ button = (Button) findViewById(R.id.CDInfos);
+ button.setOnClickListener(new infosListener());
+
+ mContext.bindService(new Intent(mContext, BeemService.class), mServConn, Service.BIND_AUTO_CREATE);
+ }
+
class aliasListener implements View.OnClickListener {
@Override
@@ -38,7 +70,7 @@
public void onClick(View v) {
Activity a = ContactDialog.this.getOwnerActivity();
Intent i = new Intent(mContext, SendIM.class);
- i.putExtra("contact", mContact);
+ i.setData(mContact.toUri());
a.startActivity(i);
dismiss();
}
@@ -72,7 +104,7 @@
Presence presencePacket = new Presence(Presence.Type.subscribe);
presencePacket.setTo(mContact.getJID());
try {
- mService.sendPresencePacket(new PresenceAdapter(presencePacket));
+ xmppFacade.sendPresencePacket(new PresenceAdapter(presencePacket));
} catch (RemoteException e) {
Log.e(TAG, "resend subscription error", e);
}
@@ -81,36 +113,17 @@
}
- public static final String TAG = "Option Dialog";
-
- private Contact mContact;
-
- private Context mContext;
-
- private IXmppFacade mService;
-
- public ContactDialog(final Context context, Contact curContact) {
- super(context);
- mContext = context;
+ private class BeemServiceConnection implements ServiceConnection {
- setContentView(R.layout.contactdialog);
- mContact = curContact;
- setTitle(curContact.getJID());
+ @Override
+ public void onServiceConnected(ComponentName name, IBinder service) {
+ xmppFacade = IXmppFacade.Stub.asInterface(service);
+ }
- Button chat = (Button) findViewById(R.id.CDChat);
- chat.setOnClickListener(new chatListener());
- Button alias = (Button) findViewById(R.id.CDAlias);
- alias.setOnClickListener(new aliasListener());
- Button group = (Button) findViewById(R.id.CDGroup);
- group.setOnClickListener(new groupListener());
- Button resend = (Button) findViewById(R.id.CDResend);
- resend.setOnClickListener(new resendListener());
- Button infos = (Button) findViewById(R.id.CDInfos);
- infos.setOnClickListener(new infosListener());
- }
-
- public void initService() {
- mService = BeemApplication.getApplication(ContactDialog.this.getOwnerActivity()).getXmppFacade();
+ @Override
+ public void onServiceDisconnected(ComponentName name) {
+ xmppFacade = null;
+ }
}
}
diff -r 17422d221dc1 -r cc4c230b5bd2 src/com/beem/project/beem/ui/ContactList.java
--- a/src/com/beem/project/beem/ui/ContactList.java Sat Jun 20 15:27:14 2009 +0200
+++ b/src/com/beem/project/beem/ui/ContactList.java Sat Jun 20 15:28:42 2009 +0200
@@ -1,6 +1,8 @@
package com.beem.project.beem.ui;
import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -8,12 +10,14 @@
import org.jivesoftware.smack.util.StringUtils;
import android.app.ExpandableListActivity;
+import android.content.ComponentName;
import android.content.Intent;
-import android.content.SharedPreferences;
+import android.content.ServiceConnection;
import android.database.DataSetObserver;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Handler;
+import android.os.IBinder;
import android.os.RemoteException;
import android.util.Log;
import android.view.LayoutInflater;
@@ -28,7 +32,7 @@
import android.widget.ImageView;
import android.widget.TextView;
-import com.beem.project.beem.BeemApplication;
+import com.beem.project.beem.BeemService;
import com.beem.project.beem.R;
import com.beem.project.beem.service.Contact;
import com.beem.project.beem.service.PresenceAdapter;
@@ -39,6 +43,111 @@
public class ContactList extends ExpandableListActivity {
+ private static final String TAG = "CONTACTLIST_ACT";
+ private static final String DEFAULT_GROUP = "Default";
+ private MyExpandableListAdapter mAdapter;
+ private IRoster mRoster;
+ private Map> groupMap;
+ private List groupName;
+ private List mListContact;
+ private Handler mHandler;
+ private IXmppFacade xmppFacade = null;
+ private final ServiceConnection mServConn = new BeemServiceConnection();
+
+ /**
+ * Callback for menu creation.
+ * @param menu the menu created
+ * @return true on success, false otherwise
+ */
+ @Override
+ public final boolean onCreateOptionsMenu(Menu menu) {
+ super.onCreateOptionsMenu(menu);
+ MenuInflater inflater = getMenuInflater();
+ inflater.inflate(R.menu.contact_list, menu);
+ return true;
+ }
+
+ /**
+ * Callback for menu item selected.
+ * @param item the item selected
+ * @return true on success, false otherwise
+ */
+ @Override
+ public final boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case R.id.contact_list_menu_settings:
+ startActivity(new Intent(this, EditSettings.class));
+ return true;
+ case R.id.contact_list_menu_add_contact:
+ startActivity(new Intent(ContactList.this, AddContact.class));
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ @Override
+ protected void onCreate(Bundle saveBundle) {
+ super.onCreate(saveBundle);
+ bindService(new Intent(this, BeemService.class), mServConn, BIND_AUTO_CREATE);
+ mHandler = new Handler();
+ groupMap = new HashMap>();
+ groupName = new ArrayList();
+ }
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ unbindService(mServConn);
+ }
+
+ class ComparatorContactListByName implements Comparator {
+ @Override
+ public int compare(T c1, T c2) {
+ return ((Contact) c1).getName().compareToIgnoreCase(((Contact) c2).getName());
+ }
+ }
+
+ class ComparatorContactListByStatusAndName implements Comparator {
+ @Override
+ public int compare(T c1, T c2) {
+ if (((Contact) c1).getStatus() < ((Contact) c2).getStatus()) {
+ return 1;
+ } else if (((Contact) c1).getStatus() > ((Contact) c2).getStatus()) {
+ return -1;
+ } else
+ return ((Contact) c1).getName().compareToIgnoreCase(((Contact) c2).getName());
+ }
+ }
+
+ private void buildContactList(List listContact) {
+ mListContact = listContact;
+ Collections.sort(mListContact, new ComparatorContactListByStatusAndName());
+ for (Contact contact : mListContact) {
+ for (String group : contact.getGroups()) {
+ if (!groupMap.containsKey(group)) {
+ groupMap.put(group, new ArrayList());
+ groupName.add(group);
+ }
+ try {
+ if (!groupMap.get(group).contains(contact))
+ groupMap.get(group).add(contact);
+ } catch (NullPointerException e) {
+ Log.e(TAG, "Failed to find group in groupMap", e);
+ }
+ }
+ if (contact.getGroups().isEmpty()) {
+ if (!groupMap.containsKey(DEFAULT_GROUP)) {
+ groupMap.put(DEFAULT_GROUP, new ArrayList());
+ groupName.add(DEFAULT_GROUP);
+ }
+ groupMap.get(DEFAULT_GROUP).add(contact);
+ }
+ }
+ mAdapter = new MyExpandableListAdapter();
+ setListAdapter(mAdapter);
+ }
+
private class BeemRosterListener extends IBeemRosterListener.Stub {
@Override
@@ -57,13 +166,7 @@
}
}
}
- mHandler.post(new Runnable() {
-
- @Override
- public void run() {
- mAdapter.changed();
- }
- });
+ mHandler.post(new RunnableChange());
}
@Override
@@ -80,13 +183,7 @@
}
}
}
- mHandler.post(new Runnable() {
-
- @Override
- public void run() {
- mAdapter.changed();
- }
- });
+ mHandler.post(new RunnableChange());
}
@Override
@@ -113,13 +210,7 @@
}
}
}
- mHandler.post(new Runnable() {
-
- @Override
- public void run() {
- mAdapter.changed();
- }
- });
+ mHandler.post(new RunnableChange());
}
@Override
@@ -127,18 +218,19 @@
for (Contact curContact : mListContact) {
if (curContact.getJID().equals(StringUtils.parseBareAddress(presence.getFrom()))) {
curContact.setStatus(presence);
- mHandler.post(new Runnable() {
-
- @Override
- public void run() {
- mAdapter.changed();
- }
- });
+ mHandler.post(new RunnableChange());
return;
}
}
}
+ private class RunnableChange implements Runnable {
+ @Override
+ public void run() {
+ mAdapter.changed();
+ }
+ }
+
}
private class MyExpandableListAdapter implements ExpandableListAdapter {
@@ -192,27 +284,27 @@
ImageView imgV = (ImageView) view.findViewById(R.id.contactliststatus);
Drawable imageDrawable = null;
switch (curContact.getStatus()) {
- case Status.CONTACT_STATUS_AVAILABLE:
- imageDrawable = getResources().getDrawable(R.drawable.online);
- break;
- case Status.CONTACT_STATUS_AVAILABLE_FOR_CHAT:
- imageDrawable = getResources().getDrawable(R.drawable.chat);
- break;
- case Status.CONTACT_STATUS_AWAY:
- imageDrawable = getResources().getDrawable(R.drawable.away);
- break;
- case Status.CONTACT_STATUS_BUSY:
- imageDrawable = getResources().getDrawable(R.drawable.dnd);
- break;
- case Status.CONTACT_STATUS_DISCONNECT:
- imageDrawable = getResources().getDrawable(R.drawable.offline);
- break;
- case Status.CONTACT_STATUS_UNAVAILABLE:
- imageDrawable = getResources().getDrawable(R.drawable.requested);
- break;
- default:
- imageDrawable = getResources().getDrawable(R.drawable.error);
- break;
+ case Status.CONTACT_STATUS_AVAILABLE:
+ imageDrawable = getResources().getDrawable(R.drawable.online);
+ break;
+ case Status.CONTACT_STATUS_AVAILABLE_FOR_CHAT:
+ imageDrawable = getResources().getDrawable(R.drawable.chat);
+ break;
+ case Status.CONTACT_STATUS_AWAY:
+ imageDrawable = getResources().getDrawable(R.drawable.away);
+ break;
+ case Status.CONTACT_STATUS_BUSY:
+ imageDrawable = getResources().getDrawable(R.drawable.dnd);
+ break;
+ case Status.CONTACT_STATUS_DISCONNECT:
+ imageDrawable = getResources().getDrawable(R.drawable.offline);
+ break;
+ case Status.CONTACT_STATUS_UNAVAILABLE:
+ imageDrawable = getResources().getDrawable(R.drawable.requested);
+ break;
+ default:
+ imageDrawable = getResources().getDrawable(R.drawable.error);
+ break;
}
imgV.setImageDrawable(imageDrawable);
@@ -244,7 +336,6 @@
void createDialog(Contact contact) {
ContactDialog dialogContact = new ContactDialog(ContactList.this, contact);
dialogContact.setOwnerActivity(ContactList.this);
- dialogContact.initService();
dialogContact.show();
}
@@ -281,7 +372,7 @@
@Override
public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView,
- ViewGroup parent) {
+ ViewGroup parent) {
View v;
if (convertView == null) {
v = LayoutInflater.from(ContactList.this).inflate(R.layout.contactlistcontact, null);
@@ -370,148 +461,26 @@
}
}
- private static final String TAG = "CONTACTLIST_ACT";
- private static final int PREFERENCECHANGED = 0;
- private static final String DEFAULT_GROUP = "Default";
- private IXmppFacade mService = null;
- private MyExpandableListAdapter mAdapter;
- private BeemApplication mBeemApplication;
- private BeemRosterListener mRosterListener;
- private IRoster mRoster;
- private Map> groupMap;
- private List groupName;
- private List mListContact;
-
- private Handler mHandler;
-
- @SuppressWarnings("unused")
- private SharedPreferences mSettings;
+ private class BeemServiceConnection implements ServiceConnection {
- private void buildContactList(List listContact) {
- mListContact = listContact;
- for (Contact contact : listContact) {
- for (String group : contact.getGroups()) {
- if (!groupMap.containsKey(group)) {
- groupMap.put(group, new ArrayList());
- groupName.add(group);
- }
- try {
- if (!groupMap.get(group).contains(contact))
- groupMap.get(group).add(contact);
- } catch (NullPointerException e) {
- Log.e(TAG, "Failed to find group in groupMap", e);
+ @Override
+ public void onServiceConnected(ComponentName name, IBinder service) {
+ xmppFacade = IXmppFacade.Stub.asInterface(service);
+ try {
+ mRoster = xmppFacade.getRoster();
+ if (mRoster != null) {
+ mRoster.addRosterListener(new BeemRosterListener());
+ buildContactList(mRoster.getContactList());
}
- }
- if (contact.getGroups().isEmpty()) {
- if (!groupMap.containsKey(DEFAULT_GROUP)) {
- groupMap.put(DEFAULT_GROUP, new ArrayList());
- groupName.add(DEFAULT_GROUP);
- }
- groupMap.get(DEFAULT_GROUP).add(contact);
- }
- }
- mAdapter = new MyExpandableListAdapter();
- setListAdapter(mAdapter);
- }
-
- private void callbackShowContactList() {
- if (mRoster != null) {
- try {
- buildContactList(mRoster.getContactList());
} catch (RemoteException e) {
e.printStackTrace();
}
}
- }
- /*
- * @Override public boolean onChildClick(ExpandableListView parent, View v, int groupPosition,
- * int childPosition, long id) { try { } catch (NullPointerException e) { Log.e(TAG,
- * "Child not found", e); return false; } }
- */
- @Override
- protected void onActivityResult(int requestCode, int resultCode, Intent data) {
- if (requestCode == PREFERENCECHANGED) {
- if (resultCode == RESULT_OK) {
- if (!groupMap.isEmpty())
- groupMap.clear();
- mBeemApplication.stopBeemService();
- }
- }
- }
-
- @Override
- protected void onCreate(Bundle saveBundle) {
- Log.d(getString(R.string.contact_list_tag), "onCreate() started");
- super.onCreate(saveBundle);
- mHandler = new Handler();
- mRosterListener = new BeemRosterListener();
- mSettings = getSharedPreferences(getString(R.string.PreferenceFileName), MODE_PRIVATE);
- mBeemApplication = BeemApplication.getApplication(this);
- groupMap = new HashMap>();
- groupName = new ArrayList();
- mBeemApplication.callWhenConnectedToServer(mHandler, new Runnable() {
-
- @Override
- public void run() {
- mService = mBeemApplication.getXmppFacade();
- try {
- mRoster = mService.getRoster();
- } catch (RemoteException e1) {
- Log.e(TAG, "Get roster failed", e1);
- }
- if (mRoster != null) {
- try {
- mRoster.addConnectionListener(mRosterListener);
- } catch (RemoteException e) {
- e.printStackTrace();
- }
- }
- callbackShowContactList();
- }
- });
- Log.d(getString(R.string.contact_list_tag), "onCreate() ended");
- }
-
- /**
- * Callback for menu creation.
- *
- * @param menu
- * the menu created
- * @return true on success, false otherwise
- */
- @Override
- public final boolean onCreateOptionsMenu(Menu menu) {
- super.onCreateOptionsMenu(menu);
- MenuInflater inflater = getMenuInflater();
- inflater.inflate(R.menu.contact_list, menu);
- return true;
- }
-
- @Override
- protected void onDestroy() {
- mBeemApplication.unbindBeemService();
- super.onDestroy();
- }
-
- /**
- * Callback for menu item selected.
- *
- * @param item
- * the item selected
- * @return true on success, false otherwise
- */
- @Override
- public final boolean onOptionsItemSelected(MenuItem item) {
- switch (item.getItemId()) {
- case R.id.contact_list_menu_settings:
- startActivity(new Intent(this, EditSettings.class));
- return true;
- case R.id.contact_list_menu_add_contact:
- startActivity(new Intent(ContactList.this, AddContact.class));
- return true;
- default:
- return false;
+ @Override
+ public void onServiceDisconnected(ComponentName name) {
+ xmppFacade = null;
+ mRoster = null;
}
}
}
diff -r 17422d221dc1 -r cc4c230b5bd2 src/com/beem/project/beem/ui/EditSettings.java
--- a/src/com/beem/project/beem/ui/EditSettings.java Sat Jun 20 15:27:14 2009 +0200
+++ b/src/com/beem/project/beem/ui/EditSettings.java Sat Jun 20 15:28:42 2009 +0200
@@ -1,6 +1,7 @@
package com.beem.project.beem.ui;
import java.util.ArrayList;
+
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
@@ -19,7 +20,7 @@
import android.widget.TabHost;
import android.widget.Toast;
-import com.beem.project.beem.BeemApplication;
+import com.beem.project.beem.BeemService;
import com.beem.project.beem.R;
/**
@@ -507,8 +508,7 @@
displayNotification(getText(R.string.settings_saved_ok));
Log.i(getString(R.string.edit_settings_tag), LOG_MSG_SETTINGS_SAVED);
}
- BeemApplication beemApp = BeemApplication.getApplication(this);
- if (beemApp.isConnected())
- beemApp.stopBeemService();
+
+ stopService(new Intent(this, BeemService.class));
}
}
diff -r 17422d221dc1 -r cc4c230b5bd2 src/com/beem/project/beem/ui/Login.java
--- a/src/com/beem/project/beem/ui/Login.java Sat Jun 20 15:27:14 2009 +0200
+++ b/src/com/beem/project/beem/ui/Login.java Sat Jun 20 15:28:42 2009 +0200
@@ -12,129 +12,34 @@
import android.os.IBinder;
import android.os.RemoteException;
import android.util.Log;
-import android.view.Menu;
-import android.view.MenuInflater;
-import android.view.MenuItem;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
-import com.beem.project.beem.BeemApplication;
import com.beem.project.beem.R;
import com.beem.project.beem.service.aidl.IBeemConnectionListener;
import com.beem.project.beem.service.aidl.IXmppConnection;
import com.beem.project.beem.service.aidl.IXmppFacade;
+import com.beem.project.beem.utils.Status;
/**
- * This class represents an activity which allows the user to connect to an XMPP server with his
- * username/password
- *
+ * This class represents an activity which allows the user to connect to an XMPP server with his username/password
* @author dasilvj
*/
public class Login extends Activity {
- private class BeemConnectionListener extends IBeemConnectionListener.Stub {
-
- private class ErrorRunnable implements Runnable {
-
- private final String mErrorMsg;
-
- public ErrorRunnable(String errorMsg) {
- mErrorMsg = errorMsg;
- }
-
- @Override
- public void run() {
- progressDialog.setMessage(mErrorMsg);
- }
-
- }
-
- @Override
- public void connectionClosed() throws RemoteException {
- mIsConnected = false;
- beemApp.stopBeemService();
- }
-
- @Override
- public void connectionClosedOnError() throws RemoteException {
- mIsConnected = false;
- beemApp.stopBeemService();
- }
-
- @Override
- public void connectionFailed(String errorMsg) throws RemoteException {
- connectionHandler.post(new ErrorRunnable(errorMsg));
- beemApp.stopBeemService();
- dismissProgressDialog();
- }
-
- private void dismissProgressDialog() {
- connectionHandler.post(new Runnable() {
-
- @Override
- public void run() {
- progressDialog.dismiss();
- }
- });
- }
-
- @Override
- public void onConnect() throws RemoteException {
- mIsConnected = true;
- dismissProgressDialog();
- Log.i(getString(R.string.login_tag), "Connected.");
- startActivity(new Intent(Login.this, ContactList.class));
- }
-
- @Override
- public void reconnectingIn(int seconds) throws RemoteException {
-
- }
-
- @Override
- public void reconnectionFailed() throws RemoteException {
- mIsConnected = false;
- }
-
- @Override
- public void reconnectionSuccessful() throws RemoteException {
- mIsConnected = true;
- }
- }
-
- protected static final String TAG = "LOG_AS";
- private static final Intent SERVICE_INTENT = new Intent();
+ protected static final String TAG = "LOG_AS";
+ private static final Intent SERVICE_INTENT = new Intent();
static {
SERVICE_INTENT.setComponent(new ComponentName("com.beem.project.beem", "com.beem.project.beem.BeemService"));
}
- private BeemApplication beemApp = null;
- private IXmppConnection xmppConnection = null;
- private IXmppFacade xmppFacade = null;
- private final Handler connectionHandler = new Handler();
- private ProgressDialog progressDialog = null;
-
- private boolean mIsConnected = false;
- private final ServiceConnection mServConn = new ServiceConnection() {
+ private final Handler connectionHandler = new Handler();
+ private ProgressDialog progressDialog = null;
- @Override
- public void onServiceConnected(ComponentName name,
- IBinder service) {
- xmppFacade = IXmppFacade.Stub.asInterface(service);
- try {
- xmppConnection = xmppFacade.createConnection();
- xmppConnection
- .addConnectionListener(new BeemConnectionListener());
- } catch (RemoteException e) {
- Log.e(getString(R.string.login_tag),
- "REMOTE EXCEPTION $" + e.getMessage());
- }
- }
-
- @Override
- public void onServiceDisconnected(ComponentName name) {
- xmppFacade = null;
- mIsConnected = false;
- }
- };
+ private boolean mIsConnected = false;
+ private final ServiceConnection mServConn = new BeemServiceConnection();
+ private IXmppFacade xmppFacade = null;
/**
* Create an about "BEEM" dialog
@@ -159,68 +64,154 @@
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.login);
+ Button button = (Button) findViewById(R.id.log_as_settings);
+ button.setOnClickListener(new OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ startActivity(new Intent(Login.this, EditSettings.class));
+ }
+
+ });
+ button = (Button) findViewById(R.id.log_as_login);
+ button.setOnClickListener(new OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ bindService(Login.SERVICE_INTENT, mServConn, BIND_AUTO_CREATE);
+ }
+
+ });
}
- /**
- * {@inheritDoc}
- */
@Override
- public boolean onCreateOptionsMenu(Menu menu) {
- MenuInflater mInflater = getMenuInflater();
- mInflater.inflate(R.menu.login, menu);
- return true;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void onDestroy() {
+ protected void onDestroy() {
super.onDestroy();
+ unbindService(mServConn);
}
/**
* {@inheritDoc}
*/
@Override
- public boolean onOptionsItemSelected(MenuItem item) {
- Intent i = null;
-
- switch (item.getItemId()) {
- case R.id.login_menu_settings:
- i = new Intent(this, EditSettings.class);
- startActivity(i);
- return true;
- case R.id.login_menu_about:
- createAboutDialog();
- return true;
- }
- return false;
+ public void onStart() {
+ super.onStart();
+ Log.i(TAG, "OnStart()");
+ progressDialog = new ProgressDialog(this);
+ if (!mIsConnected)
+ bindService(Login.SERVICE_INTENT, mServConn, BIND_AUTO_CREATE);
}
- /**
- * {@inheritDoc}
- */
- @Override
- public void onPause() {
- super.onPause();
- this.progressDialog.dismiss();
- progressDialog = null;
- this.unbindService(mServConn);
+ private class BeemConnectionListener extends IBeemConnectionListener.Stub {
+
+ private class ErrorRunnable implements Runnable {
+
+ private final String mErrorMsg;
+
+ public ErrorRunnable(String errorMsg) {
+ mErrorMsg = errorMsg;
+ }
+
+ @Override
+ public void run() {
+ progressDialog.setMessage(mErrorMsg);
+ }
+
+ }
+
+ @Override
+ public void connectionClosed() throws RemoteException {
+ mIsConnected = false;
+ Login.this.unbindService(mServConn);
+ Login.this.stopService(SERVICE_INTENT);
+ }
+
+ @Override
+ public void connectionClosedOnError() throws RemoteException {
+ mIsConnected = false;
+ Login.this.unbindService(mServConn);
+ Login.this.stopService(SERVICE_INTENT);
+ }
+
+ @Override
+ public void connectionFailed(String errorMsg) throws RemoteException {
+ connectionHandler.post(new ErrorRunnable(errorMsg));
+ mIsConnected = false;
+ Login.this.unbindService(mServConn);
+ Login.this.stopService(SERVICE_INTENT);
+ dismissProgressDialog();
+ }
+
+ private void dismissProgressDialog() {
+ connectionHandler.post(new Runnable() {
+
+ @Override
+ public void run() {
+ progressDialog.dismiss();
+ }
+ });
+ }
+
+ @Override
+ public void onConnect() throws RemoteException {
+ mIsConnected = true;
+ dismissProgressDialog();
+ Log.i(getString(R.string.login_tag), "Connected.");
+ xmppFacade.changeStatus(Status.CONTACT_STATUS_AVAILABLE, null);
+ startActivity(new Intent(Login.this, ContactList.class));
+ finish();
+ }
+
+ @Override
+ public void reconnectingIn(int seconds) throws RemoteException {
+
+ }
+
+ @Override
+ public void reconnectionFailed() throws RemoteException {
+ mIsConnected = false;
+ }
+
+ @Override
+ public void reconnectionSuccessful() throws RemoteException {
+ mIsConnected = true;
+ }
}
- /**
- * {@inheritDoc}
- */
- @Override
- public void onResume() {
- super.onResume();
- progressDialog = new ProgressDialog(this);
- progressDialog.setMessage("Loading. Please wait...");
- beemApp = BeemApplication.getApplication(this);
- this.bindService(Login.SERVICE_INTENT, mServConn, BIND_AUTO_CREATE);
- if (!mIsConnected)
- progressDialog.show();
- beemApp.startBeemService();
+ private class BeemServiceConnection implements ServiceConnection {
+ private IXmppConnection xmppConnection = null;
+
+ @Override
+ public void onServiceConnected(ComponentName name, IBinder service) {
+ xmppFacade = IXmppFacade.Stub.asInterface(service);
+ try {
+ xmppConnection = xmppFacade.createConnection();
+ xmppConnection.addConnectionListener(new BeemConnectionListener());
+ if (!xmppConnection.isAuthentificated()) {
+ connectionHandler.post(new Runnable() {
+
+ @Override
+ public void run() {
+ progressDialog.setMessage("Loading. Please wait...");
+ progressDialog.show();
+ }
+ });
+ Login.this.startService(Login.SERVICE_INTENT);
+ } else {
+ mIsConnected = true;
+ startActivity(new Intent(Login.this, ContactList.class));
+ finish();
+ }
+ } catch (RemoteException e) {
+ Log.e(getString(R.string.login_tag), "REMOTE EXCEPTION $" + e.getMessage());
+ }
+ }
+
+ @Override
+ public void onServiceDisconnected(ComponentName name) {
+ xmppFacade = null;
+ mIsConnected = false;
+ }
}
+
}
diff -r 17422d221dc1 -r cc4c230b5bd2 src/com/beem/project/beem/ui/SendIM.java
--- a/src/com/beem/project/beem/ui/SendIM.java Sat Jun 20 15:27:14 2009 +0200
+++ b/src/com/beem/project/beem/ui/SendIM.java Sat Jun 20 15:28:42 2009 +0200
@@ -3,11 +3,14 @@
import java.util.List;
import android.app.Activity;
+import android.content.ComponentName;
import android.content.Intent;
+import android.content.ServiceConnection;
import android.content.SharedPreferences;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Handler;
+import android.os.IBinder;
import android.os.RemoteException;
import android.util.Log;
import android.view.KeyEvent;
@@ -22,7 +25,7 @@
import android.widget.ScrollView;
import android.widget.TextView;
-import com.beem.project.beem.BeemApplication;
+import com.beem.project.beem.BeemService;
import com.beem.project.beem.R;
import com.beem.project.beem.service.Contact;
import com.beem.project.beem.service.Message;
@@ -34,19 +37,284 @@
/**
* This activity class provides the view for instant messaging after selecting a correspondant.
- *
* @author barbu
*/
public class SendIM extends Activity implements OnClickListener, OnKeyListener {
+ private static final String TAG = "SEND_IM";
+ private EditText mToSend;
+ private SendIMDialogSmiley mSmyDialog;
+ private SharedPreferences mSet;
+ private Handler mHandler;
+ private Contact mContact;
+ private IChatManager mChatManager;
+ private IChatManagerListener mChatManagerListener;
+ private IMessageListener mMessageListener;
+ private IChat mChat;
+ private TextView mText;
+ private TextView mLogin;
+ private ScrollView mScrolling;
+ private char mSpeak;
+
+ private final ServiceConnection mServConn = new BeemServiceConnection();
+ private IXmppFacade xmppFacade;
+
+ /**
+ * Constructor.
+ */
+ public SendIM() {
+ super();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void onClick(View view) {
+ sendText();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void onCreate(Bundle saveBundle) {
+ super.onCreate(saveBundle);
+ mHandler = new Handler();
+ mChatManagerListener = new OnChatListener();
+ mMessageListener = new OnMessageListener();
+ setContentView(R.layout.sendim);
+ mToSend = (EditText) findViewById(R.id.userText);
+ mSet = getSharedPreferences("lol", MODE_PRIVATE);
+ mSmyDialog = new SendIMDialogSmiley(this, mSet);
+ mToSend.setOnClickListener(this);
+ mToSend.setOnKeyListener(this);
+ mLogin = (TextView) findViewById(R.id.sendimlogin);
+ mContact = new Contact(getIntent().getData());
+ setViewHeader();
+ mText = (TextView) findViewById(R.id.sendimlist);
+ mScrolling = (ScrollView) findViewById(R.id.sendimscroll);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public final boolean onCreateOptionsMenu(Menu menu) {
+ super.onCreateOptionsMenu(menu);
+ MenuInflater inflater = getMenuInflater();
+ inflater.inflate(R.menu.sendimmenu, menu);
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ if (mChatManager != null) {
+ try {
+ mChatManager.removeChatCreationListener(mChatManagerListener);
+ // TODO trouver quand detruire le chat
+ // mChatManager.destroyChat(mChat);
+ } catch (RemoteException e) {
+ Log.e(TAG, "mchat manager and SendIM destroy", e);
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean onKey(View v, int keyCode, KeyEvent event) {
+ if (event.getAction() == KeyEvent.ACTION_DOWN) {
+ switch (keyCode) {
+ case KeyEvent.KEYCODE_DPAD_CENTER:
+ case KeyEvent.KEYCODE_ENTER:
+ sendText();
+ return true;
+ default:
+ return false;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void onNewIntent(Intent intent) {
+ super.onNewIntent(intent);
+ mContact = new Contact(intent.getData());
+ setViewHeader();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public final boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case R.id.sendim_smiley:
+ mSmyDialog.show();
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void onPause() {
+ super.onPause();
+ try {
+ mChat.setOpen(false);
+ } catch (RemoteException e) {
+ Log.d(TAG, "Error while closing chat", e);
+ }
+ unbindService(mServConn);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void onResume() {
+ super.onResume();
+ bindService(new Intent(this, BeemService.class), mServConn, BIND_AUTO_CREATE);
+ mScrolling.fullScroll(ScrollView.FOCUS_DOWN);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void onStart() {
+ super.onStart();
+ // TODO cancel the notification if any
+ if (mContact == null)
+ mContact = getIntent().getParcelableExtra("contact");
+ setViewHeader();
+
+ }
+
+ private class BeemServiceConnection implements ServiceConnection {
+
+ @Override
+ public void onServiceConnected(ComponentName name, IBinder service) {
+ xmppFacade = IXmppFacade.Stub.asInterface(service);
+ try {
+ if (mChatManager == null) {
+ mChatManager = xmppFacade.getChatManager();
+ mChatManager.addChatCreationListener(mChatManagerListener);
+ }
+ switchChat(mContact);
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error during chat manager creation", e);
+ }
+ }
+
+ @Override
+ public void onServiceDisconnected(ComponentName name) {
+ xmppFacade = null;
+ }
+ }
+
+ /**
+ * Send a message to the contact over the XMPP connection. Also display it on activity view. TODO : Gerer
+ * l'exception si la connexion se coupe pendant la conversation
+ */
+ private void sendText() {
+ String text = mToSend.getText().toString();
+ if (!text.equals("")) {
+ Message msg = new Message(mContact.getJID(), Message.MSG_TYPE_CHAT);
+ msg.setBody(text);
+ try {
+ // TODO: PAs connecter au serveur BING grosse Error ! INTERDICTION !
+ mChat.sendMessage(msg);
+ if (mSpeak != 1)
+ mText.append(getString(R.string.SendIMYouSay) + text + '\n');
+ else
+ mText.append(text + "\n");
+ mToSend.setText(null);
+ mScrolling.fullScroll(ScrollView.FOCUS_DOWN);
+ mToSend.requestFocus();
+ mSpeak = 1;
+ } catch (RemoteException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * Set the header information in the window.
+ */
+ private void setViewHeader() {
+ Drawable avatar = getResources().getDrawable(R.drawable.avatar);
+ ImageView imgV = (ImageView) findViewById(R.id.sendimavatar);
+ imgV.setImageDrawable(avatar);
+ mLogin = (TextView) findViewById(R.id.sendimlogin);
+ mLogin.setText(mContact.getJID());
+ TextView status = (TextView) findViewById(R.id.sendimstatus);
+ status.setTextSize(12);
+ mLogin.setTextColor(getResources().getColor(R.color.white));
+ String statmsg = mContact.getMsgState();
+ if (statmsg != null)
+ status.setText(statmsg);
+ }
+
+ /**
+ * Show the message history.
+ * @param messages list of message to display
+ */
+ private void showMessageList(List messages) {
+ mText.setText("");
+ mSpeak = 0;
+ for (Message message : messages) {
+ String from = message.getFrom();
+ if (from == null) {
+ if (mSpeak != 1)
+ mText.append(getString(R.string.SendIMYouSay));
+ mSpeak = 1;
+ } else {
+ if (mSpeak != 2) {
+ String str = String.format(getString(R.string.SendIMSays), from);
+ mText.append(str);
+ }
+ mSpeak = 2;
+ }
+ mText.append(message.getBody() + '\n');
+ }
+ mScrolling.fullScroll(ScrollView.FOCUS_DOWN);
+ }
+
+ /**
+ * Change the correspondant of the chat.
+ * @param newContact New contact to chat with
+ * @throws RemoteException if an errors occurs in the connection with the service
+ */
+ private void switchChat(Contact newContact) throws RemoteException {
+ if (mChat != null)
+ mChat.setOpen(false);
+ mChat = mChatManager.createChat(newContact, mMessageListener);
+ showMessageList(mChat.getMessages());
+ mChat.setOpen(true);
+ mContact = newContact;
+ mToSend.requestFocus();
+ }
+
/**
* Listener for chat creation. (maybe not necessary)
- *
* @author darisk
*/
private class OnChatListener extends IChatManagerListener.Stub {
-
/**
* {@inheritDoc}
*/
@@ -59,7 +327,6 @@
/**
* Listener for new chat messages.
- *
* @author darisk
*/
private class OnMessageListener extends IMessageListener.Stub {
@@ -103,287 +370,4 @@
}
}
- private static final String TAG = "SEND_IM";
- private EditText mToSend;
- private SendIMDialogSmiley mSmyDialog;
- private SharedPreferences mSet;
- private BeemApplication mBeemApplication;
- private Handler mHandler;
- private IXmppFacade mService;
- private Contact mContact;
- private IChatManager mChatManager;
- private IChatManagerListener mChatManagerListener;
- private IMessageListener mMessageListener;
- private IChat mChat;
- private TextView mText;
- private TextView mLogin;
-
- private ScrollView mScrolling;
-
- private char mSpeak;
-
- /**
- * Constructor.
- */
- public SendIM() {
- super();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void onClick(View view) {
- sendText();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void onCreate(Bundle saveBundle) {
- super.onCreate(saveBundle);
- mHandler = new Handler();
- mChatManagerListener = new OnChatListener();
- mMessageListener = new OnMessageListener();
- mBeemApplication = BeemApplication.getApplication(this);
- setContentView(R.layout.sendim);
- mToSend = (EditText) findViewById(R.id.userText);
- mSet = getSharedPreferences("lol", MODE_PRIVATE);
- mSmyDialog = new SendIMDialogSmiley(this, mSet);
- mToSend.setOnClickListener(this);
- mToSend.setOnKeyListener(this);
- mLogin = (TextView) findViewById(R.id.sendimlogin);
- // mContact = getIntent().getParcelableExtra("contact");
- mContact = new Contact(getIntent().getData());
- setViewHeader();
- mText = (TextView) findViewById(R.id.sendimlist);
- mScrolling = (ScrollView) findViewById(R.id.sendimscroll);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public final boolean onCreateOptionsMenu(Menu menu) {
- super.onCreateOptionsMenu(menu);
- MenuInflater inflater = getMenuInflater();
- inflater.inflate(R.menu.sendimmenu, menu);
- return true;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void onDestroy() {
- super.onDestroy();
- if (mChatManager != null) {
- try {
- mChatManager.removeChatCreationListener(mChatManagerListener);
- // TODO trouver quand detruire le chat
- // mChatManager.destroyChat(mChat);
- } catch (RemoteException e) {
- Log.e(TAG, "mchat manager and SendIM destroy", e);
- }
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean onKey(View v, int keyCode, KeyEvent event) {
- if (event.getAction() == KeyEvent.ACTION_DOWN) {
- switch (keyCode) {
- case KeyEvent.KEYCODE_DPAD_CENTER:
- case KeyEvent.KEYCODE_ENTER:
- sendText();
- return true;
- default:
- return false;
- }
- }
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void onNewIntent(Intent intent) {
- super.onNewIntent(intent);
- mContact = new Contact(intent.getData());
- setViewHeader();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public final boolean onOptionsItemSelected(MenuItem item) {
- switch (item.getItemId()) {
- case R.id.sendim_smiley:
- mSmyDialog.show();
- return true;
- default:
- return false;
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void onPause() {
- super.onPause();
- try {
- mChat.setOpen(false);
- } catch (RemoteException e) {
- Log.d(TAG, "Error while closing chat", e);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void onResume() {
- super.onResume();
- mBeemApplication = BeemApplication.getApplication(this);
- if (!mBeemApplication.isConnected())
- mBeemApplication.startBeemService();
- mBeemApplication.callWhenConnectedToServer(mHandler, new Runnable() {
-
- @Override
- public void run() {
- mService = mBeemApplication.getXmppFacade();
- try {
- if (mChatManager == null) {
- mChatManager = mService.getChatManager();
- mChatManager.addChatCreationListener(mChatManagerListener);
- }
- switchChat(mContact);
- } catch (RemoteException e) {
- Log.e(TAG, "Error during chat manager creation", e);
- }
- }
- });
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void onStart() {
- super.onStart();
- // TODO cancel the notification if any
- if (mContact == null)
- mContact = getIntent().getParcelableExtra("contact");
- mService = mBeemApplication.getXmppFacade();
- setViewHeader();
-
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void onStop() {
- super.onStop();
- try {
- mChat.setOpen(false);
- } catch (RemoteException e) {
- Log.d(TAG, "mchat open false", e);
- }
- mBeemApplication.unbindBeemService();
- }
-
- /**
- * Send a message to the contact over the XMPP connection. Also display it on activity view.
- * TODO : Gerer l'exception si la connexion se coupe pendant la conversation
- */
- private void sendText() {
- String text = mToSend.getText().toString();
- if (!text.equals("")) {
- Message msg = new Message(mContact.getJID(), Message.MSG_TYPE_CHAT);
- msg.setBody(text);
- try {
- mChat.sendMessage(msg);
- if (mSpeak != 1)
- mText.append(getString(R.string.SendIMYouSay) + text + '\n');
- else
- mText.append(text + "\n");
- mToSend.setText(null);
- mScrolling.fullScroll(ScrollView.FOCUS_DOWN);
- mToSend.requestFocus();
- mSpeak = 1;
- } catch (RemoteException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- }
-
- /**
- * Set the header information in the window.
- */
- private void setViewHeader() {
- Drawable avatar = getResources().getDrawable(R.drawable.avatar);
- ImageView imgV = (ImageView) findViewById(R.id.sendimavatar);
- imgV.setImageDrawable(avatar);
- mLogin = (TextView) findViewById(R.id.sendimlogin);
- mLogin.setText(mContact.getJID());
- TextView status = (TextView) findViewById(R.id.sendimstatus);
- status.setTextSize(12);
- mLogin.setTextColor(getResources().getColor(R.color.white));
- String statmsg = mContact.getMsgState();
- if (statmsg != null)
- status.setText(statmsg);
- }
-
- /**
- * Show the message history.
- *
- * @param messages
- * list of message to display
- */
- private void showMessageList(List messages) {
- mText.setText("");
- mSpeak = 0;
- for (Message message : messages) {
- String from = message.getFrom();
- if (from == null) {
- if (mSpeak != 1)
- mText.append(getString(R.string.SendIMYouSay));
- mSpeak = 1;
- } else {
- if (mSpeak != 2) {
- String str = String.format(getString(R.string.SendIMSays), from);
- mText.append(str);
- }
- mSpeak = 2;
- }
- mText.append(message.getBody() + '\n');
- }
- mScrolling.fullScroll(ScrollView.FOCUS_DOWN);
- }
-
- /**
- * Change the correspondant of the chat.
- *
- * @param newContact
- * New contact to chat with
- * @throws RemoteException
- * if an errors occurs in the connection with the service
- */
- private void switchChat(Contact newContact) throws RemoteException {
- if (mChat != null)
- mChat.setOpen(false);
- mChat = mChatManager.createChat(newContact, mMessageListener);
- showMessageList(mChat.getMessages());
- mChat.setOpen(true);
- mContact = newContact;
- mToSend.requestFocus();
- }
}