New vision + RSS

This commit is contained in:
Vladislav Khorev 2014-11-12 03:34:24 +00:00
parent 6f57fe72c6
commit 628f816a9e
47 changed files with 1440 additions and 236 deletions

View File

@ -5,9 +5,5 @@
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/> <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/> <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/HorizontalListViewLibrary"/>
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/android-support-v7-appcompat"/>
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/android-support-v7-gridlayout"/>
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/android-support-v7-mediarouter"/>
<classpathentry kind="output" path="bin/classes"/> <classpathentry kind="output" path="bin/classes"/>
</classpath> </classpath>

View File

@ -2,3 +2,283 @@ eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.source=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

View File

@ -8,6 +8,8 @@
android:minSdkVersion="11" android:minSdkVersion="11"
android:targetSdkVersion="21" /> android:targetSdkVersion="21" />
<uses-permission android:name="android.permission.INTERNET" />
<application <application
android:allowBackup="true" android:allowBackup="true"
android:icon="@drawable/ic_launcher" android:icon="@drawable/ic_launcher"

View File

@ -11,8 +11,6 @@
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target. # Project target.
target=android-20 target=android-21
android.library.reference.1=..\\HorizontalListViewLibrary android.library.reference.1=..\\appcompat_v7
android.library.reference.2=../android-support-v7-appcompat android.library.reference.2=../HorizontalListViewLibrary
android.library.reference.3=../android-support-v7-gridlayout
android.library.reference.4=../android-support-v7-mediarouter

View File

@ -0,0 +1,30 @@
<set xmlns:android="http://schemas.android.com/apk/res/android">
<scale xmlns:android="http://schemas.android.com/apk/res/android"
android:fromXScale="0.0"
android:toXScale="1.0"
android:fromYScale="0.0"
android:toYScale="1.0"
android:duration="1000"
android:pivotX="50%"
android:pivotY="50%" >
</scale>
<translate
android:fromXDelta="0"
android:toXDelta="0"
android:fromYDelta="800"
android:toYDelta="0"
android:duration="1000" />
<alpha
android:fromAlpha="0"
android:toAlpha="1"
android:duration="1000" >
</alpha>
</set>

View File

@ -1,12 +0,0 @@
<set xmlns:android="http://schemas.android.com/apk/res/android">
<objectAnimator
android:valueFrom="0"
android:valueTo="200"
android:propertyName="flag_in"
android:interpolator="@android:interpolator/accelerate_decelerate"
android:duration="@integer/flag_in_time" />
</set>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 794 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 794 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 565 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 608 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1022 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 718 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 727 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 553 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1006 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 625 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1006 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 617 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_focused="true" android:state_pressed="false" android:drawable="@drawable/see_more" />
<item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/see_more_highlighted" />
<item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/see_more_highlighted" />
<item android:drawable="@drawable/see_more" />
</selector>

View File

@ -0,0 +1,8 @@
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/see_more"/>
<item>
<shape>
<solid android:color="@color/button_highlighted" />
</shape>
</item>
</layer-list>

View File

@ -1,6 +1,24 @@
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="fishrungames.bashgid.MainActivity" >
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/fragment_proto_container" android:id="@+id/fragment_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" > android:layout_height="match_parent" >
</FrameLayout> </FrameLayout>
<fragment
android:id="@+id/navigation_drawer"
android:name="fishrungames.bashgid.NavigationDrawerFragment"
android:layout_width="@dimen/navigation_drawer_width"
android:layout_height="match_parent"
android:layout_gravity="start"
tools:layout="@layout/fragment_navigation_drawer" />
</android.support.v4.widget.DrawerLayout>

View File

@ -1,12 +0,0 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/fragment_proto_container"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<fragment android:name="fishrungames.bashgid.MainPageFragment"
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>

View File

@ -4,13 +4,15 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
android:orientation="horizontal" > android:orientation="horizontal"
android:padding="4dp" >
<ImageView <ImageView
android:id="@+id/imageView" android:id="@+id/imageView"
android:layout_width="wrap_content" android:layout_width="24dp"
android:layout_height="wrap_content" android:layout_height="24dp"
android:layout_margin="4dp" android:layout_margin="4dp"
android:layout_marginLeft="10dp"
android:src="@drawable/test_drawer_icon" /> android:src="@drawable/test_drawer_icon" />
<TextView <TextView
@ -19,8 +21,9 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_margin="4dp" android:layout_margin="4dp"
android:paddingLeft="10dp"
android:text="TextView" android:text="TextView"
android:textColor="@color/text_white" android:textColor="@color/text_white"
android:textSize="24sp" /> android:textSize="20sp" />
</LinearLayout> </LinearLayout>

View File

@ -1,28 +0,0 @@
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="fishrungames.bashgid.MainActivity" >
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</FrameLayout>
<ListView android:id="@+id/left_drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:divider="@android:color/transparent"
android:dividerHeight="0dp"
android:background="#111"/>
</android.support.v4.widget.DrawerLayout>

View File

@ -3,41 +3,19 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_margin="0dp" android:layout_margin="0dp"
android:background="@drawable/background" android:background="@color/bkg2"
android:orientation="vertical" android:orientation="vertical"
tools:context="fishrungames.bashgid.MainPageFragment" > tools:context="fishrungames.bashgid.MainPageFragment" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp" >
<EditText
android:id="@+id/editText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10" >
<requestFocus />
</EditText>
<ImageButton
android:id="@+id/searchButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:background="@drawable/transparent"
android:padding="8dp"
android:src="@drawable/abc_ic_search" />
</LinearLayout>
<ListView <ListView
android:id="@+id/listView" android:id="@+id/listView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:divider="@drawable/transparent" android:divider="@drawable/transparent"
android:dividerHeight="18dp" > android:dividerHeight="18dp"
android:paddingBottom="16dp" >
</ListView> </ListView>

View File

@ -0,0 +1,13 @@
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawerListView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/drawer_color"
android:choiceMode="singleChoice"
android:divider="@color/drawer_divider_color"
android:dividerHeight="1dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
tools:context="fishrungames.bashgid.NavigationDrawerFragment" />

View File

@ -3,7 +3,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="4dp" android:layout_margin="4dp"
android:background="@color/light_blue" android:background="@color/bkg1"
android:orientation="vertical" android:orientation="vertical"
android:paddingBottom="4dp" android:paddingBottom="4dp"
android:paddingTop="4dp" android:paddingTop="4dp"
@ -11,21 +11,29 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" > android:layout_height="wrap_content"
android:gravity="top" >
<TextView <TextView
android:id="@+id/textView" android:id="@+id/textView"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1" android:layout_weight="1"
android:text="TextView" /> android:paddingLeft="16dp"
android:textSize="16sp"
android:textStyle="bold" />
<Button <Button
android:id="@+id/button" android:id="@+id/button"
android:layout_width="wrap_content" android:layout_width="152dp"
android:layout_height="wrap_content" android:layout_height="24dp"
android:gravity="center_vertical|right|center_horizontal" android:layout_margin="8dp"
android:text="Button" /> android:background="@drawable/see_more_button"
android:gravity="right|center_vertical"
android:paddingRight="28dp"
android:text="Узнать больше"
android:textSize="16sp" />
</LinearLayout> </LinearLayout>
@ -33,6 +41,7 @@
android:id="@+id/hListView" android:id="@+id/hListView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" > android:layout_height="wrap_content" >
</it.sephiroth.android.library.widget.HListView> </it.sephiroth.android.library.widget.HListView>
</LinearLayout> </LinearLayout>

View File

@ -2,11 +2,10 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_margin="0dp" android:background="@color/bkg1"
android:background="@color/light_blue"
android:orientation="vertical" android:orientation="vertical"
android:paddingLeft="30dp" android:paddingLeft="20dp"
android:paddingRight="30dp" android:paddingRight="20dp"
tools:context="fishrungames.bashgid.MainPageFragment" > tools:context="fishrungames.bashgid.MainPageFragment" >
<TextView <TextView
@ -15,64 +14,73 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:layout_margin="8dp" android:layout_margin="8dp"
android:text="Новости" android:text="@string/news_header"
android:textSize="24sp" android:textSize="24sp"
android:textStyle="bold" /> android:textStyle="bold" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="8dp" > android:layout_marginBottom="8dp"
android:layout_marginTop="8dp" >
<ImageView <ImageView
android:id="@+id/news1ImageView" android:id="@+id/news1ImageView"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" /> android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:contentDescription="@string/news_content_description_1" />
<TextView <TextView
android:id="@+id/news1TextView" android:id="@+id/news1TextView"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="8dp" android:layout_gravity="center_vertical"
android:text="TextView" /> android:layout_marginLeft="8dp" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="8dp" > android:layout_marginBottom="8dp"
android:layout_marginTop="8dp" >
<ImageView <ImageView
android:id="@+id/news2ImageView" android:id="@+id/news2ImageView"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" /> android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:contentDescription="@string/news_content_description_2" />
<TextView <TextView
android:id="@+id/news2TextView" android:id="@+id/news2TextView"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="8dp" android:layout_gravity="center_vertical"
android:text="TextView" /> android:layout_marginLeft="8dp" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="8dp" > android:layout_marginBottom="8dp"
android:layout_marginTop="8dp" >
<ImageView <ImageView
android:id="@+id/news3ImageView" android:id="@+id/news3ImageView"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" /> android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:contentDescription="@string/news_content_description_3" />
<TextView <TextView
android:id="@+id/news3TextView" android:id="@+id/news3TextView"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="8dp" android:layout_gravity="center_vertical"
android:text="TextView" /> android:layout_marginLeft="8dp" />
</LinearLayout> </LinearLayout>
@ -81,6 +89,6 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:text="Button" /> android:text="@string/other_news" />
</LinearLayout> </LinearLayout>

View File

@ -1,10 +1,10 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android" <menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" > xmlns:app="http://schemas.android.com/apk/res-auto" >
<item <item android:id="@+id/search"
android:id="@+id/action_settings" android:title="@string/search_title"
android:orderInCategory="100" android:icon="@drawable/abc_ic_search_api_mtrl_alpha"
android:title="@string/action_settings" app:showAsAction="always"
app:showAsAction="never"/> android:actionViewClass="android.widget.SearchView" />
</menu> </menu>

View File

@ -18,6 +18,15 @@
<color name="light_blue">#BCDEFF</color> <color name="light_blue">#BCDEFF</color>
<color name="bkg1">#F0F0F0</color>
<color name="bkg2">#d0d0d0</color>
<color name="drawer_color">#202020</color>
<color name="drawer_divider_color">#404040</color>

View File

@ -16,6 +16,18 @@
<string name="search_title">Поиск</string>
<string name="news_record_not_available">Запись недоступна</string>
<string name="other_news">Другие новости...</string>
<string name="news_header">Новости</string>
<string name="news_content_description_1">Image related to news record</string>
<string name="news_content_description_2">Image related to news record</string>
<string name="news_content_description_3">Image related to news record</string>
<string name="RB_Coat">Coat of Bashkortostan</string> <string name="RB_Coat">Coat of Bashkortostan</string>

View File

@ -1,5 +1,7 @@
package fishrungames.bashgid; package fishrungames.bashgid;
import android.app.Activity; import android.app.Activity;
import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBar;
@ -17,31 +19,38 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.support.v4.widget.DrawerLayout; import android.support.v4.widget.DrawerLayout;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView; import android.widget.TextView;
public class MainActivity extends ActionBarActivity { public class MainActivity extends ActionBarActivity
implements NavigationDrawerFragment.NavigationDrawerCallbacks {
static MainActivity instance = null; static MainActivity instance = null;
private NavigationDrawerFragment mNavigationDrawerFragment = null;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main); setContentView(R.layout.activity_main);
getSupportActionBar().hide(); SetupDrawer();
getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, new WelcomeFragment()).commit();
getSupportFragmentManager().beginTransaction().add(R.id.fragment_proto_container, new WelcomeFragment()).commit();
instance = this; instance = this;
it.sephiroth.android.library.widget.HListView hx;
} }
public static MainActivity getInstance() public static MainActivity getInstance()
{ {
return instance; return instance;
@ -72,15 +81,39 @@ public class MainActivity extends ActionBarActivity {
public void OpenMainScreen() public void OpenMainScreen()
{ {
//getSupportActionBar().show(); //mainFragment = new MainFragment();
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_proto_container, new MainFragment()).commit(); getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new MainPageFragment()).commit();
getSupportFragmentManager().beginTransaction().add(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 @Override
public boolean onCreateOptionsMenu(Menu menu) { public boolean onCreateOptionsMenu(Menu menu) {
@ -101,4 +134,18 @@ public class MainActivity extends ActionBarActivity {
} }
@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();
}
} }

View File

@ -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;
}
}
}

View File

@ -1,5 +1,10 @@
package fishrungames.bashgid; 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.content.Context;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
@ -13,7 +18,7 @@ import android.widget.ListView;
import android.widget.TextView; import android.widget.TextView;
import it.sephiroth.android.library.widget.HListView; import it.sephiroth.android.library.widget.HListView;
public class MainPageFragment extends Fragment { public class MainPageFragment extends Fragment implements NewsUpdatedCallbackInterface {
String [] teaserHeaderArray = { "Для инвестора", "Культура Башкортостана", "Для гостей и туристов", "Образование" }; String [] teaserHeaderArray = { "Для инвестора", "Культура Башкортостана", "Для гостей и туристов", "Образование" };
@ -38,6 +43,7 @@ public class MainPageFragment extends Fragment {
ListView listView; ListView listView;
View header;
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
@ -47,9 +53,11 @@ public class MainPageFragment extends Fragment {
listView.setAdapter(new ListAdapter(getActivity())); 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); 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 news1ImageView = (ImageView) header.findViewById(R.id.news1ImageView);
ImageView news2ImageView = (ImageView) header.findViewById(R.id.news2ImageView); ImageView news2ImageView = (ImageView) header.findViewById(R.id.news2ImageView);
ImageView news3ImageView = (ImageView) header.findViewById(R.id.news3ImageView); 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 news2TextView = (TextView)header.findViewById(R.id.news2TextView);
TextView news3TextView = (TextView)header.findViewById(R.id.news3TextView); 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 «Урал»"); ArrayList<NewsManager.NewsRecord> newsRecordArr = NewsManager.GetInstance().getNews();
news2TextView.setText("Башкирия заняла первое место индекса «деловой активности»");
news3TextView.setText("«Салават Юлаев» обыграл «Ладу» и прервал серию из 5 поражений в КХЛ");
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);
}
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);
}
moreNewsButton.setText("Другие новости...");
} }
public class ListAdapter extends BaseAdapter { public class ListAdapter extends BaseAdapter {
private Context mContext; 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();
}
});
}
} }

View File

@ -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 <a href="https://developer.android.com/design/patterns/navigation-drawer.html#Interaction">
* design guidelines</a> 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;
}
}
}

View File

@ -5,12 +5,33 @@ import android.support.v4.app.Fragment;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
public class WelcomeFragment extends Fragment { public class WelcomeFragment extends Fragment {
View rootView;
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 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; 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);
}
} }

View File

@ -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;
}
}

View File

@ -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<String, Integer> PredefinedImageId = new HashMap<String, Integer>();
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);
}
}
}

View File

@ -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> newsRecord = new ArrayList<NewsRecord>();
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<NewsRecord> localNewsRecord = new ArrayList<NewsRecord>();
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<NewsRecord> getNews()
{
return newsRecord;
}
}

View File

@ -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<Rss2Item> rss2ItemArr = new ArrayList<Rss2Item>();
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 <item>
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);
}
}
}

View File

@ -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 "";
}
}