diff --git a/android/.classpath b/android/.classpath
index f94de68..26bdfa6 100644
--- a/android/.classpath
+++ b/android/.classpath
@@ -5,9 +5,5 @@
-
-
-
-
diff --git a/android/.settings/org.eclipse.jdt.core.prefs b/android/.settings/org.eclipse.jdt.core.prefs
index 48ab4c6..5dbe380 100644
--- a/android/.settings/org.eclipse.jdt.core.prefs
+++ b/android/.settings/org.eclipse.jdt.core.prefs
@@ -2,3 +2,283 @@ eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
+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_method_declaration=0
+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_resources_in_try=80
+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.alignment_for_union_type_in_multicatch=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=next_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=true
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
+org.eclipse.jdt.core.formatter.comment.format_line_comments=true
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
+org.eclipse.jdt.core.formatter.comment.line_length=80
+org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.join_lines_in_comments=true
+org.eclipse.jdt.core.formatter.join_wrapped_lines=true
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=160
+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=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_on_off_tags=false
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml
index 45989a8..3aea5ad 100644
--- a/android/AndroidManifest.xml
+++ b/android/AndroidManifest.xml
@@ -6,7 +6,9 @@
+ android:targetSdkVersion="21" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/android/res/animator/language_flag_in.xml b/android/res/animator/language_flag_in.xml
deleted file mode 100644
index afc08f8..0000000
--- a/android/res/animator/language_flag_in.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
diff --git a/android/res/drawable-hdpi/abc_ic_search_api_mtrl_alpha.png b/android/res/drawable-hdpi/abc_ic_search_api_mtrl_alpha.png
new file mode 100644
index 0000000..f7382d3
Binary files /dev/null and b/android/res/drawable-hdpi/abc_ic_search_api_mtrl_alpha.png differ
diff --git a/android/res/drawable-ldpi/abc_ic_search_api_mtrl_alpha.png b/android/res/drawable-ldpi/abc_ic_search_api_mtrl_alpha.png
new file mode 100644
index 0000000..0fb57b2
Binary files /dev/null and b/android/res/drawable-ldpi/abc_ic_search_api_mtrl_alpha.png differ
diff --git a/android/res/drawable-mdpi/abc_ic_search_api_mtrl_alpha.png b/android/res/drawable-mdpi/abc_ic_search_api_mtrl_alpha.png
new file mode 100644
index 0000000..0fb57b2
Binary files /dev/null and b/android/res/drawable-mdpi/abc_ic_search_api_mtrl_alpha.png differ
diff --git a/android/res/drawable-xhdpi/abc_ic_search_api_mtrl_alpha.png b/android/res/drawable-xhdpi/abc_ic_search_api_mtrl_alpha.png
new file mode 100644
index 0000000..05cfab7
Binary files /dev/null and b/android/res/drawable-xhdpi/abc_ic_search_api_mtrl_alpha.png differ
diff --git a/android/res/drawable-xxhdpi/abc_ic_search_api_mtrl_alpha.png b/android/res/drawable-xxhdpi/abc_ic_search_api_mtrl_alpha.png
new file mode 100644
index 0000000..6f60bd3
Binary files /dev/null and b/android/res/drawable-xxhdpi/abc_ic_search_api_mtrl_alpha.png differ
diff --git a/android/res/drawable/drawer_agenda.png b/android/res/drawable/drawer_agenda.png
new file mode 100644
index 0000000..95001c9
Binary files /dev/null and b/android/res/drawable/drawer_agenda.png differ
diff --git a/android/res/drawable/drawer_bashgid_logo.png b/android/res/drawable/drawer_bashgid_logo.png
new file mode 100644
index 0000000..b55ee7e
Binary files /dev/null and b/android/res/drawable/drawer_bashgid_logo.png differ
diff --git a/android/res/drawable/drawer_book.png b/android/res/drawable/drawer_book.png
new file mode 100644
index 0000000..68d3951
Binary files /dev/null and b/android/res/drawable/drawer_book.png differ
diff --git a/android/res/drawable/drawer_gear.png b/android/res/drawable/drawer_gear.png
new file mode 100644
index 0000000..4c08fbe
Binary files /dev/null and b/android/res/drawable/drawer_gear.png differ
diff --git a/android/res/drawable/drawer_id.png b/android/res/drawable/drawer_id.png
new file mode 100644
index 0000000..98f2580
Binary files /dev/null and b/android/res/drawable/drawer_id.png differ
diff --git a/android/res/drawable/drawer_industry.png b/android/res/drawable/drawer_industry.png
new file mode 100644
index 0000000..b35e8ba
Binary files /dev/null and b/android/res/drawable/drawer_industry.png differ
diff --git a/android/res/drawable/drawer_news.png b/android/res/drawable/drawer_news.png
new file mode 100644
index 0000000..157b6cc
Binary files /dev/null and b/android/res/drawable/drawer_news.png differ
diff --git a/android/res/drawable/drawer_phone.png b/android/res/drawable/drawer_phone.png
new file mode 100644
index 0000000..efa2240
Binary files /dev/null and b/android/res/drawable/drawer_phone.png differ
diff --git a/android/res/drawable/drawer_photography.png b/android/res/drawable/drawer_photography.png
new file mode 100644
index 0000000..acba6eb
Binary files /dev/null and b/android/res/drawable/drawer_photography.png differ
diff --git a/android/res/drawable/drawer_pushpin.png b/android/res/drawable/drawer_pushpin.png
new file mode 100644
index 0000000..31134e7
Binary files /dev/null and b/android/res/drawable/drawer_pushpin.png differ
diff --git a/android/res/drawable/drawer_tv.png b/android/res/drawable/drawer_tv.png
new file mode 100644
index 0000000..b6b73bb
Binary files /dev/null and b/android/res/drawable/drawer_tv.png differ
diff --git a/android/res/drawable/logo.png b/android/res/drawable/logo.png
index d7fe201..b227fa0 100644
Binary files a/android/res/drawable/logo.png and b/android/res/drawable/logo.png differ
diff --git a/android/res/drawable/see_more.png b/android/res/drawable/see_more.png
new file mode 100644
index 0000000..3f228cf
Binary files /dev/null and b/android/res/drawable/see_more.png differ
diff --git a/android/res/drawable/see_more_button.xml b/android/res/drawable/see_more_button.xml
new file mode 100644
index 0000000..869c8b1
--- /dev/null
+++ b/android/res/drawable/see_more_button.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/android/res/drawable/see_more_highlighted.xml b/android/res/drawable/see_more_highlighted.xml
new file mode 100644
index 0000000..9a889a7
--- /dev/null
+++ b/android/res/drawable/see_more_highlighted.xml
@@ -0,0 +1,8 @@
+
+
+ -
+
+
+
+
+
\ No newline at end of file
diff --git a/android/res/layout/activity_main.xml b/android/res/layout/activity_main.xml
index 3c05411..273f290 100644
--- a/android/res/layout/activity_main.xml
+++ b/android/res/layout/activity_main.xml
@@ -1,6 +1,24 @@
+
+
+
-
\ No newline at end of file
+
+
+
+
+
\ No newline at end of file
diff --git a/android/res/layout/activity_main_fast.xml b/android/res/layout/activity_main_fast.xml
deleted file mode 100644
index 3e04c95..0000000
--- a/android/res/layout/activity_main_fast.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/android/res/layout/drawer_list_element.xml b/android/res/layout/drawer_list_element.xml
index 61d9f5d..3938449 100644
--- a/android/res/layout/drawer_list_element.xml
+++ b/android/res/layout/drawer_list_element.xml
@@ -4,13 +4,15 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
- android:orientation="horizontal" >
+ android:orientation="horizontal"
+ android:padding="4dp" >
+ android:textSize="20sp" />
diff --git a/android/res/layout/fragment_main.xml b/android/res/layout/fragment_main.xml
deleted file mode 100644
index af517cd..0000000
--- a/android/res/layout/fragment_main.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/android/res/layout/fragment_main_page.xml b/android/res/layout/fragment_main_page.xml
index f253a15..2a11301 100644
--- a/android/res/layout/fragment_main_page.xml
+++ b/android/res/layout/fragment_main_page.xml
@@ -3,41 +3,19 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="0dp"
- android:background="@drawable/background"
+ android:background="@color/bkg2"
android:orientation="vertical"
tools:context="fishrungames.bashgid.MainPageFragment" >
-
-
-
-
-
-
-
-
-
-
+ android:dividerHeight="18dp"
+ android:paddingBottom="16dp" >
diff --git a/android/res/layout/fragment_navigation_drawer.xml b/android/res/layout/fragment_navigation_drawer.xml
new file mode 100644
index 0000000..33c81c3
--- /dev/null
+++ b/android/res/layout/fragment_navigation_drawer.xml
@@ -0,0 +1,13 @@
+
+
diff --git a/android/res/layout/main_page_list_element.xml b/android/res/layout/main_page_list_element.xml
index ad12d79..7819a9d 100644
--- a/android/res/layout/main_page_list_element.xml
+++ b/android/res/layout/main_page_list_element.xml
@@ -3,7 +3,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="4dp"
- android:background="@color/light_blue"
+ android:background="@color/bkg1"
android:orientation="vertical"
android:paddingBottom="4dp"
android:paddingTop="4dp"
@@ -11,21 +11,29 @@
+ android:layout_height="wrap_content"
+ android:gravity="top" >
+ android:paddingLeft="16dp"
+ android:textSize="16sp"
+ android:textStyle="bold" />
+ android:layout_width="152dp"
+ android:layout_height="24dp"
+ android:layout_margin="8dp"
+ android:background="@drawable/see_more_button"
+ android:gravity="right|center_vertical"
+ android:paddingRight="28dp"
+ android:text="Узнать больше"
+ android:textSize="16sp" />
@@ -33,6 +41,7 @@
android:id="@+id/hListView"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
+
diff --git a/android/res/layout/main_page_list_header.xml b/android/res/layout/main_page_list_header.xml
index 9b861ca..0b20900 100644
--- a/android/res/layout/main_page_list_header.xml
+++ b/android/res/layout/main_page_list_header.xml
@@ -2,11 +2,10 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:layout_margin="0dp"
- android:background="@color/light_blue"
+ android:background="@color/bkg1"
android:orientation="vertical"
- android:paddingLeft="30dp"
- android:paddingRight="30dp"
+ android:paddingLeft="20dp"
+ android:paddingRight="20dp"
tools:context="fishrungames.bashgid.MainPageFragment" >
+ android:layout_marginBottom="8dp"
+ android:layout_marginTop="8dp" >
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
+ android:contentDescription="@string/news_content_description_1" />
+ android:layout_gravity="center_vertical"
+ android:layout_marginLeft="8dp" />
+ android:layout_marginBottom="8dp"
+ android:layout_marginTop="8dp" >
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
+ android:contentDescription="@string/news_content_description_2" />
+ android:layout_gravity="center_vertical"
+ android:layout_marginLeft="8dp" />
+ android:layout_marginBottom="8dp"
+ android:layout_marginTop="8dp" >
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
+ android:contentDescription="@string/news_content_description_3" />
+ android:layout_gravity="center_vertical"
+ android:layout_marginLeft="8dp" />
@@ -81,6 +89,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
- android:text="Button" />
+ android:text="@string/other_news" />
diff --git a/android/res/menu/global.xml b/android/res/menu/global.xml
index 9e8236e..42a675e 100644
--- a/android/res/menu/global.xml
+++ b/android/res/menu/global.xml
@@ -1,10 +1,10 @@
diff --git a/android/res/values/colors.xml b/android/res/values/colors.xml
index ef05501..8259fa0 100644
--- a/android/res/values/colors.xml
+++ b/android/res/values/colors.xml
@@ -18,6 +18,15 @@
#BCDEFF
+#F0F0F0
+
+#d0d0d0
+
+
+
+#202020
+
+#404040
diff --git a/android/res/values/strings.xml b/android/res/values/strings.xml
index 1ce40bc..bf5a763 100644
--- a/android/res/values/strings.xml
+++ b/android/res/values/strings.xml
@@ -16,7 +16,19 @@
+ Поиск
+ Запись недоступна
+ Другие новости...
+
+ Новости
+
+ Image related to news record
+ Image related to news record
+ Image related to news record
+
+
+
Coat of Bashkortostan
diff --git a/android/src/fishrungames/bashgid/MainActivity.java b/android/src/fishrungames/bashgid/MainActivity.java
index 8d43d4e..1b40108 100644
--- a/android/src/fishrungames/bashgid/MainActivity.java
+++ b/android/src/fishrungames/bashgid/MainActivity.java
@@ -1,5 +1,7 @@
package fishrungames.bashgid;
+
+
import android.app.Activity;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.ActionBar;
@@ -17,31 +19,38 @@ import android.view.View;
import android.view.ViewGroup;
import android.support.v4.widget.DrawerLayout;
import android.widget.ArrayAdapter;
+import android.widget.BaseAdapter;
+import android.widget.ImageView;
+import android.widget.ListView;
import android.widget.TextView;
-public class MainActivity extends ActionBarActivity {
+public class MainActivity extends ActionBarActivity
+implements NavigationDrawerFragment.NavigationDrawerCallbacks {
static MainActivity instance = null;
-
+
+ private NavigationDrawerFragment mNavigationDrawerFragment = null;
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
+ setContentView(R.layout.activity_main);
+
+ SetupDrawer();
- getSupportActionBar().hide();
-
- getSupportFragmentManager().beginTransaction().add(R.id.fragment_proto_container, new WelcomeFragment()).commit();
-
+ getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, new WelcomeFragment()).commit();
+
+
instance = this;
- it.sephiroth.android.library.widget.HListView hx;
-
+
}
+
public static MainActivity getInstance()
{
return instance;
@@ -72,15 +81,39 @@ public class MainActivity extends ActionBarActivity {
public void OpenMainScreen()
{
- //getSupportActionBar().show();
+ //mainFragment = new MainFragment();
- getSupportFragmentManager().beginTransaction().replace(R.id.fragment_proto_container, new MainFragment()).commit();
-
- getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, new MainPageFragment()).commit();
+ getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new MainPageFragment()).commit();
+ mNavigationDrawerFragment.EnableDrawer();
+ }
+
+
+ @Override
+ public void onAttachFragment(Fragment fragment)
+ {
+ super.onAttachFragment(fragment);
}
-
+
+ public void SetupDrawer()
+ {
+
+
+ mNavigationDrawerFragment = (NavigationDrawerFragment)
+ getSupportFragmentManager().findFragmentById(R.id.navigation_drawer);
+
+ if (mNavigationDrawerFragment != null)
+ {
+
+ // Set up the drawer.
+ mNavigationDrawerFragment.setUp(
+ R.id.navigation_drawer,
+ (DrawerLayout) findViewById(R.id.drawer_layout));
+ }
+ }
+
+
@Override
public boolean onCreateOptionsMenu(Menu menu) {
@@ -99,6 +132,20 @@ public class MainActivity extends ActionBarActivity {
}
return super.onOptionsItemSelected(item);
}
+
+
+ @Override
+ public void onNavigationDrawerItemSelected(int position) {
+ // update the main content by replacing fragments
+ //FragmentManager fragmentManager = getSupportFragmentManager();
+ //fragmentManager.beginTransaction()
+ // .replace(R.id.container, PlaceholderFragment.newInstance(position + 1))
+ // .commit();
+ }
+
+
+
+
}
diff --git a/android/src/fishrungames/bashgid/MainFragment.java b/android/src/fishrungames/bashgid/MainFragment.java
deleted file mode 100644
index 8e94fce..0000000
--- a/android/src/fishrungames/bashgid/MainFragment.java
+++ /dev/null
@@ -1,83 +0,0 @@
-package fishrungames.bashgid;
-
-import android.content.Context;
-import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.ViewGroup.LayoutParams;
-import android.widget.BaseAdapter;
-import android.widget.ImageView;
-import android.widget.ListView;
-import android.widget.TextView;
-
-public class MainFragment extends Fragment {
-
- ListView left_drawer;
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
- View rootView = inflater.inflate(R.layout.fragment_main, container, false);
-
- left_drawer = (ListView) rootView.findViewById(R.id.left_drawer);
-
- left_drawer.setAdapter(new DrawerAdapter(getActivity()));
-
- return rootView;
- }
-
-
- public class DrawerAdapter extends BaseAdapter {
- private Context mContext;
-
- public DrawerAdapter(Context c) {
- mContext = c;
- }
-
- public int getCount() {
- return 3;
- }
-
- public Object getItem(int position) {
- return null;
- }
-
- public long getItemId(int position) {
- return 0;
- }
-
- // create a new ImageView for each item referenced by the Adapter
- public View getView(int position, View convertView, ViewGroup parent) {
-
-
- View view;
- if (convertView == null) { // if it's not recycled, initialize some attributes
- LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- view = inflater.inflate(R.layout.drawer_list_element, null);
-
-
- } else {
- view = convertView;
- }
-
- TextView textView = (TextView) view.findViewById(R.id.textView);
-
- if (position == 0)
- {
- textView.setText("Справочник");
- }
- else if (position == 1)
- {
- textView.setText("Новости");
- }
- else
- {
- textView.setText("Карта");
- }
-
-
- return view;
- }
- }
-}
diff --git a/android/src/fishrungames/bashgid/MainPageFragment.java b/android/src/fishrungames/bashgid/MainPageFragment.java
index 7c10bac..a930461 100644
--- a/android/src/fishrungames/bashgid/MainPageFragment.java
+++ b/android/src/fishrungames/bashgid/MainPageFragment.java
@@ -1,5 +1,10 @@
package fishrungames.bashgid;
+import java.util.ArrayList;
+
+import fishrungames.bashgid.core.ImageManager;
+import fishrungames.bashgid.core.NewsManager;
+import fishrungames.bashgid.core.NewsManager.NewsUpdatedCallbackInterface;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
@@ -13,7 +18,7 @@ import android.widget.ListView;
import android.widget.TextView;
import it.sephiroth.android.library.widget.HListView;
-public class MainPageFragment extends Fragment {
+public class MainPageFragment extends Fragment implements NewsUpdatedCallbackInterface {
String [] teaserHeaderArray = { "Для инвестора", "Культура Башкортостана", "Для гостей и туристов", "Образование" };
@@ -38,6 +43,7 @@ public class MainPageFragment extends Fragment {
ListView listView;
+ View header;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
@@ -47,9 +53,11 @@ public class MainPageFragment extends Fragment {
listView.setAdapter(new ListAdapter(getActivity()));
- View header = inflater.inflate(R.layout.main_page_list_header, null);
+ header = inflater.inflate(R.layout.main_page_list_header, null);
- fillHeader(header);
+ RefreshHeader();
+
+ NewsManager.GetInstance().DownloadNews(this);
listView.addHeaderView(header);
@@ -57,8 +65,10 @@ public class MainPageFragment extends Fragment {
}
- private void fillHeader(View header)
+ private void RefreshHeader()
{
+
+
ImageView news1ImageView = (ImageView) header.findViewById(R.id.news1ImageView);
ImageView news2ImageView = (ImageView) header.findViewById(R.id.news2ImageView);
ImageView news3ImageView = (ImageView) header.findViewById(R.id.news3ImageView);
@@ -67,22 +77,46 @@ public class MainPageFragment extends Fragment {
TextView news2TextView = (TextView)header.findViewById(R.id.news2TextView);
TextView news3TextView = (TextView)header.findViewById(R.id.news3TextView);
- news1ImageView.setImageResource(R.drawable.news_image1);
- news2ImageView.setImageResource(R.drawable.news_image2);
- news3ImageView.setImageResource(R.drawable.news_image3);
- news1TextView.setText("Власти Башкирии создадут выезд из Уфы на трассу М-5 «Урал»");
- news2TextView.setText("Башкирия заняла первое место индекса «деловой активности»");
- news3TextView.setText("«Салават Юлаев» обыграл «Ладу» и прервал серию из 5 поражений в КХЛ");
+ ArrayList newsRecordArr = NewsManager.GetInstance().getNews();
- Button moreNewsButton = (Button)header.findViewById(R.id.moreNewsButton);
+ if (newsRecordArr.size() > 0)
+ {
+ ImageManager.getInstance().ApplyImageToImageView(news1ImageView, newsRecordArr.get(0).imageId);
+ news1TextView.setText(newsRecordArr.get(0).title);
+ }
+ else
+ {
+ news1ImageView.setImageResource(R.drawable.transparent);
+ news1TextView.setText(R.string.news_record_not_available);
+ }
- moreNewsButton.setText("Другие новости...");
+ if (newsRecordArr.size() > 1)
+ {
+ ImageManager.getInstance().ApplyImageToImageView(news2ImageView, newsRecordArr.get(1).imageId);
+ news2TextView.setText(newsRecordArr.get(1).title);
+ }
+ else
+ {
+ news2ImageView.setImageResource(R.drawable.transparent);
+ news2TextView.setText(R.string.news_record_not_available);
+ }
+
+ if (newsRecordArr.size() > 2)
+ {
+ ImageManager.getInstance().ApplyImageToImageView(news3ImageView, newsRecordArr.get(2).imageId);
+ news3TextView.setText(newsRecordArr.get(2).title);
+ }
+ else
+ {
+ news3ImageView.setImageResource(R.drawable.transparent);
+ news3TextView.setText(R.string.news_record_not_available);
+ }
+
}
-
public class ListAdapter extends BaseAdapter {
private Context mContext;
@@ -151,4 +185,21 @@ public class MainPageFragment extends Fragment {
}
}
+
+
+ @Override
+ public void OnNewsUpdated()
+ {
+ getActivity().runOnUiThread(new Runnable() {
+
+ @Override
+ public void run()
+ {
+ RefreshHeader();
+ }
+
+ });
+ }
+
+
}
diff --git a/android/src/fishrungames/bashgid/NavigationDrawerFragment.java b/android/src/fishrungames/bashgid/NavigationDrawerFragment.java
new file mode 100644
index 0000000..de485e7
--- /dev/null
+++ b/android/src/fishrungames/bashgid/NavigationDrawerFragment.java
@@ -0,0 +1,390 @@
+package fishrungames.bashgid;
+
+
+import android.support.v7.app.ActionBarActivity;
+import android.app.Activity;
+import android.support.v7.app.ActionBar;
+import android.support.v4.app.Fragment;
+import android.support.v7.app.ActionBarDrawerToggle;
+import android.support.v4.view.GravityCompat;
+import android.support.v4.widget.DrawerLayout;
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.content.res.Configuration;
+import android.graphics.Typeface;
+import android.os.Bundle;
+import android.preference.PreferenceManager;
+import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.ViewGroup.LayoutParams;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.BaseAdapter;
+import android.widget.ImageView;
+import android.widget.ListView;
+import android.widget.TextView;
+import android.widget.Toast;
+
+/**
+ * Fragment used for managing interactions for and presentation of a navigation drawer.
+ * See the
+ * design guidelines for a complete explanation of the behaviors implemented here.
+ */
+public class NavigationDrawerFragment extends Fragment {
+
+ /**
+ * Remember the position of the selected item.
+ */
+ private static final String STATE_SELECTED_POSITION = "selected_navigation_drawer_position";
+
+ /**
+ * Per the design guidelines, you should show the drawer on launch until the user manually
+ * expands it. This shared preference tracks this.
+ */
+ private static final String PREF_USER_LEARNED_DRAWER = "navigation_drawer_learned";
+
+ /**
+ * A pointer to the current callbacks instance (the Activity).
+ */
+ private NavigationDrawerCallbacks mCallbacks;
+
+ /**
+ * Helper component that ties the action bar to the navigation drawer.
+ */
+ private ActionBarDrawerToggle mDrawerToggle;
+
+ private DrawerLayout mDrawerLayout;
+ private ListView mDrawerListView;
+ private View mFragmentContainerView;
+
+ private int mCurrentSelectedPosition = 0;
+ private boolean mFromSavedInstanceState;
+ private boolean mUserLearnedDrawer;
+
+ public NavigationDrawerFragment() {
+ String s = "";
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ // Read in the flag indicating whether or not the user has demonstrated awareness of the
+ // drawer. See PREF_USER_LEARNED_DRAWER for details.
+ SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getActivity());
+
+ //Don't need this shit
+ //mUserLearnedDrawer = sp.getBoolean(PREF_USER_LEARNED_DRAWER, false);
+ mUserLearnedDrawer = true;
+
+ if (savedInstanceState != null) {
+ mCurrentSelectedPosition = savedInstanceState.getInt(STATE_SELECTED_POSITION);
+ mFromSavedInstanceState = true;
+ }
+
+ // Select either the default item (0) or the last selected item.
+ selectItem(mCurrentSelectedPosition);
+
+ }
+
+ @Override
+ public void onActivityCreated (Bundle savedInstanceState) {
+ super.onActivityCreated(savedInstanceState);
+ // Indicate that this fragment would like to influence the set of actions in the action bar.
+ setHasOptionsMenu(true);
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ mDrawerListView = (ListView) inflater.inflate(
+ R.layout.fragment_navigation_drawer, container, false);
+ mDrawerListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+ @Override
+ public void onItemClick(AdapterView> parent, View view, int position, long id) {
+ selectItem(position);
+ }
+ });
+
+ mDrawerListView.setAdapter(new DrawerAdapter(getActivity()));
+
+ mDrawerListView.setItemChecked(mCurrentSelectedPosition, true);
+ return mDrawerListView;
+ }
+
+ public boolean isDrawerOpen() {
+ return mDrawerLayout != null && mDrawerLayout.isDrawerOpen(mFragmentContainerView);
+ }
+
+
+ public void EnableDrawer()
+ {
+ mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
+ }
+
+
+ /**
+ * Users of this fragment must call this method to set up the navigation drawer interactions.
+ *
+ * @param fragmentId The android:id of this fragment in its activity's layout.
+ * @param drawerLayout The DrawerLayout containing this fragment's UI.
+ */
+ public void setUp(int fragmentId, DrawerLayout drawerLayout) {
+ mFragmentContainerView = getActivity().findViewById(fragmentId);
+ mDrawerLayout = drawerLayout;
+
+
+ // set a custom shadow that overlays the main content when the drawer opens
+ mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
+ // set up the drawer's list view with items and click listener
+
+ ActionBar actionBar = getActionBar();
+ actionBar.setDisplayHomeAsUpEnabled(true);
+ actionBar.setHomeButtonEnabled(true);
+
+ // ActionBarDrawerToggle ties together the the proper interactions
+ // between the navigation drawer and the action bar app icon.
+
+ mDrawerToggle = new ActionBarDrawerToggle(
+ getActivity(), /* host Activity */
+ mDrawerLayout, /* DrawerLayout object */
+ R.string.navigation_drawer_open, /* "open drawer" description for accessibility */
+ R.string.navigation_drawer_close /* "close drawer" description for accessibility */
+ ) {
+ @Override
+ public void onDrawerClosed(View drawerView) {
+ super.onDrawerClosed(drawerView);
+ if (!isAdded()) {
+ return;
+ }
+
+ //getActivity().supportInvalidateOptionsMenu(); // calls onPrepareOptionsMenu()
+ }
+
+ @Override
+ public void onDrawerOpened(View drawerView) {
+ super.onDrawerOpened(drawerView);
+ if (!isAdded()) {
+ return;
+ }
+
+ if (!mUserLearnedDrawer) {
+ // The user manually opened the drawer; store this flag to prevent auto-showing
+ // the navigation drawer automatically in the future.
+ mUserLearnedDrawer = true;
+ SharedPreferences sp = PreferenceManager
+ .getDefaultSharedPreferences(getActivity());
+ sp.edit().putBoolean(PREF_USER_LEARNED_DRAWER, true).commit();
+ }
+
+ //getActivity().supportInvalidateOptionsMenu(); // calls onPrepareOptionsMenu()
+ }
+ };
+
+ // If the user hasn't 'learned' about the drawer, open it to introduce them to the drawer,
+ // per the navigation drawer design guidelines.
+ if (!mUserLearnedDrawer && !mFromSavedInstanceState) {
+ mDrawerLayout.openDrawer(mFragmentContainerView);
+ }
+
+ // Defer code dependent on restoration of previous instance state.
+ mDrawerLayout.post(new Runnable() {
+ @Override
+ public void run() {
+ mDrawerToggle.syncState();
+ }
+ });
+
+ mDrawerLayout.setDrawerListener(mDrawerToggle);
+
+ mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
+
+ }
+
+ private void selectItem(int position) {
+ mCurrentSelectedPosition = position;
+ if (mDrawerListView != null) {
+ mDrawerListView.setItemChecked(position, true);
+ }
+ if (mDrawerLayout != null) {
+ mDrawerLayout.closeDrawer(mFragmentContainerView);
+ }
+ if (mCallbacks != null) {
+ mCallbacks.onNavigationDrawerItemSelected(position);
+ }
+ }
+
+ @Override
+ public void onAttach(Activity activity) {
+ super.onAttach(activity);
+ try {
+ mCallbacks = (NavigationDrawerCallbacks) activity;
+ } catch (ClassCastException e) {
+ throw new ClassCastException("Activity must implement NavigationDrawerCallbacks.");
+ }
+ }
+
+ @Override
+ public void onDetach() {
+ super.onDetach();
+ mCallbacks = null;
+ }
+
+ @Override
+ public void onSaveInstanceState(Bundle outState) {
+ super.onSaveInstanceState(outState);
+ outState.putInt(STATE_SELECTED_POSITION, mCurrentSelectedPosition);
+ }
+
+ @Override
+ public void onConfigurationChanged(Configuration newConfig) {
+ super.onConfigurationChanged(newConfig);
+ // Forward the new configuration the drawer toggle component.
+ mDrawerToggle.onConfigurationChanged(newConfig);
+ }
+
+ @Override
+ public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
+ // If the drawer is open, show the global app actions in the action bar. See also
+ // showGlobalContextActionBar, which controls the top-left area of the action bar.
+
+
+ inflater.inflate(R.menu.global, menu);
+ showGlobalContextActionBar();
+
+ super.onCreateOptionsMenu(menu, inflater);
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ if (mDrawerToggle.onOptionsItemSelected(item)) {
+ return true;
+ }
+
+ if (item.getItemId() == R.id.action_example) {
+ Toast.makeText(getActivity(), "Example action.", Toast.LENGTH_SHORT).show();
+ return true;
+ }
+
+ return super.onOptionsItemSelected(item);
+ }
+
+ /**
+ * Per the navigation drawer design guidelines, updates the action bar to show the global app
+ * 'context', rather than just what's in the current screen.
+ */
+ private void showGlobalContextActionBar() {
+ ActionBar actionBar = getActionBar();
+ actionBar.setDisplayShowTitleEnabled(true);
+ //actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
+ actionBar.setTitle(R.string.app_name);
+ }
+
+ private ActionBar getActionBar() {
+ return ((ActionBarActivity) getActivity()).getSupportActionBar();
+ }
+
+ /**
+ * Callbacks interface that all activities using this fragment must implement.
+ */
+ public static interface NavigationDrawerCallbacks {
+ /**
+ * Called when an item in the navigation drawer is selected.
+ */
+ void onNavigationDrawerItemSelected(int position);
+ }
+
+
+
+ public class DrawerAdapter extends BaseAdapter {
+ private Context mContext;
+
+ final String [] titles = {
+ "Виртуальный гид",
+ "Гид",
+ "Новости",
+ "Каталог",
+ "Карта",
+ "Видео",
+ "Фотогалерея",
+ "Инвестору",
+ "Настройки"
+ };
+
+ final int [] iconIds = {
+ R.drawable.drawer_bashgid_logo,
+ R.drawable.drawer_agenda,
+ R.drawable.drawer_news,
+ R.drawable.drawer_book,
+ R.drawable.drawer_pushpin,
+ R.drawable.drawer_tv,
+ R.drawable.drawer_photography,
+ R.drawable.drawer_id,
+ R.drawable.drawer_gear
+ };
+
+ public DrawerAdapter(Context c) {
+ mContext = c;
+ }
+
+ public int getCount() {
+ return titles.length;
+ }
+
+ public Object getItem(int position) {
+ return null;
+ }
+
+ public long getItemId(int position) {
+ return 0;
+ }
+
+ // create a new ImageView for each item referenced by the Adapter
+ public View getView(int position, View convertView, ViewGroup parent) {
+
+
+ View view;
+ if (convertView == null) { // if it's not recycled, initialize some attributes
+ LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ view = inflater.inflate(R.layout.drawer_list_element, null);
+
+
+ } else {
+ view = convertView;
+ }
+
+ TextView textView = (TextView) view.findViewById(R.id.textView);
+
+ textView.setText(titles[position]);
+
+ ImageView imageView = (ImageView) view.findViewById(R.id.imageView);
+
+ imageView.setImageResource(iconIds[position]);
+
+ if (position == 0)
+ {
+ LayoutParams params = imageView.getLayoutParams();
+ params.width = 96;
+ params.height = 96;
+ imageView.setLayoutParams(params);
+
+ textView.setTypeface(null, Typeface.BOLD);
+ }
+ else
+ {
+ LayoutParams params = imageView.getLayoutParams();
+ params.width = 24;
+ params.height = 24;
+ imageView.setLayoutParams(params);
+
+ textView.setTypeface(null, Typeface.NORMAL);
+ }
+
+ return view;
+ }
+ }
+}
diff --git a/android/src/fishrungames/bashgid/WelcomeFragment.java b/android/src/fishrungames/bashgid/WelcomeFragment.java
index b209e0c..3d18ac6 100644
--- a/android/src/fishrungames/bashgid/WelcomeFragment.java
+++ b/android/src/fishrungames/bashgid/WelcomeFragment.java
@@ -5,12 +5,33 @@ import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.view.animation.Animation;
+import android.view.animation.AnimationUtils;
+import android.widget.ImageView;
public class WelcomeFragment extends Fragment {
+
+ View rootView;
+
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
- View rootView = inflater.inflate(R.layout.fragment_welcome, container, false);
+ rootView = inflater.inflate(R.layout.fragment_welcome, container, false);
return rootView;
}
+
+ @Override
+ public void onResume()
+ {
+ super.onResume();
+
+ ImageView flagView1 = (ImageView) rootView.findViewById(R.id.image_flag_china);
+ ImageView flagView2 = (ImageView) rootView.findViewById(R.id.image_flag_russia);
+ ImageView flagView3 = (ImageView) rootView.findViewById(R.id.image_flag_usa);
+
+ Animation animation = AnimationUtils.loadAnimation(getActivity(), R.anim.language_flag_in);
+ flagView1.startAnimation(animation);
+ flagView2.startAnimation(animation);
+ flagView3.startAnimation(animation);
+ }
}
diff --git a/android/src/fishrungames/bashgid/core/DownloadManager.java b/android/src/fishrungames/bashgid/core/DownloadManager.java
new file mode 100644
index 0000000..e42aef8
--- /dev/null
+++ b/android/src/fishrungames/bashgid/core/DownloadManager.java
@@ -0,0 +1,57 @@
+package fishrungames.bashgid.core;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.UnsupportedEncodingException;
+import java.net.URL;
+import java.net.URLConnection;
+
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.util.ByteArrayBuffer;
+import org.apache.http.util.CharArrayBuffer;
+import org.apache.http.util.EntityUtils;
+
+public class DownloadManager {
+
+ public static String getXmlFromUrl(String urlString) {
+ String xml = null;
+
+ try {
+ // defaultHttpClient
+
+ URL url = new URL(urlString);
+ URLConnection ucon = url.openConnection();
+
+ BufferedReader in = new BufferedReader(new InputStreamReader(
+ ucon.getInputStream()));
+ String inputLine;
+
+ StringBuilder stringBuilder = new StringBuilder();
+
+ while ((inputLine = in.readLine()) != null)
+ {
+ stringBuilder.append(inputLine);
+ }
+
+
+ xml = stringBuilder.toString();
+
+
+ } catch (UnsupportedEncodingException e) {
+ e.printStackTrace();
+ } catch (ClientProtocolException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ // return XML
+ return xml;
+ }
+}
diff --git a/android/src/fishrungames/bashgid/core/ImageManager.java b/android/src/fishrungames/bashgid/core/ImageManager.java
new file mode 100644
index 0000000..6f04397
--- /dev/null
+++ b/android/src/fishrungames/bashgid/core/ImageManager.java
@@ -0,0 +1,56 @@
+package fishrungames.bashgid.core;
+
+import java.util.HashMap;
+
+import fishrungames.bashgid.R;
+
+import android.util.Log;
+import android.widget.ImageView;
+
+public class ImageManager {
+
+ static ImageManager instance = null;
+
+ public static ImageManager getInstance()
+ {
+ if (instance == null)
+ {
+ instance = new ImageManager();
+ }
+
+ return instance;
+ }
+
+
+ HashMap PredefinedImageId = new HashMap();
+
+ public ImageManager()
+ {
+ PredefinedImageId.put("R.drawable.news_image1", R.drawable.news_image1);
+ PredefinedImageId.put("R.drawable.news_image2", R.drawable.news_image2);
+ PredefinedImageId.put("R.drawable.news_image3", R.drawable.news_image3);
+ }
+
+
+
+
+ public void ApplyImageToImageView(ImageView imageView, String imageId)
+ {
+ if (imageId.startsWith("R.drawable."))
+ {
+ Integer resourceId = PredefinedImageId.get(imageId);
+
+ if (resourceId == null)
+ {
+ Log.e("Error: ", "Image not added to PredefinedImageId: " + imageId);
+
+ resourceId = R.drawable.transparent;
+ }
+
+ imageView.setImageResource(resourceId);
+ }
+ }
+
+
+
+}
diff --git a/android/src/fishrungames/bashgid/core/NewsManager.java b/android/src/fishrungames/bashgid/core/NewsManager.java
new file mode 100644
index 0000000..c122030
--- /dev/null
+++ b/android/src/fishrungames/bashgid/core/NewsManager.java
@@ -0,0 +1,106 @@
+package fishrungames.bashgid.core;
+
+import java.util.ArrayList;
+
+public class NewsManager {
+
+ private static NewsManager instance = null;
+
+
+ public static NewsManager GetInstance()
+ {
+ if (instance == null)
+ {
+ instance = new NewsManager();
+ }
+
+ return instance;
+ }
+
+
+ public static class NewsRecord
+ {
+ public String title;
+ public String description;
+ public String imageId;
+
+ NewsRecord(String title, String description, String imageId)
+ {
+ this.title = title;
+ this.description = description;
+ this.imageId = imageId;
+ }
+
+ NewsRecord(RssReader.Rss2Item rss2Item)
+ {
+ this.title = rss2Item.title;
+ this.description = rss2Item.description;
+ this.imageId = "R.drawable.news_image1";
+ }
+ }
+
+ ArrayList newsRecord = new ArrayList();
+
+ public void DownloadNews(NewsUpdatedCallbackInterface callback)
+ {
+ Thread thread = new Thread(new DownloadNewsRunnable(callback));
+
+ thread.start();
+ }
+
+ class DownloadNewsRunnable implements Runnable
+ {
+
+ NewsUpdatedCallbackInterface callback;
+
+ public DownloadNewsRunnable(NewsUpdatedCallbackInterface callback)
+ {
+ this.callback = callback;
+ }
+
+ @Override
+ public void run()
+ {
+ String xmlCode = DownloadManager.getXmlFromUrl("http://www.bashinform.ru/rss/all.xml");
+
+ RssReader rssReader = new RssReader();
+
+ rssReader.ReadRss(xmlCode);
+
+ ArrayList localNewsRecord = new ArrayList();
+
+ for (RssReader.Rss2Item rss2Item : rssReader.rss2ItemArr)
+ {
+ localNewsRecord.add(new NewsRecord(rss2Item));
+ }
+
+ //Xperimental -- need mutex right here
+ newsRecord = localNewsRecord;
+
+ callback.OnNewsUpdated();
+ }
+ }
+
+ public static interface NewsUpdatedCallbackInterface
+ {
+ public void OnNewsUpdated();
+ }
+
+
+ public NewsManager()
+ {
+ newsRecord.add(new NewsRecord("Власти Башкирии создадут выезд из Уфы на трассу М-5 «Урал»", "Власти Башкирии создадут выезд из Уфы на трассу М-5 «Урал»", "R.drawable.news_image1"));
+ newsRecord.add(new NewsRecord("Башкирия заняла первое место индекса «деловой активности»", "Башкирия заняла первое место индекса «деловой активности»", "R.drawable.news_image2"));
+ newsRecord.add(new NewsRecord("«Салават Юлаев» обыграл «Ладу» и прервал серию из 5 поражений в КХЛ", "«Салават Юлаев» обыграл «Ладу» и прервал серию из 5 поражений в КХЛ", "R.drawable.news_image3"));
+ }
+
+
+ public ArrayList getNews()
+ {
+ return newsRecord;
+ }
+
+
+
+
+}
diff --git a/android/src/fishrungames/bashgid/core/RssReader.java b/android/src/fishrungames/bashgid/core/RssReader.java
new file mode 100644
index 0000000..5c94545
--- /dev/null
+++ b/android/src/fishrungames/bashgid/core/RssReader.java
@@ -0,0 +1,133 @@
+package fishrungames.bashgid.core;
+
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Locale;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+public class RssReader {
+
+
+
+ public static class Rss2Item
+ {
+ String title;
+ String link;
+ String description;
+
+ public static class Rss2Enclosure
+ {
+ String url;
+ int length;
+ String mimeType;
+ int width;
+ int height;
+
+ Rss2Enclosure()
+ {
+ url = null;
+ length = 0;
+ mimeType = null;
+ width = 0;
+ height = 0;
+ }
+
+ Rss2Enclosure(String url, int length, String mimeType, int width, int height)
+ {
+ this.url = url;
+ this.length = length;
+ this.mimeType = mimeType;
+ this.width = width;
+ this.height = height;
+ }
+ }
+
+ Rss2Enclosure rss2Enclosure;
+
+ Date pubDate;
+
+ Rss2Item(String title, String link, String description, Rss2Enclosure rss2Enclosure, Date pubDate)
+ {
+ this.title = title;
+ this.link = link;
+ this.description = description;
+ this.rss2Enclosure = rss2Enclosure;
+ this.pubDate = pubDate;
+
+ }
+
+ }
+
+ ArrayList rss2ItemArr = new ArrayList();
+
+ void Clear()
+ {
+ rss2ItemArr.clear();
+ }
+
+ void ReadRss(String xmlCode)
+ {
+ Document xmlDoc = XmlProcessor.getDomElement(xmlCode);
+
+
+ Element channel = (Element) xmlDoc.getElementsByTagName("channel").item(0);
+
+ NodeList nl = channel.getElementsByTagName("item");
+
+
+ // looping through all item nodes -
+ for (int i = 0; i < nl.getLength(); i++) {
+
+ Element e = (Element) nl.item(i);
+
+ String title = XmlProcessor.getValue(e, "title");
+ String link = XmlProcessor.getValue(e, "link");
+ String description = XmlProcessor.getValue(e, "description"); // description child value
+
+
+ SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z", Locale.US);
+
+ Date pubDate = new Date();
+
+ try {
+ pubDate = dateFormat.parse(XmlProcessor.getValue(e, "pubDate"));
+ } catch (ParseException e1) {
+ e1.printStackTrace();
+ }
+
+
+ NodeList nodeList = e.getElementsByTagName("enclosure");
+
+ Rss2Item.Rss2Enclosure rss2Enclosure = null;
+
+ if (nodeList.getLength() != 0)
+ {
+
+ String enclosureUrl = XmlProcessor.getAttributeValue(e, "enclosure", "url");
+ String enclosureLengthStr = XmlProcessor.getAttributeValue(e, "enclosure", "length");
+ int enclosureLength = Integer.valueOf(enclosureLengthStr);
+ String enclosureMimeType = XmlProcessor.getAttributeValue(e, "enclosure", "type");
+ int enclosureWidth = Integer.valueOf(XmlProcessor.getAttributeValue(e, "enclosure", "width"));
+ int enclosureHeight = Integer.valueOf(XmlProcessor.getAttributeValue(e, "enclosure", "height"));
+
+
+ rss2Enclosure = new Rss2Item.Rss2Enclosure(enclosureUrl, enclosureLength, enclosureMimeType, enclosureHeight, enclosureWidth);
+
+ }
+
+
+ Rss2Item rss2Item = new Rss2Item(title, link, description, rss2Enclosure, pubDate);
+
+ rss2ItemArr.add(rss2Item);
+
+ }
+ }
+
+
+}
diff --git a/android/src/fishrungames/bashgid/core/XmlProcessor.java b/android/src/fishrungames/bashgid/core/XmlProcessor.java
new file mode 100644
index 0000000..2247774
--- /dev/null
+++ b/android/src/fishrungames/bashgid/core/XmlProcessor.java
@@ -0,0 +1,105 @@
+package fishrungames.bashgid.core;
+
+import java.io.IOException;
+import java.io.StringReader;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+import android.util.Log;
+
+public class XmlProcessor
+{
+
+ public static Document getDomElement(String xml)
+ {
+ Document doc = null;
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ try
+ {
+
+ DocumentBuilder db = dbf.newDocumentBuilder();
+
+ InputSource is = new InputSource();
+ is.setCharacterStream(new StringReader(xml));
+ doc = db.parse(is);
+
+ } catch (ParserConfigurationException e)
+ {
+ Log.e("Error: ", e.getMessage());
+ return null;
+ } catch (SAXException e)
+ {
+ Log.e("Error: ", e.getMessage());
+ return null;
+ } catch (IOException e)
+ {
+ Log.e("Error: ", e.getMessage());
+ return null;
+ }
+
+ return doc;
+ }
+
+ public static String getValue(Element item, String str)
+ {
+ NodeList n = item.getElementsByTagName(str);
+ return getElementValue(n.item(0));
+ }
+
+ public static String getAttributeValue(Element item, String str, String attr)
+ {
+ NodeList n = item.getElementsByTagName(str);
+ return getElementAttributeValue(n.item(0), attr);
+ }
+
+ public static final String getElementValue(Node elem)
+ {
+ Node child;
+ if (elem != null)
+ {
+ if (elem.hasChildNodes())
+ {
+ for (child = elem.getFirstChild(); child != null; child = child.getNextSibling())
+ {
+ if (child.getNodeType() == Node.TEXT_NODE)
+ {
+ return child.getNodeValue();
+ }
+ }
+ }
+ }
+ return "";
+ }
+
+ public static final String getElementAttributeValue(Node elem, String attr)
+ {
+ Node child;
+ if (elem != null)
+ {
+
+
+ if (elem.hasAttributes())
+ {
+ child = elem.getAttributes().getNamedItem(attr);
+ if (child.getNodeName().equals(attr))
+ {
+ String childNodeValue = child.getNodeValue();
+ return childNodeValue;
+ }
+ }
+ }
+
+ return "";
+ }
+
+
+}