This commit is contained in:
Muntashir Al-Islam 2020-08-02 14:14:02 +06:00
commit 283280529b
140 changed files with 2267 additions and 931 deletions

358
.editorconfig Normal file
View file

@ -0,0 +1,358 @@
root = true
[*]
# charset = utf-8
# end_of_line = lf
# indent_size = 4
# indent_style = space
# insert_final_newline = false
# max_line_length = 100
# tab_width = 4
# ij_continuation_indent_size = 8
# ij_formatter_off_tag = @formatter:off
# ij_formatter_on_tag = @formatter:on
# ij_formatter_tags_enabled = false
# ij_smart_tabs = false
# ij_wrap_on_typing = false
[*.java]
# ij_java_align_consecutive_assignments = false
# ij_java_align_consecutive_variable_declarations = false
# ij_java_align_group_field_declarations = false
# ij_java_align_multiline_annotation_parameters = false
# ij_java_align_multiline_array_initializer_expression = false
# ij_java_align_multiline_assignment = false
# ij_java_align_multiline_binary_operation = false
# ij_java_align_multiline_chained_methods = false
# ij_java_align_multiline_extends_list = false
# ij_java_align_multiline_for = true
# ij_java_align_multiline_method_parentheses = false
# ij_java_align_multiline_parameters = true
# ij_java_align_multiline_parameters_in_calls = false
# ij_java_align_multiline_parenthesized_expression = false
# ij_java_align_multiline_resources = true
# ij_java_align_multiline_ternary_operation = false
# ij_java_align_multiline_text_blocks = false
# ij_java_align_multiline_throws_list = false
# ij_java_align_subsequent_simple_methods = false
# ij_java_align_throws_keyword = false
# ij_java_annotation_parameter_wrap = off
# ij_java_array_initializer_new_line_after_left_brace = false
# ij_java_array_initializer_right_brace_on_new_line = false
# ij_java_array_initializer_wrap = off
# ij_java_assert_statement_colon_on_next_line = false
# ij_java_assert_statement_wrap = off
# ij_java_assignment_wrap = off
# ij_java_binary_operation_sign_on_next_line = false
# ij_java_binary_operation_wrap = off
# ij_java_blank_lines_after_anonymous_class_header = 0
# ij_java_blank_lines_after_class_header = 0
# ij_java_blank_lines_after_imports = 1
# ij_java_blank_lines_after_package = 1
# ij_java_blank_lines_around_class = 1
# ij_java_blank_lines_around_field = 0
# ij_java_blank_lines_around_field_in_interface = 0
# ij_java_blank_lines_around_initializer = 1
# ij_java_blank_lines_around_method = 1
# ij_java_blank_lines_around_method_in_interface = 1
# ij_java_blank_lines_before_class_end = 0
# ij_java_blank_lines_before_imports = 1
# ij_java_blank_lines_before_method_body = 0
# ij_java_blank_lines_before_package = 0
# ij_java_block_brace_style = end_of_line
# ij_java_block_comment_at_first_column = true
# ij_java_call_parameters_new_line_after_left_paren = false
# ij_java_call_parameters_right_paren_on_new_line = false
# ij_java_call_parameters_wrap = off
# ij_java_case_statement_on_separate_line = true
# ij_java_catch_on_new_line = false
# ij_java_class_annotation_wrap = split_into_lines
# ij_java_class_brace_style = end_of_line
# ij_java_class_count_to_use_import_on_demand = 99
# ij_java_class_names_in_javadoc = 1
# ij_java_do_not_indent_top_level_class_members = false
# ij_java_do_not_wrap_after_single_annotation = false
# ij_java_do_while_brace_force = never
# ij_java_doc_add_blank_line_after_description = true
# ij_java_doc_add_blank_line_after_param_comments = false
# ij_java_doc_add_blank_line_after_return = false
# ij_java_doc_add_p_tag_on_empty_lines = true
# ij_java_doc_align_exception_comments = true
# ij_java_doc_align_param_comments = true
# ij_java_doc_do_not_wrap_if_one_line = false
# ij_java_doc_enable_formatting = true
# ij_java_doc_enable_leading_asterisks = true
# ij_java_doc_indent_on_continuation = false
# ij_java_doc_keep_empty_lines = true
# ij_java_doc_keep_empty_parameter_tag = true
# ij_java_doc_keep_empty_return_tag = true
# ij_java_doc_keep_empty_throws_tag = true
# ij_java_doc_keep_invalid_tags = true
# ij_java_doc_param_description_on_new_line = false
# ij_java_doc_preserve_line_breaks = false
# ij_java_doc_use_throws_not_exception_tag = true
# ij_java_else_on_new_line = false
# ij_java_enum_constants_wrap = off
# ij_java_extends_keyword_wrap = off
# ij_java_extends_list_wrap = off
# ij_java_field_annotation_wrap = split_into_lines
# ij_java_finally_on_new_line = false
# ij_java_for_brace_force = never
# ij_java_for_statement_new_line_after_left_paren = false
# ij_java_for_statement_right_paren_on_new_line = false
# ij_java_for_statement_wrap = off
# ij_java_generate_final_locals = false
# ij_java_generate_final_parameters = false
# ij_java_if_brace_force = never
# ij_java_imports_layout = android.**,|,androidx.**,|,com.**,|,junit.**,|,net.**,|,org.**,|,java.**,|,javax.**,|,*,|,$*,|
# ij_java_indent_case_from_switch = true
# ij_java_insert_inner_class_imports = false
# ij_java_insert_override_annotation = true
# ij_java_keep_blank_lines_before_right_brace = 2
# ij_java_keep_blank_lines_between_package_declaration_and_header = 2
# ij_java_keep_blank_lines_in_code = 2
# ij_java_keep_blank_lines_in_declarations = 2
# ij_java_keep_control_statement_in_one_line = true
# ij_java_keep_first_column_comment = true
# ij_java_keep_indents_on_empty_lines = false
# ij_java_keep_line_breaks = true
# ij_java_keep_multiple_expressions_in_one_line = false
# ij_java_keep_simple_blocks_in_one_line = false
# ij_java_keep_simple_classes_in_one_line = false
# ij_java_keep_simple_lambdas_in_one_line = false
# ij_java_keep_simple_methods_in_one_line = false
# ij_java_label_indent_absolute = false
# ij_java_label_indent_size = 0
# ij_java_lambda_brace_style = end_of_line
# ij_java_layout_static_imports_separately = true
# ij_java_line_comment_add_space = false
# ij_java_line_comment_at_first_column = true
# ij_java_method_annotation_wrap = split_into_lines
# ij_java_method_brace_style = end_of_line
# ij_java_method_call_chain_wrap = off
# ij_java_method_parameters_new_line_after_left_paren = false
# ij_java_method_parameters_right_paren_on_new_line = false
# ij_java_method_parameters_wrap = off
# ij_java_modifier_list_wrap = false
# ij_java_names_count_to_use_import_on_demand = 99
# ij_java_parameter_annotation_wrap = off
# ij_java_parentheses_expression_new_line_after_left_paren = false
# ij_java_parentheses_expression_right_paren_on_new_line = false
# ij_java_place_assignment_sign_on_next_line = false
# ij_java_prefer_longer_names = true
# ij_java_prefer_parameters_wrap = false
# ij_java_repeat_synchronized = true
# ij_java_replace_instanceof_and_cast = false
# ij_java_replace_null_check = true
# ij_java_replace_sum_lambda_with_method_ref = true
# ij_java_resource_list_new_line_after_left_paren = false
# ij_java_resource_list_right_paren_on_new_line = false
# ij_java_resource_list_wrap = off
# ij_java_space_after_closing_angle_bracket_in_type_argument = false
# ij_java_space_after_colon = true
# ij_java_space_after_comma = true
# ij_java_space_after_comma_in_type_arguments = true
# ij_java_space_after_for_semicolon = true
# ij_java_space_after_quest = true
# ij_java_space_after_type_cast = true
# ij_java_space_before_annotation_array_initializer_left_brace = false
# ij_java_space_before_annotation_parameter_list = false
# ij_java_space_before_array_initializer_left_brace = false
# ij_java_space_before_catch_keyword = true
# ij_java_space_before_catch_left_brace = true
# ij_java_space_before_catch_parentheses = true
# ij_java_space_before_class_left_brace = true
# ij_java_space_before_colon = true
# ij_java_space_before_colon_in_foreach = true
# ij_java_space_before_comma = false
# ij_java_space_before_do_left_brace = true
# ij_java_space_before_else_keyword = true
# ij_java_space_before_else_left_brace = true
# ij_java_space_before_finally_keyword = true
# ij_java_space_before_finally_left_brace = true
# ij_java_space_before_for_left_brace = true
# ij_java_space_before_for_parentheses = true
# ij_java_space_before_for_semicolon = false
# ij_java_space_before_if_left_brace = true
# ij_java_space_before_if_parentheses = true
# ij_java_space_before_method_call_parentheses = false
# ij_java_space_before_method_left_brace = true
# ij_java_space_before_method_parentheses = false
# ij_java_space_before_opening_angle_bracket_in_type_parameter = false
# ij_java_space_before_quest = true
# ij_java_space_before_switch_left_brace = true
# ij_java_space_before_switch_parentheses = true
# ij_java_space_before_synchronized_left_brace = true
# ij_java_space_before_synchronized_parentheses = true
# ij_java_space_before_try_left_brace = true
# ij_java_space_before_try_parentheses = true
# ij_java_space_before_type_parameter_list = false
# ij_java_space_before_while_keyword = true
# ij_java_space_before_while_left_brace = true
# ij_java_space_before_while_parentheses = true
# ij_java_space_inside_one_line_enum_braces = false
# ij_java_space_within_empty_array_initializer_braces = false
# ij_java_space_within_empty_method_call_parentheses = false
# ij_java_space_within_empty_method_parentheses = false
# ij_java_spaces_around_additive_operators = true
# ij_java_spaces_around_assignment_operators = true
# ij_java_spaces_around_bitwise_operators = true
# ij_java_spaces_around_equality_operators = true
# ij_java_spaces_around_lambda_arrow = true
# ij_java_spaces_around_logical_operators = true
# ij_java_spaces_around_method_ref_dbl_colon = false
# ij_java_spaces_around_multiplicative_operators = true
# ij_java_spaces_around_relational_operators = true
# ij_java_spaces_around_shift_operators = true
# ij_java_spaces_around_type_bounds_in_type_parameters = true
# ij_java_spaces_around_unary_operator = false
# ij_java_spaces_within_angle_brackets = false
# ij_java_spaces_within_annotation_parentheses = false
# ij_java_spaces_within_array_initializer_braces = false
# ij_java_spaces_within_braces = false
# ij_java_spaces_within_brackets = false
# ij_java_spaces_within_cast_parentheses = false
# ij_java_spaces_within_catch_parentheses = false
# ij_java_spaces_within_for_parentheses = false
# ij_java_spaces_within_if_parentheses = false
# ij_java_spaces_within_method_call_parentheses = false
# ij_java_spaces_within_method_parentheses = false
# ij_java_spaces_within_parentheses = false
# ij_java_spaces_within_switch_parentheses = false
# ij_java_spaces_within_synchronized_parentheses = false
# ij_java_spaces_within_try_parentheses = false
# ij_java_spaces_within_while_parentheses = false
# ij_java_special_else_if_treatment = true
# ij_java_subclass_name_suffix = Impl
# ij_java_ternary_operation_signs_on_next_line = false
# ij_java_ternary_operation_wrap = off
# ij_java_test_name_suffix = Test
# ij_java_throws_keyword_wrap = off
# ij_java_throws_list_wrap = off
# ij_java_use_external_annotations = false
# ij_java_use_fq_class_names = false
# ij_java_use_relative_indents = false
# ij_java_use_single_class_imports = true
# ij_java_variable_annotation_wrap = off
# ij_java_visibility = public
# ij_java_while_brace_force = never
# ij_java_while_on_new_line = false
# ij_java_wrap_comments = false
# ij_java_wrap_first_method_in_call_chain = false
# ij_java_wrap_long_lines = false
[{*.htm,*.shtm,*.sht,*.shtml,*.html}]
# ij_html_add_new_line_before_tags = body,div,p,form,h1,h2,h3
# ij_html_align_attributes = true
# ij_html_align_text = false
# ij_html_attribute_wrap = normal
# ij_html_block_comment_at_first_column = true
# ij_html_do_not_align_children_of_min_lines = 0
# ij_html_do_not_break_if_inline_tags = title,h1,h2,h3,h4,h5,h6,p
# ij_html_do_not_indent_children_of_tags = html,body,thead,tbody,tfoot
# ij_html_enforce_quotes = false
# ij_html_inline_tags = a,abbr,acronym,b,basefont,bdo,big,br,cite,cite,code,dfn,em,font,i,img,input,kbd,label,q,s,samp,select,small,span,strike,strong,sub,sup,textarea,tt,u,var
# ij_html_keep_blank_lines = 2
# ij_html_keep_indents_on_empty_lines = false
# ij_html_keep_line_breaks = true
# ij_html_keep_line_breaks_in_text = true
# ij_html_keep_whitespaces = false
# ij_html_keep_whitespaces_inside = span,pre,textarea
# ij_html_line_comment_at_first_column = true
# ij_html_new_line_after_last_attribute = never
# ij_html_new_line_before_first_attribute = never
# ij_html_quote_style = double
# ij_html_remove_new_line_before_tags = br
# ij_html_space_after_tag_name = false
# ij_html_space_around_equality_in_attribute = false
# ij_html_space_inside_empty_tag = false
# ij_html_text_wrap = normal
[{*.jhm,*.xslt,*.rng,*.xsl,*.xsd,*.ant,*.tld,*.fxml,*.wsdl,*.jrxml,*.xml,*.jnlp,*.xul}]
# ij_continuation_indent_size = 4
# ij_xml_block_comment_at_first_column = true
# ij_xml_keep_indents_on_empty_lines = false
# ij_xml_line_comment_at_first_column = true
# ij_xml_use_custom_settings = true
# ij_continuation_indent_size = 4
# ij_xml_block_comment_at_first_column = true
# ij_xml_keep_indents_on_empty_lines = false
# ij_xml_line_comment_at_first_column = true
# ij_xml_use_custom_settings = true
[{*.kt,*.kts}]
# ij_kotlin_align_in_columns_case_branch = false
# ij_kotlin_align_multiline_binary_operation = false
# ij_kotlin_align_multiline_extends_list = false
# ij_kotlin_align_multiline_method_parentheses = false
# ij_kotlin_align_multiline_parameters = true
# ij_kotlin_align_multiline_parameters_in_calls = false
# ij_kotlin_assignment_wrap = normal
# ij_kotlin_blank_lines_after_class_header = 0
# ij_kotlin_blank_lines_around_block_when_branches = 0
# ij_kotlin_block_comment_at_first_column = true
# ij_kotlin_call_parameters_new_line_after_left_paren = true
# ij_kotlin_call_parameters_right_paren_on_new_line = true
# ij_kotlin_call_parameters_wrap = on_every_item
# ij_kotlin_catch_on_new_line = false
# ij_kotlin_class_annotation_wrap = split_into_lines
# ij_kotlin_code_style_defaults = KOTLIN_OFFICIAL
# ij_kotlin_continuation_indent_for_chained_calls = false
# ij_kotlin_continuation_indent_for_expression_bodies = false
# ij_kotlin_continuation_indent_in_argument_lists = false
# ij_kotlin_continuation_indent_in_elvis = false
# ij_kotlin_continuation_indent_in_if_conditions = false
# ij_kotlin_continuation_indent_in_parameter_lists = false
# ij_kotlin_continuation_indent_in_supertype_lists = false
# ij_kotlin_else_on_new_line = false
# ij_kotlin_enum_constants_wrap = off
# ij_kotlin_extends_list_wrap = normal
# ij_kotlin_field_annotation_wrap = split_into_lines
# ij_kotlin_finally_on_new_line = false
# ij_kotlin_if_rparen_on_new_line = true
# ij_kotlin_import_nested_classes = false
# ij_kotlin_insert_whitespaces_in_simple_one_line_method = true
# ij_kotlin_keep_blank_lines_before_right_brace = 2
# ij_kotlin_keep_blank_lines_in_code = 2
# ij_kotlin_keep_blank_lines_in_declarations = 2
# ij_kotlin_keep_first_column_comment = true
# ij_kotlin_keep_indents_on_empty_lines = false
# ij_kotlin_keep_line_breaks = true
# ij_kotlin_lbrace_on_next_line = false
# ij_kotlin_line_comment_add_space = false
# ij_kotlin_line_comment_at_first_column = true
# ij_kotlin_method_annotation_wrap = split_into_lines
# ij_kotlin_method_call_chain_wrap = normal
# ij_kotlin_method_parameters_new_line_after_left_paren = true
# ij_kotlin_method_parameters_right_paren_on_new_line = true
# ij_kotlin_method_parameters_wrap = on_every_item
# ij_kotlin_name_count_to_use_star_import = 5
# ij_kotlin_name_count_to_use_star_import_for_members = 3
# ij_kotlin_parameter_annotation_wrap = off
# ij_kotlin_space_after_comma = true
# ij_kotlin_space_after_extend_colon = true
# ij_kotlin_space_after_type_colon = true
# ij_kotlin_space_before_catch_parentheses = true
# ij_kotlin_space_before_comma = false
# ij_kotlin_space_before_extend_colon = true
# ij_kotlin_space_before_for_parentheses = true
# ij_kotlin_space_before_if_parentheses = true
# ij_kotlin_space_before_lambda_arrow = true
# ij_kotlin_space_before_type_colon = false
# ij_kotlin_space_before_when_parentheses = true
# ij_kotlin_space_before_while_parentheses = true
# ij_kotlin_spaces_around_additive_operators = true
# ij_kotlin_spaces_around_assignment_operators = true
# ij_kotlin_spaces_around_equality_operators = true
# ij_kotlin_spaces_around_function_type_arrow = true
# ij_kotlin_spaces_around_logical_operators = true
# ij_kotlin_spaces_around_multiplicative_operators = true
# ij_kotlin_spaces_around_range = false
# ij_kotlin_spaces_around_relational_operators = true
# ij_kotlin_spaces_around_unary_operator = false
# ij_kotlin_spaces_around_when_arrow = true
# ij_kotlin_variable_annotation_wrap = off
# ij_kotlin_while_on_new_line = false
# ij_kotlin_wrap_elvis_expressions = 1
# ij_kotlin_wrap_expression_body_functions = 1
# ij_kotlin_wrap_first_method_in_call_chain = false

98
FAQ.md
View file

@ -1,7 +1,14 @@
### Q: How do I get the beta version of Retro Music?
#### Q: How do I get the beta version of Retro Music?
You can opt-in for the beta build by clicking on this link: https://play.google.com/apps/testing/code.name.monkey.retromusic
### Q: How do I use offline synced lyrics?
#### Q: How to restore my purchases?
Make sure to switch and use account in the Play Store app through which you purchased before installing Retro music. The account used to install the app is also used to purchase/restore the pro license.
If you already installed, remove all other accounts except the one with which you purchased premium. Then restore the purchase.
#### Q: How do I use offline synced lyrics?
There are two methods for how to get offline synced lyrics.
#### Method 1:-
@ -26,55 +33,120 @@ Now you have to rename the file you created in this way: <song_name> - <artist_n
##### STEP 4:
You have to copy or move this file into a location on the SD Card: whatever_sdcard/RetroMusic/lyrics/ and paste it there.
Finally you will be able to see the lyrics working.
> If you want to skip to particular time stamp, simply scroll to the time stamp from where you want to start from and a 'Play' icon will appear left to the particular stamp. Tap on play button to play from there.
### Q: Why isn't the artist's image downloading?
Last.fm has disabled the download of artist's images for the time being, whether functionality for this will be restored in future is uncertain.
#### Q: Why isn't the artist's image downloading?
Last.fm has disabled the download of artist's images for the time being, whether functionality for this will be restored in future is uncertain. So we have moved to deezer API for artist images which have very less artists in their database and you might not able to see covers on every artist profiles.
### Q: How do I change the theme?
#### Q: How do I change the theme?
Settings -> Look and feel -> Select your theme.
### Q: Why aren't last added songs showing?
#### Q: Equailizer is very laggy and unstable or I am getting "No equalizer found" error. why?
The Retro music in-built equalizer was removed updates ago so the only equalizer you will have by your OEM or android which aren't made by us and have no control over them. So you can report those issues to your OEM so that they can provide a fix in next updates.
If you are seeing "No Equalizer Found" in your device, this means your device doesn't have stock equalizer MusicFx Equalizer. You can try using this one. Its made by AEX ROM developers.
https://drive.google.com/file/d/1_1bpsn6roeEyElGKikbU39lVKUH8O3xp/view?usp=drivesdk
#### Q: Why aren't last added songs showing?
Settings -> Other -> Last added playlist interval -> Select an option from the list.
### Q: How do I enable fullscreen lockscreen controls?
#### Q: How do I enable fullscreen lockscreen controls?
Settings -> Personalize -> Fullscreen controls -> Enable (this will only be visible when songs are playing from Retro Music).
### Q: Why are gallery or random pictures showing up as album art?
#### Q: Why are gallery or random pictures showing up as album art?
Settings -> Images -> Ignore media store covers -> Enable
### Q: Which file types are supported?
#### Q: Which file types are supported?
Retro Music uses the native media player that comes with your Android phone, so as long as a file type is supported by your phone, it's supported by Retro Music.
### Q: Why is my device slowing down when I'm using the app?
#### Q: Why is my device slowing down when I'm using the app?
Retro Music is image intensive, it keeps images in the cache for quick loading.
### Q: The title "Retro Music" is showing on the top of the app, how can i fix this?
#### Q: The title "Retro Music" is showing on the top of the app, how can i fix this?
Clear the app's cache and data.
#### Q: My app is crashing, how do i fix this? (Sorry, settings have changed internally)
Reinstalling the app should fix this issue.
Please try clear data of the app. If it doesn't work, reinstalling fresh from play store should help.
#### Q: Why has all the text gone white/dissapeared?
Change the theme to Black or Dark and change it back to what you had before.
#### Q: Why some of my songs are not showing in my library?
Try checking up if those songs are not less than 30 seconds, if so head to settings -> other -> filter song duration. Put this to zero and see the songs should start appearimg in the library.
If this doesn't work out for you, re-scanning the media folder should help and subsquently rebooting the device to refresh media store.
At last resort, If nothing worked and your audio files are stored in SD card. Try moving them to internal memory then back to SD card.
#### Q: Why some of my songs are not showing in my library?
1. Try checking up if those songs are not less than 30 seconds, if so head to settings -> other -> filter song duration. Put this to zero and see the songs should start appearimg in the library.
2. If this doesn't work out for you, re-scanning the media folder should help and subsquently rebooting the device to refresh media store.
3. At last resort, If nothing worked and your audio files are stored in SD card. Try moving them to internal memory then back to SD card.
#### Q: Why my playlist/playlist songs keep disappearing?
Playlist/Playlist songs disappearing is based on android media store system. Save those playlist as file(Tap on three dot menu next to available playlist and save as file) and it should get fixed.
#### Q: Why does my library shows song files twice or no song at all?
If you are seeing duplication of songs in the library or no songs at all, then it's because of Media Store issue which got affected by some other app.
To fix this:
• Head to your device settings
• Open up "Apps & notifications" (This name depends from ROM to ROM)
• Find 'Media storage' app and clear storage (both data and cache) of it.
• Then open Retro Music app and manually scan your music from your storage.
• Reboot the device to refresh media store (Not sure if this is necessary)
NOTE: Don't panic when you will open Retro Music and see "Zero" songs there in the library. It's because you cleared Media Store which is responsible for recognising files on your device.
#### Q: I can't find folder menu anymore after latest update?
Head to settings -> personalise. And select folders from "library categories". If there is option of folders, tap on reset and select folders.
#### Q: After updating the app to latest version, font got removed. Why?
Retro Music's font have now been replaced with system font now, which means the default font your system uses will be used by Retro too. It fixes all font related issues you used to face/are facing in the app.
If you think the font looks ugly, then you just need to change the default font from your Android settings (or use any Magisk module). If you can't, there's nothing we can do about it.
#### Q: How to export playlist:
In your built-in music player, there should be an option to save those playlist as file. Save them and import from file manager by opening it into retro music.
Note that those playlist must be of your offline music only since retro music is offline music player not an online music player. So if your playlist are of online music, it can't be opened on other offline players nor can be exported
#### Q: How to restore/import playlist:
Retro Music will automatically detect any playlist file when that playlist file is stored in InternalStorage/Playlist. However, if it doesn't, just open "file manager" and open that playlist file with Retro Music.
For restoring playlists, the location of songs must be same in both Playlist file and in your storage. For example, your music is in "Internalstorage/Music" and playlist file has songs location "Internalstorage/Songs". Then it will not going to work since both these location are different.
#### Q: Adding songs to playlist or marking them as favourite are making app crash. Why?
It's a known issue with only android 10 with its media store API when songs are in SD card due to introduction of Scoped Storage by Google. The issue have been created on Google Issue Tracker by many users. Many other players which doesn't have this issue are using a custom database for storing playlist. We will soon be implementing a custom database for playlist to fix this issue!
Workaround: You can move all songs to internal storage to fix the issue.
ISSUE link: https://issuetracker.google.com/issues/147619577

View file

@ -3,6 +3,7 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: "ru.cleverpumpkin.proguard-dictionaries-generator"
apply plugin: "androidx.navigation.safeargs.kotlin"
proguardDictionaries {
dictionaryNames = [
@ -82,7 +83,7 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'androidx.preference:preference-ktx:1.1.1'
implementation 'androidx.core:core-ktx:1.3.0'
implementation 'androidx.core:core-ktx:1.3.1'
implementation 'androidx.fragment:fragment-ktx:1.2.5'
implementation 'androidx.palette:palette-ktx:1.0.0'
@ -134,6 +135,14 @@ dependencies {
def koin_version = "2.1.5"
implementation "org.koin:koin-core:$koin_version"
implementation "org.koin:koin-android:$koin_version"
implementation "org.koin:koin-android-viewmodel:$koin_version"
implementation "org.koin:koin-core-ext:$koin_version"
implementation "org.koin:koin-androidx-scope:$koin_version"
implementation "org.koin:koin-androidx-viewmodel:$koin_version"
implementation "org.koin:koin-androidx-fragment:$koin_version"
implementation "org.koin:koin-androidx-ext:$koin_version"
def nav_version = "2.3.0"
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
}

View file

@ -59,11 +59,6 @@
#-keep class org.jaudiotagger.** { *; }
#For cast
-keep class io.github.muntashirakon.music.cast.CastOptionsProvider { *; }
-keep class android.support.** { *; }
-keep class com.google.** { *; }
-keep class java.nio.file.** { *; }
-obfuscationdictionary build/obfuscation-dictionary.txt
-classobfuscationdictionary build/class-dictionary.txt

View file

@ -26,6 +26,7 @@
</style>
</head>

View file

@ -54,6 +54,7 @@
}
{style-placeholder}
</style>
</head>

View file

@ -18,8 +18,6 @@ import androidx.multidex.MultiDexApplication
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.VersionUtils
import io.github.muntashirakon.music.appshortcuts.DynamicShortcutManager
import io.github.muntashirakon.music.network.networkModule
import io.github.muntashirakon.music.providers.provideModules
import org.koin.android.ext.koin.androidContext
import org.koin.core.context.startKoin
@ -31,7 +29,7 @@ class App : MultiDexApplication() {
startKoin {
androidContext(this@App)
modules(listOf(mainModule, provideModules, networkModule))
modules(appModules)
}
// default theme
if (!ThemeStore.isConfigured(this, 3)) {

View file

@ -8,11 +8,20 @@ import io.github.muntashirakon.music.activities.search.SearchViewModel
import io.github.muntashirakon.music.fragments.LibraryViewModel
import io.github.muntashirakon.music.model.Genre
import io.github.muntashirakon.music.model.Playlist
import org.koin.android.viewmodel.dsl.viewModel
import io.github.muntashirakon.music.network.networkModule
import io.github.muntashirakon.music.providers.RepositoryImpl
import org.eclipse.egit.github.core.Repository
import org.koin.androidx.viewmodel.dsl.viewModel
import org.koin.dsl.bind
import org.koin.dsl.module
private val dataModule = module {
single {
RepositoryImpl(get(), get())
} bind Repository::class
}
val mainModule = module {
private val viewModules = module {
viewModel {
LibraryViewModel(get())
@ -38,3 +47,5 @@ val mainModule = module {
SearchViewModel(get())
}
}
val appModules = listOf(dataModule, viewModules, networkModule)

View file

@ -20,10 +20,10 @@ import io.github.muntashirakon.music.dialogs.CreatePlaylistDialog.Companion.crea
import io.github.muntashirakon.music.fragments.LibraryViewModel
import io.github.muntashirakon.music.fragments.albums.AlbumsFragment
import io.github.muntashirakon.music.fragments.artists.ArtistsFragment
import io.github.muntashirakon.music.fragments.base.AbsLibraryPagerRecyclerViewCustomGridSizeFragment
import io.github.muntashirakon.music.fragments.base.AbsRecyclerViewCustomGridSizeFragment
import io.github.muntashirakon.music.fragments.folder.FoldersFragment
import io.github.muntashirakon.music.fragments.genres.GenresFragment
import io.github.muntashirakon.music.fragments.home.BannerHomeFragment
import io.github.muntashirakon.music.fragments.mainactivity.FoldersFragment
import io.github.muntashirakon.music.fragments.playlists.PlaylistsFragment
import io.github.muntashirakon.music.fragments.queue.PlayingQueueFragment
import io.github.muntashirakon.music.fragments.songs.SongsFragment
@ -60,7 +60,7 @@ class MainActivity : AbsSlidingMusicPanelActivity(),
const val EXPAND_PANEL = "expand_panel"
}
val libraryViewModel: LibraryViewModel by inject()
private val libraryViewModel: LibraryViewModel by inject()
private var cab: MaterialCab? = null
private val intentFilter = IntentFilter(Intent.ACTION_SCREEN_OFF)
private lateinit var currentFragment: MainActivityFragmentCallbacks
@ -157,7 +157,7 @@ class MainActivity : AbsSlidingMusicPanelActivity(),
.setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_IF_ROOM)
}
val fragment: Fragment? = getCurrentFragment()
if (fragment != null && fragment is AbsLibraryPagerRecyclerViewCustomGridSizeFragment<*, *>) {
if (fragment != null && fragment is AbsRecyclerViewCustomGridSizeFragment<*, *>) {
val gridSizeItem: MenuItem = menu.findItem(R.id.action_grid_size)
if (RetroUtil.isLandscape()) {
gridSizeItem.setTitle(R.string.action_grid_size_land)
@ -187,7 +187,7 @@ class MainActivity : AbsSlidingMusicPanelActivity(),
override fun onOptionsItemSelected(item: MenuItem): Boolean {
val fragment = getCurrentFragment()
if (fragment is AbsLibraryPagerRecyclerViewCustomGridSizeFragment<*, *>) {
if (fragment is AbsRecyclerViewCustomGridSizeFragment<*, *>) {
if (handleGridSizeMenuItem(fragment, item)) {
return true
}
@ -221,7 +221,7 @@ class MainActivity : AbsSlidingMusicPanelActivity(),
}
private fun handleSortOrderMenuItem(
fragment: AbsLibraryPagerRecyclerViewCustomGridSizeFragment<*, *>,
fragment: AbsRecyclerViewCustomGridSizeFragment<*, *>,
item: MenuItem
): Boolean {
var sortOrder: String? = null
@ -265,7 +265,7 @@ class MainActivity : AbsSlidingMusicPanelActivity(),
}
private fun handleLayoutResType(
fragment: AbsLibraryPagerRecyclerViewCustomGridSizeFragment<*, *>,
fragment: AbsRecyclerViewCustomGridSizeFragment<*, *>,
item: MenuItem
): Boolean {
var layoutRes = -1
@ -286,7 +286,7 @@ class MainActivity : AbsSlidingMusicPanelActivity(),
}
private fun handleGridSizeMenuItem(
fragment: AbsLibraryPagerRecyclerViewCustomGridSizeFragment<*, *>,
fragment: AbsRecyclerViewCustomGridSizeFragment<*, *>,
item: MenuItem
): Boolean {
var gridSize = 0
@ -309,7 +309,7 @@ class MainActivity : AbsSlidingMusicPanelActivity(),
}
private fun setUpGridSizeMenu(
fragment: AbsLibraryPagerRecyclerViewCustomGridSizeFragment<*, *>,
fragment: AbsRecyclerViewCustomGridSizeFragment<*, *>,
gridSizeMenu: SubMenu
) {
when (fragment.getGridSize()) {
@ -344,7 +344,7 @@ class MainActivity : AbsSlidingMusicPanelActivity(),
}
private fun setupLayoutMenu(
fragment: AbsLibraryPagerRecyclerViewCustomGridSizeFragment<*, *>,
fragment: AbsRecyclerViewCustomGridSizeFragment<*, *>,
subMenu: SubMenu
) {
when (fragment.itemLayoutRes()) {
@ -366,7 +366,7 @@ class MainActivity : AbsSlidingMusicPanelActivity(),
}
private fun setUpSortOrderMenu(
fragment: AbsLibraryPagerRecyclerViewCustomGridSizeFragment<*, *>,
fragment: AbsRecyclerViewCustomGridSizeFragment<*, *>,
sortOrderMenu: SubMenu
) {
val currentSortOrder = fragment.getSortOrder()
@ -532,8 +532,13 @@ class MainActivity : AbsSlidingMusicPanelActivity(),
fragment: Fragment,
tag: String
) {
supportFragmentManager.commit {
setCustomAnimations(
R.anim.retro_fragment_open_enter,
R.anim.retro_fragment_open_exit,
R.anim.retro_fragment_fade_enter,
R.anim.retro_fragment_fade_exit
)
replace(R.id.fragment_container, fragment, tag)
}
currentFragment = fragment as MainActivityFragmentCallbacks

View file

@ -4,19 +4,23 @@ import android.os.Bundle
import android.view.MenuItem
import androidx.annotation.StringRes
import androidx.fragment.app.Fragment
import androidx.navigation.NavController
import androidx.navigation.fragment.NavHostFragment
import androidx.navigation.ui.AppBarConfiguration
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.VersionUtils
import io.github.muntashirakon.music.R
import io.github.muntashirakon.music.activities.base.AbsBaseActivity
import io.github.muntashirakon.music.appshortcuts.DynamicShortcutManager
import io.github.muntashirakon.music.extensions.applyToolbar
import io.github.muntashirakon.music.fragments.settings.MainSettingsFragment
import com.afollestad.materialdialogs.color.ColorChooserDialog
import kotlinx.android.synthetic.main.activity_settings.*
class SettingsActivity : AbsBaseActivity(), ColorChooserDialog.ColorCallback {
private val fragmentManager = supportFragmentManager
private lateinit var appBarConfiguration: AppBarConfiguration
private lateinit var navController: NavController
override fun onCreate(savedInstanceState: Bundle?) {
setDrawUnderStatusBar()
@ -26,16 +30,25 @@ class SettingsActivity : AbsBaseActivity(), ColorChooserDialog.ColorCallback {
setNavigationbarColorAuto()
setLightNavigationBar(true)
setupToolbar()
if (savedInstanceState == null) {
fragmentManager.beginTransaction().replace(R.id.contentFrame, MainSettingsFragment())
.commit()
}
}
private fun setupToolbar() {
setTitle(R.string.action_settings)
applyToolbar(toolbar)
val navHostFragment =
supportFragmentManager.findFragmentById(R.id.contentFrame) as NavHostFragment
val navController: NavController = navHostFragment.navController
navController.addOnDestinationChangedListener { _, _, _ ->
toolbar.title = navController.currentDestination?.label
}
//It removes the back button
//appBarConfiguration = AppBarConfiguration(navController.graph)
//setupActionBarWithNavController(navController, appBarConfiguration)
}
override fun onSupportNavigateUp(): Boolean {
return navController.navigateUp() || super.onSupportNavigateUp()
}
fun setupFragment(fragment: Fragment, @StringRes titleName: Int) {

View file

@ -8,7 +8,6 @@ import android.view.Menu
import android.view.MenuItem
import android.view.SubMenu
import android.view.View
import android.widget.ImageView
import androidx.core.app.ActivityCompat
import androidx.recyclerview.widget.DefaultItemAnimator
import androidx.recyclerview.widget.GridLayoutManager
@ -25,7 +24,6 @@ import io.github.muntashirakon.music.adapter.song.SimpleSongAdapter
import io.github.muntashirakon.music.dialogs.AddToPlaylistDialog
import io.github.muntashirakon.music.dialogs.DeleteSongsDialog
import io.github.muntashirakon.music.extensions.extraNotNull
import io.github.muntashirakon.music.extensions.ripAlpha
import io.github.muntashirakon.music.extensions.show
import io.github.muntashirakon.music.extensions.surfaceColor
import io.github.muntashirakon.music.glide.AlbumGlideRequest
@ -43,7 +41,7 @@ import com.afollestad.materialcab.MaterialCab
import com.bumptech.glide.Glide
import kotlinx.android.synthetic.main.activity_album.*
import kotlinx.android.synthetic.main.activity_album_content.*
import org.koin.android.viewmodel.ext.android.viewModel
import org.koin.androidx.viewmodel.ext.android.viewModel
import org.koin.core.parameter.parametersOf
import java.util.*
import android.util.Pair as UtilPair
@ -68,12 +66,11 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), CabHolder {
return cab as MaterialCab
}
private val detailsViewModel: AlbumDetailsViewModel by viewModel {
private val detailsViewModel by viewModel<AlbumDetailsViewModel> {
parametersOf(extraNotNull<Int>(EXTRA_ALBUM_ID).value)
}
private lateinit var simpleSongAdapter: SimpleSongAdapter
private lateinit var album: Album
private lateinit var artistImage: ImageView
private var cab: MaterialCab? = null
private val savedSortOrder: String
get() = PreferenceUtil.albumDetailSongSortOrder
@ -101,24 +98,25 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), CabHolder {
setBottomBarVisibility(View.GONE)
window.sharedElementsUseOverlay = true
windowEnterTransition()
toolbar.setBackgroundColor(surfaceColor())
addMusicServiceEventListener(detailsViewModel)
ActivityCompat.postponeEnterTransition(this)
//val viewModelFactory = AlbumDetailsViewModelFactory(application, albumId)
//viewModel = ViewModelProvider(this, viewModelFactory).get(AlbumDetailsViewModel::class.java)
detailsViewModel.getAlbum().observe(this, androidx.lifecycle.Observer {
ActivityCompat.startPostponedEnterTransition(this@AlbumDetailsActivity)
album(it)
showAlbum(it)
})
detailsViewModel.getArtist().observe(this, androidx.lifecycle.Observer {
loadArtistImage(it)
})
detailsViewModel.getMoreAlbums().observe(this, androidx.lifecycle.Observer {
moreAlbums(it)
})
detailsViewModel.getAlbumInfo().observe(this, androidx.lifecycle.Observer {
aboutAlbum(it)
})
setupRecyclerView()
artistImage = findViewById(R.id.artistImage)
artistImage.setOnClickListener {
val artistPairs = ActivityOptions.makeSceneTransitionAnimation(
this,
@ -155,12 +153,7 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), CabHolder {
}
}
fun complete() {
ActivityCompat.startPostponedEnterTransition(this)
}
fun album(album: Album) {
complete()
private fun showAlbum(album: Album) {
if (album.songs!!.isEmpty()) {
finish()
return
@ -196,7 +189,7 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), CabHolder {
detailsViewModel.loadAlbumInfo(album)
}
fun moreAlbums(albums: List<Album>) {
private fun moreAlbums(albums: List<Album>) {
moreTitle.show()
moreRecyclerView.show()
moreTitle.text = String.format(getString(R.string.label_more_from), album.artistName)
@ -211,7 +204,7 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), CabHolder {
moreRecyclerView.adapter = albumAdapter
}
fun aboutAlbum(lastFmAlbum: LastFmAlbum) {
private fun aboutAlbum(lastFmAlbum: LastFmAlbum) {
if (lastFmAlbum.album != null) {
if (lastFmAlbum.album.wiki != null) {
aboutAlbumText.show()
@ -232,7 +225,7 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), CabHolder {
}
}
fun loadArtistImage(artist: Artist) {
private fun loadArtistImage(artist: Artist) {
ArtistGlideRequest.Builder.from(Glide.with(this), artist)
.generatePalette(this)
.build()
@ -260,15 +253,17 @@ class AlbumDetailsActivity : AbsSlidingMusicPanelActivity(), CabHolder {
}
private fun setColors(color: MediaNotificationProcessor) {
val buttonColor = if (PreferenceUtil.isAdaptiveColor)
color.backgroundColor.ripAlpha()
else
ATHUtil.resolveColor(this, R.attr.colorSurface)
MaterialUtil.tintColor(
button = shuffleAction,
textColor = color.primaryTextColor,
backgroundColor = color.backgroundColor
)
MaterialUtil.tintColor(
button = playAction,
textColor = color.primaryTextColor,
backgroundColor = color.backgroundColor
)
MaterialUtil.setTint(button = shuffleAction, color = buttonColor)
MaterialUtil.setTint(button = playAction, color = buttonColor)
toolbar.setBackgroundColor(surfaceColor())
setSupportActionBar(toolbar)
supportActionBar?.title = null
}

View file

@ -0,0 +1,250 @@
package code.name.monkey.retromusic.activities.albums
import android.app.ActivityOptions
import android.os.Bundle
import android.transition.TransitionInflater
import android.util.Pair
import android.view.MenuItem
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import androidx.navigation.fragment.findNavController
import androidx.recyclerview.widget.DefaultItemAnimator
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import code.name.monkey.appthemehelper.util.MaterialUtil
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.adapter.album.HorizontalAlbumAdapter
import code.name.monkey.retromusic.adapter.song.SimpleSongAdapter
import code.name.monkey.retromusic.extensions.extraNotNull
import code.name.monkey.retromusic.extensions.show
import code.name.monkey.retromusic.fragments.base.AbsMusicServiceFragment
import code.name.monkey.retromusic.glide.AlbumGlideRequest
import code.name.monkey.retromusic.glide.ArtistGlideRequest
import code.name.monkey.retromusic.glide.RetroMusicColoredTarget
import code.name.monkey.retromusic.helper.MusicPlayerRemote
import code.name.monkey.retromusic.model.Album
import code.name.monkey.retromusic.model.Artist
import code.name.monkey.retromusic.network.model.LastFmAlbum
import code.name.monkey.retromusic.util.MusicUtil
import code.name.monkey.retromusic.util.NavigationUtil
import code.name.monkey.retromusic.util.PreferenceUtil
import code.name.monkey.retromusic.util.RetroUtil
import code.name.monkey.retromusic.util.color.MediaNotificationProcessor
import com.bumptech.glide.Glide
import kotlinx.android.synthetic.main.activity_album.*
import kotlinx.android.synthetic.main.activity_album_content.*
import org.koin.androidx.viewmodel.ext.android.viewModel
import org.koin.core.parameter.parametersOf
import java.util.*
class AlbumDetailsFragment : AbsMusicServiceFragment(R.layout.fragment_album_details) {
private lateinit var simpleSongAdapter: SimpleSongAdapter
private lateinit var album: Album
private val savedSortOrder: String
get() = PreferenceUtil.albumDetailSongSortOrder
private val detailsViewModel by viewModel<AlbumDetailsViewModel> {
parametersOf(extraNotNull<Int>(AlbumDetailsActivity.EXTRA_ALBUM_ID).value)
}
private fun setSharedElementTransitionOnEnter() {
sharedElementEnterTransition = TransitionInflater.from(context)
.inflateTransition(R.transition.change_bounds)
}
override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
setSharedElementTransitionOnEnter()
postponeEnterTransition()
playerActivity?.addMusicServiceEventListener(detailsViewModel)
detailsViewModel.getAlbum().observe(viewLifecycleOwner, androidx.lifecycle.Observer {
startPostponedEnterTransition()
showAlbum(it)
})
detailsViewModel.getArtist().observe(viewLifecycleOwner, androidx.lifecycle.Observer {
loadArtistImage(it)
})
detailsViewModel.getMoreAlbums().observe(viewLifecycleOwner, androidx.lifecycle.Observer {
moreAlbums(it)
})
detailsViewModel.getAlbumInfo().observe(viewLifecycleOwner, androidx.lifecycle.Observer {
aboutAlbum(it)
})
setupRecyclerView()
artistImage.setOnClickListener {
val artistPairs = ActivityOptions.makeSceneTransitionAnimation(
requireActivity(),
Pair.create(
artistImage,
getString(R.string.transition_artist_image)
)
)
NavigationUtil.goToArtistOptions(requireActivity(), album.artistId, artistPairs)
}
playAction.setOnClickListener { MusicPlayerRemote.openQueue(album.songs!!, 0, true) }
shuffleAction.setOnClickListener {
MusicPlayerRemote.openAndShuffleQueue(
album.songs!!,
true
)
}
aboutAlbumText.setOnClickListener {
if (aboutAlbumText.maxLines == 4) {
aboutAlbumText.maxLines = Integer.MAX_VALUE
} else {
aboutAlbumText.maxLines = 4
}
}
image.apply {
transitionName = getString(R.string.transition_album_art)
}
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
val activity = activity as AppCompatActivity
activity.supportActionBar?.setDisplayHomeAsUpEnabled(true)
}
override fun onDestroy() {
super.onDestroy()
playerActivity?.removeMusicServiceEventListener(detailsViewModel)
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
android.R.id.home -> findNavController().navigateUp()
}
return super.onOptionsItemSelected(item)
}
private fun setupRecyclerView() {
simpleSongAdapter = SimpleSongAdapter(
requireActivity() as AppCompatActivity,
ArrayList(),
R.layout.item_song,
null
)
recyclerView.apply {
layoutManager = LinearLayoutManager(requireContext())
itemAnimator = DefaultItemAnimator()
isNestedScrollingEnabled = false
adapter = simpleSongAdapter
}
}
private fun showAlbum(album: Album) {
if (album.songs!!.isEmpty()) {
return
}
this.album = album
albumTitle.text = album.title
val songText =
resources.getQuantityString(
R.plurals.albumSongs,
album.songCount,
album.songCount
)
songTitle.text = songText
if (MusicUtil.getYearString(album.year) == "-") {
albumText.text = String.format(
"%s • %s",
album.artistName,
MusicUtil.getReadableDurationString(MusicUtil.getTotalDuration(album.songs))
)
} else {
albumText.text = String.format(
"%s • %s • %s",
album.artistName,
MusicUtil.getYearString(album.year),
MusicUtil.getReadableDurationString(MusicUtil.getTotalDuration(album.songs))
)
}
loadAlbumCover()
simpleSongAdapter.swapDataSet(album.songs)
detailsViewModel.loadArtist(album.artistId)
detailsViewModel.loadAlbumInfo(album)
}
private fun moreAlbums(albums: List<Album>) {
moreTitle.show()
moreRecyclerView.show()
moreTitle.text = String.format(getString(R.string.label_more_from), album.artistName)
val albumAdapter =
HorizontalAlbumAdapter(requireActivity() as AppCompatActivity, albums, null)
moreRecyclerView.layoutManager = GridLayoutManager(
requireContext(),
1,
GridLayoutManager.HORIZONTAL,
false
)
moreRecyclerView.adapter = albumAdapter
}
private fun aboutAlbum(lastFmAlbum: LastFmAlbum) {
if (lastFmAlbum.album != null) {
if (lastFmAlbum.album.wiki != null) {
aboutAlbumText.show()
aboutAlbumTitle.show()
aboutAlbumTitle.text =
String.format(getString(R.string.about_album_label), lastFmAlbum.album.name)
aboutAlbumText.text = lastFmAlbum.album.wiki.content
}
if (lastFmAlbum.album.listeners.isNotEmpty()) {
listeners.show()
listenersLabel.show()
scrobbles.show()
scrobblesLabel.show()
listeners.text = RetroUtil.formatValue(lastFmAlbum.album.listeners.toFloat())
scrobbles.text = RetroUtil.formatValue(lastFmAlbum.album.playcount.toFloat())
}
}
}
private fun loadArtistImage(artist: Artist) {
ArtistGlideRequest.Builder.from(Glide.with(requireContext()), artist)
.generatePalette(requireContext())
.build()
.dontAnimate()
.dontTransform()
.into(object : RetroMusicColoredTarget(artistImage) {
override fun onColorReady(colors: MediaNotificationProcessor) {
}
})
}
private fun loadAlbumCover() {
AlbumGlideRequest.Builder.from(Glide.with(requireContext()), album.safeGetFirstSong())
.checkIgnoreMediaStore(requireContext())
.ignoreMediaStore(PreferenceUtil.isIgnoreMediaStoreArtwork)
.generatePalette(requireContext())
.build()
.dontAnimate()
.dontTransform()
.into(object : RetroMusicColoredTarget(image) {
override fun onColorReady(colors: MediaNotificationProcessor) {
setColors(colors)
}
})
}
private fun setColors(color: MediaNotificationProcessor) {
MaterialUtil.tintColor(
button = shuffleAction,
textColor = color.primaryTextColor,
backgroundColor = color.backgroundColor
)
MaterialUtil.tintColor(
button = playAction,
textColor = color.primaryTextColor,
backgroundColor = color.backgroundColor
)
}
}

View file

@ -7,8 +7,8 @@ import androidx.lifecycle.viewModelScope
import io.github.muntashirakon.music.interfaces.MusicServiceEventListener
import io.github.muntashirakon.music.model.Album
import io.github.muntashirakon.music.model.Artist
import io.github.muntashirakon.music.providers.RepositoryImpl
import io.github.muntashirakon.music.network.model.LastFmAlbum
import io.github.muntashirakon.music.providers.RepositoryImpl
import kotlinx.coroutines.Deferred
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.async
@ -23,10 +23,12 @@ class AlbumDetailsViewModel(
private val _album = MutableLiveData<Album>()
private val _artist = MutableLiveData<Artist>()
private val _lastFmAlbum = MutableLiveData<LastFmAlbum>()
private val _moreAlbums = MutableLiveData<List<Album>>()
fun getAlbum(): LiveData<Album> = _album
fun getArtist(): LiveData<Artist> = _artist
fun getAlbumInfo(): LiveData<LastFmAlbum> = _lastFmAlbum
fun getMoreAlbums(): LiveData<List<Album>> = _moreAlbums
init {
loadAlbumDetails()
@ -49,6 +51,10 @@ class AlbumDetailsViewModel(
fun loadArtist(artistId: Int) = viewModelScope.launch(Dispatchers.IO) {
val artist = repository.artistById(artistId)
_artist.postValue(artist)
artist.albums?.filter { item -> item.id != albumId }?.let { albums ->
if (albums.isNotEmpty()) _moreAlbums.postValue(albums)
}
}
private val loadAlbumAsync: Deferred<Album?>

View file

@ -22,7 +22,6 @@ import io.github.muntashirakon.music.adapter.album.HorizontalAlbumAdapter
import io.github.muntashirakon.music.adapter.song.SimpleSongAdapter
import io.github.muntashirakon.music.dialogs.AddToPlaylistDialog
import io.github.muntashirakon.music.extensions.extraNotNull
import io.github.muntashirakon.music.extensions.ripAlpha
import io.github.muntashirakon.music.extensions.show
import io.github.muntashirakon.music.extensions.surfaceColor
import io.github.muntashirakon.music.glide.ArtistGlideRequest
@ -31,13 +30,16 @@ import io.github.muntashirakon.music.helper.MusicPlayerRemote
import io.github.muntashirakon.music.interfaces.CabHolder
import io.github.muntashirakon.music.model.Artist
import io.github.muntashirakon.music.network.model.LastFmArtist
import io.github.muntashirakon.music.util.*
import io.github.muntashirakon.music.util.CustomArtistImageUtil
import io.github.muntashirakon.music.util.MusicUtil
import io.github.muntashirakon.music.util.RetroColorUtil
import io.github.muntashirakon.music.util.RetroUtil
import io.github.muntashirakon.music.util.color.MediaNotificationProcessor
import com.afollestad.materialcab.MaterialCab
import com.bumptech.glide.Glide
import kotlinx.android.synthetic.main.activity_artist_content.*
import kotlinx.android.synthetic.main.activity_artist_details.*
import org.koin.android.viewmodel.ext.android.viewModel
import org.koin.androidx.viewmodel.ext.android.viewModel
import org.koin.core.parameter.parametersOf
import java.util.*
import kotlin.collections.ArrayList
@ -95,8 +97,11 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder {
setBottomBarVisibility(View.GONE)
window.sharedElementsUseOverlay = true
windowEnterTransition()
ActivityCompat.postponeEnterTransition(this)
toolbar.setBackgroundColor(surfaceColor())
addMusicServiceEventListener(detailsViewModel)
ActivityCompat.postponeEnterTransition(this)
detailsViewModel.getArtist().observe(this, androidx.lifecycle.Observer {
ActivityCompat.startPostponedEnterTransition(this@ArtistDetailActivity)
artist(it)
@ -150,18 +155,12 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder {
}
}
fun complete() {
ActivityCompat.startPostponedEnterTransition(this)
}
fun artist(artist: Artist) {
complete()
if (artist.songCount <= 0) {
if (artist.songs.isEmpty()) {
finish()
}
this.artist = artist
loadArtistImage()
loadArtistImage(artist)
if (RetroUtil.isAllowedToDownloadMetadata(this)) {
loadBiography(artist.name)
}
@ -186,7 +185,7 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder {
songTitle.text = songText
albumTitle.text = albumText
songAdapter.swapDataSet(artist.songs)
albumAdapter.swapDataSet(artist.albums!!)
artist.albums?.let { albumAdapter.swapDataSet(it) }
}
private fun loadBiography(
@ -198,7 +197,7 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder {
detailsViewModel.loadBiography(name, lang, null)
}
fun artistInfo(lastFmArtist: LastFmArtist?) {
private fun artistInfo(lastFmArtist: LastFmArtist?) {
if (lastFmArtist != null && lastFmArtist.artist != null) {
val bioContent = lastFmArtist.artist.bio.content
if (bioContent != null && bioContent.trim { it <= ' ' }.isNotEmpty()) {
@ -211,7 +210,6 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder {
listenersLabel.show()
scrobbles.show()
scrobblesLabel.show()
listeners.text =
RetroUtil.formatValue(lastFmArtist.artist.stats.listeners.toFloat())
scrobbles.text =
@ -228,8 +226,9 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder {
private var lang: String? = null
private fun loadArtistImage() {
ArtistGlideRequest.Builder.from(Glide.with(this), artist).generatePalette(this).build()
private fun loadArtistImage(artist: Artist) {
ArtistGlideRequest.Builder.from(Glide.with(this), artist)
.generatePalette(this).build()
.dontAnimate().into(object : RetroMusicColoredTarget(image) {
override fun onColorReady(colors: MediaNotificationProcessor) {
setColors(colors)
@ -238,16 +237,16 @@ class ArtistDetailActivity : AbsSlidingMusicPanelActivity(), CabHolder {
}
private fun setColors(color: MediaNotificationProcessor) {
val buttonColor = if (PreferenceUtil.isAdaptiveColor)
color.backgroundColor.ripAlpha()
else
ATHUtil.resolveColor(this, R.attr.colorSurface)
MaterialUtil.setTint(button = shuffleAction, color = buttonColor)
MaterialUtil.setTint(button = playAction, color = buttonColor)
toolbar.setBackgroundColor(surfaceColor())
MaterialUtil.tintColor(
button = shuffleAction,
textColor = color.primaryTextColor,
backgroundColor = color.backgroundColor
)
MaterialUtil.tintColor(
button = playAction,
textColor = color.primaryTextColor,
backgroundColor = color.backgroundColor
)
setSupportActionBar(toolbar)
supportActionBar?.title = null
}

View file

@ -1,6 +1,5 @@
package io.github.muntashirakon.music.activities.base
import android.animation.ValueAnimator
import android.graphics.Color
import android.os.Bundle
import android.view.View
@ -8,61 +7,41 @@ import android.view.ViewGroup
import android.view.ViewTreeObserver
import android.widget.FrameLayout
import androidx.annotation.LayoutRes
import androidx.fragment.app.Fragment
import androidx.lifecycle.Observer
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.ColorUtil
import io.github.muntashirakon.music.R
import io.github.muntashirakon.music.RetroBottomSheetBehavior
import io.github.muntashirakon.music.extensions.hide
import io.github.muntashirakon.music.extensions.show
import io.github.muntashirakon.music.fragments.LibraryViewModel
import io.github.muntashirakon.music.fragments.MiniPlayerFragment
import io.github.muntashirakon.music.fragments.NowPlayingScreen
import io.github.muntashirakon.music.fragments.NowPlayingScreen.*
import io.github.muntashirakon.music.fragments.base.AbsPlayerFragment
import io.github.muntashirakon.music.fragments.player.adaptive.AdaptiveFragment
import io.github.muntashirakon.music.fragments.player.blur.BlurPlayerFragment
import io.github.muntashirakon.music.fragments.player.card.CardFragment
import io.github.muntashirakon.music.fragments.player.cardblur.CardBlurFragment
import io.github.muntashirakon.music.fragments.player.circle.CirclePlayerFragment
import io.github.muntashirakon.music.fragments.player.classic.ClassicPlayerFragment
import io.github.muntashirakon.music.fragments.player.color.ColorFragment
import io.github.muntashirakon.music.fragments.player.fit.FitFragment
import io.github.muntashirakon.music.fragments.player.flat.FlatPlayerFragment
import io.github.muntashirakon.music.fragments.player.full.FullPlayerFragment
import io.github.muntashirakon.music.fragments.player.gradient.GradientPlayerFragment
import io.github.muntashirakon.music.fragments.player.material.MaterialFragment
import io.github.muntashirakon.music.fragments.player.normal.PlayerFragment
import io.github.muntashirakon.music.fragments.player.peak.PeakPlayerFragment
import io.github.muntashirakon.music.fragments.player.plain.PlainPlayerFragment
import io.github.muntashirakon.music.fragments.player.simple.SimplePlayerFragment
import io.github.muntashirakon.music.fragments.player.tiny.TinyPlayerFragment
import io.github.muntashirakon.music.helper.MusicPlayerRemote
import io.github.muntashirakon.music.model.CategoryInfo
import io.github.muntashirakon.music.util.DensityUtil
import io.github.muntashirakon.music.util.PreferenceUtil
import io.github.muntashirakon.music.views.BottomNavigationBarTinted
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.shape.MaterialShapeDrawable
import com.google.android.material.shape.ShapeAppearanceModel
import kotlinx.android.synthetic.main.sliding_music_panel_layout.*
import org.koin.androidx.viewmodel.ext.android.viewModel
abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(),
AbsPlayerFragment.Callbacks {
abstract class AbsSlidingMusicPanelActivity() : AbsMusicServiceActivity() {
companion object {
val TAG: String = AbsSlidingMusicPanelActivity::class.java.simpleName
}
private val libraryViewModel by viewModel<LibraryViewModel>()
private lateinit var behavior: RetroBottomSheetBehavior<FrameLayout>
private var miniPlayerFragment: MiniPlayerFragment? = null
private var playerFragment: AbsPlayerFragment? = null
private var cps: NowPlayingScreen? = null
private var navigationBarColor: Int = 0
private var taskColor: Int = 0
private var lightStatusBar: Boolean = false
private var lightNavigationBar: Boolean = false
private var navigationBarColorAnimator: ValueAnimator? = null
private var paletteColor: Int = Color.WHITE
protected abstract fun createContentView(): View
private lateinit var shapeDrawable: MaterialShapeDrawable
private val panelState: Int
get() = behavior.state
@ -72,7 +51,6 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(),
setMiniPlayerAlphaProgress(slideOffset)
dimBackground.show()
dimBackground.alpha = slideOffset
shapeDrawable.interpolation = 1 - slideOffset
}
override fun onStateChanged(bottomSheet: View, newState: Int) {
@ -91,35 +69,29 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(),
}
}
fun getBottomSheetBehavior() = behavior
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(createContentView())
chooseFragmentForTheme()
setupSlidingUpPanel()
addMusicServiceEventListener(libraryViewModel)
behavior = BottomSheetBehavior.from(slidingPanel) as RetroBottomSheetBehavior
setupBottomSheet()
val themeColor = ATHUtil.resolveColor(this, android.R.attr.windowBackground, Color.GRAY)
dimBackground.setBackgroundColor(ColorUtil.withAlpha(themeColor, 0.5f))
shapeDrawable = MaterialShapeDrawable(
ShapeAppearanceModel.builder(
this,
R.style.ClassicThemeOverLay,
0
).build()
)
slidingPanel.background = shapeDrawable
libraryViewModel.paletteColorLiveData.observe(this, Observer {
this.paletteColor = it
onPaletteColorChanged()
})
}
override fun onResume() {
super.onResume()
if (cps != PreferenceUtil.nowPlayingScreen) {
postRecreate()
}
fun getBottomSheetBehavior() = behavior
private fun setupBottomSheet() {
behavior = BottomSheetBehavior.from(slidingPanel) as RetroBottomSheetBehavior
behavior.addBottomSheetCallback(bottomSheetCallbackList)
if (behavior.state == BottomSheetBehavior.STATE_EXPANDED) {
@ -127,17 +99,23 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(),
}
}
override fun onResume() {
super.onResume()
if (cps != PreferenceUtil.nowPlayingScreen) {
postRecreate()
}
}
override fun onDestroy() {
super.onDestroy()
behavior.removeBottomSheetCallback(bottomSheetCallbackList)
if (navigationBarColorAnimator != null) navigationBarColorAnimator?.cancel() // just in case
}
protected fun wrapSlidingMusicPanel(@LayoutRes resId: Int): View {
val slidingMusicPanelLayout =
layoutInflater.inflate(R.layout.sliding_music_panel_layout, null)
val contentContainer =
slidingMusicPanelLayout.findViewById<ViewGroup>(R.id.mainContentFrame)
val contentContainer: ViewGroup =
slidingMusicPanelLayout.findViewById(R.id.mainContentFrame)
layoutInflater.inflate(resId, contentContainer)
return slidingMusicPanelLayout
}
@ -159,7 +137,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(),
miniPlayerFragment?.view?.visibility = if (alpha == 0f) View.GONE else View.VISIBLE
bottomNavigationView.translationY = progress * 500
//bottomNavigationView.alpha = alpha
bottomNavigationView.alpha = alpha
}
open fun onPanelCollapsed() {
@ -168,20 +146,9 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(),
super.setTaskDescriptionColor(taskColor)
super.setNavigationbarColor(navigationBarColor)
super.setLightNavigationBar(lightNavigationBar)
playerFragment?.setMenuVisibility(false)
playerFragment?.userVisibleHint = false
playerFragment?.onHide()
}
open fun onPanelExpanded() {
val playerFragmentColor = playerFragment!!.paletteColor
super.setTaskDescriptionColor(playerFragmentColor)
playerFragment?.setMenuVisibility(true)
playerFragment?.userVisibleHint = true
playerFragment?.onShow()
onPaletteColorChanged()
}
@ -190,15 +157,12 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(),
ViewTreeObserver.OnGlobalLayoutListener {
override fun onGlobalLayout() {
slidingPanel.viewTreeObserver.removeOnGlobalLayoutListener(this)
if (cps != Peak) {
val params = slidingPanel.layoutParams as ViewGroup.LayoutParams
params.height = ViewGroup.LayoutParams.MATCH_PARENT
slidingPanel.layoutParams = params
}
when (panelState) {
BottomSheetBehavior.STATE_EXPANDED -> onPanelExpanded()
BottomSheetBehavior.STATE_COLLAPSED -> onPanelCollapsed()
else -> playerFragment!!.onHide()
else -> {
//playerFragment!!.onHide()
}
}
}
})
@ -240,33 +204,6 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(),
private fun chooseFragmentForTheme() {
cps = PreferenceUtil.nowPlayingScreen
val fragment: Fragment = when (cps) {
Blur -> BlurPlayerFragment()
Adaptive -> AdaptiveFragment()
Normal -> PlayerFragment()
Card -> CardFragment()
BlurCard -> CardBlurFragment()
Fit -> FitFragment()
Flat -> FlatPlayerFragment()
Full -> FullPlayerFragment()
Plain -> PlainPlayerFragment()
Simple -> SimplePlayerFragment()
Material -> MaterialFragment()
Color -> ColorFragment()
Tiny -> TinyPlayerFragment()
Peak -> PeakPlayerFragment()
Circle -> CirclePlayerFragment()
Classic -> ClassicPlayerFragment()
Gradient -> GradientPlayerFragment()
else -> PlayerFragment()
} // must implement AbsPlayerFragment
supportFragmentManager.beginTransaction()
.replace(R.id.playerFragmentContainer, fragment)
.commit()
supportFragmentManager.executePendingTransactions()
playerFragment =
supportFragmentManager.findFragmentById(R.id.playerFragmentContainer) as AbsPlayerFragment
miniPlayerFragment =
supportFragmentManager.findFragmentById(R.id.miniPlayerFragment) as MiniPlayerFragment
miniPlayerFragment?.view?.setOnClickListener { expandPanel() }
@ -295,7 +232,7 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(),
}
open fun handleBackPress(): Boolean {
if (behavior.peekHeight != 0 && playerFragment!!.onBackPressed()) return true
if (panelState == BottomSheetBehavior.STATE_EXPANDED) {
collapsePanel()
return true
@ -303,13 +240,10 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(),
return false
}
override fun onPaletteColorChanged() {
private fun onPaletteColorChanged() {
if (panelState == BottomSheetBehavior.STATE_EXPANDED) {
val paletteColor = playerFragment!!.paletteColor
super.setTaskDescriptionColor(paletteColor)
val isColorLight = ColorUtil.isColorLight(paletteColor)
if (PreferenceUtil.isAdaptiveColor && (cps == Normal || cps == Flat)) {
super.setLightNavigationBar(true)
super.setLightStatusbar(isColorLight)
@ -360,7 +294,6 @@ abstract class AbsSlidingMusicPanelActivity : AbsMusicServiceActivity(),
override fun setNavigationbarColor(color: Int) {
navigationBarColor = color
if (panelState == BottomSheetBehavior.STATE_COLLAPSED) {
if (navigationBarColorAnimator != null) navigationBarColorAnimator!!.cancel()
super.setNavigationbarColor(color)
}
}

View file

@ -21,7 +21,7 @@ import io.github.muntashirakon.music.util.DensityUtil
import io.github.muntashirakon.music.util.RetroColorUtil
import com.afollestad.materialcab.MaterialCab
import kotlinx.android.synthetic.main.activity_playlist_detail.*
import org.koin.android.viewmodel.ext.android.viewModel
import org.koin.androidx.viewmodel.ext.android.viewModel
import org.koin.core.parameter.parametersOf
import java.util.*

View file

@ -29,7 +29,7 @@ import com.h6ah4i.android.widget.advrecyclerview.animator.RefactoredDefaultItemA
import com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropManager
import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils
import kotlinx.android.synthetic.main.activity_playlist_detail.*
import org.koin.android.viewmodel.ext.android.viewModel
import org.koin.androidx.viewmodel.ext.android.viewModel
import org.koin.core.parameter.parametersOf

View file

@ -51,6 +51,7 @@ class HomeAdapter(
.inflate(R.layout.metal_section_recycler_view, parent, false)
)
}
GENRES -> GenreViewHolder(layout)
FAVOURITES -> PlaylistViewHolder(layout)
else -> {
SuggestionsViewHolder(
@ -104,6 +105,10 @@ class HomeAdapter(
R.string.favorites
)
}
GENRES -> {
val viewHolder = holder as GenreViewHolder
viewHolder.bind(list[position].arrayList as List<Genre>, R.string.genres)
}
}
}
@ -118,7 +123,15 @@ class HomeAdapter(
companion object {
@IntDef(RECENT_ALBUMS, TOP_ALBUMS, RECENT_ARTISTS, TOP_ARTISTS, SUGGESTIONS, FAVOURITES)
@IntDef(
RECENT_ALBUMS,
TOP_ALBUMS,
RECENT_ARTISTS,
TOP_ARTISTS,
SUGGESTIONS,
FAVOURITES,
GENRES
)
@Retention(AnnotationRetention.SOURCE)
annotation class HomeSection
@ -128,6 +141,7 @@ class HomeAdapter(
const val TOP_ARTISTS = 0
const val SUGGESTIONS = 5
const val FAVOURITES = 4
const val GENRES = 6
}
private inner class AlbumViewHolder(view: View) : AbsHomeViewItem(view) {
@ -215,6 +229,18 @@ class HomeAdapter(
}
}
private inner class GenreViewHolder(itemView: View) : AbsHomeViewItem(itemView) {
fun bind(genres: List<Genre>, titleRes: Int) {
title.text = activity.getString(titleRes)
recyclerView.apply {
show()
layoutManager = GridLayoutManager(activity, 2, GridLayoutManager.HORIZONTAL, false)
val genreAdapter = GenreAdapter(activity, genres, R.layout.item_grid_genre)
adapter = genreAdapter
}
}
}
open inner class AbsHomeViewItem(itemView: View) : RecyclerView.ViewHolder(itemView) {
val recyclerView: RecyclerView = itemView.findViewById(R.id.recyclerView)
val title: AppCompatTextView = itemView.findViewById(R.id.title)

View file

@ -3,7 +3,6 @@ package io.github.muntashirakon.music.adapter.album
import android.app.ActivityOptions
import android.content.res.ColorStateList
import android.content.res.Resources
import android.graphics.drawable.Drawable
import android.view.LayoutInflater
import android.view.MenuItem
import android.view.View
@ -106,10 +105,6 @@ open class AlbumAdapter(
.generatePalette(activity)
.build()
.into(object : RetroMusicColoredTarget(holder.image!!) {
override fun onLoadCleared(placeholder: Drawable?) {
super.onLoadCleared(placeholder)
//setColors(defaultFooterColor, holder)
}
override fun onColorReady(colors: MediaNotificationProcessor) {
setColors(colors, holder)

View file

@ -7,6 +7,7 @@ import android.view.ViewGroup
import android.widget.ImageView
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.lifecycle.lifecycleScope
import io.github.muntashirakon.music.R
import io.github.muntashirakon.music.fragments.AlbumCoverStyle
import io.github.muntashirakon.music.fragments.NowPlayingScreen.*
@ -21,7 +22,6 @@ import io.github.muntashirakon.music.util.color.MediaNotificationProcessor
import com.bumptech.glide.Glide
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
@ -68,7 +68,7 @@ class AlbumCoverPagerAdapter(
class AlbumCoverFragment : Fragment() {
lateinit var albumCover: ImageView
private lateinit var albumCover: ImageView
private var isColorReady: Boolean = false
private lateinit var color: MediaNotificationProcessor
private lateinit var song: Song
@ -96,7 +96,7 @@ class AlbumCoverPagerAdapter(
}
private fun showLyricsDialog() {
GlobalScope.launch(Dispatchers.IO) {
lifecycleScope.launch(Dispatchers.IO) {
val data = MusicUtil.getLyrics(song)
withContext(Dispatchers.Main) {
MaterialAlertDialogBuilder(
@ -116,7 +116,7 @@ class AlbumCoverPagerAdapter(
private fun getLayoutWithPlayerTheme(): Int {
return when (PreferenceUtil.nowPlayingScreen) {
Card, Fit, Tiny, Classic, Peak, Gradient, Full -> R.layout.fragment_album_full_cover
Card, Fit, Tiny, Classic, Gradient, Full -> R.layout.fragment_album_full_cover
else -> {
if (PreferenceUtil.isCarouselEffect) {
R.layout.fragment_album_carousel_cover

View file

@ -36,9 +36,10 @@ class SearchShortCutType(context: Context) : BaseShortcutType(context) {
id
).setShortLabel(context.getString(R.string.action_search))
.setLongLabel(context.getString(R.string.search_hint)).setIcon(
AppShortcutIconGenerator.generateThemedIcon(
context,
R.drawable.ic_app_shortcut_search
)
).setIntent(getPlaySongsIntent(AppShortcutLauncherActivity.SHORTCUT_TYPE_SEARCH)).build()
AppShortcutIconGenerator.generateThemedIcon(
context,
R.drawable.ic_app_shortcut_search
)
).setIntent(getPlaySongsIntent(AppShortcutLauncherActivity.SHORTCUT_TYPE_SEARCH))
.build()
}

View file

@ -88,19 +88,18 @@ public class BlacklistFolderChooserDialog extends DialogFragment implements Mate
parentFolder = new File(savedInstanceState.getString("current_path", File.pathSeparator));
checkIfCanGoUp();
parentContents = listFiles();
MaterialDialog.Builder builder =
new MaterialDialog.Builder(requireActivity())
.title(parentFolder.getAbsolutePath())
.items((CharSequence[]) getContentsArray())
.itemsCallback(this)
.autoDismiss(false)
.onPositive((dialog, which) -> {
dismiss();
callback.onFolderSelection(BlacklistFolderChooserDialog.this, parentFolder);
})
.onNegative((materialDialog, dialogAction) -> dismiss())
.positiveText(R.string.add_action)
.negativeText(android.R.string.cancel);
MaterialDialog.Builder builder = new MaterialDialog.Builder(requireContext())
.title(parentFolder.getAbsolutePath())
.items((CharSequence[]) getContentsArray())
.itemsCallback(this)
.autoDismiss(false)
.onPositive((dialog, which) -> {
callback.onFolderSelection(BlacklistFolderChooserDialog.this, parentFolder);
dismiss();
})
.onNegative((materialDialog, dialogAction) -> dismiss())
.positiveText(R.string.add_action)
.negativeText(android.R.string.cancel);
return builder.build();
}

View file

@ -4,7 +4,10 @@ import android.content.Context
import android.content.res.Configuration
import android.os.PowerManager
import androidx.annotation.IntegerRes
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.navigation.fragment.NavHostFragment
import io.github.muntashirakon.music.util.PreferenceUtil
fun Fragment.getIntRes(@IntegerRes int: Int): Int {
@ -37,3 +40,16 @@ inline fun <reified T : Any> Fragment.extraNotNull(key: String, default: T? = nu
val value = arguments?.get(key)
requireNotNull(if (value is T) value else default) { key }
}
val NavHostFragment.currentFragment: Fragment?
get() = targetFragment
val FragmentManager.currentNavigationFragment: Fragment?
get() = primaryNavigationFragment?.childFragmentManager?.fragments?.first()
fun AppCompatActivity.currentFragment(navHostId: Int): Fragment? {
val navHostFragment: NavHostFragment =
supportFragmentManager.findFragmentById(navHostId) as NavHostFragment
navHostFragment.targetFragment
return navHostFragment?.childFragmentManager?.fragments?.first()
}

View file

@ -0,0 +1,20 @@
package code.name.monkey.retromusic.extensions
import androidx.annotation.IdRes
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment
import androidx.navigation.NavController
import androidx.navigation.fragment.NavHostFragment
import androidx.navigation.fragment.findNavController
fun Fragment.navigate(@IdRes id: Int) = findNavController().navigate(id)
fun Fragment.navController(@IdRes id: Int): NavController {
val fragment = childFragmentManager.findFragmentById(id) as NavHostFragment
return fragment.navController
}
fun AppCompatActivity.navController(@IdRes id: Int): NavController {
val fragment = supportFragmentManager.findFragmentById(id) as NavHostFragment
return fragment.navController
}

View file

@ -18,19 +18,21 @@ class LibraryViewModel(
private val repository: RepositoryImpl
) : ViewModel(), MusicServiceEventListener {
private val _albums = MutableLiveData<List<Album>>()
private val _songs = MutableLiveData<List<Song>>()
private val _artists = MutableLiveData<List<Artist>>()
private val _playlist = MutableLiveData<List<Playlist>>()
private val _genre = MutableLiveData<List<Genre>>()
private val _homeSections = MutableLiveData<List<Home>>()
private val albums = MutableLiveData<List<Album>>()
private val songs = MutableLiveData<List<Song>>()
private val artists = MutableLiveData<List<Artist>>()
private val playlists = MutableLiveData<List<Playlist>>()
private val genres = MutableLiveData<List<Genre>>()
private val home = MutableLiveData<List<Home>>()
private val paletteColor = MutableLiveData<Int>()
fun homeSections(): LiveData<List<Home>> = _homeSections
fun allAlbums(): LiveData<List<Album>> = _albums
fun allSongs(): LiveData<List<Song>> = _songs
fun allArtists(): LiveData<List<Artist>> = _artists
fun allPlaylisits(): LiveData<List<Playlist>> = _playlist
fun allGenres(): LiveData<List<Genre>> = _genre
val paletteColorLiveData: LiveData<Int> = paletteColor
val homeLiveData: LiveData<List<Home>> = home
val albumsLiveData: LiveData<List<Album>> = albums
val songsLiveData: LiveData<List<Song>> = songs
val artistsLiveData: LiveData<List<Artist>> = artists
val playlisitsLiveData: LiveData<List<Playlist>> = playlists
val genresLiveData: LiveData<List<Genre>> = genres
init {
viewModelScope.launch {
@ -39,11 +41,11 @@ class LibraryViewModel(
}
private fun loadLibraryContent() = viewModelScope.launch {
_songs.value = loadSongs.await()
_albums.value = loadAlbums.await()
_artists.value = loadArtists.await()
_playlist.value = loadPlaylists.await()
_genre.value = loadGenres.await()
songs.value = loadSongs.await()
albums.value = loadAlbums.await()
artists.value = loadArtists.await()
playlists.value = loadPlaylists.await()
genres.value = loadGenres.await()
loadHomeSections()
}
@ -55,7 +57,8 @@ class LibraryViewModel(
repository.recentArtists(),
repository.recentAlbums(),
repository.suggestions(),
repository.favoritePlaylist()
repository.favoritePlaylist(),
repository.homeGenres()
)
result.forEach {
if (it != null && it.arrayList.isNotEmpty()) {
@ -68,7 +71,7 @@ class LibraryViewModel(
}
}
}
_homeSections.value = list
home.value = list
}
private val loadSongs: Deferred<List<Song>>
@ -98,13 +101,17 @@ class LibraryViewModel(
fun forceReload(reloadType: ReloadType) = viewModelScope.launch {
when (reloadType) {
Songs -> _songs.value = loadSongs.await()
Albums -> _albums.value = loadAlbums.await()
Artists -> _artists.value = loadArtists.await()
HomeSections -> _songs.value = loadSongs.await()
Songs -> songs.value = loadSongs.await()
Albums -> albums.value = loadAlbums.await()
Artists -> artists.value = loadArtists.await()
HomeSections -> songs.value = loadSongs.await()
}
}
fun updateColor(newColor: Int) {
paletteColor.postValue(newColor)
}
override fun onMediaStoreChanged() {
loadLibraryContent()
}
@ -116,6 +123,7 @@ class LibraryViewModel(
override fun onPlayStateChanged() {}
override fun onRepeatModeChanged() {}
override fun onShuffleModeChanged() {}
}
enum class ReloadType {

View file

@ -7,7 +7,9 @@ import android.os.Bundle
import android.text.SpannableString
import android.text.SpannableStringBuilder
import android.text.style.ForegroundColorSpan
import android.view.*
import android.view.GestureDetector
import android.view.MotionEvent
import android.view.View
import android.view.animation.DecelerateInterpolator
import code.name.monkey.appthemehelper.ThemeStore
import io.github.muntashirakon.music.R
@ -24,8 +26,8 @@ import io.github.muntashirakon.music.util.ViewUtil
import kotlinx.android.synthetic.main.fragment_mini_player.*
import kotlin.math.abs
open class MiniPlayerFragment : AbsMusicServiceFragment(), MusicProgressViewUpdateHelper.Callback,
View.OnClickListener {
open class MiniPlayerFragment : AbsMusicServiceFragment(R.layout.fragment_mini_player),
MusicProgressViewUpdateHelper.Callback, View.OnClickListener {
private lateinit var progressViewUpdateHelper: MusicProgressViewUpdateHelper
@ -34,14 +36,6 @@ open class MiniPlayerFragment : AbsMusicServiceFragment(), MusicProgressViewUpda
progressViewUpdateHelper = MusicProgressViewUpdateHelper(this)
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_mini_player, container, false)
}
override fun onClick(view: View) {
when (view.id) {
R.id.actionNext -> MusicPlayerRemote.playNextSong()

View file

@ -24,7 +24,8 @@ enum class NowPlayingScreen constructor(
Gradient(R.string.gradient, R.drawable.np_gradient, 17),
Material(R.string.material, R.drawable.np_material, 11),
Normal(R.string.normal, R.drawable.np_normal, 0),
Peak(R.string.peak, R.drawable.np_peak, 14),
//Peak(R.string.peak, R.drawable.np_peak, 14),
Plain(R.string.plain, R.drawable.np_plain, 3),
Simple(R.string.simple, R.drawable.np_simple, 8),
Tiny(R.string.tiny, R.drawable.np_tiny, 7),

View file

@ -7,17 +7,21 @@ import androidx.recyclerview.widget.GridLayoutManager
import io.github.muntashirakon.music.R
import io.github.muntashirakon.music.adapter.album.AlbumAdapter
import io.github.muntashirakon.music.fragments.ReloadType
import io.github.muntashirakon.music.fragments.base.AbsLibraryPagerRecyclerViewCustomGridSizeFragment
import io.github.muntashirakon.music.fragments.base.AbsRecyclerViewCustomGridSizeFragment
import io.github.muntashirakon.music.interfaces.MainActivityFragmentCallbacks
import io.github.muntashirakon.music.util.PreferenceUtil
class AlbumsFragment :
AbsLibraryPagerRecyclerViewCustomGridSizeFragment<AlbumAdapter, GridLayoutManager>(),
AbsRecyclerViewCustomGridSizeFragment<AlbumAdapter, GridLayoutManager>(),
MainActivityFragmentCallbacks {
override fun handleBackPress(): Boolean {
return false
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
mainActivity.libraryViewModel.allAlbums()
libraryViewModel.albumsLiveData
.observe(viewLifecycleOwner, Observer { albums ->
if (albums.isNotEmpty())
adapter?.swapDataSet(albums)
@ -73,7 +77,7 @@ class AlbumsFragment :
}
override fun setSortOrder(sortOrder: String) {
mainActivity.libraryViewModel.forceReload(ReloadType.Albums)
libraryViewModel.forceReload(ReloadType.Albums)
}
override fun loadLayoutRes(): Int {
@ -84,9 +88,6 @@ class AlbumsFragment :
PreferenceUtil.albumGridStyle = layoutRes
}
override fun handleBackPress(): Boolean {
return false
}
companion object {
@JvmField

View file

@ -7,17 +7,23 @@ import androidx.recyclerview.widget.GridLayoutManager
import io.github.muntashirakon.music.R
import io.github.muntashirakon.music.adapter.artist.ArtistAdapter
import io.github.muntashirakon.music.fragments.ReloadType
import io.github.muntashirakon.music.fragments.base.AbsLibraryPagerRecyclerViewCustomGridSizeFragment
import io.github.muntashirakon.music.fragments.base.AbsRecyclerViewCustomGridSizeFragment
import io.github.muntashirakon.music.interfaces.MainActivityFragmentCallbacks
import io.github.muntashirakon.music.util.PreferenceUtil
class ArtistsFragment :
AbsLibraryPagerRecyclerViewCustomGridSizeFragment<ArtistAdapter, GridLayoutManager>(),
AbsRecyclerViewCustomGridSizeFragment<ArtistAdapter, GridLayoutManager>(),
MainActivityFragmentCallbacks {
override fun handleBackPress(): Boolean {
return false
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
mainActivity.libraryViewModel.allArtists().observe(
viewLifecycleOwner, Observer { artists ->
libraryViewModel.artistsLiveData
.observe(viewLifecycleOwner, Observer { artists ->
if (artists.isNotEmpty()) {
adapter?.swapDataSet(artists)
} else {
@ -26,15 +32,11 @@ class ArtistsFragment :
})
}
override fun handleBackPress(): Boolean {
return false
}
override val emptyMessage: Int
get() = R.string.no_artists
override fun setSortOrder(sortOrder: String) {
mainActivity.libraryViewModel.forceReload(ReloadType.Artists)
libraryViewModel.forceReload(ReloadType.Artists)
}
override fun createLayoutManager(): GridLayoutManager {

View file

@ -1,15 +0,0 @@
package io.github.muntashirakon.music.fragments.base
import android.os.Bundle
import io.github.muntashirakon.music.activities.MainActivity
open class AbsLibraryPagerFragment : AbsMusicServiceFragment() {
val mainActivity: MainActivity
get() = requireActivity() as MainActivity
override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
setHasOptionsMenu(true)
}
}

View file

@ -2,13 +2,14 @@ package io.github.muntashirakon.music.fragments.base
import android.os.Bundle
import android.view.View
import androidx.annotation.LayoutRes
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.ColorUtil
import code.name.monkey.appthemehelper.util.VersionUtils
import io.github.muntashirakon.music.R
import io.github.muntashirakon.music.activities.MainActivity
abstract class AbsMainActivityFragment : AbsMusicServiceFragment() {
abstract class AbsMainActivityFragment(@LayoutRes layout: Int) : AbsMusicServiceFragment(layout) {
val mainActivity: MainActivity
get() = activity as MainActivity

View file

@ -5,6 +5,7 @@ import android.net.Uri
import android.os.Bundle
import android.view.View
import android.webkit.MimeTypeMap
import androidx.annotation.LayoutRes
import androidx.fragment.app.Fragment
import io.github.muntashirakon.music.activities.base.AbsMusicServiceActivity
import io.github.muntashirakon.music.interfaces.MusicServiceEventListener
@ -19,7 +20,8 @@ import java.util.*
* Created by hemanths on 18/08/17.
*/
open class AbsMusicServiceFragment : Fragment(), MusicServiceEventListener {
open class AbsMusicServiceFragment(@LayoutRes layout: Int) : Fragment(layout),
MusicServiceEventListener {
var playerActivity: AbsMusicServiceActivity? = null
private set

View file

@ -4,6 +4,7 @@ import android.os.Bundle
import android.view.View
import android.view.animation.AccelerateInterpolator
import android.view.animation.DecelerateInterpolator
import androidx.annotation.LayoutRes
import io.github.muntashirakon.music.R
import io.github.muntashirakon.music.fragments.VolumeFragment
import io.github.muntashirakon.music.helper.MusicProgressViewUpdateHelper
@ -15,7 +16,7 @@ import io.github.muntashirakon.music.util.color.MediaNotificationProcessor
* Created by hemanths on 24/09/17.
*/
abstract class AbsPlayerControlsFragment : AbsMusicServiceFragment(),
abstract class AbsPlayerControlsFragment(@LayoutRes layout: Int) : AbsMusicServiceFragment(layout),
MusicProgressViewUpdateHelper.Callback {
protected abstract fun show()

View file

@ -2,7 +2,6 @@ package io.github.muntashirakon.music.fragments.base
import android.annotation.SuppressLint
import android.content.ContentUris
import android.content.Context
import android.content.Intent
import android.media.MediaMetadataRetriever
import android.os.AsyncTask
@ -13,12 +12,14 @@ import android.text.TextUtils
import android.view.MenuItem
import android.view.View
import android.widget.Toast
import androidx.annotation.LayoutRes
import androidx.appcompat.widget.Toolbar
import io.github.muntashirakon.music.R
import io.github.muntashirakon.music.activities.tageditor.AbsTagEditorActivity
import io.github.muntashirakon.music.activities.tageditor.SongTagEditorActivity
import io.github.muntashirakon.music.dialogs.*
import io.github.muntashirakon.music.extensions.hide
import io.github.muntashirakon.music.fragments.LibraryViewModel
import io.github.muntashirakon.music.fragments.player.PlayerAlbumCoverFragment
import io.github.muntashirakon.music.helper.MusicPlayerRemote
import io.github.muntashirakon.music.interfaces.PaletteColorHolder
@ -26,34 +27,19 @@ import io.github.muntashirakon.music.model.Song
import io.github.muntashirakon.music.model.lyrics.Lyrics
import io.github.muntashirakon.music.util.*
import kotlinx.android.synthetic.main.shadow_statusbar_toolbar.*
import org.koin.androidx.viewmodel.ext.android.sharedViewModel
import java.io.FileNotFoundException
abstract class AbsPlayerFragment : AbsMusicServiceFragment(),
abstract class AbsPlayerFragment(@LayoutRes layout: Int) : AbsMusicServiceFragment(layout),
Toolbar.OnMenuItemClickListener,
PaletteColorHolder,
PlayerAlbumCoverFragment.Callbacks {
var callbacks: Callbacks? = null
private set
private var updateIsFavoriteTask: AsyncTask<*, *, *>? = null
private var updateLyricsAsyncTask: AsyncTask<*, *, *>? = null
private var playerAlbumCoverFragment: PlayerAlbumCoverFragment? = null
override fun onAttach(
context: Context
) {
super.onAttach(context)
try {
callbacks = context as Callbacks?
} catch (e: ClassCastException) {
throw RuntimeException(context.javaClass.simpleName + " must implement " + Callbacks::class.java.simpleName)
}
}
override fun onDetach() {
super.onDetach()
callbacks = null
}
protected val libraryViewModel by sharedViewModel<LibraryViewModel>()
override fun onMenuItemClick(
item: MenuItem

View file

@ -7,8 +7,8 @@ import androidx.recyclerview.widget.RecyclerView
import io.github.muntashirakon.music.R
import io.github.muntashirakon.music.util.RetroUtil
abstract class AbsLibraryPagerRecyclerViewCustomGridSizeFragment<A : RecyclerView.Adapter<*>, LM : RecyclerView.LayoutManager> :
AbsLibraryPagerRecyclerViewFragment<A, LM>() {
abstract class AbsRecyclerViewCustomGridSizeFragment<A : RecyclerView.Adapter<*>, LM : RecyclerView.LayoutManager> :
AbsRecyclerViewFragment<A, LM>() {
private var gridSize: Int = 0
private var sortOrder: String? = null

View file

@ -1,13 +1,14 @@
package io.github.muntashirakon.music.fragments.base
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.annotation.NonNull
import androidx.annotation.StringRes
import androidx.recyclerview.widget.RecyclerView
import io.github.muntashirakon.music.R
import io.github.muntashirakon.music.activities.MainActivity
import io.github.muntashirakon.music.fragments.LibraryViewModel
import io.github.muntashirakon.music.helper.MusicPlayerRemote
import io.github.muntashirakon.music.util.DensityUtil
import io.github.muntashirakon.music.util.ThemedFastScroller.create
@ -16,19 +17,24 @@ import com.google.android.material.appbar.AppBarLayout
import kotlinx.android.synthetic.main.fragment_main_activity_recycler_view.*
import me.zhanghai.android.fastscroll.FastScroller
import me.zhanghai.android.fastscroll.FastScrollerBuilder
import org.koin.androidx.viewmodel.ext.android.sharedViewModel
abstract class AbsLibraryPagerRecyclerViewFragment<A : RecyclerView.Adapter<*>, LM : RecyclerView.LayoutManager> :
AbsLibraryPagerFragment(), AppBarLayout.OnOffsetChangedListener {
abstract class AbsRecyclerViewFragment<A : RecyclerView.Adapter<*>, LM : RecyclerView.LayoutManager> :
AbsMusicServiceFragment(R.layout.fragment_main_activity_recycler_view),
AppBarLayout.OnOffsetChangedListener {
val libraryViewModel: LibraryViewModel by sharedViewModel()
val mainActivity: MainActivity
get() = requireActivity() as MainActivity
override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
setHasOptionsMenu(true)
}
protected var adapter: A? = null
protected var layoutManager: LM? = null
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_main_activity_recycler_view, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
@ -92,7 +98,6 @@ abstract class AbsLibraryPagerRecyclerViewFragment<A : RecyclerView.Adapter<*>,
}
private fun initLayoutManager() {
layoutManager = createLayoutManager()
}

View file

@ -12,7 +12,7 @@
* See the GNU General Public License for more details.
*/
package io.github.muntashirakon.music.fragments.mainactivity;
package io.github.muntashirakon.music.fragments.folder;
import android.app.Dialog;
import android.content.Context;
@ -84,7 +84,7 @@ public class FoldersFragment extends AbsMainActivityFragment implements
FileUtil.fileIsMimeType(file, "audio/*", MimeTypeMap.getSingleton()) ||
FileUtil.fileIsMimeType(file, "application/opus", MimeTypeMap.getSingleton()) ||
FileUtil.fileIsMimeType(file, "application/ogg", MimeTypeMap.getSingleton()));
private static final String PATH = "path";
public static final String PATH = "path";
private static final String CRUMBS = "crumbs";
private static final int LOADER_ID = 5;
private SongFileAdapter adapter;
@ -106,6 +106,7 @@ public class FoldersFragment extends AbsMainActivityFragment implements
private RecyclerView recyclerView;
public FoldersFragment() {
super(R.layout.fragment_folder);
}
public static File getDefaultStartDirectory() {
@ -170,8 +171,7 @@ public class FoldersFragment extends AbsMainActivityFragment implements
if (savedInstanceState == null) {
//noinspection ConstantConditions
setCrumb(new BreadCrumbLayout.Crumb(
FileUtil.safeGetCanonicalFile((File) getArguments().getSerializable(PATH))), true);
setCrumb(new BreadCrumbLayout.Crumb(FileUtil.safeGetCanonicalFile((File) requireArguments().getSerializable(PATH))), true);
} else {
breadCrumbs.restoreFromStateWrapper(savedInstanceState.getParcelable(CRUMBS));
getLoaderManager().initLoader(LOADER_ID, null, this);

View file

@ -20,16 +20,20 @@ import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import io.github.muntashirakon.music.R
import io.github.muntashirakon.music.adapter.GenreAdapter
import io.github.muntashirakon.music.fragments.base.AbsLibraryPagerRecyclerViewFragment
import io.github.muntashirakon.music.fragments.base.AbsRecyclerViewFragment
import io.github.muntashirakon.music.interfaces.MainActivityFragmentCallbacks
class GenresFragment : AbsLibraryPagerRecyclerViewFragment<GenreAdapter, LinearLayoutManager>(),
class GenresFragment : AbsRecyclerViewFragment<GenreAdapter, LinearLayoutManager>(),
MainActivityFragmentCallbacks {
override fun handleBackPress(): Boolean {
return false
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
mainActivity.libraryViewModel.allGenres().observe(
viewLifecycleOwner, Observer { genres ->
libraryViewModel.genresLiveData
.observe(viewLifecycleOwner, Observer { genres ->
if (genres.isNotEmpty()) {
adapter?.swapDataSet(genres)
} else {
@ -38,9 +42,6 @@ class GenresFragment : AbsLibraryPagerRecyclerViewFragment<GenreAdapter, LinearL
})
}
override fun handleBackPress(): Boolean {
return false
}
override fun createLayoutManager(): LinearLayoutManager {
return LinearLayoutManager(activity)

View file

@ -17,13 +17,12 @@ package io.github.muntashirakon.music.fragments.home
import android.app.ActivityOptions
import android.os.Bundle
import android.util.DisplayMetrics
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import io.github.muntashirakon.music.R
import io.github.muntashirakon.music.adapter.HomeAdapter
import io.github.muntashirakon.music.fragments.LibraryViewModel
import io.github.muntashirakon.music.fragments.base.AbsMainActivityFragment
import io.github.muntashirakon.music.glide.ProfileBannerGlideRequest
import io.github.muntashirakon.music.glide.UserProfileGlideRequest
@ -39,22 +38,18 @@ import com.bumptech.glide.Glide
import kotlinx.android.synthetic.main.abs_playlists.*
import kotlinx.android.synthetic.main.fragment_banner_home.*
import kotlinx.android.synthetic.main.home_content.*
import org.koin.androidx.viewmodel.ext.android.sharedViewModel
class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallbacks {
private lateinit var homeAdapter: HomeAdapter
class BannerHomeFragment :
AbsMainActivityFragment(if (PreferenceUtil.isHomeBanner) R.layout.fragment_banner_home else R.layout.fragment_home),
MainActivityFragmentCallbacks {
override fun onCreateView(
inflater: LayoutInflater,
viewGroup: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(
if (PreferenceUtil.isHomeBanner) R.layout.fragment_banner_home else R.layout.fragment_home,
viewGroup,
false
)
override fun handleBackPress(): Boolean {
return false
}
private val libraryViewModel: LibraryViewModel by sharedViewModel()
private val displayMetrics: DisplayMetrics
get() {
val display = mainActivity.windowManager.defaultDisplay
@ -106,13 +101,13 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
}
titleWelcome?.text = String.format("%s", PreferenceUtil.userName)
homeAdapter = HomeAdapter(mainActivity, displayMetrics)
val homeAdapter = HomeAdapter(mainActivity, displayMetrics)
recyclerView.apply {
layoutManager = LinearLayoutManager(mainActivity)
adapter = homeAdapter
}
mainActivity.libraryViewModel.homeSections()
libraryViewModel.homeLiveData
.observe(viewLifecycleOwner, Observer { sections ->
homeAdapter.swapData(sections)
})
@ -120,10 +115,6 @@ class BannerHomeFragment : AbsMainActivityFragment(), MainActivityFragmentCallba
loadProfile()
}
override fun handleBackPress(): Boolean {
return false
}
private fun loadProfile() {
bannerImage?.let {
ProfileBannerGlideRequest.Builder.from(

View file

@ -0,0 +1,42 @@
package code.name.monkey.retromusic.fragments.player
import android.os.Bundle
import androidx.fragment.app.Fragment
import androidx.navigation.NavController
import code.name.monkey.retromusic.R
import code.name.monkey.retromusic.extensions.navController
import code.name.monkey.retromusic.fragments.NowPlayingScreen.*
import code.name.monkey.retromusic.util.PreferenceUtil
class NowPlayingPlayerFragment : Fragment(R.layout.fragment_now_playing_player) {
companion object {
const val TAG = "NowPlaying"
}
override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
val navController = navController(R.id.playerFragmentContainer)
updateNowPlaying(navController)
}
private fun updateNowPlaying(navController: NavController) {
when (PreferenceUtil.nowPlayingScreen) {
Adaptive -> navController.navigate(R.id.adaptiveFragment)
Blur -> navController.navigate(R.id.blurPlayerFragment)
BlurCard -> navController.navigate(R.id.cardBlurFragment)
Card -> navController.navigate(R.id.cardFragment)
Circle -> navController.navigate(R.id.circlePlayerFragment)
Classic -> navController.navigate(R.id.classicPlayerFragment)
Color -> navController.navigate(R.id.colorFragment)
Fit -> navController.navigate(R.id.fitFragment)
Flat -> navController.navigate(R.id.flatPlayerFragment)
Full -> navController.navigate(R.id.fullPlayerFragment)
Gradient -> navController.navigate(R.id.gradientPlayerFragment)
Material -> navController.navigate(R.id.materialFragment)
Plain -> navController.navigate(R.id.plainPlayerFragment)
Simple -> navController.navigate(R.id.simplePlayerFragment)
Tiny -> navController.navigate(R.id.tinyPlayerFragment)
else -> navController.navigate(R.id.playerFragment)
}
}
}

View file

@ -1,9 +1,7 @@
package io.github.muntashirakon.music.fragments.player
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.viewpager.widget.ViewPager
import io.github.muntashirakon.music.R
import io.github.muntashirakon.music.adapter.album.AlbumCoverPagerAdapter
@ -13,13 +11,13 @@ import io.github.muntashirakon.music.fragments.base.AbsMusicServiceFragment
import io.github.muntashirakon.music.helper.MusicPlayerRemote
import io.github.muntashirakon.music.transform.CarousalPagerTransformer
import io.github.muntashirakon.music.transform.ParallaxPagerTransformer
import io.github.muntashirakon.music.util.PreferenceUtil
import io.github.muntashirakon.music.util.color.MediaNotificationProcessor
import kotlinx.android.synthetic.main.fragment_player_album_cover.*
class PlayerAlbumCoverFragment : AbsMusicServiceFragment(), ViewPager.OnPageChangeListener {
class PlayerAlbumCoverFragment : AbsMusicServiceFragment(R.layout.fragment_player_album_cover),
ViewPager.OnPageChangeListener {
private var callbacks: Callbacks? = null
private var currentPosition: Int = 0
private val colorReceiver = object : AlbumCoverFragment.ColorReceiver {
@ -35,13 +33,6 @@ class PlayerAlbumCoverFragment : AbsMusicServiceFragment(), ViewPager.OnPageChan
transformer.setSpeed(0.3f)
}
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_player_album_cover, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
viewPager.addOnPageChangeListener(this)

View file

@ -1,9 +1,7 @@
package io.github.muntashirakon.music.fragments.player.adaptive
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.widget.Toolbar
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
@ -18,7 +16,7 @@ import io.github.muntashirakon.music.model.Song
import io.github.muntashirakon.music.util.color.MediaNotificationProcessor
import kotlinx.android.synthetic.main.fragment_adaptive_player.*
class AdaptiveFragment : AbsPlayerFragment() {
class AdaptiveFragment : AbsPlayerFragment(R.layout.fragment_adaptive_player) {
override fun playerToolbar(): Toolbar {
return playerToolbar
@ -27,14 +25,6 @@ class AdaptiveFragment : AbsPlayerFragment() {
private var lastColor: Int = 0
private lateinit var playbackControlsFragment: AdaptivePlaybackControlsFragment
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_adaptive_player, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
setUpSubFragments()
@ -96,7 +86,7 @@ class AdaptiveFragment : AbsPlayerFragment() {
override fun onColorChanged(color: MediaNotificationProcessor) {
playbackControlsFragment.setColor(color)
lastColor = color.primaryTextColor
callbacks?.onPaletteColorChanged()
libraryViewModel.updateColor(color.primaryTextColor)
ToolbarContentTintHelper.colorizeToolbar(
playerToolbar,
ATHUtil.resolveColor(requireContext(), R.attr.colorControlNormal),

View file

@ -30,7 +30,8 @@ import io.github.muntashirakon.music.util.PreferenceUtil
import io.github.muntashirakon.music.util.color.MediaNotificationProcessor
import kotlinx.android.synthetic.main.fragment_adaptive_player_playback_controls.*
class AdaptivePlaybackControlsFragment : AbsPlayerControlsFragment() {
class AdaptivePlaybackControlsFragment :
AbsPlayerControlsFragment(R.layout.fragment_adaptive_player_playback_controls) {
private var lastPlaybackControlsColor: Int = 0
private var lastDisabledPlaybackControlsColor: Int = 0

View file

@ -4,9 +4,7 @@ import android.animation.ObjectAnimator
import android.graphics.Color
import android.graphics.PorterDuff
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.animation.AccelerateInterpolator
import android.view.animation.DecelerateInterpolator
import android.view.animation.LinearInterpolator
@ -29,7 +27,8 @@ import io.github.muntashirakon.music.util.PreferenceUtil
import io.github.muntashirakon.music.util.color.MediaNotificationProcessor
import kotlinx.android.synthetic.main.fragment_blur_player_playback_controls.*
class BlurPlaybackControlsFragment : AbsPlayerControlsFragment() {
class BlurPlaybackControlsFragment :
AbsPlayerControlsFragment(R.layout.fragment_blur_player_playback_controls) {
private var lastPlaybackControlsColor: Int = 0
private var lastDisabledPlaybackControlsColor: Int = 0
@ -40,14 +39,6 @@ class BlurPlaybackControlsFragment : AbsPlayerControlsFragment() {
progressViewUpdateHelper = MusicProgressViewUpdateHelper(this)
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_blur_player_playback_controls, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
setUpMusicControllers()

View file

@ -3,9 +3,7 @@ package io.github.muntashirakon.music.fragments.player.blur
import android.content.SharedPreferences
import android.graphics.Color
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.widget.Toolbar
import androidx.preference.PreferenceManager
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
@ -22,7 +20,8 @@ import io.github.muntashirakon.music.util.color.MediaNotificationProcessor
import com.bumptech.glide.Glide
import kotlinx.android.synthetic.main.fragment_blur.*
class BlurPlayerFragment : AbsPlayerFragment(), SharedPreferences.OnSharedPreferenceChangeListener {
class BlurPlayerFragment : AbsPlayerFragment(R.layout.fragment_blur),
SharedPreferences.OnSharedPreferenceChangeListener {
override fun playerToolbar(): Toolbar {
return playerToolbar
@ -32,12 +31,6 @@ class BlurPlayerFragment : AbsPlayerFragment(), SharedPreferences.OnSharedPrefer
private var lastColor: Int = 0
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_blur, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
@ -68,7 +61,7 @@ class BlurPlayerFragment : AbsPlayerFragment(), SharedPreferences.OnSharedPrefer
override fun onColorChanged(color: MediaNotificationProcessor) {
playbackControlsFragment.setColor(color)
lastColor = color.backgroundColor
callbacks?.onPaletteColorChanged()
libraryViewModel.updateColor(color.backgroundColor)
ToolbarContentTintHelper.colorizeToolbar(playerToolbar, Color.WHITE, activity)
}

View file

@ -2,9 +2,7 @@ package io.github.muntashirakon.music.fragments.player.card
import android.graphics.Color
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.widget.Toolbar
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
import io.github.muntashirakon.music.R
@ -16,7 +14,7 @@ import io.github.muntashirakon.music.model.Song
import io.github.muntashirakon.music.util.color.MediaNotificationProcessor
import kotlinx.android.synthetic.main.fragment_card_player.*
class CardFragment : AbsPlayerFragment() {
class CardFragment : AbsPlayerFragment(R.layout.fragment_card_player) {
override fun playerToolbar(): Toolbar {
return playerToolbar
}
@ -47,7 +45,7 @@ class CardFragment : AbsPlayerFragment() {
override fun onColorChanged(color: MediaNotificationProcessor) {
playbackControlsFragment.setColor(color)
lastColor = color.primaryTextColor
callbacks?.onPaletteColorChanged()
libraryViewModel.updateColor(color.primaryTextColor)
ToolbarContentTintHelper.colorizeToolbar(playerToolbar, Color.WHITE, activity)
}
@ -62,14 +60,6 @@ class CardFragment : AbsPlayerFragment() {
toggleFavorite(MusicPlayerRemote.currentSong)
}
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_card_player, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
setUpSubFragments()

View file

@ -3,9 +3,7 @@ package io.github.muntashirakon.music.fragments.player.card
import android.animation.ObjectAnimator
import android.graphics.PorterDuff
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.animation.LinearInterpolator
import android.widget.SeekBar
import code.name.monkey.appthemehelper.ThemeStore
@ -24,13 +22,13 @@ import io.github.muntashirakon.music.helper.PlayPauseButtonOnClickHandler
import io.github.muntashirakon.music.misc.SimpleOnSeekbarChangeListener
import io.github.muntashirakon.music.service.MusicService
import io.github.muntashirakon.music.util.MusicUtil
import io.github.muntashirakon.music.util.PreferenceUtil
import io.github.muntashirakon.music.util.color.MediaNotificationProcessor
import kotlinx.android.synthetic.main.fragment_card_player_playback_controls.*
import kotlinx.android.synthetic.main.media_button.*
class CardPlaybackControlsFragment : AbsPlayerControlsFragment() {
class CardPlaybackControlsFragment :
AbsPlayerControlsFragment(R.layout.fragment_card_player_playback_controls) {
private var lastPlaybackControlsColor: Int = 0
private var lastDisabledPlaybackControlsColor: Int = 0
@ -41,12 +39,6 @@ class CardPlaybackControlsFragment : AbsPlayerControlsFragment() {
progressViewUpdateHelper = MusicProgressViewUpdateHelper(this)
}
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_card_player_playback_controls, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

View file

@ -3,9 +3,7 @@ package io.github.muntashirakon.music.fragments.player.cardblur
import android.content.SharedPreferences
import android.graphics.Color
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.widget.Toolbar
import androidx.preference.PreferenceManager
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
@ -19,12 +17,12 @@ import io.github.muntashirakon.music.glide.RetroMusicColoredTarget
import io.github.muntashirakon.music.glide.SongGlideRequest
import io.github.muntashirakon.music.helper.MusicPlayerRemote
import io.github.muntashirakon.music.model.Song
import io.github.muntashirakon.music.util.color.MediaNotificationProcessor
import com.bumptech.glide.Glide
import kotlinx.android.synthetic.main.fragment_card_blur_player.*
class CardBlurFragment : AbsPlayerFragment(), SharedPreferences.OnSharedPreferenceChangeListener {
class CardBlurFragment : AbsPlayerFragment(R.layout.fragment_card_blur_player),
SharedPreferences.OnSharedPreferenceChangeListener {
override fun playerToolbar(): Toolbar {
return playerToolbar
}
@ -54,7 +52,7 @@ class CardBlurFragment : AbsPlayerFragment(), SharedPreferences.OnSharedPreferen
override fun onColorChanged(color: MediaNotificationProcessor) {
playbackControlsFragment.setColor(color)
lastColor = color.backgroundColor
callbacks!!.onPaletteColorChanged()
libraryViewModel.updateColor(color.backgroundColor)
ToolbarContentTintHelper.colorizeToolbar(playerToolbar, Color.WHITE, activity)
playerToolbar.setTitleTextColor(Color.WHITE)
@ -72,13 +70,6 @@ class CardBlurFragment : AbsPlayerFragment(), SharedPreferences.OnSharedPreferen
toggleFavorite(MusicPlayerRemote.currentSong)
}
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_card_blur_player, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

View file

@ -4,9 +4,7 @@ import android.animation.ObjectAnimator
import android.graphics.Color
import android.graphics.PorterDuff
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.animation.DecelerateInterpolator
import android.view.animation.LinearInterpolator
import android.widget.SeekBar
@ -24,12 +22,12 @@ import io.github.muntashirakon.music.misc.SimpleOnSeekbarChangeListener
import io.github.muntashirakon.music.service.MusicService
import io.github.muntashirakon.music.util.MusicUtil
import io.github.muntashirakon.music.util.PreferenceUtil
import io.github.muntashirakon.music.util.color.MediaNotificationProcessor
import kotlinx.android.synthetic.main.fragment_card_blur_player_playback_controls.*
import kotlinx.android.synthetic.main.media_button.*
class CardBlurPlaybackControlsFragment : AbsPlayerControlsFragment() {
class CardBlurPlaybackControlsFragment :
AbsPlayerControlsFragment(R.layout.fragment_card_blur_player_playback_controls) {
private var lastPlaybackControlsColor: Int = 0
private var lastDisabledPlaybackControlsColor: Int = 0
@ -40,18 +38,6 @@ class CardBlurPlaybackControlsFragment : AbsPlayerControlsFragment() {
progressViewUpdateHelper = MusicProgressViewUpdateHelper(this)
}
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(
R.layout.fragment_card_blur_player_playback_controls,
container,
false
)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
setUpMusicControllers()

View file

@ -58,7 +58,8 @@ import kotlinx.android.synthetic.main.fragment_circle_player.*
* Created by hemanths on 2020-01-06.
*/
class CirclePlayerFragment : AbsPlayerFragment(), Callback, OnAudioVolumeChangedListener,
class CirclePlayerFragment : AbsPlayerFragment(R.layout.fragment_circle_player), Callback,
OnAudioVolumeChangedListener,
OnSeekArcChangeListener {
private lateinit var progressViewUpdateHelper: MusicProgressViewUpdateHelper

View file

@ -6,9 +6,7 @@ import android.content.res.ColorStateList
import android.graphics.Color
import android.graphics.PorterDuff
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.animation.LinearInterpolator
import android.widget.SeekBar
import androidx.appcompat.app.AppCompatActivity
@ -37,7 +35,6 @@ import io.github.muntashirakon.music.misc.SimpleOnSeekbarChangeListener
import io.github.muntashirakon.music.model.Song
import io.github.muntashirakon.music.service.MusicService
import io.github.muntashirakon.music.util.MusicUtil
import io.github.muntashirakon.music.util.PreferenceUtil
import io.github.muntashirakon.music.util.ViewUtil
import io.github.muntashirakon.music.util.color.MediaNotificationProcessor
@ -53,7 +50,8 @@ import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils
import kotlinx.android.synthetic.main.fragment_classic_controls.*
import kotlinx.android.synthetic.main.fragment_classic_player.*
class ClassicPlayerFragment : AbsPlayerFragment(), View.OnLayoutChangeListener,
class ClassicPlayerFragment : AbsPlayerFragment(R.layout.fragment_classic_player),
View.OnLayoutChangeListener,
MusicProgressViewUpdateHelper.Callback {
private var lastColor: Int = 0
@ -107,14 +105,6 @@ class ClassicPlayerFragment : AbsPlayerFragment(), View.OnLayoutChangeListener,
progressViewUpdateHelper = MusicProgressViewUpdateHelper(this)
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_classic_player, container, false)
}
@SuppressLint("ClickableViewAccessibility")
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
@ -271,7 +261,7 @@ class ClassicPlayerFragment : AbsPlayerFragment(), View.OnLayoutChangeListener,
override fun onColorChanged(color: MediaNotificationProcessor) {
lastColor = color.backgroundColor
callbacks?.onPaletteColorChanged()
libraryViewModel.updateColor(color.backgroundColor)
lastPlaybackControlsColor = color.primaryTextColor
lastDisabledPlaybackControlsColor = ColorUtil.withAlpha(color.primaryTextColor, 0.3f)

View file

@ -3,9 +3,7 @@ package io.github.muntashirakon.music.fragments.player.color
import android.animation.ValueAnimator
import android.os.Bundle
import android.os.Handler
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.widget.Toolbar
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.ColorUtil
@ -18,7 +16,7 @@ import io.github.muntashirakon.music.model.Song
import io.github.muntashirakon.music.util.color.MediaNotificationProcessor
import kotlinx.android.synthetic.main.fragment_color_player.*
class ColorFragment : AbsPlayerFragment() {
class ColorFragment : AbsPlayerFragment(R.layout.fragment_color_player) {
private var lastColor: Int = 0
private var navigationColor: Int = 0
@ -33,10 +31,11 @@ class ColorFragment : AbsPlayerFragment() {
get() = navigationColor
override fun onColorChanged(color: MediaNotificationProcessor) {
libraryViewModel.updateColor(color.backgroundColor)
lastColor = color.secondaryTextColor
playbackControlsFragment.setColor(color)
navigationColor = color.backgroundColor
callbacks?.onPaletteColorChanged()
colorGradientBackground?.setBackgroundColor(color.backgroundColor)
playerActivity?.setLightNavigationBar(ColorUtil.isColorLight(color.backgroundColor))
Handler().post {
@ -84,14 +83,6 @@ class ColorFragment : AbsPlayerFragment() {
}
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_color_player, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
setUpSubFragments()

View file

@ -28,7 +28,8 @@ import io.github.muntashirakon.music.util.PreferenceUtil
import io.github.muntashirakon.music.util.color.MediaNotificationProcessor
import kotlinx.android.synthetic.main.fragment_color_player_playback_controls.*
class ColorPlaybackControlsFragment : AbsPlayerControlsFragment() {
class ColorPlaybackControlsFragment :
AbsPlayerControlsFragment(R.layout.fragment_adaptive_player_playback_controls) {
private var lastPlaybackControlsColor: Int = 0
private var lastDisabledPlaybackControlsColor: Int = 0

View file

@ -1,9 +1,7 @@
package io.github.muntashirakon.music.fragments.player.fit
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.widget.Toolbar
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
@ -15,7 +13,7 @@ import io.github.muntashirakon.music.model.Song
import io.github.muntashirakon.music.util.color.MediaNotificationProcessor
import kotlinx.android.synthetic.main.fragment_fit.*
class FitFragment : AbsPlayerFragment() {
class FitFragment : AbsPlayerFragment(R.layout.fragment_fit) {
override fun playerToolbar(): Toolbar {
return playerToolbar
}
@ -46,7 +44,7 @@ class FitFragment : AbsPlayerFragment() {
override fun onColorChanged(color: MediaNotificationProcessor) {
playbackControlsFragment.setColor(color)
lastColor = color.primaryTextColor
callbacks?.onPaletteColorChanged()
libraryViewModel.updateColor(color.primaryTextColor)
ToolbarContentTintHelper.colorizeToolbar(
playerToolbar,
ATHUtil.resolveColor(requireContext(), R.attr.colorControlNormal),
@ -65,14 +63,6 @@ class FitFragment : AbsPlayerFragment() {
toggleFavorite(MusicPlayerRemote.currentSong)
}
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_fit, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
setUpSubFragments()

View file

@ -31,7 +31,8 @@ import io.github.muntashirakon.music.util.PreferenceUtil
import io.github.muntashirakon.music.util.color.MediaNotificationProcessor
import kotlinx.android.synthetic.main.fragment_fit_playback_controls.*
class FitPlaybackControlsFragment : AbsPlayerControlsFragment() {
class FitPlaybackControlsFragment :
AbsPlayerControlsFragment(R.layout.fragment_fit_playback_controls) {
private var lastPlaybackControlsColor: Int = 0
@ -43,13 +44,6 @@ class FitPlaybackControlsFragment : AbsPlayerControlsFragment() {
progressViewUpdateHelper = MusicProgressViewUpdateHelper(this)
}
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_fit_playback_controls, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

View file

@ -3,9 +3,7 @@ package io.github.muntashirakon.music.fragments.player.flat
import android.animation.ObjectAnimator
import android.graphics.PorterDuff
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.animation.DecelerateInterpolator
import android.view.animation.LinearInterpolator
import android.widget.SeekBar
@ -27,12 +25,12 @@ import io.github.muntashirakon.music.helper.PlayPauseButtonOnClickHandler
import io.github.muntashirakon.music.misc.SimpleOnSeekbarChangeListener
import io.github.muntashirakon.music.service.MusicService
import io.github.muntashirakon.music.util.MusicUtil
import io.github.muntashirakon.music.util.PreferenceUtil
import io.github.muntashirakon.music.util.color.MediaNotificationProcessor
import kotlinx.android.synthetic.main.fragment_flat_player_playback_controls.*
class FlatPlaybackControlsFragment : AbsPlayerControlsFragment(), Callback {
class FlatPlaybackControlsFragment :
AbsPlayerControlsFragment(R.layout.fragment_flat_player_playback_controls), Callback {
private var lastPlaybackControlsColor: Int = 0
private var lastDisabledPlaybackControlsColor: Int = 0
@ -43,13 +41,6 @@ class FlatPlaybackControlsFragment : AbsPlayerControlsFragment(), Callback {
progressViewUpdateHelper = MusicProgressViewUpdateHelper(this)
}
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_flat_player_playback_controls, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
setUpMusicControllers()
@ -86,14 +77,14 @@ class FlatPlaybackControlsFragment : AbsPlayerControlsFragment(), Callback {
override fun setColor(color: MediaNotificationProcessor) {
if (ATHUtil.isWindowBackgroundDark(requireContext())) {
lastPlaybackControlsColor =
MaterialValueHelper.getSecondaryTextColor(requireContext(), true)
MaterialValueHelper.getSecondaryTextColor(requireContext(), false)
lastDisabledPlaybackControlsColor =
MaterialValueHelper.getSecondaryDisabledTextColor(requireContext(), true)
MaterialValueHelper.getSecondaryDisabledTextColor(requireContext(), false)
} else {
lastPlaybackControlsColor =
MaterialValueHelper.getPrimaryTextColor(requireContext(), false)
MaterialValueHelper.getPrimaryTextColor(requireContext(), true)
lastDisabledPlaybackControlsColor =
MaterialValueHelper.getPrimaryDisabledTextColor(requireContext(), false)
MaterialValueHelper.getPrimaryDisabledTextColor(requireContext(), true)
}
val colorFinal = if (PreferenceUtil.isAdaptiveColor) {
@ -116,8 +107,8 @@ class FlatPlaybackControlsFragment : AbsPlayerControlsFragment(), Callback {
val colorSecondary =
MaterialValueHelper.getSecondaryTextColor(context, ColorUtil.isColorLight(darkColor))
TintHelper.setTintAuto(playPauseButton!!, colorPrimary, false)
TintHelper.setTintAuto(playPauseButton!!, color, true)
TintHelper.setTintAuto(playPauseButton, colorPrimary, false)
TintHelper.setTintAuto(playPauseButton, color, true)
title.setBackgroundColor(color)
title.setTextColor(colorPrimary)

View file

@ -4,9 +4,7 @@ import android.animation.ArgbEvaluator
import android.animation.ValueAnimator
import android.graphics.drawable.GradientDrawable
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.widget.Toolbar
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.ColorUtil
@ -17,14 +15,13 @@ import io.github.muntashirakon.music.fragments.base.AbsPlayerFragment
import io.github.muntashirakon.music.fragments.player.PlayerAlbumCoverFragment
import io.github.muntashirakon.music.helper.MusicPlayerRemote
import io.github.muntashirakon.music.model.Song
import io.github.muntashirakon.music.util.PreferenceUtil
import io.github.muntashirakon.music.util.ViewUtil
import io.github.muntashirakon.music.util.color.MediaNotificationProcessor
import io.github.muntashirakon.music.views.DrawableGradient
import kotlinx.android.synthetic.main.fragment_flat_player.*
class FlatPlayerFragment : AbsPlayerFragment() {
class FlatPlayerFragment : AbsPlayerFragment(R.layout.fragment_flat_player) {
override fun playerToolbar(): Toolbar {
return playerToolbar
}
@ -71,13 +68,6 @@ class FlatPlayerFragment : AbsPlayerFragment() {
valueAnimator?.setDuration(ViewUtil.RETRO_MUSIC_ANIM_TIME.toLong())?.start()
}
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_flat_player, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
setUpPlayerToolbar()
@ -108,7 +98,7 @@ class FlatPlayerFragment : AbsPlayerFragment() {
override fun onColorChanged(color: MediaNotificationProcessor) {
lastColor = color.backgroundColor
controlsFragment.setColor(color)
callbacks?.onPaletteColorChanged()
libraryViewModel.updateColor(color.backgroundColor)
val isLight = ColorUtil.isColorLight(color.backgroundColor)
val iconColor = if (PreferenceUtil.isAdaptiveColor)
MaterialValueHelper.getPrimaryTextColor(requireContext(), isLight)

View file

@ -7,10 +7,8 @@ import android.graphics.Color
import android.graphics.PorterDuff
import android.os.AsyncTask
import android.os.Bundle
import android.view.LayoutInflater
import android.view.MenuItem
import android.view.View
import android.view.ViewGroup
import android.view.animation.DecelerateInterpolator
import android.view.animation.LinearInterpolator
import android.widget.PopupMenu
@ -30,7 +28,6 @@ import io.github.muntashirakon.music.model.Song
import io.github.muntashirakon.music.service.MusicService
import io.github.muntashirakon.music.util.MusicUtil
import io.github.muntashirakon.music.util.PreferenceUtil
import io.github.muntashirakon.music.util.color.MediaNotificationProcessor
import kotlinx.android.synthetic.main.fragment_full_player_controls.*
@ -38,7 +35,8 @@ import kotlinx.android.synthetic.main.fragment_full_player_controls.*
* Created by hemanths on 20/09/17.
*/
class FullPlaybackControlsFragment : AbsPlayerControlsFragment(),
class FullPlaybackControlsFragment :
AbsPlayerControlsFragment(R.layout.fragment_full_player_controls),
PopupMenu.OnMenuItemClickListener {
private var lastPlaybackControlsColor: Int = 0
@ -50,14 +48,6 @@ class FullPlaybackControlsFragment : AbsPlayerControlsFragment(),
progressViewUpdateHelper = MusicProgressViewUpdateHelper(this)
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_full_player_controls, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
setUpMusicControllers()

View file

@ -4,9 +4,7 @@ import android.app.ActivityOptions
import android.content.res.ColorStateList
import android.graphics.Color
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
import android.widget.TextView
import androidx.appcompat.widget.Toolbar
@ -33,7 +31,8 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
class FullPlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Callback {
class FullPlayerFragment : AbsPlayerFragment(R.layout.fragment_full),
MusicProgressViewUpdateHelper.Callback {
private lateinit var lyricsLayout: FrameLayout
private lateinit var lyricsLine1: TextView
private lateinit var lyricsLine2: TextView
@ -134,13 +133,6 @@ class FullPlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Ca
}
}
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_full, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
lyricsLayout = view.findViewById(R.id.playerLyrics)
@ -202,7 +194,7 @@ class FullPlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Ca
lastColor = color.backgroundColor
mask.backgroundTintList = ColorStateList.valueOf(color.backgroundColor)
controlsFragment.setColor(color)
callbacks?.onPaletteColorChanged()
libraryViewModel.updateColor(color.backgroundColor)
ToolbarContentTintHelper.colorizeToolbar(playerToolbar, Color.WHITE, activity)
}

View file

@ -7,9 +7,7 @@ import android.graphics.Color
import android.graphics.PorterDuff
import android.os.AsyncTask
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.animation.LinearInterpolator
import android.widget.PopupMenu
import android.widget.SeekBar
@ -51,7 +49,8 @@ import kotlinx.android.synthetic.main.fragment_gradient_controls.*
import kotlinx.android.synthetic.main.fragment_gradient_player.*
import kotlinx.android.synthetic.main.status_bar.*
class GradientPlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Callback,
class GradientPlayerFragment : AbsPlayerFragment(R.layout.fragment_gradient_player),
MusicProgressViewUpdateHelper.Callback,
View.OnLayoutChangeListener, PopupMenu.OnMenuItemClickListener {
private var lastColor: Int = 0
private var lastPlaybackControlsColor: Int = 0
@ -124,13 +123,6 @@ class GradientPlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelpe
progressViewUpdateHelper = MusicProgressViewUpdateHelper(this)
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_gradient_player, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
@ -201,7 +193,7 @@ class GradientPlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelpe
override fun onColorChanged(color: MediaNotificationProcessor) {
lastColor = color.backgroundColor
callbacks?.onPaletteColorChanged()
libraryViewModel.updateColor(color.backgroundColor)
mask.backgroundTintList = ColorStateList.valueOf(color.backgroundColor)
colorBackground.setBackgroundColor(color.backgroundColor)
playerQueueSheet.setBackgroundColor(ColorUtil.darkenColor(color.backgroundColor))
@ -283,6 +275,7 @@ class GradientPlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelpe
super.onQueueChanged()
updateLabel()
}
private fun updateSong() {
val song = MusicPlayerRemote.currentSong
title.text = song.title
@ -485,35 +478,36 @@ class GradientPlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelpe
songTotalTime.text = MusicUtil.getReadableDurationString(total.toLong())
songCurrentProgress.text = MusicUtil.getReadableDurationString(progress.toLong())
}
@SuppressLint("StaticFieldLeak")
private fun updateFavorite() {
if (updateIsFavoriteTask != null) {
updateIsFavoriteTask?.cancel(false)
}
updateIsFavoriteTask =
object : AsyncTask<Song, Void, Boolean>() {
override fun doInBackground(vararg params: Song): Boolean? {
val activity = activity
return if (activity != null) {
MusicUtil.isFavorite(requireActivity(), params[0])
} else {
cancel(false)
null
object : AsyncTask<Song, Void, Boolean>() {
override fun doInBackground(vararg params: Song): Boolean? {
val activity = activity
return if (activity != null) {
MusicUtil.isFavorite(requireActivity(), params[0])
} else {
cancel(false)
null
}
}
}
override fun onPostExecute(isFavorite: Boolean?) {
val activity = activity
if (activity != null) {
val res = if (isFavorite!!)
R.drawable.ic_favorite
else
R.drawable.ic_favorite_border
override fun onPostExecute(isFavorite: Boolean?) {
val activity = activity
if (activity != null) {
val res = if (isFavorite!!)
R.drawable.ic_favorite
else
R.drawable.ic_favorite_border
val drawable = TintHelper.createTintedDrawable(activity, res, Color.WHITE)
songFavourite?.setImageDrawable(drawable)
val drawable = TintHelper.createTintedDrawable(activity, res, Color.WHITE)
songFavourite?.setImageDrawable(drawable)
}
}
}
}.execute(MusicPlayerRemote.currentSong)
}.execute(MusicPlayerRemote.currentSong)
}
}

View file

@ -2,9 +2,7 @@ package io.github.muntashirakon.music.fragments.player.home
import android.graphics.Color
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.widget.Toolbar
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
@ -18,7 +16,8 @@ import io.github.muntashirakon.music.util.color.MediaNotificationProcessor
import kotlinx.android.synthetic.main.fragment_home_player.*
class HomePlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Callback {
class HomePlayerFragment : AbsPlayerFragment(R.layout.fragment_home_player),
MusicProgressViewUpdateHelper.Callback {
private var lastColor: Int = 0
private lateinit var progressViewUpdateHelper: MusicProgressViewUpdateHelper
@ -27,14 +26,6 @@ class HomePlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Ca
progressViewUpdateHelper = MusicProgressViewUpdateHelper(this)
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_home_player, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
setUpPlayerToolbar()
@ -93,7 +84,7 @@ class HomePlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Ca
override fun onColorChanged(color: MediaNotificationProcessor) {
lastColor = color.backgroundColor
callbacks?.onPaletteColorChanged()
libraryViewModel.updateColor(color.backgroundColor)
ToolbarContentTintHelper.colorizeToolbar(
playerToolbar,
Color.WHITE,

View file

@ -17,9 +17,7 @@ package io.github.muntashirakon.music.fragments.player.lockscreen
import android.animation.ObjectAnimator
import android.graphics.PorterDuff
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.animation.DecelerateInterpolator
import android.view.animation.LinearInterpolator
import android.widget.SeekBar
@ -38,7 +36,6 @@ import io.github.muntashirakon.music.helper.PlayPauseButtonOnClickHandler
import io.github.muntashirakon.music.misc.SimpleOnSeekbarChangeListener
import io.github.muntashirakon.music.service.MusicService
import io.github.muntashirakon.music.util.MusicUtil
import io.github.muntashirakon.music.util.PreferenceUtil
import io.github.muntashirakon.music.util.color.MediaNotificationProcessor
import kotlinx.android.synthetic.main.fragment_lock_screen_playback_controls.*
@ -46,7 +43,8 @@ import kotlinx.android.synthetic.main.fragment_lock_screen_playback_controls.*
/**
* @author Hemanth S (h4h13).
*/
class LockScreenPlayerControlsFragment : AbsPlayerControlsFragment() {
class LockScreenPlayerControlsFragment :
AbsPlayerControlsFragment(R.layout.fragment_lock_screen_playback_controls) {
private var progressViewUpdateHelper: MusicProgressViewUpdateHelper? = null
private var lastPlaybackControlsColor: Int = 0
@ -57,14 +55,6 @@ class LockScreenPlayerControlsFragment : AbsPlayerControlsFragment() {
progressViewUpdateHelper = MusicProgressViewUpdateHelper(this)
}
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_lock_screen_playback_controls, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
setUpMusicControllers()

View file

@ -3,9 +3,7 @@ package io.github.muntashirakon.music.fragments.player.material
import android.animation.ObjectAnimator
import android.graphics.PorterDuff
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.animation.LinearInterpolator
import android.widget.SeekBar
import code.name.monkey.appthemehelper.util.ATHUtil
@ -19,7 +17,6 @@ import io.github.muntashirakon.music.helper.PlayPauseButtonOnClickHandler
import io.github.muntashirakon.music.misc.SimpleOnSeekbarChangeListener
import io.github.muntashirakon.music.service.MusicService
import io.github.muntashirakon.music.util.MusicUtil
import io.github.muntashirakon.music.util.PreferenceUtil
import io.github.muntashirakon.music.util.color.MediaNotificationProcessor
import kotlinx.android.synthetic.main.fragment_material_playback_controls.*
@ -27,7 +24,8 @@ import kotlinx.android.synthetic.main.fragment_material_playback_controls.*
/**
* @author Hemanth S (h4h13).
*/
class MaterialControlsFragment : AbsPlayerControlsFragment() {
class MaterialControlsFragment :
AbsPlayerControlsFragment(R.layout.fragment_material_playback_controls) {
private var lastPlaybackControlsColor: Int = 0
private var lastDisabledPlaybackControlsColor: Int = 0
@ -38,13 +36,6 @@ class MaterialControlsFragment : AbsPlayerControlsFragment() {
progressViewUpdateHelper = MusicProgressViewUpdateHelper(this)
}
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_material_playback_controls, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
setUpMusicControllers()

View file

@ -1,9 +1,7 @@
package io.github.muntashirakon.music.fragments.player.material
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.widget.Toolbar
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
@ -19,7 +17,7 @@ import kotlinx.android.synthetic.main.fragment_material.*
/**
* @author Hemanth S (h4h13).
*/
class MaterialFragment : AbsPlayerFragment() {
class MaterialFragment : AbsPlayerFragment(R.layout.fragment_material) {
override fun playerToolbar(): Toolbar {
return playerToolbar
@ -52,7 +50,7 @@ class MaterialFragment : AbsPlayerFragment() {
override fun onColorChanged(color: MediaNotificationProcessor) {
playbackControlsFragment.setColor(color)
lastColor = color.backgroundColor
callbacks?.onPaletteColorChanged()
libraryViewModel.updateColor(color.backgroundColor)
ToolbarContentTintHelper.colorizeToolbar(
playerToolbar,
@ -72,13 +70,6 @@ class MaterialFragment : AbsPlayerFragment() {
toggleFavorite(MusicPlayerRemote.currentSong)
}
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_material, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
setUpSubFragments()

View file

@ -4,9 +4,7 @@ import android.animation.ArgbEvaluator
import android.animation.ValueAnimator
import android.graphics.drawable.GradientDrawable
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.widget.Toolbar
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
@ -15,7 +13,6 @@ import io.github.muntashirakon.music.fragments.base.AbsPlayerFragment
import io.github.muntashirakon.music.fragments.player.PlayerAlbumCoverFragment
import io.github.muntashirakon.music.helper.MusicPlayerRemote
import io.github.muntashirakon.music.model.Song
import io.github.muntashirakon.music.util.PreferenceUtil
import io.github.muntashirakon.music.util.ViewUtil
import io.github.muntashirakon.music.util.color.MediaNotificationProcessor
@ -23,7 +20,7 @@ import io.github.muntashirakon.music.views.DrawableGradient
import kotlinx.android.synthetic.main.fragment_player.*
class PlayerFragment : AbsPlayerFragment() {
class PlayerFragment : AbsPlayerFragment(R.layout.fragment_player) {
private var lastColor: Int = 0
override val paletteColor: Int
@ -78,7 +75,7 @@ class PlayerFragment : AbsPlayerFragment() {
override fun onColorChanged(color: MediaNotificationProcessor) {
controlsFragment.setColor(color)
lastColor = color.backgroundColor
callbacks?.onPaletteColorChanged()
libraryViewModel.updateColor(color.backgroundColor)
ToolbarContentTintHelper.colorizeToolbar(
playerToolbar,
@ -103,14 +100,6 @@ class PlayerFragment : AbsPlayerFragment() {
}
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_player, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
setUpSubFragments()

View file

@ -3,9 +3,7 @@ package io.github.muntashirakon.music.fragments.player.normal
import android.animation.ObjectAnimator
import android.graphics.PorterDuff
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.animation.DecelerateInterpolator
import android.view.animation.LinearInterpolator
import android.widget.SeekBar
@ -26,12 +24,12 @@ import io.github.muntashirakon.music.helper.PlayPauseButtonOnClickHandler
import io.github.muntashirakon.music.misc.SimpleOnSeekbarChangeListener
import io.github.muntashirakon.music.service.MusicService
import io.github.muntashirakon.music.util.MusicUtil
import io.github.muntashirakon.music.util.PreferenceUtil
import io.github.muntashirakon.music.util.color.MediaNotificationProcessor
import kotlinx.android.synthetic.main.fragment_player_playback_controls.*
class PlayerPlaybackControlsFragment : AbsPlayerControlsFragment() {
class PlayerPlaybackControlsFragment :
AbsPlayerControlsFragment(R.layout.fragment_player_playback_controls) {
private var lastPlaybackControlsColor: Int = 0
private var lastDisabledPlaybackControlsColor: Int = 0
@ -42,13 +40,6 @@ class PlayerPlaybackControlsFragment : AbsPlayerControlsFragment() {
progressViewUpdateHelper = MusicProgressViewUpdateHelper(this)
}
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_player_playback_controls, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
setUpMusicControllers()

View file

@ -18,9 +18,7 @@ import android.animation.ObjectAnimator
import android.graphics.Color
import android.graphics.PorterDuff
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.animation.LinearInterpolator
import android.widget.SeekBar
import code.name.monkey.appthemehelper.ThemeStore
@ -36,7 +34,6 @@ import io.github.muntashirakon.music.helper.PlayPauseButtonOnClickHandler
import io.github.muntashirakon.music.misc.SimpleOnSeekbarChangeListener
import io.github.muntashirakon.music.service.MusicService
import io.github.muntashirakon.music.util.MusicUtil
import io.github.muntashirakon.music.util.PreferenceUtil
import io.github.muntashirakon.music.util.color.MediaNotificationProcessor
import kotlinx.android.synthetic.main.fragment_peak_control_player.*
@ -45,7 +42,7 @@ import kotlinx.android.synthetic.main.fragment_peak_control_player.*
* Created by hemanths on 2019-10-04.
*/
class PeakPlayerControlFragment : AbsPlayerControlsFragment() {
class PeakPlayerControlFragment : AbsPlayerControlsFragment(R.layout.fragment_peak_control_player) {
private lateinit var progressViewUpdateHelper: MusicProgressViewUpdateHelper
private var lastPlaybackControlsColor: Int = 0
@ -66,14 +63,6 @@ class PeakPlayerControlFragment : AbsPlayerControlsFragment() {
progressViewUpdateHelper.stop()
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_peak_control_player, container, false)
}
override fun onViewCreated(
view: View,
savedInstanceState: Bundle?

View file

@ -15,9 +15,7 @@
package io.github.muntashirakon.music.fragments.player.peak
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.widget.Toolbar
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
@ -28,7 +26,6 @@ import io.github.muntashirakon.music.fragments.base.AbsPlayerFragment
import io.github.muntashirakon.music.fragments.player.PlayerAlbumCoverFragment
import io.github.muntashirakon.music.helper.MusicPlayerRemote
import io.github.muntashirakon.music.util.PreferenceUtil
import io.github.muntashirakon.music.util.color.MediaNotificationProcessor
import kotlinx.android.synthetic.main.fragment_peak_player.*
@ -36,19 +33,11 @@ import kotlinx.android.synthetic.main.fragment_peak_player.*
* Created by hemanths on 2019-10-03.
*/
class PeakPlayerFragment : AbsPlayerFragment() {
class PeakPlayerFragment : AbsPlayerFragment(R.layout.fragment_peak_player) {
private lateinit var controlsFragment: PeakPlayerControlFragment
private var lastColor: Int = 0
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_peak_player, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
setUpPlayerToolbar()
@ -102,7 +91,7 @@ class PeakPlayerFragment : AbsPlayerFragment() {
override fun onColorChanged(color: MediaNotificationProcessor) {
lastColor = color.primaryTextColor
callbacks?.onPaletteColorChanged()
libraryViewModel.updateColor(color.primaryTextColor)
controlsFragment.setColor(color)
}

View file

@ -3,9 +3,7 @@ package io.github.muntashirakon.music.fragments.player.plain
import android.animation.ObjectAnimator
import android.graphics.PorterDuff
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.animation.AccelerateInterpolator
import android.view.animation.DecelerateInterpolator
import android.view.animation.LinearInterpolator
@ -26,7 +24,6 @@ import io.github.muntashirakon.music.helper.PlayPauseButtonOnClickHandler
import io.github.muntashirakon.music.misc.SimpleOnSeekbarChangeListener
import io.github.muntashirakon.music.service.MusicService
import io.github.muntashirakon.music.util.MusicUtil
import io.github.muntashirakon.music.util.PreferenceUtil
import io.github.muntashirakon.music.util.color.MediaNotificationProcessor
import kotlinx.android.synthetic.main.fragment_adaptive_player_playback_controls.*
@ -43,7 +40,8 @@ import kotlinx.android.synthetic.main.fragment_plain_controls_fragment.songTotal
* @author Hemanth S (h4h13).
*/
class PlainPlaybackControlsFragment : AbsPlayerControlsFragment() {
class PlainPlaybackControlsFragment :
AbsPlayerControlsFragment(R.layout.fragment_plain_controls_fragment) {
private var lastPlaybackControlsColor: Int = 0
private var lastDisabledPlaybackControlsColor: Int = 0
@ -87,14 +85,6 @@ class PlainPlaybackControlsFragment : AbsPlayerControlsFragment() {
progressViewUpdateHelper = MusicProgressViewUpdateHelper(this)
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_plain_controls_fragment, container, false)
}
override fun onResume() {
super.onResume()

View file

@ -1,9 +1,7 @@
package io.github.muntashirakon.music.fragments.player.plain
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.widget.Toolbar
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
@ -15,7 +13,7 @@ import io.github.muntashirakon.music.model.Song
import io.github.muntashirakon.music.util.color.MediaNotificationProcessor
import kotlinx.android.synthetic.main.fragment_plain_player.*
class PlainPlayerFragment : AbsPlayerFragment() {
class PlainPlayerFragment : AbsPlayerFragment(R.layout.fragment_plain_player) {
override fun playerToolbar(): Toolbar {
return playerToolbar
}
@ -41,13 +39,6 @@ class PlainPlayerFragment : AbsPlayerFragment() {
updateSong()
}
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_plain_player, container, false)
}
private fun setUpPlayerToolbar() {
playerToolbar.apply {
inflateMenu(R.menu.menu_player)
@ -97,7 +88,7 @@ class PlainPlayerFragment : AbsPlayerFragment() {
override fun onColorChanged(color: MediaNotificationProcessor) {
plainPlaybackControlsFragment.setColor(color)
lastColor = color.primaryTextColor
callbacks!!.onPaletteColorChanged()
libraryViewModel.updateColor(color.primaryTextColor)
ToolbarContentTintHelper.colorizeToolbar(
playerToolbar,
ATHUtil.resolveColor(requireContext(), R.attr.colorControlNormal),

View file

@ -2,9 +2,7 @@ package io.github.muntashirakon.music.fragments.player.simple
import android.graphics.PorterDuff
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.animation.DecelerateInterpolator
import code.name.monkey.appthemehelper.ThemeStore
import code.name.monkey.appthemehelper.util.ATHUtil
@ -20,7 +18,6 @@ import io.github.muntashirakon.music.helper.MusicProgressViewUpdateHelper
import io.github.muntashirakon.music.helper.PlayPauseButtonOnClickHandler
import io.github.muntashirakon.music.service.MusicService
import io.github.muntashirakon.music.util.MusicUtil
import io.github.muntashirakon.music.util.PreferenceUtil
import io.github.muntashirakon.music.util.color.MediaNotificationProcessor
import kotlinx.android.synthetic.main.fragment_simple_controls_fragment.*
@ -29,7 +26,8 @@ import kotlinx.android.synthetic.main.fragment_simple_controls_fragment.*
* @author Hemanth S (h4h13).
*/
class SimplePlaybackControlsFragment : AbsPlayerControlsFragment() {
class SimplePlaybackControlsFragment :
AbsPlayerControlsFragment(R.layout.fragment_simple_controls_fragment) {
private var lastPlaybackControlsColor: Int = 0
private var lastDisabledPlaybackControlsColor: Int = 0
@ -59,14 +57,6 @@ class SimplePlaybackControlsFragment : AbsPlayerControlsFragment() {
progressViewUpdateHelper = MusicProgressViewUpdateHelper(this)
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_simple_controls_fragment, container, false)
}
override fun onResume() {
super.onResume()
progressViewUpdateHelper.start()

View file

@ -1,9 +1,7 @@
package io.github.muntashirakon.music.fragments.player.simple
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.widget.Toolbar
import code.name.monkey.appthemehelper.util.ATHUtil
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
@ -19,7 +17,7 @@ import kotlinx.android.synthetic.main.fragment_simple_player.*
* @author Hemanth S (h4h13).
*/
class SimplePlayerFragment : AbsPlayerFragment() {
class SimplePlayerFragment : AbsPlayerFragment(R.layout.fragment_simple_player) {
override fun playerToolbar(): Toolbar {
return playerToolbar
@ -31,13 +29,6 @@ class SimplePlayerFragment : AbsPlayerFragment() {
private lateinit var controlsFragment: SimplePlaybackControlsFragment
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_simple_player, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
@ -71,7 +62,7 @@ class SimplePlayerFragment : AbsPlayerFragment() {
override fun onColorChanged(color: MediaNotificationProcessor) {
lastColor = color.backgroundColor
callbacks?.onPaletteColorChanged()
libraryViewModel.updateColor(color.backgroundColor)
controlsFragment.setColor(color)
ToolbarContentTintHelper.colorizeToolbar(
playerToolbar,

View file

@ -2,9 +2,7 @@ package io.github.muntashirakon.music.fragments.player.tiny
import android.graphics.PorterDuff
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import code.name.monkey.appthemehelper.util.ColorUtil
import io.github.muntashirakon.music.R
import io.github.muntashirakon.music.fragments.base.AbsPlayerControlsFragment
@ -13,7 +11,8 @@ import io.github.muntashirakon.music.service.MusicService
import io.github.muntashirakon.music.util.color.MediaNotificationProcessor
import kotlinx.android.synthetic.main.fragment_tiny_controls_fragment.*
class TinyPlaybackControlsFragment : AbsPlayerControlsFragment() {
class TinyPlaybackControlsFragment :
AbsPlayerControlsFragment(R.layout.fragment_tiny_controls_fragment) {
override fun show() {
}
@ -38,13 +37,6 @@ class TinyPlaybackControlsFragment : AbsPlayerControlsFragment() {
private var lastPlaybackControlsColor: Int = 0
private var lastDisabledPlaybackControlsColor: Int = 0
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_tiny_controls_fragment, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

View file

@ -4,9 +4,7 @@ import android.animation.AnimatorSet
import android.animation.ObjectAnimator
import android.os.Bundle
import android.os.Handler
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.animation.LinearInterpolator
import androidx.appcompat.widget.Toolbar
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper
@ -22,12 +20,12 @@ import io.github.muntashirakon.music.helper.PlayPauseButtonOnClickHandler
import io.github.muntashirakon.music.model.Song
import io.github.muntashirakon.music.util.MusicUtil
import io.github.muntashirakon.music.util.PreferenceUtil
import io.github.muntashirakon.music.util.ViewUtil
import io.github.muntashirakon.music.util.color.MediaNotificationProcessor
import kotlinx.android.synthetic.main.fragment_tiny_player.*
class TinyPlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Callback {
class TinyPlayerFragment : AbsPlayerFragment(R.layout.fragment_tiny_player),
MusicProgressViewUpdateHelper.Callback {
private var lastColor: Int = 0
private var toolbarColor: Int = 0
@ -57,9 +55,9 @@ class TinyPlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Ca
override fun onColorChanged(color: MediaNotificationProcessor) {
lastColor = color.backgroundColor
libraryViewModel.updateColor(color.backgroundColor)
toolbarColor = color.secondaryTextColor
controlsFragment.setColor(color)
callbacks?.onPaletteColorChanged()
title.setTextColor(color.primaryTextColor)
playerSongTotalTime.setTextColor(color.primaryTextColor)
@ -111,13 +109,6 @@ class TinyPlayerFragment : AbsPlayerFragment(), MusicProgressViewUpdateHelper.Ca
}
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_tiny_player, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

View file

@ -8,30 +8,28 @@ import androidx.lifecycle.Observer
import androidx.recyclerview.widget.GridLayoutManager
import io.github.muntashirakon.music.R
import io.github.muntashirakon.music.adapter.playlist.PlaylistAdapter
import io.github.muntashirakon.music.fragments.base.AbsLibraryPagerRecyclerViewFragment
import io.github.muntashirakon.music.fragments.base.AbsRecyclerViewFragment
import io.github.muntashirakon.music.interfaces.MainActivityFragmentCallbacks
class PlaylistsFragment :
AbsLibraryPagerRecyclerViewFragment<PlaylistAdapter, GridLayoutManager>(),
AbsRecyclerViewFragment<PlaylistAdapter, GridLayoutManager>() ,
MainActivityFragmentCallbacks {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
mainActivity.libraryViewModel.allPlaylisits()
.observe(viewLifecycleOwner, Observer { playlists ->
if (playlists.isNotEmpty()) {
adapter?.swapDataSet(playlists)
} else {
adapter?.swapDataSet(listOf())
}
})
}
override fun handleBackPress(): Boolean {
return false
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
libraryViewModel.playlisitsLiveData.observe(viewLifecycleOwner, Observer { playlists ->
if (playlists.isNotEmpty()) {
adapter?.swapDataSet(playlists)
} else {
adapter?.swapDataSet(listOf())
}
})
}
override val emptyMessage: Int
get() = R.string.no_playlists

View file

@ -20,7 +20,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import io.github.muntashirakon.music.R
import io.github.muntashirakon.music.adapter.song.PlayingQueueAdapter
import io.github.muntashirakon.music.fragments.base.AbsLibraryPagerRecyclerViewFragment
import io.github.muntashirakon.music.fragments.base.AbsRecyclerViewFragment
import io.github.muntashirakon.music.helper.MusicPlayerRemote
import io.github.muntashirakon.music.interfaces.MainActivityFragmentCallbacks
import com.h6ah4i.android.widget.advrecyclerview.animator.DraggableItemAnimator
@ -34,7 +34,7 @@ import kotlinx.android.synthetic.main.activity_playing_queue.*
* Created by hemanths on 2019-12-08.
*/
class PlayingQueueFragment :
AbsLibraryPagerRecyclerViewFragment<PlayingQueueAdapter, LinearLayoutManager>(),
AbsRecyclerViewFragment<PlayingQueueAdapter, LinearLayoutManager>(),
MainActivityFragmentCallbacks {
override fun handleBackPress(): Boolean {

View file

@ -22,8 +22,6 @@ import androidx.preference.ListPreference
import androidx.preference.Preference
import androidx.preference.PreferenceManager
import code.name.monkey.appthemehelper.common.prefs.supportv7.ATEPreferenceFragmentCompat
import code.name.monkey.appthemehelper.util.ATHUtil
import io.github.muntashirakon.music.R
import io.github.muntashirakon.music.preferences.*
/**
@ -57,7 +55,7 @@ abstract class AbsSettingsFragment : ATEPreferenceFragmentCompat() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
setDivider(ColorDrawable(Color.TRANSPARENT))
listView.setBackgroundColor(ATHUtil.resolveColor(requireContext(), R.attr.colorSurface))
//listView.setBackgroundColor(ATHUtil.resolveColor(requireContext(), R.attr.colorSurface))
listView.overScrollMode = View.OVER_SCROLL_NEVER
listView.setPadding(0, 0, 0, 0)
listView.setPaddingRelative(0, 0, 0, 0)

View file

@ -14,12 +14,14 @@
package io.github.muntashirakon.music.fragments.settings
import android.content.res.ColorStateList
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.annotation.StringRes
import androidx.fragment.app.Fragment
import androidx.navigation.fragment.findNavController
import io.github.muntashirakon.music.R
import io.github.muntashirakon.music.activities.SettingsActivity
import io.github.muntashirakon.music.util.NavigationUtil
@ -28,29 +30,14 @@ import kotlinx.android.synthetic.main.fragment_main_settings.*
class MainSettingsFragment : Fragment(), View.OnClickListener {
override fun onClick(view: View) {
when (view.id) {
R.id.generalSettings -> inflateFragment(
ThemeSettingsFragment(),
R.string.general_settings_title
)
R.id.audioSettings -> inflateFragment(AudioSettings(), R.string.pref_header_audio)
R.id.nowPlayingSettings -> inflateFragment(
NowPlayingSettingsFragment(),
R.string.now_playing
)
R.id.personalizeSettings -> inflateFragment(
PersonalizeSettingsFragment(),
R.string.personalize
)
R.id.imageSettings -> inflateFragment(
ImageSettingFragment(),
R.string.pref_header_images
)
R.id.notificationSettings -> inflateFragment(
NotificationSettingsFragment(),
R.string.notification
)
R.id.otherSettings -> inflateFragment(OtherSettingsFragment(), R.string.others)
R.id.aboutSettings -> NavigationUtil.goToAbout(requireActivity())
R.id.generalSettings -> findNavController().navigate(R.id.action_mainSettingsFragment_to_themeSettingsFragment)
R.id.audioSettings -> findNavController().navigate(R.id.action_mainSettingsFragment_to_audioSettings)
R.id.personalizeSettings -> findNavController().navigate(R.id.action_mainSettingsFragment_to_personalizeSettingsFragment)
R.id.imageSettings -> findNavController().navigate(R.id.action_mainSettingsFragment_to_imageSettingFragment)
R.id.notificationSettings -> findNavController().navigate(R.id.action_mainSettingsFragment_to_notificationSettingsFragment)
R.id.otherSettings -> findNavController().navigate(R.id.action_mainSettingsFragment_to_otherSettingsFragment)
R.id.aboutSettings -> findNavController().navigate(R.id.action_mainSettingsFragment_to_aboutActivity)
R.id.nowPlayingSettings -> findNavController().navigate(R.id.action_mainSettingsFragment_to_nowPlayingSettingsFragment)
}
}

View file

@ -1,30 +1,35 @@
package io.github.muntashirakon.music.fragments.songs
import android.os.Bundle
import android.view.View
import android.view.*
import androidx.annotation.LayoutRes
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.GridLayoutManager
import io.github.muntashirakon.music.R
import io.github.muntashirakon.music.adapter.song.ShuffleButtonSongAdapter
import io.github.muntashirakon.music.adapter.song.SongAdapter
import io.github.muntashirakon.music.fragments.ReloadType
import io.github.muntashirakon.music.fragments.base.AbsLibraryPagerRecyclerViewCustomGridSizeFragment
import io.github.muntashirakon.music.fragments.base.AbsRecyclerViewCustomGridSizeFragment
import io.github.muntashirakon.music.interfaces.MainActivityFragmentCallbacks
import io.github.muntashirakon.music.util.PreferenceUtil
class SongsFragment :
AbsLibraryPagerRecyclerViewCustomGridSizeFragment<SongAdapter, GridLayoutManager>(),
AbsRecyclerViewCustomGridSizeFragment<SongAdapter, GridLayoutManager>(),
MainActivityFragmentCallbacks {
override fun handleBackPress(): Boolean {
return false
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
mainActivity.libraryViewModel.allSongs()
.observe(viewLifecycleOwner, androidx.lifecycle.Observer {
if (it.isNotEmpty()) {
adapter?.swapDataSet(it)
} else {
adapter?.swapDataSet(listOf())
}
})
libraryViewModel.songsLiveData.observe(viewLifecycleOwner, Observer {
if (it.isNotEmpty()) {
adapter?.swapDataSet(it)
} else {
adapter?.swapDataSet(listOf())
}
})
}
override val emptyMessage: Int
@ -92,7 +97,7 @@ class SongsFragment :
}
override fun setSortOrder(sortOrder: String) {
mainActivity.libraryViewModel.forceReload(ReloadType.Songs)
libraryViewModel.forceReload(ReloadType.Songs)
}
companion object {
@ -105,8 +110,71 @@ class SongsFragment :
}
}
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
super.onCreateOptionsMenu(menu, inflater)
setUpGridSizeMenu(menu.findItem(R.id.action_grid_size).subMenu)
}
override fun handleBackPress(): Boolean {
private fun setUpGridSizeMenu(
gridSizeMenu: SubMenu
) {
println(getGridSize())
when (getGridSize()) {
1 -> gridSizeMenu.findItem(R.id.action_grid_size_1).isChecked = true
2 -> gridSizeMenu.findItem(R.id.action_grid_size_2).isChecked = true
3 -> gridSizeMenu.findItem(R.id.action_grid_size_3).isChecked = true
4 -> gridSizeMenu.findItem(R.id.action_grid_size_4).isChecked = true
5 -> gridSizeMenu.findItem(R.id.action_grid_size_5).isChecked = true
6 -> gridSizeMenu.findItem(R.id.action_grid_size_6).isChecked = true
7 -> gridSizeMenu.findItem(R.id.action_grid_size_7).isChecked = true
8 -> gridSizeMenu.findItem(R.id.action_grid_size_8).isChecked = true
}
val maxGridSize = maxGridSize
if (maxGridSize < 8) {
gridSizeMenu.findItem(R.id.action_grid_size_8).isVisible = false
}
if (maxGridSize < 7) {
gridSizeMenu.findItem(R.id.action_grid_size_7).isVisible = false
}
if (maxGridSize < 6) {
gridSizeMenu.findItem(R.id.action_grid_size_6).isVisible = false
}
if (maxGridSize < 5) {
gridSizeMenu.findItem(R.id.action_grid_size_5).isVisible = false
}
if (maxGridSize < 4) {
gridSizeMenu.findItem(R.id.action_grid_size_4).isVisible = false
}
if (maxGridSize < 3) {
gridSizeMenu.findItem(R.id.action_grid_size_3).isVisible = false
}
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
if (handleGridSizeMenuItem(item)) return true
return super.onOptionsItemSelected(item)
}
fun handleGridSizeMenuItem(
item: MenuItem
): Boolean {
var gridSize = 0
when (item.itemId) {
R.id.action_grid_size_1 -> gridSize = 1
R.id.action_grid_size_2 -> gridSize = 2
R.id.action_grid_size_3 -> gridSize = 3
R.id.action_grid_size_4 -> gridSize = 4
R.id.action_grid_size_5 -> gridSize = 5
R.id.action_grid_size_6 -> gridSize = 6
R.id.action_grid_size_7 -> gridSize = 7
R.id.action_grid_size_8 -> gridSize = 8
}
if (gridSize > 0) {
item.isChecked = true
setAndSaveGridSize(gridSize)
return true
}
return false
}
}

View file

@ -11,14 +11,11 @@
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*/
package io.github.muntashirakon.music.interfaces
/**
* Created by hemanths on 14/08/17.
*/
interface MainActivityFragmentCallbacks {
internal interface MainActivityFragmentCallbacks {
fun handleBackPress(): Boolean
}

View file

@ -24,6 +24,7 @@ import androidx.core.text.HtmlCompat
import androidx.fragment.app.DialogFragment
import androidx.fragment.app.FragmentActivity
import code.name.monkey.appthemehelper.common.prefs.supportv7.ATEDialogPreference
import io.github.muntashirakon.music.App
import io.github.muntashirakon.music.R
import io.github.muntashirakon.music.dialogs.BlacklistFolderChooserDialog
import io.github.muntashirakon.music.extensions.colorButtons
@ -101,12 +102,14 @@ class BlacklistPreferenceDialog : DialogFragment(), BlacklistFolderChooserDialog
)
)
.setPositiveButton(R.string.remove_action) { _, _ ->
BlacklistStore.getInstance(mContext!!)
BlacklistStore.getInstance(App.getContext())
.removePath(File(paths[which]))
refreshBlacklistData()
}
.setNegativeButton(android.R.string.cancel, null)
.show().colorButtons()
.create()
.colorButtons()
.show()
}
.create().colorButtons()
}
@ -114,13 +117,13 @@ class BlacklistPreferenceDialog : DialogFragment(), BlacklistFolderChooserDialog
private lateinit var paths: ArrayList<String>
private fun refreshBlacklistData() {
this.paths = BlacklistStore.getInstance(mContext!!).paths
this.paths = BlacklistStore.getInstance(App.getContext()).paths
val dialog = dialog as MaterialAlertDialogBuilder?
dialog?.setItems(paths.toTypedArray(), null)
}
override fun onFolderSelection(dialog: BlacklistFolderChooserDialog, folder: File) {
BlacklistStore.getInstance(mContext!!).addPath(folder)
BlacklistStore.getInstance(App.getContext()).addPath(folder)
refreshBlacklistData()
}
}

View file

@ -1,11 +0,0 @@
package io.github.muntashirakon.music.providers
import org.eclipse.egit.github.core.Repository
import org.koin.dsl.bind
import org.koin.dsl.module
val provideModules = module {
single {
RepositoryImpl(get(), get())
} bind Repository::class
}

View file

@ -32,19 +32,19 @@ class RepositoryImpl(
override suspend fun allAlbums(): List<Album> = AlbumLoader.getAllAlbums(context)
override suspend fun albumById(albumId: Int): Album = AlbumLoader.getAlbum(context, albumId)
override suspend fun allArtists(): List<Artist> = ArtistLoader.getAllArtists(context)
override suspend fun artistById(artistId: Int): Artist =
ArtistLoader.getArtist(context, artistId)
override suspend fun allPlaylists(): List<Playlist> = PlaylistLoader.getAllPlaylists(context)
override suspend fun allGenres(): List<Genre> = GenreLoader.getAllGenres(context)
override suspend fun allSongs(): List<Song> = SongLoader.getAllSongs(context)
override suspend fun albumById(albumId: Int): Album = AlbumLoader.getAlbum(context, albumId)
override suspend fun artistById(artistId: Int): Artist =
ArtistLoader.getArtist(context, artistId)
override suspend fun suggestions(): Home? {
val songs = NotRecentlyPlayedPlaylist(context).getSongs(context).shuffled().apply {
if (size > 9) subList(0, 9)
@ -59,6 +59,22 @@ class RepositoryImpl(
return null
}
override suspend fun homeGenres(): Home? {
val genres =
GenreLoader.getAllGenres(context)
.shuffled()
.filter { it.name.length in 5..10 }
if (genres.isNotEmpty()) {
return Home(
genres,
HomeAdapter.GENRES,
R.drawable.ic_guitar
)
}
return null
}
override suspend fun search(query: String?): MutableList<Any> =
SearchLoader.searchAll(context, query)

View file

@ -58,4 +58,6 @@ interface Repository {
suspend fun favoritePlaylist(): Home?
suspend fun suggestions(): Home?
suspend fun homeGenres(): Home?
}

View file

@ -170,6 +170,7 @@ public class MusicService extends Service implements
private AppWidgetSmall appWidgetSmall = AppWidgetSmall.Companion.getInstance();
private AppWidgetText appWidgetText = AppWidgetText.Companion.getInstance();
private final BroadcastReceiver widgetIntentReceiver = new BroadcastReceiver() {
@Override
public void onReceive(final Context context, final Intent intent) {

View file

@ -8,12 +8,12 @@ import androidx.core.content.ContextCompat
import androidx.core.content.edit
import androidx.preference.PreferenceManager
import androidx.viewpager.widget.ViewPager
import io.github.muntashirakon.music.R
import io.github.muntashirakon.music.*
import io.github.muntashirakon.music.extensions.getIntRes
import io.github.muntashirakon.music.extensions.getStringOrDefault
import io.github.muntashirakon.music.fragments.AlbumCoverStyle
import io.github.muntashirakon.music.fragments.NowPlayingScreen
import io.github.muntashirakon.music.fragments.mainactivity.FoldersFragment
import io.github.muntashirakon.music.fragments.folder.FoldersFragment
import io.github.muntashirakon.music.helper.SortOrder.*
import io.github.muntashirakon.music.model.CategoryInfo
import io.github.muntashirakon.music.transform.*
@ -22,7 +22,6 @@ import com.google.android.material.bottomnavigation.LabelVisibilityMode
import com.google.gson.Gson
import com.google.gson.JsonSyntaxException
import com.google.gson.reflect.TypeToken
import io.github.muntashirakon.music.*
import java.io.File
@ -64,16 +63,14 @@ object PreferenceUtil {
}
fun registerOnSharedPreferenceChangedListener(
changeListener: OnSharedPreferenceChangeListener
) {
sharedPreferences.registerOnSharedPreferenceChangeListener(changeListener)
}
listener: OnSharedPreferenceChangeListener
) = sharedPreferences.registerOnSharedPreferenceChangeListener(listener)
fun unregisterOnSharedPreferenceChangedListener(
changeListener: OnSharedPreferenceChangeListener
) {
sharedPreferences.unregisterOnSharedPreferenceChangeListener(changeListener)
}
) = sharedPreferences.unregisterOnSharedPreferenceChangeListener(changeListener)
val baseTheme get() = sharedPreferences.getStringOrDefault(GENERAL_THEME, "auto")

View file

@ -46,7 +46,7 @@ class ListItemView : FrameLayout {
}
private fun init(context: Context, attrs: AttributeSet?) {
View.inflate(context, R.layout.list_item_view, this)
View.inflate(context, R.layout.list_item_view_no_card, this)
val typedArray = context.obtainStyledAttributes(attrs, R.styleable.ListItemView)
if (typedArray.hasValue(R.styleable.ListItemView_listItemIcon)) {

View file

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?><!--
Copyright 2019 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false">
<alpha
android:fromAlpha="0"
android:toAlpha="1.0"
android:fillEnabled="true"
android:fillBefore="true"
android:fillAfter="true"
android:interpolator="@android:anim/linear_interpolator"
android:startOffset="66"
android:duration="50" />
<scale
android:fromXScale="1.1"
android:toXScale="1"
android:fromYScale="1.1"
android:toYScale="1"
android:pivotX="50%"
android:pivotY="50%"
android:fillEnabled="true"
android:fillBefore="true"
android:fillAfter="true"
android:interpolator="@anim/retro_fragment_fast_out_extra_slow_in"
android:duration="300" />
</set>

View file

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?><!--
Copyright 2019 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false"
android:zAdjustment="top">
<alpha
android:fromAlpha="1"
android:toAlpha="0.0"
android:fillEnabled="true"
android:fillBefore="true"
android:fillAfter="true"
android:interpolator="@android:anim/linear_interpolator"
android:startOffset="66"
android:duration="50" />
<scale
android:fromXScale="1"
android:toXScale="0.9"
android:fromYScale="1"
android:toYScale="0.9"
android:pivotX="50%"
android:pivotY="50%"
android:fillEnabled="true"
android:fillBefore="true"
android:fillAfter="true"
android:interpolator="@anim/retro_fragment_fast_out_extra_slow_in"
android:duration="300" />
</set>

View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?><!--
Copyright 2019 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/linear_interpolator"
android:fromAlpha="0.0"
android:toAlpha="1.0"
android:duration="150" />

View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?><!--
Copyright 2019 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/linear_interpolator"
android:fromAlpha="1.0"
android:toAlpha="0.0"
android:duration="150" />

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?><!--
Copyright 2019 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!--Taken from https://googleplex-android.googlesource.com/platform/frameworks/base/+/HEAD/core/res/res/interpolator/decelerate_quad.xml-->
<decelerateInterpolator />

View file

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?><!--
Copyright 2019 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<set xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:shareInterpolator="false">
<alpha
android:duration="50"
android:fillAfter="true"
android:fillBefore="true"
android:fillEnabled="true"
android:fromAlpha="0"
android:interpolator="@android:anim/linear_interpolator"
android:startOffset="35"
android:toAlpha="1.0" />
<scale
android:duration="300"
android:fillAfter="true"
android:fillBefore="true"
android:fillEnabled="true"
android:fromXScale="0.85"
android:fromYScale="0.85"
android:interpolator="@anim/retro_fragment_fast_out_extra_slow_in"
android:pivotX="50%"
android:pivotY="50%"
android:toXScale="1"
android:toYScale="1"
tools:targetApi="lollipop" />
</set>

View file

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?><!--
Copyright 2019 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false">
<!-- Fade out, over a black surface, which simulates a black scrim -->
<alpha
android:fromAlpha="1"
android:toAlpha="0.0"
android:fillEnabled="true"
android:fillBefore="true"
android:fillAfter="true"
android:interpolator="@android:anim/linear_interpolator"
android:startOffset="35"
android:duration="50" />
<scale
android:fromXScale="1"
android:toXScale="1.15"
android:fromYScale="1"
android:toYScale="1.15"
android:pivotX="50%"
android:pivotY="50%"
android:fillEnabled="true"
android:fillBefore="true"
android:fillAfter="true"
android:interpolator="@anim/retro_fragment_fast_out_extra_slow_in"
android:duration="300" />
</set>

View file

@ -1,5 +1,4 @@
<animated-vector
xmlns:android="http://schemas.android.com/apk/res/android"
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt">
<aapt:attr name="android:drawable">
<vector
@ -12,7 +11,7 @@
android:name="path"
android:pathData="M 12 2 C 6.48 2 2 6.48 2 12 C 2 17.52 6.48 22 12 22 C 17.52 22 22 17.52 22 12 C 22 6.48 17.52 2 12 2 Z M 12 16.5 C 9.51 16.5 7.5 14.49 7.5 12 C 7.5 9.51 9.51 7.5 12 7.5 C 14.49 7.5 16.5 9.51 16.5 12 C 16.5 14.49 14.49 16.5 12 16.5 Z M 12 11 C 11.45 11 11 11.45 11 12 C 11 12.55 11.45 13 12 13 C 12.55 13 13 12.55 13 12 C 13 11.45 12.55 11 12 11 Z"
android:fillColor="#000"
android:strokeWidth="1"/>
android:strokeWidth="1" />
</vector>
</aapt:attr>
<target android:name="path">
@ -24,7 +23,7 @@
android:valueFrom="M 12 2 C 6.48 2 2 6.48 2 12 C 2 17.52 6.48 22 12 22 C 17.52 22 22 17.52 22 12 C 22 6.48 17.52 2 12 2 Z M 12 16.5 C 9.51 16.5 7.5 14.49 7.5 12 C 7.5 9.51 9.51 7.5 12 7.5 C 14.49 7.5 16.5 9.51 16.5 12 C 16.5 14.49 14.49 16.5 12 16.5 Z M 12 11 C 11.45 11 11 11.45 11 12 C 11 12.55 11.45 13 12 13 C 12.55 13 13 12.55 13 12 C 13 11.45 12.55 11 12 11 Z M 12 12 C 12 12 12 12 12 12 C 12 12 12 12 12 12 C 12 12 12 12 12 12 C 12 12 12 12 12 12 L 12 12"
android:valueTo="M 12 2 C 6.48 2 2 6.48 2 12 C 2 17.52 6.48 22 12 22 C 17.52 22 22 17.52 22 12 C 22 6.48 17.52 2 12 2 Z M 12 20 C 7.59 20 4 16.41 4 12 C 4 7.59 7.59 4 12 4 C 16.41 4 20 7.59 20 12 C 20 16.41 16.41 20 12 20 Z M 12 7.5 C 9.51 7.5 7.5 9.51 7.5 12 C 7.5 14.49 9.51 16.5 12 16.5 C 14.49 16.5 16.5 14.49 16.5 12 C 16.5 9.51 14.49 7.5 12 7.5 Z M 12 13 C 11.45 13 11 12.55 11 12 C 11 11.45 11.45 11 12 11 C 12.55 11 13 11.45 13 12 C 13 12.55 12.55 13 12 13 L 12 13"
android:valueType="pathType"
android:interpolator="@android:interpolator/fast_out_slow_in"/>
android:interpolator="@android:interpolator/fast_out_slow_in" />
<objectAnimator
android:propertyName="pathData"
android:startOffset="200"
@ -32,7 +31,7 @@
android:valueFrom="M 12 2 C 6.48 2 2 6.48 2 12 C 2 17.52 6.48 22 12 22 C 17.52 22 22 17.52 22 12 C 22 6.48 17.52 2 12 2 Z M 12 20 C 7.59 20 4 16.41 4 12 C 4 7.59 7.59 4 12 4 C 16.41 4 20 7.59 20 12 C 20 16.41 16.41 20 12 20 Z M 12 7.5 C 9.51 7.5 7.5 9.51 7.5 12 C 7.5 14.49 9.51 16.5 12 16.5 C 14.49 16.5 16.5 14.49 16.5 12 C 16.5 9.51 14.49 7.5 12 7.5 Z M 12 13 C 12.55 13 13 12.55 13 12 C 13 11.45 12.55 11 12 11 C 11.45 11 11 11.45 11 12 C 11 12.55 11.45 13 12 13 L 12 13"
android:valueTo="M 12 2 C 6.48 2 2 6.48 2 12 C 2 17.52 6.48 22 12 22 C 17.52 22 22 17.52 22 12 C 22 6.48 17.52 2 12 2 Z M 12 16.5 C 9.51 16.5 7.5 14.49 7.5 12 C 7.5 9.51 9.51 7.5 12 7.5 C 14.49 7.5 16.5 9.51 16.5 12 C 16.5 14.49 14.49 16.5 12 16.5 Z M 12 11 C 11.45 11 11 11.45 11 12 C 11 12.55 11.45 13 12 13 C 12.55 13 13 12.55 13 12 C 13 11.45 12.55 11 12 11 Z M 12 12 C 12 12 12 12 12 12 C 12 12 12 12 12 12 C 12 12 12 12 12 12 C 12 12 12 12 12 12 L 12 12"
android:valueType="pathType"
android:interpolator="@android:interpolator/fast_out_slow_in"/>
android:interpolator="@android:interpolator/fast_out_slow_in" />
</set>
</aapt:attr>
</target>

View file

@ -1,5 +1,4 @@
<animated-vector
xmlns:android="http://schemas.android.com/apk/res/android"
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt">
<aapt:attr name="android:drawable">
<vector
@ -13,7 +12,7 @@
android:name="home_data"
android:pathData="M 10 19 L 10 14 L 14 14 L 14 19 C 14 19.55 14.45 20 15 20 L 18 20 C 18.55 20 19 19.55 19 19 L 19 12 L 20.7 12 C 21.16 12 21.38 11.43 21.03 11.13 L 12.67 3.6 C 12.29 3.26 11.71 3.26 11.33 3.6 L 2.97 11.13 C 2.63 11.43 2.84 12 3.3 12 L 5 12 L 5 19 C 5 19.55 5.45 20 6 20 L 9 20 C 9.55 20 10 19.55 10 19 Z"
android:fillColor="#000"
android:strokeWidth="1"/>
android:strokeWidth="1" />
</group>
<group
android:name="sun"
@ -25,7 +24,7 @@
android:name="sun_data"
android:pathData="M 12 2 C 6.48 2 2 6.48 2 12 C 2 17.52 6.48 22 12 22 C 17.52 22 22 17.52 22 12 C 22 6.48 17.52 2 12 2 Z"
android:fillColor="#000"
android:strokeWidth="1"/>
android:strokeWidth="1" />
</group>
<group
android:name="cloud"
@ -36,7 +35,7 @@
android:name="path"
android:pathData="M 19.37 10.04 C 18.68 6.59 15.65 4 12.01 4 C 9.12 4 6.61 5.64 5.36 8.04 C 2.35 8.36 0.01 10.91 0.01 14 C 0.01 17.31 2.7 20 6.01 20 L 19.01 20 C 21.77 20 24.01 17.76 24.01 15 C 24.01 12.36 21.96 10.22 19.37 10.04 Z"
android:fillColor="#000"
android:strokeWidth="1"/>
android:strokeWidth="1" />
</group>
<group
android:name="cloud_1"
@ -47,7 +46,7 @@
<path
android:name="cloud_2"
android:pathData="M 19.37 10.04 C 18.68 6.59 15.65 4 12.01 4 C 9.12 4 6.61 5.64 5.36 8.04 C 2.35 8.36 0.01 10.91 0.01 14 C 0.01 17.31 2.7 20 6.01 20 L 19.01 20 C 21.77 20 24.01 17.76 24.01 15 C 24.01 12.36 21.96 10.22 19.37 10.04 Z"
android:fillColor="#000000"/>
android:fillColor="#000000" />
</group>
</vector>
</aapt:attr>
@ -60,14 +59,14 @@
android:valueFrom="-5"
android:valueTo="16"
android:valueType="floatType"
android:interpolator="@android:interpolator/fast_out_slow_in"/>
android:interpolator="@android:interpolator/fast_out_slow_in" />
<objectAnimator
android:propertyName="translateY"
android:duration="400"
android:valueFrom="10"
android:valueTo="1"
android:valueType="floatType"
android:interpolator="@android:interpolator/fast_out_slow_in"/>
android:interpolator="@android:interpolator/fast_out_slow_in" />
</set>
</aapt:attr>
</target>
@ -79,7 +78,7 @@
android:valueFrom="1"
android:valueTo="24"
android:valueType="floatType"
android:interpolator="@android:interpolator/fast_out_slow_in"/>
android:interpolator="@android:interpolator/fast_out_slow_in" />
</aapt:attr>
</target>
<target android:name="cloud_1">
@ -90,7 +89,7 @@
android:valueFrom="0"
android:valueTo="12"
android:valueType="floatType"
android:interpolator="@android:interpolator/fast_out_slow_in"/>
android:interpolator="@android:interpolator/fast_out_slow_in" />
</aapt:attr>
</target>
</animated-vector>

View file

@ -1,5 +1,4 @@
<animated-vector
xmlns:android="http://schemas.android.com/apk/res/android"
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt">
<aapt:attr name="android:drawable">
<vector
@ -13,7 +12,7 @@
android:name="note_1"
android:pathData="M 12 5 L 12 13.55 C 11.06 13.01 9.9 12.8 8.67 13.23 C 7.33 13.71 6.3 14.9 6.06 16.3 C 5.6 19.04 7.92 21.38 10.65 20.95 C 12.61 20.64 14 18.84 14 16.85 L 14 7 L 16 7 C 17.1 7 18 6.1 18 5 C 18 3.9 17.1 3 16 3 L 14 3 C 12.9 3 12 3.9 12 5 Z"
android:fillColor="#000"
android:strokeWidth="1"/>
android:strokeWidth="1" />
</group>
<group
android:name="group_2"
@ -24,7 +23,7 @@
<path
android:name="note_2"
android:pathData="M 12 5 L 12 13.55 C 11.06 13.01 9.9 12.8 8.67 13.23 C 7.33 13.71 6.3 14.9 6.06 16.3 C 5.6 19.04 7.92 21.38 10.65 20.95 C 12.61 20.64 14 18.84 14 16.85 L 14 7 L 16 7 C 17.1 7 18 6.1 18 5 C 18 3.9 17.1 3 16 3 L 14 3 C 12.9 3 12 3.9 12 5 Z"
android:fillColor="#000000"/>
android:fillColor="#000000" />
</group>
<group
android:name="group_3"
@ -35,7 +34,7 @@
<path
android:name="path"
android:pathData="M 12 5 L 12 13.55 C 11.06 13.01 9.9 12.8 8.67 13.23 C 7.33 13.71 6.3 14.9 6.06 16.3 C 5.6 19.04 7.92 21.38 10.65 20.95 C 12.61 20.64 14 18.84 14 16.85 L 14 7 L 16 7 C 17.1 7 18 6.1 18 5 C 18 3.9 17.1 3 16 3 L 14 3 C 12.9 3 12 3.9 12 5 Z"
android:fillColor="#000000"/>
android:fillColor="#000000" />
</group>
</vector>
</aapt:attr>
@ -48,7 +47,7 @@
android:valueFrom="-3"
android:valueTo="3"
android:valueType="floatType"
android:interpolator="@android:interpolator/fast_out_slow_in"/>
android:interpolator="@android:interpolator/fast_out_slow_in" />
<objectAnimator
android:propertyName="translateY"
android:startOffset="125"
@ -56,7 +55,7 @@
android:valueFrom="-1"
android:valueTo="-2"
android:valueType="floatType"
android:interpolator="@android:interpolator/fast_out_slow_in"/>
android:interpolator="@android:interpolator/fast_out_slow_in" />
<objectAnimator
android:propertyName="translateY"
android:startOffset="225"
@ -64,7 +63,7 @@
android:valueFrom="-1"
android:valueTo="0"
android:valueType="floatType"
android:interpolator="@android:interpolator/fast_out_slow_in"/>
android:interpolator="@android:interpolator/fast_out_slow_in" />
</set>
</aapt:attr>
</target>
@ -76,7 +75,7 @@
android:valueFrom="13"
android:valueTo="-11"
android:valueType="floatType"
android:interpolator="@android:interpolator/fast_out_slow_in"/>
android:interpolator="@android:interpolator/fast_out_slow_in" />
</aapt:attr>
</target>
<target android:name="group_3">
@ -87,7 +86,7 @@
android:valueFrom="-1"
android:valueTo="15"
android:valueType="floatType"
android:interpolator="@android:interpolator/fast_out_slow_in"/>
android:interpolator="@android:interpolator/fast_out_slow_in" />
</aapt:attr>
</target>
<target android:name="note_2">
@ -98,7 +97,7 @@
android:valueFrom="1"
android:valueTo="0"
android:valueType="floatType"
android:interpolator="@android:interpolator/fast_out_slow_in"/>
android:interpolator="@android:interpolator/fast_out_slow_in" />
</aapt:attr>
</target>
<target android:name="path">
@ -109,7 +108,7 @@
android:valueFrom="1"
android:valueTo="0"
android:valueType="floatType"
android:interpolator="@android:interpolator/fast_out_slow_in"/>
android:interpolator="@android:interpolator/fast_out_slow_in" />
</aapt:attr>
</target>
</animated-vector>

View file

@ -1,5 +1,10 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M13,3c-4.97,0 -9,4.03 -9,9L1,12l3.89,3.89 0.07,0.14L9,12L6,12c0,-3.87 3.13,-7 7,-7s7,3.13 7,7 -3.13,7 -7,7c-1.93,0 -3.68,-0.79 -4.94,-2.06l-1.42,1.42C8.27,19.99 10.51,21 13,21c4.97,0 9,-4.03 9,-9s-4.03,-9 -9,-9zM12,8v5l4.28,2.54 0.72,-1.21 -3.5,-2.08L13.5,8L12,8z"/>
<vector android:height="24dp"
android:tint="#FFFFFF"
android:viewportHeight="24"
android:viewportWidth="24"
android:width="24dp"
xmlns:android="http://schemas.android.com/apk/res/android">
<path
android:fillColor="@android:color/white"
android:pathData="M13,3c-4.97,0 -9,4.03 -9,9L1,12l3.89,3.89 0.07,0.14L9,12L6,12c0,-3.87 3.13,-7 7,-7s7,3.13 7,7 -3.13,7 -7,7c-1.93,0 -3.68,-0.79 -4.94,-2.06l-1.42,1.42C8.27,19.99 10.51,21 13,21c4.97,0 9,-4.03 9,-9s-4.03,-9 -9,-9zM12,8v5l4.28,2.54 0.72,-1.21 -3.5,-2.08L13.5,8L12,8z" />
</vector>

View file

@ -201,7 +201,7 @@
app:layout_constraintBottom_toTopOf="@id/playPauseButton"
app:layout_constraintStart_toStartOf="@id/repeatButton"
tools:ignore="RtlHardcoded,RtlSymmetry"
tools:text="@tools:sample/date/hhmmss" />
tools:text="@tools:sample/date/hhmmss" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/songTotalTime"
@ -213,6 +213,6 @@
app:layout_constraintBottom_toTopOf="@id/playPauseButton"
app:layout_constraintEnd_toEndOf="@id/shuffleButton"
tools:ignore="RtlHardcoded,RtlSymmetry"
tools:text="@tools:sample/date/hhmmss" />
tools:text="@tools:sample/date/hhmmss" />
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -185,7 +185,7 @@
app:layout_constraintStart_toEndOf="@id/progressSlider"
app:layout_constraintTop_toTopOf="@id/progressSlider"
tools:ignore="RtlHardcoded,RtlSymmetry"
tools:text="@tools:sample/date/hhmmss" />
tools:text="@tools:sample/date/hhmmss" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/songCurrentProgress"
@ -202,7 +202,7 @@
app:layout_constraintStart_toEndOf="@id/guideline"
app:layout_constraintTop_toTopOf="@id/progressSlider"
tools:ignore="RtlHardcoded,RtlSymmetry"
tools:text="@tools:sample/date/hhmmss" />
tools:text="@tools:sample/date/hhmmss" />
<com.google.android.material.textview.MaterialTextView

Some files were not shown because too many files have changed in this diff Show more