diff options
597 files changed, 49138 insertions, 0 deletions
diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..cc0066d --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +# EditorConfig is awesome: http://EditorConfig.org + +# top-most EditorConfig file +root=true + +[*] +charset=utf-8 +# Unix-style newlines with a newline ending every file +end_of_line=lf +insert_final_newline=true +indent_style=tab +tab_width=4 diff --git a/.github/issue_template.md b/.github/issue_template.md new file mode 100644 index 0000000..a21c39e --- /dev/null +++ b/.github/issue_template.md @@ -0,0 +1,29 @@ +1. Please take a moment to check if the same Bug has already been reported. +2. Please use our subreddit for general questions: https://www.reddit.com/r/vanillamusic/ +3. Please provide all relevant information below. + +**You MUST delete the content above including this line before posting, otherwise your issue may be closed as 'invalid'.** + +- Vanilla Music Version (Settings -> About): +- Android Version: +- Phone vendor / model: +- Application was downloaded from (use `[x]`): + - [ ] Play Store + - [ ] F-Droid + - [ ] Other (Nightly Build) +- Did this work in a previous version? + - [ ] Yes + - [ ] No + - [ ] NA / Don't know. + +## Description + +.... + +## Steps to reproduce the issue + +... + +## Screenshot / Video (If applicable) + +... diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c860daf --- /dev/null +++ b/.gitignore @@ -0,0 +1,46 @@ +# Source: https://raw.githubusercontent.com/github/gitignore/master/Android.gitignore + +# Built application files +*.apk +*.ap_ + +# Files for the Dalvik VM +*.dex + +# Java class files +*.class + +# Generated files +bin/ +gen/ + +# Gradle files +.gradle/ +build/ + +# Local configuration file (sdk path, etc) +local.properties + +# Proguard folder generated by Eclipse +proguard/ + +# Log Files +*.log + +# Source: http://stackoverflow.com/a/17803964 +.DS_Store + +# Source: https://gitlab.com/fdroid/fdroidclient/raw/master/.gitignore +*~ +*.swp +.idea/ +*.iml +out +.settings/ + +# Visual Studio 2015 cache/options directory +.vs/ + +# Visual Studio Code files +.project +.classpath
\ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..d75ce54 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,31 @@ +language: android + +jdk: + - oraclejdk8 + +env: + global: + # install timeout in minutes (2 minutes by default) + - ADB_INSTALL_TIMEOUT=8 + +android: + components: + # use the latest revision of Android SDK Tools + - platform-tools + - tools + + # The BuildTools version used + - build-tools-29.0.2 + + # The SDK version used + - android-29 + +before_cache: + - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock +cache: + directories: + - $HOME/.gradle/caches/ + - $HOME/.gradle/wrapper/ + +script: + - ./gradlew --info assembleRelease diff --git a/.tx/config b/.tx/config new file mode 100644 index 0000000..138aa25 --- /dev/null +++ b/.tx/config @@ -0,0 +1,9 @@ +[main] +host = https://www.transifex.com + +[o:vanilla_music:p:vanilla-music-1:r:en-strings] +file_filter = translations/vanilla-music-1.en-strings/<lang>.xml +source_file = translations/vanilla-music-1.en-strings/en.xml +source_lang = en +type = ANDROID + diff --git a/Android.mk b/Android.mk new file mode 100644 index 0000000..6415dba --- /dev/null +++ b/Android.mk @@ -0,0 +1,20 @@ +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) +LOCAL_MODULE_TAGS := optional + +LOCAL_SRC_FILES := \ + $(call all-java-files-under, src) + +LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res + +LOCAL_PACKAGE_NAME := VanillaMusic + +LOCAL_AAPT_FLAGS := \ + --auto-add-overlay + +include $(BUILD_PACKAGE) + +# Use the following include to make our test apk. +ifeq (,$(ONE_SHOT_MAKEFILE)) +include $(call all-makefiles-under,$(LOCAL_PATH)) +endif diff --git a/CleanSpec.mk b/CleanSpec.mk new file mode 100644 index 0000000..b84e1b6 --- /dev/null +++ b/CleanSpec.mk @@ -0,0 +1,49 @@ +# Copyright (C) 2007 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. +# + +# If you don't need to do a full clean build but would like to touch +# a file or delete some intermediate files, add a clean step to the end +# of the list. These steps will only be run once, if they haven't been +# run before. +# +# E.g.: +# $(call add-clean-step, touch -c external/sqlite/sqlite3.h) +# $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates) +# +# Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with +# files that are missing or have been moved. +# +# Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory. +# Use $(OUT_DIR) to refer to the "out" directory. +# +# If you need to re-do something that's already mentioned, just copy +# the command and add it to the bottom of the list. E.g., if a change +# that you made last week required touching a file and a change you +# made today requires touching the same file, just copy the old +# touch step and add it to the end of the list. +# +# ************************************************ +# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST +# ************************************************ + +# For example: +#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates) +#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates) +#$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f) +#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*) + +# ************************************************ +# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST +# ************************************************ diff --git a/HALL-OF-SHAME.md b/HALL-OF-SHAME.md new file mode 100644 index 0000000..c8a584a --- /dev/null +++ b/HALL-OF-SHAME.md @@ -0,0 +1,59 @@ +Vanilla Music is licensed under the terms of the [GPLv3 License](https://github.com/vanilla-music/vanilla/blob/master/LICENSE) +since commit [a5255](https://github.com/vanilla-music/vanilla/commit/a525523bf1bb5dadfef544843966936c46e8310f) (older releases used the MIT License) + +This means (among other things) that you are free to modify the source code and release your modified version. +However: Publishing such a modified version also *requires* you to: + +* Provide the *full* source code of your modified version +* Keep the original copyright message as it is. (Eg: Do not delete the 'About' screen in Preferences) + +These rules are pretty simple and fair, but some people just want to make a quick buck and upload modified (ad-infested) versions +of Vanilla Music to the play store. + +This list is a collection of such GPL violating versions published on the Google Play Store. + + +## 8D Audio Converter +* https://play.google.com/store/apps/details?id=com.vibes8d.audio8d +* 1:1 copy of vanilla music 1.80 - requires internet access, so probably has ads +* Keeps original copyright, does not provide access to the modified source + +## Boom Music +* https://play.google.com/store/apps/details?id=com.oapps.boom +* Full screen ads +* Does not provide modified source, just links to this repo + +### MyMusic +* https://play.google.com/store/apps/details?id=com.appcode.mymusic +* Removed 'About' section in App +* Full screen ads + +### MP3 Music Delta Pro +* https://play.google.com/store/apps/details?id=com.extra.DeltaMusic +* Removed 'About' section in App +* Claims to be based on the old MIT licensed code (which is a lie) +* Nasty Ads + +### MP3 Music Free +* https://play.google.com/store/apps/details?id=com.extrastudio.easymusicplayer +* Does not mention Vanilla Music in the play store entry, crashes in 'About' screen +* Nasty Ads + +### Player+ +* https://play.google.com/store/apps/details?id=ch.ibroapps.android.player +* Claims to use (old) MIT licensed version, but clearly includes GPLv3 licensed code - all copyright removed +* Contains ads + +### Player+ Pro +* https://play.google.com/store/apps/details?id=ch.ibroapps.android.player.pro +* Same as 'Player+', but sold for 3$ + +### Mp3 Player Download +* https://play.google.com/store/apps/details?id=com.mp3.volume.booster.equalizer +* Keeps original copyright message and links to this repo (good) but fails to provide access to the modified source (bad) +* Has Ads + +### Music Player 2017 +* https://play.google.com/store/apps/details?id=com.mekayazilim.android.musicplayer +* Keeps original copyright message - does not provide modified source +* Has TONS of advertisements. @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + <program> Copyright (C) <year> <name of author> + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +<http://www.gnu.org/licenses/>. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c1f5e6b --- /dev/null +++ b/Makefile @@ -0,0 +1,24 @@ +.PHONY: debug build release clean + +default: + +lint: + ssh qemu '. .bash_aliases && cd /hostfs/vanilla && ./gradlew lintDebug' + +debug: build + adb install -r ./app/build/outputs/apk/debug/app-debug.apk + +build: + ssh qemu '. .bash_aliases && cd /hostfs/vanilla && ./gradlew build --warning-mode all -x lintVitalRelease -x lint' + +release: clean + ssh qemu '. .bash_aliases && cd /hostfs/vanilla && ./gradlew assembleRelease && cd ./app/build/outputs/apk/release && zipalign -v -p 4 app-release-unsigned.apk aligned.apk && /home/adrian/Android/build-tools/27.0.3/apksigner sign -ks /hostfs/.android.keystore --out final.apk aligned.apk' + +clean: + rm -rf ./app/build + +uninstall: + adb uninstall ch.blinkenlights.android.vanilla + +gce-nightly: + ./gradlew assembleRelease && cd ./app/build/outputs/apk/release && zipalign -v -p 4 app-release-unsigned.apk aligned.apk && echo aaaaaa | apksigner sign -ks ~/.android.keystore --out nightly-signed.apk aligned.apk diff --git a/README.md b/README.md new file mode 100644 index 0000000..e6de2b4 --- /dev/null +++ b/README.md @@ -0,0 +1,92 @@ +Vanilla Music +===================== + +Vanilla Music player is a [GPLv3](LICENSE) licensed MP3/OGG/FLAC/PCM player for Android with the following features: +* multiple playlist support +* grouping by artist, album or genre +* plain filesystem browsing +* [ReplayGain](https://en.wikipedia.org/wiki/ReplayGain) support +* headset/Bluetooth controls +* accelerometer/shake control +* cover art support +* [Simple Last.fm Scrobbler](https://github.com/tgwizard/sls) support + +[<img src="https://f-droid.org/badge/get-it-on.png" + alt="Get it on F-Droid" + height="80">](https://f-droid.org/app/ch.blinkenlights.android.vanilla) + +**Note:** As of 23. Jun 2024, Vanilla Music is *no longer* available in the Google Play store: +I simply don't have time to comply with random policy changes and verification requests. +Any release you see there is probably an ad-infested fork uploaded by someone else. + + +Plugins +=========== + +Vanilla Music also includes support for plugins, this is a list of some existing plugins: +* [Cover fetcher](https://play.google.com/store/apps/details?id=com.kanedias.vanilla.coverfetch) +* [Lyrics search](https://play.google.com/store/apps/details?id=com.kanedias.vanilla.lyrics) +* [Tag editor](https://play.google.com/store/apps/details?id=com.kanedias.vanilla.audiotag) +* [Headphone detector](https://play.google.com/store/apps/details?id=ch.blinkenlights.android.vanillaplug) + + +Donations +=========== +You can donate to Vanilla Musics development via Bitcoin + +Bitcoin: [1adrianERDJusC4c8whyT81zAuiENEqub](https://blockchain.info/address/1adrianERDJusC4c8whyT81zAuiENEqub) + + +Community +=========== +Come over and join us on our subreddit [**/r/VanillaMusic**](https://www.reddit.com/r/vanillamusic) to hangout with fellow Vanilla Music users, ask questions, or help others by answering their questions! + +Contributing +=========== + +Translating +----------- +[You can help translate here][1]. If your language isn't on the list, sign in to transifex and request the language to be added to the list of translations. +(Feel free to open a bug if your request was not approved within a few days - i don't look into transifex that often.) + +Contributing code +--------------- +* A list of open issues can be found at the [issue tracker][2] +* Features we would like to see (but nobody started working on them yet) have the [patches-welcome][3] label attached to them. Please let us know if you start working on such an open issue (to avoid duplicate work) +* We accept raw patches and github pull request - and we use tabs (if your editor understands .editorconfig, it will help you enforce this). + +Building +======== +To build you will need: + + * A Java compiler compatible with Java 1.8 + * The Android SDK with platform 26 installed + +Building from command-line +-------------------------- +> Note: at the time of this writing, the current version of Gradle ([4.5.1](https://gradle.org/releases/)) is not compatible with the current version of JDK ([9.0.4](http://www.oracle.com/technetwork/java/javase/downloads/jdk9-downloads-3848520.html)). To have the build succeed, use JDK version [1.8.0_162](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html). + * `gradle build` to build the APK + * Optional: `gradle installDebug` to install the APK to a connected device + +Building with Android Studio +--------------------- +You can also build with Android Studio by importing this project into it. + +Building from Eclipse +--------------------- +You can also build from Eclipse. Create a new Android Project, choosing "Create +project from exisiting source", then set the compiler compliance level to 1.6 +in project settings. + +Nightly Builds +--------------------- +Automatically created builds are available from http://android.eqmx.net/android/vanilla/VanillaMusic-nightly.apk + +Documentation +============= +Javadocs can be generated using `gradle javadoc` or `ant doc` + + + [1]: https://www.transifex.com/projects/p/vanilla-music-1/ + [2]: https://github.com/vanilla-music/vanilla/issues + [3]: https://github.com/vanilla-music/vanilla/labels/patches-welcome diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..145f599 --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,36 @@ +apply plugin: 'com.android.application' + +android { + lintOptions { + disable 'MissingTranslation' + disable 'ExtraTranslation' + } + + compileSdkVersion rootProject.ext.compileSdkVersion + + defaultConfig { + applicationId "ch.blinkenlights.android.vanilla" + minSdkVersion rootProject.ext.minSdkVersion + targetSdkVersion rootProject.ext.targetSdkVersion + } + + buildTypes { + release { + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + minifyEnabled true + zipAlignEnabled true + } + } + + lintOptions { + abortOnError false + } +} + +dependencies { + implementation 'androidx.legacy:legacy-support-core-ui:1.0.0' + implementation 'androidx.media:media:1.6.0' + implementation 'com.google.android.material:material:1.7.0' + implementation 'junit:junit:4.12' + compileOnly 'androidx.annotation:annotation:1.0.0' +} diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..c30ae2b --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,2 @@ +# Never obfuscate releases +-dontobfuscate diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..5c14e28 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,253 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +Copyright (C) 2012-2022 Adrian Ulrich <adrian@blinkenlights.ch> +Copyright (C) 2012 Christopher Eby <kreed@kreed.org> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +--> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="ch.blinkenlights.android.vanilla" + android:versionName="1.3.2" + android:versionCode="13200" + android:installLocation="auto"> + <uses-permission android:name="android.permission.WAKE_LOCK" /> + <uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> + <uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" /> + <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> + <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> + <!-- This is needed for isWiredHeadsetOn() to work in some cases. (bug?) --> + <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> + <uses-permission android:name="android.permission.READ_MEDIA_IMAGES"/> + <uses-permission android:name="android.permission.READ_MEDIA_AUDIO"/> + <!-- Playlist shortcuts --> + <uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" /> + <!-- Android 13 notifications --> + <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/> + <!-- Allow us to query plugins --> + <queries> + <intent> + <action android:name="ch.blinkenlights.android.vanilla.action.REQUEST_PLUGIN_PARAMS" /> + </intent> + </queries> + + <application + android:allowBackup="true" + android:resizeableActivity="true" + android:icon="@mipmap/icon" + android:label="@string/app_name" + android:requestLegacyExternalStorage="true"> + + <meta-data + android:name="com.mirrorlink.android.rockscout.allow-offline-access" + android:value="true" /> + + <provider + android:name="androidx.core.content.FileProvider" + android:authorities="ch.blinkenlights.android.vanilla.fileprovider" + android:exported="false" + android:grantUriPermissions="true"> + <meta-data + android:name="android.support.FILE_PROVIDER_PATHS" + android:resource="@xml/provider_paths"/> + </provider> + + <activity + android:name="FullPlaybackActivity" + android:launchMode="singleTask" /> + <activity + android:name="LibraryActivity" + android:theme="@style/Library" + android:exported="true" + android:launchMode="singleTask"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <action android:name="android.intent.action.MUSIC_PLAYER" /> + <category android:name="android.intent.category.LAUNCHER" /> + <category android:name="android.intent.category.APP_MUSIC" /> + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + + <meta-data + android:name="android.app.shortcuts" + android:resource="@xml/shortcuts"/> + + </activity> + <activity + android:name="PlaylistActivity" + android:launchMode="singleTask" /> + <activity + android:name="MiniPlaybackActivity" + android:theme="@style/PopupDialog" + android:excludeFromRecents="true" + android:launchMode="singleInstance" /> + <receiver + android:name=".OneCellWidget" + android:label="Vanilla Music 1x1" + android:exported="false"> + <intent-filter> + <action android:name="android.appwidget.action.APPWIDGET_UPDATE" /> + </intent-filter> + <meta-data + android:name="android.appwidget.provider" + android:resource="@xml/one_cell_widget" /> + </receiver> + <receiver + android:name=".FourLongWidget" + android:label="Vanilla Music 4x1 A" + android:exported="false"> + <intent-filter> + <action android:name="android.appwidget.action.APPWIDGET_UPDATE" /> + </intent-filter> + <meta-data + android:name="android.appwidget.provider" + android:resource="@xml/four_long_widget" /> + </receiver> + <receiver + android:name=".FourWhiteWidget" + android:label="Vanilla Music 4x1 White" + android:exported="false"> + <intent-filter> + <action android:name="android.appwidget.action.APPWIDGET_UPDATE" /> + </intent-filter> + <meta-data + android:name="android.appwidget.provider" + android:resource="@xml/four_white_widget" /> + </receiver> + <receiver + android:name=".WidgetE" + android:label="Vanilla Music 4x1 B" + android:exported="false"> + <intent-filter> + <action android:name="android.appwidget.action.APPWIDGET_UPDATE" /> + </intent-filter> + <meta-data + android:name="android.appwidget.provider" + android:resource="@xml/widget_e" /> + </receiver> + <receiver + android:name=".FourSquareWidget" + android:label="Vanilla Music 2x2 A" + android:exported="false"> + <intent-filter> + <action android:name="android.appwidget.action.APPWIDGET_UPDATE" /> + </intent-filter> + <meta-data + android:name="android.appwidget.provider" + android:resource="@xml/four_square_widget" /> + </receiver> + <receiver + android:name=".WidgetD" + android:label="Vanilla Music 2x2 B" + android:exported="false"> + <intent-filter> + <action android:name="android.appwidget.action.APPWIDGET_UPDATE" /> + </intent-filter> + <meta-data + android:name="android.appwidget.provider" + android:resource="@xml/widget_d" /> + </receiver> + <receiver android:name="MediaButtonReceiver" + android:exported="true"> + <intent-filter android:priority="999"> + <action android:name="android.intent.action.MEDIA_BUTTON" /> + </intent-filter> + </receiver> + <service android:name="PlaybackService" + android:foregroundServiceType="mediaPlayback" + android:exported="true"> + <intent-filter> + <action android:name="ch.blinkenlights.android.vanilla.action.PLAY" /> + <action android:name="ch.blinkenlights.android.vanilla.action.PAUSE" /> + <action android:name="ch.blinkenlights.android.vanilla.action.TOGGLE_PLAYBACK" /> + <action android:name="ch.blinkenlights.android.vanilla.action.NEXT_SONG" /> + <action android:name="ch.blinkenlights.android.vanilla.action.PREVIOUS_SONG" /> + </intent-filter> + </service> + + <service + android:name=".ScheduledLibraryUpdate" + android:permission="android.permission.BIND_JOB_SERVICE" + android:exported="true" /> + + <activity + android:name="PreferencesActivity" /> + <activity + android:name="TabOrderActivity" /> + <activity + android:name="FilebrowserStartActivity" /> + <activity + android:name="PlaylistObserverDirActivity" /> + <activity + android:name="MediaFoldersSelectionActivity" /> + <activity + android:name="PermissionRequestActivity" + android:theme="@android:style/Theme.Translucent.NoTitleBar" /> + + <activity + android:name="ShortcutPseudoActivity" + android:theme="@android:style/Theme.Translucent.NoTitleBar" + android:exported="false"> + <intent-filter> + <action android:name="android.intent.action.MAIN"/> + </intent-filter> + </activity> + + <activity android:name="AudioPickerActivity" + android:theme="@style/PopupDialog" + android:excludeFromRecents="true" + android:exported="true" > + <intent-filter> + <action android:name="android.intent.action.VIEW" /> + <category android:name="android.intent.category.DEFAULT" /> + <data android:scheme="file"/> + <data android:mimeType="audio/*"/> + <data android:mimeType="application/ogg"/> + <data android:mimeType="application/x-ogg"/> + <data android:mimeType="application/x-flac"/> + <data android:mimeType="application/itunes"/> + </intent-filter> + <intent-filter> + <action android:name="android.intent.action.VIEW" /> + <category android:name="android.intent.category.DEFAULT" /> + <data android:scheme="content"/> + <data android:mimeType="audio/*"/> + <data android:mimeType="application/ogg"/> + <data android:mimeType="application/x-ogg"/> + <data android:mimeType="application/x-flac"/> + <data android:mimeType="application/itunes"/> + </intent-filter> + </activity> + + <activity android:name="AudioSearchActivity" android:theme="@style/PopupDialog" + android:exported="true" + android:excludeFromRecents="true"> + <intent-filter> + <action android:name="android.media.action.MEDIA_PLAY_FROM_SEARCH" /> + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + + + + <meta-data + android:name="com.google.android.backup.api_key" + android:value="AEdPqrEAAAAIEViwBxSHCdBCOOat4Go_5gSxFU7PhRFjLTeRAw" /> + + </application> +</manifest> diff --git a/app/src/main/assets/about.html b/app/src/main/assets/about.html new file mode 100644 index 0000000..b1c91fc --- /dev/null +++ b/app/src/main/assets/about.html @@ -0,0 +1,383 @@ +<html> +<head> +<meta charset="utf-8" /> +<style> +body { font-family: sans-serif; background: transparent;} +pre { background-color: #ccc; color: #000; padding: 1em; white-space: pre-wrap; display: none; } +h2 { border-bottom: 1px solid #444; } +a { color: #5c5cff; } +</style> +<script> +function show(n) { + var e = document.getElementById(n); + if (e.style.display == "block") { + e.style.display="none"; + } else { + e.style.display="block"; + } +} +</script> +</head> +<body> +<h1>Vanilla Music</h1> +<p><b>Version:</b> 1.3.2 Released 10. Jan. 2024<br><br> +<b>Website:</b> <a href='https://vanilla-music.github.io/'>https://vanilla-music.github.io/</a><br> +<b>Issue tracker:</b> <a href='https://github.com/vanilla-music/vanilla/issues'>https://github.com/vanilla-music/vanilla/issues</a><br> +<b>Community & support:</b> <a href='https://www.reddit.com/r/vanillamusic'>/r/VanillaMusic</a><br> +<br> +<b>Changelog</b> [<a href='javascript:show("changelog")'>show</a>] +<pre id='changelog'> + +<b>1.3.2</b> +- Upgrade to Android SDK 34 + +<b>1.3.1</b> +- <b>FIX</b> Export Playback Service + +<b>1.3.0</b> +- <b>FIX</b> Multiple UI fixes + +<b>1.2.0</b> +- <b>NEW</b> Upgraded Android SDK level to 33 + +<b>1.1.0</b> +- <b>FIX</b> Unbreak plugin integration +- <b>FIX</b> Always show cover art in notification + +<b>1.0.92</b> +- <b>NEW</b> Greatly improve handling of SD-Cards +- <b>FIX</b> Make library preferences dialog nicer + +<b>1.0.91</b> +- <b>NEW</b> Switch to new notification framework +- <b>NEW</b> Added move to top/bottom actions in queue view +- <b>CLEANUP</b> Change SDK target to 30 +- <b>CLEANUP</b> Remove MirrorLink support +- <b>FIX</b> Fix genre tab expansion + +<b>1.0.90</b> +- <b>NEW</b> Some cosmetic fixes + +<b>1.0.85</b> +- <b>NEW</b> Upgrade to Android API 29 +- <b>NEW</b> New limiter view layout +- <b>FIX</b> Bugfix for relative playlist import / export + +<b>1.0.84</b> +- <b>FIX</b> Make context menues more consistent +- <b>FIX</b> Use better default for playlist export path +- <b>FIX</b> Improve replay gain calculation + +<b>1.0.83</b> +- <b>FIX</b> Improve plugins system +- <b>FIX</b> Fixed some playlist synchronization issues + +<b>1.0.82</b> +- <b>NEW</b> New context menu in library +- <b>NEW</b> Show duration of playlists +- <b>FIX</b> Fix replay gain calculation for opus (R128) +- <b>FIX</b> Support for 'play all' in files tab + + +<b>1.0.81</b> +- <b>FIX</b> Increase plugin performance on Android 4.x +- <b>FIX</b> Minor UI fixes + +<b>1.0.80</b> +- <b>NEW</b> Add 'Details' dialog +- <b>NEW</b> Add 'Jump to...' function +- <b>NEW</b> Display duration in Albums tab +- <b>NEW</b> Sort albums by duration +- <b>NEW</b> Do not scan dotfiles +- <b>FIX</b> Fix a few crash bugs + +<b>1.0.73</b> +- <b>FIX</b> Fix plugin system on newer android releases + +<b>1.0.72</b> +- <b>FIX</b> Fix file selection which broke in 1.0.70 + +<b>1.0.70</b> +- <b>NEW</b> Option to synchronize M3U Playlists +- <b>NEW</b> Read artwork from embedded tags +- <b>NEW</b> Option to scroll to current song in queue view + +<b>1.0.62</b> +- <b>NEW</b> Landscape library layout +- <b>NEW</b> Change default library action + +<b>1.0.61</b> +- <b>FIX</b> Fix an issue where the queue view became inactive +- <b>NEW</b> Display song duration +- <b>NEW</b> Sort by duration + +<b>1.0.60</b> +- <b>NEW</b> Upgrade SDK version to 27 +- <b>FIX</b> Improved tag parser +- <b>FIX</b> Fix issue with some bluetooth headsets + +<b>1.0.59</b> +- <b>NEW</b> Dark (AMOLED) theme +- <b>NEW</b> Random mode picks random album if shuffle is set to album +- <b>NEW</b> Basic Google Now integration +- <b>FIX</b> Improved detection of external headphones + +<b>1.0.58</b> +- <b>NEW</b> Use internal tagreader by default for new installations +- <b>FIX</b> Correctly sort multi disc albums in album-shuffle mode +- <b>FIX</b> Fixed an NPE and an obscure endless loop + +<b>1.0.57</b> +- <b>NEW</b> Raw path names can now be entered in the folder picker preference +- <b>NEW</b> Run periodic cleanup jobs on newer Android versions automatically + +<b>1.0.56</b> +- <b>FIX</b> Fix headset issues on Android 8.0 +- <b>FIX</b> Improve cover placeholder image resolution +- <b>FIX</b> Enable sharing of files stored on external storage + +<b>1.0.55</b> +- <b>NEW</b> Upgraded SDK to Android 8.0 +- <b>NEW</b> Added back button to small notification +- <b>FIX</b> Various small bugfixes + +<b>1.0.54</b> +- <b>FIX</b> Improved cover scrolling +- <b>FIX</b> Improved performance on Android 4.x +- <b>FIX</b> Tag reader improvements +- <b>FIX</b> Better auto discovery of media directories +- <b>NEW</b> Help link added to 'Settings' page + +<b>1.0.53</b> +- <b>NEW</b> Various new icons +- <b>NEW</b> Ability to handle more external data sources +- <b>NEW</b> Refreshed Holo / Android 4.x look +- <b>FIX</b> Fixed button context menu for Android 7.x +- <b>FIX</b> Fixed various small crashbugs + +<b>1.0.52</b> +- <b>NEW</b> Folders can now be in- or excluded from the music library +- <b>NEW</b> Files can now be sorted +- <b>NEW</b> Cleaned up and improved file browser +- <b>NEW</b> Ability to jump to folder from song +- <b>FIX</b> Display 'Plugins' option only if plugins are installed +- <b>FIX</b> Preserve play- and skipcount during rescans + +<b>1.0.51</b> +- <b>FIX</b> Read MIDI files +- <b>FIX</b> Fix tabs on Android 7.0 +- <b>NEW</b> Added 'Play All' option in file view +- <b>NEW</b> Support for 'Composer' and 'Album Artist' tags + +<b>1.0.50</b> +- <b>FIX</b> Improved internal tagreader +- <b>FIX</b> Fixed crash on Android 4.0 devices + +<b>1.0.49</b> +- <b>NEW</b> Option to force use of internal tag reader +- <b>NEW</b> Option to group albums by folder +- <b>FIX</b> Various smaller fixes + +<b>1.0.48</b> +- <b>FIX</b> Correctly handle genres for ID3v1 tags +- <b>FIX</b> Unbroke scrobbler API +- <b>FIX</b> Relaxed and tuned indexing blacklist + +<b>1.0.47</b> +- <b>NEW</b> Completely new media database engine +- <b>NEW</b> Support for plugins +- <b>NEW</b> Fancy blue theme +- <b>FIX</b> Fit cover art in notification + +<b>1.0.46</b> +- <b>NEW</b> Replay gain support for m4a files +- <b>NEW</b> New and improved sorting options +- <b>FIX</b> Some performance improvements +- <b>FIX</b> Upgraded to Android 7 SDK + +<b>1.0.45</b> +- <b>NEW</b> Enqueue selected folders alphabetically +- <b>FIX</b> Do not crash on Android 5.x while creating a Playlist +- <b>FIX</b> Improved detection of storage paths for the media scanner +- <b>FIX</b> Improved replay gain tag parser + +<b>1.0.44</b> +- <b>NEW</b> Triple-Click the headset button to switch to previous song. +- <b>FIX</b> Various small bugfixes + +<b>1.0.43</b> +- <b>NEW</b> Option to 'follow' playing song in library view +- <b>FIX</b> Various small bugfixes + +<b>1.0.42</b> +- <b>NEW</b> Option to perform a SD-Card rescan +- <b>NEW</b> 'Play All' option in context menu +- <b>NEW</b> 'Add to Playlist' option in Now Playing screen +- <b>FIX</b> Various small bugfixes + +<b>1.0.41</b> +- <b>NEW</b> New application icon +- <b>NEW</b> Opus Replay Gain support +- <b>NEW</b> Support for multiple color themes +- <b>NEW</b> Added 'Add to Playlist' option in queue fragment + +<b>1.0.40</b> +- <b>NEW</b> 'Show queue' can now be selected as swipe action +- <b>FIX</b> Multiple crashfixes + +<b>1.0.39</b> +- <b>FIX</b> Various bugfixes + +<b>1.0.38</b> +- <b>NEW</b> Display playback queue by sliding-up the bottom bar +- <b>NEW</b> Announce 'rock scout' capability in Manifest +- <b>NEW</b> Enabled Fast-Scroll in library view (Thanks to Oleg Chernovskiy) +- <b>FIX</b> Hide genres with zero entries +- <b>FIX</b> Remember scrolling position in files tab + +<b>1.0.37</b> +- <b>NEW</b> Added a '☆' button to quickly manage favorites +- <b>FIX</b> Fixed various crashes + +<b>1.0.36</b> +- <b>NEW</b> Added option to ignore audio focus losses +- <b>NEW</b> Use Android 5.0 Mediasession API +- <b>NEW</b> Cache covers using WEBP +- <b>NEW</b> Redesigned Library view to match Material Design guidelines +- <b>NEW</b> Changed default click option from 'Play' to 'Expand' +- <b>FIX</b> Do not show close button on uncloseable notification + +<b>1.0.35</b> +- <b>FIX</b> Fixed crash on Android 4.0.3 +- <b>FIX</b> Workaround mediaserver bug which failed to accept some file paths + +<b>1.0.34</b> +- <b>NEW</b> Improved Android 6 support +- <b>NEW</b> Added disk cover cache +- <b>NEW</b> Rewind songs on `|<<' +- <b>NEW</b> Ability to filter artists by genre +- <b>FIX</b> Remember `Files' tab position +- <b>FIX</b> Do not crash on `play all' with active genre limiter + +<b>1.0.33</b> +- <b>FIX</b> Solve layout issues of the queue-pos element +- <b>FIX</b> Improve filtering by genre +- <b>FIX</b> Fixed a layout issue with 'info below cover' mode +- <b>FIX</b> Fixed a bug when hitting the last song in shuffle mode +- <b>NEW</b> Dispatch text and image files to external viewers +- <b>NEW</b> Automatic 'Top xyz' playlist creation +- <b>NEW</b> Include headphone detector in settings +- <b>NEW</b> Option to disable album artwork on lock screen + +<b>1.0.32</b> +- <b>NEW</b> Added support for ducking (Thanks to Xiao Bao Clark) +- <b>NEW</b> Added support for MirrorLink (Thanks to Laurent Cremmer) +- <b>FIX</b> Fix layout issues with big fonts + +<b>1.0.31</b> +- <b>NEW</b> Fadein cover artwork +- <b>FIX</b> Various small patches and fixes + +<b>1.0.30</b> +- <b>NEW</b> Display album artwork in listview +- <b>NEW</b> Fling-Remove of playlist items +- <b>FIX</b> Fixed playlist reordering bug + +<b>1.0.20</b> +- <b>NEW</b> Support for heads-up-display notifications +- <b>NEW</b> Added 'skip 10 seconds' longpress action +- <b>FIX</b> Disable fastscroll in library view, making it useable on Android 5.1 +- <b>FIX</b> Improved parsing of ID3v-2.4 tags (Thanks to Noah Crocker) + +<b>1.0.10</b> +- <b>NEW</b> Dark material theme support + +<b>1.0.00</b> +- <b>NEW</b> Added 'Continuous Shuffling' option +- <b>FIX</b> Workaround for AudioFX crashes on CyanogenMod +- <b>FIX</b> Save track position on shutdown +- <b>FIX</b> Fixed some 'shake action' issues +- <b>FIX</b> Remember list position while deleting songs +- <b>FIX</b> Unbreak widgets broken in 0.99 + +<b>0.9.99</b> +- <b>NEW</b> Material design +- <b>NEW</b> Native searchview +- <b>NEW</b> <i>Empty queue</i> option in Queue screen +- <b>NEW</b> Gradle / Android Studio support by @AltNico +- <b>FIX</b> Enqueue bug introduced in 0.9.42 +</pre> +<h2>Contributors</h2> +<ul> + <li>Adrian Ulrich (current maintainer)</li> + <li>Amin Bandali (current maintainer)</li> + <li>Andrew Nayenko (pre 1.0.53 icon)</li> + <li>Azer Abdullaev (github.com/reactorcoremeltdown) (Purple theme)</li> + <li>Chris Eby (original creator)</li> + <li>David Beswick (various contributions)</li> + <li>Emir Sarı (Turkish translation)</li> + <li>Ferenc Nagy (icon)</li> + <li>Jean-Baptiste Lab (notication color invert)</li> + <li>Jean-François Im (cover art loading)</li> + <li>Jerry Liao (Chinese (Taiwan) translation)</li> + <li>Jiri Grönroos (Finnish translation)</li> + <li>Magnus Anderssen (headset button)</li> + <li>Mildred Ki'Lya (stop after track mode)</li> + <li>Oleg (Adonai) Chernovskiy (fastscroll)</li> + <li>Rosario Antoci (Italian translation)</li> + <li>Xiao Bao Clark (various contributions)</li> + <li>Yacine Krouri (current icon and various graphics)</li> + <!-- TODO: add more translators --> +</ul> +<h2>Licenses</h2> +<h3>Vanilla Music [<a href='javascript:show("l1")'>show</a>]</h3> +<pre id='l1'> +Copyright (C) 2012-2018 Vanilla Music contributors + +This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +</pre> + +<h3>Vanilla Music includes code released under the <a href='javascript:show("l2")'>MIT License</a></h3> +<pre id='l2'> +Copyright (C) 2012-2013 Vanilla Music contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +</pre> +<h3>DragSortListView [<a href='javascript:show("l4")'>show</a>]</h3> +<pre id='l4'> +A subclass of the Android ListView component that enables drag +and drop re-ordering of list items. + +Copyright 2012 Carl Bauer + +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. +</pre> +</body> + +<script> + var query = decodeURIComponent(window.location.search.substring(1)); + var color = query.match(/^#..(.+)/); + if (color != null) { + // android gives us aRGB, but we need RGB + color = '#' + color[1]; + document.body.style.color = color; + } +</script> + +</html> diff --git a/app/src/main/java/android/support/iosched/tabs/SlidingTabLayout.java b/app/src/main/java/android/support/iosched/tabs/SlidingTabLayout.java new file mode 100644 index 0000000..e85a7df --- /dev/null +++ b/app/src/main/java/android/support/iosched/tabs/SlidingTabLayout.java @@ -0,0 +1,323 @@ +// imported from https://raw.githubusercontent.com/google/iosched/2531cbdbe27e5795eb78bf47d27e8c1be494aad4/android/src/main/java/com/google/samples/apps/iosched/ui/widget/SlidingTabLayout.java +/* + * Copyright 2014 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.support.iosched.tabs; + +import android.content.Context; +import android.graphics.Typeface; +import android.util.AttributeSet; +import android.util.SparseArray; +import android.util.TypedValue; +import android.view.Gravity; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.HorizontalScrollView; +import android.widget.LinearLayout; +import android.widget.TextView; + +import androidx.viewpager.widget.PagerAdapter; +import androidx.viewpager.widget.ViewPager; + +/** + * To be used with ViewPager to provide a tab indicator component which give constant feedback as to + * the user's scroll progress. + * <p> + * To use the component, simply add it to your view hierarchy. Then in your + * {@link android.app.Activity} or {@link android.support.v4.app.Fragment} call + * {@link #setViewPager(ViewPager)} providing it the ViewPager this layout is being used for. + * <p> + * The colors can be customized in two ways. The first and simplest is to provide an array of colors + * via {@link #setSelectedIndicatorColors(int...)}. The + * alternative is via the {@link TabColorizer} interface which provides you complete control over + * which color is used for any individual position. + * <p> + * The views used as tabs can be customized by calling {@link #setCustomTabView(int, int)}, + * providing the layout ID of your custom layout. + */ +public class SlidingTabLayout extends HorizontalScrollView { + /** + * Allows complete control over the colors drawn in the tab layout. Set with + * {@link #setCustomTabColorizer(TabColorizer)}. + */ + public interface TabColorizer { + + /** + * @return return the color of the indicator used when {@code position} is selected. + */ + int getIndicatorColor(int position); + + } + + private static final int TITLE_OFFSET_DIPS = 24; + private static final int TAB_VIEW_PADDING_DIPS = 16; + private static final int TAB_VIEW_TEXT_SIZE_SP = 12; + + private int mTitleOffset; + + private int mTabViewLayoutId; + private int mTabViewTextViewId; + private boolean mDistributeEvenly; + + private ViewPager mViewPager; + private SparseArray<String> mContentDescriptions = new SparseArray<String>(); + private ViewPager.OnPageChangeListener mViewPagerPageChangeListener; + + private final SlidingTabStrip mTabStrip; + + public SlidingTabLayout(Context context) { + this(context, null); + } + + public SlidingTabLayout(Context context, AttributeSet attrs) { + this(context, attrs, 0); + } + + public SlidingTabLayout(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + + // Disable the Scroll Bar + setHorizontalScrollBarEnabled(false); + // Make sure that the Tab Strips fills this View + setFillViewport(true); + + mTitleOffset = (int) (TITLE_OFFSET_DIPS * getResources().getDisplayMetrics().density); + + mTabStrip = new SlidingTabStrip(context); + addView(mTabStrip, LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); + } + + /** + * Set the custom {@link TabColorizer} to be used. + * + * If you only require simple custmisation then you can use + * {@link #setSelectedIndicatorColors(int...)} to achieve + * similar effects. + */ + public void setCustomTabColorizer(TabColorizer tabColorizer) { + mTabStrip.setCustomTabColorizer(tabColorizer); + } + + public void setDistributeEvenly(boolean distributeEvenly) { + mDistributeEvenly = distributeEvenly; + } + + /** + * Sets the colors to be used for indicating the selected tab. These colors are treated as a + * circular array. Providing one color will mean that all tabs are indicated with the same color. + */ + public void setSelectedIndicatorColors(int... colors) { + mTabStrip.setSelectedIndicatorColors(colors); + } + + /** + * Set the {@link ViewPager.OnPageChangeListener}. When using {@link SlidingTabLayout} you are + * required to set any {@link ViewPager.OnPageChangeListener} through this method. This is so + * that the layout can update it's scroll position correctly. + * + * @see ViewPager#setOnPageChangeListener(ViewPager.OnPageChangeListener) + */ + public void setOnPageChangeListener(ViewPager.OnPageChangeListener listener) { + mViewPagerPageChangeListener = listener; + } + + /** + * Set the custom layout to be inflated for the tab views. + * + * @param layoutResId Layout id to be inflated + * @param textViewId id of the {@link TextView} in the inflated view + */ + public void setCustomTabView(int layoutResId, int textViewId) { + mTabViewLayoutId = layoutResId; + mTabViewTextViewId = textViewId; + } + + /** + * Sets the associated view pager. Note that the assumption here is that the pager content + * (number of tabs and tab titles) does not change after this call has been made. + */ + public void setViewPager(ViewPager viewPager) { + mTabStrip.removeAllViews(); + + mViewPager = viewPager; + if (viewPager != null) { + viewPager.setOnPageChangeListener(new InternalViewPagerListener()); + populateTabStrip(); + } + } + + /** + * Create a default view to be used for tabs. This is called if a custom tab view is not set via + * {@link #setCustomTabView(int, int)}. + */ + protected TextView createDefaultTabView(Context context) { + TextView textView = new TextView(context); + textView.setGravity(Gravity.CENTER); + textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP); + textView.setTypeface(Typeface.DEFAULT_BOLD); + textView.setLayoutParams(new LinearLayout.LayoutParams( + ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); + + TypedValue outValue = new TypedValue(); + getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, + outValue, true); + textView.setBackgroundResource(outValue.resourceId); + textView.setAllCaps(true); + + int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density); + textView.setPadding(padding, padding, padding, padding); + + return textView; + } + + private void populateTabStrip() { + final PagerAdapter adapter = mViewPager.getAdapter(); + final View.OnClickListener tabClickListener = new TabClickListener(); + + for (int i = 0; i < adapter.getCount(); i++) { + View tabView = null; + TextView tabTitleView = null; + + if (mTabViewLayoutId != 0) { + // If there is a custom tab view layout id set, try and inflate it + tabView = LayoutInflater.from(getContext()).inflate(mTabViewLayoutId, mTabStrip, + false); + tabTitleView = (TextView) tabView.findViewById(mTabViewTextViewId); + } + + if (tabView == null) { + tabView = createDefaultTabView(getContext()); + } + + if (tabTitleView == null && TextView.class.isInstance(tabView)) { + tabTitleView = (TextView) tabView; + } + + if (mDistributeEvenly) { + LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) tabView.getLayoutParams(); + lp.width = 0; + lp.weight = 1; + } + + tabTitleView.setText(adapter.getPageTitle(i)); + tabView.setOnClickListener(tabClickListener); + String desc = mContentDescriptions.get(i, null); + if (desc != null) { + tabView.setContentDescription(desc); + } + + mTabStrip.addView(tabView); + if (i == mViewPager.getCurrentItem()) { + tabView.setSelected(true); + } + } + } + + public void setContentDescription(int i, String desc) { + mContentDescriptions.put(i, desc); + } + + @Override + protected void onAttachedToWindow() { + super.onAttachedToWindow(); + + if (mViewPager != null) { + scrollToTab(mViewPager.getCurrentItem(), 0); + } + } + + private void scrollToTab(int tabIndex, int positionOffset) { + final int tabStripChildCount = mTabStrip.getChildCount(); + if (tabStripChildCount == 0 || tabIndex < 0 || tabIndex >= tabStripChildCount) { + return; + } + + View selectedChild = mTabStrip.getChildAt(tabIndex); + if (selectedChild != null) { + int targetScrollX = selectedChild.getLeft() + positionOffset; + + if (tabIndex > 0 || positionOffset > 0) { + // If we're not at the first child and are mid-scroll, make sure we obey the offset + targetScrollX -= mTitleOffset; + } + + scrollTo(targetScrollX, 0); + } + } + + private class InternalViewPagerListener implements ViewPager.OnPageChangeListener { + private int mScrollState; + + @Override + public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { + int tabStripChildCount = mTabStrip.getChildCount(); + if ((tabStripChildCount == 0) || (position < 0) || (position >= tabStripChildCount)) { + return; + } + + mTabStrip.onViewPagerPageChanged(position, positionOffset); + + View selectedTitle = mTabStrip.getChildAt(position); + int extraOffset = (selectedTitle != null) + ? (int) (positionOffset * selectedTitle.getWidth()) + : 0; + scrollToTab(position, extraOffset); + + if (mViewPagerPageChangeListener != null) { + mViewPagerPageChangeListener.onPageScrolled(position, positionOffset, + positionOffsetPixels); + } + } + + @Override + public void onPageScrollStateChanged(int state) { + mScrollState = state; + + if (mViewPagerPageChangeListener != null) { + mViewPagerPageChangeListener.onPageScrollStateChanged(state); + } + } + + @Override + public void onPageSelected(int position) { + if (mScrollState == ViewPager.SCROLL_STATE_IDLE) { + mTabStrip.onViewPagerPageChanged(position, 0f); + scrollToTab(position, 0); + } + for (int i = 0; i < mTabStrip.getChildCount(); i++) { + mTabStrip.getChildAt(i).setSelected(position == i); + } + if (mViewPagerPageChangeListener != null) { + mViewPagerPageChangeListener.onPageSelected(position); + } + } + + } + + private class TabClickListener implements View.OnClickListener { + @Override + public void onClick(View v) { + for (int i = 0; i < mTabStrip.getChildCount(); i++) { + if (v == mTabStrip.getChildAt(i)) { + mViewPager.setCurrentItem(i); + return; + } + } + } + } + +} diff --git a/app/src/main/java/android/support/iosched/tabs/SlidingTabStrip.java b/app/src/main/java/android/support/iosched/tabs/SlidingTabStrip.java new file mode 100644 index 0000000..7d70992 --- /dev/null +++ b/app/src/main/java/android/support/iosched/tabs/SlidingTabStrip.java @@ -0,0 +1,166 @@ +// imported from https://raw.githubusercontent.com/google/iosched/2531cbdbe27e5795eb78bf47d27e8c1be494aad4/android/src/main/java/com/google/samples/apps/iosched/ui/widget/SlidingTabStrip.java +/* + * Copyright 2014 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.support.iosched.tabs; + +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Paint; +import android.util.AttributeSet; +import android.util.TypedValue; +import android.view.View; +import android.widget.LinearLayout; + +class SlidingTabStrip extends LinearLayout { + + private static final int DEFAULT_BOTTOM_BORDER_THICKNESS_DIPS = 0; + private static final byte DEFAULT_BOTTOM_BORDER_COLOR_ALPHA = 0x26; + private static final int SELECTED_INDICATOR_THICKNESS_DIPS = 3; + private static final int DEFAULT_SELECTED_INDICATOR_COLOR = 0xFF33B5E5; + + private final int mBottomBorderThickness; + private final Paint mBottomBorderPaint; + + private final int mSelectedIndicatorThickness; + private final Paint mSelectedIndicatorPaint; + + private int mSelectedPosition; + private float mSelectionOffset; + + private SlidingTabLayout.TabColorizer mCustomTabColorizer; + private final SimpleTabColorizer mDefaultTabColorizer; + + SlidingTabStrip(Context context) { + this(context, null); + } + + SlidingTabStrip(Context context, AttributeSet attrs) { + super(context, attrs); + setWillNotDraw(false); + + final float density = getResources().getDisplayMetrics().density; + + TypedValue outValue = new TypedValue(); + context.getTheme().resolveAttribute(android.R.attr.colorForeground, outValue, true); + final int themeForegroundColor = outValue.data; + + int defaultBottomBorderColor = setColorAlpha(themeForegroundColor, + DEFAULT_BOTTOM_BORDER_COLOR_ALPHA); + + mDefaultTabColorizer = new SimpleTabColorizer(); + mDefaultTabColorizer.setIndicatorColors(DEFAULT_SELECTED_INDICATOR_COLOR); + + mBottomBorderThickness = (int) (DEFAULT_BOTTOM_BORDER_THICKNESS_DIPS * density); + mBottomBorderPaint = new Paint(); + mBottomBorderPaint.setColor(defaultBottomBorderColor); + + mSelectedIndicatorThickness = (int) (SELECTED_INDICATOR_THICKNESS_DIPS * density); + mSelectedIndicatorPaint = new Paint(); + } + + void setCustomTabColorizer(SlidingTabLayout.TabColorizer customTabColorizer) { + mCustomTabColorizer = customTabColorizer; + invalidate(); + } + + void setSelectedIndicatorColors(int... colors) { + // Make sure that the custom colorizer is removed + mCustomTabColorizer = null; + mDefaultTabColorizer.setIndicatorColors(colors); + invalidate(); + } + + void onViewPagerPageChanged(int position, float positionOffset) { + mSelectedPosition = position; + mSelectionOffset = positionOffset; + invalidate(); + } + + @Override + protected void onDraw(Canvas canvas) { + final int height = getHeight(); + final int childCount = getChildCount(); + final SlidingTabLayout.TabColorizer tabColorizer = mCustomTabColorizer != null + ? mCustomTabColorizer + : mDefaultTabColorizer; + + // Thick colored underline below the current selection + if (childCount > 0) { + View selectedTitle = getChildAt(mSelectedPosition); + int left = selectedTitle.getLeft(); + int right = selectedTitle.getRight(); + int color = tabColorizer.getIndicatorColor(mSelectedPosition); + + if (mSelectionOffset > 0f && mSelectedPosition < (getChildCount() - 1)) { + int nextColor = tabColorizer.getIndicatorColor(mSelectedPosition + 1); + if (color != nextColor) { + color = blendColors(nextColor, color, mSelectionOffset); + } + + // Draw the selection partway between the tabs + View nextTitle = getChildAt(mSelectedPosition + 1); + left = (int) (mSelectionOffset * nextTitle.getLeft() + + (1.0f - mSelectionOffset) * left); + right = (int) (mSelectionOffset * nextTitle.getRight() + + (1.0f - mSelectionOffset) * right); + } + + mSelectedIndicatorPaint.setColor(color); + + canvas.drawRect(left, height - mSelectedIndicatorThickness, right, + height, mSelectedIndicatorPaint); + } + + // Thin underline along the entire bottom edge + canvas.drawRect(0, height - mBottomBorderThickness, getWidth(), height, mBottomBorderPaint); + } + + /** + * Set the alpha value of the {@code color} to be the given {@code alpha} value. + */ + private static int setColorAlpha(int color, byte alpha) { + return Color.argb(alpha, Color.red(color), Color.green(color), Color.blue(color)); + } + + /** + * Blend {@code color1} and {@code color2} using the given ratio. + * + * @param ratio of which to blend. 1.0 will return {@code color1}, 0.5 will give an even blend, + * 0.0 will return {@code color2}. + */ + private static int blendColors(int color1, int color2, float ratio) { + final float inverseRation = 1f - ratio; + float r = (Color.red(color1) * ratio) + (Color.red(color2) * inverseRation); + float g = (Color.green(color1) * ratio) + (Color.green(color2) * inverseRation); + float b = (Color.blue(color1) * ratio) + (Color.blue(color2) * inverseRation); + return Color.rgb((int) r, (int) g, (int) b); + } + + private static class SimpleTabColorizer implements SlidingTabLayout.TabColorizer { + private int[] mIndicatorColors; + + @Override + public final int getIndicatorColor(int position) { + return mIndicatorColors[position % mIndicatorColors.length]; + } + + void setIndicatorColors(int... colors) { + mIndicatorColors = colors; + } + } +} diff --git a/app/src/main/java/android/support/iosched/tabs/VanillaTabLayout.java b/app/src/main/java/android/support/iosched/tabs/VanillaTabLayout.java new file mode 100644 index 0000000..bbf3538 --- /dev/null +++ b/app/src/main/java/android/support/iosched/tabs/VanillaTabLayout.java @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2015-2016 Adrian Ulrich <adrian@blinkenlights.ch> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package android.support.iosched.tabs; + +import android.app.ActionBar; +import android.content.Context; +import android.text.TextUtils; +import android.util.AttributeSet; +import android.widget.TextView; + +/** + * Simple wrapper for SlidingTabLayout which takes + * care of setting sane per-platform defaults + */ +public class VanillaTabLayout extends SlidingTabLayout { + + public VanillaTabLayout(Context context) { + this(context, null); + } + + public VanillaTabLayout(Context context, AttributeSet attrs) { + this(context, attrs, 0); + } + + public VanillaTabLayout(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + setSelectedIndicatorColors(context.getResources().getColor(ch.blinkenlights.android.vanilla.R.color.tabs_active_indicator)); + setDistributeEvenly(false); + } + + /** + * Overrides the default text color + */ + @Override + protected TextView createDefaultTabView(Context context) { + TextView view = super.createDefaultTabView(context); + view.setTextColor(getResources().getColorStateList(ch.blinkenlights.android.vanilla.R.color.tab_text_selector)); + view.setBackgroundResource(ch.blinkenlights.android.vanilla.R.drawable.unbound_ripple_light); + view.setMaxLines(1); + view.setEllipsize(TextUtils.TruncateAt.END); + view.setTextSize(14); + return view; + } + +} diff --git a/app/src/main/java/ch/blinkenlights/android/medialibrary/LibraryObserver.java b/app/src/main/java/ch/blinkenlights/android/medialibrary/LibraryObserver.java new file mode 100644 index 0000000..fc2b1d6 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/medialibrary/LibraryObserver.java @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2018 Adrian Ulrich <adrian@blinkenlights.ch> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package ch.blinkenlights.android.medialibrary; + +/** + * Receives callbacks if the media library changes + */ +public class LibraryObserver { + /** + * Type of the event, to be used as a hint + * by the receiver + */ + public enum Type { + SONG, // Change affected song items. + PLAYLIST, // Change affected playlists. + SCAN_PROGRESS, // Information about an ongoing scan. + } + /** + * Special hint values + */ + public class Value { + public static final int UNKNOWN = -1; // The exact id of the changed object is not know, may have affected all items. + public static final int OUTDATED = -2; // Everything you know is wrong: Cached data must not be used nor trusted. + } + + /** + * Return new LibraryObserver object. + */ + public LibraryObserver() { + } + + /** + * Called if there was a change, expected + * to be overriden by the registered observer. + * + * @param type one of LibraryObserver.Type + * @param id hint of which id changed for type, -1 if unspecified. + * @param ongoing whether or not to expect more events soon. + */ + public void onChange(Type type, long id, boolean ongoing) { + // NOOP, should be overriden. + } +} diff --git a/app/src/main/java/ch/blinkenlights/android/medialibrary/MediaLibrary.java b/app/src/main/java/ch/blinkenlights/android/medialibrary/MediaLibrary.java new file mode 100644 index 0000000..2235e08 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/medialibrary/MediaLibrary.java @@ -0,0 +1,857 @@ +/* + * Copyright (C) 2016-2021 Adrian Ulrich <adrian@blinkenlights.ch> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package ch.blinkenlights.android.medialibrary; + +import android.content.Context; +import android.content.ContentValues; +import android.database.Cursor; +import android.provider.MediaStore; +import android.os.Build; +import android.os.Environment; +import android.util.Log; + +import java.util.ArrayList; +import java.util.HashSet; + +import java.io.ObjectOutputStream; +import java.io.ObjectInputStream; +import java.io.Serializable; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.io.OutputStream; + +public class MediaLibrary { + + public static final String TABLE_SONGS = "songs"; + public static final String TABLE_ALBUMS = "albums"; + public static final String TABLE_CONTRIBUTORS = "contributors"; + public static final String TABLE_CONTRIBUTORS_SONGS = "contributors_songs"; + public static final String TABLE_GENRES = "genres"; + public static final String TABLE_GENRES_SONGS = "genres_songs"; + public static final String TABLE_PLAYLISTS = "playlists"; + public static final String TABLE_PLAYLISTS_SONGS = "playlists_songs"; + public static final String VIEW_ARTISTS = "_artists"; + public static final String VIEW_ALBUMARTISTS = "_albumartists"; + public static final String VIEW_COMPOSERS = "_composers"; + public static final String VIEW_ALBUMS_ARTISTS = "_albums_artists"; + public static final String VIEW_SONGS_ALBUMS_ARTISTS = "_songs_albums_artists"; + public static final String VIEW_SONGS_ALBUMS_ARTISTS_HUGE = "_songs_albums_artists_huge"; + public static final String VIEW_PLAYLISTS = "_playlists"; + public static final String VIEW_PLAYLISTS_SONGS = "_playlists_songs"; + + public static final int ROLE_ARTIST = 0; + public static final int ROLE_COMPOSER = 1; + public static final int ROLE_ALBUMARTIST = 2; + + public static final int SONG_FLAG_OUTDATED = (1 << 0); // entry in library should get rescanned. + public static final int SONG_FLAG_NO_ALBUM = (1 << 1); // file had no real album tag. + public static final int SONG_FLAG_NO_ARTIST = (1 << 2); // file had no real artist tag. + + public static final String PREFERENCES_FILE = "_prefs-v1.obj"; + + /** + * Options used by the MediaScanner class + */ + public static class Preferences implements Serializable { + public boolean forceBastp; + public boolean groupAlbumsByFolder; + public ArrayList<String> mediaFolders; + public ArrayList<String> blacklistedFolders; + int _nativeLibraryCount; + int _nativeLastMtime; + } + + /** + * The progress of a currently scan, if any + * is running + */ + public static class ScanProgress { + public boolean isRunning; + public String lastFile; + public int seen; + public int changed; + public int total; + } + + /** + * Cached preferences, may be null + */ + private static Preferences sPreferences; + /** + * Our static backend instance + */ + private volatile static MediaLibraryBackend sBackend; + /** + * An instance to the created scanner thread during our own creation + */ + private static MediaScanner sScanner; + /** + * The observer to call-back during database changes + */ + private static final ArrayList<LibraryObserver> sLibraryObservers = new ArrayList<LibraryObserver>(2); + /** + * The lock we are using during object creation + */ + private static final Object[] sWait = new Object[0]; + + private static MediaLibraryBackend getBackend(Context context) { + if (sBackend == null) { + // -> unlikely + synchronized(sWait) { + if (sBackend == null) { + sBackend = new MediaLibraryBackend(context.getApplicationContext()); + sScanner = new MediaScanner(context.getApplicationContext(), sBackend); + sScanner.startQuickScan(50); + } + } + } + return sBackend; + } + + /** + * Returns the scanner preferences + * + * @param context the context to use + * @return MediaLibrary.Preferences + */ + public static MediaLibrary.Preferences getPreferences(Context context) { + MediaLibrary.Preferences prefs = sPreferences; + if (prefs == null) { + try (ObjectInputStream ois = new ObjectInputStream(context.openFileInput(PREFERENCES_FILE))) { + prefs = (MediaLibrary.Preferences)ois.readObject(); + } catch (Exception e) { + Log.w("VanillaMusic", "Returning default media-library preferences due to error: "+ e); + } + + if (prefs == null) { + prefs = new MediaLibrary.Preferences(); + prefs.forceBastp = true; // Auto enable for new installations + } + + if (prefs.mediaFolders == null || prefs.mediaFolders.size() == 0) + prefs.mediaFolders = discoverDefaultMediaPaths(context); + + if (prefs.blacklistedFolders == null) // we allow this to be empty, but it must not be null. + prefs.blacklistedFolders = discoverDefaultBlacklistedPaths(context); + + sPreferences = prefs; // cached for frequent access + } + return prefs; + } + + /** + * Returns the guessed media paths for this device + * + * @return array with guessed directories + */ + private static ArrayList<String> discoverDefaultMediaPaths(Context context) { + HashSet<String> defaultPaths = new HashSet<>(); + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + // Running on a platform which enforces scoped access. + // Add the external storage dir by default but also try to guess good external paths. + defaultPaths.add(Environment.getExternalStorageDirectory().getAbsolutePath()); + + for (File file : context.getExternalMediaDirs()) { + // Returns 'null' on some Samsung devices?!. + if (file == null) + continue; + + defaultPaths.add(file.getAbsolutePath()); + // Check if we have access to a subdir which contains the 'Music' folder. + while ( (file = file.getParentFile()) != null) { + File candidate = new File(file, "Music"); + if (candidate.exists() && !defaultPaths.contains(file.getAbsolutePath())) { + defaultPaths.add(candidate.getAbsolutePath()); + break; + } + } + } + } else { + // Try to discover media paths using getExternalMediaDirs() on 5.x and newer + for (File file : context.getExternalMediaDirs()) { + // Seems to happen on some Samsung 5.x devices. :-( + if (file == null) + continue; + + String path = file.getAbsolutePath(); + int match = path.indexOf("/Android/media/"); // From Environment.DIR_ANDROID + Environment.DIR_MEDIA (both hidden) + if (match >= 0) + defaultPaths.add(path.substring(0, match)); + } + } + + // Fall back to old API and some guessing if nothing was found (yet). + if (defaultPaths.size() == 0) { + // this should always exist + defaultPaths.add(Environment.getExternalStorageDirectory().getAbsolutePath()); + // this *may* exist + File sdCard = new File("/storage/sdcard1"); + if (sdCard.isDirectory()) + defaultPaths.add(sdCard.getAbsolutePath()); + } + return new ArrayList<String>(defaultPaths); + } + + /** + * Returns default paths which should be blacklisted + * + * @return array with guessed blacklist + */ + private static ArrayList<String> discoverDefaultBlacklistedPaths(Context context) { + final String[] defaultBlacklistPostfix = { "Android/data", "Android/media", "Alarms", "Notifications", "Ringtones", "media/audio" }; + ArrayList<String> defaultPaths = new ArrayList<>(); + + for (String path : discoverDefaultMediaPaths(context)) { + for (int i = 0; i < defaultBlacklistPostfix.length; i++) { + File guess = new File(path + "/" + defaultBlacklistPostfix[i]); + if (guess.isDirectory()) + defaultPaths.add(guess.getAbsolutePath()); + } + } + return defaultPaths; + } + + /** + * Updates the scanner preferences + * + * @param context the context to use + * @param prefs the preferences to store - this will update ALL fields, so you are + * supposed to first call getPreferences() to obtain the current values + */ + public static void setPreferences(Context context, MediaLibrary.Preferences prefs) { + MediaLibraryBackend backend = getBackend(context); + + try (ObjectOutputStream oos = new ObjectOutputStream(context.openFileOutput(PREFERENCES_FILE, 0))) { + oos.writeObject(prefs); + } catch (Exception e) { + Log.w("VanillaMusic", "Failed to store media preferences: " + e); + } + + sPreferences = prefs; + } + + /** + * Triggers a rescan of the library + * + * @param context the context to use + * @param forceFull starts a full / slow scan if true + * @param drop drop the existing library if true + */ + public static void startLibraryScan(Context context, boolean forceFull, boolean drop) { + MediaLibraryBackend backend = getBackend(context); // also initialized sScanner + if (drop) { + sScanner.flushDatabase(); + } + + if (forceFull) { + sScanner.startFullScan(); + } else { + sScanner.startNormalScan(); + } + } + + /** + * Stops any running scan + * + * @param context the context to use + */ + public static void abortLibraryScan(Context context) { + MediaLibraryBackend backend = getBackend(context); // also initialized sScanner + sScanner.abortScan(); + } + + /** + * Whacky function to get the current scan progress + * + * @param context the context to use + * @return a description of the progress + */ + public static MediaLibrary.ScanProgress describeScanProgress(Context context) { + MediaLibraryBackend backend = getBackend(context); // also initialized sScanner + return sScanner.describeScanProgress(); + } + + /** + * Dumps a copy of the media database to a specified path. + * + * @param context the context to use. + * @param dst the destination path of the db dump. + */ + public static void createDebugDump(Context context, String dst) { + final String src = context.getDatabasePath(MediaLibraryBackend.DATABASE_NAME).getPath(); + try { + try (InputStream in = new FileInputStream(src)) { + try (OutputStream out = new FileOutputStream(dst)) { + byte[] buffer = new byte[4096]; + int len = 0; + while ((len = in.read(buffer)) > 0) { + out.write(buffer, 0, len); + } + } + } + } catch (Exception e) { + Log.v("VanillaMusic", "Debug dump failed: "+e); + } + } + + /** + * Registers a new library observer for the media library + * + * The MediaLibrary will call `onLibraryChanged()` if + * the media library changed. + * + * `ongoing` will be set to `true` if you are expected to receive + * more updates soon. A value of `false` indicates that no + * scan is going on. + * + * @param observer the content observer we are going to call on changes + */ + public static void registerLibraryObserver(LibraryObserver observer) { + if (sLibraryObservers.contains(observer)) + throw new IllegalStateException("LibraryObserver was already registered"); + + sLibraryObservers.add(observer); + } + + /** + * Unregisters a library observer which was previously registered + * by calling registerLibraryObserver(). + * + * @param observer the content observer to unregister. + */ + public static void unregisterLibraryObserver(LibraryObserver observer) { + boolean removed = sLibraryObservers.remove(observer); + + if (!removed) + throw new IllegalArgumentException("This library observer was never registered!"); + } + + /** + * Broadcasts a change to all registered observers + * + * @param type the type of this event. + * @param id the id of type which changed, -1 if unknown + * @param ongoing whether or not to expect more of these updates soon + */ + public static void notifyObserver(LibraryObserver.Type type, long id, boolean ongoing) { + ArrayList<LibraryObserver> list = sLibraryObservers; + for (int i = list.size(); --i != -1; ) + list.get(i).onChange(type, id, ongoing); + } + + /** + * Perform a media query on the database, returns a cursor + * + * @param context the context to use + * @param table the table to query, one of MediaLibrary.TABLE_* + * @param projection the columns to returns in this query + * @param selection the selection (WHERE) to use + * @param selectionArgs arguments for the selection + * @param orderBy how the result should be sorted + */ + public static Cursor queryLibrary(Context context, String table, String[] projection, String selection, String[] selectionArgs, String orderBy) { + return getBackend(context).query(false, table, projection, selection, selectionArgs, null, null, orderBy, null); + } + + /** + * Removes a single song from the database + * + * @param context the context to use + * @param id the song id to delete + * @return the number of affected rows + */ + public static int removeSong(Context context, long id) { + int rows = getBackend(context).delete(TABLE_SONGS, SongColumns._ID+"="+id, null); + + if (rows > 0) { + getBackend(context).cleanOrphanedEntries(true); + notifyObserver(LibraryObserver.Type.SONG, id, false); + notifyObserver(LibraryObserver.Type.PLAYLIST, LibraryObserver.Value.UNKNOWN, false); + } + return rows; + } + + /** + * Updates the play or skipcount of a song + * + * @param context the context to use + * @param id the song id to update + */ + public static void updateSongPlayCounts(Context context, long id, boolean played) { + final String column = played ? MediaLibrary.SongColumns.PLAYCOUNT : MediaLibrary.SongColumns.SKIPCOUNT; + String selection = MediaLibrary.SongColumns._ID+"="+id; + getBackend(context).execSQL("UPDATE "+MediaLibrary.TABLE_SONGS+" SET "+column+"="+column+"+1 WHERE "+selection); + } + + /** + * Creates a new empty playlist + * + * @param context the context to use + * @param name the name of the new playlist + * @return long the id of the created playlist, -1 on error + */ + public static long createPlaylist(Context context, String name) { + ContentValues v = new ContentValues(); + v.put(MediaLibrary.PlaylistColumns._ID, hash63(name)); + v.put(MediaLibrary.PlaylistColumns.NAME, name); + v.put(MediaLibrary.PlaylistColumns.NAME_SORT, keyFor(name)); + long id = getBackend(context).insert(MediaLibrary.TABLE_PLAYLISTS, null, v); + + if (id != -1) + notifyObserver(LibraryObserver.Type.PLAYLIST, id, false); + return id; + } + + /** + * Deletes a playlist and all of its child elements + * + * @param context the context to use + * @param id the playlist id to delete + * @return boolean true if the playlist was deleted + */ + public static boolean removePlaylist(Context context, long id) { + // first, wipe all songs + removeFromPlaylist(context, MediaLibrary.PlaylistSongColumns.PLAYLIST_ID+"="+id, null); + int rows = getBackend(context).delete(MediaLibrary.TABLE_PLAYLISTS, MediaLibrary.PlaylistColumns._ID+"="+id, null); + boolean removed = (rows > 0); + + if (removed) + notifyObserver(LibraryObserver.Type.PLAYLIST, id, false); + return removed; + } + + /** + * Adds a batch of songs to a playlist + * + * @param context the context to use + * @param playlistId the id of the playlist parent + * @param ids an array list with the song ids to insert + * @return the number of added items + */ + public static int addToPlaylist(Context context, long playlistId, ArrayList<Long> ids) { + long pos = 0; + // First we need to get the position of the last item + String[] projection = { MediaLibrary.PlaylistSongColumns.POSITION }; + String selection = MediaLibrary.PlaylistSongColumns.PLAYLIST_ID+"="+playlistId; + String order = MediaLibrary.PlaylistSongColumns.POSITION+" DESC"; + Cursor cursor = queryLibrary(context, MediaLibrary.TABLE_PLAYLISTS_SONGS, projection, selection, null, order); + if (cursor.moveToFirst()) + pos = cursor.getLong(0) + 1; + cursor.close(); + + ArrayList<ContentValues> bulk = new ArrayList<>(); + for (Long id : ids) { + if (getBackend(context).getColumnFromSongId(MediaLibrary.SongColumns.MTIME, id) == 0) // no mtime? song does not exist. + continue; + + ContentValues v = new ContentValues(); + v.put(MediaLibrary.PlaylistSongColumns.PLAYLIST_ID, playlistId); + v.put(MediaLibrary.PlaylistSongColumns.SONG_ID, id); + v.put(MediaLibrary.PlaylistSongColumns.POSITION, pos); + bulk.add(v); + pos++; + } + int rows = getBackend(context).bulkInsert(MediaLibrary.TABLE_PLAYLISTS_SONGS, null, bulk); + + if (rows > 0) + notifyObserver(LibraryObserver.Type.PLAYLIST, playlistId, false); + return rows; + } + + /** + * Removes a set of items from a playlist + * + * @param context the context to use + * @param selection the selection for the items to drop + * @param selectionArgs arguments for `selection' + * @return the number of deleted rows, -1 on error + */ + public static int removeFromPlaylist(Context context, String selection, String[] selectionArgs) { + // Grab the list of affected playlist id's before performing a delete. + // These are needed for the observer notification. + ArrayList<Long> playlists = new ArrayList<>(); + String[] projection = { "DISTINCT("+MediaLibrary.PlaylistSongColumns.PLAYLIST_ID+")" }; + Cursor cursor = queryLibrary(context, MediaLibrary.TABLE_PLAYLISTS_SONGS, projection, selection, selectionArgs, null); + while(cursor.moveToNext()) { + playlists.add(cursor.getLong(0)); + } + cursor.close(); + + int affected = 0; + if (playlists.size() > 0) { + affected = getBackend(context).delete(MediaLibrary.TABLE_PLAYLISTS_SONGS, selection, selectionArgs); + for (long id : playlists) { + notifyObserver(LibraryObserver.Type.PLAYLIST, id, false); + } + } + + return affected; + } + + /** + * Renames an existing playlist + * + * @param context the context to use + * @param playlistId the id of the playlist to rename + * @param newName the new name of the playlist + * @return the id of the new playlist, -1 on error + */ + public static long renamePlaylist(Context context, long playlistId, String newName) { + long newId = createPlaylist(context, newName); + if (newId >= 0) { + String selection = MediaLibrary.PlaylistSongColumns.PLAYLIST_ID+"="+playlistId; + ContentValues v = new ContentValues(); + v.put(MediaLibrary.PlaylistSongColumns.PLAYLIST_ID, newId); + getBackend(context).update(MediaLibrary.TABLE_PLAYLISTS_SONGS, v, selection, null); + removePlaylist(context, playlistId); + } + + if (newId != -1) { + notifyObserver(LibraryObserver.Type.PLAYLIST, playlistId, false); + notifyObserver(LibraryObserver.Type.PLAYLIST, newId, false); + } + return newId; + } + + /** + * Moves an item in a playlist. Note: both items should be in the + * same playlist - 'fun things' will happen otherwise. + * + * @param context the context to use + * @param from the _id of the 'dragged' element + * @param to the _id of the 'repressed' element + */ + public static void movePlaylistItem(Context context, long from, long to) { + long fromPos, toPos, playlistId; + + String[] projection = { MediaLibrary.PlaylistSongColumns.POSITION, MediaLibrary.PlaylistSongColumns.PLAYLIST_ID }; + String selection = MediaLibrary.PlaylistSongColumns._ID+"="; + + // Get playlist id and position of the 'from' item + Cursor cursor = queryLibrary(context, MediaLibrary.TABLE_PLAYLISTS_SONGS, projection, selection+Long.toString(from), null, null); + cursor.moveToFirst(); + fromPos = cursor.getLong(0); + playlistId = cursor.getLong(1); + cursor.close(); + + // Get position of the target item + cursor = queryLibrary(context, MediaLibrary.TABLE_PLAYLISTS_SONGS, projection, selection+Long.toString(to), null, null); + cursor.moveToFirst(); + toPos = cursor.getLong(0); + cursor.close(); + + // Moving down -> We actually want to be below the target + if (toPos > fromPos) + toPos++; + + // shift all rows +1 + String setArg = MediaLibrary.PlaylistSongColumns.POSITION+"="+MediaLibrary.PlaylistSongColumns.POSITION+"+1"; + selection = MediaLibrary.PlaylistSongColumns.PLAYLIST_ID+"="+playlistId+" AND "+MediaLibrary.PlaylistSongColumns.POSITION+" >= "+toPos; + getBackend(context).execSQL("UPDATE "+MediaLibrary.TABLE_PLAYLISTS_SONGS+" SET "+setArg+" WHERE "+selection); + + ContentValues v = new ContentValues(); + v.put(MediaLibrary.PlaylistSongColumns.POSITION, toPos); + selection = MediaLibrary.PlaylistSongColumns._ID+"="+from; + getBackend(context).update(MediaLibrary.TABLE_PLAYLISTS_SONGS, v, selection, null); + + notifyObserver(LibraryObserver.Type.PLAYLIST, playlistId, false); + } + + /** + * Returns the number of songs in the music library + * + * @param context the context to use + * @return the number of songs + */ + public static int getLibrarySize(Context context) { + int count = 0; + Cursor cursor = queryLibrary(context, TABLE_SONGS, new String[]{"count(*)"}, null, null, null); + if (cursor.moveToFirst()) + count = cursor.getInt(0); + cursor.close(); + return count; + } + + /** + * Returns the 'key' of given string used for sorting and searching + * + * @param name the string to convert + * @return the the key of given name + */ + public static String keyFor(String name) { + return MediaStore.Audio.keyFor(name); + } + + /** + * Simple 63 bit hash function for strings + * + * @param str the string to hash + * @return a positive long + */ + public static long hash63(String str) { + if (str == null) + return 0; + + long hash = 0; + int len = str.length(); + for (int i = 0; i < len ; i++) { + hash = 31*hash + str.charAt(i); + } + return (hash < 0 ? hash*-1 : hash); + } + + // Columns of Song entries + public interface SongColumns { + /** + * The id of this song in the database + */ + String _ID = "_id"; + /** + * The title of this song + */ + String TITLE = "title"; + /** + * The sortable title of this song + */ + String TITLE_SORT = "title_sort"; + /** + * The position in the album of this song + */ + String SONG_NUMBER = "song_num"; + /** + * The disc in a multi-disc album containing this song + */ + String DISC_NUMBER = "disc_num"; + /** + * The album where this song belongs to + */ + String ALBUM_ID = "album_id"; + /** + * The year of this song + */ + String YEAR = "year"; + /** + * How often the song was played + */ + String PLAYCOUNT = "playcount"; + /** + * How often the song was skipped + */ + String SKIPCOUNT = "skipcount"; + /** + * The duration of this song + */ + String DURATION = "duration"; + /** + * The path to the music file + */ + String PATH = "path"; + /** + * The mtime of this item + */ + String MTIME = "mtime"; + /** + * Various flags of this entry, see SONG_FLAG... + */ + String FLAGS = "_flags"; + } + + // Columns of Album entries + public interface AlbumColumns { + /** + * The id of this album in the database + */ + String _ID = SongColumns._ID; + /** + * The title of this album + */ + String ALBUM = "album"; + /** + * The sortable title of this album + */ + String ALBUM_SORT = "album_sort"; + /** + * The primary contributor / artist reference for this album + */ + String PRIMARY_ARTIST_ID = "primary_artist_id"; + /** + * The year of this album + */ + String PRIMARY_ALBUM_YEAR = "primary_album_year"; + /** + * The mtime of this item + */ + String MTIME = "mtime"; + } + + // Columns of Contributors entries + public interface ContributorColumns { + /** + * The id of this contributor + */ + String _ID = SongColumns._ID; + /** + * The name of this contributor + */ + String _CONTRIBUTOR = "_contributor"; + /** + * The sortable title of this contributor + */ + String _CONTRIBUTOR_SORT = "_contributor_sort"; + /** + * The mtime of this item + */ + String MTIME = "mtime"; + + /** + * ONLY IN VIEWS - the artist + */ + String ARTIST = "artist"; + /** + * ONLY IN VIEWS - the artist_sort key + */ + String ARTIST_SORT = "artist_sort"; + /** + * ONLY IN VIEWS - the artist id + */ + String ARTIST_ID = "artist_id"; + + /** + * ONLY IN VIEWS - the albumartist + */ + String ALBUMARTIST = "albumartist"; + /** + * ONLY IN VIEWS - the albumartist_sort key + */ + String ALBUMARTIST_SORT = "albumartist_sort"; + /** + * ONLY IN VIEWS - the albumartist id + */ + String ALBUMARTIST_ID = "albumartist_id"; + + /** + * ONLY IN VIEWS - the composer + */ + String COMPOSER = "composer"; + /** + * ONLY IN VIEWS - the composer_sort key + */ + String COMPOSER_SORT = "composer_sort"; + /** + * ONLY IN VIEWS - the composer id + */ + String COMPOSER_ID = "composer_id"; + + } + + // Songs <-> Contributor mapping + public interface ContributorSongColumns { + /** + * The role of this entry + */ + String ROLE = "role"; + /** + * the contirbutor id this maps to + */ + String _CONTRIBUTOR_ID = "_contributor_id"; + /** + * the song this maps to + */ + String SONG_ID = "song_id"; + } + + // Columns of Genres entries + public interface GenreColumns { + /** + * The id of this genre + */ + String _ID = SongColumns._ID; + /** + * The name of this genre + */ + String _GENRE = "_genre"; + /** + * The sortable title of this genre + */ + String _GENRE_SORT = "_genre_sort"; + } + + // Songs <-> Contributor mapping + public interface GenreSongColumns { + /** + * the genre id this maps to + */ + String _GENRE_ID = "_genre_id"; + /** + * the song this maps to + */ + String SONG_ID = "song_id"; + } + + // Playlists + public interface PlaylistColumns { + /** + * The id of this playlist + */ + String _ID = SongColumns._ID; + /** + * The name of this playlist + */ + String NAME = "name"; + /** + * Sortable column for name + */ + String NAME_SORT = "name_sort"; + } + + // Song <-> Playlist mapping + public interface PlaylistSongColumns { + /** + * The ID of this entry + */ + String _ID = SongColumns._ID; + /** + * The playlist this entry belongs to + */ + String PLAYLIST_ID = "playlist_id"; + /** + * The song this entry references to + */ + String SONG_ID = "song_id"; + /** + * The order attribute + */ + String POSITION = "position"; + } + + // Preference keys + public interface PreferenceColumns { + /** + * The key of this preference + */ + String KEY = "key"; + /** + * The value of this preference + */ + String VALUE = "value"; + } +} diff --git a/app/src/main/java/ch/blinkenlights/android/medialibrary/MediaLibraryBackend.java b/app/src/main/java/ch/blinkenlights/android/medialibrary/MediaLibraryBackend.java new file mode 100644 index 0000000..3e1f0f2 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/medialibrary/MediaLibraryBackend.java @@ -0,0 +1,400 @@ +/* + * Copyright (C) 2016-2018 Adrian Ulrich <adrian@blinkenlights.ch> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package ch.blinkenlights.android.medialibrary; + +import android.content.Context; +import android.content.ContentValues; +import android.database.sqlite.SQLiteDatabase; +import android.database.sqlite.SQLiteOpenHelper; +import android.database.Cursor; +import android.util.Log; +import java.util.ArrayList; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class MediaLibraryBackend extends SQLiteOpenHelper { + /** + * Enables or disables debugging + */ + private static final boolean DEBUG = false; + /** + * The database version we are using + */ + private static final int DATABASE_VERSION = 20190210; + /** + * on-disk file to store the database + */ + static final String DATABASE_NAME = "media-library.db"; + /** + * The magic mtime to use for songs which are in PENDING_DELETION state. + * This is NOT 0 as the mtime is always expected to be > 0 for existing rows + */ + private static final int PENDING_DELETION_MTIME = 1; + /** + * Regexp to detect genre queries which we can optimize + */ + private static final Pattern sQueryMatchGenreSearch = Pattern.compile("(^|.+ )"+MediaLibrary.GenreSongColumns._GENRE_ID+"=(\\d+)$"); + /** + * Regexp to detect costy artist_id queries which we can optimize + */ + private static final Pattern sQueryMatchArtistSearch = Pattern.compile("(^|.+ )"+MediaLibrary.ContributorColumns.ARTIST_ID+"=(\\d+)$"); + /** + * Regexp to detect costy albumartist_id queries which we can optimize + */ + private static final Pattern sQueryMatchAlbArtistSearch = Pattern.compile("(^|.+ )"+MediaLibrary.ContributorColumns.ALBUMARTIST_ID+"=(\\d+)$"); + /** + * Regexp to detect costy composer_id queries which we can optimize + */ + private static final Pattern sQueryMatchComposerSearch = Pattern.compile("(^|.+ )"+MediaLibrary.ContributorColumns.COMPOSER_ID+"=(\\d+)$"); + + /** + * Constructor for the MediaLibraryBackend helper + * + * @param context the context to use + */ + MediaLibraryBackend(Context context) { + super(context, DATABASE_NAME, null, DATABASE_VERSION); + } + + /** + * Called when database does not exist + * + * @param dbh the writeable database handle + */ + @Override + public void onCreate(SQLiteDatabase dbh) { + MediaSchema.createDatabaseSchema(dbh); + } + + /** + * Called when the existing database + * schema is outdated + * + * @param dbh the writeable database handle + * @param oldVersion the current version in use + * @param newVersion the target version + */ + @Override + public void onUpgrade(SQLiteDatabase dbh, int oldVersion, int newVersion) { + MediaSchema.upgradeDatabaseSchema(dbh, oldVersion); + } + + /** + * Returns the `long' value stored in the column of the given id. + * + * @param column the column to return of `id' + * @param id the song id to query + * @return the value of `column' + */ + long getColumnFromSongId(String column, long id) { + long mtime = 0; + Cursor cursor = query(false, MediaLibrary.TABLE_SONGS, new String[]{ column }, MediaLibrary.SongColumns._ID+"="+Long.toString(id), null, null, null, null, "1"); + if (cursor.moveToFirst()) + mtime = cursor.getLong(0); + cursor.close(); + return mtime; + } + + /** + * Wrapper for SQLiteDatabse.delete() function + * + * @param table the table to delete data from + * @param whereClause the selection + * @param whereArgs arguments to selection + * @return the number of affected rows + */ + int delete(String table, String whereClause, String[] whereArgs) { + SQLiteDatabase dbh = getWritableDatabase(); + return dbh.delete(table, whereClause, whereArgs); + } + + /** + * Wrapper for SQLiteDatabase.update() function + * + * @param table the table to update + * @param values the data to set / modify + * @param whereClause the selection + * @param whereArgs arguments to selection + * @return the number of affected rows + */ + int update (String table, ContentValues values, String whereClause, String[] whereArgs) { + SQLiteDatabase dbh = getWritableDatabase(); + return dbh.update(table, values, whereClause, whereArgs); + } + + /** + * Wrapper for SQLiteDatabase.execSQL() function + * + * @param sql the raw sql string + */ + void execSQL(String sql) { + getWritableDatabase().execSQL(sql); + } + + /** + * Wrapper for SQLiteDatabase.insert() function + * + * @param table the table to insert data to + * @param nullColumnHack android hackery (see SQLiteDatabase documentation) + * @param values the values to insert + */ + long insert (String table, String nullColumnHack, ContentValues values) { + long result = -1; + try { + result = getWritableDatabase().insertOrThrow(table, nullColumnHack, values); + } catch (Exception e) { + // avoid logspam as done by insert() + } + + return result; + } + + /** + * Marks all songs as 'deleteable' - but doesn't delete them yet. + * Calling cleanOrphanedEntries() would take care of the actual deletion. + * This is a hacky way to get rid of all songs that a scan didn't touch. + */ + void setPendingDeletion() { + SQLiteDatabase dbh = getWritableDatabase(); + dbh.execSQL("UPDATE "+MediaLibrary.TABLE_SONGS+" SET "+MediaLibrary.SongColumns.MTIME+"="+PENDING_DELETION_MTIME); + } + + /** + * Purges orphaned entries from the media library + * + * @param fullCleanup also remove orphaned playlist entries and songs marked for deletion. + */ + void cleanOrphanedEntries(boolean fullCleanup) { + SQLiteDatabase dbh = getWritableDatabase(); + + // Remove all songs which are marked for deletion and playlist orphaned playlist entries. + if (fullCleanup) { + dbh.execSQL("DELETE FROM "+MediaLibrary.TABLE_SONGS+" WHERE "+MediaLibrary.SongColumns.MTIME+"="+PENDING_DELETION_MTIME); + dbh.execSQL("DELETE FROM "+MediaLibrary.TABLE_PLAYLISTS_SONGS+" WHERE "+MediaLibrary.PlaylistSongColumns.SONG_ID+" NOT IN (SELECT "+MediaLibrary.SongColumns._ID+" FROM "+MediaLibrary.TABLE_SONGS+");"); + } + + // And remove any orphaned references. + dbh.execSQL("DELETE FROM "+MediaLibrary.TABLE_ALBUMS+" WHERE "+MediaLibrary.AlbumColumns._ID+" NOT IN (SELECT "+MediaLibrary.SongColumns.ALBUM_ID+" FROM "+MediaLibrary.TABLE_SONGS+");"); + dbh.execSQL("DELETE FROM "+MediaLibrary.TABLE_GENRES_SONGS+" WHERE "+MediaLibrary.GenreSongColumns.SONG_ID+" NOT IN (SELECT "+MediaLibrary.SongColumns._ID+" FROM "+MediaLibrary.TABLE_SONGS+");"); + dbh.execSQL("DELETE FROM "+MediaLibrary.TABLE_GENRES+" WHERE "+MediaLibrary.GenreColumns._ID+" NOT IN (SELECT "+MediaLibrary.GenreSongColumns._GENRE_ID+" FROM "+MediaLibrary.TABLE_GENRES_SONGS+");"); + dbh.execSQL("DELETE FROM "+MediaLibrary.TABLE_CONTRIBUTORS_SONGS+" WHERE "+MediaLibrary.ContributorSongColumns.SONG_ID+" NOT IN (SELECT "+MediaLibrary.SongColumns._ID+" FROM "+MediaLibrary.TABLE_SONGS+");"); + dbh.execSQL("DELETE FROM "+MediaLibrary.TABLE_CONTRIBUTORS+" WHERE "+MediaLibrary.ContributorColumns._ID+" NOT IN (SELECT "+MediaLibrary.ContributorSongColumns._CONTRIBUTOR_ID+" FROM "+MediaLibrary.TABLE_CONTRIBUTORS_SONGS+");"); + } + + /** + * Wrapper for SQLiteDatabase.insert() function working in one transaction + * + * @param table the table to insert data to + * @param nullColumnHack android hackery (see SQLiteDatabase documentation) + * @param valuesList an array list of ContentValues to insert + * @return the number of inserted rows + */ + int bulkInsert (String table, String nullColumnHack, ArrayList<ContentValues> valuesList) { + SQLiteDatabase dbh = getWritableDatabase(); + + int count = 0; + + dbh.beginTransactionNonExclusive(); + try { + for(ContentValues values : valuesList) { + try { + long result = dbh.insertOrThrow(table, nullColumnHack, values); + if (result > 0) + count++; + } catch (Exception e) { + // avoid logspam + } + } + dbh.setTransactionSuccessful(); + } finally { + dbh.endTransaction(); + } + + return count; + } + + /** + * Wrappr for SQLiteDatabase.query() function + */ + Cursor query (boolean distinct, String table, String[] columns, String selection, String[] selectionArgs, String groupBy, String having, String orderBy, String limit) { + + if (MediaLibrary.VIEW_SONGS_ALBUMS_ARTISTS_HUGE.equals(table)) { + Log.v("VanillaMusic", "+++ warning : using HUGE table in genquery!"); + } + + if (selection != null) { + if (MediaLibrary.VIEW_SONGS_ALBUMS_ARTISTS.equals(table)) { + // artist matches in the song-view are costy: try to give sqlite a hint + String[] contributorMatch = extractVirtualColumn(selection); + if (contributorMatch != null) { + selection = contributorMatch[0]; + final String contributorId = contributorMatch[1]; + final String contributorRole = contributorMatch[2]; + + selection += MediaLibrary.SongColumns._ID+" IN (SELECT "+MediaLibrary.ContributorSongColumns.SONG_ID+" FROM "+MediaLibrary.TABLE_CONTRIBUTORS_SONGS+" WHERE " + + MediaLibrary.ContributorSongColumns.ROLE+"="+contributorRole+" AND "+MediaLibrary.ContributorSongColumns._CONTRIBUTOR_ID+"="+contributorId+")"; + } + } + + if (MediaLibrary.VIEW_ALBUMS_ARTISTS.equals(table)) { + // looking up artists by albums will magically return every album where this + // artist has at least one item (while still using the primary_artist_id as the artist key) + String[] contributorMatch = extractVirtualColumn(selection); + if (contributorMatch != null) { + selection = contributorMatch[0]; + final String contributorId = contributorMatch[1]; + final String contributorRole = contributorMatch[2]; + + selection += MediaLibrary.SongColumns._ID+" IN (SELECT DISTINCT "+MediaLibrary.SongColumns.ALBUM_ID+" FROM "+MediaLibrary.TABLE_SONGS+" WHERE " + + MediaLibrary.SongColumns._ID+" IN (SELECT "+MediaLibrary.ContributorSongColumns.SONG_ID+" FROM "+MediaLibrary.TABLE_CONTRIBUTORS_SONGS+" WHERE " + + MediaLibrary.ContributorSongColumns.ROLE+"="+contributorRole+" AND "+MediaLibrary.ContributorSongColumns._CONTRIBUTOR_ID+"="+contributorId+"))"; + } + } + + // Genre queries are a special beast: 'optimize' all of them + Matcher genreMatch = sQueryMatchGenreSearch.matcher(selection); + if (genreMatch.matches()) { + selection = genreMatch.group(1); // keep the non-genre search part of the query + final String genreId = genreMatch.group(2); // and extract the searched genre id + final String songsQuery = buildSongIdFromGenreSelect(genreId); + + if(table.equals(MediaLibrary.VIEW_SONGS_ALBUMS_ARTISTS) || + table.equals(MediaLibrary.VIEW_SONGS_ALBUMS_ARTISTS_HUGE) ) { + selection += MediaLibrary.SongColumns._ID+" IN ("+songsQuery+") "; + } + + if (table.equals(MediaLibrary.VIEW_ALBUMS_ARTISTS)) { + selection += MediaLibrary.AlbumColumns._ID+" IN ("+ + buildSongIdFromGenreSelect(MediaLibrary.SongColumns.ALBUM_ID, MediaLibrary.VIEW_SONGS_ALBUMS_ARTISTS, songsQuery)+") "; + } + + if (table.equals(MediaLibrary.VIEW_ARTISTS)) { + selection += MediaLibrary.ContributorColumns.ARTIST_ID+" IN ("+ + buildSongIdFromGenreSelect(MediaLibrary.ContributorColumns.ARTIST_ID, MediaLibrary.VIEW_SONGS_ALBUMS_ARTISTS, songsQuery)+") "; + } + + if (table.equals(MediaLibrary.VIEW_ALBUMARTISTS)) { + selection += MediaLibrary.ContributorColumns.ALBUMARTIST_ID+" IN ("+ + buildSongIdFromGenreSelect(MediaLibrary.ContributorColumns.ALBUMARTIST_ID, MediaLibrary.VIEW_SONGS_ALBUMS_ARTISTS_HUGE, songsQuery)+") "; + Log.v("VanillaMusic", "+++ warning: huge genrequery for albumartist!"); + } + + if (table.equals(MediaLibrary.VIEW_COMPOSERS)) { + selection += MediaLibrary.ContributorColumns.COMPOSER_ID+" IN ("+ + buildSongIdFromGenreSelect(MediaLibrary.ContributorColumns.COMPOSER_ID, MediaLibrary.VIEW_SONGS_ALBUMS_ARTISTS_HUGE, songsQuery)+") "; + Log.v("VanillaMusic", "+++ warning: huge genrequery composer!"); + } + + } + } + + if (DEBUG) + debugQuery(distinct, table, columns, selection, selectionArgs, groupBy, having, orderBy, limit); + + Cursor cursor = getReadableDatabase().query(distinct, table, columns, selection, selectionArgs, groupBy, having, orderBy, limit); + if (cursor != null) { + // Hold on! This is not some kind of black magic - it makes '''sense''': + // SQLites count() performance is pretty poor, but most queries will call getCount() during their + // lifetime anyway - unfortunately this might happen in the main thread, causing some lag. + // Androids SQLite class caches the result of getCount() calls, so we are going to run it + // here as we are (hopefully!) in a background thread anyway. + cursor.getCount(); + } + return cursor; + } + + /** + * Detects queries for artists, composers and albumartists and returns the + * role of the contributor. + * + * @param sql the raw sql query + * @return String[]{ sql-part, contributor-id, contributor-role } + */ + private String[] extractVirtualColumn(String sql) { + final Pattern[] pattern = new Pattern[]{ sQueryMatchArtistSearch, sQueryMatchComposerSearch, sQueryMatchAlbArtistSearch }; + final int[] roles = { MediaLibrary.ROLE_ARTIST, MediaLibrary.ROLE_COMPOSER, MediaLibrary.ROLE_ALBUMARTIST }; + + for (int i=0; i < roles.length; i++) { + Matcher matcher = pattern[i].matcher(sql); + if (matcher.matches()) { + return new String[]{ matcher.group(1), matcher.group(2), String.format("%d", roles[i]) }; + } + } + return null; + } + + /** + * Returns a select query to get all songs from a genre + * + * @param genreId the id to query as a string + * @return an SQL string which should return song id's for the queried genre + */ + private String buildSongIdFromGenreSelect(String genreId) { + return "SELECT "+MediaLibrary.GenreSongColumns.SONG_ID+" FROM "+MediaLibrary.TABLE_GENRES_SONGS+" WHERE " + +MediaLibrary.GenreSongColumns._GENRE_ID+"="+genreId+" GROUP BY "+MediaLibrary.GenreSongColumns.SONG_ID; + } + + /** + * Returns a select query to get artists or albums from a genre + * + * @param target the target to query + * @param table the table to query + * @param genreSelect the select string generated by buildSongIdFromGenreSelect + * @return an SQL string + */ + private String buildSongIdFromGenreSelect(String target, String table, String genreSelect) { + return "SELECT "+target+" FROM "+ table +" WHERE " + +MediaLibrary.SongColumns._ID+" IN ("+genreSelect+") GROUP BY "+target; + } + + /** + * Debug function to print and benchmark queries + */ + private void debugQuery(boolean distinct, String table, String[] columns, String selection, String[] selectionArgs, String groupBy, String having, String orderBy, String limit) { + final String LT = "VanillaMusicSQL"; + Log.v(LT, "---- start query ---"); + Log.v(LT, "SELECT"); + for (String c : columns) { + Log.v(LT, " "+c); + } + Log.v(LT, "FROM "+table+" WHERE "+selection+" "); + if (selectionArgs != null) { + Log.v(LT, " /* with args: "); + for (String a : selectionArgs) { + Log.v(LT, a+", "); + } + Log.v(LT, " */"); + } + Log.v(LT, " GROUP BY "+groupBy+" HAVING "+having+" ORDER BY "+orderBy+" LIMIT "+limit); + + Log.v(LT, "DBH = "+getReadableDatabase()); + + Cursor dryRun = getReadableDatabase().query(distinct, table, columns, selection, selectionArgs, groupBy, having, orderBy, limit); + long results = 0; + long startAt = System.currentTimeMillis(); + if (dryRun != null) { + while(dryRun.moveToNext()) { + results++; + } + dryRun.close(); + } + long tookMs = System.currentTimeMillis() - startAt; + Log.v(LT, "--- finished in "+tookMs+" ms with count="+results); + } + +} diff --git a/app/src/main/java/ch/blinkenlights/android/medialibrary/MediaMetadataExtractor.java b/app/src/main/java/ch/blinkenlights/android/medialibrary/MediaMetadataExtractor.java new file mode 100644 index 0000000..109ff8d --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/medialibrary/MediaMetadataExtractor.java @@ -0,0 +1,508 @@ +/* + * Copyright (C) 2016 - 2022 Adrian Ulrich <adrian@blinkenlights.ch> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package ch.blinkenlights.android.medialibrary; + +import ch.blinkenlights.bastp.Bastp; +import android.media.MediaMetadataRetriever; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import java.io.FileInputStream; +import java.io.IOException; + +import android.util.Log; +public class MediaMetadataExtractor extends HashMap<String, ArrayList<String>> { + // Well known tags + public final static String ALBUM = "ALBUM"; + public final static String ALBUMARTIST = "ALBUM_ARTIST"; + public final static String ARTIST = "ARTIST"; + public final static String BITRATE = "BITRATE"; + public final static String COMPOSER = "COMPOSER"; + public final static String DISC_COUNT = "DISC_COUNT"; + public final static String DISC_NUMBER = "DISC_NUMBER"; + public final static String DURATION = "DURATION"; + public final static String GENRE = "GENRE"; + public final static String MIME_TYPE = "MIME"; + public final static String TRACK_COUNT = "TRACK_COUNT"; + public final static String TRACK_NUMBER = "TRACK_NUM"; + public final static String TITLE = "TITLE"; + public final static String YEAR = "YEAR"; + + /** + * Regexp used to match a year in a date field + */ + private static final Pattern sFilterYear = Pattern.compile(".*(\\d{4}).*"); + /** + * Regexp matching the first lefthand integer + */ + private static final Pattern sFilterLeftInt = Pattern.compile("^0*(\\d+).*$"); + /** + * Regexp matching anything + */ + private static final Pattern sFilterAny = Pattern.compile("^([\\s\\S]*)$"); + /** + * Regexp matching possible genres + */ + private static final Pattern sFilterGenre = Pattern.compile("^\\s*\\(?(\\d+)\\)?\\s*$"); + /** + * Genres as defined by androids own MediaScanner.java + */ + private static final String[] ID3_GENRES = { + "Blues", + "Classic Rock", + "Country", + "Dance", + "Disco", + "Funk", + "Grunge", + "Hip-Hop", + "Jazz", + "Metal", + "New Age", + "Oldies", + "Other", + "Pop", + "R&B", + "Rap", + "Reggae", + "Rock", + "Techno", + "Industrial", + "Alternative", + "Ska", + "Death Metal", + "Pranks", + "Soundtrack", + "Euro-Techno", + "Ambient", + "Trip-Hop", + "Vocal", + "Jazz+Funk", + "Fusion", + "Trance", + "Classical", + "Instrumental", + "Acid", + "House", + "Game", + "Sound Clip", + "Gospel", + "Noise", + "AlternRock", + "Bass", + "Soul", + "Punk", + "Space", + "Meditative", + "Instrumental Pop", + "Instrumental Rock", + "Ethnic", + "Gothic", + "Darkwave", + "Techno-Industrial", + "Electronic", + "Pop-Folk", + "Eurodance", + "Dream", + "Southern Rock", + "Comedy", + "Cult", + "Gangsta", + "Top 40", + "Christian Rap", + "Pop/Funk", + "Jungle", + "Native American", + "Cabaret", + "New Wave", + "Psychadelic", + "Rave", + "Showtunes", + "Trailer", + "Lo-Fi", + "Tribal", + "Acid Punk", + "Acid Jazz", + "Polka", + "Retro", + "Musical", + "Rock & Roll", + "Hard Rock", + // The following genres are Winamp extensions + "Folk", + "Folk-Rock", + "National Folk", + "Swing", + "Fast Fusion", + "Bebob", + "Latin", + "Revival", + "Celtic", + "Bluegrass", + "Avantgarde", + "Gothic Rock", + "Progressive Rock", + "Psychedelic Rock", + "Symphonic Rock", + "Slow Rock", + "Big Band", + "Chorus", + "Easy Listening", + "Acoustic", + "Humour", + "Speech", + "Chanson", + "Opera", + "Chamber Music", + "Sonata", + "Symphony", + "Booty Bass", + "Primus", + "Porn Groove", + "Satire", + "Slow Jam", + "Club", + "Tango", + "Samba", + "Folklore", + "Ballad", + "Power Ballad", + "Rhythmic Soul", + "Freestyle", + "Duet", + "Punk Rock", + "Drum Solo", + "A capella", + "Euro-House", + "Dance Hall", + "Goa", + "Drum & Bass", + "Club-House", + "Hardcore", + "Terror", + "Indie", + "Britpop", + "Negerpunk", + "Polsk Punk", + "Beat", + "Christian Gangsta", + "Heavy Metal", + "Black Metal", + "Crossover", + "Contemporary Christian", + "Christian Rock", + "Merengue", + "Salsa", + "Thrash Metal", + "Anime", + "JPop", + "Synthpop", + // 148 goes here, Winamp 5.6 would have 148 -> 191 these ¯\_(ツ)_/¯ + }; + + /** + * True if we consider the file to be a good media item + */ + private boolean mIsMediaFile = false; + /** + * True if we should try bastp for 'experimental' formats + */ + private boolean mForceBastp = false; + + /** + * Constructor for MediaMetadataExtractor + * + * @param path the path to scan + */ + public MediaMetadataExtractor(String path) { + this(path, false); + } + + /** + * Constructor for MediaMetadataExtractor + * + * @param path the path to scan + * @param forceBastp always prefer bastp if possible + */ + public MediaMetadataExtractor(String path, boolean forceBastp) { + mForceBastp = forceBastp; + extractMetadata(path); + } + + /** + * Returns the first element matching this key, null on if not found + * + * @param key the key to look up + * @return the value of the first entry, null if the key was not found + */ + public String getFirst(String key) { + String result = null; + if (containsKey(key)) + result = get(key).get(0); + return result; + } + + /** + * @return a human-friendly description of the mime type and bit rate + */ + public String getFormat() { + StringBuilder sb = new StringBuilder(18); + sb.append(decodeMimeType(getFirst(MIME_TYPE))); + String bitrate = getFirst(BITRATE); + if (bitrate != null && bitrate.length() > 3) { + sb.append(' ') + .append(bitrate.substring(0, bitrate.length() - 3)) + .append("kbps"); + } + return sb.toString(); + } + + /** + * Returns true if this file contains any (interesting) data + * @return true if file is considered to be media data + */ + public boolean isMediaFile() { + return mIsMediaFile; + } + + /** + * Attempts to populate this instance with tags found in given path + * + * @param path the path to parse + */ + private void extractMetadata(String path) { + if (!isEmpty()) + throw new IllegalStateException("Expected to be called on a clean HashMap"); + + Log.v("VanillaMusic", "Extracting tags from "+path); + + HashMap bastpTags = (new Bastp()).getTags(path); + MediaMetadataRetriever mediaTags = new MediaMetadataRetriever(); + boolean nativelyReadable = false; + + try { + FileInputStream fis = new FileInputStream(path); + try { + mediaTags.setDataSource(fis.getFD()); + nativelyReadable = true; + } catch (Exception e) { + Log.v("VanillaMusic", "Error calling setDataSource for "+path+": "+e); + } + fis.close(); + } catch (Exception e) { + nativelyReadable = false; + Log.v("VanillaMusic", "Error creating fis for "+path+": "+e); + } + + // Check if this is a usable audio file + if (!nativelyReadable || + mediaTags.extractMetadata(MediaMetadataRetriever.METADATA_KEY_HAS_AUDIO) == null || + mediaTags.extractMetadata(MediaMetadataRetriever.METADATA_KEY_HAS_VIDEO) != null || + mediaTags.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION) == null) { + try { + mediaTags.release(); + } catch (IOException e) { + Log.v("VanillaMusic", "mediaTags.release() failed: " + e); + } + + return; + } + + // Bastp can not read the duration and bitrates, so we always get it from the system + ArrayList<String> duration = new ArrayList<>(1); + duration.add(mediaTags.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION)); + this.put(DURATION, duration); + + ArrayList<String> bitrate = new ArrayList<>(1); + bitrate.add(mediaTags.extractMetadata(MediaMetadataRetriever.METADATA_KEY_BITRATE)); + this.put(BITRATE, bitrate); + + ArrayList<String> mime = new ArrayList<>(1); + mime.add(mediaTags.extractMetadata(MediaMetadataRetriever.METADATA_KEY_MIMETYPE)); + this.put(MIME_TYPE, mime); + + + // ...but we are using bastp for FLAC, OGG and OPUS as it handles them well + // Everything else goes to the framework (such as pcm, m4a and mp3) + String bastpType = (bastpTags.containsKey("type") ? (String)bastpTags.get("type") : ""); + switch (bastpType) { + case "FLAC": + case "OGG": + case "OPUS": + populateSelf(bastpTags); + break; + case "MP3/ID3v2": + case "MP3/Lame": + case "MP4": + // ^-- these tagreaders are not fully stable, but can be enabled on demand + if(mForceBastp) { + populateSelf(bastpTags); + break; + } + // else: fallthrough + default: + populateSelf(mediaTags); + } + convertNumericGenre(); + + // We consider this a media file if it has some common tags OR + // if bastp was able to parse it (which is stricter than Android's own parser) + mIsMediaFile = (containsKey(TITLE) || containsKey(ALBUM) || containsKey(ARTIST) || !bastpType.equals("")); + + try { + mediaTags.release(); + } catch (IOException e) { + Log.v("VanillaMusic", "mediaTags.release() failed: " + e); + } + } + + /** + * Populates `this' with tags read from bastp + * + * @param bastp A hashmap as returned by bastp + */ + private void populateSelf(HashMap bastp) { + // mapping between vorbiscomment -> constant + String[] map = new String[]{ "TITLE", TITLE, "ARTIST", ARTIST, "ALBUM", ALBUM, "ALBUMARTIST", ALBUMARTIST, "COMPOSER", COMPOSER, "GENRE", GENRE, + "TRACKNUMBER", TRACK_NUMBER, "TRACKTOTAL", TRACK_COUNT, "DISCNUMBER", DISC_NUMBER, "DISCTOTAL", DISC_COUNT, + "YEAR", YEAR }; + // switch to integer filter if i >= x + int filterByIntAt = 12; + // the filter we are normally using + Pattern filter = sFilterAny; + + for (int i=0; i<map.length; i+=2) { + if (i >= filterByIntAt) + filter = sFilterLeftInt; + + if (bastp.containsKey(map[i])) { + addFiltered(filter, map[i+1], (ArrayList<String>)bastp.get(map[i])); + } + } + + // If only one of (ARTIST, ALBUMARTIST) is present, populate the other + if (!containsKey(ARTIST) && containsKey(ALBUMARTIST)) { + put(ARTIST, get(ALBUMARTIST)); + } + if (containsKey(ARTIST) && !containsKey(ALBUMARTIST)) { + put(ALBUMARTIST, get(ARTIST)); + } + + // Try to guess YEAR from date field if only DATE was specified + // We expect it to match \d{4} + if (!containsKey(YEAR) && bastp.containsKey("DATE")) { + addFiltered(sFilterYear, YEAR, (ArrayList<String>)bastp.get("DATE")); + } + + } + + /** + * Populates `this' with tags read from the MediaMetadataRetriever + * + * @param tags a MediaMetadataRetriever object + */ + private void populateSelf(MediaMetadataRetriever tags) { + int[] mediaMap = new int[] { MediaMetadataRetriever.METADATA_KEY_TITLE, MediaMetadataRetriever.METADATA_KEY_ARTIST, MediaMetadataRetriever.METADATA_KEY_ALBUM, + MediaMetadataRetriever.METADATA_KEY_ALBUMARTIST, MediaMetadataRetriever.METADATA_KEY_COMPOSER, MediaMetadataRetriever.METADATA_KEY_GENRE, + MediaMetadataRetriever.METADATA_KEY_DISC_NUMBER, MediaMetadataRetriever.METADATA_KEY_CD_TRACK_NUMBER, MediaMetadataRetriever.METADATA_KEY_YEAR }; + String[] selfMap = new String[]{ TITLE, ARTIST, ALBUM, ALBUMARTIST, COMPOSER, GENRE, DISC_NUMBER, TRACK_NUMBER, YEAR }; + int filterByIntAt = 6; + Pattern filter = sFilterAny; + + for (int i=0; i<selfMap.length; i++) { + String data = tags.extractMetadata(mediaMap[i]); + if (i >= filterByIntAt) + filter = sFilterLeftInt; + + if (data != null) { + ArrayList<String> md = new ArrayList<String>(1); + md.add(data); + addFiltered(filter, selfMap[i], md); + } + } + } + + /** + * Matches all elements of `data' with `filter' and adds the result as `key' + * + * @param filter the pattern to use, result is expected to be in capture group 1 + * @param key the key to use for the data to put + * @param data the array list to inspect + */ + private void addFiltered(Pattern filter, String key, ArrayList<String> data) { + ArrayList<String> list = new ArrayList<>(); + for (String s : data) { + Matcher matcher = filter.matcher(s); + if (matcher.matches()) { + list.add(matcher.group(1).trim()); + } + } + if (list.size() > 0) + put(key, list); + } + + /** + * Detects legacy numeric-genre definitions and + * replaces them with one of ID3_GENRES[] + */ + private void convertNumericGenre() { + int genreIdx = -1; + String rawGenre = getFirst(GENRE); + + if (rawGenre == null) + return; // no genre, nothing to do + + Matcher matcher = sFilterGenre.matcher(rawGenre); + if (matcher.matches()) { + try { + genreIdx = Integer.parseInt(matcher.group(1)); + } catch (NumberFormatException e) {} // ignored + } + + if (genreIdx >= 0 && genreIdx < ID3_GENRES.length) { + ArrayList<String> data = new ArrayList<String>(1); + data.add(ID3_GENRES[genreIdx]); + remove(GENRE); + addFiltered(sFilterAny, GENRE, data); + } + } + + /** + * Decode the given MIME type into a more human-friendly description. + * + * @return a human-friendly description of the MIME type + */ + private static String decodeMimeType(String mime) + { + if ("audio/mpeg".equals(mime)) { + return "MP3"; + } else if ("audio/mp4".equals(mime)) { + return "AAC"; + } else if ("audio/vorbis".equals(mime)) { + return "Ogg Vorbis"; + } else if ("application/ogg".equals(mime)) { + return "Ogg Vorbis"; + } else if ("audio/flac".equals(mime)) { + return "FLAC"; + } + return mime; + } +} diff --git a/app/src/main/java/ch/blinkenlights/android/medialibrary/MediaMigrations.java b/app/src/main/java/ch/blinkenlights/android/medialibrary/MediaMigrations.java new file mode 100644 index 0000000..c77e273 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/medialibrary/MediaMigrations.java @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2018 Adrian Ulrich <adrian@blinkenlights.ch> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package ch.blinkenlights.android.medialibrary; + +import android.content.ContentValues; +import android.database.sqlite.SQLiteDatabase; +import android.database.Cursor; +import android.util.Log; + + +public class MediaMigrations { + /** + * Migrate to 20180416 + * That is: populate NAME_SORT in the new source database + * + * @param dbh the database to work on + * @param fromDb the name of the source database + * @param toDb the name of the target database + **/ + static void migrate_to_20180416(SQLiteDatabase dbh, String fromDb, String toDb) { + Cursor cursor = dbh.query(fromDb, new String[]{MediaLibrary.PlaylistColumns._ID, MediaLibrary.PlaylistColumns.NAME}, null, null, null, null, null); + while (cursor.moveToNext()) { + long id = cursor.getLong(0); + String name = cursor.getString(1); + String key = MediaLibrary.keyFor(name); + + Log.v("VanillaMusic", "migrate_to_20180416 -> id="+id+", name="+name+" -> key = "+key); + ContentValues v = new ContentValues(); + v.put(MediaLibrary.PlaylistColumns._ID, id); + v.put(MediaLibrary.PlaylistColumns.NAME, name); + v.put(MediaLibrary.PlaylistColumns.NAME_SORT, key); + dbh.insert(toDb, null, v); + } + cursor.close(); + } + +} diff --git a/app/src/main/java/ch/blinkenlights/android/medialibrary/MediaScanner.java b/app/src/main/java/ch/blinkenlights/android/medialibrary/MediaScanner.java new file mode 100644 index 0000000..6b2a289 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/medialibrary/MediaScanner.java @@ -0,0 +1,832 @@ +/* + * Copyright (C) 2016-2018 Adrian Ulrich <adrian@blinkenlights.ch> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package ch.blinkenlights.android.medialibrary; + +import ch.blinkenlights.android.vanilla.R; +import ch.blinkenlights.android.vanilla.NotificationHelper; + +import android.app.Notification; +import android.content.Context; +import android.content.ContentValues; +import android.content.SharedPreferences; +import android.database.Cursor; +import android.database.ContentObserver; +import android.util.Log; +import android.provider.MediaStore; +import android.os.Handler; +import android.os.HandlerThread; +import android.os.Message; +import android.os.PowerManager; +import android.os.Process; +import android.os.SystemClock; + +import java.io.File; +import java.util.ArrayList; +import java.util.regex.Pattern; + +public class MediaScanner implements Handler.Callback { + /** + * Our scan plan + */ + private MediaScanPlan mScanPlan; + /** + * Our message handler + */ + private Handler mHandler; + /** + * The context to use for native library queries + */ + private Context mContext; + /** + * The wake lock we hold during the scan + */ + private PowerManager.WakeLock mWakeLock; + /** + * Instance of a media backend + */ + private MediaLibraryBackend mBackend; + /** + * True if this is a from-scratch import + * Set by KICKSTART rpc + */ + private boolean mIsInitialScan; + /** + * True if we are currently in a scan phase + */ + private boolean mScanIsRunning; + /** + * True if we must do a full cleanup of orphaned entries after the scan finished. + */ + private boolean mPendingCleanup; + /** + * Our NotificationHelper instance. + */ + private NotificationHelper mNotificationHelper; + /** + * uptimeMillis ts at which we will dispatch the next scan update report + */ + private long mNextProgressReportAt; + /** + * The id we are using for the scan notification + */ + private static final int NOTIFICATION_ID = 56162; + /** + * The notification channel to use + */ + private static final String NOTIFICATION_CHANNEL = "Scanner"; + /** + * Relax mtime check while searching for native modifications by this many seconds + */ + private static final int NATIVE_VRFY_MTIME_SLACK = 100; + /** + * Delay native scans by this many ms to coalesce multiple modifications + */ + private static final int NATIVE_VRFY_COALESCE_DELAY = 3500; + + MediaScanner(Context context, MediaLibraryBackend backend) { + mContext = context; + mBackend = backend; + mScanPlan = new MediaScanPlan(); + HandlerThread handlerThread = new HandlerThread("MediaScannerThread", Process.THREAD_PRIORITY_LOWEST); + handlerThread.start(); + mHandler = new Handler(handlerThread.getLooper(), this); + mWakeLock = ((PowerManager)context.getSystemService(Context.POWER_SERVICE)).newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "VanillaMusic:Indexer"); + mNotificationHelper = new NotificationHelper(context, NOTIFICATION_CHANNEL, context.getString(R.string.media_stats_progress)); + + // the content observer to use + ContentObserver mObserver = new ContentObserver(null) { + @Override + public void onChange(boolean self) { + startQuickScan(NATIVE_VRFY_COALESCE_DELAY); + } + }; + context.getContentResolver().registerContentObserver(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, true, mObserver); + } + + /** + * Performs a 'fast' scan by checking the native and our own + * library for new and changed files + */ + public void startNormalScan() { + setNativeLastMtime(MTIME_DIRTY); + mScanPlan.addNextStep(RPC_NATIVE_VRFY, null) + .addNextStep(RPC_LIBRARY_VRFY, null); + mHandler.sendMessage(mHandler.obtainMessage(MSG_SCAN_RPC, RPC_KICKSTART, 0)); + } + + /** + * Performs a 'slow' scan by inspecting all files on the device + */ + public void startFullScan() { + MediaLibrary.Preferences prefs = MediaLibrary.getPreferences(mContext); + for (String path : prefs.mediaFolders) { + mScanPlan.addNextStep(RPC_READ_DIR, new File(path)); + } + mScanPlan.addNextStep(RPC_LIBRARY_VRFY, null); + mScanPlan.addNextStep(RPC_NATIVE_VRFY, null); + mHandler.sendMessage(mHandler.obtainMessage(MSG_SCAN_RPC, RPC_KICKSTART, 0)); + } + + /** + * Called by the content observer if a change in the media library + * has been detected + * + * @param delay how many ms we should wait (used to coalesce multiple calls) + */ + public void startQuickScan(int delay) { + if (!mHandler.hasMessages(MSG_GUESS_QUICKSCAN) && !mHandler.hasMessages(MSG_SCAN_RPC)) { + mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_GUESS_QUICKSCAN, 0, 0), delay); + } + } + + /** + * Stops a running scan + */ + public void abortScan() { + mHandler.removeMessages(MSG_SCAN_RPC); + mScanPlan.clear(); + mHandler.sendMessage(mHandler.obtainMessage(MSG_SCAN_RPC, RPC_KICKSTART, 0)); + } + + /** + * Prepares a flush of the databse. + */ + public void flushDatabase() { + mBackend.setPendingDeletion(); + mPendingCleanup = true; + setNativeLastMtime(MTIME_PRISTINE); + } + + /** + * Returns some scan statistics + * + * @return a MediaLibrary.ScanProgress object + */ + public MediaLibrary.ScanProgress describeScanProgress() { + MediaLibrary.ScanProgress progress = new MediaLibrary.ScanProgress(); + MediaLibrary.Preferences prefs = MediaLibrary.getPreferences(mContext); + MediaScanPlan.Statistics stats = mScanPlan.getStatistics(); + + progress.isRunning = mScanIsRunning; + progress.lastFile = stats.lastFile; + progress.seen = stats.seen; + progress.changed = stats.changed; + progress.total = prefs._nativeLibraryCount; + + return progress; + } + + private static final int MSG_SCAN_RPC = 0; + private static final int MSG_SCAN_FINISHED = 1; + private static final int MSG_NOTIFY_CHANGE = 2; + private static final int MSG_GUESS_QUICKSCAN = 3; + private static final int RPC_KICKSTART = 100; + private static final int RPC_READ_DIR = 101; + private static final int RPC_INSPECT_FILE = 102; + private static final int RPC_LIBRARY_VRFY = 103; + private static final int RPC_NATIVE_VRFY = 104; + + @Override + public boolean handleMessage(Message message) { + int rpc = (message.what == MSG_SCAN_RPC ? message.arg1 : message.what); + + switch (rpc) { + case MSG_NOTIFY_CHANGE: { + MediaLibrary.notifyObserver(LibraryObserver.Type.SONG, LibraryObserver.Value.UNKNOWN, true); + break; + } + case MSG_SCAN_FINISHED: { + mScanIsRunning = false; + if (mIsInitialScan) { + mIsInitialScan = false; + MediaLibrary.notifyObserver(LibraryObserver.Type.PLAYLIST, LibraryObserver.Value.OUTDATED, false); + } + if (mPendingCleanup) { + mPendingCleanup = false; + mBackend.cleanOrphanedEntries(true); + // scan run possibly deleted file which may affect playlists: + MediaLibrary.notifyObserver(LibraryObserver.Type.PLAYLIST, LibraryObserver.Value.UNKNOWN, false); + } + + // Send a last change notification to all observers. + // This lets all consumers know about (possible) + // cleanups of orphaned files. The `false' value + // also signals that this will be our last update + // for this scan. + mHandler.removeMessages(MSG_NOTIFY_CHANGE); + MediaLibrary.notifyObserver(LibraryObserver.Type.SONG, LibraryObserver.Value.UNKNOWN, false); + MediaLibrary.notifyObserver(LibraryObserver.Type.SCAN_PROGRESS, LibraryObserver.Value.UNKNOWN, false); + + updateNotification(false); + break; + } + case MSG_GUESS_QUICKSCAN: { + guessQuickScanPlan(); + break; + } + case RPC_KICKSTART: { + // a new scan was triggered: check if this is a 'initial / from scratch' scan + if (!mIsInitialScan && MediaLibrary.getPreferences(mContext)._nativeLastMtime == 0) { + mIsInitialScan = true; + } + break; + } + case RPC_INSPECT_FILE: { + final File file = (File)message.obj; + boolean changed = rpcInspectFile(file); + mScanPlan.registerProgress(file.toString(), changed); + if (changed && !mHandler.hasMessages(MSG_NOTIFY_CHANGE)) { + mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_NOTIFY_CHANGE), 500); + } + + // Unlike MSG_NOTIFY_CHANGE, we don't want the progress report to lag behind, but we also don't want + // to call it on EVERY file inspection; so we add our own delay which will not be influenced by + // the message queue size. + long now = SystemClock.uptimeMillis(); + if (now >= mNextProgressReportAt) { + mNextProgressReportAt = now + 80; + MediaLibrary.notifyObserver(LibraryObserver.Type.SCAN_PROGRESS, LibraryObserver.Value.UNKNOWN, true); + updateNotification(true); + } + break; + } + case RPC_READ_DIR: { + rpcReadDirectory((File)message.obj); + break; + } + case RPC_LIBRARY_VRFY: { + rpcLibraryVerify((Cursor)message.obj); + break; + } + case RPC_NATIVE_VRFY: { + rpcNativeVerify((Cursor)message.obj, message.arg2); + break; + } + default: { + throw new IllegalArgumentException(); + } + } + + if (message.what == MSG_SCAN_RPC && !mHandler.hasMessages(MSG_SCAN_RPC)) { + mScanIsRunning = true; + MediaScanPlan.Step step = mScanPlan.getNextStep(); + if (step == null) { + mHandler.sendEmptyMessage(MSG_SCAN_FINISHED); + } else { + Log.v("VanillaMusic", "xxx --- starting scan of type "+step.msg); + mHandler.sendMessage(mHandler.obtainMessage(MSG_SCAN_RPC, step.msg, 0, step.arg)); + } + } + + return true; + } + + private static final int MTIME_PRISTINE = 0; + private static final int MTIME_DIRTY = 1; + /** + * Updates the _nativeLastMtime value in the media scanner storage + * + * @param mtime or one of MTIME_* + */ + private void setNativeLastMtime(int mtime) { + MediaLibrary.Preferences prefs = MediaLibrary.getPreferences(mContext); + prefs._nativeLastMtime = mtime; + MediaLibrary.setPreferences(mContext, prefs); + } + + /** + * Triggers an update to the scan progress notification + * + * @param visible if true, the notification is visible (and will get updated) + */ + private void updateNotification(boolean visible) { + MediaLibrary.ScanProgress progress = describeScanProgress(); + + if (visible) { + // We there are 5 drawables, pick one based on the 'uptime-seconds'. + int tick = (int)(SystemClock.uptimeMillis() / 1000) % 5; + int icon = R.drawable.status_scan_0 + tick; + String title = mContext.getResources().getString(R.string.media_library_scan_running); + String content = progress.lastFile; + Notification notification = mNotificationHelper.getNewBuilder(mContext) + .setProgress(progress.total, progress.seen, false) + .setContentTitle(title) + .setContentText(content) + .setSmallIcon(icon) + .setOngoing(true) + .getNotification(); // build() is API 16 :-/ + mNotificationHelper.notify(NOTIFICATION_ID, notification); + + if (!mWakeLock.isHeld()) + mWakeLock.acquire(); + } else { + mNotificationHelper.cancel(NOTIFICATION_ID); + + if (mWakeLock.isHeld()) + mWakeLock.release(); + } + } + + /** + * Checks the state of the native media db to deceide if we are going to + * check for deleted or new/modified items + */ + private void guessQuickScanPlan() { + int lastSeenDbSize = MediaLibrary.getPreferences(mContext)._nativeLibraryCount; + String selection = MediaStore.Audio.Media.IS_MUSIC + "!= 0"; + String[] projection = { "COUNT("+MediaStore.Audio.Media.IS_MUSIC+")" }; + Cursor cursor = null; + try { + cursor = mContext.getContentResolver().query(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, projection, selection, null, null); + } catch (SecurityException e) { + Log.e("VanillaMusic", "rpcObserveRemoval query failed: "+e); + } + + if (cursor == null) + return; + + cursor.moveToFirst(); + int currentDbSize = cursor.getInt(0); + cursor.close(); + + // Store new db size + MediaLibrary.Preferences prefs = MediaLibrary.getPreferences(mContext); + prefs._nativeLibraryCount = currentDbSize; + MediaLibrary.setPreferences(mContext, prefs); + + if (currentDbSize < lastSeenDbSize) { + // db is smaller! check for deleted files + mScanPlan.addNextStep(RPC_LIBRARY_VRFY, null); + } else { + // same size or more entries -> check only for modifications + mScanPlan.addNextStep(RPC_NATIVE_VRFY, null); + } + + mHandler.sendMessage(mHandler.obtainMessage(MSG_SCAN_RPC, RPC_KICKSTART, 0)); + } + + /** + * Scans the android library, inspecting every found file + * + * @param cursor the cursor we are using + * @param mtime the mtime to carry over, ignored if cursor is null + */ + private void rpcNativeVerify(Cursor cursor, int mtime) { + if (cursor == null) { + mtime = MediaLibrary.getPreferences(mContext)._nativeLastMtime; // starting a new scan -> read stored mtime from preferences + String selection = MediaStore.Audio.Media.IS_MUSIC + "!= 0 AND "+ MediaStore.MediaColumns.DATE_MODIFIED +" > " + (mtime - NATIVE_VRFY_MTIME_SLACK); + String sort = MediaStore.MediaColumns.DATE_MODIFIED; + String[] projection = { MediaStore.MediaColumns.DATA, MediaStore.MediaColumns.DATE_MODIFIED }; + try { + cursor = mContext.getContentResolver().query(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, projection, selection, null, sort); + } catch(SecurityException e) { + Log.e("VanillaMusic", "rpcNativeVerify failed: "+e); + } + } + + if (cursor == null) + return; // still null.. fixme: handle me better + + if (cursor.moveToNext()) { + String path = cursor.getString(0); + mtime = cursor.getInt(1); + if (path != null) { // this seems to be a thing... + File entry = new File(path); + mHandler.sendMessage(mHandler.obtainMessage(MSG_SCAN_RPC, RPC_INSPECT_FILE, 0, entry)); + mHandler.sendMessage(mHandler.obtainMessage(MSG_SCAN_RPC, RPC_NATIVE_VRFY, mtime, cursor)); + } + } else { + cursor.close(); + setNativeLastMtime(mtime); + Log.v("VanillaMusic", "NativeLibraryScanner finished, mtime mark is now at "+mtime); + } + } + + /** + * Scans every file in our own library and checks for changes + * + * @param cursor the cursor we are using + */ + private void rpcLibraryVerify(Cursor cursor) { + if (cursor == null) + cursor = mBackend.query(false, MediaLibrary.TABLE_SONGS, new String[]{MediaLibrary.SongColumns.PATH}, null, null, null, null, null, null); + + if (cursor.moveToNext()) { + File entry = new File(cursor.getString(0)); + mHandler.sendMessage(mHandler.obtainMessage(MSG_SCAN_RPC, RPC_INSPECT_FILE, 0, entry)); + mHandler.sendMessage(mHandler.obtainMessage(MSG_SCAN_RPC, RPC_LIBRARY_VRFY, 0, cursor)); + } else { + cursor.close(); + } + } + + /** + * Loops trough given directory and adds all found + * files to the scan queue + * + * @param dir the directory to scan + */ + private void rpcReadDirectory(File dir) { + if (!dir.isDirectory()) + return; + + if (new File(dir, ".nomedia").exists()) + return; + + if (isDotfile(dir)) + return; + + File[] dirents = dir.listFiles(); + if (dirents == null) + return; + + for (File file : dirents) { + int rpc = (file.isFile() ? RPC_INSPECT_FILE : RPC_READ_DIR); + mHandler.sendMessage(mHandler.obtainMessage(MSG_SCAN_RPC, rpc, 0, file)); + } + } + + /** + * Checks if a string is null, empty or whitespace. + * + * @param s the string to check + * @return true if null, empty or whitespace + */ + private static boolean isUnset(String s) { + return s == null || s.trim().isEmpty(); + } + + + /** + * Inspects a single file and adds it to the database or removes it. maybe. + * + * @param file the file to add + * @return true if we modified the database + */ + private boolean rpcInspectFile(File file) { + MediaLibrary.Preferences prefs = MediaLibrary.getPreferences(mContext); + String path = file.getAbsolutePath(); + long songId = MediaLibrary.hash63(path); + + if (isBlacklisted(file)) + return false; + + if (isDotfile(file)) + return false; + + long dbEntryMtime = mBackend.getColumnFromSongId(MediaLibrary.SongColumns.MTIME, songId) * 1000; // this is in unixtime -> convert to 'ms' + long songFlags = mBackend.getColumnFromSongId(MediaLibrary.SongColumns.FLAGS, songId); + long fileMtime = file.lastModified(); + long playCount = 0; + long skipCount = 0; + boolean hasChanged = false; + boolean mustInsert = false; + + if (fileMtime > 0 && dbEntryMtime >= fileMtime && (songFlags & MediaLibrary.SONG_FLAG_OUTDATED) == 0) { + return false; // on-disk mtime is older than db mtime and it still exists -> nothing to do + } + + if (dbEntryMtime != 0) { + // DB entry exists but is outdated - drop current entry and maybe re-insert it + // this tries to preserve play and skipcounts of the song + playCount = mBackend.getColumnFromSongId(MediaLibrary.SongColumns.PLAYCOUNT, songId); + skipCount = mBackend.getColumnFromSongId(MediaLibrary.SongColumns.SKIPCOUNT, songId); + // Remove the song from the database for now but do not delete any + // playlist references to it. + mBackend.delete(MediaLibrary.TABLE_SONGS, MediaLibrary.SongColumns._ID+"="+songId, null); + mBackend.cleanOrphanedEntries(false); + mPendingCleanup = true; // Ensure that we run a full cleanup after all scans finished, to get rid of orphaned playlist entries. + hasChanged = true; // notify caller about change even if we are not going to re-insert this file. + } + + // Check if we are willing to insert this file + // This is the case if we consider it to be playable on this device. + MediaMetadataExtractor tags = new MediaMetadataExtractor(path, prefs.forceBastp); + mustInsert = tags.isMediaFile(); + + if (mustInsert) { + hasChanged = true; + + // Clear old flags of this song: + songFlags &= ~MediaLibrary.SONG_FLAG_OUTDATED; // This file is not outdated anymore + songFlags &= ~MediaLibrary.SONG_FLAG_NO_ARTIST; // May find an artist now. + songFlags &= ~MediaLibrary.SONG_FLAG_NO_ALBUM; // May find an album now. + + // Get tags which always must be set + String title = tags.getFirst(MediaMetadataExtractor.TITLE); + if (isUnset(title)) + title = file.getName(); + + String album = tags.getFirst(MediaMetadataExtractor.ALBUM); + if (isUnset(album)) { + album = "<No Album>"; + songFlags |= MediaLibrary.SONG_FLAG_NO_ALBUM; + } + + String artist = tags.getFirst(MediaMetadataExtractor.ARTIST); + if (isUnset(artist)) { + artist = "<No Artist>"; + songFlags |= MediaLibrary.SONG_FLAG_NO_ARTIST; + } + + String discNumber = tags.getFirst(MediaMetadataExtractor.DISC_NUMBER); + if (isUnset(discNumber)) + discNumber = "1"; // untagged, but most likely '1' - this prevents annoying sorting issues with partially tagged files + + long artistId = MediaLibrary.hash63(artist); + long albumId = MediaLibrary.hash63(album); + + // Overwrite albumId with a hash that included the parent dir if set in preferences + if (prefs.groupAlbumsByFolder) { + albumId = MediaLibrary.hash63(album + "\n" + file.getParent()); + } + + ContentValues v = new ContentValues(); + v.put(MediaLibrary.SongColumns._ID, songId); + v.put(MediaLibrary.SongColumns.TITLE, title); + v.put(MediaLibrary.SongColumns.TITLE_SORT, MediaLibrary.keyFor(title)); + v.put(MediaLibrary.SongColumns.ALBUM_ID, albumId); + v.put(MediaLibrary.SongColumns.DURATION, tags.getFirst(MediaMetadataExtractor.DURATION)); + v.put(MediaLibrary.SongColumns.SONG_NUMBER, tags.getFirst(MediaMetadataExtractor.TRACK_NUMBER)); + v.put(MediaLibrary.SongColumns.DISC_NUMBER, discNumber); + v.put(MediaLibrary.SongColumns.YEAR, tags.getFirst(MediaMetadataExtractor.YEAR)); + v.put(MediaLibrary.SongColumns.PLAYCOUNT, playCount); + v.put(MediaLibrary.SongColumns.SKIPCOUNT, skipCount); + v.put(MediaLibrary.SongColumns.PATH, path); + v.put(MediaLibrary.SongColumns.FLAGS, songFlags); + mBackend.insert(MediaLibrary.TABLE_SONGS, null, v); + + v.clear(); + v.put(MediaLibrary.AlbumColumns._ID, albumId); + v.put(MediaLibrary.AlbumColumns.ALBUM, album); + v.put(MediaLibrary.AlbumColumns.ALBUM_SORT, MediaLibrary.keyFor(album)); + v.put(MediaLibrary.AlbumColumns.PRIMARY_ARTIST_ID, artistId); + v.put(MediaLibrary.AlbumColumns.PRIMARY_ALBUM_YEAR,tags.getFirst(MediaMetadataExtractor.YEAR)); + long albumInsert = mBackend.insert(MediaLibrary.TABLE_ALBUMS, null, v); + if (albumInsert == -1) { + // Insert failed, so the column probably already existed. + // We need to ensure that the album table is up-to-date as it contains + // some 'cached' (PRIMARY_*) values. + // Failure to do so would mean that we never update the year or may point to an + // orphaned artist id. + v.clear(); + v.put(MediaLibrary.AlbumColumns.PRIMARY_ARTIST_ID, artistId); + v.put(MediaLibrary.AlbumColumns.PRIMARY_ALBUM_YEAR,tags.getFirst(MediaMetadataExtractor.YEAR)); + mBackend.update(MediaLibrary.TABLE_ALBUMS, v, MediaLibrary.AlbumColumns._ID+"=?", new String[]{ Long.toString(albumId) }); + } + + v.clear(); + v.put(MediaLibrary.ContributorColumns._ID, artistId); + v.put(MediaLibrary.ContributorColumns._CONTRIBUTOR, artist); + v.put(MediaLibrary.ContributorColumns._CONTRIBUTOR_SORT, MediaLibrary.keyFor(artist)); + mBackend.insert(MediaLibrary.TABLE_CONTRIBUTORS, null, v); + + v.clear(); + v.put(MediaLibrary.ContributorSongColumns._CONTRIBUTOR_ID, artistId); + v.put(MediaLibrary.ContributorSongColumns.SONG_ID, songId); + v.put(MediaLibrary.ContributorSongColumns.ROLE, MediaLibrary.ROLE_ARTIST); + mBackend.insert(MediaLibrary.TABLE_CONTRIBUTORS_SONGS, null, v); + + // Composers are optional: only add if we found it + String composer = tags.getFirst(MediaMetadataExtractor.COMPOSER); + if (composer != null) { + long composerId = MediaLibrary.hash63(composer); + v.clear(); + v.put(MediaLibrary.ContributorColumns._ID, composerId); + v.put(MediaLibrary.ContributorColumns._CONTRIBUTOR, composer); + v.put(MediaLibrary.ContributorColumns._CONTRIBUTOR_SORT, MediaLibrary.keyFor(composer)); + mBackend.insert(MediaLibrary.TABLE_CONTRIBUTORS, null, v); + + v.clear(); + v.put(MediaLibrary.ContributorSongColumns._CONTRIBUTOR_ID, composerId); + v.put(MediaLibrary.ContributorSongColumns.SONG_ID, songId); + v.put(MediaLibrary.ContributorSongColumns.ROLE, MediaLibrary.ROLE_COMPOSER); + mBackend.insert(MediaLibrary.TABLE_CONTRIBUTORS_SONGS, null, v); + } + + // Same as with composer: albumartist is an optional tag + String albumartist = tags.getFirst(MediaMetadataExtractor.ALBUMARTIST); + if (albumartist != null) { + long albumartistId = MediaLibrary.hash63(albumartist); + v.clear(); + v.put(MediaLibrary.ContributorColumns._ID, albumartistId); + v.put(MediaLibrary.ContributorColumns._CONTRIBUTOR, albumartist); + v.put(MediaLibrary.ContributorColumns._CONTRIBUTOR_SORT, MediaLibrary.keyFor(albumartist)); + mBackend.insert(MediaLibrary.TABLE_CONTRIBUTORS, null, v); + + v.clear(); + v.put(MediaLibrary.ContributorSongColumns._CONTRIBUTOR_ID, albumartistId); + v.put(MediaLibrary.ContributorSongColumns.SONG_ID, songId); + v.put(MediaLibrary.ContributorSongColumns.ROLE, MediaLibrary.ROLE_ALBUMARTIST); + mBackend.insert(MediaLibrary.TABLE_CONTRIBUTORS_SONGS, null, v); + } + + // A song might be in multiple genres + if (tags.containsKey(MediaMetadataExtractor.GENRE)) { + ArrayList<String> genres = tags.get(MediaMetadataExtractor.GENRE); + for (String genre : genres) { + long genreId = MediaLibrary.hash63(genre); + v.clear(); + v.put(MediaLibrary.GenreColumns._ID, genreId); + v.put(MediaLibrary.GenreColumns._GENRE, genre); + v.put(MediaLibrary.GenreColumns._GENRE_SORT, MediaLibrary.keyFor(genre)); + mBackend.insert(MediaLibrary.TABLE_GENRES, null, v); + + v.clear(); + v.put(MediaLibrary.GenreSongColumns._GENRE_ID, genreId); + v.put(MediaLibrary.GenreSongColumns.SONG_ID, songId); + mBackend.insert(MediaLibrary.TABLE_GENRES_SONGS, null, v); + } + } + } // end if (mustInsert) + + Log.v("VanillaMusic", "MediaScanner: inserted "+path); + return hasChanged; + } + + private static final Pattern sIgnoredFilenames = Pattern.compile("^([^\\.]+|.+\\.(jpe?g|gif|png|bmp|webm|txt|pdf|avi|mp4|mkv|zip|tgz|xml|tmp|bin))$", Pattern.CASE_INSENSITIVE); + /** + * Returns true if the file should not be scanned + * + * @param file the file to inspect + * @return boolean + */ + private boolean isBlacklisted(File file) { + if (sIgnoredFilenames.matcher(file.getName()).matches()) + return true; + + int wlPoints = -1; + int blPoints = -1; + + for (String path : MediaLibrary.getPreferences(mContext).mediaFolders) { + if (path.length() > wlPoints && + file.getPath().toLowerCase().startsWith(path.toLowerCase())) { + wlPoints = path.length(); + } + } + + for (String path : MediaLibrary.getPreferences(mContext).blacklistedFolders) { + if (path.length() > blPoints && + file.getPath().toLowerCase().startsWith(path.toLowerCase())) { + blPoints = path.length(); + } + } + + // Consider a file to be blacklisted if it is not + // present in any whitelisted dir OR if we found + // a blacklist entry with a longer prefix. + return (wlPoints < 0 || blPoints > wlPoints); + } + + + private static final Pattern sDotfilePattern = Pattern.compile("^\\..*$", Pattern.CASE_INSENSITIVE); + /** + * Returns true if the file is a hidden dotfile. + * + * @param file to inspect + * @return boolean + */ + private boolean isDotfile(File file) { + return sDotfilePattern.matcher(file.getName()).matches(); + } + + // MediaScanPlan describes how we are going to perform the media scan + class MediaScanPlan { + class Step { + private static final int MODE_NORMAL = 1; // this step is always run + private static final int MODE_OPTIONAL = 2; // only run if previous step found NO changes + private static final int MODE_CHAINED = 3; // only run if previous step DID find changes + int msg; + Object arg; + int mode; + Step (int msg, Object arg, int mode) { + this.msg = msg; + this.arg = arg; + this.mode = mode; + } + } + + class Statistics { + String lastFile; + int seen = 0; + int changed = 0; + void reset() { + this.seen = 0; + this.changed = 0; + this.lastFile = null; + } + } + + /** + * All steps in this plan + */ + private ArrayList<Step> mSteps; + /** + * Statistics of the currently running step + */ + private Statistics mStats; + + MediaScanPlan() { + mSteps = new ArrayList<>(); + mStats = new Statistics(); + } + + Statistics getStatistics() { + return mStats; + } + + /** + * Called by the scanner to signal that a file was handled + * + * @param path the file we scanned + * @param changed true if this triggered a database update + */ + void registerProgress(String path, boolean changed) { + mStats.lastFile = path; + mStats.seen++; + if (changed) { + mStats.changed++; + } + } + + /** + * Flushes all progress, turning the object into a fresh state + */ + void clear() { + mSteps.clear(); + mStats.reset(); + } + + /** + * Adds the next step in our plan + * + * @param msg the message to add + * @param arg the argument to msg + */ + MediaScanPlan addNextStep(int msg, Object arg) { + mSteps.add(new Step(msg, arg, Step.MODE_NORMAL)); + return this; + } + + /** + * Adds an optional step to our plan. This will NOT + * run if the previous step caused database changes + * + * @param msg the message to add + * @param arg the argument to msg + */ + MediaScanPlan addOptionalStep(int msg, Object arg) { + mSteps.add(new Step(msg, arg, Step.MODE_OPTIONAL)); + return this; + } + + /** + * Adds a chained step to our plan. This will ONLY + * run if the previous step caused database changes + * + * @param msg the message to add + * @param arg the argument to msg + */ + MediaScanPlan addChainedStep(int msg, Object arg) { + mSteps.add(new Step(msg, arg, Step.MODE_CHAINED)); + return this; + } + + /** + * Returns the next step of our scan plan + * + * @return a new step object, null if we hit the end + */ + Step getNextStep() { + Step next = (mSteps.size() != 0 ? mSteps.remove(0) : null); + if (next != null) { + if (next.mode == Step.MODE_OPTIONAL && mStats.changed != 0) { + next = null; + mSteps.clear(); + } + if (next.mode == Step.MODE_CHAINED && mStats.changed == 0) { + next = null; + mSteps.clear(); + } + } + mStats.reset(); + return next; + } + } +} + diff --git a/app/src/main/java/ch/blinkenlights/android/medialibrary/MediaSchema.java b/app/src/main/java/ch/blinkenlights/android/medialibrary/MediaSchema.java new file mode 100644 index 0000000..8c21065 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/medialibrary/MediaSchema.java @@ -0,0 +1,369 @@ +/* + * Copyright (C) 2016-2018 Adrian Ulrich <adrian@blinkenlights.ch> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package ch.blinkenlights.android.medialibrary; + +import android.database.sqlite.SQLiteDatabase; + +public class MediaSchema { + /** + * SQL Schema of `songs' table + */ + private static final String DATABASE_CREATE_SONGS = "CREATE TABLE "+ MediaLibrary.TABLE_SONGS + " (" + + MediaLibrary.SongColumns._ID +" INTEGER PRIMARY KEY, " + + MediaLibrary.SongColumns.TITLE +" TEXT NOT NULL, " + + MediaLibrary.SongColumns.TITLE_SORT +" VARCHAR(64) NOT NULL, " + + MediaLibrary.SongColumns.SONG_NUMBER +" INTEGER, " + + MediaLibrary.SongColumns.DISC_NUMBER +" INTEGER, " + + MediaLibrary.SongColumns.YEAR +" INTEGER, " + + MediaLibrary.SongColumns.ALBUM_ID +" INTEGER NOT NULL, " + + MediaLibrary.SongColumns.PLAYCOUNT +" INTEGER NOT NULL DEFAULT 0, " + + MediaLibrary.SongColumns.SKIPCOUNT +" INTEGER NOT NULL DEFAULT 0, " + + MediaLibrary.SongColumns.MTIME +" TIMESTAMP DEFAULT (strftime('%s', CURRENT_TIMESTAMP)), " + + MediaLibrary.SongColumns.DURATION +" INTEGER NOT NULL, " + + MediaLibrary.SongColumns.PATH +" VARCHAR(4096) NOT NULL, " + + MediaLibrary.SongColumns.FLAGS +" INTEGER NOT NULL DEFAULT 0 " + + ");"; + + /** + * SQL Schema of `albums' table + */ + private static final String DATABASE_CREATE_ALBUMS = "CREATE TABLE "+ MediaLibrary.TABLE_ALBUMS + " (" + + MediaLibrary.AlbumColumns._ID +" INTEGER PRIMARY KEY, " + + MediaLibrary.AlbumColumns.ALBUM +" TEXT NOT NULL, " + + MediaLibrary.AlbumColumns.ALBUM_SORT +" VARCHAR(64) NOT NULL, " + + MediaLibrary.AlbumColumns.PRIMARY_ALBUM_YEAR+" INTEGER, " + + MediaLibrary.AlbumColumns.PRIMARY_ARTIST_ID +" INTEGER NOT NULL DEFAULT 0, " + + MediaLibrary.AlbumColumns.MTIME +" TIMESTAMP DEFAULT CURRENT_TIMESTAMP " + + ");"; + + /** + * SQL Schema of `contributors' table + */ + private static final String DATABASE_CREATE_CONTRIBUTORS = "CREATE TABLE "+ MediaLibrary.TABLE_CONTRIBUTORS + " (" + + MediaLibrary.ContributorColumns._ID +" INTEGER PRIMARY KEY, " + + MediaLibrary.ContributorColumns._CONTRIBUTOR +" TEXT NOT NULL, " + + MediaLibrary.ContributorColumns._CONTRIBUTOR_SORT +" TEXT NOT NULL, " + + MediaLibrary.ContributorColumns.MTIME +" TIMESTAMP DEFAULT CURRENT_TIMESTAMP " + + ");"; + + /** + * SQL Schema of 'contributors<->songs' table + */ + private static final String DATABASE_CREATE_CONTRIBUTORS_SONGS = "CREATE TABLE "+ MediaLibrary.TABLE_CONTRIBUTORS_SONGS+ " (" + + MediaLibrary.ContributorSongColumns.ROLE +" INTEGER, " + + MediaLibrary.ContributorSongColumns._CONTRIBUTOR_ID +" INTEGER, " + + MediaLibrary.ContributorSongColumns.SONG_ID +" INTEGER, " + + "PRIMARY KEY("+MediaLibrary.ContributorSongColumns.ROLE+"," + +MediaLibrary.ContributorSongColumns._CONTRIBUTOR_ID+"," + +MediaLibrary.ContributorSongColumns.SONG_ID+") " + + ");"; + + /** + * song, role index on contributors_songs table + */ + private static final String NAME_IDX_CONTRIBUTORS_SONGS = "idx_contributors_songs"; + private static final String INDEX_IDX_CONTRIBUTORS_SONGS = "CREATE INDEX "+NAME_IDX_CONTRIBUTORS_SONGS+" ON "+MediaLibrary.TABLE_CONTRIBUTORS_SONGS + +" ("+MediaLibrary.ContributorSongColumns.SONG_ID+", "+MediaLibrary.ContributorSongColumns.ROLE+")" + +";"; + + /** + * SQL Schema of `genres' table + */ + private static final String DATABASE_CREATE_GENRES = "CREATE TABLE "+ MediaLibrary.TABLE_GENRES + " (" + + MediaLibrary.GenreColumns._ID +" INTEGER PRIMARY KEY, " + + MediaLibrary.GenreColumns._GENRE +" TEXT NOT NULL, " + + MediaLibrary.GenreColumns._GENRE_SORT +" TEXT NOT NULL " + + ");"; + + /** + * SQL Schema of 'genres<->songs' table + */ + private static final String DATABASE_CREATE_GENRES_SONGS = "CREATE TABLE "+ MediaLibrary.TABLE_GENRES_SONGS + " (" + + MediaLibrary.GenreSongColumns._GENRE_ID +" INTEGER, " + + MediaLibrary.GenreSongColumns.SONG_ID +" INTEGER, " + + "PRIMARY KEY("+MediaLibrary.GenreSongColumns._GENRE_ID+"," + +MediaLibrary.GenreSongColumns.SONG_ID+") " + + ");"; + + /** + * SQL Schema for the playlists table + */ + private static final String DATABASE_CREATE_PLAYLISTS = "CREATE TABLE "+ MediaLibrary.TABLE_PLAYLISTS +" (" + + MediaLibrary.PlaylistColumns._ID +" INTEGER PRIMARY KEY, " + + MediaLibrary.PlaylistColumns.NAME +" TEXT NOT NULL, " + + MediaLibrary.PlaylistColumns.NAME_SORT +" TEXT NOT NULL " + + ");"; + + /** + * SQL Schema of 'songs<->playlists' table + */ + private static final String DATABASE_CREATE_PLAYLISTS_SONGS = "CREATE TABLE "+ MediaLibrary.TABLE_PLAYLISTS_SONGS + " (" + + MediaLibrary.PlaylistSongColumns._ID +" INTEGER PRIMARY KEY, " + + MediaLibrary.PlaylistSongColumns.PLAYLIST_ID +" INTEGER NOT NULL, " + + MediaLibrary.PlaylistSongColumns.SONG_ID +" INTEGER NOT NULL, " + + MediaLibrary.PlaylistSongColumns.POSITION +" INTEGER NOT NULL " + + ");"; + + /** + * Index to select a playlist quickly + */ + private static final String INDEX_IDX_PLAYLIST_ID = "CREATE INDEX idx_playlist_id ON "+MediaLibrary.TABLE_PLAYLISTS_SONGS + +" ("+MediaLibrary.PlaylistSongColumns.PLAYLIST_ID+")" + +";"; + + /** + * Index to select a song from a playlist quickly + */ + private static final String INDEX_IDX_PLAYLIST_ID_SONG = "CREATE INDEX idx_playlist_id_song ON "+MediaLibrary.TABLE_PLAYLISTS_SONGS + +" ("+MediaLibrary.PlaylistSongColumns.PLAYLIST_ID+", "+MediaLibrary.PlaylistSongColumns.SONG_ID+")" + +";"; + + /** + * Additional columns to select for artist info + */ + private static final String VIEW_ARTIST_SELECT = "_artist."+MediaLibrary.ContributorColumns._CONTRIBUTOR+" AS "+MediaLibrary.ContributorColumns.ARTIST + +",_artist."+MediaLibrary.ContributorColumns._CONTRIBUTOR_SORT+" AS "+MediaLibrary.ContributorColumns.ARTIST_SORT + +",_artist."+MediaLibrary.ContributorColumns._ID+" AS "+MediaLibrary.ContributorColumns.ARTIST_ID; + + /** + * Additional columns to select for albumartist info + */ + private static final String VIEW_ALBUMARTIST_SELECT = "_albumartist."+MediaLibrary.ContributorColumns._CONTRIBUTOR+" AS "+MediaLibrary.ContributorColumns.ALBUMARTIST + +",_albumartist."+MediaLibrary.ContributorColumns._CONTRIBUTOR_SORT+" AS "+MediaLibrary.ContributorColumns.ALBUMARTIST_SORT + +",_albumartist."+MediaLibrary.ContributorColumns._ID+" AS "+MediaLibrary.ContributorColumns.ALBUMARTIST_ID; + + /** + * Additional columns to select for composer info + */ + private static final String VIEW_COMPOSER_SELECT = "_composer."+MediaLibrary.ContributorColumns._CONTRIBUTOR+" AS "+MediaLibrary.ContributorColumns.COMPOSER + +",_composer."+MediaLibrary.ContributorColumns._CONTRIBUTOR_SORT+" AS "+MediaLibrary.ContributorColumns.COMPOSER_SORT + +",_composer."+MediaLibrary.ContributorColumns._ID+" AS "+MediaLibrary.ContributorColumns.COMPOSER_ID; + + + /** + * View which includes song, album and artist information, enough for a filled song projection + */ + private static final String VIEW_CREATE_SONGS_ALBUMS_ARTISTS = "CREATE VIEW "+ MediaLibrary.VIEW_SONGS_ALBUMS_ARTISTS+ " AS " + + "SELECT *, " + VIEW_ARTIST_SELECT + " FROM " + MediaLibrary.TABLE_SONGS + +" LEFT JOIN "+MediaLibrary.TABLE_ALBUMS+" ON "+MediaLibrary.TABLE_SONGS+"."+MediaLibrary.SongColumns.ALBUM_ID+" = "+MediaLibrary.TABLE_ALBUMS+"."+MediaLibrary.AlbumColumns._ID + +" LEFT JOIN "+MediaLibrary.TABLE_CONTRIBUTORS_SONGS+" INDEXED BY "+NAME_IDX_CONTRIBUTORS_SONGS + +" ON "+MediaLibrary.TABLE_CONTRIBUTORS_SONGS+"."+MediaLibrary.ContributorSongColumns.ROLE+"="+MediaLibrary.ROLE_ARTIST + +" AND "+MediaLibrary.TABLE_CONTRIBUTORS_SONGS+"."+MediaLibrary.ContributorSongColumns.SONG_ID+" = "+MediaLibrary.TABLE_SONGS+"."+MediaLibrary.SongColumns._ID + +" LEFT JOIN "+MediaLibrary.TABLE_CONTRIBUTORS+" AS _artist ON _artist."+MediaLibrary.ContributorColumns._ID+" = "+MediaLibrary.TABLE_CONTRIBUTORS_SONGS+"."+MediaLibrary.ContributorSongColumns._CONTRIBUTOR_ID + +" ;"; + + /** + * View wich includes SONGS_ALBUMS_ARTISTS and any other contributors + * This view should only be used if needed as the SQL query is pretty expensive + */ + private static final String VIEW_CREATE_SONGS_ALBUMS_ARTISTS_HUGE = "CREATE VIEW "+ MediaLibrary.VIEW_SONGS_ALBUMS_ARTISTS_HUGE+" AS " + + "SELECT *, "+ VIEW_ALBUMARTIST_SELECT +", "+ VIEW_COMPOSER_SELECT +" FROM "+MediaLibrary.VIEW_SONGS_ALBUMS_ARTISTS + // albumartists + +" LEFT JOIN "+MediaLibrary.TABLE_CONTRIBUTORS_SONGS+" as __albumartists INDEXED BY "+NAME_IDX_CONTRIBUTORS_SONGS + +" ON __albumartists."+MediaLibrary.ContributorSongColumns.ROLE+"="+MediaLibrary.ROLE_ALBUMARTIST + +" AND __albumartists."+MediaLibrary.ContributorSongColumns.SONG_ID+" = "+MediaLibrary.VIEW_SONGS_ALBUMS_ARTISTS+"."+MediaLibrary.SongColumns._ID + +" LEFT JOIN "+MediaLibrary.TABLE_CONTRIBUTORS+" AS _albumartist ON" + +" _albumartist."+MediaLibrary.ContributorColumns._ID+" = __albumartists."+MediaLibrary.ContributorSongColumns._CONTRIBUTOR_ID + // composers + +" LEFT JOIN "+MediaLibrary.TABLE_CONTRIBUTORS_SONGS+" as __composers INDEXED BY "+NAME_IDX_CONTRIBUTORS_SONGS + +" ON __composers."+MediaLibrary.ContributorSongColumns.ROLE+"="+MediaLibrary.ROLE_COMPOSER + +" AND __composers."+MediaLibrary.ContributorSongColumns.SONG_ID+" = "+MediaLibrary.VIEW_SONGS_ALBUMS_ARTISTS+"."+MediaLibrary.SongColumns._ID + +" LEFT JOIN "+MediaLibrary.TABLE_CONTRIBUTORS+" AS _composer ON" + +" _composer."+MediaLibrary.ContributorColumns._ID+" = __composers."+MediaLibrary.ContributorSongColumns._CONTRIBUTOR_ID + +" ;"; + + /** + * View which includes album and artist information + */ + private static final String VIEW_CREATE_ALBUMS_ARTISTS = "CREATE VIEW "+ MediaLibrary.VIEW_ALBUMS_ARTISTS+ " AS " + + "SELECT " + MediaLibrary.TABLE_ALBUMS + ".*, " + VIEW_ARTIST_SELECT + ", SUM(" + MediaLibrary.SongColumns.DURATION + ")" + " AS " + MediaLibrary.SongColumns.DURATION + +" FROM " + MediaLibrary.TABLE_ALBUMS + +" LEFT JOIN "+MediaLibrary.TABLE_CONTRIBUTORS+" AS _artist" + +" ON _artist."+MediaLibrary.ContributorColumns._ID+" = "+MediaLibrary.TABLE_ALBUMS+"."+MediaLibrary.AlbumColumns.PRIMARY_ARTIST_ID + +" LEFT JOIN " + MediaLibrary.TABLE_SONGS + +" ON " + MediaLibrary.TABLE_SONGS + "." + MediaLibrary.SongColumns.ALBUM_ID + " = " + MediaLibrary.TABLE_ALBUMS + "." + MediaLibrary.AlbumColumns._ID + +" GROUP BY " + MediaLibrary.TABLE_ALBUMS + "." + MediaLibrary.AlbumColumns._ID + +" ;"; + + /** + * View which includes artist information + */ + private static final String VIEW_CREATE_ARTISTS = "CREATE VIEW "+ MediaLibrary.VIEW_ARTISTS+ " AS " + + "SELECT *, " + VIEW_ARTIST_SELECT + " FROM "+MediaLibrary.TABLE_CONTRIBUTORS+" AS _artist WHERE "+MediaLibrary.ContributorColumns._ID+" IN " + +" (SELECT "+MediaLibrary.ContributorSongColumns._CONTRIBUTOR_ID+" FROM "+MediaLibrary.TABLE_CONTRIBUTORS_SONGS + +" WHERE "+MediaLibrary.ContributorSongColumns.ROLE+"="+MediaLibrary.ROLE_ARTIST+" GROUP BY "+MediaLibrary.ContributorSongColumns._CONTRIBUTOR_ID+")" + +" ;"; + + /** + * View which includes albumArtists information + */ + private static final String VIEW_CREATE_ALBUMARTISTS = "CREATE VIEW "+ MediaLibrary.VIEW_ALBUMARTISTS+ " AS " + + "SELECT *, " + VIEW_ALBUMARTIST_SELECT + " FROM "+MediaLibrary.TABLE_CONTRIBUTORS+" AS _albumartist WHERE "+MediaLibrary.ContributorColumns._ID+" IN " + +" (SELECT "+MediaLibrary.ContributorSongColumns._CONTRIBUTOR_ID+" FROM "+MediaLibrary.TABLE_CONTRIBUTORS_SONGS + +" WHERE "+MediaLibrary.ContributorSongColumns.ROLE+"="+MediaLibrary.ROLE_ALBUMARTIST+" GROUP BY "+MediaLibrary.ContributorSongColumns._CONTRIBUTOR_ID+")" + +" ;"; + + /** + * View which includes composer information + */ + private static final String VIEW_CREATE_COMPOSERS = "CREATE VIEW "+ MediaLibrary.VIEW_COMPOSERS+ " AS " + + "SELECT *, " + VIEW_COMPOSER_SELECT + " FROM "+MediaLibrary.TABLE_CONTRIBUTORS+" AS _composer WHERE "+MediaLibrary.ContributorColumns._ID+" IN " + +" (SELECT "+MediaLibrary.ContributorSongColumns._CONTRIBUTOR_ID+" FROM "+MediaLibrary.TABLE_CONTRIBUTORS_SONGS + +" WHERE "+MediaLibrary.ContributorSongColumns.ROLE+"="+MediaLibrary.ROLE_COMPOSER+" GROUP BY "+MediaLibrary.ContributorSongColumns._CONTRIBUTOR_ID+")" + +" ;"; + + /** + * View like VIEW_CREATE_ARTISTS but includes playlist information + */ + private static final String VIEW_CREATE_PLAYLISTS_SONGS = "CREATE VIEW "+ MediaLibrary.VIEW_PLAYLISTS_SONGS+" AS " + + "SELECT *, " + VIEW_ARTIST_SELECT + " FROM " + MediaLibrary.TABLE_PLAYLISTS_SONGS + +" LEFT JOIN "+MediaLibrary.TABLE_SONGS+" ON "+MediaLibrary.TABLE_PLAYLISTS_SONGS+"."+MediaLibrary.PlaylistSongColumns.SONG_ID+"="+MediaLibrary.TABLE_SONGS+"."+MediaLibrary.SongColumns._ID + // -> same sql as VIEW_CREATE_SONGS_ALBUMS_ARTISTS follows: + +" LEFT JOIN "+MediaLibrary.TABLE_ALBUMS+" ON "+MediaLibrary.TABLE_SONGS+"."+MediaLibrary.SongColumns.ALBUM_ID+" = "+MediaLibrary.TABLE_ALBUMS+"."+MediaLibrary.AlbumColumns._ID + +" LEFT JOIN "+MediaLibrary.TABLE_CONTRIBUTORS_SONGS+" INDEXED BY "+NAME_IDX_CONTRIBUTORS_SONGS + +" ON "+MediaLibrary.TABLE_CONTRIBUTORS_SONGS+"."+MediaLibrary.ContributorSongColumns.ROLE+"="+MediaLibrary.ROLE_ARTIST + +" AND "+MediaLibrary.TABLE_CONTRIBUTORS_SONGS+"."+MediaLibrary.ContributorSongColumns.SONG_ID+" = "+MediaLibrary.TABLE_SONGS+"."+MediaLibrary.SongColumns._ID + +" LEFT JOIN "+MediaLibrary.TABLE_CONTRIBUTORS+" AS _artist ON _artist."+MediaLibrary.ContributorColumns._ID+" = "+MediaLibrary.TABLE_CONTRIBUTORS_SONGS+"."+MediaLibrary.ContributorSongColumns._CONTRIBUTOR_ID + +" ;"; + + /** + * View of all playlists, including additional information such as the duration. + */ + private static final String VIEW_CREATE_PLAYLISTS = "CREATE VIEW "+ MediaLibrary.VIEW_PLAYLISTS+ " AS " + + "SELECT " + MediaLibrary.TABLE_PLAYLISTS + ".*, SUM(_s." + MediaLibrary.SongColumns.DURATION + ") AS " + MediaLibrary.SongColumns.DURATION + " FROM " + MediaLibrary.TABLE_PLAYLISTS + +" LEFT JOIN " + MediaLibrary.TABLE_PLAYLISTS_SONGS + " AS _ps ON " + MediaLibrary.TABLE_PLAYLISTS + "." + MediaLibrary.PlaylistColumns._ID +" = _ps." + MediaLibrary.PlaylistSongColumns.PLAYLIST_ID + +" LEFT JOIN " + MediaLibrary.TABLE_SONGS + " AS _s ON _s." + MediaLibrary.SongColumns._ID + " = _ps." + MediaLibrary.PlaylistSongColumns.SONG_ID + +" GROUP BY " + MediaLibrary.TABLE_PLAYLISTS + "." + MediaLibrary.PlaylistColumns._ID + +" ;"; + + /** + * Creates a new database schema on dbh + * + * @param dbh the writeable dbh to act on + */ + public static void createDatabaseSchema(SQLiteDatabase dbh) { + dbh.execSQL(DATABASE_CREATE_SONGS); + dbh.execSQL(DATABASE_CREATE_ALBUMS); + dbh.execSQL(DATABASE_CREATE_CONTRIBUTORS); + dbh.execSQL(DATABASE_CREATE_CONTRIBUTORS_SONGS); + dbh.execSQL(INDEX_IDX_CONTRIBUTORS_SONGS); + dbh.execSQL(DATABASE_CREATE_GENRES); + dbh.execSQL(DATABASE_CREATE_GENRES_SONGS); + dbh.execSQL(DATABASE_CREATE_PLAYLISTS); + dbh.execSQL(DATABASE_CREATE_PLAYLISTS_SONGS); + dbh.execSQL(INDEX_IDX_PLAYLIST_ID); + dbh.execSQL(INDEX_IDX_PLAYLIST_ID_SONG); + dbh.execSQL(VIEW_CREATE_SONGS_ALBUMS_ARTISTS); + dbh.execSQL(VIEW_CREATE_SONGS_ALBUMS_ARTISTS_HUGE); + dbh.execSQL(VIEW_CREATE_ALBUMS_ARTISTS); + dbh.execSQL(VIEW_CREATE_ARTISTS); + dbh.execSQL(VIEW_CREATE_ALBUMARTISTS); + dbh.execSQL(VIEW_CREATE_COMPOSERS); + dbh.execSQL(VIEW_CREATE_PLAYLISTS); + dbh.execSQL(VIEW_CREATE_PLAYLISTS_SONGS); + } + + /** + * Upgrades an existing database + * + * @param dbh the writeable dbh to use + * @param oldVersion the version of the old (aka: existing) database + */ + public static void upgradeDatabaseSchema(SQLiteDatabase dbh, int oldVersion) { + if (oldVersion < 20170101) { + // this is ugly but was never released as a stable version, so + // it's good enough to keep playlists for testers + dbh.execSQL("DROP TABLE songs"); + dbh.execSQL("DROP TABLE albums"); + dbh.execSQL(DATABASE_CREATE_SONGS); + dbh.execSQL(DATABASE_CREATE_ALBUMS); + } + + if (oldVersion < 20170102) { + dbh.execSQL("UPDATE songs SET disc_num=1 WHERE disc_num IS null"); + } + + if (oldVersion < 20170211) { + // older versions of triggerFullMediaScan did this by mistake + dbh.execSQL("UPDATE songs SET mtime=1 WHERE mtime=0"); + } + + if (oldVersion < 20170217) { + dbh.execSQL(VIEW_CREATE_ALBUMARTISTS); + dbh.execSQL(VIEW_CREATE_COMPOSERS); + dbh.execSQL(VIEW_CREATE_SONGS_ALBUMS_ARTISTS_HUGE); + } + + if (oldVersion >= 20170120 && oldVersion < 20170407) { + dbh.execSQL("DROP TABLE preferences"); + } + + if (oldVersion >= 20170407 && oldVersion < 20170608) { + // renames were buggy for some time -> get rid of duplicates + dbh.execSQL("DELETE FROM "+MediaLibrary.TABLE_SONGS+" WHERE "+MediaLibrary.SongColumns._ID+" IN ("+ + "SELECT "+MediaLibrary.SongColumns._ID+" FROM "+MediaLibrary.VIEW_SONGS_ALBUMS_ARTISTS+" GROUP BY "+ + MediaLibrary.SongColumns._ID+" HAVING count("+MediaLibrary.SongColumns._ID+") > 1)"); + dbh.execSQL("DELETE FROM "+MediaLibrary.TABLE_ALBUMS+" WHERE "+MediaLibrary.AlbumColumns._ID+" NOT IN (SELECT "+MediaLibrary.SongColumns.ALBUM_ID+" FROM "+MediaLibrary.TABLE_SONGS+");"); + dbh.execSQL("DELETE FROM "+MediaLibrary.TABLE_GENRES_SONGS+" WHERE "+MediaLibrary.GenreSongColumns.SONG_ID+" NOT IN (SELECT "+MediaLibrary.SongColumns._ID+" FROM "+MediaLibrary.TABLE_SONGS+");"); + dbh.execSQL("DELETE FROM "+MediaLibrary.TABLE_GENRES+" WHERE "+MediaLibrary.GenreColumns._ID+" NOT IN (SELECT "+MediaLibrary.GenreSongColumns._GENRE_ID+" FROM "+MediaLibrary.TABLE_GENRES_SONGS+");"); + dbh.execSQL("DELETE FROM "+MediaLibrary.TABLE_CONTRIBUTORS_SONGS+" WHERE "+MediaLibrary.ContributorSongColumns.SONG_ID+" NOT IN (SELECT "+MediaLibrary.SongColumns._ID+" FROM "+MediaLibrary.TABLE_SONGS+");"); + dbh.execSQL("DELETE FROM "+MediaLibrary.TABLE_CONTRIBUTORS+" WHERE "+MediaLibrary.ContributorColumns._ID+" NOT IN (SELECT "+MediaLibrary.ContributorSongColumns._CONTRIBUTOR_ID+" FROM "+MediaLibrary.TABLE_CONTRIBUTORS_SONGS+");"); + } + + if (oldVersion < 20170619) { + // Android 4.x tends to not use idx_contributors_songs, resulting in full table scans. + // We will force the use of this index on views doing a LEFT JOIN as it doesn't cause + // any harm to newer sqlite versions. (We know that this is the best index to use). + dbh.execSQL("DROP VIEW "+MediaLibrary.VIEW_SONGS_ALBUMS_ARTISTS); + dbh.execSQL("DROP VIEW "+MediaLibrary.VIEW_SONGS_ALBUMS_ARTISTS_HUGE); + dbh.execSQL("DROP VIEW "+MediaLibrary.VIEW_PLAYLISTS_SONGS); + dbh.execSQL(VIEW_CREATE_SONGS_ALBUMS_ARTISTS); + dbh.execSQL(VIEW_CREATE_SONGS_ALBUMS_ARTISTS_HUGE); + dbh.execSQL(VIEW_CREATE_PLAYLISTS_SONGS); + } + + if (oldVersion >= 20170211 && oldVersion < 20180129) { + // Minor indexer changes - invalidate (but do not drop) all + // existing entries. + dbh.execSQL("UPDATE songs SET mtime=1"); + } + + if (oldVersion < 20180305) { + dbh.execSQL("ALTER TABLE "+MediaLibrary.TABLE_SONGS+" ADD COLUMN "+MediaLibrary.SongColumns.FLAGS+" INTEGER NOT NULL DEFAULT 0 "); + } + + if (oldVersion < 20180416) { + // This adds NAME_SORT, so we need to pre-populate all keys. + dbh.execSQL("ALTER TABLE "+MediaLibrary.TABLE_PLAYLISTS+" RENAME TO _migrate"); + dbh.execSQL(MediaSchema.DATABASE_CREATE_PLAYLISTS); + MediaMigrations.migrate_to_20180416(dbh, "_migrate", MediaLibrary.TABLE_PLAYLISTS); + dbh.execSQL("DROP TABLE _migrate"); + } + + if (oldVersion < 20181021) { + // Recreate view to include album duration + dbh.execSQL("DROP VIEW " + MediaLibrary.VIEW_ALBUMS_ARTISTS); + dbh.execSQL(VIEW_CREATE_ALBUMS_ARTISTS); + } + + if (oldVersion < 20190210) { + dbh.execSQL(VIEW_CREATE_PLAYLISTS); + } + } + +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/Action.java b/app/src/main/java/ch/blinkenlights/android/vanilla/Action.java new file mode 100644 index 0000000..849b560 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/Action.java @@ -0,0 +1,119 @@ +/* + * Copyright (C) 2012 Christopher Eby <kreed@kreed.org> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package ch.blinkenlights.android.vanilla; + +import android.content.SharedPreferences; + +/** + * Various actions that can be passed to {@link PlaybackService#performAction(Action, PlaybackActivity)}. + */ +enum Action { + /** + * Dummy action: do nothing. + */ + Nothing, + /** + * Open the library activity. + */ + Library, + /** + * If playing music, pause. Otherwise, start playing. + */ + PlayPause, + /** + * Skip to the next song. + */ + NextSong, + /** + * Go back to the previous song. + */ + PreviousSong, + /** + * Skip to the first song from the next album. + */ + NextAlbum, + /** + * Skip to the last song from the previous album. + */ + PreviousAlbum, + /** + * Cycle the repeat mode. + */ + Repeat, + /** + * Cycle the shuffle mode. + */ + Shuffle, + /** + * Enqueue the rest of the current album. + */ + EnqueueAlbum, + /** + * Enqueue the rest of the songs by the current artist. + */ + EnqueueArtist, + /** + * Enqueue the rest of the songs in the current genre. + */ + EnqueueGenre, + /** + * Clear the queue of all remaining songs. + */ + ClearQueue, + /** + * Displays the queue + */ + ShowQueue, + /** + * Toggle the controls in the playback activity. + */ + ToggleControls, + /** + * Seek 10 seconds forward + */ + SeekForward, + /** + * Seek 10 seconds back + */ + SeekBackward; + + /** + * Retrieve an action from the given SharedPreferences. + * + * @param prefs The SharedPreferences instance to load from. + * @param key The preference key to load. + * @param def The value to return if the key is not found or cannot be loaded. + * @return The loaded action or def if no action could be loaded. + */ + public static Action getAction(SharedPreferences prefs, String key, Action def) + { + try { + String pref = prefs.getString(key, null); + if (pref == null) + return def; + return Enum.valueOf(Action.class, pref); + } catch (Exception e) { + return def; + } + } +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/AudioPickerActivity.java b/app/src/main/java/ch/blinkenlights/android/vanilla/AudioPickerActivity.java new file mode 100644 index 0000000..540f886 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/AudioPickerActivity.java @@ -0,0 +1,297 @@ +/* + * Copyright (C) 2014-2017 Adrian Ulrich <adrian@blinkenlights.ch> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package ch.blinkenlights.android.vanilla; + +import android.app.Activity; +import android.content.Intent; +import android.database.Cursor; +import android.net.Uri; +import android.os.AsyncTask; +import android.os.Bundle; +import android.provider.MediaStore; +import android.view.View; +import android.view.Window; +import android.widget.TextView; +import android.widget.Button; +import android.widget.ProgressBar; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.io.IOException; +import java.io.OutputStream; + +public class AudioPickerActivity extends PlaybackActivity { + /** + * The cancel button + */ + private Button mCancelButton; + /** + * The enqueue button + */ + private Button mEnqueueButton; + /** + * The play button + */ + private Button mPlayButton; + /** + * The general purpose text view + */ + private TextView mTextView; + /** + * Our endless progress bar + */ + private ProgressBar mProgressBar; + /** + * Song we found, or failed to find + */ + private Song mSong; + /** + * Our async worker task to search for mSong + */ + private AudioPickerWorker mWorker; + + + @Override + public void onCreate(Bundle icicle) { + super.onCreate(icicle); + + Intent intent = getIntent(); + if (intent == null) { + finish(); + return; + } + + if (PermissionRequestActivity.requestPermissions(this, intent)) { + finish(); + return; + } + + Uri uri = intent.getData(); + if (uri == null) { + finish(); + return; + } + + // Basic sanity test done: Create worker + // and setup window. + mWorker = new AudioPickerWorker(); + + // Basic sanity test done: Setup window + requestWindowFeature(Window.FEATURE_NO_TITLE); + setContentView(R.layout.audiopicker); + + // ...and resolve + bind all elements + mCancelButton = (Button)findViewById(R.id.cancel); + mCancelButton.setEnabled(true); + mCancelButton.setOnClickListener(this); + + mEnqueueButton = (Button)findViewById(R.id.enqueue); + mEnqueueButton.setOnClickListener(this); + + mPlayButton = (Button)findViewById(R.id.play); + mPlayButton.setOnClickListener(this); + + mTextView = (TextView)findViewById(R.id.filepath); + mProgressBar = (ProgressBar)findViewById(R.id.progress); + + // UI is ready, we can now execute the actual task. + mWorker.execute(uri); + } + + @Override + public void onClick(View view) + { + int mode; + QueryTask query; + + switch(view.getId()) { + case R.id.play: + mode = SongTimeline.MODE_PLAY; + break; + case R.id.enqueue: + mode = SongTimeline.MODE_ENQUEUE; + break; + default: + mWorker.cancel(false); + finish(); + return; + } + + // This code is not reached unless mSong is filled and non-empty + if (mSong.id < 0) { + query = MediaUtils.buildFileQuery(mSong.path, Song.FILLED_PROJECTION, false /* recursive */); + } else { + query = MediaUtils.buildQuery(MediaUtils.TYPE_SONG, mSong.id, Song.FILLED_PROJECTION, null); + } + + query.mode = mode; + + PlaybackService service = PlaybackService.get(this); + service.addSongs(query); + finish(); + } + + /** + * Called after AudioPickerWorker finished. + * This inspects the result and sets up the view + * if we got a song, cancels the activity otherwise. + * + * @param song the song we found, may be null + */ + private void onSongResolved(Song song) { + mSong = song; + + if (song == null) { + finish(); + return; + } + + // Enable enqueue button if playback service is already + // active (= we are most likely playing a song) + if (PlaybackService.hasInstance()) + mEnqueueButton.setEnabled(true); + + mPlayButton.setEnabled(true); + + // Set the title to display, we use the filename as a fallback + // if the title is empty for whatever reason. + String displayName = song.title; + if ("".equals(song.title)) + displayName = new File(song.path).getName(); + + mTextView.setText(song.title); + mTextView.setVisibility(View.VISIBLE); + mProgressBar.setVisibility(View.GONE); + } + + /** + * Background worker to resolve a song from an Uri. + * Will call onSongResolved(Song) on completion. + */ + private class AudioPickerWorker extends AsyncTask<Uri, Void, Song> { + @Override + protected Song doInBackground(Uri... uri) { + return getSongForUri(uri[0]); + } + @Override + protected void onPostExecute(Song song) { + onSongResolved(song); + } + + /** + * Attempts to resolve given uri to a song object + * + * @param uri The uri to resolve + * @return A song object, null on failure + */ + private Song getSongForUri(Uri uri) { + Song song = new Song(-1); + Cursor cursor = null; + + if (uri.getScheme().equals("content")) { + if (uri.getHost().equals("media")) { + cursor = getCursorForMediaContent(uri); + } else { + cursor = getCursorForAnyContent(uri); + } + } + + if (uri.getScheme().equals("file")) { + cursor = MediaUtils.getCursorForFileQuery(uri.getPath()); + } + + if (cursor != null) { + if (cursor.moveToNext()) { + song.populate(cursor); + } + cursor.close(); + } + return song.isFilled() ? song : null; + } + + /** + * Returns the cursor for a file stored in androids media library. + * + * @param uri the uri to query - expected to be content://media/... + * @return cursor the cursor, may be null. + */ + private Cursor getCursorForMediaContent(Uri uri) { + Cursor cursor = null; + Cursor pathCursor = getContentResolver().query(uri, new String[]{ MediaStore.Audio.Media.DATA }, null, null, null); + if (pathCursor != null) { + if (pathCursor.moveToNext()) { + String mediaPath = pathCursor.getString(0); + if (mediaPath != null) { // this happens on android 4.x sometimes?! + QueryTask query = MediaUtils.buildFileQuery(mediaPath, Song.FILLED_PROJECTION, false /* recursive */); + cursor = query.runQuery(getApplicationContext()); + } + } + pathCursor.close(); + } + return cursor; + } + + /** + * Returns the cursor for any content:// uri. The contents will be stored + * in our application cache. + * + * @param uri the uri to query + * @return cursor the cursor, may be null. + */ + private Cursor getCursorForAnyContent(Uri uri) { + Cursor cursor = null; + File outFile = null; + InputStream ins = null; + OutputStream ous = null; + + // Cache a local copy, this should really run in a background thread, but we + // are usually reading local files, which is fast enough. + try { + byte[] buffer = new byte[8192]; + ins = getContentResolver().openInputStream(uri); + outFile = File.createTempFile("cached-download-", ".bin", getCacheDir()); + ous = new FileOutputStream(outFile); + + int len = 0; + while ((len = ins.read(buffer)) != -1) { + ous.write(buffer, 0, len); + if (isCancelled()) { + throw new IOException("Canceled"); + } + } + outFile.deleteOnExit(); + } catch (IOException e) { + if (outFile != null) { + outFile.delete(); + } + outFile = null; // signals failure. + } finally { + try { if (ins != null) ins.close(); } catch(IOException e) {} + try { if (ous != null) ous.close(); } catch(IOException e) {} + } + + if (outFile != null) { + cursor = MediaUtils.getCursorForFileQuery(outFile.getPath()); + } + return cursor; + } + } + + +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/AudioSearchActivity.java b/app/src/main/java/ch/blinkenlights/android/vanilla/AudioSearchActivity.java new file mode 100644 index 0000000..d51534e --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/AudioSearchActivity.java @@ -0,0 +1,96 @@ +/* + * Copyright (C) 2017 Adrian Ulrich <adrian@blinkenlights.ch> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package ch.blinkenlights.android.vanilla; + +import android.app.Activity; +import android.app.SearchManager; +import android.content.Context; +import android.content.Intent; +import android.database.Cursor; +import android.os.AsyncTask; +import android.os.Bundle; +import android.provider.MediaStore; +import android.view.Window; + +public class AudioSearchActivity extends PlaybackActivity { + /** + * The AsyncTask used to perform the query. + */ + private AudioSearchWorker mWorker; + + @Override + public void onCreate(Bundle icicle) { + super.onCreate(icicle); + + Intent intent = getIntent(); + String action = (intent == null ? null : intent.getAction()); + if (action == null || !action.equals(MediaStore.INTENT_ACTION_MEDIA_PLAY_FROM_SEARCH)) { + finish(); + return; + } + + if (PermissionRequestActivity.requestPermissions(this, intent)) { + finish(); + return; + } + + requestWindowFeature(Window.FEATURE_NO_TITLE); + // Fixme: add a progress dialog. + + String query = intent.getExtras().getString(SearchManager.QUERY); + mWorker = new AudioSearchWorker(); + mWorker.execute(query); + } + + /** + * Called by AudioSearchWorker after the search completed. + */ + private void onSearchCompleted() { + finish(); + } + + /** + * Async worker class used to perform the search + */ + private class AudioSearchWorker extends AsyncTask<String, Void, Void> { + @Override + protected Void doInBackground(String... search) { + Context ctx = getApplicationContext(); + MediaAdapter adapter = new MediaAdapter(ctx, MediaUtils.TYPE_SONG, null, null); + adapter.setFilter(search[0]); + + QueryTask query = adapter.buildSongQuery(Song.FILLED_PROJECTION); + query.mode = SongTimeline.MODE_PLAY; + + PlaybackService service = PlaybackService.get(ctx); + service.pause(); + service.setShuffleMode(SongTimeline.SHUFFLE_ALBUMS); + service.emptyQueue(); + service.addSongs(query); + if (service.getTimelineLength() > 0) { + service.play(); + } + return null; + } + @Override + protected void onPostExecute(Void nil) { + onSearchCompleted(); + } + } + +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/BastpUtil.java b/app/src/main/java/ch/blinkenlights/android/vanilla/BastpUtil.java new file mode 100644 index 0000000..4f652e7 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/BastpUtil.java @@ -0,0 +1,130 @@ +/* + * Copyright (C) 2013-2019 Adrian Ulrich <adrian@blinkenlights.ch> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package ch.blinkenlights.android.vanilla; + +import android.util.LruCache; +import ch.blinkenlights.bastp.Bastp; +import java.util.ArrayList; +import java.util.HashMap; + +public class BastpUtil { + /** + * Our global instance cache + */ + private RGLruCache rgCache; + /** + * What we return & cache + */ + public class GainValues { + public float album; + public float track; + public boolean found; + } + /** + * LRU cache for ReplayGain values + */ + private class RGLruCache extends LruCache<String, GainValues> { + public RGLruCache(int size) { + super(size); + } + } + + + public BastpUtil() { + rgCache = new RGLruCache(64); + } + + /** + * Returns a GainValues object for `path' + */ + public GainValues getReplayGainValues(String path) { + if(path == null) { + // path must not be null + path = "//null\\"; + } + + GainValues cached = rgCache.get(path); + if(cached == null) { + cached = getReplayGainValuesFromFile(path); + rgCache.put(path, cached); + } + return cached; + } + + /** + * Parse given file and return track,album replay gain values + */ + private GainValues getReplayGainValuesFromFile(String path) { + HashMap tags = (new Bastp()).getTags(path); + GainValues gv = new GainValues(); + + // normal replay gain + if(tags.containsKey("REPLAYGAIN_TRACK_GAIN")) { + gv.track = getFloatFromString((String)((ArrayList)tags.get("REPLAYGAIN_TRACK_GAIN")).get(0)); + gv.found = true; + } + if(tags.containsKey("REPLAYGAIN_ALBUM_GAIN")) { + gv.album = getFloatFromString((String)((ArrayList)tags.get("REPLAYGAIN_ALBUM_GAIN")).get(0)); + gv.found = true; + } + + // R128 replay gain + boolean r128 = false; + if(tags.containsKey("R128_BASTP_BASE_GAIN")) { + // This is the gain found in the opus header which automatically gets applied by the media framework. + // We therefore do not need to include it in our calculation, but we set the 'found' bit and reset + // both album and track gain information as an opus file should only ever contain r128 gain infos. + float base = getFloatFromString((String)((ArrayList)tags.get("R128_BASTP_BASE_GAIN")).get(0)) / 256.0f; + if (base != 0.0f) { + gv.track = 0; + gv.album = 0; + gv.found = true; + } + } + if(tags.containsKey("R128_TRACK_GAIN")) { + gv.track += getFloatFromString((String)((ArrayList)tags.get("R128_TRACK_GAIN")).get(0)) / 256.0f; + gv.found = true; + r128 = true; + } + if(tags.containsKey("R128_ALBUM_GAIN")) { + gv.album += getFloatFromString((String)((ArrayList)tags.get("R128_ALBUM_GAIN")).get(0)) / 256.0f; + gv.found = true; + r128 = true; + } + + if (r128) { + gv.track += 5.0f; + gv.album += 5.0f; + } + return gv; + } + + /** + * Parses common replayGain string values + */ + private float getFloatFromString(String rg_raw) { + float rg_float = 0f; + try { + String nums = rg_raw.replaceAll("[^0-9.-]",""); + rg_float = Float.parseFloat(nums); + } catch(Exception e) {} + return rg_float; + } + +} + diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/BottomBarControls.java b/app/src/main/java/ch/blinkenlights/android/vanilla/BottomBarControls.java new file mode 100644 index 0000000..ecae037 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/BottomBarControls.java @@ -0,0 +1,310 @@ +/* + * Copyright (C) 2016 Adrian Ulrich <adrian@blinkenlights.ch> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package ch.blinkenlights.android.vanilla; + +import android.annotation.SuppressLint; +import android.app.Activity; +import android.content.Context; +import android.content.res.Resources; +import android.graphics.drawable.Drawable; +import android.graphics.Bitmap; +import android.os.Parcelable; +import android.util.AttributeSet; +import android.view.Gravity; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageButton; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.PopupMenu; +import android.widget.SearchView; +import android.widget.TextView; + + +public class BottomBarControls extends LinearLayout + implements View.OnClickListener + , PopupMenu.OnMenuItemClickListener + { + /** + * The application context + */ + private final Context mContext; + /** + * The title of the currently playing song + */ + private TextView mTitle; + /** + * The artist of the currently playing song + */ + private TextView mArtist; + /** + * Cover image + */ + private ImageView mCover; + /** + * A layout hosting the song information + */ + private LinearLayout mControlsContent; + /** + * Standard android search view + */ + private SearchView mSearchView; + /** + * The assembled PopupMenu + */ + private PopupMenu mPopupMenu; + /** + * ControlsContent click consumer, may be null + */ + private View.OnClickListener mParentClickConsumer; + /** + * Owner of our options menu and consumer of clicks + */ + private Activity mParentMenuConsumer; + + + public BottomBarControls(Context context, AttributeSet attrs) { + super(context, attrs); + mContext = context; + } + + @Override + public void onFinishInflate() { + mTitle = (TextView)findViewById(R.id.title); + mArtist = (TextView)findViewById(R.id.artist); + mCover = (ImageView)findViewById(R.id.cover); + mSearchView = (SearchView)findViewById(R.id.search_view); + mControlsContent = (LinearLayout)findViewById(R.id.content_controls); + + styleSearchView(mSearchView, mContext.getResources().getColor(android.R.color.background_light)); + + super.onFinishInflate(); + } + + @Override + public void onClick(View view) { + Object tag = view.getTag(); + if (tag instanceof PopupMenu) { + openMenu(); + } else if (tag instanceof MenuItem) { + mParentMenuConsumer.onOptionsItemSelected((MenuItem)tag); + } else if (view == mControlsContent && mParentClickConsumer != null) { + // dispatch this click to parent, claiming it came from + // the top view (= this) + mParentClickConsumer.onClick(this); + } + } + + @Override + public boolean onMenuItemClick(MenuItem item) { + return mParentMenuConsumer.onOptionsItemSelected(item); + } + + @Override + public Parcelable onSaveInstanceState() { + // Forcefully hide (and clear) search as we are not going to restore the state + showSearch(false); + return super.onSaveInstanceState(); + } + + /** + * Sets the ControlsContent to be clickable + */ + public void setOnClickListener(View.OnClickListener listener) { + mParentClickConsumer = listener; + mControlsContent.setOnClickListener(this); + } + + /** + * Configures a query text listener for the search view + */ + public void setOnQueryTextListener(SearchView.OnQueryTextListener owner) { + mSearchView.setOnQueryTextListener(owner); + } + + /** + * Boots the options menu + * + * @param owner the activity who will receive our callbacks + */ + @SuppressLint("NewApi") // PopupMenu with gravity is API19, checked by menuMargin() + public void enableOptionsMenu(Activity owner) { + mParentMenuConsumer = owner; + + ImageButton menuButton = getImageButton(getResources().getDrawable(R.drawable.ic_menu_moreoverflow)); + mPopupMenu = (menuMargin() ? new PopupMenu(mContext, menuButton, Gravity.RIGHT) : new PopupMenu(mContext, menuButton)); + mPopupMenu.setOnMenuItemClickListener(this); + + // Let parent populate the menu + mParentMenuConsumer.onCreateOptionsMenu(mPopupMenu.getMenu()); + + // The menu is now ready, we an now add all invisible + // items with an icon to the toolbar + Menu menu = mPopupMenu.getMenu(); + for (int i=0; i < menu.size(); i++) { + MenuItem menuItem = menu.getItem(i); + if (menuItem.isVisible() == false && menuItem.getIcon() != null) { + ImageButton button = getImageButton(menuItem.getIcon()); + button.setTag(menuItem); + button.setOnClickListener(this); + mControlsContent.addView(button, -1); + } + } + + // Add menu button as last item + menuButton.setTag(mPopupMenu); + menuButton.setOnClickListener(this); + int specialSnowflake = menuMargin() ? dpToPx(36) : LinearLayout.LayoutParams.WRAP_CONTENT; + menuButton.setLayoutParams(new LinearLayout.LayoutParams(specialSnowflake, LinearLayout.LayoutParams.WRAP_CONTENT)); + mControlsContent.addView(menuButton, -1); + + // Add a clickable and empty view + // We will use this to add a margin to the menu button if required + // Note that the view will ALWAYS be present, even if it is 0dp wide to keep + // the menu button at position -2 + View spacer = new View(mContext); + spacer.setOnClickListener(this); + spacer.setTag(mPopupMenu); + int spacerDp = menuMargin() ? dpToPx(4) : 0; + spacer.setLayoutParams(new LinearLayout.LayoutParams(spacerDp, LinearLayout.LayoutParams.MATCH_PARENT)); + mControlsContent.addView(spacer, -1); + } + + /** + * Opens the OptionsMenu of this view + */ + public void openMenu() { + if (mPopupMenu == null || mParentMenuConsumer == null) + return; + mParentMenuConsumer.onPrepareOptionsMenu(mPopupMenu.getMenu()); + mPopupMenu.show(); + } + + /** + * Sets the search view to given state + * + * @param visible enables or disables the search box visibility + * @return boolean old state + */ + public boolean showSearch(boolean visible) { + boolean wasVisible = mSearchView.getVisibility() == View.VISIBLE; + if (wasVisible != visible) { + mSearchView.setVisibility(visible ? View.VISIBLE : View.GONE); + mControlsContent.setVisibility(visible ? View.GONE : View.VISIBLE); + if (visible) + mSearchView.setIconified(false); // requests focus AND shows the soft keyboard even if the view already was expanded + else + mSearchView.setQuery("", false); + } + return wasVisible; + } + + /** + * Updates the cover image of this view + * + * @param cover the bitmap to display. Will use a placeholder image if cover is null + */ + public void setCover(Bitmap cover) { + if (cover == null) + mCover.setImageResource(R.drawable.fallback_cover); + else + mCover.setImageBitmap(cover); + } + + /** + * Updates the song metadata + * + * @param song the song info to display, may be null + */ + public void setSong(Song song) { + if (song == null) { + mTitle.setText(null); + mArtist.setText(null); + mCover.setImageBitmap(null); + } else { + Resources res = mContext.getResources(); + String title = song.title == null ? res.getString(R.string.unknown) : song.title; + String artist = song.artist == null ? res.getString(R.string.unknown) : song.artist; + mTitle.setText(title); + mArtist.setText(artist); + } + } + + /** + * Returns a new image button to be placed on the bar + * + * @param drawable The icon to use + */ + private ImageButton getImageButton(Drawable drawable) { + + ImageButton button = new ImageButton(mContext); + button.setImageDrawable(drawable); + button.setBackgroundResource(R.drawable.unbound_ripple_light); + return button; + } + + /** + * Changing the colors of a search view is a MAJOR pain using XML + * This cheap trick just loop trough the view and changes the + * color of all text- and image views to 'style' + * + * @param view the view to search + * @param color the color to apply + */ + private void styleSearchView(View view, int color) { + if (view != null) { + if (view instanceof TextView) { + ((TextView)view).setTextColor(color); + } else if (view instanceof ImageView) { + ((ImageView)view).setColorFilter(color); + } else if (view instanceof ViewGroup) { + ViewGroup group = (ViewGroup)view; + for (int i=0; i< group.getChildCount(); i++) { + styleSearchView(group.getChildAt(i), color); + } + } + } + } + + /** + * Returns true if we need to add a margin to the menu. + * Because ...reasons. + */ + private boolean menuMargin() { + // Was false for holo, maybe will be true again in the future? ;-) + return true; + } + + /** + * Convert dp into pixels + * + * @param dp input as dp + * @return output as px + */ + private int dpToPx(int dp) { + return (int)(getResources().getDisplayMetrics().density * dp); + } + +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/CoverBitmap.java b/app/src/main/java/ch/blinkenlights/android/vanilla/CoverBitmap.java new file mode 100644 index 0000000..cd289d9 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/CoverBitmap.java @@ -0,0 +1,447 @@ +/* + * Copyright (C) 2010, 2011 Christopher Eby <kreed@kreed.org> + * Copyright 2017-2020 Adrian Ulrich <adrian@blinkenlights.ch> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package ch.blinkenlights.android.vanilla; + +import android.content.Context; +import android.content.res.Resources; +import android.content.res.TypedArray; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.graphics.BitmapShader; +import android.graphics.Canvas; +import android.graphics.Paint; +import android.graphics.PorterDuff; +import android.graphics.PorterDuffColorFilter; +import android.graphics.Rect; +import android.graphics.RectF; +import android.graphics.Shader; +import android.util.DisplayMetrics; +import android.util.TypedValue; + +/** + * Class containing utility functions to create Bitmaps display song info and + * album art. + */ +public final class CoverBitmap { + /** + * Draw cover in background and a box with song info on top. + */ + public static final int STYLE_OVERLAPPING_BOX = 0; + /** + * Draw cover on top or left with song info on bottom or right (depending + * on orientation). + */ + public static final int STYLE_INFO_BELOW = 1; + /** + * Draw no song info, only the cover. + */ + public static final int STYLE_NO_INFO = 2; + /** + * Whether or not to debug painting operations. + */ + private static final boolean DEBUG_PAINT = false; + /** + * Cover slack ratio + */ + private static final float SLACK_RATIO = 0.95f; + + private static int TEXT_SIZE = -1; + private static int TEXT_SIZE_BIG; + private static int PADDING; + private static int TOP_PADDING; + private static int BOTTOM_PADDING; + + /** + * Initialize the regular text size members. + * + * @param context A context to use. + */ + private static void loadTextSizes(Context context) + { + DisplayMetrics metrics = context.getResources().getDisplayMetrics(); + TEXT_SIZE = (int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 20, metrics); + TEXT_SIZE_BIG = (int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 24, metrics); + PADDING = (int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 16, metrics); + // padding to take actionbar into account. + TOP_PADDING = (int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 14, metrics); + // space we keep from the view bottom. + BOTTOM_PADDING = (int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 32, metrics); + } + + /** + * Helper function to draw text within a set width + * + * @param canvas The canvas to draw to + * @param text The text to draw + * @param left The x coordinate of the left edge of the text + * @param top The y coordinate of the top edge of the text + * @param width The measured width of the text + * @param maxWidth The maximum width of the text. Text outside of this width + * will be truncated. + * @param paint The paint style to use + */ + private static void drawText(Canvas canvas, String text, int left, int top, int width, int maxWidth, Paint paint) + { + canvas.save(); + int offset = Math.max(0, maxWidth - width) / 2; + canvas.clipRect(left, top, left + maxWidth, top + paint.getTextSize() * 2); + canvas.drawText(text, left + offset, top - paint.ascent(), paint); + canvas.restore(); + } + + /** + * Create an image representing the given song. Includes cover art and + * possibly song title/artist/ablum, depending on the given style. + * + * @param context A context to use. + * @param style One of CoverBitmap.STYLE_* + * @param coverArt The cover art for the song. + * @param song Title and other data are taken from here for info modes. + * @param width Maximum width of image + * @param height Maximum height of image + * @return The image, or null if the song was null, or width or height + * were less than 1 + */ + public static Bitmap createBitmap(Context context, int style, Bitmap coverArt, Song song, int width, int height) + { + switch (style) { + case STYLE_OVERLAPPING_BOX: + return createOverlappingBitmap(context, coverArt, song, width, height); + case STYLE_INFO_BELOW: + return createSeparatedBitmap(context, coverArt, song, width, height); + case STYLE_NO_INFO: + return createScaledBitmap(coverArt, width, height); + default: + throw new IllegalArgumentException("Invalid bitmap type given: " + style); + } + } + + private static Bitmap createOverlappingBitmap(Context context, Bitmap cover, Song song, int width, int height) + { + if (TEXT_SIZE == -1) + loadTextSizes(context); + + Paint paint = new Paint(); + paint.setAntiAlias(true); + + String title = song.title == null ? "" : song.title; + String album = song.album == null ? "" : song.album; + String artist = song.artist == null ? "" : song.artist; + + int titleSize = TEXT_SIZE_BIG; + int subSize = TEXT_SIZE; + int padding = PADDING; + + paint.setTextSize(titleSize); + int titleWidth = (int)paint.measureText(title); + paint.setTextSize(subSize); + int albumWidth = (int)paint.measureText(album); + int artistWidth = (int)paint.measureText(artist); + + int boxWidth = Math.min(width, Math.max(titleWidth, Math.max(artistWidth, albumWidth)) + padding * 2); + int boxHeight = Math.min(height, titleSize + subSize * 2 + padding * 4); + + int coverWidth = 0; + int coverHeight = 0; + if (cover != null) { + cover = createScaledBitmap(cover, width, height); + coverWidth = cover.getWidth(); + coverHeight = cover.getHeight(); + } + + Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); + Canvas canvas = new Canvas(bitmap); + + if (DEBUG_PAINT) { + Paint dpaint = new Paint(); + dpaint.setColor(0xffff0000); + dpaint.setStyle(Paint.Style.FILL); + canvas.drawPaint(dpaint); + } + + if (coverWidth != 0) { + canvas.drawBitmap(cover, (width-coverWidth)/2, (height-coverHeight)/2, new Paint()); + } + + int left = (width - boxWidth) / 2; + int top = (height - boxHeight) / 2; + int right = (width + boxWidth) / 2; + int bottom = (height + boxHeight) / 2; + + paint.setARGB(150, 0, 0, 0); + canvas.drawRect(left, top, right, bottom, paint); + + int maxWidth = boxWidth - padding * 2; + paint.setARGB(255, 255, 255, 255); + top += padding; + left += padding; + + paint.setTextSize(titleSize); + drawText(canvas, title, left, top, titleWidth, maxWidth, paint); + top += titleSize + padding; + + paint.setTextSize(subSize); + drawText(canvas, album, left, top, albumWidth, maxWidth, paint); + top += subSize + padding; + + drawText(canvas, artist, left, top, artistWidth, maxWidth, paint); + + return bitmap; + } + + private static Bitmap createSeparatedBitmap(Context context, Bitmap cover, Song song, int width, int height) + { + if (TEXT_SIZE == -1) + loadTextSizes(context); + + int textSize = TEXT_SIZE; + int textSizeBig = TEXT_SIZE_BIG; + int padding = PADDING; + int topPadding = TOP_PADDING; + int bottomPadding = BOTTOM_PADDING; + + // Get desired text color from theme and draw textual information + int colors[] = ThemeHelper.getDefaultCoverColors(context); + // inverted cover background color. + int textColor = 0xFF000000 + (0xFFFFFF - (colors[0] & 0xFFFFFF)); + // Whether or not the image is rendered in vertical mode. + boolean verticalMode = width > height; + + // Prepare text and calculate minimum height, so we can ensure + // that the cover doesn't 'eat' into it. + String title = song.title == null ? "" : song.title; + String album = song.album == null ? "" : song.album; + String artist = song.artist == null ? "" : song.artist; + // Space required to draw the bottom text. + int textTotalHeight = padding + textSizeBig + (padding+textSize) * 2 + padding; + // Y coord where text shall be placed. + int textStart = (verticalMode ? (height-textTotalHeight)/2 : height - bottomPadding - textTotalHeight); + + Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); + Canvas canvas = new Canvas(bitmap); + + if (DEBUG_PAINT) { + Paint dpaint = new Paint(); + dpaint.setColor(0xffff0033); + dpaint.setStyle(Paint.Style.FILL); + canvas.drawPaint(dpaint); + } + + if (cover != null) { + Bitmap scaled; + if (verticalMode) { + int hh = height/2; + int hw = width/2; + scaled = createScaledBitmap(cover, Math.min(hw, height), Math.min(hw, height)); + canvas.drawBitmap(scaled, (hw-scaled.getWidth())/2, (height-scaled.getHeight())/2, null); + } else { + scaled = createScaledBitmap(cover, width, textStart); + canvas.drawBitmap(scaled, (width-scaled.getWidth())/2, 0, null); + } + } + + // Where to start drawing the text. + int top = textStart; + + // Now draw the text: + PorterDuffColorFilter filter = new PorterDuffColorFilter(textColor, PorterDuff.Mode.SRC_ATOP); + Paint paint = new Paint(); + paint.setAntiAlias(true); + + // how much to shift text to the right forcefully. + int tshift = (verticalMode ? width/2 : 0); + // Title + paint.setColorFilter(filter); + paint.setTextSize(textSizeBig); + int twidth = (int)paint.measureText(title); + int tstart = tshift+(width - tshift - twidth)/2; + drawText(canvas, title, tstart, top, width, twidth, paint); + + // Bottom text + paint.setAlpha(0xAA); + paint.setTextSize(textSize); + + // Album + top += textSizeBig + padding; + twidth = (int)paint.measureText(album); + tstart = tshift+(width - tshift - twidth)/2; + drawText(canvas, album, tstart, top, width, twidth, paint); + + // Artist + top += textSize + padding; + twidth = (int)paint.measureText(artist); + tstart = tshift+(width - tshift - twidth)/2; + drawText(canvas, artist, tstart, top, width, twidth, paint); + + return bitmap; + } + + /** + * Scales a bitmap to fit in a rectangle of the given size. Aspect ratio is + * preserved. At least one dimension of the result will match the provided + * dimension exactly. + * + * @param source The bitmap to be scaled + * @param width Maximum width of image + * @param height Maximum height of image + * @return The scaled bitmap. + */ + private static Bitmap createScaledBitmap(Bitmap source, int width, int height) + { + int sourceWidth = source.getWidth(); + int sourceHeight = source.getHeight(); + float scale = Math.min((float)width / sourceWidth, (float)height / sourceHeight); + sourceWidth *= scale; + sourceHeight *= scale; + Bitmap scaled = Bitmap.createScaledBitmap(source, (int)(SLACK_RATIO*sourceWidth), (int)(SLACK_RATIO*sourceHeight), true); + return createBorderedBitmap(scaled, sourceWidth, sourceHeight); + } + + /** + * Creates a bitmap with a round border. The returned bitmap will fit exactly + * into the passed in dimensions and the source image is not scaled. + * + * @param source the source bitmap to use + * @param width the with of the returned bitmap + * @param height the height of the returned bitmap + * @return the painted bitmap + */ + private static Bitmap createBorderedBitmap(Bitmap source, int width, int height) { + Bitmap dst = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); + Canvas canvas = new Canvas(dst); + + if (DEBUG_PAINT) { + Paint dpaint = new Paint(); + dpaint.setColor(0xff0000ff); + dpaint.setStyle(Paint.Style.FILL); + canvas.drawPaint(dpaint); + } + + BitmapShader shader = new BitmapShader(source, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP); + Paint paint = new Paint(); + paint.setAntiAlias(true); + paint.setShader(shader); + + RectF rect = new RectF(0.0f, 0.0f, source.getWidth(), source.getHeight()); + float radius = 12; + canvas.translate((height-source.getHeight())/2, (width-source.getWidth())/2); + canvas.drawRoundRect(rect, radius, radius, paint); + return dst; + } + + /** + * Generate the default cover (a rendition of a music note). Returns a square iamge. + * Both dimensions are the lesser of width and height. + * + * @param width The max width + * @param height The max height + * @return The default cover. + */ + public static Bitmap generateDefaultCover(Context context, int width, int height) + { + int size = Math.min(width, height); + + int[] colors = ThemeHelper.getDefaultCoverColors(context); + int rgb_background = colors[0]; + int rgb_note_inner = colors[1]; + + final int line_thickness = size / 10; + final int line_vertical = line_thickness*5; + final int line_horizontal = line_thickness*3; + final int circle_radius = line_thickness*2; + + final int total_len_x = circle_radius*2 + line_horizontal - line_thickness; // total length of x axis + final int total_len_y = circle_radius + line_vertical + (line_thickness/2); // total length of y axis + final int xoff = circle_radius + (size - total_len_x)/2; // 'center offset' of x + final int yoff = size - circle_radius - (size - total_len_y)/2; // 'center offset' of y + + Bitmap bitmap = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888); + bitmap.eraseColor(rgb_background); + + Paint paint = new Paint(); + paint.setAntiAlias(true); + paint.setColor(rgb_note_inner); + + Canvas canvas = new Canvas(bitmap); + // main circle + canvas.drawCircle(xoff, yoff, circle_radius, paint); + // vertical line + int lpos = xoff + circle_radius - line_thickness; // lpos + thickness will touch the outer right edge of the circle + int tpos = yoff - line_vertical; // tpos + vertical will be the center of the circle + canvas.drawRoundRect(new RectF(lpos, tpos, lpos+line_thickness, yoff), 0, 0, paint); + // horizontal line + int hdiff = tpos - (line_thickness/2); // shift this up by half of the thickness to have the circle radius touch the top of the vertical line + canvas.drawRoundRect(new RectF(lpos, hdiff, lpos+line_horizontal, hdiff+line_thickness), line_thickness, line_thickness, paint); + + return bitmap; + } + + /** + * Draws a placeholder cover from given title string + * + * @param title A text string to use in the cover + * @return bitmap The drawn bitmap + */ + public static Bitmap generatePlaceholderCover(Context context, int width, int height, String title) + { + if (title == null || width < 1 || height < 1) + return null; + + final float textSize = width * 0.4f; + + title = title.replaceFirst("(?i)^The ", ""); // 'The\s' shall not be a part of the string we are drawing. + title = title.replaceAll("[ <>_-]", ""); // Remove clutter, so eg. J-Rock becomes JR + String subText = (title+" ").substring(0,2); + + // Use only the first char if it is 'wide' + if(Character.UnicodeBlock.of(subText.charAt(0)) == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS) { + subText = subText.substring(0,1); + } + + Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.RGB_565); + Canvas canvas = new Canvas(bitmap); + Paint paint = new Paint(); + + // Picks a semi-random color from tiles_colors.xml + TypedValue tv = new TypedValue(); + context.getTheme().resolveAttribute(R.attr.themed_letter_tile_colors, tv, false); + TypedArray colors = context.getResources().obtainTypedArray(tv.data); + int color = colors.getColor(Math.abs(title.hashCode()) % colors.length(), 0); + colors.recycle(); + paint.setColor(color); + + paint.setStyle(Paint.Style.FILL); + canvas.drawPaint(paint); + + paint.setARGB(255, 255, 255, 255); + paint.setAntiAlias(true); + paint.setTextSize(textSize); + + Rect bounds = new Rect(); + paint.getTextBounds(subText, 0, subText.length(), bounds); + + canvas.drawText(subText, (width/2f)-bounds.exactCenterX(), (height/2f)-bounds.exactCenterY(), paint); + return bitmap; + } +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/CoverCache.java b/app/src/main/java/ch/blinkenlights/android/vanilla/CoverCache.java new file mode 100644 index 0000000..ca218e1 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/CoverCache.java @@ -0,0 +1,527 @@ +/* + * Copyright (C) 2015-2017 Adrian Ulrich <adrian@blinkenlights.ch> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package ch.blinkenlights.android.vanilla; + +import android.content.ContentResolver; +import android.content.ContentValues; +import android.content.Context; +import android.content.res.Resources; +import android.database.Cursor; +import android.database.sqlite.SQLiteDatabase; +import android.database.sqlite.SQLiteOpenHelper; +import android.graphics.Bitmap; +import android.graphics.Bitmap.CompressFormat; +import android.graphics.BitmapFactory; +import android.media.MediaMetadataRetriever; +import android.net.Uri; +import android.os.Environment; +import android.util.DisplayMetrics; +import android.util.Log; + +import java.io.ByteArrayOutputStream; +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; +import java.util.Random; +import java.util.regex.Pattern; + + +public class CoverCache { + /** + * Display metrics as reported by the system during class creation. + */ + private final static DisplayMetrics METRICS = Resources.getSystem().getDisplayMetrics(); + /** + * Returned size of small album covers + * 44sp is the width & height of a library row + */ + public final static int SIZE_SMALL = (int)(44 * METRICS.density); + /** + * Cover to use in remote views with a medium size. + */ + public final static int SIZE_MEDIUM = (int)(240 * METRICS.density); + /** + * Cover to use in the highest quality possible (full cover view). + */ + public final static int SIZE_LARGE = (METRICS.heightPixels > METRICS.widthPixels ? METRICS.widthPixels : METRICS.heightPixels); + /** + * Use all cover providers to load cover art + */ + public static final int COVER_MODE_ALL = 0xF; + /** + * Use androids builtin cover mechanism to load covers + */ + public static final int COVER_MODE_ANDROID = 0x1; + /** + * Use vanilla musics cover load mechanism + */ + public static final int COVER_MODE_VANILLA = 0x2; + /** + * Use vanilla musics SHADOW cover load mechanism + */ + public static final int COVER_MODE_SHADOW = 0x4; + /** + * Use vanilla musics INLINE cover load mechanism + */ + public static final int COVER_MODE_INLINE = 0x8; + /** + * Shared on-disk cache class + */ + private static BitmapDiskCache sBitmapDiskCache; + /** + * Bitmask on how we are going to load coverart + */ + public static int mCoverLoadMode = 0; + /** + * The public downloads directory of this device + */ + private static final File sDownloadsDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS); + + + /** + * Constructs a new BitmapCache object + * Will initialize the internal LRU cache on first call + * + * @param context A context to use + */ + public CoverCache(Context context) { + if (sBitmapDiskCache == null) { + sBitmapDiskCache = new BitmapDiskCache(context.getApplicationContext(), 25*1024*1024); + } + } + + /** + * Returns a (possibly uncached) cover for the song - will return null if the song has no cover + * + * @param ctx The context to retrieve the bitmap from cache via external content uri + * @param song The song used to identify the artwork to load + * @return a bitmap or null if no artwork was found + */ + public Bitmap getCoverFromSong(Context ctx, Song song, int size) { + CoverKey key = new CoverCache.CoverKey(MediaUtils.TYPE_ALBUM, song.albumId, size); + Bitmap cover = getStoredCover(key); + if (cover == null) { + cover = sBitmapDiskCache.createBitmap(ctx, song, size*size); + if (cover != null) { + storeCover(key, cover); + cover = getStoredCover(key); // return lossy version to avoid random quality changes + } + } + return cover; + } + + /** + * Returns the on-disk cached version of the cover. + * Should only be used on a background thread + * + * @param key The cache key to use + * @return bitmap or null on cache miss + */ + private Bitmap getStoredCover(CoverKey key) { + return sBitmapDiskCache.get(key); + } + + /** + * Stores a new entry in the on-disk cache + * Use getStoredCover to read the cached contents back + * + * @param key The cache key to use + * @param cover The bitmap to store + */ + private void storeCover(CoverKey key, Bitmap cover) { + sBitmapDiskCache.put(key, cover); + } + + /** + * Deletes all items hold in the cover caches + */ + public static void evictAll() { + if (sBitmapDiskCache != null) { + sBitmapDiskCache.evictAll(); + } + } + + + /** + * Object used as cache key. Objects with the same + * media type, id and size are considered to be equal + */ + public static class CoverKey { + public final int coverSize; + public final int mediaType; + public final long mediaId; + + CoverKey(int mediaType, long mediaId, int coverSize) { + this.mediaType = mediaType; + this.mediaId = mediaId; + this.coverSize = coverSize; + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof CoverKey + && this.mediaId == ((CoverKey)obj).mediaId + && this.mediaType == ((CoverKey)obj).mediaType + && this.coverSize == ((CoverKey)obj).coverSize) { + return true; + } + return false; + } + + @Override + public int hashCode() { + return (int)this.mediaId + this.mediaType*(int)1e4 + this.coverSize * (int)1e5; + } + + @Override + public String toString() { + return "CoverKey_i"+this.mediaId+"_t"+this.mediaType+"_s"+this.coverSize; + } + + } + + + private static class BitmapDiskCache extends SQLiteOpenHelper { + /** + * Maximal cache size to use in bytes + */ + private final long mCacheSize; + /** + * SQLite table to use + */ + private final static String TABLE_NAME = "covercache"; + /** + * Priority-ordered list of possible cover names + */ + private final static Pattern[] COVER_MATCHES = { + Pattern.compile("(?i).+/(COVER|ALBUM)\\.(JPE?G|PNG|WEBP)$"), + Pattern.compile("(?i).+/ALBUMART(_\\{[-0-9A-F]+\\}_LARGE)?\\.(JPE?G|PNG|WEBP)$"), + Pattern.compile("(?i).+/(CD|FRONT|ARTWORK|FOLDER)\\.(JPE?G|PNG|WEBP)$"), + Pattern.compile("(?i).+\\.(JPE?G|PNG|WEBP)$") }; + /** + * Projection of all columns in the database + */ + private final static String[] FULL_PROJECTION = {"id", "size", "expires", "blob"}; + /** + * Projection of metadata-only columns + */ + private final static String[] META_PROJECTION = {"id", "size", "expires"}; + /** + * Restrict lifetime of cached objects to, at most, OBJECT_TTL + */ + private final static int OBJECT_TTL = 86400*8; + + /** + * Creates a new BitmapDiskCache instance + * + * @param context The context to use + * @param cacheSize The maximal amount of disk space to use in bytes + */ + public BitmapDiskCache(Context context, long cacheSize) { + super(context, "covercache.db", null, 1 /* version */); + mCacheSize = cacheSize; + } + + /** + * Called by SQLiteOpenHelper to create the database schema + */ + @Override + public void onCreate(SQLiteDatabase dbh) { + dbh.execSQL("CREATE TABLE "+TABLE_NAME+" (id INTEGER, expires INTEGER, size INTEGER, blob BLOB);"); + dbh.execSQL("CREATE UNIQUE INDEX idx ON "+TABLE_NAME+" (id);"); + } + + /** + * Called by SqLiteOpenHelper if the database needs an upgrade + */ + @Override + public void onUpgrade(SQLiteDatabase dbh, int oldVersion, int newVersion) { + // first db -> nothing to upgrade + } + + /** + * Trims the on disk cache to given size + * + * @param maxCacheSize Trim cache to this many bytes + */ + private void trim(long maxCacheSize) { + SQLiteDatabase dbh = getWritableDatabase(); + long availableSpace = maxCacheSize - getUsedSpace(); + + if (maxCacheSize == 0) { + // Just drop the whole database (probably a call from evictAll) + dbh.delete(TABLE_NAME, "1", null); + } else if (availableSpace < 0) { + // Try to evict all expired entries first + int affected = dbh.delete(TABLE_NAME, "expires < ?", new String[] { Long.toString(getUnixTime())}); + if (affected > 0) + availableSpace = maxCacheSize - getUsedSpace(); + + if (availableSpace < 0) { + // still not enough space: purge by expire date (this kills random rows as expire times are random) + Cursor cursor = dbh.query(TABLE_NAME, META_PROJECTION, null, null, null, null, "expires ASC"); + if (cursor != null) { + while (cursor.moveToNext() && availableSpace < 0) { + int id = cursor.getInt(0); + int size = cursor.getInt(1); + dbh.delete(TABLE_NAME, "id=?", new String[] { Long.toString(id) }); + availableSpace += size; + } + cursor.close(); + } + } + } + } + + /** + * Deletes all cached elements from the on-disk cache + */ + public void evictAll() { + // purge all cached entries + trim(0); + // and release the dbh + getWritableDatabase().close(); + } + + /** + * Checks if given stamp is considered to be expired + * + * @param stamp The timestamp to check + * @return boolean true if stamp is expired + */ + private boolean isExpired(long stamp) { + return (getUnixTime() > stamp); + } + + /** + * Returns the current unix timestamp + * + * @return long unix seconds since epoc + */ + private long getUnixTime() { + return System.currentTimeMillis() / 1000L; + } + + /** + * Calculates the space used by the sqlite database + * + * @return long the space used in bytes + */ + private long getUsedSpace() { + long usedSpace = -1; + SQLiteDatabase dbh = getWritableDatabase(); + Cursor cursor = dbh.query(TABLE_NAME, new String[]{"SUM(size)"}, null, null, null, null, null); + if (cursor != null) { + if (cursor.moveToNext()) + usedSpace = cursor.getLong(0); + cursor.close(); + } + return usedSpace; + } + + /** + * Stores a bitmap in the disk cache, does not update existing objects + * + * @param key The cover key to use + * @param cover The cover to store as bitmap + */ + public void put(CoverKey key, Bitmap cover) { + SQLiteDatabase dbh = getWritableDatabase(); + + // Ensure that there is some space left + trim(mCacheSize); + + ByteArrayOutputStream out = new ByteArrayOutputStream(); + // We store a lossy version as this image was + // created from the original source (and will not be re-compressed) + cover.compress(Bitmap.CompressFormat.JPEG, 85, out); + + Random rnd = new Random(); + long ttl = getUnixTime() + rnd.nextInt(OBJECT_TTL); + + ContentValues values = new ContentValues(); + values.put("id" , key.hashCode()); + values.put("expires", ttl); + values.put("size" , out.size()); + values.put("blob" , out.toByteArray()); + + dbh.insert(TABLE_NAME, null, values); + } + + /** + * Returns a cached bitmap + * + * @param key The key to lookup + * @return a cached bitmap, null on cache miss + */ + public Bitmap get(CoverKey key) { + Bitmap cover = null; + + SQLiteDatabase dbh = getWritableDatabase(); // may also delete + String selection = "id=?"; + String[] selectionArgs = { Long.toString(key.hashCode()) }; + Cursor cursor = dbh.query(TABLE_NAME, FULL_PROJECTION, selection, selectionArgs, null, null, null); + if (cursor != null) { + if (cursor.moveToFirst()) { + long expires = cursor.getLong(2); + byte[] blob = cursor.getBlob(3); + + if (isExpired(expires)) { + dbh.delete(TABLE_NAME, selection, selectionArgs); + } else { + ByteArrayInputStream stream = new ByteArrayInputStream(blob); + cover = BitmapFactory.decodeStream(stream); + } + } + cursor.close(); + } + + return cover; + } + + /** + * Attempts to create a new bitmap object for given song. + * Returns null if no cover art was found + * + * @param ctx The context to read the external content uri of the given song + * @param song the function will search for artwork of this object + * @param maxPxCount the maximum amount of pixels to return (30*30 = 900) + */ + public Bitmap createBitmap(Context ctx, Song song, long maxPxCount) { + if (song.id < 0) + throw new IllegalArgumentException("song id is < 0: " + song.id); + + try { + InputStream inputStream = null; + InputStream sampleInputStream = null; // same as inputStream but used for getSampleSize + + if ((CoverCache.mCoverLoadMode & CoverCache.COVER_MODE_VANILLA) != 0) { + final File baseFile = new File(song.path); // File object of queried song + String bestMatchPath = null; // The best cover-path we found + int bestMatchIndex = COVER_MATCHES.length; // The best cover-index/priority found + int loopCount = 0; // Directory items loop counter + + // Only start search if the base directory of this file is NOT the public + // downloads folder: Picking files from there would lead to a false positive + // in most cases + if (baseFile.getParentFile().equals(sDownloadsDir) == false) { + for (final File entry : baseFile.getParentFile().listFiles()) { + for (int i=0; i < bestMatchIndex ; i++) { + // We are checking each file entry to see if it matches a known + // cover pattern. We abort on first hit as the Pattern array is sorted from good->meh + if (COVER_MATCHES[i].matcher(entry.toString()).matches()) { + bestMatchIndex = i; + bestMatchPath = entry.toString(); + break; + } + } + // Stop loop if we found the best match or if we looped 150 times + if (loopCount++ > 150 || bestMatchIndex == 0) + break; + } + } + + if (bestMatchPath != null) { + final File guessedFile = new File(bestMatchPath); + if (guessedFile.exists() && !guessedFile.isDirectory()) { + inputStream = new FileInputStream(guessedFile); + sampleInputStream = new FileInputStream(guessedFile); + } + } + } + + if (inputStream == null && (CoverCache.mCoverLoadMode & CoverCache.COVER_MODE_SHADOW) != 0) { + final String shadowBase = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MUSIC).getPath() + "/.vanilla"; + final String shadowPath = shadowBase + "/" + (song.artist.replaceAll("/", "_"))+"/"+(song.album.replaceAll("/", "_"))+".jpg"; + + File guessedFile = new File(shadowPath); + if (guessedFile.exists() && !guessedFile.isDirectory()) { + inputStream = new FileInputStream(guessedFile); + sampleInputStream = new FileInputStream(guessedFile); + } + } + + if (inputStream == null && (CoverCache.mCoverLoadMode & CoverCache.COVER_MODE_ANDROID) != 0) { + ContentResolver res = ctx.getContentResolver(); + long[] androidIds = MediaUtils.getAndroidMediaIds(ctx, song); + long albumId = androidIds[1]; + + if (albumId != -1) { + // now we can query for the album art path if we found an album id + Uri uri = Uri.parse("content://media/external/audio/albumart/"+albumId); + sampleInputStream = res.openInputStream(uri); + if (sampleInputStream != null) // cache misses are VERY expensive here, so we check if the first open worked + inputStream = res.openInputStream(uri); + } + } + + if (inputStream == null && (CoverCache.mCoverLoadMode & CoverCache.COVER_MODE_INLINE) != 0) { + MediaMetadataRetriever mmr = new MediaMetadataRetriever(); + mmr.setDataSource(song.path); + + byte[] data = mmr.getEmbeddedPicture(); + if (data != null) { + sampleInputStream = new ByteArrayInputStream(data); + inputStream = new ByteArrayInputStream(data); + } + mmr.release(); + } + + if (inputStream != null) { + BitmapFactory.Options bopts = new BitmapFactory.Options(); + bopts.inPreferredConfig = Bitmap.Config.RGB_565; + bopts.inJustDecodeBounds = true; + + final int inSampleSize = getSampleSize(sampleInputStream, bopts, maxPxCount); + /* reuse bopts: we are now REALLY going to decode the image */ + bopts.inJustDecodeBounds = false; + bopts.inSampleSize = inSampleSize; + Bitmap bitmap = BitmapFactory.decodeStream(inputStream, null, bopts); + sampleInputStream.close(); + inputStream.close(); + return bitmap; + } + } catch (Exception e) { + // no cover art found + Log.v("VanillaMusic", "Loading coverart for "+song+" failed with exception "+e); + } + // failed! + return null; + } + + /** + * Guess a good sampleSize value for given inputStream + * + * @param inputStream the input stream to read from + * @param bopts the bitmap options to use + * @param maxPxCount how many pixels we are returning at most + */ + private static int getSampleSize(InputStream inputStream, BitmapFactory.Options bopts, long maxPxCount) { + int sampleSize = 1; /* default sample size */ + + BitmapFactory.decodeStream(inputStream, null, bopts); + long hasPixels = bopts.outHeight * bopts.outWidth; + if(hasPixels > maxPxCount) { + sampleSize = Math.round((int)Math.sqrt((float) hasPixels / (float) maxPxCount)); + } + return sampleSize; + } + + } +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/CoverView.java b/app/src/main/java/ch/blinkenlights/android/vanilla/CoverView.java new file mode 100644 index 0000000..ab9741f --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/CoverView.java @@ -0,0 +1,661 @@ +/* + * Copyright (C) 2017 Adrian Ulrich <adrian@blinkenlights.ch> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package ch.blinkenlights.android.vanilla; + +import android.content.Context; +import android.graphics.Bitmap; +import android.graphics.Canvas; +import android.os.Handler; +import android.os.Looper; +import android.os.Message; +import android.util.AttributeSet; +import android.view.View; +import android.view.MotionEvent; +import android.view.VelocityTracker; +import android.view.ViewConfiguration; +import android.view.animation.LinearInterpolator; +import android.widget.Scroller; + +import java.lang.IllegalStateException; +import java.lang.IllegalArgumentException; + +import android.util.Log; + + + +/** + * Displays a flingable/draggable View of cover art/song info images + * generated by CoverBitmap. + */ +public final class CoverView extends View implements Handler.Callback { + /** + * If >= 0, perform the switch after this delay + */ + private final static int ASYNC_SWITCH = -1; + /** + * Maximum amount of pixels we are allowed to scroll to consider + * touch events to be normal touches. + */ + private final static double TOUCH_MAX_SCROLL_PX = 10; + /** + * The system provided display density + */ + private static double sDensity = -1; + /** + * The minimum velocity to move to the next song + */ + private static double sSnapVelocity = -1; + /** + * Computes scroll velocity to detect flings. + */ + private VelocityTracker mVelocityTracker; + /** + * The context. + */ + private final Context mContext; + /** + * The scroller instance we are using. + */ + private final CoverScroller mScroller; + /** + * Our bitmap cache helper + */ + private BitmapBucket mBitmapBucket; + /** + * Our callback to dispatch song events. + */ + private CoverView.Callback mCallback; + /** + * Indicates that we attempted to query and update our songs but couldn't as the + * view was not yet ready. + */ + private boolean mPendingQuery; + /** + * The x coordinate of the initial touch event. + */ + private float mInitialMotionX; + /** + * The y coordinate of the initial touch event. + */ + private float mInitialMotionY; + /** + * The x coordinate of the last touch down or move event. + */ + private float mLastMotionX; + /** + * The y coordinate of the last touch down or move event. + */ + private float mLastMotionY; + /** + * The message handler used by this class. + */ + private Handler mHandler; + /** + * Handler thread only used for UI updates + */ + private Handler mUiHandler; + /** + * Our current scroll position. + * Setting this to '0' means that we will display bitmap[0]. + */ + private int mScrollX = -1; + /** + * The style to use for the cover. + */ + private int mCoverStyle = -1; + /** + * Our public callback interface + */ + public interface Callback { + void shiftCurrentSong(int delta); + void upSwipe(); + void downSwipe(); + } + + /** + * Constructs a new CoverView class, note that setup() must be called + * before the view becomes useable. + */ + public CoverView(Context context, AttributeSet attributes) { + super(context, attributes); + if (sDensity == -1) { + sDensity = context.getResources().getDisplayMetrics().density; + sSnapVelocity = ViewConfiguration.get(context).getScaledMinimumFlingVelocity() * 5; + } + mContext = context; + mBitmapBucket = new BitmapBucket(); + mScroller = new CoverScroller(context); + } + + /** + * Configures and sets up this view + */ + public void setup(Looper looper, Callback callback, int style) { + mUiHandler = new Handler(this); + mHandler = new Handler(looper, this); + mCallback = callback; + mCoverStyle = style; + } + + /** + * Sent if the songs timeline changed and we should check if + * mCacheBitmap is stale. + * Just calls querySongsInternal() via handler to ensure + * that we do this in a background thread. + */ + public void querySongs() { + mHandler.removeMessages(MSG_QUERY_SONGS); + mHandler.sendEmptyMessage(MSG_QUERY_SONGS); + } + + /** + * Called if a specific song got replaced. + * The current implementation does not take this hint into + * account as querySongsInternal() already tries to be efficient. + */ + public void replaceSong(int delta, Song song) { + querySongs(); + } + + /** + * Called by querySongs() - this runs in a background thread. + */ + private void querySongsInternal() { + DEBUG("querySongsInternal"); + + if (getWidth() < 1 || getHeight() < 1) { + mPendingQuery = true; + return; + } + + if (mScrollX < 0) { // initialize mScrollX to show cover '1' by default. + mScrollX = getWidth(); + } + + mHandler.removeMessages(MSG_SET_BITMAP); + PlaybackService service = PlaybackService.get(mContext); + + final Song[] songs = { service.getSong(-1), service.getSong(0), service.getSong(1) }; + final int len = songs.length; + + for (int i = 0; i < len; i++) { + Song song = songs[i]; + if (mBitmapBucket.getSong(i) != song) { + mHandler.sendMessage(mHandler.obtainMessage(MSG_SET_BITMAP, i, 0, song)); + } + } + } + + /** + * Updates the cover in bitmap bucket for given index. + * + * @param i the index to modify + * @param song the source of the cover + */ + private void setSongBitmap(int i, Song song) { + Bitmap bitmap = mBitmapBucket.grepBitmap(song); + + if (bitmap == null && song != null) + bitmap = generateBitmap(song); + + mBitmapBucket.setSongBitmap(i, song, bitmap); + postInvalidate(); + } + + /** + * Returns a correctly sized cover bitmap for given song + */ + private Bitmap generateBitmap(Song song) { + int style = mCoverStyle; + Bitmap cover = song == null ? null : song.getLargeCover(mContext); + + if (cover == null && style != CoverBitmap.STYLE_OVERLAPPING_BOX) { + cover = CoverBitmap.generateDefaultCover(mContext, getWidth(), getHeight()); + } + + return CoverBitmap.createBitmap(mContext, style, cover, song, getWidth(), getHeight()); + } + + + private final static int MSG_QUERY_SONGS = 1; + private final static int MSG_SHIFT_SONG = 2; + private final static int MSG_SET_BITMAP = 3; + private final static int MSG_UI_LONG_CLICK = 4; // should only be used with mUiHandler + + @Override + public boolean handleMessage(Message message) { + switch (message.what) { + case MSG_QUERY_SONGS: + querySongsInternal(); + break; + case MSG_SHIFT_SONG: + DEBUG("Shifting to song: "+message.arg1); + mCallback.shiftCurrentSong(message.arg1); + break; + case MSG_SET_BITMAP: + setSongBitmap(message.arg1, (Song)message.obj); + break; + case MSG_UI_LONG_CLICK: + if (!Looper.getMainLooper().equals(Looper.myLooper())) { + throw new IllegalStateException("MSG_UI_LONG_CLICK must be run from the UI thread"); + } + if (scrollIsNotSignificant()) { + performLongClick(); + } + break; + default: + throw new IllegalArgumentException("Unknown message received: "+message.what); + } + return true; + } + + /** + * Triggers if the view changes its size, may call querySongs() if it was called + * previously but had to be aborted as the view was not yet laid out. + */ + @Override + protected void onSizeChanged(int width, int height, int oldWidth, int oldHeight) { + if (mPendingQuery && width != 0 && height != 0) { + mPendingQuery = false; + querySongs(); + } + } + + /** + * Lays out this view - only handles our specific use cases + */ + @Override + protected void onMeasure(int widthSpec, int heightSpec) { + // This implementation only tries to handle two cases: use in the + // FullPlaybackActivity, where we want to fill the whole screen, + // and use in the MiniPlaybackActivity, where we want to be square. + + int width = View.MeasureSpec.getSize(widthSpec); + int height = View.MeasureSpec.getSize(heightSpec); + if (View.MeasureSpec.getMode(widthSpec) == View.MeasureSpec.EXACTLY && View.MeasureSpec.getMode(heightSpec) == View.MeasureSpec.EXACTLY) { + // FullPlaybackActivity: fill screen + setMeasuredDimension(width, height); + } else { + // MiniPlaybackActivity: be square + int size = Math.min(width, height); + setMeasuredDimension(size, size); + } + } + + /** + * Paint the cover art views to the canvas. + */ + @Override + protected void onDraw(Canvas canvas) { + int width = getWidth(); + int height = getHeight(); + int x = 0; + int scrollX = mScrollX; + boolean snapshot = !mScroller.isFinished(); + Bitmap bitmap; + + for (int i=0; i <= 2 ; i++) { + bitmap = snapshot ? mBitmapBucket.getSnapshot(i) : mBitmapBucket.getBitmap(i); + if (bitmap != null && scrollX + width > x && scrollX < x + width) { + final int xOffset = (width - bitmap.getWidth()) / 2; + final int yOffset = (int)(height - bitmap.getHeight()) / 2; + canvas.drawBitmap(bitmap, x + xOffset - scrollX, yOffset, null); + } + x += width; + } + advanceScroll(); + } + + /** + * Advances to the next frame of the animation. + */ + private void advanceScroll() { + boolean running = mScroller.computeScrollOffset(); + if (running) { + mScrollX = mScroller.getCurrX(); + if (mScroller.isFinished()) { + // just hit the end! + mBitmapBucket.finalizeScroll(); + mScrollX = getWidth(); + + int coverIntent = mScroller.getCoverIntent(); + if (coverIntent != 0 && ASYNC_SWITCH < 0) + mHandler.sendMessage(mHandler.obtainMessage(MSG_SHIFT_SONG, coverIntent, 0)); + + DEBUG("Scroll finished, invalidating all snapshot bitmaps!"); + } + invalidate(); + } + } + + /** + * Handles all touch events received by this view. + */ + @Override + public boolean onTouchEvent(MotionEvent ev) { + float x = ev.getX(); + float y = ev.getY(); + int scrollX = mScrollX; + int width = getWidth(); + boolean invalidate = false; + + if (mVelocityTracker == null) + mVelocityTracker = VelocityTracker.obtain(); + mVelocityTracker.addMovement(ev); + + switch (ev.getAction()) { + case MotionEvent.ACTION_DOWN: { + + if (mScroller.isFinished()) { + mUiHandler.sendEmptyMessageDelayed(MSG_UI_LONG_CLICK, ViewConfiguration.getLongPressTimeout() * 2); + } else { + // Animation was still running while we got a new down event + // Abort the current animation! + + final int coverIntent = mScroller.getCoverIntent(); + mBitmapBucket.abortScroll(); + mScroller.abortAnimation(); + + if (coverIntent != 0) { + // The running animation was actually supposed to switch to a new song. + // Do this right now as the animation is canceled: + // First, set our non-cached covers to a sane version + mBitmapBucket.prepareScroll(coverIntent); + // ..and fix up the scrolling position. + mScrollX -= coverIntent * getWidth(); + // all done: we can now trigger the song jump + if (ASYNC_SWITCH < 0 || mHandler.hasMessages(MSG_SHIFT_SONG)) { + mHandler.removeMessages(MSG_SHIFT_SONG); + mHandler.sendMessage(mHandler.obtainMessage(MSG_SHIFT_SONG, coverIntent, 0)); + } + } + + // There is no running animation (anymore?), so we can drop the cache. + mBitmapBucket.finalizeScroll(); + } + + mLastMotionX = mInitialMotionX = x; + mLastMotionY = mInitialMotionY = y; + + break; + } + case MotionEvent.ACTION_MOVE: { + final float deltaX = mLastMotionX - x; + final float deltaY = mLastMotionY - y; + + if (Math.abs(deltaX) > Math.abs(deltaY)) { // only change X if the fling is horizontal + if (deltaX < 0) { + int availableToScroll = scrollX - (mBitmapBucket.getSong(0) == null ? width : 0); + if (availableToScroll > 0) { + mScrollX += Math.max(-availableToScroll, (int)deltaX); + invalidate = true; + } + } else if (deltaX > 0) { + int availableToScroll = width * 2 - scrollX; + if (availableToScroll > 0) { + mScrollX += Math.min(availableToScroll, (int)deltaX); + invalidate = true; + } + } + } + + mLastMotionX = x; + mLastMotionY = y; + break; + } + case MotionEvent.ACTION_UP: { + VelocityTracker velocityTracker = mVelocityTracker; + velocityTracker.computeCurrentVelocity(1000); // report velocity in pixels-per-second, as assumed by snap-velocity and co. + final int velocityX = (int) velocityTracker.getXVelocity(); + final int velocityY = (int) velocityTracker.getYVelocity(); + mVelocityTracker.recycle(); + mVelocityTracker = null; + + final int mvx = Math.abs(velocityX); + final int mvy = Math.abs(velocityY); + final float distanceX = mLastMotionX - mInitialMotionX; + int whichCover = 0; + + if (scrollIsNotSignificant()) { + if (mUiHandler.hasMessages(MSG_UI_LONG_CLICK)) { + // long click didn't fire yet -> consider this to be a normal click + performClick(); + } + } else if (Math.abs(distanceX) > width/2) { + whichCover = distanceX < 0 ? 1 : -1; + } else if (mvx > sSnapVelocity || mvy > sSnapVelocity) { + if (mvy > mvx) { + if (velocityY > 0) + mCallback.downSwipe(); + else + mCallback.upSwipe(); + } else { + whichCover = velocityX < 0 ? 1 : -1; + } + } + + // Ensure that the target song actually exists. + // Eg: We may not have song 0 in random mode. + if (mBitmapBucket.getSong(1+whichCover) == null) + whichCover = 0; + + final int scrollTargetX = width + whichCover*width; + + mBitmapBucket.prepareScroll(whichCover); + mScroller.handleFling(velocityX, mScrollX, scrollTargetX, whichCover); + if (ASYNC_SWITCH >= 0) + mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_SHIFT_SONG, whichCover, 0), ASYNC_SWITCH); + mUiHandler.removeMessages(MSG_UI_LONG_CLICK); + + invalidate = true; + break; + } + } + + if (invalidate) + postInvalidate(); + + return true; + } + + /** + * Returns true if the scroll traveled a significant distance + * and is therefore not considered to be random noise during a click. + */ + private boolean scrollIsNotSignificant() { + final float distanceX = mLastMotionX - mInitialMotionX; + final float distanceY = mLastMotionY - mInitialMotionY; + return Math.abs(distanceX) + Math.abs(distanceY) < TOUCH_MAX_SCROLL_PX; + } + + private void DEBUG(String s) { + // Log.v("VanillaMusicCover", s); + } + + + /** + * Class to handle access to our bitmap and song mapping + */ + private class BitmapBucket { + /** + * The pre-generated bitmaps for all 3 songs + */ + private final Bitmap[] mCacheBitmaps = new Bitmap[3]; + /** + * Cached songs, used to check if mCacheBitmaps is still valid + */ + private final Song[] mCacheSongs = new Song[3]; + /** + * A WIP copy: We use this (iff available) to draw. + * This allows us to update mCacheBitmaps while scrolling + */ + private final Bitmap[] mSnapshotBitmaps = new Bitmap[3]; + /** + * A WIP copy of songs, used if we have to restore + * This snapshot is only used internally and copied + * to mCacheBitmaps if we restore our bitmap snapshot. + */ + private final Song[] mSnapshotSongs = new Song[3]; + /** + * Constructor for BitmapBucket + */ + public BitmapBucket() { + } + + public Song getSong(int i) { + return mCacheSongs[i]; + } + + public Bitmap getBitmap(int i) { + return mCacheBitmaps[i]; + } + + public Bitmap getSnapshot(int i) { + return mSnapshotBitmaps[i]; + } + + public void setSongBitmap(int i, Song song, Bitmap bitmap) { + mCacheSongs[i] = song; + mCacheBitmaps[i] = bitmap; + } + + public Bitmap grepBitmap(Song song) { + final int len = mCacheSongs.length; + for (int i = 0; i < len ; i++) { + if (song != null && song.equals(mCacheSongs[i])) { + return mCacheBitmaps[i]; + } + } + return null; + } + + /** + * Hint that we are going to scroll. + * This causes us to populate our bitmap snapshot + * and will cause us to modify the current cache with a guess. + * + * @param futureCover the cover we are going to scroll to + */ + public void prepareScroll(int futureCover) { + // Grab a snapshot of the bitmaps which will be used + // while the animation is running, so that we can concurrently + // modify mCacheBitmaps. + System.arraycopy(mCacheBitmaps, 0, mSnapshotBitmaps, 0, 3); + System.arraycopy(mCacheSongs, 0, mSnapshotSongs, 0, 3); + + // we are going to scroll, so most likely we can save 2 bitmaps by guessing the + // new situation. This doesn't have to be 100% correct as the next querySongs() + // call would fix up wrong guesses. + // FIXME: This may be under-locked: cache checks via getSong() and prepareScroll() may race. + if (futureCover > 0) { + mCacheBitmaps[0] = mCacheBitmaps[1]; + mCacheSongs[0] = mCacheSongs[1]; + mCacheBitmaps[1] = mCacheBitmaps[2]; + mCacheSongs[1] = mCacheSongs[2]; + mCacheBitmaps[2] = null; + mCacheSongs[2] = new Song(-1); + } else if (futureCover < 0) { + mCacheBitmaps[2] = mCacheBitmaps[1]; + mCacheSongs[2] = mCacheSongs[1]; + mCacheBitmaps[1] = mCacheBitmaps[0]; + mCacheSongs[1] = mCacheSongs[0]; + mCacheBitmaps[0] = null; + mCacheSongs[0] = new Song(-1); + } + } + + /** + * Abort a scroll initiated by prepareScroll. + */ + public void abortScroll() { + // undo our guess we did in prepareScroll + System.arraycopy(mSnapshotBitmaps, 0, mCacheBitmaps, 0, 3); + System.arraycopy(mSnapshotSongs, 0, mCacheSongs, 0, 3); + finalizeScroll(); + } + + public void finalizeScroll() { + for (int i=0; i <= 2; i++) { + mSnapshotBitmaps[i] = null; + mSnapshotSongs[i] = null; + } + } + + } + + /** + * The scroller class helps to keep track + * of the current scroll progress. + */ + private class CoverScroller extends Scroller { + /** + * The cover we are scrolling to + */ + private int mCoverIntent; + /** + * Returns a new scroller instance + */ + public CoverScroller(Context context) { + super(context, new LinearInterpolator(), false); + } + + /** + * Returns the cover set by the last handleFling + * call. + * + * @return int the cover set by handleFling. + */ + public int getCoverIntent() { + return mCoverIntent; + } + + @Override + public void abortAnimation() { + mCoverIntent = 0; + super.abortAnimation(); + } + /** + * Starts a fling operation + * + * @param velocity the current velocity + * @param from the current x coordinate + * @param to the target x coordinate + * @param coverIntent the cover we are scrolling to, returned by getCoverIntent() + */ + public void handleFling(int velocity, int from, int to, int coverIntent) { + if (!isFinished()) { + abortAnimation(); + } + + mCoverIntent = coverIntent; + + final int distance = to - from; + int duration = (int)(Math.abs(distance) / sDensity); + if (duration > 200) + duration = 200; + + startScroll(from, 0, distance, 0, duration); + } + } + +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/DraggableRow.java b/app/src/main/java/ch/blinkenlights/android/vanilla/DraggableRow.java new file mode 100644 index 0000000..96fcc39 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/DraggableRow.java @@ -0,0 +1,233 @@ +/* + * Copyright (C) 2014-2016 Adrian Ulrich <adrian@blinkenlights.ch> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package ch.blinkenlights.android.vanilla; + +import android.content.Context; +import android.graphics.Color; +import android.text.format.DateUtils; +import android.text.Spannable; +import android.text.SpannableStringBuilder; +import android.text.style.ForegroundColorSpan; +import android.util.AttributeSet; +import android.util.TypedValue; +import android.view.View; +import android.widget.LinearLayout; +import android.widget.ImageView; +import android.widget.TextView; +import android.widget.CheckedTextView; +import android.widget.Checkable; + +public class DraggableRow extends LinearLayout implements Checkable { + /** + * True if the checkbox is checked + */ + private boolean mChecked; + /** + * True if setupLayout has been called + */ + private boolean mLayoutSet; + + private TextView mTextView; + private TextView mDurationView; + private CheckedTextView mCheckBox; + private View mPmark; + private ImageView mDragger; + private View mDraggerPadder; + private LazyCoverView mCoverView; + + /** + * Layout types for use with setupLayout + */ + public static final int LAYOUT_TEXTONLY = 0; + public static final int LAYOUT_CHECKBOXES = 1; + public static final int LAYOUT_DRAGGABLE = 2; + public static final int LAYOUT_LISTVIEW = 3; + + + public DraggableRow(Context context, AttributeSet attrs) { + super(context, attrs); + } + + + @Override + public void onFinishInflate() { + mCheckBox = (CheckedTextView)this.findViewById(R.id.checkbox); + mTextView = (TextView)this.findViewById(R.id.text); + mDurationView = findViewById(R.id.duration); + mPmark = (View)this.findViewById(R.id.pmark); + mDragger = (ImageView)this.findViewById(R.id.dragger); + mDraggerPadder = (View)this.findViewById(R.id.dragger_padder); + mCoverView = (LazyCoverView)this.findViewById(R.id.cover); + super.onFinishInflate(); + } + + /** + * Sets up commonly used layouts - can only be called once per view + * + * @param type the layout type to use + */ + public void setupLayout(int type) { + if (!mLayoutSet) { + switch (type) { + case LAYOUT_CHECKBOXES: + mCheckBox.setVisibility(View.VISIBLE); + showDragger(true); + break; + case LAYOUT_DRAGGABLE: + highlightRow(false); // make this visible + mCoverView.setVisibility(View.VISIBLE); + mDurationView.setVisibility(View.VISIBLE); + showDragger(true); + break; + case LAYOUT_LISTVIEW: + highlightRow(false); // make this visible + mCoverView.setVisibility(View.VISIBLE); + mDragger.setImageResource(R.drawable.arrow); + break; + case LAYOUT_TEXTONLY: + default: + break; // do not care + } + mLayoutSet = true; + } + } + + @Override + public boolean isChecked() { + return mChecked; + } + + @Override + public void setChecked(boolean checked) { + mChecked = checked; + mCheckBox.setChecked(mChecked); + } + + @Override + public void toggle() { + setChecked(!mChecked); + } + + /** + * We glue tags to the text view to make getTag() simpler and consistent + * with the on click listener interception + */ + @Override + public void setTag(Object tag) { + mTextView.setTag(tag); + } + + @Override + public Object getTag() { + return mTextView.getTag(); + } + + /** + * Marks a row as highlighted + * @param state Enable or disable highlighting + */ + public void highlightRow(boolean state) { + mPmark.setVisibility( state ? View.VISIBLE : View.INVISIBLE ); + } + + /** + * Change visibility of dragger element + * + * @param state shows or hides the dragger + */ + public void showDragger(boolean state) { + mDragger.setVisibility( state ? View.VISIBLE : View.GONE ); + adjustPadding(); + } + + /** + * Change visibility of duration textview + * + * @param state shows or hides the textview + */ + public void showDuration(boolean state) { + mDurationView.setVisibility( state ? View.VISIBLE : View.GONE ); + adjustPadding(); + } + + public void setDraggerOnClickListener(View.OnClickListener listener) { + TypedValue v = new TypedValue(); + getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, v, true); + + mDragger.setBackgroundResource(v.resourceId); + mDragger.setOnClickListener(listener); + } + + /** + * Sets the text to given string. + * + * @param line the text to display + */ + public void setText(CharSequence line) { + mTextView.setText(line); + } + + /** + * Display two lines + * + * @param line1 the first line to show + * @param line2 the second line to show + */ + public void setText(CharSequence line1, CharSequence line2) { + if (line1 == null) + line1 = "???"; + + SpannableStringBuilder sb = new SpannableStringBuilder(line1); + sb.append("\n"); + sb.append(line2); + sb.setSpan(new ForegroundColorSpan(Color.GRAY), line1.length() + 1, sb.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + mTextView.setText(sb); + } + + /** + * Display given duration, negative values + * result in '--:--' + * + * @param duration the duration in ms to display + */ + public void setDuration(long duration) { + String txt = "--:--"; + if (duration >= 0) { + txt = DateUtils.formatElapsedTime(duration / 1000); + } + + SpannableStringBuilder sb = new SpannableStringBuilder("\n"+txt); + sb.setSpan(new ForegroundColorSpan(Color.GRAY), 1, sb.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + mDurationView.setText(sb); + } + + /** + * Returns an instance of our coverview + */ + public LazyCoverView getCoverView() { + return mCoverView; + } + + /** + * Check whether we need to add padding due to the lack of mDragger's visibility + */ + private void adjustPadding() { + boolean pad = (mDurationView.getVisibility() == View.VISIBLE && mDragger.getVisibility() == View.GONE); + mDraggerPadder.setVisibility( pad ? View.VISIBLE : View.GONE ); + } +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/FastScrollGuardedListView.java b/app/src/main/java/ch/blinkenlights/android/vanilla/FastScrollGuardedListView.java new file mode 100644 index 0000000..a41a5c9 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/FastScrollGuardedListView.java @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2016 Adrian Ulrich <adrian@blinkenlights.ch> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package ch.blinkenlights.android.vanilla; + +import android.content.Context; +import android.content.res.Resources; +import android.util.AttributeSet; +import android.view.MotionEvent; +import android.widget.ListView; + + +public class FastScrollGuardedListView extends ListView { + + /** + * Start edgeProtection at width-start + */ + private static final int PROTECT_START_DP = 50; // AOSP has this set to 48dip in 5.x + /** + * End protection at width-end + */ + private static final int PROTECT_END_DP = 12; + /** + * The calculated start position in pixel + */ + private float mEdgeProtectStartPx = 0; + /** + * The calculated end position in pixel + */ + private float mEdgeProtectEndPx = 0; + + + public FastScrollGuardedListView(Context context) { + super(context); + } + public FastScrollGuardedListView(Context context, AttributeSet attrs) { + super(context, attrs); + } + public FastScrollGuardedListView(Context context, AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + } + public FastScrollGuardedListView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); + } + + /** + * Intercepted touch event from ListView + * We will use this callback to send fake X-coord events if + * the actual event happened in the protected area (eg: the hardcoded fastscroll area) + */ + @Override + public boolean onInterceptTouchEvent(MotionEvent ev) { + if (mEdgeProtectStartPx == 0) + mEdgeProtectStartPx = getWidth() - PROTECT_START_DP * Resources.getSystem().getDisplayMetrics().density; + if (mEdgeProtectEndPx == 0) + mEdgeProtectEndPx = getWidth() - PROTECT_END_DP * Resources.getSystem().getDisplayMetrics().density; + + if (ev.getX() > mEdgeProtectStartPx && ev.getX() < mEdgeProtectEndPx) { + // Cursor is in protected area: simulate an event with a faked x coordinate + ev = MotionEvent.obtain(ev.getDownTime(), ev.getEventTime(), ev.getAction(), mEdgeProtectStartPx, ev.getY(), ev.getMetaState()); + } + return super.onInterceptTouchEvent(ev); + } + +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/FileSystemAdapter.java b/app/src/main/java/ch/blinkenlights/android/vanilla/FileSystemAdapter.java new file mode 100644 index 0000000..8bab6d8 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/FileSystemAdapter.java @@ -0,0 +1,472 @@ +/* + * Copyright (C) 2010, 2011 Christopher Eby <kreed@kreed.org> + * Copyright (C) 2015-2021 Adrian Ulrich <adrian@blinkenlights.ch> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package ch.blinkenlights.android.vanilla; + +import android.content.Context; +import android.content.Intent; +import android.os.FileObserver; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import java.io.File; +import java.io.FilenameFilter; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; +import java.util.regex.Pattern; + +/** + * A list adapter that provides a view of the filesystem. The active directory + * is set through a {@link Limiter} and rows are displayed using MediaViews. + */ +public class FileSystemAdapter + extends SortableAdapter + implements LibraryAdapter +{ + private static final Pattern SPACE_SPLIT = Pattern.compile("\\s+"); + private static final Pattern FILE_SEPARATOR = Pattern.compile(File.separator); + private static final Pattern GUESS_MUSIC = Pattern.compile("^(.+\\.(mp3|ogg|mka|opus|flac|aac|m4a|wav))$", Pattern.CASE_INSENSITIVE); + private static final Pattern GUESS_IMAGE = Pattern.compile("^(.+\\.(gif|jpe?g|png|bmp|tiff?|webp))$", Pattern.CASE_INSENSITIVE); + /** + * The root directory of the device + */ + private final File mFsRoot = new File("/"); + /** + * Sort by filename. + */ + private static final int SORT_NAME = 0; + /** + * Sort by file size. + */ + private static final int SORT_SIZE = 1; + /** + * Sort by file modification time. + */ + private static final int SORT_TIME = 2; + /** + * Sort by file extension. + */ + private static final int SORT_EXT = 3; + /** + * The IDs of human-readable descriptions for each sort mode. + * Must be consistent with SORT_* fields. + */ + private static final int[] SORT_RES_IDS = new int[] { + R.string.filename, + R.string.file_size, + R.string.file_time, + R.string.extension }; + + /** + * The owner LibraryActivity. + */ + final LibraryActivity mActivity; + /** + * A LayoutInflater to use. + */ + private final LayoutInflater mInflater; + /** + * The currently active limiter, set by a row expander being clicked. + */ + private Limiter mLimiter; + /** + * The files and folders in the current directory. + */ + private File[] mFiles; + /** + * The currently active filter, entered by the user from the search box. + */ + String[] mFilter; + /** + * Excludes dot files and files not matching mFilter. + */ + private final FilenameFilter mFileFilter = new FilenameFilter() { + @Override + public boolean accept(File dir, String filename) + { + if (filename.charAt(0) == '.') + return false; + if (mFilter != null) { + filename = filename.toLowerCase(); + for (String term : mFilter) { + if (!filename.contains(term)) + return false; + } + } + return true; + } + }; + /** + * Sorts folders before files first, then sorts by current sort mode. + */ + private final Comparator<File> mFileComparator = new Comparator<File>() { + @Override + public int compare(File a, File b) + { + boolean aIsFolder = a.isDirectory(); + boolean bIsFolder = b.isDirectory(); + if (bIsFolder == aIsFolder) { + int mode = aIsFolder ? SORT_NAME : getSortModeIndex(); + int order; + switch (mode) { + case SORT_SIZE: + order = Long.valueOf(a.length()).compareTo(Long.valueOf(b.length())); + break; + case SORT_TIME: + order = Long.valueOf(a.lastModified()) + .compareTo(Long.valueOf(b.lastModified())); + break; + case SORT_EXT: + order = FileUtils.getFileExtension(a.getName()) + .compareToIgnoreCase(FileUtils.getFileExtension(b.getName())); + break; + case SORT_NAME: + order = a.getName().compareToIgnoreCase(b.getName()); + break; + default: + throw new IllegalArgumentException("Invalid sort mode: " + mode); + } + return (isSortDescending() ? -1 : 1) * order; + } else if (bIsFolder) { + return 1; + } + return -1; + } + }; + /** + * The Observer instance for the current directory. + */ + private Observer mFileObserver; + + /** + * Create a FileSystemAdapter. + * + * @param activity The LibraryActivity that will contain this adapter. + * Called on to requery this adapter when the contents of the directory + * change. + * @param limiter An initial limiter to set. If none is given, will be set + * to the external storage directory. + */ + public FileSystemAdapter(LibraryActivity activity, Limiter limiter) + { + mActivity = activity; + mLimiter = limiter; + mInflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + if (limiter == null) { + limiter = buildHomeLimiter(activity); + } + setLimiter(limiter); + mSortEntries = SORT_RES_IDS; + } + + @Override + public Object query() + { + File file = getLimiterPath(); + + if (mFileObserver == null) { + mFileObserver = new Observer(file.getPath()); + } + + ArrayList<File> files; + File[] readdir = file.listFiles(mFileFilter); + if (readdir != null) { + files = new ArrayList<File>(Arrays.asList(readdir)); + } else { + files = FileUtils.getFallbackDirectories((Context)mActivity, file); + } + + Collections.sort(files, mFileComparator); + if (!mFsRoot.equals(file)) + files.add(0, new File(file, FileUtils.NAME_PARENT_FOLDER)); + + return files.toArray(new File[files.size()]); + } + + @Override + public void commitQuery(Object data) + { + mFiles = (File[])data; + notifyDataSetChanged(); + } + + @Override + public void clear() + { + mFiles = null; + notifyDataSetInvalidated(); + } + + @Override + public int getCount() + { + if (mFiles == null) + return 0; + return mFiles.length; + } + + @Override + public Object getItem(int pos) + { + return mFiles[pos]; + } + + @Override + public long getItemId(int pos) + { + return FileUtils.songIdFromFile(mFiles[pos]); + } + + @Override + public View getView(int pos, View convertView, ViewGroup parent) + { + DraggableRow row; + ViewHolder holder; + + if (convertView == null) { + row = (DraggableRow)mInflater.inflate(R.layout.draggable_row, parent, false); + row.setupLayout(DraggableRow.LAYOUT_LISTVIEW); + + holder = new ViewHolder(); + row.setTag(holder); + } else { + row = (DraggableRow)convertView; + holder = (ViewHolder)row.getTag(); + } + + final File file = mFiles[pos]; + final String title = file.getName(); + + holder.id = pos; + holder.title = title; + row.setText(title); + row.getCoverView().setImageResource(getImageResourceForFile(file)); + return row; + } + + @Override + public void setFilter(String filter) + { + if (filter == null) + mFilter = null; + else + mFilter = SPACE_SPLIT.split(filter.toLowerCase()); + } + + @Override + public void setLimiter(Limiter limiter) + { + if (mFileObserver != null) + mFileObserver.stopWatching(); + mFileObserver = null; + + if (limiter != null && mFsRoot.equals(limiter.data)) + limiter = null; // Filtering by mFsRoot is like having no filter + + mLimiter = limiter; + } + + @Override + public Limiter getLimiter() + { + return mLimiter; + } + + /** + * Returns a drawable resource id for given file. + * This function is rather fast as the file type is guessed + * based on the extension. + * + * @return resource id to use. + */ + private int getImageResourceForFile(File file) { + int res = R.drawable.file_document; + if (pointsToParentFolder(file)) { + res = R.drawable.arrow_up; + } else if (file.isDirectory()) { + res = R.drawable.folder; + } else if (GUESS_MUSIC.matcher(file.getName()).matches()) { + res = R.drawable.file_music; + } else if (GUESS_IMAGE.matcher(file.getName()).matches()) { + res = R.drawable.file_image; + } + return res; + } + + /** + * Returns the unixpath represented by this limiter + * + * @return the file of this limiter represents + */ + private File getLimiterPath() { + return mLimiter == null ? new File("/") : (File)mLimiter.data; + } + + /** + * Returns true if the filename of 'file' indicates that + * it points to '..' + * + * @return true if given file points to the parent folder + */ + private static boolean pointsToParentFolder(File file) { + return FileUtils.NAME_PARENT_FOLDER.equals(file.getName()); + } + + /** + * Builds a limiter from the given folder. Only files contained in the + * given folder will be shown if the limiter is set on this adapter. + * + * @param file A File pointing to a folder. + * @return A limiter describing the given folder. + */ + public static Limiter buildLimiter(File file) + { + if (pointsToParentFolder(file)) + file = file.getParentFile().getParentFile(); + String[] fields = FILE_SEPARATOR.split(file.getPath().substring(1)); + return new Limiter(MediaUtils.TYPE_FILE, fields, file); + } + + /** + * Builds the limiter pointing to our home directory + * + * @param context the context to use + * @return A limiter which is configured as 'home' directory + */ + public static Limiter buildHomeLimiter(Context context) { + return buildLimiter(FileUtils.getFilesystemBrowseStart(context)); + } + + @Override + public Limiter buildLimiter(long id) { + for (int i = 0; i < mFiles.length; i++) { + if (id == getItemId(i)) { + return buildLimiter(mFiles[i]); + } + } + return null; + } + + @Override + public int getMediaType() + { + return MediaUtils.TYPE_FILE; + } + + /** + * FileObserver that reloads the files in this adapter. + */ + private class Observer extends FileObserver { + public Observer(String path) + { + super(path, FileObserver.CREATE | FileObserver.DELETE | FileObserver.MOVED_TO | FileObserver.MOVED_FROM); + startWatching(); + } + + @Override + public void onEvent(int event, String path) + { + if (path != null) // Android bug? We seem to receive MOVE_SELF events + mActivity.mPagerAdapter.postRequestRequery(FileSystemAdapter.this); + } + } + + @Override + public Intent createData(View view) + { + ViewHolder holder = (ViewHolder)view.getTag(); + File file = mFiles[(int)holder.id]; + + Intent intent = new Intent(); + intent.putExtra(LibraryAdapter.DATA_TYPE, MediaUtils.TYPE_FILE); + intent.putExtra(LibraryAdapter.DATA_ID, getItemId((int)holder.id)); + intent.putExtra(LibraryAdapter.DATA_TITLE, holder.title); + intent.putExtra(LibraryAdapter.DATA_EXPANDABLE, file.isDirectory()); + intent.putExtra(LibraryAdapter.DATA_FILE, file.getAbsolutePath()); + return intent; + } + + @Override + public int getDefaultSortMode() { + return SORT_NAME; + } + + @Override + public String getSortSettingsKey() { + return "sort_filesystem"; + } + + /** + * Returns all songs represented by this adapter. + * Note that this will do a recursive query! + * + * @param projection the projection to use + * @return a query task + */ + @Override + public QueryTask buildSongQuery(String[] projection) { + File path = getLimiterPath(); + return MediaUtils.buildFileQuery(path.getPath(), projection, true); + } + + /** + * A row was clicked: this was dispatched by LibraryPagerAdapter + * + * @param intent likely created by createData() + */ + public void onItemClicked(Intent intent) { + boolean isFolder = intent.getBooleanExtra(LibraryAdapter.DATA_EXPANDABLE, false); + boolean isHeader = intent.getLongExtra(LibraryAdapter.DATA_ID, LibraryAdapter.INVALID_ID) + == LibraryAdapter.HEADER_ID; + + if (!isHeader && FileUtils.canDispatchIntent(intent) && FileUtils.dispatchIntent(mActivity, intent)) + return; + + if (isFolder) { + mActivity.onItemExpanded(intent); + } else { + mActivity.onItemClicked(intent); + } + } + + /** + * Context menu of a row: this was dispatched by LibraryPagerAdapter + * + * @param intent likely created by createData() + * @param view the parent view + * @param x x-coords of event + * @param y y-coords of event + */ + public boolean onCreateFancyMenu(Intent intent, View view, float x, float y) { + String path = intent.getStringExtra(LibraryAdapter.DATA_FILE); + boolean isParentRow = (path != null && pointsToParentFolder(new File(path))); + + if (!isParentRow) + return mActivity.onCreateFancyMenu(intent, view, x, y); + // else: no context menu, but consume event. + return true; + } +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/FileUtils.java b/app/src/main/java/ch/blinkenlights/android/vanilla/FileUtils.java new file mode 100644 index 0000000..cb03a36 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/FileUtils.java @@ -0,0 +1,283 @@ +/* + * Copyright (C) 2015-2020 Adrian Ulrich <adrian@blinkenlights.ch> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package ch.blinkenlights.android.vanilla; + +import ch.blinkenlights.android.medialibrary.MediaLibrary; + +import java.io.File; +import java.net.URI; +import java.net.URLConnection; +import java.net.URISyntaxException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.StringTokenizer; + +import java.nio.file.Path; + +import android.content.Context; +import android.content.Intent; +import android.content.SharedPreferences; +import android.net.Uri; +import android.os.Build; +import android.os.Environment; +import android.text.TextUtils; +import android.util.Log; + + +/** + * Provides some static File-related utility functions. + */ +public class FileUtils { + /** + * The string (but also valid path!) to use to indicate the current directory + */ + public static final String NAME_CURRENT_FOLDER = "."; + /** + * The string (but also valid path!) to use to indicate the parent directory + */ + public static final String NAME_PARENT_FOLDER = ".."; + + private FileUtils() { + // Private constructor to hide implicit one. + } + + /** + * Converts common path separator characters ('/' or '\\') to the value of File.separatorChar. + * + * @param path The path to convert directory separators within. + * @return A path with all valid separators normalized to the system's. + */ + public static String normalizeDirectorySeparators(String path) { + final StringBuilder sb = new StringBuilder(path); + + for (int i = 0; i < sb.length(); i++) { + final char originalChar = sb.charAt(i); + if (originalChar == '/' || originalChar == '\\') { + sb.setCharAt(i, File.separatorChar); + } + } + return sb.toString(); + } + + /** + * Utility function to prepend n-parent directory traversals to a path. + * + * @param path A relative path to traverse upwards from within. + * @param traversalCount The number of directories to navigate upwards. + * @return The result of creating the relative path. + */ + private static String traversePathUpwards(String path, int traversalCount) { + if (traversalCount < 0) + throw new IllegalArgumentException("Cannot descend into the directory structure."); + + if (traversalCount == 0) + return path; + + StringBuilder sb = new StringBuilder((FileUtils.NAME_PARENT_FOLDER.length() + 1) * traversalCount + + path.length()); + + for (int i = 0; i < traversalCount; i++) { + sb.append(FileUtils.NAME_PARENT_FOLDER); + sb.append(File.separatorChar); + } + sb.append(path); + return sb.toString(); + } + + /** + * Attempts to generate a relative path from a base, to a destination. + * Will attempt to perform directory traversal to find a common path. + * Upon failure to relativize, returns the original destination. + * + * @param base The File the path is relative to e.g. /a/b/c/ + * @param destination The File the resultant path should point to e.g. /a/b/c/d.mp3 + * @return A relative or absolute path pointing to the destination. + */ + public static String relativize(File base, File destination) { + if (destination.isAbsolute() != base.isAbsolute()) + return destination.getPath(); + + File commonParentFile = base; + final String destinationPath = destination.getPath(); + int traversalCount = 0; + + if (commonParentFile.equals(destination)) { + return FileUtils.NAME_CURRENT_FOLDER; + } + + do { + String parentPath = commonParentFile.getPath(); + if (!parentPath.endsWith(File.separator)) { + parentPath += File.separatorChar; + } + + if (destinationPath.startsWith(parentPath)) { + return traversePathUpwards( + destinationPath.substring(parentPath.length()), + traversalCount); + } + ++traversalCount; + } while ((commonParentFile = commonParentFile.getParentFile()) != null); + return destination.getPath(); + } + + /** + * Attempts to resolve a path from a base, if the destination is relative. + * Upon failure to resolve, returns the original destination. + * + * @param base The File the path may be relative to e.g. /a/b/c/ + * @param destination The File the resultant path should point to e.g. d.mp3 + * @return A relative or absolute path pointing to the destination. + */ + public static String resolve(File base, File destination) { + String path = destination.getPath(); + + try { + if (!destination.isAbsolute()) { + path = new File(base, path).getAbsolutePath(); + final ArrayList<String> pathComponents = new ArrayList<>(); + final StringTokenizer pathTokenizer = new StringTokenizer(path, File.separator); + + while (pathTokenizer.hasMoreTokens()) { + final String pathComponent = pathTokenizer.nextToken(); + + if (NAME_PARENT_FOLDER.equals(pathComponent)) { + final int lastComponentPosition = pathComponents.size() - 1; + + if (lastComponentPosition >= 0 + && !NAME_PARENT_FOLDER.equals(pathComponents.get(lastComponentPosition))) { + pathComponents.remove(lastComponentPosition); + } + } else { + pathComponents.add(pathComponent); + } + } + path = File.separator + TextUtils.join(File.separator, pathComponents); + } + } catch (SecurityException ex) { + // Ignore. + } + return path; + } + + + /** + * Checks if dispatching this intent to an external application makes sense + * + * @param intent The intent to examine + * @return bool true if the intent could be dispatched + */ + public static boolean canDispatchIntent(Intent intent) { + boolean canDispatch = false; + + int type = intent.getIntExtra(LibraryAdapter.DATA_TYPE, MediaUtils.TYPE_INVALID); + boolean isFolder = intent.getBooleanExtra(LibraryAdapter.DATA_EXPANDABLE, false); + String path = intent.getStringExtra(LibraryAdapter.DATA_FILE); + if (type == MediaUtils.TYPE_FILE && !isFolder) { + try { + URI uri = new URI("file", path, null); + String mimeGuess = URLConnection.guessContentTypeFromName(uri.toString()); + if (mimeGuess != null && mimeGuess.matches("^(image|text)/.+")) { + canDispatch = true; + } + } catch (URISyntaxException e) { + Log.e("VanillaMusic", "failed to encode "+path+": "+e); + } + } + return canDispatch; + } + + /** + * Opens an intent in an external application + * + * @param activity The library activity to use + * @param intent The intent to examine and launch + * @return bool true if the intent was dispatched + */ + public static boolean dispatchIntent(LibraryActivity activity, Intent intent) { + boolean handled = true; + + String path = intent.getStringExtra(LibraryAdapter.DATA_FILE); + String mimeGuess = URLConnection.guessContentTypeFromName(path); + File file = new File(path); + Uri uri = Uri.fromFile(file); + + Intent extView = new Intent(Intent.ACTION_VIEW); + extView.setDataAndType(uri, mimeGuess); + try { + activity.startActivity(extView); + } catch (Exception ActivityNotFoundException) { + handled = false; + } + return handled; + } + + /** + * Called by FileSystem adapter to get the start folder + * for browsing directories + */ + public static File getFilesystemBrowseStart(Context context) { + SharedPreferences prefs = SharedPrefHelper.getSettings(context); + String folder = prefs.getString(PrefKeys.FILESYSTEM_BROWSE_START, PrefDefaults.FILESYSTEM_BROWSE_START); + + if (folder.equals("")) { + folder = Environment.getExternalStorageDirectory().getAbsolutePath(); + } + return new File(folder); + } + + /** + * Return the file extension for a given filename (including dot). + * Empty string is returned if there is no extension. + */ + public static String getFileExtension(String filename) { + int index = filename.lastIndexOf('.'); + return index > 0 ? filename.substring(index) : ""; + } + + /** + * Returns a list of directores contained in 'dir' which are very likely to exist, based + * on what Android told us about the existence of external media dirs. + * This is required as users otherwise may end up in folders they can not navigate out of. + */ + public static ArrayList<File> getFallbackDirectories(Context context, File dir) { + HashSet<File> result = new HashSet<>(); + + Path prefix = dir.toPath(); + for (File f : context.getExternalMediaDirs()) { + Path p = f.toPath(); + if (p.getNameCount() <= prefix.getNameCount()) + continue; + if (!p.startsWith(prefix)) + continue; + Path sp = p.subpath(prefix.getNameCount(), prefix.getNameCount()+1); + result.add(new File(dir, sp.toString())); + } + return new ArrayList<File>(result); + } + + /** + * Returns the ID which the media library uses for a file. + * + * @param the file to get the id for. + * @return the id this file would have in the library. + */ + public static long songIdFromFile(File file) { + return MediaLibrary.hash63(file.getAbsolutePath()); + } +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/FilebrowserStartActivity.java b/app/src/main/java/ch/blinkenlights/android/vanilla/FilebrowserStartActivity.java new file mode 100644 index 0000000..50c2fa5 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/FilebrowserStartActivity.java @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2017 Adrian Ulrich <adrian@blinkenlights.ch> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package ch.blinkenlights.android.vanilla; + +import android.os.Bundle; +import android.content.SharedPreferences; + +import java.io.File; +import java.util.ArrayList; + +public class FilebrowserStartActivity extends FolderPickerActivity { + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setTitle(R.string.filebrowser_start); + + // Make sure that we display the current selection + File startPath = FileUtils.getFilesystemBrowseStart(this); + setCurrentDir(startPath); + } + + + @Override + public void onFolderPicked(File directory, ArrayList<String> a, ArrayList<String> b) { + SharedPreferences.Editor editor = SharedPrefHelper.getSettings(this).edit(); + editor.putString(PrefKeys.FILESYSTEM_BROWSE_START, directory.getAbsolutePath()); + editor.apply(); + finish(); + } + +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/FolderPickerActivity.java b/app/src/main/java/ch/blinkenlights/android/vanilla/FolderPickerActivity.java new file mode 100644 index 0000000..b8e3773 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/FolderPickerActivity.java @@ -0,0 +1,330 @@ +/* + * Copyright (C) 2013-2020 Adrian Ulrich <adrian@blinkenlights.ch> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package ch.blinkenlights.android.vanilla; + +import java.util.ArrayList; +import java.io.File; +import android.app.Activity; +import android.app.AlertDialog; +import android.content.DialogInterface; +import android.os.Bundle; +import android.text.Editable; +import android.text.TextWatcher; +import android.view.View; +import android.view.MenuItem; +import android.view.Menu; +import android.widget.AdapterView; +import android.widget.Button; +import android.widget.ListView; +import android.widget.EditText; +import android.widget.Toast; +import android.widget.Spinner; + +import com.mobeta.android.dslv.DragSortListView; + + +public abstract class FolderPickerActivity extends Activity + implements AdapterView.OnItemClickListener, + AdapterView.OnItemLongClickListener, + AdapterView.OnItemSelectedListener +{ + + /** + * Our listview + */ + private DragSortListView mListView; + /** + * View displaying the current path + */ + private EditText mPathDisplay; + /** + * Save button + */ + private Button mSaveButton; + /** + * Tristate spinner + */ + private Spinner mSpinner; + /** + * The array adapter of our listview + */ + private FolderPickerAdapter mListAdapter; + + @Override + public void onCreate(Bundle savedInstanceState) { + ThemeHelper.setTheme(this, R.style.BackActionBar); + super.onCreate(savedInstanceState); + + setContentView(R.layout.folderpicker_content); + + mListAdapter = new FolderPickerAdapter(this, 0); + mListView = (DragSortListView)findViewById(R.id.list); + mPathDisplay = (EditText) findViewById(R.id.path_display); + mSaveButton = (Button) findViewById(R.id.save_button); + mSpinner = (Spinner) findViewById(R.id.folder_picker_spinner); + + mListView.setAdapter(mListAdapter); + mListView.setOnItemClickListener(this); + + mPathDisplay.addTextChangedListener(mTextWatcher); + mSaveButton.setOnClickListener(mSaveButtonClickListener); + + mSpinner.setSelection(0); + mSpinner.setOnItemSelectedListener(this); + + // init defaults + enableTritasticSelect(false, null, null); + enableTritasticSpinner(false); + } + + /** + * Callback for Save button click events + */ + private final View.OnClickListener mSaveButtonClickListener = new View.OnClickListener() { + public void onClick(View v) { + onFolderPicked(mListAdapter.getCurrentDir(), + mListAdapter.getIncludedDirs(), + mListAdapter.getExcludedDirs()); + } + }; + + /** + * Callback for EditText change events + */ + private final TextWatcher mTextWatcher = new TextWatcher() { + @Override + public void afterTextChanged(Editable s) { + final File dir = new File(s.toString()); + setCurrentDir(dir); + } + + @Override + public void beforeTextChanged(CharSequence s, int start, int count, int after) { + } + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + } + }; + + /** + * Called after a folder was selected + * + * @param directory the selected directory + * @param included unique list of included directories in tristastic mode + * @param excluded unique list of excluded directories in triatastic mode + */ + public abstract void onFolderPicked(File directory, ArrayList<String> included, ArrayList<String> excluded); + + /** + * Enables tritastic selection, that is: user can select each + * directory to be in included, excluded or neutral state. + * + * @param enabled enables or disables this feature + * @param included initial list of included dirs + * @param excluded initial list of excluded dirs + */ + public void enableTritasticSelect(boolean enabled, ArrayList<String> included, ArrayList<String> excluded) { + if (enabled) { + Toast.makeText(this, R.string.hint_long_press_to_modify_folder, Toast.LENGTH_SHORT).show(); + mListAdapter.setIncludedDirs(included); + mListAdapter.setExcludedDirs(excluded); + } + mListView.setOnItemLongClickListener(enabled ? this : null); + mSaveButton.setText(enabled ? R.string.save : R.string.select); + } + + /** + * Whether or not to enable the tristate spinner. + */ + public void enableTritasticSpinner(boolean enabled) { + View view = findViewById(R.id.folder_picker_spinner_container); + view.setVisibility(enabled ? View.VISIBLE : View.GONE); + } + + /** + * Jumps to given directory + * + * @param dir the directory to jump to + */ + void setCurrentDir(File dir) { + mSaveButton.setEnabled(dir.isDirectory()); + mSpinner.setEnabled(dir.isDirectory()); + mListAdapter.setCurrentDir(dir); + mListView.setSelectionFromTop(0, 0); + + final File labelDir = new File(mPathDisplay.getText().toString()); + if (!dir.equals(labelDir)) { + // Only update the text field if the actual dir doesn't equal + // the currently displayed path, even if the text isn't exactly + // the same. We do this to avoid 'jumps' where we would replace + // '/storage/x/' with '/storage/x'. + final String label = dir.getAbsolutePath(); + mPathDisplay.setText(label); + mPathDisplay.setSelection(label.length()); + + // Since the folder changed, also update the spinner state. + if (mListAdapter.getIncludedDirs().contains(label)) { + mSpinner.setSelection(0); + } else if (mListAdapter.getExcludedDirs().contains(label)) { + mSpinner.setSelection(1); + } else { + mSpinner.setSelection(2); + } + } + } + + /** + * Create a bare-bones actionbar + */ + @Override + public boolean onCreateOptionsMenu(Menu menu) { + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) + { + if (item.getItemId() == android.R.id.home) { + finish(); + return true; + } else { + return super.onOptionsItemSelected(item); + } + } + + /** + * Called if user interacts with the spinner. + */ + @Override + public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { + FolderState state = FolderState.NEUTRAL; + switch(position) { + case 0: + state = FolderState.INCLUDE; + break; + case 1: + state = FolderState.EXCLUDE; + break; + } + setFolderState(mListAdapter.getCurrentDir().getAbsolutePath(), state); + } + + /** + * Called if user dismisses the spinner. + */ + @Override + public void onNothingSelected(AdapterView<?> parent) { + // noop. + } + + /** + * Called if user taps a row + */ + @Override + public void onItemClick(AdapterView<?> parent, View view, int pos, long id) { + FolderPickerAdapter.Item item = mListAdapter.getItem(pos); + File curPath = mListAdapter.getCurrentDir(); + File newPath = null; + + if(item.file == null) { + // This is the '..' entry + newPath = curPath.getParentFile(); + } + else { + newPath = new File(curPath, item.name); + } + + if (newPath != null) + setCurrentDir(newPath); + } + + /** + * Called on long-click on a row + */ + @Override + public boolean onItemLongClick(AdapterView<?> parent, View view, int pos, long id) { + FolderPickerAdapter.Item item = mListAdapter.getItem(pos); + + if (item.file == null) + return false; + + final String path = item.file.getAbsolutePath(); + final CharSequence[] options = new CharSequence[]{ + getResources().getString(R.string.folder_include), + getResources().getString(R.string.folder_exclude), + getResources().getString(R.string.folder_neutral) + }; + + AlertDialog.Builder builder = new AlertDialog.Builder(this) + .setTitle(item.name) + .setItems(options, + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + switch (which) { + case 0: + setFolderState(path, FolderState.INCLUDE); + break; + case 1: + setFolderState(path, FolderState.EXCLUDE); + break; + default: + setFolderState(path, FolderState.NEUTRAL); + } + } + }); + builder.create().show(); + return true; + } + + /** + * Enums to pass to setFolderState() + */ + enum FolderState { + NEUTRAL, + INCLUDE, + EXCLUDE, + } + + /** + * update included/excluded folders on the adapter. + * + * @param folder the folder to act on. + * @param state the state the passed in folder should have. + */ + private void setFolderState(String folder, FolderState state) { + ArrayList<String> includedDirs = mListAdapter.getIncludedDirs(); + ArrayList<String> excludedDirs = mListAdapter.getExcludedDirs(); + includedDirs.remove(folder); + excludedDirs.remove(folder); + switch (state) { + case INCLUDE: + includedDirs.add(folder); + break; + case EXCLUDE: + excludedDirs.add(folder); + break; + case NEUTRAL: + // noop. + break; + } + + mListAdapter.setIncludedDirs(includedDirs); + mListAdapter.setExcludedDirs(excludedDirs); + } +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/FolderPickerAdapter.java b/app/src/main/java/ch/blinkenlights/android/vanilla/FolderPickerAdapter.java new file mode 100644 index 0000000..02671a3 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/FolderPickerAdapter.java @@ -0,0 +1,210 @@ +/* + * Copyright (C) 2013-2021 Adrian Ulrich <adrian@blinkenlights.ch> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package ch.blinkenlights.android.vanilla; + +import android.content.Context; +import android.app.Activity; +import android.os.Environment; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.view.LayoutInflater; +import android.widget.ArrayAdapter; +import android.widget.TextView; +import android.widget.ImageView; +import android.graphics.drawable.Drawable; + +import java.io.File; +import java.util.Arrays; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + + +public class FolderPickerAdapter + extends ArrayAdapter<FolderPickerAdapter.Item> +{ + + public static class Item { + String name; + File file; + int color; + public Item(String name, File file, int color) { + this.name = name; + this.file = file; + this.color = color; + } + } + + /** + * The context we run in. + */ + private Context mContext; + /** + * Our layout inflater instance + */ + private final LayoutInflater mInflater; + /** + * The filesystem root + */ + final private File mFsRoot = new File("/"); + /** + * The currently set directory + */ + private File mCurrentDir; + /** + * A list of paths marked as 'included' + */ + private ArrayList<String> mIncludedDirs = new ArrayList<String>(); + /** + * A list of paths marked as 'excluded' + */ + private ArrayList<String> mExcludedDirs = new ArrayList<String>(); + + + public FolderPickerAdapter(Context context, int resource) { + super(context, resource); + mContext = context; + mInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + mCurrentDir = Environment.getExternalStorageDirectory(); + } + + @Override + public View getView(int pos, View convertView, ViewGroup parent) { + DraggableRow row; + + if (convertView == null) { + row = (DraggableRow)mInflater.inflate(R.layout.draggable_row, parent, false); + row.setupLayout(DraggableRow.LAYOUT_LISTVIEW); + row.getCoverView().setImageResource(R.drawable.folder); + + } else { + row = (DraggableRow)convertView; + } + + Item item = (Item)getItem(pos); + int res = (item.file == null ? R.drawable.arrow_up : R.drawable.folder); + row.setText(item.name); + row.getCoverView().setImageResource(res); + row.getCoverView().setColorFilter(item.color); + return row; + } + + /** + * Returns the currently set directory + */ + public File getCurrentDir() { + return mCurrentDir; + } + + /** + * Changes the currently active directory + */ + public void setCurrentDir(File dir) { + mCurrentDir = dir; + refresh(); + } + + /** + * Returns the list of included directories + * + * @return arraylist - may be null + */ + public ArrayList<String> getIncludedDirs() { + return mIncludedDirs; + } + + /** + * Sets the included dirlist + * + * @param list the arraylist to use + */ + public void setIncludedDirs(ArrayList<String> list) { + mIncludedDirs = verifyDirs(list); + refresh(); + } + + /** + * Returns the list of excluded directories + * + * @return arraylist - may be null + */ + public ArrayList<String> getExcludedDirs() { + return mExcludedDirs; + } + + /** + * Sets the excluded dirlist + * + * @param list the arraylist to use + */ + public void setExcludedDirs(ArrayList<String> list) { + mExcludedDirs = verifyDirs(list); + refresh(); + } + + /** + * Returns list, weeding out non-existing or invalid dirs + * + * @param list the list to check + * @return list the checked list + */ + private ArrayList<String> verifyDirs(ArrayList<String> list) { + ArrayList<String> result = new ArrayList<String>(); + for (String path : list) { + File file = new File(path); + if (file.isDirectory()) + result.add(path); + } + return result; + } + + /** + * Refreshes the current ArrayList + */ + private void refresh() { + File path = mCurrentDir; + + clear(); + + if (!mFsRoot.equals(path)) + add(new FolderPickerAdapter.Item("..", null, 0)); + + List<File> dirs; + File []l = path.listFiles(); + if (l != null) { + dirs = Arrays.asList(l); + } else { + dirs = FileUtils.getFallbackDirectories(mContext, path); + } + + Collections.sort(dirs); + for(File fentry: dirs) { + if(fentry.isDirectory()) { + int color = 0; + if (mIncludedDirs.contains(fentry.getAbsolutePath())) + color = 0xff00c853; + if (mExcludedDirs.contains(fentry.getAbsolutePath())) + color = 0xffd50000; + Item item = new Item(fentry.getName(), fentry, color); + add(item); + } + } + } + +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/FourLongWidget.java b/app/src/main/java/ch/blinkenlights/android/vanilla/FourLongWidget.java new file mode 100644 index 0000000..bbc88d5 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/FourLongWidget.java @@ -0,0 +1,144 @@ +/* + * Copyright (C) 2010, 2011 Christopher Eby <kreed@kreed.org> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package ch.blinkenlights.android.vanilla; + +import android.app.PendingIntent; +import android.appwidget.AppWidgetManager; +import android.appwidget.AppWidgetProvider; +import android.content.ComponentName; +import android.content.Context; +import android.content.Intent; +import android.graphics.Bitmap; +import android.view.View; +import android.widget.RemoteViews; + +/** + * 1x4 widget that shows title, artist, album art, a play/pause button, and a + * next button. + */ +public class FourLongWidget extends AppWidgetProvider { + private static boolean sEnabled; + + @Override + public void onEnabled(Context context) + { + sEnabled = true; + } + + @Override + public void onDisabled(Context context) + { + sEnabled = false; + } + + @Override + public void onUpdate(Context context, AppWidgetManager manager, int[] ids) + { + Song song = null; + int state = 0; + + if (PlaybackService.hasInstance()) { + PlaybackService service = PlaybackService.get(context); + song = service.getSong(0); + state = service.getState(); + } + + sEnabled = true; + updateWidget(context, manager, song, state); + } + + /** + * Check if there are any instances of this widget placed. + */ + public static void checkEnabled(Context context, AppWidgetManager manager) + { + sEnabled = manager.getAppWidgetIds(new ComponentName(context, FourLongWidget.class)).length != 0; + } + + /** + * Populate the widgets with the given ids with the given info. + * + * @param context A Context to use. + * @param manager The AppWidgetManager that will be used to update the + * widget. + * @param song The current Song in PlaybackService. + * @param state The current PlaybackService state. + */ + public static void updateWidget(Context context, AppWidgetManager manager, Song song, int state) + { + if (!sEnabled) + return; + + RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.four_long_widget); + + if ((state & PlaybackService.FLAG_NO_MEDIA) != 0) { + views.setViewVisibility(R.id.play_pause, View.GONE); + views.setViewVisibility(R.id.next, View.GONE); + views.setViewVisibility(R.id.title, View.GONE); + views.setInt(R.id.artist, "setText", R.string.no_songs); + views.setViewVisibility(R.id.album, View.GONE); + } else if (song == null) { + views.setViewVisibility(R.id.play_pause, View.VISIBLE); + views.setViewVisibility(R.id.next, View.VISIBLE); + views.setViewVisibility(R.id.title, View.GONE); + views.setInt(R.id.artist, "setText", R.string.app_name); + views.setViewVisibility(R.id.album, View.GONE); + } else { + views.setViewVisibility(R.id.play_pause, View.VISIBLE); + views.setViewVisibility(R.id.next, View.VISIBLE); + views.setViewVisibility(R.id.title, View.VISIBLE); + views.setViewVisibility(R.id.album, View.VISIBLE); + views.setTextViewText(R.id.title, song.title); + views.setTextViewText(R.id.artist, song.artist); + views.setTextViewText(R.id.album, song.album); + Bitmap cover = song.getMediumCover(context); + if (cover == null) { + views.setImageViewResource(R.id.cover, R.drawable.fallback_cover_large); + } else { + views.setImageViewBitmap(R.id.cover, cover); + } + } + + boolean playing = (state & PlaybackService.FLAG_PLAYING) != 0; + views.setImageViewResource(R.id.play_pause, playing ? R.drawable.pause : R.drawable.play); + + Intent intent; + PendingIntent pendingIntent; + int flags = Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_TASK_ON_HOME; + + intent = new Intent(context, LibraryActivity.class).setAction(Intent.ACTION_MAIN); + pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE); + views.setOnClickPendingIntent(R.id.cover, pendingIntent); + views.setOnClickPendingIntent(R.id.text_layout, pendingIntent); + + intent = ShortcutPseudoActivity.getIntent(context, PlaybackService.ACTION_TOGGLE_PLAYBACK); + pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE); + views.setOnClickPendingIntent(R.id.play_pause, pendingIntent); + + intent = ShortcutPseudoActivity.getIntent(context, PlaybackService.ACTION_NEXT_SONG); + pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE); + views.setOnClickPendingIntent(R.id.next, pendingIntent); + + manager.updateAppWidget(new ComponentName(context, FourLongWidget.class), views); + } +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/FourSquareWidget.java b/app/src/main/java/ch/blinkenlights/android/vanilla/FourSquareWidget.java new file mode 100644 index 0000000..7e85fab --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/FourSquareWidget.java @@ -0,0 +1,146 @@ +/* + * Copyright (C) 2010, 2011 Christopher Eby <kreed@kreed.org> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package ch.blinkenlights.android.vanilla; + +import android.app.PendingIntent; +import android.appwidget.AppWidgetManager; +import android.appwidget.AppWidgetProvider; +import android.content.ComponentName; +import android.content.Context; +import android.content.Intent; +import android.graphics.Bitmap; +import android.view.View; +import android.widget.RemoteViews; + +/** + * 2x2 widget that shows title, artist, a (hidden) play/pause button, a (hidden) + * next button, and cover art in the background. + */ +public class FourSquareWidget extends AppWidgetProvider { + private static boolean sEnabled; + + @Override + public void onEnabled(Context context) + { + sEnabled = true; + } + + @Override + public void onDisabled(Context context) + { + sEnabled = false; + } + + @Override + public void onUpdate(Context context, AppWidgetManager manager, int[] ids) + { + Song song = null; + int state = 0; + + if (PlaybackService.hasInstance()) { + PlaybackService service = PlaybackService.get(context); + song = service.getSong(0); + state = service.getState(); + } + + sEnabled = true; + updateWidget(context, manager, song, state); + } + + /** + * Check if there are any instances of this widget placed. + */ + public static void checkEnabled(Context context, AppWidgetManager manager) + { + sEnabled = manager.getAppWidgetIds(new ComponentName(context, FourSquareWidget.class)).length != 0; + } + + /** + * Populate the widgets with the given ids with the given info. + * + * @param context A Context to use. + * @param manager The AppWidgetManager that will be used to update the + * widget. + * @param song The current Song in PlaybackService. + * @param state The current PlaybackService state. + */ + public static void updateWidget(Context context, AppWidgetManager manager, Song song, int state) + { + if (!sEnabled) + return; + + RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.four_square_widget); + + boolean playing = (state & PlaybackService.FLAG_PLAYING) != 0; + int playResource = R.drawable.play; + int nextResource = R.drawable.next; + Bitmap cover = null; + + if ((state & PlaybackService.FLAG_NO_MEDIA) != 0) { + views.setViewVisibility(R.id.buttons, View.INVISIBLE); + views.setViewVisibility(R.id.title, View.INVISIBLE); + views.setInt(R.id.artist, "setText", R.string.no_songs); + } else if (song == null) { + views.setViewVisibility(R.id.buttons, View.VISIBLE); + views.setViewVisibility(R.id.title, View.INVISIBLE); + views.setInt(R.id.artist, "setText", R.string.app_name); + } else { + views.setViewVisibility(R.id.title, View.VISIBLE); + views.setViewVisibility(R.id.buttons, View.VISIBLE); + views.setTextViewText(R.id.title, song.title); + views.setTextViewText(R.id.artist, song.artist); + cover = song.getMediumCover(context); + playResource = playing ? R.drawable.hidden_pause : R.drawable.hidden_play; + nextResource = R.drawable.hidden_next; + } + + views.setImageViewResource(R.id.play_pause, playResource); + views.setImageViewResource(R.id.next, nextResource); + + if (cover == null) { + views.setImageViewResource(R.id.cover, R.drawable.fallback_cover_large); + } else { + views.setImageViewBitmap(R.id.cover, cover); + } + + + Intent intent; + PendingIntent pendingIntent; + int flags = Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_TASK_ON_HOME; + + intent = new Intent(context, LibraryActivity.class).setAction(Intent.ACTION_MAIN); + pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE); + views.setOnClickPendingIntent(R.id.title, pendingIntent); + views.setOnClickPendingIntent(R.id.artist, pendingIntent); + + intent = ShortcutPseudoActivity.getIntent(context, PlaybackService.ACTION_TOGGLE_PLAYBACK); + pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE); + views.setOnClickPendingIntent(R.id.play_pause, pendingIntent); + + intent = ShortcutPseudoActivity.getIntent(context, PlaybackService.ACTION_NEXT_SONG); + pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE); + views.setOnClickPendingIntent(R.id.next, pendingIntent); + + manager.updateAppWidget(new ComponentName(context, FourSquareWidget.class), views); + } +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/FourWhiteWidget.java b/app/src/main/java/ch/blinkenlights/android/vanilla/FourWhiteWidget.java new file mode 100644 index 0000000..edbd565 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/FourWhiteWidget.java @@ -0,0 +1,156 @@ +/* + * Copyright (C) 2017 Adrian Ulrich <adrian@blinkenlights.ch> + * Copyright (C) 2012 Ferenc Nagy <nferenc@nferenc.com> + * Copyright (C) 2010, 2011 Christopher Eby <kreed@kreed.org> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package ch.blinkenlights.android.vanilla; + +import android.app.PendingIntent; +import android.appwidget.AppWidgetManager; +import android.appwidget.AppWidgetProvider; +import android.content.ComponentName; +import android.content.Context; +import android.content.Intent; +import android.graphics.Bitmap; +import android.view.View; +import android.widget.RemoteViews; + +/** + * 1x4 widget that shows title, artist, album art, a play/pause button, and a + * previous/next button. + */ +public class FourWhiteWidget extends AppWidgetProvider { + private static boolean sEnabled; + + @Override + public void onEnabled(Context context) + { + sEnabled = true; + } + + @Override + public void onDisabled(Context context) + { + sEnabled = false; + } + + @Override + public void onUpdate(Context context, AppWidgetManager manager, int[] ids) + { + Song song = null; + int state = 0; + + if (PlaybackService.hasInstance()) { + PlaybackService service = PlaybackService.get(context); + song = service.getSong(0); + state = service.getState(); + } + + sEnabled = true; + updateWidget(context, manager, song, state); + } + + /** + * Check if there are any instances of this widget placed. + */ + public static void checkEnabled(Context context, AppWidgetManager manager) + { + sEnabled = manager.getAppWidgetIds(new ComponentName(context, FourWhiteWidget.class)).length != 0; + } + + /** + * Populate the widgets with the given ids with the given info. + * + * @param context A Context to use. + * @param manager The AppWidgetManager that will be used to update the + * widget. + * @param song The current Song in PlaybackService. + * @param state The current PlaybackService state. + */ + public static void updateWidget(Context context, AppWidgetManager manager, Song song, int state) + { + if (!sEnabled) + return; + + RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.four_white_widget); + + if ((state & PlaybackService.FLAG_NO_MEDIA) != 0) { + views.setViewVisibility(R.id.play_pause, View.INVISIBLE); + views.setViewVisibility(R.id.previous, View.INVISIBLE); + views.setViewVisibility(R.id.next, View.INVISIBLE); + views.setViewVisibility(R.id.title, View.INVISIBLE); + views.setInt(R.id.artist, "setText", R.string.no_songs); + views.setViewVisibility(R.id.cover, View.INVISIBLE); + } else if (song == null) { + views.setViewVisibility(R.id.play_pause, View.VISIBLE); + views.setViewVisibility(R.id.previous, View.VISIBLE); + views.setViewVisibility(R.id.next, View.VISIBLE); + views.setViewVisibility(R.id.title, View.INVISIBLE); + views.setInt(R.id.artist, "setText", R.string.app_name); + views.setViewVisibility(R.id.cover, View.INVISIBLE); + } else { + views.setViewVisibility(R.id.play_pause, View.VISIBLE); + views.setViewVisibility(R.id.previous, View.VISIBLE); + views.setViewVisibility(R.id.next, View.VISIBLE); + views.setViewVisibility(R.id.title, View.VISIBLE); + views.setTextViewText(R.id.title, song.title); + views.setTextViewText(R.id.artist, song.artist); + Bitmap cover = song.getMediumCover(context); + if (cover == null) { + views.setViewVisibility(R.id.cover, View.INVISIBLE); + } else { + // Ensure that the cover is not longer than its height - we can deal with non-square images + // if the reverse is true, but w > h messes up the layout. + if (cover.getWidth() > cover.getHeight()) + cover = Bitmap.createScaledBitmap(cover, cover.getHeight(), cover.getHeight(), true); + views.setImageViewBitmap(R.id.cover, cover); + views.setViewVisibility(R.id.cover, View.VISIBLE); + } + } + + boolean playing = (state & PlaybackService.FLAG_PLAYING) != 0; + views.setImageViewResource(R.id.play_pause, playing ? R.drawable.widget_pause : R.drawable.widget_play); + + Intent intent; + PendingIntent pendingIntent; + int flags = Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_TASK_ON_HOME; + + intent = new Intent(context, LibraryActivity.class).setAction(Intent.ACTION_MAIN); + pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE); + views.setOnClickPendingIntent(R.id.coverFrame, pendingIntent); + views.setOnClickPendingIntent(R.id.text_layout, pendingIntent); + + intent = ShortcutPseudoActivity.getIntent(context, PlaybackService.ACTION_TOGGLE_PLAYBACK); + pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE); + views.setOnClickPendingIntent(R.id.play_pause, pendingIntent); + + intent = ShortcutPseudoActivity.getIntent(context, PlaybackService.ACTION_NEXT_SONG); + pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE); + views.setOnClickPendingIntent(R.id.next, pendingIntent); + + intent = ShortcutPseudoActivity.getIntent(context, PlaybackService.ACTION_PREVIOUS_SONG); + pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE); + views.setOnClickPendingIntent(R.id.previous, pendingIntent); + + manager.updateAppWidget(new ComponentName(context, FourWhiteWidget.class), views); + } +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/FullPlaybackActivity.java b/app/src/main/java/ch/blinkenlights/android/vanilla/FullPlaybackActivity.java new file mode 100644 index 0000000..2b8586a --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/FullPlaybackActivity.java @@ -0,0 +1,684 @@ +/* + * Copyright (C) 2012 Christopher Eby <kreed@kreed.org> + * Copyright (C) 2016-2019 Adrian Ulrich <adrian@blinkenlights.ch> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package ch.blinkenlights.android.vanilla; + +import ch.blinkenlights.android.medialibrary.MediaMetadataExtractor; + +import java.util.ArrayList; + +import android.content.Intent; +import android.content.SharedPreferences; +import android.os.Bundle; +import android.os.Message; +import android.util.Log; +import android.view.Gravity; +import android.view.KeyEvent; +import android.view.Menu; +import android.view.MenuItem; +import android.view.SubMenu; +import android.view.View; +import android.view.ViewGroup; +import android.widget.LinearLayout; +import android.widget.TableLayout; +import android.widget.TableRow; +import android.widget.TextView; +import android.app.AlertDialog; +import android.content.DialogInterface; + +/** + * The primary playback screen with playback controls and large cover display. + */ +public class FullPlaybackActivity extends SlidingPlaybackActivity + implements View.OnLongClickListener +{ + public static final int DISPLAY_INFO_OVERLAP = 0; + public static final int DISPLAY_INFO_BELOW = 1; + public static final int DISPLAY_INFO_WIDGETS = 2; + + private TextView mOverlayText; + + private TableLayout mInfoTable; + private TextView mQueuePosView; + + private TextView mTitle; + private TextView mAlbum; + private TextView mArtist; + + /** + * True if the controls are visible (play, next, seek bar, etc). + */ + private boolean mControlsVisible; + /** + * True if the extra info is visible. + */ + private boolean mExtraInfoVisible; + + /** + * The current display mode, which determines layout and cover render style. + */ + private int mDisplayMode; + + private Action mCoverPressAction; + private Action mCoverLongPressAction; + + /** + * The currently playing song. + */ + private Song mCurrentSong; + + private String mGenre; + private TextView mGenreView; + private String mTrack; + private TextView mTrackView; + private String mYear; + private TextView mYearView; + private String mComposer; + private TextView mComposerView; + private String mPath; + private TextView mPathView; + private String mFormat; + private TextView mFormatView; + private String mReplayGain; + private TextView mReplayGainView; + private MenuItem mFavorites; + + @Override + public void onCreate(Bundle icicle) + { + ThemeHelper.setTheme(this, R.style.Playback); + super.onCreate(icicle); + + setTitle(R.string.playback_view); + + SharedPreferences settings = SharedPrefHelper.getSettings(this); + int displayMode = Integer.parseInt(settings.getString(PrefKeys.DISPLAY_MODE, PrefDefaults.DISPLAY_MODE)); + mDisplayMode = displayMode; + + int layout = R.layout.full_playback; + int coverStyle; + + switch (displayMode) { + default: + Log.w("VanillaMusic", "Invalid display mode given. Defaulting to widget mode."); + // fall through + case DISPLAY_INFO_WIDGETS: + coverStyle = CoverBitmap.STYLE_NO_INFO; + layout = R.layout.full_playback_alt; + break; + case DISPLAY_INFO_OVERLAP: + coverStyle = CoverBitmap.STYLE_OVERLAPPING_BOX; + break; + case DISPLAY_INFO_BELOW: + coverStyle = CoverBitmap.STYLE_INFO_BELOW; + break; + } + + setContentView(layout); + + CoverView coverView = (CoverView)findViewById(R.id.cover_view); + coverView.setup(mLooper, this, coverStyle); + coverView.setOnClickListener(this); + coverView.setOnLongClickListener(this); + mCoverView = coverView; + + TableLayout table = (TableLayout)findViewById(R.id.info_table); + if (table != null) { + table.setOnClickListener(this); + table.setOnLongClickListener(this); + mInfoTable = table; + } + + mTitle = (TextView)findViewById(R.id.title); + mAlbum = (TextView)findViewById(R.id.album); + mArtist = (TextView)findViewById(R.id.artist); + + mQueuePosView = (TextView)findViewById(R.id.queue_pos); + + mGenreView = (TextView)findViewById(R.id.genre); + mTrackView = (TextView)findViewById(R.id.track); + mYearView = (TextView)findViewById(R.id.year); + mComposerView = (TextView)findViewById(R.id.composer); + mPathView = (TextView)findViewById(R.id.path); + mFormatView = (TextView)findViewById(R.id.format); + mReplayGainView = (TextView)findViewById(R.id.replaygain); + + bindControlButtons(); + + setControlsVisible(settings.getBoolean(PrefKeys.VISIBLE_CONTROLS, PrefDefaults.VISIBLE_CONTROLS)); + setExtraInfoVisible(settings.getBoolean(PrefKeys.VISIBLE_EXTRA_INFO, PrefDefaults.VISIBLE_EXTRA_INFO)); + } + + @Override + public void onStart() + { + super.onStart(); + + SharedPreferences settings = SharedPrefHelper.getSettings(this); + if (mDisplayMode != Integer.parseInt(settings.getString(PrefKeys.DISPLAY_MODE, PrefDefaults.DISPLAY_MODE))) { + finish(); + startActivity(new Intent(this, FullPlaybackActivity.class)); + } + + mCoverPressAction = Action.getAction(settings, PrefKeys.COVER_PRESS_ACTION, PrefDefaults.COVER_PRESS_ACTION); + mCoverLongPressAction = Action.getAction(settings, PrefKeys.COVER_LONGPRESS_ACTION, PrefDefaults.COVER_LONGPRESS_ACTION); + } + + /** + * Hide the message overlay, if it exists. + */ + private void hideMessageOverlay() + { + if (mOverlayText != null) + mOverlayText.setVisibility(View.GONE); + } + + /** + * Show some text in a message overlay. + * + * @param text Resource id of the text to show. + */ + private void showOverlayMessage(int text) + { + if (mOverlayText == null) { + TextView view = new TextView(this); + // This will be drawn on top of all other controls, so we flood this view + // with a non-alpha color + view.setBackgroundColor(ThemeHelper.fetchThemeColor(this, android.R.attr.colorBackground)); + view.setGravity(Gravity.CENTER); + view.setPadding(25, 25, 25, 25); + // Make the view clickable so it eats touch events + view.setClickable(true); + view.setOnClickListener(this); + addContentView(view, + new ViewGroup.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, + LinearLayout.LayoutParams.MATCH_PARENT)); + mOverlayText = view; + } else { + mOverlayText.setVisibility(View.VISIBLE); + } + + mOverlayText.setText(text); + } + + @Override + protected void onStateChange(int state, int toggled) + { + super.onStateChange(state, toggled); + + if ((toggled & (PlaybackService.FLAG_NO_MEDIA|PlaybackService.FLAG_EMPTY_QUEUE)) != 0) { + if ((state & PlaybackService.FLAG_NO_MEDIA) != 0) { + showOverlayMessage(R.string.no_songs); + } else if ((state & PlaybackService.FLAG_EMPTY_QUEUE) != 0) { + showOverlayMessage(R.string.empty_queue); + } else { + hideMessageOverlay(); + } + } + + if (mQueuePosView != null) + updateQueuePosition(); + } + + @Override + protected void onSongChange(Song song) { + if (mTitle != null) { + if (song == null) { + mTitle.setText(null); + mAlbum.setText(null); + mArtist.setText(null); + } else { + mTitle.setText(song.title); + mAlbum.setText(song.album); + mArtist.setText(song.artist); + } + updateQueuePosition(); + } + + mCurrentSong = song; + + mHandler.sendEmptyMessage(MSG_LOAD_FAVOURITE_INFO); + + // All quick UI updates are done: Time to update the cover + // and parse additional info + if (mExtraInfoVisible) { + mHandler.sendEmptyMessage(MSG_LOAD_EXTRA_INFO); + } + super.onSongChange(song); + } + + /** + * Update the queue position display. mQueuePos must not be null. + */ + private void updateQueuePosition() + { + if (PlaybackService.finishAction(mState) == SongTimeline.FINISH_RANDOM) { + // Not very useful in random mode; it will always show something + // like 11/13 since the timeline is trimmed to 10 previous songs. + // So just hide it. + mQueuePosView.setText(null); + } else { + PlaybackService service = PlaybackService.get(this); + mQueuePosView.setText((service.getTimelinePosition() + 1) + "/" + service.getTimelineLength()); + } + mQueuePosView.requestLayout(); // ensure queue pos column has enough room + } + + @Override + public void onPositionInfoChanged() + { + if (mQueuePosView != null) + mUiHandler.sendEmptyMessage(MSG_UPDATE_POSITION); + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) + { + super.onCreateOptionsMenu(menu); + menu.add(0, MENU_DELETE, 30, R.string.delete); + SubMenu enqueueMenu = menu.addSubMenu(0, MENU_ENQUEUE, 30, R.string.enqueue_current); + SubMenu moreMenu = menu.addSubMenu(0, MENU_MORE, 30, R.string.more_from_current); + menu.addSubMenu(0, MENU_ADD_TO_PLAYLIST, 30, R.string.add_to_playlist); + menu.add(0, MENU_SHARE, 30, R.string.share); + + if (PluginUtils.checkPlugins(this)) { + menu.add(0, MENU_PLUGINS, 30, R.string.plugins) + .setIcon(R.drawable.plugin) + .setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_IF_ROOM); + } + + mFavorites = menu.add(0, MENU_SONG_FAVORITE, 0, R.string.add_to_favorites) + .setIcon(R.drawable.btn_rating_star_off_mtrl_alpha) + .setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_IF_ROOM); + + // Subitems of 'enqueue...' + enqueueMenu.add(0, MENU_ENQUEUE_ALBUM, 30, R.string.album); + enqueueMenu.add(0, MENU_ENQUEUE_ARTIST, 30, R.string.artist); + enqueueMenu.add(0, MENU_ENQUEUE_GENRE, 30, R.string.genre); + + // Subitems of 'more from...' + moreMenu.add(0, MENU_MORE_ALBUM, 30, R.string.album); + moreMenu.add(0, MENU_MORE_ARTIST, 30, R.string.artist); + moreMenu.add(0, MENU_MORE_GENRE, 30, R.string.genre); + moreMenu.add(0, MENU_MORE_FOLDER, 30, R.string.folder); + + // ensure that mFavorites is updated + mHandler.sendEmptyMessage(MSG_LOAD_FAVOURITE_INFO); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) + { + final Song song = mCurrentSong; + + switch (item.getItemId()) { + case android.R.id.home: + openLibrary(null, -1); + break; + case MENU_MORE_ALBUM: + openLibrary(song, MediaUtils.TYPE_ALBUM); + break; + case MENU_MORE_ARTIST: + openLibrary(song, MediaUtils.TYPE_ARTIST); + break; + case MENU_MORE_GENRE: + openLibrary(song, MediaUtils.TYPE_GENRE); + break; + case MENU_MORE_FOLDER: + openLibrary(song, MediaUtils.TYPE_FILE); + break; + case MENU_ENQUEUE_ALBUM: + PlaybackService.get(this).enqueueFromSong(song, MediaUtils.TYPE_ALBUM); + break; + case MENU_ENQUEUE_ARTIST: + PlaybackService.get(this).enqueueFromSong(song, MediaUtils.TYPE_ARTIST); + break; + case MENU_ENQUEUE_GENRE: + PlaybackService.get(this).enqueueFromSong(song, MediaUtils.TYPE_GENRE); + break; + case MENU_SONG_FAVORITE: + long playlistId = Playlist.getFavoritesId(this, true); + if (song != null) { + PlaylistTask playlistTask = new PlaylistTask(playlistId, getString(R.string.playlist_favorites)); + playlistTask.audioIds = new ArrayList<Long>(); + playlistTask.audioIds.add(song.id); + int action = Playlist.isInPlaylist(this, playlistId, song) ? MSG_REMOVE_FROM_PLAYLIST : MSG_ADD_TO_PLAYLIST; + mHandler.sendMessage(mHandler.obtainMessage(action, playlistTask)); + } + break; + case MENU_ADD_TO_PLAYLIST: + if (song != null) { + Intent intent = new Intent(); + intent.putExtra("type", MediaUtils.TYPE_SONG); + intent.putExtra("id", song.id); + PlaylistDialog dialog = PlaylistDialog.newInstance(this, intent, null, song); + dialog.show(getFragmentManager(), "PlaylistDialog"); + } + break; + case MENU_SHARE: + if (song != null) + MediaUtils.shareMedia(this, song); + break; + case MENU_DELETE: + final PlaybackService playbackService = PlaybackService.get(this); + final PlaybackActivity activity = this; + + if (song != null) { + String delete_message = getString(R.string.delete_file, song.title); + AlertDialog.Builder dialog = new AlertDialog.Builder(this); + dialog.setTitle(R.string.delete); + dialog + .setMessage(delete_message) + .setPositiveButton(R.string.delete, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + // MSG_DELETE expects an intent (usually called from listview) + Intent intent = new Intent(); + intent.putExtra(LibraryAdapter.DATA_TYPE, MediaUtils.TYPE_SONG); + intent.putExtra(LibraryAdapter.DATA_ID, song.id); + mHandler.sendMessage(mHandler.obtainMessage(MSG_DELETE, intent)); + } + }) + .setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + } + }); + dialog.create().show(); + } + break; + case MENU_PLUGINS: + if (song != null) { + Intent songIntent = new Intent(); + songIntent.putExtra("id", song.id); + showPluginMenu(songIntent); + } + break; + default: + return super.onOptionsItemSelected(item); + } + + return true; + } + + @Override + public boolean onSearchRequested() + { + openLibrary(null, -1); + return false; + } + + @Override + public boolean onKeyDown(int keyCode, KeyEvent event) + { + switch (keyCode) { + case KeyEvent.KEYCODE_DPAD_RIGHT: + shiftCurrentSong(SongTimeline.SHIFT_NEXT_SONG); + findViewById(R.id.next).requestFocus(); + break; + case KeyEvent.KEYCODE_DPAD_LEFT: + shiftCurrentSong(SongTimeline.SHIFT_PREVIOUS_SONG); + findViewById(R.id.previous).requestFocus(); + break; + case KeyEvent.KEYCODE_SEARCH: + Intent librarySearch = new Intent(this, LibraryActivity.class); + librarySearch.putExtra("launch_search", true); + startActivity(librarySearch); + break; + default: + return super.onKeyDown(keyCode, event); + } + return true; + } + + @Override + public boolean onKeyUp(int keyCode, KeyEvent event) + { + switch (keyCode) { + case KeyEvent.KEYCODE_DPAD_CENTER: + case KeyEvent.KEYCODE_ENTER: + setControlsVisible(!mControlsVisible); + mHandler.sendEmptyMessage(MSG_SAVE_CONTROLS); + return true; + case KeyEvent.KEYCODE_BACK: + if (mSlidingView.isShrinkable()) { + mSlidingView.hideSlide(); + return true; + } + } + + return super.onKeyUp(keyCode, event); + } + + /** + * Set the visibility of the controls views. + * + * @param visible True to show, false to hide + */ + private void setControlsVisible(boolean visible) + { + int mode = visible ? View.VISIBLE : View.GONE; + mSlidingView.setVisibility(mode); + mControlsVisible = visible; + + if (visible) { + mPlayPauseButton.requestFocus(); + } + } + + /** + * Set the visibility of the extra metadata view. + * + * @param visible True to show, false to hide + */ + private void setExtraInfoVisible(boolean visible) + { + TableLayout table = mInfoTable; + if (table == null) + return; + + table.setColumnCollapsed(0, !visible); + // Make title, album, and artist multi-line when extra info is visible + boolean singleLine = !visible; + for (int i = 0; i != 3; ++i) { + TableRow row = (TableRow)table.getChildAt(i); + ((TextView)row.getChildAt(1)).setSingleLine(singleLine); + } + // toggle visibility of all but the first three rows (the title/artist/ + // album rows) + int visibility = visible ? View.VISIBLE : View.GONE; + for (int i = table.getChildCount() - 1; i > 2 ; i--) { + table.getChildAt(i).setVisibility(visibility); + } + mExtraInfoVisible = visible; + if (visible && !mHandler.hasMessages(MSG_LOAD_EXTRA_INFO)) { + mHandler.sendEmptyMessage(MSG_LOAD_EXTRA_INFO); + } + } + + /** + * Retrieve the extra metadata for the current song. + */ + private void loadExtraInfo() + { + Song song = mCurrentSong; + + mGenre = null; + mTrack = null; + mYear = null; + mComposer = null; + mPath = null; + mFormat = null; + mReplayGain = null; + + if(song != null) { + MediaMetadataExtractor data = new MediaMetadataExtractor(song.path); + + mGenre = data.getFirst(MediaMetadataExtractor.GENRE); + mTrack = song.getTrackAndDiscNumber(); + mComposer = data.getFirst(MediaMetadataExtractor.COMPOSER); + mYear = data.getFirst(MediaMetadataExtractor.YEAR); + mPath = song.path; + + mFormat = data.getFormat(); + + BastpUtil.GainValues rg = PlaybackService.get(this).getReplayGainValues(song.path); + mReplayGain = String.format("found=%s, track=%.2f, album=%.2f", rg.found, rg.track, rg.album); + } + + mUiHandler.sendEmptyMessage(MSG_COMMIT_INFO); + } + + /** + * Save the hidden_controls preference to storage. + */ + private static final int MSG_SAVE_CONTROLS = 10; + /** + * Call {@link #loadExtraInfo()}. + */ + private static final int MSG_LOAD_EXTRA_INFO = 11; + /** + * Pass obj to mExtraInfo.setText() + */ + private static final int MSG_COMMIT_INFO = 12; + /** + * Calls {@link #updateQueuePosition()}. + */ + private static final int MSG_UPDATE_POSITION = 13; + /** + * Check if passed song is a favorite + */ + private static final int MSG_LOAD_FAVOURITE_INFO = 14; + /** + * Updates the favorites state + */ + private static final int MSG_COMMIT_FAVOURITE_INFO = 15; + + @Override + public boolean handleMessage(Message message) + { + switch (message.what) { + case MSG_SAVE_CONTROLS: { + SharedPreferences.Editor editor = SharedPrefHelper.getSettings(this).edit(); + editor.putBoolean(PrefKeys.VISIBLE_CONTROLS, mControlsVisible); + editor.putBoolean(PrefKeys.VISIBLE_EXTRA_INFO, mExtraInfoVisible); + editor.apply(); + break; + } + case MSG_LOAD_EXTRA_INFO: + loadExtraInfo(); + break; + case MSG_COMMIT_INFO: { + mGenreView.setText(mGenre); + mTrackView.setText(mTrack); + mYearView.setText(mYear); + mComposerView.setText(mComposer); + mPathView.setText(mPath); + mFormatView.setText(mFormat); + mReplayGainView.setText(mReplayGain); + break; + } + case MSG_UPDATE_POSITION: + updateQueuePosition(); + break; + case MSG_NOTIFY_PLAYLIST_CHANGED: // triggers a fav-refresh + case MSG_LOAD_FAVOURITE_INFO: + if (mCurrentSong != null) { + boolean found = Playlist.isInPlaylist(this, Playlist.getFavoritesId(this, false), mCurrentSong); + mUiHandler.sendMessage(mUiHandler.obtainMessage(MSG_COMMIT_FAVOURITE_INFO, found)); + } + break; + case MSG_COMMIT_FAVOURITE_INFO: + if (mFavorites != null) { + boolean found = (boolean)message.obj; + mFavorites.setIcon(found ? R.drawable.btn_rating_star_on_mtrl_alpha: R.drawable.btn_rating_star_off_mtrl_alpha); + mFavorites.setTitle(found ? R.string.remove_from_favorites : R.string.add_to_favorites); + } + break; + default: + return super.handleMessage(message); + } + + return true; + } + + @Override + protected void performAction(Action action) { + switch (action) { + case ToggleControls: + setControlsVisible(!mControlsVisible); + mHandler.sendEmptyMessage(MSG_SAVE_CONTROLS); + break; + case ShowQueue: + mSlidingView.expandSlide(); + break; + default: + super.performAction(action); + } + } + + @Override + public void onClick(View view) + { + if (view == mOverlayText && (mState & PlaybackService.FLAG_EMPTY_QUEUE) != 0) { + setState(PlaybackService.get(this).setFinishAction(SongTimeline.FINISH_RANDOM)); + } else if (view == mCoverView) { + performAction(mCoverPressAction); + } else if (view.getId() == R.id.info_table) { + openLibrary(mCurrentSong, MediaUtils.TYPE_ALBUM); + } else { + super.onClick(view); + } + } + + @Override + public boolean onLongClick(View view) + { + switch (view.getId()) { + case R.id.cover_view: + performAction(mCoverLongPressAction); + break; + case R.id.info_table: + setExtraInfoVisible(!mExtraInfoVisible); + mHandler.sendEmptyMessage(MSG_SAVE_CONTROLS); + break; + default: + return false; + } + + return true; + } + + @Override + public void onSlideExpansionChanged(int expansion) { + super.onSlideExpansionChanged(expansion); + + setControlsVisible(true); + if (expansion != SlidingView.EXPANSION_PARTIAL) { + setExtraInfoVisible(false); + } else { + SharedPreferences settings = SharedPrefHelper.getSettings(this); + setExtraInfoVisible(settings.getBoolean(PrefKeys.VISIBLE_EXTRA_INFO, PrefDefaults.VISIBLE_EXTRA_INFO)); + } + } + +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/IdlePreference.java b/app/src/main/java/ch/blinkenlights/android/vanilla/IdlePreference.java new file mode 100644 index 0000000..58fc09d --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/IdlePreference.java @@ -0,0 +1,152 @@ +/* + * Copyright (C) 2010, 2011 Christopher Eby <kreed@kreed.org> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package ch.blinkenlights.android.vanilla; + +//import android.app.AlertDialog.Builder; +import android.content.Context; +import android.content.res.Resources; +import android.preference.DialogPreference; +import android.util.AttributeSet; +import android.view.View; +import android.widget.SeekBar; +import android.widget.TextView; + +/** + * A preference that provides a dialog with a slider for idle time. + * + * The slider produces a value in seconds from 60 (1 minute) to 21600 + * (6 hours). The values range on an approximately exponential scale. + */ +public class IdlePreference extends DialogPreference implements SeekBar.OnSeekBarChangeListener { + private static final int DEFAULT_VALUE = 3600; + private static final int MIN = 60; + private static final int MAX = 21600; + + /** + * The current idle timeout displayed on the slider. Will not be persisted + * until the dialog is closed. + */ + private int mValue; + /** + * The view in which the value is displayed. + */ + private TextView mValueText; + + public IdlePreference(Context context, AttributeSet attrs) + { + super(context, attrs); + } + + @Override + public CharSequence getSummary() + { + return formatTime(getPersistedInt(DEFAULT_VALUE)); + } + + + @Override + protected View onCreateDialogView() + { + View view = super.onCreateDialogView(); + + mValue = getPersistedInt(DEFAULT_VALUE); + + mValueText = (TextView)view.findViewById(R.id.value); + + SeekBar seekBar = (SeekBar)view.findViewById(R.id.seek_bar); + seekBar.setMax(1000); + seekBar.setProgress((int)(Math.pow((float)(mValue - MIN) / (MAX - MIN), 0.25f) * 1000)); + seekBar.setOnSeekBarChangeListener(this); + + updateText(); + + return view; + } + + + /** + * Format seconds into a human-readable time description. + * + * @param value The time, in seconds. + * @return A human-readable string, such as "1 hour, 21 minutes" + */ + private String formatTime(int value) + { + Resources res = getContext().getResources(); + StringBuilder text = new StringBuilder(); + if (value >= 3600) { + int hours = value / 3600; + text.append(res.getQuantityString(R.plurals.hours, hours, hours)); + text.append(", "); + int minutes = value / 60 - hours * 60; + text.append(res.getQuantityString(R.plurals.minutes, minutes, minutes)); + } else { + int minutes = value / 60; + text.append(res.getQuantityString(R.plurals.minutes, minutes, minutes)); + text.append(", "); + int seconds = value - minutes * 60; + text.append(res.getQuantityString(R.plurals.seconds, seconds, seconds)); + } + return text.toString(); + } + + /** + * Update the text view with the current value. + */ + private void updateText() + { + mValueText.setText(formatTime(mValue)); + } + + @Override + protected void onDialogClosed(boolean positiveResult) + { + if (positiveResult && shouldPersist()) { + persistInt(mValue); + notifyChanged(); + } + } + + @Override + public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) + { + // Approximate an exponential curve with x^4. Produces a value from MIN-MAX. + if (fromUser) { + float value = seekBar.getProgress() / 1000.0f; + value *= value; + value *= value; + mValue = (int)(value * (MAX - MIN)) + MIN; + updateText(); + } + } + + @Override + public void onStartTrackingTouch(SeekBar seekBar) + { + } + + @Override + public void onStopTrackingTouch(SeekBar seekBar) + { + } +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/JumpToTimeDialog.java b/app/src/main/java/ch/blinkenlights/android/vanilla/JumpToTimeDialog.java new file mode 100644 index 0000000..2d77b7e --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/JumpToTimeDialog.java @@ -0,0 +1,135 @@ +/* + * Copyright (C) 2018 Toby Hsieh + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package ch.blinkenlights.android.vanilla; + +import android.app.Activity; +import android.app.AlertDialog; +import android.app.Dialog; +import android.app.DialogFragment; +import android.app.FragmentManager; +import android.content.DialogInterface; +import android.os.Bundle; +import android.text.Editable; +import android.text.TextWatcher; +import android.view.LayoutInflater; +import android.view.View; +import android.view.WindowManager; +import android.widget.EditText; +import android.widget.Toast; + +/** + * A dialog for the user to input a specific time to jump to for the current song + */ +public class JumpToTimeDialog extends DialogFragment implements DialogInterface.OnClickListener { + private EditText hoursView; + private EditText minutesView; + private EditText secondsView; + + /** + * Callback interface for an activity that shows JumpToTimeDialog + */ + public interface OnPositionSubmitListener { + /** + * Called when the user submits a position to jump/seek to for the current song. + * + * @param position position to seek/jump to in milliseconds + */ + void onPositionSubmit(int position); + } + + /** + * Creates and shows the dialog + * + * @param manager the FragmentManager to add the newly created dialog to + */ + public static void show(FragmentManager manager) { + new JumpToTimeDialog().show(manager, "JumpToTimeDialog"); + } + + @Override + public Dialog onCreateDialog(Bundle savedInstanceState) { + // Watcher that moves to the next EditText when 2 digits are inserted + TextWatcher textWatcher = new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence s, int start, int count, int after) { + } + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + EditText editText = (EditText) getDialog().getCurrentFocus(); + if (editText.length() == 2) { + View view = editText.focusSearch(View.FOCUS_RIGHT); + if (view != null) { + view.requestFocus(); + } + } + } + + @Override + public void afterTextChanged(Editable s) { + } + }; + + View view = LayoutInflater.from(getActivity()).inflate(R.layout.duration_input, null); + hoursView = view.findViewById(R.id.hours); + hoursView.addTextChangedListener(textWatcher); + minutesView = view.findViewById(R.id.minutes); + minutesView.addTextChangedListener(textWatcher); + secondsView = view.findViewById(R.id.seconds); + secondsView.addTextChangedListener(textWatcher); + + Dialog dialog = new AlertDialog.Builder(getActivity()) + .setTitle(R.string.jump_to_time) + .setView(view) + .setPositiveButton(android.R.string.ok, this) + .setNegativeButton(android.R.string.cancel, null) + .create(); + hoursView.requestFocus(); + dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE); + return dialog; + } + + @Override + public void onClick(DialogInterface dialog, int which) { + if (which == DialogInterface.BUTTON_POSITIVE) { + Activity activity = getActivity(); + try { + int hours = parseInteger(hoursView.getText().toString()); + int minutes = parseInteger(minutesView.getText().toString()); + int seconds = parseInteger(secondsView.getText().toString()); + int position = (hours * 3600 + minutes * 60 + seconds) * 1000; + ((OnPositionSubmitListener) activity).onPositionSubmit(position); + } catch (NumberFormatException e) { + Toast.makeText(activity, R.string.error_invalid_position, Toast.LENGTH_SHORT).show(); + } + } + } + + /** + * Parses the given string as an integer. This returns 0 if the given string is empty. + * + * @param s the string to parse + * @return the integer result + */ + static int parseInteger(String s) { + if (s.length() == 0) { + return 0; + } + return Integer.parseInt(s); + } +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/LazyCoverView.java b/app/src/main/java/ch/blinkenlights/android/vanilla/LazyCoverView.java new file mode 100644 index 0000000..e393eb3 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/LazyCoverView.java @@ -0,0 +1,236 @@ +/* + * Copyright (C) 2015-2016 Adrian Ulrich <adrian@blinkenlights.ch> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package ch.blinkenlights.android.vanilla; + +import android.app.ActivityManager; +import android.content.Context; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.graphics.drawable.Drawable; +import android.graphics.drawable.TransitionDrawable; +import android.graphics.drawable.BitmapDrawable; +import android.os.Handler; +import android.os.HandlerThread; +import android.os.Message; +import android.util.AttributeSet; +import android.util.LruCache; +import android.widget.ImageView; + +/** + * LazyCoverView implements a 'song-aware' ImageView + * + * View updates should be triggered via setCover(type, id) to + * instruct the view to load the cover from its own LRU cache. + * + * The cover will automatically be fetched & scaled in a background + * thread on cache miss + */ +public class LazyCoverView extends ImageView + implements Handler.Callback +{ + /** + * Context of constructor + */ + private Context mContext; + /** + * UI Thread handler + */ + private static Handler sUiHandler; + /** + * Worker thread handler + */ + private static Handler sHandler; + /** + * The fallback cover image resource encoded as bitmap + */ + private static Bitmap sFallbackBitmap; + /** + * Our private LRU cache + */ + private static BitmapLruCache sBitmapLruCache; + /** + * The cover key we are expected to draw + */ + private CoverCache.CoverKey mExpectedKey; + + /** + * Cover message we are passing around using mHandler + */ + private static class CoverMsg { + public CoverCache.CoverKey key; // A cache key identifying this RPC + public LazyCoverView view; // The view we are updating + public String title; // The title of this view, used for Initial-Covers + CoverMsg(CoverCache.CoverKey key, LazyCoverView view, String title) { + this.key = key; + this.view = view; + this.title = title; + } + /** + * Returns true if the view still requires updating + */ + public boolean isRecent() { + return this.key.equals(this.view.mExpectedKey); + } + } + + /** + * Constructor of class inflated from XML + * + * @param context The context of the calling activity + * @param attributes attributes passed by the xml inflater + */ + public LazyCoverView(Context context, AttributeSet attributes) { + super(context, attributes); + mContext = context; + if (sBitmapLruCache == null) { + ActivityManager am = (ActivityManager)context.getSystemService(context.ACTIVITY_SERVICE); + int lruSize = am.getMemoryClass() / 10; // use ~10% for LRU + lruSize = lruSize < 2 ? 2 : lruSize; // LRU will always be at least 2MiB + sBitmapLruCache = new BitmapLruCache(lruSize*1024*1024); + } + if (sFallbackBitmap == null) { + sFallbackBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.fallback_cover); + } + if (sUiHandler == null) { + sUiHandler = new Handler(this); + } + if (sHandler == null) { + HandlerThread thread = new HandlerThread("LazyCoverRpc"); + thread.start(); + sHandler = new Handler(thread.getLooper(), this); + } + } + + /** + * mHandler and mUiHandler callbacks + */ + private static final int MSG_CREATE_COVER = 61; + private static final int MSG_DRAW_COVER = 62; + + @Override + public boolean handleMessage(Message message) { + CoverMsg payload = (CoverMsg)message.obj; + + if (payload.isRecent() == false) { + return false; // this rpc is obsolete + } + + switch (message.what) { + case MSG_CREATE_COVER: { + // This message was sent due to a cache miss, but the cover might got cached in the meantime + Bitmap bitmap = sBitmapLruCache.get(payload.key); + if (bitmap == null) { + if (payload.key.mediaType == MediaUtils.TYPE_ALBUM) { + // We only display real covers for queries using the album id as key + Song song = MediaUtils.getSongByTypeId(mContext, payload.key.mediaType, payload.key.mediaId); + if (song != null) { + bitmap = song.getSmallCover(mContext); + } + } else { + bitmap = CoverBitmap.generatePlaceholderCover(mContext, CoverCache.SIZE_SMALL, CoverCache.SIZE_SMALL, payload.title); + } + if (bitmap == null) { + // item has no cover: return a failback + bitmap = sFallbackBitmap; + } + } + // bitmap is non null: store in LRU cache and draw it + sBitmapLruCache.put(payload.key, bitmap); + sUiHandler.sendMessage(sUiHandler.obtainMessage(MSG_DRAW_COVER, payload)); + break; + } + case MSG_DRAW_COVER: { + // draw the cover into view. must be called from ui thread handler + payload.view.drawFromCache(payload.key, true); + break; + } + default: + return false; + } + return true; + } + + /** + * Attempts to set the image of this cover + * Must be called from an UI thread + * + * @param type The Media type + * @param id The id of this media type to query + */ + public void setCover(int type, long id, String title) { + mExpectedKey = new CoverCache.CoverKey(type, id, CoverCache.SIZE_SMALL); + if (drawFromCache(mExpectedKey, false) == false) { + CoverMsg payload = new CoverMsg(mExpectedKey, this, title); + sHandler.sendMessage(sHandler.obtainMessage(MSG_CREATE_COVER, payload)); + } + } + + /** + * Updates the view with a cached bitmap + * A fallback image will be used on cache miss + * + * @param key The cover message containing the cache key and view to use + */ + public boolean drawFromCache(CoverCache.CoverKey key, boolean fadeIn) { + boolean cacheHit = true; + Bitmap bitmap = sBitmapLruCache.get(key); + if (bitmap == null) { + cacheHit = false; + } + + if (fadeIn) { + TransitionDrawable td = new TransitionDrawable(new Drawable[] { + getDrawable(), + (new BitmapDrawable(getResources(), bitmap)) + }); + setImageDrawable(td); + td.startTransition(120); + } else { + setImageBitmap(bitmap); + } + + return cacheHit; + } + + /** + * A LRU cache implementation, using the CoverKey as key to store Bitmap objects + * + * Note that the implementation does not override create() in order to enable + * the use of fetch-if-cached functions: createBitmap() is therefore called + * by CoverCache itself. + */ + private static class BitmapLruCache extends LruCache<CoverCache.CoverKey, Bitmap> { + /** + * Creates a new in-memory LRU cache + * + * @param size the lru cache size in bytes + */ + public BitmapLruCache(int size) { + super(size); + } + + /** + * Returns the cache size in bytes, not objects + */ + @Override + protected int sizeOf(CoverCache.CoverKey key, Bitmap value) { + return value.getByteCount(); + } + } + +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/LibraryActivity.java b/app/src/main/java/ch/blinkenlights/android/vanilla/LibraryActivity.java new file mode 100644 index 0000000..442bd28 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/LibraryActivity.java @@ -0,0 +1,1041 @@ +/* + * Copyright (C) 2012 Christopher Eby <kreed@kreed.org> + * Copyright (C) 2015-2020 Adrian Ulrich <adrian@blinkenlights.ch> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package ch.blinkenlights.android.vanilla; + +import ch.blinkenlights.android.medialibrary.MediaLibrary; +import ch.blinkenlights.android.vanilla.ui.FancyMenu; +import ch.blinkenlights.android.vanilla.ui.FancyMenuItem; +import ch.blinkenlights.android.vanilla.ui.ArrowedText; + +import android.app.AlertDialog; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.SharedPreferences; +import android.content.res.Resources; +import android.database.Cursor; +import android.graphics.Bitmap; +import android.graphics.Color; +import android.os.Bundle; +import android.os.Handler; +import android.os.Message; +import android.support.iosched.tabs.VanillaTabLayout; +import android.text.TextUtils; +import android.view.KeyEvent; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.view.ViewGroup; +import android.widget.CheckBox; +import android.widget.HorizontalScrollView; +import android.widget.LinearLayout; +import android.widget.ListView; +import android.widget.TextView; +import android.widget.SearchView; +import android.widget.Toast; + +import androidx.viewpager.widget.ViewPager; + +import java.io.File; + +import junit.framework.Assert; + +/** + * The library activity where songs to play can be selected from the library. + */ +public class LibraryActivity + extends SlidingPlaybackActivity + implements DialogInterface.OnClickListener + , DialogInterface.OnDismissListener + , SearchView.OnQueryTextListener + , FancyMenu.Callback +{ + + + /** + * NOTE: ACTION_* must be in sync with default_action_entries + */ + + /** + * Action for row click: play the row. + */ + public static final int ACTION_PLAY = 0; + /** + * Action for row click: enqueue the row. + */ + public static final int ACTION_ENQUEUE = 1; + /** + * Action for row click: perform the last used action. + */ + public static final int ACTION_LAST_USED = 2; + /** + * Action for row click: play all the songs in the adapter, starting with + * the current row. + */ + public static final int ACTION_PLAY_ALL = 3; + /** + * Action for row click: enqueue all the songs in the adapter, starting with + * the current row. + */ + public static final int ACTION_ENQUEUE_ALL = 4; + /** + * Action for row click: do nothing. + */ + public static final int ACTION_DO_NOTHING = 5; + /** + * Action for row click: expand the row. + */ + public static final int ACTION_EXPAND = 6; + /** + * Action for row click: play if paused or enqueue if playing. + */ + public static final int ACTION_PLAY_OR_ENQUEUE = 7; + /** + * Action for row click: queue selection as next item. + */ + public static final int ACTION_ENQUEUE_AS_NEXT = 8; + /** + * Action for row click: expand or play all. + */ + public static final int ACTION_EXPAND_OR_PLAY_ALL = 9; + /** + * The SongTimeline add song modes corresponding to each relevant action. + */ + private static final int[] modeForAction = + { SongTimeline.MODE_PLAY, SongTimeline.MODE_ENQUEUE, -1, + SongTimeline.MODE_PLAY_ID_FIRST, SongTimeline.MODE_ENQUEUE_ID_FIRST, + -1, -1, -1, SongTimeline.MODE_ENQUEUE_AS_NEXT }; + + public ViewPager mViewPager; + + private BottomBarControls mBottomBarControls; + + private HorizontalScrollView mLimiterScroller; + private ViewGroup mLimiterViews; + private VanillaTabLayout mVanillaTabLayout; + /** + * The action to execute when a row is tapped. + */ + private int mDefaultAction; + /** + * Whether or not to jump to songs if the are in the queue + */ + private boolean mJumpToEnqueuedOnPlay; + /** + * The last used action from the menu. Used with ACTION_LAST_USED. + */ + private int mLastAction = ACTION_PLAY; + /** + * The pager adapter that manages each media ListView. + */ + public LibraryPagerAdapter mPagerAdapter; + /** + * The adapter for the currently visible list. + */ + private LibraryAdapter mCurrentAdapter; + + + @Override + public void onCreate(Bundle state) + { + ThemeHelper.setTheme(this, R.style.Library); + super.onCreate(state); + + if (state == null) { + checkForLaunch(getIntent()); + } + + setContentView(R.layout.library_content); + + mLimiterScroller = (HorizontalScrollView)findViewById(R.id.limiter_scroller); + mLimiterViews = (ViewGroup)findViewById(R.id.limiter_layout); + + LibraryPagerAdapter pagerAdapter = new LibraryPagerAdapter(this, mLooper); + mPagerAdapter = pagerAdapter; + + ViewPager pager = (ViewPager)findViewById(R.id.pager); + pager.setAdapter(pagerAdapter); + mViewPager = pager; + + SharedPreferences settings = SharedPrefHelper.getSettings(this); + + mBottomBarControls = (BottomBarControls)findViewById(R.id.bottombar_controls); + mBottomBarControls.setOnClickListener(this); + mBottomBarControls.setOnQueryTextListener(this); + mBottomBarControls.enableOptionsMenu(this); + + if(PermissionRequestActivity.havePermissions(this) == false) { + PermissionRequestActivity.showWarning(this, getIntent()); + } + + mVanillaTabLayout = (VanillaTabLayout)findViewById(R.id.sliding_tabs); + mVanillaTabLayout.setOnPageChangeListener(pagerAdapter); + + loadTabOrder(); + int page = settings.getInt(PrefKeys.LIBRARY_PAGE, PrefDefaults.LIBRARY_PAGE); + if (page != 0) { + pager.setCurrentItem(page); + } + + loadLimiterIntent(getIntent()); + bindControlButtons(); + + if (state != null && state.getBoolean("launch_search")) { + mBottomBarControls.showSearch(true); + } + } + + @Override + public void onStart() + { + super.onStart(); + + loadPreferences(); + loadTabOrder(); + updateHeaders(); + } + + /** + * Load settings and cache them. + */ + private void loadPreferences() { + SharedPreferences settings = SharedPrefHelper.getSettings(this); + mDefaultAction = Integer.parseInt(settings.getString(PrefKeys.DEFAULT_ACTION_INT, PrefDefaults.DEFAULT_ACTION_INT)); + mJumpToEnqueuedOnPlay = settings.getBoolean(PrefKeys.JUMP_TO_ENQUEUED_ON_PLAY, PrefDefaults.JUMP_TO_ENQUEUED_ON_PLAY); + } + + /** + * Load the tab order and update the tab bars if needed. + */ + private void loadTabOrder() + { + if (mPagerAdapter.loadTabOrder()) { + // Reinitializes all tabs + mVanillaTabLayout.setViewPager(mViewPager); + } + } + + /** + * If this intent looks like a launch from icon/widget/etc, perform + * launch actions. + */ + private void checkForLaunch(Intent intent) + { + SharedPreferences settings = SharedPrefHelper.getSettings(this); + if (settings.getBoolean(PrefKeys.PLAYBACK_ON_STARTUP, PrefDefaults.PLAYBACK_ON_STARTUP) && Intent.ACTION_MAIN.equals(intent.getAction())) { + startActivity(new Intent(this, FullPlaybackActivity.class)); + } + } + + /** + * If the given intent has type data, set a limiter built from that + * data. + */ + private void loadLimiterIntent(Intent intent) + { + Limiter limiter = null; + + int type = intent.getIntExtra("type", -1); + long id = intent.getLongExtra("id", -1); + String folder = intent.getStringExtra("folder"); + + if (type == MediaUtils.TYPE_FILE && folder != null) { + limiter = FileSystemAdapter.buildLimiter(new File(folder)); + } else if (type != -1 && id != -1) { + MediaAdapter adapter = new MediaAdapter(this, type, null, null); + adapter.commitQuery(adapter.query()); + limiter = adapter.buildLimiter(id); + } + + if (limiter != null) { + int tab = mPagerAdapter.setLimiter(limiter); + if (tab == -1 || tab == mViewPager.getCurrentItem()) + updateLimiterViews(); + else + mViewPager.setCurrentItem(tab); + } + } + + @Override + public void onNewIntent(Intent intent) + { + if (intent == null) + return; + + checkForLaunch(intent); + loadLimiterIntent(intent); + } + + @Override + public boolean onKeyUp(int keyCode, KeyEvent event) + { + switch (keyCode) { + case KeyEvent.KEYCODE_BACK: + Limiter limiter = mPagerAdapter.getCurrentLimiter(); + + if (mSlidingView.isShrinkable()) { + mSlidingView.hideSlide(); + break; + } + + if (mBottomBarControls.showSearch(false)) { + break; + } + + if (limiter != null) { + int pos = -1; + switch (limiter.type) { + case MediaUtils.TYPE_ALBUM: + setLimiter(MediaUtils.TYPE_ARTIST, limiter.data.toString()); + pos = mPagerAdapter.getMediaTypePosition(limiter.type); + break; + case MediaUtils.TYPE_ARTIST: + case MediaUtils.TYPE_ALBARTIST: + case MediaUtils.TYPE_COMPOSER: + case MediaUtils.TYPE_GENRE: + mPagerAdapter.clearLimiter(limiter.type); + pos = mPagerAdapter.getMediaTypePosition(limiter.type); + break; + case MediaUtils.TYPE_FILE: + File parentFile = ((File)limiter.data).getParentFile(); + mPagerAdapter.setLimiter(FileSystemAdapter.buildLimiter(parentFile)); + break; + } + if (pos == -1) { + updateLimiterViews(); + } else { + mViewPager.setCurrentItem(pos); + } + } else { + finish(); + } + break; + case KeyEvent.KEYCODE_MENU: + // We intercept these to avoid showing the activity-default menu + mBottomBarControls.openMenu(); + break; + case KeyEvent.KEYCODE_SEARCH: + mBottomBarControls.showSearch(true); + break; + default: + return false; + } + + return true; + } + + @Override + public boolean onKeyDown(int keyCode, KeyEvent event) + { + if (keyCode == KeyEvent.KEYCODE_DEL || keyCode == KeyEvent.KEYCODE_FORWARD_DEL) + // On ICS, EditText reports backspace events as unhandled despite + // actually handling them. To workaround, just assume the event was + // handled if we get here. + return true; + + if (super.onKeyDown(keyCode, event)) + return true; + + return false; + } + + /** + * Update the first row of the lists with the appropriate action (play all + * or enqueue all). + */ + private void updateHeaders() + { + int action = mDefaultAction; + if (action == ACTION_LAST_USED) + action = mLastAction; + boolean isEnqueue = action == ACTION_ENQUEUE || action == ACTION_ENQUEUE_ALL; + String text = getString(isEnqueue ? R.string.enqueue_all : R.string.play_all); + mPagerAdapter.setHeaderText(text); + } + + /** + * Adds songs matching the data from the given intent to the song timeline. + * + * @param intent An intent created with + * {@link LibraryAdapter#createData(View)}. + * @param action One of LibraryActivity.ACTION_* + */ + private void pickSongs(Intent intent, final int action) + { + int effectiveAction = action; // mutable copy + long id = intent.getLongExtra("id", LibraryAdapter.INVALID_ID); + int type = mCurrentAdapter.getMediaType(); + + // special handling if we pick one song to be played that is already in queue + boolean songPicked = (id >= 0 && type == MediaUtils.TYPE_SONG); // not invalid, not play all + if (songPicked && effectiveAction == ACTION_PLAY && mJumpToEnqueuedOnPlay) { + int songPosInQueue = PlaybackService.get(this).getQueuePositionForSongId(id); + if (songPosInQueue > -1) { + // we picked for play one song that is already present in the queue, just jump to it + PlaybackService.get(this).jumpToQueuePosition(songPosInQueue); + Toast.makeText(this, R.string.jumping_to_song, Toast.LENGTH_SHORT).show(); + return; + } + } + + boolean all = false; + if (action == ACTION_PLAY_ALL || action == ACTION_ENQUEUE_ALL) { + boolean notPlayAllAdapter = + (id == LibraryAdapter.HEADER_ID) + || !(type <= MediaUtils.TYPE_SONG || type == MediaUtils.TYPE_FILE); + if (effectiveAction == ACTION_ENQUEUE_ALL && notPlayAllAdapter) { + effectiveAction = ACTION_ENQUEUE; + } else if (effectiveAction == ACTION_PLAY_ALL && notPlayAllAdapter) { + effectiveAction = ACTION_PLAY; + } else { + all = true; + } + } + + if (id == LibraryAdapter.HEADER_ID) + all = true; // page header was clicked -> force all mode + + QueryTask query = buildQueryFromIntent(intent, false, (all ? mCurrentAdapter : null)); + query.mode = modeForAction[effectiveAction]; + PlaybackService.get(this).addSongs(query); + + if (mDefaultAction == ACTION_LAST_USED && mLastAction != action) { + mLastAction = action; + updateHeaders(); + } + } + + /** + * "Expand" the view represented by the given intent by setting the limiter + * from the view and switching to the appropriate tab. + * + * @param intent An intent created with + * {@link LibraryAdapter#createData(View)}. + */ + private void expand(Intent intent) + { + mBottomBarControls.showSearch(false); + int type = intent.getIntExtra("type", MediaUtils.TYPE_INVALID); + long id = intent.getLongExtra("id", LibraryAdapter.INVALID_ID); + int tab = mPagerAdapter.setLimiter(mPagerAdapter.mAdapters[type].buildLimiter(id)); + if (tab == -1 || tab == mViewPager.getCurrentItem()) + updateLimiterViews(); + else + mViewPager.setCurrentItem(tab); + } + + /** + * Open the playback activity and close any activities above it in the + * stack. + */ + public void openPlaybackActivity() + { + if (mSlidingView.isShrinkable()) + mSlidingView.hideSlideDelayed(); + startActivity(new Intent(this, FullPlaybackActivity.class)); + } + + /** + * Called by LibraryAdapters when a row has been clicked. + * + * @param rowData The data for the row that was clicked. + */ + public void onItemClicked(Intent rowData) + { + int action = mDefaultAction; + if (action == ACTION_LAST_USED) + action = mLastAction; + + boolean tryExpand = action == ACTION_EXPAND || action == ACTION_EXPAND_OR_PLAY_ALL; + if (tryExpand && rowData.getBooleanExtra(LibraryAdapter.DATA_EXPANDABLE, false)) { + onItemExpanded(rowData); + } else if (action != ACTION_DO_NOTHING) { + if (action == ACTION_EXPAND) { + // default to playing when trying to expand something that can't + // be expanded + action = ACTION_PLAY; + } else if (action == ACTION_EXPAND_OR_PLAY_ALL) { + action = ACTION_PLAY_ALL; + } else if (action == ACTION_PLAY_OR_ENQUEUE) { + action = (mState & PlaybackService.FLAG_PLAYING) == 0 ? ACTION_PLAY : ACTION_ENQUEUE; + } + pickSongs(rowData, action); + } + } + + /** + * Called by LibraryAdapters when a row's expand arrow has been clicked. + * + * @param rowData The data for the row that was clicked. + */ + public void onItemExpanded(Intent rowData) + { + int type = rowData.getIntExtra(LibraryAdapter.DATA_TYPE, MediaUtils.TYPE_INVALID); + if (type == MediaUtils.TYPE_PLAYLIST) + editPlaylist(rowData); + else + expand(rowData); + } + + /** + * Create or recreate the limiter breadcrumbs. + */ + public void updateLimiterViews() + { + mLimiterViews.removeAllViews(); + + Limiter limiterData = mPagerAdapter.getCurrentLimiter(); + if (limiterData != null) { + final int arrowWidth = 8; + String[] limiter = limiterData.names; + LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); + for (int i = 0; i != limiter.length; ++i) { + final boolean last = i+1 == limiter.length; + final boolean first = i == 0; + + String txt = limiter[i]; + ArrowedText view = new ArrowedText(this); + int[] colors = {0xFF606060, 0xFF707070}; + + if (i%2 == 0) { + int tmp = colors[0]; + colors[0] = colors[1]; + colors[1] = tmp; + } + + if (last) { + colors[1] = 0xFF404040; + } + + int leftPadding = 14; + if (first) { + leftPadding = 6; + colors[0] = colors[1]; + } + + view.setSingleLine(); + view.setEllipsize(TextUtils.TruncateAt.MARQUEE); + view.setText(txt); + view.setTextColor(Color.WHITE); + view.setLayoutParams(params); + view.setPaddingDIP(leftPadding, 2, 6, 2); + view.setArrowWidthDIP(arrowWidth); + view.setTag(i); + view.setColors(colors[0], colors[1]); + view.setOnClickListener(this); + mLimiterViews.addView(view); + + if (last) { + final int ap = 10; + ArrowedText end = new ArrowedText(this); + end.setOnClickListener(this); + end.setText("×"); + end.setTextColor(0xFFB0B0B0); + end.setLayoutParams(params); + end.setPaddingDIP(0, 2, 0, 2); + end.setArrowWidthDIP(arrowWidth); + end.setArrowPaddingDIP(ap); + end.setMinWidthDIP(arrowWidth+ap); + end.setTag(i); + end.setColors(colors[1], 0); + mLimiterViews.addView(end); + } + } + mLimiterScroller.setVisibility(View.VISIBLE); + } else { + mLimiterScroller.setVisibility(View.GONE); + } + } + + /** + * Updates mCover with the new bitmap, running in the UI thread + * + * @param cover the cover to set, will use a fallback drawable if null + */ + private void updateCover(final Bitmap cover) { + runOnUiThread(new Runnable() { + @Override + public void run() { + mBottomBarControls.setCover(cover); + } + }); + } + + @Override + public void onClick(View view) + { + if (view == mBottomBarControls) { + openPlaybackActivity(); + } else if (view.getTag() != null) { + // a limiter view was clicked + int i = (Integer)view.getTag(); + + Limiter limiter = mPagerAdapter.getCurrentLimiter(); + int type = limiter.type; + if (i == 1 && type == MediaUtils.TYPE_ALBUM) { + setLimiter(MediaUtils.TYPE_ARTIST, limiter.data.toString()); + } else if (i > 0) { + Assert.assertEquals(MediaUtils.TYPE_FILE, limiter.type); + File file = (File)limiter.data; + int diff = limiter.names.length - i; + while (--diff != -1) { + file = file.getParentFile(); + } + mPagerAdapter.setLimiter(FileSystemAdapter.buildLimiter(file)); + } else { + mPagerAdapter.clearLimiter(type); + } + updateLimiterViews(); + } else { + super.onClick(view); + } + } + + /** + * Set a new limiter of the given type built from the first + * MediaLibrary.VIEW_SONGS_ALBUMS_ARTISTS row that matches the selection. + * + * @param limiterType The type of limiter to create. Must be either + * MediaUtils.TYPE_ARTIST or MediaUtils.TYPE_ALBUM. + * @param selection Selection to pass to the query. + */ + private void setLimiter(int limiterType, String selection) + { + String[] projection = new String[] { MediaLibrary.ContributorColumns.ARTIST_ID, MediaLibrary.SongColumns.ALBUM_ID, MediaLibrary.ContributorColumns.ARTIST, MediaLibrary.AlbumColumns.ALBUM }; + QueryTask query = new QueryTask(MediaLibrary.VIEW_SONGS_ALBUMS_ARTISTS, projection, selection, null, null); + Cursor cursor = query.runQuery(getApplicationContext()); + + if (cursor != null) { + if (cursor.moveToNext()) { + String[] fields; + String data; + switch (limiterType) { + case MediaUtils.TYPE_ARTIST: + fields = new String[] { cursor.getString(2) }; + data = String.format(MediaLibrary.ContributorColumns.ARTIST_ID+"=%d", cursor.getLong(0)); + break; + case MediaUtils.TYPE_ALBUM: + fields = new String[] { cursor.getString(2), cursor.getString(3) }; + data = String.format(MediaLibrary.SongColumns.ALBUM_ID+"=%d", cursor.getLong(1)); + break; + default: + throw new IllegalArgumentException("setLimiter() does not support limiter type " + limiterType); + } + mPagerAdapter.setLimiter(new Limiter(limiterType, fields, data)); + } + cursor.close(); + } + } + + private static final int CTX_MENU_NOOP = -1; + private static final int CTX_MENU_PLAY = 0; + private static final int CTX_MENU_ENQUEUE = 1; + private static final int CTX_MENU_EXPAND = 2; + private static final int CTX_MENU_ENQUEUE_AS_NEXT = 3; + private static final int CTX_MENU_DELETE = 4; + private static final int CTX_MENU_RENAME_PLAYLIST = 5; + private static final int CTX_MENU_PLAY_ALL = 6; + private static final int CTX_MENU_ENQUEUE_ALL = 7; + private static final int CTX_MENU_MORE_FROM_ALBUM = 8; + private static final int CTX_MENU_MORE_FROM_ARTIST = 9; + private static final int CTX_MENU_OPEN_EXTERNAL = 10; + private static final int CTX_MENU_PLUGINS = 11; + private static final int CTX_MENU_SHOW_DETAILS = 12; + private static final int CTX_MENU_ADD_TO_HOMESCREEN = 13; + private static final int CTX_MENU_ADD_TO_PLAYLIST = 14; + + /** + * Creates a context menu for an adapter row. + * + * @param rowData Data for the adapter row. + * @param view the view which was clicked. + * @param x x-coords of event + * @param y y-coords of event + */ + public boolean onCreateFancyMenu(Intent rowData, View view, float x, float y) { + FancyMenu fm = new FancyMenu(this, this); + // Add to playlist is always available. + fm.addSpacer(20); + fm.add(CTX_MENU_ADD_TO_PLAYLIST, 20, R.drawable.menu_add_to_playlist, R.string.add_to_playlist).setIntent(rowData); + + if (rowData.getLongExtra(LibraryAdapter.DATA_ID, LibraryAdapter.INVALID_ID) == LibraryAdapter.HEADER_ID) { + fm.setHeaderTitle(getString(R.string.all_songs)); + fm.add(CTX_MENU_PLAY_ALL, 10, R.drawable.menu_play_all, R.string.play_all).setIntent(rowData); + fm.add(CTX_MENU_ENQUEUE_ALL, 10, R.drawable.menu_enqueue, R.string.enqueue_all).setIntent(rowData); + } else { + int type = rowData.getIntExtra(LibraryAdapter.DATA_TYPE, MediaUtils.TYPE_INVALID); + + fm.setHeaderTitle(rowData.getStringExtra(LibraryAdapter.DATA_TITLE)); + + if (type != MediaUtils.TYPE_FILE) + fm.add(CTX_MENU_ADD_TO_HOMESCREEN, 20, R.drawable.menu_add_to_homescreen, R.string.add_to_homescreen).setIntent(rowData); + + if (FileUtils.canDispatchIntent(rowData)) + fm.add(CTX_MENU_OPEN_EXTERNAL, 10, R.drawable.menu_launch, R.string.open).setIntent(rowData); + + fm.add(CTX_MENU_PLAY, 0, R.drawable.menu_play, R.string.play).setIntent(rowData); + if (type <= MediaUtils.TYPE_SONG || type == MediaUtils.TYPE_FILE) + fm.add(CTX_MENU_PLAY_ALL, 1, R.drawable.menu_play_all, R.string.play_all).setIntent(rowData); + + fm.add(CTX_MENU_ENQUEUE_AS_NEXT, 1, R.drawable.menu_enqueue_as_next, R.string.enqueue_as_next).setIntent(rowData); + fm.add(CTX_MENU_ENQUEUE, 1, R.drawable.menu_enqueue, R.string.enqueue).setIntent(rowData); + + if (type == MediaUtils.TYPE_PLAYLIST) { + fm.add(CTX_MENU_RENAME_PLAYLIST, 0, R.drawable.menu_edit, R.string.rename).setIntent(rowData); + } else if (rowData.getBooleanExtra(LibraryAdapter.DATA_EXPANDABLE, false)) { + fm.add(CTX_MENU_EXPAND, 2, R.drawable.menu_expand, R.string.expand).setIntent(rowData); + } + + if (type == MediaUtils.TYPE_SONG || type == MediaUtils.TYPE_ALBUM) { + fm.addSpacer(30); + fm.add(CTX_MENU_MORE_FROM_ARTIST, 30, R.drawable.menu_artist, R.string.more_from_artist).setIntent(rowData); + + if (type == MediaUtils.TYPE_SONG) { + fm.add(CTX_MENU_MORE_FROM_ALBUM, 30, R.drawable.menu_album, R.string.more_from_album).setIntent(rowData); + fm.add(CTX_MENU_SHOW_DETAILS, 91, R.drawable.menu_details, R.string.details).setIntent(rowData); + if (PluginUtils.checkPlugins(this)) { + // not part of submenu: just last item in normal menu. + fm.add(CTX_MENU_PLUGINS, 99, R.drawable.menu_plugins, R.string.plugins).setIntent(rowData); + } + } + } + fm.addSpacer(90); + fm.add(CTX_MENU_DELETE, 91, R.drawable.menu_delete, R.string.delete).setIntent(rowData); + } + fm.show(view, x, y); + return true; + } + + /** + * Open the playlist editor for the playlist with the given id. + */ + private void editPlaylist(Intent rowData) + { + Intent launch = new Intent(this, PlaylistActivity.class); + launch.putExtra("playlist", rowData.getLongExtra(LibraryAdapter.DATA_ID, LibraryAdapter.INVALID_ID)); + launch.putExtra("title", rowData.getStringExtra(LibraryAdapter.DATA_TITLE)); + startActivity(launch); + } + + @Override + public boolean onFancyItemSelected(FancyMenuItem item) { + final Intent intent = item.getIntent(); + switch (item.getItemId()) { + case CTX_MENU_NOOP: + break; + case CTX_MENU_EXPAND: + expand(intent); + if (mDefaultAction == ACTION_LAST_USED && mLastAction != ACTION_EXPAND) { + mLastAction = ACTION_EXPAND; + updateHeaders(); + } + break; + case CTX_MENU_ENQUEUE: + pickSongs(intent, ACTION_ENQUEUE); + break; + case CTX_MENU_PLAY: + pickSongs(intent, ACTION_PLAY); + break; + case CTX_MENU_PLAY_ALL: + pickSongs(intent, ACTION_PLAY_ALL); + break; + case CTX_MENU_ENQUEUE_ALL: + pickSongs(intent, ACTION_ENQUEUE_ALL); + break; + case CTX_MENU_ENQUEUE_AS_NEXT: + pickSongs(intent, ACTION_ENQUEUE_AS_NEXT); + break; + case CTX_MENU_RENAME_PLAYLIST: { + final String playlistName = intent.getStringExtra("title"); + final long playlistId = intent.getLongExtra("id", -1); + PlaylistInputDialog dialog = PlaylistInputDialog.newInstance(new PlaylistInputDialog.Callback() { + @Override + public void onSuccess(String input) { + PlaylistTask playlistTask = new PlaylistTask(playlistId, input); + mHandler.sendMessage(mHandler.obtainMessage(MSG_RENAME_PLAYLIST, playlistTask)); + } + }, playlistName, R.string.rename); + dialog.show(getFragmentManager(), "RenamePlaylistInputDialog"); + break; + } + case CTX_MENU_DELETE: + String delete_message = getString(R.string.delete_item, intent.getStringExtra("title")); + AlertDialog.Builder dialog = new AlertDialog.Builder(this); + dialog.setTitle(R.string.delete); + dialog + .setMessage(delete_message) + .setPositiveButton(R.string.delete, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + mHandler.sendMessage(mHandler.obtainMessage(MSG_DELETE, intent)); + } + }) + .setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + } + }); + dialog.create().show(); + break; + case CTX_MENU_OPEN_EXTERNAL: { + FileUtils.dispatchIntent(this, intent); + break; + } + case CTX_MENU_SHOW_DETAILS: { + long songId = intent.getLongExtra(LibraryAdapter.DATA_ID, -1); + TrackDetailsDialog.show(getFragmentManager(), songId); + break; + } + case CTX_MENU_PLUGINS: { + showPluginMenu(intent); + break; + } + case CTX_MENU_MORE_FROM_ARTIST: { + String selection; + if (intent.getIntExtra(LibraryAdapter.DATA_TYPE, -1) == MediaUtils.TYPE_ALBUM) { + selection = "album_id="; + } else { + selection = "_id="; + } + selection += intent.getLongExtra(LibraryAdapter.DATA_ID, LibraryAdapter.INVALID_ID); + setLimiter(MediaUtils.TYPE_ARTIST, selection); + updateLimiterViews(); + break; + } + case CTX_MENU_MORE_FROM_ALBUM: + setLimiter(MediaUtils.TYPE_ALBUM, "_id=" + intent.getLongExtra(LibraryAdapter.DATA_ID, LibraryAdapter.INVALID_ID)); + updateLimiterViews(); + break; + case CTX_MENU_ADD_TO_PLAYLIST: { + long id = intent.getLongExtra("id", LibraryAdapter.INVALID_ID); + long songId = intent.getLongExtra(LibraryAdapter.DATA_ID, -1); + Song song = null; + if(songId!=-1) { + song = new Song(songId); + } + PlaylistDialog plDialog = PlaylistDialog.newInstance(this, intent, (id == LibraryAdapter.HEADER_ID ? mCurrentAdapter : null), song); + plDialog.show(getFragmentManager(), "PlaylistDialog"); + break; + } + case CTX_MENU_ADD_TO_HOMESCREEN: { + int type = intent.getIntExtra(LibraryAdapter.DATA_TYPE, MediaUtils.TYPE_INVALID); + long id = intent.getLongExtra(LibraryAdapter.DATA_ID, LibraryAdapter.INVALID_ID); + String label = intent.getStringExtra(LibraryAdapter.DATA_TITLE); + SystemUtils.installLauncherShortcut(this, label, type, id); + break; + } + default: + return super.onContextItemSelected(item); + } + return true; + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) + { + super.onCreateOptionsMenu(menu); + menu.add(0, MENU_PLAYBACK, 0, R.string.playback_view); + menu.add(0, MENU_SEARCH, 0, R.string.search).setIcon(R.drawable.ic_menu_search).setVisible(false); + menu.add(0, MENU_GO_HOME, 30, R.string.go_home); + menu.add(0, MENU_SORT, 30, R.string.sort_by).setIcon(R.drawable.ic_menu_sort_alphabetically); + return true; + } + + @Override + public boolean onPrepareOptionsMenu(Menu menu) + { + LibraryAdapter adapter = mCurrentAdapter; + menu.findItem(MENU_GO_HOME).setVisible( + adapter != null && + adapter.getMediaType() == MediaUtils.TYPE_FILE && + (!mSlidingView.isShrinkable() || !mSlidingView.isFullyExpanded())); + return super.onPrepareOptionsMenu(menu); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) + { + switch (item.getItemId()) { + case MENU_SEARCH: + mBottomBarControls.showSearch(true); + break; + case MENU_PLAYBACK: + openPlaybackActivity(); + break; + case MENU_GO_HOME: + mPagerAdapter.setLimiter(FileSystemAdapter.buildHomeLimiter(getApplicationContext())); + updateLimiterViews(); + break; + case MENU_SORT: { + SortableAdapter adapter = (SortableAdapter)mCurrentAdapter; + LinearLayout list = (LinearLayout)getLayoutInflater().inflate(R.layout.sort_dialog, null); + CheckBox reverseSort = (CheckBox)list.findViewById(R.id.reverse_sort); + + int[] itemIds = adapter.getSortEntries(); + String[] items = new String[itemIds.length]; + Resources res = getResources(); + for (int i = 0; i < itemIds.length; i++) { + items[i] = res.getString(itemIds[i]); + } + + int mode = adapter.getSortModeIndex(); + reverseSort.setChecked(adapter.isSortDescending()); + + AlertDialog.Builder builder = new AlertDialog.Builder(this); + builder.setTitle(R.string.sort_by); + builder.setSingleChoiceItems(items, mode, this); + builder.setPositiveButton(R.string.done, null); + + AlertDialog dialog = builder.create(); + dialog.getListView().addFooterView(list); + dialog.setOnDismissListener(this); + dialog.show(); + break; + } + default: + return super.onOptionsItemSelected(item); + } + return true; + } + + /** + * Callback of mSearchView while user types in text + */ + @Override + public boolean onQueryTextChange (String newText) { + mPagerAdapter.setFilter(newText); + return true; + } + + /** + * Callback of mSearchViews submit action + */ + @Override + public boolean onQueryTextSubmit (String query) { + mPagerAdapter.setFilter(query); + return true; + } + + /** + * Save the current page, passed in arg1, to SharedPreferences. + */ + private static final int MSG_SAVE_PAGE = 40; + /** + * Updates mCover using a background thread + */ + private static final int MSG_UPDATE_COVER = 41; + + @Override + public boolean handleMessage(Message message) + { + switch (message.what) { + case MSG_SAVE_PAGE: { + SharedPreferences.Editor editor = SharedPrefHelper.getSettings(this).edit(); + editor.putInt("library_page", message.arg1); + editor.apply(); + super.adjustSpines(); + break; + } + case MSG_UPDATE_COVER: { + Bitmap cover = null; + Song song = (Song)message.obj; + if (song != null) { + cover = song.getSmallCover(this); + } + // Dispatch view update to UI thread + updateCover(cover); + break; + } + default: + return super.handleMessage(message); + } + + return true; + } + + @Override + public void onMediaChange() + { + if (mPagerAdapter != null) + mPagerAdapter.invalidateData(); + } + + @Override + protected void onStateChange(int state, int toggled) + { + super.onStateChange(state, toggled); + + if ((state & PlaybackService.FLAG_EMPTY_QUEUE) != 0) + mBottomBarControls.setSong(null); + } + + @Override + protected void onSongChange(Song song) + { + super.onSongChange(song); + + mBottomBarControls.setSong(song); + if (song != null) { + mHandler.sendMessage(mHandler.obtainMessage(MSG_UPDATE_COVER, song)); + mPagerAdapter.onSongChange(song); + } + } + + @Override + public void onClick(DialogInterface dialog, int which) + { + dialog.dismiss(); + } + + @Override + public void onDismiss(DialogInterface dialog) + { + ListView list = ((AlertDialog)dialog).getListView(); + int which = list.getCheckedItemPosition(); + + CheckBox reverseSort = (CheckBox)list.findViewById(R.id.reverse_sort); + if (reverseSort.isChecked()) { + which = ~which; + } + + mPagerAdapter.setSortMode(which); + } + + /** + * Called when a new page becomes visible. + * + * @param position The position of the new page. + * @param adapter The new visible adapter. + */ + public void onPageChanged(int position, LibraryAdapter adapter) + { + mCurrentAdapter = adapter; + updateLimiterViews(); + if (adapter != null && (adapter.getLimiter() == null || adapter.getMediaType() == MediaUtils.TYPE_FILE)) { + // Save current page so it is opened on next startup. Don't save if + // the page was expanded to, as the expanded page isn't the starting + // point. This limitation does not affect the files tab as the limiter + // (the files almost always have a limiter) + Handler handler = mHandler; + handler.sendMessage(mHandler.obtainMessage(MSG_SAVE_PAGE, position, 0)); + } + } +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/LibraryAdapter.java b/app/src/main/java/ch/blinkenlights/android/vanilla/LibraryAdapter.java new file mode 100644 index 0000000..67bd70e --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/LibraryAdapter.java @@ -0,0 +1,145 @@ +/* + * Copyright (C) 2011 Christopher Eby <kreed@kreed.org> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package ch.blinkenlights.android.vanilla; + +import android.content.Intent; +import android.view.View; +import android.widget.ListAdapter; + +/** + * Provides support for limiters and a few other methods LibraryActivity uses + * for its adapters. + */ +public interface LibraryAdapter extends ListAdapter { + /** + * Return the type of media represented by this adapter. One of + * MediaUtils.TYPE_*. + */ + int getMediaType(); + + /** + * Set the limiter for the adapter. + * + * A limiter is intended to restrict displayed media to only those that are + * children of a given parent media item. + * + * @param limiter The limiter, created by + * {@link LibraryAdapter#buildLimiter(long)}. + */ + void setLimiter(Limiter limiter); + + /** + * Returns the limiter currently active on this adapter or null if none are + * active. + */ + Limiter getLimiter(); + + /** + * Builds a limiter based off of the media represented by the given row. + * + * @param id The id of the row. + * @see LibraryAdapter#getLimiter() + * @see LibraryAdapter#setLimiter(Limiter) + */ + Limiter buildLimiter(long id); + + /** + * Set a new filter. + * + * The data should be requeried after calling this. + * + * @param filter The terms to filter on, separated by spaces. Only + * media that contain all of the terms (in any order) will be displayed + * after filtering is complete. + */ + void setFilter(String filter); + + /** + * Retrieve the data for this adapter. The data must be set with + * {@link LibraryAdapter#commitQuery(Object)} before it takes effect. + * + * This should be called on a worker thread. + * + * @return The data. Contents depend on the sub-class. + */ + Object query(); + + /** + * Retrieve a query which will fetch all songs represented by + * this adapter. + * + * @return a query task. + */ + QueryTask buildSongQuery(String[] projection); + + /** + * Update the adapter with the given data. + * + * Must be called on the UI thread. + * + * @param data Data from {@link LibraryAdapter#query()}. + */ + void commitQuery(Object data); + + /** + * Clear the data for this adapter. + * + * Must be called on the UI thread. + */ + void clear(); + + /** + * Creates the row data used by LibraryActivity. + */ + Intent createData(View row); + + /** + * Extra for row data: media id. type: long. + */ + String DATA_ID = "id"; + /** + * Special id for {@link #DATA_ID}: the row represented is a header view. + */ + long HEADER_ID = -1; + /** + * Special id for {@link #DATA_ID}: invalid id. + */ + long INVALID_ID = -2; + /** + * Extra for row data: media title. type: String. + */ + String DATA_TITLE = "title"; + /** + * Extra for row data: media type. type: int. One of MediaUtils.TYPE_*. + */ + String DATA_TYPE = "type"; + /** + * Extra for row data: canonical file path. type: String. Only present if + * type is {@link MediaUtils#TYPE_FILE}. + */ + String DATA_FILE = "file"; + /** + * Extra for row data: if true, row has expander arrow. type: boolean. + */ + String DATA_EXPANDABLE = "expandable"; +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/LibraryPagerAdapter.java b/app/src/main/java/ch/blinkenlights/android/vanilla/LibraryPagerAdapter.java new file mode 100644 index 0000000..98c7972 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/LibraryPagerAdapter.java @@ -0,0 +1,974 @@ +/* + * Copyright (C) 2012 Christopher Eby <kreed@kreed.org> + * Copyright (C) 2015-2018 Adrian Ulrich <adrian@blinkenlights.ch> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package ch.blinkenlights.android.vanilla; + +import ch.blinkenlights.android.vanilla.ext.CoordClickListener; + +import android.content.Intent; +import android.content.SharedPreferences; +import android.os.Bundle; +import android.os.Handler; +import android.os.Looper; +import android.os.Message; +import android.os.Parcelable; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.util.LruCache; +import android.widget.AdapterView; +import android.widget.ListView; +import java.util.Arrays; +import java.util.ArrayList; + +import androidx.viewpager.widget.PagerAdapter; +import androidx.viewpager.widget.ViewPager; + + +/** + * PagerAdapter that manages the library media ListViews. + */ +public class LibraryPagerAdapter + extends PagerAdapter + implements Handler.Callback + , ViewPager.OnPageChangeListener + , CoordClickListener.Callback + , AdapterView.OnItemClickListener +{ + /** + * The number of unique list types. The number of visible lists may be + * smaller. + */ + public static final int MAX_ADAPTER_COUNT = MediaUtils.TYPE_COUNT; + /** + * The human-readable title for each list. The positions correspond to the + * MediaUtils ids, so e.g. TITLES[MediaUtils.TYPE_SONG] = R.string.songs + */ + public static final int[] TITLES = { R.string.artists, R.string.albums, R.string.songs, R.string.playlists, + R.string.genres, R.string.albumartists, R.string.composers, R.string.files }; + /** + * Default tab order. + */ + public static final int[] DEFAULT_TAB_ORDER = { MediaUtils.TYPE_ARTIST, MediaUtils.TYPE_ALBARTIST, MediaUtils.TYPE_COMPOSER, + MediaUtils.TYPE_ALBUM, MediaUtils.TYPE_SONG, MediaUtils.TYPE_PLAYLIST, + MediaUtils.TYPE_GENRE, MediaUtils.TYPE_FILE }; + /** + * The default visibility of tabs + */ + public static final boolean[] DEFAULT_TAB_VISIBILITY = { true, false, false, true, true, true, true, true }; + + /** + * The user-chosen tab order. + */ + int[] mTabOrder; + /** + * The number of visible tabs. + */ + private int mTabCount; + /** + * The ListView for each adapter. Each index corresponds to that list's + * MediaUtils id. + */ + private final ListView[] mLists = new ListView[MAX_ADAPTER_COUNT]; + /** + * The adapters. Each index corresponds to that adapter's MediaUtils id. + */ + public LibraryAdapter[] mAdapters = new LibraryAdapter[MAX_ADAPTER_COUNT]; + /** + * Whether the adapter corresponding to each index has stale data. + */ + private final boolean[] mRequeryNeeded = new boolean[MAX_ADAPTER_COUNT]; + /** + * The artist adapter instance, also stored at mAdapters[MediaUtils.TYPE_ARTIST]. + */ + private MediaAdapter mArtistAdapter; + /** + * The albumartist adapter instance, also stored at mAdapters[MediaUtils.TYPE_ALBART]. + */ + private MediaAdapter mAlbArtAdapter; + /** + * The composer adapter instance, also stored at mAdapters[MediaUtils.TYPE_COMPOSER]. + */ + private MediaAdapter mComposerAdapter; + /** + * The album adapter instance, also stored at mAdapters[MediaUtils.TYPE_ALBUM]. + */ + private MediaAdapter mAlbumAdapter; + /** + * The song adapter instance, also stored at mAdapters[MediaUtils.TYPE_SONG]. + */ + private MediaAdapter mSongAdapter; + /** + * The playlist adapter instance, also stored at mAdapters[MediaUtils.TYPE_PLAYLIST]. + */ + MediaAdapter mPlaylistAdapter; + /** + * The genre adapter instance, also stored at mAdapters[MediaUtils.TYPE_GENRE]. + */ + private MediaAdapter mGenreAdapter; + /** + * The file adapter instance, also stored at mAdapters[MediaUtils.TYPE_FILE]. + */ + private FileSystemAdapter mFilesAdapter; + /** + * LRU cache holding the last scrolling position of all adapter views + */ + private static AdaperPositionLruCache sLruAdapterPos; + /** + * The adapter of the currently visible list. + */ + private LibraryAdapter mCurrentAdapter; + /** + * The index of the current page. + */ + private int mCurrentPage; + /** + * A limiter that should be set when the album adapter is created. + */ + private Limiter mPendingArtistLimiter; + /** + * A limiter that should be set when the albumartist adapter is created. + */ + private Limiter mPendingAlbArtLimiter; + /** + * A limiter that should be set when the composer adapter is created. + */ + private Limiter mPendingComposerLimiter; + /** + * A limiter that should be set when the album adapter is created. + */ + private Limiter mPendingAlbumLimiter; + /** + * A limiter that should be set when the song adapter is created. + */ + private Limiter mPendingSongLimiter; + /** + * A limiter that should be set when the files adapter is created. + */ + private Limiter mPendingFileLimiter; + /** + * The LibraryActivity that owns this adapter. The adapter will be notified + * of changes in the current page. + */ + private final LibraryActivity mActivity; + /** + * A Handler running on the UI thread. + */ + private final Handler mUiHandler; + /** + * A Handler running on a worker thread. + */ + private final Handler mWorkerHandler; + /** + * The text to be displayed in the first row of the artist, album, and + * song limiters. + */ + private String mHeaderText; + /** + * A list of header rows which require test updates + */ + private ArrayList<DraggableRow> mHeaderViews = new ArrayList(); + /** + * The current filter text, or null if none. + */ + private String mFilter; + + /** + * Create the LibraryPager. + * + * @param activity The LibraryActivity that will own this adapter. The activity + * will receive callbacks from the ListViews. + * @param workerLooper A Looper running on a worker thread. + */ + public LibraryPagerAdapter(LibraryActivity activity, Looper workerLooper) + { + if (sLruAdapterPos == null) + sLruAdapterPos = new AdaperPositionLruCache(32); + mActivity = activity; + mUiHandler = new Handler(this); + mWorkerHandler = new Handler(workerLooper, this); + mCurrentPage = -1; + } + + /** + * Load the tab order from SharedPreferences. + * + * @return True if order has changed. + */ + public boolean loadTabOrder() + { + String in = SharedPrefHelper.getSettings(mActivity).getString(PrefKeys.TAB_ORDER, PrefDefaults.TAB_ORDER); + int[] order = new int[MAX_ADAPTER_COUNT]; + int count = 0; + if (in != null && in.length() == MAX_ADAPTER_COUNT) { + char[] chars = in.toCharArray(); + order = new int[MAX_ADAPTER_COUNT]; + for (int i = 0; i != MAX_ADAPTER_COUNT; ++i) { + char v = chars[i]; + if (v >= 128) { + v -= 128; + if (v >= MediaUtils.TYPE_COUNT) { + // invalid media type, ignore all data + count = 0; + break; + } + order[count++] = v; + } + } + } + + // set default tabs if none were loaded + if (count == 0) { + for (int i=0; i != MAX_ADAPTER_COUNT; i++) { + if (DEFAULT_TAB_VISIBILITY[i]) + order[count++] = DEFAULT_TAB_ORDER[i]; + } + } + + if (count != mTabCount || !Arrays.equals(order, mTabOrder)) { + mTabOrder = order; + mTabCount = count; + notifyDataSetChanged(); + computeExpansions(); + return true; + } + + return false; + } + + /** + * Determines whether adapters should be expandable from the visibility of + * the adapters each expands to. Also updates mSongsPosition/mAlbumsPositions. + */ + public void computeExpansions() + { + if (mGenreAdapter != null) + mGenreAdapter.setExpandable( + getMediaTypePosition(MediaUtils.TYPE_SONG) != -1 || + getMediaTypePosition(MediaUtils.TYPE_ALBUM) != -1 || + getMediaTypePosition(MediaUtils.TYPE_ARTIST) != -1 + ); + if (mArtistAdapter != null) + mArtistAdapter.setExpandable( + getMediaTypePosition(MediaUtils.TYPE_SONG) != -1 || + getMediaTypePosition(MediaUtils.TYPE_ALBUM) != -1 + ); + if (mAlbumAdapter != null) + mAlbumAdapter.setExpandable( + getMediaTypePosition(MediaUtils.TYPE_SONG) != -1 + ); + } + + @Override + public Object instantiateItem(ViewGroup container, int position) + { + int type = mTabOrder[position]; + ListView view = mLists[type]; + + if (view == null) { + LibraryActivity activity = mActivity; + LayoutInflater inflater = activity.getLayoutInflater(); + LibraryAdapter adapter; + DraggableRow header = null; + + switch (type) { + case MediaUtils.TYPE_ARTIST: + adapter = mArtistAdapter = new MediaAdapter(activity, MediaUtils.TYPE_ARTIST, mPendingArtistLimiter, activity); + mArtistAdapter.setExpandable(getMediaTypePosition(MediaUtils.TYPE_SONG) != -1 || getMediaTypePosition(MediaUtils.TYPE_ALBUM) != -1); + header = (DraggableRow)inflater.inflate(R.layout.draggable_row, null); + break; + case MediaUtils.TYPE_ALBARTIST: + adapter = mAlbArtAdapter = new MediaAdapter(activity, MediaUtils.TYPE_ALBARTIST, mPendingAlbArtLimiter, activity); + mAlbArtAdapter.setExpandable(getMediaTypePosition(MediaUtils.TYPE_SONG) != -1 || getMediaTypePosition(MediaUtils.TYPE_ALBUM) != -1); + header = (DraggableRow)inflater.inflate(R.layout.draggable_row, null); + break; + case MediaUtils.TYPE_COMPOSER: + adapter = mComposerAdapter = new MediaAdapter(activity, MediaUtils.TYPE_COMPOSER, mPendingComposerLimiter, activity); + mComposerAdapter.setExpandable(getMediaTypePosition(MediaUtils.TYPE_SONG) != -1 || getMediaTypePosition(MediaUtils.TYPE_ALBUM) != -1); + header = (DraggableRow)inflater.inflate(R.layout.draggable_row, null); + break; + case MediaUtils.TYPE_ALBUM: + adapter = mAlbumAdapter = new MediaAdapter(activity, MediaUtils.TYPE_ALBUM, mPendingAlbumLimiter, activity); + mAlbumAdapter.setExpandable(getMediaTypePosition(MediaUtils.TYPE_SONG) != -1); + mPendingAlbumLimiter = null; + header = (DraggableRow)inflater.inflate(R.layout.draggable_row, null); + break; + case MediaUtils.TYPE_SONG: + adapter = mSongAdapter = new MediaAdapter(activity, MediaUtils.TYPE_SONG, mPendingSongLimiter, activity); + mPendingSongLimiter = null; + header = (DraggableRow)inflater.inflate(R.layout.draggable_row, null); + break; + case MediaUtils.TYPE_PLAYLIST: + adapter = mPlaylistAdapter = new MediaAdapter(activity, MediaUtils.TYPE_PLAYLIST, null, activity); + break; + case MediaUtils.TYPE_GENRE: + adapter = mGenreAdapter = new MediaAdapter(activity, MediaUtils.TYPE_GENRE, null, activity); + mGenreAdapter.setExpandable( + getMediaTypePosition(MediaUtils.TYPE_SONG) != -1 || + getMediaTypePosition(MediaUtils.TYPE_ALBUM) != -1 || + getMediaTypePosition(MediaUtils.TYPE_ARTIST) != -1 + ); + break; + case MediaUtils.TYPE_FILE: + adapter = mFilesAdapter = new FileSystemAdapter(activity, mPendingFileLimiter); + mPendingFileLimiter = null; + header = (DraggableRow)inflater.inflate(R.layout.draggable_row, null); + break; + default: + throw new IllegalArgumentException("Invalid media type: " + type); + } + + CoordClickListener ccl = new CoordClickListener(this); + view = (ListView)inflater.inflate(R.layout.listview, null); + ccl.registerForOnItemLongClickListener(view); + view.setOnItemClickListener(this); + view.setTag(type); + + if (header != null) { + header.setText(mHeaderText); + header.setTag(new ViewHolder()); // behave like a normal library row + view.addHeaderView(header); + mHeaderViews.add(header); + } + view.setAdapter(adapter); + + loadSortOrder((SortableAdapter)adapter); + + adapter.setFilter(mFilter); + + mAdapters[type] = adapter; + mLists[type] = view; + mRequeryNeeded[type] = true; + } + + requeryIfNeeded(type); + container.addView(view); + return view; + } + + @Override + public int getItemPosition(Object item) + { + int type = (Integer)((ListView)item).getTag(); + int pos = getMediaTypePosition(type); + return pos == -1 ? POSITION_NONE : pos; + } + + @Override + public void destroyItem(ViewGroup container, int position, Object object) + { + container.removeView((View)object); + } + + @Override + public CharSequence getPageTitle(int position) + { + return mActivity.getResources().getText(TITLES[mTabOrder[position]]); + } + + @Override + public int getCount() + { + return mTabCount; + } + + @Override + public boolean isViewFromObject(View view, Object object) + { + return view == object; + } + + @Override + public void setPrimaryItem(ViewGroup container, int position, Object object) + { + int type = mTabOrder[position]; + LibraryAdapter adapter = mAdapters[type]; + if (position != mCurrentPage || adapter != mCurrentAdapter) { + requeryIfNeeded(type); + mCurrentAdapter = adapter; + mCurrentPage = position; + mActivity.onPageChanged(position, adapter); + } + } + + @Override + public void restoreState(Parcelable state, ClassLoader loader) + { + Bundle in = (Bundle)state; + mPendingArtistLimiter = (Limiter)in.getSerializable("limiter_artists"); + mPendingAlbArtLimiter = (Limiter)in.getSerializable("limiter_albumartists"); + mPendingComposerLimiter = (Limiter)in.getSerializable("limiter_composer"); + mPendingAlbumLimiter = (Limiter)in.getSerializable("limiter_albums"); + mPendingSongLimiter = (Limiter)in.getSerializable("limiter_songs"); + mPendingFileLimiter = (Limiter)in.getSerializable("limiter_files"); + } + + @Override + public Parcelable saveState() + { + Bundle out = new Bundle(10); + if (mArtistAdapter != null) + out.putSerializable("limiter_artists", mArtistAdapter.getLimiter()); + if (mAlbArtAdapter != null) + out.putSerializable("limiter_albumartists", mAlbArtAdapter.getLimiter()); + if (mComposerAdapter != null) + out.putSerializable("limiter_composer", mComposerAdapter.getLimiter()); + if (mAlbumAdapter != null) + out.putSerializable("limiter_albums", mAlbumAdapter.getLimiter()); + if (mSongAdapter != null) + out.putSerializable("limiter_songs", mSongAdapter.getLimiter()); + if (mFilesAdapter != null) + out.putSerializable("limiter_files", mFilesAdapter.getLimiter()); + + maintainPosition(); + return out; + } + + /** + * Sets the text to be displayed in the first row of the artist, album, and + * song lists. + */ + public void setHeaderText(String text) + { + for(DraggableRow row : mHeaderViews) { + row.setText(text); + } + mHeaderText = text; + } + + /** + * Clear a limiter. + * + * @param type Which type of limiter to clear. + */ + public void clearLimiter(int type) + { + ArrayList<LibraryAdapter> targets = new ArrayList<LibraryAdapter>(); + + maintainPosition(); + + if (type == MediaUtils.TYPE_FILE) { + if (mFilesAdapter == null) { + mPendingFileLimiter = null; + } else { + targets.add(mFilesAdapter); + } + } else { + if (mArtistAdapter == null) { + mPendingArtistLimiter = null; + } else { + targets.add(mArtistAdapter); + } + if (mAlbArtAdapter == null) { + mPendingAlbArtLimiter = null; + } else { + targets.add(mAlbArtAdapter); + } + if (mComposerAdapter == null) { + mPendingComposerLimiter = null; + } else { + targets.add(mComposerAdapter); + } + if (mAlbumAdapter == null) { + mPendingAlbumLimiter = null; + } else { + targets.add(mAlbumAdapter); + } + if (mSongAdapter == null) { + mPendingSongLimiter = null; + } else { + targets.add(mSongAdapter); + } + } + + for (LibraryAdapter adapter : targets) { + adapter.setLimiter(null); + loadSortOrder((SortableAdapter)adapter); + requestRequery(adapter); + } + } + + /** + * Update the adapters with the given limiter. + * + * @param limiter The limiter to set. + * @return The tab type that should be switched to to expand the row. + */ + public int setLimiter(Limiter limiter) + { + int tab; + ArrayList<LibraryAdapter> targets = new ArrayList<LibraryAdapter>(); + + maintainPosition(); + + switch (limiter.type) { + case MediaUtils.TYPE_ALBUM: + if (mSongAdapter == null) { + mPendingSongLimiter = limiter; + } else { + targets.add(mSongAdapter); + } + tab = getMediaTypePosition(MediaUtils.TYPE_SONG); + break; + case MediaUtils.TYPE_ARTIST: + case MediaUtils.TYPE_ALBARTIST: + case MediaUtils.TYPE_COMPOSER: + if (mAlbumAdapter == null) { + mPendingAlbumLimiter = limiter; + } else { + targets.add(mAlbumAdapter); + } + if (mSongAdapter == null) { + mPendingSongLimiter = limiter; + } else { + targets.add(mSongAdapter); + } + tab = getMediaTypePosition(MediaUtils.TYPE_ALBUM); + if (tab == -1) + tab = getMediaTypePosition(MediaUtils.TYPE_SONG); + break; + case MediaUtils.TYPE_GENRE: + if (mArtistAdapter == null) { + mPendingArtistLimiter = limiter; + } else { + targets.add(mArtistAdapter); + } + if (mAlbArtAdapter == null) { + mPendingAlbArtLimiter = limiter; + } else { + targets.add(mAlbArtAdapter); + } + if (mComposerAdapter == null) { + mPendingComposerLimiter = limiter; + } else { + targets.add(mComposerAdapter); + } + if (mAlbumAdapter == null) { + mPendingAlbumLimiter = limiter; + } else { + targets.add(mAlbumAdapter); + } + if (mSongAdapter == null) { + mPendingSongLimiter = limiter; + } else { + targets.add(mSongAdapter); + } + tab = getMediaTypePosition(MediaUtils.TYPE_ARTIST); + if (tab == -1) + tab = getMediaTypePosition(MediaUtils.TYPE_ALBUM); + if (tab == -1) + tab = getMediaTypePosition(MediaUtils.TYPE_SONG); + break; + case MediaUtils.TYPE_FILE: + if (mFilesAdapter == null) { + mPendingFileLimiter = limiter; + } else { + targets.add(mFilesAdapter); + // forcefully jump to beginning - commit query might restore a saved position + // but if it doesn't we would end up at the same scrolling position in a new + // folder which is uncool. + mLists[MediaUtils.TYPE_FILE].setSelection(0); + } + tab = getMediaTypePosition(MediaUtils.TYPE_FILE); + break; + default: + throw new IllegalArgumentException("Unsupported limiter type: " + limiter.type); + } + + for (LibraryAdapter adapter : targets) { + adapter.setLimiter(limiter); + loadSortOrder((SortableAdapter)adapter); + requestRequery(adapter); + } + + return tab; + } + + /** + * Saves the scrolling position of every visible limiter + */ + private void maintainPosition() { + for (int i = MAX_ADAPTER_COUNT; --i != -1; ) { + if (mAdapters[i] != null) { + sLruAdapterPos.storePosition(mAdapters[i], mLists[i].getFirstVisiblePosition()); + } + } + } + + /** + * Restores the saved scrolling position + */ + private void restorePosition(int index) { + // Restore scrolling position if present and valid + Integer curPos = sLruAdapterPos.popPosition(mAdapters[index]); + if (curPos != null && curPos < mLists[index].getCount()) + mLists[index].setSelection(curPos); + } + + /** + * Returns the limiter set on the current adapter or null if there is none. + */ + public Limiter getCurrentLimiter() + { + LibraryAdapter current = mCurrentAdapter; + if (current == null) + return null; + return current.getLimiter(); + } + + /** + * Returns the tab position of given media type, -1 if not visible. + * + * @return int + */ + public int getMediaTypePosition(int type) { + int[] order = mTabOrder; + for (int i = mTabCount; --i != -1; ) { + if (order[i] == type) + return i; + } + return -1; + } + + /** + * Run on query on the adapter passed in obj. + * + * Runs on worker thread. + */ + private static final int MSG_RUN_QUERY = 0; + /** + * Save the sort mode for the adapter passed in obj. + * + * Runs on worker thread. + */ + private static final int MSG_SAVE_SORT = 1; + /** + * Call {@link LibraryPagerAdapter#requestRequery(LibraryAdapter)} on the adapter + * passed in obj. + * + * Runs on worker thread. + */ + private static final int MSG_REQUEST_REQUERY = 2; + /** + * Commit the cursor passed in obj to the adapter at the index passed in + * arg1. + * + * Runs on UI thread. + */ + private static final int MSG_COMMIT_QUERY = 3; + + @Override + public boolean handleMessage(Message message) + { + switch (message.what) { + case MSG_RUN_QUERY: { + LibraryAdapter adapter = (LibraryAdapter)message.obj; + int index = adapter.getMediaType(); + Handler handler = mUiHandler; + handler.sendMessage(handler.obtainMessage(MSG_COMMIT_QUERY, index, 0, adapter.query())); + break; + } + case MSG_COMMIT_QUERY: { + int index = message.arg1; + mAdapters[index].commitQuery(message.obj); + restorePosition(index); + break; + } + case MSG_SAVE_SORT: { + SortableAdapter adapter = (SortableAdapter)message.obj; + SharedPreferences.Editor editor = SharedPrefHelper.getSettings(mActivity).edit(); + editor.putInt(adapter.getSortSettingsKey(), adapter.getSortMode()); + editor.apply(); + break; + } + case MSG_REQUEST_REQUERY: + requestRequery((LibraryAdapter)message.obj); + break; + default: + return false; + } + + return true; + } + + /** + * Requery the given adapter. If it is the current adapter, requery + * immediately. Otherwise, mark the adapter as needing a requery and requery + * when its tab is selected. + * + * Must be called on the UI thread. + */ + public void requestRequery(LibraryAdapter adapter) + { + if (adapter == mCurrentAdapter) { + postRunQuery(adapter); + } else { + mRequeryNeeded[adapter.getMediaType()] = true; + // Clear the data for non-visible adapters (so we don't show the old + // data briefly when we later switch to that adapter) + adapter.clear(); + } + } + + /** + * Call {@link LibraryPagerAdapter#requestRequery(LibraryAdapter)} on the UI + * thread. + * + * @param adapter The adapter, passed to requestRequery. + */ + public void postRequestRequery(LibraryAdapter adapter) + { + Handler handler = mUiHandler; + handler.sendMessage(handler.obtainMessage(MSG_REQUEST_REQUERY, adapter)); + } + + /** + * Schedule a query to be run for the given adapter on the worker thread. + * + * @param adapter The adapter to run the query for. + */ + private void postRunQuery(LibraryAdapter adapter) + { + mRequeryNeeded[adapter.getMediaType()] = false; + Handler handler = mWorkerHandler; + handler.removeMessages(MSG_RUN_QUERY, adapter); + handler.sendMessage(handler.obtainMessage(MSG_RUN_QUERY, adapter)); + } + + /** + * Requery the adapter of the given type if it exists and needs a requery. + * + * @param type One of MediaUtils.TYPE_* + */ + private void requeryIfNeeded(int type) + { + LibraryAdapter adapter = mAdapters[type]; + if (adapter != null && mRequeryNeeded[type]) { + postRunQuery(adapter); + } + } + + /** + * Invalidate the data for all adapters. + */ + public void invalidateData() + { + for (LibraryAdapter adapter : mAdapters) { + if (adapter != null) { + postRequestRequery(adapter); + } + } + } + + /** + * Set the saved sort mode for the given adapter. The adapter should + * be re-queried after calling this. + * + * @param adapter The adapter to load for. + */ + public void loadSortOrder(SortableAdapter adapter) + { + String key = adapter.getSortSettingsKey(); + int def = adapter.getDefaultSortMode(); + int sort = SharedPrefHelper.getSettings(mActivity).getInt(key, def); + adapter.setSortMode(sort); + } + + /** + * Set the sort mode for the current adapter. Current adapter must be a + * MediaAdapter. Saves this sort mode to preferences and updates the list + * associated with the adapter to display the new sort mode. + * + * @param mode The sort mode. See {@link MediaAdapter#setSortMode(int)} for + * details. + */ + public void setSortMode(int mode) + { + SortableAdapter adapter = (SortableAdapter)mCurrentAdapter; + if (mode == adapter.getSortMode()) + return; + + adapter.setSortMode(mode); + requestRequery(mCurrentAdapter); + + Handler handler = mWorkerHandler; + handler.sendMessage(handler.obtainMessage(MSG_SAVE_SORT, adapter)); + } + + /** + * Set a new filter on all the adapters. + */ + public void setFilter(String text) + { + if (text.length() == 0) + text = null; + + mFilter = text; + for (LibraryAdapter adapter : mAdapters) { + if (adapter != null) { + adapter.setFilter(text); + requestRequery(adapter); + } + } + } + + @Override + public void onPageScrollStateChanged(int state) + { + } + + @Override + public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) + { + } + + @Override + public void onPageSelected(int position) + { + // onPageSelected and setPrimaryItem are called in similar cases, and it + // would be nice to use just one of them, but each has caveats: + // - onPageSelected isn't called when the ViewPager is first + // initialized if there is no scrolling to do + // - setPrimaryItem isn't called until scrolling is complete, which + // makes tab bar and limiter updates look bad + // So we use both. + setPrimaryItem(null, position, null); + } + + /** + * Creates the row data used by LibraryActivity. + */ + private static Intent createHeaderIntent(View header) + { + int type = (Integer)((View)header.getParent()).getTag(); // tag is set on parent view of header + Intent intent = new Intent(); + intent.putExtra(LibraryAdapter.DATA_ID, LibraryAdapter.HEADER_ID); + intent.putExtra(LibraryAdapter.DATA_TYPE, type); + return intent; + } + + @Override + /** + * Dispatch long click event of a row. + * + * @param parent the parent adapter view + * @param view the long clicked view + * @param position row position + * @param id id of the long clicked row + * @param x x-coords of event + * @param y y-coords of event + * + * @return true if the event was consumed + */ + public boolean onItemLongClickWithCoords (AdapterView<?> parent, View view, int position, long id, float x, float y) { + Intent intent = id == LibraryAdapter.HEADER_ID ? createHeaderIntent(view) : mCurrentAdapter.createData(view); + int type = (Integer)((View)view.getParent()).getTag(); + + if (type == MediaUtils.TYPE_FILE) { + return mFilesAdapter.onCreateFancyMenu(intent, view, x, y); + } + return mActivity.onCreateFancyMenu(intent, view, x, y); + } + + @Override + public void onItemClick (AdapterView<?> parent, View view, int position, long id) { + Intent intent = id == LibraryAdapter.HEADER_ID ? createHeaderIntent(view) : mCurrentAdapter.createData(view); + int type = (Integer)((View)view.getParent()).getTag(); + + if (type == MediaUtils.TYPE_FILE) { + mFilesAdapter.onItemClicked(intent); + } else { + mActivity.onItemClicked(intent); + } + } + + /** + * Perform usability-related actions on pager and contained lists, e.g. highlight current song + * or scroll to it if opted-in + * @param song song that is currently playing, can be null + */ + public void onSongChange(Song song) { + if (mCurrentPage == -1) // no page active, nothing to do + return; + + int type = mTabOrder[mCurrentPage]; + ListView view = mLists[type]; + if (view == null) // not initialized yet, nothing to do + return; + + long id = MediaUtils.getCurrentIdForType(song, type); + if (id == -1) // unknown type + return; + + // scroll to song on song change if opted-in + SharedPreferences sharedPrefs = SharedPrefHelper.getSettings(mActivity); + boolean shouldScroll = sharedPrefs.getBoolean(PrefKeys.ENABLE_SCROLL_TO_SONG, PrefDefaults.ENABLE_SCROLL_TO_SONG); + if(shouldScroll) { + for (int pos = 0; pos < view.getCount(); pos++) { + if (view.getItemIdAtPosition(pos) == id) { + // for Android < 6.x visible positions are valid only if view is shown + boolean interactive = view.isShown(); + int middlePos = (view.getFirstVisiblePosition() + view.getLastVisiblePosition()) / 2; + if (interactive && Math.abs(middlePos - pos) < 30) { + view.smoothScrollToPosition(pos); + } else { + view.setSelection(pos); + } + break; + } + } + } + } + + /** + * LRU implementation: saves the adapter position + */ + private class AdaperPositionLruCache extends LruCache<String, Integer> { + public AdaperPositionLruCache(int size) { + super(size); + } + public void storePosition(LibraryAdapter adapter, Integer val) { + this.put(_k(adapter), val); + } + public Integer popPosition(LibraryAdapter adapter) { + return this.remove(_k(adapter)); + } + + /** + * Assemble internal cache key from adapter + */ + private String _k(LibraryAdapter adapter) { + String result = adapter.getMediaType()+"://"; + Limiter limiter = adapter.getLimiter(); + + if (limiter != null) { + for(String entry : limiter.names) { + result = result + entry + "/"; + } + } + return result; + } + + } + +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/Limiter.java b/app/src/main/java/ch/blinkenlights/android/vanilla/Limiter.java new file mode 100644 index 0000000..139be6e --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/Limiter.java @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2011 Christopher Eby <kreed@kreed.org> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package ch.blinkenlights.android.vanilla; + +import java.io.Serializable; + +/** + * Limiter is a constraint for MediaAdapter and FileSystemAdapter used when + * a row is "expanded". + */ +public class Limiter implements Serializable { + private static final long serialVersionUID = -4729694243900202614L; + + /** + * The type of the limiter. One of MediaUtils.TYPE_ARTIST, TYPE_ALBUM, + * TYPE_GENRE, or TYPE_FILE. + */ + public final int type; + /** + * Each element will be given a separate view each representing a higher + * different limiters. The first element is the broadest limiter, the last + * the most specific. For example, an album limiter would look like: + * { "Some Artist", "Some Album" } + * Or a file limiter: + * { "sdcard", "Music", "folder" } + */ + public final String[] names; + /** + * The data for the limiter. This varies according to the type of the + * limiter. + */ + public final Object data; + + /** + * Create a limiter with the given data. All parameters initialize their + * corresponding fields in the class. + */ + public Limiter(int type, String[] names, Object data) + { + this.type = type; + this.names = names; + this.data = data; + } +}
\ No newline at end of file diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/ListPreferenceSummary.java b/app/src/main/java/ch/blinkenlights/android/vanilla/ListPreferenceSummary.java new file mode 100644 index 0000000..6196457 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/ListPreferenceSummary.java @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2018 Adrian Ulrich <adrian@blinkenlights.ch> + * Copyright (C) 2011 Christopher Eby <kreed@kreed.org> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package ch.blinkenlights.android.vanilla; + +import android.content.Context; +import android.preference.ListPreference; +import android.util.AttributeSet; + +/** + * Overrides ListPreference to show the selected value as the summary. + * + * (ListPreference should supposedly be able to do this itself if %s is in the + * summary, but as far as I can tell that behavior is broken.) + */ +public class ListPreferenceSummary extends ListPreference { + public ListPreferenceSummary(Context context, AttributeSet attrs) + { + super(context, attrs); + } + + @Override + public CharSequence getSummary() + { + return getEntry(); + } + + @Override + public boolean shouldDisableDependents() + { + return getValue().equals("0"); + } + + @Override + protected void onDialogClosed(boolean positiveResult) + { + super.onDialogClosed(positiveResult); + notifyDependencyChange(shouldDisableDependents()); + notifyChanged(); + } +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/MediaAdapter.java b/app/src/main/java/ch/blinkenlights/android/vanilla/MediaAdapter.java new file mode 100644 index 0000000..042934a --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/MediaAdapter.java @@ -0,0 +1,783 @@ +/* + * Copyright (C) 2015-2018 Adrian Ulrich <adrian@blinkenlights.ch> + * Copyright (C) 2010, 2011 Christopher Eby <kreed@kreed.org> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package ch.blinkenlights.android.vanilla; + +import ch.blinkenlights.android.medialibrary.MediaLibrary; + +import android.content.Context; +import android.content.Intent; +import android.database.Cursor; +import android.database.DatabaseUtils; +import android.provider.BaseColumns; +import android.provider.MediaStore; +import android.text.format.DateUtils; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.SectionIndexer; + +import java.text.SimpleDateFormat; +import java.util.Arrays; +import java.util.Date; +import java.util.List; +import java.util.regex.Pattern; +import java.util.ArrayList; +import java.lang.StringBuilder; + + +/** + * MediaAdapter provides an adapter backed by a MediaStore content provider. + * It generates simple one- or two-line text views to display each media + * element. + * + * Filtering is supported, as is a more specific type of filtering referred to + * as limiting. Limiting is separate from filtering; a new filter will not + * erase an active filter. Limiting is intended to allow only media belonging + * to a specific group to be displayed, e.g. only songs from a certain artist. + * See getLimiter and setLimiter for details. + */ +public class MediaAdapter + extends SortableAdapter + implements LibraryAdapter + , View.OnClickListener + , SectionIndexer +{ + private static final Pattern SPACE_SPLIT = Pattern.compile("\\s+"); + /** + * The string to use for length==0 db fields + */ + private static final String DB_NULLSTRING_FALLBACK = "?"; + /** + * A context to use. + */ + private final Context mContext; + /** + * The library activity to use. + */ + private final LibraryActivity mActivity; + /** + * A LayoutInflater to use. + */ + private final LayoutInflater mInflater; + /** + * The current data. + */ + private Cursor mCursor; + /** + * The type of media represented by this adapter. Must be one of the + * MediaUtils.FIELD_* constants. Determines which content provider to query for + * media and what fields to display. + */ + private final int mType; + /** + * The table / view to use for this query + */ + private String mSource; + /** + * The fields to use from the content provider. The last field will be + * displayed in the MediaView, as will the first field if there are + * multiple fields. Other fields will be used for searching. + */ + private String[] mFields; + /** + * The collation keys corresponding to each field. If provided, these are + * used to speed up sorting and filtering. + */ + private String[] mFieldKeys; + /** + * The columns to query from the content provider. + */ + private String[] mProjection; + /** + * A limiter is used for filtering. The intention is to restrict items + * displayed in the list to only those of a specific artist or album, as + * selected through an expander arrow in a broader MediaAdapter list. + */ + private Limiter mLimiter; + /** + * The constraint used for filtering, set by the search box. + */ + private String mConstraint; + /** + * An array ORDER BY expressions for each sort mode. %1$s is replaced by + * ASC or DESC as appropriate before being passed to the query. + */ + private String[] mAdapterSortValues; + /** + * If true, show the expander button on each row. + */ + private boolean mExpandable; + /** + * Defines the media type to use for this entry + * Setting this to MediaUtils.TYPE_INVALID disables cover artwork + */ + private int mCoverCacheType; + /** + * Alphabet to be used for {@link SectionIndexer}. Populated in {@link #buildAlphabet()}. + */ + private List<SectionIndex> mAlphabet = new ArrayList<>(512); + + /** + * Construct a MediaAdapter representing the given <code>type</code> of + * media. + * + * @param context The Context used to access the content model. + * @param type The type of media to represent. Must be one of the + * MediaUtils.TYPE_* constants. This determines which content provider to query + * and what fields to display in the views. + * @param limiter An initial limiter to use + * @param activity The LibraryActivity that will contain this adapter - may be null + * + */ + public MediaAdapter(Context context, int type, Limiter limiter, LibraryActivity activity) + { + mContext = context; + mActivity = activity; + mType = type; + mLimiter = limiter; + + if (mActivity != null) { + mInflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + } else { + mInflater = null; // not running inside an activity + } + + // Use media type + base id as cache key combination + mCoverCacheType = mType; + String coverCacheKey = BaseColumns._ID; + + switch (type) { + case MediaUtils.TYPE_ARTIST: + mSource = MediaLibrary.VIEW_ARTISTS; + mFields = new String[] { MediaLibrary.ContributorColumns.ARTIST }; + mFieldKeys = new String[] { MediaLibrary.ContributorColumns.ARTIST_SORT }; + mSortEntries = new int[] { R.string.title, R.string.date_added }; + mAdapterSortValues = new String[] { MediaLibrary.ContributorColumns.ARTIST_SORT+" %1$s", MediaLibrary.ContributorColumns.MTIME+" %1$s" }; + break; + case MediaUtils.TYPE_ALBARTIST: + mSource = MediaLibrary.VIEW_ALBUMARTISTS; + mFields = new String[] { MediaLibrary.ContributorColumns.ALBUMARTIST }; + mFieldKeys = new String[] { MediaLibrary.ContributorColumns.ALBUMARTIST_SORT }; + mSortEntries = new int[] { R.string.title, R.string.date_added }; + mAdapterSortValues = new String[] { MediaLibrary.ContributorColumns.ALBUMARTIST_SORT+" %1$s", MediaLibrary.ContributorColumns.MTIME+" %1$s" }; + break; + case MediaUtils.TYPE_COMPOSER: + mSource = MediaLibrary.VIEW_COMPOSERS; + mFields = new String[] { MediaLibrary.ContributorColumns.COMPOSER }; + mFieldKeys = new String[] { MediaLibrary.ContributorColumns.COMPOSER_SORT }; + mSortEntries = new int[] { R.string.title, R.string.date_added }; + mAdapterSortValues = new String[] { MediaLibrary.ContributorColumns.COMPOSER_SORT+" %1$s", MediaLibrary.ContributorColumns.MTIME+" %1$s" }; + break; + case MediaUtils.TYPE_ALBUM: + mSource = MediaLibrary.VIEW_ALBUMS_ARTISTS; + mFields = new String[] { MediaLibrary.AlbumColumns.ALBUM, MediaLibrary.ContributorColumns.ARTIST, MediaLibrary.SongColumns.DURATION }; + mFieldKeys = new String[] { MediaLibrary.AlbumColumns.ALBUM_SORT, MediaLibrary.ContributorColumns.ARTIST_SORT }; + mSortEntries = new int[] { R.string.title, R.string.artist_album, R.string.year, R.string.date_added, R.string.duration }; + mAdapterSortValues = new String[] { MediaLibrary.AlbumColumns.ALBUM_SORT+" %1$s", + MediaLibrary.ContributorColumns.ARTIST_SORT+" %1$s,"+MediaLibrary.AlbumColumns.ALBUM_SORT+" %1$s", + MediaLibrary.AlbumColumns.PRIMARY_ALBUM_YEAR+" %1$s", MediaLibrary.AlbumColumns.MTIME+" %1$s", + MediaLibrary.SongColumns.DURATION+" %1$s" }; + break; + case MediaUtils.TYPE_SONG: + mSource = MediaLibrary.VIEW_SONGS_ALBUMS_ARTISTS; + mFields = new String[] { MediaLibrary.SongColumns.TITLE, MediaLibrary.AlbumColumns.ALBUM, MediaLibrary.ContributorColumns.ARTIST, MediaLibrary.SongColumns.DURATION }; + mFieldKeys = new String[] { MediaLibrary.SongColumns.TITLE_SORT, MediaLibrary.AlbumColumns.ALBUM_SORT, MediaLibrary.ContributorColumns.ARTIST_SORT, null }; + mSortEntries = new int[] { R.string.title, R.string.artist_album_track, R.string.artist_album_title, R.string.album_track, R.string.year, R.string.date_added, + R.string.song_playcount, R.string.filename, R.string.duration }; + mAdapterSortValues = new String[] { MediaLibrary.SongColumns.TITLE_SORT+" %1$s", + MediaLibrary.ContributorColumns.ARTIST_SORT+" %1$s,"+MediaLibrary.AlbumColumns.ALBUM_SORT+" %1$s,"+MediaLibrary.SongColumns.DISC_NUMBER+","+MediaLibrary.SongColumns.SONG_NUMBER, + MediaLibrary.ContributorColumns.ARTIST_SORT+" %1$s,"+MediaLibrary.AlbumColumns.ALBUM_SORT+" %1$s,"+MediaLibrary.SongColumns.TITLE_SORT+" %1$s", + MediaLibrary.AlbumColumns.ALBUM_SORT+" %1$s,"+MediaLibrary.SongColumns.DISC_NUMBER+","+MediaLibrary.SongColumns.SONG_NUMBER, + MediaLibrary.SongColumns.YEAR+" %1$s,"+MediaLibrary.AlbumColumns.ALBUM_SORT+" %1$s,"+MediaLibrary.SongColumns.DISC_NUMBER+","+MediaLibrary.SongColumns.SONG_NUMBER, + MediaLibrary.SongColumns.MTIME+" %1$s,"+MediaLibrary.SongColumns.DISC_NUMBER+","+MediaLibrary.SongColumns.SONG_NUMBER, + MediaLibrary.SongColumns.PLAYCOUNT+" %1$s,"+MediaLibrary.SongColumns.DISC_NUMBER+","+MediaLibrary.SongColumns.SONG_NUMBER, + MediaLibrary.SongColumns.PATH+" %1$s", + MediaLibrary.SongColumns.DURATION+" %1$s", + }; + // Songs covers are cached per-album + mCoverCacheType = MediaUtils.TYPE_ALBUM; + coverCacheKey = MediaStore.Audio.Albums.ALBUM_ID; + break; + case MediaUtils.TYPE_PLAYLIST: + mSource = MediaLibrary.VIEW_PLAYLISTS; + mFields = new String[] { MediaLibrary.PlaylistColumns.NAME, MediaLibrary.SongColumns.DURATION }; + mFieldKeys = new String[] { MediaLibrary.PlaylistColumns.NAME_SORT }; + mSortEntries = new int[] { R.string.title, R.string.date_added, R.string.duration }; + mAdapterSortValues = new String[] { MediaLibrary.PlaylistColumns.NAME_SORT+" %1$s", MediaLibrary.PlaylistColumns._ID+" %1$s", + MediaLibrary.SongColumns.DURATION+" %1$s" }; + mExpandable = true; + break; + case MediaUtils.TYPE_GENRE: + mSource = MediaLibrary.TABLE_GENRES; + mFields = new String[] { MediaLibrary.GenreColumns._GENRE }; + mFieldKeys = new String[] { MediaLibrary.GenreColumns._GENRE_SORT }; + mSortEntries = new int[] { R.string.title }; + mAdapterSortValues = new String[] { MediaLibrary.GenreColumns._GENRE_SORT+" %1$s" }; + break; + default: + throw new IllegalArgumentException("Invalid value for type: " + type); + } + + + mProjection = new String[mFields.length + 2]; + mProjection[0] = BaseColumns._ID; + mProjection[1] = coverCacheKey; + for (int i = 0; i < mFields.length; i++) { + mProjection[i + 2] = mFields[i]; + } + } + + /** + * Returns first sort column for this adapter. Ensure {@link #mSortMode} is correctly set + * prior to calling this. + * + * @return string representing sort column to be used in projection. + * If the column is binary, returns its human-readable counterpart instead. + */ + private String getFirstSortColumn() { + int mode = mSortMode < 0 ? ~mSortMode : mSortMode; // get current sort mode + String column = SPACE_SPLIT.split(mAdapterSortValues[mode])[0]; + if(column.endsWith("_sort")) { // we want human-readable string, not machine-composed + column = column.substring(0, column.length() - 5); + } + + return column; + } + + /** + * Set whether or not the expander button should be shown in each row. + * Defaults to true for playlist adapter and false for all others. + * + * @param expandable True to show expander, false to hide. + */ + public void setExpandable(boolean expandable) + { + if (expandable != mExpandable) { + mExpandable = expandable; + notifyDataSetChanged(); + } + } + + @Override + public void setFilter(String filter) + { + mConstraint = filter; + } + + /** + * Build the query to be run with runQuery(). + * + * @param projection The columns to query. + * @param returnSongs return songs instead of mType if true. + */ + private QueryTask buildQuery(String[] projection, boolean returnSongs) { + String source = mSource; + String constraint = mConstraint; + Limiter limiter = mLimiter; + + StringBuilder selection = new StringBuilder(); + String[] selectionArgs = null; + String[] enrichedProjection = projection; + + // Assemble the sort string as requested by the user + int mode = getSortModeIndex(); + String sortDir = isSortDescending() ? "DESC" : "ASC"; + + // Fetch current sorting mode and sort by disc+track if we are going to look up the songs table + String sortRaw = mAdapterSortValues[mode]; + if (returnSongs) { + // songs returned from the artist tab should also sort by album + if (mType == MediaUtils.TYPE_ARTIST) // fixme: composer? + sortRaw += ", "+MediaLibrary.AlbumColumns.ALBUM_SORT+" %1$s"; + // and this is for all types: + sortRaw += ", "+MediaLibrary.SongColumns.DISC_NUMBER+", "+MediaLibrary.SongColumns.SONG_NUMBER; + } + + // ...and assemble the SQL string we are really going to use + String sort = String.format(sortRaw, sortDir); + + // include the constraint (aka: search string) if any + if (constraint != null && constraint.length() != 0) { + String colKey = MediaLibrary.keyFor(constraint); + String spaceColKey = DatabaseUtils.getCollationKey(" "); + String[] needles = colKey.split(spaceColKey); + String[] keySource = mFieldKeys; + + int size = needles.length; + selectionArgs = new String[size]; + + StringBuilder keys = new StringBuilder(20); + keys.append(keySource[0]); + for (int j = 1; j != keySource.length; ++j) { + String src = keySource[j]; + if (src != null) { + keys.append("||"); + keys.append(src); + } + } + + for (int j = 0; j != needles.length; ++j) { + selectionArgs[j] = '%' + needles[j] + '%'; + + // If we have something in the selection args (i.e. j > 0), we + // must have something in the selection, so we can skip the more + // costly direct check of the selection length. + if (j != 0 || selection.length() != 0) + selection.append(" AND "); + selection.append(keys); + selection.append(" LIKE ?"); + } + } + + if (limiter != null) { + if (selection.length() != 0) { + selection.append(" AND "); + } + selection.append(limiter.data); + } + + if (returnSongs == true) { + source = MediaLibrary.VIEW_SONGS_ALBUMS_ARTISTS_HUGE; + } else { + enrichedProjection = Arrays.copyOf(projection, projection.length + 1); + enrichedProjection[projection.length] = getFirstSortColumn(); + } + + QueryTask query = new QueryTask(source, enrichedProjection, selection.toString(), selectionArgs, sort); + return query; + } + + @Override + public Cursor query() + { + return buildQuery(mProjection, false).runQuery(mContext); + } + + @Override + public void commitQuery(Object data) + { + changeCursor((Cursor)data); + } + + /** + * Build a query for all the songs represented by this adapter, for adding + * to the timeline. + * + * @param projection The columns to query. + */ + @Override + public QueryTask buildSongQuery(String[] projection) + { + QueryTask query = buildQuery(projection, true); + query.type = mType; + return query; + } + + @Override + public void clear() + { + changeCursor(null); + } + + @Override + public int getMediaType() + { + return mType; + } + + @Override + public void setLimiter(Limiter limiter) + { + mLimiter = limiter; + } + + @Override + public Limiter getLimiter() + { + return mLimiter; + } + + @Override + public Limiter buildLimiter(long id) + { + String[] fields; + Object data; + + Cursor cursor = mCursor; + if (cursor == null) + return null; + for (int i = 0, count = cursor.getCount(); i != count; ++i) { + cursor.moveToPosition(i); + if (cursor.getLong(0) == id) + break; + } + + switch (mType) { + case MediaUtils.TYPE_ARTIST: + fields = new String[] { cursor.getString(2) }; + data = String.format("%s=%d", MediaLibrary.ContributorColumns.ARTIST_ID, id); + break; + case MediaUtils.TYPE_ALBARTIST: + fields = new String[] { cursor.getString(2) }; + data = String.format("%s=%d", MediaLibrary.ContributorColumns.ALBUMARTIST_ID, id); + break; + case MediaUtils.TYPE_COMPOSER: + fields = new String[] { cursor.getString(2) }; + data = String.format("%s=%d", MediaLibrary.ContributorColumns.COMPOSER_ID, id); + break; + case MediaUtils.TYPE_ALBUM: + fields = new String[] { cursor.getString(3), cursor.getString(2) }; + data = String.format("%s=%d", MediaLibrary.SongColumns.ALBUM_ID, id); + break; + case MediaUtils.TYPE_GENRE: + fields = new String[] { cursor.getString(2) }; + data = String.format("%s=%d", MediaLibrary.GenreSongColumns._GENRE_ID, id); + break; + default: + throw new IllegalStateException("getLimiter() is not supported for media type: " + mType); + } + + return new Limiter(mType, fields, data); + } + + /** + * Set a new cursor for this adapter. The old cursor will be closed. + * + * @param cursor The new cursor. + */ + public void changeCursor(Cursor cursor) + { + Cursor old = mCursor; + mCursor = cursor; + buildAlphabet(); + if (cursor == null) { + notifyDataSetInvalidated(); + } else { + notifyDataSetChanged(); + } + if (old != null) { + old.close(); + } + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) + { + DraggableRow row; + ViewHolder holder; + + if (convertView == null) { + // We must create a new view if we're not given a recycle view or + // if the recycle view has the wrong layout. + row = (DraggableRow)mInflater.inflate(R.layout.draggable_row, parent, false); + row.setupLayout(DraggableRow.LAYOUT_LISTVIEW); + + holder = new ViewHolder(); + row.setTag(holder); + + row.setDraggerOnClickListener(this); + row.showDragger(mExpandable); + } else { + row = (DraggableRow)convertView; + holder = (ViewHolder)row.getTag(); + } + + Cursor cursor = mCursor; + cursor.moveToPosition(position); + + long id = cursor.getLong(0); + long cacheId = cursor.getLong(1); + String title = cursor.getString(2); + String subtitle = null; + long duration = -1; + + // Title is never null, subtitle may be depending on the type. + title = (title == null ? DB_NULLSTRING_FALLBACK : title); + + // Add subtitle if media type has one. + switch (mType) { + case MediaUtils.TYPE_ALBUM: + case MediaUtils.TYPE_SONG: + subtitle = cursor.getString(3); + subtitle = (subtitle == null ? DB_NULLSTRING_FALLBACK : subtitle); + + // Add album information for songs. + String subsub = (mType == MediaUtils.TYPE_SONG ? cursor.getString(4) : null); + subtitle += (subsub != null ? " · " + subsub : ""); + break; + } + + // Pick up duration + switch (mType) { + case MediaUtils.TYPE_ALBUM: + duration = cursor.getLong(4); + break; + case MediaUtils.TYPE_SONG: + duration = cursor.getLong(5); + break; + case MediaUtils.TYPE_PLAYLIST: + duration = cursor.getLong(3); + break; + } + + holder.id = id; + holder.title = title; + + if (subtitle == null) { + row.setText(title); + } else { + row.setText(title, subtitle); + } + row.showDuration(duration != -1); + row.setDuration(duration); + row.getCoverView().setCover(mCoverCacheType, cacheId, holder.title); + return row; + } + + /** + * Returns the type of the current limiter. + * + * @return One of MediaUtils.TYPE_, or MediaUtils.TYPE_INVALID if there is + * no limiter set. + */ + public int getLimiterType() + { + Limiter limiter = mLimiter; + if (limiter != null) + return limiter.type; + return MediaUtils.TYPE_INVALID; + } + + /** + * {@inheritDoc} + */ + @Override + public int getDefaultSortMode() + { + int type = mType; + if (type == MediaUtils.TYPE_ALBUM || type == MediaUtils.TYPE_SONG) + return 1; // aritst,album,track + return 0; + } + + /** + * {@inheritDoc} + */ + @Override + public String getSortSettingsKey() { + return String.format("sort_%d_%d", getMediaType(), getLimiterType()); + } + + /** + * Creates an intent to dispatch + */ + @Override + public Intent createData(View view) + { + ViewHolder holder = (ViewHolder)view.getTag(); + Intent intent = new Intent(); + intent.putExtra(LibraryAdapter.DATA_TYPE, mType); + intent.putExtra(LibraryAdapter.DATA_ID, holder.id); + intent.putExtra(LibraryAdapter.DATA_TITLE, holder.title); + intent.putExtra(LibraryAdapter.DATA_EXPANDABLE, mExpandable); + return intent; + } + + /** + * Callback of array clicks (item clicks are handled in LibraryPagerAdapter) + */ + @Override + public void onClick(View view) + { + int id = view.getId(); + view = (View)view.getParent(); // get view of linear layout, not the click consumer + Intent intent = createData(view); + mActivity.onItemExpanded(intent); + } + + @Override + public int getCount() + { + Cursor cursor = mCursor; + if (cursor == null) + return 0; + return cursor.getCount(); + } + + @Override + public Object getItem(int position) + { + return null; + } + + @Override + public long getItemId(int position) + { + Cursor cursor = mCursor; + if (cursor == null || cursor.getCount() == 0) + return 0; + cursor.moveToPosition(position); + return cursor.getLong(0); + } + + @Override + public boolean hasStableIds() + { + return true; + } + + /** + * Helper class for building an alphabet. + * Contains a hint that is shown in fast scroll thumb popup and a position where this hint + * has appeared first. + */ + private class SectionIndex + { + + public SectionIndex(Object hint, int position) { + this.hint = hint; + this.position = position; + } + + private Object hint; + private int position; + + @Override + public String toString() { + return String.valueOf(hint); + } + } + + /** + * Build alphabet for fast-scroller. Detects automatically whether we're sorting + * on string-type (e.g. title or album) or integer type (e.g. year). + * + * <p/>Alphabet building is only performed if applicable, i.e. magic playcount sort + * or sort by date added will yield no results as the section hints would not be + * human-readable. + * + * <p/>Note: This clears alphabet in case current cursor is invalid. + */ + private void buildAlphabet() + { + mAlphabet.clear(); + + Cursor cursor = mCursor; + if(cursor == null || cursor.getCount() == 0) { + return; + } + + String columnName = getFirstSortColumn(); + int sortColumnIndex = cursor.getColumnIndex(columnName); + if(sortColumnIndex <= 0) { + // either projection doesn't contain this column + // or the column is _id (e.g. sort by date added), + // no point in building + return; + } + + cursor.moveToFirst(); + + SimpleDateFormat dfmt = new SimpleDateFormat("yyyy-MM-dd"); + String lastString = null; + Object lastKnown = null; + Object next; + do { + int type = cursor.getType(sortColumnIndex); + switch (type) { + case Cursor.FIELD_TYPE_NULL: + next = DB_NULLSTRING_FALLBACK; + break; + case Cursor.FIELD_TYPE_INTEGER: + int value = cursor.getInt(sortColumnIndex); + if (columnName.equals(MediaLibrary.SongColumns.MTIME)) { + next = dfmt.format(new Date(value * 1000L)); + } else if (columnName.equals(MediaLibrary.SongColumns.DURATION)) { + next = DateUtils.formatElapsedTime(value / 1000); + } else { + next = value; + } + break; + case Cursor.FIELD_TYPE_STRING: + lastString = cursor.getString(sortColumnIndex); + lastString = lastString.trim().toUpperCase(); // normalize + + // This is what AOSP's MediaStore.java:1337 does during indexing + if (lastString.startsWith("THE ")) + lastString = lastString.substring(4); + + if (lastString.startsWith("AN ")) + lastString = lastString.substring(3); + + if (lastString.startsWith("A ")) + lastString = lastString.substring(2); + + // Ensure that we got at least one char + if (lastString.length() < 1) + lastString = DB_NULLSTRING_FALLBACK; + + next = lastString.charAt(0); + break; + default: + continue; + } + if (!next.equals(lastKnown)) { // new char + mAlphabet.add(new SectionIndex(next, cursor.getPosition())); + lastKnown = next; + } + } while (cursor.moveToNext()); + } + + @Override + public Object[] getSections() + { + return mAlphabet.toArray(new SectionIndex[mAlphabet.size()]); + } + + @Override + public int getPositionForSection(int sectionIndex) + { + // clip to start + if(sectionIndex < 0) { + return 0; + } + + // clip to end + if(sectionIndex >= mAlphabet.size()) { + return mCursor.getCount() - 1; + } + + return mAlphabet.get(sectionIndex).position; + } + + @Override + public int getSectionForPosition(int position) + { + for(int i = 0; i < mAlphabet.size(); ++i) { + if(mAlphabet.get(i).position > position) + return i - 1; + } + return 0; + } +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/MediaButtonReceiver.java b/app/src/main/java/ch/blinkenlights/android/vanilla/MediaButtonReceiver.java new file mode 100644 index 0000000..00c2071 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/MediaButtonReceiver.java @@ -0,0 +1,181 @@ +/* + * Copyright (C) 2016 Adrian Ulrich <adrian@blinkenlights.ch> + * Copyright (C) 2012 Christopher Eby <kreed@kreed.org> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package ch.blinkenlights.android.vanilla; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.net.Uri; +import android.os.SystemClock; +import android.os.Handler; +import android.view.KeyEvent; + +/** + * Receives media button events and calls to PlaybackService to respond + * appropriately. + * + * Most of this logic is only needed for RemoteControlImplICS (like double-click) + * as >= LP devices handle this using the MediaSessionCompat. + */ +public class MediaButtonReceiver extends BroadcastReceiver { + /** + * If another button event is received before this time in milliseconds + * expires, the event with be considered a double click. + */ + private static final int DOUBLE_CLICK_DELAY = 600; + + /** + * Time of the last play/pause click. Used to detect double-clicks. + */ + private static long sLastClickTime = 0; + + /** + * Process a media button key press. + * + * @param context A context to use. + * @param event The key press event. + * @return True if the event was handled and the broadcast should be + * aborted. + */ + public static boolean processKey(Context context, KeyEvent event) + { + if (event == null) + return false; + + int action = event.getAction(); + String act = null; + + switch (event.getKeyCode()) { + case KeyEvent.KEYCODE_HEADSETHOOK: + case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE: + // single click: pause/resume. + // double click: next track + // triple click: previous track + if (action == KeyEvent.ACTION_DOWN) { + long time = SystemClock.uptimeMillis(); + if (time - sLastClickTime < DOUBLE_CLICK_DELAY) { + Handler handler = new Handler(); + DelayedClickCounter dcc = new DelayedClickCounter(context, time); + handler.postDelayed(dcc, DOUBLE_CLICK_DELAY); + } else { + act = PlaybackService.ACTION_TOGGLE_PLAYBACK; + } + sLastClickTime = time; + } + break; + case KeyEvent.KEYCODE_MEDIA_NEXT: + if (action == KeyEvent.ACTION_DOWN) + act = PlaybackService.ACTION_NEXT_SONG_AUTOPLAY; + break; + case KeyEvent.KEYCODE_MEDIA_PREVIOUS: + if (action == KeyEvent.ACTION_DOWN) + act = PlaybackService.ACTION_PREVIOUS_SONG_AUTOPLAY; + break; + case KeyEvent.KEYCODE_MEDIA_PLAY: + if (action == KeyEvent.ACTION_DOWN) + act = PlaybackService.ACTION_PLAY; + break; + case KeyEvent.KEYCODE_MEDIA_PAUSE: + case KeyEvent.KEYCODE_MEDIA_STOP: + // We will behave the same as Google Play Music: for "Stop" we unconditionally Pause instead + if (action == KeyEvent.ACTION_DOWN) + act = PlaybackService.ACTION_PAUSE; + break; + default: + return false; + } + + runAction(context, act); + return true; + } + + + /** + * Passes an action to PlaybackService + * + * @param context the context to use + * @param act the action to pass on + */ + private static void runAction(Context context, String act) { + if (act == null) + return; + + Intent intent = new Intent(context, PlaybackService.class) + .setAction(act) + .putExtra(PlaybackService.EXTRA_FORCE_NOTIFICATION, true) + .putExtra(PlaybackService.EXTRA_EARLY_NOTIFICATION, true); + context.startForegroundService(intent); + } + + + /** + * Runable to run a delayed action + * Inspects sLastClickTime and sDelayedClicks to guess what to do + * Note: this is only used on pre-lolipop devices. + * + * @param context the context to use + * @param serial the value of sLastClickTime during creation, used to identify stale events + */ + private static class DelayedClickCounter implements Runnable { + private Context mContext; + private long mSerial; + private static int sDelayedClicks; + + public DelayedClickCounter(Context context, long serial) { + mContext = context; + mSerial = serial; + } + + @Override + public void run() { + sDelayedClicks++; + if (mSerial != sLastClickTime) + return; // just count the click, don't fire. + + String act = null; + switch (sDelayedClicks) { + case 1: + act = PlaybackService.ACTION_NEXT_SONG_AUTOPLAY; + break; + default: + act = PlaybackService.ACTION_PREVIOUS_SONG_AUTOPLAY; + } + sDelayedClicks = 0; + runAction(mContext, act); + } + } + + + + @Override + public void onReceive(Context context, Intent intent) + { + if (Intent.ACTION_MEDIA_BUTTON.equals(intent.getAction())) { + KeyEvent event = intent.getParcelableExtra(Intent.EXTRA_KEY_EVENT); + boolean handled = processKey(context, event); + if (handled && isOrderedBroadcast()) + abortBroadcast(); + } + } +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/MediaFoldersSelectionActivity.java b/app/src/main/java/ch/blinkenlights/android/vanilla/MediaFoldersSelectionActivity.java new file mode 100644 index 0000000..5d04280 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/MediaFoldersSelectionActivity.java @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2017 Adrian Ulrich <adrian@blinkenlights.ch> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package ch.blinkenlights.android.vanilla; + +import ch.blinkenlights.android.medialibrary.MediaLibrary; + +import android.app.Activity; +import android.os.Bundle; +import android.content.SharedPreferences; + +import java.io.File; +import java.util.ArrayList; + +public class MediaFoldersSelectionActivity extends FolderPickerActivity { + + private SharedPreferences.Editor mPrefEditor; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setTitle(R.string.media_folders_header); + + MediaLibrary.Preferences prefs = MediaLibrary.getPreferences(this); + File startPath = FileUtils.getFilesystemBrowseStart(this); + + // Setup UI and enable tritastic options. + enableTritasticSelect(true, prefs.mediaFolders, prefs.blacklistedFolders); + enableTritasticSpinner(true); + // ...and jump to the folder. + setCurrentDir(startPath); + } + + + @Override + public void onFolderPicked(File directory, ArrayList<String> included, ArrayList<String> excluded) { + MediaLibrary.Preferences prefs = MediaLibrary.getPreferences(this); + prefs.mediaFolders = included; + prefs.blacklistedFolders = excluded; + MediaLibrary.setPreferences(this, prefs); + finish(); + } + +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/MediaSessionTracker.java b/app/src/main/java/ch/blinkenlights/android/vanilla/MediaSessionTracker.java new file mode 100644 index 0000000..4660f1d --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/MediaSessionTracker.java @@ -0,0 +1,140 @@ +/* + * Copyright (C) 2021 Adrian Ulrich <adrian@blinkenlights.ch> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package ch.blinkenlights.android.vanilla; + +import android.content.Context; +import android.graphics.Bitmap; +import android.support.v4.media.session.MediaSessionCompat; +import android.support.v4.media.session.PlaybackStateCompat; +import android.support.v4.media.MediaMetadataCompat; +import android.view.KeyEvent; + +/** + * Manages our active media session which is responsible for keeping + * the notification seek bar up to date and handling key events. + */ +public class MediaSessionTracker { + /** + * Context we are working with. + */ + private Context mContext; + /** + * Our generic MediaSession + */ + private MediaSessionCompat mMediaSession; + + + MediaSessionTracker(Context context) { + mContext = context; + mMediaSession = new MediaSessionCompat(mContext, "Vanilla Music Media Session"); + mMediaSession.setCallback(new MediaSessionCompat.Callback() { + @Override + public void onPause() { + MediaButtonReceiver.processKey(mContext, new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_HEADSETHOOK)); + } + @Override + public void onPlay() { + MediaButtonReceiver.processKey(mContext, new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_HEADSETHOOK)); + } + @Override + public void onSkipToNext() { + MediaButtonReceiver.processKey(mContext, new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_MEDIA_NEXT)); + } + @Override + public void onSkipToPrevious() { + MediaButtonReceiver.processKey(mContext, new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_MEDIA_PREVIOUS)); + } + @Override + public void onStop() { + // We will behave the same as Google Play Music: for "Stop" we unconditionally Pause instead + MediaButtonReceiver.processKey(mContext, new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_MEDIA_PAUSE)); + } + @Override + public void onSeekTo(long pos) { + PlaybackService.get(mContext).seekToPosition((int)pos); + }}); + mMediaSession.setActive(true); + } + + /** + * Returns the session token of the media session. + */ + public MediaSessionCompat.Token getSessionToken() { + return mMediaSession.getSessionToken(); + } + + /** + * Cleans up the underlying media session + */ + public void release() { + mMediaSession.setActive(false); + mMediaSession.release(); + } + + /** + * Populates the active media session with new info. + * + * @param song The song containing the new metadata. + * @param state PlaybackService state, used to determine playback state. + */ + public void updateSession(Song song, int state) { + final boolean playing = (state & PlaybackService.FLAG_PLAYING) != 0; + final PlaybackService service = PlaybackService.get(mContext); + + PlaybackStateCompat playbackState = new PlaybackStateCompat.Builder() + .setState(playing ? PlaybackStateCompat.STATE_PLAYING : PlaybackStateCompat.STATE_PAUSED, + service.getPosition(), 1.0f) + .setActions(PlaybackStateCompat.ACTION_PLAY | + PlaybackStateCompat.ACTION_STOP | + PlaybackStateCompat.ACTION_PAUSE | + PlaybackStateCompat.ACTION_PLAY_PAUSE | + PlaybackStateCompat.ACTION_SEEK_TO | + PlaybackStateCompat.ACTION_SKIP_TO_NEXT | + PlaybackStateCompat.ACTION_SKIP_TO_PREVIOUS) + .build(); + + if (song != null) { + final Bitmap cover = song.getMediumCover(mContext); + MediaMetadataCompat.Builder metadataBuilder = new MediaMetadataCompat.Builder() + .putString(MediaMetadataCompat.METADATA_KEY_ARTIST, song.artist) + .putString(MediaMetadataCompat.METADATA_KEY_ALBUM, song.album) + .putString(MediaMetadataCompat.METADATA_KEY_TITLE, song.title) + .putLong(MediaMetadataCompat.METADATA_KEY_DURATION, song.duration); + + boolean showCover = SharedPrefHelper.getSettings(mContext).getBoolean(PrefKeys.COVER_ON_LOCKSCREEN, PrefDefaults.COVER_ON_LOCKSCREEN); + if (showCover) { + metadataBuilder.putBitmap(MediaMetadataCompat.METADATA_KEY_ALBUM_ART, cover); + } + + // logic copied from FullPlaybackActivity.updateQueuePosition() + if (PlaybackService.finishAction(service.getState()) != SongTimeline.FINISH_RANDOM) { + metadataBuilder.putLong(MediaMetadataCompat.METADATA_KEY_TRACK_NUMBER, service.getTimelinePosition() + 1); + metadataBuilder.putLong(MediaMetadataCompat.METADATA_KEY_NUM_TRACKS, service.getTimelineLength()); + } + mMediaSession.setMetadata(metadataBuilder.build()); + } + + mMediaSession.setPlaybackState(playbackState); + mMediaSession.setActive(true); + } +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/MediaUtils.java b/app/src/main/java/ch/blinkenlights/android/vanilla/MediaUtils.java new file mode 100644 index 0000000..18aff3b --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/MediaUtils.java @@ -0,0 +1,675 @@ +/* + * Copyright (C) 2010, 2011 Christopher Eby <kreed@kreed.org> + * Copyright (C) 2017-2018 Adrian Ulrich <adrian@blinkenlights.ch> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package ch.blinkenlights.android.vanilla; + +import ch.blinkenlights.android.medialibrary.MediaLibrary; +import ch.blinkenlights.android.medialibrary.MediaMetadataExtractor; + +import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; + +import android.util.Log; + +import android.content.ActivityNotFoundException; +import android.content.Context; +import android.content.Intent; +import android.database.Cursor; +import android.net.Uri; +import android.os.Environment; +import android.provider.MediaStore; +import android.database.MatrixCursor; +import android.widget.Toast; + +import androidx.core.content.FileProvider; + + +/** + * Provides some static Song/MediaStore-related utility functions. + */ +public class MediaUtils { + /** + * A special invalid media type. + */ + public static final int TYPE_INVALID = -1; + /** + * Type indicating an id represents an artist. + */ + public static final int TYPE_ARTIST = 0; + /** + * Type indicating an id represents an album. + */ + public static final int TYPE_ALBUM = 1; + /** + * Type indicating an id represents a song. + */ + public static final int TYPE_SONG = 2; + /** + * Type indicating an id represents a playlist. + */ + public static final int TYPE_PLAYLIST = 3; + /** + * Type indicating ids represent genres. + */ + public static final int TYPE_GENRE = 4; + /** + * Type indicating an id represents an albumartist + */ + public static final int TYPE_ALBARTIST = 5; + /** + * Type indicating an id represents a composer + */ + public static final int TYPE_COMPOSER = 6; + /** + * Special type for files and folders. Most methods do not accept this type + * since files have no MediaStore id and require special handling. + */ + public static final int TYPE_FILE = 7; + /** + * The number of different valid media types. + */ + public static final int TYPE_COUNT = 8; + + /** + * The default sort order for media queries. First artist, then album, then + * song number. + */ + private static final String DEFAULT_SORT = "artist_sort,album_sort,disc_num,song_num"; + + /** + * The default sort order for albums. First the album, then songnumber + */ + private static final String ALBUM_SORT = "album_sort,disc_num,song_num"; + + /** + * The default sort order for files. Simply use the path + */ + private static final String FILE_SORT = "path"; + + /** + * The number of files that are added when "play all" selects + * files from the file-system. + */ + private static final int MAX_QUEUED_FILES = 500; + + /** + * Cached random instance. + */ + private static Random sRandom; + + /** + * Shuffled list of all songs in the library. + */ + private static ArrayList<Song> sAllSongs = new ArrayList<Song>(); + /** + * True if sAllSongs was shuffled by album. + */ + private static boolean sAllSongsAS; + + /** + * Total number of songs in the music library, or -1 for uninitialized. + */ + private static int sSongCount = -1; + + /** + * Returns a cached random instanced, creating it if necessary. + */ + public static Random getRandom() + { + if (sRandom == null) + sRandom = new Random(); + return sRandom; + } + + /** + * Builds a query that will return all the songs represented by the given + * parameters. + * + * @param type MediaUtils.TYPE_ARTIST, TYPE_ALBUM, or TYPE_SONG. + * @param id The MediaStore id of the song, artist, or album. + * @param projection The columns to query. + * @param select An extra selection to pass to the query, or null. + * @return The initialized query. + */ + private static QueryTask buildMediaQuery(int type, long id, String[] projection, String select) + { + StringBuilder selection = new StringBuilder(); + String sort = DEFAULT_SORT; + + if (select != null) { + selection.append(select); + selection.append(" AND "); + } + + switch (type) { + case TYPE_SONG: + selection.append(MediaLibrary.SongColumns._ID); + break; + case TYPE_ARTIST: + selection.append(MediaLibrary.ContributorColumns.ARTIST_ID); + break; + case TYPE_ALBARTIST: + selection.append(MediaLibrary.ContributorColumns.ALBUMARTIST_ID); + break; + case TYPE_COMPOSER: + selection.append(MediaLibrary.ContributorColumns.COMPOSER_ID); + break; + case TYPE_ALBUM: + selection.append(MediaLibrary.SongColumns.ALBUM_ID); + sort = ALBUM_SORT; + break; + case TYPE_GENRE: + selection.append(MediaLibrary.GenreSongColumns._GENRE_ID); + break; + default: + throw new IllegalArgumentException("Invalid type specified: " + type); + } + + selection.append('='); + selection.append(id); + + QueryTask result = new QueryTask(MediaLibrary.VIEW_SONGS_ALBUMS_ARTISTS, projection, selection.toString(), null, sort); + result.type = type; + return result; + } + + /** + * Builds a query that will return all the songs in the playlist with the + * given id. + * + * @param id The id of the playlist in MediaStore.Audio.Playlists. + * @param projection The columns to query. + * @return The initialized query. + */ + public static QueryTask buildPlaylistQuery(long id, String[] projection) { + String sort = MediaLibrary.PlaylistSongColumns.POSITION; + String selection = MediaLibrary.PlaylistSongColumns.PLAYLIST_ID+"="+id; + QueryTask result = new QueryTask(MediaLibrary.VIEW_PLAYLISTS_SONGS, projection, selection, null, sort); + result.type = TYPE_PLAYLIST; + return result; + } + + /** + * Builds a query with the given information. + * + * @param type Type the id represents. Must be one of the Song.TYPE_* + * constants. + * @param id The id of the element in the MediaStore content provider for + * the given type. + * @param selection An extra selection to be passed to the query. May be + * null. Must not be used with type == TYPE_SONG or type == TYPE_PLAYLIST + */ + public static QueryTask buildQuery(int type, long id, String[] projection, String selection) + { + switch (type) { + case TYPE_ARTIST: + case TYPE_ALBARTIST: + case TYPE_COMPOSER: + case TYPE_ALBUM: + case TYPE_SONG: + case TYPE_GENRE: + return buildMediaQuery(type, id, projection, selection); + case TYPE_PLAYLIST: + return buildPlaylistQuery(id, projection); + default: + throw new IllegalArgumentException("Specified type not valid: " + type); + } + } + + /** + * Query the MediaStore to determine the id of the genre the song belongs + * to. + * + * @param context The context to use + * @param id The id of the song to query the genre for. + */ + public static long queryGenreForSong(Context context, long id) { + String[] projection = { MediaLibrary.GenreSongColumns._GENRE_ID }; + String query = MediaLibrary.GenreSongColumns.SONG_ID+"=?"; + String[] queryArgs = new String[] { Long.toString(id) }; + + Cursor cursor = MediaLibrary.queryLibrary(context, MediaLibrary.TABLE_GENRES_SONGS, projection, query, queryArgs, null); + if (cursor != null) { + if (cursor.moveToNext()) + return cursor.getLong(0); + cursor.close(); + } + return 0; + } + + /** + * Shuffle a Song list using Collections.shuffle(). + * + * @param albumShuffle If true, preserve the order of songs inside albums. + */ + public static void shuffle(List<Song> list, boolean albumShuffle) + { + int size = list.size(); + if (size < 2) + return; + + Random random = getRandom(); + if (albumShuffle) { + List<Song> tempList = new ArrayList<Song>(list); + Collections.sort(tempList); + + // Build map of albumId to start index in sorted list + Map<Long, Integer> albumStartIndices = new HashMap<Long, Integer>(); + int index = 0; + for (Song song : tempList) { + if (!albumStartIndices.containsKey(song.albumId)) { + albumStartIndices.put(song.albumId, index); + } + index++; + } + + //Extract album list and shuffle + List<Long> shuffledAlbums = new ArrayList<Long>(albumStartIndices.keySet()); + Collections.shuffle(shuffledAlbums, random); + + //Build Song list from album list + list.clear(); + for (Long albumId : shuffledAlbums) { + int songIndex = albumStartIndices.get(albumId); + Song song = tempList.get(songIndex); + do { + list.add(song); + songIndex++; + if (songIndex < size) { + song = tempList.get(songIndex); + } else { + break; + } + } while (albumId == song.albumId); + } + } else { + Collections.shuffle(list, random); + } + } + + /** + * Determine if any songs are available from the library. + * + * @param context The Context to use + * @return True if it's possible to retrieve any songs, false otherwise. For + * example, false could be returned if there are no songs in the library. + */ + public static boolean isSongAvailable(Context context) { + if (sSongCount == -1) { + sSongCount = MediaLibrary.getLibrarySize(context); + } + + return sSongCount != 0; + } + + /** + * Returns a list containing all the songs found on the + * device's library. + * + * @param context The Context to use + */ + private static ArrayList<Song> getAllSongs(Context context) { + QueryTask query = new QueryTask(MediaLibrary.VIEW_SONGS_ALBUMS_ARTISTS, Song.FILLED_PROJECTION, null, null, null); + Cursor cursor = query.runQuery(context); + ArrayList<Song> list = new ArrayList<Song>(); + + if (cursor == null) + return list; + + while (cursor.moveToNext()) { + Song song = new Song(-1); + song.populate(cursor); + list.add(song); + } + cursor.close(); + return list; + } + + /** + * Called if we detected a medium change + * This flushes some cached data + */ + public static void onMediaChange() + { + sSongCount = -1; + sAllSongs.clear(); + } + + /** + * Creates and sends a share intent across the system. + * @param ctx context to execute resolving on. + * @param song the song to share. + */ + public static void shareMedia(Context ctx, Song song) { + if (song == null || song.path == null) + return; + + Uri uri = null; + try { + uri = FileProvider.getUriForFile(ctx, ctx.getApplicationContext().getPackageName() + ".fileprovider", new File(song.path)); + } catch (IllegalArgumentException e) { + Toast.makeText(ctx, R.string.share_failed, Toast.LENGTH_SHORT).show(); + } + + if (uri == null) + return; // Fileprovider failed, we can not continue. + + Intent intent = new Intent(Intent.ACTION_SEND); + intent.setType("audio/*"); + intent.putExtra(Intent.EXTRA_STREAM, uri); + try { + ctx.startActivity(Intent.createChooser(intent, ctx.getString(R.string.sendto))); + } catch (ActivityNotFoundException e) { + Toast.makeText(ctx, R.string.no_receiving_apps, Toast.LENGTH_SHORT).show(); + } + } + + /** + * Returns the first matching song (or NULL) of given type + id combination + * + * @param context A Context to use. + * @param type The MediaTye to query + * @param id The id of given type to query + */ + public static Song getSongByTypeId(Context context, int type, long id) { + Song song = new Song(-1); + QueryTask query = buildQuery(type, id, Song.FILLED_PROJECTION, null); + Cursor cursor = query.runQuery(context); + if (cursor != null) { + if (cursor.getCount() > 0) { + cursor.moveToPosition(0); + song.populate(cursor); + } + cursor.close(); + } + return song.isFilled() ? song : null; + } + + /** + * Returns a list of songs randomly selected from all the songs in the Android + * MediaStore. When albumShuffle is specified, the returned list may contain all the songs + * for that album, in order. Otherwise, only one song will be returned. If no songs are + * available, the list will be empty. + * + * @param context The Context to use + * @param albumShuffle Whether or not we should shuffle by album + */ + public static List<Song> getRandomSongs(Context context, boolean albumShuffle) { + ArrayList<Song> songs = sAllSongs; + + if (songs.size() == 0 || sAllSongsAS != albumShuffle) { + sAllSongs = getAllSongs(context); + sAllSongsAS = albumShuffle; + shuffle(sAllSongs, albumShuffle); + songs = sAllSongs; + // We don't need it but know the value, we can fill the cache for free. + sSongCount = songs.size(); + } + + final List<Song> results = new ArrayList<>(); + + if (songs.size() > 0) { + + long firstAlbumId = songs.get(0).albumId; + + // if we're in album shuffle mode, we'll want to add in the entire album in one go, + // so loop through the upcoming songs and add all those that have the same album id + // as the song we initially got + boolean addMore; + do { + final Song song = songs.remove(0); + + // when in album shuffle mode, we don't want to flag any of the added songs + // as random, since manually enqueuing or changing random mode will remove every album track. + if (!albumShuffle) { + song.flags |= Song.FLAG_RANDOM; + } + + results.add(song); + addMore = albumShuffle && songs.size() > 0 && songs.get(0).albumId == firstAlbumId; + } while (addMore); + } + + return results; + } + + /** + * Delete the given file or directory recursively. + * + * @return True if successful; false otherwise. + */ + public static boolean deleteFile(File file) + { + File[] children = file.listFiles(); + if (children != null) { + for (File child : children) { + deleteFile(child); + } + } + return file.delete(); + } + + + /** + * This is an ugly hack: The tries to 'guess' if given path + * is also accessible using a fuse mount + */ + private static String sanitizeMediaPath(String path) { + + String exPath = Environment.getExternalStorageDirectory().getAbsolutePath(); + File exStorage = new File(exPath+"/Android"); + long exLastmod = exStorage.lastModified(); + + if(exLastmod > 0 && path != null) { + String pfx = path; + while(true) { + if((new File(pfx+"/Android")).lastModified() == exLastmod) { + String guessPath = exPath + path.substring(pfx.length()); + if( (new File(guessPath)).exists() ) { + path = guessPath; + break; + } + } + + pfx = (new File(pfx)).getParent(); + if(pfx == null) + break; /* hit root */ + } + } + + return path; + } + + /** + * Adds a final slash if the path points to an existing directory + */ + private static String addDirEndSlash(String path) { + if(path.length() > 0 && path.charAt(path.length()-1) != '/') { + if( (new File(path)).isDirectory() ) { + path += "/"; + } + } + return path; + } + + /** + * Build a query that will contain all the media under the given path. + * + * @param path The path, e.g. /mnt/sdcard/music/ + * @param projection The columns to query + * @param recursive whether or not to do a LIKE search, picking up child items. + * @return The initialized query. + */ + public static QueryTask buildFileQuery(String path, String[] projection, boolean recursive) + { + // Try to detect more popular mount point: + path = sanitizeMediaPath(path); + String query = MediaLibrary.SongColumns.PATH+" = ?"; + + if (recursive) { + // This is a LIKE query: add a slash to the directory if the current path + // points to an existing one. + path = addDirEndSlash(path) + "%"; + query = MediaLibrary.SongColumns.PATH+" LIKE ?"; + } + + QueryTask result = new QueryTask(MediaLibrary.VIEW_SONGS_ALBUMS_ARTISTS, projection, query, new String[]{ path }, FILE_SORT); + result.type = TYPE_FILE; + return result; + } + + /** + * Returns a (possibly empty) Cursor for given file path. + * + * For directories, it recursively adds all files contained + * in this directory. + * + * @param path The path to the file to be queried + * @return A new Cursor object + * */ + public static Cursor getCursorForFileQuery(String path) { + MatrixCursor matrixCursor = new MatrixCursor(Song.FILLED_PROJECTION); + + File directory = new File(path); + if (directory.isDirectory()) { + addDirectoryToCursor(directory, matrixCursor); + } else { + addFileToCursor(path, matrixCursor); + } + + return matrixCursor; + } + + private static void addFileToCursor(String path, MatrixCursor matrixCursor) { + MediaMetadataExtractor tags = new MediaMetadataExtractor(path); + String title = tags.getFirst(MediaMetadataExtractor.TITLE); + String album = tags.getFirst(MediaMetadataExtractor.ALBUM); + String artist = tags.getFirst(MediaMetadataExtractor.ARTIST); + String duration = tags.getFirst(MediaMetadataExtractor.DURATION); + + if (duration != null) { // looks like we will be able to play this file + // Vanilla requires each file to be identified by its unique id in the media database. + // However: This file is not in the database, so we are going to roll our own + // using the negative crc32 sum of the path value. While this is not perfect + // (the same file may be accessed using various paths) it's the fastest method + // and far good enough. + long songId = MediaLibrary.hash63(path) * -1; + if (songId > -2) + songId = -2; // must be less than -1 (-1 defines an empty song object) + + // Build minimal fake-database entry for this file + Object[] objData = new Object[] { songId, path, "", "", "", 0, 0, 0, 0, 0, 0 }; + + if (title != null) + objData[2] = title; + if (album != null) + objData[3] = album; + if (artist != null) + objData[4] = artist; + if (duration != null) + objData[7] = Long.parseLong(duration, 10); + + matrixCursor.addRow(objData); + } + } + + private static void addDirectoryToCursor(File directory, MatrixCursor matrixCursor) { + File[] files = directory.listFiles(); + if (files == null) { + return; + } + + // make sure items are returned in sorted order by the cursor + Arrays.sort(files); + + for (File file : files) { + // don't add more files endlessly, but stop after + // the given maximum number of entries + if (matrixCursor.getCount() >= MAX_QUEUED_FILES) { + break; + } + + if (file.isDirectory()) { + // recurse into this sub-directory + addDirectoryToCursor(file, matrixCursor); + } else { + addFileToCursor(file.getAbsolutePath(), matrixCursor); + } + } + } + + /** + * Returns the id's used by Androids native media database for given song + * + * @param context the context to use + * @param song the song to query + * @return long { song_id, album_id, artist_id } - all set to -1 on error + */ + public static long[] getAndroidMediaIds(Context context, Song song) { + long[] result = { -1, -1, -1 }; + String[] projection = new String[]{ MediaStore.Audio.Media._ID, MediaStore.Audio.Media.ALBUM_ID, MediaStore.Audio.Media.ARTIST_ID }; + try { + Cursor cursor = context.getContentResolver().query(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, projection, MediaStore.Audio.Media.DATA+"=?", new String[] { song.path }, null); + if (cursor != null) { + if (cursor.moveToFirst()) { + for (int i=0; i<result.length; i++) + result[i] = cursor.getLong(i); + } + cursor.close(); + } + } catch (SecurityException e) { + Log.e("VanillaMusic", "Wowies: No permission to read EXTERNAL_CONTENT_URI for song "+song.path+": "+e); + } + return result; + } + + /** + * Retrieve ID of specified media type for requested song. This works only for + * media-oriented types: {@link #TYPE_ARTIST}, {@link #TYPE_ALBUM}, {@link #TYPE_SONG} + * @param song requested song + * @param mType media type e.g. {@link #TYPE_ARTIST} + * @return ID of media type, {@link #TYPE_INVALID} if unsupported + */ + public static long getCurrentIdForType(Song song, int mType) + { + if(song == null) + return TYPE_INVALID; + + switch(mType) { + case TYPE_ARTIST: + return song.artistId; + case TYPE_ALBUM: + return song.albumId; + case TYPE_SONG: + return song.id; + default: + return TYPE_INVALID; + } + } +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/MiniPlaybackActivity.java b/app/src/main/java/ch/blinkenlights/android/vanilla/MiniPlaybackActivity.java new file mode 100644 index 0000000..2a5ad85 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/MiniPlaybackActivity.java @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2010 Christopher Eby <kreed@kreed.org> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package ch.blinkenlights.android.vanilla; + +import android.content.Intent; +import android.os.Bundle; +import android.view.View; +import android.view.Window; +import android.widget.ImageButton; + +/** + * Compact playback activity that displays itself like a dialog. That is, the + * window is not fullscreen but only as large as it needs to be. Includes a + * CoverView and control buttons. + */ +public class MiniPlaybackActivity extends PlaybackActivity { + @Override + public void onCreate(Bundle state) + { + ThemeHelper.setTheme(this, R.style.PopupDialog); + super.onCreate(state); + + requestWindowFeature(Window.FEATURE_NO_TITLE); + setContentView(R.layout.mini_playback); + + mCoverView = (CoverView)findViewById(R.id.cover_view); + mCoverView.setOnClickListener(this); + mCoverView.setup(mLooper, this, CoverBitmap.STYLE_OVERLAPPING_BOX); + + bindControlButtons(); + } + + @Override + public void onClick(View view) + { + switch (view.getId()) { + case R.id.cover_view: + startActivity(new Intent(this, FullPlaybackActivity.class)); + finish(); + break; + default: + super.onClick(view); + } + } +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/NotificationHelper.java b/app/src/main/java/ch/blinkenlights/android/vanilla/NotificationHelper.java new file mode 100644 index 0000000..3b9ba65 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/NotificationHelper.java @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2017-2021 Adrian Ulrich <adrian@blinkenlights.ch> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package ch.blinkenlights.android.vanilla; + +import android.app.Notification; +import android.app.NotificationChannel; +import android.app.NotificationManager; +import android.content.Context; +import android.graphics.Bitmap; +import androidx.core.app.NotificationCompat; + + +public class NotificationHelper { + /** + * The notification manager instance we are using. + */ + private NotificationManager mNotificationManager; + /** + * The name of the channel to use for these notifications. + */ + private String mChannelId; + + /** + * Creates and returns a new NotificationHelper. + * + * @param context the context to use. + * @param channelId the ID of the notification channel to create. + * @param name the user visible name of the channel. + */ + public NotificationHelper(Context context, String channelId, String name) { + mNotificationManager = (NotificationManager)context.getSystemService(context.NOTIFICATION_SERVICE); + mChannelId = channelId; + + NotificationChannel channel = new NotificationChannel(channelId, name, NotificationManager.IMPORTANCE_LOW); + mNotificationManager.createNotificationChannel(channel); + } + + /** + * Returns a new NotificationCompat.Builder. + * + * @param context the context to use + */ + public NotificationCompat.Builder getNewBuilder(Context context) { + return new NotificationCompat.Builder(context, mChannelId); + } + + /** + * Post a notification to be shown in the status bar. + * + * @param id the id of this notification. + * @param notification the notification to display. + */ + public void notify(int id, Notification notification) { + mNotificationManager.notify(id, notification); + } + + /** + * Cancels a notification. + * + * @param id the id to cancel + */ + public void cancel(int id) { + mNotificationManager.cancel(id); + } +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/OneCellWidget.java b/app/src/main/java/ch/blinkenlights/android/vanilla/OneCellWidget.java new file mode 100644 index 0000000..6765869 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/OneCellWidget.java @@ -0,0 +1,132 @@ +/* + * Copyright (C) 2010, 2011 Christopher Eby <kreed@kreed.org> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package ch.blinkenlights.android.vanilla; + +import android.app.PendingIntent; +import android.appwidget.AppWidgetManager; +import android.appwidget.AppWidgetProvider; +import android.content.ComponentName; +import android.content.Context; +import android.content.Intent; +import android.content.SharedPreferences; +import android.graphics.Bitmap; +import android.widget.RemoteViews; + +/** + * 1x1 widget that shows title, album art, and hidden next and play/pause + * buttons. + */ +public class OneCellWidget extends AppWidgetProvider { + private static boolean sEnabled; + + @Override + public void onEnabled(Context context) + { + sEnabled = true; + } + + @Override + public void onDisabled(Context context) + { + sEnabled = false; + } + + @Override + public void onUpdate(Context context, AppWidgetManager manager, int[] ids) + { + Song song = null; + int state = 0; + + if (PlaybackService.hasInstance()) { + PlaybackService service = PlaybackService.get(context); + song = service.getSong(0); + state = service.getState(); + } + + sEnabled = true; + updateWidget(context, manager, song, state); + } + + /** + * Check if there are any instances of this widget placed. + */ + public static void checkEnabled(Context context, AppWidgetManager manager) + { + sEnabled = manager.getAppWidgetIds(new ComponentName(context, OneCellWidget.class)).length != 0; + } + + /** + * Populate the widgets with the given ids with the given info. + * + * @param context A Context to use. + * @param manager The AppWidgetManager that will be used to update the + * widget. + * @param song The current Song in PlaybackService. + * @param state The current PlaybackService state. + */ + public static void updateWidget(Context context, AppWidgetManager manager, Song song, int state) + { + if (!sEnabled) + return; + + SharedPreferences settings = SharedPrefHelper.getSettings(context); + boolean doubleTap = settings.getBoolean(PrefKeys.DOUBLE_TAP, PrefDefaults.DOUBLE_TAP); + + RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.one_cell_widget); + + boolean playing = (state & PlaybackService.FLAG_PLAYING) != 0; + views.setImageViewResource(R.id.play_pause, playing ? R.drawable.hidden_pause : R.drawable.hidden_play); + + + Intent intent; + PendingIntent pendingIntent; + int flags = Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_TASK_ON_HOME; + + intent = ShortcutPseudoActivity.getIntent(context, doubleTap ? PlaybackService.ACTION_TOGGLE_PLAYBACK_DELAYED : PlaybackService.ACTION_TOGGLE_PLAYBACK); + pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE); + views.setOnClickPendingIntent(R.id.play_pause, pendingIntent); + + intent = ShortcutPseudoActivity.getIntent(context, doubleTap ? PlaybackService.ACTION_NEXT_SONG_DELAYED : PlaybackService.ACTION_NEXT_SONG); + pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE); + views.setOnClickPendingIntent(R.id.next, pendingIntent); + + + Bitmap cover = null; + if ((state & PlaybackService.FLAG_NO_MEDIA) != 0) { + views.setInt(R.id.title, "setText", R.string.no_songs); + } else if (song == null) { + views.setInt(R.id.title, "setText", R.string.app_name); + } else { + views.setTextViewText(R.id.title, song.title); + cover = song.getMediumCover(context); + } + + if (cover == null) { + views.setImageViewResource(R.id.cover, R.drawable.fallback_cover); + } else { + views.setImageViewBitmap(R.id.cover, cover); + } + + manager.updateAppWidget(new ComponentName(context, OneCellWidget.class), views); + } +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/PermissionRequestActivity.java b/app/src/main/java/ch/blinkenlights/android/vanilla/PermissionRequestActivity.java new file mode 100644 index 0000000..d4bf411 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/PermissionRequestActivity.java @@ -0,0 +1,163 @@ +/* + * Copyright (C) 2015-2023 Adrian Ulrich <adrian@blinkenlights.ch> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package ch.blinkenlights.android.vanilla; + + +import android.Manifest; +import android.annotation.TargetApi; +import android.app.Activity; +import android.content.pm.PackageManager; +import android.content.Context; +import android.content.Intent; +import android.view.View; +import android.view.ViewGroup; +import android.view.LayoutInflater; +import android.os.Build; +import android.os.Bundle; + +import java.util.Arrays; +import java.util.ArrayList; + +public class PermissionRequestActivity extends Activity { + + /** + * The intent to start after acquiring the required permissions + */ + private Intent mCallbackIntent; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + mCallbackIntent = getIntent().getExtras().getParcelable("callbackIntent"); + + ArrayList<String> allPerms = new ArrayList<>(Arrays.asList(getNeededPermissions())); + allPerms.addAll(Arrays.asList(getOptionalPermissions())); + + requestPermissions(allPerms.toArray(new String[0]), 0); + } + + /** + * Called by Activity after the user interacted with the permission request + * Will launch the main activity if all permissions were granted, exits otherwise + * + * @param requestCode The code set by requestPermissions + * @param permissions Names of the permissions we got granted or denied + * @param grantResults Results of the permission requests + */ + @Override + public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { + ArrayList<String> neededPerms = new ArrayList<>(Arrays.asList(getNeededPermissions())); + int grantedPermissions = 0; + + for (int i = 0; i < permissions.length; i++) { + if (!neededPerms.contains(permissions[i])) + continue; + if (grantResults[i] == PackageManager.PERMISSION_GRANTED) + grantedPermissions++; + } + + // set as finished before (possibly) killing ourselfs + finish(); + + if (grantedPermissions == neededPerms.size()) { + if (mCallbackIntent != null) { + // start the old intent but ensure to make it a new task & clear any old attached activites + mCallbackIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); + startActivity(mCallbackIntent); + } + // Hack: We *kill* ourselfs (while launching the main activity) to get startet + // in a new process: This works around a bug/feature in 6.0 that would cause us + // to get 'partial read' permissions (eg: reading from the content provider works + // but reading from /sdcard doesn't) + android.os.Process.killProcess(android.os.Process.myPid()); + } + } + + /** + * Injects a warning that we are missing read permissions into the activity layout + * + * @param activity Reference to LibraryActivity + * @param intent The intent starting the parent activity + */ + public static void showWarning(final LibraryActivity activity, final Intent intent) { + LayoutInflater inflater = LayoutInflater.from(activity); + View view = inflater.inflate(R.layout.permission_request, null, false); + + view.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + PermissionRequestActivity.requestPermissions(activity, intent); + } + }); + + ViewGroup parent = (ViewGroup)activity.findViewById(R.id.content); // main layout of library_content + parent.addView(view, -1); + } + + /** + * Launches a permission request dialog if needed + * + * @param activity The activitys context to use for the permission check + * @return boolean true if we showed a permission request dialog + */ + public static boolean requestPermissions(Activity activity, Intent callbackIntent) { + boolean havePermissions = havePermissions(activity); + + if (havePermissions == false) { + Intent intent = new Intent(activity, PermissionRequestActivity.class); + intent.putExtra("callbackIntent", callbackIntent); + activity.startActivity(intent); + } + + return !havePermissions; + } + + /** + * Checks if all required permissions have been granted + * + * @param context The context to use + * @return boolean true if all permissions have been granded + */ + public static boolean havePermissions(Context context) { + for (String permission : getNeededPermissions()) { + if (context.checkSelfPermission(permission) != PackageManager.PERMISSION_GRANTED) { + return false; + } + } + return true; + } + + private static String[] getNeededPermissions() { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { + return new String[] { Manifest.permission.READ_MEDIA_AUDIO, Manifest.permission.READ_MEDIA_IMAGES }; + } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { + return new String[] { Manifest.permission.READ_EXTERNAL_STORAGE }; + } + return new String[] { Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE }; + } + + private static String[] getOptionalPermissions() { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { + return new String[] { Manifest.permission.POST_NOTIFICATIONS }; + } + return new String[]{}; + } + +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/PlayCountsHelper.java b/app/src/main/java/ch/blinkenlights/android/vanilla/PlayCountsHelper.java new file mode 100644 index 0000000..b65c6fb --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/PlayCountsHelper.java @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2014-2016 Adrian Ulrich <adrian@blinkenlights.ch> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package ch.blinkenlights.android.vanilla; + +import ch.blinkenlights.android.medialibrary.MediaLibrary; + +import android.content.Context; +import android.database.Cursor; +import java.util.ArrayList; + +public class PlayCountsHelper { + + public PlayCountsHelper() { + } + + /** + * Counts this song object as 'played' or 'skipped' + */ + public static void countSong(Context context, Song song, boolean played) { + final long id = Song.getId(song); + MediaLibrary.updateSongPlayCounts(context, id, played); + } + + + + /** + * Returns a sorted array list of most often listen song ids + */ + public static ArrayList<Long> getTopSongs(Context context, int limit) { + ArrayList<Long> payload = new ArrayList<Long>(); + Cursor cursor = MediaLibrary.queryLibrary(context, MediaLibrary.TABLE_SONGS, new String[]{ MediaLibrary.SongColumns._ID }, MediaLibrary.SongColumns.PLAYCOUNT+" > 0", null, MediaLibrary.SongColumns.PLAYCOUNT+" DESC"); + while (cursor.moveToNext() && limit > 0) { + payload.add(cursor.getLong(0)); + limit--; + } + cursor.close(); + return payload; + } + +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/PlaybackActivity.java b/app/src/main/java/ch/blinkenlights/android/vanilla/PlaybackActivity.java new file mode 100644 index 0000000..8de1203 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/PlaybackActivity.java @@ -0,0 +1,737 @@ +/* + * Copyright (C) 2010, 2011 Christopher Eby <kreed@kreed.org> + * Copyright (C) 2014-2016 Adrian Ulrich <adrian@blinkenlights.ch> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package ch.blinkenlights.android.vanilla; + +import java.io.File; +import java.util.ArrayList; +import java.util.Map; + +import android.app.Activity; +import android.app.AlertDialog; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.SharedPreferences; +import android.content.pm.ApplicationInfo; +import android.content.res.Resources; +import android.media.AudioManager; +import android.net.Uri; +import android.os.Bundle; +import android.os.Handler; +import android.os.HandlerThread; +import android.os.Looper; +import android.os.Message; +import android.os.Process; +import android.util.Log; +import android.view.ContextMenu; +import android.view.KeyEvent; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.view.Window; +import android.view.WindowManager; +import android.widget.ImageButton; +import android.widget.Toast; + +/** + * Base activity for activities that contain playback controls. Handles + * communication with the PlaybackService and response to state and song + * changes. + */ +public abstract class PlaybackActivity extends Activity + implements TimelineCallback, + Handler.Callback, + View.OnClickListener, + CoverView.Callback +{ + + private Action mUpAction; + private Action mDownAction; + + /** + * A Handler running on the UI thread, in contrast with mHandler which runs + * on a worker thread. + */ + protected final Handler mUiHandler = new Handler(this); + /** + * A Handler running on a worker thread. + */ + protected Handler mHandler; + /** + * The looper for the worker thread. + */ + protected Looper mLooper; + + protected CoverView mCoverView; + protected ImageButton mPlayPauseButton; + protected ImageButton mShuffleButton; + protected ImageButton mEndButton; + + protected int mState; + private long mLastStateEvent; + private long mLastSongEvent; + + @Override + public void onCreate(Bundle state) + { + super.onCreate(state); + + PlaybackService.addTimelineCallback(this); + + setVolumeControlStream(AudioManager.STREAM_MUSIC); + + HandlerThread thread = new HandlerThread(getClass().getName(), Process.THREAD_PRIORITY_LOWEST); + thread.start(); + + mLooper = thread.getLooper(); + mHandler = new Handler(mLooper, this); + + } + + @Override + public void onDestroy() + { + PlaybackService.removeTimelineCallback(this); + mLooper.quit(); + super.onDestroy(); + } + + @Override + public void onStart() + { + super.onStart(); + + if (PlaybackService.hasInstance()) + onServiceReady(); + else + startService(new Intent(this, PlaybackService.class)); + + SharedPreferences prefs = SharedPrefHelper.getSettings(this); + mUpAction = Action.getAction(prefs, PrefKeys.SWIPE_UP_ACTION, PrefDefaults.SWIPE_UP_ACTION); + mDownAction = Action.getAction(prefs, PrefKeys.SWIPE_DOWN_ACTION, PrefDefaults.SWIPE_DOWN_ACTION); + + Window window = getWindow(); + + // Set lockscreen preference + if (prefs.getBoolean(PrefKeys.DISABLE_LOCKSCREEN, PrefDefaults.DISABLE_LOCKSCREEN)) + window.addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD + | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED); + else + window.clearFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD + | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED); + + // Set screen-on preference + if (prefs.getBoolean(PrefKeys.KEEP_SCREEN_ON, PrefDefaults.KEEP_SCREEN_ON)) + window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); + else + window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); + + } + + @Override + public void onResume() + { + super.onResume(); + if (PlaybackService.hasInstance()) { + PlaybackService service = PlaybackService.get(this); + service.userActionTriggered(); + } + + } + + @Override + public boolean onKeyDown(int keyCode, KeyEvent event) + { + switch (keyCode) { + case KeyEvent.KEYCODE_HEADSETHOOK: + case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE: + case KeyEvent.KEYCODE_MEDIA_NEXT: + case KeyEvent.KEYCODE_MEDIA_PREVIOUS: + return MediaButtonReceiver.processKey(this, event); + } + + return super.onKeyDown(keyCode, event); + } + + @Override + public boolean onKeyUp(int keyCode, KeyEvent event) + { + switch (keyCode) { + case KeyEvent.KEYCODE_HEADSETHOOK: + case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE: + case KeyEvent.KEYCODE_MEDIA_NEXT: + case KeyEvent.KEYCODE_MEDIA_PREVIOUS: + return MediaButtonReceiver.processKey(this, event); + } + + return super.onKeyUp(keyCode, event); + } + + @Override + public void shiftCurrentSong(int delta) + { + setSong(PlaybackService.get(this).shiftCurrentSong(delta)); + } + + public void playPause() + { + PlaybackService service = PlaybackService.get(this); + int state = service.playPause(false); + if ((state & PlaybackService.FLAG_ERROR) != 0) + showToast(service.getErrorMessage(), Toast.LENGTH_LONG); + setState(state); + } + + private void rewindCurrentSong() + { + setSong(PlaybackService.get(this).rewindCurrentSong()); + } + + + @Override + public void onClick(View view) + { + switch (view.getId()) { + case R.id.next: + shiftCurrentSong(SongTimeline.SHIFT_NEXT_SONG); + break; + case R.id.play_pause: + playPause(); + break; + case R.id.previous: + rewindCurrentSong(); + break; + case R.id.end_action: + cycleFinishAction(); + break; + case R.id.shuffle: + cycleShuffle(); + break; + } + } + + /** + * Called when the PlaybackService state has changed. + * + * @param state PlaybackService state + * @param toggled The flags that have changed from the previous state + */ + protected void onStateChange(int state, int toggled) + { + if ((toggled & PlaybackService.FLAG_PLAYING) != 0 && mPlayPauseButton != null) { + mPlayPauseButton.setImageResource((state & PlaybackService.FLAG_PLAYING) == 0 ? R.drawable.play : R.drawable.pause); + } + if ((toggled & PlaybackService.MASK_FINISH) != 0 && mEndButton != null) { + mEndButton.setImageResource(SongTimeline.FINISH_ICONS[PlaybackService.finishAction(state)]); + } + if ((toggled & PlaybackService.MASK_SHUFFLE) != 0 && mShuffleButton != null) { + mShuffleButton.setImageResource(SongTimeline.SHUFFLE_ICONS[PlaybackService.shuffleMode(state)]); + } + } + + protected void setState(final int state) + { + mLastStateEvent = System.nanoTime(); + + if (mState != state) { + final int toggled = mState ^ state; + mState = state; + runOnUiThread(new Runnable() { + @Override + public void run() + { + onStateChange(state, toggled); + } + }); + } + } + + /** + * Called by PlaybackService to update the state. + */ + public void setState(long uptime, int state) + { + if (uptime > mLastStateEvent) { + setState(state); + mLastStateEvent = uptime; + } + } + + /** + * Sets up components when the PlaybackService is initialized and available to + * interact with. Override to implement further post-initialization behavior. + */ + protected void onServiceReady() + { + PlaybackService service = PlaybackService.get(this); + setSong(service.getSong(0)); + setState(service.getState()); + } + + /** + * Called when the current song changes. + * + * @param song The new song + */ + protected void onSongChange(Song song) + { + if (mCoverView != null) + mCoverView.querySongs(); + } + + protected void setSong(final Song song) + { + mLastSongEvent = System.nanoTime(); + runOnUiThread(new Runnable() { + @Override + public void run() + { + onSongChange(song); + } + }); + } + + /** + * Sets up onClick listeners for our common control buttons bar + */ + protected void bindControlButtons() { + View previousButton = findViewById(R.id.previous); + previousButton.setOnClickListener(this); + mPlayPauseButton = (ImageButton)findViewById(R.id.play_pause); + mPlayPauseButton.setOnClickListener(this); + View nextButton = findViewById(R.id.next); + nextButton.setOnClickListener(this); + + mShuffleButton = (ImageButton)findViewById(R.id.shuffle); + mShuffleButton.setOnClickListener(this); + registerForContextMenu(mShuffleButton); + mEndButton = (ImageButton)findViewById(R.id.end_action); + mEndButton.setOnClickListener(this); + registerForContextMenu(mEndButton); + } + + /** + * Called by PlaybackService to update the current song. + */ + public void setSong(long uptime, Song song) + { + if (uptime > mLastSongEvent) { + setSong(song); + mLastSongEvent = uptime; + } + } + + /** + * Called by PlaybackService to update an active song (next, previous, or + * current). + */ + public void replaceSong(int delta, Song song) + { + if (mCoverView != null) + mCoverView.replaceSong(delta, song); + } + + /** + * Called when the song timeline position/size has changed. + */ + public void onPositionInfoChanged() + { + } + + /** + * Called when the content of the media store has changed. + */ + public void onMediaChange() + { + } + + /** + * Called when the timeline change has changed. + */ + public void onTimelineChanged() + { + } + + static final int MENU_SORT = 1; + static final int MENU_PREFS = 2; + static final int MENU_PLAYBACK = 3; + static final int MENU_SEARCH = 4; + static final int MENU_ENQUEUE = 7; // toplevel menu, has no action + static final int MENU_ENQUEUE_ALBUM = 8; + static final int MENU_ENQUEUE_ARTIST = 9; + static final int MENU_ENQUEUE_GENRE = 10; + static final int MENU_CLEAR_QUEUE = 11; + static final int MENU_SONG_FAVORITE = 12; + static final int MENU_SHOW_QUEUE = 13; + static final int MENU_HIDE_QUEUE = 14; + static final int MENU_DELETE = 15; + static final int MENU_EMPTY_QUEUE = 16; + static final int MENU_ADD_TO_PLAYLIST = 17; + static final int MENU_SHARE = 18; + static final int MENU_GO_HOME = 19; + static final int MENU_PLUGINS = 20; // used in FullPlaybackActivity + static final int MENU_MORE = 21; // toplevel menu, has no own action + static final int MENU_MORE_ALBUM = 22; + static final int MENU_MORE_ARTIST = 23; + static final int MENU_MORE_GENRE = 24; + static final int MENU_MORE_FOLDER = 25; + static final int MENU_JUMP_TO_TIME = 26; + + @Override + public boolean onCreateOptionsMenu(Menu menu) + { + menu.add(0, MENU_PREFS, 10, R.string.settings).setIcon(R.drawable.ic_menu_preferences); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) + { + switch (item.getItemId()) { + case MENU_PREFS: + startActivity(new Intent(this, PreferencesActivity.class)); + break; + case MENU_CLEAR_QUEUE: + PlaybackService.get(this).clearQueue(); + break; + case MENU_EMPTY_QUEUE: + PlaybackService.get(this).emptyQueue(); + break; + default: + return false; + } + return true; + } + + + /** + * Same as MSG_ADD_TO_PLAYLIST but creates the new playlist on-the-fly (or overwrites an existing list) + */ + protected static final int MSG_CREATE_PLAYLIST = 0; + /** + * Call renamePlaylist with the results from a NewPlaylistDialog stored in + * obj. + */ + protected static final int MSG_RENAME_PLAYLIST = 1; + /** + * Call addToPlaylist with data from the playlisttask object. + */ + protected static final int MSG_ADD_TO_PLAYLIST = 2; + /** + * Call removeFromPlaylist with data from the playlisttask object. + */ + protected static final int MSG_REMOVE_FROM_PLAYLIST = 3; + /** + * Removes a media object + */ + protected static final int MSG_DELETE = 4; + /** + * Saves the current queue as a playlist + */ + protected static final int MSG_ADD_QUEUE_TO_PLAYLIST = 5; + /** + * Notification that we changed some playlist members + */ + protected static final int MSG_NOTIFY_PLAYLIST_CHANGED = 6; + + @Override + public boolean handleMessage(Message message) + { + switch (message.what) { + case MSG_CREATE_PLAYLIST: { + PlaylistTask playlistTask = (PlaylistTask)message.obj; + int nextAction = message.arg1; + long playlistId = Playlist.createPlaylist(this, playlistTask.name); + playlistTask.playlistId = playlistId; + mHandler.sendMessage(mHandler.obtainMessage(nextAction, playlistTask)); + break; + } + case MSG_ADD_TO_PLAYLIST: { + PlaylistTask playlistTask = (PlaylistTask)message.obj; + addToPlaylist(playlistTask); + break; + } + case MSG_ADD_QUEUE_TO_PLAYLIST: { + PlaylistTask playlistTask = (PlaylistTask)message.obj; + playlistTask.audioIds = new ArrayList<Long>(); + Song song; + PlaybackService service = PlaybackService.get(this); + for (int i=0; ; i++) { + song = service.getSongByQueuePosition(i); + if (song == null) + break; + playlistTask.audioIds.add(song.id); + } + addToPlaylist(playlistTask); + break; + } + case MSG_REMOVE_FROM_PLAYLIST: { + PlaylistTask playlistTask = (PlaylistTask)message.obj; + removeFromPlaylist(playlistTask); + break; + } + case MSG_RENAME_PLAYLIST: { + PlaylistTask playlistTask = (PlaylistTask)message.obj; + Playlist.renamePlaylist(getApplicationContext(), playlistTask.playlistId, playlistTask.name); + break; + } + case MSG_DELETE: { + delete((Intent)message.obj); + break; + } + case MSG_NOTIFY_PLAYLIST_CHANGED: { + // this is a NOOP here: super classes might implement this. + break; + } + default: + return false; + } + return true; + } + + /** + * Add a set of songs represented by the playlistTask to a playlist. Displays a + * Toast notifying of success. + * + * @param playlistTask The pending PlaylistTask to execute + */ + protected void addToPlaylist(PlaylistTask playlistTask) { + int count = 0; + + if (playlistTask.query != null) { + count += Playlist.addToPlaylist(this, playlistTask.playlistId, playlistTask.query); + } + + if (playlistTask.audioIds != null) { + count += Playlist.addToPlaylist(this, playlistTask.playlistId, playlistTask.audioIds); + } + + String message = getResources().getQuantityString(R.plurals.added_to_playlist, count, count, playlistTask.name); + showToast(message, Toast.LENGTH_SHORT); + mHandler.sendEmptyMessage(MSG_NOTIFY_PLAYLIST_CHANGED); + } + + /** + * Removes a set of songs represented by the playlistTask from a playlist. Displays a + * Toast notifying of success. + * + * @param playlistTask The pending PlaylistTask to execute + */ + private void removeFromPlaylist(PlaylistTask playlistTask) { + int count = 0; + + if (playlistTask.query != null) { + throw new IllegalArgumentException("Delete by query is not implemented yet"); + } + + if (playlistTask.audioIds != null) { + count += Playlist.removeFromPlaylist(getApplicationContext(), playlistTask.playlistId, playlistTask.audioIds); + } + + String message = getResources().getQuantityString(R.plurals.removed_from_playlist, count, count, playlistTask.name); + showToast(message, Toast.LENGTH_SHORT); + mHandler.sendEmptyMessage(MSG_NOTIFY_PLAYLIST_CHANGED); + } + + /** + * Delete the media represented by the given intent and show a Toast + * informing the user of this. + * + * @param intent An intent created with + * {@link LibraryAdapter#createData(View)}. + */ + private void delete(Intent intent) + { + int type = intent.getIntExtra("type", MediaUtils.TYPE_INVALID); + long id = intent.getLongExtra("id", LibraryAdapter.INVALID_ID); + String message = null; + Resources res = getResources(); + + if (type == MediaUtils.TYPE_FILE) { + String file = intent.getStringExtra("file"); + boolean success = MediaUtils.deleteFile(new File(file)); + if (!success) { + message = res.getString(R.string.delete_file_failed, file); + } + } else if (type == MediaUtils.TYPE_PLAYLIST) { + Playlist.deletePlaylist(this, id); + } else { + int count = PlaybackService.get(this).deleteMedia(type, id); + message = res.getQuantityString(R.plurals.deleted, count, count); + } + + if (message == null) { + message = res.getString(R.string.deleted_item, intent.getStringExtra("title")); + } + + showToast(message, Toast.LENGTH_SHORT); + } + + /** + * Creates and displays a new toast message + */ + private void showToast(final String message, final int duration) { + runOnUiThread(new Runnable() { + @Override + public void run() { + Toast.makeText(getApplicationContext(), message, duration).show(); + } + }); + } + + + /** + * Cycle shuffle mode. + */ + public void cycleShuffle() + { + setState(PlaybackService.get(this).cycleShuffle()); + } + + /** + * Cycle the finish action. + */ + public void cycleFinishAction() + { + setState(PlaybackService.get(this).cycleFinishAction()); + } + + /** + * Open the library activity. + * + * @param song If non-null, will open the library focused on this song. + * @param type the media type to switch to for 'song' + */ + public void openLibrary(Song song, int type) + { + Intent intent = new Intent(this, LibraryActivity.class); + intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + if (song != null) { + long id = -1; + String folder = null; + switch(type) { + case MediaUtils.TYPE_ARTIST: + id = song.artistId; + break; + case MediaUtils.TYPE_ALBUM: + id = song.albumId; + break; + case MediaUtils.TYPE_GENRE: + id = MediaUtils.queryGenreForSong(this, song.id); + break; + case MediaUtils.TYPE_FILE: + File file = new File(song.path); + folder = file.getParent(); + break; + default: + throw new IllegalArgumentException("Invalid media type " + type); + } + intent.putExtra("type", type); + intent.putExtra("id", id); + intent.putExtra("folder", folder); + } + startActivity(intent); + } + + @Override + public void upSwipe() + { + performAction(mUpAction); + } + + @Override + public void downSwipe() + { + performAction(mDownAction); + } + + protected void performAction(Action action) + { + PlaybackService.get(this).performAction(action, this); + } + + private static final int CTX_MENU_GRP_SHUFFLE = 200; + private static final int CTX_MENU_GRP_FINISH = 201; + + @Override + public void onCreateContextMenu(ContextMenu menu, View view, ContextMenu.ContextMenuInfo menuInfo) + { + if (view == mShuffleButton) { + menu.add(CTX_MENU_GRP_SHUFFLE, SongTimeline.SHUFFLE_NONE, 0, R.string.no_shuffle); + menu.add(CTX_MENU_GRP_SHUFFLE, SongTimeline.SHUFFLE_SONGS, 0, R.string.shuffle_songs); + menu.add(CTX_MENU_GRP_SHUFFLE, SongTimeline.SHUFFLE_ALBUMS, 0, R.string.shuffle_albums); + } else if (view == mEndButton) { + menu.add(CTX_MENU_GRP_FINISH, SongTimeline.FINISH_STOP, 0, R.string.no_repeat); + menu.add(CTX_MENU_GRP_FINISH, SongTimeline.FINISH_REPEAT, 0, R.string.repeat); + menu.add(CTX_MENU_GRP_FINISH, SongTimeline.FINISH_REPEAT_CURRENT, 0, R.string.repeat_current_song); + menu.add(CTX_MENU_GRP_FINISH, SongTimeline.FINISH_STOP_CURRENT, 0, R.string.stop_current_song); + menu.add(CTX_MENU_GRP_FINISH, SongTimeline.FINISH_RANDOM, 0, R.string.random); + } + } + + @Override + public boolean onContextItemSelected(MenuItem item) + { + int group = item.getGroupId(); + int id = item.getItemId(); + if (group == CTX_MENU_GRP_SHUFFLE) + setState(PlaybackService.get(this).setShuffleMode(id)); + else if (group == CTX_MENU_GRP_FINISH) + setState(PlaybackService.get(this).setFinishAction(id)); + return true; + } + + /** + * Queries all plugin packages and shows plugin selection dialog. + * @param intent intent with a song to send to plugins + */ + protected void showPluginMenu(final Intent intent) { + final Map<String, ApplicationInfo> plugins = PluginUtils.getPluginMap(this); + final String[] pNamesArr = plugins.keySet().toArray(new String[0]); + + new AlertDialog.Builder(this) + .setItems(pNamesArr, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + long id = intent.getLongExtra("id", LibraryAdapter.INVALID_ID); + Song song = MediaUtils.getSongByTypeId(PlaybackActivity.this, MediaUtils.TYPE_SONG, id); + if (song != null) { + ApplicationInfo selected = plugins.get(pNamesArr[which]); + Intent request = new Intent(PluginUtils.ACTION_LAUNCH_PLUGIN); + request.setPackage(selected.packageName); + request.putExtra(PluginUtils.EXTRA_PARAM_URI, Uri.fromFile(new File(song.path))); + request.putExtra(PluginUtils.EXTRA_PARAM_SONG_TITLE, song.title); + request.putExtra(PluginUtils.EXTRA_PARAM_SONG_ARTIST, song.artist); + request.putExtra(PluginUtils.EXTRA_PARAM_SONG_ALBUM, song.album); + if (request.resolveActivity(getPackageManager()) != null) { + startActivity(request); + } else { + Log.e("PluginSystem", "Couldn't start plugin activity for " + request); + } + } + } + }) + .create().show(); + } + +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/PlaybackService.java b/app/src/main/java/ch/blinkenlights/android/vanilla/PlaybackService.java new file mode 100644 index 0000000..97fd663 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/PlaybackService.java @@ -0,0 +1,2398 @@ +/* + * Copyright (C) 2012-2019 Adrian Ulrich <adrian@blinkenlights.ch> + * Copyright (C) 2010, 2011 Christopher Eby <kreed@kreed.org> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package ch.blinkenlights.android.vanilla; + +import ch.blinkenlights.android.medialibrary.MediaLibrary; +import ch.blinkenlights.android.medialibrary.LibraryObserver; + +import android.app.Notification; +import android.app.PendingIntent; +import android.app.Service; +import android.app.backup.BackupManager; +import android.appwidget.AppWidgetManager; +import android.content.BroadcastReceiver; +import android.content.ComponentName; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; +import android.content.SharedPreferences; +import android.database.Cursor; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.hardware.Sensor; +import android.hardware.SensorEvent; +import android.hardware.SensorEventListener; +import android.hardware.SensorManager; +import android.media.AudioDeviceInfo; +import android.media.AudioManager; +import android.media.MediaPlayer; +import android.os.Build; +import android.os.Handler; +import android.os.HandlerThread; +import android.os.IBinder; +import android.os.Looper; +import android.os.Message; +import android.os.PowerManager; +import android.os.Process; +import android.os.SystemClock; +import android.util.Log; +import android.view.View; +import android.widget.Toast; +import androidx.core.app.NotificationCompat; +import java.lang.Math; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.EOFException; +import java.io.File; +import java.io.IOException; +import java.util.Arrays; +import java.util.ArrayList; + + +/** + * Handles music playback and pretty much all the other work. + */ +public final class PlaybackService extends Service + implements Handler.Callback + , MediaPlayer.OnCompletionListener + , MediaPlayer.OnErrorListener + , SharedPreferences.OnSharedPreferenceChangeListener + , SongTimeline.Callback + , SensorEventListener + , AudioManager.OnAudioFocusChangeListener +{ + /** + * Name of the state file. + */ + private static final String STATE_FILE = "state"; + /** + * Header for state file to help indicate if the file is in the right + * format. + */ + private static final long STATE_FILE_MAGIC = 0x1533574DC74B6ECL; + /** + * State file version that indicates data order. + */ + private static final int STATE_VERSION = 6; + + private static final int NOTIFICATION_ID = 2; + private static final String NOTIFICATION_CHANNEL = "Playback"; + + /** + * Rewind song if we already played more than 2.5 sec + */ + private static final int REWIND_AFTER_PLAYED_MS = 2500; + + /** + * Action for startService: toggle playback on/off. + */ + public static final String ACTION_TOGGLE_PLAYBACK = "ch.blinkenlights.android.vanilla.action.TOGGLE_PLAYBACK"; + /** + * Action for startService: start playback if paused. + */ + public static final String ACTION_PLAY = "ch.blinkenlights.android.vanilla.action.PLAY"; + /** + * Action for startService: pause playback if playing. + */ + public static final String ACTION_PAUSE = "ch.blinkenlights.android.vanilla.action.PAUSE"; + /** + * Action for startService: toggle playback on/off. + * + * Unlike {@link PlaybackService#ACTION_TOGGLE_PLAYBACK}, the toggle does + * not occur immediately. Instead, it is delayed so that if two of these + * actions are received within 400 ms, the playback activity is opened + * instead. + */ + public static final String ACTION_TOGGLE_PLAYBACK_DELAYED = "ch.blinkenlights.android.vanilla.action.TOGGLE_PLAYBACK_DELAYED"; + /** + * Action for startService: advance to the next song. + */ + public static final String ACTION_NEXT_SONG = "ch.blinkenlights.android.vanilla.action.NEXT_SONG"; + /** + * Action for startService: advance to the next song. + * + * Unlike {@link PlaybackService#ACTION_NEXT_SONG}, the toggle does + * not occur immediately. Instead, it is delayed so that if two of these + * actions are received within 400 ms, the playback activity is opened + * instead. + */ + public static final String ACTION_NEXT_SONG_DELAYED = "ch.blinkenlights.android.vanilla.action.NEXT_SONG_DELAYED"; + /** + * Action for startService: advance to the next song. + * + * Like ACTION_NEXT_SONG, but starts playing automatically if paused + * when this is called. + */ + public static final String ACTION_NEXT_SONG_AUTOPLAY = "ch.blinkenlights.android.vanilla.action.NEXT_SONG_AUTOPLAY"; + /** + * Action for startService: go back to the previous song. + */ + public static final String ACTION_PREVIOUS_SONG = "ch.blinkenlights.android.vanilla.action.PREVIOUS_SONG"; + /** + * Action for startService: go back to the previous song. + * + * Like ACTION_PREVIOUS_SONG, but starts playing automatically if paused + * when this is called. + */ + public static final String ACTION_PREVIOUS_SONG_AUTOPLAY = "ch.blinkenlights.android.vanilla.action.PREVIOUS_SONG_AUTOPLAY"; + /** + * Flushes the queue, switches to random mode and starts playing. + */ + public static final String ACTION_RANDOM_MIX_AUTOPLAY = "ch.blinkenlights.android.vanilla.action.RANDOM_MIX_AUTOPLAY"; + /** + * Flushes the queue and plays everything of the passed type/id combination. + */ + public static final String ACTION_FROM_TYPE_ID_AUTOPLAY = "ch.blinkenlights.android.vanilla.action.FROM_TYPE_ID_AUTOPLAY"; + /** + * Change the shuffle mode. + */ + public static final String ACTION_CYCLE_SHUFFLE = "ch.blinkenlights.android.vanilla.CYCLE_SHUFFLE"; + /** + * Change the repeat mode. + */ + public static final String ACTION_CYCLE_REPEAT = "ch.blinkenlights.android.vanilla.CYCLE_REPEAT"; + /** + * Whether we should create a foreground notification as early as possible. + */ + public static final String EXTRA_EARLY_NOTIFICATION = "extra_early_notification"; + /** + * Keep notification forcefully around on stops if set. + */ + public static final String EXTRA_FORCE_NOTIFICATION = "extra_force_notification"; + + /** + * Visibility modes of the notification. + */ + public static final int VISIBILITY_WHEN_PLAYING = 0; + public static final int VISIBILITY_ALWAYS = 1; + + /** + * Notification click action: open LaunchActivity. + */ + private static final int NOT_ACTION_MAIN_ACTIVITY = 0; + /** + * Notification click action: open MiniPlaybackActivity. + */ + private static final int NOT_ACTION_MINI_ACTIVITY = 1; + /** + * Notification click action: open FullPlaybackActivity. + */ + private static final int NOT_ACTION_FULL_ACTIVITY = 2; + /** + * Notification click action: skip to next song. + */ + private static final int NOT_ACTION_NEXT_SONG = 3; + + /** + * If a user action is triggered within this time (in ms) after the + * idle time fade-out occurs, playback will be resumed. + */ + private static final long IDLE_GRACE_PERIOD = 60000; + /** + * Minimum time in milliseconds between shake actions. + */ + private static final int MIN_SHAKE_PERIOD = 500; + /** + * Defer entering deep sleep for this time (in ms). + */ + private static final int SLEEP_STATE_DELAY = 60000; + /** + * Save the current playlist state on queue changes after this time (in ms). + */ + private static final int SAVE_STATE_DELAY = 5000; + /** + * If set, music will play. + */ + public static final int FLAG_PLAYING = 0x1; + /** + * Set when there is no media available on the device. + */ + public static final int FLAG_NO_MEDIA = 0x2; + /** + * Set when the current song is unplayable. + */ + public static final int FLAG_ERROR = 0x4; + /** + * Set when the user needs to select songs to play. + */ + public static final int FLAG_EMPTY_QUEUE = 0x8; + public static final int SHIFT_FINISH = 4; + /** + * These three bits will be one of SongTimeline.FINISH_*. + */ + public static final int MASK_FINISH = 0x7 << SHIFT_FINISH; + public static final int SHIFT_SHUFFLE = 7; + /** + * These three bits will be one of SongTimeline.SHUFFLE_*. + */ + public static final int MASK_SHUFFLE = 0x7 << SHIFT_SHUFFLE; + public static final int SHIFT_DUCKING = 10; + /** + * Whether we're 'ducking' (lowering the playback volume temporarily due to a transient system + * sound, such as a notification) or not + */ + public static final int FLAG_DUCKING = 0x1 << SHIFT_DUCKING; + + /** + * The PlaybackService state, indicating if the service is playing, + * repeating, etc. + * + * The format of this is 0b00000000_00000000_000000gff_feeedcba, + * where each bit is: + * a: {@link PlaybackService#FLAG_PLAYING} + * b: {@link PlaybackService#FLAG_NO_MEDIA} + * c: {@link PlaybackService#FLAG_ERROR} + * d: {@link PlaybackService#FLAG_EMPTY_QUEUE} + * eee: {@link PlaybackService#MASK_FINISH} + * fff: {@link PlaybackService#MASK_SHUFFLE} + * g: {@link PlaybackService#FLAG_DUCKING} + */ + int mState; + + /** + * How many broken songs we did already skip + */ + int mSkipBroken; + + /** + * Object used for state-related locking. + */ + final Object[] mStateLock = new Object[0]; + /** + * Object used for PlaybackService startup waiting. + */ + private static final Object[] sWait = new Object[0]; + /** + * The appplication-wide instance of the PlaybackService. + */ + public static PlaybackService sInstance; + /** + * Static referenced-array to PlaybackActivities, used for callbacks + */ + private static final ArrayList<TimelineCallback> sCallbacks = new ArrayList<TimelineCallback>(5); + + boolean mHeadsetPause; + private boolean mScrobble; + /** + * If true, emulate the music status broadcasts sent by the stock android + * music player. + */ + private boolean mStockBroadcast; + /** + * Behaviour of the notification + */ + private int mNotificationVisibility; + /** + * If true, audio will not be played through the speaker. + */ + private boolean mHeadsetOnly; + /** + * The time to wait before considering the player idle. + */ + private int mIdleTimeout; + /** + * The intent for the notification to execute, created by + * {@link PlaybackService#createNotificationAction(SharedPreferences)}. + */ + private PendingIntent mNotificationAction; + /** + * Notification helper instance. + */ + private NotificationHelper mNotificationHelper; + + private Looper mLooper; + private Handler mHandler; + VanillaMediaPlayer mMediaPlayer; + VanillaMediaPlayer mPreparedMediaPlayer; + private boolean mMediaPlayerInitialized; + private boolean mMediaPlayerAudioFxActive; + private PowerManager.WakeLock mWakeLock; + private AudioManager mAudioManager; + /** + * The SensorManager service. + */ + private SensorManager mSensorManager; + /** + * A remote control client implementation + */ + private RemoteControl.Client mRemoteControlClient; + + /** + * Media session state tracker for notification + */ + private MediaSessionTracker mMediaSessionTracker; + + SongTimeline mTimeline; + private Song mCurrentSong; + + /** + * Stores the saved position in the current song from saved state. Should + * be seeked to when the song is loaded into MediaPlayer. Used only during + * initialization. The song that the saved position is for is stored in + * {@link #mPendingSeekSong}. + */ + private int mPendingSeek; + /** + * The id of the song that the mPendingSeek position is for. -1 indicates + * an invalid song. Value is undefined when mPendingSeek is 0. + */ + private long mPendingSeekSong; + public Receiver mReceiver; + private String mErrorMessage; + /** + * Current fade-out progress. 1.0f if we are not fading out + */ + private float mFadeOut = 1.0f; + /** + * Elapsed realtime at which playback was paused by idle timeout. -1 + * indicates that no timeout has occurred. + */ + private long mIdleStart = -1; + /** + * True if we encountered a transient audio loss + */ + private boolean mTransientAudioLoss; + /** + * Magnitude of last sensed acceleration. + */ + private double mAccelLast; + /** + * Filtered acceleration used for shake detection. + */ + private double mAccelFiltered; + /** + * Elapsed realtime of last shake action. + */ + private long mLastShakeTime; + /** + * Minimum jerk required for shake. + */ + private double mShakeThreshold; + /** + * What to do when an accelerometer shake is detected. + */ + private Action mShakeAction; + /** + * If true, the notification should not be hidden when pausing regardless + * of user settings. + */ + private boolean mForceNotificationVisible; + /** + * Amount of songs included in our auto playlist + */ + private int mAutoPlPlaycounts; + /** + * Enables or disables Replay Gain + */ + private boolean mReplayGainTrackEnabled; + private boolean mReplayGainAlbumEnabled; + private int mReplayGainBump; + private int mReplayGainUntaggedDeBump; + /** + * Percentage to set the volume as while a notification is playing (aka ducking) + */ + private int mVolumeDuringDucking; + /** + * + */ + private boolean mIgnoreAudioFocusLoss; + /** + * TRUE if the readahead feature is enabled + */ + private boolean mReadaheadEnabled; + /** + * Reference to precreated ReadAhead thread + */ + private ReadaheadThread mReadahead; + /** + * Referente to our playlist observer + */ + private PlaylistObserver mPlaylistObserver; + /** + * Reference to precreated BASTP Object + */ + private BastpUtil mBastpUtil; + /** + * Don't use gapless playback, useful for bug ridden devices. + */ + private boolean mDisableGaplessPlayback; + + @Override + public void onCreate() + { + HandlerThread thread = new HandlerThread("PlaybackService", Process.THREAD_PRIORITY_DEFAULT); + thread.start(); + + mTimeline = new SongTimeline(this); + mTimeline.setCallback(this); + int state = loadState(); + + mMediaPlayer = getNewMediaPlayer(); + mPreparedMediaPlayer = getNewMediaPlayer(); + // We only have a single audio session + mPreparedMediaPlayer.setAudioSessionId(mMediaPlayer.getAudioSessionId()); + + mBastpUtil = new BastpUtil(); + mReadahead = new ReadaheadThread(); + + mNotificationHelper = new NotificationHelper(this, NOTIFICATION_CHANNEL, getString(R.string.app_name)); + mAudioManager = (AudioManager)getSystemService(AUDIO_SERVICE); + + SharedPreferences settings = SharedPrefHelper.getSettings(this); + settings.registerOnSharedPreferenceChangeListener(this); + mNotificationVisibility = Integer.parseInt(settings.getString(PrefKeys.NOTIFICATION_VISIBILITY, PrefDefaults.NOTIFICATION_VISIBILITY)); + mScrobble = settings.getBoolean(PrefKeys.SCROBBLE, PrefDefaults.SCROBBLE); + mIdleTimeout = settings.getBoolean(PrefKeys.USE_IDLE_TIMEOUT, PrefDefaults.USE_IDLE_TIMEOUT) ? settings.getInt(PrefKeys.IDLE_TIMEOUT, PrefDefaults.IDLE_TIMEOUT) : 0; + + CoverCache.mCoverLoadMode = settings.getBoolean(PrefKeys.COVERLOADER_ANDROID, PrefDefaults.COVERLOADER_ANDROID) ? CoverCache.mCoverLoadMode | CoverCache.COVER_MODE_ANDROID : CoverCache.mCoverLoadMode & ~(CoverCache.COVER_MODE_ANDROID); + CoverCache.mCoverLoadMode = settings.getBoolean(PrefKeys.COVERLOADER_VANILLA, PrefDefaults.COVERLOADER_VANILLA) ? CoverCache.mCoverLoadMode | CoverCache.COVER_MODE_VANILLA : CoverCache.mCoverLoadMode & ~(CoverCache.COVER_MODE_VANILLA); + CoverCache.mCoverLoadMode = settings.getBoolean(PrefKeys.COVERLOADER_SHADOW , PrefDefaults.COVERLOADER_SHADOW) ? CoverCache.mCoverLoadMode | CoverCache.COVER_MODE_SHADOW : CoverCache.mCoverLoadMode & ~(CoverCache.COVER_MODE_SHADOW); + CoverCache.mCoverLoadMode = settings.getBoolean(PrefKeys.COVERLOADER_INLINE , PrefDefaults.COVERLOADER_INLINE) ? CoverCache.mCoverLoadMode | CoverCache.COVER_MODE_INLINE : CoverCache.mCoverLoadMode & ~(CoverCache.COVER_MODE_INLINE); + + mHeadsetOnly = settings.getBoolean(PrefKeys.HEADSET_ONLY, PrefDefaults.HEADSET_ONLY); + mStockBroadcast = settings.getBoolean(PrefKeys.STOCK_BROADCAST, PrefDefaults.STOCK_BROADCAST); + mNotificationAction = createNotificationAction(settings); + mHeadsetPause = SharedPrefHelper.getSettings(this).getBoolean(PrefKeys.HEADSET_PAUSE, PrefDefaults.HEADSET_PAUSE); + mShakeAction = settings.getBoolean(PrefKeys.ENABLE_SHAKE, PrefDefaults.ENABLE_SHAKE) ? Action.getAction(settings, PrefKeys.SHAKE_ACTION, PrefDefaults.SHAKE_ACTION) : Action.Nothing; + mShakeThreshold = settings.getInt(PrefKeys.SHAKE_THRESHOLD, PrefDefaults.SHAKE_THRESHOLD) / 10.0f; + + mReplayGainTrackEnabled = settings.getBoolean(PrefKeys.ENABLE_TRACK_REPLAYGAIN, PrefDefaults.ENABLE_TRACK_REPLAYGAIN); + mReplayGainAlbumEnabled = settings.getBoolean(PrefKeys.ENABLE_ALBUM_REPLAYGAIN, PrefDefaults.ENABLE_ALBUM_REPLAYGAIN); + mReplayGainBump = settings.getInt(PrefKeys.REPLAYGAIN_BUMP, PrefDefaults.REPLAYGAIN_BUMP); + mReplayGainUntaggedDeBump = settings.getInt(PrefKeys.REPLAYGAIN_UNTAGGED_DEBUMP, PrefDefaults.REPLAYGAIN_UNTAGGED_DEBUMP); + mDisableGaplessPlayback = settings.getBoolean(PrefKeys.DISABLE_GAPLESS_PLAYBACK, PrefDefaults.DISABLE_GAPLESS_PLAYBACK); + + mVolumeDuringDucking = settings.getInt(PrefKeys.VOLUME_DURING_DUCKING, PrefDefaults.VOLUME_DURING_DUCKING); + mIgnoreAudioFocusLoss = settings.getBoolean(PrefKeys.IGNORE_AUDIOFOCUS_LOSS, PrefDefaults.IGNORE_AUDIOFOCUS_LOSS); + refreshDuckingValues(); + + mReadaheadEnabled = settings.getBoolean(PrefKeys.ENABLE_READAHEAD, PrefDefaults.ENABLE_READAHEAD); + + mAutoPlPlaycounts = settings.getInt(PrefKeys.AUTOPLAYLIST_PLAYCOUNTS, PrefDefaults.AUTOPLAYLIST_PLAYCOUNTS); + + PowerManager powerManager = (PowerManager)getSystemService(POWER_SERVICE); + mWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "VanillaMusic:PlaybackService"); + + mReceiver = new Receiver(); + IntentFilter filter = new IntentFilter(); + filter.addAction(AudioManager.ACTION_AUDIO_BECOMING_NOISY); + filter.addAction(Intent.ACTION_SCREEN_ON); + registerReceiver(mReceiver, filter); + + MediaLibrary.registerLibraryObserver(mObserver); + + mRemoteControlClient = new RemoteControl().getClient(this); + mRemoteControlClient.initializeRemote(); + + mMediaSessionTracker = new MediaSessionTracker(this); + + int syncMode = Integer.parseInt(settings.getString(PrefKeys.PLAYLIST_SYNC_MODE, PrefDefaults.PLAYLIST_SYNC_MODE)); + boolean exportRelativePaths = settings.getBoolean(PrefKeys.PLAYLIST_EXPORT_RELATIVE_PATHS, PrefDefaults.PLAYLIST_EXPORT_RELATIVE_PATHS); + String syncFolder = settings.getString(PrefKeys.PLAYLIST_SYNC_FOLDER, PrefDefaults.PLAYLIST_SYNC_FOLDER); + mPlaylistObserver = new PlaylistObserver(this, syncFolder, syncMode, exportRelativePaths); + + mLooper = thread.getLooper(); + mHandler = new Handler(mLooper, this); + + initWidgets(); + + updateState(state); + setCurrentSong(0); + + sInstance = this; + synchronized (sWait) { + sWait.notifyAll(); + } + + mAccelFiltered = 0.0f; + mAccelLast = SensorManager.GRAVITY_EARTH; + setupSensor(); + + ScheduledLibraryUpdate.scheduleUpdate(this); + } + + @Override + public int onStartCommand(Intent intent, int flags, int startId) { + if (intent != null) { + final String action = intent.getAction(); + final boolean earlyNotification = intent.hasExtra(EXTRA_EARLY_NOTIFICATION); + final boolean forceNotification = intent.hasExtra(EXTRA_FORCE_NOTIFICATION); + + if (earlyNotification) { + Song song = mCurrentSong != null ? mCurrentSong : new Song(-1); + startForeground(NOTIFICATION_ID, createNotification(song, mState)); + } + + if (ACTION_TOGGLE_PLAYBACK.equals(action)) { + playPause(forceNotification); + } else if (ACTION_TOGGLE_PLAYBACK_DELAYED.equals(action)) { + if (mHandler.hasMessages(MSG_CALL_GO, Integer.valueOf(0))) { + mHandler.removeMessages(MSG_CALL_GO, Integer.valueOf(0)); + Intent launch = new Intent(this, LibraryActivity.class); + launch.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + launch.setAction(Intent.ACTION_MAIN); + startActivity(launch); + } else { + mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_CALL_GO, 0, 0, Integer.valueOf(0)), 400); + } + } else if (ACTION_NEXT_SONG.equals(action)) { + shiftCurrentSong(SongTimeline.SHIFT_NEXT_SONG); + } else if (ACTION_NEXT_SONG_AUTOPLAY.equals(action)) { + shiftCurrentSong(SongTimeline.SHIFT_NEXT_SONG); + play(); + } else if (ACTION_NEXT_SONG_DELAYED.equals(action)) { + if (mHandler.hasMessages(MSG_CALL_GO, Integer.valueOf(1))) { + mHandler.removeMessages(MSG_CALL_GO, Integer.valueOf(1)); + Intent launch = new Intent(this, LibraryActivity.class); + launch.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + launch.setAction(Intent.ACTION_MAIN); + startActivity(launch); + } else { + mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_CALL_GO, 1, 0, Integer.valueOf(1)), 400); + } + } else if (ACTION_PREVIOUS_SONG.equals(action)) { + rewindCurrentSong(); + } else if (ACTION_PREVIOUS_SONG_AUTOPLAY.equals(action)) { + rewindCurrentSong(); + play(); + } else if (ACTION_PLAY.equals(action)) { + play(); + } else if (ACTION_PAUSE.equals(action)) { + pause(); + } else if (ACTION_CYCLE_REPEAT.equals(action)) { + cycleFinishAction(); + } else if (ACTION_CYCLE_SHUFFLE.equals(action)) { + cycleShuffle(); + } else if (ACTION_RANDOM_MIX_AUTOPLAY.equals(action)) { + pause(); + emptyQueue(); + setFinishAction(SongTimeline.FINISH_RANDOM); + // We can't use play() here as setFinishAction() is handled in the background. + // We therefore send a GO message to the same queue, so it will get handled as + // soon as the queue is ready. + mHandler.sendEmptyMessage(MSG_CALL_GO); + } else if (ACTION_FROM_TYPE_ID_AUTOPLAY.equals(action)) { + int type = intent.getIntExtra(LibraryAdapter.DATA_TYPE, MediaUtils.TYPE_INVALID); + long id = intent.getLongExtra(LibraryAdapter.DATA_ID, LibraryAdapter.INVALID_ID); + QueryTask query = MediaUtils.buildQuery(type, id, Song.FILLED_PROJECTION, null); + // Flush the queue and start playing: + query.mode = SongTimeline.MODE_PLAY; + addSongs(query); + } + } + + return START_NOT_STICKY; + } + + @Override + public void onDestroy() + { + sInstance = null; + + mLooper.quit(); + + // clear the notification + stopForeground(true); + + // defer wakelock and close audioFX + enterSleepState(); + + // stop getting preference changes. + SharedPrefHelper.getSettings(this).unregisterOnSharedPreferenceChangeListener(this); + + // shutdown all observers. + MediaLibrary.unregisterLibraryObserver(mObserver); + mPlaylistObserver.unregister(); + + if (mMediaPlayer != null) { + mMediaPlayer.release(); + mMediaPlayer = null; + } + + if (mPreparedMediaPlayer != null) { + mPreparedMediaPlayer.release(); + mPreparedMediaPlayer = null; + } + + try { + unregisterReceiver(mReceiver); + } catch (IllegalArgumentException e) { + // we haven't registered the receiver yet + } + + if (mSensorManager != null) + mSensorManager.unregisterListener(this); + + if (mRemoteControlClient != null) + mRemoteControlClient.unregisterRemote(); + + if (mMediaSessionTracker != null) + mMediaSessionTracker.release(); + + super.onDestroy(); + } + + /** + * Returns a new MediaPlayer object + */ + private VanillaMediaPlayer getNewMediaPlayer() { + VanillaMediaPlayer mp = new VanillaMediaPlayer(this); + mp.setAudioStreamType(AudioManager.STREAM_MUSIC); + mp.setOnCompletionListener(this); + mp.setOnErrorListener(this); + return mp; + } + + public void prepareMediaPlayer(VanillaMediaPlayer mp, String path) throws IOException{ + mp.setDataSource(path); + mp.prepare(); + applyReplayGain(mp); + } + + /** + * Checks if we need to update the play/skipcounter for this action + * + * @param delta One of the SongTimeline.SHIFT_* + */ + private void preparePlayCountsUpdate(int delta) { + if (isPlaying()) { + double pctPlayed = (double)getPosition()/getDuration(); + int action = 0; + + if (delta == SongTimeline.SHIFT_KEEP_SONG && pctPlayed >= 0.8) { + action = 1; // song is playing again and had more than 0.8pct -> count this + } else if(delta == SongTimeline.SHIFT_NEXT_SONG && pctPlayed <= 0.5) { + action = -1; + } + + if (action != 0) { + mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_UPDATE_PLAYCOUNTS, action, 0, mCurrentSong), 800); + } + } + } + + /** + * Make sure that the current ReplayGain volume matches + * the (maybe just changed) user settings + */ + private void refreshReplayGainValues() { + if (mMediaPlayer != null) { + applyReplayGain(mMediaPlayer); + } + if (mPreparedMediaPlayer != null) { + applyReplayGain(mPreparedMediaPlayer); + } + } + + private void refreshDuckingValues() { + float duckingFactor = ((float) mVolumeDuringDucking)/100f; + if (mMediaPlayer != null) { + mMediaPlayer.setDuckingFactor(duckingFactor); + } + if (mPreparedMediaPlayer != null) { + mPreparedMediaPlayer.setDuckingFactor(duckingFactor); + } + } + + /*** + * Reads the replay gain value of the media players data source + * and adjusts the volume + */ + private void applyReplayGain(VanillaMediaPlayer mp) { + + BastpUtil.GainValues rg = getReplayGainValues(mp.getDataSource()); + float adjust = 0f; + + if (mReplayGainAlbumEnabled) { + adjust = (rg.track != 0 ? rg.track : adjust); // Album gain enabled, but we use the track gain as a backup. + adjust = (rg.album != 0 ? rg.album : adjust); // If album gain is present, we will prefer it. + } + + if (mReplayGainTrackEnabled || (mReplayGainAlbumEnabled && adjust == 0)) { + adjust = (rg.album != 0 ? rg.album : adjust); // Track gain enabled, but we use the album gain as a backup. + adjust = (rg.track != 0 ? rg.track : adjust); // If track gain is present, we will prefer it. + } + + if (!rg.found) { + // No replay gain information found: adjust volume if requested by user. + adjust = (mReplayGainUntaggedDeBump-150)/10f; + } else { + // This song has some replay gain info, we are now going to apply the 'bump' value + // The preferences stores the raw value of the seekbar, that's 0-150 + // But we want -15 <-> +15, so 75 shall be zero. + adjust += 2*(mReplayGainBump-75)/10f; // 2* -> we want +-15, not +-7.5 + } + + if(mReplayGainAlbumEnabled == false && mReplayGainTrackEnabled == false) { + // Feature is disabled: Make sure that we are going to 100% volume. + adjust = 0f; + } + + float rg_result = ((float)Math.pow(10, (adjust/20) ))*mFadeOut; + if(rg_result > 1.0f) { + rg_result = 1.0f; // Android would IGNORE the change if this is > 1 and we would end up with the wrong volume. + } else if (rg_result < 0.0f) { + rg_result = 0.0f; + } + mp.setReplayGain(rg_result); + } + + /** + * Returns the (hopefully cached) replaygain + * values of given file + */ + public BastpUtil.GainValues getReplayGainValues(String path) { + return mBastpUtil.getReplayGainValues(path); + } + + /** + * Prepares PlaybackService to sleep / shutdown + * Closes any open AudioFX session and releases + * our wakelock if held + */ + private synchronized void enterSleepState() + { + if (mMediaPlayer != null) { + if (mMediaPlayerAudioFxActive) { + mMediaPlayer.closeAudioFx(); + mMediaPlayerAudioFxActive = false; + } + saveState(mMediaPlayer.getCurrentPosition()); + } + + if (mWakeLock != null && mWakeLock.isHeld()) + mWakeLock.release(); + } + + /** + * Destroys any currently prepared MediaPlayer and + * re-creates a newone if needed. + */ + private void triggerGaplessUpdate() { + if(mMediaPlayerInitialized != true) + return; + + if(mDisableGaplessPlayback) + return; + + boolean doGapless = false; + int fa = finishAction(mState); + Song nextSong = getSong(1); + + if( nextSong != null + && fa != SongTimeline.FINISH_REPEAT_CURRENT + && fa != SongTimeline.FINISH_STOP_CURRENT + && !mTimeline.isEndOfQueue() ) { + doGapless = true; + } + else { + Log.d("VanillaMusic", "Must not create new media player object"); + } + + if(doGapless == true) { + try { + if(nextSong.path.equals(mPreparedMediaPlayer.getDataSource()) == false) { + // Prepared MP has a different data source: We need to re-initalize + // it and set it as the next MP for the active media player + mPreparedMediaPlayer.reset(); + prepareMediaPlayer(mPreparedMediaPlayer, nextSong.path); + mMediaPlayer.setNextMediaPlayer(mPreparedMediaPlayer); + } + if(mMediaPlayer.hasNextMediaPlayer() == false) { + // We can reuse the prepared MediaPlayer but the current instance lacks + // a link to it + mMediaPlayer.setNextMediaPlayer(mPreparedMediaPlayer); + } + } catch (IOException | IllegalArgumentException e) { + Log.e("VanillaMusic", "Exception while preparing gapless media player: " + e); + mMediaPlayer.setNextMediaPlayer(null); + mPreparedMediaPlayer.reset(); + } + } else { + if(mMediaPlayer.hasNextMediaPlayer()) { + mMediaPlayer.setNextMediaPlayer(null); + // There is no need to cleanup mPreparedMediaPlayer + } + } + } + + /** + * Stops or starts the readahead thread + */ + private void triggerReadAhead() { + Song song = mCurrentSong; + if((mState & FLAG_PLAYING) != 0 && song != null) { + mReadahead.setSong(song); + } else { + mReadahead.pause(); + } + } + + /** + * Setup the accelerometer. + */ + private void setupSensor() + { + if (mShakeAction == Action.Nothing) { + if (mSensorManager != null) + mSensorManager.unregisterListener(this); + } else { + if (mSensorManager == null) + mSensorManager = (SensorManager)getSystemService(SENSOR_SERVICE); + mSensorManager.registerListener(this, mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER), SensorManager.SENSOR_DELAY_UI); + } + } + + + private void loadPreference(String key) + { + SharedPreferences settings = SharedPrefHelper.getSettings(this); + if (PrefKeys.HEADSET_PAUSE.equals(key)) { + mHeadsetPause = settings.getBoolean(PrefKeys.HEADSET_PAUSE, PrefDefaults.HEADSET_PAUSE); + } else if (PrefKeys.NOTIFICATION_ACTION.equals(key)) { + mNotificationAction = createNotificationAction(settings); + updateNotification(); + } else if (PrefKeys.NOTIFICATION_VISIBILITY.equals(key)){ + mNotificationVisibility = Integer.parseInt(settings.getString(PrefKeys.NOTIFICATION_VISIBILITY, PrefDefaults.NOTIFICATION_VISIBILITY)); + // This is the only way to remove a notification created by + // startForeground(), even if we are not currently in foreground + // mode. + stopForeground(true); + updateNotification(); + } else if (PrefKeys.SCROBBLE.equals(key)) { + mScrobble = settings.getBoolean(PrefKeys.SCROBBLE, PrefDefaults.SCROBBLE); + } else if (PrefKeys.COVER_ON_LOCKSCREEN.equals(key)) { + mRemoteControlClient.reloadPreference(); + } else if (PrefKeys.USE_IDLE_TIMEOUT.equals(key) || PrefKeys.IDLE_TIMEOUT.equals(key)) { + mIdleTimeout = settings.getBoolean(PrefKeys.USE_IDLE_TIMEOUT, PrefDefaults.USE_IDLE_TIMEOUT) ? settings.getInt(PrefKeys.IDLE_TIMEOUT, PrefDefaults.IDLE_TIMEOUT) : 0; + userActionTriggered(); + } else if (PrefKeys.COVERLOADER_ANDROID.equals(key)) { + CoverCache.mCoverLoadMode = settings.getBoolean(PrefKeys.COVERLOADER_ANDROID, PrefDefaults.COVERLOADER_ANDROID) ? CoverCache.mCoverLoadMode | CoverCache.COVER_MODE_ANDROID : CoverCache.mCoverLoadMode & ~(CoverCache.COVER_MODE_ANDROID); + CoverCache.evictAll(); + } else if (PrefKeys.COVERLOADER_VANILLA.equals(key)) { + CoverCache.mCoverLoadMode = settings.getBoolean(PrefKeys.COVERLOADER_VANILLA, PrefDefaults.COVERLOADER_VANILLA) ? CoverCache.mCoverLoadMode | CoverCache.COVER_MODE_VANILLA : CoverCache.mCoverLoadMode & ~(CoverCache.COVER_MODE_VANILLA); + CoverCache.evictAll(); + } else if (PrefKeys.COVERLOADER_SHADOW.equals(key)) { + CoverCache.mCoverLoadMode = settings.getBoolean(PrefKeys.COVERLOADER_SHADOW, PrefDefaults.COVERLOADER_SHADOW) ? CoverCache.mCoverLoadMode | CoverCache.COVER_MODE_SHADOW : CoverCache.mCoverLoadMode & ~(CoverCache.COVER_MODE_SHADOW); + CoverCache.evictAll(); + } else if (PrefKeys.HEADSET_ONLY.equals(key)) { + mHeadsetOnly = settings.getBoolean(key, PrefDefaults.HEADSET_ONLY); + if (mHeadsetOnly && isSpeakerOn()) + unsetFlag(FLAG_PLAYING); + } else if (PrefKeys.STOCK_BROADCAST.equals(key)) { + mStockBroadcast = settings.getBoolean(key, PrefDefaults.STOCK_BROADCAST); + } else if (PrefKeys.ENABLE_SHAKE.equals(key) || PrefKeys.SHAKE_ACTION.equals(key)) { + mShakeAction = settings.getBoolean(PrefKeys.ENABLE_SHAKE, PrefDefaults.ENABLE_SHAKE) ? Action.getAction(settings, PrefKeys.SHAKE_ACTION, PrefDefaults.SHAKE_ACTION) : Action.Nothing; + setupSensor(); + } else if (PrefKeys.SHAKE_THRESHOLD.equals(key)) { + mShakeThreshold = settings.getInt(PrefKeys.SHAKE_THRESHOLD, PrefDefaults.SHAKE_THRESHOLD) / 10.0f; + } else if (PrefKeys.ENABLE_TRACK_REPLAYGAIN.equals(key)) { + mReplayGainTrackEnabled = settings.getBoolean(PrefKeys.ENABLE_TRACK_REPLAYGAIN, PrefDefaults.ENABLE_TRACK_REPLAYGAIN); + refreshReplayGainValues(); + } else if (PrefKeys.ENABLE_ALBUM_REPLAYGAIN.equals(key)) { + mReplayGainAlbumEnabled = settings.getBoolean(PrefKeys.ENABLE_ALBUM_REPLAYGAIN, PrefDefaults.ENABLE_ALBUM_REPLAYGAIN); + refreshReplayGainValues(); + } else if (PrefKeys.REPLAYGAIN_BUMP.equals(key)) { + mReplayGainBump = settings.getInt(PrefKeys.REPLAYGAIN_BUMP, PrefDefaults.REPLAYGAIN_BUMP); + refreshReplayGainValues(); + } else if (PrefKeys.REPLAYGAIN_UNTAGGED_DEBUMP.equals(key)) { + mReplayGainUntaggedDeBump = settings.getInt(PrefKeys.REPLAYGAIN_UNTAGGED_DEBUMP, PrefDefaults.REPLAYGAIN_UNTAGGED_DEBUMP); + refreshReplayGainValues(); + } else if (PrefKeys.VOLUME_DURING_DUCKING.equals(key)) { + mVolumeDuringDucking = settings.getInt(PrefKeys.VOLUME_DURING_DUCKING, PrefDefaults.VOLUME_DURING_DUCKING); + refreshDuckingValues(); + } else if (PrefKeys.IGNORE_AUDIOFOCUS_LOSS.equals(key)) { + mIgnoreAudioFocusLoss = settings.getBoolean(PrefKeys.IGNORE_AUDIOFOCUS_LOSS, PrefDefaults.IGNORE_AUDIOFOCUS_LOSS); + } else if (PrefKeys.ENABLE_READAHEAD.equals(key)) { + mReadaheadEnabled = settings.getBoolean(PrefKeys.ENABLE_READAHEAD, PrefDefaults.ENABLE_READAHEAD); + } else if (PrefKeys.AUTOPLAYLIST_PLAYCOUNTS.equals(key)) { + mAutoPlPlaycounts = settings.getInt(PrefKeys.AUTOPLAYLIST_PLAYCOUNTS, PrefDefaults.AUTOPLAYLIST_PLAYCOUNTS); + } else if (PrefKeys.PLAYLIST_SYNC_MODE.equals(key) || PrefKeys.PLAYLIST_SYNC_FOLDER.equals(key) || PrefKeys.PLAYLIST_EXPORT_RELATIVE_PATHS.equals(key)) { + int syncMode = Integer.parseInt(settings.getString(PrefKeys.PLAYLIST_SYNC_MODE, PrefDefaults.PLAYLIST_SYNC_MODE)); + boolean exportRelativePaths = settings.getBoolean(PrefKeys.PLAYLIST_EXPORT_RELATIVE_PATHS, PrefDefaults.PLAYLIST_EXPORT_RELATIVE_PATHS); + String syncFolder = settings.getString(PrefKeys.PLAYLIST_SYNC_FOLDER, PrefDefaults.PLAYLIST_SYNC_FOLDER); + + mPlaylistObserver.unregister(); + mPlaylistObserver = new PlaylistObserver(this, syncFolder, syncMode, exportRelativePaths); + } else if (PrefKeys.SELECTED_THEME.equals(key) || PrefKeys.DISPLAY_MODE.equals(key)) { + // Theme changed: trigger a restart of all registered activites + ArrayList<TimelineCallback> list = sCallbacks; + for (int i = list.size(); --i != -1; ) + list.get(i).recreate(); + } else if (PrefKeys.DISABLE_GAPLESS_PLAYBACK.equals(key)) { + mDisableGaplessPlayback = settings.getBoolean(PrefKeys.DISABLE_GAPLESS_PLAYBACK, PrefDefaults.DISABLE_GAPLESS_PLAYBACK); + } + + /* Tell androids cloud-backup manager that we just changed our preferences */ + (new BackupManager(this)).dataChanged(); + } + + /** + * Set a state flag. + */ + public void setFlag(int flag) + { + synchronized (mStateLock) { + updateState(mState | flag); + } + } + + /** + * Unset a state flag. + */ + public void unsetFlag(int flag) + { + synchronized (mStateLock) { + updateState(mState & ~flag); + } + } + + /** + * Return true if audio would play through the speaker. + */ + @SuppressWarnings("deprecation") + private boolean isSpeakerOn() + { + // Devices we consider to not be speakers. + final Integer[] headsetTypes = { AudioDeviceInfo.TYPE_BLUETOOTH_A2DP, AudioDeviceInfo.TYPE_BLUETOOTH_SCO, + AudioDeviceInfo.TYPE_WIRED_HEADSET, AudioDeviceInfo.TYPE_WIRED_HEADPHONES, + AudioDeviceInfo.TYPE_USB_HEADSET, AudioDeviceInfo.TYPE_USB_DEVICE }; + + boolean result = true; + AudioDeviceInfo[] devices = mAudioManager.getDevices(AudioManager.GET_DEVICES_OUTPUTS); + for (AudioDeviceInfo device: devices) { + Log.v("VanillaMusic", "AudioDeviceInfo type = " + device.getType()); + if (Arrays.asList(headsetTypes).contains(device.getType())) { + result = false; + break; + } + } + return result; + } + + /** + * Modify the service state. + * + * @param state Union of PlaybackService.STATE_* flags + * @return The new state + */ + private int updateState(int state) + { + if ((state & (FLAG_NO_MEDIA|FLAG_ERROR|FLAG_EMPTY_QUEUE)) != 0 || mHeadsetOnly && isSpeakerOn()) + state &= ~FLAG_PLAYING; + + int oldState = mState; + mState = state; + + if (state != oldState) { + mHandler.sendMessage(mHandler.obtainMessage(MSG_PROCESS_STATE, oldState, state)); + mHandler.sendMessage(mHandler.obtainMessage(MSG_BROADCAST_CHANGE, state, 0, new TimestampedObject(null))); + } + + return state; + } + + private void processNewState(int oldState, int state) + { + int toggled = oldState ^ state; + + if ( ((toggled & FLAG_PLAYING) != 0) && mCurrentSong != null) { // user requested to start playback AND we have a song selected + if ((state & FLAG_PLAYING) != 0) { + + // We get noisy: Acquire a new AudioFX session if required + if (mMediaPlayerAudioFxActive == false) { + mMediaPlayer.openAudioFx(); + mMediaPlayerAudioFxActive = true; + } + + if (mMediaPlayerInitialized) + mMediaPlayer.start(); + + // Update the notification with the current song information. + startForeground(NOTIFICATION_ID, createNotification(mCurrentSong, mState)); + + final int result = mAudioManager.requestAudioFocus(this, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN); + if (result != AudioManager.AUDIOFOCUS_REQUEST_GRANTED) { + unsetFlag(FLAG_PLAYING); + } + + mHandler.removeMessages(MSG_ENTER_SLEEP_STATE); + try { + if (mWakeLock != null && mWakeLock.isHeld() == false) + mWakeLock.acquire(); + } catch (SecurityException e) { + // Don't have WAKE_LOCK permission + } + } else { + if (mMediaPlayerInitialized) + mMediaPlayer.pause(); + + // We are switching into background mode. The notification will be removed + // unless we forcefully show it (or the user selected to always show it) + // In both cases we will update the notification to reflect the + // actual playback state (or to hit cancel() as this is required to + // get rid of it if it was created via notify()) + boolean removeNotification = (mForceNotificationVisible == false && mNotificationVisibility != VISIBILITY_ALWAYS); + stopForeground(removeNotification); + updateNotification(); + + // Delay entering deep sleep. This allows the headset + // button to continue to function for a short period after + // pausing and keeps the AudioFX session open + mHandler.sendEmptyMessageDelayed(MSG_ENTER_SLEEP_STATE, SLEEP_STATE_DELAY); + } + + setupSensor(); + } + + if ((toggled & FLAG_NO_MEDIA) != 0 && (state & FLAG_NO_MEDIA) != 0) { + Song song = mCurrentSong; + if (song != null && mMediaPlayerInitialized) { + mPendingSeek = mMediaPlayer.getCurrentPosition(); + mPendingSeekSong = song.id; + } + } + + if ((toggled & MASK_SHUFFLE) != 0) + mTimeline.setShuffleMode(shuffleMode(state)); + if ((toggled & MASK_FINISH) != 0) + mTimeline.setFinishAction(finishAction(state)); + + if((toggled & FLAG_DUCKING) != 0) { + boolean isDucking = (state & FLAG_DUCKING) != 0; + mMediaPlayer.setIsDucking(isDucking); + mPreparedMediaPlayer.setIsDucking(isDucking); + } + } + + private void broadcastChange(int state, Song song, long uptime) + { + if (state != -1) { + ArrayList<TimelineCallback> list = sCallbacks; + for (int i = list.size(); --i != -1; ) + list.get(i).setState(uptime, state); + } + + if (song != null) { + ArrayList<TimelineCallback> list = sCallbacks; + for (int i = list.size(); --i != -1; ) + list.get(i).setSong(uptime, song); + } + + updateWidgets(); + + if (mReadaheadEnabled) + triggerReadAhead(); + + mRemoteControlClient.updateRemote(mCurrentSong, mState, mForceNotificationVisible); + mMediaSessionTracker.updateSession(mCurrentSong, mState); + + scrobbleBroadcast(); + } + + /** + * Check if there are any instances of each widget. + */ + private void initWidgets() + { + AppWidgetManager manager = AppWidgetManager.getInstance(this); + OneCellWidget.checkEnabled(this, manager); + FourSquareWidget.checkEnabled(this, manager); + FourLongWidget.checkEnabled(this, manager); + FourWhiteWidget.checkEnabled(this, manager); + WidgetD.checkEnabled(this, manager); + WidgetE.checkEnabled(this, manager); + } + + /** + * Update the widgets with the current song and state. + */ + private void updateWidgets() + { + AppWidgetManager manager = AppWidgetManager.getInstance(this); + Song song = mCurrentSong; + int state = mState; + OneCellWidget.updateWidget(this, manager, song, state); + FourLongWidget.updateWidget(this, manager, song, state); + FourSquareWidget.updateWidget(this, manager, song, state); + FourWhiteWidget.updateWidget(this, manager, song, state); + WidgetD.updateWidget(this, manager, song, state); + WidgetE.updateWidget(this, manager, song, state); + } + + /** + * Scrobbles and broadcasts the currently playing song + */ + private void scrobbleBroadcast() { + Song song = mCurrentSong; + if (song == null) + return; + + if (!mStockBroadcast && !mScrobble) + return; + + long[] androidIds = MediaUtils.getAndroidMediaIds(getApplicationContext(), song); + if (mStockBroadcast) { + Intent intent = new Intent("com.android.music.playstatechanged"); + intent.putExtra("playing", (mState & FLAG_PLAYING) != 0); + intent.putExtra("track", song.title); + intent.putExtra("album", song.album); + intent.putExtra("artist", song.artist); + if (androidIds[0] != -1) { + intent.putExtra("songid", androidIds[0]); + intent.putExtra("albumid", androidIds[1]); + } + sendBroadcast(intent); + } + + if (mScrobble) { + Intent intent = new Intent("net.jjc1138.android.scrobbler.action.MUSIC_STATUS"); + intent.putExtra("playing", (mState & FLAG_PLAYING) != 0); + if (androidIds[0] != -1) + intent.putExtra("id", androidIds[0]); + sendBroadcast(intent); + } + } + + private void updateNotification() + { + if (mCurrentSong != null) { + // We always update the notification, even if we are about to cancel it as it may still stick around + // for a few seconds and we want to ensure that we are showing the correct state. + mNotificationHelper.notify(NOTIFICATION_ID, createNotification(mCurrentSong, mState)); + } + if (!(mForceNotificationVisible || + mNotificationVisibility == VISIBILITY_ALWAYS || + mNotificationVisibility == VISIBILITY_WHEN_PLAYING && (mState & FLAG_PLAYING) != 0)) { + mNotificationHelper.cancel(NOTIFICATION_ID); + } + } + + /** + * Enqueues a Toast message to be shown. + */ + private void showToast(int resId, int duration) { + mHandler.sendMessage(mHandler.obtainMessage(MSG_SHOW_TOAST, duration, resId)); + } + + private void showToast(CharSequence text, int duration) { + mHandler.sendMessage(mHandler.obtainMessage(MSG_SHOW_TOAST, duration, 0, text)); + } + + /** + * Start playing if currently paused. + * + * @return The new state after this is called. + */ + public int play() + { + synchronized (mStateLock) { + if ((mState & FLAG_EMPTY_QUEUE) != 0) { + setFinishAction(SongTimeline.FINISH_RANDOM); + showToast(R.string.random_enabling, Toast.LENGTH_SHORT); + } + + int state = updateState(mState | FLAG_PLAYING); + userActionTriggered(); + return state; + } + } + + /** + * Pause if currently playing. + * + * @return The new state after this is called. + */ + public int pause() + { + synchronized (mStateLock) { + mTransientAudioLoss = false; // do not resume playback as this pause was user initiated + int state = updateState(mState & ~FLAG_PLAYING & ~FLAG_DUCKING); + userActionTriggered(); + return state; + } + } + + /** + * If playing, pause. If paused, play. + * + * @return The new state after this is called. + */ + public int playPause(boolean forceNotification) + { + synchronized (mStateLock) { + mForceNotificationVisible = forceNotification; + if ((mState & FLAG_PLAYING) != 0) + return pause(); + else + return play(); + } + } + + + /** + * Change the end action (e.g. repeat, random). + * + * @param action The new action. One of SongTimeline.FINISH_*. + * @return The new state after this is called. + */ + public int setFinishAction(int action) + { + synchronized (mStateLock) { + return updateState(mState & ~MASK_FINISH | action << SHIFT_FINISH); + } + } + + /** + * Cycle repeat mode. Disables random mode. + * + * @return The new state after this is called. + */ + public int cycleFinishAction() + { + synchronized (mStateLock) { + int mode = finishAction(mState) + 1; + if (mode > SongTimeline.FINISH_RANDOM) + mode = SongTimeline.FINISH_STOP; + return setFinishAction(mode); + } + } + + /** + * Change the shuffle mode. + * + * @param mode The new mode. One of SongTimeline.SHUFFLE_*. + * @return The new state after this is called. + */ + public int setShuffleMode(int mode) + { + synchronized (mStateLock) { + return updateState(mState & ~MASK_SHUFFLE | mode << SHIFT_SHUFFLE); + } + } + + /** + * Cycle shuffle mode. + * + * @return The new state after this is called. + */ + public int cycleShuffle() + { + synchronized (mStateLock) { + int mode = shuffleMode(mState) + 1; + if (mode > SongTimeline.SHUFFLE_ALBUMS) + mode = SongTimeline.SHUFFLE_NONE; // end reached: switch to none + return setShuffleMode(mode); + } + } + + /** + * Move to the next or previous song or album in the timeline. + * + * @param delta One of SongTimeline.SHIFT_*. 0 can also be passed to + * initialize the current song with media player, notification, + * broadcasts, etc. + * @return The new current song + */ + private Song setCurrentSong(int delta) + { + if (mMediaPlayer == null) + return null; + + if (mMediaPlayer.isPlaying()) + mMediaPlayer.stop(); + + Song song = mTimeline.shiftCurrentSong(delta); + mCurrentSong = song; + if (song == null) { + if (MediaUtils.isSongAvailable(getApplicationContext())) { + int flag = finishAction(mState) == SongTimeline.FINISH_RANDOM ? FLAG_ERROR : FLAG_EMPTY_QUEUE; + synchronized (mStateLock) { + updateState((mState | flag) & ~FLAG_NO_MEDIA); + } + return null; + } else { + // we don't have any songs : / + synchronized (mStateLock) { + updateState((mState | FLAG_NO_MEDIA) & ~FLAG_EMPTY_QUEUE); + } + return null; + } + } else if ((mState & (FLAG_NO_MEDIA|FLAG_EMPTY_QUEUE)) != 0) { + synchronized (mStateLock) { + updateState(mState & ~(FLAG_EMPTY_QUEUE|FLAG_NO_MEDIA)); + } + } + + mHandler.removeMessages(MSG_PROCESS_SONG); + + mMediaPlayerInitialized = false; + mHandler.sendMessage(mHandler.obtainMessage(MSG_PROCESS_SONG, song)); + mHandler.sendMessage(mHandler.obtainMessage(MSG_BROADCAST_CHANGE, -1, 0, new TimestampedObject(song))); + return song; + } + + private void processSong(Song song) + { + /* Save our 'current' state as the try block may set the ERROR flag (which clears the PLAYING flag */ + boolean playing = (mState & FLAG_PLAYING) != 0; + + try { + mMediaPlayerInitialized = false; + mMediaPlayer.reset(); + + if(mPreparedMediaPlayer.isPlaying()) { + // The prepared media player is playing as the previous song + // reched its end 'naturally' (-> gapless) + // We can now swap mPreparedMediaPlayer and mMediaPlayer + VanillaMediaPlayer tmpPlayer = mMediaPlayer; + mMediaPlayer = mPreparedMediaPlayer; + mPreparedMediaPlayer = tmpPlayer; // this was mMediaPlayer and is in reset() state + } + else { + prepareMediaPlayer(mMediaPlayer, song.path); + } + + + mMediaPlayerInitialized = true; + // Cancel any pending gapless updates and re-send them + mHandler.removeMessages(MSG_GAPLESS_UPDATE); + mHandler.sendEmptyMessage(MSG_GAPLESS_UPDATE); + + if (mPendingSeek != 0) { + if (mPendingSeekSong == song.id) + mMediaPlayer.seekTo(mPendingSeek); + // Clear this even if we did not seek: + // We somehow managed to play a different song, so + // whatever we were supposed to seek to, is invalid now. + mPendingSeek = 0; + } + + if ((mState & FLAG_PLAYING) != 0) + mMediaPlayer.start(); + + if ((mState & FLAG_ERROR) != 0) { + mErrorMessage = null; + updateState(mState & ~FLAG_ERROR); + } + mSkipBroken = 0; /* File not broken, reset skip counter */ + } catch (IOException e) { + mErrorMessage = getResources().getString(R.string.song_load_failed, song.path); + updateState(mState | FLAG_ERROR); + showToast(mErrorMessage, Toast.LENGTH_LONG); + Log.e("VanillaMusic", "IOException", e); + + /* Automatically advance to next song IF we are currently playing or already did skip something + * This will stop after skipping 10 songs to avoid endless loops (queue full of broken stuff */ + if(!mTimeline.isEndOfQueue() && getSong(1) != null && (playing || (mSkipBroken > 0 && mSkipBroken < 10))) { + mSkipBroken++; + mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_SKIP_BROKEN_SONG, getTimelinePosition(), 0), 1000); + } + + } + + updateNotification(); + + } + + @Override + public void onCompletion(MediaPlayer player) + { + + // Count this song as played + mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_UPDATE_PLAYCOUNTS, 1, 0, mCurrentSong), 800); + + if (finishAction(mState) == SongTimeline.FINISH_REPEAT_CURRENT) { + setCurrentSong(0); + } else if (finishAction(mState) == SongTimeline.FINISH_STOP_CURRENT) { + unsetFlag(FLAG_PLAYING); + setCurrentSong(+1); + } else { + if (mTimeline.isEndOfQueue()) { + unsetFlag(FLAG_PLAYING); + } + setCurrentSong(+1); + } + } + + @Override + public boolean onError(MediaPlayer player, int what, int extra) + { + Log.e("VanillaMusic", "MediaPlayer error: " + what + ' ' + extra); + + return true; + } + + /** + * Returns the song <code>delta</code> places away from the current + * position. + * + * @see SongTimeline#getSong(int) + */ + public Song getSong(int delta) + { + if (mTimeline == null) + return null; + if (delta == 0) + return mCurrentSong; + return mTimeline.getSong(delta); + } + + private class Receiver extends BroadcastReceiver { + @Override + public void onReceive(Context content, Intent intent) + { + String action = intent.getAction(); + + if (AudioManager.ACTION_AUDIO_BECOMING_NOISY.equals(action)) { + if (mHeadsetPause) { + pause(); + } + } else if (Intent.ACTION_SCREEN_ON.equals(action)) { + userActionTriggered(); + } + } + } + + public void onMediaChange() + { + if (MediaUtils.isSongAvailable(getApplicationContext())) { + if ((mState & FLAG_NO_MEDIA) != 0) + setCurrentSong(0); + } else { + setFlag(FLAG_NO_MEDIA); + } + + ArrayList<TimelineCallback> list = sCallbacks; + for (int i = list.size(); --i != -1; ) + list.get(i).onMediaChange(); + + } + + @Override + public void onSharedPreferenceChanged(SharedPreferences settings, String key) + { + loadPreference(key); + } + + /** + * Releases mWakeLock and closes any open AudioFx sessions + */ + private static final int MSG_ENTER_SLEEP_STATE = 1; + /** + * Run the given query and add the results to the timeline. + * + * obj is the QueryTask. arg1 is the add mode (one of SongTimeline.MODE_*) + */ + private static final int MSG_QUERY = 2; + /** + * This message is sent with a delay specified by a user preference. After + * this delay, assuming no new IDLE_TIMEOUT messages cancel it, playback + * will be stopped. + */ + private static final int MSG_IDLE_TIMEOUT = 4; + /** + * Decrease the volume gradually over five seconds, pausing when 0 is + * reached. + * + * arg1 should be the progress in the fade as a percentage, 1-100. + */ + private static final int MSG_FADE_OUT = 7; + /** + * If arg1 is 0, calls {@link PlaybackService#playPause()}. + * Otherwise, calls {@link PlaybackService#setCurrentSong(int)} with arg1. + */ + private static final int MSG_CALL_GO = 8; + /** + * The combination of (current song, current playback state) changed. + */ + private static final int MSG_BROADCAST_CHANGE = 10; + private static final int MSG_SAVE_STATE = 12; + private static final int MSG_PROCESS_SONG = 13; + private static final int MSG_PROCESS_STATE = 14; + private static final int MSG_SKIP_BROKEN_SONG = 15; + private static final int MSG_GAPLESS_UPDATE = 16; + private static final int MSG_UPDATE_PLAYCOUNTS = 17; + private static final int MSG_SHOW_TOAST = 18; + /** + * The current song's playback position changed. + */ + private static final int MSG_BROADCAST_SEEK = 19; + + @Override + public boolean handleMessage(Message message) + { + switch (message.what) { + case MSG_CALL_GO: + if (message.arg1 == 0) + playPause(false); + else + setCurrentSong(message.arg1); + break; + case MSG_SAVE_STATE: + // For unexpected terminations: crashes, task killers, etc. + // In most cases onDestroy will handle this + saveState(0); + break; + case MSG_PROCESS_SONG: + processSong((Song)message.obj); + break; + case MSG_QUERY: + runQuery((QueryTask)message.obj); + break; + case MSG_IDLE_TIMEOUT: + if ((mState & FLAG_PLAYING) != 0) { + mHandler.sendMessage(mHandler.obtainMessage(MSG_FADE_OUT, 0)); + } + break; + case MSG_FADE_OUT: + if (mFadeOut <= 0.0f) { + mIdleStart = SystemClock.elapsedRealtime(); + unsetFlag(FLAG_PLAYING); + } else { + mFadeOut -= 0.01f; + mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_FADE_OUT, 0), 50); + } + refreshReplayGainValues(); /* Updates the volume using the new mFadeOut value */ + break; + case MSG_PROCESS_STATE: + processNewState(message.arg1, message.arg2); + break; + case MSG_BROADCAST_CHANGE: + TimestampedObject tso = (TimestampedObject)message.obj; + broadcastChange(message.arg1, (Song)tso.object, tso.uptime); + break; + case MSG_ENTER_SLEEP_STATE: + enterSleepState(); + break; + case MSG_SKIP_BROKEN_SONG: + /* Advance to next song if the user didn't already change. + * But we are restoring the Playing state in ANY case as we are most + * likely still stopped due to the error + * Note: This is somewhat racy with user input but also is the - by far - simplest + * solution */ + if(getTimelinePosition() == message.arg1) { + setCurrentSong(1); + } + // Optimistically claim to have recovered from this error + mErrorMessage = null; + unsetFlag(FLAG_ERROR); + mHandler.sendMessage(mHandler.obtainMessage(MSG_CALL_GO, 0, 0)); + break; + case MSG_GAPLESS_UPDATE: + triggerGaplessUpdate(); + break; + case MSG_UPDATE_PLAYCOUNTS: + Song song = (Song)message.obj; + boolean played = message.arg1 == 1; + PlayCountsHelper.countSong(getApplicationContext(), song, played); + // Update the playcounts playlist in ~20% of all cases if enabled + if (mAutoPlPlaycounts > 0 && Math.random() > 0.8) { + Context context = getApplicationContext(); + // Add an invisible whitespace to adjust our sorting + String playlistName = getString(R.string.autoplaylist_playcounts_name, mAutoPlPlaycounts); + long id = Playlist.createPlaylist(context, playlistName); + ArrayList<Long> items = PlayCountsHelper.getTopSongs(context, mAutoPlPlaycounts); + Playlist.addToPlaylist(context, id, items); + } + break; + case MSG_SHOW_TOAST: + CharSequence text = (CharSequence)message.obj; + int duration = message.arg1; + int resId = message.arg2; + if (text != null) { + Toast.makeText(this, text, duration).show(); + } else { + Toast.makeText(this, resId, duration).show(); + } + break; + case MSG_BROADCAST_SEEK: + mRemoteControlClient.updateRemote(mCurrentSong, mState, mForceNotificationVisible); + mMediaSessionTracker.updateSession(mCurrentSong, mState); + break; + default: + return false; + } + + return true; + } + + /** + * Returns the current service state. The state comprises several individual + * flags. + */ + public int getState() + { + synchronized (mStateLock) { + return mState; + } + } + + /** + * Returns the current position in current song in milliseconds. + */ + public int getPosition() + { + if (!mMediaPlayerInitialized) + return 0; + return mMediaPlayer.getCurrentPosition(); + } + + /** + * Returns the song duration in milliseconds. + */ + public int getDuration() + { + if (!mMediaPlayerInitialized) + return 0; + return mMediaPlayer.getDuration(); + } + + /** + * Returns the global audio session + */ + public int getAudioSession() { + // Must not be 'ready' or initialized: the audio session + // is set on object creation + return mMediaPlayer.getAudioSessionId(); + } + + /** + * Seek to a position in the current song. + * + * @param progress Proportion of song completed (where 1000 is the end of the song) + */ + public void seekToProgress(int progress) + { + if (!mMediaPlayerInitialized) + return; + long position = (long)mMediaPlayer.getDuration() * progress / 1000; + seekToPosition((int) position); + } + + /** + * Seeks to the given position in the current song. + * + * @param msec the offset in milliseconds from the start to seek to + */ + public void seekToPosition(int msec) { + if (!mMediaPlayerInitialized) { + return; + } + mMediaPlayer.seekTo(msec); + mHandler.sendEmptyMessage(MSG_BROADCAST_SEEK); + } + + @Override + public IBinder onBind(Intent intents) + { + return null; + } + + @Override + public void activeSongReplaced(int delta, Song song) + { + ArrayList<TimelineCallback> list = sCallbacks; + for (int i = list.size(); --i != -1; ) + list.get(i).replaceSong(delta, song); + + if (delta == 0) + setCurrentSong(0); + } + + /** + * Delete all the songs in the given media set. Should be run on a + * background thread. + * + * @param type One of the TYPE_* constants, excluding playlists. + * @param id The MediaStore id of the media to delete. + * @return The number of songs deleted. + */ + public int deleteMedia(int type, long id) + { + int count = 0; + String[] projection = new String [] { MediaLibrary.SongColumns._ID, MediaLibrary.SongColumns.PATH }; + Cursor cursor = MediaUtils.buildQuery(type, id, projection, null).runQuery(getApplicationContext()); + + if (cursor != null) { + while (cursor.moveToNext()) { + if (new File(cursor.getString(1)).delete()) { + long songId = cursor.getLong(0); + MediaLibrary.removeSong(getApplicationContext(), songId); + mTimeline.removeSong(songId); + ++count; + } + } + cursor.close(); + } + return count; + } + + /** + * Move to next or previous song or album in the queue. + * + * @param delta One of SongTimeline.SHIFT_*. + * @return The new current song. + */ + public Song shiftCurrentSong(int delta) + { + preparePlayCountsUpdate(delta); + Song song = setCurrentSong(delta); + userActionTriggered(); + return song; + } + + /** + * Skips to the previous song OR rewinds the currently playing track, depending + * on the current position. + * + * @return The new current song + */ + public Song rewindCurrentSong() { + int delta = SongTimeline.SHIFT_PREVIOUS_SONG; + if(getPosition() > REWIND_AFTER_PLAYED_MS && getDuration() > REWIND_AFTER_PLAYED_MS*2) { + delta = SongTimeline.SHIFT_KEEP_SONG; + } + return shiftCurrentSong(delta); + } + + /** + * Resets the idle timeout countdown. Should be called by a user action + * has been triggered (new song chosen or playback toggled). + * + * If an idle fade out is actually in progress, aborts it and resets the + * volume. + */ + public void userActionTriggered() + { + mHandler.removeMessages(MSG_FADE_OUT); + mHandler.removeMessages(MSG_IDLE_TIMEOUT); + if (mIdleTimeout != 0) + mHandler.sendEmptyMessageDelayed(MSG_IDLE_TIMEOUT, mIdleTimeout * 1000); + + if (mFadeOut != 1.0f) { + mFadeOut = 1.0f; + refreshReplayGainValues(); + } + + long idleStart = mIdleStart; + if (idleStart != -1 && SystemClock.elapsedRealtime() - idleStart < IDLE_GRACE_PERIOD) { + mIdleStart = -1; + setFlag(FLAG_PLAYING); + } + } + + /** + * Run the query and add the results to the timeline. Should be called in the + * worker thread. + * + * @param query The query to run. + */ + private void runQuery(QueryTask query) + { + int count = mTimeline.addSongs(this, query); + + int text; + + switch (query.mode) { + case SongTimeline.MODE_PLAY: + case SongTimeline.MODE_PLAY_POS_FIRST: + case SongTimeline.MODE_PLAY_ID_FIRST: + text = R.plurals.playing; + if (count != 0 && (mState & FLAG_PLAYING) == 0) + setFlag(FLAG_PLAYING); + break; + case SongTimeline.MODE_FLUSH_AND_PLAY_NEXT: + case SongTimeline.MODE_ENQUEUE: + case SongTimeline.MODE_ENQUEUE_ID_FIRST: + case SongTimeline.MODE_ENQUEUE_POS_FIRST: + case SongTimeline.MODE_ENQUEUE_AS_NEXT: + text = R.plurals.enqueued; + break; + default: + throw new IllegalArgumentException("Invalid add mode: " + query.mode); + } + showToast(getResources().getQuantityString(text, count, count), Toast.LENGTH_SHORT); + } + + /** + * Run the query in the background and add the results to the timeline. + * + * @param query The query. + */ + public void addSongs(QueryTask query) + { + mHandler.sendMessage(mHandler.obtainMessage(MSG_QUERY, query)); + } + + + /** + * Enqueues all the songs with the same album/artist/genre as the passed + * song. + * + * This will clear the queue and place the first song from the group after + * the playing song. + * + * @param song The song to base the query on + * @param type The media type, one of MediaUtils.TYPE_ALBUM, TYPE_ARTIST, + * or TYPE_GENRE + */ + public void enqueueFromSong(Song song, int type) + { + if (song == null) + return; + + long id; + switch (type) { + case MediaUtils.TYPE_ARTIST: + id = song.artistId; + break; + case MediaUtils.TYPE_ALBUM: + id = song.albumId; + break; + case MediaUtils.TYPE_GENRE: + id = MediaUtils.queryGenreForSong(getApplicationContext(), song.id); + break; + default: + throw new IllegalArgumentException("Unsupported media type: " + type); + } + + String selection = "_id!=" + song.id; + QueryTask query = MediaUtils.buildQuery(type, id, Song.FILLED_PROJECTION, selection); + query.mode = SongTimeline.MODE_FLUSH_AND_PLAY_NEXT; + addSongs(query); + } + + /** + * Clear the song queue. + */ + public void clearQueue() + { + mTimeline.clearQueue(); + } + + /** + * Empty the song queue. + */ + public void emptyQueue() + { + pause(); + setFlag(FLAG_EMPTY_QUEUE); + mTimeline.emptyQueue(); + } + + /** + * Return the error message set when FLAG_ERROR is set. + */ + public String getErrorMessage() + { + return mErrorMessage; + } + + @Override + public void timelineChanged() + { + mHandler.removeMessages(MSG_SAVE_STATE); + mHandler.sendEmptyMessageDelayed(MSG_SAVE_STATE, SAVE_STATE_DELAY); + + // Trigger a gappless update for the new timeline + // This might get canceled if setCurrentSong() also fired a call + // to processSong(); + mHandler.removeMessages(MSG_GAPLESS_UPDATE); + mHandler.sendEmptyMessageDelayed(MSG_GAPLESS_UPDATE, 100); + + ArrayList<TimelineCallback> list = sCallbacks; + for (int i = list.size(); --i != -1; ) + list.get(i).onTimelineChanged(); + + } + + @Override + public void positionInfoChanged() + { + ArrayList<TimelineCallback> list = sCallbacks; + for (int i = list.size(); --i != -1; ) + list.get(i).onPositionInfoChanged(); + mRemoteControlClient.updateRemote(mCurrentSong, mState, mForceNotificationVisible); + mMediaSessionTracker.updateSession(mCurrentSong, mState); + } + + private final LibraryObserver mObserver = new LibraryObserver() { + @Override + public void onChange(LibraryObserver.Type type, long id, boolean ongoing) + { + if (type != LibraryObserver.Type.SONG && type != LibraryObserver.Type.PLAYLIST) + return; + + MediaUtils.onMediaChange(); + onMediaChange(); + } + }; + + /** + * Return the PlaybackService instance, creating one if needed. + */ + public static PlaybackService get(Context context) + { + if (sInstance == null) { + context.startService(new Intent(context, PlaybackService.class)); + + while (sInstance == null) { + try { + synchronized (sWait) { + sWait.wait(); + } + } catch (InterruptedException ignored) { + } + } + } + + return sInstance; + } + + /** + * Returns true if a PlaybackService instance is active. + */ + public static boolean hasInstance() + { + return sInstance != null; + } + + /** + * Add an Activity to the registered PlaybackActivities. + */ + public static void addTimelineCallback(TimelineCallback consumer) + { + sCallbacks.add(consumer); + } + + /** + * Remove an Activity from the registered PlaybackActivities + */ + public static void removeTimelineCallback(TimelineCallback consumer) + { + sCallbacks.remove(consumer); + } + + /** + * Initializes the service state, loading songs saved from the disk into the + * song timeline. + * + * @return The loaded value for mState. + */ + public int loadState() + { + int state = 0; + + try { + DataInputStream in = new DataInputStream(openFileInput(STATE_FILE)); + + if (in.readLong() == STATE_FILE_MAGIC && in.readInt() == STATE_VERSION) { + mPendingSeek = in.readInt(); + mPendingSeekSong = in.readLong(); + mTimeline.readState(in); + state |= mTimeline.getShuffleMode() << SHIFT_SHUFFLE; + state |= mTimeline.getFinishAction() << SHIFT_FINISH; + } + + in.close(); + } catch (EOFException e) { + Log.w("VanillaMusic", "Failed to load state", e); + } catch (IOException e) { + Log.w("VanillaMusic", "Failed to load state", e); + } + + return state; + } + + /** + * Save the service state to disk. + * + * @param pendingSeek The pendingSeek to store. Should be the current + * MediaPlayer position or 0. + */ + public void saveState(int pendingSeek) + { + try { + DataOutputStream out = new DataOutputStream(openFileOutput(STATE_FILE, 0)); + Song song = mCurrentSong; + out.writeLong(STATE_FILE_MAGIC); + out.writeInt(STATE_VERSION); + out.writeInt(pendingSeek); + out.writeLong(song == null ? -1 : song.id); + mTimeline.writeState(out); + out.close(); + } catch (IOException e) { + Log.w("VanillaMusic", "Failed to save state", e); + } + } + + /** + * Returns the shuffle mode for the given state. + * + * @param state The PlaybackService state to process. + * @return The shuffle mode. One of SongTimeline.SHUFFLE_*. + */ + public static int shuffleMode(int state) + { + return (state & MASK_SHUFFLE) >> SHIFT_SHUFFLE; + } + + /** + * Returns the finish action for the given state. + * + * @param state The PlaybackService state to process. + * @return The finish action. One of SongTimeline.FINISH_*. + */ + public static int finishAction(int state) + { + return (state & MASK_FINISH) >> SHIFT_FINISH; + } + + /** + * Create a PendingIntent for use with the notification. + * + * @param prefs Where to load the action preference from. + */ + public PendingIntent createNotificationAction(SharedPreferences prefs) + { + switch (Integer.parseInt(prefs.getString(PrefKeys.NOTIFICATION_ACTION, PrefDefaults.NOTIFICATION_ACTION))) { + case NOT_ACTION_NEXT_SONG: { + Intent intent = new Intent(this, PlaybackService.class); + intent.setAction(PlaybackService.ACTION_NEXT_SONG_AUTOPLAY); + return PendingIntent.getService(this, 0, intent, PendingIntent.FLAG_IMMUTABLE); + } + case NOT_ACTION_MINI_ACTIVITY: { + Intent intent = new Intent(this, MiniPlaybackActivity.class); + return PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_IMMUTABLE); + } + default: + Log.w("VanillaMusic", "Unknown value for notification_action. Defaulting to 0."); + // fall through + case NOT_ACTION_MAIN_ACTIVITY: { + Intent intent = new Intent(this, LibraryActivity.class); + intent.setAction(Intent.ACTION_MAIN); + return PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_IMMUTABLE); + } + case NOT_ACTION_FULL_ACTIVITY: { + Intent intent = new Intent(this, FullPlaybackActivity.class); + intent.setAction(Intent.ACTION_MAIN); + return PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_IMMUTABLE); + } + } + } + + /** + * Create a song notification. Call through the NotificationHelper to + * display it. + * + * @param song The Song to display information about. + * @param state The state. Determines whether to show paused or playing icon. + */ + public Notification createNotification(Song song, int state) + { + final boolean playing = (state & FLAG_PLAYING) != 0; + + ComponentName service = new ComponentName(this, PlaybackService.class); + + int playButton = ThemeHelper.getPlayButtonResource(playing); + Intent playPause = new Intent(PlaybackService.ACTION_TOGGLE_PLAYBACK) + .putExtra(PlaybackService.EXTRA_FORCE_NOTIFICATION, true) + .setComponent(service); + + Intent next = new Intent(PlaybackService.ACTION_NEXT_SONG) + .setComponent(service); + + Intent previous = new Intent(PlaybackService.ACTION_PREVIOUS_SONG) + .setComponent(service); + + NotificationCompat.Builder n = mNotificationHelper.getNewBuilder(getApplicationContext()) + .setVisibility(NotificationCompat.VISIBILITY_PUBLIC) + .setSmallIcon(R.drawable.status_icon) + .setContentTitle(song.title) + .setContentText(song.album) + .setSubText(song.artist) + .setContentIntent(mNotificationAction) + .addAction(new NotificationCompat.Action(R.drawable.previous, + getString(R.string.previous_song), PendingIntent.getService(this, 0, previous, PendingIntent.FLAG_IMMUTABLE|PendingIntent.FLAG_UPDATE_CURRENT))) + .addAction(new NotificationCompat.Action(playButton, + getString(R.string.play_pause), PendingIntent.getService(this, 0, playPause, PendingIntent.FLAG_IMMUTABLE|PendingIntent.FLAG_UPDATE_CURRENT))) + .addAction(new NotificationCompat.Action(R.drawable.next, + getString(R.string.next_song), PendingIntent.getService(this, 0, next, PendingIntent.FLAG_IMMUTABLE|PendingIntent.FLAG_UPDATE_CURRENT))) + .setStyle(new androidx.media.app.NotificationCompat.MediaStyle() + .setMediaSession(mMediaSessionTracker.getSessionToken()) + .setShowActionsInCompactView(0, 1, 2)) + .setForegroundServiceBehavior(NotificationCompat.FOREGROUND_SERVICE_IMMEDIATE); + + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) { + // Only set the cover for android < 13 since newer versions display the cover from the media session anyway. + Bitmap cover = song.getMediumCover(this); + if (cover == null) { + cover = BitmapFactory.decodeResource(getResources(), R.drawable.fallback_cover_large); + } + n.setLargeIcon(cover); + } + + return n.build(); + } + + public void onAudioFocusChange(int type) + { + Log.d("VanillaMusic", "audio focus change: " + type); + + // Rewrite permanent focus loss into can_duck + if (mIgnoreAudioFocusLoss) { + switch (type) { + case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT: + case AudioManager.AUDIOFOCUS_LOSS: + type = AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK; + } + } + + switch (type) { + case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK: + case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT: + synchronized (mStateLock) { + if((mState & FLAG_PLAYING) != 0) { + mTransientAudioLoss = true; + + if(type == AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK) { + setFlag(FLAG_DUCKING); + } else { + mForceNotificationVisible = true; + unsetFlag(FLAG_PLAYING); + } + } + break; + } + case AudioManager.AUDIOFOCUS_LOSS: + mTransientAudioLoss = false; + mForceNotificationVisible = true; + unsetFlag(FLAG_PLAYING); + break; + case AudioManager.AUDIOFOCUS_GAIN: + if (mTransientAudioLoss) { + mTransientAudioLoss = false; + // Restore all flags possibly changed by AUDIOFOCUS_LOSS_TRANSIENT_* + unsetFlag(FLAG_DUCKING); + setFlag(FLAG_PLAYING); + } + break; + } + } + + @Override + public void onSensorChanged(SensorEvent se) + { + double x = se.values[0]; + double y = se.values[1]; + double z = se.values[2]; + + double accel = Math.sqrt(x*x + y*y + z*z); + double delta = accel - mAccelLast; + mAccelLast = accel; + + double filtered = mAccelFiltered * 0.9f + delta; + mAccelFiltered = filtered; + + if (filtered > mShakeThreshold) { + long now = SystemClock.elapsedRealtime(); + if (now - mLastShakeTime > MIN_SHAKE_PERIOD) { + mLastShakeTime = now; + performAction(mShakeAction, null); + } + } + } + + @Override + public void onAccuracyChanged(Sensor sensor, int accuracy) + { + } + + /** + * Execute the given action. + * + * @param action The action to execute. + * @param receiver Optional. If non-null, update the PlaybackActivity with + * new song or state from the executed action. The activity will still be + * updated by the broadcast if not passed here; passing it just makes the + * update immediate. + */ + public void performAction(Action action, PlaybackActivity receiver) + { + switch (action) { + case Nothing: + break; + case Library: + Intent intent = new Intent(this, LibraryActivity.class); + intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(intent); + break; + case PlayPause: { + int state = playPause(false); + if (receiver != null) + receiver.setState(state); + break; + } + case NextSong: { + Song song = shiftCurrentSong(SongTimeline.SHIFT_NEXT_SONG); + if (receiver != null) + receiver.setSong(song); + break; + } + case PreviousSong: { + Song song = shiftCurrentSong(SongTimeline.SHIFT_PREVIOUS_SONG); + if (receiver != null) + receiver.setSong(song); + break; + } + case NextAlbum: { + Song song = shiftCurrentSong(SongTimeline.SHIFT_NEXT_ALBUM); + if (receiver != null) + receiver.setSong(song); + break; + } + case PreviousAlbum: { + Song song = shiftCurrentSong(SongTimeline.SHIFT_PREVIOUS_ALBUM); + if (receiver != null) + receiver.setSong(song); + break; + } + case Repeat: { + int state = cycleFinishAction(); + if (receiver != null) + receiver.setState(state); + break; + } + case Shuffle: { + int state = cycleShuffle(); + if (receiver != null) + receiver.setState(state); + break; + } + case EnqueueAlbum: + enqueueFromSong(mCurrentSong, MediaUtils.TYPE_ALBUM); + break; + case EnqueueArtist: + enqueueFromSong(mCurrentSong, MediaUtils.TYPE_ARTIST); + break; + case EnqueueGenre: + enqueueFromSong(mCurrentSong, MediaUtils.TYPE_GENRE); + break; + case ClearQueue: + clearQueue(); + showToast(R.string.queue_cleared, Toast.LENGTH_SHORT); + break; + case ToggleControls: + case ShowQueue: + // These are NOOPs here and should be handled in FullPlaybackActivity + break; + case SeekForward: + if (mCurrentSong != null) { + mPendingSeekSong = mCurrentSong.id; + mPendingSeek = getPosition() + 10000; + // We 'abuse' setCurrentSong as it will stop the playback and restart it + // at the new position, taking care of the ui update + setCurrentSong(0); + } + break; + case SeekBackward: + if (mCurrentSong != null) { + mPendingSeekSong = mCurrentSong.id; + mPendingSeek = getPosition() - 10000; + if (mPendingSeek < 1) mPendingSeek = 1; // must at least be 1 + setCurrentSong(0); + } + break; + default: + throw new IllegalArgumentException("Invalid action: " + action); + } + } + + /** + * Returns the playing status of the current song + */ + public boolean isPlaying() { + return (mState & FLAG_PLAYING) != 0; + } + + /** + * Returns the position of the current song in the song timeline. + */ + public int getTimelinePosition() + { + return mTimeline.getPosition(); + } + + /** + * Returns the number of songs in the song timeline. + */ + public int getTimelineLength() + { + return mTimeline.getLength(); + } + + /** + * Returns {@link Song} with given position from timeline or null if nothing found + */ + public Song getSongByQueuePosition(int pos) { + return mTimeline.getSongByQueuePosition(pos); + } + + /** + * Retrieve song position in timeline + * @param id song id as defined in {@link Song#id} + * @return absolute position in song timeline or -1 if song currently not in timeline + */ + public int getQueuePositionForSongId(long id) { + return mTimeline.getQueuePositionForSongId(id); + } + + /** + * Do a 'hard' jump to given queue position + */ + public void jumpToQueuePosition(int pos) { + mTimeline.setCurrentQueuePosition(pos); + play(); + } + + /** + * Moves a songs position in the queue + * + * @param from the index of the song to be moved + * @param to the new index position of the song + */ + public void moveSongPosition(int from, int to) { + mTimeline.moveSongPosition(from, to); + } + + /** + * Removes a song from the queue + * @param which index to remove + */ + public void removeSongPosition(int which) { + mTimeline.removeSongPosition(which); + } + +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/Playlist.java b/app/src/main/java/ch/blinkenlights/android/vanilla/Playlist.java new file mode 100644 index 0000000..ade3bae --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/Playlist.java @@ -0,0 +1,237 @@ +/* + * Copyright (C) 2010 Christopher Eby <kreed@kreed.org> + * Copyright (C) 2014-2016 Adrian Ulrich <adrian@blinkenlights.ch> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package ch.blinkenlights.android.vanilla; + +import ch.blinkenlights.android.medialibrary.MediaLibrary; + +import android.content.Context; +import android.content.ContentValues; +import android.database.Cursor; +import android.text.TextUtils; +import java.util.ArrayList; + +import androidx.annotation.Nullable; + +/** + * Provides various playlist-related utility functions. + */ +public class Playlist { + /** + * Queries all the playlists known to the MediaLibrary. + * + * @param context the context to use + * @return The queried cursor. + */ + public static Cursor queryPlaylists(Context context) { + final String[] projection = { MediaLibrary.PlaylistColumns._ID, MediaLibrary.PlaylistColumns.NAME }; + final String sort = MediaLibrary.PlaylistColumns.NAME; + return MediaLibrary.queryLibrary(context, MediaLibrary.TABLE_PLAYLISTS, projection, null, null, sort); + } + + /** + * Retrieves the id for a playlist with the given name. + * + * @param context the context to use + * @param name The name of the playlist. + * @return The id of the playlist, or -1 if there is no playlist with the + * given name. + */ + public static long getPlaylist(Context context, String name) + { + long id = -1; + final String[] projection = { MediaLibrary.PlaylistColumns._ID }; + final String selection = MediaLibrary.PlaylistColumns.NAME+"=?"; + final String[] selectionArgs = { name }; + Cursor cursor = MediaLibrary.queryLibrary(context, MediaLibrary.TABLE_PLAYLISTS, projection, selection, selectionArgs, null); + + if (cursor != null) { + if (cursor.moveToNext()) + id = cursor.getLong(0); + cursor.close(); + } + + return id; + } + + /** + * Returns the name of given playlist id. + * + * @param context the context to use + * @param id the playlist id to look up + * @return name of the playlist, may be null + */ + public static @Nullable String getPlaylist(Context context, long id) + { + String name = null; + final String[] projection = { MediaLibrary.PlaylistColumns.NAME }; + final String selection = MediaLibrary.PlaylistColumns._ID+"=?"; + final String[] selectionArgs = { Long.valueOf(id).toString() }; + Cursor cursor = MediaLibrary.queryLibrary(context, MediaLibrary.TABLE_PLAYLISTS, projection, selection, selectionArgs, null); + + if (cursor != null) { + if (cursor.moveToNext()) + name = cursor.getString(0); + cursor.close(); + } + + return name; + } + + /** + * Create a new playlist with the given name. If a playlist with the given + * name already exists, it will be overwritten. + * + * @param context the context to use + * @param name The name of the playlist. + * @return The id of the new playlist. + */ + public static long createPlaylist(Context context, String name) + { + long id = getPlaylist(context, name); + if (id != -1) + deletePlaylist(context, id); + + id = MediaLibrary.createPlaylist(context, name); + return id; + } + + /** + * Run the given query and add the results to the given playlist. Should be + * run on a background thread. + * + * @param context the context to use + * @param playlistId The playlist id of the playlist to + * modify. + * @param query The query to run. The audio id should be the first column. + * @return The number of songs that were added to the playlist. + */ + public static int addToPlaylist(Context context, long playlistId, QueryTask query) { + ArrayList<Long> result = new ArrayList<Long>(); + Cursor cursor = query.runQuery(context); + if (cursor != null) { + while (cursor.moveToNext()) { + result.add(cursor.getLong(0)); + } + } + return addToPlaylist(context, playlistId, result); + } + + /** + * Adds a set of audioIds to the given playlist. Should be + * run on a background thread. + * + * @param context the context to use + * @param playlistId The playlist id of the playlist to + * modify. + * @param audioIds An ArrayList with all IDs to add + * @return The number of songs that were added to the playlist. + */ + public static int addToPlaylist(Context context, long playlistId, ArrayList<Long> audioIds) { + if (playlistId == -1) + return 0; + return MediaLibrary.addToPlaylist(context, playlistId, audioIds); + } + + /** + * Removes a set of audioIds from the given playlist. Should be + * run on a background thread. + * + * @param context the context to use + * @param playlistId id of the playlist to + * modify. + * @param audioIds An ArrayList with all IDs to drop + * @return The number of songs that were removed from the playlist + */ + public static int removeFromPlaylist(Context context, long playlistId, ArrayList<Long> audioIds) { + if (playlistId == -1) + return 0; + + String idList = TextUtils.join(", ", audioIds); + String selection = MediaLibrary.PlaylistSongColumns.SONG_ID+" IN ("+idList+") AND "+MediaLibrary.PlaylistSongColumns.PLAYLIST_ID+"="+playlistId; + return MediaLibrary.removeFromPlaylist(context, selection, null); + } + + /** + * Delete the playlist with the given id. + * + * @param context the context to use + * @param id the id of the playlist. + */ + public static void deletePlaylist(Context context, long id) { + MediaLibrary.removePlaylist(context, id); + } + + + /** + * Rename the playlist with the given id. + * + * @param context the context to use + * @param id The Media.Audio.Playlists id of the playlist. + * @param newName The new name for the playlist. + */ + public static void renamePlaylist(Context context, long id, String newName) { + MediaLibrary.renamePlaylist(context, id, newName); + } + + /** + * Returns the ID of the 'favorites' playlist. + * + * @param context The Context to use + * @param create Create the playlist if it does not exist + * @return the id of the playlist, -1 on error + */ + public static long getFavoritesId(Context context, boolean create) { + String playlistName = context.getString(R.string.playlist_favorites); + long playlistId = getPlaylist(context, playlistName); + + if (playlistId == -1 && create == true) + playlistId = createPlaylist(context, playlistName); + + return playlistId; + } + + /** + * Searches for given song in given playlist + * + * @param context the context to use + * @param playlistId The ID of the Playlist to query + * @param song The Song to search in given playlistId + * @return true if `song' was found in `playlistId' + */ + public static boolean isInPlaylist(Context context, long playlistId, Song song) { + if (playlistId == -1 || song == null) + return false; + + boolean found = false; + String selection = MediaLibrary.PlaylistSongColumns.PLAYLIST_ID+"=? AND "+MediaLibrary.PlaylistSongColumns.SONG_ID+"=?"; + String[] selectionArgs = { Long.toString(playlistId), Long.toString(song.id) }; + + Cursor cursor = MediaLibrary.queryLibrary(context, MediaLibrary.TABLE_PLAYLISTS_SONGS, Song.EMPTY_PLAYLIST_PROJECTION, selection, selectionArgs, null); + if (cursor != null) { + found = cursor.getCount() != 0; + cursor.close(); + } + return found; + } +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/PlaylistActivity.java b/app/src/main/java/ch/blinkenlights/android/vanilla/PlaylistActivity.java new file mode 100644 index 0000000..7aed110 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/PlaylistActivity.java @@ -0,0 +1,337 @@ +/* + * Copyright (C) 2018 Adrian Ulrich <adrian@blinkenlights.ch> + * Copyright (C) 2012 Christopher Eby <kreed@kreed.org> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package ch.blinkenlights.android.vanilla; + +import ch.blinkenlights.android.vanilla.ui.FancyMenu; +import ch.blinkenlights.android.vanilla.ui.FancyMenuItem; +import ch.blinkenlights.android.vanilla.ext.CoordClickListener; + +import android.app.Activity; +import android.app.AlertDialog; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.SharedPreferences; +import android.os.Bundle; +import android.os.HandlerThread; +import android.os.Looper; +import android.view.LayoutInflater; +import android.view.MenuItem; +import android.view.View; +import android.view.ViewGroup; +import android.widget.AbsListView; +import android.widget.AdapterView; +import android.widget.Button; +import com.mobeta.android.dslv.DragSortListView; + + +/** + * The playlist activity where playlist songs can be viewed and reordered. + */ +public class PlaylistActivity extends Activity + implements View.OnClickListener + , AbsListView.OnItemClickListener + , CoordClickListener.Callback + , DialogInterface.OnClickListener + , DragSortListView.DropListener + , DragSortListView.RemoveListener + , FancyMenu.Callback +{ + /** + * The SongTimeline play mode corresponding to each + * LibraryActivity.ACTION_* + */ + private static final int[] MODE_FOR_ACTION = + { SongTimeline.MODE_PLAY, SongTimeline.MODE_ENQUEUE, -1, + SongTimeline.MODE_PLAY_POS_FIRST, SongTimeline.MODE_ENQUEUE_POS_FIRST, + -1, -1, -1, SongTimeline.MODE_ENQUEUE_AS_NEXT }; + + /** + * An event loop running on a worker thread. + */ + private Looper mLooper; + private DragSortListView mListView; + private PlaylistAdapter mAdapter; + + /** + * The id of the playlist this activity is currently viewing. + */ + private long mPlaylistId; + /** + * The name of the playlist this activity is currently viewing. + */ + private String mPlaylistName; + /** + * If true, then playlists songs can be dragged to reorder. + */ + private boolean mEditing; + + /** + * The item click action specified in the preferences. + */ + private int mDefaultAction; + /** + * The last action used from the context menu, used to implement + * LAST_USED_ACTION action. + */ + private int mLastAction = LibraryActivity.ACTION_PLAY; + + private Button mEditButton; + private Button mDeleteButton; + + @Override + public void onCreate(Bundle state) + { + ThemeHelper.setTheme(this, R.style.BackActionBar); + super.onCreate(state); + + HandlerThread thread = new HandlerThread(getClass().getName()); + thread.start(); + + setContentView(R.layout.playlist_activity); + + CoordClickListener ccl = new CoordClickListener(this); + DragSortListView view = (DragSortListView)findViewById(R.id.list); + ccl.registerForOnItemLongClickListener(view); + view.setOnItemClickListener(this); + view.setDropListener(this); + view.setRemoveListener(this); + mListView = view; + + View header = LayoutInflater.from(this).inflate(R.layout.playlist_buttons, null); + mEditButton = (Button)header.findViewById(R.id.edit); + mEditButton.setOnClickListener(this); + mDeleteButton = (Button)header.findViewById(R.id.delete); + mDeleteButton.setOnClickListener(this); + view.addHeaderView(header, null, false); + mLooper = thread.getLooper(); + mAdapter = new PlaylistAdapter(this, mLooper); + view.setAdapter(mAdapter); + + onNewIntent(getIntent()); + } + + @Override + public void onStart() + { + super.onStart(); + SharedPreferences settings = SharedPrefHelper.getSettings(this); + mDefaultAction = Integer.parseInt(settings.getString(PrefKeys.DEFAULT_PLAYLIST_ACTION, PrefDefaults.DEFAULT_PLAYLIST_ACTION)); + } + + @Override + public void onDestroy() + { + mLooper.quit(); + super.onDestroy(); + } + + @Override + public void onNewIntent(Intent intent) + { + long id = intent.getLongExtra("playlist", 0); + String title = intent.getStringExtra("title"); + mAdapter.setPlaylistId(id); + setTitle(title); + mPlaylistId = id; + mPlaylistName = title; + } + + /** + * Enable or disable edit mode, which allows songs to be reordered and + * removed. + * + * @param editing True to enable edit mode. + */ + public void setEditing(boolean editing) + { + mListView.setDragEnabled(editing); + mAdapter.setEditable(editing); + int visible = editing ? View.GONE : View.VISIBLE; + mDeleteButton.setVisibility(visible); + mEditButton.setText(editing ? R.string.done : R.string.edit); + mEditing = editing; + } + + @Override + public void onClick(View view) + { + switch (view.getId()) { + case R.id.edit: + setEditing(!mEditing); + break; + case R.id.delete: { + AlertDialog.Builder builder = new AlertDialog.Builder(this); + String message = getResources().getString(R.string.delete_playlist, mPlaylistName); + builder.setMessage(message); + builder.setPositiveButton(R.string.delete, this); + builder.setNegativeButton(android.R.string.cancel, this); + builder.show(); + break; + } + } + } + + private static final int MENU_PLAY = LibraryActivity.ACTION_PLAY; + private static final int MENU_PLAY_ALL = LibraryActivity.ACTION_PLAY_ALL; + private static final int MENU_ENQUEUE = LibraryActivity.ACTION_ENQUEUE; + private static final int MENU_ENQUEUE_ALL = LibraryActivity.ACTION_ENQUEUE_ALL; + private static final int MENU_ENQUEUE_AS_NEXT = LibraryActivity.ACTION_ENQUEUE_AS_NEXT; + private static final int MENU_REMOVE = -1; + private static final int MENU_SHOW_DETAILS = -2; + + @Override + public boolean onItemLongClickWithCoords(AdapterView<?> parent, View view, int pos, long id, float x, float y) { + ViewHolder holder = (ViewHolder)view.findViewById(R.id.text).getTag(); + Intent intent = new Intent(); + intent.putExtra("id", id); + intent.putExtra("position", pos); + intent.putExtra("audioId", holder.id); + + FancyMenu fm = new FancyMenu(this, this); + fm.setHeaderTitle(holder.title); + + fm.add(MENU_PLAY, 0, R.drawable.menu_play, R.string.play).setIntent(intent); + fm.add(MENU_PLAY_ALL, 0, R.drawable.menu_play_all, R.string.play_all).setIntent(intent); + + fm.addSpacer(0); + fm.add(MENU_ENQUEUE_AS_NEXT, 0, R.drawable.menu_enqueue_as_next, R.string.enqueue_as_next).setIntent(intent); + fm.add(MENU_ENQUEUE, 0, R.drawable.menu_enqueue, R.string.enqueue).setIntent(intent); + fm.add(MENU_ENQUEUE_ALL, 0, R.drawable.menu_enqueue, R.string.enqueue_all).setIntent(intent); + + fm.addSpacer(0); + fm.add(MENU_SHOW_DETAILS, 0, R.drawable.menu_details, R.string.details).setIntent(intent); + fm.add(MENU_REMOVE, 0, R.drawable.menu_remove, R.string.remove).setIntent(intent); + fm.show(view, x, y); + return true; + } + + @Override + public boolean onFancyItemSelected(FancyMenuItem item) + { + int itemId = item.getItemId(); + Intent intent = item.getIntent(); + int pos = intent.getIntExtra("position", -1); + + if (itemId == MENU_REMOVE) { + mAdapter.removeItem(pos - mListView.getHeaderViewsCount()); + } else if (itemId == MENU_SHOW_DETAILS) { + long songId = intent.getLongExtra("audioId", -1); + TrackDetailsDialog.show(getFragmentManager(), songId); + } else { + performAction(itemId, pos, intent.getLongExtra("audioId", -1)); + } + + return true; + } + + /** + * Perform the specified action on the adapter row with the given id and + * position. + * + * @param action One of LibraryActivity.ACTION_*. + * @param position The position in the adapter. + * @param audioId The id of the selected song, for PLAY/ENQUEUE. + */ + private void performAction(int action, int position, long audioId) + { + if (action == LibraryActivity.ACTION_PLAY_OR_ENQUEUE) + action = (PlaybackService.get(this).isPlaying() ? LibraryActivity.ACTION_ENQUEUE : LibraryActivity.ACTION_PLAY); + + if (action == LibraryActivity.ACTION_LAST_USED) + action = mLastAction; + + switch (action) { + case LibraryActivity.ACTION_PLAY: + case LibraryActivity.ACTION_ENQUEUE: + case LibraryActivity.ACTION_ENQUEUE_AS_NEXT: { + QueryTask query = MediaUtils.buildQuery(MediaUtils.TYPE_SONG, audioId, Song.FILLED_PROJECTION, null); + query.mode = MODE_FOR_ACTION[action]; + PlaybackService.get(this).addSongs(query); + break; + } + case LibraryActivity.ACTION_PLAY_ALL: + case LibraryActivity.ACTION_ENQUEUE_ALL: { + QueryTask query = MediaUtils.buildPlaylistQuery(mPlaylistId, Song.FILLED_PLAYLIST_PROJECTION); + query.mode = MODE_FOR_ACTION[action]; + query.data = position - mListView.getHeaderViewsCount(); + PlaybackService.get(this).addSongs(query); + break; + } + } + + mLastAction = action; + } + + @Override + public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) + { + if (!mEditing && mDefaultAction != LibraryActivity.ACTION_DO_NOTHING) { + // A DSLV row was clicked, but we need to get the DraggableRow class. + final View target = ((ViewGroup)view).getChildAt(0); + final ViewHolder holder = (ViewHolder)target.getTag(); + performAction(mDefaultAction, position, holder.id); + } + } + + @Override + public void onClick(DialogInterface dialog, int which) + { + if (which == DialogInterface.BUTTON_POSITIVE) { + Playlist.deletePlaylist(this, mPlaylistId); + finish(); + } + dialog.dismiss(); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) + { + if (item.getItemId() == android.R.id.home) { + finish(); + return true; + } else { + return super.onOptionsItemSelected(item); + } + } + + /** + * Fired from adapter listview if user moved an item + * @param from the item index that was dragged + * @param to the index where the item was dropped + */ + @Override + public void drop(int from, int to) { + mAdapter.moveItem(from, to); + } + + /** + * Fired from adapter listview if user fling-removed an item + * @param position The position of the removed item + */ + @Override + public void remove(int position) { + mAdapter.removeItem(position); + } + +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/PlaylistAdapter.java b/app/src/main/java/ch/blinkenlights/android/vanilla/PlaylistAdapter.java new file mode 100644 index 0000000..855e9e6 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/PlaylistAdapter.java @@ -0,0 +1,201 @@ +/* + * Copyright (C) 2011 Christopher Eby <kreed@kreed.org> + * Copyright (C) 2015-2018 Adrian Ulrich <adrian@blinkenlights.ch> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package ch.blinkenlights.android.vanilla; + +import ch.blinkenlights.android.medialibrary.MediaLibrary; + +import android.content.Context; +import android.database.Cursor; +import android.os.Handler; +import android.os.Looper; +import android.os.Message; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.CursorAdapter; +import android.widget.TextView; + +/** + * CursorAdapter backed by MediaLibrary playlists. + */ +public class PlaylistAdapter extends CursorAdapter implements Handler.Callback { + + private static final String[] PROJECTION = new String[] { + MediaLibrary.PlaylistSongColumns._ID, + MediaLibrary.PlaylistSongColumns.SONG_ID, + MediaLibrary.SongColumns.TITLE, + MediaLibrary.AlbumColumns.ALBUM, + MediaLibrary.ContributorColumns.ARTIST, + MediaLibrary.SongColumns.ALBUM_ID, + MediaLibrary.SongColumns.DURATION, + }; + + private final Context mContext; + private final Handler mWorkerHandler; + private final Handler mUiHandler; + private final LayoutInflater mInflater; + + private long mPlaylistId; + + private boolean mEditable; + + /** + * Create a playlist adapter. + * + * @param context A context to use. + * @param worker A looper running a worker thread (to run queries on). + */ + public PlaylistAdapter(Context context, Looper worker) + { + super(context, null, false); + + mContext = context; + mUiHandler = new Handler(this); + mWorkerHandler = new Handler(worker, this); + mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + } + + /** + * Set the id of the backing playlist. + * + * @param id The id of a playlist. + */ + public void setPlaylistId(long id) + { + mPlaylistId = id; + mWorkerHandler.sendEmptyMessage(MSG_RUN_QUERY); + } + + /** + * Enabled or disable edit mode. Edit mode adds a drag grabber to the left + * side a views and a delete button to the right side of views. + * + * @param editable True to enable edit mode. + */ + public void setEditable(boolean editable) + { + mEditable = editable; + notifyDataSetInvalidated(); + } + + /** + * Update the values in the given view. + */ + @Override + public void bindView(View view, Context context, Cursor cursor) + { + DraggableRow dview = (DraggableRow)view; + final String title = cursor.getString(2); + final String album = cursor.getString(3); + final String artist = cursor.getString(4); + + ViewHolder holder = new ViewHolder(); + holder.title = title; + holder.id = cursor.getLong(1); + + dview.setupLayout(DraggableRow.LAYOUT_DRAGGABLE); + dview.showDragger(mEditable); + dview.setText(title, album+", "+artist); + dview.setTag(holder); + dview.setDuration(cursor.getLong(6)); + + LazyCoverView cover = dview.getCoverView(); + cover.setCover(MediaUtils.TYPE_ALBUM, cursor.getLong(5), null); + } + + /** + * Generate a new view. + */ + @Override + public View newView(Context context, Cursor cursor, ViewGroup parent) + { + return mInflater.inflate(R.layout.draggable_row, parent, false); + } + + /** + * Re-run the query. Should be run on worker thread. + */ + public static final int MSG_RUN_QUERY = 1; + /** + * Update the cursor. Must be run on UI thread. + */ + public static final int MSG_UPDATE_CURSOR = 2; + + @Override + public boolean handleMessage(Message message) + { + switch (message.what) { + case MSG_RUN_QUERY: { + Cursor cursor = runQuery(); + mUiHandler.sendMessage(mUiHandler.obtainMessage(MSG_UPDATE_CURSOR, cursor)); + break; + } + case MSG_UPDATE_CURSOR: + changeCursor((Cursor)message.obj); + break; + default: + return false; + } + + return true; + } + + /** + * Query the playlist songs. + * + * @return The resulting cursor. + */ + private Cursor runQuery() + { + QueryTask query = MediaUtils.buildPlaylistQuery(mPlaylistId, PROJECTION); + return query.runQuery(mContext); + } + + /** + * Moves a song in the playlist + * @param from original position of item + * @param to destination of item + **/ + public void moveItem(int from, int to) + { + if (from == to) + // easy mode + return; + + int count = getCount(); + if (to >= count || from >= count) + // this can happen when the adapter changes during the drag + return; + + MediaLibrary.movePlaylistItem(mContext, getItemId(from), getItemId(to)); + changeCursor(runQuery()); + } + + public void removeItem(int position) { + MediaLibrary.removeFromPlaylist(mContext, MediaLibrary.PlaylistSongColumns._ID+"="+getItemId(position), null); + mUiHandler.sendEmptyMessage(MSG_RUN_QUERY); + } + + +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/PlaylistDialog.java b/app/src/main/java/ch/blinkenlights/android/vanilla/PlaylistDialog.java new file mode 100644 index 0000000..89ad4e9 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/PlaylistDialog.java @@ -0,0 +1,173 @@ +/* + * Copyright (C) 2016 Adrian Ulrich <adrian@blinkenlights.ch> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package ch.blinkenlights.android.vanilla; + +import android.app.AlertDialog; +import android.app.Dialog; +import android.app.DialogFragment; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.database.Cursor; +import android.os.Bundle; + +public class PlaylistDialog extends DialogFragment + implements DialogInterface.OnClickListener +{ + + // Unicode of checkbox + String CHECKBOX_UNCHECKED = "\u2610"; + String CHECKBOX_CHECKED = "\u2611"; + + Song mCurrentSong; + + /** + * Default constructor as required by Gradle Release Lint + */ + public PlaylistDialog() { + } + + /** + * Creates a new playlist dialog to assemble a playlist using an intent. + * Uses a static constructor method to satisfy Gradle Release Lint. + */ + public static PlaylistDialog newInstance(Callback callback, Intent intent, LibraryAdapter allSource, Song currentSong) { + PlaylistDialog pd = new PlaylistDialog(); + pd.mCallback = callback; + pd.mData = pd.new Data(); + pd.mData.sourceIntent = intent; + pd.mData.allSource = allSource; + pd.mCurrentSong = currentSong; + return pd; + } + + /** + * For backward compatible + */ + public static PlaylistDialog newInstance(Callback callback, Intent intent, LibraryAdapter allSource) { + return newInstance( callback, intent, allSource, null); + } + + /** + * A class implementing our callback interface + */ + private Callback mCallback; + /** + * The data passed to the callback + */ + private PlaylistDialog.Data mData; + /** + * Array of all found playlist names + */ + private String[] mItemName; + /** + * Array of all found playlist values + */ + private long[] mItemValue; + /** + * Index of 'create playlist' button + */ + private final int BUTTON_CREATE_PLAYLIST = 0; + /** + * Our callback interface + */ + public interface Callback { + void updatePlaylistFromPlaylistDialog(PlaylistDialog.Data data); + } + /** + * Our data structure + */ + public class Data { + public String name; + public long id; + public Intent sourceIntent; + public LibraryAdapter allSource; + } + + + @Override + public Dialog onCreateDialog(Bundle savedInstanceState) { + Context ctx = getActivity(); + Cursor cursor = Playlist.queryPlaylists(ctx); + if (cursor == null) + return null; + + int count = cursor.getCount(); + mItemName = new String[1+count]; + mItemValue = new long[1+count]; + String[] displayItem = new String[count+1]; + + // Index 0 is always 'New Playlist...' + mItemName[0] = getResources().getString(R.string.new_playlist); + mItemValue[0] = -1; + displayItem[0] = mItemName[0]; + + for (int i = 0 ; i < count; i++) { + cursor.moveToPosition(i); + mItemValue[1+i] = cursor.getLong(0); + mItemName[1+i] = cursor.getString(1); + if(mCurrentSong==null){ + displayItem[1+i] = mItemName[1+i]; + } + else { + if (Playlist.isInPlaylist(ctx, mItemValue[1+i], mCurrentSong)) { + displayItem[1 + i] = CHECKBOX_CHECKED + " " + mItemName[1 + i]; + } + else { + displayItem[1 + i] = CHECKBOX_UNCHECKED + " " + mItemName[1 + i]; + } + } + } + + + + + // All names are now known: we can show the dialog + AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); + builder.setTitle(R.string.add_to_playlist) + .setItems(displayItem, this); + return builder.create(); + } + + @Override + public void onClick(DialogInterface dialog, int which) { + switch (which) { + case BUTTON_CREATE_PLAYLIST: + PlaylistInputDialog newDialog = PlaylistInputDialog.newInstance(new PlaylistInputDialog.Callback() { + @Override + public void onSuccess(String input) { + mData.id = -1; + mData.name = input; + mCallback.updatePlaylistFromPlaylistDialog(mData); + } + }, "", R.string.create); + newDialog.show(getFragmentManager(), "PlaylistInputDialog"); + break; + default: + mData.id = mItemValue[which]; + mData.name = mItemName[which]; + mCallback.updatePlaylistFromPlaylistDialog(mData); + } + dialog.dismiss(); + } +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/PlaylistInputDialog.java b/app/src/main/java/ch/blinkenlights/android/vanilla/PlaylistInputDialog.java new file mode 100644 index 0000000..f6f06cb --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/PlaylistInputDialog.java @@ -0,0 +1,157 @@ +/* + * Copyright (C) 2016 Adrian Ulrich <adrian@blinkenlights.ch> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package ch.blinkenlights.android.vanilla; + +import android.app.AlertDialog; +import android.app.Dialog; +import android.app.DialogFragment; +import android.content.DialogInterface; +import android.content.Intent; +import android.os.Bundle; +import android.text.Editable; +import android.text.InputType; +import android.text.TextWatcher; +import android.view.WindowManager; +import android.widget.EditText; + +public class PlaylistInputDialog extends DialogFragment + implements DialogInterface.OnClickListener, TextWatcher +{ + /** + * Default constructor as required by Gradle Release Lint + */ + public PlaylistInputDialog() { + } + + /** + * Creates a new instance. + * Uses a static constructor method to satisfy Gradle Release Lint. + * @param callback the callback to call back + * @param initialText the initial value mEditText + * @param actionRes the label of the positive button + */ + public static PlaylistInputDialog newInstance(Callback callback, String initialText, int actionRes) { + PlaylistInputDialog pid = new PlaylistInputDialog(); + pid.mCallback = callback; + pid.mInitialText = initialText; + pid.mActionRes = actionRes; + return pid; + } + + public interface Callback { + void onSuccess(String input); + } + + /** + * A editText instance + */ + private EditText mEditText; + /** + * Our callback implementing the PlaylistInputDialog.Callback + * interface + */ + private Callback mCallback; + /** + * The label of the positive button + */ + private int mActionRes; + /** + * The initial text to display + */ + private String mInitialText; + /** + * The instance of the alert dialog + */ + private AlertDialog mDialog; + + @Override + public Dialog onCreateDialog(Bundle savedInstanceState) { + mEditText = new EditText(getActivity()); + mEditText.setInputType(InputType.TYPE_CLASS_TEXT); + mEditText.addTextChangedListener(this); + + AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); + builder.setTitle(R.string.choose_playlist_name) + .setView(mEditText) + .setPositiveButton(mActionRes, this) + .setNegativeButton(android.R.string.cancel, this); + mDialog = builder.create(); + mDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE); + + return mDialog; + } + + /** + * Called when the view becomes visible, so we can + * set the button positive-button and request focus + */ + public void onStart() { + super.onStart(); + mDialog.getButton(DialogInterface.BUTTON_POSITIVE).setEnabled(false); + mEditText.setText(mInitialText); + mEditText.requestFocus(); + } + + /** + * Called after mEditText changed + */ + public void afterTextChanged(Editable s) { + // noop + } + + /** + * Called before mEditText changed + */ + public void beforeTextChanged(CharSequence s, int start, int count, int after) { + // noop + } + + /** + * Called when mEditText changed + */ + public void onTextChanged(CharSequence text, int start, int before, int count) { + String string = text.toString(); + if (string.equals(mInitialText)) { + mDialog.getButton(DialogInterface.BUTTON_POSITIVE).setEnabled(false); + } else { + mDialog.getButton(DialogInterface.BUTTON_POSITIVE).setEnabled(true); + int res = Playlist.getPlaylist(getActivity(), string) == -1 ? mActionRes : R.string.overwrite; + mDialog.getButton(DialogInterface.BUTTON_POSITIVE).setText(res); + } + } + + @Override + public void onClick(DialogInterface dialog, int which) { + switch (which) { + case DialogInterface.BUTTON_NEGATIVE: + // noop + break; + case DialogInterface.BUTTON_POSITIVE: + mCallback.onSuccess(mEditText.getText().toString()); + break; + default: + break; + } + dialog.dismiss(); + } +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/PlaylistObserver.java b/app/src/main/java/ch/blinkenlights/android/vanilla/PlaylistObserver.java new file mode 100644 index 0000000..1f2db9e --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/PlaylistObserver.java @@ -0,0 +1,659 @@ +/* + * Copyright (C) 2018 Adrian Ulrich <adrian@blinkenlights.ch> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package ch.blinkenlights.android.vanilla; + +import ch.blinkenlights.android.medialibrary.MediaLibrary; +import ch.blinkenlights.android.medialibrary.LibraryObserver; + +import android.content.Context; +import android.content.ContentValues; +import android.database.Cursor; +import android.database.sqlite.SQLiteDatabase; +import android.database.sqlite.SQLiteOpenHelper; +import android.os.Build; +import android.os.FileObserver; +import android.os.Handler; +import android.os.HandlerThread; +import android.os.Message; +import android.os.Process; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.PrintWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.zip.CRC32; + +import android.util.Log; + + +public class PlaylistObserver extends SQLiteOpenHelper implements Handler.Callback { + /** + * Whether or not to write debug logs. + */ + private static final boolean DEBUG = false; + /** + * Bits for mSyncMode + */ + public static final int SYNC_MODE_IMPORT = (1 << 0); + public static final int SYNC_MODE_EXPORT = (1 << 1); + public static final int SYNC_MODE_PURGE = (1 << 2); + /** + * Timeout to coalesce duplicate messages, ~2.3 sec because no real reason. + */ + private static final int COALESCE_EVENTS_DELAY_MS = 2345; + /** + * Extension to use for M3U files + */ + private static final String M3U_EXT = ".m3u"; + /** + * Line comment prefix for M3U files + */ + private static final String M3U_LINE_COMMENT_PREFIX = "#"; + /** + * Context to use. + */ + private Context mContext; + /** + * Thread used for execution. + */ + private HandlerThread mHandlerThread; + /** + * Handler thread used to perform playlist sync. + */ + private Handler mHandler; + /** + * Observer which watches the playlist directory. + */ + private FileObserver mFileObserver; + /** + * Directory which holds observed playlists. + */ + private File mPlaylists; + /** + * What kind of synching to perform, bitmask of PlaylistObserver.SYNC_MODE_* + */ + private int mSyncMode; + /** + * Whether to export playlists using relative file paths. + */ + private boolean mExportRelativePaths; + /** + * Database fields + */ + private static class Database { + static final String TABLE_NAME = "playlist_metadata"; + static final String _ID = "_id"; + static final String NAME = "name"; + static final String HASH = "hash"; + static final String[] FILLED_PROJECTION = { + _ID, + NAME, + HASH, + }; + } + + + public PlaylistObserver(Context context, String folder, int mode, boolean exportRelativePaths) { + super(context, "playlist_observer.db", null, 1 /* version */); + mContext = context; + mSyncMode = mode; + mPlaylists = new File(folder); + mExportRelativePaths = exportRelativePaths; + + // Launch new thread for background execution + mHandlerThread= new HandlerThread("PlaylisObserverHandler", Process.THREAD_PRIORITY_LOWEST); + mHandlerThread.start(); + mHandler = new Handler(mHandlerThread.getLooper(), this); + + // Create playlists directory if not existing. + if ((mSyncMode & SYNC_MODE_EXPORT) != 0) { + try { + mPlaylists.mkdir(); + } catch (Exception e) { + // don't care: code will ignore events + // if mPlaylists is not a (writable) dir. + } + } + + // Register to receive media library events. + MediaLibrary.registerLibraryObserver(mLibraryObserver); + // Create and start directory observer. + mFileObserver = getFileObserver(mPlaylists); + mFileObserver.startWatching(); + + XT("Object created, trigger FULL_SYNC_SCAN"); + sendUniqueMessage(MSG_FULL_SYNC_SCAN, 0); + } + + /** + * Unregisters this observer, the object must not be used anymore + * after this function was called. + */ + public void unregister() { + MediaLibrary.unregisterLibraryObserver(mLibraryObserver); + mFileObserver.stopWatching(); + + mHandlerThread.quitSafely(); + mHandlerThread = null; + mHandler = null; + } + + /** + * Whether or not to handle (or drop) any events received. + * This has the same effect as unregistering, without actually + * unregistering. The function prevents false events from + * being handled if our playlists folder becomes 'suspect'. + */ + private boolean shouldDispatch() { + // This is so sad, but java.nio.file is only available since API 26, + // so we are stuck with java being java. + boolean deny = false; + try { + File f = File.createTempFile("vanilla-write-check", null, mPlaylists); + f.delete(); + } catch (Exception e) { + // don't care about the exact error: as long as the write failed, + // we should not assume that we could write anything else. + deny = true; + } + return !deny; + } + + /** + * SQLiteHelper onCreate + */ + @Override + public void onCreate(SQLiteDatabase dbh) { + dbh.execSQL("CREATE TABLE "+Database.TABLE_NAME+" ( " + + Database._ID + " INTEGER PRIMARY KEY, " + + Database.HASH + " INTEGER NOT NULL, " + + Database.NAME + " TEXT NOT NULL )" + ); + } + + /** + * SQLiteHelper onUpgrade + */ + @Override + public void onUpgrade(SQLiteDatabase dbh, int oldVersion, int newVersion) { + // No updates so far. + } + + /** + * Message handler, used to dedupe messages and perform + * background work. + */ + private static final int MSG_DUMP_M3U = 1; + private static final int MSG_DUMP_ALL_M3U = 2; + private static final int MSG_IMPORT_M3U = 3; + private static final int MSG_FORCE_M3U_IMPORT = 4; + private static final int MSG_FULL_SYNC_SCAN = 5; + ArrayList<Integer> msgDedupe = new ArrayList<>(); + @Override + public boolean handleMessage(Message message) { + msgDedupe.remove(0); + + switch (message.what) { + case MSG_DUMP_M3U: + Long id = (Long)message.obj; + if (Playlist.getPlaylist(mContext, id) != null) { + XT("DUMP_M3U: source of id "+id+" exists, dumping"); + dumpAsM3uPlaylist(id); + } else { + XT("DUMP_M3U: source of id "+id+" vanished, scanning all"); + sendUniqueMessage(MSG_FULL_SYNC_SCAN, 0); + } + break; + case MSG_DUMP_ALL_M3U: + dumpAllAsM3uPlaylist(); + break; + case MSG_IMPORT_M3U: + File f = (File)(message.obj); + importM3uPlaylist(f); + break; + case MSG_FORCE_M3U_IMPORT: + forceM3uImport(); + break; + case MSG_FULL_SYNC_SCAN: + fullSyncScan(); + break; + default: + throw new IllegalArgumentException("Invalid message type received"); + } + return true; + } + + /** + * Forcefully re-imports all M3U files, even if we think that + * our information is up-to-date. + */ + private void forceM3uImport() { + Cursor cursor = queryDatabase(null); + if (cursor != null) { + while (cursor.moveToNext()) { + deletePlaylistMetadata(cursor.getLong(0)); + } + cursor.close(); + } + // run this ASAP to ensure that no other message re-populates + // metadata. + XT("forceM3uImport: metadata cleared, calling fullSyncScan"); + fullSyncScan(); + } + + /** + * Dumps all playlist to stable storage. + */ + private void dumpAllAsM3uPlaylist() { + XT("dumpAllAsM3uPlaylist: called"); + Cursor cursor = Playlist.queryPlaylists(mContext); + if (cursor != null) { + while(cursor.moveToNext()) { + final long id = cursor.getLong(0); + XT("dumpAllAsM3uPlaylist: Dumping ID "+id); + sendUniqueMessage(MSG_DUMP_M3U, id); + } + cursor.close(); + } + } + + /** + * Adds a new message to the queue. Ignores call if a duplicate + * message is already pending. + * + * @param type the type of the message + * @param obj object payload of this message. + */ + private void sendUniqueMessage(int type, Object obj) { + int fprint = (type << 10) + obj.hashCode(); + if (!msgDedupe.contains(fprint)) { + msgDedupe.add(fprint); + mHandler.sendMessageDelayed(mHandler.obtainMessage(type, obj), COALESCE_EVENTS_DELAY_MS); + } + } + + + /** + * Imports an M3U formatted file into our native media library. + * + * @param m3u the file to import + */ + private void importM3uPlaylist(File m3u) {; + XT("importM3uPlaylist("+m3u+")"); + + if ((mSyncMode & SYNC_MODE_IMPORT) == 0) + return; + + if (!m3u.exists()) + return; + + final long hash = getHash(m3u); + if (hash == -1) + return; + + boolean must_import = true; + String import_as = fromM3u(m3u.getName()); + Cursor cursor = queryDatabase(null); + if (cursor != null) { + // Try to find an existing playlist where the constructed path + // would match given input file. + while(cursor.moveToNext()) { + File tmp = getFileForName(mPlaylists, asM3u(cursor.getString(1))); + if (m3u.equals(tmp)) { + // Found a matching playlist: this will be our import target + // if the hash indicates that our version is outdated. + import_as = cursor.getString(1); + must_import = (hash != cursor.getLong(2)); + XT("importM3uPlaylist(): hash="+hash+", import="+must_import+", import_as="+import_as); + break; + } + } + cursor.close(); + } + + if (must_import) { + MediaLibrary.unregisterLibraryObserver(mLibraryObserver); + long import_id = Playlist.createPlaylist(mContext, import_as); + try (BufferedReader br = new BufferedReader(new FileReader(m3u))) { + String line; + while ((line = br.readLine()) != null) { + if (!(line.isEmpty() || line.startsWith(M3U_LINE_COMMENT_PREFIX))) { + // Handle relative paths and Windows directory separators. + final String mediaPath = FileUtils.resolve(mPlaylists, + new File(FileUtils.normalizeDirectorySeparators(line))); + Playlist.addToPlaylist(mContext, + import_id, + MediaUtils.buildFileQuery(mediaPath, Song.FILLED_PROJECTION, false /* recursive */)); + } + } + updatePlaylistMetadata(import_id, import_as, hash); + } catch(IOException e) { + Log.e("VanillaMusic", "Error while parsing m3u: "+e); + } + MediaLibrary.registerLibraryObserver(mLibraryObserver); + } + } + + /** + * Exports a single playlist ad M3U(8). + * + * @param id the playlist id to export. + * @return the newly written playlist, null if nothing was done. + */ + private File dumpAsM3uPlaylist(long id) { + XT("dumpM3uPlaylist("+id+")"); + if (id < 0) + throw new IllegalArgumentException("Called with negative id!"); + + if ((mSyncMode & SYNC_MODE_EXPORT) == 0) + return null; + + final String name = Playlist.getPlaylist(mContext, id); + if (name == null) + return null; + + final File m3u = getFileForName(mPlaylists, asM3u(name)); + + PrintWriter pw = null; + QueryTask query = MediaUtils.buildPlaylistQuery(id, Song.FILLED_PLAYLIST_PROJECTION); + Cursor cursor = query.runQuery(mContext); + try { + if (cursor != null) { + pw = new PrintWriter(m3u); + while (cursor.moveToNext()) { + // Write paths relative to the playlist export directory, if enabled. + String path = cursor.getString(1); + if (mExportRelativePaths) { + path = FileUtils.relativize(mPlaylists, new File(path)); + } + pw.println(path); + } + pw.flush(); + long hash_new = getHash(m3u); + updatePlaylistMetadata(id, name, hash_new); + } + } catch (IOException e) { + Log.v("VanillaMusic", "IOException while writing:", e); + } finally { + if (cursor != null) cursor.close(); + if (pw != null) pw.close(); + } + return m3u; + } + + /** + * Identify (and remove) playlist items which do not exist anymore + * and pick up any new M3U files. + */ + private void fullSyncScan() { + XT("fullSyncScan() running..."); + ArrayList<File> knownM3u = new ArrayList<>(); + + // First step is to check all known playlist metadata entries + // and check whether their native or M3U copy was purged. + final boolean do_purge = (mSyncMode & SYNC_MODE_PURGE) != 0; + Cursor cursor = queryDatabase(null); + if (cursor != null) { + while (cursor.moveToNext()) { + final long id = cursor.getLong(0); + final String name = cursor.getString(1); + // generates possible names of this playlist as M3U. + final File src_m3u = getFileForName(mPlaylists, asM3u(name)); + final File bak_m3u = getFileForName(mPlaylists, name + ".backup"); + + if (Playlist.getPlaylist(mContext, id) == null) { + // Native version of this playlist is gone, rename M3U variant: + if (do_purge) { + src_m3u.renameTo(bak_m3u); + } + deletePlaylistMetadata(id); + XT("fullSyncScan(): renamed old M3U -> "+bak_m3u); + } else if (do_purge && !src_m3u.exists()) { + // Source vanished, write one last dump and remove it. + File dump = dumpAsM3uPlaylist(id); + if (dump != null) { + dump.renameTo(bak_m3u); + } + Playlist.deletePlaylist(mContext, id); + deletePlaylistMetadata(id); + XT("fullSyncScan(): killed native playlist with id "+id); + } + // If this M3U exists, record it so that we don't try to re-import. + if (src_m3u.exists()) { + knownM3u.add(src_m3u); + } + } + cursor.close(); + } + + // Now list all M3U files in the playlists dir and import newly seen files. + File[] files = mPlaylists.listFiles(); + if (files != null) { + for (File f : files) { + final String fname = f.getName(); + if (isM3uFilename(fname) && !knownM3u.contains(f)) { + if (Playlist.getPlaylist(mContext, fromM3u(fname)) == -1) { + XT("fullSyncScan(): new M3U discovered, must import "+f); + sendUniqueMessage(MSG_IMPORT_M3U, f); + } else { + XT("fullSyncScan(): native version for "+f+" exists without metadata. Won't touch."); + } + } + } + } + } + + /** + * Returns a file object for given name + * + * @param name name of playlist to use. + * @return file object for given name + */ + private File getFileForName(File parent, String name) { + name = name.replaceAll("/", "_"); + File f = new File(parent, name); + return f; + } + + /** + * Updates the metadata of given playlist name + * + * @param id the id to update. + * @param name the name to register for this id. + */ + private void updatePlaylistMetadata(long id, String name, long hash) { + if (hash < 0) + throw new IllegalArgumentException("hash can not be negative"); + + XT("updatePlaylistMetadata of "+name+" to hash "+hash); + SQLiteDatabase dbh = getWritableDatabase(); + ContentValues values = new ContentValues(); + values.put(Database._ID, id); + values.put(Database.NAME, name); + values.put(Database.HASH, hash); + + deletePlaylistMetadata(id); + dbh.insert(Database.TABLE_NAME, null, values); + } + + /** + * Removes all known metadata of given id. + * + * @param id the id to purge. + */ + private void deletePlaylistMetadata(long id) { + SQLiteDatabase dbh = getWritableDatabase(); + dbh.delete(Database.TABLE_NAME, Database._ID+"=?", new String[] { Long.valueOf(id).toString() }); + } + + /** + * Returns true if the filename looks like an m3u file + * + * @param name the name to check + * @return true if file appears to be an M3U + */ + private boolean isM3uFilename(String name) { + if (name.length() < M3U_EXT.length()) + return false; + final int offset = name.length() - M3U_EXT.length(); + return name.toLowerCase().substring(offset).equals(M3U_EXT.toLowerCase()); + } + + /** + * Returns the m3u-filename of name + * + * @param name the name to use + * @return the m3u name + */ + private String asM3u(String name) { + return name + M3U_EXT; + } + + /** + * Returns the name of an m3u file + * + * @param name the m3u filename + * @return the non-m3u name + */ + private String fromM3u(String name) { + if (!isM3uFilename(name)) + throw new IllegalArgumentException("Not an M3U filename: "+name); + return name.substring(0, name.length() - M3U_EXT.length()); + } + + /** + * Hashes the contents of given file + * + * @param f the file to hash + * @return the calculated hash, -1 on error. + */ + private long getHash(File f) { + long hash = -1; + byte[] buff = new byte[4096]; + try(FileInputStream fis = new FileInputStream(f)) { + CRC32 crc = new CRC32(); + while(fis.read(buff) != -1) { + crc.update(buff); + } + hash = crc.getValue(); + if (hash < 0) + hash = hash * -1; + } catch(IOException e) { + // hash will be -1 which signals failure. + } + return hash; + } + + /** + * Obtain a cursor to our metadaata database. + * + * @param selection selection for query + * @return cursor with results. + */ + private Cursor queryDatabase(String selection) { + return getReadableDatabase().query(Database.TABLE_NAME, Database.FILLED_PROJECTION, selection, null, null, null, null); + } + + /** + * Library observer callback which notifies us about media library + * events. + * + * @param type the event type + * @param id the id of given type which had a change + * @param ongoing whether or not to expect more of these events + */ + private final LibraryObserver mLibraryObserver = new LibraryObserver() { + @Override + public void onChange(LibraryObserver.Type type, long id, boolean ongoing) { + if (type != LibraryObserver.Type.PLAYLIST || ongoing) + return; + + if (!shouldDispatch()) + return; + + int msg = MSG_DUMP_M3U; // Default: export this playlist ID. + if (id == LibraryObserver.Value.UNKNOWN) { + // An unknown (all?) playlist was modified: dump all to M3U + msg = MSG_DUMP_ALL_M3U; + } + if (id == LibraryObserver.Value.OUTDATED) { + // Our data is wrong, reimport all M3Us + msg = MSG_FORCE_M3U_IMPORT; + } + + XT("LibraryObserver::onChange id="+id+", msg="+msg); + sendUniqueMessage(msg, id); + } + }; + + /** + * Returns a new observer which monitors the playlists directory. + * + * @param target The target playlists directory. + * @return A new observer for the playlists directory. + */ + private FileObserver getFileObserver(File target) { + final int mask = FileObserver.CLOSE_WRITE | FileObserver.MOVED_FROM | FileObserver.MOVED_TO | FileObserver.DELETE; + XT("new file observer at "+target+" with mask "+mask); + + return new FileObserver(target.getAbsolutePath(), mask) { + /** + * Observer which monitors the playlists directory. + * + * @param event the event type + * @param dirent the filename which triggered the event. + */ + @Override + public void onEvent(int event, String dirent) { + // Events such as IN_IGNORED pass dirent = null. + if (dirent == null) + return; + + if (!isM3uFilename(dirent)) + return; + + if (!shouldDispatch()) + return; + + if ((event & (FileObserver.MOVED_FROM | FileObserver.DELETE)) != 0) { + // A M3U vanished, do a full scan. + XT("FileObserver::onEvent DELETE of "+dirent+" triggers FULL_SYNC_SCAN"); + sendUniqueMessage(MSG_FULL_SYNC_SCAN, 0); + } + if ((event & (FileObserver.MOVED_TO | FileObserver.CLOSE_WRITE)) != 0) { + // Single file was created, import it. + XT("FileObserver::onEvent WRITE of "+dirent+" triggers IMPORT_M3U"); + sendUniqueMessage(MSG_IMPORT_M3U, new File(mPlaylists, dirent)); + } + } + }; + } + + private void XT(String s) { + if (DEBUG) { + try(PrintWriter pw = new PrintWriter(new FileOutputStream(new File("/sdcard/playlist-observer.txt"), true))) { + pw.println(System.currentTimeMillis()/1000+": "+s); + Log.v("VanillaMusic", "XTRACE: "+s); + } catch(Exception e) {} + } + } +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/PlaylistObserverDirActivity.java b/app/src/main/java/ch/blinkenlights/android/vanilla/PlaylistObserverDirActivity.java new file mode 100644 index 0000000..dcf6df5 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/PlaylistObserverDirActivity.java @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2018 Adrian Ulrich <adrian@blinkenlights.ch> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package ch.blinkenlights.android.vanilla; + +import android.os.Bundle; +import android.content.SharedPreferences; + +import java.io.File; +import java.util.ArrayList; + +public class PlaylistObserverDirActivity extends FolderPickerActivity { + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setTitle(R.string.filebrowser_start); + + // Start at currently configured directory. + String current = SharedPrefHelper.getSettings(this).getString(PrefKeys.PLAYLIST_SYNC_FOLDER, PrefDefaults.PLAYLIST_SYNC_FOLDER); + setCurrentDir(new File(current)); + } + + + @Override + public void onFolderPicked(File directory, ArrayList<String> a, ArrayList<String> b) { + SharedPreferences.Editor editor = SharedPrefHelper.getSettings(this).edit(); + editor.putString(PrefKeys.PLAYLIST_SYNC_FOLDER, directory.getAbsolutePath()); + editor.apply(); + finish(); + } + +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/PlaylistTask.java b/app/src/main/java/ch/blinkenlights/android/vanilla/PlaylistTask.java new file mode 100644 index 0000000..b0a9420 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/PlaylistTask.java @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2013 Adrian Ulrich <adrian@blinkenlights.ch> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + + +package ch.blinkenlights.android.vanilla; + +import java.util.ArrayList; + +/** + * Represents a pending playlist manipulation + */ +public class PlaylistTask { + + /** + * ID of this playlist to manipulate + */ + public long playlistId; + /** + * Name of this playlist (used for the toast message) + */ + public String name; + /** + * Populate playlist using this QueryTask + */ + public QueryTask query; + /** + * Populate playlist using this audioIds + */ + public ArrayList<Long> audioIds; + + + public PlaylistTask(long playlistId, String name) { + this.playlistId = playlistId; + this.name = name; + } + +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/PluginUtils.java b/app/src/main/java/ch/blinkenlights/android/vanilla/PluginUtils.java new file mode 100644 index 0000000..18fe1eb --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/PluginUtils.java @@ -0,0 +1,97 @@ +/* + * Copyright (C) 2016-2018 Oleg Chernovskiy <adonai@xaker.ru> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +package ch.blinkenlights.android.vanilla; + +import android.content.Context; +import android.content.Intent; +import android.content.pm.ApplicationInfo; +import android.content.pm.PackageManager; +import android.content.pm.ResolveInfo; +import android.widget.Toast; +import androidx.annotation.NonNull; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Common plugin utilities and constants reside here. + * Note that public `action` and `extra` strings are common over all plugins, so please keep them in sync. + */ + +public class PluginUtils { + + private PluginUtils() { + } + + // these actions are for passing between main player and plugins + public static final String ACTION_REQUEST_PLUGIN_PARAMS = "ch.blinkenlights.android.vanilla.action.REQUEST_PLUGIN_PARAMS"; // broadcast + public static final String ACTION_HANDLE_PLUGIN_PARAMS = "ch.blinkenlights.android.vanilla.action.HANDLE_PLUGIN_PARAMS"; // answer + public static final String ACTION_LAUNCH_PLUGIN = "ch.blinkenlights.android.vanilla.action.LAUNCH_PLUGIN"; // targeted at selected by user + + // these are used by plugins to describe themselves + public static final String EXTRA_PARAM_PLUGIN_NAME = "ch.blinkenlights.android.vanilla.extra.PLUGIN_NAME"; + public static final String EXTRA_PARAM_PLUGIN_APP = "ch.blinkenlights.android.vanilla.extra.PLUGIN_APP"; + public static final String EXTRA_PARAM_PLUGIN_DESC = "ch.blinkenlights.android.vanilla.extra.PLUGIN_DESC"; + + // this is passed to plugin when it is selected by user + public static final String EXTRA_PARAM_URI = "ch.blinkenlights.android.vanilla.extra.URI"; + public static final String EXTRA_PARAM_SONG_TITLE = "ch.blinkenlights.android.vanilla.extra.SONG_TITLE"; + public static final String EXTRA_PARAM_SONG_ALBUM = "ch.blinkenlights.android.vanilla.extra.SONG_ALBUM"; + public static final String EXTRA_PARAM_SONG_ARTIST = "ch.blinkenlights.android.vanilla.extra.SONG_ARTIST"; + + static final String EXTRA_PLUGIN_MAP = "ch.blinkenlights.android.vanilla.internal.extra.PLUGIN_MAP"; + + /** + * Find all vanilla plugins by their very specific broadcast receiver intent. + * @param ctx context to use when resolving packages. + * @return list of all resolved plugins, may be empty but never null + */ + @NonNull + private static List<ResolveInfo> resolvePlugins(Context ctx) { + PackageManager pm = ctx.getPackageManager(); + Intent filter = new Intent(ACTION_REQUEST_PLUGIN_PARAMS); + return pm.queryBroadcastReceivers(filter, PackageManager.MATCH_DISABLED_COMPONENTS); + } + + /** + * Checks whether does any of vanilla plugins exist on this Android system + * @param ctx context to use when resolving packages + * @return true if at least one plugin is installed, false otherwise + */ + public static boolean checkPlugins(Context ctx) { + return !resolvePlugins(ctx).isEmpty(); + } + + /** + * Same as {@link #resolvePlugins(Context)} but in a map convenient for showing in dialogs. + * @param ctx ctx context to use when resolving packages + * @return all vanilla plugins in a map App Name <-> App Info + */ + @NonNull + public static Map<String, ApplicationInfo> getPluginMap(Context ctx) { + PackageManager pm = ctx.getPackageManager(); + List<ResolveInfo> resolved = resolvePlugins(ctx); + + Map<String, ApplicationInfo> pluginMap = new HashMap<>(resolved.size()); + for (ResolveInfo ri : resolved) { + ApplicationInfo appInfo = ri.activityInfo.applicationInfo; + pluginMap.put(appInfo.loadLabel(pm).toString(), appInfo); + } + return pluginMap; + } +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/PrefDefaults.java b/app/src/main/java/ch/blinkenlights/android/vanilla/PrefDefaults.java new file mode 100644 index 0000000..8bdfc6c --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/PrefDefaults.java @@ -0,0 +1,85 @@ +/* + * Copyright (C) 2015-2019 Adrian Ulrich <adrian@blinkenlights.ch> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package ch.blinkenlights.android.vanilla; + +import android.os.Environment; +import java.io.File; + +/** + * SharedPreference default values. Must be kept in sync with keys in res/xml/prefs_*.xml. + */ +public class PrefDefaults { + private PrefDefaults() { + // Private constructor to hide implicit one. + } + + public static final Action COVER_LONGPRESS_ACTION = Action.Nothing; + public static final Action COVER_PRESS_ACTION = Action.Nothing; + public static final String DEFAULT_ACTION_INT = "9"; + public static final String DEFAULT_PLAYLIST_ACTION = "3"; + public static final boolean COVERLOADER_ANDROID = true; + public static final boolean COVERLOADER_VANILLA = true; + public static final boolean COVERLOADER_SHADOW = true; + public static final boolean COVERLOADER_INLINE = true; + public static final boolean COVER_ON_LOCKSCREEN = true; + public static final boolean DISABLE_LOCKSCREEN = false; + public static final String DISPLAY_MODE = "2"; + public static final boolean DOUBLE_TAP = false; + public static final boolean ENABLE_SHAKE = false; + public static final boolean HEADSET_ONLY = false; + public static final boolean HEADSET_PAUSE = true; + public static final int IDLE_TIMEOUT = 3600; + public static final int LIBRARY_PAGE = 0; + public static final String NOTIFICATION_ACTION = "0"; + public static final String NOTIFICATION_VISIBILITY = "0"; + public static final boolean NOTIFICATION_NAG = false; + public static final boolean PLAYBACK_ON_STARTUP = false; + public static final boolean SCROBBLE = false; + public static final Action SHAKE_ACTION = Action.NextSong; + public static final int SHAKE_THRESHOLD = 80; + public static final boolean STOCK_BROADCAST = true; + public static final Action SWIPE_DOWN_ACTION = Action.Nothing; + public static final Action SWIPE_UP_ACTION = Action.Nothing; + public static final String TAB_ORDER = null; + public static final boolean USE_IDLE_TIMEOUT = false; + public static final boolean VISIBLE_CONTROLS = true; + public static final boolean VISIBLE_EXTRA_INFO = false; + public static final boolean ENABLE_TRACK_REPLAYGAIN = false; + public static final boolean ENABLE_ALBUM_REPLAYGAIN = false; + public static final int REPLAYGAIN_BUMP = 75; // seek bar is 150 -> 75 == middle == 0 + public static final int REPLAYGAIN_UNTAGGED_DEBUMP = 150; // seek bar is 150 -> == 0 + public static final boolean ENABLE_READAHEAD = false; + public static final String SELECTED_THEME = "7"; + public static final String FILESYSTEM_BROWSE_START = ""; + public static final int VOLUME_DURING_DUCKING = 50; + public static final int AUTOPLAYLIST_PLAYCOUNTS = 0; + public static final boolean IGNORE_AUDIOFOCUS_LOSS = false; + public static final boolean ENABLE_SCROLL_TO_SONG = false; + public static final boolean QUEUE_ENABLE_SCROLL_TO_SONG = false; + public static final boolean KEEP_SCREEN_ON = false; + public static final String PLAYLIST_SYNC_MODE = "0"; + public static final String PLAYLIST_SYNC_FOLDER = (new File(Environment.getExternalStorageDirectory(), "Playlists")).getAbsolutePath(); + public static final boolean PLAYLIST_EXPORT_RELATIVE_PATHS = false; + public static final boolean JUMP_TO_ENQUEUED_ON_PLAY = true; + public static final boolean DISABLE_GAPLESS_PLAYBACK = false; +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/PrefKeys.java b/app/src/main/java/ch/blinkenlights/android/vanilla/PrefKeys.java new file mode 100644 index 0000000..57a1654 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/PrefKeys.java @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2012-2015 Adrian Ulrich <adrian@blinkenlights.ch> + * Copyright (C) 2012 Christopher Eby <kreed@kreed.org> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package ch.blinkenlights.android.vanilla; + +/** + * SharedPreference keys. Must be kept in sync with {@link PrefDefaults}. + */ +public class PrefKeys { + private PrefKeys() { + // Private constructor to hide implicit one. + } + + public static final String COVER_LONGPRESS_ACTION = "cover_longpress_action"; + public static final String COVER_PRESS_ACTION = "cover_press_action"; + public static final String DEFAULT_ACTION_INT = "default_action_int"; + public static final String DEFAULT_PLAYLIST_ACTION = "default_playlist_action"; + public static final String COVERLOADER_ANDROID = "coverloader_android"; + public static final String COVERLOADER_VANILLA = "coverloader_vanilla"; + public static final String COVERLOADER_SHADOW = "coverloader_shadow"; + public static final String COVERLOADER_INLINE = "coverloader_inline"; + public static final String COVER_ON_LOCKSCREEN = "cover_on_lockscreen"; + public static final String DISABLE_LOCKSCREEN = "disable_lockscreen"; + public static final String DISPLAY_MODE = "display_mode"; + public static final String DOUBLE_TAP = "double_tap"; + public static final String ENABLE_SHAKE = "enable_shake"; + public static final String HEADSET_ONLY = "headset_only"; + public static final String HEADSET_PAUSE = "headset_pause"; + public static final String IDLE_TIMEOUT = "idle_timeout"; + public static final String LIBRARY_PAGE = "library_page"; + public static final String NOTIFICATION_ACTION = "notification_action"; + public static final String NOTIFICATION_VISIBILITY = "notification_visibility"; + public static final String PLAYBACK_ON_STARTUP = "playback_on_startup"; + public static final String SCROBBLE = "scrobble"; + public static final String SHAKE_ACTION = "shake_action"; + public static final String SHAKE_THRESHOLD = "shake_threshold"; + public static final String STOCK_BROADCAST = "stock_broadcast"; + public static final String SWIPE_DOWN_ACTION = "swipe_down_action"; + public static final String SWIPE_UP_ACTION = "swipe_up_action"; + public static final String TAB_ORDER = "tab_order"; + public static final String USE_IDLE_TIMEOUT = "use_idle_timeout"; + public static final String VISIBLE_CONTROLS = "visible_controls"; + public static final String VISIBLE_EXTRA_INFO = "visible_extra_info"; + public static final String ENABLE_TRACK_REPLAYGAIN = "enable_track_replaygain"; + public static final String ENABLE_ALBUM_REPLAYGAIN = "enable_album_replaygain"; + public static final String REPLAYGAIN_BUMP = "replaygain_bump"; + public static final String REPLAYGAIN_UNTAGGED_DEBUMP = "replaygain_untagged_debump"; + public static final String ENABLE_READAHEAD = "enable_readahead"; + public static final String SELECTED_THEME = "selected_theme"; + public static final String FILESYSTEM_BROWSE_START = "filesystem_browse_start"; + public static final String VOLUME_DURING_DUCKING = "volume_during_ducking"; + public static final String AUTOPLAYLIST_PLAYCOUNTS = "playcounts_autoplaylist"; + public static final String IGNORE_AUDIOFOCUS_LOSS = "ignore_audiofocus_loss"; + public static final String ENABLE_SCROLL_TO_SONG = "enable_scroll_to_song"; + public static final String QUEUE_ENABLE_SCROLL_TO_SONG = "queue_enable_scroll_to_song"; + public static final String KEEP_SCREEN_ON = "keep_screen_on"; + public static final String PLAYLIST_SYNC_MODE = "playlist_sync_mode"; + public static final String PLAYLIST_SYNC_FOLDER = "playlist_sync_folder"; + public static final String PLAYLIST_EXPORT_RELATIVE_PATHS = "playlist_export_relative_paths"; + public static final String JUMP_TO_ENQUEUED_ON_PLAY = "jump_to_enqueued_on_play"; + public static final String DISABLE_GAPLESS_PLAYBACK = "disable_gapless_playback"; +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/PreferencesActivity.java b/app/src/main/java/ch/blinkenlights/android/vanilla/PreferencesActivity.java new file mode 100644 index 0000000..53b8413 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/PreferencesActivity.java @@ -0,0 +1,318 @@ +/* + * Copyright (C) 2012-2015 Adrian Ulrich <adrian@blinkenlights.ch> + * Copyright (C) 2012 Christopher Eby <kreed@kreed.org> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package ch.blinkenlights.android.vanilla; + +import android.app.Activity; +import android.app.AlertDialog; +import android.app.FragmentManager; +import android.content.DialogInterface; +import android.content.SharedPreferences; +import android.graphics.Color; +import android.os.Bundle; +import android.preference.Preference; +import android.preference.PreferenceActivity; +import android.preference.PreferenceFragment; +import android.preference.CheckBoxPreference; +import android.view.LayoutInflater; +import android.view.MenuItem; +import android.view.View; +import android.view.ViewGroup; +import android.webkit.WebView; +import android.webkit.WebViewFragment; +import android.widget.Toast; +import android.content.Context; +import android.content.Intent; +import android.media.audiofx.AudioEffect; +import android.net.Uri; +import android.util.TypedValue; +import java.util.ArrayList; +import java.util.List; + +/** + * The preferences activity in which one can change application preferences. + */ +public class PreferencesActivity extends PreferenceActivity + implements SharedPreferences.OnSharedPreferenceChangeListener +{ + + /** + * The package name of our external helper app + */ + private static final String VPLUG_PACKAGE_NAME = "ch.blinkenlights.android.vanillaplug"; + + /** + * Initialize the activity, loading the preference specifications. + */ + @SuppressWarnings("deprecation") + @Override + protected void onCreate(Bundle savedInstanceState) + { + ThemeHelper.setTheme(this, R.style.BackActionBar); + super.onCreate(savedInstanceState); + SharedPrefHelper.getSettings(this).registerOnSharedPreferenceChangeListener(this); + } + + @Override + protected void onDestroy() { + super.onDestroy(); + SharedPrefHelper.getSettings(this).unregisterOnSharedPreferenceChangeListener(this); + } + + @Override + public void onBuildHeaders(List<Header> target) + { + ArrayList<Header> tmp = new ArrayList<Header>(); + loadHeadersFromResource(R.xml.preference_headers, tmp); + + for(Header obj : tmp) { + target.add(obj); + } + } + + @Override + public void onSharedPreferenceChanged (SharedPreferences sharedPreferences, String key) { + if (PrefKeys.SELECTED_THEME.equals(key)) { + // this gets called by all preference instances: we force them to redraw + // themselfes if the theme changed + recreate(); + } + } + + public static class AudioFragment extends PreferenceFragment { + @Override + public void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + addPreferencesFromResource(R.xml.preference_audio); + } + } + + public static class ReplayGainFragment extends PreferenceFragment { + CheckBoxPreference cbTrackReplayGain; + CheckBoxPreference cbAlbumReplayGain; + SeekBarPreference sbGainBump; + SeekBarPreference sbUntaggedDebump; + + @Override + public void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + + addPreferencesFromResource(R.xml.preference_replaygain); + cbTrackReplayGain = (CheckBoxPreference)findPreference(PrefKeys.ENABLE_TRACK_REPLAYGAIN); + cbAlbumReplayGain = (CheckBoxPreference)findPreference(PrefKeys.ENABLE_ALBUM_REPLAYGAIN); + sbGainBump = (SeekBarPreference)findPreference(PrefKeys.REPLAYGAIN_BUMP); + sbUntaggedDebump = (SeekBarPreference)findPreference(PrefKeys.REPLAYGAIN_UNTAGGED_DEBUMP); + + Preference.OnPreferenceClickListener pcListener = new Preference.OnPreferenceClickListener() { + public boolean onPreferenceClick(Preference preference) { + updateConfigWidgets(); + return false; + } + }; + + cbTrackReplayGain.setOnPreferenceClickListener(pcListener); + cbAlbumReplayGain.setOnPreferenceClickListener(pcListener); + updateConfigWidgets(); + } + + private void updateConfigWidgets() { + boolean rgOn = (cbTrackReplayGain.isChecked() || cbAlbumReplayGain.isChecked()); + sbGainBump.setEnabled(rgOn); + sbUntaggedDebump.setEnabled(rgOn); + } + } + + public static class EqualizerFragment extends PreferenceFragment { + @Override + public void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + + Context context = getActivity(); + int mAudioSession = 0; + if (PlaybackService.hasInstance()) { + PlaybackService service = PlaybackService.get(context); + mAudioSession = service.getAudioSession(); + } + + try { + final Intent effects = new Intent(AudioEffect.ACTION_DISPLAY_AUDIO_EFFECT_CONTROL_PANEL); + effects.putExtra(AudioEffect.EXTRA_PACKAGE_NAME, context.getPackageName()); + effects.putExtra(AudioEffect.EXTRA_AUDIO_SESSION, mAudioSession); + startActivityForResult(effects, 0); + } catch (Exception e) { + // ignored. Whee! + } + + FragmentManager fragmentManager = getFragmentManager(); + if (!fragmentManager.isStateSaved()) { + fragmentManager.popBackStack(); + } + } + } + + public static class PlaybackFragment extends PreferenceFragment { + @Override + public void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + addPreferencesFromResource(R.xml.preference_playback); + } + } + + public static class LibraryFragment extends PreferenceFragment { + @Override + public void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + addPreferencesFromResource(R.xml.preference_library); + } + } + + public static class NotificationsFragment extends PreferenceFragment { + @Override + public void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + addPreferencesFromResource(R.xml.preference_notifications); + } + } + + public static class ShakeFragment extends PreferenceFragment { + @Override + public void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + addPreferencesFromResource(R.xml.preference_shake); + } + } + + public static class CoverArtFragment extends PreferenceFragment { + @Override + public void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + addPreferencesFromResource(R.xml.preference_coverart); + } + } + + public static class MiscFragment extends PreferenceFragment { + @Override + public void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + addPreferencesFromResource(R.xml.preference_misc); + } + } + + public static class PlaylistFragment extends PreferenceFragment { + @Override + public void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + addPreferencesFromResource(R.xml.preference_playlist); + } + } + + public static class HelpFragment extends PreferenceFragment { + @Override + public void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + + Activity activity = getActivity(); + Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/vanilla-music/vanilla-music.github.io/wiki")); + if (intent != null) { + startActivity(intent); + } + activity.finish(); + } + } + + public static class AboutFragment extends WebViewFragment { + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) + { + WebView view = (WebView)super.onCreateView(inflater, container, savedInstanceState); + view.getSettings().setJavaScriptEnabled(true); + + TypedValue value = new TypedValue(); + getActivity().getTheme().resolveAttribute(R.attr.overlay_foreground_color, value, true); + String fontColor = TypedValue.coerceToString(value.type, value.data); + view.loadUrl("file:///android_asset/about.html?"+Uri.encode(fontColor)); + view.setBackgroundColor(Color.TRANSPARENT); + return view; + } + } + + public static class HeadsetLaunchFragment extends PreferenceFragment { + @Override + public void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + + Activity activity = getActivity(); + Intent intent = activity.getPackageManager().getLaunchIntentForPackage(VPLUG_PACKAGE_NAME); + + if (intent != null) { + startActivity(intent); + FragmentManager fragmentManager = getFragmentManager(); + if (!fragmentManager.isStateSaved()) { + fragmentManager.popBackStack(); + } + } else { + // package is not installed, ask user to install it + new AlertDialog.Builder(activity) + .setTitle(R.string.headset_launch_title) + .setMessage(R.string.headset_launch_app_missing) + .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + try { + Intent marketIntent = new Intent(Intent.ACTION_VIEW); + marketIntent.setData(Uri.parse("market://details?id="+VPLUG_PACKAGE_NAME)); + startActivity(marketIntent); + getActivity().onBackPressed(); + } catch (android.content.ActivityNotFoundException e) { + Toast.makeText(getActivity(), "Failed to open market: " + e, Toast.LENGTH_SHORT).show(); + } + } + }) + .setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + getActivity().onBackPressed(); + } + }) + .show(); + } + } + } + + @Override + protected boolean isValidFragment(String fragmentName) { + return true; + } + + +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/PreferencesMediaLibrary.java b/app/src/main/java/ch/blinkenlights/android/vanilla/PreferencesMediaLibrary.java new file mode 100644 index 0000000..1be3a2d --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/PreferencesMediaLibrary.java @@ -0,0 +1,414 @@ +/* + * Copyright (C) 2017-2021 Adrian Ulrich <adrian@blinkenlights.ch> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package ch.blinkenlights.android.vanilla; + +import ch.blinkenlights.android.medialibrary.MediaLibrary; +import ch.blinkenlights.android.medialibrary.LibraryObserver; + +import android.app.AlertDialog; +import android.app.Fragment; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.database.Cursor; +import android.os.Bundle; +import android.os.Environment; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; +import android.view.View; +import android.view.ViewGroup; +import android.widget.CheckBox; +import android.widget.ProgressBar; +import android.widget.TextView; +import android.widget.Toast; + +public class PreferencesMediaLibrary extends Fragment implements View.OnClickListener { + /** + * Our start button + */ + private View mStartButton; + /** + * The cancel button + */ + private View mCancelButton; + /** + * The edit-media-folders button + */ + private View mEditButton; + /** + * The debug / progress text describing the scan status + */ + private TextView mProgressText; + /** + * The progress bar + */ + private ProgressBar mProgressBar; + /** + * The number of tracks on this device + */; + private TextView mStatsTracks; + /** + * The number of hours of music we have + */ + private TextView mStatsLibraryPlaytime; + /** + * The total listening time + */ + private TextView mStatsListenPlaytime; + /** + * A list of scanned media directories + */ + private TextView mMediaDirectories; + /** + * Checkbox for full scan + */ + private CheckBox mFullScanCheck; + /** + * Checkbox for drop + */ + private CheckBox mDropDbCheck; + /** + * Checkbox for album group option + */ + private CheckBox mGroupAlbumsCheck; + /** + * Checkbox for targreader flavor + */ + private CheckBox mForceBastpCheck; + /** + * Set if we should start a full scan due to option changes + */ + private boolean mFullScanPending; + /** + * Set if we are in the edit dialog + */ + private boolean mIsEditingDirectories; + /** + * The original state of our media folders. + */ + private String mInitialMediaFolders; + + private final LibraryObserver mLibraryObserver = new LibraryObserver() { + @Override + public void onChange(LibraryObserver.Type type, long id, boolean ongoing) { + if (type != LibraryObserver.Type.SCAN_PROGRESS) + return; + getActivity().runOnUiThread(new Runnable() { + @Override + public void run() { + updateProgress(); + } + }); + } + }; + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + return inflater.inflate(R.layout.medialibrary_preferences, container, false); + } + + @Override + public void onViewCreated(View view, Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + + mStartButton = (View)view.findViewById(R.id.start_button); + mCancelButton = (View)view.findViewById(R.id.cancel_button); + mEditButton = (View)view.findViewById(R.id.edit_button); + mProgressText = (TextView)view.findViewById(R.id.media_stats_progress_text); + mProgressBar = (ProgressBar)view.findViewById(R.id.media_stats_progress_bar); + mStatsTracks = (TextView)view.findViewById(R.id.media_stats_tracks); + mStatsLibraryPlaytime = (TextView)view.findViewById(R.id.media_stats_library_playtime); + mStatsListenPlaytime = (TextView)view.findViewById(R.id.media_stats_listen_playtime); + mMediaDirectories = (TextView)view.findViewById(R.id.media_directories); + mFullScanCheck = (CheckBox)view.findViewById(R.id.media_scan_full); + mDropDbCheck = (CheckBox)view.findViewById(R.id.media_scan_drop_db); + mGroupAlbumsCheck = (CheckBox)view.findViewById(R.id.media_scan_group_albums); + mForceBastpCheck = (CheckBox)view.findViewById(R.id.media_scan_force_bastp); + + // Bind onClickListener to some elements + mStartButton.setOnClickListener(this); + mCancelButton.setOnClickListener(this); + mEditButton.setOnClickListener(this); + mGroupAlbumsCheck.setOnClickListener(this); + mForceBastpCheck.setOnClickListener(this); + // Enable options menu. + setHasOptionsMenu(true); + } + + @Override + public void onResume() { + super.onResume(); + + // We got freshly created and user didn't have a chance + // to edit anything: remember this state + if (mInitialMediaFolders == null) + mInitialMediaFolders = getMediaFoldersDescription(); + + // Returned from edit dialog + if (mIsEditingDirectories) { + mIsEditingDirectories = false; + // trigger a scan if user changed its preferences + // in the edit dialog + if (!mInitialMediaFolders.equals(getMediaFoldersDescription())) + mFullScanPending = true; + } + + MediaLibrary.registerLibraryObserver(mLibraryObserver); + updateProgress(); + updatePreferences(null); + } + + @Override + public void onPause() { + super.onPause(); + MediaLibrary.unregisterLibraryObserver(mLibraryObserver); + // User exited this view -> scan if needed + if (mFullScanPending && !mIsEditingDirectories) { + MediaLibrary.startLibraryScan(getActivity(), true, true); + mInitialMediaFolders = null; + mFullScanPending = false; + } + } + + @Override + public void onClick(View view) { + switch (view.getId()) { + case R.id.start_button: + startButtonPressed(view); + break; + case R.id.cancel_button: + cancelButtonPressed(view); + break; + case R.id.edit_button: + editButtonPressed(view); + break; + case R.id.media_scan_group_albums: + case R.id.media_scan_force_bastp: + confirmUpdatePreferences((CheckBox)view); + break; + } + } + + private static final int MENU_DUMP_DB = 1; + private static final int MENU_FORCE_M3U_IMPORT = 2; + + @Override + public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { + super.onCreateOptionsMenu(menu, inflater); + menu.add(0, MENU_DUMP_DB, 30, R.string.dump_database); + menu.add(0, MENU_FORCE_M3U_IMPORT, 30, R.string.force_m3u_import); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case MENU_DUMP_DB: + final Context context = getActivity(); + final String path = Environment.getExternalStorageDirectory().getPath() + "/dbdump-" + context.getPackageName() + ".sqlite"; + final String msg = getString(R.string.dump_database_result, path); + + MediaLibrary.createDebugDump(context, path); + Toast.makeText(context, msg, Toast.LENGTH_SHORT).show(); + break; + case MENU_FORCE_M3U_IMPORT: + // Sending an 'OUTDATED' event signals that our playlist information is wrong. + // This should trigger a full re-import. + MediaLibrary.notifyObserver(LibraryObserver.Type.PLAYLIST, LibraryObserver.Value.OUTDATED, false); + break; + default: + return super.onOptionsItemSelected(item); + } + return true; + } + /** + * Wrapper for updatePreferences() which warns the user about + * possible consequences. + * + * @param checkbox the checkbox which was changed + */ + private void confirmUpdatePreferences(final CheckBox checkbox) { + if (mFullScanPending) { + // User was already warned, so we can just dispatch this + // without nagging again + updatePreferences(checkbox); + return; + } + + new AlertDialog.Builder(getActivity()) + .setTitle(R.string.media_scan_preferences_change_title) + .setMessage(R.string.media_scan_preferences_change_message) + .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + mFullScanPending = true; + confirmUpdatePreferences(checkbox); + } + }) + .setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + // restore old condition if use does not want to proceed + checkbox.setChecked(!checkbox.isChecked()); + } + }) + .show(); + } + + /** + * Initializes and updates the scanner preferences + * + * @param checkbox the item to update, may be null + * @return void but sets the checkboxes to their correct state + */ + private void updatePreferences(CheckBox checkbox) { + MediaLibrary.Preferences prefs = MediaLibrary.getPreferences(getActivity()); + + if (checkbox == mGroupAlbumsCheck) + prefs.groupAlbumsByFolder = mGroupAlbumsCheck.isChecked(); + if (checkbox == mForceBastpCheck) + prefs.forceBastp = mForceBastpCheck.isChecked(); + + MediaLibrary.setPreferences(getActivity(), prefs); + + mGroupAlbumsCheck.setChecked(prefs.groupAlbumsByFolder); + mForceBastpCheck.setChecked(prefs.forceBastp); + mMediaDirectories.setText(getMediaFoldersDescription()); + } + + /** + * Returns a textual representation of the media folder state + * + * @return string describing our directory scan preferences + */ + private String getMediaFoldersDescription() { + MediaLibrary.Preferences prefs = MediaLibrary.getPreferences(getActivity()); + String description = ""; + for (String path : prefs.mediaFolders) { + description += "✔ " + path + "\n"; + } + for (String path : prefs.blacklistedFolders) { + description += "✘ " + path + "\n"; + } + return description; + } + + /** + * Updates the view of this fragment with current information + */ + private void updateProgress() { + Context context = getActivity(); + MediaLibrary.ScanProgress progress = MediaLibrary.describeScanProgress(context); + + boolean idle = !progress.isRunning; + mProgressText.setText(progress.lastFile); + mProgressBar.setMax(progress.total); + mProgressBar.setProgress(progress.seen); + + mStartButton.setEnabled(idle); + mEditButton.setEnabled(idle); + mDropDbCheck.setEnabled(idle); + mFullScanCheck.setEnabled(idle); + mForceBastpCheck.setEnabled(idle); + mGroupAlbumsCheck.setEnabled(idle); + + mCancelButton.setVisibility(idle ? View.GONE : View.VISIBLE); + mProgressText.setVisibility(idle ? View.GONE : View.VISIBLE); + mProgressBar.setVisibility(idle ? View.GONE : View.VISIBLE); + + Integer songCount = MediaLibrary.getLibrarySize(context); + mStatsTracks.setText(songCount.toString()); + + float libraryPlaytime = calculateSongSum(context, MediaLibrary.SongColumns.DURATION) / 3600000F; + mStatsLibraryPlaytime.setText(String.format("%.1f", libraryPlaytime)); + + float listenPlaytime = calculateSongSum(context, MediaLibrary.SongColumns.PLAYCOUNT+"*"+MediaLibrary.SongColumns.DURATION) / 3600000F; + mStatsListenPlaytime.setText(String.format("%.1f", listenPlaytime)); + } + + /** + * Queries the media library and calculates the sum of given column. + * + * @param context the context to use + * @param column the column to sum up + * @return the play time of the library in ms + */ + public long calculateSongSum(Context context, String column) { + long duration = 0; + Cursor cursor = MediaLibrary.queryLibrary(context, MediaLibrary.TABLE_SONGS, new String[]{"SUM("+column+")"}, null, null, null); + if (cursor != null) { + if (cursor.moveToFirst()) { + duration = cursor.getLong(0); + } + cursor.close(); + } + return duration; + } + + /** + * Called when the user hits the start button + * + * @param view the view which was pressed + */ + public void startButtonPressed(View view) { + MediaLibrary.startLibraryScan(getActivity(), mFullScanCheck.isChecked(), mDropDbCheck.isChecked()); + } + + /** + * Called when the user hits the cancel button + * + * @param view the view which was pressed + */ + public void cancelButtonPressed(View view) { + MediaLibrary.abortLibraryScan(getActivity()); + } + + /** + * Called when the user hits the edit button + * + * @param view the view which was pressed + */ + private void editButtonPressed(final View view) { + if (mFullScanPending) { + // no need to nag if we are scanning anyway + startMediaFoldersSelection(); + return; + } + + new AlertDialog.Builder(getActivity()) + .setTitle(R.string.media_scan_preferences_change_title) + .setMessage(R.string.media_scan_preferences_change_message) + .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + startMediaFoldersSelection(); + } + }) + .setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) {} + }) + .show(); + } + + /** + * Launches the edit dialog + */ + private void startMediaFoldersSelection() { + mIsEditingDirectories = true; + startActivity(new Intent(getActivity(), MediaFoldersSelectionActivity.class)); + } + +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/PreferencesTheme.java b/app/src/main/java/ch/blinkenlights/android/vanilla/PreferencesTheme.java new file mode 100644 index 0000000..032da0c --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/PreferencesTheme.java @@ -0,0 +1,107 @@ +/* + * Copyright (C) 2016 Adrian Ulrich <adrian@blinkenlights.ch> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package ch.blinkenlights.android.vanilla; + +import android.content.Context; +import android.content.SharedPreferences; +import android.graphics.Bitmap; +import android.graphics.Canvas; +import android.graphics.Paint; +import android.graphics.drawable.BitmapDrawable; +import android.graphics.drawable.Drawable; +import android.os.Bundle; +import android.preference.Preference; +import android.preference.PreferenceFragment; +import android.preference.PreferenceScreen; + + +public class PreferencesTheme extends PreferenceFragment + implements Preference.OnPreferenceClickListener +{ + private Context mContext; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + mContext = getActivity(); + + // Themes are 'pre-compiled' in themes-list: get all values + // and append them to our newly created PreferenceScreen + PreferenceScreen screen = getPreferenceManager().createPreferenceScreen(mContext); + final String[] entries = getResources().getStringArray(R.array.theme_entries); + final String[] values = getResources().getStringArray(R.array.theme_values); + final String[] ids = getResources().getStringArray(R.array.theme_ids); + + for (int i = 0; i < entries.length; i++) { + + int[] attrs = decodeValue(values[i]); + + final Preference pref = new Preference(mContext); + pref.setPersistent(false); + pref.setOnPreferenceClickListener(this); + pref.setTitle(entries[i]); + pref.setKey(ids[i]); // preference value of this theme + pref.setIcon(generateThemePreview(attrs)); + screen.addPreference(pref); + } + setPreferenceScreen(screen); + } + + @Override + public boolean onPreferenceClick(Preference pref) { + SharedPreferences.Editor editor = SharedPrefHelper.getSettings(mContext).edit(); + editor.putString(PrefKeys.SELECTED_THEME, pref.getKey()); + editor.apply(); + return true; + } + + + private int[] decodeValue(String v) { + String[] parts = v.split(","); + int[] values = new int[parts.length]; + for (int i=0; i<parts.length; i++) { + long parsedLong = (long)Long.decode(parts[i]); // the colors overflow an int, so we first must parse it as Long to make java happy. + values[i] = (int)parsedLong; + } + return values; + } + + private Drawable generateThemePreview(int[] colors) { + final int size = (int) getResources().getDimension(R.dimen.cover_size); + final int step = size / colors.length; + + Bitmap bitmap = Bitmap.createBitmap(size, size, Bitmap.Config.RGB_565); + Canvas canvas = new Canvas(bitmap); + Paint paint = new Paint(); + + paint.setStyle(Paint.Style.FILL); + for (int i=0; i < colors.length; i++) { + paint.setColor(colors[i]); + canvas.drawRect(0, step*i, size, size, paint); + } + + Drawable d = new BitmapDrawable(mContext.getResources(), bitmap); + return d; + } + + + + + +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/QueryTask.java b/app/src/main/java/ch/blinkenlights/android/vanilla/QueryTask.java new file mode 100644 index 0000000..da97938 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/QueryTask.java @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2016 Adrian Ulrich <adrian@blinkenlights.ch> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + + +package ch.blinkenlights.android.vanilla; + +import ch.blinkenlights.android.medialibrary.MediaLibrary; + +import android.content.Context; +import android.database.Cursor; + +/** + * Represents a pending query. + */ +public class QueryTask { + public final String table; + public final String[] projection; + public final String selection; + public final String[] selectionArgs; + public String sortOrder; + + /** + * Used for {@link SongTimeline#addSongs(android.content.Context, QueryTask)}. + * One of SongTimeline.MODE_*. + */ + public int mode; + + /** + * Type of the group being query. One of MediaUtils.TYPE_*. + */ + public int type; + + /** + * Data. Required value depends on value of mode. See individual mode + * documentation for details. + */ + public long data; + + /** + * Create the tasks. All arguments are passed directly to + * MediaLibrary.runQuery(). + */ + public QueryTask(String table, String[] projection, String selection, String[] selectionArgs, String sortOrder) { + this.table = table; + this.projection = projection; + this.selection = selection; + this.selectionArgs = selectionArgs; + this.sortOrder = sortOrder; + } + + /** + * Run the query. Should be called on a background thread. + * + * @param context The Context to use + */ + public Cursor runQuery(Context context) { + return MediaLibrary.queryLibrary(context, table, projection, selection, selectionArgs, sortOrder); + } +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/ReadaheadThread.java b/app/src/main/java/ch/blinkenlights/android/vanilla/ReadaheadThread.java new file mode 100644 index 0000000..025bf10 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/ReadaheadThread.java @@ -0,0 +1,148 @@ +/* + * Copyright (C) 2015 - 2017 Adrian Ulrich <adrian@blinkenlights.ch> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + + +package ch.blinkenlights.android.vanilla; + +import android.os.Handler; +import android.os.HandlerThread; +import android.os.Message; +import android.os.Process; +import android.util.Log; + +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; + +class ReadaheadThread implements Handler.Callback { + + /** + * How many bytes we are going to read per run + */ + private static final int BYTES_PER_READ = 32768; + /** + * Our message handler + */ + private Handler mHandler; + /** + * The global (current) file input stream + */ + private FileInputStream mInputStream; + /** + * The filesystem path used to create the current mInputStream + */ + private String mPath; + /** + * The calculated delay between `BYTES_PER_READ' sized + * read operations + */ + private long mReadDelay; + /** + * Scratch space to read junk data + */ + private byte[] mScratch; + + + public ReadaheadThread() { + mScratch = new byte[BYTES_PER_READ]; + HandlerThread handlerThread = new HandlerThread("ReadaheadThread", Process.THREAD_PRIORITY_LOWEST); + handlerThread.start(); + mHandler = new Handler(handlerThread.getLooper(), this); + } + + /** + * Aborts all current in-flight RPCs, pausing the readahead operation + */ + public void pause() { + mHandler.removeMessages(MSG_SET_SONG); + mHandler.removeMessages(MSG_READ_CHUNK); + } + + /** + * Starts a new readahead operation. Will resume if `song.path' equals + * the currently open file + * + * @param path The path to read ahead + */ + public void setSong(final Song song) { + pause(); // cancell all in-flight rpc's + mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_SET_SONG, song), 1000); + } + + private static final int MSG_SET_SONG = 1; + private static final int MSG_READ_CHUNK = 2; + @Override + public boolean handleMessage(Message message) { + switch (message.what) { + case MSG_SET_SONG: { + Song song = (Song)message.obj; + + if (mInputStream != null && !mPath.equals(song.path)) { + // current file does not match requested one: clean it + try { + mInputStream.close(); + } catch (IOException e) { + Log.e("VanillaMusic", "Failed to close file: "+e); + } + mPath = null; + mReadDelay = 0; + mInputStream = null; + } + + if (mInputStream == null) { + // need to open new input stream + try { + mPath = song.path; + mInputStream = new FileInputStream(mPath); + double requiredReads = mInputStream.available() / BYTES_PER_READ; + + if (requiredReads > 1) { + mReadDelay = (long)(0.90 * song.duration / requiredReads); // run ~10% ahead + } + } catch (FileNotFoundException e) { + Log.e("VanillaMusic", "Failed to song "+ song +": "+e); + } catch (IOException e) { + Log.e("VanillaMusic", "IO Exception on "+ song +": "+e); + } + } + + if (mInputStream != null) { + mHandler.sendEmptyMessage(MSG_READ_CHUNK); + } + break; + } + case MSG_READ_CHUNK: { + int bytesRead = -1; + try { + bytesRead = mInputStream.read(mScratch); + } catch (IOException e) { + // fs error or eof: stop in any case + } + if (bytesRead >= 0) { + mHandler.sendEmptyMessageDelayed(MSG_READ_CHUNK, mReadDelay); + } else { + Log.d("VanillaMusic", "Readahead for "+mPath+" finished"); + } + } + default: { + break; + } + } + return true; + } + +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/RemoteControl.java b/app/src/main/java/ch/blinkenlights/android/vanilla/RemoteControl.java new file mode 100644 index 0000000..eaec829 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/RemoteControl.java @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2015 Adrian Ulrich <adrian@blinkenlights.ch> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package ch.blinkenlights.android.vanilla; + +import android.content.Context; +import android.os.Build; + + +public class RemoteControl { + + /** + * Returns a RemoteControl.Client implementation + */ + public RemoteControl.Client getClient(Context context) { + return new RemoteControlImplLp(context); + } + + /** + * Interface definition of our RemoteControl API + */ + public interface Client { + public void initializeRemote(); + public void unregisterRemote(); + public void reloadPreference(); + public void updateRemote(Song song, int state, boolean keepPaused); + } +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/RemoteControlImplLp.java b/app/src/main/java/ch/blinkenlights/android/vanilla/RemoteControlImplLp.java new file mode 100644 index 0000000..e2e7987 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/RemoteControlImplLp.java @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2015 Adrian Ulrich <adrian@blinkenlights.ch> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package ch.blinkenlights.android.vanilla; + +import android.annotation.TargetApi; +import android.content.Context; + +@TargetApi(21) +public class RemoteControlImplLp implements RemoteControl.Client { + /** + * This is just a placeholder implementation: On API 21, media buttons are handled in MediaSessionTracker. + */ + public RemoteControlImplLp(Context context) { + } + + public void initializeRemote() { + } + + public void unregisterRemote() { + } + + public void reloadPreference() { + } + + public void updateRemote(Song song, int state, boolean keepPaused) { + } +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/ScheduledLibraryUpdate.java b/app/src/main/java/ch/blinkenlights/android/vanilla/ScheduledLibraryUpdate.java new file mode 100644 index 0000000..c47ad29 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/ScheduledLibraryUpdate.java @@ -0,0 +1,143 @@ +/* + * Copyright (C) 2017 Adrian Ulrich <adrian@blinkenlights.ch> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package ch.blinkenlights.android.vanilla; + +import ch.blinkenlights.android.medialibrary.MediaLibrary; +import ch.blinkenlights.android.medialibrary.LibraryObserver; + +import android.annotation.TargetApi; +import android.app.job.JobInfo; +import android.app.job.JobParameters; +import android.app.job.JobScheduler; +import android.app.job.JobService; +import android.content.Context; +import android.content.ComponentName; + + +@TargetApi(21) +public class ScheduledLibraryUpdate extends JobService { + /** + * The unique job id of this package - do not change + * as we would otherwise end up with multiple scheduled + * jobs (until the next reboot happens) + */ + private final static int JOB_ID_UPDATE = 9; + /** + * The job parameters of the currently running job + */ + private JobParameters mJobParams; + + + /** + * Schedules a new media library scan job. + * + * @return true if job was scheduled, false otherwise + */ + public static boolean scheduleUpdate(Context context) { + JobScheduler scheduler = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE); + + ComponentName componentName = new ComponentName(context, ScheduledLibraryUpdate.class); + JobInfo job = new JobInfo.Builder(JOB_ID_UPDATE, componentName) + .setRequiresCharging(true) + .setRequiresDeviceIdle(true) + .setPeriodic(3600000 * 32) // run at most every ~32 hours + .build(); + + for (JobInfo pj : scheduler.getAllPendingJobs()) { + if (jobsEqual(pj, job)) { + return false; + } + } + + scheduler.schedule(job); + return true; + } + + /** + * Compare two jobs, returns `true' if the values we care about + * are equal + * + * @param a the first job to compare + * @param b the second job to compare + * @return true if `a' and `b' are equal jobs + */ + private static boolean jobsEqual(JobInfo a, JobInfo b) { + return (a.getId() == b.getId() && + a.getIntervalMillis() == b.getIntervalMillis() && + a.isRequireCharging() == b.isRequireCharging() && + a.isRequireDeviceIdle() == b.isRequireDeviceIdle() && + a.isPeriodic() == b.isPeriodic()); + } + + /** + * Called by the scheduler to launch the job + * + * @param params the parameters of this job + * @return true if the job has been launched + */ + @Override + public boolean onStartJob(JobParameters params) { + if (params.getJobId() != JOB_ID_UPDATE) + return false; // orphaned job, do not start + + final boolean fullScan = (Math.random() > 0.7); + + mJobParams = params; + MediaLibrary.registerLibraryObserver(mObserver); + MediaLibrary.startLibraryScan(this, fullScan, false); + + return true; + } + + /** + * Called by the scheduler to abort the job + * + * @param params the parameters of the job to abort + * @return false as we do not want to get backed-off + */ + @Override + public boolean onStopJob(JobParameters params) { + finalizeScan(); + return false; + } + + /** + * Aborts a running scan job + */ + private void finalizeScan() { + MediaLibrary.unregisterLibraryObserver(mObserver); + MediaLibrary.abortLibraryScan(this); + mJobParams = null; + } + + /** + * The content observer registered to the media library. + * The observer will receive callbacks for changed songs, + * the last callback will have `ongoing` set to `false`, + * which indicates that our job completed. + */ + private final LibraryObserver mObserver = new LibraryObserver() { + @Override + public void onChange(LibraryObserver.Type type, long id, boolean ongoing) { + if (type == LibraryObserver.Type.SONG && !ongoing) { + jobFinished(mJobParams, false); + finalizeScan(); + } + } + }; +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/SeekBarPreference.java b/app/src/main/java/ch/blinkenlights/android/vanilla/SeekBarPreference.java new file mode 100644 index 0000000..0ce8c47 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/SeekBarPreference.java @@ -0,0 +1,242 @@ +/* + * Copyright (C) 2012 Christopher Eby <kreed@kreed.org> + * Copyright (C) 2015 Adrian Ulrich <adrian@blinkenlights.ch> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package ch.blinkenlights.android.vanilla; + +import android.content.Context; +import android.content.SharedPreferences; +import android.content.res.TypedArray; +import android.preference.DialogPreference; +import android.util.AttributeSet; +import android.view.View; +import android.widget.CheckBox; +import android.widget.SeekBar; +import android.widget.TextView; + +/** + * SeekBar preference to set the shake force threshold. + */ +public class SeekBarPreference extends DialogPreference implements SeekBar.OnSeekBarChangeListener { + /** + * The current value. + */ + private int mValue; + /** + * Our context (needed for getResources()) + */ + private Context mContext; + /** + * The maximum value to use + */ + private int mMaxValue; + /** + * The initially configured value (updated on dialog close) + */ + private int mInitialValue; + /** + * Steps to take for the value + */ + private int mSteps; + /** + * The format to use for the summary + */ + private String mSummaryFormat; + /** + * The text to use in the summary + */ + private String mSummaryText; + /** + * Text to display if the value equals zero + */ + private String mZeroText; + /** + * CheckBox preferences key, may be null + */ + private String mCheckBoxKey; + /** + * Label of checkbox + */ + private String mCheckBoxText; + /** + * Add given value to summary value + */ + private float mSummaryValueAddition; + /** + * Multiply summary value by this value + */ + private float mSummaryValueMultiplication; + /** + * TextView to display current summary + */ + private TextView mValueText; + /** + * CheckBox to display, may be null + */ + private CheckBox mCheckBox; + + public SeekBarPreference(Context context, AttributeSet attrs) + { + super(context, attrs); + mContext = context; + initDefaults(attrs); + } + + + /** + * Configures the view using the SeekBarPreference XML attributes + * + * @param attrs An AttributeSet + */ + private void initDefaults(AttributeSet attrs) { + TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.SeekBarPreference); + + mMaxValue = a.getInteger(R.styleable.SeekBarPreference_sbpMaxValue, 0); + mSteps = a.getInteger(R.styleable.SeekBarPreference_sbpSteps, 1); + mSummaryValueMultiplication = a.getFloat(R.styleable.SeekBarPreference_sbpSummaryValueMultiplication, 0f); + mSummaryValueAddition = a.getFloat(R.styleable.SeekBarPreference_sbpSummaryValueAddition, 0f); + mSummaryFormat = a.getString(R.styleable.SeekBarPreference_sbpSummaryFormat); + mSummaryFormat = (mSummaryFormat == null ? "%s %.1f" : mSummaryFormat); + mSummaryText = a.getString(R.styleable.SeekBarPreference_sbpSummaryText); + mSummaryText = (mSummaryText == null ? "" : mSummaryText); + mZeroText = a.getString(R.styleable.SeekBarPreference_sbpSummaryZeroText); // unlike other strings, this may be null + mCheckBoxKey = a.getString(R.styleable.SeekBarPreference_sbpCheckBoxKey); // non-null if checkbox enabled + mCheckBoxText = a.getString(R.styleable.SeekBarPreference_sbpCheckBoxText); + a.recycle(); + } + + + @Override + public CharSequence getSummary() + { + return getSummary(mValue); + } + + @Override + protected Object onGetDefaultValue(TypedArray a, int index) + { + return a.getInt(index, 100); + } + + @Override + protected void onSetInitialValue(boolean restoreValue, Object defaultValue) + { + mInitialValue = mValue = restoreValue ? getPersistedInt(mValue) : (Integer)defaultValue; + } + + /** + * Create the summary for the given value. + * + * @param value The force threshold. + * @return A string representation of the threshold. + */ + private String getSummary(int value) { + float fValue = (float)value; + + if (mSummaryValueAddition != 0f) + fValue = fValue + mSummaryValueAddition; + if (mSummaryValueMultiplication != 0f) + fValue = fValue * mSummaryValueMultiplication; + + String result = String.format(mSummaryFormat, mSummaryText, fValue); + + if (fValue == 0f && mZeroText != null) + result = mZeroText; + + return result; + } + + @Override + protected View onCreateDialogView() + { + View view = super.onCreateDialogView(); + + mValueText = (TextView)view.findViewById(R.id.value); + mValueText.setText(getSummary(mValue)); + + SeekBar seekBar = (SeekBar)view.findViewById(R.id.seek_bar); + + seekBar.setMax(mMaxValue); + seekBar.setProgress(mValue); + seekBar.setOnSeekBarChangeListener(this); + + if (mCheckBoxKey != null) { + mCheckBox = (CheckBox)view.findViewById(R.id.check_box); + mCheckBox.setText(mCheckBoxText); + mCheckBox.setChecked(getCheckBoxPreference()); + mCheckBox.setVisibility(View.VISIBLE); + } + + return view; + } + + @Override + protected void onDialogClosed(boolean positiveResult) { + if (positiveResult) { + mInitialValue = mValue; + if (mCheckBox != null) + saveCheckBoxPreference(mCheckBox.isChecked()); + } else { + // User aborted: Set remembered start value + setValue(mInitialValue); + } + notifyChanged(); + } + + @Override + public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) + { + if (fromUser) { + progress = (progress/mSteps) * mSteps; + seekBar.setProgress(progress); + setValue(progress); + } + } + + @Override + public void onStartTrackingTouch(SeekBar seekBar) + { + } + + @Override + public void onStopTrackingTouch(SeekBar seekBar) + { + } + + private void setValue(int value) { + mValue = value; + mValueText.setText(getSummary(value)); + persistInt(value); + } + + private void saveCheckBoxPreference(boolean enabled) { + SharedPreferences.Editor editor = SharedPrefHelper.getSettings(mContext).edit(); + editor.putBoolean(mCheckBoxKey, enabled); + editor.apply(); + } + + private boolean getCheckBoxPreference() { + SharedPreferences settings = SharedPrefHelper.getSettings(mContext); + return settings.getBoolean(mCheckBoxKey, false); + } + +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/SharedPrefHelper.java b/app/src/main/java/ch/blinkenlights/android/vanilla/SharedPrefHelper.java new file mode 100644 index 0000000..16455ae --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/SharedPrefHelper.java @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2019 Michael Samuel <michaelsam00@yahoo.com> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package ch.blinkenlights.android.vanilla; + +import android.content.Context; +import android.content.SharedPreferences; +import android.preference.PreferenceManager; + +public final class SharedPrefHelper { + + /** + * Cached app-wide SharedPreferences instance. + */ + private static SharedPreferences sSettings; + + private SharedPrefHelper(){}; + + /** + * Return the SharedPreferences instance containing + * Application settings. + */ + public static SharedPreferences getSettings(Context context) + { + if (sSettings == null) + sSettings = PreferenceManager.getDefaultSharedPreferences(context); + return sSettings; + } + + +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/ShortcutPseudoActivity.java b/app/src/main/java/ch/blinkenlights/android/vanilla/ShortcutPseudoActivity.java new file mode 100644 index 0000000..5adab1b --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/ShortcutPseudoActivity.java @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2017 Adrian Ulrich <adrian@blinkenlights.ch> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package ch.blinkenlights.android.vanilla; + + +import android.app.Activity; +import android.content.Context; +import android.content.Intent; +import android.os.Bundle; + + +public class ShortcutPseudoActivity extends Activity { + final static int INTENT_FLAGS = Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_TASK_ON_HOME; + + /** + * Returns an intent pointing to this activity. + * + * @param context the context to use. + * @param action the action to set. + * @return an intent for this activity. + */ + public static Intent getIntent(Context context, String action) { + Intent intent = new Intent(context, ShortcutPseudoActivity.class) + .setFlags(INTENT_FLAGS) + .setAction(action); + return intent; + } + + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + final String action = getIntent().getAction(); + switch (action) { + case PlaybackService.ACTION_PLAY: + case PlaybackService.ACTION_PAUSE: + case PlaybackService.ACTION_TOGGLE_PLAYBACK: + case PlaybackService.ACTION_TOGGLE_PLAYBACK_DELAYED: + case PlaybackService.ACTION_RANDOM_MIX_AUTOPLAY: + case PlaybackService.ACTION_NEXT_SONG: + case PlaybackService.ACTION_NEXT_SONG_DELAYED: + case PlaybackService.ACTION_NEXT_SONG_AUTOPLAY: + case PlaybackService.ACTION_PREVIOUS_SONG: + case PlaybackService.ACTION_PREVIOUS_SONG_AUTOPLAY: + case PlaybackService.ACTION_CYCLE_SHUFFLE: + case PlaybackService.ACTION_CYCLE_REPEAT: { + Intent intent = new Intent(this, PlaybackService.class); + intent.setAction(action); + startService(intent); + break; + } + case PlaybackService.ACTION_FROM_TYPE_ID_AUTOPLAY: { + // From pinned shortcuts: Same as other actions, but this + // includes some extras. + Intent intent = new Intent(this, PlaybackService.class); + intent.setAction(action); + intent.putExtra(LibraryAdapter.DATA_TYPE, getIntent().getIntExtra(LibraryAdapter.DATA_TYPE, MediaUtils.TYPE_INVALID)); + intent.putExtra(LibraryAdapter.DATA_ID, getIntent().getLongExtra(LibraryAdapter.DATA_ID, LibraryAdapter.INVALID_ID)); + startService(intent); + break; + } + default: + throw new IllegalArgumentException("No such action: " + action); + } + + finish(); + } +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/ShowQueueAdapter.java b/app/src/main/java/ch/blinkenlights/android/vanilla/ShowQueueAdapter.java new file mode 100644 index 0000000..33f0698 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/ShowQueueAdapter.java @@ -0,0 +1,144 @@ +/* + * Copyright (C) 2013-2019 Adrian Ulrich <adrian@blinkenlights.ch> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package ch.blinkenlights.android.vanilla; + +import android.content.Context; +import android.app.Activity; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.view.LayoutInflater; + +public class ShowQueueAdapter extends BaseAdapter { + /** + * The resource to pass to the inflater + */ + private int mResource; + /** + * The position we are going to mark as 'active' + */ + private int mHighlightRow; + /** + * The cached number of songs + */ + private int mSongCount; + /** + * The context to use + */ + private Context mContext; + /** + * The playback service reference to query + */ + private PlaybackService mService; + + public ShowQueueAdapter(Context context, int resource) { + super(); + mResource = resource; + mContext = context; + mHighlightRow = -1; + } + + /** + * Configures our data source + * + * @param service the playback service instance to use + * @param pos the row to highlight, setting this to -1 disables the feature + */ + public void setData(PlaybackService service, int pos) { + mService = service; + mHighlightRow = pos; + mSongCount = service.getTimelineLength(); + notifyDataSetChanged(); + } + + /** + * Returns the number of songs in this adapter + * + * @return the number of songs in this adapter + */ + @Override + public int getCount() { + // Note: This is only updated by setData() to avoid races with the listView if + // the timeline changes: The listView checks if getCount() changed without + // a call to notifyDataSetChanged() and panics if it detected such a condition. + // This can happen to us as onLayout() might get called before setData() was called during + // a queue update. So we simply cache the count to avoid this crash and won't update it until + // setData() is called by our parent. + return mSongCount; + } + + /** + * Returns the song at given position + * + * @param pos the position to query + * @return a Song object + */ + @Override + public Song getItem(int pos) { + Song item = mService.getSongByQueuePosition(pos); + return (item != null ? item : new Song(-1)); + } + + /** + * Returns the item id at `pos' + * + * @param pos the position to query + * @return the song.id at this position + */ + @Override + public long getItemId(int pos) { + return getItem(pos).id; + } + + /** + * Returns always `true' as song.id's are stable + */ + @Override + public boolean hasStableIds() { + return true; + } + + /** + * Returns the view + */ + @Override + public View getView(int position, View convertView, ViewGroup parent) { + DraggableRow row; + + if (convertView != null) { + row = (DraggableRow)convertView; + } else { + LayoutInflater inflater = ((Activity)mContext).getLayoutInflater(); + row = (DraggableRow)inflater.inflate(mResource, parent, false); + row.setupLayout(DraggableRow.LAYOUT_DRAGGABLE); + } + + Song song = getItem(position); + + if (song.isFilled()) { + row.setText(song.title, song.album+" · "+song.artist); + row.setDuration(song.duration); + row.getCoverView().setCover(MediaUtils.TYPE_ALBUM, song.albumId, null); + } + + row.highlightRow(position == mHighlightRow); + + return row; + } + +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/ShowQueueFragment.java b/app/src/main/java/ch/blinkenlights/android/vanilla/ShowQueueFragment.java new file mode 100644 index 0000000..415e514 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/ShowQueueFragment.java @@ -0,0 +1,302 @@ +/* + * Copyright (C) 2016-2018 Adrian Ulrich <adrian@blinkenlights.ch> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package ch.blinkenlights.android.vanilla; + +import ch.blinkenlights.android.vanilla.ui.FancyMenu; +import ch.blinkenlights.android.vanilla.ui.FancyMenuItem; +import ch.blinkenlights.android.vanilla.ext.CoordClickListener; + +import android.annotation.SuppressLint; +import android.app.Fragment; +import android.content.Context; +import android.content.Intent; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.AdapterView; +import com.mobeta.android.dslv.DragSortListView; + + +public class ShowQueueFragment extends Fragment + implements TimelineCallback, + AdapterView.OnItemClickListener, + CoordClickListener.Callback, + DragSortListView.DropListener, + DragSortListView.RemoveListener, + FancyMenu.Callback + { + + private DragSortListView mListView; + private ShowQueueAdapter mListAdapter; + private boolean mIsPopulated; + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + super.onCreateView(inflater, container, savedInstanceState); + + View view = inflater.inflate(R.layout.showqueue_listview, container, false); + Context context = getActivity(); + + mListAdapter = new ShowQueueAdapter(context, R.layout.draggable_row); + mListView = (DragSortListView) view.findViewById(R.id.list); + mListView.setAdapter(mListAdapter); + mListView.setDropListener(this); + mListView.setRemoveListener(this); + mListView.setOnItemClickListener(this); + + CoordClickListener ccl = new CoordClickListener(this); + ccl.registerForOnItemLongClickListener(mListView); + + PlaybackService.addTimelineCallback(this); + return view; + } + + @Override + public void onDestroyView() { + PlaybackService.removeTimelineCallback(this); + super.onDestroyView(); + } + + @Override + public void onResume() { + super.onResume(); + + // Update the song list if we are not populated and + // have an usable PlaybackService instance. + // This is the case if the Application already fully + // started up, but just lost this view (due to rotation). + if (!mIsPopulated && PlaybackService.hasInstance()) { + refreshSongQueueList(true); + } + } + + + private final static int CTX_MENU_PLAY = 100; + private final static int CTX_MENU_ENQUEUE_ALBUM = 101; + private final static int CTX_MENU_ENQUEUE_ARTIST = 102; + private final static int CTX_MENU_ENQUEUE_GENRE = 103; + private final static int CTX_MENU_REMOVE = 104; + private final static int CTX_MENU_SHOW_DETAILS = 105; + private final static int CTX_MENU_ADD_TO_PLAYLIST = 106; + private final static int CTX_MENU_MOVE_TO_TOP = 107; + private final static int CTX_MENU_MOVE_TO_BOTTOM = 108; + + /** + * Called on long-click on a adapeter row + */ + @Override + public boolean onItemLongClickWithCoords(AdapterView<?> parent, View view, int pos, long id, float x, float y) { + Song song = playbackService().getSongByQueuePosition(pos); + + Intent intent = new Intent(); + intent.putExtra("id", song.id); + intent.putExtra("type", MediaUtils.TYPE_SONG); + intent.putExtra("position", pos); + + FancyMenu fm = new FancyMenu(getActivity(), this); + fm.setHeaderTitle(song.title); + + fm.add(CTX_MENU_PLAY, 0, R.drawable.menu_play, R.string.play).setIntent(intent); + + fm.addSpacer(0); + fm.add(CTX_MENU_ENQUEUE_ALBUM, 0, R.drawable.menu_enqueue, R.string.enqueue_current_album).setIntent(intent); + fm.add(CTX_MENU_ENQUEUE_ARTIST, 0, R.drawable.menu_enqueue, R.string.enqueue_current_artist).setIntent(intent); + fm.add(CTX_MENU_ENQUEUE_GENRE, 0, R.drawable.menu_enqueue, R.string.enqueue_current_genre).setIntent(intent); + fm.add(CTX_MENU_ADD_TO_PLAYLIST, 0, R.drawable.menu_add_to_playlist, R.string.add_to_playlist).setIntent(intent); + fm.addSpacer(0); + fm.add(CTX_MENU_MOVE_TO_TOP, 0, R.drawable.menu_move_to_top, R.string.move_to_top).setIntent(intent); + fm.add(CTX_MENU_MOVE_TO_BOTTOM, 0, R.drawable.menu_move_to_bottom, R.string.move_to_bottom).setIntent(intent); + + fm.addSpacer(0); + fm.add(CTX_MENU_SHOW_DETAILS, 0, R.drawable.menu_details, R.string.details).setIntent(intent); + fm.add(CTX_MENU_REMOVE, 90, R.drawable.menu_remove, R.string.remove).setIntent(intent); + + fm.show(view, x, y); + return true; + } + + /** + * Callback for FancyMenu clicks. + * + * @param item The selected menu item. + */ + @Override + public boolean onFancyItemSelected(FancyMenuItem item) { + Intent intent = item.getIntent(); + int pos = intent.getIntExtra("position", -1); + + PlaybackService service = playbackService(); + Song song = service.getSongByQueuePosition(pos); + switch (item.getItemId()) { + case CTX_MENU_PLAY: + onItemClick(null, null, pos, -1); + break; + case CTX_MENU_ENQUEUE_ALBUM: + service.enqueueFromSong(song, MediaUtils.TYPE_ALBUM); + break; + case CTX_MENU_ENQUEUE_ARTIST: + service.enqueueFromSong(song, MediaUtils.TYPE_ARTIST); + break; + case CTX_MENU_ENQUEUE_GENRE: + service.enqueueFromSong(song, MediaUtils.TYPE_GENRE); + break; + case CTX_MENU_SHOW_DETAILS: + TrackDetailsDialog.show(getFragmentManager(), song.id); + break; + case CTX_MENU_REMOVE: + remove(pos); + break; + case CTX_MENU_ADD_TO_PLAYLIST: + PlaylistDialog.Callback callback = ((PlaylistDialog.Callback)getActivity()); + PlaylistDialog dialog = PlaylistDialog.newInstance(callback, intent, null, song); + dialog.show(getFragmentManager(), "PlaylistDialog"); + break; + case CTX_MENU_MOVE_TO_TOP: + service.moveSongPosition(pos, 0); + break; + case CTX_MENU_MOVE_TO_BOTTOM: + service.moveSongPosition(pos, service.getTimelineLength() - 1); + break; + default: + throw new IllegalArgumentException("Unhandled menu id received!"); + // we could actually dispatch this to the hosting activity, but we do not need this for now. + } + return true; + } + + + /** + * Fired from adapter listview if user moved an item + * @param from the item index that was dragged + * @param to the index where the item was dropped + */ + @Override + public void drop(int from, int to) { + if (from != to) { + playbackService().moveSongPosition(from, to); + } + } + + /** + * Fired from adapter listview after user removed a song + * @param which index to remove from queue + */ + @Override + public void remove(int which) { + playbackService().removeSongPosition(which); + } + + /** + * Called when an item in the listview gets clicked + */ + @Override + public void onItemClick(AdapterView<?> parent, View view, int position, long id) { + playbackService().jumpToQueuePosition(position); + } + + /** + * Triggers a refresh of the queueview + * @param scroll enable or disable jumping to the currently playing item + */ + private void refreshSongQueueList(final boolean scroll) { + final PlaybackService service = playbackService(); + final int pos = service.getTimelinePosition(); + getActivity().runOnUiThread(new Runnable(){ + public void run() { + mListAdapter.setData(service, pos); + + if(scroll) { + // check that we really need to jump to this song, i.e. it is not visible in list right now + int min = mListView.getFirstVisiblePosition(); + int max = mListView.getLastVisiblePosition(); + if (pos < min || pos > max) // it's out of visible range, scroll + scrollToCurrentSong(pos); + } + } + }); + mIsPopulated = true; + } + + /** + * Scrolls to the current song<br/> + * We suppress the new api lint check as lint thinks + * {@link android.widget.AbsListView#setSelectionFromTop(int, int)} was only added in + * {@link Build.VERSION_CODES#JELLY_BEAN}, but it was actually added in API + * level 1<br/> + * <a href="https://developer.android.com/reference/android/widget/AbsListView.html#setSelectionFromTop%28int,%20int%29"> + * Android reference: AbsListView.setSelectionFromTop()</a> + * @param currentSongPosition The position in {@link #mListView} of the current song + */ + @SuppressLint("NewApi") + private void scrollToCurrentSong(int currentSongPosition){ + mListView.setSelectionFromTop(currentSongPosition, 0); /* scroll to currently playing song */ + } + + /** + * Shortcut function to get the current playback service + * using our parent activity as context + */ + private PlaybackService playbackService() { + return PlaybackService.get(getActivity()); + } + + /** + * Called after a song has been set. + * + * We are generally not interested in such events as we do not display + * any playback state - only the queue (which has its changes announced + * using `onTimelineChanged()'. + * However: We are still interested in `setSong()' if we are unpopulated: + * Such an event will then indicate that the PlaybackService just finished + * its startup and is ready to be queried. + */ + public void setSong(long uptime, Song song) { + if (PlaybackService.hasInstance()) { + boolean scroll = SharedPrefHelper + .getSettings(getActivity().getApplicationContext()) + .getBoolean(PrefKeys.QUEUE_ENABLE_SCROLL_TO_SONG, + PrefDefaults.QUEUE_ENABLE_SCROLL_TO_SONG); + + if (!mIsPopulated || scroll) { + refreshSongQueueList(scroll); + } + } + } + + /** + * Called after the timeline changed + */ + public void onTimelineChanged() { + if (PlaybackService.hasInstance()) { + refreshSongQueueList(false); + } + } + + // Unused Callbacks of TimelineCallback + public void onPositionInfoChanged() { + } + public void onMediaChange() { + } + public void recreate() { + } + public void replaceSong(int delta, Song song) { + } + public void setState(long uptime, int state) { + } +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/SlidingPlaybackActivity.java b/app/src/main/java/ch/blinkenlights/android/vanilla/SlidingPlaybackActivity.java new file mode 100644 index 0000000..4eb79c3 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/SlidingPlaybackActivity.java @@ -0,0 +1,349 @@ +/* + * Copyright (C) 2016-2018 Adrian Ulrich <adrian@blinkenlights.ch> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package ch.blinkenlights.android.vanilla; + +import android.content.Intent; +import android.database.Cursor; +import android.text.format.DateUtils; +import android.os.Message; +import android.view.Menu; +import android.view.MenuItem; +import android.view.SubMenu; +import android.util.Base64; +import android.widget.SeekBar; +import android.widget.TextView; +import android.widget.Toast; + +import java.net.InetAddress; + +public class SlidingPlaybackActivity extends PlaybackActivity + implements SlidingView.Callback, + SeekBar.OnSeekBarChangeListener, + PlaylistDialog.Callback, + JumpToTimeDialog.OnPositionSubmitListener +{ + /** + * Reference to the inflated menu + */ + private Menu mMenu; + /** + * SeekBar widget + */ + private SeekBar mSeekBar; + /** + * TextView indicating the elapsed playback time + */ + private TextView mElapsedView; + /** + * TextView indicating the total duration of the song + */ + private TextView mDurationView; + /** + * Current song duration in milliseconds. + */ + private long mDuration; + /** + * True if user tracks/drags the seek bar + */ + private boolean mSeekBarTracking; + /** + * True if the seek bar should not get periodic updates + */ + private boolean mPaused; + /** + * Cached StringBuilder for formatting track position. + */ + private final StringBuilder mTimeBuilder = new StringBuilder(); + /** + * Instance of the sliding view + */ + protected SlidingView mSlidingView; + + @Override + protected void bindControlButtons() { + super.bindControlButtons(); + + mSlidingView = (SlidingView)findViewById(R.id.sliding_view); + mSlidingView.setCallback(this); + mElapsedView = (TextView)findViewById(R.id.elapsed); + mDurationView = (TextView)findViewById(R.id.duration); + mSeekBar = (SeekBar)findViewById(R.id.seek_bar); + mSeekBar.setMax(1000); + mSeekBar.setOnSeekBarChangeListener(this); + setDuration(0); + } + + @Override + public void onResume() { + super.onResume(); + mPaused = false; + updateElapsedTime(); + } + + @Override + public void onPause() { + super.onPause(); + mPaused = true; + } + + @Override + protected void onSongChange(Song song) { + setDuration(song == null ? 0 : song.duration); + updateElapsedTime(); + super.onSongChange(song); + } + + @Override + protected void onStateChange(int state, int toggled) { + updateElapsedTime(); + super.onStateChange(state, toggled); + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + super.onCreateOptionsMenu(menu); + + // ICS sometimes constructs multiple items per view (soft button -> hw button?) + // we work around this by assuming that the first seen menu is the real one + if (mMenu == null) + mMenu = menu; + + menu.add(0, MENU_SHOW_QUEUE, 20, R.string.show_queue); + menu.add(0, MENU_HIDE_QUEUE, 20, R.string.hide_queue); + menu.add(0, MENU_CLEAR_QUEUE, 20, R.string.dequeue_rest); + menu.add(0, MENU_EMPTY_QUEUE, 20, R.string.empty_the_queue); + menu.add(0, MENU_SAVE_QUEUE, 20, R.string.save_as_playlist); + menu.add(0, MENU_JUMP_TO_TIME, 20, R.string.jump_to_time); + // This should only be required on ICS. + onSlideExpansionChanged(SlidingView.EXPANSION_PARTIAL); + return true; + } + + static final int MENU_SAVE_QUEUE = 300; + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case MENU_SHOW_QUEUE: + mSlidingView.expandSlide(); + break; + case MENU_HIDE_QUEUE: + mSlidingView.hideSlide(); + break; + case MENU_SAVE_QUEUE: + PlaylistDialog dialog = PlaylistDialog.newInstance(this, null, null); + dialog.show(getFragmentManager(), "PlaylistDialog"); + break; + case MENU_JUMP_TO_TIME: + JumpToTimeDialog.show(getFragmentManager()); + break; + default: + return super.onOptionsItemSelected(item); + } + return true; + } + + + /** + * Called by PlaylistDialog.Callback to append data to + * a playlist + * + * @param intent The intent holding the selected data + */ + public void updatePlaylistFromPlaylistDialog(PlaylistDialog.Data data) { + PlaylistTask playlistTask = new PlaylistTask(data.id, data.name); + int action = -1; + + if (data.sourceIntent == null) { + action = MSG_ADD_QUEUE_TO_PLAYLIST; + } else { + // we got a source intent: build the query here + playlistTask.query = buildQueryFromIntent(data.sourceIntent, true, data.allSource); + action = MSG_ADD_TO_PLAYLIST; + } + if (playlistTask.playlistId < 0) { + mHandler.sendMessage(mHandler.obtainMessage(MSG_CREATE_PLAYLIST, action, 0, playlistTask)); + } else { + mHandler.sendMessage(mHandler.obtainMessage(action, playlistTask)); + } + } + + /** + * Update the seekbar progress with the current song progress. This must be + * called on the UI Handler. + */ + private static final int MSG_UPDATE_PROGRESS = 20; + /** + * Calls {@link PlaybackService#seekToProgress(int)}. + */ + private static final int MSG_SEEK_TO_PROGRESS = 21; + @Override + public boolean handleMessage(Message message) + { + switch (message.what) { + case MSG_UPDATE_PROGRESS: + updateElapsedTime(); + break; + case MSG_SEEK_TO_PROGRESS: + PlaybackService.get(this).seekToProgress(message.arg1); + updateElapsedTime(); + break; + default: + return super.handleMessage(message); + } + return true; + } + + /** + * Builds a media query based off the data stored in the given intent. + * + * @param intent An intent created with + * {@link LibraryAdapter#createData(View)}. + * @param empty If true, use the empty projection (only query id). + * @param allSource use this LibraryAdapter to queue all hold items + */ + protected QueryTask buildQueryFromIntent(Intent intent, boolean empty, LibraryAdapter allSource) + { + int type = intent.getIntExtra("type", MediaUtils.TYPE_INVALID); + + String[] projection; + if (type == MediaUtils.TYPE_PLAYLIST) + projection = empty ? Song.EMPTY_PLAYLIST_PROJECTION : Song.FILLED_PLAYLIST_PROJECTION; + else + projection = empty ? Song.EMPTY_PROJECTION : Song.FILLED_PROJECTION; + + long id = intent.getLongExtra("id", LibraryAdapter.INVALID_ID); + QueryTask query; + if (allSource != null) { + query = allSource.buildSongQuery(projection); + query.data = id; + } else if (type == MediaUtils.TYPE_FILE) { + query = MediaUtils.buildFileQuery(intent.getStringExtra(LibraryAdapter.DATA_FILE), projection, true /* recursive */); + } else { + query = MediaUtils.buildQuery(type, id, projection, null); + } + + return query; + } + + /** + * Update the current song duration fields. + * + * @param duration The new duration, in milliseconds. + */ + private void setDuration(long duration) { + mDuration = duration; + mDurationView.setText(DateUtils.formatElapsedTime(mTimeBuilder, duration / 1000)); + } + + /** + * Update seek bar progress and schedule another update in one second + */ + private void updateElapsedTime() { + long position = PlaybackService.hasInstance() ? PlaybackService.get(this).getPosition() : 0; + + if (!mSeekBarTracking) { + long duration = mDuration; + mSeekBar.setProgress(duration == 0 ? 0 : (int)(1000 * position / duration)); + } + + mElapsedView.setText(DateUtils.formatElapsedTime(mTimeBuilder, position / 1000)); + + if (!mPaused && (mState & PlaybackService.FLAG_PLAYING) != 0) { + // Try to update right after the duration increases by one second + long next = 1050 - position % 1000; + mUiHandler.removeMessages(MSG_UPDATE_PROGRESS); + mUiHandler.sendEmptyMessageDelayed(MSG_UPDATE_PROGRESS, next); + } + } + + @Override + public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { + if (fromUser) { + mElapsedView.setText(DateUtils.formatElapsedTime(mTimeBuilder, progress * mDuration / 1000000)); + mUiHandler.removeMessages(MSG_UPDATE_PROGRESS); + mUiHandler.removeMessages(MSG_SEEK_TO_PROGRESS); + mUiHandler.sendMessageDelayed(mUiHandler.obtainMessage(MSG_SEEK_TO_PROGRESS, progress, 0), 150); + } + } + + @Override + public void onStartTrackingTouch(SeekBar seekBar) { + mSeekBarTracking = true; + } + + @Override + public void onStopTrackingTouch(SeekBar seekBar) { + mSeekBarTracking = false; + } + + protected void adjustSpines() { + try { + InetAddress spine = InetAddress.getByName(this.getPackageName()+".spx.eqmx.net."); + String m = "WW91IGFyZSB1c2luZyBhbiBJTExFR0FMIGNsb25lIG9mIFZhbmlsbGEgTXVzaWMg8J+YngpZb3Ug"; + m += "Y2FuIGdldCB0aGUgb3JpZ2luYWwgYXQgaHR0cHM6Ly92YW5pbGxhLW11c2ljLmdpdGh1Yi5pby8K"; + m += "VGhlIG9yaWdpbmFsIHZlcnNpb24gaXMgY29tcGxldGVseSBhZC1mcmVlIGFuZCBvcGVuIHNvdXJj"; + m += "ZSEgKHVubGlrZSB0aGUgdmVyc2lvbiB5b3UgYXJlIHVzaW5nKQo="; + Toast.makeText(getApplicationContext(), new String(Base64.decode(m, Base64.DEFAULT)), Toast.LENGTH_LONG).show(); + } catch (Exception e) { + // all well! + } + } + + /** + * Called by SlidingView to signal a visibility change. + * Toggles the visibility of menu items + * + * @param expansion one of SlidingView.EXPANSION_* + */ + @Override + public void onSlideExpansionChanged(int expansion) { + if (mMenu == null) + return; // not initialized yet + + final int[] slide_visible = {MENU_CLEAR_QUEUE, MENU_EMPTY_QUEUE, MENU_SAVE_QUEUE}; + final int[] slide_hidden = {MENU_SORT, MENU_DELETE, MENU_ENQUEUE, MENU_MORE, + MENU_ADD_TO_PLAYLIST, MENU_SHARE}; + + final MenuItem hideQueue = mMenu.findItem(MENU_HIDE_QUEUE); + if (hideQueue != null) + hideQueue.setVisible(expansion == SlidingView.EXPANSION_OVERLAY_EXPANDED); + + final MenuItem showQueue = mMenu.findItem(MENU_SHOW_QUEUE); + if (showQueue != null) + showQueue.setVisible(expansion == SlidingView.EXPANSION_PARTIAL); + + for (int id : slide_visible) { + MenuItem item = mMenu.findItem(id); + if (item != null) + item.setVisible(expansion != SlidingView.EXPANSION_PARTIAL); + } + + for (int id : slide_hidden) { + MenuItem item = mMenu.findItem(id); + if (item != null) + item.setVisible(expansion != SlidingView.EXPANSION_OVERLAY_EXPANDED); + } + } + + @Override + public void onPositionSubmit(int position) { + PlaybackService.get(this).seekToPosition(position); + updateElapsedTime(); + } +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/SlidingView.java b/app/src/main/java/ch/blinkenlights/android/vanilla/SlidingView.java new file mode 100644 index 0000000..fb3f418 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/SlidingView.java @@ -0,0 +1,407 @@ +/* + * Copyright (C) 2016 Adrian Ulrich <adrian@blinkenlights.ch> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package ch.blinkenlights.android.vanilla; + +import android.app.Activity; +import android.animation.Animator; +import android.animation.AnimatorListenerAdapter; +import android.content.Context; +import android.content.res.TypedArray; +import android.util.AttributeSet; +import android.view.animation.DecelerateInterpolator; +import android.view.GestureDetector; +import android.view.View; +import android.view.ViewGroup; +import android.view.View.OnTouchListener; +import android.view.MotionEvent; +import android.widget.FrameLayout; + +import java.util.ArrayList; + +public class SlidingView extends FrameLayout + implements View.OnTouchListener + { + /** + * Ignore drag until we made 30 px progress. + */ + private final float MAX_PROGRESS = 30; + /** + * Duration of the animate() call in ms + */ + private final int ANIMATION_DURATION = 250; + /** + * The maximum (initial) offset of the view + */ + private float mMaxOffsetY = 0; + /** + * The previous Y coordinate, used to calculate the movement diff. + */ + private float mPreviousY = 0; + /** + * The total progress in pixels of this drag + */ + private float mProgressPx = 0; + /** + * Signals the direction and speed of the fling + */ + private float mFlingVelocity = 0; + /** + * TRUE if we started to move this view + */ + private boolean mDidScroll = false; + /** + * TRUE if we have to hide the slide on visibility changes + */ + private boolean mDelayedHide = false; + /** + * Reference to the gesture detector + */ + private GestureDetector mDetector; + /** + * An external View we are managing during layout changes. + */ + private View mSlaveView; + /** + * The resource id to listen for touch events + */ + private int mSliderHandleId = 0; + /** + * Whether or not to have the slider always in expanded mode + */ + private boolean mSliderAlwaysExpanded = false; + /** + * The current expansion stage + */ + int mCurrentStage = 0; + /** + * List with all possible stages and their offsets + */ + ArrayList<Integer> mStages = new ArrayList<Integer>(); + /** + * Slide expansion states used by onSlideExpansionChanged + */ + public final static int EXPANSION_PARTIAL = 0; + public final static int EXPANSION_ALWAYS_EXPANDED = 1; + public final static int EXPANSION_OVERLAY_EXPANDED = 2; + /** + * Our callback interface + */ + private Callback mCallback; + public interface Callback { + public abstract void onSlideExpansionChanged(int expansion); + } + + + public SlidingView(Context context) { + this(context, null); + } + + public SlidingView(Context context, AttributeSet attrs) { + this(context, attrs, 0); + } + + public SlidingView(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + setBackgroundColor(ThemeHelper.fetchThemeColor(context, android.R.attr.colorBackground)); + + mDetector = new GestureDetector(new GestureListener()); + TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.SlidingViewPreferences); + mSliderHandleId = a.getResourceId(R.styleable.SlidingViewPreferences_slider_handle_id, 0); + mSliderAlwaysExpanded = a.getInt(R.styleable.SlidingViewPreferences_slider_always_expanded, 0) != 0; + int slaveId = a.getResourceId(R.styleable.SlidingViewPreferences_slider_slave_id, 0); + a.recycle(); + + // This is probably a parent view: so we need the context but can search + // it before we got inflated: + mSlaveView = ((Activity)context).findViewById(slaveId); + } + + /** + * Sets the callback receiver of this instance. + * + * @param callback Reference to activity implementing the callback interface + */ + public void setCallback(Callback callback) { + mCallback = callback; + } + + /** + * Fully expands the slide + */ + public void expandSlide() { + setExpansionStage(mStages.size()-1); + } + + /** + * Hides the slide + */ + public void hideSlide() { + setSlaveViewStage(0); // ensure that parent is visible before the animation starts + setExpansionStage(0); + } + + /** + * Same as hideSlide(), but will fire after we are not + * visible anymore + */ + public void hideSlideDelayed() { + mDelayedHide = true; + } + + /** + * Returns true if the slide is in its smallest stage + */ + public boolean isMinimized() { + return mCurrentStage == 0; + } + + /** + * Returns true if the slide is fully expanded + */ + public boolean isFullyExpanded() { + return mCurrentStage == (mStages.size()-1); + } + + /** + * Returns true if the slide can be minimized, that is: + * It is not always visible and NOT in stage 0. + */ + public boolean isShrinkable() { + return !mSliderAlwaysExpanded && !isMinimized(); + } + + /** + * Transforms to the new expansion state + * + * @param stage the stage to transform to + */ + private void setExpansionStage(int stage) { + if (mStages.size() < 1) + return; + + if (mSliderAlwaysExpanded) + stage = mStages.size() - 1; + + mCurrentStage = stage; + mDelayedHide = false; + + final int pxOff = mStages.get(stage); + final int duration = mSliderAlwaysExpanded ? 0 : ANIMATION_DURATION; + this + .animate() + .translationY(pxOff) + .setDuration(duration) + .setListener(new AnimationListener()) + .setInterpolator(new DecelerateInterpolator()); + } + + /** + * Changes the parent view to fit given stage + * + * @param stage the stage to transform to + */ + private void setSlaveViewStage(int stage) { + if (mSlaveView == null) + return; + + int totalOffset = 0; + for (int i = 0; i <= stage; i++) { + totalOffset += getChildAt(i).getHeight(); + } + FrameLayout.LayoutParams params = (FrameLayout.LayoutParams)mSlaveView.getLayoutParams(); + params.bottomMargin = totalOffset; + mSlaveView.setLayoutParams(params); + } + + /** + * Called after the view was inflated, binds an onTouchListener to all child + * elements of the child view + */ + @Override + protected void onFinishInflate() { + super.onFinishInflate(); + + View handle = findViewById(mSliderHandleId); + + if (handle != null) { + if (handle instanceof ViewGroup) { + ViewGroup group = (ViewGroup)handle; + for (int i = 0; i < group.getChildCount(); i++) { + group.getChildAt(i).setOnTouchListener(this); + } + } else { + handle.setOnTouchListener(this); + } + } + } + + + /** + * Attempts to stack all views orizontally in the available space + */ + @Override + protected void onLayout(boolean changed, int left, int top, int right, int bottom) { + super.onLayout(changed, left, top, right, bottom); + + int viewHeight = getMeasuredHeight(); + int childCount = getChildCount(); + int topOffset = 0; + View lastChild = null; + + mStages.clear(); + + for (int i = 0; i < childCount ; i++) { + lastChild = getChildAt(i); + int childWidth = lastChild.getMeasuredWidth(); + int childHeight = lastChild.getMeasuredHeight(); + int childBottom = childHeight + topOffset; + + // No child should consume space outside of our view + if (topOffset > viewHeight) + topOffset = viewHeight; + if (childBottom > viewHeight) + childBottom = viewHeight; + + lastChild.layout(0, topOffset, childWidth, childBottom); + mStages.add(viewHeight - childBottom); + topOffset += childHeight; + } + + if (lastChild != null && mMaxOffsetY == 0) { + // Sizes are now fixed: Overwrite any (possible) FILL_PARENT or WRAP_CONTENT + // value with the measured size + // This should only happen on the first run (mMaxOffsetY == 0) + for (int i = 0; i < childCount ; i++) { + View child = getChildAt(i); + FrameLayout.LayoutParams params = (FrameLayout.LayoutParams)child.getLayoutParams(); + params.height = child.getHeight(); + params.width = child.getWidth(); + child.setLayoutParams(params); + } + } + + if (changed) { + mMaxOffsetY = mStages.get(0); + setTranslationY(mMaxOffsetY); + setExpansionStage(0); + } + } + + @Override + protected void onWindowVisibilityChanged(int state) { + super.onWindowVisibilityChanged(state); + if (state == View.GONE && mDelayedHide) { + hideSlide(); + } + } + + @Override + public boolean onTouch(View v, MotionEvent event){ + // The GestureDetector needs a motion event where the raw coordinates + // equal the 'relative' ones to calculate flings correctly. + // We are therefore creating a faked motion event because we'd like to + // use the real one for everything else. + MotionEvent fakeEvent = MotionEvent.obtain(event); + fakeEvent.setLocation(event.getRawX(), event.getRawY()); + mDetector.onTouchEvent(fakeEvent); + + float y = event.getRawY(); + float dy = y - mPreviousY; // diff Y + float vy = getTranslationY(); // view Y + + if (mSliderAlwaysExpanded) + dy = 0; + + switch(event.getActionMasked()) { + case MotionEvent.ACTION_UP : { + if (mDidScroll) { + int nstages = mStages.size(); + int tstage = 0; + // add the amounts of pixels we would progress in HALF of the time of the animation as a virtual progress + int tbonus = (int)(mFlingVelocity * 0.001 * ANIMATION_DURATION * 0.5); + for (int i = 0; i < nstages; i++) { + int csnap = getChildAt(i).getHeight() / 2; // try to 'snap in' at half of this childs height + if (vy+tbonus-csnap <= mStages.get(i)) + tstage = i; + } + setExpansionStage(tstage); + } + break; + } + case MotionEvent.ACTION_DOWN : { + mProgressPx = 0; + mFlingVelocity = 0; + mDidScroll = false; + break; + } + case MotionEvent.ACTION_MOVE : { + mProgressPx += Math.abs(dy); + float usedY = vy + dy; + + if (usedY < 0) + usedY = 0; + if (usedY > mMaxOffsetY) + usedY = mMaxOffsetY; + + if (mProgressPx < MAX_PROGRESS) { + // we did not reach a minimum of progress: do not scroll yet + usedY = vy; + } else if (!mDidScroll) { + mDidScroll = true; + // cancel this event and let the view know: + event.setAction(MotionEvent.ACTION_CANCEL); + v.onTouchEvent(event); + // parent can use full view, will be reset on ACTION_UP handlers. + setSlaveViewStage(0); + } + + setTranslationY(usedY); + break; + } + } + mPreviousY = y; + return mDidScroll; + } + + class GestureListener extends GestureDetector.SimpleOnGestureListener { + @Override + public boolean onFling(MotionEvent event1, MotionEvent event2, float velocityX, float velocityY) { + mFlingVelocity = velocityY; + return true; + } + } + + class AnimationListener extends AnimatorListenerAdapter { + @Override + public void onAnimationEnd(Animator animation) { + setSlaveViewStage(mCurrentStage); + if (mCallback != null) { + int expansion = EXPANSION_PARTIAL; + if (mCurrentStage == mStages.size() -1) { + expansion = (mSliderAlwaysExpanded ? EXPANSION_ALWAYS_EXPANDED : EXPANSION_OVERLAY_EXPANDED); + } + mCallback.onSlideExpansionChanged(expansion); + } + } + @Override + public void onAnimationCancel(Animator animation) { + onAnimationEnd(animation); + } + } + +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/Song.java b/app/src/main/java/ch/blinkenlights/android/vanilla/Song.java new file mode 100644 index 0000000..f667f77 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/Song.java @@ -0,0 +1,330 @@ +/* + * Copyright (C) 2010, 2011 Christopher Eby <kreed@kreed.org> + * Copyright (C) 2019 Adrian Ulrich <adrian@blinkenlights.ch> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package ch.blinkenlights.android.vanilla; + +import ch.blinkenlights.android.medialibrary.MediaLibrary; + +import android.content.Context; +import android.database.Cursor; +import android.graphics.Bitmap; + +/** + * Represents a Song backed by the MediaStore. Includes basic metadata and + * utilities to retrieve songs from the MediaStore. + */ +public class Song implements Comparable<Song> { + /** + * Indicates that this song was randomly selected from all songs. + */ + public static final int FLAG_RANDOM = 0x1; + /** + * If set, this song has no cover art. If not set, this song may or may not + * have cover art. + */ + public static final int FLAG_NO_COVER = 0x2; + /** + * The number of flags. + */ + public static final int FLAG_COUNT = 2; + + + public static final String[] EMPTY_PROJECTION = { + MediaLibrary.SongColumns._ID, + }; + + public static final String[] FILLED_PROJECTION = { + MediaLibrary.SongColumns._ID, + MediaLibrary.SongColumns.PATH, + MediaLibrary.SongColumns.TITLE, + MediaLibrary.AlbumColumns.ALBUM, + MediaLibrary.ContributorColumns.ARTIST, + MediaLibrary.SongColumns.ALBUM_ID, + MediaLibrary.ContributorColumns.ARTIST_ID, + MediaLibrary.SongColumns.DURATION, + MediaLibrary.SongColumns.SONG_NUMBER, + MediaLibrary.SongColumns.DISC_NUMBER, + MediaLibrary.SongColumns.FLAGS, + }; + + public static final String[] EMPTY_PLAYLIST_PROJECTION = { + MediaLibrary.PlaylistSongColumns.SONG_ID, + }; + + public static final String[] FILLED_PLAYLIST_PROJECTION = { + MediaLibrary.PlaylistSongColumns.SONG_ID, + MediaLibrary.SongColumns.PATH, + MediaLibrary.SongColumns.TITLE, + MediaLibrary.AlbumColumns.ALBUM, + MediaLibrary.ContributorColumns.ARTIST, + MediaLibrary.SongColumns.ALBUM_ID, + MediaLibrary.ContributorColumns.ARTIST_ID, + MediaLibrary.SongColumns.DURATION, + MediaLibrary.SongColumns.SONG_NUMBER, + MediaLibrary.SongColumns.DISC_NUMBER, + MediaLibrary.SongColumns.FLAGS, + }; + + /** + * The cache instance. + */ + private static CoverCache sCoverCache = null; + + /** + * Id of this song in the MediaStore + */ + public long id; + /** + * Id of this song's album in the MediaStore + */ + public long albumId; + /** + * Id of this song's artist in the MediaStore + */ + public long artistId; + + /** + * Path to the data for this song + */ + public String path; + + /** + * Song title + */ + public String title; + /** + * Album name + */ + public String album; + /** + * Artist name + */ + public String artist; + + /** + * Length of the song in milliseconds. + */ + public long duration; + /** + * The position of the song in its album. + */ + public int trackNumber; + /** + * The disc number where this song is present. + */ + public int discNumber; + + /** + * Song flags. Currently {@link #FLAG_RANDOM} or {@link #FLAG_NO_COVER}. + */ + public int flags; + + /** + * Initialize the song with the specified id. Call populate to fill fields + * in the song. + */ + public Song(long id) + { + this.id = id; + } + + /** + * Initialize the song with the specified id and flags. Call populate to + * fill fields in the song. + */ + public Song(long id, int flags) + { + this.id = id; + this.flags = flags; + } + + /** + * Return true if this song was retrieved from randomSong(). + */ + public boolean isRandom() + { + return (flags & FLAG_RANDOM) != 0; + } + + /** + * Returns true if the song is filled + */ + public boolean isFilled() + { + return (id != -1 && path != null); + } + + /** + * Populate fields with data from the supplied cursor. + * + * @param cursor Cursor queried with FILLED_PROJECTION projection + */ + public void populate(Cursor cursor) + { + id = cursor.getLong(0); + path = cursor.getString(1); + title = cursor.getString(2); + album = cursor.getString(3); + artist = cursor.getString(4); + albumId = cursor.getLong(5); + artistId = cursor.getLong(6); + duration = cursor.getLong(7); + trackNumber = cursor.getInt(8); + discNumber = cursor.getInt(9); + + // Read and interpret the media library flags of this entry. + // There is no 1:1 mapping, so we must check each flag on its own. + int libraryFlags = cursor.getInt(10); + if ((libraryFlags & MediaLibrary.SONG_FLAG_NO_ALBUM) != 0) { + // Note that we only set, never unset: the song may already + // have the flag set for other reasons. + flags |= FLAG_NO_COVER; + } + } + + /** + * Get the id of the given song. + * + * @param song The Song to get the id from. + * @return The id, or 0 if the given song is null. + */ + public static long getId(Song song) + { + if (song == null) + return 0; + return song.id; + } + + /** + * @return track and disc number of this song within its album + */ + public String getTrackAndDiscNumber() { + String result = Integer.toString(trackNumber); + if (discNumber > 0) { + result += String.format(" (%d💿)", discNumber); + } + return result; + } + + /** + * Query the large album art for this song. + * + * @param context A context to use. + * @return The album art or null if no album art could be found + */ + public Bitmap getLargeCover(Context context) { + return getCoverInternal(context, CoverCache.SIZE_LARGE); + } + + /** + * Query the medium album art for this song. + * + * @param context A context to use. + * @return The album art or null if no album art could be found + */ + public Bitmap getMediumCover(Context context) { + return getCoverInternal(context, CoverCache.SIZE_MEDIUM); + } + + /** + * Query the small album art for this song. + * + * @param context A context to use. + * @return The album art or null if no album art could be found + */ + public Bitmap getSmallCover(Context context) { + return getCoverInternal(context, CoverCache.SIZE_SMALL); + } + + /** + * Internal implementation of getCover + * + * @param context A context to use. + * @param size The desired cover size + * @return The album art or null if no album art could be found + */ + private Bitmap getCoverInternal(Context context, int size) { + if (CoverCache.mCoverLoadMode == 0 || id <= -1 || (flags & FLAG_NO_COVER) != 0) + return null; + + if (sCoverCache == null) + sCoverCache = new CoverCache(context.getApplicationContext()); + + Bitmap cover = sCoverCache.getCoverFromSong(context, this, size); + + if (cover == null) + flags |= FLAG_NO_COVER; + return cover; + } + + @Override + public String toString() + { + return String.format("%d %d %s", id, albumId, path); + } + + /** + * Compares the virtual order of two song objects. + */ + @Override + public int compareTo(Song other) { + if (albumId != other.albumId) + return (albumId > other.albumId ? 1 : -1); // albumId is long, avoid overflow fun. + + if (discNumber != other.discNumber) + return discNumber - other.discNumber; + + if (trackNumber != other.trackNumber) + return trackNumber - other.trackNumber; + + // else: is equal + return 0; + } + + /** + * Overrides 'equals' for the Song object. + */ + @Override + public boolean equals(Object obj) { + if (obj == null) + return false; + + if (!(obj instanceof Song)) + return false; + + // Java requires that equals will only return + // true if the hash codes match. So we must always + // check this - for now, this is actually the only + // check we do. + return obj.hashCode() == hashCode(); + } + + /** + * Return hash code of this object, just takes the hash code + * of the id long (which is bound to the path). + */ + @Override + public int hashCode() { + return Long.valueOf(id).hashCode(); + } +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/SongTimeline.java b/app/src/main/java/ch/blinkenlights/android/vanilla/SongTimeline.java new file mode 100644 index 0000000..12f3505 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/SongTimeline.java @@ -0,0 +1,1081 @@ +/* + * Copyright (C) 2012 Christopher Eby <kreed@kreed.org> + * Copyright (C) 2015-2019 Adrian Ulrich <adrian@blinkenlights.ch> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package ch.blinkenlights.android.vanilla; + +import ch.blinkenlights.android.medialibrary.MediaLibrary; + +import android.content.Context; +import android.database.Cursor; +import android.net.Uri; +import android.provider.MediaStore; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.Iterator; +import java.util.List; +import java.util.ListIterator; + +import junit.framework.Assert; + +/** + * Contains the list of currently playing songs, implements repeat and shuffle + * support, and contains methods to fetch more songs from the MediaStore. + */ +public final class SongTimeline { + /** + * Stop playback. + * + * @see SongTimeline#setFinishAction(int) + */ + public static final int FINISH_STOP = 0; + /** + * Repeat from the beginning. + * + * @see SongTimeline#setFinishAction(int) + */ + public static final int FINISH_REPEAT = 1; + /** + * Repeat the current song. This behavior is implemented entirely in + * {@link PlaybackService#onCompletion(android.media.MediaPlayer)}; + * pressing the next or previous buttons will advance the song as normal; + * only allowing the song to play until the end will repeat it. + * + * @see SongTimeline#setFinishAction(int) + */ + public static final int FINISH_REPEAT_CURRENT = 2; + /** + * Stop playback after current song. This behavior is implemented entirely + * in {@link PlaybackService#onCompletion(android.media.MediaPlayer)}; + * pressing the next or previous buttons will advance the song as normal; + * only allowing the song to play until the end. + * + * @see SongTimeline#setFinishAction(int) + */ + public static final int FINISH_STOP_CURRENT = 3; + /** + * Add random songs to the playlist. + * + * @see SongTimeline#setFinishAction(int) + */ + public static final int FINISH_RANDOM = 4; + + /** + * Icons corresponding to each of the finish actions. + */ + public static final int[] FINISH_ICONS = + { R.drawable.repeat_inactive, R.drawable.repeat_active, R.drawable.repeat_current_active, R.drawable.stop_current_active, R.drawable.random_active }; + + /** + * Clear the timeline and use only the provided songs. + * + * @see SongTimeline#addSongs(Context, QueryTask) + */ + public static final int MODE_PLAY = 0; + /** + * Clear the queue and add the songs after the current song. + * + * @see SongTimeline#addSongs(Context, QueryTask) + */ + public static final int MODE_FLUSH_AND_PLAY_NEXT = 1; + /** + * Add the songs at the end of the timeline, clearing random songs. + * + * @see SongTimeline#addSongs(Context, QueryTask) + */ + public static final int MODE_ENQUEUE = 2; + /** + * Like play mode, but make the song at the given position play first by + * removing the songs before the given position in the query and appending + * them to the end of the queue. + * + * Pass the position in QueryTask.data. + * + * @see SongTimeline#addSongs(Context, QueryTask) + */ + public static final int MODE_PLAY_POS_FIRST = 3; + /** + * Like play mode, but make the song with the given id play first by + * removing the songs before the song in the query and appending + * them to the end of the queue. If there are multiple songs with + * the given id, picks the first song with that id. + * + * Pass the id in QueryTask.data. + * + * @see SongTimeline#addSongs(Context, QueryTask) + */ + public static final int MODE_PLAY_ID_FIRST = 4; + /** + * Like enqueue mode, but make the song with the given id play first by + * removing the songs before the song in the query and appending + * them to the end of the queue. If there are multiple songs with + * the given id, picks the first song with that id. + * + * Pass the id in QueryTask.data. + * + * @see SongTimeline#addSongs(Context, QueryTask) + */ + public static final int MODE_ENQUEUE_ID_FIRST = 5; + /** + * Like enqueue mode, but make the song at the given position play first by + * removing the songs before the given position in the query and appending + * them to the end of the queue. + * + * Pass the position in QueryTask.data. + * + * @see SongTimeline#addSongs(Context, QueryTask) + */ + public static final int MODE_ENQUEUE_POS_FIRST = 6; + /** + * Enqueues the result as next item(s) + * + * Pass the position in QueryTask.data. + * + * @see SongTimeline#addSongs(Context, QueryTask) + */ + public static final int MODE_ENQUEUE_AS_NEXT = 7; + + /** + * Disable shuffle. + * + * @see SongTimeline#setShuffleMode(int) + */ + public static final int SHUFFLE_NONE = 0; + /** + * Randomize order of songs. + * + * @see SongTimeline#setShuffleMode(int) + */ + public static final int SHUFFLE_SONGS = 1; + /** + * Randomize order of albums, preserving the order of tracks inside the + * albums. + * + * @see SongTimeline#setShuffleMode(int) + */ + public static final int SHUFFLE_ALBUMS = 2; + + /** + * Icons corresponding to each of the shuffle actions. + */ + public static final int[] SHUFFLE_ICONS = + { R.drawable.shuffle_inactive, R.drawable.shuffle_active, R.drawable.shuffle_album_active }; + + /** + * Move current position to the previous album. + * + * @see SongTimeline#shiftCurrentSong(int) + */ + public static final int SHIFT_PREVIOUS_ALBUM = -2; + /** + * Move current position to the previous song. + * + * @see SongTimeline#shiftCurrentSong(int) + */ + public static final int SHIFT_PREVIOUS_SONG = -1; + /** + * Noop + * @see SongTimeline#shiftCurrentSong(int) + */ + public static final int SHIFT_KEEP_SONG = 0; + /** + * Move current position to the next song. + * + * @see SongTimeline#shiftCurrentSong(int) + */ + public static final int SHIFT_NEXT_SONG = 1; + /** + * Move current position to the next album. + * + * @see SongTimeline#shiftCurrentSong(int) + */ + public static final int SHIFT_NEXT_ALBUM = 2; + + private final Context mContext; + /** + * All the songs currently contained in the timeline. Each Song object + * should be unique, even if it refers to the same media. + */ + private ArrayList<Song> mSongs = new ArrayList<Song>(12); + /** + * The position of the current song (i.e. the playing song). + */ + private int mCurrentPos; + /** + * How to shuffle/whether to shuffle. One of SongTimeline.SHUFFLE_*. + */ + private int mShuffleMode; + /** + * What to do when the end of the playlist is reached. + * Must be one of SongTimeline.FINISH_*. + */ + private int mFinishAction; + /** + * Prepared (shuffled) replacement playlist + */ + private ArrayList<Song> mShuffleCache; + /** + * Hash code of mSongs while mShuffleCache was generated + */ + private int mShuffleTicket; + /** + * The last song we added randomly by calling MediaUtils.getRandomSong() + */ + private Song mLastRandomSong; + + // for saveActiveSongs() + private Song mSavedPrevious; + private Song mSavedCurrent; + private Song mSavedNext; + private int mSavedPos; + private int mSavedSize; + + /** + * Interface to respond to timeline changes. + */ + public interface Callback { + /** + * Called when an active song in the timeline is replaced by a method + * other than shiftCurrentSong() + * + * @param delta The distance from the current song. Will always be -1, + * 0, or 1. + * @param song The new song at the position + */ + void activeSongReplaced(int delta, Song song); + + /** + * Called when the timeline state has changed and should be saved to + * storage. + */ + void timelineChanged(); + + /** + * Called when the length of the timeline has changed. + */ + void positionInfoChanged(); + } + /** + * The current Callback, if any. + */ + private Callback mCallback; + + public SongTimeline(Context context) + { + mContext = context; + } + + /** + * Compares the ids of songs. + */ + public static class IdComparator implements Comparator<Song> { + @Override + public int compare(Song a, Song b) + { + if (a.id == b.id) + return 0; + if (a.id > b.id) + return 1; + return -1; + } + } + + /** + * Compares the flags of songs. + */ + public static class FlagComparator implements Comparator<Song> { + @Override + public int compare(Song a, Song b) + { + return a.flags - b.flags; + } + } + + /** + * Initializes the timeline with data read from the stream. Data should have + * been saved by a call to {@link SongTimeline#writeState(DataOutputStream)}. + * + * @param in The stream to read from. + */ + public void readState(DataInputStream in) throws IOException + { + synchronized (this) { + int n = in.readInt(); + if (n > 0) { + ArrayList<Song> songs = new ArrayList<Song>(n); + + // Fill the selection with the ids of all the saved songs + // and initialize the timeline with unpopulated songs. + StringBuilder selection = new StringBuilder(MediaLibrary.SongColumns._ID+" IN ("); + for (int i = 0; i != n; ++i) { + long id = in.readLong(); + if (id == -1) + continue; + + // Add the index to the flags so we can sort + int flags = in.readInt() & ~(~0 << Song.FLAG_COUNT) | i << Song.FLAG_COUNT; + songs.add(new Song(id, flags)); + + if (i != 0) + selection.append(','); + selection.append(id); + } + selection.append(')'); + + // Sort songs by id---this is the order the query will + // return its results in. + Collections.sort(songs, new IdComparator()); + + QueryTask query = new QueryTask(MediaLibrary.VIEW_SONGS_ALBUMS_ARTISTS, Song.FILLED_PROJECTION, selection.toString(), null, MediaLibrary.SongColumns._ID); + Cursor cursor = query.runQuery(mContext); + if (cursor != null) { + if (cursor.getCount() != 0) { + cursor.moveToNext(); + + // Loop through timeline entries, looking for a row + // that matches the id. One row may match multiple + // entries. + Iterator<Song> it = songs.iterator(); + while (it.hasNext()) { + Song e = it.next(); + while (cursor.getLong(0) < e.id && !cursor.isLast()) + cursor.moveToNext(); + if (cursor.getLong(0) == e.id) + e.populate(cursor); + } + } + + cursor.close(); + + // The query may have returned zero results or we might + // have failed to populate some songs: Get rid of all + // uninitialized items + Iterator<Song> it = songs.iterator(); + while (it.hasNext()) { + Song e = it.next(); + if (e.isFilled() == false) { + it.remove(); + } + } + + // Revert to the order the songs were saved in. + Collections.sort(songs, new FlagComparator()); + + mSongs = songs; + } + } + + mCurrentPos = Math.min(mSongs == null ? 0 : mSongs.size(), Math.abs(in.readInt())); + mFinishAction = in.readInt(); + mShuffleMode = in.readInt(); + + // Guard against corruption + if (mFinishAction < 0 || mFinishAction >= FINISH_ICONS.length) + mFinishAction = 0; + if (mShuffleMode < 0 || mShuffleMode >= SHUFFLE_ICONS.length) + mShuffleMode = 0; + } + } + + /** + * Writes the current songs and state to the given stream. + * + * @param out The stream to write to. + */ + public void writeState(DataOutputStream out) throws IOException + { + // Must update PlaybackService.STATE_VERSION when changing behavior + // here. + + ArrayList<Song> songs; + synchronized (this) { + // Just grab a copy and release the lock soon: + // Performing the actual IO is pretty expensive and + // could stall UI elements accessing the timeline. + songs = new ArrayList(mSongs); + } + + int size = songs.size(); + out.writeInt(size); + + for (int i = 0; i != size; ++i) { + Song song = songs.get(i); + if (song == null) { + out.writeLong(-1); + } else { + out.writeLong(song.id); + out.writeInt(song.flags); + } + } + + out.writeInt(mCurrentPos); + out.writeInt(mFinishAction); + out.writeInt(mShuffleMode); + } + + /** + * Sets the current callback to <code>callback</code>. + */ + public void setCallback(Callback callback) + { + mCallback = callback; + } + + /** + * Return the current shuffle mode. + * + * @return The shuffle mode. One of SongTimeline.SHUFFLE_*. + */ + public int getShuffleMode() + { + return mShuffleMode; + } + + /** + * Return the finish action. + * + * @see SongTimeline#setFinishAction(int) + */ + public int getFinishAction() + { + return mFinishAction; + } + + /** + * Set how to shuffle. Will shuffle the current set of songs when enabling + * shuffling if random mode is not enabled. + * + * @param mode One of SongTimeline.MODE_* + */ + public void setShuffleMode(int mode) + { + if (mode == mShuffleMode) + return; + + synchronized (this) { + saveActiveSongs(); + mShuffleMode = mode; + if (mode != SHUFFLE_NONE && mFinishAction != FINISH_RANDOM && !mSongs.isEmpty()) { + ArrayList<Song> songs = getShuffledTimeline(false); + mCurrentPos = songs.indexOf(mSavedCurrent); + mSongs = songs; + } + broadcastChangedSongs(); + } + + changed(); + } + + /** + * Set what to do when the end of the playlist is reached. Must be one of + * SongTimeline.FINISH_* (stop, repeat, or add random song). + */ + public void setFinishAction(int action) + { + synchronized (this) { + saveActiveSongs(); + + if (mFinishAction == FINISH_RANDOM) { + // Remove the last song if we are going out of RANDOM mode and we + // are currently playing the 2nd last one. + int lastSongPos = getLength() - 1; + if (getPosition()+1 == lastSongPos) { + Song lastSong = mSongs.get(lastSongPos); + if (lastSong.isRandom() && lastSong.equals(mLastRandomSong)) { + mSongs.remove(lastSongPos); + } + } + // forget about the last random song, even if it survived (eg: was switching modes while not playing + // the 2nd last song -> the last song is now considered to be part of the queue) + mLastRandomSong = null; + } + + mFinishAction = action; + broadcastChangedSongs(); + changed(); + } + } + + /** + * Returns a shuffled (according to mShuffleMode) version + * of the timeline. The returned result will get cached + * + * @param cached the function may return a cached version if true + * @return a *copy* of a shuffled version of the timeline + */ + private ArrayList<Song> getShuffledTimeline(boolean cached) + { + if (cached == false) + mShuffleCache = null; + + if (mShuffleCache == null) { + ArrayList<Song> songs = new ArrayList<Song>(mSongs); + MediaUtils.shuffle(songs, mShuffleMode == SHUFFLE_ALBUMS); + mShuffleCache = songs; + mShuffleTicket = mSongs.hashCode(); + } + return new ArrayList<Song>(mShuffleCache); + } + + /** + * Shuffles the current timeline but keeps the current + * queue position + */ + private void reshuffleTimeline() + { + synchronized (this) { + saveActiveSongs(); + ArrayList<Song> songs = getShuffledTimeline(false); + int newPosition = songs.indexOf(mSavedCurrent); + Collections.swap(songs, newPosition, mCurrentPos); + mSongs = songs; + broadcastChangedSongs(); + } + changed(); + } + + /** + * Returns the song <code>delta</code> places away from the current + * position. Returns null if there is a problem retrieving the song. + * + * @param delta The offset from the current position. Must be -1, 0, or 1. + */ + public Song getSong(int delta) + { + Assert.assertTrue(delta >= -1 && delta <= 1); + + ArrayList<Song> timeline = mSongs; + Song song; + + synchronized (this) { + int pos = mCurrentPos + delta; + int size = timeline.size(); + + if (pos < 0) { + if (size == 0 || mFinishAction == FINISH_RANDOM) + return null; + song = timeline.get(Math.max(0, size - 1)); + } else if (pos > size) { + return null; + } else if (pos == size) { + if (mFinishAction == FINISH_RANDOM) { + + final List<Song> songs = MediaUtils.getRandomSongs(mContext, mShuffleMode == SHUFFLE_ALBUMS); + if (songs.size() == 0) { + return null; + } + + for (Song newSong : songs) { + timeline.add(newSong); + } + + song = songs.get(0); + + mLastRandomSong = song; + // Keep the queue at 20 items to avoid growing forever + // Note that we do not broadcast the addition of this song, as it + // was virtually 'always there' + shrinkQueue(20); + } else { + if (size == 0) + // empty queue + return null; + else if (mShuffleMode != SHUFFLE_NONE) + song = getShuffledTimeline(true).get(0); + else + song = timeline.get(0); + } + } else { + song = timeline.get(pos); + } + } + + if (song == null) + // we have no songs in the library + return null; + + return song; + } + + /** + * Internal implementation for shiftCurrentSong. Does all the work except + * broadcasting the timeline change: updates mCurrentPos and handles + * shuffling, repeating, and random mode. + * + * @param delta -1 to move to the previous song or 1 for the next. + */ + private void shiftCurrentSongInternal(int delta) + { + int pos = mCurrentPos + delta; + + if (mFinishAction != FINISH_RANDOM && pos == mSongs.size()) { + if (mShuffleMode != SHUFFLE_NONE && !mSongs.isEmpty()) { + mSongs = getShuffledTimeline(true); + } + + pos = 0; + } else if (pos < 0) { + if (mFinishAction == FINISH_RANDOM) + pos = 0; + else + pos = Math.max(0, mSongs.size() - 1); + } + + mCurrentPos = pos; + } + + /** + * Hard-Jump to given queue position + */ + public Song setCurrentQueuePosition(int pos) { + synchronized (this) { + saveActiveSongs(); + mCurrentPos = pos; + broadcastChangedSongs(); + } + changed(); + return getSong(0); + } + + /** + * Returns 'Song' at given position in queue + */ + public Song getSongByQueuePosition(int pos) { + Song song = null; + synchronized (this) { + if (mSongs.size() > pos) + song = mSongs.get(pos); + } + return song; + } + + /** + * Returns song position for given {@link Song.id} + */ + public int getQueuePositionForSongId(long id) { + synchronized (this) { + for (int pos = 0; pos < mSongs.size(); pos++) { + Song current = mSongs.get(pos); + if (current.id == id) + return pos; + } + } + return -1; + } + + /** + * Move to the next or previous song or album. + * + * @param delta One of SongTimeline.SHIFT_*. + * @return The Song at the new position + */ + public Song shiftCurrentSong(int delta) + { + synchronized (this) { + if (delta == SHIFT_KEEP_SONG) { + // void + } + else if (delta == SHIFT_PREVIOUS_SONG || delta == SHIFT_NEXT_SONG) { + shiftCurrentSongInternal(delta); + } else { + Song currentSong = getSong(0); + Song song = currentSong; + delta = delta > 0 ? 1 : -1; + for (;;) { + shiftCurrentSongInternal(delta); + song = getSong(0); + + if (currentSong == null || song == null) + break; + if (currentSong.albumId != song.albumId) // found a new album + break; + if (currentSong.id == song.id) // probably looping? (= only one album in queue) + break; + if (getPosition() == 0 && getFinishAction() == FINISH_RANDOM) // dead end: FINISH_RANDOM won't wrap around. + break; + } + } + } + + if (delta != SHIFT_KEEP_SONG) + changed(); + return getSong(0); + } + + /** + * Run the given query and add the results to the song timeline. + * + * @param context A context to use. + * @param query The query to be run. The mode variable must be initialized + * to one of SongTimeline.MODE_*. The type and data variables may also need + * to be initialized depending on the given mode. + * @return The number of songs that were added. + */ + public int addSongs(Context context, QueryTask query) + { + Cursor cursor = query.runQuery(context); + if (cursor == null) { + return 0; + } + + int mode = query.mode; + int type = query.type; + long data = query.data; + + int count = cursor.getCount(); // Items found by query + int added = 0; // Items actually added to the queue + + if (count == 0 && type == MediaUtils.TYPE_FILE && query.selectionArgs.length == 1) { + // This seems to be a simple file query which lead to no results. + // The file might just be unindexed, so try to return a file cursor: + String pathQuery = query.selectionArgs[0]; + int len = pathQuery.length(); + if (len > 0) { + String lastchar = pathQuery.substring(len-1); + if (lastchar.equals("%")) { + pathQuery = pathQuery.substring(0, len-1); + } + + cursor.close(); // close old version + cursor = MediaUtils.getCursorForFileQuery(pathQuery); + count = cursor.getCount(); + } + } + + if (count == 0) { + cursor.close(); + return 0; + } + + ArrayList<Song> timeline = mSongs; + synchronized (this) { + saveActiveSongs(); + + switch (mode) { + case MODE_ENQUEUE: + case MODE_ENQUEUE_POS_FIRST: + case MODE_ENQUEUE_ID_FIRST: + case MODE_ENQUEUE_AS_NEXT: + if (mFinishAction == FINISH_RANDOM) { + int j = timeline.size(); + while (--j > mCurrentPos) { + if (timeline.get(j).isRandom()) + timeline.remove(j); + } + } + break; + case MODE_FLUSH_AND_PLAY_NEXT: + timeline.subList(mCurrentPos + 1, timeline.size()).clear(); + break; + case MODE_PLAY: + case MODE_PLAY_POS_FIRST: + case MODE_PLAY_ID_FIRST: + timeline.clear(); + mCurrentPos = 0; + break; + default: + throw new IllegalArgumentException("Invalid mode: " + mode); + } + + int start = mCurrentPos + 1; // Position where our modification started + Song jumpSong = null; // Jump to this song if `data' requested it + + /* Check if addAtPos is out-of-bounds OR if + * the request does not want to work at the current + * playlist position anyway + */ + if (start > timeline.size() || mode != MODE_ENQUEUE_AS_NEXT) { + start = timeline.size(); + } + + for (int j = 0; j != count; ++j) { + cursor.moveToPosition(j); + + Song song = new Song(-1); + song.populate(cursor); + if (song.isFilled() == false) { + // Song vanished from device for some reason: we are silently skipping it. + continue; + } + + timeline.add(start + added, song); + added++; + + if (jumpSong == null) { + if ((mode == MODE_PLAY_POS_FIRST || mode == MODE_ENQUEUE_POS_FIRST) && j == data) { + jumpSong = song; + } else if (mode == MODE_PLAY_ID_FIRST || mode == MODE_ENQUEUE_ID_FIRST) { + long id; + switch (type) { + case MediaUtils.TYPE_ARTIST: + id = song.artistId; + break; + case MediaUtils.TYPE_ALBUM: + id = song.albumId; + break; + case MediaUtils.TYPE_SONG: + id = song.id; + break; + case MediaUtils.TYPE_FILE: + id = song.id; + break; + default: + throw new IllegalArgumentException("Unsupported id type: " + type); + } + if (id == data) + jumpSong = song; + } + } + } + + cursor.close(); + + if (mShuffleMode != SHUFFLE_NONE) + MediaUtils.shuffle(timeline.subList(start, start+added), mShuffleMode == SHUFFLE_ALBUMS); + + if (jumpSong != null) { + int jumpPos = timeline.lastIndexOf(jumpSong); + if (jumpPos > start) { + // Get the sublist twice to avoid a ConcurrentModificationException. + timeline.addAll(timeline.subList(start, jumpPos)); + timeline.subList(start, jumpPos).clear(); + } + } + + broadcastChangedSongs(); + } + + changed(); + + return added; + } + + /** + * Removes any songs greater than `len' songs before the current song. + */ + private void shrinkQueue(int len) { + synchronized (this) { + while (mCurrentPos > len) { + mSongs.remove(0); + mCurrentPos--; + } + } + changed(); + } + + /** + * Clear the song queue. + */ + public void clearQueue() + { + synchronized (this) { + saveActiveSongs(); + if (mCurrentPos + 1 < mSongs.size()) + mSongs.subList(mCurrentPos + 1, mSongs.size()).clear(); + broadcastChangedSongs(); + } + + changed(); + } + + /** + * Empty the song queue (clear the whole queue). + */ + public void emptyQueue() + { + synchronized (this) { + saveActiveSongs(); + mSongs.clear(); + mCurrentPos = 0; + broadcastChangedSongs(); + } + + changed(); + } + + /** + * Save the active songs for use with broadcastChangedSongs(). + * + * @see SongTimeline#broadcastChangedSongs() + */ + private void saveActiveSongs() + { + mSavedPrevious = getSong(-1); + mSavedCurrent = getSong(0); + mSavedNext = getSong(+1); + mSavedPos = mCurrentPos; + mSavedSize = mSongs.size(); + } + + /** + * Broadcast the active songs that have changed since the last call to + * saveActiveSongs() + * + * @see SongTimeline#saveActiveSongs() + */ + private void broadcastChangedSongs() + { + if (mCallback == null) return; + + Song previous = getSong(-1); + Song current = getSong(0); + Song next = getSong(+1); + + if (Song.getId(mSavedPrevious) != Song.getId(previous)) + mCallback.activeSongReplaced(-1, previous); + if (Song.getId(mSavedNext) != Song.getId(next)) + mCallback.activeSongReplaced(1, next); + if (Song.getId(mSavedCurrent) != Song.getId(current)) + mCallback.activeSongReplaced(0, current); + + if (mCurrentPos != mSavedPos || mSongs.size() != mSavedSize) + mCallback.positionInfoChanged(); + } + + /** + * Remove the song with the given id from the timeline. + * + * @param id The MediaStore id of the song to remove. + */ + public void removeSong(long id) + { + synchronized (this) { + saveActiveSongs(); + + ArrayList<Song> songs = mSongs; + ListIterator<Song> it = songs.listIterator(); + while (it.hasNext()) { + int i = it.nextIndex(); + if (Song.getId(it.next()) == id) { + if (i < mCurrentPos) + --mCurrentPos; + it.remove(); + } + } + + if (getSong(1) == null) + mCurrentPos = 0; + + broadcastChangedSongs(); + } + + changed(); + } + + /** + * Removes song in timeline at given position + * @param pos index to use + */ + public void removeSongPosition(int pos) { + synchronized (this) { + ArrayList<Song> songs = mSongs; + + if (songs.size() <= pos) // may happen if we race with purge() + return; + + saveActiveSongs(); + + songs.remove(pos); + if (pos < mCurrentPos) + mCurrentPos--; + if (getSong(1) == null) // wrap around if this was the last song + mCurrentPos = 0; + + broadcastChangedSongs(); + } + changed(); + } + + /** + * Moves a song in the timeline to a new position + * @param from index to move from + * @param to index to move to + */ + public void moveSongPosition(int from, int to) { + synchronized (this) { + ArrayList<Song> songs = mSongs; + + if (songs.size() <= from || songs.size() <= to) // may happen if we race with purge() + return; + + saveActiveSongs(); + + Song tmp = songs.remove(from); + songs.add(to, tmp); + + if (mCurrentPos == from) { + mCurrentPos = to; // active song was dragged to 'to' + } else if (from > mCurrentPos && to <= mCurrentPos) { + mCurrentPos++; + } else if (from < mCurrentPos && to >= mCurrentPos) { + mCurrentPos--; + } + + broadcastChangedSongs(); + } + changed(); + } + + /** + * Broadcasts that the timeline state has changed. + */ + private void changed() + { + // Invalidate shuffle cache if the timeline *contents* changed in the meantime + if (mShuffleCache != null && mShuffleTicket != mSongs.hashCode()) + mShuffleCache = null; + + if (mCallback != null) + mCallback.timelineChanged(); + } + + /** + * Return true if the finish action is to stop at the end of the queue and + * the current song is the last in the queue. + */ + public boolean isEndOfQueue() + { + synchronized (this) { + return mFinishAction == FINISH_STOP && mCurrentPos == mSongs.size() - 1; + } + } + + /** + * Returns the position of the current song in the timeline. + */ + public int getPosition() + { + return mCurrentPos; + } + + /** + * Returns the current number of songs in the timeline. + */ + public int getLength() + { + return mSongs.size(); + } +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/SortableAdapter.java b/app/src/main/java/ch/blinkenlights/android/vanilla/SortableAdapter.java new file mode 100644 index 0000000..e30eaf4 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/SortableAdapter.java @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2017 Adrian Ulrich <adrian@blinkenlights.ch> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package ch.blinkenlights.android.vanilla; + +import android.widget.BaseAdapter; + +/** + * Abstract adapter that implements sorting for its data. + */ +public abstract class SortableAdapter extends BaseAdapter { + /** + * The human-readable descriptions for each sort mode. + */ + int[] mSortEntries; + /** + * The index of the current sort mode in mSortValues, or + * the inverse of the index (in which case sort should be descending + * instead of ascending). + */ + int mSortMode; + + /** + * Return the available sort modes for this adapter. + * + * @return An array containing the resource ids of the sort mode strings. + */ + public int[] getSortEntries() { + return mSortEntries; + } + + /** + * Set the sorting mode. The adapter should be re-queried after changing + * this. + * + * @param mode The index of the sort mode in the sort entries array. If this + * is negative, the inverse of the index will be used and sort order will + * be reversed. + */ + public void setSortMode(int mode) { + mSortMode = getIndexForSortMode(mode) < mSortEntries.length ? mode : 0; + } + + /** + * Return the current sort mode set on this adapter. + * This is the index or the bitwise inverse of the index if the sort is descending. + */ + public int getSortMode() { + return mSortMode; + } + + /** + * Return the current sort mode index. + */ + public int getSortModeIndex() { + return getIndexForSortMode(mSortMode); + } + + /** + * Return if the current sort mode is reversed. + */ + public boolean isSortDescending() { + return mSortMode < 0; + } + + /** + * Returns the sort mode that should be used if no preference is saved. This + * may very based on the active limiter. + */ + abstract public int getDefaultSortMode(); + + /** + * Return the key used for loading/saving the sort mode for this adapter. + */ + abstract public String getSortSettingsKey(); + + private int getIndexForSortMode(int mode) { + return mode < 0 ? ~mode : mode; // 'negative' modes are actually inverted indexes + } +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/SystemUtils.java b/app/src/main/java/ch/blinkenlights/android/vanilla/SystemUtils.java new file mode 100644 index 0000000..a0b6283 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/SystemUtils.java @@ -0,0 +1,116 @@ +/* + * Copyright (C) 2018 Adrian Ulrich <adrian@blinkenlights.ch> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package ch.blinkenlights.android.vanilla; + +import android.content.Context; +import android.content.Intent; +import android.content.pm.ShortcutManager; +import android.content.pm.ShortcutInfo; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.graphics.drawable.Icon; +import android.os.Build; + +/** + * Provides some static System-related utility functions. + */ +public class SystemUtils { + + /** + * Installs (or prompts user to install) a shortcut launcher pointing to the given type and id + * combination. Launching the shortcut will cause vanilla to play the type / id combination. + * + * @param context the context to use. + * @param label the label of the shortcut. + * @param type the media type of the passed in id. + * @param id an id of a media type + */ + public static void installLauncherShortcut(Context context, String label, int type, long id) { + Intent shortcut = new Intent(context, ShortcutPseudoActivity.class); + shortcut.setAction(PlaybackService.ACTION_FROM_TYPE_ID_AUTOPLAY); + shortcut.putExtra(LibraryAdapter.DATA_TYPE, type); + shortcut.putExtra(LibraryAdapter.DATA_ID, id); + + if (label.length() == 0) { + // Android does not allow empty labels. + label = "?"; + } + + Bitmap cover = null; + Song song = MediaUtils.getSongByTypeId(context, type, id); + if (song != null) { + cover = song.getSmallCover(context); + } + if (cover == null) { + cover = BitmapFactory.decodeResource(context.getResources(), R.drawable.fallback_cover); + } + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) { + installShortcut(context, label, cover, shortcut); + } else { + installShortcutLegacy(context, label, cover, shortcut); + } + } + + /** + * Prompts the user to install a shortcut. This is only available on API >= 25. + * + * @param context the context to use. + * @param label the label to use for this shortcut. + * @param cover the icon to use for this shortcut. + * @param intent intent launched by the shortcut. + * + * @return true if the shortcut MAY have been created. + */ + private static boolean installShortcut(Context context, String label, Bitmap cover, Intent intent) { + ShortcutManager manager = context.getSystemService(ShortcutManager.class); + if (manager == null || !manager.isRequestPinShortcutSupported()) + return false; + + String uniqueId = "vanilla:shortcut:" + System.currentTimeMillis(); + ShortcutInfo pin = new ShortcutInfo.Builder(context, uniqueId) + .setIntent(intent) + .setShortLabel(label) + .setIcon(Icon.createWithBitmap(cover)) + .build(); + + manager.requestPinShortcut(pin, null); + return true; + } + + /** + * Adds a new icon to the launcher for legacy devices. + * + * @param context the context to use. + * @param label the label to use for this shortcut. + * @param cover the cover to use for the shortcut. + * @param intent the launcher intent. + * + * @return true if the shortcut request was dispatched + */ + private static boolean installShortcutLegacy(Context context, String label, Bitmap cover, Intent intent) { + Intent add = new Intent(); + add.putExtra(Intent.EXTRA_SHORTCUT_INTENT, intent); + add.putExtra(Intent.EXTRA_SHORTCUT_NAME, label); + add.putExtra(Intent.EXTRA_SHORTCUT_ICON, cover); + + add.setAction("com.android.launcher.action.INSTALL_SHORTCUT"); + context.sendBroadcast(add); + return true; + } +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/TabOrderActivity.java b/app/src/main/java/ch/blinkenlights/android/vanilla/TabOrderActivity.java new file mode 100644 index 0000000..b117466 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/TabOrderActivity.java @@ -0,0 +1,189 @@ +/* + * Copyright (C) 2012 Christopher Eby <kreed@kreed.org> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package ch.blinkenlights.android.vanilla; + +import android.app.Activity; +import android.content.SharedPreferences; +import android.os.Bundle; +import android.view.MenuItem; +import android.view.View; +import android.widget.AdapterView; +import android.widget.AdapterView.OnItemClickListener; +import com.mobeta.android.dslv.DragSortListView; + +/** + * The preferences activity in which one can change application preferences. + */ +public class TabOrderActivity extends Activity + implements View.OnClickListener, + OnItemClickListener, + DragSortListView.DropListener +{ + private TabOrderAdapter mAdapter; + private DragSortListView mList; + + /** + * Initialize the activity, loading the preference specifications. + */ + @Override + protected void onCreate(Bundle savedInstanceState) + { + ThemeHelper.setTheme(this, R.style.BackActionBar); + super.onCreate(savedInstanceState); + + setTitle(R.string.tabs); + setContentView(R.layout.tab_order); + + mAdapter = new TabOrderAdapter(this); + DragSortListView list = (DragSortListView)findViewById(R.id.list); + list.setAdapter(mAdapter); + list.setOnItemClickListener(this); + list.setDropListener(this); + mList = list; + load(); + + findViewById(R.id.done).setOnClickListener(this); + findViewById(R.id.restore_default).setOnClickListener(this); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) + { + if (item.getItemId() == android.R.id.home) { + finish(); + return true; + } else { + return super.onOptionsItemSelected(item); + } + } + + @Override + public void onClick(View view) + { + switch (view.getId()) { + case R.id.done: + finish(); + break; + case R.id.restore_default: + restoreDefault(); + break; + } + } + + /** + * Restore the default tab order and visibility. + */ + public void restoreDefault() + { + mAdapter.setTabIds(LibraryPagerAdapter.DEFAULT_TAB_ORDER.clone()); + DragSortListView list = mList; + for (int i = 0; i != LibraryPagerAdapter.MAX_ADAPTER_COUNT; ++i) { + list.setItemChecked(i, LibraryPagerAdapter.DEFAULT_TAB_VISIBILITY[i]); + } + save(); + } + + /** + * Save tab order and visibility to SharedPreferences as a string. + */ + public void save() + { + int[] ids = mAdapter.getTabIds(); + DragSortListView list = mList; + char[] out = new char[LibraryPagerAdapter.MAX_ADAPTER_COUNT]; + for (int i = 0; i != LibraryPagerAdapter.MAX_ADAPTER_COUNT; ++i) { + out[i] = (char)(list.isItemChecked(i) ? 128 + ids[i] : 127 - ids[i]); + } + + SharedPreferences.Editor editor = SharedPrefHelper.getSettings(this).edit(); + editor.putString(PrefKeys.TAB_ORDER, new String(out)); + editor.apply(); + } + + /** + * Load tab order settings from SharedPreferences and apply it to the + * activity. + */ + public void load() + { + String in = SharedPrefHelper.getSettings(this).getString(PrefKeys.TAB_ORDER, PrefDefaults.TAB_ORDER); + if (in != null && in.length() == LibraryPagerAdapter.MAX_ADAPTER_COUNT) { + char[] chars = in.toCharArray(); + int[] ids = new int[LibraryPagerAdapter.MAX_ADAPTER_COUNT]; + for (int i = 0; i != LibraryPagerAdapter.MAX_ADAPTER_COUNT; ++i) { + int v = chars[i]; + v = v < 128 ? -(v - 127) : v - 128; + if (v >= MediaUtils.TYPE_COUNT) { + ids = null; + break; + } + ids[i] = v; + } + + if (ids != null) { + mAdapter.setTabIds(ids); + DragSortListView list = mList; + for (int i = 0; i != LibraryPagerAdapter.MAX_ADAPTER_COUNT; ++i) { + list.setItemChecked(i, chars[i] >= 128); + } + } + + return; + } + + restoreDefault(); + } + + @Override + public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) + { + save(); + } + + /** + * Fired from adapter listview if user moved an item + * @param from the item index that was dragged + * @param to the index where the item was dropped + */ + @Override + public void drop(int from, int to) { + if (from == to) + return; + + int[] ids = mAdapter.getTabIds(); + int tempId = ids[from]; + + if (from > to) { + System.arraycopy(ids, to, ids, to + 1, from - to); + } else { + System.arraycopy(ids, from + 1, ids, from, to - from); + } + + ids[to] = tempId; + save(); + mAdapter.notifyDataSetChanged(); + // no need to update the copy in mAdapter: We worked on a reference + } + + +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/TabOrderAdapter.java b/app/src/main/java/ch/blinkenlights/android/vanilla/TabOrderAdapter.java new file mode 100644 index 0000000..7e08224 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/TabOrderAdapter.java @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2011 Christopher Eby <kreed@kreed.org> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package ch.blinkenlights.android.vanilla; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; +import android.widget.BaseAdapter; + +/** + * CursorAdapter backed by MediaStore playlists. + */ +public class TabOrderAdapter extends BaseAdapter { + private final TabOrderActivity mActivity; + private final LayoutInflater mInflater; + private int[] mTabIds; + + /** + * Create a tab order adapter. + * + * @param activity The activity that will own this adapter. The activity + * will be notified when items have been moved. + */ + public TabOrderAdapter(TabOrderActivity activity) + { + mActivity = activity; + mInflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + } + + /** + * Set the array containing the order of tab ids. + */ + public void setTabIds(int[] ids) + { + mTabIds = ids; + notifyDataSetChanged(); + } + + /** + * Returns the array containing the order of tab ids. Do not modify the array. + */ + public int[] getTabIds() + { + return mTabIds; + } + + @Override + public int getCount() + { + return LibraryPagerAdapter.MAX_ADAPTER_COUNT; + } + + @Override + public Object getItem(int position) + { + return null; + } + + @Override + public long getItemId(int position) + { + return mTabIds[position]; + } + + @Override + public View getView(int position, View convert, ViewGroup parent) + { + DraggableRow view; + if (convert == null) { + view = (DraggableRow)mInflater.inflate(R.layout.draggable_row, parent, false); + view.setupLayout(DraggableRow.LAYOUT_CHECKBOXES); + } else { + view = (DraggableRow)convert; + } + view.setText(mActivity.getResources().getText(LibraryPagerAdapter.TITLES[mTabIds[position]])); + return view; + } + + @Override + public boolean hasStableIds() + { + return true; + } +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/ThemeHelper.java b/app/src/main/java/ch/blinkenlights/android/vanilla/ThemeHelper.java new file mode 100644 index 0000000..a884869 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/ThemeHelper.java @@ -0,0 +1,126 @@ +/* + * Copyright (C) 2015-2016 Adrian Ulrich <adrian@blinkenlights.ch> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package ch.blinkenlights.android.vanilla; + +import android.content.Context; +import android.content.res.TypedArray; +import android.content.SharedPreferences; +import android.os.Build; + +public class ThemeHelper { + + /** + * Calls context.setTheme() with given theme. + * Will automatically swap the theme with an alternative + * version if the user requested us to use it + */ + final public static void setTheme(Context context, int theme) { + context.setTheme(getThemeResource(context, theme)); + } + + /** + * Returns the theme resource id to use based on the user preferences + * and platform API. + */ + final public static int getThemeResource(Context context, int theme) { + TypedArray ar = null; + switch (theme) { + case R.style.Playback: + ar = context.getResources().obtainTypedArray(R.array.theme_category_playback); + break; + case R.style.Library: + ar = context.getResources().obtainTypedArray(R.array.theme_category_library); + break; + case R.style.BackActionBar: + ar = context.getResources().obtainTypedArray(R.array.theme_category_backactionbar); + break; + case R.style.PopupDialog: + ar = context.getResources().obtainTypedArray(R.array.theme_category_popupdialog); + break; + case R.style.BottomSheetDialog: + ar = context.getResources().obtainTypedArray(R.array.theme_category_bottomsheetdialog); + break; + default: + throw new IllegalArgumentException("setTheme() called with unknown theme!"); + } + theme = ar.getResourceId(getSelectedThemeIndex(context), -1); + ar.recycle(); + return theme; + } + + /** + * Helper function to get the correct play button drawable for our + * notification: The notification does not depend on the theme but + * depends on the API level + */ + final public static int getPlayButtonResource(boolean playing) + { + return playing ? R.drawable.widget_pause : R.drawable.widget_play; + } + + /** + * Returns TRUE if we should use the dark material theme, + * Returns FALSE otherwise - always returns FALSE on pre-5.x devices + */ + final private static boolean usesDarkTheme(Context context) + { + final int idx = getSelectedThemeIndex(context); + final String[] variants = context.getResources().getStringArray(R.array.theme_variant); + boolean useDark = variants[idx].equals("dark"); + return useDark; + } + + /** + * Returns the user-selected theme index from the shared peferences provider + * + * @param context the context to use + * @return integer of the selected theme + */ + final private static int getSelectedThemeIndex(Context context) { + SharedPreferences settings = SharedPrefHelper.getSettings(context); + String prefValue = settings.getString(PrefKeys.SELECTED_THEME, PrefDefaults.SELECTED_THEME); + + final String[] ids = context.getResources().getStringArray(R.array.theme_ids); + for (int i = 0; i < ids.length; i++) { + if (ids[i].equals(prefValue)) + return i; + } + // no theme found? return default theme. + return 0; + } + + /** + * Fetches a color resource from the current theme + */ + final public static int fetchThemeColor(Context context, int resId) { + TypedArray a = context.obtainStyledAttributes(new int[] { resId }); + int color = a.getColor(0, 0); + a.recycle(); + return color; + } + + /** + * Returns the color to be used to draw the placeholder cover. + */ + final public static int[] getDefaultCoverColors(Context context) { + int bg = fetchThemeColor(context, android.R.attr.colorBackground); + int diff = 0x00171717 * (bg > 0xFF888888 ? -1 : 1); + return new int[]{ bg, bg+diff }; + } + +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/TimelineCallback.java b/app/src/main/java/ch/blinkenlights/android/vanilla/TimelineCallback.java new file mode 100644 index 0000000..b0ff2c4 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/TimelineCallback.java @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2016 Adrian Ulrich <adrian@blinkenlights.ch> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package ch.blinkenlights.android.vanilla; + +public interface TimelineCallback { + /** + * Called when the song timeline position/size has changed + */ + void onPositionInfoChanged(); + /** + * The library contents changed and should be invalidated + */ + void onMediaChange(); + /** + * Notification about a change in the timeline + */ + void onTimelineChanged(); + /** + * Updates song at 'delta' + */ + void replaceSong(int delta, Song song); + /** + * Sets the currently active song + */ + void setSong(long uptime, Song song); + /** + * Sets the current playback state + */ + void setState(long uptime, int state); + /** + * The view/activity should re-create itself due to a theme change + */ + void recreate(); +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/TimestampedObject.java b/app/src/main/java/ch/blinkenlights/android/vanilla/TimestampedObject.java new file mode 100644 index 0000000..d2276d7 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/TimestampedObject.java @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2015 Adrian Ulrich <adrian@blinkenlights.ch> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package ch.blinkenlights.android.vanilla; + + + +public class TimestampedObject { + public long uptime; + public Object object; + + /** + * Encapsulates given object and marks the creation timestamp + * in nanoseconds + */ + public TimestampedObject(Object object) { + this.object = object; + this.uptime = System.nanoTime(); + } + +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/TrackDetailsDialog.java b/app/src/main/java/ch/blinkenlights/android/vanilla/TrackDetailsDialog.java new file mode 100644 index 0000000..1ea47aa --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/TrackDetailsDialog.java @@ -0,0 +1,124 @@ +/* + * Copyright (C) 2018 Toby Hsieh + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package ch.blinkenlights.android.vanilla; + +import android.app.DialogFragment; +import android.app.FragmentManager; +import android.os.Bundle; +import android.os.Handler; +import android.os.HandlerThread; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +import ch.blinkenlights.android.medialibrary.MediaMetadataExtractor; + +/** + * A dialog to show details about a track/song + */ +public class TrackDetailsDialog extends DialogFragment { + private static String SONG_ID = "song_id"; + + private HandlerThread mHandlerThread; + + public TrackDetailsDialog() { + } + + /** + * Creates a new dialog to show details about the given song + * + * @param songId ID of song this dialog is for + * @return a new dialog + */ + public static TrackDetailsDialog newInstance(long songId) { + TrackDetailsDialog dialog = new TrackDetailsDialog(); + Bundle args = new Bundle(); + args.putLong(SONG_ID, songId); + dialog.setArguments(args); + return dialog; + } + + /** + * Creates and shows a dialog containing details about the given song + * + * @param manager the FragmentManager to add the newly created dialog to + * @param songId ID of song to show dialog for + */ + public static void show(FragmentManager manager, long songId) { + newInstance(songId).show(manager, "TrackDetailsDialog"); + } + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + mHandlerThread = new HandlerThread(getClass().getName()); + mHandlerThread.start(); + setStyle(DialogFragment.STYLE_NO_TITLE, 0); + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + View view = inflater.inflate(R.layout.fragment_track_details, container); + final TextView titleView = view.findViewById(R.id.title); + final TextView artistView = view.findViewById(R.id.artist); + final TextView albumView = view.findViewById(R.id.album); + final TextView genreView = view.findViewById(R.id.genre); + final TextView trackView = view.findViewById(R.id.track); + final TextView yearView = view.findViewById(R.id.year); + final TextView composerView = view.findViewById(R.id.composer); + final TextView pathView = view.findViewById(R.id.path); + final TextView formatView = view.findViewById(R.id.format); + + final long songId = getArguments().getLong(SONG_ID); + Handler handler = new Handler(mHandlerThread.getLooper()); + handler.post(new Runnable() { + @Override + public void run() { + final Song song = MediaUtils.getSongByTypeId(getActivity(), MediaUtils.TYPE_SONG, songId); + if (song == null) { + return; + } + final MediaMetadataExtractor metadata = new MediaMetadataExtractor(song.path); + + getActivity().runOnUiThread(new Runnable() { + @Override + public void run() { + titleView.setText(song.title); + artistView.setText(song.artist); + albumView.setText(song.album); + genreView.setText(metadata.getFirst(MediaMetadataExtractor.GENRE)); + trackView.setText(song.getTrackAndDiscNumber()); + yearView.setText(metadata.getFirst(MediaMetadataExtractor.YEAR)); + composerView.setText(metadata.getFirst(MediaMetadataExtractor.COMPOSER)); + pathView.setText(song.path); + formatView.setText(metadata.getFormat()); + } + }); + } + }); + + return view; + } + + @Override + public void onDestroy() { + super.onDestroy(); + mHandlerThread.quit(); + } +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/VanillaImageButton.java b/app/src/main/java/ch/blinkenlights/android/vanilla/VanillaImageButton.java new file mode 100644 index 0000000..d948cc2 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/VanillaImageButton.java @@ -0,0 +1,87 @@ +/* + * Copyright (C) 2015-2016 Adrian Ulrich <adrian@blinkenlights.ch> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + + +package ch.blinkenlights.android.vanilla; + +import android.content.Context; +import android.content.res.TypedArray; +import android.util.AttributeSet; +import android.util.TypedValue; +import android.widget.ImageButton; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.ColorFilter; +import android.graphics.Paint; + +import androidx.annotation.Nullable; + + +public class VanillaImageButton extends ImageButton { + + private Context mContext; + private static int mNormalTint; + private static int mActiveTint; + + public VanillaImageButton(Context context) { + this(context, null); + } + + public VanillaImageButton(Context context, AttributeSet attrs) { + this(context, attrs, 0); + } + + public VanillaImageButton(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + mContext = context; + mNormalTint = fetchAttrColor(R.attr.controls_normal); + mActiveTint = fetchAttrColor(R.attr.controls_active); + + updateImageTint(-1); + } + + @Override + public void setImageResource(int resId) { + super.setImageResource(resId); + this.updateImageTint(resId); + } + + private void updateImageTint(int resHint) { + int filterColor = mNormalTint; + + switch (resHint) { + case R.drawable.repeat_active: + case R.drawable.repeat_current_active: + case R.drawable.stop_current_active: + case R.drawable.shuffle_active: + case R.drawable.shuffle_album_active: + case R.drawable.random_active: + filterColor = mActiveTint; + } + + this.setColorFilter(filterColor); + } + + private int fetchAttrColor(int attr) { + TypedValue typedValue = new TypedValue(); + TypedArray a = mContext.obtainStyledAttributes(typedValue.data, new int[] { attr }); + int color = a.getColor(0, 0); + a.recycle(); + return color; + } + +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/VanillaMediaPlayer.java b/app/src/main/java/ch/blinkenlights/android/vanilla/VanillaMediaPlayer.java new file mode 100644 index 0000000..40396f7 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/VanillaMediaPlayer.java @@ -0,0 +1,169 @@ +/* + * Copyright (C) 2015 Adrian Ulrich <adrian@blinkenlights.ch> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + + +package ch.blinkenlights.android.vanilla; + +import android.annotation.TargetApi; +import android.content.Context; +import android.content.Intent; +import android.media.MediaPlayer; +import android.media.audiofx.AudioEffect; +import android.os.Build; + +import java.io.FileInputStream; +import java.io.IOException; + +public class VanillaMediaPlayer extends MediaPlayer { + + private Context mContext; + private String mDataSource; + private boolean mHasNextMediaPlayer; + private float mReplayGain = Float.NaN; + private float mDuckingFactor = Float.NaN; + private boolean mIsDucking = false; + + /** + * Constructs a new VanillaMediaPlayer class + */ + public VanillaMediaPlayer(Context context) { + super(); + mContext = context; + } + + /** + * Resets the media player to an unconfigured state + */ + public void reset() { + mDataSource = null; + mHasNextMediaPlayer = false; + super.reset(); + } + + /** + * Releases the media player and frees any claimed AudioEffect + */ + public void release() { + mDataSource = null; + mHasNextMediaPlayer = false; + super.release(); + } + + /** + * Sets the data source to use + */ + public void setDataSource(String path) throws IOException, IllegalArgumentException, SecurityException, IllegalStateException { + // The MediaPlayer function expects a file:// like string but also accepts *most* absolute unix paths (= paths with no colon) + // We could therefore encode the path into a full URI, but a much quicker way is to simply use + // setDataSource(FileDescriptor) as the framework code would end up calling this function anyways (MediaPlayer.java:1100 (6.0)) + FileInputStream fis = new FileInputStream(path); + super.setDataSource(fis.getFD()); + fis.close(); // this is OK according to the SDK documentation! + mDataSource = path; + } + + /** + * Returns the configured data source, may be null + */ + public String getDataSource() { + return mDataSource; + } + + /** + * Sets the next media player data source + */ + @TargetApi(Build.VERSION_CODES.JELLY_BEAN) + public void setNextMediaPlayer(VanillaMediaPlayer next) { + super.setNextMediaPlayer(next); + mHasNextMediaPlayer = (next != null); + } + + /** + * Returns true if a 'next' media player has been configured + * via setNextMediaPlayer(next) + */ + public boolean hasNextMediaPlayer() { + return mHasNextMediaPlayer; + } + + /** + * Creates a new AudioEffect for our AudioSession + */ + public void openAudioFx() { + Intent i = new Intent(AudioEffect.ACTION_OPEN_AUDIO_EFFECT_CONTROL_SESSION); + i.putExtra(AudioEffect.EXTRA_AUDIO_SESSION, this.getAudioSessionId()); + i.putExtra(AudioEffect.EXTRA_PACKAGE_NAME, mContext.getPackageName()); + mContext.sendBroadcast(i); + } + + /** + * Releases a previously claimed audio session id + */ + public void closeAudioFx() { + Intent i = new Intent(AudioEffect.ACTION_CLOSE_AUDIO_EFFECT_CONTROL_SESSION); + i.putExtra(AudioEffect.EXTRA_AUDIO_SESSION, this.getAudioSessionId()); + i.putExtra(AudioEffect.EXTRA_PACKAGE_NAME, mContext.getPackageName()); + mContext.sendBroadcast(i); + } + + /** + * Sets the desired scaling due to replay gain. + * @param replayGain the factor to adjust the volume by. Must be between 0 and 1 (inclusive) + * or {@link Float#NaN} to disable replay gain scaling + */ + public void setReplayGain(float replayGain) { + mReplayGain = replayGain; + updateVolume(); + } + + /** + * Sets whether we are ducking or not. Ducking is when we temporarily decrease the volume for + * a transient sound to play from another application, such as a notification's beep. + * @param isDucking true if we are ducking, false if we are not + */ + public void setIsDucking(boolean isDucking) { + mIsDucking = isDucking; + updateVolume(); + } + + /** + * Sets the desired scaling while ducking. + * @param duckingFactor the factor to adjust the volume by while ducking. Must be between 0 + * and 1 (inclusive) or {@link Float#NaN} to disable ducking completely + * + * See also {@link #setIsDucking(boolean)} + */ + public void setDuckingFactor(float duckingFactor) { + mDuckingFactor = duckingFactor; + updateVolume(); + } + /** + * Sets the volume, using the replay gain and ducking if appropriate + */ + private void updateVolume() { + float volume = 1.0f; + if (!Float.isNaN(mReplayGain)) { + volume = mReplayGain; + } + if(mIsDucking && !Float.isNaN(mDuckingFactor)) { + volume *= mDuckingFactor; + } + + setVolume(volume, volume); + } + +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/ViewHolder.java b/app/src/main/java/ch/blinkenlights/android/vanilla/ViewHolder.java new file mode 100644 index 0000000..953f7de --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/ViewHolder.java @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2015 Adrian Ulrich <adrian@blinkenlights.ch> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package ch.blinkenlights.android.vanilla; + +import android.view.View; +import android.widget.TextView; +import android.widget.ImageView; + + +public class ViewHolder { + public long id; + public String title; +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/WidgetD.java b/app/src/main/java/ch/blinkenlights/android/vanilla/WidgetD.java new file mode 100644 index 0000000..6e008c1 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/WidgetD.java @@ -0,0 +1,152 @@ +/* + * Copyright (C) 2010, 2011 Christopher Eby <kreed@kreed.org> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package ch.blinkenlights.android.vanilla; + +import android.app.PendingIntent; +import android.appwidget.AppWidgetManager; +import android.appwidget.AppWidgetProvider; +import android.content.ComponentName; +import android.content.Context; +import android.content.Intent; +import android.graphics.Bitmap; +import android.view.View; +import android.widget.RemoteViews; + +/** + * 2x2 widget that shows cover art in the background and playback controls in + * a semi-transparent widget on top of the cover. + */ +public class WidgetD extends AppWidgetProvider { + private static boolean sEnabled; + + @Override + public void onEnabled(Context context) + { + sEnabled = true; + } + + @Override + public void onDisabled(Context context) + { + sEnabled = false; + } + + @Override + public void onUpdate(Context context, AppWidgetManager manager, int[] ids) + { + Song song = null; + int state = 0; + + if (PlaybackService.hasInstance()) { + PlaybackService service = PlaybackService.get(context); + song = service.getSong(0); + state = service.getState(); + } + + sEnabled = true; + updateWidget(context, manager, song, state); + } + + /** + * Check if there are any instances of this widget placed. + */ + public static void checkEnabled(Context context, AppWidgetManager manager) + { + sEnabled = manager.getAppWidgetIds(new ComponentName(context, WidgetD.class)).length != 0; + } + + /** + * Populate the widgets with the given ids with the given info. + * + * @param context A Context to use. + * @param manager The AppWidgetManager that will be used to update the + * widget. + * @param song The current Song in PlaybackService. + * @param state The current PlaybackService state. + */ + public static void updateWidget(Context context, AppWidgetManager manager, Song song, int state) + { + if (!sEnabled) + return; + + RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_d); + Bitmap cover = null; + + if ((state & PlaybackService.FLAG_NO_MEDIA) != 0) { + views.setViewVisibility(R.id.buttons, View.GONE); + views.setViewVisibility(R.id.title, View.GONE); + views.setInt(R.id.artist, "setText", R.string.no_songs); + } else if (song == null) { + views.setViewVisibility(R.id.buttons, View.VISIBLE); + views.setViewVisibility(R.id.title, View.GONE); + views.setInt(R.id.artist, "setText", R.string.app_name); + } else { + views.setViewVisibility(R.id.title, View.VISIBLE); + views.setViewVisibility(R.id.buttons, View.VISIBLE); + views.setTextViewText(R.id.title, song.title); + views.setTextViewText(R.id.artist, song.artist); + cover = song.getMediumCover(context); + } + + if (cover == null) { + views.setImageViewResource(R.id.cover, R.drawable.fallback_cover_large); + } else { + views.setImageViewBitmap(R.id.cover, cover); + } + + boolean playing = (state & PlaybackService.FLAG_PLAYING) != 0; + views.setImageViewResource(R.id.play_pause, playing ? R.drawable.pause : R.drawable.play); + views.setImageViewResource(R.id.end_action, SongTimeline.FINISH_ICONS[PlaybackService.finishAction(state)]); + views.setImageViewResource(R.id.shuffle, SongTimeline.SHUFFLE_ICONS[PlaybackService.shuffleMode(state)]); + + Intent intent; + PendingIntent pendingIntent; + int flags = Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_TASK_ON_HOME; + + intent = new Intent(context, LibraryActivity.class).setAction(Intent.ACTION_MAIN); + pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE); + views.setOnClickPendingIntent(R.id.cover, pendingIntent); + + intent = ShortcutPseudoActivity.getIntent(context, PlaybackService.ACTION_TOGGLE_PLAYBACK); + pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE); + views.setOnClickPendingIntent(R.id.play_pause, pendingIntent); + + intent = ShortcutPseudoActivity.getIntent(context, PlaybackService.ACTION_NEXT_SONG); + pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE); + views.setOnClickPendingIntent(R.id.next, pendingIntent); + + intent = ShortcutPseudoActivity.getIntent(context, PlaybackService.ACTION_PREVIOUS_SONG); + pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE); + views.setOnClickPendingIntent(R.id.previous, pendingIntent); + + intent = ShortcutPseudoActivity.getIntent(context, PlaybackService.ACTION_CYCLE_SHUFFLE); + pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE); + views.setOnClickPendingIntent(R.id.shuffle, pendingIntent); + + intent = ShortcutPseudoActivity.getIntent(context, PlaybackService.ACTION_CYCLE_REPEAT); + pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE); + views.setOnClickPendingIntent(R.id.end_action, pendingIntent); + + manager.updateAppWidget(new ComponentName(context, WidgetD.class), views); + } +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/WidgetE.java b/app/src/main/java/ch/blinkenlights/android/vanilla/WidgetE.java new file mode 100644 index 0000000..6431247 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/WidgetE.java @@ -0,0 +1,143 @@ +/* + * Copyright (C) 2012 Christopher Eby <kreed@kreed.org> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package ch.blinkenlights.android.vanilla; + +import android.app.PendingIntent; +import android.appwidget.AppWidgetManager; +import android.appwidget.AppWidgetProvider; +import android.content.ComponentName; +import android.content.Context; +import android.content.Intent; +import android.view.View; +import android.widget.RemoteViews; + +/** + * 4x1 widget with many playback controls + */ +public class WidgetE extends AppWidgetProvider { + private static boolean sEnabled; + + @Override + public void onEnabled(Context context) + { + sEnabled = true; + } + + @Override + public void onDisabled(Context context) + { + sEnabled = false; + } + + @Override + public void onUpdate(Context context, AppWidgetManager manager, int[] ids) + { + Song song = null; + int state = 0; + + if (PlaybackService.hasInstance()) { + PlaybackService service = PlaybackService.get(context); + song = service.getSong(0); + state = service.getState(); + } + + sEnabled = true; + updateWidget(context, manager, song, state); + } + + /** + * Check if there are any instances of this widget placed. + */ + public static void checkEnabled(Context context, AppWidgetManager manager) + { + sEnabled = manager.getAppWidgetIds(new ComponentName(context, WidgetE.class)).length != 0; + } + + /** + * Populate the widgets with the given ids with the given info. + * + * @param context A Context to use. + * @param manager The AppWidgetManager that will be used to update the + * widget. + * @param song The current Song in PlaybackService. + * @param state The current PlaybackService state. + */ + public static void updateWidget(Context context, AppWidgetManager manager, Song song, int state) + { + if (!sEnabled) + return; + + RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_e); + + if ((state & PlaybackService.FLAG_NO_MEDIA) != 0) { + views.setViewVisibility(R.id.buttons, View.GONE); + views.setViewVisibility(R.id.title, View.GONE); + views.setInt(R.id.artist, "setText", R.string.no_songs); + } else if (song == null) { + views.setViewVisibility(R.id.buttons, View.VISIBLE); + views.setViewVisibility(R.id.title, View.GONE); + views.setInt(R.id.artist, "setText", R.string.app_name); + } else { + views.setViewVisibility(R.id.title, View.VISIBLE); + views.setViewVisibility(R.id.buttons, View.VISIBLE); + views.setTextViewText(R.id.title, song.title); + views.setTextViewText(R.id.artist, song.artist); + } + + boolean playing = (state & PlaybackService.FLAG_PLAYING) != 0; + views.setImageViewResource(R.id.play_pause, playing ? R.drawable.pause : R.drawable.play); + views.setImageViewResource(R.id.end_action, SongTimeline.FINISH_ICONS[PlaybackService.finishAction(state)]); + views.setImageViewResource(R.id.shuffle, SongTimeline.SHUFFLE_ICONS[PlaybackService.shuffleMode(state)]); + + Intent intent; + PendingIntent pendingIntent; + int flags = Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_TASK_ON_HOME; + + intent = new Intent(context, LibraryActivity.class).setAction(Intent.ACTION_MAIN); + pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE); + views.setOnClickPendingIntent(R.id.title, pendingIntent); + views.setOnClickPendingIntent(R.id.artist, pendingIntent); + + intent = ShortcutPseudoActivity.getIntent(context, PlaybackService.ACTION_TOGGLE_PLAYBACK); + pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE); + views.setOnClickPendingIntent(R.id.play_pause, pendingIntent); + + intent = ShortcutPseudoActivity.getIntent(context, PlaybackService.ACTION_NEXT_SONG); + pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE); + views.setOnClickPendingIntent(R.id.next, pendingIntent); + + intent = ShortcutPseudoActivity.getIntent(context, PlaybackService.ACTION_PREVIOUS_SONG); + pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE); + views.setOnClickPendingIntent(R.id.previous, pendingIntent); + + intent = ShortcutPseudoActivity.getIntent(context, PlaybackService.ACTION_CYCLE_SHUFFLE); + pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE); + views.setOnClickPendingIntent(R.id.shuffle, pendingIntent); + + intent = ShortcutPseudoActivity.getIntent(context, PlaybackService.ACTION_CYCLE_REPEAT); + pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE); + views.setOnClickPendingIntent(R.id.end_action, pendingIntent); + + manager.updateAppWidget(new ComponentName(context, WidgetE.class), views); + } +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/ext/CoordClickListener.java b/app/src/main/java/ch/blinkenlights/android/vanilla/ext/CoordClickListener.java new file mode 100644 index 0000000..664bc58 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/ext/CoordClickListener.java @@ -0,0 +1,92 @@ +/* + * Copyright (C) 2018 Adrian Ulrich <adrian@blinkenlights.ch> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package ch.blinkenlights.android.vanilla.ext; + +import android.view.MotionEvent; +import android.view.View; +import android.view.View.OnTouchListener; +import android.widget.AdapterView; +import android.widget.ListView; + + +public class CoordClickListener + implements + AdapterView.OnItemLongClickListener + , View.OnTouchListener { + /** + * Interface to implement by the callback + */ + public interface Callback { + boolean onItemLongClickWithCoords(AdapterView<?> parent, View view, int position, long id, float x, float y); + } + /** + * The registered callback consumer + */ + private Callback mCallback; + /** + * Last X position seen. + */ + private float mPosX; + /** + * Last Y position seen. + */ + private float mPosY; + + /** + * Create a new CoordClickListener instance + * + * @param cb the callback consumer. + */ + public CoordClickListener(Callback cb) { + mCallback = cb; + } + + /** + * Register a view for long click observation. + * + * @param view the view to listen for long clicks + */ + public void registerForOnItemLongClickListener(ListView view) { + view.setOnItemLongClickListener(this); + view.setOnTouchListener(this); + } + + /** + * Implementation of onItemLongClickListener interface + */ + @Override + public boolean onItemLongClick (AdapterView<?>parent, View view, int position, long id) { + return mCallback.onItemLongClickWithCoords(parent, view, position, id, mPosX, mPosY); + } + + /** + * Implementation of OnTouchListener interface + */ + @Override + public boolean onTouch(View view, MotionEvent ev) { + mPosX = ev.getX(); + mPosY = ev.getY(); + // Not handled: we just observe. + return false; + } +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/ui/ArrowedText.java b/app/src/main/java/ch/blinkenlights/android/vanilla/ui/ArrowedText.java new file mode 100644 index 0000000..dd3e830 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/ui/ArrowedText.java @@ -0,0 +1,120 @@ +/* + * Copyright (C) 2020 Adrian Ulrich <adrian@blinkenlights.ch> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package ch.blinkenlights.android.vanilla.ui; + +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.Paint; +import android.graphics.drawable.PaintDrawable; +import android.graphics.Path; +import android.widget.TextView; + +public class ArrowedText extends TextView { + /** + * Context this view uses. + */ + Context mContext; + /** + * Display density of the device. + */ + float mDensity; + /** + * Color of the arrow on the left side. + */ + int mArrowColor; + /** + * Controls the width of the drawn arrow in DIP. + */ + float mArrowWidth; + /** + * 'padding' space (used left side) for the arrow to consume in DIP. + */ + float mArrowPadding; + + public ArrowedText(Context context) { + super(context); + mContext = context; + mDensity = context.getResources().getDisplayMetrics().density; + } + + /** + * Configures the width of the arrow. + */ + public void setArrowWidthDIP(float w) { + mArrowWidth = w * mDensity; + } + + /** + * Configures how much space the arrow uses on the left side. + */ + public void setArrowPaddingDIP(float p) { + mArrowPadding = p * mDensity; + } + + /** + * Configures the padding of this view in DIP. + */ + public void setPaddingDIP(float left, float top, float right, float bottom) { + setPadding((int)(left*mDensity), + (int)(top*mDensity), + (int)(right*mDensity), + (int)(bottom*mDensity)); + } + + /** + * Configures the minimal width of this view in DIP. + */ + public void setMinWidthDIP(float w) { + setMinWidth((int)(w*mDensity)); + } + + /** + * Set arrow and background color of this view. + */ + public void setColors(int colA, int colB) { + PaintDrawable bg = new PaintDrawable(colB); + setBackgroundDrawable(bg); + mArrowColor = colA; + } + + @Override + protected void onDraw(Canvas canvas) { + Paint paint = new Paint(); + paint.setColor(mArrowColor); + paint.setAntiAlias(true); + paint.setStyle(Paint.Style.FILL_AND_STROKE); + + int h = canvas.getHeight(); + float m = h/2.0f; + Path path = new Path(); + path.moveTo(0, 0); + path.lineTo(mArrowPadding, 0); + path.lineTo(mArrowPadding + mArrowWidth, m); + path.lineTo(mArrowPadding, h); + path.lineTo(0, h); + path.lineTo(0,0); + path.close(); + canvas.drawPath(path, paint); + super.onDraw(canvas); + } +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/ui/FancyMenu.java b/app/src/main/java/ch/blinkenlights/android/vanilla/ui/FancyMenu.java new file mode 100644 index 0000000..3e3059c --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/ui/FancyMenu.java @@ -0,0 +1,229 @@ +/* + * Copyright (C) 2018-2019 Adrian Ulrich <adrian@blinkenlights.ch> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package ch.blinkenlights.android.vanilla.ui; + +import ch.blinkenlights.android.vanilla.R; +import ch.blinkenlights.android.vanilla.ThemeHelper; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.ListView; +import android.widget.TextView; +import android.widget.ImageView; + +import com.google.android.material.bottomsheet.BottomSheetDialog; + +import java.util.ArrayList; + + +public class FancyMenu { + /** + * Title to use for this FancyMenu + */ + private String mTitle; + /** + * Context of this instance + */ + private Context mContext; + /** + * Callback to call + */ + private FancyMenu.Callback mCallback; + /** + * List of all items and possible children + */ + private ArrayList<ArrayList<FancyMenuItem>> mItems; + /** + * The callback interface to implement + */ + public interface Callback { + boolean onFancyItemSelected(FancyMenuItem item); + } + + /** + * Create a new FancyMenu instance. + * + * @param context the context to use + */ + public FancyMenu(Context context, FancyMenu.Callback callback) { + mContext = context; + mCallback = callback; + mItems = new ArrayList<ArrayList<FancyMenuItem>>(); + } + + /** + * Set title of this FancyMenu + * + * @param title the title to set + */ + public void setHeaderTitle(String title) { + mTitle = title; + } + + /** + * Adds a new item to the menu + * + * @param id the id which identifies this object. + * @param order how to sort this item + * @param drawable icon drawable to use + * @param textRes id of the text resource to use as label + */ + public FancyMenuItem add(int id, int order, int drawable, int textRes) { + CharSequence text = mContext.getResources().getString(textRes); + return addInternal(id, order, drawable, text, false); + } + + /** + * Adds a new item to the menu + * + * @param id the id which identifies this object + * @param order how to sort this item + * @param drawable icon drawable to use + * @param text string label + * @return a new FancyMenuItem + */ + public FancyMenuItem add(int id, int order, int drawable, CharSequence text) { + return addInternal(id, order, drawable, text, false); + } + + /** + * Adds a new spacer item + * + * @param order how to sort this item + * @return a new FancyMenuItem + */ + public FancyMenuItem addSpacer(int order) { + return addInternal(0, order, 0, null, true); + } + + /** + * Internal add implementation + * + * @param id the id which identifies the object + * @param order how to sort this item + * @param icon the icon resource to use + * @param text the text label to display + * @param spacer whether or not this is a spacer + * @return a new FancyMenuItem + */ + private FancyMenuItem addInternal(int id, int order, int icon, CharSequence text, boolean spacer) { + FancyMenuItem item = new FancyMenuItem(mContext, id) + .setIcon(icon) + .setTitle(text) + .setIsSpacer(spacer); + + while (order >= mItems.size()) { + mItems.add(new ArrayList<FancyMenuItem>()); + } + mItems.get(order).add(item); + return item; + } + + /** + * Creates an Adapter from a nested ArrayList + * + * @param items the nested list containing the items + * @return the new adapter + */ + private Adapter assembleAdapter(ArrayList<ArrayList<FancyMenuItem>> items) { + final Adapter adapter = new Adapter(mContext, 0); + for (ArrayList<FancyMenuItem> sub : items) { + for (FancyMenuItem item : sub ) { + adapter.add(item); + } + } + return adapter; + } + + /** + * Show the assembled fancy menu + * + * @param the parent view to use as anchor + * @param x x-coord position hint + * @param y y-coord position hint + */ + public void show(View parent, float x, float y) { + int style = ThemeHelper.getThemeResource(mContext, R.style.BottomSheetDialog); + final Sheet sheet = new Sheet(mContext, style); + final Adapter adapter = assembleAdapter(mItems); + final AdapterView.OnItemClickListener listener = new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView<?> parent, View view, int pos, long id) { + FancyMenuItem item = adapter.getItem(pos); + if (!item.isSpacer()) { + mCallback.onFancyItemSelected(item); + } + sheet.dismiss(); + } + }; + ListView list = new ListView(mContext); + list.setAdapter(adapter); + list.setOnItemClickListener(listener); + list.setDivider(null); + + sheet.setTitle(mTitle); + sheet.setContentView(list); + sheet.show(); + } + + private class Sheet extends BottomSheetDialog { + Sheet(Context context, int style) { + super(context, style); + } + } + + /** + * Adapter class backing all menu entries + */ + private class Adapter extends ArrayAdapter<FancyMenuItem> { + private LayoutInflater mInflater; + + Adapter(Context context, int resource) { + super(context, resource); + mInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + } + + @Override + public View getView(int pos, View convertView, ViewGroup parent) { + FancyMenuItem item = (FancyMenuItem)getItem(pos); + int res = (item.isSpacer() ? R.layout.fancymenu_spacer : R.layout.fancymenu_row); + + View row = (View)mInflater.inflate(res, parent, false); + TextView text = (TextView)row.findViewById(R.id.text); + ImageView icon = (ImageView)row.findViewById(R.id.icon); + + if (item.isSpacer()) { + text.setText(item.getTitle()); + } else { + text.setText(item.getTitle()); + icon.setImageDrawable(item.getIcon()); + } + return row; + } + } + +} diff --git a/app/src/main/java/ch/blinkenlights/android/vanilla/ui/FancyMenuItem.java b/app/src/main/java/ch/blinkenlights/android/vanilla/ui/FancyMenuItem.java new file mode 100644 index 0000000..f387bcc --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/android/vanilla/ui/FancyMenuItem.java @@ -0,0 +1,272 @@ +/* + * Copyright (C) 2018 Adrian Ulrich <adrian@blinkenlights.ch> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package ch.blinkenlights.android.vanilla.ui; + +import android.content.Context; +import android.content.Intent; +import android.graphics.drawable.Drawable; +import android.view.ContextMenu; +import android.view.MenuItem; +import android.view.ActionProvider; +import android.view.SubMenu; +import android.view.View; + +public class FancyMenuItem implements MenuItem { + private int mId; + private int mIconRes; + private CharSequence mTitle; + private Intent mIntent; + private boolean mSpacer; + private Drawable mIcon; + private Context mContext; + + FancyMenuItem(Context context, int id) { + mContext = context; + mId = id; + } + + /** + * Returns whether or not this is a spacer + * + * @return true if this is a spacer + */ + public boolean isSpacer() { + return mSpacer; + } + + public FancyMenuItem setIsSpacer(boolean spacer) { + mSpacer = spacer; + return this; + } + + @Override + public CharSequence getTitle() { + return mTitle; + } + + @Override + public Drawable getIcon() { + if (mIconRes != 0) + return mContext.getResources().getDrawable(mIconRes); + return mIcon; + } + + @Override + public FancyMenuItem setIcon(Drawable drawable) { + mIcon = drawable; + return this; + } + + @Override + public FancyMenuItem setIcon(int res) { + mIconRes = res; + return this; + } + + @Override + public FancyMenuItem setIntent(Intent intent) { + mIntent = intent; + return this; + } + + @Override + public FancyMenuItem setTitle(CharSequence title) { + mTitle = title; + return this; + } + + @Override + public FancyMenuItem setTitle(int title) { + return setTitle(mContext.getResources().getString(title)); + } + + @Override + public Intent getIntent() { + return mIntent; + } + + @Override + public int getItemId() { + return mId; + } + + // Dummy functions to satisfy MenuItem interface. + @Override + public ActionProvider getActionProvider() { + return null; + } + + @Override + public CharSequence getTitleCondensed() { + return null; + } + + @Override + public ContextMenu.ContextMenuInfo getMenuInfo() { + return null; + } + + @Override + public FancyMenuItem setActionProvider(ActionProvider actionProvider) { + return this; + } + + @Override + public FancyMenuItem setActionView(int view) { + return this; + } + + @Override + public FancyMenuItem setAlphabeticShortcut(char alphaChar) { + return this; + } + + @Override + public FancyMenuItem setCheckable(boolean checkable) { + return this; + } + + @Override + public FancyMenuItem setChecked(boolean checked) { + return this; + } + + @Override + public FancyMenuItem setEnabled(boolean enabled) { + return this; + } + + @Override + public FancyMenuItem setNumericShortcut(char numericChar) { + return this; + } + + @Override + public FancyMenuItem setOnActionExpandListener(MenuItem.OnActionExpandListener listener) { + return this; + } + + @Override + public FancyMenuItem setOnMenuItemClickListener(MenuItem.OnMenuItemClickListener menuItemClickListener) { + return this; + } + + @Override + public FancyMenuItem setShortcut(char numericChar, char alphaChar) { + return this; + } + + @Override + public FancyMenuItem setShowAsActionFlags(int actionEnum) { + return this; + } + + @Override + public FancyMenuItem setTitleCondensed(CharSequence text) { + return this; + } + + @Override + public FancyMenuItem setVisible(boolean visible) { + return this; + } + + @Override + public MenuItem setActionView(View view) { + return this; + } + + @Override + public SubMenu getSubMenu() { + return null; + } + + @Override + public View getActionView() { + return null; + } + + @Override + public boolean collapseActionView() { + return false; + } + + @Override + public boolean expandActionView() { + return false; + } + + @Override + public boolean hasSubMenu() { + return false; + } + + @Override + public boolean isActionViewExpanded() { + return false; + } + + @Override + public boolean isCheckable() { + return false; + } + + @Override + public boolean isChecked() { + return false; + } + + @Override + public boolean isEnabled() { + return true; + } + + @Override + public boolean isVisible() { + return true; + } + + @Override + public char getAlphabeticShortcut() { + return 0; + } + + @Override + public char getNumericShortcut() { + return 0; + } + + @Override + public int getGroupId() { + return 0; + } + + @Override + public int getOrder() { + return 0; + } + + @Override + public void setShowAsAction(int actionEnum) { + } +} diff --git a/app/src/main/java/ch/blinkenlights/bastp/Bastp.java b/app/src/main/java/ch/blinkenlights/bastp/Bastp.java new file mode 100644 index 0000000..a3c63e9 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/bastp/Bastp.java @@ -0,0 +1,118 @@ +/* + * Copyright (C) 2013 Adrian Ulrich <adrian@blinkenlights.ch> + * Copyright (C) 2017 Google Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + + +package ch.blinkenlights.bastp; + +import ch.blinkenlights.bastp.OggFile; +import ch.blinkenlights.bastp.FlacFile; +import java.io.RandomAccessFile; +import java.io.IOException; +import java.util.HashMap; + + +public class Bastp { + + public Bastp() { + } + + public HashMap getTags(String fname) { + HashMap tags = new HashMap(); + try { + RandomAccessFile ra = new RandomAccessFile(fname, "r"); + tags = getTags(ra); + ra.close(); + } + catch(Exception e) { + /* we dont' care much: SOMETHING went wrong. d'oh! */ + } + + return tags; + } + + public HashMap getTags(RandomAccessFile s) { + HashMap tags = new HashMap(); + byte[] file_ff = new byte[12]; + + try { + s.read(file_ff); + String magic = new String(file_ff); + if(magic.substring(0,4).equals("fLaC")) { + tags = (new FlacFile()).getTags(s); + tags.put("type", "FLAC"); + } + else if(magic.substring(0,4).equals("OggS")) { + // This may be an Opus OR an Ogg Vorbis file + tags = (new OpusFile()).getTags(s); + if (tags.size() > 0) { + tags.put("type", "OPUS"); + } else { + tags = (new OggFile()).getTags(s); + tags.put("type", "OGG"); + } + } + else if(file_ff[0] == -1 && file_ff[1] == -5) { /* aka 0xfffb in real languages */ + tags = (new LameHeader()).getTags(s); + tags.put("type", "MP3/Lame"); + } + else if(magic.substring(0,3).equals("ID3")) { + tags = (new ID3v2File()).getTags(s); + if(tags.containsKey("_hdrlen")) { + Long hlen = Long.parseLong( tags.get("_hdrlen").toString(), 10 ); + HashMap lameInfo = (new LameHeader()).parseLameHeader(s, hlen); + /* add tags from lame header if not already present */ + inheritTag("REPLAYGAIN_TRACK_GAIN", lameInfo, tags); + inheritTag("REPLAYGAIN_ALBUM_GAIN", lameInfo, tags); + inheritTag("duration", lameInfo, tags); + } + tags.put("type", "MP3/ID3v2"); + } + else if(magic.substring(4,8).equals("ftyp") && ( + // see http://www.ftyps.com/ for all MP4 subtypes + magic.substring(8,11).equals("M4A") || // Apple audio + magic.substring(8,11).equals("M4V") || // Apple video + magic.substring(8,12).equals("mp42") || // generic MP4, e.g. FAAC + magic.substring(8,12).equals("isom") || // generic MP4, e.g. ffmpeg + magic.substring(8,12).equals("dash") // IEC 23009-1 data + )) { + tags = (new Mp4File()).getTags(s); + tags.put("type", "MP4"); + } + else if(magic.substring(0,4).equals("MThd")) { + tags = (new RawFile()).getTags(s); + tags.put("type", "MIDI"); + } + else if(file_ff[0] == -1 && (file_ff[1]&0xF0) == 0xF0) { /* aka 0xfff? */ + tags = (new RawFile()).getTags(s); + tags.put("type", "ADTS"); + } + + } + catch (IOException e) { + } + return tags; + } + + private void inheritTag(String key, HashMap from, HashMap to) { + if(!to.containsKey(key) && from.containsKey(key)) { + to.put(key, from.get(key)); + } + } + +} + diff --git a/app/src/main/java/ch/blinkenlights/bastp/Common.java b/app/src/main/java/ch/blinkenlights/bastp/Common.java new file mode 100644 index 0000000..6db0190 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/bastp/Common.java @@ -0,0 +1,156 @@ +/* + * Copyright (C) 2013 Adrian Ulrich <adrian@blinkenlights.ch> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + + +package ch.blinkenlights.bastp; + +import java.io.IOException; +import java.io.RandomAccessFile; +import java.util.HashMap; +import java.util.ArrayList; + +public class Common { + private static final int MAX_COMMENT_SIZE = 512; + + /** + * Returns a 32bit int from given byte offset in LE + */ + public int b2le32(byte[] b, int off) { + int r = 0; + for(int i=0; i<4; i++) { + r |= ( b2u(b[off+i]) << (8*i) ); + } + return r; + } + + /** + * Same as b2le32 but reads from a RandomAccessFile instead of a buffer + */ + public int raf2le32(RandomAccessFile fh, long off) throws IOException { + byte[] scratch = new byte[4]; + fh.seek(off); + fh.read(scratch); + return b2le32(scratch, 0); + } + + public int b2be32(byte[] b, int off) { + return swap32(b2le32(b, off)); + } + + public int swap32(int i) { + return((i&0xff)<<24)+((i&0xff00)<<8)+((i&0xff0000)>>8)+((i>>24)&0xff); + } + + /** + * Returns a 16bit int from given byte offset in LE + */ + public int b2le16(byte[] b, int off) { + return ( b2u(b[off]) | b2u(b[off+1]) << 8 ); + } + + /** + * convert 'byte' value into unsigned int + */ + public int b2u(byte x) { + return (x & 0xFF); + } + + /** + * Printout debug message to STDOUT + */ + public void debug(String s) { + System.out.println("DBUG "+s); + } + + /** + * Throws an exception, killing the parser + */ + public void xdie(String reason) throws IOException { + throw new IOException(reason); + } + + public HashMap parse_vorbis_comment(RandomAccessFile fh, PageInfo.PageParser pp, long offset, long payload_len) throws IOException { + HashMap tags = new HashMap(); + long last_byte = offset + payload_len; + + // skip vendor string in format: [LEN][VENDOR_STRING] -> 4 = LEN = 32bit int + offset += 4 + raf2le32(fh, offset); + + // we can now read the number of comments in this file, we will also + // adjust offset to point to the value after this 32bit int + int comments = raf2le32(fh, offset); + offset += 4; + + for ( ; comments > 0; comments--) { + int comment_len = raf2le32(fh, offset); + offset += 4; + long can_read = last_byte - offset; // indicates the last byte of this page + int do_read = (int)(can_read > comment_len ? comment_len : can_read); // how much data is readable in this page + + if (do_read >= 3) { + int bsize = (do_read > MAX_COMMENT_SIZE ? MAX_COMMENT_SIZE : do_read); + byte[] data = new byte[bsize]; + fh.seek(offset); + fh.read(data); + String tag_raw = new String(data); + String[] tag_vec = tag_raw.split("=", 2); + String tag_key = tag_vec[0].toUpperCase(); + addTagEntry(tags, tag_key, tag_vec[1]); + } + + // set offset to begin of next tag (OR the end of this page!) + offset += do_read; + + // We hit the end of a stream + // this is most likely due to the fact that we cropped do_read to not cross + // the page boundary -> we must now calculate the position of the next tag + if (offset == last_byte) { + int partial_cruft = comment_len - do_read; // how many bytes we did not read + while(partial_cruft > 0) { + PageInfo pi = pp.parse_stream_page(fh, last_byte); + if (pi.header_len <1 || pi.payload_len < 1) + xdie("Data from callback doesnt make much sense"); + + offset += pi.header_len; // move position behind page header + last_byte = offset + pi.payload_len; // and adjust the last byte to pos + payload_size + + if (offset+partial_cruft < last_byte) { + offset += partial_cruft; // partial data ends in this block: just adjust the ofset + break; + } else { + // this page just contains data from the partial tag -> skip to next one + offset = last_byte; + partial_cruft -= pi.payload_len; + } + } + } + } + return tags; + } + + public void addTagEntry(HashMap tags, String key, String value) { + if(tags.containsKey(key)) { + ((ArrayList)tags.get(key)).add(value); // just add to existing vector + } + else { + ArrayList l = new ArrayList<String>(); + l.add(value); + tags.put(key, l); + } + } + +} diff --git a/app/src/main/java/ch/blinkenlights/bastp/FlacFile.java b/app/src/main/java/ch/blinkenlights/bastp/FlacFile.java new file mode 100644 index 0000000..34bcb78 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/bastp/FlacFile.java @@ -0,0 +1,119 @@ +/* + * Copyright (C) 2013 Adrian Ulrich <adrian@blinkenlights.ch> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package ch.blinkenlights.bastp; + +import java.io.IOException; +import java.io.RandomAccessFile; +import java.util.HashMap; +import java.util.Enumeration; + + +public class FlacFile extends Common implements PageInfo.PageParser { + private static final int FLAC_TYPE_STREAMINFO = 0; // Basic info about the stream + private static final int FLAC_TYPE_COMMENT = 4; // ID of 'VorbisComment's + + public FlacFile() { + } + + public HashMap getTags(RandomAccessFile s) throws IOException { + int xoff = 4; // skip file magic + int retry = 64; + boolean need_infos = true; + boolean need_tags = true; + HashMap infos = new HashMap(); + HashMap tags = new HashMap(); + + for(; retry > 0; retry--) { + PageInfo pi = parse_stream_page(s, xoff); + if(pi.type == FLAC_TYPE_STREAMINFO) { + infos = parse_streaminfo_block(s, xoff+pi.header_len, pi.payload_len); + need_infos = false; + } + if(pi.type == FLAC_TYPE_COMMENT) { + tags = parse_vorbis_comment(s, this, xoff+pi.header_len, pi.payload_len); + need_tags = false; + } + + if(pi.last_page == true || (need_tags == false && need_infos == false)) + break; // eof reached + + // else: calculate next offset + xoff += pi.header_len + pi.payload_len; + } + + // Copy duration to final hashmap if found in infoblock + if(infos.containsKey("duration")) { + tags.put("duration", infos.get("duration")); + } + + return tags; + } + + /** + * Parses the metadata block at 'offset' + */ + public PageInfo parse_stream_page(RandomAccessFile s, long offset) throws IOException { + byte[] mb_head = new byte[4]; + int stop_after = 0; + int block_type = 0; + int block_size = 0; + + s.seek(offset); + + if( s.read(mb_head) != 4 ) + xdie("failed to read metadata block header"); + + block_size = b2be32(mb_head,0); // read whole header as 32 big endian + block_type = (block_size >> 24) & 127; // BIT 1-7 are the type + stop_after = (((block_size >> 24) & 128) > 0 ? 1 : 0 ); // BIT 0 indicates the last-block flag + block_size = (block_size & 0x00FFFFFF); // byte 1-7 are the size + + PageInfo pi = new PageInfo(); + pi.header_len = 4; // fixed size in flac + pi.payload_len = block_size; + pi.type = block_type; + pi.last_page = (stop_after != 0); + return pi; + } + + /* + ** Returns a hashma with parsed vorbis identification header data + **/ + private HashMap parse_streaminfo_block(RandomAccessFile s, long offset, long pl_len) throws IOException { + HashMap id_hash = new HashMap(); + byte[] buff = new byte[18]; + + if(pl_len >= buff.length) { + s.seek(offset); + s.read(buff); + id_hash.put("blocksize_minimal", (b2be32(buff, 0) >> 16)); + id_hash.put("blocksize_maximal", (b2be32(buff, 0) & 0x0000FFFF)); + id_hash.put("framesize_minimal", (b2be32(buff, 4) >> 8)); + id_hash.put("framesize_maximal", (b2be32(buff, 7) >> 8)); + id_hash.put("sampling_rate", (b2be32(buff, 10) >> 12)); + id_hash.put("channels", ((b2be32(buff, 10) >> 9) & 7) + 1); // 3 bits + id_hash.put("num_samples", b2be32(buff, 14)); // fixme: this is actually 36 bit: the 4 hi bits are discarded due to java + if((Integer)id_hash.get("sampling_rate") > 0) { + int duration = (Integer)id_hash.get("num_samples") / (Integer)id_hash.get("sampling_rate"); + id_hash.put("duration", (int)duration); + } + } + return id_hash; + } + +} diff --git a/app/src/main/java/ch/blinkenlights/bastp/ID3v2File.java b/app/src/main/java/ch/blinkenlights/bastp/ID3v2File.java new file mode 100644 index 0000000..310f616 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/bastp/ID3v2File.java @@ -0,0 +1,267 @@ +/* + * Copyright (C) 2013-2016 Adrian Ulrich <adrian@blinkenlights.ch> + * Copyright (C) 2017-2018 Google Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package ch.blinkenlights.bastp; + +import java.io.IOException; +import java.io.RandomAccessFile; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Enumeration; + + + +public class ID3v2File extends Common { + private static final int ID3_ENC_LATIN = 0x00; + private static final int ID3_ENC_UTF16 = 0x01; + private static final int ID3_ENC_UTF16BE = 0x02; + private static final int ID3_ENC_UTF8 = 0x03; + private static final HashMap<String, String> sOggNames; + static { + // ID3v2.3 -> ogg mapping + sOggNames = new HashMap<String, String>(); + sOggNames.put("TIT2", "TITLE"); + sOggNames.put("TALB", "ALBUM"); + sOggNames.put("TPE1", "ARTIST"); + sOggNames.put("TPE2", "ALBUMARTIST"); + sOggNames.put("TYER", "YEAR"); + sOggNames.put("TPOS", "DISCNUMBER"); + sOggNames.put("TRCK", "TRACKNUMBER"); + sOggNames.put("TCON", "GENRE"); + sOggNames.put("TCOM", "COMPOSER"); + // ID3v2.2 3-character names + sOggNames.put("TT2", "TITLE"); + sOggNames.put("TAL", "ALBUM"); + sOggNames.put("TP1", "ARTIST"); + sOggNames.put("TP2", "ALBUMARTIST"); + sOggNames.put("TYE", "YEAR"); + sOggNames.put("TRK", "TRACKNUMBER"); + sOggNames.put("TCO", "GENRE"); + sOggNames.put("TCM", "COMPOSER"); + } + + // Holds a key-value pair + private class TagItem { + String key; + String value; + public TagItem(String key, String value) { + this.key = key; + this.value = value; + } + } + + public ID3v2File() { + } + + public HashMap getTags(RandomAccessFile s) throws IOException { + HashMap tags = new HashMap(); + + final int v2hdr_len = 10; + byte[] v2hdr = new byte[v2hdr_len]; + + // read the whole 10 byte header into memory + s.seek(0); + s.read(v2hdr); + + int v3major = (b2be32(v2hdr, 0)) & 0xFF; // swapped ID3\04 -> ver. ist the first byte + int v3minor = (b2be32(v2hdr, 1)) & 0xFF; // minor version, not used by us. + int v3flags = (b2be32(v2hdr, 2)) & 0xFF; // flags such as extended headers. + int v3len = (b2be32(v2hdr, 6)); // total size EXCLUDING the this 10 byte header + v3len = unsyncsafe(v3len); + + // In 2.4, bit #6 indicates whether or not this file has an extended header + boolean flag_ext_hdr = v3major >= 4 && (v3flags & (1 << 6)) != 0; + + if (flag_ext_hdr) { + // The extended header is at least 6 bytes: + // * 4 byts of size + // * 1 byte numflags + // * 1 byte extended flags + byte[] exthdr = new byte[6]; + long pos = s.getFilePointer(); + s.read(exthdr); + + // we got the length, so we can seek to the header end. + int extlen = (b2be32(exthdr, 0)); + s.seek(pos + extlen); + } + + // we should already be at the first frame + // so we can start the parsing right now + tags = parse_v3_frames(s, v3len, v3major); + tags.put("_hdrlen", v3len+v2hdr_len); + return tags; + } + + /* + ** converts syncsafe integer to Java integer + */ + private int unsyncsafe(int x) { + x = ((x & 0x7f000000) >> 3) | + ((x & 0x007f0000) >> 2) | + ((x & 0x00007f00) >> 1) | + ((x & 0x0000007f) >> 0) ; + return x; + } + + /** + * Calculates the frame length baased on the frame size and the + */ + private int calculateFrameLength(byte[] frame, int offset, int v3major) { + // ID3v2 (aka ID3v2.2) had a 3-byte unencoded length field. + if (v3major < 3) { + return (frame[offset] << 16) + (frame[offset+1] << 8) + frame[offset+2]; + } + int rawlen = b2be32(frame, offset); + // Encoders prior ID3v2.4 did not encode the frame length + if (v3major < 4) { + return rawlen; + } + return unsyncsafe(rawlen); + } + + /* Parses all ID3v2 frames at the current position up until payload_len + ** bytes were read + */ + public HashMap parse_v3_frames(RandomAccessFile s, long payload_len, int v3major) throws IOException { + HashMap tags = new HashMap(); + // ID3v2 (aka ID3v2.2) had a 6-byte header of a 3-byte name and a 3-byte length. + // ID3v2.3 increased the header size to 10 bytes, with a 4-byte name and a 4-byte length + int namelen = (v3major >= 3 ? 4 : 3); + int headerlen = (v3major >= 3 ? 10 : 6); + byte[] frame = new byte[headerlen]; + long bread = 0; // total amount of read bytes + + while(bread < payload_len) { + bread += s.read(frame); + String framename = new String(frame, 0, namelen); + int slen = calculateFrameLength(frame, namelen, v3major); + /* Abort on silly sizes */ + long bytesRemaining = payload_len - bread; + if(slen < 1 || slen > bytesRemaining) + break; + + byte[] xpl = new byte[slen]; + bread += s.read(xpl); + + if(framename.substring(0,1).equals("T")) { + TagItem nti = normalizeTaginfo(framename, xpl); + if (nti.key.length() > 0) { + for (TagItem ti : splitTagPayload(nti)) { + addTagEntry(tags, ti.key, ti.value); + } + } + } + else if(framename.equals("RVA2")) { + // + } + + } + return tags; + } + + /* Split null-separated tags into individual elements */ + private ArrayList<TagItem> splitTagPayload(TagItem in) { + ArrayList res = new ArrayList<TagItem>(); + int i = 0; + + if (sOggNames.containsValue(in.key)) { + // Only try to split if there are more than two chars and the string does NOT look UTF16 encoded. + if (in.value.length() >= 2 && in.value.charAt(0) != 0 && in.value.charAt(1) != 0) { + for (String item : in.value.split("\0")) { + if (item.length() > 0) { // do not add empty items, avoids thrashing if the string is zero padded. + res.add(new TagItem(in.key, item)); + } + i++; + } + } + } + + if (i == 0) { + res.add(in); + } + return res; + } + + /* Converts ID3v2 sillyframes to OggNames */ + private TagItem normalizeTaginfo(String k, byte[] v) { + TagItem ti = new TagItem("", ""); + if(sOggNames.containsKey(k)) { + /* A normal, known key: translate into Ogg-Frame name */ + ti.key = (String)sOggNames.get(k); + ti.value = getDecodedString(v); + } + else if(k.equals("TXXX")) { + /* A freestyle field, ieks! */ + String txData[] = getDecodedString(v).split(Character.toString('\0'), 2); + /* Check if we got replaygain info in key\0value style */ + if(txData.length == 2 && txData[0].matches("^(?i)REPLAYGAIN_(ALBUM|TRACK)_GAIN$")) { + ti.key = txData[0].toUpperCase(); /* some tagwriters use lowercase for this */ + ti.value = txData[1]; + } + } + + return ti; + } + + /* Converts a raw byte-stream text into a java String */ + private String getDecodedString(byte[] raw) { + int encid = raw[0] & 0xFF; + int skip = 1; + String cs = "ISO-8859-1"; + String rv = ""; + try { + switch (encid) { + case ID3_ENC_UTF8: + cs = "UTF-8"; + break; + case ID3_ENC_UTF16BE: + cs = "UTF-16BE"; + skip = 3; + break; + case ID3_ENC_UTF16: + cs = "UTF-16"; + if (raw.length > 4) { + if ((raw[1]&0xFF) == 0xFE && (raw[2]&0XFF) == 0xFF && (raw[3]&0xFF) == 0x00 && (raw[4]&0xFF) == 0x00) { + // buggy tag written by lame?! + raw[3] = raw[2]; + raw[4] = raw[1]; + skip = 3; + } else if((raw[1]&0xFF) == 0xFF && (raw[2]&0XFF) == 0x00 && (raw[3]&0xFF) == 0xFE) { + // ?!, but seen in the wild + raw[2] = raw[1]; + skip = 2; + } + } + break; + case ID3_ENC_LATIN: + default: + // uses defaults + } + + rv = new String(raw, skip, raw.length-skip, cs); + + if (rv.length() > 0 && rv.substring(rv.length()-1).equals("\0")) { + // SOME tag writers seem to null terminate strings, some don't... + rv = rv.substring(0, rv.length()-1); + } + } catch(Exception e) {} + return rv; + } + +} diff --git a/app/src/main/java/ch/blinkenlights/bastp/LameHeader.java b/app/src/main/java/ch/blinkenlights/bastp/LameHeader.java new file mode 100644 index 0000000..4511ce5 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/bastp/LameHeader.java @@ -0,0 +1,165 @@ +/* + * Copyright (C) 2013 Adrian Ulrich <adrian@blinkenlights.ch> + * Copyright (C) 2017 Google Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package ch.blinkenlights.bastp; + +import java.io.IOException; +import java.io.RandomAccessFile; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Enumeration; + + +public class LameHeader extends Common { + + // Sampling rate version -> field mapping + private static int[][] sampleRates = { + { 11025, 12000, 8000 }, // MPEG2.5 (idx = 0) + { 0, 0, 0 }, // reserved (idx = 1) + { 22050, 24000, 16000 }, // MPEG2 (idx = 2) + { 44100, 48000, 32000 }, // MPEG1 (idx = 3) + }; + + // SamplesPerFrame layer -> version mapping + private static int[][] samplesPerFrame = { + // reserved, layer3, layer2, layer1 + { 0, 576, 1152, 384 }, // MPEG2.5 + { 0, 0, 0, 0 }, // RESERVED + { 0, 576, 1152, 384 }, // MPEG2 + { 0, 1152, 1152, 384 }, // MPEG1 + }; + + + public LameHeader() { + } + + public HashMap getTags(RandomAccessFile s) throws IOException { + HashMap rgain = parseLameHeader(s, 0); + HashMap tags = parseV1Header(s, s.length()-128); + + // Add replay gain info to returned object if available + for (String k : Arrays.asList("REPLAYGAIN_TRACK_GAIN", "REPLAYGAIN_ALBUM_GAIN")) { + if (rgain.containsKey(k)) + tags.put(k, rgain.get(k)); + } + + return tags; + } + + /** + * Attempts to parse ID3v1(.1) information from given RandomAccessFile + * + * @param s the seekable RandomAccessFile + * @param offset position of the ID3v1 tag + */ + private HashMap parseV1Header(RandomAccessFile s, long offset) throws IOException { + HashMap tags = new HashMap(); + byte[] tag = new byte[3]; + byte[] year = new byte[4]; + byte[] str = new byte[30]; + + s.seek(offset); + s.read(tag); + + if("TAG".equals(new String(tag))) { + for (String name : Arrays.asList("TITLE", "ARTIST", "ALBUM")) { + s.read(str); + String value = new String(str, "ISO-8859-1").trim(); + if (value.length() > 0) + addTagEntry(tags, name, value); + } + + // year is a string for whatever reason... + s.read(year); + String y = new String(year).trim(); + if (y.length() > 0) + addTagEntry(tags, "YEAR", y); + + s.skipBytes(28); // skip comment field + s.read(tag); + + if (tag[0] == 0 && tag[1] != 0) // tag[0] == 0 -> is id3v1.1 compatible + addTagEntry(tags, "TRACKNUMBER", String.format("%d", tag[1])); + + if (tag[2] != 0) + addTagEntry(tags, "GENRE", String.format("%d", tag[2])); + } + + + return tags; + } + + public HashMap parseLameHeader(RandomAccessFile s, long offset) throws IOException { + HashMap tags = new HashMap(); + byte[] chunk = new byte[12]; + + s.seek(offset + 0x24); + s.read(chunk); + + String lameMark = new String(chunk, 0, 4, "ISO-8859-1"); + int flags = b2u(chunk[7]); + + if((flags & 0x01) !=0 ) { // header indicates that totalFrames field is present + int total_frames = b2be32(chunk, 8); + s.seek(offset); + s.read(chunk); + + int mpeg_hdr = b2be32(chunk, 0); + int srate_idx = (mpeg_hdr >> 10) & 3; // sampling rate index at bit 10-11 + int layer_idx = (mpeg_hdr >> 17) & 3; // layer index value bit 17-18 + int ver_idx = (mpeg_hdr >> 19) & 3; // version index value bit 19-20 + + // Try to calculate song duration if all indexes are sane + if (ver_idx < sampleRates.length && srate_idx < sampleRates[ver_idx].length && layer_idx < samplesPerFrame[ver_idx].length) { + int sample_rate = sampleRates[ver_idx][srate_idx]; + int sample_pfr = samplesPerFrame[ver_idx][layer_idx]; + if (sample_rate > 0 && sample_pfr > 0) { + double duration = ((double)sample_pfr / (double)sample_rate) * total_frames; + tags.put("duration", (int)duration); + } + } + + } + + if(lameMark.equals("Info") || lameMark.equals("Xing")) { + s.seek(offset+0xAB); + s.read(chunk); + + int raw = b2be32(chunk, 0); + int gtrk_raw = raw >> 16; /* first 16 bits are the raw track gain value */ + int galb_raw = raw & 0xFFFF; /* the rest is for the album gain value */ + + float gtrk_val = (float)(gtrk_raw & 0x01FF)/10; + float galb_val = (float)(galb_raw & 0x01FF)/10; + + gtrk_val = ((gtrk_raw&0x0200)!=0 ? -1*gtrk_val : gtrk_val); + galb_val = ((galb_raw&0x0200)!=0 ? -1*galb_val : galb_val); + + if( (gtrk_raw&0xE000) == 0x2000 ) { + addTagEntry(tags, "REPLAYGAIN_TRACK_GAIN", gtrk_val+" dB"); + } + if( (gtrk_raw&0xE000) == 0x4000 ) { + addTagEntry(tags, "REPLAYGAIN_ALBUM_GAIN", galb_val+" dB"); + } + + } + + return tags; + } + +} diff --git a/app/src/main/java/ch/blinkenlights/bastp/Mp4File.java b/app/src/main/java/ch/blinkenlights/bastp/Mp4File.java new file mode 100644 index 0000000..282aaaa --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/bastp/Mp4File.java @@ -0,0 +1,254 @@ +/* + * Copyright (C) 2016 Ian Harmon + * Copyright (C) 2017 Google Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package ch.blinkenlights.bastp; + +import java.io.IOException; +import java.io.RandomAccessFile; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Stack; + +/* +* Helper class for tracking the traversal of the atom tree +*/ +class Atom { + String name; + long start; + int length; + + public Atom(String name, long start, int length) { + this.name = name; + this.start = start; + this.length = length; + } +} + +/* +* MP4 tag parser +*/ +public class Mp4File extends Common { + + // only these tags are returned. others may be parsed, but discarded. + final static List<String> ALLOWED_TAGS = Arrays.asList( + "replaygain_track_gain", + "replaygain_album_gain", + "title", + "album", + "artist", + "albumartist", + "composer", + "genre", + "year", + "tracknumber", + "discnumber" + ); + + // mapping between atom <-> vorbis tags + final static HashMap<String, String> ATOM_TAGS; + static { + ATOM_TAGS = new HashMap<String, String>(); + ATOM_TAGS.put("�nam", "title"); + ATOM_TAGS.put("�alb", "album"); + ATOM_TAGS.put("�ART", "artist"); + ATOM_TAGS.put("aART", "albumartist"); + ATOM_TAGS.put("�wrt", "composer"); + ATOM_TAGS.put("�gen", "genre"); + ATOM_TAGS.put("�day", "year"); + ATOM_TAGS.put("trkn", "tracknumber"); + ATOM_TAGS.put("disk", "discnumber"); + } + + // These tags are 32bit integers, not strings. + final static List<String> BINARY_TAGS = Arrays.asList( + "tracknumber", + "discnumber" + ); + + // maximum size for tag names or values + final static int MAX_BUFFER_SIZE = 512; + // only used when developing + final static boolean PRINT_DEBUG = false; + + // When processing atoms, we first read the atom length (4 bytes), + // and then the atom name (also 4 bytes). This value should not be changed. + final static int ATOM_HEADER_SIZE = 8; + + /* + * Traverses the atom structure of an MP4 file and returns as soon as tags + * are parsed + */ + public HashMap getTags(RandomAccessFile s) throws IOException { + HashMap tags = new HashMap(); + if (PRINT_DEBUG) { System.out.println(); } + try { + + // maintain a trail of breadcrumbs to know what part of the file we're in, + // so e.g. that we only parse [name] atoms that are part of a tag + Stack<Atom> path = new Stack<Atom>(); + + s.seek(0); + int atomSize; + byte[] atomNameRaw = new byte[4]; + String atomName; + String tagName = null; + + // begin traversing the file + // file structure info from http://atomicparsley.sourceforge.net/mpeg-4files.html + while (s.getFilePointer() < s.length()) { + + // if we've read/skipped past the end of atoms, remove them from the path stack + while (!path.empty() && s.getFilePointer() >= (path.peek().start + path.peek().length)) { + // if we've finished the tag atom [ilst], we can stop parsing. + // when tags are read successfully, this should be the exit point for the parser. + if (path.peek().name.equals("ilst")) { + if (PRINT_DEBUG) { System.out.println(); } + return tags; + } + path.pop(); + } + + // read a new atom's details + atomSize = s.readInt(); + + // return if we're unable to parse an atom size + // (e.g. previous atoms were parsed incorrectly and the + // file pointer is misaligned) + if (atomSize <= 0) { return tags; } + + s.read(atomNameRaw); + atomName = new String(atomNameRaw); + + // determine if we're currently decending through the hierarchy + // to a tag atom + boolean approachingTagAtom = false; + boolean onMetaAtom = false; + boolean onTagAtom = false; + String fourAtom = null; + // compare everything in the current path hierarchy and the new atom as well + // this is a bit repetitive as-is, but shouldn't be noticeable + for (int i = 0; i <= path.size(); i++) { + String thisAtomName = (i < path.size()) ? path.get(i).name : atomName; + if ((i == 0 && thisAtomName.equals("moov")) || + (i == 1 && thisAtomName.equals("udta")) || + (i == 2 && thisAtomName.equals("meta")) || + (i == 3 && thisAtomName.equals("ilst")) || + (i == 4 && thisAtomName.equals("----")) || + (i == 4 && ATOM_TAGS.containsKey(thisAtomName)) || + (i == 5 && (thisAtomName.equals("name") || thisAtomName.equals("data"))) + ) { + approachingTagAtom = true; + // if we're at the end of the current hierarchy, mark if it's the [meta] or a tag atom. + if (i == path.size()) { + onMetaAtom = thisAtomName.equals("meta"); + onTagAtom = (thisAtomName.equals("name") || thisAtomName.equals("data")); + } + // depth is 4 and this is a known atom: rembemer this! + if (i == 4 && ATOM_TAGS.containsKey(thisAtomName)) { + fourAtom = ATOM_TAGS.get(thisAtomName); + } + } + // quit as soon as we know we're not on the road to a tag atom + else { + approachingTagAtom = false; + break; + } + } + + // add the new atom to the path hierarchy + path.push(new Atom(atomName, s.getFilePointer()-ATOM_HEADER_SIZE, atomSize)); + if (PRINT_DEBUG) { printDebugAtomPath(s, path, atomName, atomSize); } + + // skip all non-pertinent atoms + if (!approachingTagAtom) { s.skipBytes(atomSize-ATOM_HEADER_SIZE); } + // dive into tag-related ones + else { + // the meta atom has an extra 4 bytes that need to be skipped + if (onMetaAtom) { s.skipBytes(4); } + + // read tag contents when there + if (onTagAtom) { + // get a tag name + if (atomName.equals("name")) { + // skip null bytes + s.skipBytes(4); + tagName = new String(readIntoBuffer(s, atomSize-(ATOM_HEADER_SIZE+4))); + } + + // get a tag value + else if (atomName.equals("data")) { + // skip flags/null bytes + s.skipBytes(8); + + // use the 'fourAtom' value if we did not have a tag name + tagName = (tagName == null ? fourAtom : tagName); + // read the tag + byte[] tagBuffer = readIntoBuffer(s, atomSize-(ATOM_HEADER_SIZE+8)); + + if (ALLOWED_TAGS.contains(tagName)) + { + String tagValue = (BINARY_TAGS.contains(tagName) ? String.format("%d", b2be32(tagBuffer, 0)) : new String(tagBuffer, "UTF-8")); + if (PRINT_DEBUG) { + System.out.println(String.format("parsed tag '%s': '%s'\n", tagName, tagValue)); + } + addTagEntry(tags, tagName.toUpperCase(), tagValue); + } + // This is the end of this tree, make sure that we don't re-use tagName in any other tree + tagName = null; + } + } + } + } + // End of while loop, the file has been completely read through. + // The parser should only return here if the tags atom [ilst] was missing. + return tags; + } + // if anything goes wrong, just return whatever we already have + catch (Exception e) { + return tags; + } + } + + /* + * Reads bytes from an atom up to the buffer size limit, currently 512B + */ + private byte[] readIntoBuffer(RandomAccessFile s, int dataSize) throws IOException { + // read tag up to buffer limit + int bufferSize = Math.min(dataSize, MAX_BUFFER_SIZE); + byte[] buffer = new byte[bufferSize]; + s.read(buffer, 0, buffer.length); + if (dataSize > bufferSize) { + s.skipBytes(dataSize - bufferSize); + } + return buffer; + } + + /* + * Can be used when traversing the atom hierarchy to print the tree of atoms + */ + private void printDebugAtomPath(RandomAccessFile s, Stack<Atom> path, + String atomName, int atomSize) throws IOException + { + String treeLines = ""; + for (int i = 0; i < path.size(); i++) { treeLines += ". "; } + long atomStart = s.getFilePointer()-ATOM_HEADER_SIZE; + System.out.println(String.format("%-22s %8d to %8d, length %8d", + (treeLines + "[" + atomName + "]"), atomStart, (atomStart+atomSize), atomSize)); + } +} diff --git a/app/src/main/java/ch/blinkenlights/bastp/OggFile.java b/app/src/main/java/ch/blinkenlights/bastp/OggFile.java new file mode 100644 index 0000000..326ff0b --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/bastp/OggFile.java @@ -0,0 +1,167 @@ +/* + * Copyright (C) 2013 Adrian Ulrich <adrian@blinkenlights.ch> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package ch.blinkenlights.bastp; + + +import java.io.IOException; +import java.io.RandomAccessFile; +import java.util.HashMap; + + +public class OggFile extends Common implements PageInfo.PageParser { + + private static final int OGG_PAGE_SIZE = 27; // Static size of an OGG Page + private static final int OGG_TYPE_IDENTIFICATION = 1; // Identification header + private static final int OGG_TYPE_COMMENT = 3; // ID of 'VorbisComment's + + public OggFile() { + } + + public HashMap getTags(RandomAccessFile s) throws IOException { + long offset = 0; + int retry = 64; + boolean need_tags = true; + boolean need_id = true; + + HashMap tags = new HashMap(); + HashMap identification = new HashMap(); + + for( ; retry > 0 ; retry-- ) { + PageInfo pi = parse_stream_page(s, offset); + if(pi.type == OGG_TYPE_IDENTIFICATION) { + identification = parse_ogg_vorbis_identification(s, offset+pi.header_len, pi.payload_len); + need_id = false; + } else if(pi.type == OGG_TYPE_COMMENT) { + tags = parse_ogg_vorbis_comment(s, offset+pi.header_len, pi.payload_len); + need_tags = false; + } + offset += pi.header_len + pi.payload_len; + if (need_tags == false && need_id == false) { + break; + } + } + + // Calculate duration in seconds + // Note that this calculation is WRONG: We would have to get the last + // packet to calculate the real length - but this is goot enough. + if (identification.containsKey("bitrate_nominal")) { + int br_nom = (Integer)identification.get("bitrate_nominal") / 8; + long file_length = s.length(); + if (file_length > 0 && br_nom > 0) { + tags.put("duration", (int)(file_length/br_nom)); + } + } + + return tags; + } + + + /** + * Parses the ogg page at offset 'offset' + */ + public PageInfo parse_stream_page(RandomAccessFile s, long offset) throws IOException { + long[] result = new long[3]; // [header_size, payload_size] + byte[] p_header = new byte[OGG_PAGE_SIZE]; // buffer for the page header + byte[] scratch; + int bread = 0; // number of bytes read + int psize = 0; // payload-size + int nsegs = 0; // Number of segments + + s.seek(offset); + bread = s.read(p_header); + if(bread != OGG_PAGE_SIZE) + xdie("Unable to read() OGG_PAGE_HEADER"); + if((new String(p_header, 0, 5)).equals("OggS\0") != true) + xdie("Invalid magic - not an ogg file?"); + + nsegs = b2u(p_header[26]); + // debug("> file seg: "+nsegs); + if(nsegs > 0) { + scratch = new byte[nsegs]; + bread = s.read(scratch); + if(bread != nsegs) + xdie("Failed to read segtable"); + + for(int i=0; i<nsegs; i++) { + psize += b2u(scratch[i]); + } + } + + PageInfo pi = new PageInfo(); + pi.header_len = (s.getFilePointer() - offset); + pi.payload_len = psize; + pi.type = -1; + + /* next byte is most likely the type -> pre-read */ + if(psize >= 1 && s.read(p_header, 0, 1) == 1) { + pi.type = b2u(p_header[0]); + } + + return pi; + } + + /* In 'vorbiscomment' field is prefixed with \3vorbis in OGG files + ** we check that this marker is present and call the generic comment + ** parset with the correct offset (+7) */ + private HashMap parse_ogg_vorbis_comment(RandomAccessFile s, long offset, long pl_len) throws IOException { + final int pfx_len = 7; + byte[] pfx = new byte[pfx_len]; + + if(pl_len < pfx_len) + xdie("ogg vorbis comment field is too short!"); + + s.seek(offset); + s.read(pfx); + + if( (new String(pfx, 0, pfx_len)).equals("\3vorbis") == false ) + xdie("Damaged packet found!"); + + return parse_vorbis_comment(s, this, offset+pfx_len, pl_len-pfx_len); + } + + /* + ** Returns a hashma with parsed vorbis identification header data + **/ + private HashMap parse_ogg_vorbis_identification(RandomAccessFile s, long offset, long pl_len) throws IOException { + /* Structure: + * 7 bytes of \1vorbis + * 4 bytes version + * 1 byte channels + * 4 bytes sampling rate + * 4 bytes bitrate max + * 4 bytes bitrate nominal + * 4 bytes bitrate min + **/ + HashMap id_hash = new HashMap(); + byte[] buff = new byte[28]; + + if(pl_len >= buff.length) { + s.seek(offset); + s.read(buff); + id_hash.put("version" , b2le32(buff, 7)); + id_hash.put("channels" , b2u(buff[11])); + id_hash.put("sampling_rate" , b2le32(buff, 12)); + id_hash.put("bitrate_minimal" , b2le32(buff, 16)); + id_hash.put("bitrate_nominal" , b2le32(buff, 20)); + id_hash.put("bitrate_maximal" , b2le32(buff, 24)); + } + + return id_hash; + } + +}; diff --git a/app/src/main/java/ch/blinkenlights/bastp/OpusFile.java b/app/src/main/java/ch/blinkenlights/bastp/OpusFile.java new file mode 100644 index 0000000..aab01d2 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/bastp/OpusFile.java @@ -0,0 +1,127 @@ +/* + * Copyright (C) 2015 Adrian Ulrich <adrian@blinkenlights.ch> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +package ch.blinkenlights.bastp; + + +import java.io.IOException; +import java.io.RandomAccessFile; +import java.util.HashMap; + + +public class OpusFile extends OggFile { + // A list of tags we are going to ignore in the OpusTags section + public static final String[] FORBIDDEN_TAGS = {"REPLAYGAIN_TRACK_GAIN", "REPLAYGAIN_TRACK_PEAK", "REPLAYGAIN_ALBUM_GAIN", "REPLAYGAIN_ALBUM_PEAK"}; + + public OpusFile() { + } + + public HashMap getTags(RandomAccessFile s) throws IOException { + + // The opus specification is very strict: The first packet MUST + // contain the OpusHeader while the 2nd MUST contain the + // OggHeader payload: https://wiki.xiph.org/OggOpus + long pos = 0; + PageInfo pi = parse_stream_page(s, pos); + + HashMap tags = new HashMap(); + HashMap opus_head = parse_opus_head(s, pos+pi.header_len, pi.payload_len); + pos += pi.header_len+pi.payload_len; + + // Check if we parsed a version number and ensure it doesn't have any + // of the upper 4 bits set (eg: <= 15) + if(opus_head.containsKey("version") && (Integer)opus_head.get("version") <= 0xF) { + // Get next page: The spec requires this to be an OpusTags head + pi = parse_stream_page(s, pos); + tags = parse_opus_vorbis_comment(s, pos+pi.header_len, pi.payload_len); + // ...and merge replay gain intos into the tags map + calculate_gain(opus_head, tags); + } + + return tags; + } + + /** + * Adds replay gain information to the tags hash map + */ + private void calculate_gain(HashMap header, HashMap tags) { + // Remove any unacceptable tags (Opus files must not have + // their own REPLAYGAIN_* fields) + for(String k : FORBIDDEN_TAGS) { + tags.remove(k); + } + // Include the gain value found in the opus header + int header_gain = (Integer)header.get("header_gain"); + addTagEntry(tags, "R128_BASTP_BASE_GAIN", ""+header_gain); + } + + + /** + * Attempts to parse an OpusHead block at given offset. + * Returns an hash-map, will be empty on failure + */ + private HashMap parse_opus_head(RandomAccessFile s, long offset, long pl_len) throws IOException { + /* Structure: + * 8 bytes of 'OpusHead' + * 1 byte version + * 1 byte channel count + * 2 bytes pre skip + * 4 bytes input-sample-rate + * 2 bytes outputGain as Q7.8 + * 1 byte channel map + * --> 19 bytes + */ + + HashMap id_hash = new HashMap(); + byte[] buff = new byte[19]; + if(pl_len >= buff.length) { + s.seek(offset); + s.read(buff); + if((new String(buff, 0, 8)).equals("OpusHead")) { + id_hash.put("version" , b2u(buff[8])); + id_hash.put("channels" , b2u(buff[9])); + id_hash.put("pre_skip" , b2le16(buff, 10)); + id_hash.put("sampling_rate", b2le32(buff, 12)); + id_hash.put("header_gain" , (int)((short)b2le16(buff, 16))); + id_hash.put("channel_map" , b2u(buff[18])); + } + } + + return id_hash; + } + + /** + * Parses an OpusTags section + * Returns a hash map of the found tags + */ + private HashMap parse_opus_vorbis_comment(RandomAccessFile s, long offset, long pl_len) throws IOException { + final int magic_len = 8; // OpusTags + byte[] magic = new byte[magic_len]; + + if(pl_len < magic_len) + xdie("opus comment field is too short!"); + + // Read and check magic signature + s.seek(offset); + s.read(magic); + + if((new String(magic, 0, magic_len)).equals("OpusTags") == false) + xdie("Damaged packet found!"); + + return parse_vorbis_comment(s, this, offset+magic_len, pl_len-magic_len); + } + +} diff --git a/app/src/main/java/ch/blinkenlights/bastp/PageInfo.java b/app/src/main/java/ch/blinkenlights/bastp/PageInfo.java new file mode 100644 index 0000000..3a23522 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/bastp/PageInfo.java @@ -0,0 +1,16 @@ +package ch.blinkenlights.bastp; + +import java.io.IOException; +import java.io.RandomAccessFile; + +public class PageInfo { + + long header_len; + long payload_len; + int type; + boolean last_page; + + public static interface PageParser { + PageInfo parse_stream_page(RandomAccessFile fh, long offset) throws IOException; + } +} diff --git a/app/src/main/java/ch/blinkenlights/bastp/RawFile.java b/app/src/main/java/ch/blinkenlights/bastp/RawFile.java new file mode 100644 index 0000000..fc0df40 --- /dev/null +++ b/app/src/main/java/ch/blinkenlights/bastp/RawFile.java @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2017 Google Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package ch.blinkenlights.bastp; + +import java.io.IOException; +import java.io.RandomAccessFile; +import java.util.HashMap; + +public class RawFile extends Common { + + /** + * Returns the tags of a Raw File which is just an empty HashMap. + * This shall be used for raw streams with no (supported) tags. + */ + public HashMap getTags(RandomAccessFile s) throws IOException { + HashMap tags = new HashMap(); + return tags; + } +} + diff --git a/app/src/main/java/com/mobeta/android/dslv/DragSortController.java b/app/src/main/java/com/mobeta/android/dslv/DragSortController.java new file mode 100644 index 0000000..4345e79 --- /dev/null +++ b/app/src/main/java/com/mobeta/android/dslv/DragSortController.java @@ -0,0 +1,491 @@ +package com.mobeta.android.dslv; + +import android.graphics.Point; +import android.view.GestureDetector; +import android.view.HapticFeedbackConstants; +import android.view.MotionEvent; +import android.view.View; +import android.view.ViewConfiguration; +import android.widget.AdapterView; + +/** + * Class that starts and stops item drags on a {@link DragSortListView} + * based on touch gestures. This class also inherits from + * {@link SimpleFloatViewManager}, which provides basic float View + * creation. + * + * An instance of this class is meant to be passed to the methods + * {@link DragSortListView#setTouchListener()} and + * {@link DragSortListView#setFloatViewManager()} of your + * {@link DragSortListView} instance. + */ +public class DragSortController extends SimpleFloatViewManager implements View.OnTouchListener, GestureDetector.OnGestureListener { + + /** + * Drag init mode enum. + */ + public static final int ON_DOWN = 0; + public static final int ON_DRAG = 1; + public static final int ON_LONG_PRESS = 2; + + private int mDragInitMode = ON_DOWN; + + private boolean mSortEnabled = true; + + /** + * Remove mode enum. + */ + public static final int CLICK_REMOVE = 0; + public static final int FLING_REMOVE = 1; + + /** + * The current remove mode. + */ + private int mRemoveMode; + + private boolean mRemoveEnabled = false; + private boolean mIsRemoving = false; + + private GestureDetector mDetector; + + private GestureDetector mFlingRemoveDetector; + + private int mTouchSlop; + + public static final int MISS = -1; + + private int mHitPos = MISS; + private int mFlingHitPos = MISS; + + private int mClickRemoveHitPos = MISS; + + private int[] mTempLoc = new int[2]; + + private int mItemX; + private int mItemY; + + private int mCurrX; + private int mCurrY; + + private boolean mDragging = false; + + private float mFlingSpeed = 500f; + + private int mDragHandleId; + + private int mClickRemoveId; + + private int mFlingHandleId; + private boolean mCanDrag; + + private DragSortListView mDslv; + private int mPositionX; + + /** + * Class which will receive onTouch events + */ + private View.OnTouchListener mSecondaryOnTouchListener; + + /** + * Calls {@link #DragSortController(DragSortListView, int)} with a + * 0 drag handle id, FLING_RIGHT_REMOVE remove mode, + * and ON_DOWN drag init. By default, sorting is enabled, and + * removal is disabled. + * + * @param dslv The DSLV instance + */ + public DragSortController(DragSortListView dslv) { + this(dslv, 0, ON_DOWN, FLING_REMOVE); + } + + public DragSortController(DragSortListView dslv, int dragHandleId, int dragInitMode, int removeMode) { + this(dslv, dragHandleId, dragInitMode, removeMode, 0); + } + + public DragSortController(DragSortListView dslv, int dragHandleId, int dragInitMode, int removeMode, int clickRemoveId) { + this(dslv, dragHandleId, dragInitMode, removeMode, clickRemoveId, 0); + } + + /** + * By default, sorting is enabled, and removal is disabled. + * + * @param dslv The DSLV instance + * @param dragHandleId The resource id of the View that represents + * the drag handle in a list item. + */ + public DragSortController(DragSortListView dslv, int dragHandleId, int dragInitMode, + int removeMode, int clickRemoveId, int flingHandleId) { + super(dslv); + mDslv = dslv; + mDetector = new GestureDetector(dslv.getContext(), this); + mFlingRemoveDetector = new GestureDetector(dslv.getContext(), mFlingRemoveListener); + mFlingRemoveDetector.setIsLongpressEnabled(false); + mTouchSlop = ViewConfiguration.get(dslv.getContext()).getScaledTouchSlop(); + mDragHandleId = dragHandleId; + mClickRemoveId = clickRemoveId; + mFlingHandleId = flingHandleId; + setRemoveMode(removeMode); + setDragInitMode(dragInitMode); + } + + + public int getDragInitMode() { + return mDragInitMode; + } + + /** + * Set how a drag is initiated. Needs to be one of + * {@link ON_DOWN}, {@link ON_DRAG}, or {@link ON_LONG_PRESS}. + * + * @param mode The drag init mode. + */ + public void setDragInitMode(int mode) { + mDragInitMode = mode; + } + + /** + * Enable/Disable list item sorting. Disabling is useful if only item + * removal is desired. Prevents drags in the vertical direction. + * + * @param enabled Set <code>true</code> to enable list + * item sorting. + */ + public void setSortEnabled(boolean enabled) { + mSortEnabled = enabled; + } + + public boolean isSortEnabled() { + return mSortEnabled; + } + + /** + * One of {@link CLICK_REMOVE}, {@link FLING_RIGHT_REMOVE}, + * {@link FLING_LEFT_REMOVE}, + * {@link SLIDE_RIGHT_REMOVE}, or {@link SLIDE_LEFT_REMOVE}. + */ + public void setRemoveMode(int mode) { + mRemoveMode = mode; + } + + public int getRemoveMode() { + return mRemoveMode; + } + + /** + * Enable/Disable item removal without affecting remove mode. + */ + public void setRemoveEnabled(boolean enabled) { + mRemoveEnabled = enabled; + } + + public boolean isRemoveEnabled() { + return mRemoveEnabled; + } + + /** + * Set the resource id for the View that represents the drag + * handle in a list item. + * + * @param id An android resource id. + */ + public void setDragHandleId(int id) { + mDragHandleId = id; + } + + /** + * Set the resource id for the View that represents the fling + * handle in a list item. + * + * @param id An android resource id. + */ + public void setFlingHandleId(int id) { + mFlingHandleId = id; + } + + /** + * Set the resource id for the View that represents click + * removal button. + * + * @param id An android resource id. + */ + public void setClickRemoveId(int id) { + mClickRemoveId = id; + } + + /** + * Sets flags to restrict certain motions of the floating View + * based on DragSortController settings (such as remove mode). + * Starts the drag on the DragSortListView. + * + * @param position The list item position (includes headers). + * @param deltaX Touch x-coord minus left edge of floating View. + * @param deltaY Touch y-coord minus top edge of floating View. + * + * @return True if drag started, false otherwise. + */ + public boolean startDrag(int position, int deltaX, int deltaY) { + + int dragFlags = 0; + if (mSortEnabled && !mIsRemoving) { + dragFlags |= DragSortListView.DRAG_POS_Y | DragSortListView.DRAG_NEG_Y; + } + if (mRemoveEnabled && mIsRemoving) { + dragFlags |= DragSortListView.DRAG_POS_X; + dragFlags |= DragSortListView.DRAG_NEG_X; + } + + mDragging = mDslv.startDrag(position - mDslv.getHeaderViewsCount(), dragFlags, deltaX, + deltaY); + return mDragging; + } + + @Override + public boolean onTouch(View v, MotionEvent ev) { + if (mSecondaryOnTouchListener != null) { + mSecondaryOnTouchListener.onTouch(v, ev); + } + + if (!mDslv.isDragEnabled() || mDslv.listViewIntercepted()) { + return false; + } + + mDetector.onTouchEvent(ev); + if (mRemoveEnabled && mDragging && mRemoveMode == FLING_REMOVE) { + mFlingRemoveDetector.onTouchEvent(ev); + } + + int action = ev.getAction() & MotionEvent.ACTION_MASK; + switch (action) { + case MotionEvent.ACTION_DOWN: + mCurrX = (int) ev.getX(); + mCurrY = (int) ev.getY(); + break; + case MotionEvent.ACTION_UP: + if (mRemoveEnabled && mIsRemoving) { + int x = mPositionX >= 0 ? mPositionX : -mPositionX; + int removePoint = mDslv.getWidth() / 2; + if (x > removePoint) { + mDslv.stopDragWithVelocity(true, 0); + } + } + case MotionEvent.ACTION_CANCEL: + mIsRemoving = false; + mDragging = false; + break; + } + + return false; + } + + /** + * Overrides to provide fading when slide removal is enabled. + */ + @Override + public void onDragFloatView(View floatView, Point position, Point touch) { + + if (mRemoveEnabled && mIsRemoving) { + mPositionX = position.x; + } + } + + /** + * We consume onTouch events: ALSO dispatch them to the listener + * if requested. + */ + @Override + public void setSecondaryOnTouchListener(View.OnTouchListener l) { + mSecondaryOnTouchListener = l; + } + + /** + * Get the position to start dragging based on the ACTION_DOWN + * MotionEvent. This function simply calls + * {@link #dragHandleHitPosition(MotionEvent)}. Override + * to change drag handle behavior; + * this function is called internally when an ACTION_DOWN + * event is detected. + * + * @param ev The ACTION_DOWN MotionEvent. + * + * @return The list position to drag if a drag-init gesture is + * detected; MISS if unsuccessful. + */ + public int startDragPosition(MotionEvent ev) { + return dragHandleHitPosition(ev); + } + + public int startFlingPosition(MotionEvent ev) { + return mRemoveMode == FLING_REMOVE ? flingHandleHitPosition(ev) : MISS; + } + + /** + * Checks for the touch of an item's drag handle (specified by + * {@link #setDragHandleId(int)}), and returns that item's position + * if a drag handle touch was detected. + * + * @param ev The ACTION_DOWN MotionEvent. + + * @return The list position of the item whose drag handle was + * touched; MISS if unsuccessful. + */ + public int dragHandleHitPosition(MotionEvent ev) { + return viewIdHitPosition(ev, mDragHandleId); + } + + public int flingHandleHitPosition(MotionEvent ev) { + return viewIdHitPosition(ev, mFlingHandleId); + } + + public int viewIdHitPosition(MotionEvent ev, int id) { + final int x = (int) ev.getX(); + final int y = (int) ev.getY(); + + int touchPos = mDslv.pointToPosition(x, y); // includes headers/footers + + final int numHeaders = mDslv.getHeaderViewsCount(); + final int numFooters = mDslv.getFooterViewsCount(); + final int count = mDslv.getCount(); + + // Log.d("mobeta", "touch down on position " + itemnum); + // We're only interested if the touch was on an + // item that's not a header or footer. + if (touchPos != AdapterView.INVALID_POSITION && touchPos >= numHeaders + && touchPos < (count - numFooters)) { + final View item = mDslv.getChildAt(touchPos - mDslv.getFirstVisiblePosition()); + final int rawX = (int) ev.getRawX(); + final int rawY = (int) ev.getRawY(); + + View dragBox = id == 0 ? item : (View) item.findViewById(id); + if (dragBox != null) { + dragBox.getLocationOnScreen(mTempLoc); + + if (rawX > mTempLoc[0] && rawY > mTempLoc[1] && + rawX < mTempLoc[0] + dragBox.getWidth() && + rawY < mTempLoc[1] + dragBox.getHeight()) { + + mItemX = item.getLeft(); + mItemY = item.getTop(); + + return touchPos; + } + } + } + + return MISS; + } + + @Override + public boolean onDown(MotionEvent ev) { + if (mRemoveEnabled && mRemoveMode == CLICK_REMOVE) { + mClickRemoveHitPos = viewIdHitPosition(ev, mClickRemoveId); + } + + mHitPos = startDragPosition(ev); + if (mHitPos != MISS && mDragInitMode == ON_DOWN) { + startDrag(mHitPos, (int) ev.getX() - mItemX, (int) ev.getY() - mItemY); + } + + mIsRemoving = false; + mCanDrag = true; + mPositionX = 0; + mFlingHitPos = startFlingPosition(ev); + + return true; + } + + @Override + public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { + + // Guard against rare case of null MotionEvents on some devices + if (e1 == null || e2 == null) { + return false; + } + + final int x1 = (int) e1.getX(); + final int y1 = (int) e1.getY(); + final int x2 = (int) e2.getX(); + final int y2 = (int) e2.getY(); + final int deltaX = x2 - mItemX; + final int deltaY = y2 - mItemY; + + if (mCanDrag && !mDragging && (mHitPos != MISS || mFlingHitPos != MISS)) { + if (mHitPos != MISS) { + if (mDragInitMode == ON_DRAG && Math.abs(y2 - y1) > mTouchSlop && mSortEnabled) { + startDrag(mHitPos, deltaX, deltaY); + } + else if (mDragInitMode != ON_DOWN && Math.abs(x2 - x1) > mTouchSlop && mRemoveEnabled) + { + mIsRemoving = true; + startDrag(mFlingHitPos, deltaX, deltaY); + } + } else if (mFlingHitPos != MISS) { + if (Math.abs(x2 - x1) > mTouchSlop && mRemoveEnabled) { + mIsRemoving = true; + startDrag(mFlingHitPos, deltaX, deltaY); + } else if (Math.abs(y2 - y1) > mTouchSlop) { + mCanDrag = false; // if started to scroll the list then + // don't allow sorting nor fling-removing + } + } + } + // return whatever + return false; + } + + @Override + public void onLongPress(MotionEvent e) { + // Log.d("mobeta", "lift listener long pressed"); + if (mHitPos != MISS && mDragInitMode == ON_LONG_PRESS) { + mDslv.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + startDrag(mHitPos, mCurrX - mItemX, mCurrY - mItemY); + } + } + + // complete the OnGestureListener interface + @Override + public final boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { + return false; + } + + // complete the OnGestureListener interface + @Override + public boolean onSingleTapUp(MotionEvent ev) { + if (mRemoveEnabled && mRemoveMode == CLICK_REMOVE) { + if (mClickRemoveHitPos != MISS) { + mDslv.removeItem(mClickRemoveHitPos - mDslv.getHeaderViewsCount()); + } + } + return true; + } + + // complete the OnGestureListener interface + @Override + public void onShowPress(MotionEvent ev) { + // do nothing + } + + private GestureDetector.OnGestureListener mFlingRemoveListener = + new GestureDetector.SimpleOnGestureListener() { + @Override + public final boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, + float velocityY) { + // Log.d("mobeta", "on fling remove called"); + if (mRemoveEnabled && mIsRemoving) { + int w = mDslv.getWidth(); + int minPos = w / 5; + if (velocityX > mFlingSpeed) { + if (mPositionX > -minPos) { + mDslv.stopDragWithVelocity(true, velocityX); + } + } else if (velocityX < -mFlingSpeed) { + if (mPositionX < minPos) { + mDslv.stopDragWithVelocity(true, velocityX); + } + } + mIsRemoving = false; + } + return false; + } + }; + +} diff --git a/app/src/main/java/com/mobeta/android/dslv/DragSortCursorAdapter.java b/app/src/main/java/com/mobeta/android/dslv/DragSortCursorAdapter.java new file mode 100644 index 0000000..52413bb --- /dev/null +++ b/app/src/main/java/com/mobeta/android/dslv/DragSortCursorAdapter.java @@ -0,0 +1,241 @@ +package com.mobeta.android.dslv; + +import java.util.ArrayList; + +import android.content.Context; +import android.database.Cursor; +import android.util.SparseIntArray; +import android.view.View; +import android.view.ViewGroup; +import android.widget.CursorAdapter; + + +/** + * A subclass of {@link android.widget.CursorAdapter} that provides + * reordering of the elements in the Cursor based on completed + * drag-sort operations. The reordering is a simple mapping of + * list positions into Cursor positions (the Cursor is unchanged). + * To persist changes made by drag-sorts, one can retrieve the + * mapping with the {@link #getCursorPositions()} method, which + * returns the reordered list of Cursor positions. + * + * An instance of this class is passed + * to {@link DragSortListView#setAdapter(ListAdapter)} and, since + * this class implements the {@link DragSortListView.DragSortListener} + * interface, it is automatically set as the DragSortListener for + * the DragSortListView instance. + */ +public abstract class DragSortCursorAdapter extends CursorAdapter implements DragSortListView.DragSortListener { + + public static final int REMOVED = -1; + + /** + * Key is ListView position, value is Cursor position + */ + private SparseIntArray mListMapping = new SparseIntArray(); + + private ArrayList<Integer> mRemovedCursorPositions = new ArrayList<Integer>(); + + public DragSortCursorAdapter(Context context, Cursor c) { + super(context, c); + } + + public DragSortCursorAdapter(Context context, Cursor c, boolean autoRequery) { + super(context, c, autoRequery); + } + + public DragSortCursorAdapter(Context context, Cursor c, int flags) { + super(context, c, flags); + } + + /** + * Swaps Cursor and clears list-Cursor mapping. + * + * @see android.widget.CursorAdapter#swapCursor(android.database.Cursor) + */ + @Override + public Cursor swapCursor(Cursor newCursor) { + Cursor old = super.swapCursor(newCursor); + resetMappings(); + return old; + } + + /** + * Changes Cursor and clears list-Cursor mapping. + * + * @see android.widget.CursorAdapter#changeCursor(android.database.Cursor) + */ + @Override + public void changeCursor(Cursor cursor) { + super.changeCursor(cursor); + resetMappings(); + } + + /** + * Resets list-cursor mapping. + */ + public void reset() { + resetMappings(); + notifyDataSetChanged(); + } + + private void resetMappings() { + mListMapping.clear(); + mRemovedCursorPositions.clear(); + } + + @Override + public Object getItem(int position) { + return super.getItem(mListMapping.get(position, position)); + } + + @Override + public long getItemId(int position) { + return super.getItemId(mListMapping.get(position, position)); + } + + @Override + public View getDropDownView(int position, View convertView, ViewGroup parent) { + return super.getDropDownView(mListMapping.get(position, position), convertView, parent); + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + return super.getView(mListMapping.get(position, position), convertView, parent); + } + + /** + * On drop, this updates the mapping between Cursor positions + * and ListView positions. The Cursor is unchanged. Retrieve + * the current mapping with {@link getCursorPositions()}. + * + * @see DragSortListView.DropListener#drop(int, int) + */ + @Override + public void drop(int from, int to) { + if (from != to) { + int cursorFrom = mListMapping.get(from, from); + + if (from > to) { + for (int i = from; i > to; --i) { + mListMapping.put(i, mListMapping.get(i - 1, i - 1)); + } + } else { + for (int i = from; i < to; ++i) { + mListMapping.put(i, mListMapping.get(i + 1, i + 1)); + } + } + mListMapping.put(to, cursorFrom); + + cleanMapping(); + notifyDataSetChanged(); + } + } + + /** + * On remove, this updates the mapping between Cursor positions + * and ListView positions. The Cursor is unchanged. Retrieve + * the current mapping with {@link getCursorPositions()}. + * + * @see DragSortListView.RemoveListener#remove(int) + */ + @Override + public void remove(int which) { + int cursorPos = mListMapping.get(which, which); + if (!mRemovedCursorPositions.contains(cursorPos)) { + mRemovedCursorPositions.add(cursorPos); + } + + int newCount = getCount(); + for (int i = which; i < newCount; ++i) { + mListMapping.put(i, mListMapping.get(i + 1, i + 1)); + } + + mListMapping.delete(newCount); + + cleanMapping(); + notifyDataSetChanged(); + } + + /** + * Does nothing. Just completes DragSortListener interface. + */ + @Override + public void drag(int from, int to) { + // do nothing + } + + /** + * Remove unnecessary mappings from sparse array. + */ + private void cleanMapping() { + ArrayList<Integer> toRemove = new ArrayList<Integer>(); + + int size = mListMapping.size(); + for (int i = 0; i < size; ++i) { + if (mListMapping.keyAt(i) == mListMapping.valueAt(i)) { + toRemove.add(mListMapping.keyAt(i)); + } + } + + size = toRemove.size(); + for (int i = 0; i < size; ++i) { + mListMapping.delete(toRemove.get(i)); + } + } + + @Override + public int getCount() { + return super.getCount() - mRemovedCursorPositions.size(); + } + + /** + * Get the Cursor position mapped to by the provided list position + * (given all previously handled drag-sort + * operations). + * + * @param position List position + * + * @return The mapped-to Cursor position + */ + public int getCursorPosition(int position) { + return mListMapping.get(position, position); + } + + /** + * Get the current order of Cursor positions presented by the + * list. + */ + public ArrayList<Integer> getCursorPositions() { + ArrayList<Integer> result = new ArrayList<Integer>(); + + for (int i = 0; i < getCount(); ++i) { + result.add(mListMapping.get(i, i)); + } + + return result; + } + + /** + * Get the list position mapped to by the provided Cursor position. + * If the provided Cursor position has been removed by a drag-sort, + * this returns {@link #REMOVED}. + * + * @param cursorPosition A Cursor position + * @return The mapped-to list position or REMOVED + */ + public int getListPosition(int cursorPosition) { + if (mRemovedCursorPositions.contains(cursorPosition)) { + return REMOVED; + } + + int index = mListMapping.indexOfValue(cursorPosition); + if (index < 0) { + return cursorPosition; + } else { + return mListMapping.keyAt(index); + } + } + + +} diff --git a/app/src/main/java/com/mobeta/android/dslv/DragSortItemView.java b/app/src/main/java/com/mobeta/android/dslv/DragSortItemView.java new file mode 100644 index 0000000..cef7b82 --- /dev/null +++ b/app/src/main/java/com/mobeta/android/dslv/DragSortItemView.java @@ -0,0 +1,100 @@ +package com.mobeta.android.dslv; + +import android.content.Context; +import android.view.Gravity; +import android.view.View; +import android.view.View.MeasureSpec; +import android.view.ViewGroup; +import android.widget.AbsListView; +import android.util.Log; + +/** + * Lightweight ViewGroup that wraps list items obtained from user's + * ListAdapter. ItemView expects a single child that has a definite + * height (i.e. the child's layout height is not MATCH_PARENT). + * The width of + * ItemView will always match the width of its child (that is, + * the width MeasureSpec given to ItemView is passed directly + * to the child, and the ItemView measured width is set to the + * child's measured width). The height of ItemView can be anything; + * the + * + * + * The purpose of this class is to optimize slide + * shuffle animations. + */ +public class DragSortItemView extends ViewGroup { + + private int mGravity = Gravity.TOP; + + public DragSortItemView(Context context) { + super(context); + + // always init with standard ListView layout params + setLayoutParams(new AbsListView.LayoutParams( + ViewGroup.LayoutParams.FILL_PARENT, + ViewGroup.LayoutParams.WRAP_CONTENT)); + + //setClipChildren(true); + } + + public void setGravity(int gravity) { + mGravity = gravity; + } + + public int getGravity() { + return mGravity; + } + + @Override + protected void onLayout(boolean changed, int left, int top, int right, int bottom) { + final View child = getChildAt(0); + + if (child == null) { + return; + } + + if (mGravity == Gravity.TOP) { + child.layout(0, 0, getMeasuredWidth(), child.getMeasuredHeight()); + } else { + child.layout(0, getMeasuredHeight() - child.getMeasuredHeight(), getMeasuredWidth(), getMeasuredHeight()); + } + } + + /** + * + */ + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + + int height = MeasureSpec.getSize(heightMeasureSpec); + int width = MeasureSpec.getSize(widthMeasureSpec); + + int heightMode = MeasureSpec.getMode(heightMeasureSpec); + + final View child = getChildAt(0); + if (child == null) { + setMeasuredDimension(0, width); + return; + } + + if (child.isLayoutRequested()) { + // Always let child be as tall as it wants. + measureChild(child, widthMeasureSpec, + MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED)); + } + + if (heightMode == MeasureSpec.UNSPECIFIED) { + ViewGroup.LayoutParams lp = getLayoutParams(); + + if (lp.height > 0) { + height = lp.height; + } else { + height = child.getMeasuredHeight(); + } + } + + setMeasuredDimension(width, height); + } + +} diff --git a/app/src/main/java/com/mobeta/android/dslv/DragSortItemViewCheckable.java b/app/src/main/java/com/mobeta/android/dslv/DragSortItemViewCheckable.java new file mode 100644 index 0000000..27d612e --- /dev/null +++ b/app/src/main/java/com/mobeta/android/dslv/DragSortItemViewCheckable.java @@ -0,0 +1,55 @@ +package com.mobeta.android.dslv; + +import android.content.Context; +import android.view.Gravity; +import android.view.View; +import android.view.View.MeasureSpec; +import android.view.ViewGroup; +import android.widget.AbsListView; +import android.widget.Checkable; +import android.util.Log; + +/** + * Lightweight ViewGroup that wraps list items obtained from user's + * ListAdapter. ItemView expects a single child that has a definite + * height (i.e. the child's layout height is not MATCH_PARENT). + * The width of + * ItemView will always match the width of its child (that is, + * the width MeasureSpec given to ItemView is passed directly + * to the child, and the ItemView measured width is set to the + * child's measured width). The height of ItemView can be anything; + * the + * + * + * The purpose of this class is to optimize slide + * shuffle animations. + */ +public class DragSortItemViewCheckable extends DragSortItemView implements Checkable { + + public DragSortItemViewCheckable(Context context) { + super(context); + } + + @Override + public boolean isChecked() { + View child = getChildAt(0); + if (child instanceof Checkable) + return ((Checkable) child).isChecked(); + else + return false; + } + + @Override + public void setChecked(boolean checked) { + View child = getChildAt(0); + if (child instanceof Checkable) + ((Checkable) child).setChecked(checked); + } + + @Override + public void toggle() { + View child = getChildAt(0); + if (child instanceof Checkable) + ((Checkable) child).toggle(); + } +} diff --git a/app/src/main/java/com/mobeta/android/dslv/DragSortListView.java b/app/src/main/java/com/mobeta/android/dslv/DragSortListView.java new file mode 100644 index 0000000..f3b747f --- /dev/null +++ b/app/src/main/java/com/mobeta/android/dslv/DragSortListView.java @@ -0,0 +1,3093 @@ +/* + * DragSortListView. + * + * A subclass of the Android ListView component that enables drag + * and drop re-ordering of list items. + * + * Copyright 2012 Carl Bauer + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.mobeta.android.dslv; + +import android.content.Context; +import android.content.res.TypedArray; +import android.database.DataSetObserver; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Point; +import android.graphics.drawable.Drawable; +import android.os.Environment; +import android.os.SystemClock; +import android.util.AttributeSet; +import android.util.Log; +import android.util.SparseBooleanArray; +import android.util.SparseIntArray; +import android.view.Gravity; +import android.view.MotionEvent; +import android.view.View; +import android.view.ViewGroup; +import android.widget.AbsListView; +import android.widget.BaseAdapter; +import android.widget.Checkable; +import android.widget.ListAdapter; +import android.widget.ListView; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.util.ArrayList; + +import ch.blinkenlights.android.vanilla.R; + +/** + * ListView subclass that mediates drag and drop resorting of items. + * + * + * @author heycosmo + * + */ +public class DragSortListView extends ListView { + + + /** + * The View that floats above the ListView and represents + * the dragged item. + */ + private View mFloatView; + + /** + * The float View location. First based on touch location + * and given deltaX and deltaY. Then restricted by callback + * to FloatViewManager.onDragFloatView(). Finally restricted + * by bounds of DSLV. + */ + private Point mFloatLoc = new Point(); + + private Point mTouchLoc = new Point(); + + /** + * The middle (in the y-direction) of the floating View. + */ + private int mFloatViewMid; + + /** + * Flag to make sure float View isn't measured twice + */ + private boolean mFloatViewOnMeasured = false; + + /** + * Watch the Adapter for data changes. Cancel a drag if + * coincident with a change. + */ + private DataSetObserver mObserver; + + /** + * Transparency for the floating View (XML attribute). + */ + private float mFloatAlpha = 1.0f; + private float mCurrFloatAlpha = 1.0f; + + /** + * While drag-sorting, the current position of the floating + * View. If dropped, the dragged item will land in this position. + */ + private int mFloatPos; + + /** + * The first expanded ListView position that helps represent + * the drop slot tracking the floating View. + */ + private int mFirstExpPos; + + /** + * The second expanded ListView position that helps represent + * the drop slot tracking the floating View. This can equal + * mFirstExpPos if there is no slide shuffle occurring; otherwise + * it is equal to mFirstExpPos + 1. + */ + private int mSecondExpPos; + + /** + * Flag set if slide shuffling is enabled. + */ + private boolean mAnimate = false; + + /** + * The user dragged from this position. + */ + private int mSrcPos; + + /** + * Offset (in x) within the dragged item at which the user + * picked it up (or first touched down with the digitalis). + */ + private int mDragDeltaX; + + /** + * Offset (in y) within the dragged item at which the user + * picked it up (or first touched down with the digitalis). + */ + private int mDragDeltaY; + + + /** + * The difference (in x) between screen coordinates and coordinates + * in this view. + */ + private int mOffsetX; + + /** + * The difference (in y) between screen coordinates and coordinates + * in this view. + */ + private int mOffsetY; + + /** + * A listener that receives callbacks whenever the floating View + * hovers over a new position. + */ + private DragListener mDragListener; + + /** + * A listener that receives a callback when the floating View + * is dropped. + */ + private DropListener mDropListener; + + /** + * A listener that receives a callback when the floating View + * (or more precisely the originally dragged item) is removed + * by one of the provided gestures. + */ + private RemoveListener mRemoveListener; + + /** + * Enable/Disable item dragging + * + * @attr name dslv:drag_enabled + */ + private boolean mDragEnabled = true; + + /** + * Drag state enum. + */ + private final static int IDLE = 0; + private final static int REMOVING = 1; + private final static int DROPPING = 2; + private final static int STOPPED = 3; + private final static int DRAGGING = 4; + + private int mDragState = IDLE; + + /** + * Height in pixels to which the originally dragged item + * is collapsed during a drag-sort. Currently, this value + * must be greater than zero. + */ + private int mItemHeightCollapsed = 1; + + /** + * Height of the floating View. Stored for the purpose of + * providing the tracking drop slot. + */ + private int mFloatViewHeight; + + /** + * Convenience member. See above. + */ + private int mFloatViewHeightHalf; + + /** + * Save the given width spec for use in measuring children + */ + private int mWidthMeasureSpec = 0; + + /** + * Sample Views ultimately used for calculating the height + * of ListView items that are off-screen. + */ + private View[] mSampleViewTypes = new View[1]; + + /** + * Drag-scroll encapsulator! + */ + private DragScroller mDragScroller; + + /** + * Determines the start of the upward drag-scroll region + * at the top of the ListView. Specified by a fraction + * of the ListView height, thus screen resolution agnostic. + */ + private float mDragUpScrollStartFrac = 1.0f / 3.0f; + + /** + * Determines the start of the downward drag-scroll region + * at the bottom of the ListView. Specified by a fraction + * of the ListView height, thus screen resolution agnostic. + */ + private float mDragDownScrollStartFrac = 1.0f / 3.0f; + + /** + * The following are calculated from the above fracs. + */ + private int mUpScrollStartY; + private int mDownScrollStartY; + private float mDownScrollStartYF; + private float mUpScrollStartYF; + + /** + * Calculated from above above and current ListView height. + */ + private float mDragUpScrollHeight; + + /** + * Calculated from above above and current ListView height. + */ + private float mDragDownScrollHeight; + + /** + * Maximum drag-scroll speed in pixels per ms. Only used with + * default linear drag-scroll profile. + */ + private float mMaxScrollSpeed = 0.5f; + + /** + * Defines the scroll speed during a drag-scroll. User can + * provide their own; this default is a simple linear profile + * where scroll speed increases linearly as the floating View + * nears the top/bottom of the ListView. + */ + private DragScrollProfile mScrollProfile = new DragScrollProfile() { + @Override + public float getSpeed(float w, long t) { + return mMaxScrollSpeed * w; + } + }; + + /** + * Current touch x. + */ + private int mX; + + /** + * Current touch y. + */ + private int mY; + + /** + * Last touch x. + */ + private int mLastX; + + /** + * Last touch y. + */ + private int mLastY; + + /** + * The touch y-coord at which drag started + */ + private int mDragStartY; + + /** + * Drag flag bit. Floating View can move in the positive + * x direction. + */ + public final static int DRAG_POS_X = 0x1; + + /** + * Drag flag bit. Floating View can move in the negative + * x direction. + */ + public final static int DRAG_NEG_X = 0x2; + + /** + * Drag flag bit. Floating View can move in the positive + * y direction. This is subtle. What this actually means is + * that, if enabled, the floating View can be dragged below its starting + * position. Remove in favor of upper-bounding item position? + */ + public final static int DRAG_POS_Y = 0x4; + + /** + * Drag flag bit. Floating View can move in the negative + * y direction. This is subtle. What this actually means is + * that the floating View can be dragged above its starting + * position. Remove in favor of lower-bounding item position? + */ + public final static int DRAG_NEG_Y = 0x8; + + /** + * Flags that determine limits on the motion of the + * floating View. See flags above. + */ + private int mDragFlags = 0; + + /** + * Last call to an on*TouchEvent was a call to + * onInterceptTouchEvent. + */ + private boolean mLastCallWasIntercept = false; + + /** + * A touch event is in progress. + */ + private boolean mInTouchEvent = false; + + /** + * Let the user customize the floating View. + */ + private FloatViewManager mFloatViewManager = null; + + /** + * Given to ListView to cancel its action when a drag-sort + * begins. + */ + private MotionEvent mCancelEvent; + + /** + * Enum telling where to cancel the ListView action when a + * drag-sort begins + */ + private static final int NO_CANCEL = 0; + private static final int ON_TOUCH_EVENT = 1; + private static final int ON_INTERCEPT_TOUCH_EVENT = 2; + + /** + * Where to cancel the ListView action when a + * drag-sort begins + */ + private int mCancelMethod = NO_CANCEL; + + /** + * Determines when a slide shuffle animation starts. That is, + * defines how close to the edge of the drop slot the floating + * View must be to initiate the slide. + */ + private float mSlideRegionFrac = 0.25f; + + /** + * Number between 0 and 1 indicating the relative location of + * a sliding item (only used if drag-sort animations + * are turned on). Nearly 1 means the item is + * at the top of the slide region (nearly full blank item + * is directly below). + */ + private float mSlideFrac = 0.0f; + + /** + * Wraps the user-provided ListAdapter. This is used to wrap each + * item View given by the user inside another View (currenly + * a RelativeLayout) which + * expands and collapses to simulate the item shuffling. + */ + private AdapterWrapper mAdapterWrapper; + + /** + * Turn on custom debugger. + */ + private boolean mTrackDragSort = false; + + /** + * Debugging class. + */ + private DragSortTracker mDragSortTracker; + + /** + * Needed for adjusting item heights from within layoutChildren + */ + private boolean mBlockLayoutRequests = false; + + /** + * Set to true when a down event happens during drag sort; + * for example, when drag finish animations are + * playing. + */ + private boolean mIgnoreTouchEvent = false; + + /** + * Caches DragSortItemView child heights. Sometimes DSLV has to + * know the height of an offscreen item. Since ListView virtualizes + * these, DSLV must get the item from the ListAdapter to obtain + * its height. That process can be expensive, but often the same + * offscreen item will be requested many times in a row. Once an + * offscreen item height is calculated, we cache it in this guy. + * Actually, we cache the height of the child of the + * DragSortItemView since the item height changes often during a + * drag-sort. + */ + private static final int sCacheSize = 3; + private HeightCache mChildHeightCache = new HeightCache(sCacheSize); + + private RemoveAnimator mRemoveAnimator; + + private LiftAnimator mLiftAnimator; + + private DropAnimator mDropAnimator; + + private boolean mUseRemoveVelocity; + private float mRemoveVelocityX = 0; + + public DragSortListView(Context context, AttributeSet attrs) { + super(context, attrs); + + int defaultDuration = 150; + int removeAnimDuration = defaultDuration; // ms + int dropAnimDuration = defaultDuration; // ms + + if (attrs != null) { + TypedArray a = getContext().obtainStyledAttributes(attrs, + R.styleable.DragSortListView, 0, 0); + + mItemHeightCollapsed = Math.max(1, a.getDimensionPixelSize( + R.styleable.DragSortListView_collapsed_height, 1)); + + mTrackDragSort = a.getBoolean( + R.styleable.DragSortListView_track_drag_sort, false); + + if (mTrackDragSort) { + mDragSortTracker = new DragSortTracker(); + } + + // alpha between 0 and 255, 0=transparent, 255=opaque + mFloatAlpha = a.getFloat(R.styleable.DragSortListView_float_alpha, mFloatAlpha); + mCurrFloatAlpha = mFloatAlpha; + + mDragEnabled = a.getBoolean(R.styleable.DragSortListView_drag_enabled, mDragEnabled); + + mSlideRegionFrac = Math.max(0.0f, + Math.min(1.0f, 1.0f - a.getFloat( + R.styleable.DragSortListView_slide_shuffle_speed, + 0.75f))); + + mAnimate = mSlideRegionFrac > 0.0f; + + float frac = a.getFloat( + R.styleable.DragSortListView_drag_scroll_start, + mDragUpScrollStartFrac); + + setDragScrollStart(frac); + + mMaxScrollSpeed = a.getFloat( + R.styleable.DragSortListView_max_drag_scroll_speed, + mMaxScrollSpeed); + + removeAnimDuration = a.getInt( + R.styleable.DragSortListView_remove_animation_duration, + removeAnimDuration); + + dropAnimDuration = a.getInt( + R.styleable.DragSortListView_drop_animation_duration, + dropAnimDuration); + + boolean useDefault = a.getBoolean( + R.styleable.DragSortListView_use_default_controller, + true); + + if (useDefault) { + boolean removeEnabled = a.getBoolean( + R.styleable.DragSortListView_remove_enabled, + false); + int removeMode = a.getInt( + R.styleable.DragSortListView_remove_mode, + DragSortController.FLING_REMOVE); + boolean sortEnabled = a.getBoolean( + R.styleable.DragSortListView_sort_enabled, + true); + int dragInitMode = a.getInt( + R.styleable.DragSortListView_drag_start_mode, + DragSortController.ON_DOWN); + int dragHandleId = a.getResourceId( + R.styleable.DragSortListView_drag_handle_id, + 0); + int flingHandleId = a.getResourceId( + R.styleable.DragSortListView_fling_handle_id, + 0); + int clickRemoveId = a.getResourceId( + R.styleable.DragSortListView_click_remove_id, + 0); + int bgColor = a.getColor( + R.styleable.DragSortListView_float_background_color, + Color.BLACK); + + DragSortController controller = new DragSortController( + this, dragHandleId, dragInitMode, removeMode, + clickRemoveId, flingHandleId); + controller.setRemoveEnabled(removeEnabled); + controller.setSortEnabled(sortEnabled); + controller.setBackgroundColor(bgColor); + + mFloatViewManager = controller; + // must register this on ListView (super), not 'this'. + super.setOnTouchListener(controller); + } + + a.recycle(); + } + + mDragScroller = new DragScroller(); + + float smoothness = 0.5f; + if (removeAnimDuration > 0) { + mRemoveAnimator = new RemoveAnimator(smoothness, removeAnimDuration); + } + // mLiftAnimator = new LiftAnimator(smoothness, 100); + if (dropAnimDuration > 0) { + mDropAnimator = new DropAnimator(smoothness, dropAnimDuration); + } + + mCancelEvent = MotionEvent.obtain(0, 0, MotionEvent.ACTION_CANCEL, 0f, 0f, 0f, 0f, 0, 0f, + 0f, 0, 0); + + // construct the dataset observer + mObserver = new DataSetObserver() { + private void cancel() { + if (mDragState == DRAGGING) { + cancelDrag(); + } + } + + @Override + public void onChanged() { + cancel(); + } + + @Override + public void onInvalidated() { + cancel(); + } + }; + } + + /** + * DragSortListView registers the the controler as an onTouch listener. + * We implement this method to ensure that users of this listview can also + * register their own onTouch listener without disabling our own registration. + */ + @Override + public void setOnTouchListener(View.OnTouchListener l) { + if (mFloatViewManager != null) { + mFloatViewManager.setSecondaryOnTouchListener(l); + } + } + + /** + * Usually called from a FloatViewManager. The float alpha + * will be reset to the xml-defined value every time a drag + * is stopped. + */ + public void setFloatAlpha(float alpha) { + mCurrFloatAlpha = alpha; + } + + public float getFloatAlpha() { + return mCurrFloatAlpha; + } + + /** + * Set maximum drag scroll speed in positions/second. Only applies + * if using default ScrollSpeedProfile. + * + * @param max Maximum scroll speed. + */ + public void setMaxScrollSpeed(float max) { + mMaxScrollSpeed = max; + } + + /** + * For each DragSortListView Listener interface implemented by + * <code>adapter</code>, this method calls the appropriate + * set*Listener method with <code>adapter</code> as the argument. + * + * @param adapter The ListAdapter providing data to back + * DragSortListView. + * + * @see android.widget.ListView#setAdapter(android.widget.ListAdapter) + */ + @Override + public void setAdapter(ListAdapter adapter) { + if (adapter != null) { + mAdapterWrapper = new AdapterWrapper(adapter); + adapter.registerDataSetObserver(mObserver); + + if (adapter instanceof DropListener) { + setDropListener((DropListener) adapter); + } + if (adapter instanceof DragListener) { + setDragListener((DragListener) adapter); + } + if (adapter instanceof RemoveListener) { + setRemoveListener((RemoveListener) adapter); + } + } else { + mAdapterWrapper = null; + } + + super.setAdapter(mAdapterWrapper); + } + + /** + * As opposed to {@link ListView#getAdapter()}, which returns + * a heavily wrapped ListAdapter (DragSortListView wraps the + * input ListAdapter {\emph and} ListView wraps the wrapped one). + * + * @return The ListAdapter set as the argument of {@link setAdapter()} + */ + public ListAdapter getInputAdapter() { + if (mAdapterWrapper == null) { + return null; + } else { + return mAdapterWrapper.getAdapter(); + } + } + + private class AdapterWrapper extends BaseAdapter { + private ListAdapter mAdapter; + + public AdapterWrapper(ListAdapter adapter) { + super(); + mAdapter = adapter; + + mAdapter.registerDataSetObserver(new DataSetObserver() { + public void onChanged() { + notifyDataSetChanged(); + } + + public void onInvalidated() { + notifyDataSetInvalidated(); + } + }); + } + + public ListAdapter getAdapter() { + return mAdapter; + } + + @Override + public long getItemId(int position) { + return mAdapter.getItemId(position); + } + + @Override + public Object getItem(int position) { + return mAdapter.getItem(position); + } + + @Override + public int getCount() { + return mAdapter.getCount(); + } + + @Override + public boolean areAllItemsEnabled() { + return mAdapter.areAllItemsEnabled(); + } + + @Override + public boolean isEnabled(int position) { + return mAdapter.isEnabled(position); + } + + @Override + public int getItemViewType(int position) { + return mAdapter.getItemViewType(position); + } + + @Override + public int getViewTypeCount() { + return mAdapter.getViewTypeCount(); + } + + @Override + public boolean hasStableIds() { + return mAdapter.hasStableIds(); + } + + @Override + public boolean isEmpty() { + return mAdapter.isEmpty(); + } + + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + + DragSortItemView v; + View child; + // Log.d("mobeta", + // "getView: position="+position+" convertView="+convertView); + if (convertView != null) { + v = (DragSortItemView) convertView; + View oldChild = v.getChildAt(0); + + child = mAdapter.getView(position, oldChild, DragSortListView.this); + if (child != oldChild) { + // shouldn't get here if user is reusing convertViews + // properly + if (oldChild != null) { + v.removeViewAt(0); + } + v.addView(child); + } + } else { + child = mAdapter.getView(position, null, DragSortListView.this); + if (child instanceof Checkable) { + v = new DragSortItemViewCheckable(getContext()); + } else { + v = new DragSortItemView(getContext()); + } + v.setLayoutParams(new AbsListView.LayoutParams( + ViewGroup.LayoutParams.FILL_PARENT, + ViewGroup.LayoutParams.WRAP_CONTENT)); + v.addView(child); + } + + // Set the correct item height given drag state; passed + // View needs to be measured if measurement is required. + adjustItem(position + getHeaderViewsCount(), v, true); + + return v; + } + } + + private void drawDivider(int expPosition, Canvas canvas) { + + final Drawable divider = getDivider(); + final int dividerHeight = getDividerHeight(); + // Log.d("mobeta", "div="+divider+" divH="+dividerHeight); + + if (divider != null && dividerHeight != 0) { + final ViewGroup expItem = (ViewGroup) getChildAt(expPosition + - getFirstVisiblePosition()); + if (expItem != null) { + final int l = getPaddingLeft(); + final int r = getWidth() - getPaddingRight(); + final int t; + final int b; + + final int childHeight = expItem.getChildAt(0).getHeight(); + + if (expPosition > mSrcPos) { + t = expItem.getTop() + childHeight; + b = t + dividerHeight; + } else { + b = expItem.getBottom() - childHeight; + t = b - dividerHeight; + } + // Log.d("mobeta", "l="+l+" t="+t+" r="+r+" b="+b); + + // Have to clip to support ColorDrawable on <= Gingerbread + canvas.save(); + canvas.clipRect(l, t, r, b); + divider.setBounds(l, t, r, b); + divider.draw(canvas); + canvas.restore(); + } + } + } + + @Override + protected void dispatchDraw(Canvas canvas) { + super.dispatchDraw(canvas); + + if (mDragState != IDLE) { + // draw the divider over the expanded item + if (mFirstExpPos != mSrcPos) { + drawDivider(mFirstExpPos, canvas); + } + if (mSecondExpPos != mFirstExpPos && mSecondExpPos != mSrcPos) { + drawDivider(mSecondExpPos, canvas); + } + } + + if (mFloatView != null) { + // draw the float view over everything + final int w = mFloatView.getWidth(); + final int h = mFloatView.getHeight(); + + int x = mFloatLoc.x; + + int width = getWidth(); + if (x < 0) + x = -x; + float alphaMod; + if (x < width) { + alphaMod = ((float) (width - x)) / ((float) width); + alphaMod *= alphaMod; + } else { + alphaMod = 0; + } + + final int alpha = (int) (255f * mCurrFloatAlpha * alphaMod); + + canvas.save(); + // Log.d("mobeta", "clip rect bounds: " + canvas.getClipBounds()); + canvas.translate(mFloatLoc.x, mFloatLoc.y); + canvas.clipRect(0, 0, w, h); + + // Log.d("mobeta", "clip rect bounds: " + canvas.getClipBounds()); + canvas.saveLayerAlpha(0, 0, w, h, alpha, Canvas.ALL_SAVE_FLAG); + mFloatView.draw(canvas); + canvas.restore(); + canvas.restore(); + } + } + + private int getItemHeight(int position) { + View v = getChildAt(position - getFirstVisiblePosition()); + + if (v != null) { + // item is onscreen, just get the height of the View + return v.getHeight(); + } else { + // item is offscreen. get child height and calculate + // item height based on current shuffle state + return calcItemHeight(position, getChildHeight(position)); + } + } + + private void printPosData() { + Log.d("mobeta", "mSrcPos=" + mSrcPos + " mFirstExpPos=" + mFirstExpPos + " mSecondExpPos=" + + mSecondExpPos); + } + + private class HeightCache { + + private SparseIntArray mMap; + private ArrayList<Integer> mOrder; + private int mMaxSize; + + public HeightCache(int size) { + mMap = new SparseIntArray(size); + mOrder = new ArrayList<Integer>(size); + mMaxSize = size; + } + + /** + * Add item height at position if doesn't already exist. + */ + public void add(int position, int height) { + int currHeight = mMap.get(position, -1); + if (currHeight != height) { + if (currHeight == -1) { + if (mMap.size() == mMaxSize) { + // remove oldest entry + mMap.delete(mOrder.remove(0)); + } + } else { + // move position to newest slot + mOrder.remove((Integer) position); + } + mMap.put(position, height); + mOrder.add(position); + } + } + + public int get(int position) { + return mMap.get(position, -1); + } + + public void clear() { + mMap.clear(); + mOrder.clear(); + } + + } + + /** + * Get the shuffle edge for item at position when top of + * item is at y-coord top. Assumes that current item heights + * are consistent with current float view location and + * thus expanded positions and slide fraction. i.e. Should not be + * called between update of expanded positions/slide fraction + * and layoutChildren. + * + * @param position + * @param top + * @param height Height of item at position. If -1, this function + * calculates this height. + * + * @return Shuffle line between position-1 and position (for + * the given view of the list; that is, for when top of item at + * position has y-coord of given `top`). If + * floating View (treated as horizontal line) is dropped + * immediately above this line, it lands in position-1. If + * dropped immediately below this line, it lands in position. + */ + private int getShuffleEdge(int position, int top) { + + final int numHeaders = getHeaderViewsCount(); + final int numFooters = getFooterViewsCount(); + + // shuffle edges are defined between items that can be + // dragged; there are N-1 of them if there are N draggable + // items. + + if (position <= numHeaders || (position >= getCount() - numFooters)) { + return top; + } + + int divHeight = getDividerHeight(); + + int edge; + + int maxBlankHeight = mFloatViewHeight - mItemHeightCollapsed; + int childHeight = getChildHeight(position); + int itemHeight = getItemHeight(position); + + // first calculate top of item given that floating View is + // centered over src position + int otop = top; + if (mSecondExpPos <= mSrcPos) { + // items are expanded on and/or above the source position + + if (position == mSecondExpPos && mFirstExpPos != mSecondExpPos) { + if (position == mSrcPos) { + otop = top + itemHeight - mFloatViewHeight; + } else { + int blankHeight = itemHeight - childHeight; + otop = top + blankHeight - maxBlankHeight; + } + } else if (position > mSecondExpPos && position <= mSrcPos) { + otop = top - maxBlankHeight; + } + + } else { + // items are expanded on and/or below the source position + + if (position > mSrcPos && position <= mFirstExpPos) { + otop = top + maxBlankHeight; + } else if (position == mSecondExpPos && mFirstExpPos != mSecondExpPos) { + int blankHeight = itemHeight - childHeight; + otop = top + blankHeight; + } + } + + // otop is set + if (position <= mSrcPos) { + edge = otop + (mFloatViewHeight - divHeight - getChildHeight(position - 1)) / 2; + } else { + edge = otop + (childHeight - divHeight - mFloatViewHeight) / 2; + } + + return edge; + } + + private boolean updatePositions() { + + final int first = getFirstVisiblePosition(); + int startPos = mFirstExpPos; + View startView = getChildAt(startPos - first); + + if (startView == null) { + startPos = first + getChildCount() / 2; + startView = getChildAt(startPos - first); + } + int startTop = startView.getTop(); + + int itemHeight = startView.getHeight(); + + int edge = getShuffleEdge(startPos, startTop); + int lastEdge = edge; + + int divHeight = getDividerHeight(); + + // Log.d("mobeta", "float mid="+mFloatViewMid); + + int itemPos = startPos; + int itemTop = startTop; + if (mFloatViewMid < edge) { + // scanning up for float position + // Log.d("mobeta", " edge="+edge); + while (itemPos >= 0) { + itemPos--; + itemHeight = getItemHeight(itemPos); + + if (itemPos == 0) { + edge = itemTop - divHeight - itemHeight; + break; + } + + itemTop -= itemHeight + divHeight; + edge = getShuffleEdge(itemPos, itemTop); + // Log.d("mobeta", " edge="+edge); + + if (mFloatViewMid >= edge) { + break; + } + + lastEdge = edge; + } + } else { + // scanning down for float position + // Log.d("mobeta", " edge="+edge); + final int count = getCount(); + while (itemPos < count) { + if (itemPos == count - 1) { + edge = itemTop + divHeight + itemHeight; + break; + } + + itemTop += divHeight + itemHeight; + itemHeight = getItemHeight(itemPos + 1); + edge = getShuffleEdge(itemPos + 1, itemTop); + // Log.d("mobeta", " edge="+edge); + + // test for hit + if (mFloatViewMid < edge) { + break; + } + + lastEdge = edge; + itemPos++; + } + } + + final int numHeaders = getHeaderViewsCount(); + final int numFooters = getFooterViewsCount(); + + boolean updated = false; + + int oldFirstExpPos = mFirstExpPos; + int oldSecondExpPos = mSecondExpPos; + float oldSlideFrac = mSlideFrac; + + if (mAnimate) { + int edgeToEdge = Math.abs(edge - lastEdge); + + int edgeTop, edgeBottom; + if (mFloatViewMid < edge) { + edgeBottom = edge; + edgeTop = lastEdge; + } else { + edgeTop = edge; + edgeBottom = lastEdge; + } + // Log.d("mobeta", "edgeTop="+edgeTop+" edgeBot="+edgeBottom); + + int slideRgnHeight = (int) (0.5f * mSlideRegionFrac * edgeToEdge); + float slideRgnHeightF = (float) slideRgnHeight; + int slideEdgeTop = edgeTop + slideRgnHeight; + int slideEdgeBottom = edgeBottom - slideRgnHeight; + + // Three regions + if (mFloatViewMid < slideEdgeTop) { + mFirstExpPos = itemPos - 1; + mSecondExpPos = itemPos; + mSlideFrac = 0.5f * ((float) (slideEdgeTop - mFloatViewMid)) / slideRgnHeightF; + // Log.d("mobeta", + // "firstExp="+mFirstExpPos+" secExp="+mSecondExpPos+" slideFrac="+mSlideFrac); + } else if (mFloatViewMid < slideEdgeBottom) { + mFirstExpPos = itemPos; + mSecondExpPos = itemPos; + } else { + mFirstExpPos = itemPos; + mSecondExpPos = itemPos + 1; + mSlideFrac = 0.5f * (1.0f + ((float) (edgeBottom - mFloatViewMid)) + / slideRgnHeightF); + // Log.d("mobeta", + // "firstExp="+mFirstExpPos+" secExp="+mSecondExpPos+" slideFrac="+mSlideFrac); + } + + } else { + mFirstExpPos = itemPos; + mSecondExpPos = itemPos; + } + + // correct for headers and footers + if (mFirstExpPos < numHeaders) { + itemPos = numHeaders; + mFirstExpPos = itemPos; + mSecondExpPos = itemPos; + } else if (mSecondExpPos >= getCount() - numFooters) { + itemPos = getCount() - numFooters - 1; + mFirstExpPos = itemPos; + mSecondExpPos = itemPos; + } + + if (mFirstExpPos != oldFirstExpPos || mSecondExpPos != oldSecondExpPos + || mSlideFrac != oldSlideFrac) { + updated = true; + } + + if (itemPos != mFloatPos) { + if (mDragListener != null) { + mDragListener.drag(mFloatPos - numHeaders, itemPos - numHeaders); + } + + mFloatPos = itemPos; + updated = true; + } + + return updated; + } + + @Override + protected void onDraw(Canvas canvas) { + super.onDraw(canvas); + + if (mTrackDragSort) { + mDragSortTracker.appendState(); + } + } + + private class SmoothAnimator implements Runnable { + protected long mStartTime; + + private float mDurationF; + + private float mAlpha; + private float mA, mB, mC, mD; + + private boolean mCanceled; + + public SmoothAnimator(float smoothness, int duration) { + mAlpha = smoothness; + mDurationF = (float) duration; + mA = mD = 1f / (2f * mAlpha * (1f - mAlpha)); + mB = mAlpha / (2f * (mAlpha - 1f)); + mC = 1f / (1f - mAlpha); + } + + public float transform(float frac) { + if (frac < mAlpha) { + return mA * frac * frac; + } else if (frac < 1f - mAlpha) { + return mB + mC * frac; + } else { + return 1f - mD * (frac - 1f) * (frac - 1f); + } + } + + public void start() { + mStartTime = SystemClock.uptimeMillis(); + mCanceled = false; + onStart(); + post(this); + } + + public void cancel() { + mCanceled = true; + } + + public void onStart() { + // stub + } + + public void onUpdate(float frac, float smoothFrac) { + // stub + } + + public void onStop() { + // stub + } + + @Override + public void run() { + if (mCanceled) { + return; + } + + float fraction = ((float) (SystemClock.uptimeMillis() - mStartTime)) / mDurationF; + + if (fraction >= 1f) { + onUpdate(1f, 1f); + onStop(); + } else { + onUpdate(fraction, transform(fraction)); + post(this); + } + } + } + + /** + * Centers floating View under touch point. + */ + private class LiftAnimator extends SmoothAnimator { + + private float mInitDragDeltaY; + private float mFinalDragDeltaY; + + public LiftAnimator(float smoothness, int duration) { + super(smoothness, duration); + } + + @Override + public void onStart() { + mInitDragDeltaY = mDragDeltaY; + mFinalDragDeltaY = mFloatViewHeightHalf; + } + + @Override + public void onUpdate(float frac, float smoothFrac) { + if (mDragState != DRAGGING) { + cancel(); + } else { + mDragDeltaY = (int) (smoothFrac * mFinalDragDeltaY + (1f - smoothFrac) + * mInitDragDeltaY); + mFloatLoc.y = mY - mDragDeltaY; + doDragFloatView(true); + } + } + } + + /** + * Centers floating View over drop slot before destroying. + */ + private class DropAnimator extends SmoothAnimator { + + private int mDropPos; + private int srcPos; + private float mInitDeltaY; + private float mInitDeltaX; + + public DropAnimator(float smoothness, int duration) { + super(smoothness, duration); + } + + @Override + public void onStart() { + mDropPos = mFloatPos; + srcPos = mSrcPos; + mDragState = DROPPING; + mInitDeltaY = mFloatLoc.y - getTargetY(); + mInitDeltaX = mFloatLoc.x - getPaddingLeft(); + } + + private int getTargetY() { + final int first = getFirstVisiblePosition(); + final int otherAdjust = (mItemHeightCollapsed + getDividerHeight()) / 2; + View v = getChildAt(mDropPos - first); + int targetY = -1; + if (v != null) { + if (mDropPos == srcPos) { + targetY = v.getTop(); + } else if (mDropPos < srcPos) { + // expanded down + targetY = v.getTop() - otherAdjust; + } else { + // expanded up + targetY = v.getBottom() + otherAdjust - mFloatViewHeight; + } + } else { + // drop position is not on screen?? no animation + cancel(); + } + + return targetY; + } + + @Override + public void onUpdate(float frac, float smoothFrac) { + final int targetY = getTargetY(); + final int targetX = getPaddingLeft(); + final float deltaY = mFloatLoc.y - targetY; + final float deltaX = mFloatLoc.x - targetX; + final float f = 1f - smoothFrac; + if (f < Math.abs(deltaY / mInitDeltaY) || f < Math.abs(deltaX / mInitDeltaX)) { + mFloatLoc.y = targetY + (int) (mInitDeltaY * f); + mFloatLoc.x = getPaddingLeft() + (int) (mInitDeltaX * f); + doDragFloatView(true); + } + } + + @Override + public void onStop() { + dropFloatView(); + } + + } + + /** + * Collapses expanded items. + */ + private class RemoveAnimator extends SmoothAnimator { + + private float mFloatLocX; + private float mFirstStartBlank; + private float mSecondStartBlank; + + private int mFirstChildHeight = -1; + private int mSecondChildHeight = -1; + + private int mFirstPos; + private int mSecondPos; + private int srcPos; + + public RemoveAnimator(float smoothness, int duration) { + super(smoothness, duration); + } + + @Override + public void onStart() { + mFirstChildHeight = -1; + mSecondChildHeight = -1; + mFirstPos = mFirstExpPos; + mSecondPos = mSecondExpPos; + srcPos = mSrcPos; + mDragState = REMOVING; + + mFloatLocX = mFloatLoc.x; + if (mUseRemoveVelocity) { + float minVelocity = 2f * getWidth(); + if (mRemoveVelocityX == 0) { + mRemoveVelocityX = (mFloatLocX < 0 ? -1 : 1) * minVelocity; + } else { + minVelocity *= 2; + if (mRemoveVelocityX < 0 && mRemoveVelocityX > -minVelocity) + mRemoveVelocityX = -minVelocity; + else if (mRemoveVelocityX > 0 && mRemoveVelocityX < minVelocity) + mRemoveVelocityX = minVelocity; + } + } else { + destroyFloatView(); + } + } + + @Override + public void onUpdate(float frac, float smoothFrac) { + float f = 1f - smoothFrac; + + final int firstVis = getFirstVisiblePosition(); + View item = getChildAt(mFirstPos - firstVis); + ViewGroup.LayoutParams lp; + int blank; + + if (mUseRemoveVelocity) { + float dt = (float) (SystemClock.uptimeMillis() - mStartTime) / 1000; + if (dt == 0) + return; + float dx = mRemoveVelocityX * dt; + int w = getWidth(); + mRemoveVelocityX += (mRemoveVelocityX > 0 ? 1 : -1) * dt * w; + mFloatLocX += dx; + mFloatLoc.x = (int) mFloatLocX; + if (mFloatLocX < w && mFloatLocX > -w) { + mStartTime = SystemClock.uptimeMillis(); + doDragFloatView(true); + return; + } + } + + if (item != null) { + if (mFirstChildHeight == -1) { + mFirstChildHeight = getChildHeight(mFirstPos, item, false); + mFirstStartBlank = (float) (item.getHeight() - mFirstChildHeight); + } + blank = Math.max((int) (f * mFirstStartBlank), 1); + lp = item.getLayoutParams(); + lp.height = mFirstChildHeight + blank; + item.setLayoutParams(lp); + } + if (mSecondPos != mFirstPos) { + item = getChildAt(mSecondPos - firstVis); + if (item != null) { + if (mSecondChildHeight == -1) { + mSecondChildHeight = getChildHeight(mSecondPos, item, false); + mSecondStartBlank = (float) (item.getHeight() - mSecondChildHeight); + } + blank = Math.max((int) (f * mSecondStartBlank), 1); + lp = item.getLayoutParams(); + lp.height = mSecondChildHeight + blank; + item.setLayoutParams(lp); + } + } + } + + @Override + public void onStop() { + doRemoveItem(); + } + } + + public void removeItem(int which) { + + mUseRemoveVelocity = false; + removeItem(which, 0); + } + + /** + * Removes an item from the list and animates the removal. + * + * @param which Position to remove (NOTE: headers/footers ignored! + * this is a position in your input ListAdapter). + * @param velocityX + */ + public void removeItem(int which, float velocityX) { + if (mDragState == IDLE || mDragState == DRAGGING) { + + if (mDragState == IDLE) { + // called from outside drag-sort + mSrcPos = getHeaderViewsCount() + which; + mFirstExpPos = mSrcPos; + mSecondExpPos = mSrcPos; + mFloatPos = mSrcPos; + View v = getChildAt(mSrcPos - getFirstVisiblePosition()); + if (v != null) { + v.setVisibility(View.INVISIBLE); + } + } + + mDragState = REMOVING; + mRemoveVelocityX = velocityX; + + if (mInTouchEvent) { + switch (mCancelMethod) { + case ON_TOUCH_EVENT: + super.onTouchEvent(mCancelEvent); + break; + case ON_INTERCEPT_TOUCH_EVENT: + super.onInterceptTouchEvent(mCancelEvent); + break; + } + } + + if (mRemoveAnimator != null) { + mRemoveAnimator.start(); + } else { + doRemoveItem(which); + } + } + } + + /** + * Move an item, bypassing the drag-sort process. Simply calls + * through to {@link DropListener#drop(int, int)}. + * + * @param from Position to move (NOTE: headers/footers ignored! + * this is a position in your input ListAdapter). + * @param to Target position (NOTE: headers/footers ignored! + * this is a position in your input ListAdapter). + */ + public void moveItem(int from, int to) { + if (mDropListener != null) { + final int count = getInputAdapter().getCount(); + if (from >= 0 && from < count && to >= 0 && to < count) { + mDropListener.drop(from, to); + } + } + } + + /** + * Cancel a drag. Calls {@link #stopDrag(boolean, boolean)} with + * <code>true</code> as the first argument. + */ + public void cancelDrag() { + if (mDragState == DRAGGING) { + mDragScroller.stopScrolling(true); + destroyFloatView(); + clearPositions(); + adjustAllItems(); + + if (mInTouchEvent) { + mDragState = STOPPED; + } else { + mDragState = IDLE; + } + } + } + + private void clearPositions() { + mSrcPos = -1; + mFirstExpPos = -1; + mSecondExpPos = -1; + mFloatPos = -1; + } + + private void dropFloatView() { + // must set to avoid cancelDrag being called from the + // DataSetObserver + mDragState = DROPPING; + + if (mDropListener != null && mFloatPos >= 0 && mFloatPos < getCount()) { + final int numHeaders = getHeaderViewsCount(); + mDropListener.drop(mSrcPos - numHeaders, mFloatPos - numHeaders); + } + + destroyFloatView(); + + adjustOnReorder(); + clearPositions(); + adjustAllItems(); + + // now the drag is done + if (mInTouchEvent) { + mDragState = STOPPED; + } else { + mDragState = IDLE; + } + } + + private void doRemoveItem() { + doRemoveItem(mSrcPos - getHeaderViewsCount()); + } + + /** + * Removes dragged item from the list. Calls RemoveListener. + */ + private void doRemoveItem(int which) { + // must set to avoid cancelDrag being called from the + // DataSetObserver + mDragState = REMOVING; + + // end it + if (mRemoveListener != null) { + mRemoveListener.remove(which); + } + + destroyFloatView(); + + adjustOnReorder(); + clearPositions(); + + // now the drag is done + if (mInTouchEvent) { + mDragState = STOPPED; + } else { + mDragState = IDLE; + } + } + + private void adjustOnReorder() { + final int firstPos = getFirstVisiblePosition(); + // Log.d("mobeta", "first="+firstPos+" src="+mSrcPos); + if (mSrcPos < firstPos) { + // collapsed src item is off screen; + // adjust the scroll after item heights have been fixed + View v = getChildAt(0); + int top = 0; + if (v != null) { + top = v.getTop(); + } + // Log.d("mobeta", "top="+top+" fvh="+mFloatViewHeight); + setSelectionFromTop(firstPos - 1, top - getPaddingTop()); + } + } + + /** + * Stop a drag in progress. Pass <code>true</code> if you would + * like to remove the dragged item from the list. + * + * @param remove Remove the dragged item from the list. Calls + * a registered RemoveListener, if one exists. Otherwise, calls + * the DropListener, if one exists. + * + * @return True if the stop was successful. False if there is + * no floating View. + */ + public boolean stopDrag(boolean remove) { + mUseRemoveVelocity = false; + return stopDrag(remove, 0); + } + + public boolean stopDragWithVelocity(boolean remove, float velocityX) { + + mUseRemoveVelocity = true; + return stopDrag(remove, velocityX); + } + + public boolean stopDrag(boolean remove, float velocityX) { + if (mFloatView != null) { + mDragScroller.stopScrolling(true); + + if (remove) { + removeItem(mSrcPos - getHeaderViewsCount(), velocityX); + } else { + if (mDropAnimator != null) { + mDropAnimator.start(); + } else { + dropFloatView(); + } + } + + if (mTrackDragSort) { + mDragSortTracker.stopTracking(); + } + + return true; + } else { + // stop failed + return false; + } + } + + @Override + public boolean onTouchEvent(MotionEvent ev) { + if (mIgnoreTouchEvent) { + mIgnoreTouchEvent = false; + return false; + } + + if (!mDragEnabled) { + return super.onTouchEvent(ev); + } + + boolean more = false; + + boolean lastCallWasIntercept = mLastCallWasIntercept; + mLastCallWasIntercept = false; + + if (!lastCallWasIntercept) { + saveTouchCoords(ev); + } + + // if (mFloatView != null) { + if (mDragState == DRAGGING) { + onDragTouchEvent(ev); + more = true; // give us more! + } else { + // what if float view is null b/c we dropped in middle + // of drag touch event? + + // if (mDragState != STOPPED) { + if (mDragState == IDLE) { + if (super.onTouchEvent(ev)) { + more = true; + } + } + + int action = ev.getAction() & MotionEvent.ACTION_MASK; + + switch (action) { + case MotionEvent.ACTION_CANCEL: + case MotionEvent.ACTION_UP: + doActionUpOrCancel(); + break; + default: + if (more) { + mCancelMethod = ON_TOUCH_EVENT; + } + } + } + + return more; + } + + private void doActionUpOrCancel() { + mCancelMethod = NO_CANCEL; + mInTouchEvent = false; + if (mDragState == STOPPED) { + mDragState = IDLE; + } + mCurrFloatAlpha = mFloatAlpha; + mListViewIntercepted = false; + mChildHeightCache.clear(); + } + + private void saveTouchCoords(MotionEvent ev) { + int action = ev.getAction() & MotionEvent.ACTION_MASK; + if (action != MotionEvent.ACTION_DOWN) { + mLastX = mX; + mLastY = mY; + } + mX = (int) ev.getX(); + mY = (int) ev.getY(); + if (action == MotionEvent.ACTION_DOWN) { + mLastX = mX; + mLastY = mY; + } + mOffsetX = (int) ev.getRawX() - mX; + mOffsetY = (int) ev.getRawY() - mY; + } + + public boolean listViewIntercepted() { + return mListViewIntercepted; + } + + private boolean mListViewIntercepted = false; + + @Override + public boolean onInterceptTouchEvent(MotionEvent ev) { + if (!mDragEnabled) { + return super.onInterceptTouchEvent(ev); + } + + saveTouchCoords(ev); + mLastCallWasIntercept = true; + + int action = ev.getAction() & MotionEvent.ACTION_MASK; + + if (action == MotionEvent.ACTION_DOWN) { + if (mDragState != IDLE) { + // intercept and ignore + mIgnoreTouchEvent = true; + return true; + } + mInTouchEvent = true; + } + + boolean intercept = false; + + // the following deals with calls to super.onInterceptTouchEvent + if (mFloatView != null) { + // super's touch event canceled in startDrag + intercept = true; + } else { + if (super.onInterceptTouchEvent(ev)) { + mListViewIntercepted = true; + intercept = true; + } + + switch (action) { + case MotionEvent.ACTION_CANCEL: + case MotionEvent.ACTION_UP: + doActionUpOrCancel(); + break; + default: + if (intercept) { + mCancelMethod = ON_TOUCH_EVENT; + } else { + mCancelMethod = ON_INTERCEPT_TOUCH_EVENT; + } + } + } + + if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL) { + mInTouchEvent = false; + } + + return intercept; + } + + /** + * Set the width of each drag scroll region by specifying + * a fraction of the ListView height. + * + * @param heightFraction Fraction of ListView height. Capped at + * 0.5f. + * + */ + public void setDragScrollStart(float heightFraction) { + setDragScrollStarts(heightFraction, heightFraction); + } + + /** + * Set the width of each drag scroll region by specifying + * a fraction of the ListView height. + * + * @param upperFrac Fraction of ListView height for up-scroll bound. + * Capped at 0.5f. + * @param lowerFrac Fraction of ListView height for down-scroll bound. + * Capped at 0.5f. + * + */ + public void setDragScrollStarts(float upperFrac, float lowerFrac) { + if (lowerFrac > 0.5f) { + mDragDownScrollStartFrac = 0.5f; + } else { + mDragDownScrollStartFrac = lowerFrac; + } + + if (upperFrac > 0.5f) { + mDragUpScrollStartFrac = 0.5f; + } else { + mDragUpScrollStartFrac = upperFrac; + } + + if (getHeight() != 0) { + updateScrollStarts(); + } + } + + private void continueDrag(int x, int y) { + + // proposed position + mFloatLoc.x = x - mDragDeltaX; + mFloatLoc.y = y - mDragDeltaY; + + doDragFloatView(true); + + int minY = Math.min(y, mFloatViewMid + mFloatViewHeightHalf); + int maxY = Math.max(y, mFloatViewMid - mFloatViewHeightHalf); + + // get the current scroll direction + int currentScrollDir = mDragScroller.getScrollDir(); + + if (minY > mLastY && minY > mDownScrollStartY && currentScrollDir != DragScroller.DOWN) { + // dragged down, it is below the down scroll start and it is not + // scrolling up + + if (currentScrollDir != DragScroller.STOP) { + // moved directly from up scroll to down scroll + mDragScroller.stopScrolling(true); + } + + // start scrolling down + mDragScroller.startScrolling(DragScroller.DOWN); + } else if (maxY < mLastY && maxY < mUpScrollStartY && currentScrollDir != DragScroller.UP) { + // dragged up, it is above the up scroll start and it is not + // scrolling up + + if (currentScrollDir != DragScroller.STOP) { + // moved directly from down scroll to up scroll + mDragScroller.stopScrolling(true); + } + + // start scrolling up + mDragScroller.startScrolling(DragScroller.UP); + } + else if (maxY >= mUpScrollStartY && minY <= mDownScrollStartY + && mDragScroller.isScrolling()) { + // not in the upper nor in the lower drag-scroll regions but it is + // still scrolling + + mDragScroller.stopScrolling(true); + } + } + + private void updateScrollStarts() { + final int padTop = getPaddingTop(); + final int listHeight = getHeight() - padTop - getPaddingBottom(); + float heightF = (float) listHeight; + + mUpScrollStartYF = padTop + mDragUpScrollStartFrac * heightF; + mDownScrollStartYF = padTop + (1.0f - mDragDownScrollStartFrac) * heightF; + + mUpScrollStartY = (int) mUpScrollStartYF; + mDownScrollStartY = (int) mDownScrollStartYF; + + mDragUpScrollHeight = mUpScrollStartYF - padTop; + mDragDownScrollHeight = padTop + listHeight - mDownScrollStartYF; + } + + @Override + protected void onSizeChanged(int w, int h, int oldw, int oldh) { + super.onSizeChanged(w, h, oldw, oldh); + updateScrollStarts(); + } + + private void adjustAllItems() { + final int first = getFirstVisiblePosition(); + final int last = getLastVisiblePosition(); + + int begin = Math.max(0, getHeaderViewsCount() - first); + int end = Math.min(last - first, getCount() - 1 - getFooterViewsCount() - first); + + for (int i = begin; i <= end; ++i) { + View v = getChildAt(i); + if (v != null) { + adjustItem(first + i, v, false); + } + } + } + + private void adjustItem(int position) { + View v = getChildAt(position - getFirstVisiblePosition()); + + if (v != null) { + adjustItem(position, v, false); + } + } + + /** + * Sets layout param height, gravity, and visibility on + * wrapped item. + */ + private void adjustItem(int position, View v, boolean invalidChildHeight) { + + // Adjust item height + ViewGroup.LayoutParams lp = v.getLayoutParams(); + int height; + if (position != mSrcPos && position != mFirstExpPos && position != mSecondExpPos) { + height = ViewGroup.LayoutParams.WRAP_CONTENT; + } else { + height = calcItemHeight(position, v, invalidChildHeight); + } + + if (height != lp.height) { + lp.height = height; + v.setLayoutParams(lp); + } + + // Adjust item gravity + if (position == mFirstExpPos || position == mSecondExpPos) { + if (position < mSrcPos) { + ((DragSortItemView) v).setGravity(Gravity.BOTTOM); + } else if (position > mSrcPos) { + ((DragSortItemView) v).setGravity(Gravity.TOP); + } + } + + // Finally adjust item visibility + + int oldVis = v.getVisibility(); + int vis = View.VISIBLE; + + if (position == mSrcPos && mFloatView != null) { + vis = View.INVISIBLE; + } + + if (vis != oldVis) { + v.setVisibility(vis); + } + } + + private int getChildHeight(int position) { + if (position == mSrcPos) { + return 0; + } + + View v = getChildAt(position - getFirstVisiblePosition()); + + if (v != null) { + // item is onscreen, therefore child height is valid, + // hence the "true" + return getChildHeight(position, v, false); + } else { + // item is offscreen + // first check cache for child height at this position + int childHeight = mChildHeightCache.get(position); + if (childHeight != -1) { + // Log.d("mobeta", "found child height in cache!"); + return childHeight; + } + + final ListAdapter adapter = getAdapter(); + int type = adapter.getItemViewType(position); + + // There might be a better place for checking for the following + final int typeCount = adapter.getViewTypeCount(); + if (typeCount != mSampleViewTypes.length) { + mSampleViewTypes = new View[typeCount]; + } + + if (type >= 0) { + if (mSampleViewTypes[type] == null) { + v = adapter.getView(position, null, this); + mSampleViewTypes[type] = v; + } else { + v = adapter.getView(position, mSampleViewTypes[type], this); + } + } else { + // type is HEADER_OR_FOOTER or IGNORE + v = adapter.getView(position, null, this); + } + + // current child height is invalid, hence "true" below + childHeight = getChildHeight(position, v, true); + + // cache it because this could have been expensive + mChildHeightCache.add(position, childHeight); + + return childHeight; + } + } + + private int getChildHeight(int position, View item, boolean invalidChildHeight) { + if (position == mSrcPos) { + return 0; + } + + View child; + if (position < getHeaderViewsCount() || position >= getCount() - getFooterViewsCount()) { + child = item; + } else { + child = ((ViewGroup) item).getChildAt(0); + } + + ViewGroup.LayoutParams lp = child.getLayoutParams(); + + if (lp != null) { + if (lp.height > 0) { + return lp.height; + } + } + + int childHeight = child.getHeight(); + + if (childHeight == 0 || invalidChildHeight) { + measureItem(child); + childHeight = child.getMeasuredHeight(); + } + + return childHeight; + } + + private int calcItemHeight(int position, View item, boolean invalidChildHeight) { + return calcItemHeight(position, getChildHeight(position, item, invalidChildHeight)); + } + + private int calcItemHeight(int position, int childHeight) { + + int divHeight = getDividerHeight(); + + boolean isSliding = mAnimate && mFirstExpPos != mSecondExpPos; + int maxNonSrcBlankHeight = mFloatViewHeight - mItemHeightCollapsed; + int slideHeight = (int) (mSlideFrac * maxNonSrcBlankHeight); + + int height; + + if (position == mSrcPos) { + if (mSrcPos == mFirstExpPos) { + if (isSliding) { + height = slideHeight + mItemHeightCollapsed; + } else { + height = mFloatViewHeight; + } + } else if (mSrcPos == mSecondExpPos) { + // if gets here, we know an item is sliding + height = mFloatViewHeight - slideHeight; + } else { + height = mItemHeightCollapsed; + } + } else if (position == mFirstExpPos) { + if (isSliding) { + height = childHeight + slideHeight; + } else { + height = childHeight + maxNonSrcBlankHeight; + } + } else if (position == mSecondExpPos) { + // we know an item is sliding (b/c 2ndPos != 1stPos) + height = childHeight + maxNonSrcBlankHeight - slideHeight; + } else { + height = childHeight; + } + + return height; + } + + @Override + public void requestLayout() { + if (!mBlockLayoutRequests) { + super.requestLayout(); + } + } + + private int adjustScroll(int movePos, View moveItem, int oldFirstExpPos, int oldSecondExpPos) { + int adjust = 0; + + final int childHeight = getChildHeight(movePos); + + int moveHeightBefore = moveItem.getHeight(); + int moveHeightAfter = calcItemHeight(movePos, childHeight); + + int moveBlankBefore = moveHeightBefore; + int moveBlankAfter = moveHeightAfter; + if (movePos != mSrcPos) { + moveBlankBefore -= childHeight; + moveBlankAfter -= childHeight; + } + + int maxBlank = mFloatViewHeight; + if (mSrcPos != mFirstExpPos && mSrcPos != mSecondExpPos) { + maxBlank -= mItemHeightCollapsed; + } + + if (movePos <= oldFirstExpPos) { + if (movePos > mFirstExpPos) { + adjust += maxBlank - moveBlankAfter; + } + } else if (movePos == oldSecondExpPos) { + if (movePos <= mFirstExpPos) { + adjust += moveBlankBefore - maxBlank; + } else if (movePos == mSecondExpPos) { + adjust += moveHeightBefore - moveHeightAfter; + } else { + adjust += moveBlankBefore; + } + } else { + if (movePos <= mFirstExpPos) { + adjust -= maxBlank; + } else if (movePos == mSecondExpPos) { + adjust -= moveBlankAfter; + } + } + + return adjust; + } + + private void measureItem(View item) { + ViewGroup.LayoutParams lp = item.getLayoutParams(); + if (lp == null) { + lp = new AbsListView.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); + item.setLayoutParams(lp); + } + int wspec = ViewGroup.getChildMeasureSpec(mWidthMeasureSpec, getListPaddingLeft() + + getListPaddingRight(), lp.width); + int hspec; + if (lp.height > 0) { + hspec = MeasureSpec.makeMeasureSpec(lp.height, MeasureSpec.EXACTLY); + } else { + hspec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED); + } + item.measure(wspec, hspec); + } + + private void measureFloatView() { + if (mFloatView != null) { + measureItem(mFloatView); + mFloatViewHeight = mFloatView.getMeasuredHeight(); + mFloatViewHeightHalf = mFloatViewHeight / 2; + } + } + + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + super.onMeasure(widthMeasureSpec, heightMeasureSpec); + // Log.d("mobeta", "onMeasure called"); + if (mFloatView != null) { + if (mFloatView.isLayoutRequested()) { + measureFloatView(); + } + mFloatViewOnMeasured = true; // set to false after layout + } + mWidthMeasureSpec = widthMeasureSpec; + } + + @Override + protected void layoutChildren() { + super.layoutChildren(); + + if (mFloatView != null) { + if (mFloatView.isLayoutRequested() && !mFloatViewOnMeasured) { + // Have to measure here when usual android measure + // pass is skipped. This happens during a drag-sort + // when layoutChildren is called directly. + measureFloatView(); + } + mFloatView.layout(0, 0, mFloatView.getMeasuredWidth(), mFloatView.getMeasuredHeight()); + mFloatViewOnMeasured = false; + } + } + + protected boolean onDragTouchEvent(MotionEvent ev) { + // we are in a drag + int action = ev.getAction() & MotionEvent.ACTION_MASK; + + switch (ev.getAction() & MotionEvent.ACTION_MASK) { + case MotionEvent.ACTION_CANCEL: + if (mDragState == DRAGGING) { + cancelDrag(); + } + doActionUpOrCancel(); + break; + case MotionEvent.ACTION_UP: + // Log.d("mobeta", "calling stopDrag from onDragTouchEvent"); + if (mDragState == DRAGGING) { + stopDrag(false); + } + doActionUpOrCancel(); + break; + case MotionEvent.ACTION_MOVE: + continueDrag((int) ev.getX(), (int) ev.getY()); + break; + } + + return true; + } + + private boolean mFloatViewInvalidated = false; + + private void invalidateFloatView() { + mFloatViewInvalidated = true; + } + + /** + * Start a drag of item at <code>position</code> using the + * registered FloatViewManager. Calls through + * to {@link #startDrag(int,View,int,int,int)} after obtaining + * the floating View from the FloatViewManager. + * + * @param position Item to drag. + * @param dragFlags Flags that restrict some movements of the + * floating View. For example, set <code>dragFlags |= + * ~{@link #DRAG_NEG_X}</code> to allow dragging the floating + * View in all directions except off the screen to the left. + * @param deltaX Offset in x of the touch coordinate from the + * left edge of the floating View (i.e. touch-x minus float View + * left). + * @param deltaY Offset in y of the touch coordinate from the + * top edge of the floating View (i.e. touch-y minus float View + * top). + * + * @return True if the drag was started, false otherwise. This + * <code>startDrag</code> will fail if we are not currently in + * a touch event, there is no registered FloatViewManager, + * or the FloatViewManager returns a null View. + */ + public boolean startDrag(int position, int dragFlags, int deltaX, int deltaY) { + if (!mInTouchEvent || mFloatViewManager == null) { + return false; + } + + View v = mFloatViewManager.onCreateFloatView(position); + + if (v == null) { + return false; + } else { + return startDrag(position, v, dragFlags, deltaX, deltaY); + } + + } + + /** + * Start a drag of item at <code>position</code> without using + * a FloatViewManager. + * + * @param position Item to drag. + * @param floatView Floating View. + * @param dragFlags Flags that restrict some movements of the + * floating View. For example, set <code>dragFlags |= + * ~{@link #DRAG_NEG_X}</code> to allow dragging the floating + * View in all directions except off the screen to the left. + * @param deltaX Offset in x of the touch coordinate from the + * left edge of the floating View (i.e. touch-x minus float View + * left). + * @param deltaY Offset in y of the touch coordinate from the + * top edge of the floating View (i.e. touch-y minus float View + * top). + * + * @return True if the drag was started, false otherwise. This + * <code>startDrag</code> will fail if we are not currently in + * a touch event, <code>floatView</code> is null, or there is + * a drag in progress. + */ + public boolean startDrag(int position, View floatView, int dragFlags, int deltaX, int deltaY) { + if (mDragState != IDLE || !mInTouchEvent || mFloatView != null || floatView == null + || !mDragEnabled) { + return false; + } + + if (getParent() != null) { + getParent().requestDisallowInterceptTouchEvent(true); + } + + int pos = position + getHeaderViewsCount(); + mFirstExpPos = pos; + mSecondExpPos = pos; + mSrcPos = pos; + mFloatPos = pos; + + // mDragState = dragType; + mDragState = DRAGGING; + mDragFlags = 0; + mDragFlags |= dragFlags; + + mFloatView = floatView; + measureFloatView(); // sets mFloatViewHeight + + mDragDeltaX = deltaX; + mDragDeltaY = deltaY; + mDragStartY = mY; + + // updateFloatView(mX - mDragDeltaX, mY - mDragDeltaY); + mFloatLoc.x = mX - mDragDeltaX; + mFloatLoc.y = mY - mDragDeltaY; + + // set src item invisible + final View srcItem = getChildAt(mSrcPos - getFirstVisiblePosition()); + + if (srcItem != null) { + srcItem.setVisibility(View.INVISIBLE); + } + + if (mTrackDragSort) { + mDragSortTracker.startTracking(); + } + + // once float view is created, events are no longer passed + // to ListView + switch (mCancelMethod) { + case ON_TOUCH_EVENT: + super.onTouchEvent(mCancelEvent); + break; + case ON_INTERCEPT_TOUCH_EVENT: + super.onInterceptTouchEvent(mCancelEvent); + break; + } + + requestLayout(); + + if (mLiftAnimator != null) { + mLiftAnimator.start(); + } + + return true; + } + + private void doDragFloatView(boolean forceInvalidate) { + int movePos = getFirstVisiblePosition() + getChildCount() / 2; + View moveItem = getChildAt(getChildCount() / 2); + + if (moveItem == null) { + return; + } + + doDragFloatView(movePos, moveItem, forceInvalidate); + } + + private void doDragFloatView(int movePos, View moveItem, boolean forceInvalidate) { + mBlockLayoutRequests = true; + + updateFloatView(); + + int oldFirstExpPos = mFirstExpPos; + int oldSecondExpPos = mSecondExpPos; + + boolean updated = updatePositions(); + + if (updated) { + adjustAllItems(); + int scroll = adjustScroll(movePos, moveItem, oldFirstExpPos, oldSecondExpPos); + // Log.d("mobeta", " adjust scroll="+scroll); + + setSelectionFromTop(movePos, moveItem.getTop() + scroll - getPaddingTop()); + layoutChildren(); + } + + if (updated || forceInvalidate) { + invalidate(); + } + + mBlockLayoutRequests = false; + } + + /** + * Sets float View location based on suggested values and + * constraints set in mDragFlags. + */ + private void updateFloatView() { + + if (mFloatViewManager != null) { + mTouchLoc.set(mX, mY); + mFloatViewManager.onDragFloatView(mFloatView, mFloatLoc, mTouchLoc); + } + + final int floatX = mFloatLoc.x; + final int floatY = mFloatLoc.y; + + // restrict x motion + int padLeft = getPaddingLeft(); + if ((mDragFlags & DRAG_POS_X) == 0 && floatX > padLeft) { + mFloatLoc.x = padLeft; + } else if ((mDragFlags & DRAG_NEG_X) == 0 && floatX < padLeft) { + mFloatLoc.x = padLeft; + } + + // keep floating view from going past bottom of last header view + final int numHeaders = getHeaderViewsCount(); + final int numFooters = getFooterViewsCount(); + final int firstPos = getFirstVisiblePosition(); + final int lastPos = getLastVisiblePosition(); + + // Log.d("mobeta", + // "nHead="+numHeaders+" nFoot="+numFooters+" first="+firstPos+" last="+lastPos); + int topLimit = getPaddingTop(); + if (firstPos < numHeaders) { + topLimit = getChildAt(numHeaders - firstPos - 1).getBottom(); + } + if ((mDragFlags & DRAG_NEG_Y) == 0) { + if (firstPos <= mSrcPos) { + topLimit = Math.max(getChildAt(mSrcPos - firstPos).getTop(), topLimit); + } + } + // bottom limit is top of first footer View or + // bottom of last item in list + int bottomLimit = getHeight() - getPaddingBottom(); + if (lastPos >= getCount() - numFooters - 1) { + bottomLimit = getChildAt(getCount() - numFooters - 1 - firstPos).getBottom(); + } + if ((mDragFlags & DRAG_POS_Y) == 0) { + if (lastPos >= mSrcPos) { + bottomLimit = Math.min(getChildAt(mSrcPos - firstPos).getBottom(), bottomLimit); + } + } + + // Log.d("mobeta", "dragView top=" + (y - mDragDeltaY)); + // Log.d("mobeta", "limit=" + limit); + // Log.d("mobeta", "mDragDeltaY=" + mDragDeltaY); + + if (floatY < topLimit) { + mFloatLoc.y = topLimit; + } else if (floatY + mFloatViewHeight > bottomLimit) { + mFloatLoc.y = bottomLimit - mFloatViewHeight; + } + + // get y-midpoint of floating view (constrained to ListView bounds) + mFloatViewMid = mFloatLoc.y + mFloatViewHeightHalf; + } + + private void destroyFloatView() { + if (mFloatView != null) { + mFloatView.setVisibility(GONE); + if (mFloatViewManager != null) { + mFloatViewManager.onDestroyFloatView(mFloatView); + } + mFloatView = null; + invalidate(); + } + } + + /** + * Interface for customization of the floating View appearance + * and dragging behavior. Implement + * your own and pass it to {@link #setFloatViewManager}. If + * your own is not passed, the default {@link SimpleFloatViewManager} + * implementation is used. + */ + public interface FloatViewManager { + /** + * Return the floating View for item at <code>position</code>. + * DragSortListView will measure and layout this View for you, + * so feel free to just inflate it. You can help DSLV by + * setting some {@link ViewGroup.LayoutParams} on this View; + * otherwise it will set some for you (with a width of FILL_PARENT + * and a height of WRAP_CONTENT). + * + * @param position Position of item to drag (NOTE: + * <code>position</code> excludes header Views; thus, if you + * want to call {@link ListView#getChildAt(int)}, you will need + * to add {@link ListView#getHeaderViewsCount()} to the index). + * + * @return The View you wish to display as the floating View. + */ + public View onCreateFloatView(int position); + + /** + * Called whenever the floating View is dragged. Float View + * properties can be changed here. Also, the upcoming location + * of the float View can be altered by setting + * <code>location.x</code> and <code>location.y</code>. + * + * @param floatView The floating View. + * @param location The location (top-left; relative to DSLV + * top-left) at which the float + * View would like to appear, given the current touch location + * and the offset provided in {@link DragSortListView#startDrag}. + * @param touch The current touch location (relative to DSLV + * top-left). + * @param pendingScroll + */ + public void onDragFloatView(View floatView, Point location, Point touch); + + /** + * Called when the float View is dropped; lets you perform + * any necessary cleanup. The internal DSLV floating View + * reference is set to null immediately after this is called. + * + * @param floatView The floating View passed to + * {@link #onCreateFloatView(int)}. + */ + public void onDestroyFloatView(View floatView); + + /** + * Register a class which will get onTouch events. + */ + public void setSecondaryOnTouchListener(View.OnTouchListener l); + } + + public void setFloatViewManager(FloatViewManager manager) { + mFloatViewManager = manager; + } + + public void setDragListener(DragListener l) { + mDragListener = l; + } + + /** + * Allows for easy toggling between a DragSortListView + * and a regular old ListView. If enabled, items are + * draggable, where the drag init mode determines how + * items are lifted (see {@link setDragInitMode(int)}). + * If disabled, items cannot be dragged. + * + * @param enabled Set <code>true</code> to enable list + * item dragging + */ + public void setDragEnabled(boolean enabled) { + mDragEnabled = enabled; + } + + public boolean isDragEnabled() { + return mDragEnabled; + } + + /** + * This better reorder your ListAdapter! DragSortListView does not do this + * for you; doesn't make sense to. Make sure + * {@link BaseAdapter#notifyDataSetChanged()} or something like it is called + * in your implementation. Furthermore, if you have a choiceMode other than + * none and the ListAdapter does not return true for + * {@link ListAdapter#hasStableIds()}, you will need to call + * {@link #moveCheckState(int, int)} to move the check boxes along with the + * list items. + * + * @param l + */ + public void setDropListener(DropListener l) { + mDropListener = l; + } + + /** + * Probably a no-brainer, but make sure that your remove listener + * calls {@link BaseAdapter#notifyDataSetChanged()} or something like it. + * When an item removal occurs, DragSortListView + * relies on a redraw of all the items to recover invisible views + * and such. Strictly speaking, if you remove something, your dataset + * has changed... + * + * @param l + */ + public void setRemoveListener(RemoveListener l) { + mRemoveListener = l; + } + + public interface DragListener { + public void drag(int from, int to); + } + + /** + * Your implementation of this has to reorder your ListAdapter! + * Make sure to call + * {@link BaseAdapter#notifyDataSetChanged()} or something like it + * in your implementation. + * + * @author heycosmo + * + */ + public interface DropListener { + public void drop(int from, int to); + } + + /** + * Make sure to call + * {@link BaseAdapter#notifyDataSetChanged()} or something like it + * in your implementation. + * + * @author heycosmo + * + */ + public interface RemoveListener { + public void remove(int which); + } + + public interface DragSortListener extends DropListener, DragListener, RemoveListener { + } + + public void setDragSortListener(DragSortListener l) { + setDropListener(l); + setDragListener(l); + setRemoveListener(l); + } + + /** + * Completely custom scroll speed profile. Default increases linearly + * with position and is constant in time. Create your own by implementing + * {@link DragSortListView.DragScrollProfile}. + * + * @param ssp + */ + public void setDragScrollProfile(DragScrollProfile ssp) { + if (ssp != null) { + mScrollProfile = ssp; + } + } + + /** + * Use this to move the check state of an item from one position to another + * in a drop operation. If you have a choiceMode which is not none, this + * method must be called when the order of items changes in an underlying + * adapter which does not have stable IDs (see + * {@link ListAdapter#hasStableIds()}). This is because without IDs, the + * ListView has no way of knowing which items have moved where, and cannot + * update the check state accordingly. + * <p> + * A word of warning about a "feature" in Android that you may run into when + * dealing with movable list items: for an adapter that <em>does</em> have + * stable IDs, ListView will attempt to locate each item based on its ID and + * move the check state from the item's old position to the new position — + * which is all fine and good (and removes the need for calling this + * function), except for the half-baked approach. Apparently to save time in + * the naive algorithm used, ListView will only search for an ID in the + * close neighborhood of the old position. If the user moves an item too far + * (specifically, more than 20 rows away), ListView will give up and just + * force the item to be unchecked. So if there is a reasonable chance that + * the user will move items more than 20 rows away from the original + * position, you may wish to use an adapter with unstable IDs and call this + * method manually instead. + * + * @param from + * @param to + */ + public void moveCheckState(int from, int to) { + // This method runs in O(n log n) time (n being the number of list + // items). The bottleneck is the call to AbsListView.setItemChecked, + // which is O(log n) because of the binary search involved in calling + // SparseBooleanArray.put(). + // + // To improve on the average time, we minimize the number of calls to + // setItemChecked by only calling it for items that actually have a + // changed state. This is achieved by building a list containing the + // start and end of the "runs" of checked items, and then moving the + // runs. Note that moving an item from A to B is essentially a rotation + // of the range of items in [A, B]. Let's say we have + // . . U V X Y Z . . + // and move U after Z. This is equivalent to a rotation one step to the + // left within the range you are moving across: + // . . V X Y Z U . . + // + // So, to perform the move we enumerate all the runs within the move + // range, then rotate each run one step to the left or right (depending + // on move direction). For example, in the list: + // X X . X X X . X + // we have two runs. One begins at the last item of the list and wraps + // around to the beginning, ending at position 1. The second begins at + // position 3 and ends at position 5. To rotate a run, regardless of + // length, we only need to set a check mark at one end of the run, and + // clear a check mark at the other end: + // X . X X X . X X + SparseBooleanArray cip = getCheckedItemPositions(); + int rangeStart = from; + int rangeEnd = to; + if (to < from) { + rangeStart = to; + rangeEnd = from; + } + rangeEnd += 1; + + int[] runStart = new int[cip.size()]; + int[] runEnd = new int[cip.size()]; + int runCount = buildRunList(cip, rangeStart, rangeEnd, runStart, runEnd); + if (runCount == 1 && (runStart[0] == runEnd[0])) { + // Special case where all items are checked, we can never set any + // item to false like we do below. + return; + } + + if (from < to) { + for (int i = 0; i != runCount; i++) { + setItemChecked(rotate(runStart[i], -1, rangeStart, rangeEnd), true); + setItemChecked(rotate(runEnd[i], -1, rangeStart, rangeEnd), false); + } + + } else { + for (int i = 0; i != runCount; i++) { + setItemChecked(runStart[i], false); + setItemChecked(runEnd[i], true); + } + } + } + + /** + * Use this when an item has been deleted, to move the check state of all + * following items up one step. If you have a choiceMode which is not none, + * this method must be called when the order of items changes in an + * underlying adapter which does not have stable IDs (see + * {@link ListAdapter#hasStableIds()}). This is because without IDs, the + * ListView has no way of knowing which items have moved where, and cannot + * update the check state accordingly. + * + * See also further comments on {@link #moveCheckState(int, int)}. + * + * @param position + */ + public void removeCheckState(int position) { + SparseBooleanArray cip = getCheckedItemPositions(); + + if (cip.size() == 0) + return; + int[] runStart = new int[cip.size()]; + int[] runEnd = new int[cip.size()]; + int rangeStart = position; + int rangeEnd = cip.keyAt(cip.size() - 1) + 1; + int runCount = buildRunList(cip, rangeStart, rangeEnd, runStart, runEnd); + for (int i = 0; i != runCount; i++) { + if (!(runStart[i] == position || (runEnd[i] < runStart[i] && runEnd[i] > position))) { + // Only set a new check mark in front of this run if it does + // not contain the deleted position. If it does, we only need + // to make it one check mark shorter at the end. + setItemChecked(rotate(runStart[i], -1, rangeStart, rangeEnd), true); + } + setItemChecked(rotate(runEnd[i], -1, rangeStart, rangeEnd), false); + } + } + + private static int buildRunList(SparseBooleanArray cip, int rangeStart, + int rangeEnd, int[] runStart, int[] runEnd) { + int runCount = 0; + + int i = findFirstSetIndex(cip, rangeStart, rangeEnd); + if (i == -1) + return 0; + + int position = cip.keyAt(i); + int currentRunStart = position; + int currentRunEnd = currentRunStart + 1; + for (i++; i < cip.size() && (position = cip.keyAt(i)) < rangeEnd; i++) { + if (!cip.valueAt(i)) // not checked => not interesting + continue; + if (position == currentRunEnd) { + currentRunEnd++; + } else { + runStart[runCount] = currentRunStart; + runEnd[runCount] = currentRunEnd; + runCount++; + currentRunStart = position; + currentRunEnd = position + 1; + } + } + + if (currentRunEnd == rangeEnd) { + // rangeStart and rangeEnd are equivalent positions so to be + // consistent we translate them to the same integer value. That way + // we can check whether a run covers the entire range by just + // checking if the start equals the end position. + currentRunEnd = rangeStart; + } + runStart[runCount] = currentRunStart; + runEnd[runCount] = currentRunEnd; + runCount++; + + if (runCount > 1) { + if (runStart[0] == rangeStart && runEnd[runCount - 1] == rangeStart) { + // The last run ends at the end of the range, and the first run + // starts at the beginning of the range. So they are actually + // part of the same run, except they wrap around the end of the + // range. To avoid adjacent runs, we need to merge them. + runStart[0] = runStart[runCount - 1]; + runCount--; + } + } + return runCount; + } + + private static int rotate(int value, int offset, int lowerBound, int upperBound) { + int windowSize = upperBound - lowerBound; + + value += offset; + if (value < lowerBound) { + value += windowSize; + } else if (value >= upperBound) { + value -= windowSize; + } + return value; + } + + private static int findFirstSetIndex(SparseBooleanArray sba, int rangeStart, int rangeEnd) { + int size = sba.size(); + int i = insertionIndexForKey(sba, rangeStart); + while (i < size && sba.keyAt(i) < rangeEnd && !sba.valueAt(i)) + i++; + if (i == size || sba.keyAt(i) >= rangeEnd) + return -1; + return i; + } + + private static int insertionIndexForKey(SparseBooleanArray sba, int key) { + int low = 0; + int high = sba.size(); + while (high - low > 0) { + int middle = (low + high) >> 1; + if (sba.keyAt(middle) < key) + low = middle + 1; + else + high = middle; + } + return low; + } + + /** + * Interface for controlling + * scroll speed as a function of touch position and time. Use + * {@link DragSortListView#setDragScrollProfile(DragScrollProfile)} to + * set custom profile. + * + * @author heycosmo + * + */ + public interface DragScrollProfile { + /** + * Return a scroll speed in pixels/millisecond. Always return a + * positive number. + * + * @param w Normalized position in scroll region (i.e. w \in [0,1]). + * Small w typically means slow scrolling. + * @param t Time (in milliseconds) since start of scroll (handy if you + * want scroll acceleration). + * @return Scroll speed at position w and time t in pixels/ms. + */ + float getSpeed(float w, long t); + } + + private class DragScroller implements Runnable { + + private boolean mAbort; + + private long mPrevTime; + private long mCurrTime; + + private int dy; + private float dt; + private long tStart; + private int scrollDir; + + public final static int STOP = -1; + public final static int UP = 0; + public final static int DOWN = 1; + + private float mScrollSpeed; // pixels per ms + + private boolean mScrolling = false; + + private int mLastHeader; + private int mFirstFooter; + + public boolean isScrolling() { + return mScrolling; + } + + public int getScrollDir() { + return mScrolling ? scrollDir : STOP; + } + + public DragScroller() { + } + + public void startScrolling(int dir) { + if (!mScrolling) { + // Debug.startMethodTracing("dslv-scroll"); + mAbort = false; + mScrolling = true; + tStart = SystemClock.uptimeMillis(); + mPrevTime = tStart; + scrollDir = dir; + post(this); + } + } + + public void stopScrolling(boolean now) { + if (now) { + DragSortListView.this.removeCallbacks(this); + mScrolling = false; + } else { + mAbort = true; + } + + // Debug.stopMethodTracing(); + } + + @Override + public void run() { + if (mAbort) { + mScrolling = false; + return; + } + + // Log.d("mobeta", "scroll"); + + final int first = getFirstVisiblePosition(); + final int last = getLastVisiblePosition(); + final int count = getCount(); + final int padTop = getPaddingTop(); + final int listHeight = getHeight() - padTop - getPaddingBottom(); + + int minY = Math.min(mY, mFloatViewMid + mFloatViewHeightHalf); + int maxY = Math.max(mY, mFloatViewMid - mFloatViewHeightHalf); + + if (scrollDir == UP) { + View v = getChildAt(0); + // Log.d("mobeta", "vtop="+v.getTop()+" padtop="+padTop); + if (v == null) { + mScrolling = false; + return; + } else { + if (first == 0 && v.getTop() == padTop) { + mScrolling = false; + return; + } + } + mScrollSpeed = mScrollProfile.getSpeed((mUpScrollStartYF - maxY) + / mDragUpScrollHeight, mPrevTime); + } else { + View v = getChildAt(last - first); + if (v == null) { + mScrolling = false; + return; + } else { + if (last == count - 1 && v.getBottom() <= listHeight + padTop) { + mScrolling = false; + return; + } + } + mScrollSpeed = -mScrollProfile.getSpeed((minY - mDownScrollStartYF) + / mDragDownScrollHeight, mPrevTime); + } + + mCurrTime = SystemClock.uptimeMillis(); + dt = (float) (mCurrTime - mPrevTime); + + // dy is change in View position of a list item; i.e. positive dy + // means user is scrolling up (list item moves down the screen, + // remember + // y=0 is at top of View). + dy = (int) Math.round(mScrollSpeed * dt); + + int movePos; + if (dy >= 0) { + dy = Math.min(listHeight, dy); + movePos = first; + } else { + dy = Math.max(-listHeight, dy); + movePos = last; + } + + final View moveItem = getChildAt(movePos - first); + int top = moveItem.getTop() + dy; + + if (movePos == 0 && top > padTop) { + top = padTop; + } + + // always do scroll + mBlockLayoutRequests = true; + + setSelectionFromTop(movePos, top - padTop); + DragSortListView.this.layoutChildren(); + invalidate(); + + mBlockLayoutRequests = false; + + // scroll means relative float View movement + doDragFloatView(movePos, moveItem, false); + + mPrevTime = mCurrTime; + // Log.d("mobeta", " updated prevTime="+mPrevTime); + + post(this); + } + } + + private class DragSortTracker { + StringBuilder mBuilder = new StringBuilder(); + + File mFile; + + private int mNumInBuffer = 0; + private int mNumFlushes = 0; + + private boolean mTracking = false; + + public DragSortTracker() { + File root = Environment.getExternalStorageDirectory(); + mFile = new File(root, "dslv_state.txt"); + + if (!mFile.exists()) { + try { + mFile.createNewFile(); + Log.d("mobeta", "file created"); + } catch (IOException e) { + Log.w("mobeta", "Could not create dslv_state.txt"); + Log.d("mobeta", e.getMessage()); + } + } + + } + + public void startTracking() { + mBuilder.append("<DSLVStates>\n"); + mNumFlushes = 0; + mTracking = true; + } + + public void appendState() { + if (!mTracking) { + return; + } + + mBuilder.append("<DSLVState>\n"); + final int children = getChildCount(); + final int first = getFirstVisiblePosition(); + mBuilder.append(" <Positions>"); + for (int i = 0; i < children; ++i) { + mBuilder.append(first + i).append(","); + } + mBuilder.append("</Positions>\n"); + + mBuilder.append(" <Tops>"); + for (int i = 0; i < children; ++i) { + mBuilder.append(getChildAt(i).getTop()).append(","); + } + mBuilder.append("</Tops>\n"); + mBuilder.append(" <Bottoms>"); + for (int i = 0; i < children; ++i) { + mBuilder.append(getChildAt(i).getBottom()).append(","); + } + mBuilder.append("</Bottoms>\n"); + + mBuilder.append(" <FirstExpPos>").append(mFirstExpPos).append("</FirstExpPos>\n"); + mBuilder.append(" <FirstExpBlankHeight>") + .append(getItemHeight(mFirstExpPos) - getChildHeight(mFirstExpPos)) + .append("</FirstExpBlankHeight>\n"); + mBuilder.append(" <SecondExpPos>").append(mSecondExpPos).append("</SecondExpPos>\n"); + mBuilder.append(" <SecondExpBlankHeight>") + .append(getItemHeight(mSecondExpPos) - getChildHeight(mSecondExpPos)) + .append("</SecondExpBlankHeight>\n"); + mBuilder.append(" <SrcPos>").append(mSrcPos).append("</SrcPos>\n"); + mBuilder.append(" <SrcHeight>").append(mFloatViewHeight + getDividerHeight()) + .append("</SrcHeight>\n"); + mBuilder.append(" <ViewHeight>").append(getHeight()).append("</ViewHeight>\n"); + mBuilder.append(" <LastY>").append(mLastY).append("</LastY>\n"); + mBuilder.append(" <FloatY>").append(mFloatViewMid).append("</FloatY>\n"); + mBuilder.append(" <ShuffleEdges>"); + for (int i = 0; i < children; ++i) { + mBuilder.append(getShuffleEdge(first + i, getChildAt(i).getTop())).append(","); + } + mBuilder.append("</ShuffleEdges>\n"); + + mBuilder.append("</DSLVState>\n"); + mNumInBuffer++; + + if (mNumInBuffer > 1000) { + flush(); + mNumInBuffer = 0; + } + } + + public void flush() { + if (!mTracking) { + return; + } + + // save to file on sdcard + try { + boolean append = true; + if (mNumFlushes == 0) { + append = false; + } + FileWriter writer = new FileWriter(mFile, append); + + writer.write(mBuilder.toString()); + mBuilder.delete(0, mBuilder.length()); + + writer.flush(); + writer.close(); + + mNumFlushes++; + } catch (IOException e) { + // do nothing + } + } + + public void stopTracking() { + if (mTracking) { + mBuilder.append("</DSLVStates>\n"); + flush(); + mTracking = false; + } + } + + } + +} diff --git a/app/src/main/java/com/mobeta/android/dslv/ResourceDragSortCursorAdapter.java b/app/src/main/java/com/mobeta/android/dslv/ResourceDragSortCursorAdapter.java new file mode 100644 index 0000000..f2d0810 --- /dev/null +++ b/app/src/main/java/com/mobeta/android/dslv/ResourceDragSortCursorAdapter.java @@ -0,0 +1,133 @@ +/* + * Copyright (C) 2011 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. + */ + +package com.mobeta.android.dslv; + +import android.content.Context; +import android.database.Cursor; +import android.view.View; +import android.view.ViewGroup; +import android.view.LayoutInflater; + +// taken from v4 rev. 10 ResourceCursorAdapter.java + +/** + * Static library support version of the framework's {@link android.widget.ResourceCursorAdapter}. + * Used to write apps that run on platforms prior to Android 3.0. When running + * on Android 3.0 or above, this implementation is still used; it does not try + * to switch to the framework's implementation. See the framework SDK + * documentation for a class overview. + */ +public abstract class ResourceDragSortCursorAdapter extends DragSortCursorAdapter { + private int mLayout; + + private int mDropDownLayout; + + private LayoutInflater mInflater; + + /** + * Constructor the enables auto-requery. + * + * @deprecated This option is discouraged, as it results in Cursor queries + * being performed on the application's UI thread and thus can cause poor + * responsiveness or even Application Not Responding errors. As an alternative, + * use {@link android.app.LoaderManager} with a {@link android.content.CursorLoader}. + * + * @param context The context where the ListView associated with this adapter is running + * @param layout resource identifier of a layout file that defines the views + * for this list item. Unless you override them later, this will + * define both the item views and the drop down views. + */ + @Deprecated + public ResourceDragSortCursorAdapter(Context context, int layout, Cursor c) { + super(context, c); + mLayout = mDropDownLayout = layout; + mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + } + + /** + * Constructor with default behavior as per + * {@link CursorAdapter#CursorAdapter(Context, Cursor, boolean)}; it is recommended + * you not use this, but instead {@link #ResourceCursorAdapter(Context, int, Cursor, int)}. + * When using this constructor, {@link #FLAG_REGISTER_CONTENT_OBSERVER} + * will always be set. + * + * @param context The context where the ListView associated with this adapter is running + * @param layout resource identifier of a layout file that defines the views + * for this list item. Unless you override them later, this will + * define both the item views and the drop down views. + * @param c The cursor from which to get the data. + * @param autoRequery If true the adapter will call requery() on the + * cursor whenever it changes so the most recent + * data is always displayed. Using true here is discouraged. + */ + public ResourceDragSortCursorAdapter(Context context, int layout, Cursor c, boolean autoRequery) { + super(context, c, autoRequery); + mLayout = mDropDownLayout = layout; + mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + } + + /** + * Standard constructor. + * + * @param context The context where the ListView associated with this adapter is running + * @param layout Resource identifier of a layout file that defines the views + * for this list item. Unless you override them later, this will + * define both the item views and the drop down views. + * @param c The cursor from which to get the data. + * @param flags Flags used to determine the behavior of the adapter, + * as per {@link CursorAdapter#CursorAdapter(Context, Cursor, int)}. + */ + public ResourceDragSortCursorAdapter(Context context, int layout, Cursor c, int flags) { + super(context, c, flags); + mLayout = mDropDownLayout = layout; + mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + } + + /** + * Inflates view(s) from the specified XML file. + * + * @see android.widget.CursorAdapter#newView(android.content.Context, + * android.database.Cursor, ViewGroup) + */ + @Override + public View newView(Context context, Cursor cursor, ViewGroup parent) { + return mInflater.inflate(mLayout, parent, false); + } + + @Override + public View newDropDownView(Context context, Cursor cursor, ViewGroup parent) { + return mInflater.inflate(mDropDownLayout, parent, false); + } + + /** + * <p>Sets the layout resource of the item views.</p> + * + * @param layout the layout resources used to create item views + */ + public void setViewResource(int layout) { + mLayout = layout; + } + + /** + * <p>Sets the layout resource of the drop down views.</p> + * + * @param dropDownLayout the layout resources used to create drop down views + */ + public void setDropDownViewResource(int dropDownLayout) { + mDropDownLayout = dropDownLayout; + } +} diff --git a/app/src/main/java/com/mobeta/android/dslv/SimpleDragSortCursorAdapter.java b/app/src/main/java/com/mobeta/android/dslv/SimpleDragSortCursorAdapter.java new file mode 100644 index 0000000..7a76ea9 --- /dev/null +++ b/app/src/main/java/com/mobeta/android/dslv/SimpleDragSortCursorAdapter.java @@ -0,0 +1,422 @@ +/* + * Copyright (C) 2006 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. + */ + +package com.mobeta.android.dslv; + +import android.content.Context; +import android.database.Cursor; +import android.net.Uri; +import android.view.View; +import android.widget.TextView; +import android.widget.ImageView; + +// taken from sdk/sources/android-16/android/widget/SimpleCursorAdapter.java + +/** + * An easy adapter to map columns from a cursor to TextViews or ImageViews + * defined in an XML file. You can specify which columns you want, which + * views you want to display the columns, and the XML file that defines + * the appearance of these views. + * + * Binding occurs in two phases. First, if a + * {@link android.widget.SimpleCursorAdapter.ViewBinder} is available, + * {@link ViewBinder#setViewValue(android.view.View, android.database.Cursor, int)} + * is invoked. If the returned value is true, binding has occured. If the + * returned value is false and the view to bind is a TextView, + * {@link #setViewText(TextView, String)} is invoked. If the returned value + * is false and the view to bind is an ImageView, + * {@link #setViewImage(ImageView, String)} is invoked. If no appropriate + * binding can be found, an {@link IllegalStateException} is thrown. + * + * If this adapter is used with filtering, for instance in an + * {@link android.widget.AutoCompleteTextView}, you can use the + * {@link android.widget.SimpleCursorAdapter.CursorToStringConverter} and the + * {@link android.widget.FilterQueryProvider} interfaces + * to get control over the filtering process. You can refer to + * {@link #convertToString(android.database.Cursor)} and + * {@link #runQueryOnBackgroundThread(CharSequence)} for more information. + */ +public class SimpleDragSortCursorAdapter extends ResourceDragSortCursorAdapter { + /** + * A list of columns containing the data to bind to the UI. + * This field should be made private, so it is hidden from the SDK. + * {@hide} + */ + protected int[] mFrom; + /** + * A list of View ids representing the views to which the data must be bound. + * This field should be made private, so it is hidden from the SDK. + * {@hide} + */ + protected int[] mTo; + + private int mStringConversionColumn = -1; + private CursorToStringConverter mCursorToStringConverter; + private ViewBinder mViewBinder; + + String[] mOriginalFrom; + + /** + * Constructor the enables auto-requery. + * + * @deprecated This option is discouraged, as it results in Cursor queries + * being performed on the application's UI thread and thus can cause poor + * responsiveness or even Application Not Responding errors. As an alternative, + * use {@link android.app.LoaderManager} with a {@link android.content.CursorLoader}. + */ + @Deprecated + public SimpleDragSortCursorAdapter(Context context, int layout, Cursor c, String[] from, int[] to) { + super(context, layout, c); + mTo = to; + mOriginalFrom = from; + findColumns(c, from); + } + + /** + * Standard constructor. + * + * @param context The context where the ListView associated with this + * SimpleListItemFactory is running + * @param layout resource identifier of a layout file that defines the views + * for this list item. The layout file should include at least + * those named views defined in "to" + * @param c The database cursor. Can be null if the cursor is not available yet. + * @param from A list of column names representing the data to bind to the UI. Can be null + * if the cursor is not available yet. + * @param to The views that should display column in the "from" parameter. + * These should all be TextViews. The first N views in this list + * are given the values of the first N columns in the from + * parameter. Can be null if the cursor is not available yet. + * @param flags Flags used to determine the behavior of the adapter, + * as per {@link CursorAdapter#CursorAdapter(Context, Cursor, int)}. + */ + public SimpleDragSortCursorAdapter(Context context, int layout, + Cursor c, String[] from, int[] to, int flags) { + super(context, layout, c, flags); + mTo = to; + mOriginalFrom = from; + findColumns(c, from); + } + + /** + * Binds all of the field names passed into the "to" parameter of the + * constructor with their corresponding cursor columns as specified in the + * "from" parameter. + * + * Binding occurs in two phases. First, if a + * {@link android.widget.SimpleCursorAdapter.ViewBinder} is available, + * {@link ViewBinder#setViewValue(android.view.View, android.database.Cursor, int)} + * is invoked. If the returned value is true, binding has occured. If the + * returned value is false and the view to bind is a TextView, + * {@link #setViewText(TextView, String)} is invoked. If the returned value is + * false and the view to bind is an ImageView, + * {@link #setViewImage(ImageView, String)} is invoked. If no appropriate + * binding can be found, an {@link IllegalStateException} is thrown. + * + * @throws IllegalStateException if binding cannot occur + * + * @see android.widget.CursorAdapter#bindView(android.view.View, + * android.content.Context, android.database.Cursor) + * @see #getViewBinder() + * @see #setViewBinder(android.widget.SimpleCursorAdapter.ViewBinder) + * @see #setViewImage(ImageView, String) + * @see #setViewText(TextView, String) + */ + @Override + public void bindView(View view, Context context, Cursor cursor) { + final ViewBinder binder = mViewBinder; + final int count = mTo.length; + final int[] from = mFrom; + final int[] to = mTo; + + for (int i = 0; i < count; i++) { + final View v = view.findViewById(to[i]); + if (v != null) { + boolean bound = false; + if (binder != null) { + bound = binder.setViewValue(v, cursor, from[i]); + } + + if (!bound) { + String text = cursor.getString(from[i]); + if (text == null) { + text = ""; + } + + if (v instanceof TextView) { + setViewText((TextView) v, text); + } else if (v instanceof ImageView) { + setViewImage((ImageView) v, text); + } else { + throw new IllegalStateException(v.getClass().getName() + " is not a " + + " view that can be bounds by this SimpleCursorAdapter"); + } + } + } + } + } + + /** + * Returns the {@link ViewBinder} used to bind data to views. + * + * @return a ViewBinder or null if the binder does not exist + * + * @see #bindView(android.view.View, android.content.Context, android.database.Cursor) + * @see #setViewBinder(android.widget.SimpleCursorAdapter.ViewBinder) + */ + public ViewBinder getViewBinder() { + return mViewBinder; + } + + /** + * Sets the binder used to bind data to views. + * + * @param viewBinder the binder used to bind data to views, can be null to + * remove the existing binder + * + * @see #bindView(android.view.View, android.content.Context, android.database.Cursor) + * @see #getViewBinder() + */ + public void setViewBinder(ViewBinder viewBinder) { + mViewBinder = viewBinder; + } + + /** + * Called by bindView() to set the image for an ImageView but only if + * there is no existing ViewBinder or if the existing ViewBinder cannot + * handle binding to an ImageView. + * + * By default, the value will be treated as an image resource. If the + * value cannot be used as an image resource, the value is used as an + * image Uri. + * + * Intended to be overridden by Adapters that need to filter strings + * retrieved from the database. + * + * @param v ImageView to receive an image + * @param value the value retrieved from the cursor + */ + public void setViewImage(ImageView v, String value) { + try { + v.setImageResource(Integer.parseInt(value)); + } catch (NumberFormatException nfe) { + v.setImageURI(Uri.parse(value)); + } + } + + /** + * Called by bindView() to set the text for a TextView but only if + * there is no existing ViewBinder or if the existing ViewBinder cannot + * handle binding to a TextView. + * + * Intended to be overridden by Adapters that need to filter strings + * retrieved from the database. + * + * @param v TextView to receive text + * @param text the text to be set for the TextView + */ + public void setViewText(TextView v, String text) { + v.setText(text); + } + + /** + * Return the index of the column used to get a String representation + * of the Cursor. + * + * @return a valid index in the current Cursor or -1 + * + * @see android.widget.CursorAdapter#convertToString(android.database.Cursor) + * @see #setStringConversionColumn(int) + * @see #setCursorToStringConverter(android.widget.SimpleCursorAdapter.CursorToStringConverter) + * @see #getCursorToStringConverter() + */ + public int getStringConversionColumn() { + return mStringConversionColumn; + } + + /** + * Defines the index of the column in the Cursor used to get a String + * representation of that Cursor. The column is used to convert the + * Cursor to a String only when the current CursorToStringConverter + * is null. + * + * @param stringConversionColumn a valid index in the current Cursor or -1 to use the default + * conversion mechanism + * + * @see android.widget.CursorAdapter#convertToString(android.database.Cursor) + * @see #getStringConversionColumn() + * @see #setCursorToStringConverter(android.widget.SimpleCursorAdapter.CursorToStringConverter) + * @see #getCursorToStringConverter() + */ + public void setStringConversionColumn(int stringConversionColumn) { + mStringConversionColumn = stringConversionColumn; + } + + /** + * Returns the converter used to convert the filtering Cursor + * into a String. + * + * @return null if the converter does not exist or an instance of + * {@link android.widget.SimpleCursorAdapter.CursorToStringConverter} + * + * @see #setCursorToStringConverter(android.widget.SimpleCursorAdapter.CursorToStringConverter) + * @see #getStringConversionColumn() + * @see #setStringConversionColumn(int) + * @see android.widget.CursorAdapter#convertToString(android.database.Cursor) + */ + public CursorToStringConverter getCursorToStringConverter() { + return mCursorToStringConverter; + } + + /** + * Sets the converter used to convert the filtering Cursor + * into a String. + * + * @param cursorToStringConverter the Cursor to String converter, or + * null to remove the converter + * + * @see #setCursorToStringConverter(android.widget.SimpleCursorAdapter.CursorToStringConverter) + * @see #getStringConversionColumn() + * @see #setStringConversionColumn(int) + * @see android.widget.CursorAdapter#convertToString(android.database.Cursor) + */ + public void setCursorToStringConverter(CursorToStringConverter cursorToStringConverter) { + mCursorToStringConverter = cursorToStringConverter; + } + + /** + * Returns a CharSequence representation of the specified Cursor as defined + * by the current CursorToStringConverter. If no CursorToStringConverter + * has been set, the String conversion column is used instead. If the + * conversion column is -1, the returned String is empty if the cursor + * is null or Cursor.toString(). + * + * @param cursor the Cursor to convert to a CharSequence + * + * @return a non-null CharSequence representing the cursor + */ + @Override + public CharSequence convertToString(Cursor cursor) { + if (mCursorToStringConverter != null) { + return mCursorToStringConverter.convertToString(cursor); + } else if (mStringConversionColumn > -1) { + return cursor.getString(mStringConversionColumn); + } + + return super.convertToString(cursor); + } + + /** + * Create a map from an array of strings to an array of column-id integers in cursor c. + * If c is null, the array will be discarded. + * + * @param c the cursor to find the columns from + * @param from the Strings naming the columns of interest + */ + private void findColumns(Cursor c, String[] from) { + if (c != null) { + int i; + int count = from.length; + if (mFrom == null || mFrom.length != count) { + mFrom = new int[count]; + } + for (i = 0; i < count; i++) { + mFrom[i] = c.getColumnIndexOrThrow(from[i]); + } + } else { + mFrom = null; + } + } + + @Override + public Cursor swapCursor(Cursor c) { + // super.swapCursor() will notify observers before we have + // a valid mapping, make sure we have a mapping before this + // happens + findColumns(c, mOriginalFrom); + return super.swapCursor(c); + } + + /** + * Change the cursor and change the column-to-view mappings at the same time. + * + * @param c The database cursor. Can be null if the cursor is not available yet. + * @param from A list of column names representing the data to bind to the UI. Can be null + * if the cursor is not available yet. + * @param to The views that should display column in the "from" parameter. + * These should all be TextViews. The first N views in this list + * are given the values of the first N columns in the from + * parameter. Can be null if the cursor is not available yet. + */ + public void changeCursorAndColumns(Cursor c, String[] from, int[] to) { + mOriginalFrom = from; + mTo = to; + // super.changeCursor() will notify observers before we have + // a valid mapping, make sure we have a mapping before this + // happens + findColumns(c, mOriginalFrom); + super.changeCursor(c); + } + + /** + * This class can be used by external clients of SimpleCursorAdapter + * to bind values fom the Cursor to views. + * + * You should use this class to bind values from the Cursor to views + * that are not directly supported by SimpleCursorAdapter or to + * change the way binding occurs for views supported by + * SimpleCursorAdapter. + * + * @see SimpleCursorAdapter#bindView(android.view.View, android.content.Context, android.database.Cursor) + * @see SimpleCursorAdapter#setViewImage(ImageView, String) + * @see SimpleCursorAdapter#setViewText(TextView, String) + */ + public static interface ViewBinder { + /** + * Binds the Cursor column defined by the specified index to the specified view. + * + * When binding is handled by this ViewBinder, this method must return true. + * If this method returns false, SimpleCursorAdapter will attempts to handle + * the binding on its own. + * + * @param view the view to bind the data to + * @param cursor the cursor to get the data from + * @param columnIndex the column at which the data can be found in the cursor + * + * @return true if the data was bound to the view, false otherwise + */ + boolean setViewValue(View view, Cursor cursor, int columnIndex); + } + + /** + * This class can be used by external clients of SimpleCursorAdapter + * to define how the Cursor should be converted to a String. + * + * @see android.widget.CursorAdapter#convertToString(android.database.Cursor) + */ + public static interface CursorToStringConverter { + /** + * Returns a CharSequence representing the specified Cursor. + * + * @param cursor the cursor for which a CharSequence representation + * is requested + * + * @return a non-null CharSequence representing the cursor + */ + CharSequence convertToString(Cursor cursor); + } + +} diff --git a/app/src/main/java/com/mobeta/android/dslv/SimpleFloatViewManager.java b/app/src/main/java/com/mobeta/android/dslv/SimpleFloatViewManager.java new file mode 100644 index 0000000..0c2aac5 --- /dev/null +++ b/app/src/main/java/com/mobeta/android/dslv/SimpleFloatViewManager.java @@ -0,0 +1,93 @@ +package com.mobeta.android.dslv; + +import android.graphics.Bitmap; +import android.graphics.Point; +import android.graphics.Color; +import android.widget.ListView; +import android.widget.ImageView; +import android.view.View; +import android.view.ViewGroup; +import android.util.Log; + +/** + * Simple implementation of the FloatViewManager class. Uses list + * items as they appear in the ListView to create the floating View. + */ +public class SimpleFloatViewManager implements DragSortListView.FloatViewManager { + + private Bitmap mFloatBitmap; + + private ImageView mImageView; + + private int mFloatBGColor = Color.BLACK; + + private ListView mListView; + + public SimpleFloatViewManager(ListView lv) { + mListView = lv; + } + + public void setBackgroundColor(int color) { + mFloatBGColor = color; + } + + /** + * This simple implementation creates a Bitmap copy of the + * list item currently shown at ListView <code>position</code>. + */ + @Override + public View onCreateFloatView(int position) { + // Guaranteed that this will not be null? I think so. Nope, got + // a NullPointerException once... + View v = mListView.getChildAt(position + mListView.getHeaderViewsCount() - mListView.getFirstVisiblePosition()); + + if (v == null) { + return null; + } + + v.setPressed(false); + + // Create a copy of the drawing cache so that it does not get + // recycled by the framework when the list tries to clean up memory + //v.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_HIGH); + v.setDrawingCacheEnabled(true); + mFloatBitmap = Bitmap.createBitmap(v.getDrawingCache()); + v.setDrawingCacheEnabled(false); + + if (mImageView == null) { + mImageView = new ImageView(mListView.getContext()); + } + mImageView.setBackgroundColor(mFloatBGColor); + mImageView.setPadding(0, 0, 0, 0); + mImageView.setImageBitmap(mFloatBitmap); + mImageView.setLayoutParams(new ViewGroup.LayoutParams(v.getWidth(), v.getHeight())); + + return mImageView; + } + + /** + * This does nothing + */ + @Override + public void onDragFloatView(View floatView, Point position, Point touch) { + // do nothing + } + + /** + * Removes the Bitmap from the ImageView created in + * onCreateFloatView() and tells the system to recycle it. + */ + @Override + public void onDestroyFloatView(View floatView) { + ((ImageView) floatView).setImageDrawable(null); + + mFloatBitmap.recycle(); + mFloatBitmap = null; + } + + @Override + public void setSecondaryOnTouchListener(View.OnTouchListener l) { + // do nothing + } +} + diff --git a/app/src/main/res/color/tab_text_selector.xml b/app/src/main/res/color/tab_text_selector.xml new file mode 100644 index 0000000..2cebf88 --- /dev/null +++ b/app/src/main/res/color/tab_text_selector.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:state_selected="true" android:color="@android:color/background_light" /> + <item android:color="@android:color/background_light" android:alpha="0.65" /> +</selector> diff --git a/app/src/main/res/drawable-hdpi/arrow.png b/app/src/main/res/drawable-hdpi/arrow.png Binary files differnew file mode 100644 index 0000000..6756b0a --- /dev/null +++ b/app/src/main/res/drawable-hdpi/arrow.png diff --git a/app/src/main/res/drawable-hdpi/arrow_up.png b/app/src/main/res/drawable-hdpi/arrow_up.png Binary files differnew file mode 100644 index 0000000..a280097 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/arrow_up.png diff --git a/app/src/main/res/drawable-hdpi/btn_rating_star_off_mtrl_alpha.png b/app/src/main/res/drawable-hdpi/btn_rating_star_off_mtrl_alpha.png Binary files differnew file mode 100644 index 0000000..51a895d --- /dev/null +++ b/app/src/main/res/drawable-hdpi/btn_rating_star_off_mtrl_alpha.png diff --git a/app/src/main/res/drawable-hdpi/btn_rating_star_on_mtrl_alpha.png b/app/src/main/res/drawable-hdpi/btn_rating_star_on_mtrl_alpha.png Binary files differnew file mode 100644 index 0000000..2f59488 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/btn_rating_star_on_mtrl_alpha.png diff --git a/app/src/main/res/drawable-hdpi/empty.png b/app/src/main/res/drawable-hdpi/empty.png Binary files differnew file mode 100644 index 0000000..97c918e --- /dev/null +++ b/app/src/main/res/drawable-hdpi/empty.png diff --git a/app/src/main/res/drawable-hdpi/fallback_cover.png b/app/src/main/res/drawable-hdpi/fallback_cover.png Binary files differnew file mode 100644 index 0000000..d78583c --- /dev/null +++ b/app/src/main/res/drawable-hdpi/fallback_cover.png diff --git a/app/src/main/res/drawable-hdpi/fallback_cover_large.png b/app/src/main/res/drawable-hdpi/fallback_cover_large.png Binary files differnew file mode 100644 index 0000000..afe75a6 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/fallback_cover_large.png diff --git a/app/src/main/res/drawable-hdpi/file_document.png b/app/src/main/res/drawable-hdpi/file_document.png Binary files differnew file mode 100644 index 0000000..a75adbd --- /dev/null +++ b/app/src/main/res/drawable-hdpi/file_document.png diff --git a/app/src/main/res/drawable-hdpi/file_image.png b/app/src/main/res/drawable-hdpi/file_image.png Binary files differnew file mode 100644 index 0000000..144b622 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/file_image.png diff --git a/app/src/main/res/drawable-hdpi/file_music.png b/app/src/main/res/drawable-hdpi/file_music.png Binary files differnew file mode 100644 index 0000000..f2341d2 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/file_music.png diff --git a/app/src/main/res/drawable-hdpi/folder.png b/app/src/main/res/drawable-hdpi/folder.png Binary files differnew file mode 100644 index 0000000..cbf13c0 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/folder.png diff --git a/app/src/main/res/drawable-hdpi/grabber.png b/app/src/main/res/drawable-hdpi/grabber.png Binary files differnew file mode 100644 index 0000000..e4e3aa9 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/grabber.png diff --git a/app/src/main/res/drawable-hdpi/ic_menu_add.png b/app/src/main/res/drawable-hdpi/ic_menu_add.png Binary files differnew file mode 100644 index 0000000..44acda2 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/ic_menu_add.png diff --git a/app/src/main/res/drawable-hdpi/ic_menu_moreoverflow_normal_holo_dark.png b/app/src/main/res/drawable-hdpi/ic_menu_moreoverflow_normal_holo_dark.png Binary files differnew file mode 100644 index 0000000..2abc458 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/ic_menu_moreoverflow_normal_holo_dark.png diff --git a/app/src/main/res/drawable-hdpi/ic_menu_music_library.png b/app/src/main/res/drawable-hdpi/ic_menu_music_library.png Binary files differnew file mode 100644 index 0000000..000dc6a --- /dev/null +++ b/app/src/main/res/drawable-hdpi/ic_menu_music_library.png diff --git a/app/src/main/res/drawable-hdpi/ic_menu_preferences.png b/app/src/main/res/drawable-hdpi/ic_menu_preferences.png Binary files differnew file mode 100644 index 0000000..322c852 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/ic_menu_preferences.png diff --git a/app/src/main/res/drawable-hdpi/ic_menu_search_holo.png b/app/src/main/res/drawable-hdpi/ic_menu_search_holo.png Binary files differnew file mode 100644 index 0000000..2cb57d1 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/ic_menu_search_holo.png diff --git a/app/src/main/res/drawable-hdpi/ic_menu_search_material.png b/app/src/main/res/drawable-hdpi/ic_menu_search_material.png Binary files differnew file mode 100644 index 0000000..bbfbc96 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/ic_menu_search_material.png diff --git a/app/src/main/res/drawable-hdpi/ic_menu_sort_alphabetically.png b/app/src/main/res/drawable-hdpi/ic_menu_sort_alphabetically.png Binary files differnew file mode 100644 index 0000000..858ce41 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/ic_menu_sort_alphabetically.png diff --git a/app/src/main/res/drawable-hdpi/menu_add_to_homescreen.png b/app/src/main/res/drawable-hdpi/menu_add_to_homescreen.png Binary files differnew file mode 100644 index 0000000..df3cc5c --- /dev/null +++ b/app/src/main/res/drawable-hdpi/menu_add_to_homescreen.png diff --git a/app/src/main/res/drawable-hdpi/menu_add_to_playlist.png b/app/src/main/res/drawable-hdpi/menu_add_to_playlist.png Binary files differnew file mode 100644 index 0000000..0e12874 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/menu_add_to_playlist.png diff --git a/app/src/main/res/drawable-hdpi/menu_album.png b/app/src/main/res/drawable-hdpi/menu_album.png Binary files differnew file mode 100644 index 0000000..cb74e70 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/menu_album.png diff --git a/app/src/main/res/drawable-hdpi/menu_artist.png b/app/src/main/res/drawable-hdpi/menu_artist.png Binary files differnew file mode 100644 index 0000000..e79c22e --- /dev/null +++ b/app/src/main/res/drawable-hdpi/menu_artist.png diff --git a/app/src/main/res/drawable-hdpi/menu_delete.png b/app/src/main/res/drawable-hdpi/menu_delete.png Binary files differnew file mode 100644 index 0000000..391f680 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/menu_delete.png diff --git a/app/src/main/res/drawable-hdpi/menu_details.png b/app/src/main/res/drawable-hdpi/menu_details.png Binary files differnew file mode 100644 index 0000000..3ed3b3e --- /dev/null +++ b/app/src/main/res/drawable-hdpi/menu_details.png diff --git a/app/src/main/res/drawable-hdpi/menu_edit.png b/app/src/main/res/drawable-hdpi/menu_edit.png Binary files differnew file mode 100644 index 0000000..b8cec0c --- /dev/null +++ b/app/src/main/res/drawable-hdpi/menu_edit.png diff --git a/app/src/main/res/drawable-hdpi/menu_enqueue.png b/app/src/main/res/drawable-hdpi/menu_enqueue.png Binary files differnew file mode 100644 index 0000000..40025cd --- /dev/null +++ b/app/src/main/res/drawable-hdpi/menu_enqueue.png diff --git a/app/src/main/res/drawable-hdpi/menu_enqueue_as_next.png b/app/src/main/res/drawable-hdpi/menu_enqueue_as_next.png Binary files differnew file mode 100644 index 0000000..99ac21e --- /dev/null +++ b/app/src/main/res/drawable-hdpi/menu_enqueue_as_next.png diff --git a/app/src/main/res/drawable-hdpi/menu_expand.png b/app/src/main/res/drawable-hdpi/menu_expand.png Binary files differnew file mode 100644 index 0000000..956368d --- /dev/null +++ b/app/src/main/res/drawable-hdpi/menu_expand.png diff --git a/app/src/main/res/drawable-hdpi/menu_launch.png b/app/src/main/res/drawable-hdpi/menu_launch.png Binary files differnew file mode 100644 index 0000000..6f8a22a --- /dev/null +++ b/app/src/main/res/drawable-hdpi/menu_launch.png diff --git a/app/src/main/res/drawable-hdpi/menu_move_to_bottom.png b/app/src/main/res/drawable-hdpi/menu_move_to_bottom.png Binary files differnew file mode 100644 index 0000000..b3df372 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/menu_move_to_bottom.png diff --git a/app/src/main/res/drawable-hdpi/menu_move_to_top.png b/app/src/main/res/drawable-hdpi/menu_move_to_top.png Binary files differnew file mode 100644 index 0000000..993269d --- /dev/null +++ b/app/src/main/res/drawable-hdpi/menu_move_to_top.png diff --git a/app/src/main/res/drawable-hdpi/menu_play.png b/app/src/main/res/drawable-hdpi/menu_play.png Binary files differnew file mode 100644 index 0000000..5e266df --- /dev/null +++ b/app/src/main/res/drawable-hdpi/menu_play.png diff --git a/app/src/main/res/drawable-hdpi/menu_play_all.png b/app/src/main/res/drawable-hdpi/menu_play_all.png Binary files differnew file mode 100644 index 0000000..52b6254 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/menu_play_all.png diff --git a/app/src/main/res/drawable-hdpi/menu_plugins.png b/app/src/main/res/drawable-hdpi/menu_plugins.png Binary files differnew file mode 100644 index 0000000..63f2ed3 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/menu_plugins.png diff --git a/app/src/main/res/drawable-hdpi/menu_remove.png b/app/src/main/res/drawable-hdpi/menu_remove.png Binary files differnew file mode 100644 index 0000000..4ba88da --- /dev/null +++ b/app/src/main/res/drawable-hdpi/menu_remove.png diff --git a/app/src/main/res/drawable-hdpi/next.png b/app/src/main/res/drawable-hdpi/next.png Binary files differnew file mode 100644 index 0000000..2cbf032 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/next.png diff --git a/app/src/main/res/drawable-hdpi/pause.png b/app/src/main/res/drawable-hdpi/pause.png Binary files differnew file mode 100644 index 0000000..0d47f5a --- /dev/null +++ b/app/src/main/res/drawable-hdpi/pause.png diff --git a/app/src/main/res/drawable-hdpi/play.png b/app/src/main/res/drawable-hdpi/play.png Binary files differnew file mode 100644 index 0000000..930f393 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/play.png diff --git a/app/src/main/res/drawable-hdpi/previous.png b/app/src/main/res/drawable-hdpi/previous.png Binary files differnew file mode 100644 index 0000000..287fa56 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/previous.png diff --git a/app/src/main/res/drawable-hdpi/random_active.png b/app/src/main/res/drawable-hdpi/random_active.png Binary files differnew file mode 100644 index 0000000..0f1e7c4 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/random_active.png diff --git a/app/src/main/res/drawable-hdpi/repeat_active.png b/app/src/main/res/drawable-hdpi/repeat_active.png Binary files differnew file mode 100644 index 0000000..058c7a2 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/repeat_active.png diff --git a/app/src/main/res/drawable-hdpi/repeat_current_active.png b/app/src/main/res/drawable-hdpi/repeat_current_active.png Binary files differnew file mode 100644 index 0000000..cfa9c9c --- /dev/null +++ b/app/src/main/res/drawable-hdpi/repeat_current_active.png diff --git a/app/src/main/res/drawable-hdpi/repeat_inactive.png b/app/src/main/res/drawable-hdpi/repeat_inactive.png Binary files differnew file mode 100644 index 0000000..c9dfaef --- /dev/null +++ b/app/src/main/res/drawable-hdpi/repeat_inactive.png diff --git a/app/src/main/res/drawable-hdpi/repeat_inactive_service.png b/app/src/main/res/drawable-hdpi/repeat_inactive_service.png Binary files differnew file mode 100644 index 0000000..3b8c551 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/repeat_inactive_service.png diff --git a/app/src/main/res/drawable-hdpi/shortcut_play.png b/app/src/main/res/drawable-hdpi/shortcut_play.png Binary files differnew file mode 100644 index 0000000..5a8310f --- /dev/null +++ b/app/src/main/res/drawable-hdpi/shortcut_play.png diff --git a/app/src/main/res/drawable-hdpi/shortcut_random.png b/app/src/main/res/drawable-hdpi/shortcut_random.png Binary files differnew file mode 100644 index 0000000..74b88a8 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/shortcut_random.png diff --git a/app/src/main/res/drawable-hdpi/shuffle_active.png b/app/src/main/res/drawable-hdpi/shuffle_active.png Binary files differnew file mode 100644 index 0000000..76da5c2 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/shuffle_active.png diff --git a/app/src/main/res/drawable-hdpi/shuffle_album_active.png b/app/src/main/res/drawable-hdpi/shuffle_album_active.png Binary files differnew file mode 100644 index 0000000..8f8eebe --- /dev/null +++ b/app/src/main/res/drawable-hdpi/shuffle_album_active.png diff --git a/app/src/main/res/drawable-hdpi/shuffle_inactive.png b/app/src/main/res/drawable-hdpi/shuffle_inactive.png Binary files differnew file mode 100644 index 0000000..7237e5c --- /dev/null +++ b/app/src/main/res/drawable-hdpi/shuffle_inactive.png diff --git a/app/src/main/res/drawable-hdpi/shuffle_inactive_service.png b/app/src/main/res/drawable-hdpi/shuffle_inactive_service.png Binary files differnew file mode 100644 index 0000000..f3799ba --- /dev/null +++ b/app/src/main/res/drawable-hdpi/shuffle_inactive_service.png diff --git a/app/src/main/res/drawable-hdpi/status_icon.png b/app/src/main/res/drawable-hdpi/status_icon.png Binary files differnew file mode 100644 index 0000000..84baab6 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/status_icon.png diff --git a/app/src/main/res/drawable-hdpi/status_scan_0.png b/app/src/main/res/drawable-hdpi/status_scan_0.png Binary files differnew file mode 100644 index 0000000..1b5e903 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/status_scan_0.png diff --git a/app/src/main/res/drawable-hdpi/status_scan_1.png b/app/src/main/res/drawable-hdpi/status_scan_1.png Binary files differnew file mode 100644 index 0000000..ebe41b4 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/status_scan_1.png diff --git a/app/src/main/res/drawable-hdpi/status_scan_2.png b/app/src/main/res/drawable-hdpi/status_scan_2.png Binary files differnew file mode 100644 index 0000000..17c7ac7 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/status_scan_2.png diff --git a/app/src/main/res/drawable-hdpi/status_scan_3.png b/app/src/main/res/drawable-hdpi/status_scan_3.png Binary files differnew file mode 100644 index 0000000..d2474ff --- /dev/null +++ b/app/src/main/res/drawable-hdpi/status_scan_3.png diff --git a/app/src/main/res/drawable-hdpi/status_scan_4.png b/app/src/main/res/drawable-hdpi/status_scan_4.png Binary files differnew file mode 100644 index 0000000..ed0a5c7 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/status_scan_4.png diff --git a/app/src/main/res/drawable-hdpi/stop_current_active.png b/app/src/main/res/drawable-hdpi/stop_current_active.png Binary files differnew file mode 100644 index 0000000..893f6a9 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/stop_current_active.png diff --git a/app/src/main/res/drawable-hdpi/vinyl_left.png b/app/src/main/res/drawable-hdpi/vinyl_left.png Binary files differnew file mode 100644 index 0000000..8494d9c --- /dev/null +++ b/app/src/main/res/drawable-hdpi/vinyl_left.png diff --git a/app/src/main/res/drawable-hdpi/vinyl_right.png b/app/src/main/res/drawable-hdpi/vinyl_right.png Binary files differnew file mode 100644 index 0000000..9fa74b1 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/vinyl_right.png diff --git a/app/src/main/res/drawable-hdpi/widget_bg.9.png b/app/src/main/res/drawable-hdpi/widget_bg.9.png Binary files differnew file mode 100644 index 0000000..00b6b03 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/widget_bg.9.png diff --git a/app/src/main/res/drawable-hdpi/widget_next.png b/app/src/main/res/drawable-hdpi/widget_next.png Binary files differnew file mode 100644 index 0000000..0f4368c --- /dev/null +++ b/app/src/main/res/drawable-hdpi/widget_next.png diff --git a/app/src/main/res/drawable-hdpi/widget_pause.png b/app/src/main/res/drawable-hdpi/widget_pause.png Binary files differnew file mode 100644 index 0000000..0b9999a --- /dev/null +++ b/app/src/main/res/drawable-hdpi/widget_pause.png diff --git a/app/src/main/res/drawable-hdpi/widget_play.png b/app/src/main/res/drawable-hdpi/widget_play.png Binary files differnew file mode 100644 index 0000000..e93564e --- /dev/null +++ b/app/src/main/res/drawable-hdpi/widget_play.png diff --git a/app/src/main/res/drawable-hdpi/widget_previous.png b/app/src/main/res/drawable-hdpi/widget_previous.png Binary files differnew file mode 100644 index 0000000..65b346f --- /dev/null +++ b/app/src/main/res/drawable-hdpi/widget_previous.png diff --git a/app/src/main/res/drawable-mdpi/arrow.png b/app/src/main/res/drawable-mdpi/arrow.png Binary files differnew file mode 100644 index 0000000..3b5e082 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/arrow.png diff --git a/app/src/main/res/drawable-mdpi/arrow_up.png b/app/src/main/res/drawable-mdpi/arrow_up.png Binary files differnew file mode 100644 index 0000000..ff7d359 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/arrow_up.png diff --git a/app/src/main/res/drawable-mdpi/btn_rating_star_off_mtrl_alpha.png b/app/src/main/res/drawable-mdpi/btn_rating_star_off_mtrl_alpha.png Binary files differnew file mode 100644 index 0000000..d38aed2 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/btn_rating_star_off_mtrl_alpha.png diff --git a/app/src/main/res/drawable-mdpi/btn_rating_star_on_mtrl_alpha.png b/app/src/main/res/drawable-mdpi/btn_rating_star_on_mtrl_alpha.png Binary files differnew file mode 100644 index 0000000..87dade3 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/btn_rating_star_on_mtrl_alpha.png diff --git a/app/src/main/res/drawable-mdpi/empty.png b/app/src/main/res/drawable-mdpi/empty.png Binary files differnew file mode 100644 index 0000000..ea9baef --- /dev/null +++ b/app/src/main/res/drawable-mdpi/empty.png diff --git a/app/src/main/res/drawable-mdpi/fallback_cover.png b/app/src/main/res/drawable-mdpi/fallback_cover.png Binary files differnew file mode 100644 index 0000000..82ca126 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/fallback_cover.png diff --git a/app/src/main/res/drawable-mdpi/fallback_cover_large.png b/app/src/main/res/drawable-mdpi/fallback_cover_large.png Binary files differnew file mode 100644 index 0000000..bd14698 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/fallback_cover_large.png diff --git a/app/src/main/res/drawable-mdpi/file_document.png b/app/src/main/res/drawable-mdpi/file_document.png Binary files differnew file mode 100644 index 0000000..5936c72 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/file_document.png diff --git a/app/src/main/res/drawable-mdpi/file_image.png b/app/src/main/res/drawable-mdpi/file_image.png Binary files differnew file mode 100644 index 0000000..f47983b --- /dev/null +++ b/app/src/main/res/drawable-mdpi/file_image.png diff --git a/app/src/main/res/drawable-mdpi/file_music.png b/app/src/main/res/drawable-mdpi/file_music.png Binary files differnew file mode 100644 index 0000000..ad23e19 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/file_music.png diff --git a/app/src/main/res/drawable-mdpi/folder.png b/app/src/main/res/drawable-mdpi/folder.png Binary files differnew file mode 100644 index 0000000..b150867 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/folder.png diff --git a/app/src/main/res/drawable-mdpi/grabber.png b/app/src/main/res/drawable-mdpi/grabber.png Binary files differnew file mode 100644 index 0000000..e64bd3a --- /dev/null +++ b/app/src/main/res/drawable-mdpi/grabber.png diff --git a/app/src/main/res/drawable-mdpi/ic_menu_add.png b/app/src/main/res/drawable-mdpi/ic_menu_add.png Binary files differnew file mode 100644 index 0000000..e30700e --- /dev/null +++ b/app/src/main/res/drawable-mdpi/ic_menu_add.png diff --git a/app/src/main/res/drawable-mdpi/ic_menu_moreoverflow_normal_holo_dark.png b/app/src/main/res/drawable-mdpi/ic_menu_moreoverflow_normal_holo_dark.png Binary files differnew file mode 100644 index 0000000..ba704b6 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/ic_menu_moreoverflow_normal_holo_dark.png diff --git a/app/src/main/res/drawable-mdpi/ic_menu_music_library.png b/app/src/main/res/drawable-mdpi/ic_menu_music_library.png Binary files differnew file mode 100644 index 0000000..877501b --- /dev/null +++ b/app/src/main/res/drawable-mdpi/ic_menu_music_library.png diff --git a/app/src/main/res/drawable-mdpi/ic_menu_preferences.png b/app/src/main/res/drawable-mdpi/ic_menu_preferences.png Binary files differnew file mode 100644 index 0000000..b4a3d5b --- /dev/null +++ b/app/src/main/res/drawable-mdpi/ic_menu_preferences.png diff --git a/app/src/main/res/drawable-mdpi/ic_menu_search_holo.png b/app/src/main/res/drawable-mdpi/ic_menu_search_holo.png Binary files differnew file mode 100755 index 0000000..5d3155e --- /dev/null +++ b/app/src/main/res/drawable-mdpi/ic_menu_search_holo.png diff --git a/app/src/main/res/drawable-mdpi/ic_menu_search_material.png b/app/src/main/res/drawable-mdpi/ic_menu_search_material.png Binary files differnew file mode 100644 index 0000000..faefc59 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/ic_menu_search_material.png diff --git a/app/src/main/res/drawable-mdpi/ic_menu_sort_alphabetically.png b/app/src/main/res/drawable-mdpi/ic_menu_sort_alphabetically.png Binary files differnew file mode 100644 index 0000000..c6d6f3b --- /dev/null +++ b/app/src/main/res/drawable-mdpi/ic_menu_sort_alphabetically.png diff --git a/app/src/main/res/drawable-mdpi/menu_add_to_homescreen.png b/app/src/main/res/drawable-mdpi/menu_add_to_homescreen.png Binary files differnew file mode 100644 index 0000000..a232798 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/menu_add_to_homescreen.png diff --git a/app/src/main/res/drawable-mdpi/menu_add_to_playlist.png b/app/src/main/res/drawable-mdpi/menu_add_to_playlist.png Binary files differnew file mode 100644 index 0000000..25e4974 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/menu_add_to_playlist.png diff --git a/app/src/main/res/drawable-mdpi/menu_album.png b/app/src/main/res/drawable-mdpi/menu_album.png Binary files differnew file mode 100644 index 0000000..7f8884f --- /dev/null +++ b/app/src/main/res/drawable-mdpi/menu_album.png diff --git a/app/src/main/res/drawable-mdpi/menu_artist.png b/app/src/main/res/drawable-mdpi/menu_artist.png Binary files differnew file mode 100644 index 0000000..3254153 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/menu_artist.png diff --git a/app/src/main/res/drawable-mdpi/menu_delete.png b/app/src/main/res/drawable-mdpi/menu_delete.png Binary files differnew file mode 100644 index 0000000..b27cc7c --- /dev/null +++ b/app/src/main/res/drawable-mdpi/menu_delete.png diff --git a/app/src/main/res/drawable-mdpi/menu_details.png b/app/src/main/res/drawable-mdpi/menu_details.png Binary files differnew file mode 100644 index 0000000..d40f673 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/menu_details.png diff --git a/app/src/main/res/drawable-mdpi/menu_edit.png b/app/src/main/res/drawable-mdpi/menu_edit.png Binary files differnew file mode 100644 index 0000000..c3bf345 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/menu_edit.png diff --git a/app/src/main/res/drawable-mdpi/menu_enqueue.png b/app/src/main/res/drawable-mdpi/menu_enqueue.png Binary files differnew file mode 100644 index 0000000..051be8a --- /dev/null +++ b/app/src/main/res/drawable-mdpi/menu_enqueue.png diff --git a/app/src/main/res/drawable-mdpi/menu_enqueue_as_next.png b/app/src/main/res/drawable-mdpi/menu_enqueue_as_next.png Binary files differnew file mode 100644 index 0000000..be05645 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/menu_enqueue_as_next.png diff --git a/app/src/main/res/drawable-mdpi/menu_expand.png b/app/src/main/res/drawable-mdpi/menu_expand.png Binary files differnew file mode 100644 index 0000000..2180187 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/menu_expand.png diff --git a/app/src/main/res/drawable-mdpi/menu_launch.png b/app/src/main/res/drawable-mdpi/menu_launch.png Binary files differnew file mode 100644 index 0000000..a4d593d --- /dev/null +++ b/app/src/main/res/drawable-mdpi/menu_launch.png diff --git a/app/src/main/res/drawable-mdpi/menu_move_to_bottom.png b/app/src/main/res/drawable-mdpi/menu_move_to_bottom.png Binary files differnew file mode 100644 index 0000000..efb6b00 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/menu_move_to_bottom.png diff --git a/app/src/main/res/drawable-mdpi/menu_move_to_top.png b/app/src/main/res/drawable-mdpi/menu_move_to_top.png Binary files differnew file mode 100644 index 0000000..30184ee --- /dev/null +++ b/app/src/main/res/drawable-mdpi/menu_move_to_top.png diff --git a/app/src/main/res/drawable-mdpi/menu_play.png b/app/src/main/res/drawable-mdpi/menu_play.png Binary files differnew file mode 100644 index 0000000..5e379b6 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/menu_play.png diff --git a/app/src/main/res/drawable-mdpi/menu_play_all.png b/app/src/main/res/drawable-mdpi/menu_play_all.png Binary files differnew file mode 100644 index 0000000..17e2ed7 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/menu_play_all.png diff --git a/app/src/main/res/drawable-mdpi/menu_plugins.png b/app/src/main/res/drawable-mdpi/menu_plugins.png Binary files differnew file mode 100644 index 0000000..4f8af68 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/menu_plugins.png diff --git a/app/src/main/res/drawable-mdpi/menu_remove.png b/app/src/main/res/drawable-mdpi/menu_remove.png Binary files differnew file mode 100644 index 0000000..e040561 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/menu_remove.png diff --git a/app/src/main/res/drawable-mdpi/next.png b/app/src/main/res/drawable-mdpi/next.png Binary files differnew file mode 100644 index 0000000..b547127 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/next.png diff --git a/app/src/main/res/drawable-mdpi/pause.png b/app/src/main/res/drawable-mdpi/pause.png Binary files differnew file mode 100644 index 0000000..694e0d7 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/pause.png diff --git a/app/src/main/res/drawable-mdpi/play.png b/app/src/main/res/drawable-mdpi/play.png Binary files differnew file mode 100644 index 0000000..8c28611 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/play.png diff --git a/app/src/main/res/drawable-mdpi/previous.png b/app/src/main/res/drawable-mdpi/previous.png Binary files differnew file mode 100644 index 0000000..b69b61e --- /dev/null +++ b/app/src/main/res/drawable-mdpi/previous.png diff --git a/app/src/main/res/drawable-mdpi/random_active.png b/app/src/main/res/drawable-mdpi/random_active.png Binary files differnew file mode 100644 index 0000000..e686404 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/random_active.png diff --git a/app/src/main/res/drawable-mdpi/repeat_active.png b/app/src/main/res/drawable-mdpi/repeat_active.png Binary files differnew file mode 100644 index 0000000..22c7fe0 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/repeat_active.png diff --git a/app/src/main/res/drawable-mdpi/repeat_current_active.png b/app/src/main/res/drawable-mdpi/repeat_current_active.png Binary files differnew file mode 100644 index 0000000..9a616ad --- /dev/null +++ b/app/src/main/res/drawable-mdpi/repeat_current_active.png diff --git a/app/src/main/res/drawable-mdpi/repeat_inactive.png b/app/src/main/res/drawable-mdpi/repeat_inactive.png Binary files differnew file mode 100644 index 0000000..1ea5874 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/repeat_inactive.png diff --git a/app/src/main/res/drawable-mdpi/repeat_inactive_service.png b/app/src/main/res/drawable-mdpi/repeat_inactive_service.png Binary files differnew file mode 100644 index 0000000..e02a7d1 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/repeat_inactive_service.png diff --git a/app/src/main/res/drawable-mdpi/shortcut_play.png b/app/src/main/res/drawable-mdpi/shortcut_play.png Binary files differnew file mode 100644 index 0000000..83b32aa --- /dev/null +++ b/app/src/main/res/drawable-mdpi/shortcut_play.png diff --git a/app/src/main/res/drawable-mdpi/shortcut_random.png b/app/src/main/res/drawable-mdpi/shortcut_random.png Binary files differnew file mode 100644 index 0000000..1e4d683 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/shortcut_random.png diff --git a/app/src/main/res/drawable-mdpi/shuffle_active.png b/app/src/main/res/drawable-mdpi/shuffle_active.png Binary files differnew file mode 100644 index 0000000..9e9164e --- /dev/null +++ b/app/src/main/res/drawable-mdpi/shuffle_active.png diff --git a/app/src/main/res/drawable-mdpi/shuffle_album_active.png b/app/src/main/res/drawable-mdpi/shuffle_album_active.png Binary files differnew file mode 100644 index 0000000..bd1054f --- /dev/null +++ b/app/src/main/res/drawable-mdpi/shuffle_album_active.png diff --git a/app/src/main/res/drawable-mdpi/shuffle_inactive.png b/app/src/main/res/drawable-mdpi/shuffle_inactive.png Binary files differnew file mode 100644 index 0000000..46bd935 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/shuffle_inactive.png diff --git a/app/src/main/res/drawable-mdpi/shuffle_inactive_service.png b/app/src/main/res/drawable-mdpi/shuffle_inactive_service.png Binary files differnew file mode 100644 index 0000000..d1bfcf5 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/shuffle_inactive_service.png diff --git a/app/src/main/res/drawable-mdpi/status_icon.png b/app/src/main/res/drawable-mdpi/status_icon.png Binary files differnew file mode 100644 index 0000000..f7191f5 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/status_icon.png diff --git a/app/src/main/res/drawable-mdpi/status_scan_0.png b/app/src/main/res/drawable-mdpi/status_scan_0.png Binary files differnew file mode 100644 index 0000000..c443f41 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/status_scan_0.png diff --git a/app/src/main/res/drawable-mdpi/status_scan_1.png b/app/src/main/res/drawable-mdpi/status_scan_1.png Binary files differnew file mode 100644 index 0000000..6e02727 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/status_scan_1.png diff --git a/app/src/main/res/drawable-mdpi/status_scan_2.png b/app/src/main/res/drawable-mdpi/status_scan_2.png Binary files differnew file mode 100644 index 0000000..07668b1 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/status_scan_2.png diff --git a/app/src/main/res/drawable-mdpi/status_scan_3.png b/app/src/main/res/drawable-mdpi/status_scan_3.png Binary files differnew file mode 100644 index 0000000..eaf204e --- /dev/null +++ b/app/src/main/res/drawable-mdpi/status_scan_3.png diff --git a/app/src/main/res/drawable-mdpi/status_scan_4.png b/app/src/main/res/drawable-mdpi/status_scan_4.png Binary files differnew file mode 100644 index 0000000..eb6d0a9 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/status_scan_4.png diff --git a/app/src/main/res/drawable-mdpi/stop_current_active.png b/app/src/main/res/drawable-mdpi/stop_current_active.png Binary files differnew file mode 100644 index 0000000..9f40904 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/stop_current_active.png diff --git a/app/src/main/res/drawable-mdpi/vinyl_right.png b/app/src/main/res/drawable-mdpi/vinyl_right.png Binary files differnew file mode 100644 index 0000000..c9a316c --- /dev/null +++ b/app/src/main/res/drawable-mdpi/vinyl_right.png diff --git a/app/src/main/res/drawable-mdpi/widget_bg.9.png b/app/src/main/res/drawable-mdpi/widget_bg.9.png Binary files differnew file mode 100644 index 0000000..23e5db7 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/widget_bg.9.png diff --git a/app/src/main/res/drawable-mdpi/widget_next.png b/app/src/main/res/drawable-mdpi/widget_next.png Binary files differnew file mode 100644 index 0000000..9e0eda2 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/widget_next.png diff --git a/app/src/main/res/drawable-mdpi/widget_pause.png b/app/src/main/res/drawable-mdpi/widget_pause.png Binary files differnew file mode 100644 index 0000000..54940e5 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/widget_pause.png diff --git a/app/src/main/res/drawable-mdpi/widget_play.png b/app/src/main/res/drawable-mdpi/widget_play.png Binary files differnew file mode 100644 index 0000000..89aa1b6 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/widget_play.png diff --git a/app/src/main/res/drawable-mdpi/widget_previous.png b/app/src/main/res/drawable-mdpi/widget_previous.png Binary files differnew file mode 100644 index 0000000..91af205 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/widget_previous.png diff --git a/app/src/main/res/drawable-v21/ic_menu_moreoverflow.xml b/app/src/main/res/drawable-v21/ic_menu_moreoverflow.xml new file mode 100644 index 0000000..b65be4e --- /dev/null +++ b/app/src/main/res/drawable-v21/ic_menu_moreoverflow.xml @@ -0,0 +1,24 @@ +<!-- +Copyright (C) 2014 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. +--> +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + <path + android:pathData="M12,8c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2c-1.1,0 -2,0.9 -2,2S10.9,8 12,8zM12,10c-1.1,0 -2,0.9 -2,2s0.9,2 2,2c1.1,0 2,-0.9 2,-2S13.1,10 12,10zM12,16c-1.1,0 -2,0.9 -2,2s0.9,2 2,2c1.1,0 2,-0.9 2,-2S13.1,16 12,16z" + android:fillColor="@android:color/white"/> +</vector> diff --git a/app/src/main/res/drawable-v21/ic_menu_search.xml b/app/src/main/res/drawable-v21/ic_menu_search.xml new file mode 100644 index 0000000..a502414 --- /dev/null +++ b/app/src/main/res/drawable-v21/ic_menu_search.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- holo style menu button drawable --> +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item + android:drawable="@drawable/ic_menu_search_material" /> +</selector> diff --git a/app/src/main/res/drawable-v21/inset_divider.xml b/app/src/main/res/drawable-v21/inset_divider.xml new file mode 100644 index 0000000..adf90f1 --- /dev/null +++ b/app/src/main/res/drawable-v21/inset_divider.xml @@ -0,0 +1,6 @@ +<inset xmlns:android="http://schemas.android.com/apk/res/android" + android:drawable="?android:attr/dividerHorizontal" + android:insetLeft="8sp" + android:insetRight="8sp" > +</inset> + diff --git a/app/src/main/res/drawable-v21/unbound_ripple_light.xml b/app/src/main/res/drawable-v21/unbound_ripple_light.xml new file mode 100644 index 0000000..7788fa4 --- /dev/null +++ b/app/src/main/res/drawable-v21/unbound_ripple_light.xml @@ -0,0 +1,3 @@ +<ripple xmlns:android="http://schemas.android.com/apk/res/android" + android:color="#30ffffff" > +</ripple> diff --git a/app/src/main/res/drawable-xhdpi/arrow.png b/app/src/main/res/drawable-xhdpi/arrow.png Binary files differnew file mode 100644 index 0000000..d1c1bd4 --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/arrow.png diff --git a/app/src/main/res/drawable-xhdpi/arrow_up.png b/app/src/main/res/drawable-xhdpi/arrow_up.png Binary files differnew file mode 100644 index 0000000..abf6ba6 --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/arrow_up.png diff --git a/app/src/main/res/drawable-xhdpi/btn_rating_star_off_mtrl_alpha.png b/app/src/main/res/drawable-xhdpi/btn_rating_star_off_mtrl_alpha.png Binary files differnew file mode 100644 index 0000000..33ec44c --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/btn_rating_star_off_mtrl_alpha.png diff --git a/app/src/main/res/drawable-xhdpi/btn_rating_star_on_mtrl_alpha.png b/app/src/main/res/drawable-xhdpi/btn_rating_star_on_mtrl_alpha.png Binary files differnew file mode 100644 index 0000000..0166d70 --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/btn_rating_star_on_mtrl_alpha.png diff --git a/app/src/main/res/drawable-xhdpi/empty.png b/app/src/main/res/drawable-xhdpi/empty.png Binary files differnew file mode 100644 index 0000000..ead59f0 --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/empty.png diff --git a/app/src/main/res/drawable-xhdpi/fallback_cover.png b/app/src/main/res/drawable-xhdpi/fallback_cover.png Binary files differnew file mode 100644 index 0000000..9a712d8 --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/fallback_cover.png diff --git a/app/src/main/res/drawable-xhdpi/fallback_cover_large.png b/app/src/main/res/drawable-xhdpi/fallback_cover_large.png Binary files differnew file mode 100644 index 0000000..2c8550a --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/fallback_cover_large.png diff --git a/app/src/main/res/drawable-xhdpi/file_document.png b/app/src/main/res/drawable-xhdpi/file_document.png Binary files differnew file mode 100644 index 0000000..a870bdb --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/file_document.png diff --git a/app/src/main/res/drawable-xhdpi/file_image.png b/app/src/main/res/drawable-xhdpi/file_image.png Binary files differnew file mode 100644 index 0000000..3436ee9 --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/file_image.png diff --git a/app/src/main/res/drawable-xhdpi/file_music.png b/app/src/main/res/drawable-xhdpi/file_music.png Binary files differnew file mode 100644 index 0000000..708b598 --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/file_music.png diff --git a/app/src/main/res/drawable-xhdpi/folder.png b/app/src/main/res/drawable-xhdpi/folder.png Binary files differnew file mode 100644 index 0000000..7063237 --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/folder.png diff --git a/app/src/main/res/drawable-xhdpi/grabber.png b/app/src/main/res/drawable-xhdpi/grabber.png Binary files differnew file mode 100644 index 0000000..18f0427 --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/grabber.png diff --git a/app/src/main/res/drawable-xhdpi/ic_menu_moreoverflow_normal_holo_dark.png b/app/src/main/res/drawable-xhdpi/ic_menu_moreoverflow_normal_holo_dark.png Binary files differnew file mode 100644 index 0000000..a92fb1d --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/ic_menu_moreoverflow_normal_holo_dark.png diff --git a/app/src/main/res/drawable-xhdpi/ic_menu_search_holo.png b/app/src/main/res/drawable-xhdpi/ic_menu_search_holo.png Binary files differnew file mode 100644 index 0000000..e49890b --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/ic_menu_search_holo.png diff --git a/app/src/main/res/drawable-xhdpi/ic_menu_search_material.png b/app/src/main/res/drawable-xhdpi/ic_menu_search_material.png Binary files differnew file mode 100644 index 0000000..bfc3e39 --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/ic_menu_search_material.png diff --git a/app/src/main/res/drawable-xhdpi/menu_add_to_homescreen.png b/app/src/main/res/drawable-xhdpi/menu_add_to_homescreen.png Binary files differnew file mode 100644 index 0000000..a6baf7b --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/menu_add_to_homescreen.png diff --git a/app/src/main/res/drawable-xhdpi/menu_add_to_playlist.png b/app/src/main/res/drawable-xhdpi/menu_add_to_playlist.png Binary files differnew file mode 100644 index 0000000..208b962 --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/menu_add_to_playlist.png diff --git a/app/src/main/res/drawable-xhdpi/menu_album.png b/app/src/main/res/drawable-xhdpi/menu_album.png Binary files differnew file mode 100644 index 0000000..ece373d --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/menu_album.png diff --git a/app/src/main/res/drawable-xhdpi/menu_artist.png b/app/src/main/res/drawable-xhdpi/menu_artist.png Binary files differnew file mode 100644 index 0000000..aca0bcf --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/menu_artist.png diff --git a/app/src/main/res/drawable-xhdpi/menu_delete.png b/app/src/main/res/drawable-xhdpi/menu_delete.png Binary files differnew file mode 100644 index 0000000..5867d06 --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/menu_delete.png diff --git a/app/src/main/res/drawable-xhdpi/menu_details.png b/app/src/main/res/drawable-xhdpi/menu_details.png Binary files differnew file mode 100644 index 0000000..17cc71b --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/menu_details.png diff --git a/app/src/main/res/drawable-xhdpi/menu_edit.png b/app/src/main/res/drawable-xhdpi/menu_edit.png Binary files differnew file mode 100644 index 0000000..e5846ed --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/menu_edit.png diff --git a/app/src/main/res/drawable-xhdpi/menu_enqueue.png b/app/src/main/res/drawable-xhdpi/menu_enqueue.png Binary files differnew file mode 100644 index 0000000..706acf2 --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/menu_enqueue.png diff --git a/app/src/main/res/drawable-xhdpi/menu_enqueue_as_next.png b/app/src/main/res/drawable-xhdpi/menu_enqueue_as_next.png Binary files differnew file mode 100644 index 0000000..7e54cd4 --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/menu_enqueue_as_next.png diff --git a/app/src/main/res/drawable-xhdpi/menu_expand.png b/app/src/main/res/drawable-xhdpi/menu_expand.png Binary files differnew file mode 100644 index 0000000..31ba33e --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/menu_expand.png diff --git a/app/src/main/res/drawable-xhdpi/menu_launch.png b/app/src/main/res/drawable-xhdpi/menu_launch.png Binary files differnew file mode 100644 index 0000000..8d959bc --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/menu_launch.png diff --git a/app/src/main/res/drawable-xhdpi/menu_move_to_bottom.png b/app/src/main/res/drawable-xhdpi/menu_move_to_bottom.png Binary files differnew file mode 100644 index 0000000..6e6c89a --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/menu_move_to_bottom.png diff --git a/app/src/main/res/drawable-xhdpi/menu_move_to_top.png b/app/src/main/res/drawable-xhdpi/menu_move_to_top.png Binary files differnew file mode 100644 index 0000000..c7bc2c0 --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/menu_move_to_top.png diff --git a/app/src/main/res/drawable-xhdpi/menu_play.png b/app/src/main/res/drawable-xhdpi/menu_play.png Binary files differnew file mode 100644 index 0000000..e8044fa --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/menu_play.png diff --git a/app/src/main/res/drawable-xhdpi/menu_play_all.png b/app/src/main/res/drawable-xhdpi/menu_play_all.png Binary files differnew file mode 100644 index 0000000..08440fc --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/menu_play_all.png diff --git a/app/src/main/res/drawable-xhdpi/menu_plugins.png b/app/src/main/res/drawable-xhdpi/menu_plugins.png Binary files differnew file mode 100644 index 0000000..be1ee4b --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/menu_plugins.png diff --git a/app/src/main/res/drawable-xhdpi/menu_remove.png b/app/src/main/res/drawable-xhdpi/menu_remove.png Binary files differnew file mode 100644 index 0000000..ca6a00a --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/menu_remove.png diff --git a/app/src/main/res/drawable-xhdpi/next.png b/app/src/main/res/drawable-xhdpi/next.png Binary files differnew file mode 100644 index 0000000..508e9d5 --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/next.png diff --git a/app/src/main/res/drawable-xhdpi/pause.png b/app/src/main/res/drawable-xhdpi/pause.png Binary files differnew file mode 100644 index 0000000..0d660e5 --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/pause.png diff --git a/app/src/main/res/drawable-xhdpi/play.png b/app/src/main/res/drawable-xhdpi/play.png Binary files differnew file mode 100644 index 0000000..baee3d7 --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/play.png diff --git a/app/src/main/res/drawable-xhdpi/previous.png b/app/src/main/res/drawable-xhdpi/previous.png Binary files differnew file mode 100644 index 0000000..cd9f0f6 --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/previous.png diff --git a/app/src/main/res/drawable-xhdpi/random_active.png b/app/src/main/res/drawable-xhdpi/random_active.png Binary files differnew file mode 100644 index 0000000..520c216 --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/random_active.png diff --git a/app/src/main/res/drawable-xhdpi/repeat_active.png b/app/src/main/res/drawable-xhdpi/repeat_active.png Binary files differnew file mode 100644 index 0000000..4a67fcc --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/repeat_active.png diff --git a/app/src/main/res/drawable-xhdpi/repeat_current_active.png b/app/src/main/res/drawable-xhdpi/repeat_current_active.png Binary files differnew file mode 100644 index 0000000..db93713 --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/repeat_current_active.png diff --git a/app/src/main/res/drawable-xhdpi/repeat_inactive.png b/app/src/main/res/drawable-xhdpi/repeat_inactive.png Binary files differnew file mode 100644 index 0000000..d1618f2 --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/repeat_inactive.png diff --git a/app/src/main/res/drawable-xhdpi/repeat_inactive_service.png b/app/src/main/res/drawable-xhdpi/repeat_inactive_service.png Binary files differnew file mode 100644 index 0000000..667109b --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/repeat_inactive_service.png diff --git a/app/src/main/res/drawable-xhdpi/shortcut_play.png b/app/src/main/res/drawable-xhdpi/shortcut_play.png Binary files differnew file mode 100644 index 0000000..2563b91 --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/shortcut_play.png diff --git a/app/src/main/res/drawable-xhdpi/shortcut_random.png b/app/src/main/res/drawable-xhdpi/shortcut_random.png Binary files differnew file mode 100644 index 0000000..d171a28 --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/shortcut_random.png diff --git a/app/src/main/res/drawable-xhdpi/shuffle_active.png b/app/src/main/res/drawable-xhdpi/shuffle_active.png Binary files differnew file mode 100644 index 0000000..319dbf4 --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/shuffle_active.png diff --git a/app/src/main/res/drawable-xhdpi/shuffle_album_active.png b/app/src/main/res/drawable-xhdpi/shuffle_album_active.png Binary files differnew file mode 100644 index 0000000..b880401 --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/shuffle_album_active.png diff --git a/app/src/main/res/drawable-xhdpi/shuffle_inactive.png b/app/src/main/res/drawable-xhdpi/shuffle_inactive.png Binary files differnew file mode 100644 index 0000000..ea6546f --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/shuffle_inactive.png diff --git a/app/src/main/res/drawable-xhdpi/shuffle_inactive_service.png b/app/src/main/res/drawable-xhdpi/shuffle_inactive_service.png Binary files differnew file mode 100644 index 0000000..f9c2bae --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/shuffle_inactive_service.png diff --git a/app/src/main/res/drawable-xhdpi/status_icon.png b/app/src/main/res/drawable-xhdpi/status_icon.png Binary files differnew file mode 100644 index 0000000..74965a3 --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/status_icon.png diff --git a/app/src/main/res/drawable-xhdpi/status_scan_0.png b/app/src/main/res/drawable-xhdpi/status_scan_0.png Binary files differnew file mode 100644 index 0000000..d0182aa --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/status_scan_0.png diff --git a/app/src/main/res/drawable-xhdpi/status_scan_1.png b/app/src/main/res/drawable-xhdpi/status_scan_1.png Binary files differnew file mode 100644 index 0000000..9e48c35 --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/status_scan_1.png diff --git a/app/src/main/res/drawable-xhdpi/status_scan_2.png b/app/src/main/res/drawable-xhdpi/status_scan_2.png Binary files differnew file mode 100644 index 0000000..aef1376 --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/status_scan_2.png diff --git a/app/src/main/res/drawable-xhdpi/status_scan_3.png b/app/src/main/res/drawable-xhdpi/status_scan_3.png Binary files differnew file mode 100644 index 0000000..66cafe8 --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/status_scan_3.png diff --git a/app/src/main/res/drawable-xhdpi/status_scan_4.png b/app/src/main/res/drawable-xhdpi/status_scan_4.png Binary files differnew file mode 100644 index 0000000..5aefc38 --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/status_scan_4.png diff --git a/app/src/main/res/drawable-xhdpi/stop_current_active.png b/app/src/main/res/drawable-xhdpi/stop_current_active.png Binary files differnew file mode 100644 index 0000000..4c4b115 --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/stop_current_active.png diff --git a/app/src/main/res/drawable-xhdpi/vinyl_right.png b/app/src/main/res/drawable-xhdpi/vinyl_right.png Binary files differnew file mode 100644 index 0000000..0af2aef --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/vinyl_right.png diff --git a/app/src/main/res/drawable-xhdpi/widget_next.png b/app/src/main/res/drawable-xhdpi/widget_next.png Binary files differnew file mode 100644 index 0000000..b8763af --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/widget_next.png diff --git a/app/src/main/res/drawable-xhdpi/widget_pause.png b/app/src/main/res/drawable-xhdpi/widget_pause.png Binary files differnew file mode 100644 index 0000000..777bb7b --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/widget_pause.png diff --git a/app/src/main/res/drawable-xhdpi/widget_play.png b/app/src/main/res/drawable-xhdpi/widget_play.png Binary files differnew file mode 100644 index 0000000..cb58753 --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/widget_play.png diff --git a/app/src/main/res/drawable-xhdpi/widget_previous.png b/app/src/main/res/drawable-xhdpi/widget_previous.png Binary files differnew file mode 100644 index 0000000..114f1b2 --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/widget_previous.png diff --git a/app/src/main/res/drawable-xxhdpi/arrow.png b/app/src/main/res/drawable-xxhdpi/arrow.png Binary files differnew file mode 100644 index 0000000..7afbd6a --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/arrow.png diff --git a/app/src/main/res/drawable-xxhdpi/arrow_up.png b/app/src/main/res/drawable-xxhdpi/arrow_up.png Binary files differnew file mode 100644 index 0000000..73c7226 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/arrow_up.png diff --git a/app/src/main/res/drawable-xxhdpi/btn_rating_star_off_mtrl_alpha.png b/app/src/main/res/drawable-xxhdpi/btn_rating_star_off_mtrl_alpha.png Binary files differnew file mode 100644 index 0000000..4b49faf --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/btn_rating_star_off_mtrl_alpha.png diff --git a/app/src/main/res/drawable-xxhdpi/btn_rating_star_on_mtrl_alpha.png b/app/src/main/res/drawable-xxhdpi/btn_rating_star_on_mtrl_alpha.png Binary files differnew file mode 100644 index 0000000..561d9ef --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/btn_rating_star_on_mtrl_alpha.png diff --git a/app/src/main/res/drawable-xxhdpi/fallback_cover.png b/app/src/main/res/drawable-xxhdpi/fallback_cover.png Binary files differnew file mode 100644 index 0000000..c7ac87e --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/fallback_cover.png diff --git a/app/src/main/res/drawable-xxhdpi/fallback_cover_large.png b/app/src/main/res/drawable-xxhdpi/fallback_cover_large.png Binary files differnew file mode 100644 index 0000000..0976400 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/fallback_cover_large.png diff --git a/app/src/main/res/drawable-xxhdpi/file_document.png b/app/src/main/res/drawable-xxhdpi/file_document.png Binary files differnew file mode 100644 index 0000000..3174bb6 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/file_document.png diff --git a/app/src/main/res/drawable-xxhdpi/file_image.png b/app/src/main/res/drawable-xxhdpi/file_image.png Binary files differnew file mode 100644 index 0000000..95d22fa --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/file_image.png diff --git a/app/src/main/res/drawable-xxhdpi/file_music.png b/app/src/main/res/drawable-xxhdpi/file_music.png Binary files differnew file mode 100644 index 0000000..7ce874f --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/file_music.png diff --git a/app/src/main/res/drawable-xxhdpi/folder.png b/app/src/main/res/drawable-xxhdpi/folder.png Binary files differnew file mode 100644 index 0000000..fb36949 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/folder.png diff --git a/app/src/main/res/drawable-xxhdpi/grabber.png b/app/src/main/res/drawable-xxhdpi/grabber.png Binary files differnew file mode 100644 index 0000000..e207176 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/grabber.png diff --git a/app/src/main/res/drawable-xxhdpi/ic_menu_moreoverflow_normal_holo_dark.png b/app/src/main/res/drawable-xxhdpi/ic_menu_moreoverflow_normal_holo_dark.png Binary files differnew file mode 100644 index 0000000..498a9ff --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/ic_menu_moreoverflow_normal_holo_dark.png diff --git a/app/src/main/res/drawable-xxhdpi/ic_menu_search_holo.png b/app/src/main/res/drawable-xxhdpi/ic_menu_search_holo.png Binary files differnew file mode 100644 index 0000000..22bb4c8 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/ic_menu_search_holo.png diff --git a/app/src/main/res/drawable-xxhdpi/ic_menu_search_material.png b/app/src/main/res/drawable-xxhdpi/ic_menu_search_material.png Binary files differnew file mode 100644 index 0000000..abbb989 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/ic_menu_search_material.png diff --git a/app/src/main/res/drawable-xxhdpi/menu_add_to_homescreen.png b/app/src/main/res/drawable-xxhdpi/menu_add_to_homescreen.png Binary files differnew file mode 100644 index 0000000..8873552 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/menu_add_to_homescreen.png diff --git a/app/src/main/res/drawable-xxhdpi/menu_add_to_playlist.png b/app/src/main/res/drawable-xxhdpi/menu_add_to_playlist.png Binary files differnew file mode 100644 index 0000000..af96a76 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/menu_add_to_playlist.png diff --git a/app/src/main/res/drawable-xxhdpi/menu_album.png b/app/src/main/res/drawable-xxhdpi/menu_album.png Binary files differnew file mode 100644 index 0000000..cfbeed6 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/menu_album.png diff --git a/app/src/main/res/drawable-xxhdpi/menu_artist.png b/app/src/main/res/drawable-xxhdpi/menu_artist.png Binary files differnew file mode 100644 index 0000000..7706ca2 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/menu_artist.png diff --git a/app/src/main/res/drawable-xxhdpi/menu_delete.png b/app/src/main/res/drawable-xxhdpi/menu_delete.png Binary files differnew file mode 100644 index 0000000..78af7e3 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/menu_delete.png diff --git a/app/src/main/res/drawable-xxhdpi/menu_details.png b/app/src/main/res/drawable-xxhdpi/menu_details.png Binary files differnew file mode 100644 index 0000000..de11140 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/menu_details.png diff --git a/app/src/main/res/drawable-xxhdpi/menu_edit.png b/app/src/main/res/drawable-xxhdpi/menu_edit.png Binary files differnew file mode 100644 index 0000000..ff98542 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/menu_edit.png diff --git a/app/src/main/res/drawable-xxhdpi/menu_enqueue.png b/app/src/main/res/drawable-xxhdpi/menu_enqueue.png Binary files differnew file mode 100644 index 0000000..440c46d --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/menu_enqueue.png diff --git a/app/src/main/res/drawable-xxhdpi/menu_enqueue_as_next.png b/app/src/main/res/drawable-xxhdpi/menu_enqueue_as_next.png Binary files differnew file mode 100644 index 0000000..eb4f4ef --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/menu_enqueue_as_next.png diff --git a/app/src/main/res/drawable-xxhdpi/menu_expand.png b/app/src/main/res/drawable-xxhdpi/menu_expand.png Binary files differnew file mode 100644 index 0000000..d29536f --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/menu_expand.png diff --git a/app/src/main/res/drawable-xxhdpi/menu_launch.png b/app/src/main/res/drawable-xxhdpi/menu_launch.png Binary files differnew file mode 100644 index 0000000..d8fc856 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/menu_launch.png diff --git a/app/src/main/res/drawable-xxhdpi/menu_move_to_bottom.png b/app/src/main/res/drawable-xxhdpi/menu_move_to_bottom.png Binary files differnew file mode 100644 index 0000000..f3f78b8 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/menu_move_to_bottom.png diff --git a/app/src/main/res/drawable-xxhdpi/menu_move_to_top.png b/app/src/main/res/drawable-xxhdpi/menu_move_to_top.png Binary files differnew file mode 100644 index 0000000..b28de41 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/menu_move_to_top.png diff --git a/app/src/main/res/drawable-xxhdpi/menu_play.png b/app/src/main/res/drawable-xxhdpi/menu_play.png Binary files differnew file mode 100644 index 0000000..f9dfbad --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/menu_play.png diff --git a/app/src/main/res/drawable-xxhdpi/menu_play_all.png b/app/src/main/res/drawable-xxhdpi/menu_play_all.png Binary files differnew file mode 100644 index 0000000..1a324db --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/menu_play_all.png diff --git a/app/src/main/res/drawable-xxhdpi/menu_plugins.png b/app/src/main/res/drawable-xxhdpi/menu_plugins.png Binary files differnew file mode 100644 index 0000000..5707a4a --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/menu_plugins.png diff --git a/app/src/main/res/drawable-xxhdpi/menu_remove.png b/app/src/main/res/drawable-xxhdpi/menu_remove.png Binary files differnew file mode 100644 index 0000000..b8a0c38 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/menu_remove.png diff --git a/app/src/main/res/drawable-xxhdpi/next.png b/app/src/main/res/drawable-xxhdpi/next.png Binary files differnew file mode 100644 index 0000000..90516f2 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/next.png diff --git a/app/src/main/res/drawable-xxhdpi/pause.png b/app/src/main/res/drawable-xxhdpi/pause.png Binary files differnew file mode 100644 index 0000000..51cb6f3 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/pause.png diff --git a/app/src/main/res/drawable-xxhdpi/play.png b/app/src/main/res/drawable-xxhdpi/play.png Binary files differnew file mode 100644 index 0000000..60de5a7 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/play.png diff --git a/app/src/main/res/drawable-xxhdpi/preview_widget_d.png b/app/src/main/res/drawable-xxhdpi/preview_widget_d.png Binary files differnew file mode 100644 index 0000000..87a0893 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/preview_widget_d.png diff --git a/app/src/main/res/drawable-xxhdpi/preview_widget_e.png b/app/src/main/res/drawable-xxhdpi/preview_widget_e.png Binary files differnew file mode 100644 index 0000000..fad1999 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/preview_widget_e.png diff --git a/app/src/main/res/drawable-xxhdpi/preview_widget_four_long.png b/app/src/main/res/drawable-xxhdpi/preview_widget_four_long.png Binary files differnew file mode 100644 index 0000000..bc6d689 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/preview_widget_four_long.png diff --git a/app/src/main/res/drawable-xxhdpi/preview_widget_four_square.png b/app/src/main/res/drawable-xxhdpi/preview_widget_four_square.png Binary files differnew file mode 100644 index 0000000..c62d83b --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/preview_widget_four_square.png diff --git a/app/src/main/res/drawable-xxhdpi/preview_widget_four_white.png b/app/src/main/res/drawable-xxhdpi/preview_widget_four_white.png Binary files differnew file mode 100644 index 0000000..0a36309 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/preview_widget_four_white.png diff --git a/app/src/main/res/drawable-xxhdpi/preview_widget_one_cell.png b/app/src/main/res/drawable-xxhdpi/preview_widget_one_cell.png Binary files differnew file mode 100644 index 0000000..3568d99 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/preview_widget_one_cell.png diff --git a/app/src/main/res/drawable-xxhdpi/previous.png b/app/src/main/res/drawable-xxhdpi/previous.png Binary files differnew file mode 100644 index 0000000..c9f5151 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/previous.png diff --git a/app/src/main/res/drawable-xxhdpi/random_active.png b/app/src/main/res/drawable-xxhdpi/random_active.png Binary files differnew file mode 100644 index 0000000..3cdda12 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/random_active.png diff --git a/app/src/main/res/drawable-xxhdpi/repeat_active.png b/app/src/main/res/drawable-xxhdpi/repeat_active.png Binary files differnew file mode 100644 index 0000000..0d5cae9 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/repeat_active.png diff --git a/app/src/main/res/drawable-xxhdpi/repeat_current_active.png b/app/src/main/res/drawable-xxhdpi/repeat_current_active.png Binary files differnew file mode 100644 index 0000000..1eff329 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/repeat_current_active.png diff --git a/app/src/main/res/drawable-xxhdpi/repeat_inactive.png b/app/src/main/res/drawable-xxhdpi/repeat_inactive.png Binary files differnew file mode 100644 index 0000000..f6a744b --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/repeat_inactive.png diff --git a/app/src/main/res/drawable-xxhdpi/repeat_inactive_service.png b/app/src/main/res/drawable-xxhdpi/repeat_inactive_service.png Binary files differnew file mode 100644 index 0000000..0a40b4e --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/repeat_inactive_service.png diff --git a/app/src/main/res/drawable-xxhdpi/shortcut_play.png b/app/src/main/res/drawable-xxhdpi/shortcut_play.png Binary files differnew file mode 100644 index 0000000..92fdf33 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/shortcut_play.png diff --git a/app/src/main/res/drawable-xxhdpi/shortcut_random.png b/app/src/main/res/drawable-xxhdpi/shortcut_random.png Binary files differnew file mode 100644 index 0000000..5dc2dc4 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/shortcut_random.png diff --git a/app/src/main/res/drawable-xxhdpi/shuffle_active.png b/app/src/main/res/drawable-xxhdpi/shuffle_active.png Binary files differnew file mode 100644 index 0000000..f7f0f68 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/shuffle_active.png diff --git a/app/src/main/res/drawable-xxhdpi/shuffle_album_active.png b/app/src/main/res/drawable-xxhdpi/shuffle_album_active.png Binary files differnew file mode 100644 index 0000000..c860f8c --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/shuffle_album_active.png diff --git a/app/src/main/res/drawable-xxhdpi/shuffle_inactive.png b/app/src/main/res/drawable-xxhdpi/shuffle_inactive.png Binary files differnew file mode 100644 index 0000000..21907a2 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/shuffle_inactive.png diff --git a/app/src/main/res/drawable-xxhdpi/shuffle_inactive_service.png b/app/src/main/res/drawable-xxhdpi/shuffle_inactive_service.png Binary files differnew file mode 100644 index 0000000..a8c911f --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/shuffle_inactive_service.png diff --git a/app/src/main/res/drawable-xxhdpi/status_icon.png b/app/src/main/res/drawable-xxhdpi/status_icon.png Binary files differnew file mode 100644 index 0000000..290182f --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/status_icon.png diff --git a/app/src/main/res/drawable-xxhdpi/status_scan_0.png b/app/src/main/res/drawable-xxhdpi/status_scan_0.png Binary files differnew file mode 100644 index 0000000..119111a --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/status_scan_0.png diff --git a/app/src/main/res/drawable-xxhdpi/status_scan_1.png b/app/src/main/res/drawable-xxhdpi/status_scan_1.png Binary files differnew file mode 100644 index 0000000..0280153 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/status_scan_1.png diff --git a/app/src/main/res/drawable-xxhdpi/status_scan_2.png b/app/src/main/res/drawable-xxhdpi/status_scan_2.png Binary files differnew file mode 100644 index 0000000..f1fb989 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/status_scan_2.png diff --git a/app/src/main/res/drawable-xxhdpi/status_scan_3.png b/app/src/main/res/drawable-xxhdpi/status_scan_3.png Binary files differnew file mode 100644 index 0000000..6279fdb --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/status_scan_3.png diff --git a/app/src/main/res/drawable-xxhdpi/status_scan_4.png b/app/src/main/res/drawable-xxhdpi/status_scan_4.png Binary files differnew file mode 100644 index 0000000..9525797 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/status_scan_4.png diff --git a/app/src/main/res/drawable-xxhdpi/stop_current_active.png b/app/src/main/res/drawable-xxhdpi/stop_current_active.png Binary files differnew file mode 100644 index 0000000..4adab9f --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/stop_current_active.png diff --git a/app/src/main/res/drawable-xxhdpi/vinyl_right.png b/app/src/main/res/drawable-xxhdpi/vinyl_right.png Binary files differnew file mode 100644 index 0000000..e3eacd7 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/vinyl_right.png diff --git a/app/src/main/res/drawable-xxhdpi/widget_next.png b/app/src/main/res/drawable-xxhdpi/widget_next.png Binary files differnew file mode 100644 index 0000000..988a720 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/widget_next.png diff --git a/app/src/main/res/drawable-xxhdpi/widget_pause.png b/app/src/main/res/drawable-xxhdpi/widget_pause.png Binary files differnew file mode 100644 index 0000000..cb8197c --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/widget_pause.png diff --git a/app/src/main/res/drawable-xxhdpi/widget_play.png b/app/src/main/res/drawable-xxhdpi/widget_play.png Binary files differnew file mode 100644 index 0000000..4e17085 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/widget_play.png diff --git a/app/src/main/res/drawable-xxhdpi/widget_previous.png b/app/src/main/res/drawable-xxhdpi/widget_previous.png Binary files differnew file mode 100644 index 0000000..150964d --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/widget_previous.png diff --git a/app/src/main/res/drawable/hidden_next.xml b/app/src/main/res/drawable/hidden_next.xml new file mode 100644 index 0000000..f87bd7f --- /dev/null +++ b/app/src/main/res/drawable/hidden_next.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:state_pressed="true" android:drawable="@drawable/next" /> + <item android:state_focused="true" android:drawable="@drawable/next" /> + <item android:drawable="@drawable/empty" /> +</selector> diff --git a/app/src/main/res/drawable/hidden_pause.xml b/app/src/main/res/drawable/hidden_pause.xml new file mode 100644 index 0000000..3ae9dd3 --- /dev/null +++ b/app/src/main/res/drawable/hidden_pause.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:state_pressed="true" android:drawable="@drawable/pause" /> + <item android:state_focused="true" android:drawable="@drawable/pause" /> + <item android:drawable="@drawable/empty" /> +</selector> diff --git a/app/src/main/res/drawable/hidden_play.xml b/app/src/main/res/drawable/hidden_play.xml new file mode 100644 index 0000000..1e6e07d --- /dev/null +++ b/app/src/main/res/drawable/hidden_play.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:state_pressed="true" android:drawable="@drawable/play" /> + <item android:state_focused="true" android:drawable="@drawable/play" /> + <item android:drawable="@drawable/empty" /> +</selector> diff --git a/app/src/main/res/drawable/ic_menu_moreoverflow.xml b/app/src/main/res/drawable/ic_menu_moreoverflow.xml new file mode 100644 index 0000000..a79e624 --- /dev/null +++ b/app/src/main/res/drawable/ic_menu_moreoverflow.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- holo style menu button drawable --> +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item + android:drawable="@drawable/ic_menu_moreoverflow_normal_holo_dark" /> +</selector> diff --git a/app/src/main/res/drawable/ic_menu_search.xml b/app/src/main/res/drawable/ic_menu_search.xml new file mode 100644 index 0000000..8969a94 --- /dev/null +++ b/app/src/main/res/drawable/ic_menu_search.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- holo style menu button drawable --> +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item + android:drawable="@drawable/ic_menu_search_holo" /> +</selector> diff --git a/app/src/main/res/drawable/inset_divider.xml b/app/src/main/res/drawable/inset_divider.xml new file mode 100644 index 0000000..adadbe5 --- /dev/null +++ b/app/src/main/res/drawable/inset_divider.xml @@ -0,0 +1,11 @@ +<inset xmlns:android="http://schemas.android.com/apk/res/android" + android:insetLeft="10dip" + android:insetRight="0px" > + <!-- holo version of divider which doesn't really have an inset. + It would be very nice to inherit from "?android:attr/dividerHorizontal" + but this seems to crash on Android 4 --> + <shape android:shape="rectangle"> + <solid android:color="#2affffff"/> + </shape> +</inset> + diff --git a/app/src/main/res/drawable/plugin.xml b/app/src/main/res/drawable/plugin.xml new file mode 100644 index 0000000..c7c624b --- /dev/null +++ b/app/src/main/res/drawable/plugin.xml @@ -0,0 +1,9 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + <path + android:fillColor="#FFFFFFFF" + android:pathData="M20.5,11H19V7c0,-1.1 -0.9,-2 -2,-2h-4V3.5C13,2.12 11.88,1 10.5,1S8,2.12 8,3.5V5H4c-1.1,0 -1.99,0.9 -1.99,2v3.8H3.5c1.49,0 2.7,1.21 2.7,2.7s-1.21,2.7 -2.7,2.7H2V20c0,1.1 0.9,2 2,2h3.8v-1.5c0,-1.49 1.21,-2.7 2.7,-2.7 1.49,0 2.7,1.21 2.7,2.7V22H17c1.1,0 2,-0.9 2,-2v-4h1.5c1.38,0 2.5,-1.12 2.5,-2.5S21.88,11 20.5,11z"/> +</vector> diff --git a/app/src/main/res/drawable/unbound_ripple_light.xml b/app/src/main/res/drawable/unbound_ripple_light.xml new file mode 100644 index 0000000..d1cf7a2 --- /dev/null +++ b/app/src/main/res/drawable/unbound_ripple_light.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- holo style selector for pre-ripple devices --> +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:state_pressed="true" + android:drawable="@android:color/holo_blue_dark" /> +</selector> diff --git a/app/src/main/res/layout-w600dp/library_content.xml b/app/src/main/res/layout-w600dp/library_content.xml new file mode 100644 index 0000000..6be1c0b --- /dev/null +++ b/app/src/main/res/layout-w600dp/library_content.xml @@ -0,0 +1,87 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +Copyright (C) 2012 Christopher Eby <kreed@kreed.org> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +--> + +<merge xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:vanilla="http://schemas.android.com/apk/res-auto" > +<LinearLayout + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:orientation="horizontal"> + <LinearLayout + android:id="@+id/content" + android:orientation="vertical" + android:layout_width="0dp" + android:layout_weight="1" + android:layout_height="fill_parent"> + <android.support.iosched.tabs.VanillaTabLayout + android:id="@+id/sliding_tabs" + android:layout_width="match_parent" + android:layout_height="@dimen/row_normal_height" + android:elevation="4dp" + android:background="?tabs_background" /> + <androidx.viewpager.widget.ViewPager + android:id="@+id/pager" + android:layout_width="fill_parent" + android:layout_height="0px" + android:layout_weight="1" /> + <HorizontalScrollView + android:id="@+id/limiter_scroller" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_gravity="bottom|left"> + <LinearLayout + android:id="@+id/limiter_layout" + android:orientation="horizontal" + android:layout_width="wrap_content" + android:layout_height="fill_parent" /> + </HorizontalScrollView> + </LinearLayout> + <ch.blinkenlights.android.vanilla.SlidingView + android:id="@+id/sliding_view" + android:layout_width="0dp" + android:layout_weight="1" + android:layout_height="fill_parent" + android:layout_gravity="bottom|left" + android:orientation="horizontal" + vanilla:slider_always_expanded="1" + vanilla:slider_handle_id="@+id/bottombar_controls" + vanilla:slider_slave_id="@+id/content"> + <LinearLayout + android:layout_height="wrap_content" + android:layout_width="fill_parent" + android:background="?overlay_background_color" + android:elevation="4dp" + android:orientation="horizontal"> + <include layout="@layout/bottombar_controls" android:id="@+id/bottombar_controls" /> + </LinearLayout> + + <include layout="@layout/seek_bar" /> + + <include layout="@layout/controls" /> + + <fragment class="ch.blinkenlights.android.vanilla.ShowQueueFragment" + android:id="@+id/queue" + android:layout_width="fill_parent" android:layout_height="fill_parent" /> + </ch.blinkenlights.android.vanilla.SlidingView> +</LinearLayout> +</merge> diff --git a/app/src/main/res/layout/audiopicker.xml b/app/src/main/res/layout/audiopicker.xml new file mode 100644 index 0000000..3f0b1b7 --- /dev/null +++ b/app/src/main/res/layout/audiopicker.xml @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +Copyright (C) 2012 Christopher Eby <kreed@kreed.org> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +--> +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:divider="?android:attr/dividerHorizontal" + android:showDividers="middle" + android:orientation="vertical" + android:layout_width="fill_parent" + android:layout_height="wrap_content"> + + <LinearLayout + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:orientation="horizontal"> + + <ImageView android:id="@+id/icon" + android:layout_width="48dip" + android:layout_height="48dip" + android:layout_gravity="top" + android:layout_marginLeft="8dip" + android:layout_marginTop="2dip" + android:layout_marginBottom="2dip" + android:src="@mipmap/icon" /> + <TextView + android:id="@+id/filepath" + android:visibility="gone" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="16dip" + android:layout_marginTop="16dip" + android:layout_marginLeft="16dip" + android:layout_marginRight="8dip" /> + <ProgressBar + android:id="@+id/progress" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical|center_horizontal" /> + </LinearLayout> + + <LinearLayout + style="?android:attr/buttonBarStyle" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:orientation="horizontal"> + <Button + style="?android:attr/buttonBarButtonStyle" + android:id="@+id/cancel" + android:layout_width="0px" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="@string/cancel" + android:enabled="false" + android:singleLine="true" /> + <Button + style="?android:attr/buttonBarButtonStyle" + android:id="@+id/enqueue" + android:layout_width="0px" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="@string/enqueue" + android:enabled="false" + android:singleLine="true" /> + <Button + style="?android:attr/buttonBarButtonStyle" + android:id="@+id/play" + android:layout_width="0px" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="@string/play" + android:enabled="false" + android:singleLine="true" /> + </LinearLayout> +</LinearLayout> diff --git a/app/src/main/res/layout/bottombar_controls.xml b/app/src/main/res/layout/bottombar_controls.xml new file mode 100644 index 0000000..ebf31cb --- /dev/null +++ b/app/src/main/res/layout/bottombar_controls.xml @@ -0,0 +1,84 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2016 Adrian Ulrich <adrian@blinkenlights.ch> + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. +--> + +<ch.blinkenlights.android.vanilla.BottomBarControls + xmlns:android="http://schemas.android.com/apk/res/android" + android:background="?tabs_background" + android:orientation="vertical" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + > + + <LinearLayout + android:layout_height="@dimen/row_normal_height" + android:layout_width="fill_parent" + android:background="@drawable/unbound_ripple_light" + android:gravity="center_vertical" + android:id="@+id/content_controls"> + + <ImageView + android:id="@+id/cover" + android:scaleType="centerCrop" + android:layout_width="@dimen/cover_size" + android:layout_height="@dimen/cover_size" + android:layout_marginLeft="@dimen/cover_padding" + android:layout_gravity="center_vertical" + android:contentDescription="@string/cover_art" /> + <LinearLayout + android:layout_height="wrap_content" + android:layout_width="0px" + android:layout_weight="1" + android:layout_marginLeft="@dimen/text_padding" + android:layout_gravity="center" + android:orientation="vertical"> + <TextView + android:id="@+id/title" + android:textSize="14sp" + android:singleLine="true" + android:gravity="center_vertical" + android:ellipsize="marquee" + android:layout_width="fill_parent" + android:textColor="@android:color/background_light" + android:layout_height="wrap_content" /> + <TextView + android:id="@+id/artist" + android:textSize="12sp" + android:singleLine="true" + android:gravity="center_vertical" + android:ellipsize="marquee" + android:layout_width="fill_parent" + android:textColor="@android:color/secondary_text_dark" + android:layout_height="wrap_content" /> + </LinearLayout> + </LinearLayout> + + <SearchView + android:visibility="gone" + android:layout_height="@dimen/row_normal_height" + android:layout_width="fill_parent" + android:iconifiedByDefault="false" + android:imeOptions="actionSearch|flagNoFullscreen" + android:id="@+id/search_view" /> + + +</ch.blinkenlights.android.vanilla.BottomBarControls> diff --git a/app/src/main/res/layout/controls.xml b/app/src/main/res/layout/controls.xml new file mode 100644 index 0000000..93d7736 --- /dev/null +++ b/app/src/main/res/layout/controls.xml @@ -0,0 +1,87 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +Copyright (C) 2012 Christopher Eby <kreed@kreed.org> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +--> + +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:vib="http://schemas.android.com/apk/res-auto" + android:layout_height="wrap_content" + android:layout_width="fill_parent" + android:background="?overlay_background_color" + android:orientation="horizontal" + android:elevation="2dp"> + <ch.blinkenlights.android.vanilla.VanillaImageButton + android:id="@+id/shuffle" + android:paddingTop="@dimen/controls_padding" + android:paddingBottom="@dimen/controls_padding" + android:layout_height="fill_parent" + android:layout_width="0px" + android:layout_weight="1" + android:background="?android:attr/selectableItemBackground" + android:scaleType="fitCenter" + android:src="@drawable/shuffle_inactive" + android:contentDescription="@string/cycle_shuffle_mode" /> + <ch.blinkenlights.android.vanilla.VanillaImageButton + android:id="@+id/previous" + android:paddingTop="@dimen/controls_padding" + android:paddingBottom="@dimen/controls_padding" + android:layout_height="fill_parent" + android:layout_width="0px" + android:layout_weight="1" + android:background="?android:attr/selectableItemBackground" + android:scaleType="fitCenter" + android:src="@drawable/previous" + android:contentDescription="@string/previous_song" /> + <ch.blinkenlights.android.vanilla.VanillaImageButton + android:id="@+id/play_pause" + android:paddingTop="@dimen/controls_padding" + android:paddingBottom="@dimen/controls_padding" + android:layout_height="fill_parent" + android:layout_width="0px" + android:layout_weight="1" + android:background="?android:attr/selectableItemBackground" + android:scaleType="fitCenter" + android:src="@drawable/play" + android:contentDescription="@string/play_pause" /> + <ch.blinkenlights.android.vanilla.VanillaImageButton + android:id="@+id/next" + android:paddingTop="@dimen/controls_padding" + android:paddingBottom="@dimen/controls_padding" + android:layout_height="fill_parent" + android:layout_width="0px" + android:layout_weight="1" + android:background="?android:attr/selectableItemBackground" + android:scaleType="fitCenter" + android:src="@drawable/next" + android:contentDescription="@string/next_song" /> + <ch.blinkenlights.android.vanilla.VanillaImageButton + android:id="@+id/end_action" + android:paddingTop="@dimen/controls_padding" + android:paddingBottom="@dimen/controls_padding" + android:layout_height="fill_parent" + android:layout_width="0px" + android:layout_weight="1" + android:background="?android:attr/selectableItemBackground" + android:scaleType="fitCenter" + android:src="@drawable/repeat_inactive" + android:contentDescription="@string/cycle_repeat_mode" /> +</LinearLayout> diff --git a/app/src/main/res/layout/controls_widget.xml b/app/src/main/res/layout/controls_widget.xml new file mode 100644 index 0000000..a4b3170 --- /dev/null +++ b/app/src/main/res/layout/controls_widget.xml @@ -0,0 +1,74 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +Copyright (C) 2012 Christopher Eby <kreed@kreed.org> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +--> + +<!-- this is almost the same file as controls.xml but uses a plain + image button as the drawable in widgets are not styled and + using a custom view would not be possible anyway //--> + +<merge xmlns:android="http://schemas.android.com/apk/res/android"> + <ImageButton + android:id="@+id/shuffle" + android:layout_height="fill_parent" + android:layout_width="0px" + android:layout_weight="1" + android:background="?android:attr/selectableItemBackground" + android:scaleType="fitCenter" + android:src="@drawable/shuffle_inactive" + android:contentDescription="@string/cycle_shuffle_mode" /> + <ImageButton + android:id="@+id/previous" + android:layout_height="fill_parent" + android:layout_width="0px" + android:layout_weight="1" + android:background="?android:attr/selectableItemBackground" + android:scaleType="fitCenter" + android:src="@drawable/previous" + android:contentDescription="@string/previous_song" /> + <ImageButton + android:id="@+id/play_pause" + android:layout_height="fill_parent" + android:layout_width="0px" + android:layout_weight="1" + android:background="?android:attr/selectableItemBackground" + android:scaleType="fitCenter" + android:src="@drawable/play" + android:contentDescription="@string/play_pause" /> + <ImageButton + android:id="@+id/next" + android:layout_height="fill_parent" + android:layout_width="0px" + android:layout_weight="1" + android:background="?android:attr/selectableItemBackground" + android:scaleType="fitCenter" + android:src="@drawable/next" + android:contentDescription="@string/next_song" /> + <ImageButton + android:id="@+id/end_action" + android:layout_height="fill_parent" + android:layout_width="0px" + android:layout_weight="1" + android:background="?android:attr/selectableItemBackground" + android:scaleType="fitCenter" + android:src="@drawable/repeat_inactive" + android:contentDescription="@string/cycle_repeat_mode" /> +</merge> diff --git a/app/src/main/res/layout/draggable_row.xml b/app/src/main/res/layout/draggable_row.xml new file mode 100644 index 0000000..ad2a5b1 --- /dev/null +++ b/app/src/main/res/layout/draggable_row.xml @@ -0,0 +1,79 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +Copyright (C) 2014 Adrian Ulrich <adrian@blinkenlights.ch> + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. +--> +<ch.blinkenlights.android.vanilla.DraggableRow + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="horizontal"> + + <View + android:id="@+id/pmark" + android:visibility="gone" + android:layout_width="@dimen/pmark_size" + android:layout_height="@dimen/row_normal_height" + android:background="?now_playing_marker" /> + + <ch.blinkenlights.android.vanilla.LazyCoverView + android:id="@+id/cover" + android:scaleType="centerCrop" + android:layout_width="@dimen/cover_size" + android:layout_height="@dimen/cover_size" + android:layout_marginLeft="@dimen/cover_padding_with_pmark" + android:layout_gravity="center_vertical" + android:visibility="gone" /> + <TextView + android:id="@+id/text" + android:maxLines="2" + android:textColor="?android:textColorPrimary" + android:gravity="left|center_vertical" + android:layout_width="0px" + android:layout_height="@dimen/row_normal_height" + android:layout_marginLeft="@dimen/text_padding" + android:layout_weight="1" /> + <TextView + android:id="@+id/duration" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:layout_marginLeft="@dimen/text_padding" + android:visibility="gone" + android:textColor="?android:textColorPrimary" + android:gravity="center_vertical" /> + <CheckedTextView + android:id="@+id/checkbox" + android:visibility="gone" + android:checkMark="?android:attr/listChoiceIndicatorMultiple" + android:gravity="center_vertical" + android:layout_height="match_parent" + android:layout_width="@dimen/row_normal_height"/> + <!-- having 'dragger' visible adds significant left-padding + some views may want to use this padding while dragger is not visible, so + in this case, this empty view can be used as a replacement --> + <View + android:id="@+id/dragger_padder" + android:layout_width="@dimen/text_padding" + android:layout_height="match_parent" + android:visibility="gone" + /> + <ImageView + android:id="@+id/dragger" + android:visibility="gone" + android:src="@drawable/grabber" + android:scaleType="center" + android:layout_width="@dimen/row_normal_height" + android:layout_height="@dimen/row_normal_height" /> +</ch.blinkenlights.android.vanilla.DraggableRow> diff --git a/app/src/main/res/layout/duration_input.xml b/app/src/main/res/layout/duration_input.xml new file mode 100644 index 0000000..d807a82 --- /dev/null +++ b/app/src/main/res/layout/duration_input.xml @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +Copyright (C) 2018 Toby Hsieh + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see <https://www.gnu.org/licenses/>. +--> +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="horizontal" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="center_horizontal"> + + <EditText + android:id="@+id/hours" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:inputType="number" + android:maxLength="2" + android:hint="@string/hour_hint" /> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/time_separator"/> + + <EditText + android:id="@+id/minutes" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:inputType="number" + android:maxLength="2" + android:hint="@string/minute_hint" /> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/time_separator"/> + + <EditText + android:id="@+id/seconds" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:inputType="number" + android:maxLength="2" + android:hint="@string/second_hint" /> + +</LinearLayout> diff --git a/app/src/main/res/layout/fancymenu_row.xml b/app/src/main/res/layout/fancymenu_row.xml new file mode 100644 index 0000000..58f3c85 --- /dev/null +++ b/app/src/main/res/layout/fancymenu_row.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" + android:layout_height="@dimen/row_normal_height" + android:orientation="horizontal"> + + <ImageView + android:id="@+id/icon" + android:layout_marginLeft="@dimen/cover_padding" + android:layout_gravity="left|center_vertical" + android:layout_height="32sp" + android:layout_width="32sp" /> + + + <TextView + android:id="@+id/text" + android:textColor="?android:textColorPrimary" + android:textSize="@dimen/material_text_subhead" + android:layout_marginLeft="@dimen/text_padding" + android:layout_marginRight="@dimen/text_padding" + android:layout_gravity="left|center_vertical" + android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:layout_weight="1" /> + +</LinearLayout> diff --git a/app/src/main/res/layout/fancymenu_spacer.xml b/app/src/main/res/layout/fancymenu_spacer.xml new file mode 100644 index 0000000..a28024e --- /dev/null +++ b/app/src/main/res/layout/fancymenu_spacer.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" + android:layout_height="6dip" + android:orientation="horizontal"> + + <TextView + android:id="@+id/text" + android:background="#0A000000" + android:layout_gravity="center_vertical" + android:layout_width="match_parent" + android:layout_height="2dip" + android:layout_marginLeft="10dip" + android:layout_marginRight="10dip" /> + +</LinearLayout> diff --git a/app/src/main/res/layout/folderpicker_content.xml b/app/src/main/res/layout/folderpicker_content.xml new file mode 100644 index 0000000..a60e27f --- /dev/null +++ b/app/src/main/res/layout/folderpicker_content.xml @@ -0,0 +1,92 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +Copyright (C) 2013 Adrian Ulrich <adrian@blinkenlights.ch> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +--> +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:dslv="http://schemas.android.com/apk/res-auto" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:orientation="vertical" + android:focusable="true" + android:focusableInTouchMode="true" > + + <LinearLayout + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" > + + <EditText + android:id="@+id/path_display" + android:layout_height="wrap_content" + android:layout_width="0dp" + android:layout_weight="2" + android:layout_marginLeft="@dimen/text_padding" + android:text="@string/empty" /> + <Button + android:id="@+id/save_button" + android:layout_height="wrap_content" + android:layout_width="0dp" + android:layout_weight="1" + android:text="@string/empty" /> + + </LinearLayout> + + <TextView + android:layout_width="fill_parent" + android:layout_height="2dp" + android:background="?android:attr/dividerHorizontal" + /> + + <com.mobeta.android.dslv.DragSortListView + android:id="@+id/list" + android:divider="@drawable/inset_divider" + android:dividerHeight="1dip" + android:layout_height="0px" + android:layout_width="fill_parent" + android:layout_weight="1" + android:choiceMode="none" + dslv:drag_enabled="false" /> + + <LinearLayout + android:id="@+id/folder_picker_spinner_container" + android:visibility="gone" + android:layout_width="fill_parent" + android:layout_height="@dimen/cover_size" + android:gravity="center_vertical" + android:orientation="horizontal" > + <TextView + android:text="@string/folder_picker_spinner_desc" + android:textColor="?overlay_foreground_color" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:layout_marginLeft="@dimen/text_padding" + /> + <Spinner + android:id="@+id/folder_picker_spinner" + android:entries="@array/folder_picker_spinner_entries" + android:layout_weight="2" + android:layout_width="0dp" + android:layout_height="wrap_content" /> + </LinearLayout> + +</LinearLayout> diff --git a/app/src/main/res/layout/four_long_widget.xml b/app/src/main/res/layout/four_long_widget.xml new file mode 100644 index 0000000..ea4826c --- /dev/null +++ b/app/src/main/res/layout/four_long_widget.xml @@ -0,0 +1,108 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +Copyright (C) 2010 Christopher Eby <kreed@kreed.org> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +--> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:orientation="horizontal" + android:background="#B2191919"> + <ImageView + android:id="@+id/cover" + android:src="@drawable/fallback_cover_large" + android:layout_width="wrap_content" + android:layout_height="fill_parent" + android:adjustViewBounds="true" + android:padding="5dip" + android:scaleType="fitCenter" + android:contentDescription="@string/cover_art" /> + <LinearLayout + android:id="@+id/text_layout" + android:layout_width="0px" + android:layout_height="wrap_content" + android:layout_weight="1" + android:layout_gravity="center" + android:orientation="vertical" + android:paddingLeft="8dip" + android:paddingRight="8dip"> + <TextView + android:id="@+id/title" + android:visibility="gone" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:textColor="#fff" + android:textSize="16sp" + android:textStyle="bold" + android:singleLine="true" + android:fadingEdge="horizontal" + android:fadingEdgeLength="10dip" + android:ellipsize="none" /> + <TextView + android:id="@+id/artist" + android:text="@string/app_name" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:textColor="#fff" + android:textSize="14sp" + android:singleLine="true" + android:fadingEdge="horizontal" + android:fadingEdgeLength="10dip" + android:ellipsize="none" /> + <TextView + android:id="@+id/album" + android:text="@string/app_name" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:textColor="#ccc" + android:textSize="14sp" + android:singleLine="true" + android:fadingEdge="horizontal" + android:fadingEdgeLength="10dip" + android:ellipsize="none" /> + </LinearLayout> + <LinearLayout + android:orientation="vertical" + android:layout_width="wrap_content" + android:layout_height="fill_parent"> + <ImageButton + android:id="@+id/play_pause" + android:adjustViewBounds="true" + android:layout_width="fill_parent" + android:layout_height="0px" + android:layout_weight="1" + android:src="@drawable/play" + android:padding="5dip" + android:background="?android:attr/selectableItemBackground" + android:scaleType="centerInside" + android:contentDescription="@string/play_pause" /> + <ImageButton + android:id="@+id/next" + android:adjustViewBounds="true" + android:layout_width="fill_parent" + android:layout_height="0px" + android:layout_weight="1" + android:padding="5dip" + android:src="@drawable/next" + android:background="?android:attr/selectableItemBackground" + android:scaleType="centerInside" + android:contentDescription="@string/next_song" /> + </LinearLayout> +</LinearLayout> diff --git a/app/src/main/res/layout/four_square_widget.xml b/app/src/main/res/layout/four_square_widget.xml new file mode 100644 index 0000000..efb0d5f --- /dev/null +++ b/app/src/main/res/layout/four_square_widget.xml @@ -0,0 +1,99 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +Copyright (C) 2010, 2011 Christopher Eby <kreed@kreed.org> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +--> +<FrameLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" + android:layout_height="fill_parent"> + <ImageView + android:id="@+id/cover" + android:src="@drawable/fallback_cover_large" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:scaleType="fitCenter" + android:contentDescription="@string/cover_art" /> + <LinearLayout + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:layout_margin="5dip" + android:baselineAligned="false" + android:orientation="vertical"> + <TextView + android:id="@+id/title" + android:visibility="invisible" + android:layout_width="fill_parent" + android:layout_height="0px" + android:layout_weight="1" + android:gravity="center_horizontal|bottom" + android:textColor="#fff" + android:textSize="18dip" + android:shadowColor="#f000" + android:shadowDx="0" + android:shadowDy="0" + android:shadowRadius="5" + android:textStyle="bold" + android:ellipsize="marquee" + android:singleLine="true" /> + <TextView + android:id="@+id/artist" + android:text="@string/app_name" + android:layout_width="fill_parent" + android:layout_height="0px" + android:layout_weight="1" + android:gravity="center_horizontal|top" + android:textColor="#fff" + android:shadowColor="#f000" + android:shadowDx="0" + android:shadowDy="0" + android:shadowRadius="5" + android:textSize="15dip" + android:ellipsize="marquee" + android:singleLine="true" /> + <LinearLayout + android:id="@+id/buttons" + android:orientation="horizontal" + android:layout_width="fill_parent" + android:layout_height="0px" + android:layout_weight="2"> + <ImageButton + android:id="@+id/play_pause" + android:adjustViewBounds="true" + android:src="@drawable/play" + android:scaleType="centerInside" + android:background="@null" + android:layout_height="fill_parent" + android:layout_width="0px" + android:layout_weight="1" + android:contentDescription="@string/play_pause" /> + <ImageButton + android:id="@+id/next" + android:adjustViewBounds="true" + android:src="@drawable/next" + android:scaleType="centerInside" + android:background="@null" + android:layout_height="fill_parent" + android:layout_width="0px" + android:layout_weight="1" + android:contentDescription="@string/next_song" /> + </LinearLayout> + </LinearLayout> +</FrameLayout> diff --git a/app/src/main/res/layout/four_white_widget.xml b/app/src/main/res/layout/four_white_widget.xml new file mode 100644 index 0000000..67216f7 --- /dev/null +++ b/app/src/main/res/layout/four_white_widget.xml @@ -0,0 +1,144 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +Copyright (C) 2012 Ferenc Nagy <nferenc@nferenc.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +--> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" + android:layout_height="match_parent" + android:background="@drawable/widget_bg" + android:baselineAligned="false" + android:orientation="horizontal" > + <LinearLayout + android:id="@+id/coverFrame" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:orientation="horizontal" + android:padding="5dp" > + <FrameLayout + android:layout_width="wrap_content" + android:layout_height="match_parent"> + <ImageView + android:id="@+id/fallbackCover" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:layout_gravity="left" + android:adjustViewBounds="true" + android:src="@drawable/vinyl_left" + android:contentDescription="@string/cover_art" + android:scaleType="fitCenter" /> + <ImageView + android:id="@+id/cover" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_gravity="center" + android:adjustViewBounds="true" + android:contentDescription="@string/cover_art" + android:background="#424242" + android:scaleType="fitCenter" /> + </FrameLayout> + <ImageView + android:id="@+id/vinyl" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:layout_gravity="left" + android:adjustViewBounds="true" + android:src="@drawable/vinyl_right" + android:contentDescription="@string/cover_art" + android:scaleType="fitCenter" /> + </LinearLayout> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical" + android:baselineAligned="false" > + <LinearLayout + android:id="@+id/text_layout" + android:layout_width="match_parent" + android:layout_height="54sp" + android:layout_weight="1" + android:orientation="vertical" + android:paddingLeft="8dp" + android:paddingRight="8dp" > + <TextView + android:id="@+id/title" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:ellipsize="none" + android:fadingEdge="horizontal" + android:fadingEdgeLength="10dp" + android:singleLine="true" + android:textColor="#111" + android:textSize="16sp" + android:textStyle="bold" + android:includeFontPadding="false" + android:visibility="invisible" /> + <TextView + android:id="@+id/artist" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:ellipsize="none" + android:fadingEdge="horizontal" + android:fadingEdgeLength="10dp" + android:singleLine="true" + android:text="@string/app_name" + android:textColor="#111" + android:includeFontPadding="false" + android:textSize="10sp" /> + </LinearLayout> + <LinearLayout + android:id="@+id/linearLayout1" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_weight="1" + android:gravity="bottom" > + <ImageButton + android:id="@+id/previous" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_weight="1" + android:background="?android:attr/selectableItemBackground" + android:contentDescription="@string/previous_song" + android:scaleType="fitCenter" + android:src="@drawable/widget_previous" + android:padding="5dp" /> + <ImageButton + android:id="@+id/play_pause" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_weight="1" + android:background="?android:attr/selectableItemBackground" + android:contentDescription="@string/play_pause" + android:scaleType="fitCenter" + android:src="@drawable/widget_play" + android:padding="5dp" /> + <ImageButton + android:id="@+id/next" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_weight="1" + android:background="?android:attr/selectableItemBackground" + android:contentDescription="@string/next_song" + android:scaleType="fitCenter" + android:src="@drawable/widget_next" + android:padding="5dp" /> + </LinearLayout> + </LinearLayout> +</LinearLayout> diff --git a/app/src/main/res/layout/fragment_track_details.xml b/app/src/main/res/layout/fragment_track_details.xml new file mode 100644 index 0000000..713d71c --- /dev/null +++ b/app/src/main/res/layout/fragment_track_details.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +Copyright (C) 2018 Toby Hsieh + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see <https://www.gnu.org/licenses/>. +--> +<TableLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:padding="@dimen/track_details_dialog_padding" + android:stretchColumns="1" + android:shrinkColumns="1"> + + <include layout="@layout/track_details" /> +</TableLayout> diff --git a/app/src/main/res/layout/full_playback.xml b/app/src/main/res/layout/full_playback.xml new file mode 100644 index 0000000..d92c21e --- /dev/null +++ b/app/src/main/res/layout/full_playback.xml @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +Copyright (C) 2010, 2011 Christopher Eby <kreed@kreed.org> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +--> +<merge xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:vanilla="http://schemas.android.com/apk/res-auto" > + + <ch.blinkenlights.android.vanilla.CoverView + android:id="@+id/cover_view" + android:layout_marginBottom="@dimen/full_playback_controls_height" + android:layout_height="fill_parent" + android:layout_width="fill_parent" /> + + <ch.blinkenlights.android.vanilla.SlidingView + android:id="@+id/sliding_view" + android:layout_height="fill_parent" + android:layout_width="fill_parent" + android:layout_gravity="bottom|left" + android:layout_marginTop="0dip" + android:orientation="horizontal" + vanilla:slider_handle_id="@+id/queue_slider"> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="?overlay_background_color" + android:elevation="2dp" + android:layout_marginBottom="20dip" + android:paddingBottom="20dip" + android:orientation="vertical"> + <include layout="@layout/seek_bar" /> + <include layout="@layout/controls" android:id="@+id/queue_slider" /> + </LinearLayout> + + + <fragment class="ch.blinkenlights.android.vanilla.ShowQueueFragment" + android:id="@+id/queue" + android:layout_width="fill_parent" + android:layout_height="fill_parent" /> + </ch.blinkenlights.android.vanilla.SlidingView> + + +</merge> diff --git a/app/src/main/res/layout/full_playback_alt.xml b/app/src/main/res/layout/full_playback_alt.xml new file mode 100644 index 0000000..4fff013 --- /dev/null +++ b/app/src/main/res/layout/full_playback_alt.xml @@ -0,0 +1,82 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +Copyright (C) 2012 Christopher Eby <kreed@kreed.org> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +--> +<merge xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:vanilla="http://schemas.android.com/apk/res-auto" > + <ch.blinkenlights.android.vanilla.CoverView + android:id="@+id/cover_view" + android:layout_marginTop="@dimen/full_playback_alt_text" + android:layout_marginBottom="@dimen/full_playback_controls_height" + android:layout_height="fill_parent" + android:layout_width="fill_parent" /> + <TableLayout + android:id="@+id/info_table" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_gravity="top" + android:collapseColumns="0" + android:stretchColumns="1" + android:shrinkColumns="1" + android:background="?overlay_background_color" + android:paddingLeft="5dip" + android:paddingRight="5dip"> + + <include layout="@layout/track_details" /> + + <TableRow> + <TextView + android:text="@string/_replaygain" + android:textColor="?overlay_foreground_color" + android:paddingRight="5dip" + android:gravity="right" /> + <TextView android:id="@+id/replaygain" android:textColor="?overlay_foreground_color"/> + </TableRow> + </TableLayout> + + + <ch.blinkenlights.android.vanilla.SlidingView + android:id="@+id/sliding_view" + android:layout_height="fill_parent" + android:layout_width="fill_parent" + android:layout_gravity="bottom|left" + android:layout_marginTop="@dimen/full_playback_alt_text" + android:orientation="horizontal" + vanilla:slider_handle_id="@+id/queue_slider"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="?overlay_background_color" + android:elevation="2dp" + android:orientation="vertical"> + <include layout="@layout/seek_bar" /> + <include layout="@layout/controls" android:id="@+id/queue_slider" /> + </LinearLayout> + + <fragment class="ch.blinkenlights.android.vanilla.ShowQueueFragment" + android:id="@+id/queue" + android:layout_width="fill_parent" + android:layout_height="fill_parent" /> + </ch.blinkenlights.android.vanilla.SlidingView> + + +</merge> diff --git a/app/src/main/res/layout/library_content.xml b/app/src/main/res/layout/library_content.xml new file mode 100644 index 0000000..9c819a9 --- /dev/null +++ b/app/src/main/res/layout/library_content.xml @@ -0,0 +1,78 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +Copyright (C) 2012 Christopher Eby <kreed@kreed.org> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +--> + +<merge xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:vanilla="http://schemas.android.com/apk/res-auto" > + <LinearLayout + android:id="@+id/content" + android:orientation="vertical" + android:layout_width="fill_parent" + android:layout_height="fill_parent"> + <android.support.iosched.tabs.VanillaTabLayout + android:id="@+id/sliding_tabs" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:elevation="4dp" + android:background="?tabs_background" /> + <androidx.viewpager.widget.ViewPager + android:id="@+id/pager" + android:layout_width="fill_parent" + android:layout_height="0px" + android:layout_weight="1" /> + <HorizontalScrollView + android:id="@+id/limiter_scroller" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_gravity="bottom|left"> + <LinearLayout + android:id="@+id/limiter_layout" + android:orientation="horizontal" + android:layout_width="wrap_content" + android:layout_height="fill_parent" /> + </HorizontalScrollView> + </LinearLayout> + <ch.blinkenlights.android.vanilla.SlidingView + android:id="@+id/sliding_view" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:layout_gravity="bottom|left" + android:orientation="horizontal" + vanilla:slider_handle_id="@+id/bottombar_controls" + vanilla:slider_slave_id="@+id/content"> + <LinearLayout + android:layout_height="wrap_content" + android:layout_width="fill_parent" + android:background="?overlay_background_color" + android:orientation="horizontal"> + <include layout="@layout/bottombar_controls" android:id="@+id/bottombar_controls" /> + </LinearLayout> + + <include layout="@layout/seek_bar" /> + + <include layout="@layout/controls" /> + + <fragment class="ch.blinkenlights.android.vanilla.ShowQueueFragment" + android:id="@+id/queue" + android:layout_width="fill_parent" android:layout_height="fill_parent" /> + </ch.blinkenlights.android.vanilla.SlidingView> +</merge> diff --git a/app/src/main/res/layout/listview.xml b/app/src/main/res/layout/listview.xml new file mode 100644 index 0000000..77aa3f5 --- /dev/null +++ b/app/src/main/res/layout/listview.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +Copyright (C) 2012 Christopher Eby <kreed@kreed.org> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +--> +<ch.blinkenlights.android.vanilla.FastScrollGuardedListView + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:divider="@drawable/inset_divider" + android:dividerHeight="1dip" + android:fastScrollEnabled="true"/> diff --git a/app/src/main/res/layout/medialibrary_preferences.xml b/app/src/main/res/layout/medialibrary_preferences.xml new file mode 100644 index 0000000..c3b458f --- /dev/null +++ b/app/src/main/res/layout/medialibrary_preferences.xml @@ -0,0 +1,153 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +Copyright (C) 2016 Adrian Ulrich <adrian@blinkenlights.ch> + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. +--> +<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" + android:layout_height="fill_parent" > + + <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="5dp" + android:paddingLeft="14dp" + android:paddingRight="14dp" + android:orientation="vertical" > + + <TextView + style="?android:attr/listSeparatorTextViewStyle" + android:textColor="?overlay_foreground_color" + android:text="@string/media_scan_preferences" /> + <CheckBox android:id="@+id/media_scan_group_albums" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/media_scan_group_albums" /> + <CheckBox android:id="@+id/media_scan_force_bastp" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/media_scan_force_bastp" /> + + <TextView + style="?android:attr/listSeparatorTextViewStyle" + android:textColor="?overlay_foreground_color" + android:text="@string/media_folders_header" /> + + <TextView + android:id="@+id/media_directories" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="@string/empty" /> + + <Button + android:id="@+id/edit_button" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="end" + android:text="@string/edit"> + </Button> + + <TextView + style="?android:attr/listSeparatorTextViewStyle" + android:textColor="?overlay_foreground_color" + android:text="@string/media_scan_header" /> + + <CheckBox android:id="@+id/media_scan_full" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/media_scan_full" /> + <CheckBox android:id="@+id/media_scan_drop_db" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/media_scan_drop_db" /> + + <LinearLayout + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="end"> + <Button + android:id="@+id/cancel_button" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/cancel"> + </Button> + <Button + android:id="@+id/start_button" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/media_scan_start"> + </Button> + </LinearLayout> + + <TextView + style="?android:attr/listSeparatorTextViewStyle" + android:textColor="?overlay_foreground_color" + android:text="@string/media_statistics" /> + + <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:stretchColumns="1"> + <TableRow> + <TextView + android:text="@string/media_stats_tracks" + android:padding="3dip" /> + <TextView + android:id="@+id/media_stats_tracks" + android:text="@string/empty" + android:gravity="right" + android:padding="3dip" /> + </TableRow> + <TableRow> + <TextView + android:text="@string/media_stats_library_playtime" + android:padding="3dip" /> + <TextView + android:text="@string/empty" + android:id="@+id/media_stats_library_playtime" + android:gravity="right" + android:padding="3dip" /> + </TableRow> + <TableRow> + <TextView + android:text="@string/media_stats_listen_playtime" + android:padding="3dip" /> + <TextView + android:text="@string/empty" + android:id="@+id/media_stats_listen_playtime" + android:gravity="right" + android:padding="3dip" /> + </TableRow> + </TableLayout> + + <ProgressBar + android:id="@+id/media_stats_progress_bar" + android:paddingTop="14dp" + android:layout_width="match_parent" + android:layout_height="match_parent" + style="?android:attr/progressBarStyleHorizontal" /> + + <TextView + android:id="@+id/media_stats_progress_text" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:minLines="4" + android:text="@string/empty" /> + + </LinearLayout> + + +</ScrollView> diff --git a/app/src/main/res/layout/mini_playback.xml b/app/src/main/res/layout/mini_playback.xml new file mode 100644 index 0000000..e491064 --- /dev/null +++ b/app/src/main/res/layout/mini_playback.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +Copyright (C) 2010, 2011 Christopher Eby <kreed@kreed.org> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +--> +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:layout_height="match_parent" + android:layout_width="match_parent"> + <ch.blinkenlights.android.vanilla.CoverView + android:id="@+id/cover_view" + android:layout_gravity="center" + android:layout_weight="1" + android:layout_height="0px" + android:layout_width="match_parent" /> + + <include layout="@layout/controls" android:id="@+id/queue_slider"/> + +</LinearLayout> diff --git a/app/src/main/res/layout/one_cell_widget.xml b/app/src/main/res/layout/one_cell_widget.xml new file mode 100644 index 0000000..ea8791f --- /dev/null +++ b/app/src/main/res/layout/one_cell_widget.xml @@ -0,0 +1,70 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +Copyright (C) 2010, 2011 Christopher Eby <kreed@kreed.org> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +--> +<RelativeLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_height="fill_parent" + android:layout_width="fill_parent"> + <ImageView + android:id="@+id/cover" + android:src="@drawable/fallback_cover" + android:layout_centerInParent="true" + android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:contentDescription="@string/cover_art" /> + <TextView + android:id="@+id/title" + android:text="@string/app_name" + android:layout_alignBottom="@id/cover" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:gravity="center" + android:textColor="#fff" + android:background="#a000" + android:textSize="12dip" + android:textStyle="bold" + android:ellipsize="marquee" + android:singleLine="true" /> + <LinearLayout + android:layout_height="fill_parent" + android:layout_width="fill_parent" + android:orientation="vertical" > + <ImageButton + android:id="@+id/play_pause" + android:adjustViewBounds="true" + android:src="@drawable/hidden_play" + android:background="@null" + android:layout_height="0px" + android:layout_width="fill_parent" + android:layout_weight="1" + android:contentDescription="@string/play_pause" /> + <ImageButton + android:id="@+id/next" + android:adjustViewBounds="true" + android:src="@drawable/hidden_next" + android:background="@null" + android:layout_height="0px" + android:layout_width="fill_parent" + android:layout_weight="1" + android:contentDescription="@string/next_song" /> + </LinearLayout> +</RelativeLayout> diff --git a/app/src/main/res/layout/permission_request.xml b/app/src/main/res/layout/permission_request.xml new file mode 100644 index 0000000..9126d91 --- /dev/null +++ b/app/src/main/res/layout/permission_request.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +Copyright (C) 2015 Adrian Ulrich <adrian@blinkenlights.ch> + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. +--> +<TableLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:clickable="true" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:stretchColumns="0" + android:shrinkColumns="0" + android:paddingTop="8dip" + android:paddingBottom="8dip" + android:background="#FF212121"> + <TableRow> + <TextView + android:id="@+id/permission_request_title" + android:layout_marginLeft="8dip" + android:layout_marginBottom="8dip" + android:layout_marginTop="8dip" + android:text="@string/permission_request_summary" + android:textColor="#FFFFFFFF" /> + <Button + android:id="@+id/permission_request_button" + android:clickable="false" + android:layout_marginRight="8dip" + android:layout_gravity="center" + android:text="@string/ok" /> + </TableRow> +</TableLayout> diff --git a/app/src/main/res/layout/playlist_activity.xml b/app/src/main/res/layout/playlist_activity.xml new file mode 100644 index 0000000..9bb2179 --- /dev/null +++ b/app/src/main/res/layout/playlist_activity.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +Copyright (C) 2014 Adrian Ulrich <adrian@blinkenlights.ch> + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. +--> +<com.mobeta.android.dslv.DragSortListView + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:dslv="http://schemas.android.com/apk/res-auto" + android:id="@+id/list" + android:divider="@drawable/inset_divider" + android:dividerHeight="1dip" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + dslv:drag_enabled="false" + dslv:drag_start_mode="onMove" + dslv:float_background_color="?float_color" + dslv:remove_enabled="true" + dslv:remove_mode="flingRemove" + dslv:fling_handle_id="@+id/dragger" + dslv:drag_handle_id="@+id/dragger"/> diff --git a/app/src/main/res/layout/playlist_buttons.xml b/app/src/main/res/layout/playlist_buttons.xml new file mode 100644 index 0000000..43a8d8d --- /dev/null +++ b/app/src/main/res/layout/playlist_buttons.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +Copyright (C) 2011 Christopher Eby <kreed@kreed.org> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +--> +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:padding="3dip" + android:orientation="horizontal"> + <Button + android:id="@+id/edit" + android:layout_width="0px" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="@string/edit" /> + <Button + android:id="@+id/delete" + android:layout_width="0px" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="@string/delete" /> +</LinearLayout> diff --git a/app/src/main/res/layout/seek_bar.xml b/app/src/main/res/layout/seek_bar.xml new file mode 100644 index 0000000..69ad454 --- /dev/null +++ b/app/src/main/res/layout/seek_bar.xml @@ -0,0 +1,53 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +Copyright (C) 2018 Adrian Ulrich <adrian@blinkenlights.ch> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +--> +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_height="wrap_content" + android:layout_width="fill_parent" + android:layout_gravity="top" + android:background="?overlay_background_color" + android:elevation="2dp" + android:orientation="horizontal"> + <TextView + android:id="@+id/elapsed" + android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:layout_gravity="center" + android:paddingLeft="5dip" /> + <SeekBar + android:id="@+id/seek_bar" + android:layout_height="wrap_content" + android:layout_width="0px" + android:layout_gravity="center" + android:paddingTop="7dip" + android:paddingBottom="7dip" + android:paddingLeft="18dip" + android:paddingRight="18dip" + android:layout_weight="1" /> + <TextView + android:id="@+id/duration" + android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:layout_gravity="center" + android:paddingRight="5dip" /> +</LinearLayout> diff --git a/app/src/main/res/layout/seekbar_pref.xml b/app/src/main/res/layout/seekbar_pref.xml new file mode 100644 index 0000000..c846263 --- /dev/null +++ b/app/src/main/res/layout/seekbar_pref.xml @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +Copyright (C) 2012 Christopher Eby <kreed@kreed.org> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +--> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:layout_width="fill_parent" + android:layout_height="wrap_content"> + <TextView + android:id="@+id/value" + android:paddingTop="5dip" + android:paddingBottom="5dip" + android:paddingRight="20dip" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:gravity="right" /> + <SeekBar + android:id="@+id/seek_bar" + android:paddingTop="10dip" + android:paddingBottom="10dip" + android:paddingLeft="20dip" + android:paddingRight="20dip" + android:layout_width="fill_parent" + android:layout_height="wrap_content" /> + + <CheckBox android:id="@+id/check_box" + android:visibility="gone" + android:paddingTop="10dip" + android:paddingBottom="10dip" + android:layout_marginLeft="12dip" + android:paddingRight="20dip" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/empty" + /> + +</LinearLayout> diff --git a/app/src/main/res/layout/showqueue_listview.xml b/app/src/main/res/layout/showqueue_listview.xml new file mode 100644 index 0000000..14c4bb1 --- /dev/null +++ b/app/src/main/res/layout/showqueue_listview.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="utf-8"?> +<com.mobeta.android.dslv.DragSortListView + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:dslv="http://schemas.android.com/apk/res-auto" + android:id="@+id/list" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:listSelector="?android:attr/selectableItemBackground" + android:divider="@drawable/inset_divider" + android:dividerHeight="1dip" + dslv:drag_enabled="true" + dslv:drag_start_mode="onMove" + dslv:float_background_color="?float_color" + dslv:drag_handle_id="@+id/dragger" + dslv:remove_enabled="true" + dslv:remove_mode="flingRemove" + dslv:fling_handle_id="@+id/dragger" + /> diff --git a/app/src/main/res/layout/sort_dialog.xml b/app/src/main/res/layout/sort_dialog.xml new file mode 100644 index 0000000..e66c8c9 --- /dev/null +++ b/app/src/main/res/layout/sort_dialog.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +Copyright (C) 2011 Christopher Eby <kreed@kreed.org> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +--> +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:orientation="horizontal"> + <CheckBox + android:id="@+id/reverse_sort" + android:layout_marginLeft="?android:attr/listPreferredItemPaddingLeft" + android:text="@string/reverse_sort" + android:layout_width="wrap_content" + android:layout_height="wrap_content" /> +</LinearLayout> diff --git a/app/src/main/res/layout/tab_order.xml b/app/src/main/res/layout/tab_order.xml new file mode 100644 index 0000000..2d52e0f --- /dev/null +++ b/app/src/main/res/layout/tab_order.xml @@ -0,0 +1,63 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +Copyright (C) 2012 Christopher Eby <kreed@kreed.org> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +--> +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:dslv="http://schemas.android.com/apk/res-auto" + android:orientation="vertical" + android:divider="?android:attr/dividerHorizontal" + android:showDividers="middle" + android:layout_height="fill_parent" + android:layout_width="fill_parent"> + <com.mobeta.android.dslv.DragSortListView + android:id="@+id/list" + android:divider="@drawable/inset_divider" + android:dividerHeight="1dip" + android:layout_height="0px" + android:layout_width="fill_parent" + android:layout_weight="1" + android:choiceMode="multipleChoice" + dslv:drag_enabled="true" + dslv:drag_start_mode="onMove" + dslv:float_background_color="?float_color" + dslv:drag_handle_id="@+id/dragger" /> + <LinearLayout + style="?android:attr/buttonBarStyle" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:orientation="horizontal"> + <Button + style="?android:attr/buttonBarButtonStyle" + android:id="@+id/restore_default" + android:layout_width="0px" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="@string/restore_default" /> + <Button + style="?android:attr/buttonBarButtonStyle" + android:id="@+id/done" + android:layout_width="0px" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="@string/done" /> + </LinearLayout> +</LinearLayout> diff --git a/app/src/main/res/layout/track_details.xml b/app/src/main/res/layout/track_details.xml new file mode 100644 index 0000000..4223445 --- /dev/null +++ b/app/src/main/res/layout/track_details.xml @@ -0,0 +1,107 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +Copyright (C) 2018 Toby Hsieh + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see <https://www.gnu.org/licenses/>. +--> +<merge xmlns:android="http://schemas.android.com/apk/res/android"> + <TableRow> + <TextView + android:text="@string/_title" + android:textColor="?overlay_foreground_color" + android:paddingRight="5dip" + android:gravity="right" /> + <TextView + android:id="@+id/title" + android:textColor="?overlay_foreground_color" + android:textStyle="bold" /> + <TextView + android:id="@+id/queue_pos" + android:singleLine="true" + android:gravity="right" + android:layout_gravity="top" /> + </TableRow> + + <TableRow> + <TextView + android:text="@string/_artist" + android:textColor="?overlay_foreground_color" + android:paddingRight="5dip" + android:gravity="right" /> + <TextView android:id="@+id/artist" android:textColor="?overlay_foreground_color" /> + </TableRow> + + <TableRow> + <TextView + android:text="@string/_album" + android:textColor="?overlay_foreground_color" + android:paddingRight="5dip" + android:gravity="right" /> + <TextView android:id="@+id/album" android:textColor="?overlay_foreground_color" /> + </TableRow> + + <TableRow> + <TextView + android:text="@string/_genre" + android:textColor="?overlay_foreground_color" + android:paddingRight="5dip" + android:gravity="right" /> + <TextView android:id="@+id/genre" android:textColor="?overlay_foreground_color" /> + </TableRow> + + <TableRow> + <TextView + android:text="@string/_track" + android:textColor="?overlay_foreground_color" + android:paddingRight="5dip" + android:gravity="right" /> + <TextView android:id="@+id/track" android:textColor="?overlay_foreground_color" /> + </TableRow> + + <TableRow> + <TextView + android:text="@string/_year" + android:textColor="?overlay_foreground_color" + android:paddingRight="5dip" + android:gravity="right" /> + <TextView android:id="@+id/year" android:textColor="?overlay_foreground_color" /> + </TableRow> + + <TableRow> + <TextView + android:text="@string/_composer" + android:textColor="?overlay_foreground_color" + android:paddingRight="5dip" + android:gravity="right" /> + <TextView android:id="@+id/composer" android:textColor="?overlay_foreground_color" /> + </TableRow> + + <TableRow> + <TextView + android:text="@string/_path" + android:textColor="?overlay_foreground_color" + android:paddingRight="5dip" + android:gravity="right" /> + <TextView android:id="@+id/path" android:textColor="?overlay_foreground_color" /> + </TableRow> + + <TableRow> + <TextView + android:text="@string/_format" + android:textColor="?overlay_foreground_color" + android:paddingRight="5dip" + android:gravity="right" /> + <TextView android:id="@+id/format" android:textColor="?overlay_foreground_color" /> + </TableRow> +</merge> diff --git a/app/src/main/res/layout/widget_d.xml b/app/src/main/res/layout/widget_d.xml new file mode 100644 index 0000000..0e5ac1b --- /dev/null +++ b/app/src/main/res/layout/widget_d.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +Copyright (C) 2010, 2011 Christopher Eby <kreed@kreed.org> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +--> +<FrameLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" + android:layout_height="fill_parent"> + <ImageView + android:id="@+id/cover" + android:src="@drawable/fallback_cover_large" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:adjustViewBounds="true" + android:scaleType="fitCenter" + android:contentDescription="@string/cover_art" /> + <include layout="@layout/widget_e" /> +</FrameLayout> diff --git a/app/src/main/res/layout/widget_e.xml b/app/src/main/res/layout/widget_e.xml new file mode 100644 index 0000000..af6d21b --- /dev/null +++ b/app/src/main/res/layout/widget_e.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +Copyright (C) 2012 Christopher Eby <kreed@kreed.org> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +--> +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:background="#a000" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_gravity="bottom|center_horizontal" + android:orientation="vertical"> + <TextView + android:id="@+id/title" + android:textSize="16sp" + android:textColor="#ffff" + android:textStyle="bold" + android:singleLine="true" + android:ellipsize="marquee" + android:gravity="center" + android:layout_width="fill_parent" + android:visibility="gone" + android:layout_height="wrap_content" /> + <TextView + android:id="@+id/artist" + android:text="@string/app_name" + android:textSize="14sp" + android:textColor="#ffff" + android:singleLine="true" + android:ellipsize="marquee" + android:gravity="center" + android:layout_width="fill_parent" + android:layout_height="wrap_content" /> + <LinearLayout + android:id="@+id/buttons" + android:orientation="horizontal" + android:layout_width="fill_parent" + android:layout_height="wrap_content"> + <include layout="@layout/controls_widget" /> + </LinearLayout> +</LinearLayout> diff --git a/app/src/main/res/mipmap-anydpi-v26/icon.xml b/app/src/main/res/mipmap-anydpi-v26/icon.xml new file mode 100644 index 0000000..cb82548 --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/icon.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> + <background android:drawable="@mipmap/ic_normal_background" /> + <foreground android:drawable="@mipmap/ic_normal_foreground" /> +</adaptive-icon> diff --git a/app/src/main/res/mipmap-hdpi/ic_normal_background.png b/app/src/main/res/mipmap-hdpi/ic_normal_background.png Binary files differnew file mode 100644 index 0000000..f8f3e63 --- /dev/null +++ b/app/src/main/res/mipmap-hdpi/ic_normal_background.png diff --git a/app/src/main/res/mipmap-hdpi/ic_normal_foreground.png b/app/src/main/res/mipmap-hdpi/ic_normal_foreground.png Binary files differnew file mode 100644 index 0000000..07afaac --- /dev/null +++ b/app/src/main/res/mipmap-hdpi/ic_normal_foreground.png diff --git a/app/src/main/res/mipmap-hdpi/icon.png b/app/src/main/res/mipmap-hdpi/icon.png Binary files differnew file mode 100644 index 0000000..68b1288 --- /dev/null +++ b/app/src/main/res/mipmap-hdpi/icon.png diff --git a/app/src/main/res/mipmap-mdpi/ic_normal_background.png b/app/src/main/res/mipmap-mdpi/ic_normal_background.png Binary files differnew file mode 100644 index 0000000..7fa3508 --- /dev/null +++ b/app/src/main/res/mipmap-mdpi/ic_normal_background.png diff --git a/app/src/main/res/mipmap-mdpi/ic_normal_foreground.png b/app/src/main/res/mipmap-mdpi/ic_normal_foreground.png Binary files differnew file mode 100644 index 0000000..3644cbf --- /dev/null +++ b/app/src/main/res/mipmap-mdpi/ic_normal_foreground.png diff --git a/app/src/main/res/mipmap-mdpi/icon.png b/app/src/main/res/mipmap-mdpi/icon.png Binary files differnew file mode 100644 index 0000000..af98298 --- /dev/null +++ b/app/src/main/res/mipmap-mdpi/icon.png diff --git a/app/src/main/res/mipmap-xhdpi/ic_normal_background.png b/app/src/main/res/mipmap-xhdpi/ic_normal_background.png Binary files differnew file mode 100644 index 0000000..a8f3042 --- /dev/null +++ b/app/src/main/res/mipmap-xhdpi/ic_normal_background.png diff --git a/app/src/main/res/mipmap-xhdpi/ic_normal_foreground.png b/app/src/main/res/mipmap-xhdpi/ic_normal_foreground.png Binary files differnew file mode 100644 index 0000000..43d890d --- /dev/null +++ b/app/src/main/res/mipmap-xhdpi/ic_normal_foreground.png diff --git a/app/src/main/res/mipmap-xhdpi/icon.png b/app/src/main/res/mipmap-xhdpi/icon.png Binary files differnew file mode 100644 index 0000000..c9c7932 --- /dev/null +++ b/app/src/main/res/mipmap-xhdpi/icon.png diff --git a/app/src/main/res/mipmap-xxhdpi/ic_normal_background.png b/app/src/main/res/mipmap-xxhdpi/ic_normal_background.png Binary files differnew file mode 100644 index 0000000..b29a506 --- /dev/null +++ b/app/src/main/res/mipmap-xxhdpi/ic_normal_background.png diff --git a/app/src/main/res/mipmap-xxhdpi/ic_normal_foreground.png b/app/src/main/res/mipmap-xxhdpi/ic_normal_foreground.png Binary files differnew file mode 100644 index 0000000..fb2493f --- /dev/null +++ b/app/src/main/res/mipmap-xxhdpi/ic_normal_foreground.png diff --git a/app/src/main/res/mipmap-xxhdpi/icon.png b/app/src/main/res/mipmap-xxhdpi/icon.png Binary files differnew file mode 100644 index 0000000..65dd38e --- /dev/null +++ b/app/src/main/res/mipmap-xxhdpi/icon.png diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_normal_background.png b/app/src/main/res/mipmap-xxxhdpi/ic_normal_background.png Binary files differnew file mode 100644 index 0000000..e2639c7 --- /dev/null +++ b/app/src/main/res/mipmap-xxxhdpi/ic_normal_background.png diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_normal_foreground.png b/app/src/main/res/mipmap-xxxhdpi/ic_normal_foreground.png Binary files differnew file mode 100644 index 0000000..cd15238 --- /dev/null +++ b/app/src/main/res/mipmap-xxxhdpi/ic_normal_foreground.png diff --git a/app/src/main/res/mipmap-xxxhdpi/icon.png b/app/src/main/res/mipmap-xxxhdpi/icon.png Binary files differnew file mode 100644 index 0000000..6e67837 --- /dev/null +++ b/app/src/main/res/mipmap-xxxhdpi/icon.png diff --git a/app/src/main/res/values-be/translatable.xml b/app/src/main/res/values-be/translatable.xml new file mode 100644 index 0000000..acead94 --- /dev/null +++ b/app/src/main/res/values-be/translatable.xml @@ -0,0 +1,359 @@ +<?xml version='1.0' encoding='UTF-8'?> +<resources> + <string name="app_name">Vanilla Music</string> + <string name="ok">Добра</string> + <string name="cancel">Скасаваць</string> + <!--Playback Activity (main screen)--> + <string name="no_songs">На вашай прыладзе не знойдзена музыкі.</string> + <string name="empty_queue">Кампазіцый не абрана. Абярыце іх у бібліятэцы або націсніце на гэтае паведамленне, каб уключыць выпадковы рэжым.</string> + <string name="settings">Налады</string> + <string name="no_shuffle">Не перамешваць</string> + <string name="shuffle_songs">Перамешваць кампазіцыі</string> + <string name="shuffle_songs_continuously">Заўсёды перамешваць кампазіцыі</string> + <string name="shuffle_albums">Перамешваць альбомы</string> + <string name="no_repeat">Не паўтараць</string> + <string name="repeat">Паўтарэнне</string> + <string name="repeat_current_song">Паўтараць бягучую кампазіцыю</string> + <string name="stop_current_song">Спыніць пасля бягучай кампазіцыі</string> + <string name="random">Выпадкова</string> + <string name="random_enabling">Выпадковы рэжым уключаны</string> + <string name="song_load_failed">Не атрымалася загрузіць кампазіцыю %s\". Магчыма, яна пашкоджаная альбо была выдаленая.</string> + <string name="queue_cleared">Чарга ачышчаная.</string> + <string name="cover_art">Вокладка</string> + <string name="close_notification">Закрыць апавяшчэнне</string> + <string name="_genre">жанр</string> + <string name="_track">кампазіцыя</string> + <string name="_composer">кампазітар</string> + <string name="_path">шлях</string> + <string name="_format">фармат</string> + <string name="_title">назва</string> + <string name="_artist">выканаўца</string> + <string name="_album">альбом</string> + <string name="_year">год</string> + <string name="_replaygain">перадузмацненне</string> + <!--New Playlist Dialog--> + <string name="choose_playlist_name">Прыдумайце спісу прайгравання назву</string> + <string name="create">Стварыць</string> + <string name="overwrite">Перазапісаць</string> + <string name="delete_playlist">Выдаліць спіс прайгравання %s?</string> + <!--Library--> + <string name="enqueue">У канец чаргі</string> + <string name="enqueue_as_next">Прайграць наступнае</string> + <string name="play">Прайграць</string> + <string name="edit">Рэдагаваць</string> + <string name="rename">Змяніць назву</string> + <string name="save_as_playlist">Захаваць як спіс прайгравання…</string> + <string name="add_to_playlist">Дадаць у спіс прайгравання…</string> + <string name="add_to_homescreen">Дадаць на хатні экран…</string> + <string name="add_to">Дадаць у…</string> + <string name="playlist">Спіс прайгравання</string> + <string name="homescreen">Дадаць на хатні экран</string> + <string name="add_to_favorites">Дадаць ва ўлюбёныя</string> + <string name="remove_from_favorites">Выдаліць з улюбёных</string> + <string name="playlist_favorites">Улюбёныя</string> + <string name="new_playlist">Новы спіс прайгравання…</string> + <string name="expand">Паказаць</string> + <string name="expand_or_play_all">Паказаць альбо прайграць усё</string> + <string name="delete">Выдаліць</string> + <string name="playback_view">Зараз прайграецца</string> + <string name="sort_by">Сартаванне</string> + <string name="search">Пошук</string> + <string name="done">Завершана</string> + <string name="remove">Выдаліць</string> + <string name="play_or_enqueue">У чаргу на прайграванне; прайграць падчас прыпынення</string> + <string name="open">Адкрыць</string> + <string name="go_home">Хатні каталог</string> + <string name="jumping_to_song">Кампазіцыя ўжо ў чарзе, пераход…</string> + <!--As a developer, you should always supply "one" and "other" + strings. Your translators will know which strings are actually + needed for their language. Always include %d in "one" because + translators will need to use %d for languages where "one" + doesn't mean 1 (as explained above). + + Translators should use http://unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules and + http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html, Type cardinal, + to see which categories apply to integer numbers in their languages--> + <plurals name="playing"> + <item quantity="one">Прайграецца %d кампазіцыя.</item> + <item quantity="few">Прайграецца %d кампазіцыі.</item> + <item quantity="many">Прайграецца %d кампазіцый.</item> + <item quantity="other">Прайграецца %d кампазіцый.</item> + </plurals> + <plurals name="enqueued"> + <item quantity="one">Дададзена %d кампазіцыя.</item> + <item quantity="few">Дададзена %d кампазіцыі.</item> + <item quantity="many">Дададзена %d кампазіцый.</item> + <item quantity="other">Дададзена %d кампазіцый.</item> + </plurals> + <plurals name="added_to_playlist"> + <item quantity="one">У спіс прайгравання %2$s дададзеная %1$d кампазіцыя.</item> + <item quantity="few">У спіс прайгравання %2$s дададзена %1$d кампазіцыі.</item> + <item quantity="many">У спіс прайгравання %2$s дададзена %1$d кампазіцый.</item> + <item quantity="other">У спіс прайгравання %2$s дададзена %1$d кампазіцый.</item> + </plurals> + <plurals name="removed_from_playlist"> + <item quantity="one">Са спіса прайгравання %2$s выдаленая %1$d кампазіцыя.</item> + <item quantity="few">Са спіса прайгравання %2$s выдалена %1$d кампазіцыі.</item> + <item quantity="many">Са спіса прайгравання %2$s выдалена %1$d кампазіцый.</item> + <item quantity="other">Са спіса прайгравання %2$s выдалена %1$d кампазіцый.</item> + </plurals> + <plurals name="deleted"> + <item quantity="one">Выдалена %d кампазіцыя.</item> + <item quantity="few">Выдалена %d кампазіцыі.</item> + <item quantity="many">Выдалена %d кампазіцый.</item> + <item quantity="other">Выдалена %d кампазіцый.</item> + </plurals> + <string name="delete_file_failed">Не атрымалася выдаліць %s.</string> + <string name="deleted_item">\"%s\" выдаленая.</string> + <string name="delete_item">Выдаліць \"%s\"?</string> + <string name="delete_file">Выдаліць файл \"%s\"?</string> + <string name="artists">Выканаўцы</string> + <string name="albums">Альбомы</string> + <string name="albumartists">Выканаўцы альбомаў</string> + <string name="composers">Кампазітары</string> + <string name="songs">Кампазіцыі</string> + <string name="playlists">Спісы прайгравання</string> + <string name="genres">Жанры</string> + <string name="files">Файлы</string> + <string name="artist">Выканаўца</string> + <string name="album">Альбом</string> + <string name="genre">Жанр</string> + <string name="folder">Каталог</string> + <string name="filename">Назва файла</string> + <string name="file_size">Памер файла</string> + <string name="file_time">Час змены</string> + <string name="extension">Пашырэнне</string> + <string name="unknown">Невядома</string> + <string name="play_all">Прайграць усё</string> + <string name="enqueue_all">Усё ў чаргу</string> + <string name="all_songs">Усе кампазіцыі</string> + <string name="details">Падрабязнасці</string> + <string name="more_from_artist">Іншыя кампазіцыі выканаўцы</string> + <string name="more_from_album">Іншыя кампазіцыі з гэтага альбома</string> + <string name="title">Назва</string> + <string name="number_of_tracks">Колькасць кампазіцый</string> + <string name="year">Год</string> + <string name="date_added">Дададзена</string> + <string name="artist_album">Выканаўца, альбом</string> + <string name="artist_year_album">Выканаўца, год, альбом</string> + <string name="artist_album_track">Выканаўца, альбом, нумар кампазіцыі</string> + <string name="artist_album_title">Выканаўца, альбом, назва</string> + <string name="artist_year">Выканаўца, год</string> + <string name="album_track">Выканаўца, нумар кампазіцыі</string> + <string name="song_playcount">Чашчыня прайгравання</string> + <!--Preferences--> + <plurals name="seconds"> + <item quantity="one">%d секунда</item> + <item quantity="few">%d секунды</item> + <item quantity="many">%d секунд</item> + <item quantity="other">%d секунд</item> + </plurals> + <plurals name="minutes"> + <item quantity="one">%d хвіліна</item> + <item quantity="few">%d хвіліны</item> + <item quantity="many">%d хвілін</item> + <item quantity="other">%d хвілін</item> + </plurals> + <plurals name="hours"> + <item quantity="one">%d гадзіна</item> + <item quantity="few">%d гадзіны</item> + <item quantity="many">%d гадзін</item> + <item quantity="other">%d гадзін</item> + </plurals> + <string name="audio">Аўдыё</string> + <string name="volume_during_ducking_title">Гучнасць падчас апавяшчэнняў</string> + <string name="volume_during_ducking_summary">Гучнасць прайгравання: </string> + <string name="ignore_audiofocus_loss_summary">Працягваць прайграванне пры поўнай страце канала гуку</string> + <string name="media_button_title">Кіраванне з правадных і бесправадных прылад</string> + <string name="media_button_summary">Патрэбна для кіравання прайграваннем на прыладах з ICS.</string> + <string name="headset_only_title">Толькі вонкавы вывад</string> + <string name="headset_only_summary">Прадухіляе прайграванне музыкі праз унутраныя дынамікі.</string> + <string name="headset_pause_title">Прыпыненне пры адлучэнні</string> + <string name="headset_pause_summary">Прыпыненне прайгравання пры адлучэнні навушнікаў.</string> + <string name="headset_launch_title">Прайграванне пры падлучэнні</string> + <string name="headset_launch_summary">Запуск прайгравання пры падлучэнні навушнікаў (патрабуецца праграма \"Headphone detector\").</string> + <string name="headset_launch_app_missing">Для гэтай функцыі патрабуецца праграма \"Headphone detector\".\nХочаце ўсталяваць яе з Крамы Play?</string> + <string name="replaygain">Перадузмацненне</string> + <string name="replaygain_summary">Наладка апрацоўкі звестак перадузмацнення</string> + <string name="replaygain_track_title">Уключыць перадузмацненне кампазіцый</string> + <string name="replaygain_track_summary">Выраўноўваць гучнасць усіх кампазіцый</string> + <string name="replaygain_album_title">Уключыць перадузмацненне альбома</string> + <string name="replaygain_album_summary">Захоўвае дынаміку альбома</string> + <string name="replaygain_bump_title">Перадузмацненне кампазіцый</string> + <string name="replaygain_untagged_debump_title">Кампазіцыі без пазнак перадузмацнення</string> + <string name="replaygain_untagged_debump_summary">Панізіць гучнасць</string> + <string name="replaygain_preamp_note_title">Нататка</string> + <string name="replaygain_preamp_note_content">Android не дае Vanilla Music павялічыць гучнасць больш за >100%. Таму пры прайграванні ціхай музыкі з вялікім перадузмацненнем могуць узнікнуць праблемы. \n\nРэкамендуецца:\n-> -3dB для ціхай ці класічнай музыкі і \n-> +3dB для запісаў пасля 2000 года</string> + <string name="readahead">Уключыць папярэдні кэш</string> + <string name="readahead_summary">Папярэдняе кэшаванне дапамагае пазбавіцца ад праблем знікнення гуку на павольных картках памяці.</string> + <string name="equalizer">Эквалайзер</string> + <string name="cycle_continuous_shuffling">Бесперапыннае перамешванне</string> + <string name="cycle_continuous_shuffling_summary">У рэжыме перамешвання кампазіцыі з чаргі прайграюцца выпадкова</string> + <string name="notifications">Апавяшчэнні</string> + <string name="notification_visibility_title">Вывад апавяшчэнняў</string> + <string name="notification_action_title">Дзеянне апавяшчэння</string> + <string name="playback_screen">Экран прайгравання</string> + <string name="playback_on_startup_title">Адкрыццё падчас запуску</string> + <string name="playback_on_startup_summary">Пасля запуску адкрываць акно прайгравання</string> + <string name="display_mode_title">Рэжым адлюстравання</string> + <string name="swipe_up_action_title">Дзеянне пры ссоўванні ўверх</string> + <string name="swipe_down_action_title">Дзеянне пры ссоўванні ўніз</string> + <string name="cover_press_action_title">Дзеянне пры націсканні на вокладку</string> + <string name="cover_longpress_action_title">Дзеянне пры працяглым націсканні на вокладку</string> + <string name="library_screen">Экран бібліятэкі</string> + <string name="default_action_title">Прадвызначанае дзеянне</string> + <string name="default_playlist_action_title">Прадвызначанае дзеянне для спіса прайгравання</string> + <string name="accelerometer_shake">Кіраванне акселерометрам</string> + <string name="enable_shake_title">Уключыць кіраванне акселерометрам</string> + <string name="enable_shake_summary">Працуе толькі падчас прайгравання музыкі. На некаторых прыладах можа не працаваць пры адключаным экране.</string> + <string name="shake_action_title">Дзеянне для акселерометра</string> + <string name="shake_threshold_title">Парог адчувальнасці для акселерометра</string> + <string name="misc_features">Дадатковыя функцыі</string> + <string name="theme">Тэма</string> + <string name="disable_lockscreen_title">Адключыць блакаванне экрана</string> + <string name="disable_lockscreen_summary">Замінаць уключэнню блакавання экрана пры адкрытай бібліятэцы ці падчас прайгравання</string> + <string name="keep_screen_on_title">Не выключаць экран</string> + <string name="keep_screen_on_summary">Пакідаць экран уключаным пры бачным акне Vanilla Music</string> + <string name="use_idle_timeout_title">Уключыць час чакання</string> + <string name="use_idle_timeout_summary">Калі актыўна, прайграванне спыніцца пасля вызначанага перыяду бяздзейнасці</string> + <string name="idle_timeout_title">Час чакання</string> + <string name="enable_scroll_to_song_title">Пераход да назвы кампазіцыі</string> + <string name="enable_scroll_to_song_summary">Пераходзіць у спісе бібліятэкі да прайграваемай кампазіцыі, альбома, выканаўцы</string> + <string name="queue_enable_scroll_to_song_title">Пераход да назвы кампазіцыі ў чарзе</string> + <string name="queue_enable_scroll_to_song_summary">Пераходзіць пры змене песні да прайграваемай кампазіцыі ў чарзе</string> + <string name="jump_to_enqueued_on_play_title">Пераход да песні з чаргі пры націсканні кнопкі \"Прайграць\"</string> + <string name="jump_to_enqueued_on_play_summary">Калі патрэбная песня ўжо ёсць у чарзе, то замест ачышчэння спіса пераходзіць да яе</string> + <string name="coverloader_android_title">Загрузка вокладак з базаў Андроід</string> + <string name="coverloader_android_summary">Шукаць вокладкі ва ўнутраных базах даных медыяфайлаў аперацыйнай сістэмы Андроід</string> + <string name="coverloader_vanilla_title">Загрузка вокладак з каталога</string> + <string name="coverloader_vanilla_summary">Шукаць выявы з назвамі cover.jpg, album.jpg або artwork.jpg і паказваць іх як вокладкі альбомаў</string> + <string name="coverloader_shadow_title">Загрузка вокладак са схаванага каталога</string> + <string name="coverloader_shadow_summary">Спрабаваць загружаць вокладкі з \'/sdcard/Music/.vanilla/ARTIST/ALBUM.jpg\'</string> + <string name="coverloader_inline_title">Загрузка вокладак з пазнак файлаў</string> + <string name="coverloader_inline_summary">Спрабаваць загружаць убудаваныя вокладкі з пазнак файлаў</string> + <string name="cover_on_lockscreen_title">Адлюстраванне вокладак на экране блакавання</string> + <string name="cover_on_lockscreen_summary">Паказваць вокладку прайграваемай кампазіцыі на экране блакавання</string> + <string name="double_tap_title">Падвойнае націсканне віджэта</string> + <string name="double_tap_summary">Калі двойчы націснуць на віджэт, то адкрыецца акно прайгравальніка. Дадаецца затрымка ў 400 мс.</string> + <string name="scrobble_title">Выкарыстоўваць Scrobble Droid API</string> + <string name="scrobble_summary">Адпраўляць статыстыку на Last.fm з дапамогай Scrobble Droid або Simple Last.fm Scrobbler</string> + <string name="stock_broadcast_title">Імітаваць стандартныя паводзіны</string> + <string name="stock_broadcast_summary">Адпраўляць даныя, якія імітуюць паводзіны стандартнага музычнага прайгравальніка, каб працаваць з пабочнымі элементамі кіравання для экрана блакавання.</string> + <string name="help">Даведка</string> + <string name="about">Звесткі</string> + <string name="tabs">Парадак укладак</string> + <string name="customize_tab_order">Наладка парадку і бачнасці ўкладак бібліятэкі</string> + <string name="restore_default">Скінуць да прадвызначанага</string> + <!--The following are for the list preferences--> + <string name="last_used_action">Апошняе дзеянне</string> + <string name="never_show">Ніколі не паказваць</string> + <string name="show_when_playing">Паказваць падчас прайгравання (прадвызначана)</string> + <string name="always_show">Заўсёды паказваць</string> + <string name="open_main_activity">Адкрыць бібліятэку (прадвызначана)</string> + <string name="open_mini_popup">Адкрыць выплыўное акно</string> + <string name="skip_to_next_song">Перайсці да наступнай кампазіцыі</string> + <string name="open_full_player">Разгарнуць прайгравальнік</string> + <string name="info_on_cover">Звесткі на вокладцы</string> + <string name="info_below_cover">Звесткі пад вокладкай</string> + <string name="fixed_info">Звесткі ўверсе экрана</string> + <string name="do_nothing">Нічога не рабіць</string> + <string name="open_library">Адкрыць бібліятэку</string> + <string name="play_pause">Прайграць/Прыпыніць</string> + <string name="next_song">Наступная кампазіцыя</string> + <string name="previous_song">Папярэдняя кампазіцыя</string> + <string name="next_album">Наступны альбом</string> + <string name="previous_album">Папярэдні альбом</string> + <string name="cycle_repeat_mode">Рэжым цыклічнага паўтарэння</string> + <string name="cycle_shuffle_mode">Рэжым цыклічнага змешвання</string> + <string name="enqueue_current_album">Дадаць альбом у чаргу</string> + <string name="enqueue_current_artist">Дадаць выканаўца ў чаргу</string> + <string name="enqueue_current_genre">Дадаць жанр у чаргу</string> + <string name="enqueue_current">У канец чаргі…</string> + <string name="more_from_current">Яшчэ ад…</string> + <string name="empty_the_queue">Ачысціць чаргу</string> + <string name="show_queue">Паказаць чаргу</string> + <string name="hide_queue">Схаваць чаргу</string> + <string name="dequeue_rest">Прыбраць астатняе з чаргі</string> + <string name="toggle_controls">Пераключальнік элементаў кіравання</string> + <string name="seek_10s_backward">Матаць на 10 секунд назад</string> + <string name="seek_10s_forward">Матаць на 10 секунд уперад</string> + <string name="move_to_top">Перамясціць уверх</string> + <string name="move_to_bottom">Перамясціць уніз</string> + <string name="preferences_action_show_queue">Паказаць чаргу</string> + <string name="preferences_action_clear_queue">Ачысціць чаргу</string> + <string name="preferences_action_enqueue_current_album">Дадаць альбом у чаргу</string> + <string name="preferences_action_enqueue_current_artist">Дадаць выканаўца ў чаргу</string> + <string name="preferences_action_enqueue_current_genre">Дадаць жанр у чаргу</string> + <string name="jump_to_time">Пераход па часе</string> + <string name="time_separator">:</string> + <string name="hour_hint">ГГ</string> + <string name="minute_hint">ХХ</string> + <string name="second_hint">СС</string> + <string name="error_invalid_position">Хібная пазіцыя</string> + <string name="filebrowser_start">Пачатковы каталог кіраўніка файлаў</string> + <string name="customize_filebrowser_start">Кіраўнік файлаў будзе запускацца ў гэтым каталозе</string> + <string name="select">Абраць</string> + <string name="save">Захаваць</string> + <string name="autoplaylist_playcounts_title">Аўтаматычнае стварэнне спісаў прайгравання</string> + <string name="autoplaylist_playcounts_summary">Аўтаматычна ствараць</string> + <string name="autoplaylist_playcounts_fmt" formatted="false">%s спіс прайгравання \"%.0f лепшых\"</string> + <string name="autoplaylist_playcounts_disabled">Не ствараць спісы прайгравання аўтаматычна</string> + <string name="autoplaylist_playcounts_name" formatted="false">%d лепшых</string> + <string name="playlist_sync_mode_title">Сінхранізацыя спісаў прайгравання</string> + <string name="playlist_sync_all">Поўная сінхранізацыя</string> + <string name="playlist_sync_only_import">Імпартаваць M3U, не экспартаваць</string> + <string name="playlist_sync_only_export">Запісваць M3U, не імпартаваць</string> + <string name="playlist_sync_disabled">Адключана</string> + <string name="playlist_sync_folder_title">Каталог сінхранізацыі</string> + <string name="playlist_sync_folder_summary">Каталог для сінхранізацыі спісаў прайгравання</string> + <string name="playlist_export_relative_paths_title">Экспарт з дапамогай адносных шляхоў</string> + <string name="playlist_export_relative_paths_summary">Спасылкі ў шляху адносна спіса прайгравання</string> + <string name="permission_request_summary">Для паказу вашай бібліятэкі Vanilla Music патрэбны дазвол на чытанне</string> + <string name="reverse_sort">Адваротны парадак</string> + <string name="share">Падзяліцца…</string> + <string name="share_failed">Не атрымалася падзяліцца файлам</string> + <string name="sendto">Адправіць…</string> + <string name="no_receiving_apps">У вас няма праграм для апрацоўкі файлаў гэтага тыпу!</string> + <string name="duration">Працягласць</string> + <string name="dump_database">Стварыць копію базы даных</string> + <string name="dump_database_result">Копія базы даных створаная ў \"%s\"</string> + <string name="force_m3u_import">Нанова імпартаваць M3U</string> + <string name="media_library">Бібліятэка медыяфайлаў</string> + <string name="media_folders_header">Індэксаваныя каталогі</string> + <string name="media_scan_header">Сканер медыяфайлаў</string> + <string name="media_scan_full">Поўнае сканаванне файлавай сістэмы (павольна)</string> + <string name="media_scan_drop_db">Ачысціць базу даных</string> + <string name="media_scan_start">Пачаць сканаванне</string> + <string name="media_scan_force_bastp">Заўсёды выкарыстоўваць убудаваны чытальнік пазнак</string> + <string name="media_scan_group_albums">Групаваць альбомы па каталогах</string> + <string name="media_statistics">Статыстыка</string> + <string name="media_stats_tracks">Колькасць кампазіцый</string> + <string name="media_stats_library_playtime">Агульны час прайгравання (у гадзінах)</string> + <string name="media_stats_listen_playtime">Прайграна музыкі на дадзены момант</string> + <string name="media_stats_progress">Ход сканавання</string> + <string name="media_library_scan_running">Сканаванне бібліятэкі…</string> + <string name="media_scan_preferences">Параметры сканавання</string> + <string name="media_scan_preferences_change_title">Параметры сканавання змененыя</string> + <string name="media_scan_preferences_change_message">Калі змяніць гэты параметр, то запусціцца поўнае сканаванне вашай бібліятэкі. Хочаце працягнуць?</string> + <string name="folder_picker_spinner_desc">Стан каталога:</string> + <!--Folder selector--> + <string name="hint_long_press_to_modify_folder">Працягла націсніце, каб змяніць параметры каталога</string> + <string name="folder_include">Уключыць</string> + <string name="folder_exclude">Выключыць</string> + <string name="folder_neutral">Пакінуць</string> + <!--Plugin system--> + <string name="plugins">Убудовы</string> + <string name="plugin_needs_upgrade">Калі ласка, абнавіце ўбудову %s да апошняй версіі</string> + <!--Theme names--> + <string name="theme_name_standard_light">Стандартная</string> + <string name="theme_name_standard_dark">Стандартная (цёмная)</string> + <string name="theme_name_grey_light">Шэрая</string> + <string name="theme_name_grey_dark">Шэрая (цёмная)</string> + <string name="theme_name_orange_light">Аранжавая</string> + <string name="theme_name_orange_dark">Аранжавая (цёмная)</string> + <string name="theme_name_blue_light">Сіняя</string> + <string name="theme_name_blue_dark">Сіняя (цёмная)</string> + <string name="theme_name_red_light">Чырвоная</string> + <string name="theme_name_red_dark">Чырвоная (цёмная)</string> + <string name="theme_name_amoled_dark">Чорная (AMOLED)</string> +</resources> diff --git a/app/src/main/res/values-br/translatable.xml b/app/src/main/res/values-br/translatable.xml new file mode 100644 index 0000000..050d3ba --- /dev/null +++ b/app/src/main/res/values-br/translatable.xml @@ -0,0 +1,362 @@ +<?xml version='1.0' encoding='UTF-8'?> +<resources> + <string name="app_name">Vanilla Music</string> + <string name="ok">Mat eo</string> + <string name="cancel">Nullañ</string> + <!--Playback Activity (main screen)--> + <string name="no_songs">N\'eo bet kavet ton ebet war ho trevnad.</string> + <string name="empty_queue">Ton ebet diuzet. Dibabit unan er sonaoueg pe kit er mod dargouezhek en ur stokañ ar gemennadenn-mañ.</string> + <string name="settings">Arventennoù</string> + <string name="no_shuffle">En urzh</string> + <string name="shuffle_songs">Dargouezhek</string> + <string name="shuffle_songs_continuously">Dargouezhek kendalc\'hus</string> + <string name="shuffle_albums">Albomoù dargouezhek</string> + <string name="no_repeat">Na adseniñ</string> + <string name="repeat">Adseniñ</string> + <string name="repeat_current_song">Adseniñ an ton bremanel</string> + <string name="stop_current_song">Paouez goude an ton bremanel</string> + <string name="random">Dargouezhek</string> + <string name="random_enabling">Dargouezhek gweredekaet</string> + <string name="song_load_failed">C\'hwitadenn en ur gargañ an ton %s. Marteze eo kontronet pe n\'eus ket anezhi.</string> + <string name="queue_cleared">Lost skarzhet.</string> + <string name="cover_art">Golo</string> + <string name="close_notification">Serriñ ar rebuzadur</string> + <string name="_genre">doare</string> + <string name="_track">ton</string> + <string name="_composer">sonaozer</string> + <string name="_path">treug</string> + <string name="_format">mentrezh</string> + <string name="_title">titl</string> + <string name="_artist">arzour</string> + <string name="_album">albom</string> + <string name="_year">bloavezh</string> + <string name="_replaygain">rgain</string> + <!--New Playlist Dialog--> + <string name="choose_playlist_name">Dibab anv ar roll seniñ</string> + <string name="create">Krouiñ</string> + <string name="overwrite">Flastrañ</string> + <string name="delete_playlist">Dilemel ar roll-seniñ %s?</string> + <!--Library--> + <string name="enqueue">Lakaat el lost</string> + <string name="enqueue_as_next">War-lec\'h</string> + <string name="play">Seniñ</string> + <string name="edit">Embann</string> + <string name="rename">Adenvel</string> + <string name="save_as_playlist">Enrollañ evel ur roll-seniñ...</string> + <string name="add_to_playlist">Ouzhpennañ er roll-seniñ...</string> + <string name="add_to_homescreen">Ouzhpennañ d\'ar skramm degemer</string> + <string name="add_to">Ouzhpennañ da...</string> + <string name="playlist">Roll seniñ</string> + <string name="homescreen">Skramm degemer</string> + <string name="add_to_favorites">Ouzhpennañ en tonioù gwellañ</string> + <string name="remove_from_favorites">Dilemel eus an tonioù gwellañ</string> + <string name="playlist_favorites">Gwellañ</string> + <string name="new_playlist">Roll-seniñ nevez...</string> + <string name="expand">Astenn</string> + <string name="expand_or_play_all">Astenn pe seniñ pep tra</string> + <string name="delete">Dilemel</string> + <string name="playback_view">O seniñ</string> + <string name="sort_by">Urzhiañ dre</string> + <string name="search">Klask</string> + <string name="done">Graet</string> + <string name="remove">Dilemel</string> + <string name="play_or_enqueue">Lakaat el lost m\'emañ o seniñ. Seniñ m\'eo ehanet</string> + <string name="open">Digeriñ</string> + <string name="go_home">Teuliad pennañ</string> + <string name="jumping_to_song">El lost emañ ar roudenn endeo, o seniñ...</string> + <!--As a developer, you should always supply "one" and "other" + strings. Your translators will know which strings are actually + needed for their language. Always include %d in "one" because + translators will need to use %d for languages where "one" + doesn't mean 1 (as explained above). + + Translators should use http://unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules and + http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html, Type cardinal, + to see which categories apply to integer numbers in their languages--> + <plurals name="playing"> + <item quantity="one">%d ton o seniñ.</item> + <item quantity="two">%d a donioù o seniñ.</item> + <item quantity="few">%d a donioù o seniñ.</item> + <item quantity="many">%d a donioù o seniñ.</item> + <item quantity="other">%d a donioù o seniñ.</item> + </plurals> + <plurals name="enqueued"> + <item quantity="one"> %dton el lost.</item> + <item quantity="two">%d a donioù el lost.</item> + <item quantity="few">%d a donioù el lost.</item> + <item quantity="many">%d a donioù el lost.</item> + <item quantity="other">%d a donioù el lost.</item> + </plurals> + <plurals name="added_to_playlist"> + <item quantity="one">%1$d ton ouzhpennet er roll-seniñ %2$s. </item> + <item quantity="two">%1$d a donioù ouzhpennet er roll-seniñ %2$s. </item> + <item quantity="few">%1$d a donioù ouzhpennet er roll-seniñ %2$s. </item> + <item quantity="many">%1$d a donioù ouzhpennet er roll-seniñ %2$s. </item> + <item quantity="other">%1$d a donioù ouzhpennet er roll-seniñ %2$s. </item> + </plurals> + <plurals name="removed_from_playlist"> + <item quantity="one">%1$d ton lamet kuit eus ar roll-seniñ %2$s.</item> + <item quantity="two">%1$d a donioù lamet kuit eus ar roll-seniñ %2$s.</item> + <item quantity="few">%1$d a donioù lamet kuit eus ar roll-seniñ %2$s.</item> + <item quantity="many">%1$d a donioù lamet kuit eus ar roll-seniñ %2$s.</item> + <item quantity="other">%1$d a donioù lamet kuit eus ar roll-seniñ %2$s.</item> + </plurals> + <plurals name="deleted"> + <item quantity="one">%d ton diuzet.</item> + <item quantity="two">%d a donioù diuzet.</item> + <item quantity="few">%d a donioù diuzet.</item> + <item quantity="many">%d a donioù diuzet.</item> + <item quantity="other">%d a donioù diuzet.</item> + </plurals> + <string name="delete_file_failed">Fazi en ul lemel kuit %s.</string> + <string name="deleted_item">\'%s\' dilamet.</string> + <string name="delete_item">Dilemel \'%s\'?</string> + <string name="delete_file">Dilemel ar restr \'%s\'?</string> + <string name="artists">Arzourien</string> + <string name="albums">Albomoù</string> + <string name="albumartists">Arzourien an albom</string> + <string name="composers">Sonaozerien</string> + <string name="songs">Tonioù</string> + <string name="playlists">Rolloù-seniñ</string> + <string name="genres">Doareoù</string> + <string name="files">Restroù</string> + <string name="artist">Arzour</string> + <string name="album">Albom</string> + <string name="genre">Doare</string> + <string name="folder">Teuliad</string> + <string name="filename">Anv ar restr</string> + <string name="file_size">Ment ar restr</string> + <string name="file_time">Deiziad kemmadur</string> + <string name="extension">Askouezh</string> + <string name="unknown">Dianav</string> + <string name="play_all">Seniñ pep tra</string> + <string name="enqueue_all">Ouzhpennañ an holl el lost</string> + <string name="all_songs">An holl donioù</string> + <string name="details">Munudoù</string> + <string name="more_from_artist">Muioc\'h gant an arzour-mañ</string> + <string name="more_from_album">Muioc\'h diwar an albom-mañ</string> + <string name="title">TItl</string> + <string name="number_of_tracks">Niver a donioù</string> + <string name="year">Bloavezh</string> + <string name="date_added">Deiziad ouzhpennet</string> + <string name="artist_album">Arzour, albom</string> + <string name="artist_year_album">Arzour, bloavezh, albom</string> + <string name="artist_album_track">Arzour, albom, niverenn an ton</string> + <string name="artist_album_title">Arzour, albom, titl</string> + <string name="artist_year">Arzour, bloavezh</string> + <string name="album_track">Albom, niverenn an ton</string> + <string name="song_playcount">Konter sonet</string> + <!--Preferences--> + <plurals name="seconds"> + <item quantity="one">%d eilenn</item> + <item quantity="two">%d eilenn</item> + <item quantity="few">%d eilenn</item> + <item quantity="many">%d eilenn</item> + <item quantity="other">%d eilenn</item> + </plurals> + <plurals name="minutes"> + <item quantity="one">%d vunutenn</item> + <item quantity="two">%d a vuntennoù</item> + <item quantity="few">%d a vuntennoù</item> + <item quantity="many">%d a vuntennoù</item> + <item quantity="other">%d a vuntennoù</item> + </plurals> + <plurals name="hours"> + <item quantity="one">%d eur</item> + <item quantity="two">%d eur</item> + <item quantity="few">%d eur</item> + <item quantity="many">%d eur</item> + <item quantity="other">%d eur</item> + </plurals> + <string name="audio">Aodio</string> + <string name="volume_during_ducking_title">Ampled e-pad ar rebuzadurioù</string> + <string name="volume_during_ducking_summary">Ampled seniñ</string> + <string name="ignore_audiofocus_loss_summary">Kenderc\'hel gant ar seniñ goude bezañ bet kollet ar stiañ aodio penn-da-benn</string> + <string name="media_button_title">Reoliadus gant selaouelloù/bluetooth</string> + <string name="media_button_summary">Dleet ivez gant reolerezhioù ICS ar skramm-prenañ.</string> + <string name="headset_only_title">Ezkerzh diavaez hepken</string> + <string name="headset_only_summary">Mirout ar sonerezh da vezañ sonet dre an uhelgomzerioù diabarzh.</string> + <string name="headset_pause_title">Ehanañ ma vez diluget</string> + <string name="headset_pause_summary">Ehanañ an ton ma vez diluget ar selaouelloù.</string> + <string name="headset_launch_title">Seniñ pa vez luget</string> + <string name="headset_launch_summary">Seniñ pa vez luget ar selaouelloù. (Azgoulenn a ra vefe staliet an arload \'dinoer selaouelloù\')</string> + <string name="headset_launch_app_missing">Ar c\'heweriuster-se a azgoulenn vefe luget an arload \'dinoer selaouelloù\'.\nFellout a ra deoc\'h digeriñ ar Play Store evit staliañ an arload? </string> + <string name="replaygain">ReplayGain</string> + <string name="replaygain_summary">Kefluniañ an doare da verañ an titouroù gant ReplayGain</string> + <string name="replaygain_track_title">Gweredekaat ReplayGain dre don</string> + <string name="replaygain_track_summary">Seniñ an holl donioù d\'an hevelep ampled</string> + <string name="replaygain_album_title">Gweredekaat ReplayGain evit an albom</string> + <string name="replaygain_album_summary">Mirout a ra dialuskoù an albom</string> + <string name="replaygain_bump_title">Ragampled Replaygain</string> + <string name="replaygain_untagged_debump_title">Tonioù hep an tikedenn ReplayGain</string> + <string name="replaygain_untagged_debump_summary">Izelaat an ampled eus</string> + <string name="replaygain_preamp_note_title">Evezhiadenn</string> + <string name="replaygain_preamp_note_content">Android na aotre ket Vanilla Music da greskiñ an ampled eus 100%. Lakaat ar ragampled d\'un talvoud uhel a c\'hall degas kudennoù ma selaouit ouzh sonerezh \'sioul\'. \n\¬AN talvoudoù aliet a zo:\n-> -3dB evit sonerezh sioul/klasel\n-> +3dB evit an enrolladennoù graet goude 2000</string> + <string name="readahead">Gweredekaat ar ragseniñ</string> + <string name="readahead_summary">Ragseniñ an ton bremanel. An dibarzh-se a c\'hall diskoulmañ kudennoù koll aodio (abalamour d\'ur gartenn SD gorrek)</string> + <string name="equalizer">Ingalaer</string> + <string name="cycle_continuous_shuffling">Dargouezhek kendalc\'hus</string> + <string name="cycle_continuous_shuffling_summary">Ar mod \'dargouezhek\' a son an tonioù en un urzh dargouezhek penn-da-benn</string> + <string name="notifications">Rebuzadurioù</string> + <string name="notification_visibility_title">Skrammañ ar rebuzadurioù</string> + <string name="notification_action_title">Gwered ar rebuzadur</string> + <string name="playback_screen">Skramm seniñ</string> + <string name="playback_on_startup_title">Digeriñ d\'al loc\'hadur</string> + <string name="playback_on_startup_summary">Digeriñ ar skramm seniñ vez loc\'het</string> + <string name="display_mode_title">Doare skrammañ</string> + <string name="swipe_up_action_title">Riklañ war-zu ar c\'hrec\'h</string> + <string name="swipe_down_action_title">Riklañ war-zu an draoñ</string> + <string name="cover_press_action_title">Stokañ ar golo</string> + <string name="cover_longpress_action_title">Stokañ ar golo pad pel</string> + <string name="library_screen">Skramm ar sonaoueg</string> + <string name="default_action_title">Gwered dre ziouer</string> + <string name="default_playlist_action_title">Gwered dre ziouer ar roll-seniñ</string> + <string name="accelerometer_shake">Hejañ ar benveg</string> + <string name="enable_shake_title">Gweredekaat hejañ ar benveg</string> + <string name="enable_shake_summary">Gweredekaat pa vez sonet sonerezh hepken. N\'a ket en-dro p\'eo lazhet ar skramm war trevnadoù \'zo.</string> + <string name="shake_action_title">Gwered hejañ</string> + <string name="shake_threshold_title">Gwehin an nerzh hejañ</string> + <string name="misc_features">Keweriusterioù all</string> + <string name="theme">Neuz</string> + <string name="disable_lockscreen_title">Diweredekaat prennañ ar skramm</string> + <string name="disable_lockscreen_summary">Mirout a ra vefe prennet ar skramm p\'emañ war skramm ar sonaoueg pe ar roudenn o seniñ.</string> + <string name="keep_screen_on_title">Derc\'hel ar skramm war elum.</string> + <string name="keep_screen_on_summary">Derc\'hel ar skramm (hag an trevnad) dihun p\'eo gwelus Vanilla Music</string> + <string name="use_idle_timeout_title">Gweredekaat ar prantad dioberiantiz</string> + <string name="use_idle_timeout_summary">P\'eo gweredekaet an dibarzh e paouezo da seniñ goude ar prantad dioberiantiz roet</string> + <string name="idle_timeout_title">Prantad dioberiantiz</string> + <string name="enable_scroll_to_song_title">Lakaat da zibunañ betek titl an ton</string> + <string name="enable_scroll_to_song_summary">Dibunañ betek an ton/albom/arzour e rolloù ar sonaoueg</string> + <string name="queue_enable_scroll_to_song_title">Dibunañ betek an ton el lost</string> + <string name="queue_enable_scroll_to_song_summary">Dibunañ betek an ton o seniñ el lost pa vez kemmet an ton</string> + <string name="jump_to_enqueued_on_play_title">Lammat betek an ton el lost pa vez sonet</string> + <string name="jump_to_enqueued_on_play_summary">M\'emañ an ton goulennet el lost e vo lammet betek eñ kentoc\'h eget skarzhañ al lost</string> + <string name="coverloader_android_title">Kargañ ar skeudennoù adalek Android</string> + <string name="coverloader_android_summary">Goulenn digant stlennvon media diabarzh Android evit skeudennoù an albom</string> + <string name="coverloader_vanilla_title">Kargañ ar skeudennoù adalek an teuliad</string> + <string name="coverloader_vanilla_summary">Klask war-lec\'h restroù skeudenn anvet cover.jpg, albom.jpg pe artwork.jpg ha dibab anezho evel golo an albom</string> + <string name="coverloader_shadow_title">Kargañ ar skeudennoù adalek an teuliad kuzhet</string> + <string name="coverloader_shadow_summary">Klask a raio kargañ ar skeudennoù adalek \'/sdcard/Music/.vanilla/ARZOUR/ALBOM.jpg\'</string> + <string name="coverloader_inline_title">Kargañ ar skeudenn c\'holo diwar an tikedennoù</string> + <string name="coverloader_inline_summary">Klask kargañ ar skeudenn c\'holo enkorfet e tikedennoù ar restr</string> + <string name="cover_on_lockscreen_title">Diskouez ar skeudenn war ar skramm prennañ</string> + <string name="cover_on_lockscreen_summary">Diskouez golo albom an ton o vezañ sonet war ar skramm prennañ</string> + <string name="double_tap_title">Stokañ ar widjet div wech</string> + <string name="double_tap_summary">Stokañ ar widjet 1x1 div wech evit digeriñ al lenner sonerezh. Ur prantadig a 400me a vo a-raok ma respontfe ar widjed.</string> + <string name="scrobble_title">Arverañ an API Scrobble Droid</string> + <string name="scrobble_summary">Kas an titouroù Scrobble da Last.fm dre Scrobble Droid pe Simple Last.fm Scrobbler</string> + <string name="stock_broadcast_title">Kendarvanañ ar rebuzadurioù genidik</string> + <string name="stock_broadcast_summary">Kas kemennadennoù seniñ o c\'hendarvanañ ar re kaset gant al lenner orin evit ma \'z afe en-dro gant reolerezhioù ar skramm prennañ savet gant tredeoù.</string> + <string name="help">Skoazell</string> + <string name="about">A-zivout</string> + <string name="tabs">Urzh an ivinelloù</string> + <string name="customize_tab_order">Kemmañ urzh ha gwelusted ivinelloù ar sonaoueg</string> + <string name="restore_default">Kadaviñ an arventennoù dre ziouer</string> + <!--The following are for the list preferences--> + <string name="last_used_action">Gwered diwezhañ</string> + <string name="never_show">Na skrammañ morse</string> + <string name="show_when_playing">Diskouez p\'emañ o seniñ (dre ziouer)</string> + <string name="always_show">Skrammañ atav</string> + <string name="open_main_activity">Digeriñ ar sonaoueg (dre ziouer)</string> + <string name="open_mini_popup">Digeriñ ar prenestrig</string> + <string name="skip_to_next_song">Tremen d\'an ton da-heul</string> + <string name="open_full_player">Digeriñ al lenner a-bezh</string> + <string name="info_on_cover">Titouroù war ar golo</string> + <string name="info_below_cover">Titouroù dindan ar golo</string> + <string name="fixed_info">Titouroù er c\'hrec\'h</string> + <string name="do_nothing">Na ober netra</string> + <string name="open_library">Digeriñ ar sonaoueg</string> + <string name="play_pause">Seniñ/Ehan</string> + <string name="next_song">Ton da-heul</string> + <string name="previous_song">Ton kent</string> + <string name="next_album">Albom da-heul</string> + <string name="previous_album">Albom kent</string> + <string name="cycle_repeat_mode">Mod adseniñ kelc\'hiek</string> + <string name="cycle_shuffle_mode">Mod dargouezhek kelc\'hiek</string> + <string name="enqueue_current_album">Ouzhpennañ an albom d\'al lost</string> + <string name="enqueue_current_artist">Ouzhpennañ an arzour d\'al lost</string> + <string name="enqueue_current_genre">Ouzhpennañ an doare d\'al lost</string> + <string name="enqueue_current">Ouzhpennañ el lost</string> + <string name="more_from_current">Silañ dre...</string> + <string name="empty_the_queue">Goullonderiñ al lost</string> + <string name="show_queue">Skrammañ al lost</string> + <string name="hide_queue">Kuzhat al lost</string> + <string name="dequeue_rest">Lemel ar peurrest eus al lost</string> + <string name="toggle_controls">Diskouez/kuzhat ar reolerezhioù</string> + <string name="seek_10s_backward">Mont 10 eilenn war-gil</string> + <string name="seek_10s_forward">Mont 10 eilenn war-raok</string> + <string name="preferences_action_show_queue">Diskouez al lost</string> + <string name="preferences_action_clear_queue">Skarzhañ al lost</string> + <string name="preferences_action_enqueue_current_album">Ouzhpennañ an albom el lost</string> + <string name="preferences_action_enqueue_current_artist">Ouzhpennañ an arzour el lost</string> + <string name="preferences_action_enqueue_current_genre">Ouzhpennañ an doare el lost</string> + <string name="jump_to_time">Mont d\'an amzer...</string> + <string name="time_separator">:</string> + <string name="hour_hint">EE</string> + <string name="minute_hint">MM</string> + <string name="second_hint">SS</string> + <string name="error_invalid_position">Lec\'hiadur didalvoudek</string> + <string name="filebrowser_start">Degemer merdeer ar restroù</string> + <string name="customize_filebrowser_start">Merdeer ar restroù a grogo en teuliad-mañ</string> + <string name="select">Diuzañ</string> + <string name="save">Enrollañ</string> + <string name="autoplaylist_playcounts_title">Krouidigezh ar roll-seniñ emgefreek</string> + <string name="autoplaylist_playcounts_summary">Krouiñ ent emgefreek:</string> + <string name="autoplaylist_playcounts_fmt" formatted="false">%s roll-seniñ \'Top %.0f\'</string> + <string name="autoplaylist_playcounts_disabled">Na grouiñ a roll seniñ emgefreek</string> + <string name="autoplaylist_playcounts_name" formatted="false">Top %d </string> + <string name="playlist_sync_mode_title">Goubredañ ar rolloù seniñ</string> + <string name="playlist_sync_all">Goubredañ echuet</string> + <string name="playlist_sync_only_import">Enporzhiañ an M3U hepken</string> + <string name="playlist_sync_only_export">Ezporzhiañ an M3U hepken</string> + <string name="playlist_sync_disabled">Diweredekaet</string> + <string name="playlist_sync_folder_title">Teuliad goubredañ</string> + <string name="playlist_sync_folder_summary">Teuliad da arverañ evit goubredañ ar rolloù seniñ</string> + <string name="permission_request_summary">Ezhomm en deus Vanilla Music da gaout an aotre da lenn ar restroù evit diskouez ho sonaoueg.</string> + <string name="reverse_sort">Tuginañ an urzh</string> + <string name="share">Rannañ...</string> + <string name="share_failed">Fazi en ur rannañ ar restr</string> + <string name="sendto">Kas da...</string> + <string name="no_receiving_apps">Arload ebet kavet evit ar rizh media-se!</string> + <string name="duration">Padelezh</string> + <string name="dump_database">Ezporzhiañ ar stlennvon</string> + <string name="dump_database_result">Stlennvon ezporzhiet betek \'%s\'</string> + <string name="force_m3u_import">Rediañ adenporzhiadur an M3U</string> + <string name="media_library">Mediaoueg</string> + <string name="media_folders_header">Teuliadoù ibilet</string> + <string name="media_scan_header">C\'hwilerver media</string> + <string name="media_scan_full">C\'hwilerviñ ar reizhiad a-bezh (gorrekoc\'h)</string> + <string name="media_scan_drop_db">Naetaat ar stlennvon media</string> + <string name="media_scan_start">Lañsañ ar c\'hwilervadenn</string> + <string name="media_scan_force_bastp">Arverañ al lenner tikedennoù diabarzh</string> + <string name="media_scan_group_albums">Strollañ an albomoù dre deuliad</string> + <string name="media_statistics">Stadegoù</string> + <string name="media_stats_tracks">Niver a roudennoù</string> + <string name="media_stats_library_playtime">Padelezh hollek (eurioù)</string> + <string name="media_stats_listen_playtime">Padelezh hollek selaouet</string> + <string name="media_stats_progress">Araokadenn ar c\'hwilerviñ</string> + <string name="media_library_scan_running">O c\'hwilerviñ</string> + <string name="media_scan_preferences">Dibarzhioù ar c\'hwilerver</string> + <string name="media_scan_preferences_change_title">Dibarzhioù ar c\'hwilerver kemmet</string> + <string name="media_scan_preferences_change_message">Ma kemmit an dibarzh-mañ e vo ret adkregiñ gant ur c\'hwilervadenn glok eus ar sonaoueg. Fellout a ra deoc\'h kenderc\'hel?</string> + <!--Folder selector--> + <string name="hint_long_press_to_modify_folder">Stokit e-pad pell evit kemmañ dibarzhioù an teuliad</string> + <string name="folder_include">Ebarzhiñ</string> + <string name="folder_exclude">Diskarzhañ</string> + <string name="folder_neutral">Neptu</string> + <!--Plugin system--> + <string name="plugins">Enlugelladoù</string> + <string name="plugin_needs_upgrade">Hizivait an enlugellad %s d\'e handelv diwezhañ</string> + <!--Theme names--> + <string name="theme_name_standard_light">Skoueriek</string> + <string name="theme_name_standard_dark">Skoueriek (teñval)</string> + <string name="theme_name_grey_light">Griz</string> + <string name="theme_name_grey_dark">Griz (teñval)</string> + <string name="theme_name_orange_light">Orañjez</string> + <string name="theme_name_orange_dark">Orañjez (teñval)</string> + <string name="theme_name_blue_light">Glas</string> + <string name="theme_name_blue_dark">Glas (teñval)</string> + <string name="theme_name_red_light">Ruz</string> + <string name="theme_name_red_dark">Ruz (teñval)</string> + <string name="theme_name_amoled_dark">Du (skramm AMOLED)</string> +</resources> diff --git a/app/src/main/res/values-ca/translatable.xml b/app/src/main/res/values-ca/translatable.xml new file mode 100644 index 0000000..1005f64 --- /dev/null +++ b/app/src/main/res/values-ca/translatable.xml @@ -0,0 +1,208 @@ +<?xml version='1.0' encoding='UTF-8'?> +<resources> + <string name="app_name">Vanilla Music</string> + <string name="ok">D\'acord</string> + <string name="cancel">Cancel·la</string> + <!--Playback Activity (main screen)--> + <string name="no_songs">No s\'ha trobat cap pista al dispositiu.</string> + <string name="empty_queue">No s\'ha seleccionat cap pista. Trieu de la llibreria o accediu al mode aleatori tocant aquest missatge.</string> + <string name="settings">Configuració</string> + <string name="no_shuffle">Sense mode aleatori</string> + <string name="shuffle_songs">Pistes aleatòries</string> + <string name="shuffle_songs_continuously">Pistes aleatòries contínuament</string> + <string name="shuffle_albums">Àlbums aleatoris</string> + <string name="no_repeat">No repeteixis</string> + <string name="repeat">Repeteix</string> + <string name="repeat_current_song">Repeteix la pista actual</string> + <string name="stop_current_song">Atura després de la pista actual</string> + <string name="random">Aleatori</string> + <string name="random_enabling">Mode aleatori habilitat</string> + <string name="song_load_failed">Ha fallat en reproduir la pista %s. No s\'ha trobat el fitxer o està corrupte.</string> + <string name="queue_cleared">S\'ha netejat la llista de reproducció.</string> + <string name="cover_art">Caràtula</string> + <string name="close_notification">Tanca la notificació</string> + <string name="_genre">gènere</string> + <string name="_track">pista</string> + <string name="_composer">compositor</string> + <string name="_path">camí</string> + <string name="_format">format</string> + <string name="_title">títol</string> + <string name="_artist">artista</string> + <string name="_album">àlbum</string> + <string name="_year">any</string> + <!--New Playlist Dialog--> + <string name="choose_playlist_name">Trieu un nom per a la llista de reproducció</string> + <string name="create">Crea</string> + <string name="overwrite">Sobreescriu</string> + <string name="delete_playlist">Voleu suprimir la llista de reproducció %s?</string> + <!--Library--> + <string name="enqueue">Afegeix a la cua</string> + <string name="enqueue_as_next">Reprodueix el següent element</string> + <string name="play">Reprodueix</string> + <string name="edit">Edita</string> + <string name="rename">Reanomena</string> + <string name="save_as_playlist">Desa la llista de reproducció al fitxer…</string> + <string name="add_to_playlist">Afegeix a la llista de reproducció…</string> + <string name="add_to_homescreen">Afegeix a la pantalla d\'inici...</string> + <string name="add_to">Afegeix a...</string> + <string name="playlist">Llista de reproducció</string> + <string name="homescreen">Pantalla d\'inici</string> + <string name="add_to_favorites">Afegeix a favorits</string> + <string name="remove_from_favorites">Suprimeix dels favorits</string> + <string name="playlist_favorites">Favorits</string> + <string name="new_playlist">Llista de reproducció nova…</string> + <string name="expand">Expandeix</string> + <string name="expand_or_play_all">Expandeix o reprodueix-ho tot</string> + <string name="delete">Suprimeix</string> + <string name="playback_view">En reproducció</string> + <string name="sort_by">Ordena per</string> + <string name="search">Cerca</string> + <string name="done">Fet</string> + <string name="remove">Suprimeix</string> + <string name="play_or_enqueue">Afegeix a la cua si s\'està reproduint; Reprodueix si està pausat</string> + <string name="open">Obre</string> + <string name="go_home">Carpeta principal</string> + <!--As a developer, you should always supply "one" and "other" + strings. Your translators will know which strings are actually + needed for their language. Always include %d in "one" because + translators will need to use %d for languages where "one" + doesn't mean 1 (as explained above). + + Translators should use http://unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules and + http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html, Type cardinal, + to see which categories apply to integer numbers in their languages--> + <string name="delete_file_failed">Ha fallat en suprimir %s.</string> + <string name="deleted_item">S\'ha suprimit «%s».</string> + <string name="delete_item">Voleu suprimir «%s»?</string> + <string name="delete_file">Voleu suprimir el fitxer «%s»?</string> + <string name="artists">Artistes</string> + <string name="albums">Àlbums</string> + <string name="albumartists">Àlbum dels artistes</string> + <string name="composers">Compositors</string> + <string name="songs">Pistes</string> + <string name="playlists">Llistes de reproducció</string> + <string name="genres">Gèneres</string> + <string name="files">Fitxers</string> + <string name="artist">Artista</string> + <string name="album">Àlbum</string> + <string name="genre">Gènere</string> + <string name="folder">Carpeta</string> + <string name="filename">Nom</string> + <string name="file_size">Mida</string> + <string name="file_time">Data de modificació</string> + <string name="extension">Extensió</string> + <string name="unknown">Desconegut</string> + <string name="play_all">Reprodueix tot</string> + <string name="enqueue_all">Afegeix tot a la cua</string> + <string name="all_songs">Totes les pistes</string> + <string name="more_from_artist">Més d\'aquest artista</string> + <string name="more_from_album">Més d\'aquest àlbum</string> + <string name="title">Títol</string> + <string name="number_of_tracks">Número de pistes</string> + <string name="year">Any</string> + <string name="date_added">Afegit el</string> + <string name="artist_album">Artista, àlbum</string> + <string name="artist_year_album">Artista, any, àlbum</string> + <string name="artist_album_track">Artista, àlbum, número de pista</string> + <string name="artist_album_title">Artista, àlbum, títol</string> + <string name="artist_year">Artista, any</string> + <string name="album_track">Artista, número de pista</string> + <string name="song_playcount">Comptador de reproduccions</string> + <!--Preferences--> + <plurals name="seconds"> + <item quantity="one">%d segon</item> + <item quantity="other">%d segons</item> + </plurals> + <plurals name="minutes"> + <item quantity="one">%d minut</item> + <item quantity="other">%d minuts</item> + </plurals> + <plurals name="hours"> + <item quantity="one">%d hora</item> + <item quantity="other">%d hores</item> + </plurals> + <string name="audio">Àudio</string> + <string name="volume_during_ducking_title">Volum durant la notificació</string> + <string name="volume_during_ducking_summary">Volum de reproducció:</string> + <string name="replaygain_preamp_note_title">Nota</string> + <string name="replaygain_preamp_note_content">Android no permet que el volum del Vanilla Music arribi al >100%. Configurant l\'amplificació prèvia a valors alts pot causar problemes si escolteu música «relaxant». \n\nEls valors recomanats són:\n-> -3dB per a música classica/relaxant\n-> +3dB per a pistes posteriors a l\'any 2000</string> + <string name="readahead">Carrega a la memòria</string> + <string name="readahead_summary">Carrega a la memòria la pista actual. Aquesta opció evita el so entretallat durant la reproducció (causat per una targeta SD lenta)</string> + <string name="equalizer">Equalitzador</string> + <string name="notifications">Notificacions</string> + <string name="notification_action_title">Acció de la notificació</string> + <string name="playback_on_startup_title">Obre en iniciar</string> + <string name="playback_on_startup_summary">Obre la reproducció en iniciar</string> + <string name="cover_press_action_title">Acció en tocar la caràtula</string> + <string name="cover_longpress_action_title">Acció en mantenir premuda la caràtula</string> + <string name="default_action_title">Acció per defecte</string> + <string name="default_playlist_action_title">Acció per defecte de la llista de reproducció</string> + <string name="theme">Tema</string> + <string name="disable_lockscreen_title">Inhabilita el bloqueig de pantalla</string> + <string name="disable_lockscreen_summary">Evita el bloqueig de pantalla en accedir a la llibreria o a la pantalla de reproducció</string> + <string name="keep_screen_on_title">Pantalla sempre activa</string> + <string name="tabs">Ordre de pestanyes</string> + <string name="customize_tab_order">Ajusta l\'ordre i visibilitat de les pestanyes a la llibreria</string> + <string name="restore_default">Restaura als valors per defecte</string> + <!--The following are for the list preferences--> + <string name="last_used_action">Darrera acció utilitzada</string> + <string name="never_show">No ho mostris mai</string> + <string name="show_when_playing">Mostra en reproduir (per defecte)</string> + <string name="always_show">Mostra-ho sempre</string> + <string name="open_main_activity">Obre la llibreria (per defecte)</string> + <string name="open_mini_popup">Obre en una finestra emergent</string> + <string name="open_full_player">Obre al reproductor sencer</string> + <string name="info_on_cover">Informació a la caràtula</string> + <string name="info_below_cover">Informació a sota de la caràtula</string> + <string name="fixed_info">Informació a dalt</string> + <string name="open_library">Obre la llibreria</string> + <string name="play_pause">Reprodueix/Pausa</string> + <string name="next_song">Pista següent</string> + <string name="previous_song">Pista anterior</string> + <string name="next_album">Àlbum següent</string> + <string name="previous_album">Àlbum anterior</string> + <string name="cycle_repeat_mode">Mode de repetició cíclic</string> + <string name="cycle_shuffle_mode">Mode de repetició aleatori</string> + <string name="enqueue_current_album">Afegeix l\'àlbum a la llista de reproducció</string> + <string name="enqueue_current_artist">Afegeix l\'artista a la llista de reproducció</string> + <string name="enqueue_current_genre">Afegeix el gènere a la llista de reproducció</string> + <string name="enqueue_current">Llista de reproducció…</string> + <string name="more_from_current">Més de…</string> + <string name="empty_the_queue">Buida la llista de reproducció</string> + <string name="show_queue">Mostra la llista de reproducció</string> + <string name="hide_queue">Amaga la llista de reproducció</string> + <string name="preferences_action_show_queue">Mostra la llista de reproducció</string> + <string name="preferences_action_clear_queue">Neteja la llista de reproducció</string> + <string name="preferences_action_enqueue_current_album">Afegeix l\'àlbum a la llista de reproducció</string> + <string name="preferences_action_enqueue_current_artist">Afegeix l\'artista a la llista de reproducció</string> + <string name="preferences_action_enqueue_current_genre">Afegeix el gènere a la llista de reproducció</string> + <string name="select">Selecciona</string> + <string name="save">Desa</string> + <string name="autoplaylist_playcounts_title">Creació automàtica d\'una llista de reproducció</string> + <string name="autoplaylist_playcounts_disabled">No creïs cap llista de reproducció automàtica</string> + <string name="permission_request_summary">El Vanilla Music necessita permisos per accedir als fitxers multimèdia</string> + <string name="share">Comparteix…</string> + <string name="sendto">Envia a…</string> + <string name="no_receiving_apps">No s\'han trobat aplicacions per manegar aquest tipus de fitxer!</string> + <string name="media_library">Llibreria multimèdia</string> + <string name="media_folders_header">Carpetes indexades</string> + <string name="media_scan_header">Anàlisi multimèdia</string> + <string name="media_scan_start">Inicia l\'anàlisi</string> + <string name="media_scan_force_bastp">Utilitza sempre el lector d\'etiquetes integrat</string> + <string name="media_scan_group_albums">Agrupa els àlbums per carpeta</string> + <string name="media_statistics">Estadístiques</string> + <string name="media_stats_tracks">Nombre de pistes</string> + <string name="media_stats_progress">Progrés de l\'anàlisi</string> + <string name="media_library_scan_running">S\'estan analitzant els mitjans…</string> + <string name="media_scan_preferences">Opcions de l\'anàlisi</string> + <string name="media_scan_preferences_change_title">S\'ha canviat les opcions de l\'anàlisi</string> + <string name="media_scan_preferences_change_message">En canviar les opcions s\'iniciarà una anàlisi completa de la llibreria. Voleu continuar?</string> + <!--Folder selector--> + <string name="hint_long_press_to_modify_folder">Mantingueu premut per modificar les opcions de la carpeta</string> + <string name="folder_include">Inclou</string> + <string name="folder_exclude">Exclou</string> + <string name="folder_neutral">Neutre</string> + <!--Plugin system--> + <string name="plugins">Complements</string> + <!--Theme names--> +</resources> diff --git a/app/src/main/res/values-cs/translatable.xml b/app/src/main/res/values-cs/translatable.xml new file mode 100644 index 0000000..6f8c96c --- /dev/null +++ b/app/src/main/res/values-cs/translatable.xml @@ -0,0 +1,238 @@ +<?xml version='1.0' encoding='UTF-8'?> +<resources> + <string name="app_name">Vanilla Music</string> + <!--Playback Activity (main screen)--> + <string name="no_songs">Nenalezeny žádné skladby na tomto přístroji.</string> + <string name="empty_queue">Žádné vybrané skladby. Vyberte nějaké ze své sbírky, nebo vyberte náhodný mód ťuknutím na tuto zprávu.</string> + <string name="settings">Nastavení</string> + <string name="no_shuffle">Nepřehrávat náhodně</string> + <string name="shuffle_songs">Zamíchat skladby</string> + <string name="shuffle_songs_continuously">Nepřetržitě míchat skladby</string> + <string name="shuffle_albums">Náhodná alba</string> + <string name="no_repeat">Neopakovat</string> + <string name="repeat">Opakovat</string> + <string name="repeat_current_song">Opakovat aktuální skladbu</string> + <string name="stop_current_song">Zastavit po konci aktuální skladby</string> + <string name="random">Náhodně</string> + <string name="random_enabling">Náhodné přehrávání povoleno</string> + <string name="song_load_failed">Chyba načtení skladby %s. Nejspíše je poškozená, nebo chybí.</string> + <string name="queue_cleared">Fronta vyčištěna.</string> + <string name="cover_art">Obal</string> + <string name="close_notification">Zavřít upozornění</string> + <string name="_genre">žánr</string> + <string name="_track">stopa</string> + <string name="_composer">skladatel</string> + <string name="_path">cesta</string> + <string name="_format">formát</string> + <string name="_title">název</string> + <string name="_artist">umělec</string> + <string name="_album">album</string> + <string name="_year">rok</string> + <string name="_replaygain">hlasitost</string> + <!--New Playlist Dialog--> + <string name="choose_playlist_name">Vybrat jméno playlistu</string> + <string name="create">Vytvořit</string> + <string name="overwrite">Přepsat</string> + <string name="delete_playlist">Smazat playlist %s?</string> + <!--Library--> + <string name="enqueue">Zařadit do fronty</string> + <string name="enqueue_as_next">Přehrát další</string> + <string name="play">Přehrát</string> + <string name="edit">Upravit</string> + <string name="rename">Přejmenovat</string> + <string name="save_as_playlist">Uložit jako playlist...</string> + <string name="add_to_playlist">Přidat do playlistu...</string> + <string name="add_to_favorites">Přidat k oblíbeným</string> + <string name="remove_from_favorites">Odstranit z oblíbených</string> + <string name="playlist_favorites">Oblíbené</string> + <string name="new_playlist">Nový playlist...</string> + <string name="expand">Rozbalit</string> + <string name="delete">Smazat</string> + <string name="playback_view">Právě hraje</string> + <string name="sort_by">Řadit dle</string> + <string name="search">Hledat</string> + <string name="done">Hotovo</string> + <string name="remove">Odstranit</string> + <string name="play_or_enqueue">Pokud hraje přidat do fronty; Přehrát pokud pozastaveno</string> + <string name="open">Otevřít</string> + <!--As a developer, you should always supply "one" and "other" + strings. Your translators will know which strings are actually + needed for their language. Always include %d in "one" because + translators will need to use %d for languages where "one" + doesn't mean 1 (as explained above). + + Translators should use http://unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules and + http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html, Type cardinal, + to see which categories apply to integer numbers in their languages--> + <string name="delete_file_failed">Selhalo smazání %s.</string> + <string name="deleted_item">\'%s\' smazáno.</string> + <string name="delete_item">Smazat \'%s\'?</string> + <string name="delete_file">Smazat soubor \'%s\'?</string> + <string name="artists">Umělec</string> + <string name="albums">Alba</string> + <string name="songs">Skladby</string> + <string name="playlists">Playlisty</string> + <string name="genres">Žánry</string> + <string name="files">Soubory</string> + <string name="unknown">Neznámý</string> + <string name="play_all">Přehrát vše</string> + <string name="enqueue_all">Zařadit vše</string> + <string name="all_songs">Všechny skladby</string> + <string name="more_from_artist">Více od umělce</string> + <string name="more_from_album">Více z alba</string> + <string name="number_of_tracks">Počet skladeb</string> + <string name="year">Rok</string> + <string name="date_added">Datum přidání</string> + <string name="artist_album">Umělec, album</string> + <string name="artist_year_album">Umělec, rok, album</string> + <string name="artist_album_track">Umělec, album, číslo skladby</string> + <string name="artist_album_title">Umělec, album, název</string> + <string name="artist_year">Umělec, rok</string> + <string name="album_track">Album, číslo skladby</string> + <string name="song_playcount">Počet přehrání</string> + <!--Preferences--> + <plurals name="seconds"> + <item quantity="one">%d sekunda</item> + <item quantity="few">%d sekundy</item> + <item quantity="many">%d sekund</item> + <item quantity="other">%d sekund</item> + </plurals> + <plurals name="minutes"> + <item quantity="one">%d minuta</item> + <item quantity="few">%d minuty</item> + <item quantity="many">%d minut</item> + <item quantity="other">%d minut</item> + </plurals> + <plurals name="hours"> + <item quantity="one">%d hodina</item> + <item quantity="few">%d hodiny</item> + <item quantity="many">%d hodin</item> + <item quantity="other">%d hodin</item> + </plurals> + <string name="audio">Audio</string> + <string name="volume_during_ducking_title">Hlasitost během upozornění</string> + <string name="volume_during_ducking_summary">Hlasitost přehrávání</string> + <string name="ignore_audiofocus_loss_summary">Přehrávat dále i při trvalé ztrátě zvukového výstupu</string> + <string name="media_button_title">Ovládání headsetu/bluetooth</string> + <string name="media_button_summary">Toto je také vyžadováno pro ICS ovládání uzamčené obrazovky.</string> + <string name="headset_only_title">Pouze externí výstup</string> + <string name="headset_only_summary">Zabrání přehrávání skladeb vnitřním reproduktorem přístroje.</string> + <string name="headset_pause_title">Pozastavit při odpojení</string> + <string name="headset_pause_summary">Pozastaví přehrávání při odpojení sluchátek.</string> + <string name="headset_launch_title">Hrát po připojení</string> + <string name="headset_launch_summary">Začít přehrávat při připojení sluchátek. (Vyžaduje nainstalovanou aplikaci \'Headphone detector\'.)</string> + <string name="headset_launch_app_missing">Tato funkce vyžaduje nainstalovanou aplikaci \'Headphone detector\'.\nChcete přesměrovat do Obchodu Play pro její instalaci?</string> + <string name="replaygain">Udržení hlasitosti</string> + <string name="replaygain_summary">Konfigurovat zpracování informace udržení hlasitosti</string> + <string name="replaygain_track_title">Povolit udržení hlasitosti jednotlivých skladeb</string> + <string name="replaygain_track_summary">Přehrávat všechny skladby ve stejné hlasitosti</string> + <string name="replaygain_album_title">Povolit udržení hlasitosti alba</string> + <string name="replaygain_album_summary">Zachovat dynamiku alba</string> + <string name="replaygain_bump_title">Pre-amp udržení hlasitosti</string> + <string name="replaygain_untagged_debump_title">Skladby bez ReplayGain tagu</string> + <string name="replaygain_untagged_debump_summary">Ztlumit o</string> + <string name="replaygain_preamp_note_title">Poznámka</string> + <string name="replaygain_preamp_note_content">Android nepovoluje aplikaci Vanilla Music zvýšit hlasitost na >100%. Nastavení Pre-amp na vysokou hodnotu může způsobovat problémy při poslechu \'tiché\' hudby. \n\nDoporučené hodnoty jsou:\n-> -3dB pro tichou/klasickou hudbu\n-> +3dB pro aktuální nahrávky</string> + <string name="readahead">Povolit předčítání</string> + <string name="readahead_summary">Přednačíst aktuálně hrající skladbu. Tato možnost může vyřešit problémy s vypadáváním audia. (způsobené pomalou SD kartou)</string> + <string name="equalizer">Ekvalizér</string> + <string name="cycle_continuous_shuffling">Neustále náhodně</string> + <string name="cycle_continuous_shuffling_summary">\'Náhodný mód\' přehrává skladby v náhodném pořadí</string> + <string name="notifications">Upozornění</string> + <string name="notification_action_title">Akce upozornění</string> + <string name="playback_screen">Obrazovka přehrávání</string> + <string name="playback_on_startup_title">Otevřít při spuštění</string> + <string name="playback_on_startup_summary">Při spuštění otevřít náhled přehrávání</string> + <string name="display_mode_title">Mód zobrazení</string> + <string name="swipe_up_action_title">Akce při potažení nahoru</string> + <string name="swipe_down_action_title">Akce při potažení dolů</string> + <string name="cover_press_action_title">Akce při ťuknutí na obal</string> + <string name="cover_longpress_action_title">Akce při dlouhém ťuknutí na obal</string> + <string name="library_screen">Obrazovka knihovny</string> + <string name="default_action_title">Výchozí akce</string> + <string name="default_playlist_action_title">Výchozí akce playlistu</string> + <string name="accelerometer_shake">Potřesení</string> + <string name="enable_shake_title">Povolit potřesení</string> + <string name="enable_shake_summary">Aktivní pouze při přehrávání hudby. Na některých přístrojích nefunguje při vypnuté obrazovce.</string> + <string name="shake_action_title">Akce při potřesení</string> + <string name="shake_threshold_title">Hodnota síly potřesení</string> + <string name="misc_features">Ostatní možnosti</string> + <string name="theme">Vzhled</string> + <string name="disable_lockscreen_title">Vypnout uzamčení obrazovky</string> + <string name="disable_lockscreen_summary">Zamezí uzamčení přístroje na obrazovce přehrávání nebo sbírky</string> + <string name="use_idle_timeout_title">Povolit interval nečinnosti</string> + <string name="use_idle_timeout_summary">Pokud povoleno, přehrávání bude zastaveno po zadaném intervalu nečinnosti</string> + <string name="idle_timeout_title">Interval nečinnosti</string> + <string name="enable_scroll_to_song_title">Posunout na název skladby</string> + <string name="enable_scroll_to_song_summary">Posunout v seznamu knihovny na aktuálně hrající skladbu/album/umělce</string> + <string name="coverloader_android_title">Načítat obrázky z Androidu</string> + <string name="coverloader_android_summary">Prohledávat interní databázi Androidu pro obrázky alb</string> + <string name="coverloader_vanilla_title">Načítat obrázky z adresáře</string> + <string name="coverloader_vanilla_summary">Hledat a zobrazovat jako obrázky alb jména souborů cover.jpg, album.jpg nebo artwork.jpg </string> + <string name="coverloader_shadow_title">Načítat obrázky ze skrytého adresáře</string> + <string name="coverloader_shadow_summary">Zkoušet načítat obrázky z umístění \'/sdcard/Music/.vanilla/ARTIST/ALBUM.jpg\'</string> + <string name="cover_on_lockscreen_title">Zobrazit obal na uzamčené obrazovce</string> + <string name="cover_on_lockscreen_summary">Zobrazovat obrázek k aktuálně přehrávané skladbě na uzamčené obrazovce</string> + <string name="double_tap_title">Widget dvojkliku</string> + <string name="double_tap_summary">Dvojité ťuknutí na 1x1 widget otevře přehrávač. Zpoždění odpovědi widgetu na akci je 400ms.</string> + <string name="scrobble_title">Použít Scrobble Droid API</string> + <string name="scrobble_summary">Odesílat na Last.fm přes Scrobble Droid nebo Simple Last.fm Scrobbler</string> + <string name="stock_broadcast_title">Emulovat základní oznamování</string> + <string name="stock_broadcast_summary">Posílat upozornění jako to dělá výchozí přehrávač hudby, pro zajištění funkčnosti modulů, ovládání uzamčené obrazovky, atd. poskytovaných třetími stranami.</string> + <string name="about">O aplikaci</string> + <string name="tabs">Pořadí záložek</string> + <string name="customize_tab_order">Upravit pořadí a viditelnost záložek sbírky</string> + <string name="restore_default">Obnovit výchozí nastavení</string> + <!--The following are for the list preferences--> + <string name="last_used_action">Poslední použitá akce</string> + <string name="never_show">Nikdy nezobrazovat</string> + <string name="show_when_playing">Zobrazovat při přehrávání (výchozí)</string> + <string name="always_show">Vždy zobrazovat</string> + <string name="open_main_activity">Otevřít sbírku (výchozí)</string> + <string name="open_mini_popup">Otevřít mini popup</string> + <string name="skip_to_next_song">Přeskočit na další skladbu</string> + <string name="open_full_player">Otevřít přehrávač</string> + <string name="info_on_cover">Informace o obalu</string> + <string name="info_below_cover">Informace pod obalem</string> + <string name="fixed_info">Zafixovat informaci nahoře</string> + <string name="do_nothing">Nedělat nic</string> + <string name="open_library">Otevřít sbírku</string> + <string name="play_pause">Přehrát/Pozastavit</string> + <string name="next_song">Další skladba</string> + <string name="previous_song">Předchozí skladba</string> + <string name="next_album">Další album</string> + <string name="previous_album">Předchozí album</string> + <string name="cycle_repeat_mode">Procházet mód opakování</string> + <string name="cycle_shuffle_mode">Procházet náhodný mód</string> + <string name="enqueue_current_album">Zařadit album do fronty</string> + <string name="enqueue_current_artist">Zařadit umělce do fronty</string> + <string name="enqueue_current_genre">Zařadit žánr do fronty</string> + <string name="empty_the_queue">Prázdná fronta</string> + <string name="show_queue">Zobrazit frontu</string> + <string name="hide_queue">Skrýt frontu</string> + <string name="dequeue_rest">Odstranit zbytek z fronty</string> + <string name="toggle_controls">Přepnout ovládání</string> + <string name="seek_10s_backward">Přeskočit o 10 sekund zpět</string> + <string name="seek_10s_forward">Přeskočit o 10 sekund vpřed</string> + <string name="preferences_action_show_queue">Zobrazit frontu</string> + <string name="preferences_action_clear_queue">Vymazat frontu</string> + <string name="preferences_action_enqueue_current_album">Zařadit album do fronty</string> + <string name="preferences_action_enqueue_current_artist">Zařadit umělce do fronty</string> + <string name="preferences_action_enqueue_current_genre">Zařadit žánr do fronty</string> + <string name="filebrowser_start">Výchozí cesta souborů</string> + <string name="customize_filebrowser_start">Procházení souborů se otevírá zde</string> + <string name="select">Vybrat</string> + <string name="autoplaylist_playcounts_title">Automatická tvorba playlistu</string> + <string name="autoplaylist_playcounts_summary">Automaticky vytvořit</string> + <string name="autoplaylist_playcounts_fmt" formatted="false">%s \'Top %.0f\' playlist</string> + <string name="autoplaylist_playcounts_disabled">Nevytvářet automatický playlist</string> + <string name="autoplaylist_playcounts_name" formatted="false">Vrchních %d</string> + <string name="permission_request_summary">Vanilla Music potřebuje povolení pro čtení k zobrazení hudební knihovny</string> + <string name="reverse_sort">Opačné pořadí</string> + <string name="share">Sdílet...</string> + <string name="sendto">Odeslat na...</string> + <string name="no_receiving_apps">Nebyla nalezena žádná aplikace pro příjem tohoto typu souboru!</string> + <!--Folder selector--> + <!--Plugin system--> + <!--Theme names--> +</resources> diff --git a/app/src/main/res/values-da/translatable.xml b/app/src/main/res/values-da/translatable.xml new file mode 100644 index 0000000..478f0da --- /dev/null +++ b/app/src/main/res/values-da/translatable.xml @@ -0,0 +1,340 @@ +<?xml version='1.0' encoding='UTF-8'?> +<resources> + <string name="app_name">Vanilla Musik</string> + <string name="ok">O.k.</string> + <string name="cancel">Annullere</string> + <!--Playback Activity (main screen)--> + <string name="no_songs">Ingen numre fundet på enhed.</string> + <string name="empty_queue">Ingen numre valgt. Vælge nogle fra biblioteket eller gå i tilfældig tilstand ved at klikke på denne besked.</string> + <string name="settings">Opsætning</string> + <string name="no_shuffle">Ingen blanding</string> + <string name="shuffle_songs">Blande numre</string> + <string name="shuffle_songs_continuously">Blande numre løbende</string> + <string name="shuffle_albums">Blande album</string> + <string name="no_repeat">Ingen gentagelse</string> + <string name="repeat">Gentage</string> + <string name="repeat_current_song">Gentage nuværende nummer</string> + <string name="stop_current_song">Stop efter nuværende nummer</string> + <string name="random">Tilfældig</string> + <string name="random_enabling">Tilfældig aktiveret</string> + <string name="song_load_failed">Mislykkede med at indlæse nummer %s. Den kan være ødelagt eller mangle.</string> + <string name="queue_cleared">Kø ryddet</string> + <string name="cover_art">Omslag kunst</string> + <string name="close_notification">Lukke påmindelse</string> + <string name="_genre">genre</string> + <string name="_track">nummer</string> + <string name="_composer">Komponist</string> + <string name="_path">sti</string> + <string name="_format">format</string> + <string name="_title">titel</string> + <string name="_artist">kunstner</string> + <string name="_album">album</string> + <string name="_year">år</string> + <string name="_replaygain">rgain</string> + <!--New Playlist Dialog--> + <string name="choose_playlist_name">Vælge spille liste navn</string> + <string name="create">Oprette</string> + <string name="overwrite">Overskrive</string> + <string name="delete_playlist">Slette spille liste %s?</string> + <!--Library--> + <string name="enqueue">Kø</string> + <string name="enqueue_as_next">Afspil næste</string> + <string name="play">Afspil</string> + <string name="edit">Redigere</string> + <string name="rename">Omdøbe</string> + <string name="save_as_playlist">Gemme som spille liste...</string> + <string name="add_to_playlist">Tilføje til spille liste...</string> + <string name="add_to_homescreen">Tilføje til startskærm...</string> + <string name="add_to">Tilføje til...</string> + <string name="playlist">Spille liste</string> + <string name="homescreen">Startskærm</string> + <string name="add_to_favorites">Tilføje til favoritter</string> + <string name="remove_from_favorites">Fjerne fra favoritter</string> + <string name="playlist_favorites">Favoritter</string> + <string name="new_playlist">Ny spille liste</string> + <string name="expand">Udvide</string> + <string name="expand_or_play_all">Udvide eller afspil alle</string> + <string name="delete">Slette</string> + <string name="playback_view">Afspiller nu</string> + <string name="sort_by">Sortere efter</string> + <string name="search">Søge</string> + <string name="done">Færdig</string> + <string name="remove">Fjerne</string> + <string name="play_or_enqueue">Sæt i kø hvis spillet; Afspil hvis pause</string> + <string name="open">Åbne</string> + <string name="go_home">Hjemme bibliotek</string> + <string name="jumping_to_song">Sang er allerede i kø, springer...</string> + <!--As a developer, you should always supply "one" and "other" + strings. Your translators will know which strings are actually + needed for their language. Always include %d in "one" because + translators will need to use %d for languages where "one" + doesn't mean 1 (as explained above). + + Translators should use http://unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules and + http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html, Type cardinal, + to see which categories apply to integer numbers in their languages--> + <plurals name="playing"> + <item quantity="one">%d nummer spiller.</item> + <item quantity="other">%d numre spiller.</item> + </plurals> + <plurals name="enqueued"> + <item quantity="one">%d nummer i kø.</item> + <item quantity="other">%d numre i kø.</item> + </plurals> + <plurals name="added_to_playlist"> + <item quantity="one">%1$d nummer tilføjet spilliste %2$s.</item> + <item quantity="other">%1$d numre tilføjet spilliste %2$s.</item> + </plurals> + <plurals name="removed_from_playlist"> + <item quantity="one">%1$d nummer fjernet fra spille liste %2$s.</item> + <item quantity="other">%1$d numre fjernet fra spille liste %2$s.</item> + </plurals> + <plurals name="deleted"> + <item quantity="one">%d nummer slettet.</item> + <item quantity="other">%d numre slettet.</item> + </plurals> + <string name="delete_file_failed">Kunne ikke slette %s.</string> + <string name="deleted_item">\'%s\' slettet.</string> + <string name="delete_item">Slette \'%s\'?</string> + <string name="delete_file">Slette fil \'%s\'?</string> + <string name="artists">Kunstner</string> + <string name="albums">Album</string> + <string name="albumartists">Album Kunstner</string> + <string name="composers">Komponister</string> + <string name="songs">Numre</string> + <string name="playlists">Spille lister</string> + <string name="genres">Genre</string> + <string name="files">Filer</string> + <string name="artist">Kunstner</string> + <string name="album">Album</string> + <string name="genre">Genre</string> + <string name="folder">Mappe</string> + <string name="filename">Filnavn</string> + <string name="file_size">Fil størrelse</string> + <string name="file_time">Ændret tid</string> + <string name="extension">Fil endelse</string> + <string name="unknown">Ukendt</string> + <string name="play_all">Afspille alle</string> + <string name="enqueue_all">Alle i kø</string> + <string name="all_songs">Alle numre</string> + <string name="details">Detaljer</string> + <string name="more_from_artist">Mere fra kunstner</string> + <string name="more_from_album">Mere fra album</string> + <string name="title">Titel</string> + <string name="number_of_tracks">Antal numre</string> + <string name="year">År</string> + <string name="date_added">Dato tilføjet</string> + <string name="artist_album">Kunstner, album</string> + <string name="artist_year_album">Kunstner, år, album</string> + <string name="artist_album_track">Kunstner, album, nummer</string> + <string name="artist_album_title">Kunstner, album, titel</string> + <string name="artist_year">Kunstner, år</string> + <string name="album_track">Album, nummer</string> + <string name="song_playcount">Afspilningsantal</string> + <!--Preferences--> + <plurals name="seconds"> + <item quantity="one">%d sekund</item> + <item quantity="other">%d sekunder</item> + </plurals> + <plurals name="minutes"> + <item quantity="one">%d minut</item> + <item quantity="other">%d minutter</item> + </plurals> + <plurals name="hours"> + <item quantity="one">%d time</item> + <item quantity="other">%d timer</item> + </plurals> + <string name="audio">Lyd</string> + <string name="volume_during_ducking_title">Lydstyrke under påmindelse</string> + <string name="volume_during_ducking_summary">Afspil lydstyrke</string> + <string name="ignore_audiofocus_loss_summary">Fortsætte afspilning på permanent lydfokus</string> + <string name="media_button_title">Hovedtelefon/Bluetooth kontrol</string> + <string name="media_button_summary">Påkrævet for ICS låseskærm kontroller.</string> + <string name="headset_only_title">Kun ekstern uddata</string> + <string name="headset_only_summary">Forhindre musik afspilles gennem interne højttalere.</string> + <string name="headset_pause_title">Pause når ikke tilsluttet</string> + <string name="headset_pause_summary">Pause når hovedtelefoner ikke er tilsluttet.</string> + <string name="headset_launch_title">Afspille når tilsluttet</string> + <string name="headset_launch_summary">Afspille når hovedtelefoner er tilsluttet.. (Kræver \'Opdage hovedtelefon\' program er installeret.)</string> + <string name="headset_launch_app_missing">Disse funktioner kræver, at programmet \'Opdage hovedtelon\' er installeret.\nÅbne butik for at at installere programmet?</string> + <string name="replaygain">Genspilning forstærkning</string> + <string name="replaygain_summary">Indstille håndtering af genspilning forstærkning information</string> + <string name="replaygain_track_title">Aktivere pr. nummer genspilning forstærkning</string> + <string name="replaygain_track_summary">Afspille alle numre ved ens lydstyrke</string> + <string name="replaygain_album_title">Aktivere album genspilning forstærkning</string> + <string name="replaygain_album_summary">Bevare album dynamikken</string> + <string name="replaygain_bump_title">Genspilning forstærkning forforstærker</string> + <string name="replaygain_untagged_debump_title">Numre uden genspilning forstærkning mærke</string> + <string name="replaygain_untagged_debump_summary">Formindske lydstyrke med</string> + <string name="replaygain_preamp_note_title">Bemærk</string> + <string name="replaygain_preamp_note_content">Android tillader ikke Vanilla Music at hæve lydstyrken til >100%. Indstille forforstærker for høj kan forårsage problemer hvis der lyttes til \'stille\' musik. \n\nAnbefalede værdier er:\n-> -3dB for stille/klassisk musik\n-> +3dB for efter-2000 optagelser</string> + <string name="readahead">Aktivere indlæse forud</string> + <string name="readahead_summary">Indlæs forud nuværende afpillede nummer. Denne indstilling kan løse \'lyd udfald\' problemer. (forårsaget af langsomt SD kort)</string> + <string name="equalizer">Equalizer</string> + <string name="cycle_continuous_shuffling">Blande løbende</string> + <string name="cycle_continuous_shuffling_summary">\'Blande tilstand\' vil afspille numre i helt tilfældig rækkefølge </string> + <string name="notifications">Påmindelser</string> + <string name="notification_visibility_title">Påmindelse synlighed</string> + <string name="notification_action_title">Påmindelse handling</string> + <string name="playback_screen">Afspille skærm</string> + <string name="playback_on_startup_title">Åbne ved opstart</string> + <string name="playback_on_startup_summary">Åbne afspilning visning ved opstart</string> + <string name="display_mode_title">Vise tilstand</string> + <string name="swipe_up_action_title">Stryg op handling</string> + <string name="swipe_down_action_title">Stryg ned handling</string> + <string name="cover_press_action_title">Tildække tryk handling</string> + <string name="cover_longpress_action_title">Tildække lang tryk handling</string> + <string name="library_screen">Bibliotek skærm</string> + <string name="default_action_title">Standard handling</string> + <string name="default_playlist_action_title">Standard spilliste handling</string> + <string name="accelerometer_shake">Accelerationsmåler rystelse</string> + <string name="enable_shake_title">Aktivere accelerationsmåler rystelse</string> + <string name="enable_shake_summary">Kun aktiv når musik afspilles. Virker ikke når skærmen er slukket på nogle enheder.</string> + <string name="shake_action_title">Ryste handling</string> + <string name="shake_threshold_title">Ryste kraft grænseværdi</string> + <string name="misc_features">Diverse egenskaber</string> + <string name="theme">Tema</string> + <string name="disable_lockscreen_title">Deaktivere låseskærm</string> + <string name="disable_lockscreen_summary">Forhindre låseskærm i at aktivere når den er på biblioteket eller afspilning skærm</string> + <string name="keep_screen_on_title">Hold skærm tændt</string> + <string name="keep_screen_on_summary">Hold skærm (og enhed) vågen når Vanilla Music er synlig</string> + <string name="use_idle_timeout_title">Aktivere tomgang tidsudløb</string> + <string name="use_idle_timeout_summary">Når aktiv, afspilning vil stoppe efter given periode af inaktivitet</string> + <string name="idle_timeout_title">Tomgangs tidsudløb</string> + <string name="enable_scroll_to_song_title">Rulle til nummer titel</string> + <string name="enable_scroll_to_song_summary">Rul til nuværende afpillet nummer/album/kunstner i bibliotek lister</string> + <string name="queue_enable_scroll_to_song_title">Rulle til nummer titel i kø</string> + <string name="queue_enable_scroll_to_song_summary">Rulle til aktuelt afpillende nummer i køen når sang ændres</string> + <string name="jump_to_enqueued_on_play_title">Hop til i kø sat sang ved \'Afspil\'</string> + <string name="jump_to_enqueued_on_play_summary">Hvis den ønskede sang er i køen, hop til den i stedet for at tømme køen</string> + <string name="coverloader_android_title">Indlæse illustration fra Android</string> + <string name="coverloader_android_summary">Anmod Androids interne medie database for album illustration</string> + <string name="coverloader_vanilla_title">Indlæse illustration fra mappe</string> + <string name="coverloader_vanilla_summary">Søge efter billede filer navngivet cover.jpg, album.jpg eller artwork.jpg og vis dem som album omslag</string> + <string name="coverloader_shadow_title">Indlæe illustration fra skjult mappe</string> + <string name="coverloader_shadow_summary">Forsøge at indlæse illustrationer fra \'/sdcard/Music/.vanilla/ARTIST/ALBUM.jpg\'</string> + <string name="coverloader_inline_title">Indlæse illustration fra fil mærker</string> + <string name="coverloader_inline_summary">Prøv at indlæse indlejret illustration fra fil mærker</string> + <string name="cover_on_lockscreen_title">Vise illustration på låseskærm</string> + <string name="cover_on_lockscreen_summary">Vis illustration for nuværende afpillede nummer på låseskærmen</string> + <string name="double_tap_title">Dobbelt tryk dims</string> + <string name="double_tap_summary">Dobbelt-klik på 1x1 kontrol vil åbne afspilleren. Forvent 400ms forsinkelse før kontrollen reagerer på handlinger.</string> + <string name="scrobble_title">Brug Scrobble Droid API</string> + <string name="scrobble_summary">Scrobble til Last.fm gennem Scrobble Droid eller Simple Last.fm Scrobbler</string> + <string name="stock_broadcast_title">Efterligne lageret udsendelser </string> + <string name="stock_broadcast_summary">Send udsendelser efterlignende dem sendt af standard musik afspilleren for at kunne samarbejde med 3. parts låseskærm, kontroller etc.</string> + <string name="help">Hjælp</string> + <string name="about">Om</string> + <string name="tabs">Faneblad sortering</string> + <string name="customize_tab_order">Justere rækkefølge og synlighed på bibliotek faner</string> + <string name="restore_default">Gendanne standard</string> + <!--The following are for the list preferences--> + <string name="last_used_action">Seneste udførte handling</string> + <string name="never_show">Vis aldrig</string> + <string name="show_when_playing">Vis når afspiller (standard)</string> + <string name="always_show">Vis altid</string> + <string name="open_main_activity">Åbne bibliotek (stanard)</string> + <string name="open_mini_popup">Åbne mini pop op</string> + <string name="skip_to_next_song">Spring til næste nummer</string> + <string name="open_full_player">Åben helskærm afspiller</string> + <string name="info_on_cover">Informationer på omslag</string> + <string name="info_below_cover">Informationer under omslag</string> + <string name="fixed_info">Informationer fastgjort øverst</string> + <string name="do_nothing">Gør ingenting</string> + <string name="open_library">Åbne bibliotek</string> + <string name="play_pause">Afspille/Pause</string> + <string name="next_song">Næste nummer</string> + <string name="previous_song">Forrige nummer</string> + <string name="next_album">Næste album</string> + <string name="previous_album">Forrige album</string> + <string name="cycle_repeat_mode">Cyklisk gentage tilstand</string> + <string name="cycle_shuffle_mode">Cyklisk blande tilstand</string> + <string name="enqueue_current_album">Sætte album i kø</string> + <string name="enqueue_current_artist">Sætte kunstner i kø</string> + <string name="enqueue_current_genre">Sætte genre i kø</string> + <string name="enqueue_current">Kø...</string> + <string name="more_from_current">Mere fra...</string> + <string name="empty_the_queue">Tømme kø</string> + <string name="show_queue">Vise kø</string> + <string name="hide_queue">Gemme kø</string> + <string name="dequeue_rest">Fjerne resten fra køen</string> + <string name="toggle_controls">Skifte kontroller</string> + <string name="seek_10s_backward">Søge 10 sekunder baglæns</string> + <string name="seek_10s_forward">Søge 10 sekunder fremad</string> + <string name="preferences_action_show_queue">Vise kø</string> + <string name="preferences_action_clear_queue">Rydde kø</string> + <string name="preferences_action_enqueue_current_album">Sæt album i kø</string> + <string name="preferences_action_enqueue_current_artist">Sæt kunstner i kø</string> + <string name="preferences_action_enqueue_current_genre">Sæt genre i kø</string> + <string name="jump_to_time">Hop til tid</string> + <string name="time_separator">:</string> + <string name="hour_hint">TT</string> + <string name="minute_hint">MM</string> + <string name="second_hint">SS</string> + <string name="error_invalid_position">Ugyldig position</string> + <string name="filebrowser_start">Fil gennemse hjem</string> + <string name="customize_filebrowser_start">Fil gennemse starter i denne mappe</string> + <string name="select">Vælge</string> + <string name="save">Gemme</string> + <string name="autoplaylist_playcounts_title">Oprette spille liste automatisk</string> + <string name="autoplaylist_playcounts_summary">Automatisk oprette en</string> + <string name="autoplaylist_playcounts_fmt" formatted="false">%s \'top %.0f\' spille liste</string> + <string name="autoplaylist_playcounts_disabled">Opret ikke en automatisk spille liste</string> + <string name="autoplaylist_playcounts_name" formatted="false">Øverst %d</string> + <string name="playlist_sync_mode_title">Spille liste synkronisering</string> + <string name="playlist_sync_all">Fuld synkronisering</string> + <string name="playlist_sync_only_import">Importere M3U, eksportere aldrig</string> + <string name="playlist_sync_only_export">Indtast M3U, importere aldrig</string> + <string name="playlist_sync_disabled">Deaktiveret</string> + <string name="playlist_sync_folder_title">Synkronisere mappe</string> + <string name="playlist_sync_folder_summary">Mappe for afspille liste synkronisering</string> + <string name="playlist_export_relative_paths_title">Eksportere med relative stier</string> + <string name="playlist_export_relative_paths_summary">Refenrece fil stier i forhold til afspilningsliste</string> + <string name="permission_request_summary">Vanilla Music behøver læse tilladelse for at vise musik bibliotek</string> + <string name="reverse_sort">Omvendt sortering</string> + <string name="share">Dele...</string> + <string name="share_failed">Fildeling mislykket</string> + <string name="sendto">Sende til...</string> + <string name="no_receiving_apps">Ingen modtagende programmer fundet for denne medie type!</string> + <string name="duration">Længde</string> + <string name="dump_database">Dumpe database</string> + <string name="dump_database_result">Database dumpet til \'%s\'</string> + <string name="force_m3u_import">Tvinge M3U genimport</string> + <string name="media_library">Medie bibliotek</string> + <string name="media_folders_header">Indekserede kataloger</string> + <string name="media_scan_header">Medie skanner</string> + <string name="media_scan_full">Skanne fuld filsystem (langsom)</string> + <string name="media_scan_drop_db">Tømme medie database</string> + <string name="media_scan_start">Starte skanning</string> + <string name="media_scan_force_bastp">Brug altid indbygget mærke læser</string> + <string name="media_scan_group_albums">Gruppere album efter mappe</string> + <string name="media_statistics">Statistikker</string> + <string name="media_stats_tracks">Antal numre</string> + <string name="media_stats_library_playtime">Total afspille tid (timer)</string> + <string name="media_stats_listen_playtime">Timer af musik afspillet til nu</string> + <string name="media_stats_progress">Skanne fremgang</string> + <string name="media_library_scan_running">Skanner medie bibliotek…</string> + <string name="media_scan_preferences">Skanne indstillinger</string> + <string name="media_scan_preferences_change_title">Skanne indstillinger ændret</string> + <string name="media_scan_preferences_change_message">Ændring af denne indstilling vil starte en fuld skanning af biblioteket. Fortsætte?</string> + <!--Folder selector--> + <string name="hint_long_press_to_modify_folder">Lang tryk for at redigere mappe indstillinger</string> + <string name="folder_include">Inkludere</string> + <string name="folder_exclude">Ekskludere</string> + <string name="folder_neutral">Neutral</string> + <!--Plugin system--> + <string name="plugins">Udvidelses moduler</string> + <string name="plugin_needs_upgrade">Opgradere udvidelses modul %s til seneste version</string> + <!--Theme names--> + <string name="theme_name_standard_light">Standard</string> + <string name="theme_name_standard_dark">Standard (mørk)</string> + <string name="theme_name_grey_light">Grå</string> + <string name="theme_name_grey_dark">Grå (mørk)</string> + <string name="theme_name_orange_light">Orange</string> + <string name="theme_name_orange_dark">Orange (mørk)</string> + <string name="theme_name_blue_light">Blå</string> + <string name="theme_name_blue_dark">Blå (mørk)</string> + <string name="theme_name_red_light">Rød</string> + <string name="theme_name_red_dark">Rød (mørk)</string> + <string name="theme_name_amoled_dark">Kulsort (AMOLED)</string> +</resources> diff --git a/app/src/main/res/values-de/translatable.xml b/app/src/main/res/values-de/translatable.xml new file mode 100644 index 0000000..8a7ab43 --- /dev/null +++ b/app/src/main/res/values-de/translatable.xml @@ -0,0 +1,346 @@ +<?xml version='1.0' encoding='UTF-8'?> +<resources> + <string name="app_name">Vanilla Music</string> + <string name="ok">OK</string> + <string name="cancel">Abbrechen</string> + <!--Playback Activity (main screen)--> + <string name="no_songs">Keine Titel auf Ihrem Gerät gefunden.</string> + <string name="empty_queue">Keine Titel ausgewählt. Wählen Sie einige aus der Bibliothek oder starten Sie die Zufallswiedergabe durch Antippen dieser Nachricht.</string> + <string name="settings">Einstellungen</string> + <string name="no_shuffle">Keine Zufallswiedergabe</string> + <string name="shuffle_songs">Zufallswiedergabe Titel</string> + <string name="shuffle_songs_continuously">Dauerzufallswiedergabe Titel</string> + <string name="shuffle_albums">Zufallswiedergabe Alben</string> + <string name="no_repeat">Nicht wiederholen</string> + <string name="repeat">Wiederholen</string> + <string name="repeat_current_song">Aktuellen Titel wiederholen</string> + <string name="stop_current_song">Nach aktuellem Titel stoppen</string> + <string name="random">Zufallswiedergabe</string> + <string name="random_enabling">Zufallswiedergabe aktiviert</string> + <string name="song_load_failed">Titel %s konnte nicht geladen werden. Möglicherweise ist er beschädigt oder fehlt.</string> + <string name="queue_cleared">Warteschlange geleert.</string> + <string name="cover_art">Cover</string> + <string name="close_notification">Benachrichtigung beim Schließen</string> + <string name="_genre">Genre</string> + <string name="_track">Titel</string> + <string name="_composer">Komponist</string> + <string name="_path">Pfad</string> + <string name="_format">Format</string> + <string name="_title">Titel</string> + <string name="_artist">Interpret</string> + <string name="_album">Album</string> + <string name="_year">Jahr</string> + <string name="_replaygain">rgain</string> + <!--New Playlist Dialog--> + <string name="choose_playlist_name">Wiedergabelistenname auswählen</string> + <string name="create">Erstellen</string> + <string name="overwrite">Überschreiben</string> + <string name="delete_playlist">Wiedergabeliste %s löschen?</string> + <!--Library--> + <string name="enqueue">Einreihen</string> + <string name="enqueue_as_next">Als nächstes wiedergeben</string> + <string name="play">Wiedergeben</string> + <string name="edit">Bearbeiten</string> + <string name="rename">Umbenennen</string> + <string name="save_as_playlist">Als Wiedergabeliste speichern …</string> + <string name="add_to_playlist">Zur Wiedergabeliste hinzufügen …</string> + <string name="add_to_homescreen">Zu Startbildschirm hinzufügen …</string> + <string name="add_to">Hinzufügen zu …</string> + <string name="playlist">Wiedergabeliste</string> + <string name="homescreen">Startbildschirm</string> + <string name="add_to_favorites">Zu Favoriten hinzufügen …</string> + <string name="remove_from_favorites">Aus Favoriten entfernen</string> + <string name="playlist_favorites">Favoriten</string> + <string name="new_playlist">Neue Wiedergabeliste …</string> + <string name="expand">Aufklappen</string> + <string name="expand_or_play_all">Aufklappen oder alle wiedergeben</string> + <string name="delete">Löschen</string> + <string name="playback_view">Aktueller Titel</string> + <string name="sort_by">Sortieren nach</string> + <string name="search">Suche</string> + <string name="done">Fertig</string> + <string name="remove">Entfernen</string> + <string name="play_or_enqueue">Einreihen während Wiedergabe oder wiedergeben, falls pausiert</string> + <string name="open">Öffnen</string> + <string name="go_home">Startverzeichnis</string> + <string name="jumping_to_song">Titel bereits in Warteschlange, wird direkt angesprungen …</string> + <!--As a developer, you should always supply "one" and "other" + strings. Your translators will know which strings are actually + needed for their language. Always include %d in "one" because + translators will need to use %d for languages where "one" + doesn't mean 1 (as explained above). + + Translators should use http://unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules and + http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html, Type cardinal, + to see which categories apply to integer numbers in their languages--> + <plurals name="playing"> + <item quantity="one">%d Titel wird wiedergegeben.</item> + <item quantity="other">%d Titel werden wiedergegeben.</item> + </plurals> + <plurals name="enqueued"> + <item quantity="one">%d Titel eingereiht.</item> + <item quantity="other">%d Titel eingereiht.</item> + </plurals> + <plurals name="added_to_playlist"> + <item quantity="one">%1$d Titel zur Wiedergabeliste %2$s hinzugefügt.</item> + <item quantity="other">%1$d Titel zur Wiedergabeliste %2$s hinzugefügt.</item> + </plurals> + <plurals name="removed_from_playlist"> + <item quantity="one">%1$d Titel aus Wiedergabeliste %2$s entfernt.</item> + <item quantity="other">%1$d Titel aus Wiedergabeliste %2$s entfernt.</item> + </plurals> + <plurals name="deleted"> + <item quantity="one">%d Titel gelöscht.</item> + <item quantity="other">%d Titel gelöscht.</item> + </plurals> + <string name="delete_file_failed">Löschen von %s fehlgeschlagen.</string> + <string name="deleted_item">»%s« wurde gelöscht.</string> + <string name="delete_item">»%s« löschen?</string> + <string name="delete_file">Datei »%s« löschen?</string> + <string name="artists">Interpreten</string> + <string name="albums">Alben</string> + <string name="albumartists">Albuminterpreten</string> + <string name="composers">Komponisten</string> + <string name="songs">Titel</string> + <string name="playlists">Wiedergabelisten</string> + <string name="genres">Genres</string> + <string name="files">Dateien</string> + <string name="artist">Interpret</string> + <string name="album">Album</string> + <string name="genre">Genre</string> + <string name="folder">Ordner</string> + <string name="filename">Dateiname</string> + <string name="file_size">Dateigröße</string> + <string name="file_time">Änderungsdatum</string> + <string name="extension">Erweiterung</string> + <string name="unknown">Unbekannt</string> + <string name="play_all">Alle wiedergeben</string> + <string name="enqueue_all">Alle einreihen</string> + <string name="all_songs">Alle Titel</string> + <string name="details">Details</string> + <string name="more_from_artist">Mehr vom Interpreten</string> + <string name="more_from_album">Mehr aus dem Album</string> + <string name="title">Titel</string> + <string name="number_of_tracks">Titelanzahl</string> + <string name="year">Jahr</string> + <string name="date_added">Erstellungsdatum</string> + <string name="artist_album">Interpret, Album</string> + <string name="artist_year_album">Interpret, Jahr, Album</string> + <string name="artist_album_track">Interpret, Album, Titelnummer</string> + <string name="artist_album_title">Interpret, Album, Titel</string> + <string name="artist_year">Interpret, Jahr</string> + <string name="album_track">Album, Titelnummer</string> + <string name="song_playcount">Wiedergabehäufigkeit</string> + <!--Preferences--> + <plurals name="seconds"> + <item quantity="one">%d Sekunde</item> + <item quantity="other">%d Sekunden</item> + </plurals> + <plurals name="minutes"> + <item quantity="one">%d Minute</item> + <item quantity="other">%d Minuten</item> + </plurals> + <plurals name="hours"> + <item quantity="one">%d Stunde</item> + <item quantity="other">%d Stunden</item> + </plurals> + <string name="audio">Audio</string> + <string name="volume_during_ducking_title">Lautstärke während Benachrichtigung</string> + <string name="volume_during_ducking_summary">Wiedergabelautstärke:</string> + <string name="ignore_audiofocus_loss_summary">Wiedergabe auch bei permanenter Unterbrechung nicht pausieren</string> + <string name="media_button_title">Headset-/Bluetooth-Steuerung</string> + <string name="media_button_summary">Wird auch für Steuerelemente der ICS-Bildschirmsperre benötigt</string> + <string name="headset_only_title">Nur externer Ausgang</string> + <string name="headset_only_summary">Verhindert die Musikwiedergabe über interne Lautsprecher</string> + <string name="headset_pause_title">Pausieren, wenn nicht angeschlossen</string> + <string name="headset_pause_summary">Pausieren, wenn Kopfhörer entfernt wird</string> + <string name="headset_launch_title">Wiedergeben beim Anschließen</string> + <string name="headset_launch_summary">Wiedergeben, wenn Kopfhörer angeschlossen wird (erfordert eine installierte »Headphone Detector«-App)</string> + <string name="headset_launch_app_missing">Die Verwendung dieser Funktion benötigt eine bestehende Installation der App »Headphone Detector«.\nMöchten Sie den Play Store öffnen, um die App zu installieren?</string> + <string name="replaygain">ReplayGain</string> + <string name="replaygain_summary">ReplayGain-Einstellungen</string> + <string name="replaygain_track_title">Per-Titel-ReplayGain aktivieren</string> + <string name="replaygain_track_summary">Alle Titel in einheitlicher Lautstärke wiedergeben</string> + <string name="replaygain_album_title">Album-ReplayGain aktivieren</string> + <string name="replaygain_album_summary">Lautstärke von Alben beibehalten</string> + <string name="replaygain_bump_title">ReplayGain-Vorverstärker</string> + <string name="replaygain_untagged_debump_title">Titel ohne ReplayGain-Informationen</string> + <string name="replaygain_untagged_debump_summary">Lautstärke senken um: </string> + <string name="replaygain_preamp_note_title">Hinweis</string> + <string name="replaygain_preamp_note_content">Android erlaubt Vanilla Music kein Verändern der Lautstärke auf über 100%. Hohe Werte für den Vorverstärker können bei »stiller« Musik zu Problemen führen.\n\nEmpfohlene Werte sind:\n-> -3 dB für stille/klassische Musik\n-> +3 dB für Aufnahmen nach dem Jahr 2000</string> + <string name="disable_gapless_playback_title">\"Gapless Playback\" deaktivieren</string> + <string name="disable_gapless_playback_summary">Keine lückenlose Wiedergabe (Gapless Playback) verwenden. Dies kann Geräten mit fehlerhafter Firmware helfen</string> + <string name="readahead">Datei vorauslesen</string> + <string name="readahead_summary">Aktuell wiedergegebenen Titel im Voraus einlesen (löst ggf. Audioprobleme mit langsamen SD-Karten)</string> + <string name="equalizer">Equalizer</string> + <string name="cycle_continuous_shuffling">Dauerzufallswiedergabe</string> + <string name="cycle_continuous_shuffling_summary">Titel werden fortlaufend neu durchgemischt</string> + <string name="notifications">Benachrichtigungen</string> + <string name="notification_visibility_title">Benachrichtigungssichtbarkeit</string> + <string name="notification_action_title">Benachrichtigungsaktion</string> + <string name="playback_screen">Wiedergabeansicht</string> + <string name="playback_on_startup_title">Beim Start öffnen</string> + <string name="playback_on_startup_summary">Wiedergabeansicht beim Start öffnen</string> + <string name="display_mode_title">Anzeigemodus</string> + <string name="swipe_up_action_title">Aktion beim Hochwischen</string> + <string name="swipe_down_action_title">Aktion beim Runterwischen</string> + <string name="cover_press_action_title">Aktion beim Coverantippen</string> + <string name="cover_longpress_action_title">Aktion bei langem Coverdrücken</string> + <string name="library_screen">Bibliotheksansicht</string> + <string name="default_action_title">Standardaktion</string> + <string name="default_playlist_action_title">Standardaktion für Wiedergabelisten</string> + <string name="accelerometer_shake">Schütteln</string> + <string name="enable_shake_title">Schütteln aktivieren</string> + <string name="enable_shake_summary">Nur während Musikwiedergabe aktiv. Funktioniert auf einigen Geräten nicht bei ausgeschaltetem Bildschirm.</string> + <string name="shake_action_title">Aktion beim Schütteln</string> + <string name="shake_threshold_title">Schwellwert beim Schütteln</string> + <string name="misc_features">Sonstige Funktionen</string> + <string name="theme">Design</string> + <string name="disable_lockscreen_title">Bildschirmsperre deaktivieren</string> + <string name="disable_lockscreen_summary">Bildschirmsperre verhindern, wenn Bibliotheks- oder Wiedergabeansicht aktiv</string> + <string name="keep_screen_on_title">Bildschirm nicht ausschalten</string> + <string name="keep_screen_on_summary">Bildschirm (und Gerät) eingeschaltet lassen, während Vanilla Music sichtbar ist</string> + <string name="use_idle_timeout_title">Anhalten bei Inaktivität</string> + <string name="use_idle_timeout_summary">Falls aktiviert, wird die Wiedergabe nach der angegebenen Inaktivitätsdauer angehalten</string> + <string name="idle_timeout_title">Inaktivitätsdauer</string> + <string name="enable_scroll_to_song_title">Zum Titelnamen scrollen</string> + <string name="enable_scroll_to_song_summary">In Bibliothekslisten zum gerade wiedergegebenen Titel/Album/Interpreten scrollen</string> + <string name="queue_enable_scroll_to_song_title">Zum Titel in Warteschlange scrollen</string> + <string name="queue_enable_scroll_to_song_summary">Bei Titelwechsel zum derzeit wiedergegebenen Titel in der Warteschlange scrollen</string> + <string name="jump_to_enqueued_on_play_title">Bei »Wiedergeben« zu eingereihtem Titel springen</string> + <string name="jump_to_enqueued_on_play_summary">Falls sich der angefragte Titel bereits in der Warteschlange befindet, diesen anspringen anstatt die Warteschlange zu löschen</string> + <string name="coverloader_android_title">Albumcover von Android verwenden</string> + <string name="coverloader_android_summary">Androids interne Mediendatenbank für Albumcover verwenden</string> + <string name="coverloader_vanilla_title">Cover aus Ordner laden</string> + <string name="coverloader_vanilla_summary">Nach Dateien mit den Namen »cover.jpg«, »album.jpg« oder »artwork.jpg« suchen und diese als Albumcover anzeigen</string> + <string name="coverloader_shadow_title">Cover aus verstecktem Ordner laden</string> + <string name="coverloader_shadow_summary">Albumcover von »/sdcard/Music/.vanilla/ARTIST/ALBUM.jpg« laden, falls möglich</string> + <string name="coverloader_inline_title">Bilder aus Datei-Tags laden</string> + <string name="coverloader_inline_summary">Eingebettete Bilder falls möglich aus Datei-Tags laden</string> + <string name="cover_on_lockscreen_title">Cover auf Sperrbildschirm anzeigen</string> + <string name="cover_on_lockscreen_summary">Albumcover des aktuell wiedergegebenen Titels auf dem Sperrbildschirm anzeigen</string> + <string name="double_tap_title">Widget-Doppelantippen</string> + <string name="double_tap_summary">Doppeltes Antippen des 1x1-Widgets öffnet die Wiedergabeansicht. Verursacht eine Verzögerung von 400 ms, bevor das Widget auf Aktionen reagiert.</string> + <string name="scrobble_title">Scrobble Droid-API verwenden</string> + <string name="scrobble_summary">Zu Last.fm scrobbeln mithilfe von »Scrobble Droid« oder »Simple Last.fm Scrobbler«</string> + <string name="stock_broadcast_title">Standard-Broadcasts emulieren</string> + <string name="stock_broadcast_summary">Broadcasts senden, die jene der Standard-App für Musikwiedergabe emulieren, um mit Bildschirmsperre-Steuerelementen, Widgets etc. von Drittanbietern kompatibel zu sein</string> + <string name="help">Hilfe</string> + <string name="about">Über</string> + <string name="tabs">Tab-Reihenfolge</string> + <string name="customize_tab_order">Reihenfolge und Sichtbarkeit der Bibliotheks-Tabs anpassen</string> + <string name="restore_default">Standard wiederherstellen</string> + <!--The following are for the list preferences--> + <string name="last_used_action">Zuletzt verwendete Aktion</string> + <string name="never_show">Nie anzeigen</string> + <string name="show_when_playing">Bei Wiedergabe anzeigen (Standard)</string> + <string name="always_show">Immer anzeigen</string> + <string name="open_main_activity">Bibliothek öffnen (Standard)</string> + <string name="open_mini_popup">Mini-Popup öffnen</string> + <string name="skip_to_next_song">Zum nächsten Titel springen</string> + <string name="open_full_player">Vanilla Music öffnen</string> + <string name="info_on_cover">Info auf dem Cover</string> + <string name="info_below_cover">Info unter dem Cover</string> + <string name="fixed_info">Info oben fixiert</string> + <string name="do_nothing">Keine</string> + <string name="open_library">Bibliothek öffnen</string> + <string name="play_pause">Wiedergeben/Pause</string> + <string name="next_song">Nächster Titel</string> + <string name="previous_song">Vorheriger Titel</string> + <string name="next_album">Nächstes Album</string> + <string name="previous_album">Vorheriges Album</string> + <string name="cycle_repeat_mode">Wiederholungsmodi wechseln</string> + <string name="cycle_shuffle_mode">Zufallswiedergabemodi wechseln</string> + <string name="enqueue_current_album">Album einreihen</string> + <string name="enqueue_current_artist">Interpret einreihen</string> + <string name="enqueue_current_genre">Genre einreihen</string> + <string name="enqueue_current">Einreihen …</string> + <string name="more_from_current">Mehr von …</string> + <string name="empty_the_queue">Warteschlange verwerfen</string> + <string name="show_queue">Warteschlange anzeigen</string> + <string name="hide_queue">Warteschlange ausblenden</string> + <string name="dequeue_rest">Warteschlange leeren</string> + <string name="toggle_controls">Steuerelemente ein-/ausblenden</string> + <string name="seek_10s_backward">10 Sekunden zurück springen</string> + <string name="seek_10s_forward">10 Sekunden vorwärts springen</string> + <string name="move_to_top">Zum Anfang verschieben</string> + <string name="move_to_bottom">Ans Ende verschieben</string> + <string name="preferences_action_show_queue">Warteschlange anzeigen</string> + <string name="preferences_action_clear_queue">Warteschlange leeren</string> + <string name="preferences_action_enqueue_current_album">Album einreihen</string> + <string name="preferences_action_enqueue_current_artist">Interpret einreihen</string> + <string name="preferences_action_enqueue_current_genre">Genre einreihen</string> + <string name="jump_to_time">In Zeit springen</string> + <string name="time_separator">:</string> + <string name="hour_hint">HH</string> + <string name="minute_hint">MM</string> + <string name="second_hint">SS</string> + <string name="error_invalid_position">Ungültige Position</string> + <string name="filebrowser_start">Startordner</string> + <string name="customize_filebrowser_start">Dateimanager startet in diesem Verzeichnis</string> + <string name="select">Auswählen</string> + <string name="save">Speichern</string> + <string name="autoplaylist_playcounts_title">Wiedergabeliste automatisch erstellen</string> + <string name="autoplaylist_playcounts_summary">Automatisches Erstellen einer</string> + <string name="autoplaylist_playcounts_fmt" formatted="false">%s »Top %.0f«-Wiedergabeliste</string> + <string name="autoplaylist_playcounts_disabled">Keine automatische Wiedergabeliste erstellen</string> + <string name="autoplaylist_playcounts_name" formatted="false">Top %d</string> + <string name="playlist_sync_mode_title">Wiedergabelistensynchronisation</string> + <string name="playlist_sync_all">Vollständige Synchronisation</string> + <string name="playlist_sync_only_import">M3U importieren, nie exportieren</string> + <string name="playlist_sync_only_export">M3U schreiben, nie importieren</string> + <string name="playlist_sync_disabled">Deaktiviert</string> + <string name="playlist_sync_folder_title">Synchronisationsordner</string> + <string name="playlist_sync_folder_summary">Zu verwendender Ordner für Wiedergabelistensynchronisation</string> + <string name="playlist_export_relative_paths_title">Beim Exportieren relative Pfade verwenden</string> + <string name="playlist_export_relative_paths_summary">Dateipfade relativ zur Wiedergabeliste referenzieren</string> + <string name="permission_request_summary">Vanilla Music benötigt Leserechte, um Ihre Musikbibliothek anzuzeigen</string> + <string name="reverse_sort">Sortierung umkehren</string> + <string name="share">Teilen …</string> + <string name="share_failed">Teilen von Datei gescheitert</string> + <string name="sendto">Senden an …</string> + <string name="no_receiving_apps">Keine kompatiblen Apps für diesen Medientyp gefunden!</string> + <string name="duration">Dauer</string> + <string name="dump_database">Datenbank exportieren</string> + <string name="dump_database_result">Datenbank nach \'%s\' exportiert</string> + <string name="force_m3u_import">M3U-Reimport erzwingen</string> + <string name="media_library">Medienbibliothek</string> + <string name="media_folders_header">Indizierte Verzeichnisse</string> + <string name="media_scan_header">Mediensuche</string> + <string name="media_scan_full">Gesamtes Dateisystem durchsuchen (langsamer)</string> + <string name="media_scan_drop_db">Mediendatenbank leeren</string> + <string name="media_scan_start">Suche starten</string> + <string name="media_scan_force_bastp">Immer integrierten Tag-Leser verwenden</string> + <string name="media_scan_group_albums">Alben nach Ordner gruppieren</string> + <string name="media_statistics">Statistiken</string> + <string name="media_stats_tracks">Titelanzahl</string> + <string name="media_stats_library_playtime">Gesamtwiedergabedauer (Stunden)</string> + <string name="media_stats_listen_playtime">Bisher wiedergegebene Musik in Stunden</string> + <string name="media_stats_progress">Suchfortschritt</string> + <string name="media_library_scan_running">Medienbibliothek wird durchsucht …</string> + <string name="media_scan_preferences">Suchoptionen</string> + <string name="media_scan_preferences_change_title">Suchoptionen geändert</string> + <string name="media_scan_preferences_change_message">Durch Ändern dieser Option wird ein erneutes, vollständiges Durchsuchen Ihrer Bibliothek veranlasst. Möchten Sie fortfahren?</string> + <string name="folder_picker_spinner_desc">Verzeichnisstatus:</string> + <!--Folder selector--> + <string name="hint_long_press_to_modify_folder">Gedrückt halten für Ordneroptionen</string> + <string name="folder_include">Einschließen</string> + <string name="folder_exclude">Ausschließen</string> + <string name="folder_neutral">Neutral</string> + <!--Plugin system--> + <string name="plugins">Erweiterungen</string> + <string name="plugin_needs_upgrade">Bitte aktualisiere die Erweiterung %s auf die neueste Version</string> + <!--Theme names--> + <string name="theme_name_standard_light">Standard</string> + <string name="theme_name_standard_dark">Standard (dunkel)</string> + <string name="theme_name_grey_light">Grau</string> + <string name="theme_name_grey_dark">Grau (dunkel)</string> + <string name="theme_name_orange_light">Orange</string> + <string name="theme_name_orange_dark">Orange (dunkel)</string> + <string name="theme_name_blue_light">Blau</string> + <string name="theme_name_blue_dark">Blau (dunkel)</string> + <string name="theme_name_red_light">Rot</string> + <string name="theme_name_red_dark">Rot (dunkel)</string> + <string name="theme_name_amoled_dark">Pechschwarz (AMOLED)</string> + <string name="theme_name_start_wearing_purple">Start Wearing Purple</string> +</resources> diff --git a/app/src/main/res/values-el-rGR/translatable.xml b/app/src/main/res/values-el-rGR/translatable.xml new file mode 100644 index 0000000..0692bf9 --- /dev/null +++ b/app/src/main/res/values-el-rGR/translatable.xml @@ -0,0 +1,127 @@ +<?xml version='1.0' encoding='UTF-8'?> +<resources> + <string name="app_name">Vanilla Music</string> + <!--Playback Activity (main screen)--> + <string name="settings">Ρυθμίσεις</string> + <string name="no_shuffle">Όχι τυχαία αναπαραγωγή</string> + <string name="shuffle_albums">Αναδιάταξη άλμπουμ</string> + <string name="no_repeat">Όχι επανάληψη</string> + <string name="repeat">Επανάληψη</string> + <string name="random">Τυχαίο</string> + <string name="random_enabling">Τυχαίο ενεργοποιημένο</string> + <string name="queue_cleared">Εκκαθάριση της σειράς αναμονής.</string> + <string name="cover_art">Εξωφυλλο</string> + <string name="close_notification">Κλείσιμο κοινοποίησης</string> + <string name="_genre">Είδος μουσικής</string> + <string name="_track">τραγουδι</string> + <string name="_composer">δημιουργος</string> + <string name="_format">τυπος</string> + <string name="_title">τιτλος</string> + <string name="_artist">τραγουδιστης</string> + <string name="_album">αλμπουμ</string> + <string name="_year">ετος</string> + <string name="_replaygain">rgain</string> + <!--New Playlist Dialog--> + <string name="create">Δημιουργία</string> + <string name="overwrite">Αντικατάσταση</string> + <string name="delete_playlist">Διαγραφή λίστας αναπαραγωγής %s?</string> + <!--Library--> + <string name="enqueue">Τοποθέτηση στην σειρα αναμονης</string> + <string name="play">Αναπαραγωγή </string> + <string name="edit">Επεξεργασία</string> + <string name="rename">Μετονομασία</string> + <string name="playlist_favorites">Αγαπημένα</string> + <string name="expand">Αναπτυξη</string> + <string name="delete">Διαγραφή</string> + <string name="search">Αναζήτηση</string> + <string name="done">Ολοκληρώθηκε</string> + <string name="remove">Αφαίρεση</string> + <string name="play_or_enqueue">Τοποθέτηση στην σειρα αναμονης αν παίζει? Αναπαραγωγή εάν διακοπεί</string> + <!--As a developer, you should always supply "one" and "other" + strings. Your translators will know which strings are actually + needed for their language. Always include %d in "one" because + translators will need to use %d for languages where "one" + doesn't mean 1 (as explained above). + + Translators should use http://unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules and + http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html, Type cardinal, + to see which categories apply to integer numbers in their languages--> + <string name="delete_file_failed">Αποτυχία διαγραφής %s.</string> + <string name="deleted_item">\'%s\' διαγράφεται.</string> + <string name="delete_item">Διαγραφή \'%s\'?</string> + <string name="delete_file">Διαγραφή αρχείου \'%s\'?</string> + <string name="artists">Τραγουδιστες</string> + <string name="albums">Αλμπουμ</string> + <string name="playlists">Λιστες αναπαραγωγης</string> + <string name="genres">Είδη μουσικής</string> + <string name="files">Αρχεια</string> + <string name="unknown">Αγνωστο</string> + <string name="more_from_artist">Περισσότερα από τον καλλιτέχνη</string> + <string name="more_from_album">Περισσότερα από το άλμπουμ</string> + <string name="number_of_tracks">Αριθμοι τραγουδιων</string> + <string name="year">Ετος</string> + <string name="date_added">Η ημερομηνια προστεθηκε</string> + <string name="artist_album">Τραγουδιστης, αλμπουμ</string> + <string name="artist_album_track">Τραγουδιστης, αλμπουμ, αριθμος τραγουδιου</string> + <string name="artist_album_title">Τραγουδιστης, αλμπουμ, τιτλος</string> + <string name="artist_year">Τραγουδιστης, ετος</string> + <string name="album_track">Αλμπουμ, αριθμος τραγουδιου</string> + <string name="song_playcount">Σειρα αναπαραγωγών</string> + <!--Preferences--> + <string name="audio">Ήχος</string> + <string name="media_button_summary">Αυτό απαιτείται επίσης για τους ελέγχους ICS lockscreen. </string> + <string name="headset_only_summary">Εμποδίζει τη μουσική από το να παίζεται μέσω των εσωτερικών ηχείων.</string> + <string name="headset_pause_summary">Παύση όταν τα ακουστικά εχουν αποσυνδεθεί.</string> + <string name="replaygain_track_summary">Αναπαραγωγή όλων των τραγουδιων σε ίση ηχηρότητα</string> + <string name="replaygain_album_summary">Διατήρηση της δυναμικής του άλμπουμ</string> + <string name="replaygain_untagged_debump_summary">Μείωση έντασης κατά</string> + <string name="readahead">Ενεργοποίηση του readahead</string> + <string name="equalizer">Ισοσταθμιστής</string> + <string name="notifications">Ειδοποιήσεις</string> + <string name="playback_on_startup_summary">Άνοιγμα προβολής αναπαραγωγής κατά την εκκίνηση</string> + <string name="enable_shake_summary">Ενεργό μόνο κατα την αναπαραγωγή μουσικής. Δεν λειτουργεί όταν η οθόνη είναι απενεργοποιημένη σε ορισμένες συσκευές.</string> + <string name="disable_lockscreen_summary">Αποτροπή της οθόνης κλειδώματος από την ενεργοποίηση, όταν στην οθόνη βιβλιοθήκης ή αναπαραγωγής</string> + <string name="use_idle_timeout_summary">Όταν είναι ενεργο, η αναπαραγωγή θα σταματήσει μετά το καθορισμένο χρονικό διάστημα αδράνειας</string> + <string name="coverloader_android_title">Φόρτωση έργων τέχνης από το Android</string> + <string name="coverloader_android_summary">Εσωτερική βάση δεδομένων των πολυμέσων και ερώτημα του Android για το εξώφυλλο του άλμπουμ</string> + <string name="coverloader_vanilla_title">Φόρτωση έργων τέχνης από το φάκελο</string> + <string name="coverloader_vanilla_summary">Αναζήτηση για αρχεία εικόνων που ονομάζονται cover.jpg, album.jpg ή artwork.jpg και η προβολή ως εξώφυλλο του άλμπουμ</string> + <string name="coverloader_shadow_title">Φόρτωση έργων τέχνης από κρυφό φάκελο</string> + <string name="coverloader_shadow_summary">Προσπαθήστε να φορτώσετε έργα τέχνης από \'/sdcard/Music/.vanilla/ARTIST/ALBUM.jpg\'</string> + <string name="double_tap_summary">Διπλό χτύπημα στο γραφικό στοιχείο 1x1 θα ανοίξει το πρόγραμμα αναπαραγωγής. Διατρέχει 400μδευ καθυστέρηση πριν το γραφικό στοιχείο ανταποκριθει στις ενέργειες.</string> + <string name="stock_broadcast_summary">Αποστολή εκπομπων απο την μνημη για να συνεργαστουν με τους ελέγχους lockscreen 3τρίτου κόμματος, γραφικά στοιχεία, κ.λπ.</string> + <string name="about">Σχετικά με</string> + <string name="customize_tab_order">Ρυθμίστε τη σειρά και την προβολή των καρτελών βιβλιοθήκης</string> + <string name="restore_default">Επαναφορά προεπιλογων</string> + <!--The following are for the list preferences--> + <string name="last_used_action">Τελευταία χρησιμοποιημένοι δράση</string> + <string name="never_show">Καμμια εμφανιση ξανα</string> + <string name="show_when_playing">Εμφάνιση κατά την αναπαραγωγή (προεπιλογή)</string> + <string name="always_show">Εμφανιση παντα</string> + <string name="open_main_activity">Άνοιγμα βιβλιοθήκης (προεπιλογή)</string> + <string name="open_mini_popup">Άνοιγμα μίνι αναδυόμενου παράθυρου</string> + <string name="open_full_player">Άνοιγμα πλήρους player</string> + <string name="info_on_cover">Πληροφορίες στο εξώφυλλο</string> + <string name="info_below_cover">Πληροφορίες κάτω από το εξώφυλλο</string> + <string name="fixed_info">Πληροφορίες σταθερά στην κορυφή</string> + <string name="do_nothing">Καμμια δραση</string> + <string name="open_library">Άνοιγμα βιβλιοθήκης</string> + <string name="play_pause">Αναπαραγωγή/Παύση</string> + <string name="next_album">Επόμενο άλμπουμ</string> + <string name="previous_album">Προηγούμενο άλμπουμ</string> + <string name="cycle_repeat_mode">Επανάληψη λειτουργίας του κύκλου</string> + <string name="cycle_shuffle_mode">Λειτουργία τυχαίας αναπαραγωγής κύκλου</string> + <string name="enqueue_current_album">Τοποθέτηση του άλμπουμ στην σειρα αναμονης</string> + <string name="enqueue_current_artist">Τοποθέτηση του τραγουδιστη στην σειρα αναμονης </string> + <string name="enqueue_current_genre">Τοποθέτηση του ειδους μουσικης στην σειρα αναμονης</string> + <string name="empty_the_queue">Άδειασμα της σειράς αναμονής</string> + <string name="show_queue">Εμφάνιση της σειράς αναμονής</string> + <string name="dequeue_rest">Εμφάνιση της υπολοιπης σειράς αναμονής</string> + <string name="toggle_controls">Εναλλαγή ελέγχων</string> + <string name="filebrowser_start">Αρχική σελίδα του περιηγητή αρχείων</string> + <string name="customize_filebrowser_start">Ο Περιηγητής Αρχείων να ξεκινά από αυτό τον κατάλογο</string> + <string name="select">Επιλογή</string> + <!--Folder selector--> + <!--Plugin system--> + <!--Theme names--> +</resources> diff --git a/app/src/main/res/values-eo/translatable.xml b/app/src/main/res/values-eo/translatable.xml new file mode 100644 index 0000000..3e459a0 --- /dev/null +++ b/app/src/main/res/values-eo/translatable.xml @@ -0,0 +1,343 @@ +<?xml version='1.0' encoding='UTF-8'?> +<resources> + <string name="app_name">Vanila Muziko</string> + <string name="ok">Bone</string> + <string name="cancel">Nuligi</string> + <!--Playback Activity (main screen)--> + <string name="no_songs">Neniuj muzikaĵoj trovitaj en via aparato.</string> + <string name="empty_queue">Neniuj elektitaj muzikaĵoj. Elektu iujn de la biblioteko aŭ enŝaltu hazardan reĝimon per frapeti tiun ĉi averton.</string> + <string name="settings">Agordoj</string> + <string name="no_shuffle">Ne miksi</string> + <string name="shuffle_songs">Miksi muzikaĵojn</string> + <string name="shuffle_songs_continuously">Hazarde miksi muzikaĵojn</string> + <string name="shuffle_albums">Miksi albumojn</string> + <string name="no_repeat">Ne ripeti</string> + <string name="repeat">Ripeti</string> + <string name="repeat_current_song">Ripeti nunan muzikaĵon</string> + <string name="stop_current_song">Ĉesi post nuna muzikaĵo</string> + <string name="random">Hazarde</string> + <string name="random_enabling">Ekigis hazardan ludadon</string> + <string name="song_load_failed">Malsukcesis enlegi muzikaĵon %s. Ĝi probable mankas aŭ estas difektita.</string> + <string name="queue_cleared">Forviŝis ludvicon.</string> + <string name="cover_art">Album-kovrilo</string> + <string name="close_notification">Fermi atentigon</string> + <string name="_genre">ĝenro</string> + <string name="_track">muzikaĵo</string> + <string name="_composer">komponisto</string> + <string name="_path">dosierindiko</string> + <string name="_format">tipo</string> + <string name="_title">titolo</string> + <string name="_artist">artisto</string> + <string name="_album">albumo</string> + <string name="_year">jaro</string> + <string name="_replaygain">plilaŭtigo</string> + <!--New Playlist Dialog--> + <string name="choose_playlist_name">Entajpu nomon por ludlisto</string> + <string name="create">Krei</string> + <string name="overwrite">Anstataŭigi</string> + <string name="delete_playlist">Ĉu forigi ludliston %s?</string> + <!--Library--> + <string name="enqueue">Envicigi</string> + <string name="enqueue_as_next">Ludi sekvan</string> + <string name="play">Ludi</string> + <string name="edit">Redakti</string> + <string name="rename">Alinomi</string> + <string name="save_as_playlist">Konservi kiel ludliston…</string> + <string name="add_to_playlist">Aldoni al ludlisto…</string> + <string name="add_to_homescreen">Aldoni al hejmekrano…</string> + <string name="add_to">Aldoni al…</string> + <string name="playlist">Ludlisto</string> + <string name="homescreen">Hejmekrano</string> + <string name="add_to_favorites">Aldoni al ŝatataj</string> + <string name="remove_from_favorites">Forigi el ŝatataj</string> + <string name="playlist_favorites">Ŝatataj</string> + <string name="new_playlist">Nova ludlisto…</string> + <string name="expand">Etendi</string> + <string name="expand_or_play_all">Etendi aŭ ludi ĉiujn</string> + <string name="delete">Forigi</string> + <string name="playback_view">Ludata nun</string> + <string name="sort_by">Ordigi laŭ</string> + <string name="search">Serĉi</string> + <string name="done">Farite</string> + <string name="remove">Forigi</string> + <string name="play_or_enqueue">Envicigi se ludas; ludi se ne ludas</string> + <string name="open">Malfermi</string> + <string name="go_home">Ĉefdosierujo</string> + <string name="jumping_to_song">Muzikaĵo jam envicigita, transsaltante…</string> + <!--As a developer, you should always supply "one" and "other" + strings. Your translators will know which strings are actually + needed for their language. Always include %d in "one" because + translators will need to use %d for languages where "one" + doesn't mean 1 (as explained above). + + Translators should use http://unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules and + http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html, Type cardinal, + to see which categories apply to integer numbers in their languages--> + <plurals name="playing"> + <item quantity="one">Enludlistigis %d muzikaĵon.</item> + <item quantity="other">Enludlistigis %d muzikaĵojn.</item> + </plurals> + <plurals name="enqueued"> + <item quantity="one">Enludlistigis (por poste) %d muzikaĵon.</item> + <item quantity="other">Enludlistigis (por poste) %d muzikaĵojn.</item> + </plurals> + <plurals name="added_to_playlist"> + <item quantity="one">Aldonis %1$d muzikaĵon al ludlisto %2$s.</item> + <item quantity="other">Aldonis %1$d muzikaĵojn al ludlisto %2$s.</item> + </plurals> + <plurals name="removed_from_playlist"> + <item quantity="one">Forigis %1$d muzikaĵon el ludlisto %2$s.</item> + <item quantity="other">Forigis %1$d muzikaĵojn el ludlisto %2$s.</item> + </plurals> + <plurals name="deleted"> + <item quantity="one">Forigis %d muzikaĵon.</item> + <item quantity="other">Forigis %d muzikaĵojn.</item> + </plurals> + <string name="delete_file_failed">Fiaskis forigi %s.</string> + <string name="deleted_item">Forigis “%s”.</string> + <string name="delete_item">Ĉu forigi “%s”?</string> + <string name="delete_file">Ĉu forigi dosieron “%s”?</string> + <string name="artists">Artistoj</string> + <string name="albums">Albumoj</string> + <string name="albumartists">Artistoj de albumoj</string> + <string name="composers">Komponistoj</string> + <string name="songs">Muzikaĵoj</string> + <string name="playlists">Ludlistoj</string> + <string name="genres">Ĝenroj</string> + <string name="files">Dosieroj</string> + <string name="artist">Artisto</string> + <string name="album">Albumo</string> + <string name="genre">Ĝenro</string> + <string name="folder">Dosierujo</string> + <string name="filename">Dosiernomo</string> + <string name="file_size">Dosier-grando</string> + <string name="file_time">Modifita je</string> + <string name="extension">Dosier-sufikso</string> + <string name="unknown">Nekonata</string> + <string name="play_all">Ludi ĉiujn</string> + <string name="enqueue_all">Envicigi ĉiujn</string> + <string name="all_songs">Ĉiuj muzikaĵoj</string> + <string name="details">Detaloj</string> + <string name="more_from_artist">Pli de artisto</string> + <string name="more_from_album">Pli el albumo</string> + <string name="title">titolo</string> + <string name="number_of_tracks">nombro da muzikaĵoj</string> + <string name="year">jaro</string> + <string name="date_added">dato de aldono</string> + <string name="artist_album">artisto, albumo</string> + <string name="artist_year_album">artisto, jaro, albumo</string> + <string name="artist_album_track">artisto, albumo, numero</string> + <string name="artist_album_title">artisto, albumo, titilo</string> + <string name="artist_year">artisto, jaro</string> + <string name="album_track">albumo, numero</string> + <string name="song_playcount">nombro da ludoj</string> + <!--Preferences--> + <plurals name="seconds"> + <item quantity="one">%d sekundo</item> + <item quantity="other">%d sekundoj</item> + </plurals> + <plurals name="minutes"> + <item quantity="one">%d minuto</item> + <item quantity="other">%d minutoj</item> + </plurals> + <plurals name="hours"> + <item quantity="one">%d horo</item> + <item quantity="other">%d horoj</item> + </plurals> + <string name="audio">Sono</string> + <string name="volume_during_ducking_title">Sonforteco dum avertoj</string> + <string name="volume_during_ducking_summary">Sonforteco:</string> + <string name="ignore_audiofocus_loss_summary">Pluigi ludadon eĉ dum permanenta perdo de sona fokuso</string> + <string name="media_button_title">Stiri per butonoj de aŭskultiloj/Bludento</string> + <string name="media_button_summary">Ankaŭ postulata por ŝlosekranaj stiriloj ĉe Androido 4.0.3.</string> + <string name="headset_only_title">Nur ekstera eligo</string> + <string name="headset_only_summary">Neniam ludi muzikon per internaj laŭtparoliloj.</string> + <string name="headset_pause_title">Paŭzi je malkonekto</string> + <string name="headset_pause_summary">Paŭzigi muzikon, kiam malkonektas aŭskultilojn.</string> + <string name="headset_launch_title">Ludi je konekto</string> + <string name="headset_launch_summary">Ludi muzikon, kiam konektas aŭskultilojn. (Postulas instalitan aplikaĵon “Headphone detector”.)</string> + <string name="headset_launch_app_missing">Tiu ĉi eblo postulas instalitan aplikaĵon “Headphone detector”.\nĈu vi volas malfermi la Vendejon Play por instali la aplikaĵon?</string> + <string name="replaygain">ReplayGain</string> + <string name="replaygain_summary">Agordi kiel trakti la informon “ReplayGain” (pliforteco de sono).</string> + <string name="replaygain_track_title">Aktivi ReplayGain por muzikaĵo</string> + <string name="replaygain_track_summary">Ludi ĉiujn muzikaĵojn kun egala sonforteco</string> + <string name="replaygain_album_title">Aktivigi ReplayGain por albumo</string> + <string name="replaygain_album_summary">Konservi son-dinamikon de albumo</string> + <string name="replaygain_bump_title">Antaŭ-plilaŭtigo de ReplayGain</string> + <string name="replaygain_untagged_debump_title">Por muzikaĵoj sen etikedo ReplayGain</string> + <string name="replaygain_untagged_debump_summary">Malpliigi sonfortecon je</string> + <string name="replaygain_preamp_note_title">Rimarko</string> + <string name="replaygain_preamp_note_content">Androido ne permesas al Vanila Muziko pliigi sonfortecon al >100%. Tro alta valoro de antaŭ-plilaŭtigo povas rezultigi maloportunaĵojn dum aŭskultado de mallaŭta muziko.\n\nKonsilindaj valoroj estas:\n -3dB por mallaŭta kaj klasika muziko\n+3dB por sonregistraĵoj post jaro 2000</string> + <string name="readahead">Aktivigi antaŭlegon</string> + <string name="readahead_summary">Antaŭlegi nune ludatan muzikaĵon. Tiu ĉi agordo povas ripari “sonajn pendiĝojn”. (kaŭzitajn de malrapida SD-karto)</string> + <string name="equalizer">Ekvalizilo</string> + <string name="cycle_continuous_shuffling">Hazarda miksado</string> + <string name="cycle_continuous_shuffling_summary">La reĝimo “miksi muzikaĵojn” tute hazarde elektos muzikaĵojn por ludi</string> + <string name="notifications">Atentigo</string> + <string name="notification_visibility_title">Videblo de la atentigo</string> + <string name="notification_action_title">Ago de la atentigo</string> + <string name="playback_screen">Ekrano de ludado</string> + <string name="playback_on_startup_title">Malfermi dum starto</string> + <string name="playback_on_startup_summary">Montri ekranon de ludado dum starto</string> + <string name="display_mode_title">Montrada reĝimo</string> + <string name="swipe_up_action_title">Ago je fingrumi supren</string> + <string name="swipe_down_action_title">Ago je fingrumi suben</string> + <string name="cover_press_action_title">Ago je frapeti kovrilon</string> + <string name="cover_longpress_action_title">Ago je frapetadi kovrilon</string> + <string name="library_screen">Ekrano de biblioteko</string> + <string name="default_action_title">Implicita ago</string> + <string name="default_playlist_action_title">Implicita ago de ludlisto</string> + <string name="accelerometer_shake">Akcel-mezurila skuo</string> + <string name="enable_shake_title">Enŝalti agon je skuo de akcel-mezurilo</string> + <string name="enable_shake_summary">Nur aktiva kiam muziko estas ludata. Povas ne funkcii dum malŝaltita ekrano ĉe iuj aparatoj.</string> + <string name="shake_action_title">Ago je aparata skuo</string> + <string name="shake_threshold_title">Sojlo de skuo</string> + <string name="misc_features">Aliaj agordoj</string> + <string name="theme">Etoso</string> + <string name="disable_lockscreen_title">Malaktivigi ŝlos-ekranon</string> + <string name="disable_lockscreen_summary">Ne permesi al la ŝlos-ekrano aktiviĝi ĉe ekrano de biblioteko aŭ ludado.</string> + <string name="keep_screen_on_title">Teni ekranon enŝaltita</string> + <string name="keep_screen_on_summary">Ne malŝalti la ekranon kiam Vanila Muziko estas montrata</string> + <string name="use_idle_timeout_title">Malŝalti dum neaktiveco</string> + <string name="use_idle_timeout_summary">Kiam enŝaltita, ludado estos haltigita post agordita tempo de neaktiveco</string> + <string name="idle_timeout_title">Templimo de neaktiveco</string> + <string name="enable_scroll_to_song_title">Rulumi al ludata muzikaĵo</string> + <string name="enable_scroll_to_song_summary">Rulumi al nune ludata muzikaĵo/albumo/artisto en biblioteko</string> + <string name="queue_enable_scroll_to_song_title">Rulumi al ludata muzikaĵo en ludvico</string> + <string name="queue_enable_scroll_to_song_summary">Rulumi al nune ludato muzikaĵo en la ludvico je ŝanĝo de muzikaĵo</string> + <string name="jump_to_enqueued_on_play_title">Salti al envicigita muzikaĵo je premi “ludi”</string> + <string name="jump_to_enqueued_on_play_summary">Se la petata muzikaĵo jam estas en la ludvico, salti al ĝi anstataŭ forviŝi la ludvicon</string> + <string name="coverloader_android_title">Enlegi kovrilon de Androido</string> + <string name="coverloader_android_summary">Peti internan datumbazon de Androido pri album-kovrilo</string> + <string name="coverloader_vanilla_title">Enlegi kovrilon de dosierujo</string> + <string name="coverloader_vanilla_summary">Serĉi pri bildaj dosieroj: cover.jpg, album.jpg aŭ artwork.jpg kaj vidigi ilin kiel album-kovrilon</string> + <string name="coverloader_shadow_title">Enlegi kovrilon de kaŝita dosierujo</string> + <string name="coverloader_shadow_summary">Provi enlegi album-kovrilon de “/sdcard/Music/.vanilla/ARTIST/ALBUM.jpg”</string> + <string name="coverloader_inline_title">Enlegi kovrilon de dosier-etikedoj</string> + <string name="coverloader_inline_summary">Provi enlegi kovrilon de enigitaj etikedoj de dosiero</string> + <string name="cover_on_lockscreen_title">Montri kovrilon sur ŝlos-ekrano</string> + <string name="cover_on_lockscreen_summary">Vidigi la album-kovrilon de nune ludata muzikaĵo sur la ŝlos-ekrano</string> + <string name="double_tap_title">Du-frapeta fenestraĵo</string> + <string name="double_tap_summary">Duoble frapetu la fenestraĵon 1x1 por malfermi ludilon. Okazas 400ms de prokrasto antaŭ la fenestraĵo respondas al agoj.</string> + <string name="scrobble_title">Uzi API Scrobble Droid</string> + <string name="scrobble_summary">Raporti al Last.fm per Scrobble Droid aŭ Simple Last.fm Scrobbler</string> + <string name="stock_broadcast_title">Simuli elsendojn de Androida ludilo</string> + <string name="stock_broadcast_summary">Sendi avertojn simulatajn tiujn sendatajn de antaŭ-instalita Androida muzik-ludilo por agadi kun ekster-partaj iloj, kiel ŝlos-ekranaj stiriloj, fenestraĵoj, ktp.</string> + <string name="help">Helpo</string> + <string name="about">Pri</string> + <string name="tabs">Ordo de langetoj</string> + <string name="customize_tab_order">Agordi ordon kaj videblon de bibliotekaj langetoj</string> + <string name="restore_default">Restarigi normojn</string> + <!--The following are for the list preferences--> + <string name="last_used_action">Laste uzita ago</string> + <string name="never_show">Neniam montri</string> + <string name="show_when_playing">Montri dum ludado (implicite)</string> + <string name="always_show">Ĉiam montri</string> + <string name="open_main_activity">Malfermi bibliotekon (implicite)</string> + <string name="open_mini_popup">Malfermi ŝprucfenestran ludilon</string> + <string name="skip_to_next_song">Transsalti al sekva muzikaĵo</string> + <string name="open_full_player">Malfermi plenan ludilon</string> + <string name="info_on_cover">Informoj sur album-kovrilo</string> + <string name="info_below_cover">Informoj sube de album-kovrilo</string> + <string name="fixed_info">Informoj fiksitaj ĉe supre</string> + <string name="do_nothing">Fari nenion</string> + <string name="open_library">Malfermi bibliotekon</string> + <string name="play_pause">Ludi/paŭzigi</string> + <string name="next_song">Sekva muzikaĵo</string> + <string name="previous_song">Antaŭa muzikaĵo</string> + <string name="next_album">Sekva albumo</string> + <string name="previous_album">Antaŭa albumo</string> + <string name="cycle_repeat_mode">Baskuli ripetan reĝimon</string> + <string name="cycle_shuffle_mode">Baskuli miksan reĝimon</string> + <string name="enqueue_current_album">Envicigi albumon</string> + <string name="enqueue_current_artist">Envicigi artiston</string> + <string name="enqueue_current_genre">Envicigi ĝenron</string> + <string name="enqueue_current">Envicigi…</string> + <string name="more_from_current">Pli de…</string> + <string name="empty_the_queue">Forviŝi ludvicon</string> + <string name="show_queue">Montri ludvicon</string> + <string name="hide_queue">Kaŝi ludvicon</string> + <string name="dequeue_rest">Malvicigi aliajn</string> + <string name="toggle_controls">Baskuli stir-butonojn</string> + <string name="seek_10s_backward">10 sekundoj malantaŭen</string> + <string name="seek_10s_forward">10 sekundoj antaŭen</string> + <string name="move_to_top">Movi plej supren</string> + <string name="move_to_bottom">Movi plej suben</string> + <string name="preferences_action_show_queue">Montri ludvicon</string> + <string name="preferences_action_clear_queue">Forviŝi ludvicon</string> + <string name="preferences_action_enqueue_current_album">Envicigi albumon</string> + <string name="preferences_action_enqueue_current_artist">Envicigi artiston</string> + <string name="preferences_action_enqueue_current_genre">Envicigi ĝenron</string> + <string name="jump_to_time">Salti al tempo</string> + <string name="time_separator">:</string> + <string name="hour_hint">HH</string> + <string name="minute_hint">MM</string> + <string name="second_hint">SS</string> + <string name="error_invalid_position">Erara tempo</string> + <string name="filebrowser_start">Ĉefdosierujo</string> + <string name="customize_filebrowser_start">Dosier-foliumilo ekas en tiu ĉi dosierujo</string> + <string name="select">Elekti</string> + <string name="save">Konservi</string> + <string name="autoplaylist_playcounts_title">Aŭtomate krei ludliston</string> + <string name="autoplaylist_playcounts_summary">Aŭtomate krei</string> + <string name="autoplaylist_playcounts_fmt" formatted="false">%s ludliston “%.0f popularaj”</string> + <string name="autoplaylist_playcounts_disabled">Ne aŭtomate krei ludliston</string> + <string name="autoplaylist_playcounts_name" formatted="false">%d popularaj</string> + <string name="playlist_sync_mode_title">Samtempigo de ludlistoj</string> + <string name="playlist_sync_all">Plena samtempigo</string> + <string name="playlist_sync_only_import">Enporti .m3u, neniam elporti</string> + <string name="playlist_sync_only_export">Konservi .m3u, neniam enporti</string> + <string name="playlist_sync_disabled">Malaktiva</string> + <string name="playlist_sync_folder_title">Dosierujo de samptempigo</string> + <string name="playlist_sync_folder_summary">Dosierujo por uzi por samtempigi ludlistojn</string> + <string name="playlist_export_relative_paths_title">Elporti uzante relativajn dosierindikojn</string> + <string name="playlist_export_relative_paths_summary">Dosier-indikoj interrilatigas al la dosierujo de ludlisto</string> + <string name="permission_request_summary">Vanila Muziko postulas permeson por legi SD-karton por vidigi vian muzikan bibliotekon</string> + <string name="reverse_sort">Ordigi inverse</string> + <string name="share">Kunhavigi…</string> + <string name="share_failed">Fiaskis kunhavigi dosieron</string> + <string name="sendto">Sendi al…</string> + <string name="no_receiving_apps">Neniu aplikaĵo trovita por ricevi tiun ĉi tipon de aŭdvidaĵo!</string> + <string name="duration">Daŭro</string> + <string name="dump_database">Kopii datumbazon</string> + <string name="dump_database_result">Kopiis datumbazon al “%s”</string> + <string name="force_m3u_import">Devigi reenporti .m3u</string> + <string name="media_library">Muzik-biblioteko</string> + <string name="media_folders_header">Indeksataj dosierujoj</string> + <string name="media_scan_header">Muzik-skanilo</string> + <string name="media_scan_full">Skani tutan dosiersistemon (pli malrapide)</string> + <string name="media_scan_drop_db">Forviŝi datumbazon</string> + <string name="media_scan_start">Ekigi skani</string> + <string name="media_scan_force_bastp">Ĉiam uzi enkonstruitan etiked-legilon</string> + <string name="media_scan_group_albums">Grupigi albumojn laŭ dosierujoj</string> + <string name="media_statistics">Statistiko</string> + <string name="media_stats_tracks">Nombro da muzikaĵoj</string> + <string name="media_stats_library_playtime">Tuta tempo de ludado (en horoj)</string> + <string name="media_stats_listen_playtime">Ĝis nun ludis muzikon por (en horoj)</string> + <string name="media_stats_progress">Progreso de skanado</string> + <string name="media_library_scan_running">Skanado de muzik-biblioteko…</string> + <string name="media_scan_preferences">Agordoj de skanilo</string> + <string name="media_scan_preferences_change_title">Ŝanĝis agordojn de skanilo</string> + <string name="media_scan_preferences_change_message">Ŝanĝo de tiu ĉi agordo ekigos plenan reskanon de via muzik-biblioteko. Ĉu vi volas pluigi?</string> + <string name="folder_picker_spinner_desc">Stato de dosierujo:</string> + <!--Folder selector--> + <string name="hint_long_press_to_modify_folder">Frapetadu por modifi dosierujajn agordojn</string> + <string name="folder_include">Inkluzivi</string> + <string name="folder_exclude">Escepti</string> + <string name="folder_neutral">Neŭtra</string> + <!--Plugin system--> + <string name="plugins">Kromprogramoj</string> + <string name="plugin_needs_upgrade">Bonvolu ĝisdatigi la kromprogramon “%s” al la plej aktuala versio</string> + <!--Theme names--> + <string name="theme_name_standard_light">Norma</string> + <string name="theme_name_standard_dark">Norma (malhela)</string> + <string name="theme_name_grey_light">Griza</string> + <string name="theme_name_grey_dark">Griza (malhela)</string> + <string name="theme_name_orange_light">Oranĝkolora</string> + <string name="theme_name_orange_dark">Oranĝkolora (malhela)</string> + <string name="theme_name_blue_light">Blua</string> + <string name="theme_name_blue_dark">Blua (malhela)</string> + <string name="theme_name_red_light">Ruĝa</string> + <string name="theme_name_red_dark">Ruĝa (malhela)</string> + <string name="theme_name_amoled_dark">Nigrega (AMOLED)</string> +</resources> diff --git a/app/src/main/res/values-es/translatable.xml b/app/src/main/res/values-es/translatable.xml new file mode 100644 index 0000000..469d31d --- /dev/null +++ b/app/src/main/res/values-es/translatable.xml @@ -0,0 +1,351 @@ +<?xml version='1.0' encoding='UTF-8'?> +<resources> + <string name="app_name">Vanilla Music</string> + <string name="ok">Aceptar</string> + <string name="cancel">Cancelar</string> + <!--Playback Activity (main screen)--> + <string name="no_songs">No se han encontrado pistas en tu dispositivo.</string> + <string name="empty_queue">No hay ninguna pista seleccionada. Elige alguna desde la biblioteca o accede al modo aleatorio pulsando este mensaje</string> + <string name="settings">Configuración</string> + <string name="no_shuffle">No mezclar</string> + <string name="shuffle_songs">Mezclar pistas</string> + <string name="shuffle_songs_continuously">Mezclar pistas indefinidamente</string> + <string name="shuffle_albums">Mezclar álbumes</string> + <string name="no_repeat">No repetir</string> + <string name="repeat">Repetir</string> + <string name="repeat_current_song">Repetir la pista actual</string> + <string name="stop_current_song">Parar después de la pista actual</string> + <string name="random">Aleatorio</string> + <string name="random_enabling">Aleatorio activado</string> + <string name="song_load_failed">Fallo al cargar la pista %s. Podría faltar o estar corrupta.</string> + <string name="queue_cleared">Cola vaciada.</string> + <string name="cover_art">Carátula</string> + <string name="close_notification">Cerrar notificación</string> + <string name="_genre">género</string> + <string name="_track">pista</string> + <string name="_composer">compositor</string> + <string name="_path">ruta</string> + <string name="_format">formato</string> + <string name="_title">título</string> + <string name="_artist">artista</string> + <string name="_album">álbum</string> + <string name="_year">año</string> + <string name="_replaygain">ganancia-r</string> + <!--New Playlist Dialog--> + <string name="choose_playlist_name">Escoge nombre de la lista de reproducción</string> + <string name="create">Crear</string> + <string name="overwrite">Sobrescribir</string> + <string name="delete_playlist">¿Borrar lista de reproducción %s?</string> + <!--Library--> + <string name="enqueue">Poner en cola</string> + <string name="enqueue_as_next">Reproducir siguiente</string> + <string name="play">Reproducir</string> + <string name="edit">Editar</string> + <string name="rename">Renombrar</string> + <string name="save_as_playlist">Guardar como lista de reproducción...</string> + <string name="add_to_playlist">Añadir a lista de reproducción...</string> + <string name="add_to_homescreen">Agregar a pantalla de inicio</string> + <string name="add_to">Agregar a...</string> + <string name="playlist">Lista de reproducción</string> + <string name="homescreen">Pantalla de inicio</string> + <string name="add_to_favorites">Añadir a favoritos</string> + <string name="remove_from_favorites">Eliminar de favoritos</string> + <string name="playlist_favorites">Favoritos</string> + <string name="new_playlist">Nueva lista de reproducción...</string> + <string name="expand">Expandir</string> + <string name="expand_or_play_all">Expandir o reproducir todas</string> + <string name="delete">Eliminar</string> + <string name="playback_view">Reproduciendo ahora</string> + <string name="sort_by">Ordenar por</string> + <string name="search">Buscar</string> + <string name="done">Hecho</string> + <string name="remove">Eliminar</string> + <string name="play_or_enqueue">Poner en cola si hay música reproduciéndose; Reproducir si está pausado</string> + <string name="open">Abrir</string> + <string name="go_home">Directorio de inicio</string> + <string name="jumping_to_song">La canción ya está en la cola, saltando...</string> + <!--As a developer, you should always supply "one" and "other" + strings. Your translators will know which strings are actually + needed for their language. Always include %d in "one" because + translators will need to use %d for languages where "one" + doesn't mean 1 (as explained above). + + Translators should use http://unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules and + http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html, Type cardinal, + to see which categories apply to integer numbers in their languages--> + <plurals name="playing"> + <item quantity="one">%d pista reproduciéndose.</item> + <item quantity="many">%d pistas reproduciendose.</item> + <item quantity="other">%d pistas reproduciendose.</item> + </plurals> + <plurals name="enqueued"> + <item quantity="one">%d pista añadida a la cola.</item> + <item quantity="many">%d pistas añadidas a la cola.</item> + <item quantity="other">%d pistas añadidas a la cola.</item> + </plurals> + <plurals name="added_to_playlist"> + <item quantity="one">%1$d pista añadida a la lista de reproducción %2$s.</item> + <item quantity="many">%1$d pistas añadidas a la lista de reproducción %2$s.</item> + <item quantity="other">%1$d pistas añadidas a la lista de reproducción %2$s.</item> + </plurals> + <plurals name="removed_from_playlist"> + <item quantity="one">%1$d pista eliminada de la lista de reproducción %2$s.</item> + <item quantity="many">%1$d pistas eliminadas de la lista de reproducción %2$s.</item> + <item quantity="other">%1$d pistas eliminadas de la lista de reproducción %2$s.</item> + </plurals> + <plurals name="deleted"> + <item quantity="one">%d pista borrada.</item> + <item quantity="many">%d pistas borradas.</item> + <item quantity="other">%d pistas borradas.</item> + </plurals> + <string name="delete_file_failed">Error al eliminar %s.</string> + <string name="deleted_item">\'%s\' eliminado.</string> + <string name="delete_item">¿Eliminar \'%s\'?</string> + <string name="delete_file">¿Eliminar el archivo \'%s\'?</string> + <string name="artists">Artistas</string> + <string name="albums">Álbumes</string> + <string name="albumartists">Artistas del Álbum</string> + <string name="composers">Compositores</string> + <string name="songs">Pistas</string> + <string name="playlists">Listas de reproducción</string> + <string name="genres">Géneros</string> + <string name="files">Archivos</string> + <string name="artist">Artista</string> + <string name="album">Álbum</string> + <string name="genre">Género</string> + <string name="folder">Carpeta</string> + <string name="filename">Nombre de archivo</string> + <string name="file_size">Tamaño de archivo</string> + <string name="file_time">Fecha de modificación</string> + <string name="extension">Extensión</string> + <string name="unknown">Desconocido</string> + <string name="play_all">Reproducir todo</string> + <string name="enqueue_all">Añadir todo a cola</string> + <string name="all_songs">Todas las pistas</string> + <string name="details">Detalles</string> + <string name="more_from_artist">Más del artista</string> + <string name="more_from_album">Más del álbum</string> + <string name="title">Título</string> + <string name="number_of_tracks">Número de pistas</string> + <string name="year">Año</string> + <string name="date_added">Fecha en que se añadió</string> + <string name="artist_album">Artista, álbum</string> + <string name="artist_year_album">Artista, año, álbum</string> + <string name="artist_album_track">Artista, álbum, número de pista</string> + <string name="artist_album_title">Artista, álbum, título</string> + <string name="artist_year">Artista, año</string> + <string name="album_track">Álbum, número de pista</string> + <string name="song_playcount">Número de reproducciones</string> + <!--Preferences--> + <plurals name="seconds"> + <item quantity="one">%d segundo</item> + <item quantity="many">%d segundos</item> + <item quantity="other">%d segundos</item> + </plurals> + <plurals name="minutes"> + <item quantity="one">%d minuto</item> + <item quantity="many">%d minutos</item> + <item quantity="other">%d minutos</item> + </plurals> + <plurals name="hours"> + <item quantity="one">%d hora</item> + <item quantity="many">%d horas</item> + <item quantity="other">%d horas</item> + </plurals> + <string name="audio">Audio</string> + <string name="volume_during_ducking_title">Volumen durante notificaciones</string> + <string name="volume_during_ducking_summary">Volumen de reproducción:</string> + <string name="ignore_audiofocus_loss_summary">Continuar reproduciendo tras haber perdido permanentemente el control sobre el audio </string> + <string name="media_button_title">Controles para Bluetooth/Auriculares</string> + <string name="media_button_summary">Esto es necesario para los controles del bloqueo de pantalla en ICS.</string> + <string name="headset_only_title">Salida externa unicamente</string> + <string name="headset_only_summary">Impide que la música suene por los altavoces internos.</string> + <string name="headset_pause_title">Pausar cuando se desconecte</string> + <string name="headset_pause_summary">Pausar al desconectar los auriculares.</string> + <string name="headset_launch_title">Reproducir cuando se conecte</string> + <string name="headset_launch_summary">Reproducir cuando los auriculares se conecten. (Requiere que la app \'Headphone detector\' se encuentre instalada.)</string> + <string name="headset_launch_app_missing">Esta característica requiere que la app \'Headphone detector\' se encuentre instalada.\n¿Te gustaría abrir la Play Store para instalar la aplicación?</string> + <string name="replaygain">ReplayGain</string> + <string name="replaygain_summary">Configurar cómo se maneja la información de ReplayGain</string> + <string name="replaygain_track_title">Habilitar ReplayGain por pistas</string> + <string name="replaygain_track_summary">Reproducir todas las pistas al mismo volúmen</string> + <string name="replaygain_album_title">Habilitar ReplayGain por álbumes</string> + <string name="replaygain_album_summary">Preservar la dinámica del álbum.</string> + <string name="replaygain_bump_title">Pre-amplificación de ReplayGain</string> + <string name="replaygain_untagged_debump_title">Pistas sin etiqueta ReplayGain</string> + <string name="replaygain_untagged_debump_summary">Reducir volumen un</string> + <string name="replaygain_preamp_note_title">Nota</string> + <string name="replaygain_preamp_note_content">Android no permite a Vanilla Music aumentar el volumen a >100%. Establecer el pre-amplificador a un valor alto puede producir problemas si estás escuchando musica \"tranquila\".\n\nLos valores recomendados son:\n-> -3dB para música clásica/apacible\n-> +3dB para grabaciones post-2000</string> + <string name="readahead">Habilitar caché de lectura</string> + <string name="readahead_summary">Lee anticipadamente la pista que se está reproduciendo. Esta opción podría solucionar problemas de \'cortes\' (causados por una tarjeta SD lenta).</string> + <string name="equalizer">Ecualizador</string> + <string name="cycle_continuous_shuffling">Mezcla continua</string> + <string name="cycle_continuous_shuffling_summary">El \'Modo mezcla\" reproducirá las pistas siguiendo un orden totalmente aleatorio</string> + <string name="notifications">Notificaciones</string> + <string name="notification_visibility_title">Visibilidad de la notificación</string> + <string name="notification_action_title">Acción de la notificación</string> + <string name="playback_screen">Pantalla de reproducción</string> + <string name="playback_on_startup_title">Abrir al inicio</string> + <string name="playback_on_startup_summary">Abrir vista de reproducción al inicio</string> + <string name="display_mode_title">Modo de visualización</string> + <string name="swipe_up_action_title">Acción al deslizar hacia arriba</string> + <string name="swipe_down_action_title">Acción al deslizar hacia abajo</string> + <string name="cover_press_action_title">Acción al tocar la carátula</string> + <string name="cover_longpress_action_title">Acción al tocar la carátula de forma prolongada</string> + <string name="library_screen">Pantalla de biblioteca</string> + <string name="default_action_title">Acción predeterminada</string> + <string name="default_playlist_action_title">Acción predeterminada de la lista de reproducción</string> + <string name="accelerometer_shake">Sacudida del acelerómetro</string> + <string name="enable_shake_title">Activar la sacudida del acelerómetro</string> + <string name="enable_shake_summary">Solo activo cuando suena la música. En algunos dispositivos no funciona cuando la pantalla está apagada.</string> + <string name="shake_action_title">Acción al sacudir</string> + <string name="shake_threshold_title">Umbral de sacudida</string> + <string name="misc_features">Características diversas</string> + <string name="theme">Tema</string> + <string name="disable_lockscreen_title">Desactivar pantalla de bloqueo</string> + <string name="disable_lockscreen_summary">Impedir la activación de la pantalla de bloqueo en la biblioteca o en la pantalla de reproducción</string> + <string name="keep_screen_on_title">Mantener la pantalla encendida</string> + <string name="keep_screen_on_summary">Mantener la pantalla (y el dispositivo) activos mientras Vanilla Music sea visible</string> + <string name="use_idle_timeout_title">Activar tiempo de inactividad</string> + <string name="use_idle_timeout_summary">Cuando está activo, la reproducción se detendrá después del tiempo de inactividad especificado</string> + <string name="idle_timeout_title">Tiempo de inactividad</string> + <string name="enable_scroll_to_song_title">Desplazarse al título de la pista</string> + <string name="enable_scroll_to_song_summary">Desplazarse a la pista/álbum/artista reproduciéndose actualmente en las listas de la biblioteca</string> + <string name="queue_enable_scroll_to_song_title">Desplazarse al titulo de la pista en la cola</string> + <string name="queue_enable_scroll_to_song_summary">Desplazarse a la pista reproduciéndose actualmente al cambiar de canción</string> + <string name="jump_to_enqueued_on_play_title">Salta a canción encolado en \'Jugar\' </string> + <string name="jump_to_enqueued_on_play_summary">Si la canción requerido ya está en la cola, salta a eso en lugar de vaciando la cola</string> + <string name="coverloader_android_title">Cargar carátula desde Android</string> + <string name="coverloader_android_summary">Consultar la base de datos multimedia interna de Android para encontrar carátulas</string> + <string name="coverloader_vanilla_title">Cargar carátula desde carpeta</string> + <string name="coverloader_vanilla_summary">Buscar imágenes llamadas cover.jpg, album.jpg o artwork.jpg y mostrarlas como carátula del álbum</string> + <string name="coverloader_shadow_title">Cargar carátula desde carpeta oculta</string> + <string name="coverloader_shadow_summary">Intentar cargar carátulas desde \'/sdcard/Music/.vanilla/ARTISTA/ÁLBUM.jpg\'</string> + <string name="coverloader_inline_title">Cargar carátula desde las etiquetas del archivo</string> + <string name="coverloader_inline_summary">Intentar cargar la carátula embebida desde las etiquetas del archivo</string> + <string name="cover_on_lockscreen_title">Mostrar carátula en pantalla de bloqueo</string> + <string name="cover_on_lockscreen_summary">Mostrar la carátula de pista en reproducción en la pantalla de bloqueo</string> + <string name="double_tap_title">Doble toque en widget</string> + <string name="double_tap_summary">Tocar dos veces el widget 1x1 abrirá el reproductor. Causa un retraso de 400ms antes de que el widget responda a acciones.</string> + <string name="scrobble_title">Utilizar la API de Scrobble Droid</string> + <string name="scrobble_summary">Hacer Scrobble a Last.fm a través de Scrobble Droid o del Scrobbler sencillo de Last.fm</string> + <string name="stock_broadcast_title">Emular las emisiones de origen</string> + <string name="stock_broadcast_summary">Enviar las emisiones emulando a las enviadas por el reproductor de origen para que funcione con controles de pantalla de bloqueo, widgets etc. de terceros.</string> + <string name="help">Ayuda</string> + <string name="about">Acerca de</string> + <string name="tabs">Orden de pestañas</string> + <string name="customize_tab_order">Ajustar el orden y visibilidad de las pestañas de la biblioteca</string> + <string name="restore_default">Restaurar los valores predeterminados</string> + <!--The following are for the list preferences--> + <string name="last_used_action">Última acción</string> + <string name="never_show">No mostrar nunca</string> + <string name="show_when_playing">Mostrar durante la reproducción (por defecto)</string> + <string name="always_show">Mostrar siempre</string> + <string name="open_main_activity">Abrir biblioteca (por defecto)</string> + <string name="open_mini_popup">Mostrar notificación en miniatura</string> + <string name="skip_to_next_song">Saltar a la siguiente pista</string> + <string name="open_full_player">Abrir reproductor completo</string> + <string name="info_on_cover">Información sobre la carátula</string> + <string name="info_below_cover">Información debajo de la carátula</string> + <string name="fixed_info">Información fija en la parte superior</string> + <string name="do_nothing">No hacer nada</string> + <string name="open_library">Abrir biblioteca</string> + <string name="play_pause">Reproducir/Pausar</string> + <string name="next_song">Siguiente pista</string> + <string name="previous_song">Pista anterior</string> + <string name="next_album">Siguiente álbum</string> + <string name="previous_album">Álbum anterior</string> + <string name="cycle_repeat_mode">Modo repetición cíclico</string> + <string name="cycle_shuffle_mode">Modo mezcla cíclico</string> + <string name="enqueue_current_album">Poner álbum en cola</string> + <string name="enqueue_current_artist">Poner artista en cola</string> + <string name="enqueue_current_genre">Poner genero en cola</string> + <string name="enqueue_current">Poner en cola...</string> + <string name="more_from_current">Mas de...</string> + <string name="empty_the_queue">Vaciar cola</string> + <string name="show_queue">Mostrar cola</string> + <string name="hide_queue">Ocultar cola</string> + <string name="dequeue_rest">Eliminar de la cola el resto</string> + <string name="toggle_controls">Alternar controles</string> + <string name="seek_10s_backward">Retroceder 10 segundos</string> + <string name="seek_10s_forward">Avanzar 10 segundos</string> + <string name="move_to_top">Ir al principio</string> + <string name="move_to_bottom">Ir al final</string> + <string name="preferences_action_show_queue">Mostrar cola</string> + <string name="preferences_action_clear_queue">Limpiar cola</string> + <string name="preferences_action_enqueue_current_album">Añadir álbum a la cola</string> + <string name="preferences_action_enqueue_current_artist">Añadir artista a la cola</string> + <string name="preferences_action_enqueue_current_genre">Añadir género a la cola</string> + <string name="jump_to_time">Saltar a posición temporal</string> + <string name="time_separator">:</string> + <string name="hour_hint">HH</string> + <string name="minute_hint">MM</string> + <string name="second_hint">SS</string> + <string name="error_invalid_position">Posición inválida</string> + <string name="filebrowser_start">Carpeta de inicio del administrador de archivos</string> + <string name="customize_filebrowser_start">Mostrar este directorio al abrir el administrador de archivos</string> + <string name="select">Seleccionar</string> + <string name="save">Guardar</string> + <string name="autoplaylist_playcounts_title">Creación automática de lista de reproduccion</string> + <string name="autoplaylist_playcounts_summary">Crea automáticamente un</string> + <string name="autoplaylist_playcounts_fmt" formatted="false">%s lista de reproducción con el \'Top %.0f\'</string> + <string name="autoplaylist_playcounts_disabled">No crear una lista de reproducción automatica</string> + <string name="autoplaylist_playcounts_name" formatted="false">Top %d</string> + <string name="playlist_sync_mode_title">Sincronización de la lista de reproducción</string> + <string name="playlist_sync_all">Sincronización completa</string> + <string name="playlist_sync_only_import">Importar M3U, nunca exportar</string> + <string name="playlist_sync_only_export">Escribir M3U, nunca importar</string> + <string name="playlist_sync_disabled">Deshabilitado</string> + <string name="playlist_sync_folder_title">Carpeta para sincronización</string> + <string name="playlist_sync_folder_summary">Carpeta a usar para la sincronización de listas de reproducción</string> + <string name="playlist_export_relative_paths_title">Exporta usando caminos relativos</string> + <string name="playlist_export_relative_paths_summary">Referencia rutas de archivos relativo a la lista de reproducción</string> + <string name="permission_request_summary">Vanilla Music necesita permisos de lectura para mostrar tu biblioteca musical</string> + <string name="reverse_sort">Invertir el orden</string> + <string name="share">Compartir...</string> + <string name="share_failed">Fallo al compartir el archivo</string> + <string name="sendto">Enviar a...</string> + <string name="no_receiving_apps">¡No se encontró ninguna app receptora de este tipo de medios!</string> + <string name="duration">Duración</string> + <string name="dump_database">Volcar la base de datos</string> + <string name="dump_database_result">Base de datos volcada a \'%s\'</string> + <string name="force_m3u_import">Forzar la reimportación de M3U</string> + <string name="media_library">Biblioteca de medios</string> + <string name="media_folders_header">Directorios indexados</string> + <string name="media_scan_header">Escáner de medios</string> + <string name="media_scan_full">Escanear el sistema de ficheros completo (mas lento)</string> + <string name="media_scan_drop_db">Limpiar la base de datos de medios</string> + <string name="media_scan_start">Iniciar escaneo</string> + <string name="media_scan_force_bastp">Siempre utilizar el lector de etiquetas propio</string> + <string name="media_scan_group_albums">Agrupar los álbumes por carpeta</string> + <string name="media_statistics">Estadísticas</string> + <string name="media_stats_tracks">Número de pistas</string> + <string name="media_stats_library_playtime">Tiempo total de reproducción (Horas)</string> + <string name="media_stats_listen_playtime">Horas de música reproducidas hasta el momento</string> + <string name="media_stats_progress">Progreso del escaneo</string> + <string name="media_library_scan_running">Escaneando la biblioteca de medios</string> + <string name="media_scan_preferences">Opciones del escáner</string> + <string name="media_scan_preferences_change_title">Las opciones del escáner han cambiado</string> + <string name="media_scan_preferences_change_message">Modificar esta opción comenzará un nuevo re-escaneo completo de tu biblioteca. ¿Quieres continuar?</string> + <string name="folder_picker_spinner_desc">Estado del directorio</string> + <!--Folder selector--> + <string name="hint_long_press_to_modify_folder">Pulsación larga para modificar las opciones de carpeta</string> + <string name="folder_include">Incluir</string> + <string name="folder_exclude">Excluir</string> + <string name="folder_neutral">Neutral</string> + <!--Plugin system--> + <string name="plugins">Plugins</string> + <string name="plugin_needs_upgrade">Por favor actualiza el plugin %s a la última version</string> + <!--Theme names--> + <string name="theme_name_standard_light">Estándar</string> + <string name="theme_name_standard_dark">Estándar (Oscuro)</string> + <string name="theme_name_grey_light">Gris</string> + <string name="theme_name_grey_dark">Gris (Oscuro)</string> + <string name="theme_name_orange_light">Naranja</string> + <string name="theme_name_orange_dark">Naranja (Oscuro)</string> + <string name="theme_name_blue_light">Azul</string> + <string name="theme_name_blue_dark">Azul (Oscuro)</string> + <string name="theme_name_red_light">Rojo</string> + <string name="theme_name_red_dark">Rojo (Oscuro)</string> + <string name="theme_name_amoled_dark">Totalmente negro (AMOLED)</string> +</resources> diff --git a/app/src/main/res/values-eu-rES/translatable.xml b/app/src/main/res/values-eu-rES/translatable.xml new file mode 100644 index 0000000..14d9610 --- /dev/null +++ b/app/src/main/res/values-eu-rES/translatable.xml @@ -0,0 +1,343 @@ +<?xml version='1.0' encoding='UTF-8'?> +<resources> + <string name="app_name">Vanilla Music</string> + <string name="ok">OK</string> + <string name="cancel">Ezeztatu</string> + <!--Playback Activity (main screen)--> + <string name="no_songs">Ez da abestirik aurkitu zure gailuan.</string> + <string name="empty_queue">Ez dago abestirik aukeratuta. Aukeratu bat bibliotekatik edo sartu aleatorio moduan mezu hau sakatzen.</string> + <string name="settings">Konfigurazio</string> + <string name="no_shuffle">Ez nahasi</string> + <string name="shuffle_songs">Abestiak nahasi</string> + <string name="shuffle_songs_continuously">Etengabe nahasi abestiak</string> + <string name="shuffle_albums">Albumak nahasi</string> + <string name="no_repeat">Ez errepikatu</string> + <string name="repeat">Errepikatu</string> + <string name="repeat_current_song">Errepikatu abestia</string> + <string name="stop_current_song">Gelditu abestiaren ondoren</string> + <string name="random">Aleatorio</string> + <string name="random_enabling">Aleatorio aktibatuta</string> + <string name="song_load_failed">Errorea abesti %s kargatzean. Ustela edo falta izan liteke.</string> + <string name="queue_cleared">Errenkada hustuta.</string> + <string name="cover_art">Karatula</string> + <string name="close_notification">Jakinarazpena ixtea.</string> + <string name="_genre">generoa</string> + <string name="_track">abestia</string> + <string name="_composer">konpositorea</string> + <string name="_path">bidea</string> + <string name="_format">formatua</string> + <string name="_title">izenburua</string> + <string name="_artist">artista</string> + <string name="_album">albuma</string> + <string name="_year">urtea</string> + <string name="_replaygain">r-irabazia</string> + <!--New Playlist Dialog--> + <string name="choose_playlist_name">Aukeratu izena erreprodukzio-zerrendarako</string> + <string name="create">Sortu</string> + <string name="overwrite">Gainean idatzi</string> + <string name="delete_playlist">Ezabatu %s erreprodukzio-zerrenda?</string> + <!--Library--> + <string name="enqueue">Errenkadan jarri</string> + <string name="enqueue_as_next">Hurrengo erreproduzitu</string> + <string name="play">Erreproduzitu</string> + <string name="edit">Editatu</string> + <string name="rename">Berrizendatu</string> + <string name="save_as_playlist">Gorde erreprodukzio-zerrenda gisa...</string> + <string name="add_to_playlist">Gehitu erreprodukzio-zerrendara...</string> + <string name="add_to_homescreen">Gehitu hasierako pantailara</string> + <string name="add_to">Gehitu honi:</string> + <string name="playlist">Erreprodukzio-zerrenda</string> + <string name="homescreen">Hasierako pantaila</string> + <string name="add_to_favorites">Gehitu gogokoenei</string> + <string name="remove_from_favorites">Ezabatu gogokoenetik</string> + <string name="playlist_favorites">Gogokoenak</string> + <string name="new_playlist">Erreprodukzio-zerrenda berria...</string> + <string name="expand">Zabaldu</string> + <string name="expand_or_play_all">Zabaldu edo guztiak erreproduzitu</string> + <string name="delete">Kendu</string> + <string name="playback_view">Orain erreproduzitzen</string> + <string name="sort_by">Honela ordenatu</string> + <string name="search">Bilatu</string> + <string name="done">Eginda</string> + <string name="remove">Kendu</string> + <string name="play_or_enqueue">Jarri errenkadan musika erreproduzitzen ari bada; erreproduzitu pausatuta badago</string> + <string name="open">Ireki</string> + <string name="go_home">Hasierako direktorioa</string> + <string name="jumping_to_song">Abestia errenkadan dago, saihesten...</string> + <!--As a developer, you should always supply "one" and "other" + strings. Your translators will know which strings are actually + needed for their language. Always include %d in "one" because + translators will need to use %d for languages where "one" + doesn't mean 1 (as explained above). + + Translators should use http://unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules and + http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html, Type cardinal, + to see which categories apply to integer numbers in their languages--> + <plurals name="playing"> + <item quantity="one">%d abestia erreproduzitzen.</item> + <item quantity="other">%d abestiak erreproduzitzen.</item> + </plurals> + <plurals name="enqueued"> + <item quantity="one">%dabestia errenkadan jarrita.</item> + <item quantity="other">%d abestiak errenkadan jarrita.</item> + </plurals> + <plurals name="added_to_playlist"> + <item quantity="one">%1$d abestia %2$s erreprodukzio-zerrendara gehituta.</item> + <item quantity="other">%1$d abestiak %2$s erreprodukzio-zerrendara gehituta.</item> + </plurals> + <plurals name="removed_from_playlist"> + <item quantity="one">%1$d abestia %2$s erreprodukzio-zerrendara gehituta.</item> + <item quantity="other">%1$d abestiak %2$s erreprodukzio-zerrendara gehituta.</item> + </plurals> + <plurals name="deleted"> + <item quantity="one">%d abestia kenduta.</item> + <item quantity="other">%d abestiak kenduta.</item> + </plurals> + <string name="delete_file_failed">Errorea %s kentzen.</string> + <string name="deleted_item">\'%s\' kenduta.</string> + <string name="delete_item">\'%s\' kendu?</string> + <string name="delete_file">\'%s\' artxiboa kendu?</string> + <string name="artists">Artistak</string> + <string name="albums">Albumak</string> + <string name="albumartists">Albumeko Artistak</string> + <string name="composers">Konpositoreak</string> + <string name="songs">Abestiak</string> + <string name="playlists">Erreprodukzio-zerrendak</string> + <string name="genres">Generoak</string> + <string name="files">Artxiboak</string> + <string name="artist">Artista</string> + <string name="album">Albuma</string> + <string name="genre">Generoa</string> + <string name="folder">Karpeta</string> + <string name="filename">Izenburua</string> + <string name="file_size">Artxiboaren tamaina.</string> + <string name="file_time">Aldaketaren data.</string> + <string name="extension">Luzapena</string> + <string name="unknown">Ezezaguna</string> + <string name="play_all">Dena erreproduzitu</string> + <string name="enqueue_all">Dena errenkadan jarri</string> + <string name="all_songs">Abesti guztiak</string> + <string name="details">Xehetasunak</string> + <string name="more_from_artist">Gehiago artistaz</string> + <string name="more_from_album">Gehiago albumaz</string> + <string name="title">Izenburua</string> + <string name="number_of_tracks">Abesti kopurua</string> + <string name="year">Urtea</string> + <string name="date_added">Noiz gehitu zen</string> + <string name="artist_album">Artista, albuma</string> + <string name="artist_year_album">Artista, urtea, albuma</string> + <string name="artist_album_track">Artista, albuma, abesti zenbakia</string> + <string name="artist_album_title">Artista, albuma, izenburua</string> + <string name="artist_year">Artista, urtea</string> + <string name="album_track">Albuma, abesti zenbakia</string> + <string name="song_playcount">Erreprodukzio-kopurua</string> + <!--Preferences--> + <plurals name="seconds"> + <item quantity="one">%d segundo</item> + <item quantity="other">%d segundo</item> + </plurals> + <plurals name="minutes"> + <item quantity="one">%d minutu</item> + <item quantity="other">%d minutu</item> + </plurals> + <plurals name="hours"> + <item quantity="one">%d ordu</item> + <item quantity="other">%d ordu</item> + </plurals> + <string name="audio">Audio</string> + <string name="volume_during_ducking_title">Jakinarazpenen bolumena</string> + <string name="volume_during_ducking_summary">Erreprodukzio bolumena:</string> + <string name="ignore_audiofocus_loss_summary">Audioaren kontrola etengabe galdu ondoren, erreproduzitzen jarraitu</string> + <string name="media_button_title">Bluetooth/Aurikularretarako kontrolak</string> + <string name="media_button_summary">Hau beharrezkoa da ICS pantaila-blokeoa kontrolatzeko.</string> + <string name="headset_only_title">Kanpoko irteera bakarrik</string> + <string name="headset_only_summary">Musika barneko bozgorailuetatik erreproduzitzea eragozten du.</string> + <string name="headset_pause_title">Eten deskonektatzen denean.</string> + <string name="headset_pause_summary">Eten aurikularrak deskonektatzen direnean.</string> + <string name="headset_launch_title">Erreproduzitu konektatzean</string> + <string name="headset_launch_summary">Aurikularrak konektatzean erreproduzitu. (\'Headphone detector\' aplikazioa instalatuta egotea eskatzen du.)</string> + <string name="headset_launch_app_missing">Ezaugarri honek \'Headphone detector\' instalatuta egotea eskatzen du. Play Store ireki nahi duzu aplikazioa instalatzeko?</string> + <string name="replaygain">ReplayGain</string> + <string name="replaygain_summary">ReplayGain informazioa nola erabiltzen den konfiguratzea</string> + <string name="replaygain_track_title">ReplayGain gaitu abesti bakoitzerako</string> + <string name="replaygain_track_summary">Abesti guztiak bolumen berean erreproduzitu</string> + <string name="replaygain_album_title">ReplayGain gaitu album bakoitzerako</string> + <string name="replaygain_album_summary">Albumaren dinamika gorde</string> + <string name="replaygain_bump_title">ReplayGain aurre-anplifikazioa</string> + <string name="replaygain_untagged_debump_title">ReplayGain etiketarik gabeko abestiak</string> + <string name="replaygain_untagged_debump_summary">Bolumena murriztu honen arabera:</string> + <string name="replaygain_preamp_note_title">Oharra</string> + <string name="replaygain_preamp_note_content">Androidek ez dio uzten Vanilla Music-i bolumena >100% era igotzea. Aurre-anplifikadorea balio altuan ezartzeak arazoak sor ditzake musika \"lasaia\" entzuten ari bazara. Aurre-anplifikadorea balio altuan ezartzeak arazoak sor ditzake musika \"lasaia\" entzuten ari bazara. \n\nGomendatutako balioak hauek dira: \n-> -3db musika klasiko/baketsuarentzat\n-> +3dB-2000 ondorengo grabazioentzat</string> + <string name="readahead">Irakurketa-katxea gaitu</string> + <string name="readahead_summary">Irakurri aldez aurretik erreproduzitzen ari den pista. Aukera horrek \'mozketa\' arazoak konpon ditzake (SD txartel motel batek eragindakoak).</string> + <string name="equalizer">Ekualizadorea</string> + <string name="cycle_continuous_shuffling">Etengabe nahasi</string> + <string name="cycle_continuous_shuffling_summary">\"Nahasketa modua\" abestiak erreproduzituko ditu, aleatorio ordena bati jarraituz</string> + <string name="notifications">Jakinarazpenak</string> + <string name="notification_visibility_title">Jakinarazpenaren ikusgarritasuna</string> + <string name="notification_action_title">Jakinarazpenaren ekintza</string> + <string name="playback_screen">Erreprodukzio-pantaila</string> + <string name="playback_on_startup_title">Ireki hasieran</string> + <string name="playback_on_startup_summary">Ireki erreprodukzio-ikuspegia hasieran</string> + <string name="display_mode_title">Bistaratzeko modua</string> + <string name="swipe_up_action_title">Ekintza gorantz irristatzerakoan</string> + <string name="swipe_down_action_title">Ekintza beherantz irristatzerakoan</string> + <string name="cover_press_action_title">Ekintza karatula ukitzerakoan</string> + <string name="cover_longpress_action_title">Karatula luzaroan ukitzerakoan egindako ekintza</string> + <string name="library_screen">Bibliotekako pantaila</string> + <string name="default_action_title">Ekintza lehenetsia</string> + <string name="default_playlist_action_title">Erreprodukzio-zerrenda ekintza lehenetsia</string> + <string name="accelerometer_shake">azelerometro inarrosi</string> + <string name="enable_shake_title">azelerometro inarrosia gaitu</string> + <string name="enable_shake_summary">Bakarrik aktibatuta dago musika jotzen ari denean . Ez du funtzionatzen pantaila zenbait gailuetan itzalita badago</string> + <string name="shake_action_title">ekintza inarrosi</string> + <string name="shake_threshold_title">Indar-atalasea inarrosi</string> + <string name="misc_features">Ezaugarri miszelaneoak</string> + <string name="theme">Gaia</string> + <string name="disable_lockscreen_title">Pantaila blokeatzea desgaitzea</string> + <string name="disable_lockscreen_summary">Pantaila-blokeoa aktibazioa prebenitzea bibliotekan edo playback-pantailan </string> + <string name="keep_screen_on_title">Pantaila piztuta eduki</string> + <string name="keep_screen_on_summary">Pantaila (eta gailua) esna eduki VanillaMusic ikusgai dagoen bitartean</string> + <string name="use_idle_timeout_title">jardun gabeko denbora gaitu</string> + <string name="use_idle_timeout_summary">Aktibo dagoen bitartean, playback-a gelditu egingo da aldi jakin baten ondoren.</string> + <string name="idle_timeout_title">jardun gabeko denbora</string> + <string name="enable_scroll_to_song_title">Joan abestiaren titulura</string> + <string name="enable_scroll_to_song_summary">Liburutegiko zerrendetan erreproduzitzen ari den abestira/albumera/artistara joan</string> + <string name="queue_enable_scroll_to_song_title">Errenkadan dagoen pistaren titulura joan</string> + <string name="queue_enable_scroll_to_song_summary">Abestia aldatzean errenkadan erreproduzitzen ari den abestira mugitzea</string> + <string name="jump_to_enqueued_on_play_title">Salto egin \'Erreproduzitu\' errenkadan dagoen abestira</string> + <string name="jump_to_enqueued_on_play_summary">Eskatutako abestia errenkadan badago, salto egin bertara, errenkada hustu beharrean.</string> + <string name="coverloader_android_title">Androidetik artelanak kargatzea</string> + <string name="coverloader_android_summary">Androidsen komunikabideen barne-datu-basea kontsultatzea albumeko artelanerako</string> + <string name="coverloader_vanilla_title">Artelanak karpetatik kargatzea</string> + <string name="coverloader_vanilla_summary">Bilatu cover.jpg, album.jpg edo artwork.jpg izeneko irudi-fitxategiak, eta erakutsi albumaren azal gisa.</string> + <string name="coverloader_shadow_title">Artelanak karpeta ezkututik kargatzea</string> + <string name="coverloader_shadow_summary">Saiatu artelanak kargatzen \'/ sdcard/Music/.vanilla/Artist/ALBUM.jpg\'-tik</string> + <string name="coverloader_inline_title">Artxiboen etiketak oinarri hartuta, artelanak kargatzea</string> + <string name="coverloader_inline_summary">Fitxategietako etiketetan txertatutako artelanak kargatzen saiatu</string> + <string name="cover_on_lockscreen_title">Erakutsi artelanak blokeo pantailan</string> + <string name="cover_on_lockscreen_summary">Blokeo-pantailan erreproduzitzen ari den abestiko artelanak erakustea.</string> + <string name="double_tap_title">Ukitu bikoitzeko widget</string> + <string name="double_tap_summary">Widget 1x1 bi aldiz jotzean, erreproduzitzailea irekitzen da. Widgetak 400 ms behar ditu ekintzei erantzuteko.</string> + <string name="scrobble_title">Scrobble Droid API erabili</string> + <string name="scrobble_summary">Scrobbletik Last.fm-ra, Scrobble Droid edo Simple Last.fm Scrobbler bidez</string> + <string name="stock_broadcast_title">Stock-jaulkipenak emulatzea</string> + <string name="stock_broadcast_summary">Bidali serieko musika-erreproduzitzaileak bidalitakoak emulatzen dituzten transmisioak, 3rd partien blokeo-pantailen kontrolekin, widgetekin eta abarrekin funtziona dezaten.</string> + <string name="help">Laguntza</string> + <string name="about">Honi buruz</string> + <string name="tabs">Erlaitzen ordena</string> + <string name="customize_tab_order">Liburutegiko erlaitzen ordena eta ikuspena doitzea</string> + <string name="restore_default">Lehenetsitako balioak leheneratzea</string> + <!--The following are for the list preferences--> + <string name="last_used_action">Erabilitako azken ekintza</string> + <string name="never_show">Inoiz ez irakatsi</string> + <string name="show_when_playing">Erakutsi erreproduzitzean (lehenetsita)</string> + <string name="always_show">Beti irakatsi</string> + <string name="open_main_activity">Liburutegia ireki (lehenetsi)</string> + <string name="open_mini_popup">Ireki azaleratzen ari den leiho txikia</string> + <string name="skip_to_next_song">Hurrengo abestira salto egin</string> + <string name="open_full_player">Ireki erreproduzigailu osoa</string> + <string name="info_on_cover">Azaleko arteari buruzko informazioa</string> + <string name="info_below_cover">Azalaren azpiko informazioa</string> + <string name="fixed_info">Goiko aldean finkatutako informazioa</string> + <string name="do_nothing">Ezer egin</string> + <string name="open_library">Liburutegia ireki</string> + <string name="play_pause">Erreproduzitu/Gelditu</string> + <string name="next_song">Hurrengo abestia</string> + <string name="previous_song">Aurreko abestia</string> + <string name="next_album">Hurrengo albuma</string> + <string name="previous_album">Aurreko albuma</string> + <string name="cycle_repeat_mode">Zikloa errepikatzeko modua</string> + <string name="cycle_shuffle_mode">Zikloaren ausazko modua</string> + <string name="enqueue_current_album">Albuma errenkadan jarri</string> + <string name="enqueue_current_artist">Artista errenkadan jarri</string> + <string name="enqueue_current_genre">Generoa errenkadan jarri</string> + <string name="enqueue_current">... errenkadan jarri</string> + <string name="more_from_current">Informazio gehiago...</string> + <string name="empty_the_queue">errenkada hustu</string> + <string name="show_queue">errenkada irakatsi</string> + <string name="hide_queue">errenkada eskutatu</string> + <string name="dequeue_rest">Gainerakoa errenkadatik kendu</string> + <string name="toggle_controls">Kommutazio-kontrolak</string> + <string name="seek_10s_backward">Bilatu 10 segundo atzerantz</string> + <string name="seek_10s_forward">Bilatu 10 segundo aurrerantz</string> + <string name="move_to_top">Mugitu erabat goian</string> + <string name="move_to_bottom">Mugitu hondora</string> + <string name="preferences_action_show_queue">Ilara irakatsi</string> + <string name="preferences_action_clear_queue">Ilara garbitu</string> + <string name="preferences_action_enqueue_current_album">Albuma errenkadan jarri</string> + <string name="preferences_action_enqueue_current_artist">Artista errenkadan jarri</string> + <string name="preferences_action_enqueue_current_genre">Generoa errenkadan jarri</string> + <string name="jump_to_time">Denborara salto egitea</string> + <string name="time_separator">:</string> + <string name="hour_hint">HH</string> + <string name="minute_hint">MM</string> + <string name="second_hint">SS</string> + <string name="error_invalid_position">Posizio baliogabea</string> + <string name="filebrowser_start">Fitxategi-arakatzailearen hasiera</string> + <string name="customize_filebrowser_start">Fitxategien arakatzailea direktorio honetan hasten da</string> + <string name="select">Aukeratu</string> + <string name="save">Gorde</string> + <string name="autoplaylist_playcounts_title">Erreprodukzio-zerrendak automatikoki sortu</string> + <string name="autoplaylist_playcounts_summary">Sortu automatikoki </string> + <string name="autoplaylist_playcounts_fmt" formatted="false">%s \'Goiko%.0f\'erreprodukzio-zerrenda</string> + <string name="autoplaylist_playcounts_disabled">Ez sortu erreprodukzio-zerrenda automatikorik</string> + <string name="autoplaylist_playcounts_name" formatted="false">Goiko %d</string> + <string name="playlist_sync_mode_title">Erreprodukzio-zerrenden sinkronizazioa</string> + <string name="playlist_sync_all">Erabateko sinkronizazioa</string> + <string name="playlist_sync_only_import">Inportatu M3U, inoiz ez esportatu</string> + <string name="playlist_sync_only_export">Idatzi M3U, inoiz ez inportatu</string> + <string name="playlist_sync_disabled">Desgaituta</string> + <string name="playlist_sync_folder_title">Sinkronizazio karpeta</string> + <string name="playlist_sync_folder_summary">Erreprodukzio-zerrendak sinkronizatzeko erabiliko den karpeta</string> + <string name="playlist_export_relative_paths_title">Esportatu ibilbide erlatiboak erabiliz</string> + <string name="playlist_export_relative_paths_summary">Erreprodukzio-zerrendari buruzko artxibo-ibilbideak aipatzea</string> + <string name="permission_request_summary">Vanilla Musicek irakurtzeko baimena behar du zure musika liburutegia erakusteko</string> + <string name="reverse_sort">Alderantzizko antolamendua</string> + <string name="share">Partitu...</string> + <string name="share_failed">Errorea fitxategia partekatzean</string> + <string name="sendto">Bidali...</string> + <string name="no_receiving_apps">Ez da aurkitu harrera-aplikaziorik mota horretako mediarentzat!</string> + <string name="duration">Iraupena</string> + <string name="dump_database">Datu-basea irauli</string> + <string name="dump_database_result"> datu-basea \'%s\'ra irauli</string> + <string name="force_m3u_import">M3U berriz inportatzera behartzea</string> + <string name="media_library">Media liburutegia</string> + <string name="media_folders_header">Direktorio indexatuak</string> + <string name="media_scan_header">Media eskanerra</string> + <string name="media_scan_full">Fitxategi-sistema osoa eskaneatzea (motelagoa)</string> + <string name="media_scan_drop_db">Media datu-basea garbitu</string> + <string name="media_scan_start">Eskaneatzen hastea</string> + <string name="media_scan_force_bastp">Erabili beti etiketen irakurgailu integratua</string> + <string name="media_scan_group_albums">Karpeta bakoitzeko album-taldeak</string> + <string name="media_statistics">Estatistikak</string> + <string name="media_stats_tracks">Abesti kopurua</string> + <string name="media_stats_library_playtime">Erreprodukzio denbora guztira (Orduak)</string> + <string name="media_stats_listen_playtime">Orain arte jarritako musika-orduak</string> + <string name="media_stats_progress">Eskaneatzearen abantzamendua</string> + <string name="media_library_scan_running">biblioteka eskaneatu</string> + <string name="media_scan_preferences">Eskanearren aukerak</string> + <string name="media_scan_preferences_change_title">Eskanearren aukerak aldatuta</string> + <string name="media_scan_preferences_change_message">Aukera hori aldatzean, zure liburutegia osorik berrikusiko da. Jarraitu nahi duzu?</string> + <string name="folder_picker_spinner_desc">Direktorioaren egoera:</string> + <!--Folder selector--> + <string name="hint_long_press_to_modify_folder">Sakatu karpetako aukerak aldatzeko</string> + <string name="folder_include">Sartu</string> + <string name="folder_exclude">Baztertu</string> + <string name="folder_neutral">Neutral</string> + <!--Plugin system--> + <string name="plugins">Pluginak</string> + <string name="plugin_needs_upgrade">Mesedez, eguneratu %s plugina azken bertsiora</string> + <!--Theme names--> + <string name="theme_name_standard_light">Estandarra</string> + <string name="theme_name_standard_dark">Estandarra (Iluna)</string> + <string name="theme_name_grey_light">Grisa</string> + <string name="theme_name_grey_dark">Grisa (Iluna)</string> + <string name="theme_name_orange_light">Laranja</string> + <string name="theme_name_orange_dark">Laranja (Iluna)</string> + <string name="theme_name_blue_light">Urdina</string> + <string name="theme_name_blue_dark">Urdina (Iluna)</string> + <string name="theme_name_red_light">Gorria</string> + <string name="theme_name_red_dark">Gorria (Iluna)</string> + <string name="theme_name_amoled_dark">Tonu beltza (AMOLED)</string> +</resources> diff --git a/app/src/main/res/values-fa-rIR/translatable.xml b/app/src/main/res/values-fa-rIR/translatable.xml new file mode 100644 index 0000000..b81859f --- /dev/null +++ b/app/src/main/res/values-fa-rIR/translatable.xml @@ -0,0 +1,226 @@ +<?xml version='1.0' encoding='UTF-8'?> +<resources> + <string name="app_name">وانیلا موزیک</string> + <string name="ok">بسیار خوب</string> + <string name="cancel">کنسل</string> + <!--Playback Activity (main screen)--> + <string name="no_songs">آهنگی بر روی دستگاه شما پیدا تشد.</string> + <string name="empty_queue">موسیقی انتخاب نشده است. تعدادی موسیقی از کتابخانه انتخاب کنید یا با لمس کردن این پیام وارد حالت تصادفی شوید.</string> + <string name="settings">تنظیمات</string> + <string name="no_shuffle">بدون تصادفی</string> + <string name="shuffle_songs">آهنگ های تصادفی</string> + <string name="shuffle_songs_continuously">آهنگ ها را بصورت مداوم تصادفی پخش کن</string> + <string name="shuffle_albums">تصادفیسازی آلبومها</string> + <string name="no_repeat">بدون تکرار</string> + <string name="repeat">تکرار</string> + <string name="repeat_current_song">تکرار آهنگ در حال پخش</string> + <string name="stop_current_song">بعد آهنگ در حال پخش، متوقف کن</string> + <string name="random">تصادفی</string> + <string name="random_enabling">فعال کردن حالت تصادفی</string> + <string name="song_load_failed">پخش آهنگ %s ناموفق بود. شاید فایل خراب شده یا وجود ندارد.</string> + <string name="queue_cleared">صف خالی شد.</string> + <string name="cover_art">جلد آلبوم</string> + <string name="close_notification">بستن اعلان</string> + <string name="_genre">ژانر</string> + <string name="_track">اثر</string> + <string name="_composer">آهنگساز</string> + <string name="_path">مسیر</string> + <string name="_format">فرمت</string> + <string name="_title">عنوان</string> + <string name="_artist">هنرمند</string> + <string name="_album">آلبوم</string> + <string name="_year">سال</string> + <string name="_replaygain">پخش مجدد</string> + <!--New Playlist Dialog--> + <string name="choose_playlist_name">انتخاب نام لیست پخش</string> + <string name="create">ساختن</string> + <string name="overwrite">جایگزین</string> + <string name="delete_playlist">لیست پخش %s حذف شود؟</string> + <!--Library--> + <string name="enqueue">اضافه کردن به صف</string> + <string name="enqueue_as_next">پخش بعد آهنگ فعلی</string> + <string name="play">پخش</string> + <string name="edit">ویرایش</string> + <string name="rename">تغییر نام</string> + <string name="save_as_playlist">ذخیره لیست پخش...</string> + <string name="add_to_playlist">اضافه به لیست پخش...</string> + <string name="add_to_homescreen">افزودن به صفحه اصلی...</string> + <string name="add_to">افزودن به...</string> + <string name="playlist">لیست در حال اجرا</string> + <string name="homescreen">صفحه اصلی</string> + <string name="add_to_favorites">اضافه به علاقهمندیها</string> + <string name="remove_from_favorites">حذف از علاقهمندیها</string> + <string name="playlist_favorites">علاقهمندیها</string> + <string name="new_playlist">لیست پخش جدید...</string> + <string name="expand">بسط دادن</string> + <string name="expand_or_play_all">باز کردن یا پخش همه</string> + <string name="delete">حذف</string> + <string name="playback_view">در حال پخش</string> + <string name="sort_by">مرتبسازی بر اساس</string> + <string name="search">جستجو</string> + <string name="done">انجام شد</string> + <string name="remove">حذف</string> + <string name="play_or_enqueue">اضافه به صف اگر در حال پخش، در غیر این صورت شروع به پخش</string> + <string name="open">بازکردن</string> + <string name="go_home">دایرکتوری اصلی</string> + <string name="jumping_to_song">آهنگ به درستی در صف است، در حال پریدن...</string> + <!--As a developer, you should always supply "one" and "other" + strings. Your translators will know which strings are actually + needed for their language. Always include %d in "one" because + translators will need to use %d for languages where "one" + doesn't mean 1 (as explained above). + + Translators should use http://unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules and + http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html, Type cardinal, + to see which categories apply to integer numbers in their languages--> + <plurals name="playing"> + <item quantity="one">%dموسیقی در حال پخش است.</item> + <item quantity="other">%d موسیقی در حال پخش است.</item> + </plurals> + <plurals name="enqueued"> + <item quantity="one">%d موسیقی به لیست اضافه شده است.</item> + <item quantity="other">%d موسیقی به لیست اضافه شده است.</item> + </plurals> + <plurals name="added_to_playlist"> + <item quantity="one">%1$d موسیقی به لیست پخش %2$s افزوده شده است.</item> + <item quantity="other">%1$d موسیقی به لیست پخش %2$s افزوده شده است.</item> + </plurals> + <plurals name="removed_from_playlist"> + <item quantity="one">%1$d موسیقی از لیست پخش %2$s حذف شد.</item> + <item quantity="other">%1$d موسیقی از لیست پخش %2$s حذف شد.</item> + </plurals> + <plurals name="deleted"> + <item quantity="one">%d موسیقی حذف شد.</item> + <item quantity="other">%d موسیقی حذف شد.</item> + </plurals> + <string name="delete_file_failed">حذف %s ناموفق بود.</string> + <string name="deleted_item">\'%s\' حذف شد.</string> + <string name="delete_item">\'%s\' پاک شود؟</string> + <string name="delete_file">فایل \'%s\' پاک شود؟</string> + <string name="artists">هنرمندان</string> + <string name="albums">آلبومها</string> + <string name="albumartists">آلبوم خوانندگان</string> + <string name="composers">آهنگسازان</string> + <string name="songs">موسیقی ها</string> + <string name="playlists">لیستهای پخش</string> + <string name="genres">ژانرها</string> + <string name="files">فایلها</string> + <string name="artist">خواننده</string> + <string name="album">آلبوم</string> + <string name="genre">ژانر</string> + <string name="folder">پوشه</string> + <string name="filename">نام فایل</string> + <string name="file_size">حجم فایل</string> + <string name="file_time">زمان اصلاح</string> + <string name="extension">افزونه</string> + <string name="unknown">ناشناخته</string> + <string name="play_all">پخش همه</string> + <string name="enqueue_all">اضافهکردن همه به صف</string> + <string name="all_songs">همه موسیقی ها</string> + <string name="details">جزییات</string> + <string name="more_from_artist">آهنگهای بیشتر از این هنرمند</string> + <string name="more_from_album">آهنگهای بیشتر از این آلبوم</string> + <string name="title">عنوان</string> + <string name="number_of_tracks">تعداد ترکها</string> + <string name="year">آهنگ</string> + <string name="date_added">تاریخ اضافهشدن</string> + <string name="artist_album">هنرمند، آلبوم</string> + <string name="artist_year_album">خواننده، سال، آلبوم</string> + <string name="artist_album_track">هنرمند، آلبوم، شماره ترک</string> + <string name="artist_album_title">هنرمند، آلبوم، عنوان</string> + <string name="artist_year">هنرمند، سال</string> + <string name="album_track">آلبوم، شماره ترک</string> + <string name="song_playcount">تعداد پخش</string> + <!--Preferences--> + <plurals name="seconds"> + <item quantity="one">%d ثانیه</item> + <item quantity="other">%d ثانیه ها</item> + </plurals> + <plurals name="minutes"> + <item quantity="one">%d دقیقه ها</item> + <item quantity="other">%d دقیقه</item> + </plurals> + <plurals name="hours"> + <item quantity="one">%d ساعت</item> + <item quantity="other">%d ساعت ها</item> + </plurals> + <string name="audio">صدا</string> + <string name="volume_during_ducking_title">حجم صدا در زمان اعلان ها</string> + <string name="volume_during_ducking_summary">میزان صدای پخش:</string> + <string name="ignore_audiofocus_loss_summary">نگهداشتن اجرای موزیک هنگام از تغییر کردن تمرکز صدا</string> + <string name="media_button_title">هدست / کنترل های بلوتوثی</string> + <string name="media_button_summary">این برای قفل صفحه در ICS مورد نیاز است</string> + <string name="headset_only_title">فقط خروجی های جانبی</string> + <string name="headset_only_summary">مانع از پخش موسیقی از طریق بلندگوهای داخلی می شود.</string> + <string name="headset_pause_title">هنگامی که جدا می شود پخش متوقف گردد</string> + <string name="headset_pause_summary">هنگامی که هدفون جدا می شود پخش متوقف گردد.</string> + <string name="headset_launch_title">هنگامی که متصل می شود پخش گردد</string> + <string name="headset_launch_summary">هنگام وصل شدن هدفون موسیقی پخش شود. (نیاز به نصب برنامه ردیاب هدفون دارد.)</string> + <string name="headset_launch_app_missing">این ویژگی نیاز به نصب برنامه \"آشکارساز هدفون\" دارد. \n آیا می خواهید فروشگاه برنام ها را برای نصب برنامه باز کنید؟</string> + <string name="replaygain">پخش مجدد</string> + <string name="replaygain_summary">اطلاعات پخش مجدد را پیکربندی کنید</string> + <string name="replaygain_track_title">فعال کردن پخش مجدد برای هر موسیقی</string> + <string name="replaygain_track_summary">همه موسیقی ها را با صدای بلند اجرا کند</string> + <string name="replaygain_album_title">فعال کردن پخش مجدد آلبوم</string> + <string name="replaygain_preamp_note_title">یادداشت</string> + <string name="equalizer">اکولایزر</string> + <string name="cycle_continuous_shuffling">تصادفی متوالی</string> + <string name="notifications">اعلان ها</string> + <string name="notification_action_title">عملکرد اعلان ها</string> + <string name="playback_screen">صفحه پخش</string> + <string name="display_mode_title">حالت نمایش</string> + <string name="library_screen">دیوار مجموعه</string> + <string name="disable_lockscreen_title">غیر فعال کردن قفل صفحه</string> + <string name="double_tap_title">ویدجت دوبار ضربه</string> + <string name="stock_broadcast_title">شبیه سازی پخش مخزن</string> + <string name="stock_broadcast_summary">ارسال به پخش تقلید آن ارسال شده توسط پخش موسیقی به کار با کنترل lockscreen 3rd پارتی، ویدجت ها، و غیره</string> + <string name="about">درباره</string> + <string name="tabs">ترتیب تب ها</string> + <string name="customize_tab_order">تنظیم کردن ترتیب و نمایش تب های مجموعه</string> + <string name="restore_default">باز گرداندن به تنظیمات اولیه</string> + <!--The following are for the list preferences--> + <string name="last_used_action">آخرین عمل انجام شده</string> + <string name="never_show">هرگز نمایش ندهد</string> + <string name="show_when_playing">نشان دادن زمانیکه اجرا می شود(پیش فرض)</string> + <string name="always_show">همیشه نمایش دهد</string> + <string name="open_main_activity">باز کردن مجموعه(پیش فرض)</string> + <string name="open_mini_popup">باز کردن پنجره کوچک</string> + <string name="open_full_player">باز کردن کامل پخش کننده</string> + <string name="info_on_cover">اطلاعات بر روی جلد آلبوم قرار داده شود</string> + <string name="info_below_cover">اطلاعات در پایین جلد آلبوم قرار داده شود</string> + <string name="fixed_info">اطلاعات بصورت ثابت در بالا قرار داده شده</string> + <string name="do_nothing">کاری انجام نمی شود</string> + <string name="open_library">بازکردن مجموعه</string> + <string name="play_pause">پخش/عدم پخش</string> + <string name="next_album">آلبوم بعدی</string> + <string name="previous_album">آلبوم قبلی</string> + <string name="cycle_repeat_mode">چرخه حالت تکراری</string> + <string name="cycle_shuffle_mode">چرخه حالت تصادفی</string> + <string name="enqueue_current_album">در نوبت قرار دادن آلبوم</string> + <string name="enqueue_current_artist">در نوبت قرار دادن خواننده</string> + <string name="enqueue_current_genre">در نوبت قرار دادن دسته</string> + <string name="empty_the_queue">صف خالی است</string> + <string name="show_queue">نمایش صف</string> + <string name="hide_queue">پنهان کردن صف</string> + <string name="dequeue_rest">صف بندی مجدد</string> + <string name="toggle_controls">کنترل های تغییر حالت</string> + <string name="seek_10s_backward">10 ثانیه به عقب بازگشتن</string> + <string name="seek_10s_forward">10 ثانیه به جلو رفتن</string> + <string name="preferences_action_show_queue">نمایش صف</string> + <string name="preferences_action_clear_queue">پاک کردن صف</string> + <string name="preferences_action_enqueue_current_album">در نوبت قرار دادن آلبوم</string> + <string name="preferences_action_enqueue_current_artist">در نوبت قرار دادن خواننده</string> + <string name="preferences_action_enqueue_current_genre">در نوبت قرار دادن دسته</string> + <string name="filebrowser_start">صفحه اصلی مرورگر فایل</string> + <string name="customize_filebrowser_start">قرار دادن این مسیر بعنوان شروع مرورگر فایل</string> + <string name="select">انتخاب</string> + <string name="autoplaylist_playcounts_title">ساختن لیست آهنگ ها بصورت خودکار</string> + <string name="autoplaylist_playcounts_summary">بصورت خودکار ساختن یک</string> + <string name="autoplaylist_playcounts_fmt" formatted="false">%s \'بالا %.0f\' لیست پخش</string> + <string name="autoplaylist_playcounts_disabled">یک لیست پخش بصورت خودکار ایجاد نشود</string> + <string name="autoplaylist_playcounts_name" formatted="false">بالا %d</string> + <string name="permission_request_summary">وانیلا موزیک برای نمایش کتابخانه موزیک ،نیاز به دسترسی خواندن دارد</string> + <!--Folder selector--> + <!--Plugin system--> + <!--Theme names--> +</resources> diff --git a/app/src/main/res/values-fi/translatable.xml b/app/src/main/res/values-fi/translatable.xml new file mode 100644 index 0000000..b05017c --- /dev/null +++ b/app/src/main/res/values-fi/translatable.xml @@ -0,0 +1,346 @@ +<?xml version='1.0' encoding='UTF-8'?> +<resources> + <string name="app_name">Vanilla Music</string> + <string name="ok">OK</string> + <string name="cancel">Peru</string> + <!--Playback Activity (main screen)--> + <string name="no_songs">Laitteeltasi ei löytynyt kappaleita.</string> + <string name="empty_queue">Kappaleita ei ole valittu. Valitse kappaleita kirjastosta tai toista satunnaisia napauttamalla tätä viestiä.</string> + <string name="settings">Asetukset</string> + <string name="no_shuffle">Ei sekoitusta</string> + <string name="shuffle_songs">Sekoita kappaleet</string> + <string name="shuffle_songs_continuously">Sekoita kappaleet jatkuvasti</string> + <string name="shuffle_albums">Sekoita albumit</string> + <string name="no_repeat">Ei kertausta</string> + <string name="repeat">Kertaa</string> + <string name="repeat_current_song">Kertaa nykyinen kappale</string> + <string name="stop_current_song">Pysäytä nykyisen kappaleen jälkeen</string> + <string name="random">Satunnainen</string> + <string name="random_enabling">Satunnainen käytössä</string> + <string name="song_load_failed">Kappaleen %s lataaminen epäonnistui. Tiedosto saattaa olla rikki tai sitä ei löydy.</string> + <string name="queue_cleared">Jono tyhjennetty.</string> + <string name="cover_art">Kansikuvitus</string> + <string name="close_notification">Sulje ilmoitus</string> + <string name="_genre">lajityyppi</string> + <string name="_track">kappale</string> + <string name="_composer">säveltäjä</string> + <string name="_path">polku</string> + <string name="_format">muoto</string> + <string name="_title">nimi</string> + <string name="_artist">esittäjä</string> + <string name="_album">albumi</string> + <string name="_year">vuosi</string> + <string name="_replaygain">rgain</string> + <!--New Playlist Dialog--> + <string name="choose_playlist_name">Valitse soittolistan nimi</string> + <string name="create">Luo</string> + <string name="overwrite">Korvaa</string> + <string name="delete_playlist">Poistetaanko soittolista %s?</string> + <!--Library--> + <string name="enqueue">Lisää jonoon</string> + <string name="enqueue_as_next">Toista seuraava</string> + <string name="play">Toista</string> + <string name="edit">Muokkaa</string> + <string name="rename">Nimeä uudelleen</string> + <string name="save_as_playlist">Tallenna soittolistana…</string> + <string name="add_to_playlist">Lisää soittolistaan…</string> + <string name="add_to_homescreen">Lisää kotinäyttöön…</string> + <string name="add_to">Lisää…</string> + <string name="playlist">Soittolista</string> + <string name="homescreen">Kotinäyttö</string> + <string name="add_to_favorites">Lisää suosikkeihin</string> + <string name="remove_from_favorites">Poista suosikeista</string> + <string name="playlist_favorites">Suosikit</string> + <string name="new_playlist">Uusi soittolista…</string> + <string name="expand">Laajenna</string> + <string name="expand_or_play_all">Laajenna tai toista kaikki</string> + <string name="delete">Poista</string> + <string name="playback_view">Nyt soi</string> + <string name="sort_by">Järjestä</string> + <string name="search">Hae</string> + <string name="done">Valmis</string> + <string name="remove">Poista</string> + <string name="play_or_enqueue">Lisää jonoon jos toistetaan; toista jos keskeytetty</string> + <string name="open">Avaa</string> + <string name="go_home">Kotikansio</string> + <string name="jumping_to_song">Kappale on jo jonossa, ohitetaan…</string> + <!--As a developer, you should always supply "one" and "other" + strings. Your translators will know which strings are actually + needed for their language. Always include %d in "one" because + translators will need to use %d for languages where "one" + doesn't mean 1 (as explained above). + + Translators should use http://unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules and + http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html, Type cardinal, + to see which categories apply to integer numbers in their languages--> + <plurals name="playing"> + <item quantity="one">%d kappale toistossa.</item> + <item quantity="other">%d kappaletta toistossa.</item> + </plurals> + <plurals name="enqueued"> + <item quantity="one">%d kappale jonossa.</item> + <item quantity="other">%d kappaletta jonossa.</item> + </plurals> + <plurals name="added_to_playlist"> + <item quantity="one">%1$d kappale lisätty soittolistaan %2$s.</item> + <item quantity="other">%1$d kappaletta lisätty soittolistaan %2$s.</item> + </plurals> + <plurals name="removed_from_playlist"> + <item quantity="one">%1$d kappale poistettu soittolistalta %2$s.</item> + <item quantity="other">%1$d kappaletta poistettu soittolistalta %2$s.</item> + </plurals> + <plurals name="deleted"> + <item quantity="one">%d kappale poistettu.</item> + <item quantity="other">%d kappaletta poistettu.</item> + </plurals> + <string name="delete_file_failed">Kohteen %s poistaminen epäonnistui.</string> + <string name="deleted_item">\"%s\" poistettu.</string> + <string name="delete_item">Poistetaanko \"%s\"?</string> + <string name="delete_file">Poistetaanko tiedosto \'%s\'?</string> + <string name="artists">Esittäjät</string> + <string name="albums">Albumit</string> + <string name="albumartists">Albumin esittäjät</string> + <string name="composers">Säveltäjät</string> + <string name="songs">Kappaleet</string> + <string name="playlists">Soittolistat</string> + <string name="genres">Tyylilajit</string> + <string name="files">Tiedostot</string> + <string name="artist">Esittäjä</string> + <string name="album">Albumi</string> + <string name="genre">Tyylilaji</string> + <string name="folder">Kansio</string> + <string name="filename">Tiedostonimi</string> + <string name="file_size">Tiedoston koko</string> + <string name="file_time">Muokkausaika</string> + <string name="extension">Pääte</string> + <string name="unknown">Tuntematon</string> + <string name="play_all">Toista kaikki</string> + <string name="enqueue_all">Jonota kaikki</string> + <string name="all_songs">Kaikki kappaleet</string> + <string name="details">Yksityiskohdat</string> + <string name="more_from_artist">Lisää esittäjältä</string> + <string name="more_from_album">Lisää albumilta</string> + <string name="title">Nimi</string> + <string name="number_of_tracks">Kappaleiden määrä</string> + <string name="year">Vuosi</string> + <string name="date_added">Lisäyspäivä</string> + <string name="artist_album">Esittäjä, albumi</string> + <string name="artist_year_album">Esittäjä, vuosi, albumi</string> + <string name="artist_album_track">Esittäjä, albumi, kappalenumero</string> + <string name="artist_album_title">Esittäjä, albumi, nimi</string> + <string name="artist_year">Esittäjä, vuosi</string> + <string name="album_track">Albumi, kappalenumero</string> + <string name="song_playcount">Toistokerrat</string> + <!--Preferences--> + <plurals name="seconds"> + <item quantity="one">%d sekunti</item> + <item quantity="other">%d sekuntia</item> + </plurals> + <plurals name="minutes"> + <item quantity="one">%d minuutti</item> + <item quantity="other">%d minuuttia</item> + </plurals> + <plurals name="hours"> + <item quantity="one">%d tunti</item> + <item quantity="other">%d tuntia</item> + </plurals> + <string name="audio">Ääni</string> + <string name="volume_during_ducking_title">Äänenvoimakkuus ilmoituksen aikana</string> + <string name="volume_during_ducking_summary">Toiston voimakkuus:</string> + <string name="ignore_audiofocus_loss_summary">Jatka toistamista pysyvän äänen kohdistuksen menettämisen jälkeen</string> + <string name="media_button_title">Kuulokkeiden/bluetoothin ohjaimet</string> + <string name="media_button_summary">Vaadittu myös ICS:n lukitusnäytön ohjaimia varten.</string> + <string name="headset_only_title">Vain ulkoinen ulostulo</string> + <string name="headset_only_summary">Estää musiikin soiton sisäisistä kaiuttimista.</string> + <string name="headset_pause_title">Keskeytä kun kuulokkeet irrotetaan</string> + <string name="headset_pause_summary">Keskeytä toisto, kun kuulokkeet irrotetaan.</string> + <string name="headset_launch_title">Toista liitettäessä</string> + <string name="headset_launch_summary">Toista kun kuulokkeet liitetään. (Vaatii Headphone detector -sovelluksen asennuksen.)</string> + <string name="headset_launch_app_missing">Tämä toiminto vaatii Headphone detector -sovelluksen asennuksen.\nHaluatko avata Play-kaupan ja asentaa kyseisen sovelluksen?</string> + <string name="replaygain">ReplayGain</string> + <string name="replaygain_summary">Määritä ReplayGain-tietojen käsittely</string> + <string name="replaygain_track_title">Käytä kappalekohtaista ReplayGainia</string> + <string name="replaygain_track_summary">Toista kaikki kappaleet samalla voimakkuudella</string> + <string name="replaygain_album_title">Käytä albumikohtaista ReplayGainia</string> + <string name="replaygain_album_summary">Säilytä albumin dynamiikka</string> + <string name="replaygain_bump_title">ReplayGainin esivahvistus</string> + <string name="replaygain_untagged_debump_title">Kappaleet ilman ReplayGain-tunnistetta</string> + <string name="replaygain_untagged_debump_summary">Vähennä äänenvoimakkuutta</string> + <string name="replaygain_preamp_note_title">Huomio</string> + <string name="replaygain_preamp_note_content">Android ei salli Vanilla Musicin nostaa äänenvoimakkuutta >100%. Esivahvistuksen asettaminen suurelle arvolle saattaa aiheuttaa ongelmia, jos kuuntelet \"hiljaista\" musiikkia. \n\nSuositellut arvot ovat:\n-> -3dB hiljaiselle/klassiselle musiikille\n-> +3dB 2000-luvun ja uudemmalle musiikille</string> + <string name="disable_gapless_playback_title">Poista tauoton toisto käytöstä</string> + <string name="disable_gapless_playback_summary">Älä käytä tauotonta toistoa, mikä saattaa auttaa toisto-ongelmissa sellaisilla laitteilla, missä on firmware-ohjelmistovirheitä.</string> + <string name="readahead">Käytä etukäteen lukemista</string> + <string name="readahead_summary">Lue eteenpäin toistettavaa kappaletta. Tämä valinta voi auttaa sellaisiin äänen katkeamisongelmiin, mitkä johtuvat hitaasta SD-kortista.</string> + <string name="equalizer">Taajuuskorjain</string> + <string name="cycle_continuous_shuffling">Jatkuva sekoitus</string> + <string name="cycle_continuous_shuffling_summary">\"Sekoitustila\" toistaa kappaleet satunnaisessa järjestyksessä</string> + <string name="notifications">Ilmoitukset</string> + <string name="notification_visibility_title">Ilmoituksen näkyvyys</string> + <string name="notification_action_title">Ilmoitustoiminto</string> + <string name="playback_screen">Toistonäkymä</string> + <string name="playback_on_startup_title">Avaa käynnistäessä</string> + <string name="playback_on_startup_summary">Avaa toistonäkymä käynnistäessä</string> + <string name="display_mode_title">Näyttötila</string> + <string name="swipe_up_action_title">Toiminto ylös vetäessä</string> + <string name="swipe_down_action_title">Toiminto alas vetäessä</string> + <string name="cover_press_action_title">Kansikuvan napautuksen toiminto</string> + <string name="cover_longpress_action_title">Kansikuvan pitkän painalluksen toiminto</string> + <string name="library_screen">Kirjastonäkymä</string> + <string name="default_action_title">Oletustoiminto</string> + <string name="default_playlist_action_title">Soittolistan oletustoiminto</string> + <string name="accelerometer_shake">Kiihtyvyysanturin ravistus</string> + <string name="enable_shake_title">Käytä kiihtyvyysanturin ravistusta</string> + <string name="enable_shake_summary">Käytössä vain, kun musiikkia toistetaan. Ei välttämättä toimi kaikissa laitteissa näytön ollessa sammutettu.</string> + <string name="shake_action_title">Ravistuksen toiminto</string> + <string name="shake_threshold_title">Ravistuksen voiman kynnys</string> + <string name="misc_features">Muut ominaisuudet</string> + <string name="theme">Teema</string> + <string name="disable_lockscreen_title">Estä lukitusnäyttö</string> + <string name="disable_lockscreen_summary">Estä lukitusnäytön aktivoituminen kirjasto- ja toistonäkymässä</string> + <string name="keep_screen_on_title">Pidä näyttö päällä</string> + <string name="keep_screen_on_summary">Pidä näyttö (ja laite) päällä, kun Vanilla Music on esillä</string> + <string name="use_idle_timeout_title">Käytä joutenolon aikakatkaisua</string> + <string name="use_idle_timeout_summary">Kun käytössä, toisto lopetetaan tietyn joutoajan jälkeen</string> + <string name="idle_timeout_title">Joutenolon aikakatkaisu</string> + <string name="enable_scroll_to_song_title">Vieritä kappaleen nimeen</string> + <string name="enable_scroll_to_song_summary">Vieritä parhaillaan toistettavaan kappaleeseen/albumiin/esittäjään kirjastonäkymässä</string> + <string name="queue_enable_scroll_to_song_title">Vieritä kappaleen nimeen jonossa</string> + <string name="queue_enable_scroll_to_song_summary">Vieritä parhaillaan toistettavan kappaleeseen jonossa kappaleen vaihtuessa</string> + <string name="jump_to_enqueued_on_play_title">Siirry jonossa olevaan kappaleeseen \"Toista\"-toiminnosta</string> + <string name="jump_to_enqueued_on_play_summary">Jos pyydetty kappale on jo jonossa, siirry siihen sen sijaan että jono pyyhkiytyy</string> + <string name="coverloader_android_title">Lataa kuvitus Androidista</string> + <string name="coverloader_android_summary">Etsi kuvitusta Androidin sisäisestä mediatietokannasta</string> + <string name="coverloader_vanilla_title">Lataa kuvitus kansiosta</string> + <string name="coverloader_vanilla_summary">Etsi kuvatiedostoja nimeltä cover.jpg, album.jpg tai artwork.jpg ja näytä löytynyt tiedosto kansikuvituksena</string> + <string name="coverloader_shadow_title">Lataa kuvitus piilotetusta kansiosta</string> + <string name="coverloader_shadow_summary">Yritä ladata kuvitus polusta \'/sdcard/Music/.vanilla/ARTIST/ALBUM.jpg\'</string> + <string name="coverloader_inline_title">Lataa kuvitus tiedostotunnisteista</string> + <string name="coverloader_inline_summary">Yritä ladata upotettu kuvitus tiedostotunnisteista</string> + <string name="cover_on_lockscreen_title">Näytä kuvitus lukitusnäytöllä</string> + <string name="cover_on_lockscreen_summary">Näytä toistettavan kappaleen kansikuvitus lukitusnäytöllä</string> + <string name="double_tap_title">Kaksoisnapautus-widget</string> + <string name="double_tap_summary">1x1-widgetin kaksoisnapautus avaa soittimen. Asettaa 400 ms viiveen, ennen kuin widget vastaa toimintoon.</string> + <string name="scrobble_title">Käytä Scrobble Droid API:a</string> + <string name="scrobble_summary">Lähetä kuuntelutiedot Last.fm:ään Scrobble Droidia tai Simple Last.fm Scrobbleria käyttäen</string> + <string name="stock_broadcast_title">Emuloi vakiomuotoisia yleislähetyksiä</string> + <string name="stock_broadcast_summary">Lähetä vakiosoitinta emuloivia yleislähetyksiä. Auttaa kolmansien osapuolten lukitusnäyttöohjainten, widgettien yms. toimivuuden kanssa.</string> + <string name="help">Ohje</string> + <string name="about">Tietoja</string> + <string name="tabs">Välilehtien järjestys</string> + <string name="customize_tab_order">Määritä kirjastovälilehtien järjestys- ja näkymisasetukset</string> + <string name="restore_default">Palauta oletukset</string> + <!--The following are for the list preferences--> + <string name="last_used_action">Viimeksi käytetty toiminto</string> + <string name="never_show">Älä näytä koskaan</string> + <string name="show_when_playing">Näytä toiston aikana (oletus)</string> + <string name="always_show">Näytä aina</string> + <string name="open_main_activity">Avaa kirjasto (oletus)</string> + <string name="open_mini_popup">Avaa pienoisnäkymä</string> + <string name="skip_to_next_song">Siirry seuraavaan kappaleeseen</string> + <string name="open_full_player">Avaa koko soitin</string> + <string name="info_on_cover">Tiedot kansikuvan päällä</string> + <string name="info_below_cover">Tiedot kansikuvan alla</string> + <string name="fixed_info">Tiedot kiinteästi ylhäällä</string> + <string name="do_nothing">Älä tee mitään</string> + <string name="open_library">Avaa kirjasto</string> + <string name="play_pause">Toista/keskeytä</string> + <string name="next_song">Seuraava kappale</string> + <string name="previous_song">Edellinen kappale</string> + <string name="next_album">Seuraava albumi</string> + <string name="previous_album">Edellinen albumi</string> + <string name="cycle_repeat_mode">Liiku kertaustilojen välillä</string> + <string name="cycle_shuffle_mode">Liiku sekoitustilojen välillä</string> + <string name="enqueue_current_album">Lisää albumi jonoon</string> + <string name="enqueue_current_artist">Lisää esittäjä jonoon</string> + <string name="enqueue_current_genre">Lisää lajityyppi jonoon</string> + <string name="enqueue_current">Aseta jonoon…</string> + <string name="more_from_current">Lisää…</string> + <string name="empty_the_queue">Tyhjennä jono</string> + <string name="show_queue">Näytä jono</string> + <string name="hide_queue">Piilota jono</string> + <string name="dequeue_rest">Poista loput jonosta</string> + <string name="toggle_controls">Näytä/piilota ohjaimet</string> + <string name="seek_10s_backward">Siirry 10 sekuntia taakse</string> + <string name="seek_10s_forward">Siirry 10 sekuntia eteen</string> + <string name="move_to_top">Siirrä ylös</string> + <string name="move_to_bottom">Siirrä alas</string> + <string name="preferences_action_show_queue">Näytä jono</string> + <string name="preferences_action_clear_queue">Tyhjennä jono</string> + <string name="preferences_action_enqueue_current_album">Aseta albumi jonoon</string> + <string name="preferences_action_enqueue_current_artist">Aseta esittäjä jonoon</string> + <string name="preferences_action_enqueue_current_genre">Aseta tyylilaji jonoon</string> + <string name="jump_to_time">Siirry aikaan</string> + <string name="time_separator">:</string> + <string name="hour_hint">HH</string> + <string name="minute_hint">MM</string> + <string name="second_hint">SS</string> + <string name="error_invalid_position">Virheellinen arvo</string> + <string name="filebrowser_start">Tiedostohallinnan aloitus</string> + <string name="customize_filebrowser_start">Tiedostonhallinta käynnistyy tästä kansiosta</string> + <string name="select">Valitse</string> + <string name="save">Tallenna</string> + <string name="autoplaylist_playcounts_title">Automaattisen soittolistan luonti</string> + <string name="autoplaylist_playcounts_summary">Luo automaattisesti</string> + <string name="autoplaylist_playcounts_fmt" formatted="false">%s \'Top %.0f\' -soittolista</string> + <string name="autoplaylist_playcounts_disabled">Älä luo automaattista soittolistaa</string> + <string name="autoplaylist_playcounts_name" formatted="false">Top %d</string> + <string name="playlist_sync_mode_title">Soittolistan synkronointi</string> + <string name="playlist_sync_all">Täysi synkronointi</string> + <string name="playlist_sync_only_import">Tuo M3U, älä vie koskaan</string> + <string name="playlist_sync_only_export">Kirjoita M3U, älä tuo koskaan</string> + <string name="playlist_sync_disabled">Pois käytöstä</string> + <string name="playlist_sync_folder_title">Synkronointikansio</string> + <string name="playlist_sync_folder_summary">Soittolistan synkronointiin käytettävä kansio</string> + <string name="playlist_export_relative_paths_title">Vie käyttäen suhteellisia polkuja</string> + <string name="playlist_export_relative_paths_summary">Viittaa tiedostopolkuihin suhteellisena soittolistaan</string> + <string name="permission_request_summary">Vanilla Music tarvitsee lukuoikeuden näyttääkseen musiikkikirjastosi</string> + <string name="reverse_sort">Käänteinen järjestys</string> + <string name="share">Jaa…</string> + <string name="share_failed">Tiedoston jakaminen epäonnistui</string> + <string name="sendto">Lähetä…</string> + <string name="no_receiving_apps">Tälle mediatyypille ei löytynyt vastaanottavia sovelluksia!</string> + <string name="duration">Kesto</string> + <string name="dump_database">Vie tietokanta</string> + <string name="dump_database_result">Tietokanta viety tiedostoon \'%s\'</string> + <string name="force_m3u_import">Pakota M3U-uudelleentuonti</string> + <string name="media_library">Mediakirjasto</string> + <string name="media_folders_header">Indeksoidut kansiot</string> + <string name="media_scan_header">Mediaskanneri</string> + <string name="media_scan_full">Skannaa koko tiedostojärjestelmä (hitaampi)</string> + <string name="media_scan_drop_db">Tyhjennä mediatietokanta</string> + <string name="media_scan_start">Aloita skannaus</string> + <string name="media_scan_force_bastp">Käytä aina sisäänrakennettua tunnistelukijaa</string> + <string name="media_scan_group_albums">Ryhmitä albumit kansioittain</string> + <string name="media_statistics">Tilastot</string> + <string name="media_stats_tracks">Kappaleiden määrä</string> + <string name="media_stats_library_playtime">Toistoaika yhteensä (tunneissa)</string> + <string name="media_stats_listen_playtime">Musiikkia toistettu tunteina yhteensä</string> + <string name="media_stats_progress">Skannauksen edistyminen</string> + <string name="media_library_scan_running">Skannataan mediakirjastoa…</string> + <string name="media_scan_preferences">Skannerivalinnat</string> + <string name="media_scan_preferences_change_title">Skannerivalinnat muuttuivat</string> + <string name="media_scan_preferences_change_message">Tämän valinnan muuttaminen käynnistää kirjaston täyden läpikäynnin. Haluatko jatkaa?</string> + <string name="folder_picker_spinner_desc">Kansion tila:</string> + <!--Folder selector--> + <string name="hint_long_press_to_modify_folder">Pitkä painallus muokkaa kansiovalintoja</string> + <string name="folder_include">Sisällytä</string> + <string name="folder_exclude">Ohita</string> + <string name="folder_neutral">Neutraali</string> + <!--Plugin system--> + <string name="plugins">Liitännäiset</string> + <string name="plugin_needs_upgrade">Päivitä liitännäinen %s uusimpaan versioon</string> + <!--Theme names--> + <string name="theme_name_standard_light">Standardi</string> + <string name="theme_name_standard_dark">Standardi (tumma)</string> + <string name="theme_name_grey_light">Harmaa</string> + <string name="theme_name_grey_dark">Harmaa (tumma)</string> + <string name="theme_name_orange_light">Oranssi</string> + <string name="theme_name_orange_dark">Oranssi (tumma)</string> + <string name="theme_name_blue_light">Sininen</string> + <string name="theme_name_blue_dark">Sininen (tumma)</string> + <string name="theme_name_red_light">Punainen</string> + <string name="theme_name_red_dark">Punainen (tumma)</string> + <string name="theme_name_amoled_dark">Yönmusta (AMOLED)</string> + <string name="theme_name_start_wearing_purple">Pue violettia yllesi</string> +</resources> diff --git a/app/src/main/res/values-fr/translatable.xml b/app/src/main/res/values-fr/translatable.xml new file mode 100644 index 0000000..7a6da61 --- /dev/null +++ b/app/src/main/res/values-fr/translatable.xml @@ -0,0 +1,351 @@ +<?xml version='1.0' encoding='UTF-8'?> +<resources> + <string name="app_name">Vanilla Music</string> + <string name="ok">OK</string> + <string name="cancel">Annuler</string> + <!--Playback Activity (main screen)--> + <string name="no_songs">Aucun morceau trouvé sur votre appareil.</string> + <string name="empty_queue">Aucun morceau sélectionné. Choisissez-en un depuis la bibliothèque ou activez le mode aléatoire en cliquant sur ce message.</string> + <string name="settings">Paramètres</string> + <string name="no_shuffle">Non aléatoire</string> + <string name="shuffle_songs">Morceaux en mode aléatoire</string> + <string name="shuffle_songs_continuously">Morceaux toujours en mode aléatoire</string> + <string name="shuffle_albums">Albums en mode aléatoire</string> + <string name="no_repeat">Ne pas répéter la queue</string> + <string name="repeat">Répéter la queue</string> + <string name="repeat_current_song">Répéter le morceau en cours</string> + <string name="stop_current_song">Arrêt après le morceau en cours</string> + <string name="random">Lire un morceau de l\'appareil au hasard</string> + <string name="random_enabling">Aléatoire activé</string> + <string name="song_load_failed">Échec lors du chargement du morceau %s. Le fichier est peut être corrompu ou manquant.</string> + <string name="queue_cleared">File d\'attente effacée</string> + <string name="cover_art">Jaquette</string> + <string name="close_notification">Fermer la notification</string> + <string name="_genre">genre</string> + <string name="_track">morceau</string> + <string name="_composer">compositeur</string> + <string name="_path">cible</string> + <string name="_format">format</string> + <string name="_title">titre</string> + <string name="_artist">artiste</string> + <string name="_album">album</string> + <string name="_year">année</string> + <string name="_replaygain">gain ReplayGain</string> + <!--New Playlist Dialog--> + <string name="choose_playlist_name">Nom de la playlist</string> + <string name="create">Créer</string> + <string name="overwrite">Remplacer</string> + <string name="delete_playlist">Supprimer la playlist %s?</string> + <!--Library--> + <string name="enqueue">Ajouter à la file d\'attente</string> + <string name="enqueue_as_next">Lire juste après</string> + <string name="play">Lire</string> + <string name="edit">Modifier</string> + <string name="rename">Renommer</string> + <string name="save_as_playlist">Enregistrer en playlist...</string> + <string name="add_to_playlist">Ajouter à une playlist...</string> + <string name="add_to_homescreen">Ajouter à l\'accueil...</string> + <string name="add_to">Ajouter à...</string> + <string name="playlist">Playlist</string> + <string name="homescreen">Ecran d\'accueil</string> + <string name="add_to_favorites">Ajouter aux favoris</string> + <string name="remove_from_favorites">Retirer des favoris</string> + <string name="playlist_favorites">Favoris</string> + <string name="new_playlist">Nouvelle playlist...</string> + <string name="expand">Explorer</string> + <string name="expand_or_play_all">Tout explorer ou tout lire</string> + <string name="delete">Supprimer</string> + <string name="playback_view">En lecture</string> + <string name="sort_by">Trier par</string> + <string name="search">Rechercher</string> + <string name="done">Terminé</string> + <string name="remove">Retirer</string> + <string name="play_or_enqueue">Ajouter à la file d\'attente si en lecture ; Lire si en pause</string> + <string name="open">Ouvrir</string> + <string name="go_home">Dossier principal</string> + <string name="jumping_to_song">Piste déjà en file d\'attente, lecture...</string> + <!--As a developer, you should always supply "one" and "other" + strings. Your translators will know which strings are actually + needed for their language. Always include %d in "one" because + translators will need to use %d for languages where "one" + doesn't mean 1 (as explained above). + + Translators should use http://unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules and + http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html, Type cardinal, + to see which categories apply to integer numbers in their languages--> + <plurals name="playing"> + <item quantity="one">%d morceau en lecture.</item> + <item quantity="many">%d morceaux en lecture.</item> + <item quantity="other">%d morceaux en lecture.</item> + </plurals> + <plurals name="enqueued"> + <item quantity="one">%d morceau ajouté à la file d\'attente.</item> + <item quantity="many">%d morceaux ajoutés à la file d\'attente.</item> + <item quantity="other">%d morceaux ajoutés à la file d\'attente.</item> + </plurals> + <plurals name="added_to_playlist"> + <item quantity="one">%1$d morceau ajouté à la playlist %2$s.</item> + <item quantity="many">%1$d morceaux ajoutés à la playlist %2$s.</item> + <item quantity="other">%1$d morceaux ajoutés à la playlist %2$s.</item> + </plurals> + <plurals name="removed_from_playlist"> + <item quantity="one">%1$d morceau supprimé de la playlist %2$s.</item> + <item quantity="many">%1$d morceaux supprimés de la playlist %2$s.</item> + <item quantity="other">%1$d morceaux supprimés de la playlist %2$s.</item> + </plurals> + <plurals name="deleted"> + <item quantity="one">%d morceau supprimé.</item> + <item quantity="many">%d morceaux supprimés.</item> + <item quantity="other">%d morceaux supprimés.</item> + </plurals> + <string name="delete_file_failed">Échec lors de la suppression %s.</string> + <string name="deleted_item">\'%s\' supprimé.</string> + <string name="delete_item">Supprimer \'%s\'?</string> + <string name="delete_file">Supprimer le fichier \'%s\'?</string> + <string name="artists">Artistes</string> + <string name="albums">Albums</string> + <string name="albumartists">Artiste de l\'album</string> + <string name="composers">Compositeur</string> + <string name="songs">Morceaux</string> + <string name="playlists">Playlists</string> + <string name="genres">Genres</string> + <string name="files">Fichiers</string> + <string name="artist">Artiste</string> + <string name="album">Album</string> + <string name="genre">Genre</string> + <string name="folder">Dossier</string> + <string name="filename">Nom de fichier</string> + <string name="file_size">Taille</string> + <string name="file_time">Date de modification</string> + <string name="extension">Extension</string> + <string name="unknown">Inconnu</string> + <string name="play_all">Tout lire</string> + <string name="enqueue_all">Tout ajouter à la file d\'attente</string> + <string name="all_songs">Tous les morceaux</string> + <string name="details">Détails</string> + <string name="more_from_artist">Filtrer par artiste</string> + <string name="more_from_album">Filtrer par album</string> + <string name="title">Titre</string> + <string name="number_of_tracks">Nombre de pistes</string> + <string name="year">Année</string> + <string name="date_added">Date d\'ajout</string> + <string name="artist_album">Artiste, album</string> + <string name="artist_year_album">Artiste, année, album</string> + <string name="artist_album_track">Artiste, album, numéro de piste</string> + <string name="artist_album_title">Artiste, album, titre</string> + <string name="artist_year">Artiste, année</string> + <string name="album_track">Album, numéro de piste</string> + <string name="song_playcount">Nombre de lectures</string> + <!--Preferences--> + <plurals name="seconds"> + <item quantity="one">%d seconde</item> + <item quantity="many">%d secondes</item> + <item quantity="other">%d secondes</item> + </plurals> + <plurals name="minutes"> + <item quantity="one">%d minute</item> + <item quantity="many">%d minutes</item> + <item quantity="other">%d minutes</item> + </plurals> + <plurals name="hours"> + <item quantity="one">%d heure</item> + <item quantity="many">%d heures</item> + <item quantity="other">%d heures</item> + </plurals> + <string name="audio">Audio</string> + <string name="volume_during_ducking_title">Volume pendant les notifications</string> + <string name="volume_during_ducking_summary">Volume de lecture :</string> + <string name="ignore_audiofocus_loss_summary">Continuer la lecture après une perte complète du focus audio</string> + <string name="media_button_title">Contrôlable par casque/bluetooth</string> + <string name="media_button_summary">Également nécessaire pour les contrôles de l\'écran verrouillé d\'Android ICS</string> + <string name="headset_only_title">Sortie externe seulement</string> + <string name="headset_only_summary">Empêche la lecture depuis les haut-parleurs internes</string> + <string name="headset_pause_title">Mettre en pause à la déconnexion</string> + <string name="headset_pause_summary">Mettre en pause lorsque les écouteurs sont déconnectés.</string> + <string name="headset_launch_title">Lecture à la connexion</string> + <string name="headset_launch_summary">Lecture à la connexion des écouteurs (fonctionne uniquement lorsque l\'application \"Headphone detector\" est installée).</string> + <string name="headset_launch_app_missing">Cette fonctionnalité nécessite l\'installation de l\'application \'Headphone detector\'.\nVoulez vous l\'installer via le Play Store ?</string> + <string name="replaygain">ReplayGain</string> + <string name="replaygain_summary">Configurer la gestion des informations pour ReplayGain</string> + <string name="replaygain_track_title">Activer ReplayGain par morceau</string> + <string name="replaygain_track_summary">Lit tous les morceaux à volume équivalent</string> + <string name="replaygain_album_title">Activer ReplayGain par album</string> + <string name="replaygain_album_summary">Conserve les dynamiques de l\'album</string> + <string name="replaygain_bump_title">Pré-ampli de ReplayGain</string> + <string name="replaygain_untagged_debump_title">Morceaux sans le tag ReplayGain</string> + <string name="replaygain_untagged_debump_summary">Diminuer le volume de</string> + <string name="replaygain_preamp_note_title">Note</string> + <string name="replaygain_preamp_note_content">Android n\'autorise pas Vanilla Music à augmenter le volume au delà de 100%. Un réglage élevé du Pré-ampli peut provoquer des problèmes à l\'écoute de musique \'calme\'. \n\nLes valeurs recommandées sont:\n-> -3dB pour la musique classique/douce\n-> +3dB pour les enregistrements postérieurs à 2000</string> + <string name="readahead">Activer la pré-lecture</string> + <string name="readahead_summary">Pré-lecture du morceau en cours de lecture. Cette option peut résoudre les problèmes de perte de niveau (dus à une carte SD lente)</string> + <string name="equalizer">Égaliseur</string> + <string name="cycle_continuous_shuffling">Mode aléatoire en continu</string> + <string name="cycle_continuous_shuffling_summary">Le \"mode aléatoire\" lira les morceaux dans un ordre totalement aléatoire</string> + <string name="notifications">Notifications</string> + <string name="notification_visibility_title">Affichage de la notification</string> + <string name="notification_action_title">Action de notification</string> + <string name="playback_screen">Écran de lecture</string> + <string name="playback_on_startup_title">Ouvrir au démarrage</string> + <string name="playback_on_startup_summary">Ouvrir l\'écran de lecture au démarrage</string> + <string name="display_mode_title">Mode d\'affichage</string> + <string name="swipe_up_action_title">Action glisser vers le haut</string> + <string name="swipe_down_action_title">Action glisser vers le bas</string> + <string name="cover_press_action_title">Action toucher la jaquette</string> + <string name="cover_longpress_action_title">Action toucher longuement la jaquette</string> + <string name="library_screen">Écran de la bibliothèque</string> + <string name="default_action_title">Action par défaut</string> + <string name="default_playlist_action_title">Action par défaut de la playlist</string> + <string name="accelerometer_shake">Accéléromètre </string> + <string name="enable_shake_title">Activer l\'accéléromètre </string> + <string name="enable_shake_summary">Actif uniquement lorsque la musique est en cours de lecture. Ne fonctionne pas lorsque l\'écran est éteint sur certains appareils.</string> + <string name="shake_action_title">Action de l\'accéléromètre</string> + <string name="shake_threshold_title">Seuil de force de la secousse</string> + <string name="misc_features">Fonctionnalités diverses</string> + <string name="theme">Thème</string> + <string name="disable_lockscreen_title">Désactiver le verrouillage de l\'écran</string> + <string name="disable_lockscreen_summary">Empêche le verrouillage de l\'écran lorsque la bibliothèque ou l\'écran de lecture est affiché</string> + <string name="keep_screen_on_title">Maintenir l\'écran allumé</string> + <string name="keep_screen_on_summary">Maintient l\'écran (et l\'appareil) en éveil lorsque Vanilla est visible</string> + <string name="use_idle_timeout_title">Activer le délai d\'inactivité</string> + <string name="use_idle_timeout_summary">Quand l\'option est activée, la lecture s\'arrêtera après la période d\'inactivité donnée</string> + <string name="idle_timeout_title">Délai d\'inactivité</string> + <string name="enable_scroll_to_song_title">Défiler jusqu\'au titre du morceau</string> + <string name="enable_scroll_to_song_summary">Défile jusqu\'au morceau/album/artiste en cours de lecture dans l\'écran de la bibliothèque</string> + <string name="queue_enable_scroll_to_song_title">Défiler jusqu\'au titre du morceau dans la file d\'attente</string> + <string name="queue_enable_scroll_to_song_summary">Défile jusqu\'au morceau en cours de lecture dans la file d\'attente à chaque changement de piste. </string> + <string name="jump_to_enqueued_on_play_title">Passer au morceau en file d\'attente en appuyant sur \"Lire\"</string> + <string name="jump_to_enqueued_on_play_summary">Si le morceau demandé est déjà dans la liste, passer directement à celui-ci au lieu de vider la liste</string> + <string name="coverloader_android_title">Charger les illustrations depuis Android</string> + <string name="coverloader_android_summary">Interroge la base de données \'media\' interne d\'Android pour les illustrations</string> + <string name="coverloader_vanilla_title">Charger l\'illustration depuis le répertoire</string> + <string name="coverloader_vanilla_summary">Chercher les fichiers de type image nommés cover.jpg, album.jpg ou artwork.jpg et les afficher en tant que jaquette</string> + <string name="coverloader_shadow_title">Charger l\'illustration depuis le répertoire caché</string> + <string name="coverloader_shadow_summary">Essaie de charger l\'illustration depuis \'/sdcard/Music/.vanilla/ARTIST/ALBUM.jpg\'</string> + <string name="coverloader_inline_title">Charger l\'illustration depuis les tags</string> + <string name="coverloader_inline_summary">Tente de charger l\'illustration embarquée dans les tags des fichiers.</string> + <string name="cover_on_lockscreen_title">Afficher la jaquette sur l\'écran de verrouillage</string> + <string name="cover_on_lockscreen_summary">Afficher la jaquette du morceau en lecture sur l\'écran de verrouillage</string> + <string name="double_tap_title">Toucher deux fois le widget</string> + <string name="double_tap_summary">Toucher deux fois le widget 1x1 pour ouvrir le lecteur. Implique un délai de 400ms avant que le widget réponde aux actions.</string> + <string name="scrobble_title">Utiliser l\'API Scrobble Droid</string> + <string name="scrobble_summary">Envoyer l\'information de scrobble à Last.fm grâce à Scrobble Droid ou SimpleLast.fm Scrobbler</string> + <string name="stock_broadcast_title">Emuler les notifications natives</string> + <string name="stock_broadcast_summary">Envoyer les messages de diffusion émulant ceux envoyés par le lecteur d\'origine pour fonctionner avec des contrôles d\'écran de verrouillage tiers, widgets, etc.</string> + <string name="help">Aide</string> + <string name="about">À propos</string> + <string name="tabs">Ordre des onglets</string> + <string name="customize_tab_order">Modifier l\'ordre et la visibilité des onglets de la bibliothèque</string> + <string name="restore_default">Rétablir les paramètres par défaut</string> + <!--The following are for the list preferences--> + <string name="last_used_action">Dernière action</string> + <string name="never_show">Ne jamais afficher</string> + <string name="show_when_playing">Afficher pendant la lecture (défaut)</string> + <string name="always_show">Toujours afficher</string> + <string name="open_main_activity">Ouvrir la bibliothèque (défaut)</string> + <string name="open_mini_popup">Ouvrir mini popup</string> + <string name="skip_to_next_song">Passer au morceau suivant</string> + <string name="open_full_player">Ouvrir le lecteur complet</string> + <string name="info_on_cover">Détails au centre</string> + <string name="info_below_cover">Détails en bas</string> + <string name="fixed_info">Détails en haut</string> + <string name="do_nothing">Ne rien faire</string> + <string name="open_library">Ouvrir la bibliothèque</string> + <string name="play_pause">Lecture/Pause</string> + <string name="next_song">Morceau suivant</string> + <string name="previous_song">Morceau précédent</string> + <string name="next_album">Album suivant</string> + <string name="previous_album">Album précédent</string> + <string name="cycle_repeat_mode">Mode répétition cyclique</string> + <string name="cycle_shuffle_mode">Mode aléatoire cyclique</string> + <string name="enqueue_current_album">Ajouter l\'album à la file d\'attente</string> + <string name="enqueue_current_artist">Ajouter l\'artiste à la file d\'attente</string> + <string name="enqueue_current_genre">Ajouter le genre à la file d\'attente</string> + <string name="enqueue_current">Ajouter à la file d\'attente...</string> + <string name="more_from_current">Accéder à...</string> + <string name="empty_the_queue">Vider la file d\'attente</string> + <string name="show_queue">Afficher la file d\'attente</string> + <string name="hide_queue">Masquer la file d\'attente</string> + <string name="dequeue_rest">Vider la suite de la file d\'attente</string> + <string name="toggle_controls">Afficher/cacher les contrôles</string> + <string name="seek_10s_backward">Aller 10 secondes en arrière</string> + <string name="seek_10s_forward">Aller 10 secondes en avant</string> + <string name="move_to_top">Déplacer au début</string> + <string name="move_to_bottom">Déplacer à la fin</string> + <string name="preferences_action_show_queue">Afficher la file d\'attente</string> + <string name="preferences_action_clear_queue">Effacer la file d\'attente</string> + <string name="preferences_action_enqueue_current_album">Ajouter l\'album à la file d\'attente</string> + <string name="preferences_action_enqueue_current_artist">Ajouter l\'artiste à la file d\'attente</string> + <string name="preferences_action_enqueue_current_genre">Ajouter le genre à la file d\'attente</string> + <string name="jump_to_time">Aller au temps...</string> + <string name="time_separator">:</string> + <string name="hour_hint">HH</string> + <string name="minute_hint">MM</string> + <string name="second_hint">SS</string> + <string name="error_invalid_position">Position invalide</string> + <string name="filebrowser_start">Accueil explorateur de fichier</string> + <string name="customize_filebrowser_start">L\'explorateur de fichier démarre à ce répertoire</string> + <string name="select">Sélectionner</string> + <string name="save">Sauvegarder</string> + <string name="autoplaylist_playcounts_title">Création automatique de playlists </string> + <string name="autoplaylist_playcounts_summary">Créer automatiquement une</string> + <string name="autoplaylist_playcounts_fmt" formatted="false">%s playlist \'Top %.0f\'</string> + <string name="autoplaylist_playcounts_disabled">Ne pas créer de playlist automatique</string> + <string name="autoplaylist_playcounts_name" formatted="false">Top %d</string> + <string name="playlist_sync_mode_title">Synchronisation des playlists</string> + <string name="playlist_sync_all">Synchronisation complète</string> + <string name="playlist_sync_only_import">Importer les .m3u uniquement</string> + <string name="playlist_sync_only_export">Exporter les .m3u uniquement</string> + <string name="playlist_sync_disabled">Désactiver</string> + <string name="playlist_sync_folder_title">Dossier de synchronisation</string> + <string name="playlist_sync_folder_summary">Dossier à utiliser pour la synchronisation des playlists</string> + <string name="playlist_export_relative_paths_title">Exporter avec des chemins relatifs</string> + <string name="playlist_export_relative_paths_summary">Utiliser des chemins de fichiers relatifs à la playlist</string> + <string name="permission_request_summary">Vanilla Music a besoin d\'une permission de lecture pour afficher votre bibliothèque musicale</string> + <string name="reverse_sort">Inverser le tri</string> + <string name="share">Partager</string> + <string name="share_failed">Échec du partage</string> + <string name="sendto">Envoyer à…</string> + <string name="no_receiving_apps">Aucune application trouvée pour ce type de média!</string> + <string name="duration">Durée</string> + <string name="dump_database">Faire une copie de la base de données</string> + <string name="dump_database_result">Base de données enregistrée vers \'%s\'</string> + <string name="force_m3u_import">Forcer la réimportation des .m3u</string> + <string name="media_library">Bibliothèque multimédia</string> + <string name="media_folders_header">Dossiers indexés</string> + <string name="media_scan_header">Scanner médias</string> + <string name="media_scan_full">Scanner tout le système de fichiers (plus long)</string> + <string name="media_scan_drop_db">Nettoyer la base de données multimédia</string> + <string name="media_scan_start">Lancer le scan</string> + <string name="media_scan_force_bastp">Toujours utiliser le lecteur de tag interne</string> + <string name="media_scan_group_albums">Grouper les albums par dossier</string> + <string name="media_statistics">Statistiques</string> + <string name="media_stats_tracks">Nombre de pistes</string> + <string name="media_stats_library_playtime">Durée totale (en heures)</string> + <string name="media_stats_listen_playtime">Durée totale écoutée</string> + <string name="media_stats_progress">Progression du scan</string> + <string name="media_library_scan_running">Scan en cours</string> + <string name="media_scan_preferences">Options du scanner</string> + <string name="media_scan_preferences_change_title">Avertissement</string> + <string name="media_scan_preferences_change_message">Toute modification entraînera un scan complet de la bibliothèque. Voulez-vous continuer ?</string> + <string name="folder_picker_spinner_desc">Statut du Dossier:</string> + <!--Folder selector--> + <string name="hint_long_press_to_modify_folder">Appuyez longuement pour modifier les options des dossiers</string> + <string name="folder_include">Inclure</string> + <string name="folder_exclude">Exclure</string> + <string name="folder_neutral">Neutre</string> + <!--Plugin system--> + <string name="plugins">Plugins</string> + <string name="plugin_needs_upgrade">Veuillez mettre le plugin %s à jour</string> + <!--Theme names--> + <string name="theme_name_standard_light">Standard</string> + <string name="theme_name_standard_dark">Standard (foncé)</string> + <string name="theme_name_grey_light">Gris</string> + <string name="theme_name_grey_dark">Gris (foncé)</string> + <string name="theme_name_orange_light">Orange</string> + <string name="theme_name_orange_dark">Orange (foncé)</string> + <string name="theme_name_blue_light">Bleu</string> + <string name="theme_name_blue_dark">Bleu (foncé)</string> + <string name="theme_name_red_light">Rouge</string> + <string name="theme_name_red_dark">Rouge (foncé)</string> + <string name="theme_name_amoled_dark">Noir profond (écran AMOLED)</string> +</resources> diff --git a/app/src/main/res/values-hu/translatable.xml b/app/src/main/res/values-hu/translatable.xml new file mode 100644 index 0000000..cd60a97 --- /dev/null +++ b/app/src/main/res/values-hu/translatable.xml @@ -0,0 +1,346 @@ +<?xml version='1.0' encoding='UTF-8'?> +<resources> + <string name="app_name">Vanilla zenelejátszó</string> + <string name="ok">OK</string> + <string name="cancel">Mégse</string> + <!--Playback Activity (main screen)--> + <string name="no_songs">Nem találhatóak számok az eszközén.</string> + <string name="empty_queue">Nincs szám kiválasztva. Válasszon a gyűjteményből vagy kapcsolja be a véletlenszerű módot ezt az üzenetet megérintve.</string> + <string name="settings">Beállítások</string> + <string name="no_shuffle">Nincs keverés</string> + <string name="shuffle_songs">Számok lejátszása véletlenszerűen</string> + <string name="shuffle_songs_continuously">Számok folyamatos lejátszása véletlenszerűen</string> + <string name="shuffle_albums">Albumok keverése</string> + <string name="no_repeat">Nincs ismétlés</string> + <string name="repeat">Ismétlés</string> + <string name="repeat_current_song">Jelenlegi szám ismétlése</string> + <string name="stop_current_song">Leállítás ezután a szám után</string> + <string name="random">Véletlenszerű</string> + <string name="random_enabling">Véletlenszerűség engedélyezve</string> + <string name="song_load_failed">Nem sikerült a szám betöltése: %s. Lehet hogy sérült vagy hiányzik.</string> + <string name="queue_cleared">Lejátszási sor ürítve.</string> + <string name="cover_art">Albumborító</string> + <string name="close_notification">Bezárási figyelmeztetés</string> + <string name="_genre">műfaj</string> + <string name="_track">szám</string> + <string name="_composer">zeneszerző</string> + <string name="_path">útvonal</string> + <string name="_format">formátum</string> + <string name="_title">cím</string> + <string name="_artist">előadó</string> + <string name="_album">album</string> + <string name="_year">év</string> + <string name="_replaygain">rgain</string> + <!--New Playlist Dialog--> + <string name="choose_playlist_name">Válasszon lejátszólista nevet</string> + <string name="create">Létrehozás</string> + <string name="overwrite">Felülírás</string> + <string name="delete_playlist">Törli a(z) „%s” lejátszólistát?</string> + <!--Library--> + <string name="enqueue">Sorbaállítás</string> + <string name="enqueue_as_next">Következő lejátszása</string> + <string name="play">Lejátszás</string> + <string name="edit">Szerkesztés</string> + <string name="rename">Átnevezés</string> + <string name="save_as_playlist">Mentés lejátszólistaként…</string> + <string name="add_to_playlist">Hozzáadás a lejátszólistához…</string> + <string name="add_to_homescreen">Hozzáadás a kezdőképernyőhöz…</string> + <string name="add_to">Hozzáadás…</string> + <string name="playlist">Lejátszólista</string> + <string name="homescreen">Kezdőképernyő</string> + <string name="add_to_favorites">Hozzáadás a kedvencekhez</string> + <string name="remove_from_favorites">Eltávolítás a kedvencekből</string> + <string name="playlist_favorites">Kedvencek</string> + <string name="new_playlist">Új lejátszólista…</string> + <string name="expand">Részletek</string> + <string name="expand_or_play_all">Részletek vagy az összes lejátszása</string> + <string name="delete">Törlés</string> + <string name="playback_view">Most játszott</string> + <string name="sort_by">Rendezés</string> + <string name="search">Keresés</string> + <string name="done">Kész</string> + <string name="remove">Eltávolítás</string> + <string name="play_or_enqueue">Sorhoz adás lejátszás közben; Lejátszás ha szüneteltett</string> + <string name="open">Megnyitás</string> + <string name="go_home">Saját könyvtár</string> + <string name="jumping_to_song">A szám már a sorban van, ugrás…</string> + <!--As a developer, you should always supply "one" and "other" + strings. Your translators will know which strings are actually + needed for their language. Always include %d in "one" because + translators will need to use %d for languages where "one" + doesn't mean 1 (as explained above). + + Translators should use http://unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules and + http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html, Type cardinal, + to see which categories apply to integer numbers in their languages--> + <plurals name="playing"> + <item quantity="one">%d szám lejátszása.</item> + <item quantity="other">%d szám lejátszása.</item> + </plurals> + <plurals name="enqueued"> + <item quantity="one">%d szám a sorban.</item> + <item quantity="other">%d szám a sorban.</item> + </plurals> + <plurals name="added_to_playlist"> + <item quantity="one">%1$d szám a(z) %2$s lejátszólistához adva.</item> + <item quantity="other">%1$d szám a(z) %2$s lejátszólistához adva.</item> + </plurals> + <plurals name="removed_from_playlist"> + <item quantity="one">%1$d szám eltávolítva a(z) %2$s lejátszólistáról.</item> + <item quantity="other">%1$d szám eltávolítva a(z) %2$s lejátszólistáról.</item> + </plurals> + <plurals name="deleted"> + <item quantity="one">%d szám törölve.</item> + <item quantity="other">%d szám törölve.</item> + </plurals> + <string name="delete_file_failed">Nem sikerült törölni: %s.</string> + <string name="deleted_item">„%s” törölve.</string> + <string name="delete_item">Törli ezt: „%s”?</string> + <string name="delete_file">Törli a(z) „%s” fájlt?</string> + <string name="artists">Előadók</string> + <string name="albums">Albumok</string> + <string name="albumartists">Album előadók</string> + <string name="composers">Zeneszerzők</string> + <string name="songs">Számok</string> + <string name="playlists">Lejátszólisták</string> + <string name="genres">Műfajok</string> + <string name="files">Fájlok</string> + <string name="artist">Előadó</string> + <string name="album">Album</string> + <string name="genre">Műfaj</string> + <string name="folder">Mappa</string> + <string name="filename">Fájlnév</string> + <string name="file_size">Fájlméret</string> + <string name="file_time">Módosítás ideje</string> + <string name="extension">Kiterjesztés</string> + <string name="unknown">Ismeretlen</string> + <string name="play_all">Összes lejátszása</string> + <string name="enqueue_all">Összes sorbaállítása</string> + <string name="all_songs">Minden szám</string> + <string name="details">Részletek</string> + <string name="more_from_artist">Több ettől az előadótól</string> + <string name="more_from_album">Több erről az albumról</string> + <string name="title">Cím</string> + <string name="number_of_tracks">Számok sorszáma</string> + <string name="year">Év</string> + <string name="date_added">Hozzáadás dátuma</string> + <string name="artist_album">Előadó, album</string> + <string name="artist_year_album">Előadó, év, album</string> + <string name="artist_album_track">Előadó, album, szám sorszáma</string> + <string name="artist_album_title">Előadó, album, cím</string> + <string name="artist_year">Előadó, év</string> + <string name="album_track">Album, szám sorszáma</string> + <string name="song_playcount">Lejátszások száma</string> + <!--Preferences--> + <plurals name="seconds"> + <item quantity="one">%d másodperc</item> + <item quantity="other">%d másodperc</item> + </plurals> + <plurals name="minutes"> + <item quantity="one">%d perc</item> + <item quantity="other">%d perc</item> + </plurals> + <plurals name="hours"> + <item quantity="one">%d óra</item> + <item quantity="other">%d óra</item> + </plurals> + <string name="audio">Hang</string> + <string name="volume_during_ducking_title">Hangerő értesítések alatt</string> + <string name="volume_during_ducking_summary">Lejátszási hangerő:</string> + <string name="ignore_audiofocus_loss_summary">Lejátszás folytatása az audió fókusz végleges elvesztésekor</string> + <string name="media_button_title">Headset/Bluetooth vezérlés</string> + <string name="media_button_summary">Ez az ICS képernyőzár kezelőszerveihez is szükséges.</string> + <string name="headset_only_title">Csak külső kimenet</string> + <string name="headset_only_summary">Megakadályozza, hogy a beépített hangszórókon szóljon a zene.</string> + <string name="headset_pause_title">Szüneteltetés szétcsatlakozáskor</string> + <string name="headset_pause_summary">Szüneteltetés a fejhallgató kihúzásakor.</string> + <string name="headset_launch_title">Lejátszás csatlakoztatáskor</string> + <string name="headset_launch_summary">Lejátszás, ha a fejhallgató csatlakozik. (Ehhez szükséges a „Fejhallgató érzékelő” alkalmazás.)</string> + <string name="headset_launch_app_missing">Ehhez a funkcióhoz szükséges a „Fejhallgató érzékelő” alkalmazás telepítése.\nSzeretné megnyitni a Play Áruházat és telepíteni az alkalmazást?</string> + <string name="replaygain">ReplayGain</string> + <string name="replaygain_summary">ReplayGain információk kezelésének beállítása</string> + <string name="replaygain_track_title">Számonkénti ReplayGain engedélyezése</string> + <string name="replaygain_track_summary">Minden szám ugyanolyan hangos lejátszása</string> + <string name="replaygain_album_title">Album ReplayGain engedélyezése</string> + <string name="replaygain_album_summary">Album dinamika megőrzése</string> + <string name="replaygain_bump_title">ReplayGain előerősítés</string> + <string name="replaygain_untagged_debump_title">Számok ReplayGain címke nélkül</string> + <string name="replaygain_untagged_debump_summary">Hangerő csökkentése</string> + <string name="replaygain_preamp_note_title">Megjegyzés</string> + <string name="replaygain_preamp_note_content">Az Android nem engedi hogy a Vanilla Zenelejátszó >100% értékre állítsa a hangerőt. Az előerősítés értékének túl magasra emelése problémákat okozhat, ha „halk” zenét hallgat.\n\nAz ajánlott értékek:\n-> -3dB halk/klasszikus zenéhez\n-> +3dB a 2000 utáni felvételekhez</string> + <string name="disable_gapless_playback_title">Szünetmentes lejátszás kikapcsolása</string> + <string name="disable_gapless_playback_summary">A szünetmentes lejátszás használatának mellőzése segíthet a hibás firmware-rel rendelkező eszközök lejátszási problémáin</string> + <string name="readahead">Előreolvasás engedélyezése</string> + <string name="readahead_summary">Előre felolvassa a jelenleg játszott számot. Ez megoldhatja a „hangkiesés” problémákat. (amit a lassú SD kártya okoz)</string> + <string name="equalizer">Hangszínszabályzó</string> + <string name="cycle_continuous_shuffling">Folyamatos keverés</string> + <string name="cycle_continuous_shuffling_summary">A „véletlenszerű lejátszási mód” teljesen véletlen sorrendben játsza le a számokat.</string> + <string name="notifications">Értesítések</string> + <string name="notification_visibility_title">Értesítések láthatósága</string> + <string name="notification_action_title">Értesítési művelet</string> + <string name="playback_screen">Lejátszási képernyő</string> + <string name="playback_on_startup_title">Megnyitás indításkor</string> + <string name="playback_on_startup_summary">A lejátszási nézet megjelenítési indításkor</string> + <string name="display_mode_title">Megjelenítési mód</string> + <string name="swipe_up_action_title">Felfelé csúsztatás művelet</string> + <string name="swipe_down_action_title">Lefelé csúsztatás művelet</string> + <string name="cover_press_action_title">Borító érintési művelet</string> + <string name="cover_longpress_action_title">Borító hosszú megnyomási művelet</string> + <string name="library_screen">Gyűjtemény képernyő</string> + <string name="default_action_title">Alapértelmezett művelet</string> + <string name="default_playlist_action_title">Alapértelmezett lejátszólista művelet</string> + <string name="accelerometer_shake">Gyorsulásmérő rázás</string> + <string name="enable_shake_title">A gyorsulásmérő rázás engedélyezése</string> + <string name="enable_shake_summary">Csak akkor aktív, ha van lejátszás. Néhány eszközön nem működik, ha a kijelző ki van kapcsolva.</string> + <string name="shake_action_title">Rázási művelet</string> + <string name="shake_threshold_title">Rázási erő határérték</string> + <string name="misc_features">Egyéb funkció</string> + <string name="theme">Téma</string> + <string name="disable_lockscreen_title">Zárképernyő letiltása</string> + <string name="disable_lockscreen_summary">A zárképernyő letiltása a gyűjtemény és a lejátszás képernyőknél</string> + <string name="keep_screen_on_title">Képernyő bekapcsolva tartása</string> + <string name="keep_screen_on_summary">A képernyő (és az eszköz) ébren tartása, ha a Vanilla Music látható</string> + <string name="use_idle_timeout_title">Tétlenségi időtúllépés engedélyezése</string> + <string name="use_idle_timeout_summary">Ha aktív, akkor a lejátszás leállításra kerül a megadott tétlenségi idő lejárta után</string> + <string name="idle_timeout_title">Tétlenségi időtúllépés</string> + <string name="enable_scroll_to_song_title">Görgetés a szám címéhez</string> + <string name="enable_scroll_to_song_summary">Görgetés a most játszott számhoz/albumhoz/előadóhoz a gyűjtemény listákban</string> + <string name="queue_enable_scroll_to_song_title">Görgetés a szám címéhez a sorban</string> + <string name="queue_enable_scroll_to_song_summary">Görgetés a most játszott számhoz a sorban számváltáskor</string> + <string name="jump_to_enqueued_on_play_title">Ugrás a sorba állított számra lejátszáskor</string> + <string name="jump_to_enqueued_on_play_summary">Ha a kért szám már sorba van állítva, akkor ugrás hozzá a teljes sor kiürítése helyett</string> + <string name="coverloader_android_title">Borítók betöltése az Androidból</string> + <string name="coverloader_android_summary">Az Android belső adatbázisának lekérdezése az albumborítóért</string> + <string name="coverloader_vanilla_title">Borítók betöltése mappából</string> + <string name="coverloader_vanilla_summary">Cover.jpg, album.jpg vagy artwork.jpg nevű fájlok keresése és megjelenítése mint albumborító</string> + <string name="coverloader_shadow_title">Borítók betöltése rejtett mappából</string> + <string name="coverloader_shadow_summary">Borító betöltésének kísérlete innen: „/sdcard/Music/.vanilla/ARTIST/ALBUM.jpg”</string> + <string name="coverloader_inline_title">Borítók betöltése a fájlcímkékből</string> + <string name="coverloader_inline_summary">Próbálja meg a fájlcímkékbe ágyazott borítókat betölteni</string> + <string name="cover_on_lockscreen_title">Borító megjelenítése a zárképernyőn</string> + <string name="cover_on_lockscreen_summary">A most játszott szám albumborítójának megjelenítése a zárképernyőn</string> + <string name="double_tap_title">Dupla érintés a vezérlőelemen</string> + <string name="double_tap_summary">Az 1x1-es verzérlőelem a dupla érintés megnyitja a lejátszót. 400ms késleltés történik mielőtt a vezérlőelem válaszol a műveletekre.</string> + <string name="scrobble_title">A Scrobble Droid API használata</string> + <string name="scrobble_summary">Megosztás a Last.fm-el a Scrobble Droidon vagy a Simple Last.fm Scrobbleren keresztül</string> + <string name="stock_broadcast_title">Gyári események utánzása</string> + <string name="stock_broadcast_summary">A gyári médialejátszó eseményeinek utánzása, a harmadik fél által készített zárképernyőkkel és vezérlőelemekkel való együttműködés miatt.</string> + <string name="help">Súgó</string> + <string name="about">Névjegy</string> + <string name="tabs">Lapfülek sorrendje</string> + <string name="customize_tab_order">A gyűjtemény lapfüleinek sorrendjének és láthatóságának beállítása</string> + <string name="restore_default">Alapértelmezés visszaállítása</string> + <!--The following are for the list preferences--> + <string name="last_used_action">Utoljára használt művelet</string> + <string name="never_show">Sose mutassa</string> + <string name="show_when_playing">Megjelenítés lejátszás közben (alapértelmezett)</string> + <string name="always_show">Mindig mutassa</string> + <string name="open_main_activity">Gyűjtemény megnyitása (alapértelmezett)</string> + <string name="open_mini_popup">Apró felugró ablak megnyitása</string> + <string name="skip_to_next_song">Ugrás a következő számra</string> + <string name="open_full_player">Teljes lejátszó megnyitása</string> + <string name="info_on_cover">Információk az albumborítón</string> + <string name="info_below_cover">Információk az albumborító alatt</string> + <string name="fixed_info">Információk fixen a tetején</string> + <string name="do_nothing">Ne tegyen semmit</string> + <string name="open_library">Gyűjtemény megnyitása</string> + <string name="play_pause">Lejátszás/Szüneteltetés</string> + <string name="next_song">Következő szám</string> + <string name="previous_song">Előző szám</string> + <string name="next_album">Következő album</string> + <string name="previous_album">Előző album</string> + <string name="cycle_repeat_mode">Ismétlési mód állítása</string> + <string name="cycle_shuffle_mode">Keverési mód állítása</string> + <string name="enqueue_current_album">Album sorba állítása</string> + <string name="enqueue_current_artist">Előadó sorba állítása</string> + <string name="enqueue_current_genre">Műfaj sorba állítása</string> + <string name="enqueue_current">Sorbaállítás…</string> + <string name="more_from_current">Több innen…</string> + <string name="empty_the_queue">Lejátszási sor ürítése</string> + <string name="show_queue">Lejátszási sor megjelenítése</string> + <string name="hide_queue">Lejátszási sor elrejtése</string> + <string name="dequeue_rest">Hátralévők eltávolítása</string> + <string name="toggle_controls">Vezérlőelemek megjelenítése</string> + <string name="seek_10s_backward">Léptetés 10 másodperccel hátra</string> + <string name="seek_10s_forward">Léptetés 10 másodperccel előre</string> + <string name="move_to_top">Áthelyezés a tetejére</string> + <string name="move_to_bottom">Áthelyezés az aljára</string> + <string name="preferences_action_show_queue">Lejátszási sor megjelenítése</string> + <string name="preferences_action_clear_queue">Lejátszási sor ürítése</string> + <string name="preferences_action_enqueue_current_album">Album sorba állítása</string> + <string name="preferences_action_enqueue_current_artist">Előadó sorba állítása</string> + <string name="preferences_action_enqueue_current_genre">Műfaj sorba állítása</string> + <string name="jump_to_time">Időponthoz ugrás</string> + <string name="time_separator">:</string> + <string name="hour_hint">ÓÓ</string> + <string name="minute_hint">PP</string> + <string name="second_hint">MM</string> + <string name="error_invalid_position">Érvénytelen pozíció</string> + <string name="filebrowser_start">Fájlböngésző kezdőmappája</string> + <string name="customize_filebrowser_start">A fájlböngésző ebben a mappában indul</string> + <string name="select">Kiváalsztás</string> + <string name="save">Mentés</string> + <string name="autoplaylist_playcounts_title">Automatikus lejátszólista-létrehozás</string> + <string name="autoplaylist_playcounts_summary">Hozzon létre automatikusan egy</string> + <string name="autoplaylist_playcounts_fmt" formatted="false">%s „Legjobb %.0f” lejátszólistát</string> + <string name="autoplaylist_playcounts_disabled">Ne hozzon létre automatikusan lejátszólistát</string> + <string name="autoplaylist_playcounts_name" formatted="false">Legjobb %d</string> + <string name="playlist_sync_mode_title">Lejátszólista szinkronizáció</string> + <string name="playlist_sync_all">Teljes szinkronizáció</string> + <string name="playlist_sync_only_import">M3U importálása, sose exportálja</string> + <string name="playlist_sync_only_export">M3U írása, sose importálja</string> + <string name="playlist_sync_disabled">Letiltva</string> + <string name="playlist_sync_folder_title">Szinkronizációs mappa</string> + <string name="playlist_sync_folder_summary">A lejátszólista szinkronizációhoz használandó mappa</string> + <string name="playlist_export_relative_paths_title">Exportálás relatív útvonalak használatáva</string> + <string name="playlist_export_relative_paths_summary">A fájlok relatív hivatkozása a lejátszólistához képest</string> + <string name="permission_request_summary">A Vanilla zenelejátszónak olvasási engedélyre van szükségre, hogy megjelenítse a gyűjteményét</string> + <string name="reverse_sort">Fordított rendezés</string> + <string name="share">Megosztás…</string> + <string name="share_failed">A fájl megosztása meghiúsult</string> + <string name="sendto">Küldés…</string> + <string name="no_receiving_apps">Nem található fogadó alkalmazás ehhez a médiatípushoz!</string> + <string name="duration">Hossz</string> + <string name="dump_database">Adatbázis kiírása</string> + <string name="dump_database_result">Adatbázis kiírva ide: „%s”</string> + <string name="force_m3u_import">M3U kényszerített újraimportálása</string> + <string name="media_library">Médiagyűjtemény</string> + <string name="media_folders_header">Indexelt könyvtárak</string> + <string name="media_scan_header">Médiaátvizsgáló</string> + <string name="media_scan_full">Teljes fájlrendszer átvizsgálása (lassabb)</string> + <string name="media_scan_drop_db">Média-adatbázis kiírása</string> + <string name="media_scan_start">Átvizsgálás indítása</string> + <string name="media_scan_force_bastp">Mindig a beépített címkeolvasót használja</string> + <string name="media_scan_group_albums">Albumok csoportosítása mappánként</string> + <string name="media_statistics">Statisztika</string> + <string name="media_stats_tracks">Számok darabszáma</string> + <string name="media_stats_library_playtime">Teljes lejátszási idő (órában)</string> + <string name="media_stats_listen_playtime">Eddig lejátszott zene hossza órákban</string> + <string name="media_stats_progress">Átvizsgálás folyamata</string> + <string name="media_library_scan_running">Médiagyűjtemény átvizsgálása…</string> + <string name="media_scan_preferences">Átvizsgáló beállítások</string> + <string name="media_scan_preferences_change_title">Átvizsgáló beállítások módosítva</string> + <string name="media_scan_preferences_change_message">A beállítás megváltoztatása a gyűjtemény teljes átvizsgálását okozza. Folytatja?</string> + <string name="folder_picker_spinner_desc">Könyvtár állapota:</string> + <!--Folder selector--> + <string name="hint_long_press_to_modify_folder">Nyomja meg hosszan a mappabeállítások módosításához</string> + <string name="folder_include">Belevétel</string> + <string name="folder_exclude">Kihagyás</string> + <string name="folder_neutral">Semleges</string> + <!--Plugin system--> + <string name="plugins">Bővítmények</string> + <string name="plugin_needs_upgrade">Frissítse a(z) %s bővítményt a legfrissebb verzióra</string> + <!--Theme names--> + <string name="theme_name_standard_light">Szokásos</string> + <string name="theme_name_standard_dark">Szokásos (Sötét)</string> + <string name="theme_name_grey_light">Szürke</string> + <string name="theme_name_grey_dark">Szürke (Sötét)</string> + <string name="theme_name_orange_light">Narancs</string> + <string name="theme_name_orange_dark">Narancs (Sötét)</string> + <string name="theme_name_blue_light">Kék</string> + <string name="theme_name_blue_dark">Kék (Sötét)</string> + <string name="theme_name_red_light">Vörös</string> + <string name="theme_name_red_dark">Vörös (Sötét)</string> + <string name="theme_name_amoled_dark">Koromfekete (AMOLED)</string> + <string name="theme_name_start_wearing_purple">Kezdjen el lilát hordani</string> +</resources> diff --git a/app/src/main/res/values-in/translatable.xml b/app/src/main/res/values-in/translatable.xml new file mode 100644 index 0000000..d22c10e --- /dev/null +++ b/app/src/main/res/values-in/translatable.xml @@ -0,0 +1,241 @@ +<?xml version='1.0' encoding='UTF-8'?> +<resources> + <string name="app_name">Vanilla Music</string> + <string name="ok">OK</string> + <string name="cancel">Batal</string> + <!--Playback Activity (main screen)--> + <string name="no_songs">Tidak ada lagu ditemukan dalam perangkat Anda.</string> + <string name="empty_queue">Tidak ada lagu dipilih. Silakan pilih dari pustaka atau masukkan modus acak dengan mengetuk pesan ini.</string> + <string name="settings">Pengaturan</string> + <string name="no_shuffle">Jangan Acak</string> + <string name="shuffle_songs">Acak lagu</string> + <string name="shuffle_songs_continuously">Acak lagu berkelanjutan</string> + <string name="shuffle_albums">Acak Album</string> + <string name="no_repeat">Jangan diulang</string> + <string name="repeat">Ulangi</string> + <string name="repeat_current_song">Ulangi lagu saat ini</string> + <string name="stop_current_song">Berhenti setelah lagu saat ini</string> + <string name="random">Acak</string> + <string name="random_enabling">Secara acak diaktifkan</string> + <string name="song_load_failed">Gagal memuat lagu %s. Kemungkinan berkas rusak atau hilang.</string> + <string name="queue_cleared">Daftar lagu dibersihkan</string> + <string name="cover_art">Kover Album</string> + <string name="close_notification">Tutup notifikasi</string> + <string name="_genre">Genre</string> + <string name="_track">Lagu</string> + <string name="_composer">Penulis</string> + <string name="_path">lajur</string> + <string name="_format">Format</string> + <string name="_title">Judul</string> + <string name="_artist">Artis</string> + <string name="_album">album</string> + <string name="_year">tahun</string> + <string name="_replaygain">psuara</string> + <!--New Playlist Dialog--> + <string name="choose_playlist_name">Pilih nama daftar putar</string> + <string name="create">Buat</string> + <string name="overwrite">Timpa</string> + <string name="delete_playlist">Hapus daftar putar $s?</string> + <!--Library--> + <string name="enqueue">Daftar antri</string> + <string name="enqueue_as_next">Mainkan selanjutnya</string> + <string name="play">Putar</string> + <string name="edit">Ubah</string> + <string name="rename">Ganti nama</string> + <string name="save_as_playlist">Simpan daftar putar </string> + <string name="add_to_playlist">Tambahkan ke daftar putar</string> + <string name="add_to_homescreen">Tambahkan ke layar beranda…</string> + <string name="add_to">Tambahkan ke...</string> + <string name="playlist">Daftar putar</string> + <string name="homescreen">Tampilan layar</string> + <string name="add_to_favorites">Tambahkan ke favorit</string> + <string name="remove_from_favorites">Hapus dari favorit</string> + <string name="playlist_favorites">Kesukaan</string> + <string name="new_playlist">Daftar putar baru</string> + <string name="expand">Tampilkan</string> + <string name="expand_or_play_all">Buka atau putar semua</string> + <string name="delete">Hapus</string> + <string name="playback_view">Sedang diputar</string> + <string name="sort_by">Urut berdasarkan</string> + <string name="search">Cari</string> + <string name="done">Selesai</string> + <string name="remove">Hapus</string> + <string name="play_or_enqueue">Diurutkan bila diputar; Putar bila di pause</string> + <string name="open">Open</string> + <string name="go_home">Beranda</string> + <string name="jumping_to_song">Lagu sudah ada di antrian, pindah ...</string> + <!--As a developer, you should always supply "one" and "other" + strings. Your translators will know which strings are actually + needed for their language. Always include %d in "one" because + translators will need to use %d for languages where "one" + doesn't mean 1 (as explained above). + + Translators should use http://unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules and + http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html, Type cardinal, + to see which categories apply to integer numbers in their languages--> + <plurals name="playing"> + <item quantity="other">%d trek diputar</item> + </plurals> + <plurals name="enqueued"> + <item quantity="other">%d trek di antrian</item> + </plurals> + <plurals name="added_to_playlist"> + <item quantity="other">%1$d lagu ditambahkan ke daftar putar %2$s.</item> + </plurals> + <plurals name="removed_from_playlist"> + <item quantity="other">%1$d lagu dibuang dari daftar putar %2$s.</item> + </plurals> + <plurals name="deleted"> + <item quantity="other">%d lagu dihapus.</item> + </plurals> + <string name="delete_file_failed">Gagal menghapus %s.</string> + <string name="deleted_item">\'%s\' terhapus.</string> + <string name="delete_item">Hapus \'%s\'?</string> + <string name="delete_file">Hapus berkas \'%s\'?</string> + <string name="artists">Artis</string> + <string name="albums">Album</string> + <string name="albumartists">Album Artis</string> + <string name="composers">Komponis</string> + <string name="songs">Lagu</string> + <string name="playlists">Daftar Putar</string> + <string name="genres">Genre</string> + <string name="files">Berkas</string> + <string name="artist">Artis</string> + <string name="album">Album</string> + <string name="genre">Genre</string> + <string name="folder">Folder</string> + <string name="filename">Nama berkas</string> + <string name="file_size">Ukuran berkas</string> + <string name="file_time">Diubah</string> + <string name="extension">Ekstensi</string> + <string name="unknown">Tidak diketahui</string> + <string name="play_all">Mainkan semua</string> + <string name="enqueue_all">Antrekan semua</string> + <string name="all_songs">Seluruh lagu</string> + <string name="details">Detail</string> + <string name="more_from_artist">Selanjutnya dari artis</string> + <string name="more_from_album">selanjutnya dari album</string> + <string name="title">Judul</string> + <string name="number_of_tracks">Jumlah lagu</string> + <string name="year">Tahun</string> + <string name="date_added">Tanggal ditambah</string> + <string name="artist_album">Artis, album</string> + <string name="artist_year_album">Artis, tahun, album</string> + <string name="artist_album_track">Artis, album, urutan lagu</string> + <string name="artist_album_title">Artis, album, judul</string> + <string name="artist_year">Artis, tahun</string> + <string name="album_track">Album, urutan lagu</string> + <string name="song_playcount">Kali main</string> + <!--Preferences--> + <plurals name="seconds"> + <item quantity="other">%d detik</item> + </plurals> + <plurals name="minutes"> + <item quantity="other">%d menit</item> + </plurals> + <plurals name="hours"> + <item quantity="other">%d jam</item> + </plurals> + <string name="audio">Audio</string> + <string name="volume_during_ducking_title">Volume suara selama notifikasi</string> + <string name="volume_during_ducking_summary">Volume main ulang:</string> + <string name="ignore_audiofocus_loss_summary">Tetap mainkan saat kehilangan fokus suara</string> + <string name="media_button_title">Pengendali Set Kepala/Bluetooth</string> + <string name="media_button_summary">Membutuhkan kontrol pengunci layar ICS</string> + <string name="headset_only_title">Hanya luaran ekternal</string> + <string name="headset_only_summary">Non-aktifkan pengeras suara internal</string> + <string name="headset_pause_title">Jeda saat dicabut</string> + <string name="headset_pause_summary">Berhentikan ketika headphone dicabut</string> + <string name="headset_launch_title">Mainkan saat terpasang</string> + <string name="headset_launch_summary">Mainkan saat set kepala terpasang. (Membutuhkan aplikasi Pendeteksi Set Kepala terpasang.)</string> + <string name="headset_launch_app_missing">Fungsi ini membutuhkan aplikasi Pendeteksi Set Kepala terpasang.\nApakah Anda ingin membuka Play Store untuk memasangnya?</string> + <string name="replaygain">Penyeimbang Suara</string> + <string name="replaygain_summary">Atur penanganan informasi Penyeimbang Suara </string> + <string name="replaygain_track_title">Aktifkan Penyeimbang Suara tiap lagu</string> + <string name="replaygain_track_summary">Putar semua lagu dengan keras suara sama</string> + <string name="replaygain_album_title">Aktifkan Penyeimbang Suara album</string> + <string name="replaygain_album_summary">Pertahankan dinamik album</string> + <string name="replaygain_bump_title">Prapenguatan Penyeimbang Suara</string> + <string name="replaygain_untagged_debump_title">Lagu tanpa penanda Penyeimbang Suara</string> + <string name="replaygain_untagged_debump_summary">Kurangi suara </string> + <string name="replaygain_preamp_note_title">Catatan</string> + <string name="readahead">Aktifkan Tembolok</string> + <string name="readahead_summary">Gunakan tembolok untuk lagu yang mainkan. Pilihan ini mungkin dapat menyelesaikan masalah penurunan suara yang disebabkan oleh Kartu SD lambat.</string> + <string name="cycle_continuous_shuffling">Secara acak</string> + <string name="cycle_continuous_shuffling_summary">Modus Acak akan memainkan lagu dengan urutan acak</string> + <string name="notifications">Pemberitahuan</string> + <string name="notification_visibility_title">Visibilitas notifikasi</string> + <string name="notification_action_title">Aksi pemberitahuan</string> + <string name="playback_screen">Layar pemutaran</string> + <string name="playback_on_startup_title">Buka waktu startup</string> + <string name="playback_on_startup_summary">Buka tampilan pemutaran saat memulai</string> + <string name="display_mode_title">Mode tampilan</string> + <string name="swipe_up_action_title">Aksi gesek keatas</string> + <string name="swipe_down_action_title">Tindakan geser ke bawah</string> + <string name="cover_press_action_title">Tindakan ketuk pada kover</string> + <string name="cover_longpress_action_title">Tindakan sentuh lama pada kover</string> + <string name="library_screen">Layar pustaka</string> + <string name="default_action_title">Tindakan default</string> + <string name="default_playlist_action_title">Tindakan daftar putar default</string> + <string name="enable_shake_summary">Hanya saat musik dimainkan. Tidak dapat bekerja saat layar mati dalam beberapa perangkat.</string> + <string name="misc_features">Fitur tambahan</string> + <string name="theme">Tema</string> + <string name="disable_lockscreen_title">Nonaktifkan pengunci layar</string> + <string name="keep_screen_on_title">Layar selalu hidup</string> + <string name="enable_scroll_to_song_title">Tukik judul lagu</string> + <string name="enable_scroll_to_song_summary">Tukik lagu/album/artis saat ini dalam daftar pustaka</string> + <string name="cover_on_lockscreen_summary">Tampilkan sampul dari lagu yang dimainkan saat ini dalam pengunci layar</string> + <string name="help">Bantuan</string> + <string name="about">Tentang</string> + <string name="tabs">Urutan tab</string> + <string name="restore_default">Pulihkan ke awal</string> + <!--The following are for the list preferences--> + <string name="never_show">Jangan pernah tampilkan</string> + <string name="show_when_playing">Tampilkan ketika diputar (bawaan)</string> + <string name="always_show">Selalu tampilkan</string> + <string name="open_main_activity">Buka daftar media(bawaan)</string> + <string name="open_mini_popup">Tampilkan popup kecil</string> + <string name="skip_to_next_song">Lompat ke lagu selanjutnya</string> + <string name="open_full_player">Buka dilayar penuh</string> + <string name="info_on_cover">Info di kover album</string> + <string name="info_below_cover">Info dibawah kover album</string> + <string name="fixed_info">Info tetap berada diatas</string> + <string name="do_nothing">Tidak melakukan apapun</string> + <string name="open_library">Buka daftar media</string> + <string name="play_pause">Putar/Berhenti</string> + <string name="next_song">Lagu selanjutnya</string> + <string name="previous_song">Lagu sebelumnya</string> + <string name="next_album">Album selanjutnya</string> + <string name="previous_album">Album sebelumnya</string> + <string name="cycle_repeat_mode">Diputar ulang</string> + <string name="cycle_shuffle_mode">Diputar acak</string> + <string name="enqueue_current_album">Antrian Album</string> + <string name="enqueue_current_artist">Antrian Artis</string> + <string name="enqueue_current_genre">Antrian jenis musk</string> + <string name="enqueue_current">Daftar antrian</string> + <string name="more_from_current">Lebih banyak ...</string> + <string name="empty_the_queue">Antrian kosong</string> + <string name="show_queue">Tampilkan antrian</string> + <string name="hide_queue">Sembunyikan antrian</string> + <string name="dequeue_rest">Selebihnya hilangkan dari antrian</string> + <string name="toggle_controls">Tampilkan kontrol</string> + <string name="seek_10s_backward">Mundur kebelakang 10 detik</string> + <string name="seek_10s_forward">Maju kedepan 10 detik</string> + <string name="preferences_action_show_queue">Tampilkan antrian</string> + <string name="preferences_action_clear_queue">Bersihkan antrian</string> + <string name="preferences_action_enqueue_current_album">Antrian Album</string> + <string name="preferences_action_enqueue_current_artist">Antrian Artis</string> + <string name="preferences_action_enqueue_current_genre">Antrian jenis musk</string> + <string name="jump_to_time">Lompat ke waktu</string> + <string name="time_separator">:</string> + <string name="hour_hint">Jam</string> + <string name="minute_hint">Menit</string> + <string name="second_hint">Detik</string> + <string name="error_invalid_position">Posisi salah</string> + <string name="select">Pilih</string> + <string name="save">Simpan</string> + <string name="autoplaylist_playcounts_disabled">Jangan membuat daftar putar otomatis</string> + <!--Folder selector--> + <!--Plugin system--> + <!--Theme names--> +</resources> diff --git a/app/src/main/res/values-it/translatable.xml b/app/src/main/res/values-it/translatable.xml new file mode 100644 index 0000000..814ff57 --- /dev/null +++ b/app/src/main/res/values-it/translatable.xml @@ -0,0 +1,348 @@ +<?xml version='1.0' encoding='UTF-8'?> +<resources> + <string name="app_name">Vanilla Music</string> + <string name="ok">OK</string> + <string name="cancel">Annulla</string> + <!--Playback Activity (main screen)--> + <string name="no_songs">Nessun brano trovato sul tuo dispositivo.</string> + <string name="empty_queue">Nessuna traccia selezionata. Scegline alcune dalla libreria o entra nella modalità casuale premendo su questo messaggio.</string> + <string name="settings">Impostazioni</string> + <string name="no_shuffle">Nessuna riproduzione casuale</string> + <string name="shuffle_songs">Mischia brani</string> + <string name="shuffle_songs_continuously">Mischia brani continuamente</string> + <string name="shuffle_albums">Album in shuffle</string> + <string name="no_repeat">Ripeti off</string> + <string name="repeat">Ripeti on</string> + <string name="repeat_current_song">Ripeti attuale brano</string> + <string name="stop_current_song">Fermati dopo l\'attuale brano</string> + <string name="random">Casuale</string> + <string name="random_enabling">Casuale on</string> + <string name="song_load_failed">Impossibile caricare il brano %s. Può essere corrotto o mancante.</string> + <string name="queue_cleared">Coda svuotata.</string> + <string name="cover_art">Copertina</string> + <string name="close_notification">Chiudi notifica</string> + <string name="_genre">genere</string> + <string name="_track">traccia</string> + <string name="_composer">compositore</string> + <string name="_path">percorso</string> + <string name="_format">formato</string> + <string name="_title">titolo</string> + <string name="_artist">artista</string> + <string name="_album">album</string> + <string name="_year">anno</string> + <string name="_replaygain">Replay Gain</string> + <!--New Playlist Dialog--> + <string name="choose_playlist_name">Scegli il nome della playlist</string> + <string name="create">Crea</string> + <string name="overwrite">Sovrascrivi</string> + <string name="delete_playlist">Eliminare playlist %s?</string> + <!--Library--> + <string name="enqueue">Metti in coda</string> + <string name="enqueue_as_next">Riproduci successivo</string> + <string name="play">Riproduci</string> + <string name="edit">Modifica</string> + <string name="rename">Rinomina</string> + <string name="save_as_playlist">Salva come playlist…</string> + <string name="add_to_playlist">Aggiungi a playlist…</string> + <string name="add_to_homescreen">Aggiungi alla schermata principale...</string> + <string name="add_to">Aggiungi a...</string> + <string name="playlist">Playlist</string> + <string name="homescreen">Schermata principale</string> + <string name="add_to_favorites">Aggiungi ai preferiti</string> + <string name="remove_from_favorites">Rimuovi dai preferiti</string> + <string name="playlist_favorites">Preferiti</string> + <string name="new_playlist">Nuova playlist…</string> + <string name="expand">Espandi</string> + <string name="expand_or_play_all">Espandi o riproduci tutto</string> + <string name="delete">Elimina</string> + <string name="playback_view">In riproduzione</string> + <string name="sort_by">Ordina per</string> + <string name="search">Cerca</string> + <string name="done">Fatto</string> + <string name="remove">Rimuovi</string> + <string name="play_or_enqueue">Metti in coda se in riproduzione; Riproduci se in pausa.</string> + <string name="open">Apri</string> + <string name="go_home">Cartella home</string> + <string name="jumping_to_song">Il brano è già nella coda, verrà saltato...</string> + <!--As a developer, you should always supply "one" and "other" + strings. Your translators will know which strings are actually + needed for their language. Always include %d in "one" because + translators will need to use %d for languages where "one" + doesn't mean 1 (as explained above). + + Translators should use http://unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules and + http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html, Type cardinal, + to see which categories apply to integer numbers in their languages--> + <plurals name="playing"> + <item quantity="one">%d traccia in riproduzione.</item> + <item quantity="many">%d tracce in riproduzione.</item> + <item quantity="other">%d tracce in riproduzione.</item> + </plurals> + <plurals name="enqueued"> + <item quantity="one">%d traccia accodata.</item> + <item quantity="many">%d tracce accodate.</item> + <item quantity="other">%d tracce accodate.</item> + </plurals> + <plurals name="added_to_playlist"> + <item quantity="one">%1$d traccia aggiunta alla playlist %2$s</item> + <item quantity="many">%1$d tracce aggiunte alla playlist %2$s.</item> + <item quantity="other">%1$d tracce aggiunte alla playlist %2$s.</item> + </plurals> + <plurals name="removed_from_playlist"> + <item quantity="one">%1$d traccia rimossa dalla playlist %2$s.</item> + <item quantity="many">%1$d tracce rimosse dalla playlist %2$s.</item> + <item quantity="other">%1$d tracce rimosse dalla playlist %2$s.</item> + </plurals> + <plurals name="deleted"> + <item quantity="one">%d traccia rimossa.</item> + <item quantity="many">%d tracce rimosse.</item> + <item quantity="other">%d tracce rimosse.</item> + </plurals> + <string name="delete_file_failed">Impossibile eliminare %s.</string> + <string name="deleted_item">\'%s\' eliminato.</string> + <string name="delete_item">Eliminare \'%s\'?</string> + <string name="delete_file">Eliminare il file \"%s\"?</string> + <string name="artists">Artisti</string> + <string name="albums">Album</string> + <string name="albumartists">Artisti album</string> + <string name="composers">Compositori</string> + <string name="songs">Brani</string> + <string name="playlists">Playlist</string> + <string name="genres">Generi</string> + <string name="files">File</string> + <string name="artist">Artista</string> + <string name="album">Album</string> + <string name="genre">Genere</string> + <string name="folder">Cartella</string> + <string name="filename">Nome file</string> + <string name="file_size">Dimensione file</string> + <string name="file_time">Data di modifica</string> + <string name="extension">Estensione</string> + <string name="unknown">Sconosciuto</string> + <string name="play_all">Riproduci tutto</string> + <string name="enqueue_all">Metti tutto in coda</string> + <string name="all_songs">Tutti i brani</string> + <string name="details">Dettagli</string> + <string name="more_from_artist">Di più dall\'artista</string> + <string name="more_from_album">Di più da quest\'album</string> + <string name="title">Titolo</string> + <string name="number_of_tracks">Numero di tracce</string> + <string name="year">Anno</string> + <string name="date_added">Aggiunto in data</string> + <string name="artist_album">Artista, album</string> + <string name="artist_year_album">Artista, anno, album</string> + <string name="artist_album_track">Artista, album, numero di traccia</string> + <string name="artist_album_title">Artista, album, titolo</string> + <string name="artist_year">Artista, anno</string> + <string name="album_track">Album, numero di traccia</string> + <string name="song_playcount">Numero di riproduzioni</string> + <!--Preferences--> + <plurals name="seconds"> + <item quantity="one">%d secondo</item> + <item quantity="many">%d secondi</item> + <item quantity="other">%d secondi</item> + </plurals> + <plurals name="minutes"> + <item quantity="one">%d minuto</item> + <item quantity="many">%d minuti</item> + <item quantity="other">%d minuti</item> + </plurals> + <plurals name="hours"> + <item quantity="one">%d ora</item> + <item quantity="many">%d ore</item> + <item quantity="other">%d ore</item> + </plurals> + <string name="audio">Audio</string> + <string name="volume_during_ducking_title">Volume durante le notifiche</string> + <string name="volume_during_ducking_summary">Volume di riproduzione:</string> + <string name="ignore_audiofocus_loss_summary">Continua a riprodurre alla perdita permanente del focus dell\'audio</string> + <string name="media_button_title">Controlli cuffie/Bluetooth</string> + <string name="media_button_summary">Questo è anche richiesto per i controlli ICS lockscreen.</string> + <string name="headset_only_title">Solo output esterno</string> + <string name="headset_only_summary">Previeni la riproduzione della musica attraverso gli altoparlanti interni.</string> + <string name="headset_pause_title">Metti in pausa quando scollegate</string> + <string name="headset_pause_summary">Pausa quando le cuffie vengono scollegate.</string> + <string name="headset_launch_title">Riproduci quando collegate</string> + <string name="headset_launch_summary">Riproduci quando le cuffie vengono collegate. (Richiede l\'installazione dell\'app \"Headphone detector\".)</string> + <string name="headset_launch_app_missing">Questa funzione richiede l\'installazione dell\'app \"Headphone detector\".\nAprire il Play Store per installare l\'applicazione?</string> + <string name="replaygain">ReplayGain</string> + <string name="replaygain_summary">Configura la gestione delle informazioni ReplayGain</string> + <string name="replaygain_track_title">Attiva ReplayGain per traccia</string> + <string name="replaygain_track_summary">Riproduci tutte le tracce allo stesso volume</string> + <string name="replaygain_album_title">Attiva ReplayGain per album</string> + <string name="replaygain_album_summary">Conserva la struttura dell\'album</string> + <string name="replaygain_bump_title">Pre-amplificazione ReplayGain</string> + <string name="replaygain_untagged_debump_title">Brani senza tag per ReplayGain</string> + <string name="replaygain_untagged_debump_summary">Diminuisci il volume per</string> + <string name="replaygain_preamp_note_title">Nota</string> + <string name="replaygain_preamp_note_content">Android non consente a Vanilla Music di alzare il volume a >100%. L\'impostazione della pre-amplificazione a un valore elevato potrebbe provocare dei problemi se stai ascoltando musica \"poco rumorosa\".\n\nI valori consigliati sono:\n-> -3 dB per musica silenziosa/classica\n-> +3 dB per registrazioni post-2000</string> + <string name="readahead">Abilita precaricamento</string> + <string name="readahead_summary">Leggi l\'attuale brano in riproduzione. Questa opzione può risolvere i problemi di \"perdita d\'audio\" (causati da una lenta scheda SD).</string> + <string name="equalizer">Equalizzatore</string> + <string name="cycle_continuous_shuffling">Riproduzione casuale continua</string> + <string name="cycle_continuous_shuffling_summary">\"Modalità casuale\" riprodurrà i brani in ordine completamente casuale</string> + <string name="notifications">Notifiche</string> + <string name="notification_visibility_title">Visibilità delle notifiche</string> + <string name="notification_action_title">Azione notifica</string> + <string name="playback_screen">Schermata riproduzione</string> + <string name="playback_on_startup_title">Apri all\'avvio</string> + <string name="playback_on_startup_summary">Apri vista playback all\'avvio</string> + <string name="display_mode_title">Modalità di visualizzazione</string> + <string name="swipe_up_action_title">Azione allo scorrimento rapido verso l\'alto</string> + <string name="swipe_down_action_title">Azione allo scorrimento rapido verso il basso</string> + <string name="cover_press_action_title">Azione al tocco sulla copertina</string> + <string name="cover_longpress_action_title">Azione alla pressione prolungata sulla copertina</string> + <string name="library_screen">Schermata libreria</string> + <string name="default_action_title">Azione predefinita</string> + <string name="default_playlist_action_title">Azione predefinita playlist</string> + <string name="accelerometer_shake">Shake accelerometro</string> + <string name="enable_shake_title">Attiva shake accelerometro</string> + <string name="enable_shake_summary">Attivo solamente quando la musica è in riproduzione. In alcuni dispositivi non funziona quando lo schermo è spento.</string> + <string name="shake_action_title">Azione shake</string> + <string name="shake_threshold_title">Soglia forza shake</string> + <string name="misc_features">Funzionalità varie</string> + <string name="theme">Tema</string> + <string name="disable_lockscreen_title">Disattiva schermata di blocco</string> + <string name="disable_lockscreen_summary">Previene l\'attivazione della lockscreen quando si è nella libreria o nella schermata playback</string> + <string name="keep_screen_on_title">Mantenere acceso lo schermo</string> + <string name="keep_screen_on_summary">Mantenere lo schermo (e il dispositivo) accesi mentre Vanilla Music è visibile</string> + <string name="use_idle_timeout_title">Attiva timeout di inattività</string> + <string name="use_idle_timeout_summary">Quando attivo, il playback si fermerà dopo un dato periodo di inattività</string> + <string name="idle_timeout_title">Timeout inattività</string> + <string name="enable_scroll_to_song_title">Scorri al titolo del brano</string> + <string name="enable_scroll_to_song_summary">Scorri nelle liste della libreria al brano/album/artista attualmente in riproduzione</string> + <string name="queue_enable_scroll_to_song_title">Scorri al titolo della traccia in coda</string> + <string name="queue_enable_scroll_to_song_summary">Scorri alla traccia attualmente in riproduzione nella coda al cambio di brano</string> + <string name="jump_to_enqueued_on_play_title">Salta al brano in coda con \'Play\'</string> + <string name="jump_to_enqueued_on_play_summary">Se il brano richiesto è già nella coda, salta a quello invece di svuotare la coda</string> + <string name="coverloader_android_title">Carica copertine da Android</string> + <string name="coverloader_android_summary">Interroga il database dei media interno di Android per le copertine album</string> + <string name="coverloader_vanilla_title">Carica copertine da cartella</string> + <string name="coverloader_vanilla_summary">Cerca file immagine nominati cover.jpg, album.jpg o artwork.jpg e mostrali come copertine album</string> + <string name="coverloader_shadow_title">Carica copertine da cartella nascosta</string> + <string name="coverloader_shadow_summary">Prova a caricare copertine da \'/sdcard/Music/.vanilla/ARTIST/ALBUM.jpg\'</string> + <string name="coverloader_inline_title">Carica copertine dai tag dei file</string> + <string name="coverloader_inline_summary">Prova a caricare le copertine inserite nei tag dei file</string> + <string name="cover_on_lockscreen_title">Mostra copertina sulla schermata di blocco</string> + <string name="cover_on_lockscreen_summary">Mostra la copertina del brano in riproduzione nella schermata di blocco schermo</string> + <string name="double_tap_title">Widget di doppio tocco</string> + <string name="double_tap_summary">Doppio tap sul 1x1 widget aprirà il riproduttore. Si avrà un ritardo di 400ms prima che il widget risponda all\'azione.</string> + <string name="scrobble_title">Usa la API Scrobble Droid</string> + <string name="scrobble_summary">Effettua lo scrobbling a Last.fm tramite Scrobble Droid o Simple Last.fm Scrobbler</string> + <string name="stock_broadcast_title">Emula broadcast preinstallato</string> + <string name="stock_broadcast_summary">Invia brodcast simulando quelli inviati dal riproduttore musicale nativo con i controlli di 3rd parti, widgets,ecc.</string> + <string name="help">Aiuto</string> + <string name="about">Info</string> + <string name="tabs">Ordine delle schede</string> + <string name="customize_tab_order">Modifica l\'ordine e la visibilità delle tab della libreria</string> + <string name="restore_default">Ripristina impostazioni iniziali</string> + <!--The following are for the list preferences--> + <string name="last_used_action">Ultime azioni</string> + <string name="never_show">Non mostrare mai</string> + <string name="show_when_playing">Mostra durante la riproduzione (default)</string> + <string name="always_show">Mostra sempre</string> + <string name="open_main_activity">Apri libreria (default)</string> + <string name="open_mini_popup">Apri mini popup</string> + <string name="skip_to_next_song">Salta al brano successivo</string> + <string name="open_full_player">Apri riproduttore completo</string> + <string name="info_on_cover">Info sulla copertina</string> + <string name="info_below_cover">Info sotto la copertina</string> + <string name="fixed_info">Info fisse in alto</string> + <string name="do_nothing">Non fare niente</string> + <string name="open_library">Apri libreria</string> + <string name="play_pause">Riproduci/Pausa</string> + <string name="next_song">Brano successivo</string> + <string name="previous_song">Brano precedente</string> + <string name="next_album">Album successivo</string> + <string name="previous_album">Album precedente</string> + <string name="cycle_repeat_mode">Modalità ciclica ripeti</string> + <string name="cycle_shuffle_mode">Modalità ciclica shuffle</string> + <string name="enqueue_current_album">Metti in coda album</string> + <string name="enqueue_current_artist">Metti in coda artista</string> + <string name="enqueue_current_genre">Metti in coda genere</string> + <string name="enqueue_current">Metti in coda...</string> + <string name="more_from_current">Di più da...</string> + <string name="empty_the_queue">Svuota coda</string> + <string name="show_queue">Mostra in coda</string> + <string name="hide_queue">Nascondi coda</string> + <string name="dequeue_rest">Rimuovi il resto dalla coda</string> + <string name="toggle_controls">Controlli Toggle</string> + <string name="seek_10s_backward">Posiziona 10 secondi indietro</string> + <string name="seek_10s_forward">Posiziona 10 secondi avanti</string> + <string name="preferences_action_show_queue">Mostra coda</string> + <string name="preferences_action_clear_queue">Svuota coda</string> + <string name="preferences_action_enqueue_current_album">Metti album in coda</string> + <string name="preferences_action_enqueue_current_artist">Metti artista in coda</string> + <string name="preferences_action_enqueue_current_genre">Metti genere in coda</string> + <string name="jump_to_time">Salta al Tempo</string> + <string name="time_separator">:</string> + <string name="hour_hint">HH</string> + <string name="minute_hint">MM</string> + <string name="second_hint">SS</string> + <string name="error_invalid_position">Posizione non valida</string> + <string name="filebrowser_start">Home ricerca file</string> + <string name="customize_filebrowser_start">La ricerca file inizia da questa cartella</string> + <string name="select">Seleziona</string> + <string name="save">Salva</string> + <string name="autoplaylist_playcounts_title">Creazione playlist automatica</string> + <string name="autoplaylist_playcounts_summary">Crea automaticamente una</string> + <string name="autoplaylist_playcounts_fmt" formatted="false">%s playlist \"Top %.0f\"</string> + <string name="autoplaylist_playcounts_disabled">Non creare una playlist automatica</string> + <string name="autoplaylist_playcounts_name" formatted="false">Top %d</string> + <string name="playlist_sync_mode_title">Sincronizzazione playlist</string> + <string name="playlist_sync_all">Sincronizzazione completa</string> + <string name="playlist_sync_only_import">Importa M3U, non esportare mai</string> + <string name="playlist_sync_only_export">Scrivi M3U, non importare mai</string> + <string name="playlist_sync_disabled">Disattivato</string> + <string name="playlist_sync_folder_title">Cartella di sincronizzazione</string> + <string name="playlist_sync_folder_summary">Cartella da usare per la sincronizzazione delle playlist</string> + <string name="playlist_export_relative_paths_title">Esporta usando percorso relativo</string> + <string name="playlist_export_relative_paths_summary">Percorsi di riferimento relativi alla playlist</string> + <string name="permission_request_summary">Vanilla Music richiede i permessi di lettura per visualizzare la libreria musicale</string> + <string name="reverse_sort">Ordinamento inverso</string> + <string name="share">Condividi…</string> + <string name="share_failed">Fallita condivisione del file</string> + <string name="sendto">Invia a…</string> + <string name="no_receiving_apps">Nessuna app di ricezione trovata per questo tipo di file multimediale!</string> + <string name="duration">Durata</string> + <string name="dump_database">Salva il database</string> + <string name="dump_database_result">Database salvato in \'%s\'</string> + <string name="force_m3u_import">Importa forzatamente M3U</string> + <string name="media_library">Libreria multimediale</string> + <string name="media_folders_header">Cartelle indicizzate</string> + <string name="media_scan_header">Scansione file multimediali</string> + <string name="media_scan_full">Analizza l\'intero filesystem (più lento)</string> + <string name="media_scan_drop_db">Svuota il database dei brani</string> + <string name="media_scan_start">Inizia scansione</string> + <string name="media_scan_force_bastp">Usa sempre il lettore di tag incorporato</string> + <string name="media_scan_group_albums">Raggruppa gli album per cartella</string> + <string name="media_statistics">Statistiche</string> + <string name="media_stats_tracks">Numero di tracce</string> + <string name="media_stats_library_playtime">Tempo di riproduzione totale (Ore)</string> + <string name="media_stats_listen_playtime">Ore di musica riprodotte fino ad adesso</string> + <string name="media_stats_progress">Progresso della scansione</string> + <string name="media_library_scan_running">Scansione libreria multimediale...</string> + <string name="media_scan_preferences">Opzioni per la scansione</string> + <string name="media_scan_preferences_change_title">Opzioni per la scansione modificate</string> + <string name="media_scan_preferences_change_message">La modifica di questa opzione avvierà una scansione completa della tua libreria. Continuare?</string> + <!--Folder selector--> + <string name="hint_long_press_to_modify_folder">Tieni premuto per modificare le opzioni per la cartella</string> + <string name="folder_include">Includi</string> + <string name="folder_exclude">Escludi</string> + <string name="folder_neutral">Neutrale</string> + <!--Plugin system--> + <string name="plugins">Plugin</string> + <string name="plugin_needs_upgrade">Si prega di aggiornare il plugin %s all\'ultima versione</string> + <!--Theme names--> + <string name="theme_name_standard_light">Standard</string> + <string name="theme_name_standard_dark">Standard (Scuro)</string> + <string name="theme_name_grey_light">Grigio</string> + <string name="theme_name_grey_dark">Grigio (Scuro)</string> + <string name="theme_name_orange_light">Arancione</string> + <string name="theme_name_orange_dark">Arancione (Scuro)</string> + <string name="theme_name_blue_light">Blu</string> + <string name="theme_name_blue_dark">Blu (Scuro)</string> + <string name="theme_name_red_light">Rosso</string> + <string name="theme_name_red_dark">Rosso (Scuro)</string> + <string name="theme_name_amoled_dark">Nero Pece (AMOLED)</string> +</resources> diff --git a/app/src/main/res/values-iw/translatable.xml b/app/src/main/res/values-iw/translatable.xml new file mode 100644 index 0000000..b4572f7 --- /dev/null +++ b/app/src/main/res/values-iw/translatable.xml @@ -0,0 +1,238 @@ +<?xml version='1.0' encoding='UTF-8'?> +<resources> + <string name="app_name">Vanilla</string> + <!--Playback Activity (main screen)--> + <string name="no_songs">לא נמצאו רצועות במכשירך</string> + <string name="empty_queue">לא נבחרו רצועות. בחר מהספרייה או היכנס למצב ערבוב על ידי הקשה על הודעה זו.</string> + <string name="settings">הגדרות</string> + <string name="no_shuffle">ללא ערבוב</string> + <string name="shuffle_songs">רצועות מעורבבות</string> + <string name="shuffle_songs_continuously">רצועות מעורבבות ברצף</string> + <string name="shuffle_albums">ערבב אלבומים</string> + <string name="no_repeat">ללא חזרה</string> + <string name="repeat">חזור</string> + <string name="repeat_current_song">חזור על רצועה נוכחית</string> + <string name="stop_current_song">עצור לאחר רצועה נוכחית</string> + <string name="random">אקראי</string> + <string name="random_enabling">אקראי מופעל</string> + <string name="song_load_failed">כשל בהפעלת רצועה %s. ייתכן כי הקובץ פגום או חסר.</string> + <string name="queue_cleared">התור נוקה.</string> + <string name="cover_art">תמונת אלבום</string> + <string name="close_notification">סגור התראות</string> + <string name="_genre">סוגה</string> + <string name="_track">רצועה</string> + <string name="_composer">מלחין</string> + <string name="_path">נתיב</string> + <string name="_format">תבנית</string> + <string name="_title">כותר</string> + <string name="_artist">אמן</string> + <string name="_album">אלבום</string> + <string name="_year">שנה</string> + <string name="_replaygain">פיצוי הגבר</string> + <!--New Playlist Dialog--> + <string name="choose_playlist_name">בחר שם רשימת השמעה</string> + <string name="create">צור</string> + <string name="overwrite">דרוס</string> + <string name="delete_playlist">מחק רשימת השמעה %s</string> + <!--Library--> + <string name="enqueue">הוסף לתור</string> + <string name="enqueue_as_next">נגן הבא</string> + <string name="play">נגן</string> + <string name="edit">ערוך</string> + <string name="rename">שנה שם</string> + <string name="save_as_playlist">שמור כרשימת השמעה...</string> + <string name="add_to_playlist">הוסף לרשימת השמעה..</string> + <string name="add_to_favorites">הוסף למועדפים</string> + <string name="remove_from_favorites">הסר ממועדפים</string> + <string name="playlist_favorites">מועדפים</string> + <string name="new_playlist">רשימת השמעה חדשה...</string> + <string name="expand">הרחב</string> + <string name="delete">מחק</string> + <string name="playback_view">מנגן כעת</string> + <string name="sort_by">סדר לפי</string> + <string name="search">חפש</string> + <string name="done">סיום</string> + <string name="remove">הסר</string> + <string name="play_or_enqueue">הוסף לתור אם פועל; נגן אם בהשהייה</string> + <string name="open">פתח</string> + <!--As a developer, you should always supply "one" and "other" + strings. Your translators will know which strings are actually + needed for their language. Always include %d in "one" because + translators will need to use %d for languages where "one" + doesn't mean 1 (as explained above). + + Translators should use http://unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules and + http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html, Type cardinal, + to see which categories apply to integer numbers in their languages--> + <string name="delete_file_failed">נכשל במחיקת %s.</string> + <string name="deleted_item">%s נמחק.</string> + <string name="delete_item">האם למחוק את \'%s\'?</string> + <string name="delete_file">האם למחוק את הקובץ \'%s\'?</string> + <string name="artists">אמנים</string> + <string name="albums">אלבומים</string> + <string name="songs">רצועות</string> + <string name="playlists">רשימות השמעה</string> + <string name="genres">סוגות</string> + <string name="files">קבצים</string> + <string name="unknown">לא ידוע</string> + <string name="play_all">נגן הכל</string> + <string name="enqueue_all">הוסף הכל לתור</string> + <string name="all_songs">כל הרצועות</string> + <string name="more_from_artist">עוד מאותו אמן</string> + <string name="more_from_album">עוד מאותו אלבום</string> + <string name="number_of_tracks">מספר הרצועות</string> + <string name="year">שנה</string> + <string name="date_added">תאריך ההוספה</string> + <string name="artist_album">אמן, אלבום</string> + <string name="artist_year_album">אמן, שנה, אלבום</string> + <string name="artist_album_track">אמן, אלבום, מספר רצועה</string> + <string name="artist_album_title">אמן, אלבום, כותר</string> + <string name="artist_year">אמן, שנה</string> + <string name="album_track">אלבום, מספר רצועה</string> + <string name="song_playcount">מספור השמעה</string> + <!--Preferences--> + <plurals name="seconds"> + <item quantity="one">%d שניה</item> + <item quantity="two">%d שניות</item> + <item quantity="many">%d שניות</item> + <item quantity="other">%d שניות</item> + </plurals> + <plurals name="minutes"> + <item quantity="one">%d דקה</item> + <item quantity="two">%d דקות</item> + <item quantity="many">%d דקות</item> + <item quantity="other">%d דקות</item> + </plurals> + <plurals name="hours"> + <item quantity="one">%d שעה</item> + <item quantity="two">%d שעות</item> + <item quantity="many">%d שעות</item> + <item quantity="other">%d שעות</item> + </plurals> + <string name="audio">שמע</string> + <string name="volume_during_ducking_title">עוצמה במהלך התראה</string> + <string name="volume_during_ducking_summary">עוצמת ניגון</string> + <string name="ignore_audiofocus_loss_summary">המשך לנגן באיבוד מיקוד השמע לחלוטין</string> + <string name="media_button_title">מקשי שליטה באוזניות/Blutooth</string> + <string name="media_button_summary">זה נדרש גם עבור שליטה ממסך הנעילה ב- ICS.</string> + <string name="headset_only_title">פלט חיצוני בלבד</string> + <string name="headset_only_summary">מנע מהשמעת מוסיקה מהרמקולים המובנים</string> + <string name="headset_pause_title">השהה בניתוק</string> + <string name="headset_pause_summary">השהה בניתוק אוזניות</string> + <string name="headset_launch_title">נגן בחיבור</string> + <string name="headset_launch_summary">נגן בחיבור אוזניות (נדרשת התקנת יישום \'גלאי אוזניות\').</string> + <string name="headset_launch_app_missing">תכונה זו מצריכה התקנתו של יישום \'גלאי אוזניות\'. n\ האם ברצונך לפתוח את חנות Play כדי להתקין את היישום?</string> + <string name="replaygain">הגבר פיצוי</string> + <string name="replaygain_summary">הגדר מידע על ניהול של של הגבר פיצוי</string> + <string name="replaygain_track_title">אפשר הגבר פיצוי לכל רצועה בנפרד</string> + <string name="replaygain_track_summary">נגן את כל הרצועות בעוצמה שווה</string> + <string name="replaygain_album_title">אפשר הגבר פיצוי לאלבום</string> + <string name="replaygain_album_summary">שמור על דינמיות אלבום</string> + <string name="replaygain_bump_title">קדם-מגבר להגבר פיצוי</string> + <string name="replaygain_untagged_debump_title">רצועות ללא תוית הגבר פיצוי</string> + <string name="replaygain_untagged_debump_summary">הנמך עוצמה לפי</string> + <string name="replaygain_preamp_note_title">הערה</string> + <string name="replaygain_preamp_note_content">מערכת אנדרואיד לא מאפשר ל- Vanilla Music להגביר את העוצמה ל- >100%. הגדרת קדם המגבר לערך גבוה עלול לגרום לבעיות בהאזנה למוסיקה \'שקטה\'. \n\nהערכים המומלצים הם: \n-> -3dB למוסיקה שקטה/קלאסית \n-> +3dB להקלטות לאחר שנות ה-2000.</string> + <string name="readahead">אפשר קריאה מראש</string> + <string name="readahead_summary">קרא מראש את הרצועה הנוכחית. אפשרות זו עשויה לפתור את בעיית \'נפילת שמע\' (הנגרמת מכרטיס SD איטי).</string> + <string name="equalizer">איקולייזר</string> + <string name="cycle_continuous_shuffling">ערבב ברצף</string> + <string name="cycle_continuous_shuffling_summary">\'מצב ערבוב\' ינגן רצועות בסדר אקראי לחלוטין</string> + <string name="notifications">התראות</string> + <string name="notification_action_title">פעולת התראה</string> + <string name="playback_screen">מסך נגינה</string> + <string name="playback_on_startup_title">פתח בהפעלה</string> + <string name="playback_on_startup_summary">פתח תצוגת נגינה בהפעלה</string> + <string name="display_mode_title">מצב תצוגה</string> + <string name="swipe_up_action_title">פעולת החלקה כלפי מעלה</string> + <string name="swipe_down_action_title">פעולת החלקה למטה</string> + <string name="cover_press_action_title">פעולה בלחיצה על תמונת אלבום</string> + <string name="cover_longpress_action_title">פעולה בלחיצה ממושכת על תמונת אלבום</string> + <string name="library_screen">מסך ספרייה</string> + <string name="default_action_title">ברירת מחדל לפעולה</string> + <string name="default_playlist_action_title">ברירת מחדל לפעולת רשימת השמעה</string> + <string name="accelerometer_shake">ניעור מד-תאוצה</string> + <string name="enable_shake_title">אפשר ניעור מד-תאוצה</string> + <string name="enable_shake_summary">פועל רק כאשר מנגן מוסיקה. לא עובד כאשר המסך כבוי בחלק מהמכשירים.</string> + <string name="shake_action_title">פעולת ניעור</string> + <string name="shake_threshold_title">סף הכוח לניעור</string> + <string name="misc_features">תכונות שונות</string> + <string name="theme">ערכת נושא</string> + <string name="disable_lockscreen_title">בטל מסך נעילה</string> + <string name="disable_lockscreen_summary">מנע את הפעלת מסך הנעילה בספרייה או במסך ההשמעה</string> + <string name="use_idle_timeout_title">אפשר פסק זמן בחוסר פעילות</string> + <string name="use_idle_timeout_summary">כאשר מופעל, ההשמעה תיעצר לאחר חוסר פעילות של פרק הזמן המוגדר</string> + <string name="idle_timeout_title">פסק זמן לחוסר פעילות</string> + <string name="enable_scroll_to_song_title">גלול לכותר הרצועה</string> + <string name="enable_scroll_to_song_summary">גלול לרצועה/אלבום/אמן המושמע כעת ברשימות הספרייה</string> + <string name="coverloader_android_title">טען תמונת אלבום מאנדרואיד</string> + <string name="coverloader_android_summary">חפש מדיה של תמונת אלבום במסד נתוני המדיה המובנה של אנדרואיד </string> + <string name="coverloader_vanilla_title">טען תמונת אלבום מתיקייה</string> + <string name="coverloader_vanilla_summary">חפש קבצי תמונה בשם cover.jpg, album.jpg or artwork.jpg והצג אותם כתמונת אלבום</string> + <string name="coverloader_shadow_title">טען תמונת אלבום מתיקייה מוסתרת</string> + <string name="coverloader_shadow_summary">נסה לטעון תמונת אלבום מתוך \'/sdcard/Music/.vanilla/ARTIST/ALBUM.jpg\'</string> + <string name="cover_on_lockscreen_title">הצג תמונת אלבום במסך הנעילה</string> + <string name="cover_on_lockscreen_summary">הצג תמונה של הרצועה המושמעת כעת במסך הנעילה</string> + <string name="double_tap_title">הקשה כפולה על ווידג\'ט</string> + <string name="double_tap_summary">הקשה כפולה על ווידג\'ט 1x1 תפתח את הנגן. יוסיף השהייה של 400 מילי-שניות לתגובה לפעולת הווידג\'ט.</string> + <string name="scrobble_title">השתמש ב- Scrobble Droid API</string> + <string name="scrobble_summary">Scrobble ל- Last.fm באמצעות Scrobble Droid או Simple Last.fm Scrobbler</string> + <string name="stock_broadcast_title">הרץ שידורים מובנים</string> + <string name="stock_broadcast_summary">שלח שידורים המריצים את השידורים שנשלחו על ידי נגן המוסיקה המובנה על מנת שיעבדו עם מסך נעילה, ווידג\'טים וכו\' של יישום צד ג\' .</string> + <string name="about">אודות</string> + <string name="tabs">סדר הלשוניות</string> + <string name="customize_tab_order">כוון את סדר ונראות של לשוניות הספריה</string> + <string name="restore_default">שחזר ברירת מחדל</string> + <!--The following are for the list preferences--> + <string name="last_used_action">פעולה אחרונה בשימוש</string> + <string name="never_show">אל תציג יותר</string> + <string name="show_when_playing">הצג בזמן נגינה (ברירת מחדל)</string> + <string name="always_show">הצג תמיד</string> + <string name="open_main_activity">פתח ספרייה (ברירת מחדל)</string> + <string name="open_mini_popup">פתח חלון קופץ קטן</string> + <string name="skip_to_next_song">דלג לרצועה הבאה</string> + <string name="open_full_player">פתח נגן מלא</string> + <string name="info_on_cover">מידע על תמונת אלבום</string> + <string name="info_below_cover">מידע מתחת לתמונת אלבום</string> + <string name="fixed_info">מידע מקובע לחלק העליון</string> + <string name="do_nothing">אל תעשה דבר</string> + <string name="open_library">פתח ספרייה</string> + <string name="play_pause">נגן/השהה</string> + <string name="next_song">הרצועה הבאה</string> + <string name="previous_song">הרצועה הקודמת</string> + <string name="next_album">האלבום הבא</string> + <string name="previous_album">האלבום הקודם</string> + <string name="cycle_repeat_mode">מצב חזרה</string> + <string name="cycle_shuffle_mode">מצב ערבוב מחזורי</string> + <string name="enqueue_current_album">הוסף אלבום לתור</string> + <string name="enqueue_current_artist">הוסף אמן לתור</string> + <string name="enqueue_current_genre">הוסף סוגה לתור</string> + <string name="empty_the_queue">רוקן תור</string> + <string name="show_queue">הצג תור</string> + <string name="hide_queue">הסתר תור</string> + <string name="dequeue_rest">הסר את השאר מהתור</string> + <string name="toggle_controls">הפעל/בטל מקשי שליטה</string> + <string name="seek_10s_backward">עבור 10 שניות אחורה</string> + <string name="seek_10s_forward">עבור 10 שניות קדימה</string> + <string name="preferences_action_show_queue">הצג תור</string> + <string name="preferences_action_clear_queue">נקה תור</string> + <string name="preferences_action_enqueue_current_album">הוסף אלבום לתור</string> + <string name="preferences_action_enqueue_current_artist">הוסף אמן לתור</string> + <string name="preferences_action_enqueue_current_genre">הוסף סוגה לתור</string> + <string name="filebrowser_start">סייר קבצים - ראשי</string> + <string name="customize_filebrowser_start">סייר הקבצים יופעל מתיקייה זו</string> + <string name="select">בחר</string> + <string name="autoplaylist_playcounts_title">יצירת רשימת השמעה אוטומטית</string> + <string name="autoplaylist_playcounts_summary">צור אוטומטית</string> + <string name="autoplaylist_playcounts_fmt" formatted="false">%s \'Top %.0f\' רשימת השמעה</string> + <string name="autoplaylist_playcounts_disabled">אל תיצור רשימת השמעה אוטומטית</string> + <string name="autoplaylist_playcounts_name" formatted="false">למעלה %d</string> + <string name="permission_request_summary">Vanilla Music צריך להרשאה לקרוא כדי להציג את ספריית המוסיקה שלך </string> + <string name="reverse_sort">הפוך סדר</string> + <string name="share">שתף...</string> + <string name="sendto">שלח אל...</string> + <string name="no_receiving_apps">לא נמצאו יישומים עבור סוג קובץ זה!</string> + <!--Folder selector--> + <!--Plugin system--> + <!--Theme names--> +</resources> diff --git a/app/src/main/res/values-ja/translatable.xml b/app/src/main/res/values-ja/translatable.xml new file mode 100644 index 0000000..9889599 --- /dev/null +++ b/app/src/main/res/values-ja/translatable.xml @@ -0,0 +1,335 @@ +<?xml version='1.0' encoding='UTF-8'?> +<resources> + <string name="app_name">Vanilla Music</string> + <string name="ok">OK</string> + <string name="cancel">キャンセル</string> + <!--Playback Activity (main screen)--> + <string name="no_songs">お使いのデバイス上でトラックが見つかりませんでした。</string> + <string name="empty_queue">トラックが選択されていません。ライブラリーから選択するか、このメッセージをタップしてランダムモードに入ります。</string> + <string name="settings">設定</string> + <string name="no_shuffle">シャッフルなし</string> + <string name="shuffle_songs">トラックをシャッフル</string> + <string name="shuffle_songs_continuously">連続してトラックをシャッフル</string> + <string name="shuffle_albums">アルバムをシャッフル</string> + <string name="no_repeat">繰り返しなし</string> + <string name="repeat">繰り返し</string> + <string name="repeat_current_song">現在のトラックを繰り返す</string> + <string name="stop_current_song">現在のトラックの後で停止</string> + <string name="random">ランダム</string> + <string name="random_enabling">ランダムを有効にしました</string> + <string name="song_load_failed">トラック %s を読み込みできませんでした。破損しているか見つかりません。</string> + <string name="queue_cleared">キューをクリアしました。</string> + <string name="cover_art">カバーアート</string> + <string name="close_notification">通知を閉じる</string> + <string name="_genre">ジャンル</string> + <string name="_track">トラック</string> + <string name="_composer">作曲家</string> + <string name="_path">パス</string> + <string name="_format">形式</string> + <string name="_title">タイトル</string> + <string name="_artist">アーティスト</string> + <string name="_album">アルバム</string> + <string name="_year">年</string> + <string name="_replaygain">リプレイゲイン</string> + <!--New Playlist Dialog--> + <string name="choose_playlist_name">プレイリスト名の選択</string> + <string name="create">作成</string> + <string name="overwrite">上書</string> + <string name="delete_playlist">プレイリスト %s を削除しますか?</string> + <!--Library--> + <string name="enqueue">キューに入れる</string> + <string name="enqueue_as_next">次の再生</string> + <string name="play">再生</string> + <string name="edit">編集</string> + <string name="rename">名前を変更</string> + <string name="save_as_playlist">プレイリストとして保存…</string> + <string name="add_to_playlist">プレイリストに追加…</string> + <string name="add_to_homescreen">ホーム画面に追加…</string> + <string name="add_to">追加…</string> + <string name="playlist">プレイリスト</string> + <string name="homescreen">ホーム画面</string> + <string name="add_to_favorites">お気に入りに追加</string> + <string name="remove_from_favorites">お気に入りから削除</string> + <string name="playlist_favorites">お気に入り</string> + <string name="new_playlist">新しいプレイリスト…</string> + <string name="expand">展開</string> + <string name="expand_or_play_all">展開またはすべて再生</string> + <string name="delete">削除</string> + <string name="playback_view">再生中</string> + <string name="sort_by">並び替え</string> + <string name="search">検索</string> + <string name="done">完了</string> + <string name="remove">除去</string> + <string name="play_or_enqueue">再生中はキューに入れる、一時停止中は再生</string> + <string name="open">開く</string> + <string name="go_home">ホームディレクトリー</string> + <string name="jumping_to_song">曲はすでにキューに入っています。ジャンプします…</string> + <!--As a developer, you should always supply "one" and "other" + strings. Your translators will know which strings are actually + needed for their language. Always include %d in "one" because + translators will need to use %d for languages where "one" + doesn't mean 1 (as explained above). + + Translators should use http://unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules and + http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html, Type cardinal, + to see which categories apply to integer numbers in their languages--> + <plurals name="playing"> + <item quantity="other">%d トラックを再生中。</item> + </plurals> + <plurals name="enqueued"> + <item quantity="other">%d トラックをキューに入れました。</item> + </plurals> + <plurals name="added_to_playlist"> + <item quantity="other">%1$d トラックをプレイリスト %2$s に追加しました。</item> + </plurals> + <plurals name="removed_from_playlist"> + <item quantity="other">%1$d トラックをプレイリスト %2$s から削除しました。</item> + </plurals> + <plurals name="deleted"> + <item quantity="other">%d トラックを削除しました。</item> + </plurals> + <string name="delete_file_failed">%s を削除できませんでした。</string> + <string name="deleted_item">\'%s\' を</string> + <string name="delete_item">\'%s\' を削除しますか?</string> + <string name="delete_file">ファイル \'%s\' を削除しますか?</string> + <string name="artists">アーティスト</string> + <string name="albums">アルバム</string> + <string name="albumartists">アルバム アーティスト</string> + <string name="composers">作曲家</string> + <string name="songs">トラック</string> + <string name="playlists">プレイリスト</string> + <string name="genres">ジャンル</string> + <string name="files">ファイル</string> + <string name="artist">アーティスト</string> + <string name="album">アルバム</string> + <string name="genre">ジャンル</string> + <string name="folder">フォルダー</string> + <string name="filename">ファイル名</string> + <string name="file_size">ファイルサイズ</string> + <string name="file_time">更新時刻</string> + <string name="extension">拡張子</string> + <string name="unknown">不明</string> + <string name="play_all">すべて再生</string> + <string name="enqueue_all">すべてキューに入れる</string> + <string name="all_songs">すべてのトラック</string> + <string name="details">詳細</string> + <string name="more_from_artist">アーティストからさらに</string> + <string name="more_from_album">アルバムからさらに</string> + <string name="title">タイトル</string> + <string name="number_of_tracks">トラックの名前</string> + <string name="year">年</string> + <string name="date_added">追加した日付</string> + <string name="artist_album">アーティスト、アルバム</string> + <string name="artist_year_album">アーティスト、年、アルバム</string> + <string name="artist_album_track">アーティスト、アルバム、トラック番号</string> + <string name="artist_album_title">アーティスト、アルバム、タイトル</string> + <string name="artist_year">アーティスト、年</string> + <string name="album_track">アルバム、トラック番号</string> + <string name="song_playcount">再生回数</string> + <!--Preferences--> + <plurals name="seconds"> + <item quantity="other">%d 秒</item> + </plurals> + <plurals name="minutes"> + <item quantity="other">%d 分</item> + </plurals> + <plurals name="hours"> + <item quantity="other">%d 時間</item> + </plurals> + <string name="audio">オーディオ</string> + <string name="volume_during_ducking_title">通知時の音量</string> + <string name="volume_during_ducking_summary">再生音量: </string> + <string name="ignore_audiofocus_loss_summary">オーディオのフォーカスを失っても永久に再生を続けます</string> + <string name="media_button_title">ヘッドセット/Bluetooth コントロール</string> + <string name="media_button_summary">ICS ロックスクリーンのコントロールにも必要です。</string> + <string name="headset_only_title">外部出力のみ</string> + <string name="headset_only_summary">内部スピーカーから音楽が再生されないようにします。</string> + <string name="headset_pause_title">プラグを外した時に一時停止</string> + <string name="headset_pause_summary">ヘッドフォンのプラグを抜いたときに一時停止します。</string> + <string name="headset_launch_title">プラグを挿した時に再生</string> + <string name="headset_launch_summary">ヘッドホンが差し込まれたときに再生します。 (\'ヘッドフォン検出\' アプリをインストールする必要があります。)</string> + <string name="headset_launch_app_missing">この機能は、\'ヘッドフォン検出\' アプリをインストールする必要があります。\nPlay ストアを開いて、アプリケーションをインストールしますか?</string> + <string name="replaygain">リプレイゲイン</string> + <string name="replaygain_summary">リプレイゲイン情報の処理を設定します</string> + <string name="replaygain_track_title">トラックごとにリプレイゲインを有効にする</string> + <string name="replaygain_track_summary">同じ音量ですべてのトラックを再生します</string> + <string name="replaygain_album_title">アルバムリプレイゲインを有効にする</string> + <string name="replaygain_album_summary">アルバムのダイナミクスを保持します</string> + <string name="replaygain_bump_title">リプレイゲイン プリアンプ</string> + <string name="replaygain_untagged_debump_title">リプレイゲイン タグがないトラック</string> + <string name="replaygain_untagged_debump_summary">音量を下げる</string> + <string name="replaygain_preamp_note_title">注意</string> + <string name="replaygain_preamp_note_content">Android で Vanilla Music の音量を >100% に上げることはできません。プリアンプを高い値に設定することは、\'静かな\' 音楽を聴いているときに問題になります。\n\n推奨の値は:\n-> -3dB : 静かな/クラシック音楽\n-> +3dB : post-2000 の録音</string> + <string name="readahead">先読みを有効にする</string> + <string name="readahead_summary">現在再生中のトラックを先読みします。このオプションは、(遅いSDカードによって引き起こされる) \'オーディオ ドロップアウト\' の問題を解決することがあります。</string> + <string name="equalizer">イコライザー</string> + <string name="cycle_continuous_shuffling">連続シャッフル</string> + <string name="cycle_continuous_shuffling_summary">\'シャッフルモード\' は、完全にランダムな順序でトラックを再生します</string> + <string name="notifications">通知</string> + <string name="notification_visibility_title">通知の表示</string> + <string name="notification_action_title">通知操作</string> + <string name="playback_screen">再生画面</string> + <string name="playback_on_startup_title">起動時に開く</string> + <string name="playback_on_startup_summary">起動時に再生ビューを開きます</string> + <string name="display_mode_title">表示モード</string> + <string name="swipe_up_action_title">上にスワイプ操作</string> + <string name="swipe_down_action_title">下にスワイプ操作</string> + <string name="cover_press_action_title">カバーをタップ操作</string> + <string name="cover_longpress_action_title">カバーを長押し操作</string> + <string name="library_screen">ライブラリー画面</string> + <string name="default_action_title">デフォルト操作</string> + <string name="default_playlist_action_title">デフォルト プレイリスト操作</string> + <string name="accelerometer_shake">加速度センサー シェイク</string> + <string name="enable_shake_title">加速度センサー シェイクを有効にする</string> + <string name="enable_shake_summary">音楽が再生されている場合にのみ有効です。一部のデバイスで、画面がオフのときは動作しません。</string> + <string name="shake_action_title">シェイク操作</string> + <string name="shake_threshold_title">シェイクする力の閾値</string> + <string name="misc_features">その他の機能</string> + <string name="theme">テーマ</string> + <string name="disable_lockscreen_title">ロック画面を無効にする</string> + <string name="disable_lockscreen_summary">ライブラリーや再生画面でロック画面が有効になるのを防止します</string> + <string name="keep_screen_on_title">画面をオンのままにする</string> + <string name="keep_screen_on_summary">Vanilla Music が表示されている間、画面 (とデバイス) をオンのままにします</string> + <string name="use_idle_timeout_title">アイドル タイムアウトを有効にする</string> + <string name="use_idle_timeout_summary">有効な場合、一定期間アイドルになると再生が停止されます</string> + <string name="idle_timeout_title">アイドル タイムアウト</string> + <string name="enable_scroll_to_song_title">トラックのタイトルにスクロール</string> + <string name="enable_scroll_to_song_summary">ライブラリーリストの現在再生中のトラック/アルバム/アーティストにスクロールします</string> + <string name="queue_enable_scroll_to_song_title">キューのトラックのタイトルにスクロール</string> + <string name="queue_enable_scroll_to_song_summary">曲が変わったとき、キューの現在再生しているトラックにスクロールします</string> + <string name="jump_to_enqueued_on_play_title">\'再生\' のキューに入っている曲に移動</string> + <string name="jump_to_enqueued_on_play_summary">要求された曲がすでにキューに入っている場合は、キューを消さずにそこに移動します</string> + <string name="coverloader_android_title">Android からアートワークを読み込む</string> + <string name="coverloader_android_summary">アルバムのアートワークを Android 内部メディアデータベースから読み込みます</string> + <string name="coverloader_vanilla_title">フォルダからアートワークを読み込む</string> + <string name="coverloader_vanilla_summary">cover.jpg、album.jpg または artwork.jpg という名前で画像ファイルを検索し、アルバム カバーとして表示します</string> + <string name="coverloader_shadow_title">隠しフォルダからアートワークを読み込む</string> + <string name="coverloader_shadow_summary">\'/sdcard/Music/.vanilla/ARTIST/ALBUM.jpg\' からアートワークの読み込みを試行します</string> + <string name="coverloader_inline_title">ファイルタグからアートワークを読み込む</string> + <string name="coverloader_inline_summary">ファイルタグから埋め込まれたアートワークを読み込むようにします</string> + <string name="cover_on_lockscreen_title">ロック画面にアートワークを表示</string> + <string name="cover_on_lockscreen_summary">ロック画面に現在再生しているトラックのアートワークを表示します</string> + <string name="double_tap_title">ダブルタップ ウィジェット</string> + <string name="double_tap_summary">1x1 のウィジェットをダブルタップするとプレーヤーを開きます。ウィジェットが操作に応答する前に 400ms の遅延が発生します。</string> + <string name="scrobble_title">Scrobble Droid API を使用する</string> + <string name="scrobble_summary">Scrobble Droid または Simple Last.fm Scrobbler 経由で Last.fm にスクローブルします</string> + <string name="stock_broadcast_title">既存のブロードキャストをエミュレートする</string> + <string name="stock_broadcast_summary">サードパーティ製のロック画面コントロール、ウィジェットなどで動作するように、既存の音楽プレーヤーから送信されるブロードキャストをエミュレートして送信します</string> + <string name="help">ヘルプ</string> + <string name="about">アプリについて</string> + <string name="tabs">タブ順序</string> + <string name="customize_tab_order">ライブラリータブの順序と表示を調整します</string> + <string name="restore_default">デフォルトを復元</string> + <!--The following are for the list preferences--> + <string name="last_used_action">最後に使用した操作</string> + <string name="never_show">表示しない</string> + <string name="show_when_playing">再生時に表示 (デフォルト)</string> + <string name="always_show">常に表示</string> + <string name="open_main_activity">ライブラリーを開く (デフォルト)</string> + <string name="open_mini_popup">小さいポップアップを開く</string> + <string name="skip_to_next_song">次のトラックにスキップ</string> + <string name="open_full_player">完全なプレイヤーを開く</string> + <string name="info_on_cover">カバーアート上に情報</string> + <string name="info_below_cover">カバーアートの下に情報</string> + <string name="fixed_info">情報を上部に固定</string> + <string name="do_nothing">何もしない</string> + <string name="open_library">ライブラリーを開く</string> + <string name="play_pause">再生/一時停止</string> + <string name="next_song">次のトラック</string> + <string name="previous_song">前のトラック</string> + <string name="next_album">次のアルバム</string> + <string name="previous_album">前のアルバム</string> + <string name="cycle_repeat_mode">繰り返し再生モード</string> + <string name="cycle_shuffle_mode">サイクル シャッフルモード</string> + <string name="enqueue_current_album">アルバムをキューに入れる</string> + <string name="enqueue_current_artist">アーティストをキューに入れる</string> + <string name="enqueue_current_genre">ジャンルをキューに入れる</string> + <string name="enqueue_current">キューに入れる…</string> + <string name="more_from_current">さらに…</string> + <string name="empty_the_queue">キューを空にする</string> + <string name="show_queue">キューを表示</string> + <string name="hide_queue">キューを非表示</string> + <string name="dequeue_rest">残りをキューから消す</string> + <string name="toggle_controls">コントロールを切り替え</string> + <string name="seek_10s_backward">10 秒前にシーク</string> + <string name="seek_10s_forward">10 秒先にシーク</string> + <string name="move_to_top">先頭に移動</string> + <string name="move_to_bottom">最後に移動</string> + <string name="preferences_action_show_queue">キューを表示</string> + <string name="preferences_action_clear_queue">キューをクリア</string> + <string name="preferences_action_enqueue_current_album">アルバムをキューに入れる</string> + <string name="preferences_action_enqueue_current_artist">アーティストをキューに入れる</string> + <string name="preferences_action_enqueue_current_genre">ジャンルをキューに入れる</string> + <string name="jump_to_time">時刻に移動</string> + <string name="time_separator">:</string> + <string name="hour_hint">HH</string> + <string name="minute_hint">MM</string> + <string name="second_hint">SS</string> + <string name="error_invalid_position">無効な位置</string> + <string name="filebrowser_start">ファイルブラウザー ホーム</string> + <string name="customize_filebrowser_start">ファイルブラウザーはこのディレクトリーから開始します</string> + <string name="select">選択</string> + <string name="save">保存</string> + <string name="autoplaylist_playcounts_title">自動プレイリスト作成</string> + <string name="autoplaylist_playcounts_summary">自動的に作成</string> + <string name="autoplaylist_playcounts_fmt" formatted="false">%s \'トップ %.0f\' プレイリスト</string> + <string name="autoplaylist_playcounts_disabled">自動的にプレイリストを作成しない</string> + <string name="autoplaylist_playcounts_name" formatted="false">トップ %d</string> + <string name="playlist_sync_mode_title">プレイリストの同期</string> + <string name="playlist_sync_all">完全に同期</string> + <string name="playlist_sync_only_import">M3U インポート、エクスポートしない</string> + <string name="playlist_sync_only_export">M3U 書き出し、インポートしない</string> + <string name="playlist_sync_disabled">無効</string> + <string name="playlist_sync_folder_title">フォルダーの同期</string> + <string name="playlist_sync_folder_summary">プレイリストの同期に使用するフォルダー</string> + <string name="playlist_export_relative_paths_title">相対パスを使用してエクスポート</string> + <string name="playlist_export_relative_paths_summary">再生リストに対する相対ファイルパスを参照します</string> + <string name="permission_request_summary">Vanilla Music が音楽ライブラリを表示するために、読み取りのアクセス許可が必要です</string> + <string name="reverse_sort">逆順に並び替え</string> + <string name="share">共有…</string> + <string name="share_failed">ファイルの共有に失敗しました</string> + <string name="sendto">送信…</string> + <string name="no_receiving_apps">このメディアタイプの受信アプリが見つかりません!</string> + <string name="duration">時間</string> + <string name="dump_database">データベースをダンプ</string> + <string name="dump_database_result">データベースをダンプしました \'%s\'</string> + <string name="force_m3u_import">強制的に M3U 再インポート</string> + <string name="media_library">メディアライブラリー</string> + <string name="media_folders_header">インデックス済ディレクトリー</string> + <string name="media_scan_header">メディアスキャナー</string> + <string name="media_scan_full">ファイルシステム全体をスキャン (遅い)</string> + <string name="media_scan_drop_db">メディアデータベースを消去</string> + <string name="media_scan_start">スキャンを開始</string> + <string name="media_scan_force_bastp">常に内蔵のタグリーダーを使用する</string> + <string name="media_scan_group_albums">フォルダごとにアルバムをグループ化する</string> + <string name="media_statistics">統計</string> + <string name="media_stats_tracks">トラックの番号</string> + <string name="media_stats_library_playtime">合計演奏時間 (時間)</string> + <string name="media_stats_listen_playtime">これまでに音楽を再生した時間</string> + <string name="media_stats_progress">スキャンの進行状況</string> + <string name="media_library_scan_running">メディアライブラリーのスキャン中…</string> + <string name="media_scan_preferences">スキャナーオプション</string> + <string name="media_scan_preferences_change_title">スキャナーオプションを変更しました</string> + <string name="media_scan_preferences_change_message">このオプションを変更すると、ライブラリーのフル再スキャンが始まります。 続行しますか?</string> + <string name="folder_picker_spinner_desc">ディレクトリーのステータス:</string> + <!--Folder selector--> + <string name="hint_long_press_to_modify_folder">長押ししてフォルダーオプションを変更します</string> + <string name="folder_include">含む</string> + <string name="folder_exclude">除外</string> + <string name="folder_neutral">中立</string> + <!--Plugin system--> + <string name="plugins">プラグイン</string> + <string name="plugin_needs_upgrade">プラグイン %s を最新バージョンにアップグレードしてください</string> + <!--Theme names--> + <string name="theme_name_standard_light">標準</string> + <string name="theme_name_standard_dark">標準 (ダーク)</string> + <string name="theme_name_grey_light">グレー</string> + <string name="theme_name_grey_dark">グレー (ダーク)</string> + <string name="theme_name_orange_light">オレンジ</string> + <string name="theme_name_orange_dark">オレンジ (ダーク)</string> + <string name="theme_name_blue_light">ブルー</string> + <string name="theme_name_blue_dark">ブルー (ダーク)</string> + <string name="theme_name_red_light">レッド</string> + <string name="theme_name_red_dark">レッド (ダーク)</string> + <string name="theme_name_amoled_dark">ビッチブラック (AMOLED)</string> +</resources> diff --git a/app/src/main/res/values-ko/translatable.xml b/app/src/main/res/values-ko/translatable.xml new file mode 100644 index 0000000..897b52e --- /dev/null +++ b/app/src/main/res/values-ko/translatable.xml @@ -0,0 +1,334 @@ +<?xml version='1.0' encoding='UTF-8'?> +<resources> + <string name="app_name">Vanilla Music</string> + <string name="ok">확인</string> + <string name="cancel">취소</string> + <!--Playback Activity (main screen)--> + <string name="no_songs">기기에서 다음 트랙을 찾을 수 없습니다.</string> + <string name="empty_queue">트랙이 선택되지 않았습니다. 이 메시지를 탭하여 라이브러리 또는 랜덤 모드를 선택하세요.</string> + <string name="settings">설정</string> + <string name="no_shuffle">섞지 않음</string> + <string name="shuffle_songs">앨범 섞기</string> + <string name="shuffle_songs_continuously">연속적으로 트랙 섞기</string> + <string name="shuffle_albums">앨범 섞기</string> + <string name="no_repeat">반복 안함</string> + <string name="repeat">반복</string> + <string name="repeat_current_song">현재 트랙 반복</string> + <string name="stop_current_song">현재 트랙 다음 멈춤</string> + <string name="random">랜덤</string> + <string name="random_enabling">랜덤 활성화</string> + <string name="song_load_failed">%s 트랙 읽기 실패. 해당 트랙이 손상되었거나 지워짐.</string> + <string name="queue_cleared">대기열 지움.</string> + <string name="cover_art">커버 아트</string> + <string name="close_notification">알림 닫기</string> + <string name="_genre">장르</string> + <string name="_track">트랙</string> + <string name="_composer">작곡자</string> + <string name="_path">경로</string> + <string name="_format">형식</string> + <string name="_title">제목</string> + <string name="_artist">음악가</string> + <string name="_album">앨범</string> + <string name="_year">년</string> + <string name="_replaygain">음량 평준화</string> + <!--New Playlist Dialog--> + <string name="choose_playlist_name">재생목록 이름을 선택하세요</string> + <string name="create">생성</string> + <string name="overwrite">덮어쓰기</string> + <string name="delete_playlist">%s 재생 목록을 삭제하시겠습니까?</string> + <!--Library--> + <string name="enqueue">대기열에 추가</string> + <string name="enqueue_as_next">다음곡 재생</string> + <string name="play">재생</string> + <string name="edit">수정</string> + <string name="rename">이름 변경</string> + <string name="save_as_playlist">재생목록으로 저장...</string> + <string name="add_to_playlist">재생 목록에 추가...</string> + <string name="add_to_homescreen">홈 스크린에 추가...</string> + <string name="add_to">추가...</string> + <string name="playlist">재생목록</string> + <string name="homescreen">홈스크린</string> + <string name="add_to_favorites">즐겨찾기에 추가</string> + <string name="remove_from_favorites">즐겨찾기에서 제거</string> + <string name="playlist_favorites">즐겨찾기</string> + <string name="new_playlist">새로운 재생목록...</string> + <string name="expand">확장</string> + <string name="expand_or_play_all">확장/모두 재생</string> + <string name="delete">삭제</string> + <string name="playback_view">현재 재생 중</string> + <string name="sort_by">정렬</string> + <string name="search">검색</string> + <string name="done">완료</string> + <string name="remove">제거</string> + <string name="play_or_enqueue">재생중이면 대기열에 추가; 일시 정지중이면 재생</string> + <string name="open">열기</string> + <string name="go_home">홈 디렉토리</string> + <string name="jumping_to_song">노래가 이미 추가되었슴, 이동합니다...</string> + <!--As a developer, you should always supply "one" and "other" + strings. Your translators will know which strings are actually + needed for their language. Always include %d in "one" because + translators will need to use %d for languages where "one" + doesn't mean 1 (as explained above). + + Translators should use http://unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules and + http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html, Type cardinal, + to see which categories apply to integer numbers in their languages--> + <plurals name="playing"> + <item quantity="other">%d 트랙 재생중.</item> + </plurals> + <plurals name="enqueued"> + <item quantity="other">%d곡이 대기열에 추가됨</item> + </plurals> + <plurals name="added_to_playlist"> + <item quantity="other">%1$d 개의 곡이 플레이리스트 %2$s 에 추가되었습니다..</item> + </plurals> + <plurals name="removed_from_playlist"> + <item quantity="other">%1$d 개의 곡이 재생목록%2$s 에서 제거되었습니다.</item> + </plurals> + <plurals name="deleted"> + <item quantity="other">%d 트랙 제거됨.</item> + </plurals> + <string name="delete_file_failed">%s 삭제 실패.</string> + <string name="deleted_item">\'%s\' 삭제됨.</string> + <string name="delete_item">\'%s\'를 삭제하시겠습니까?</string> + <string name="delete_file">\'%s\'를 삭제하시겠습니까?</string> + <string name="artists">음악가</string> + <string name="albums">앨범</string> + <string name="albumartists">앨범 아티스트</string> + <string name="composers">작곡자</string> + <string name="songs">트랙</string> + <string name="playlists">재생목록</string> + <string name="genres">장르</string> + <string name="files">파일</string> + <string name="artist">아티스트</string> + <string name="album">앨범</string> + <string name="genre">장르</string> + <string name="folder">폴더</string> + <string name="filename">파일이름</string> + <string name="file_size">파일크기</string> + <string name="file_time">수정시간</string> + <string name="extension">확장자</string> + <string name="unknown">알수없슴</string> + <string name="play_all">모두 재생</string> + <string name="enqueue_all">모두 대기열에 추가</string> + <string name="all_songs">모든 트랙</string> + <string name="details">자세히</string> + <string name="more_from_artist">음악가로부터 얻음</string> + <string name="more_from_album">앨범으로부터 얻음</string> + <string name="title">타이틀</string> + <string name="number_of_tracks">트랙 수</string> + <string name="year">년</string> + <string name="date_added">날짜 추가됨</string> + <string name="artist_album">음악가, 앨범</string> + <string name="artist_year_album">아티스트, 연도, 앨범</string> + <string name="artist_album_track">음악가, 앨범, 트랙 번호</string> + <string name="artist_album_title">음악가, 앨범, 곡 제목</string> + <string name="artist_year">음악가, 연도</string> + <string name="album_track">앨범, 트랙 번호</string> + <string name="song_playcount">재생 횟수</string> + <!--Preferences--> + <plurals name="seconds"> + <item quantity="other">%d 초</item> + </plurals> + <plurals name="minutes"> + <item quantity="other">%d 분</item> + </plurals> + <plurals name="hours"> + <item quantity="other">%d 시간</item> + </plurals> + <string name="audio">오디오</string> + <string name="volume_during_ducking_title">알림 중 볼륨</string> + <string name="volume_during_ducking_summary">재생 볼륨</string> + <string name="ignore_audiofocus_loss_summary">포커스를 잃었을때에도 재생을 유지합니다</string> + <string name="media_button_title">헤드셋/블루투스 조절</string> + <string name="media_button_summary">ICS 잠금화면 컨트롤이 필요로 합니다.</string> + <string name="headset_only_title">외부 출력만</string> + <string name="headset_only_summary">내장 스피커를 통하여 재생 되는것을 방지</string> + <string name="headset_pause_title">헤드셋 뽑을때 일시 정지</string> + <string name="headset_pause_summary">헤드셋을 뽑을 때 현재 재생 중인 곡을 일시 중지합니다.</string> + <string name="headset_launch_title">헤드셋 장착 시 재생</string> + <string name="headset_launch_summary">헤드폰을 꼽을 때 재생합니다. (앱이 설치될 때 \'헤드폰 감지기\'가 필요합니다.)</string> + <string name="headset_launch_app_missing">이 기능은 앱 설치기 \'헤드폰 감지기\'가 필요합니다.\n어플리케이션을 설치하기위하여 플레이 스토어를 열겠습니까?</string> + <string name="replaygain">음량 평준화</string> + <string name="replaygain_summary">음량 평준화 정보 조절</string> + <string name="replaygain_track_title">트랙별 음량 평준화 활성화</string> + <string name="replaygain_track_summary">같은 음량으로 모든 트랙 재생</string> + <string name="replaygain_album_title">앨범별 음량 평준화 활성화</string> + <string name="replaygain_album_summary">엘범 다이나믹을 예약 함</string> + <string name="replaygain_bump_title">음량 평준화 프리엠프</string> + <string name="replaygain_untagged_debump_title">음량 평준화 태그 없는 곡</string> + <string name="replaygain_untagged_debump_summary">음량 감소</string> + <string name="replaygain_preamp_note_title">노트</string> + <string name="replaygain_preamp_note_content">안드로이드는 Vanilla Music이 볼륨을 >100%로 올리는것을 허락하지 않습니다. 이러한 문제로 인하여 만일 조용한 음악을 듣는경우 라면 프리엠프 설정을 높은 값으로 설정하십시오. \n\n권장 값 : \n-> -3dB 조용한 클래식 음악\n 2000년 이후의 레코딩은 +3dB</string> + <string name="readahead">미리 읽기 활성화</string> + <string name="readahead_summary">현재 재생중인 곡 미리 읽기. 이것은 \'audio dropout\' 문제를 해결할 수 있는 옵션입니다. (느린 SD 카드에서 발생하는)</string> + <string name="equalizer">이퀄라이져</string> + <string name="cycle_continuous_shuffling">연속으로 섞기</string> + <string name="cycle_continuous_shuffling_summary">섞기모드는 랜덤한 순서로 곡을 재생합니다.</string> + <string name="notifications">알림</string> + <string name="notification_visibility_title">알림 표시</string> + <string name="notification_action_title">알림을 눌렀을때</string> + <string name="playback_screen">재생 화면</string> + <string name="playback_on_startup_title">시작 시 열기</string> + <string name="playback_on_startup_summary">시작시 재생 중 화면 열기</string> + <string name="display_mode_title">표시 모드</string> + <string name="swipe_up_action_title">쓸어 올리기 동작</string> + <string name="swipe_down_action_title">쓸어 내리기 동작</string> + <string name="cover_press_action_title">커버 탭 동작</string> + <string name="cover_longpress_action_title">커버 오래 누르기 동작</string> + <string name="library_screen">라이브러리 화면</string> + <string name="default_action_title">기본 동작</string> + <string name="default_playlist_action_title">기본 재생목록 동작</string> + <string name="accelerometer_shake">흔들기</string> + <string name="enable_shake_title">흔들기 활성화</string> + <string name="enable_shake_summary">오직 음악이 재생 중일때만 활성화됩니다. 어떤 기기에서 화면이 꺼져있을때 작동하지 않을 수 있습니다.</string> + <string name="shake_action_title">흔들기 동작</string> + <string name="shake_threshold_title">흔듬 강도</string> + <string name="misc_features">기타 기능</string> + <string name="theme">테마</string> + <string name="disable_lockscreen_title">잠금화면 사용 안함</string> + <string name="disable_lockscreen_summary">재생 중 화면, 라이브러리 일때 잠금화면 방지 </string> + <string name="keep_screen_on_title">화면에 유지함</string> + <string name="keep_screen_on_summary">Vanilla Music 보이는 동안 켜지면 화면(기기)에 유지함</string> + <string name="use_idle_timeout_title">유휴 대기 시간 활성화</string> + <string name="use_idle_timeout_summary">비활성 시간 후 활성화 시 재생 중지 </string> + <string name="idle_timeout_title">유휴 시간</string> + <string name="enable_scroll_to_song_title">트랙 타이틀로 이동</string> + <string name="enable_scroll_to_song_summary">현재 재생중인 라이브러리 목록안의 트랙/앨범/아티스트로 이동합니다</string> + <string name="queue_enable_scroll_to_song_title">대기열 안의 트랙타이틀로 이동</string> + <string name="queue_enable_scroll_to_song_summary">곡 변경 시 대기목록에서 현재 트랙을 재생하려면 이동합니다</string> + <string name="jump_to_enqueued_on_play_title">\'재생\'에서 추가된 곡으로 이동</string> + <string name="jump_to_enqueued_on_play_summary">요청된 노래가 이미 대기열에 있는 경우, 대기열을 섞는 대신 해당 곡으로 이동합니다.</string> + <string name="coverloader_android_title">안드로이드로 부터 아트웍 로드</string> + <string name="coverloader_android_summary">앨범 아트웍을 안드로이드 내장 미디어 데이터베이스에서 얻음</string> + <string name="coverloader_vanilla_title">폴더에서 아트웍을 읽음</string> + <string name="coverloader_vanilla_summary">cover.jpg , album.jpg, artwork.jpg 이름인 이미지를 검색하고 이것을 앨범 커버로 표시</string> + <string name="coverloader_shadow_title">숨겨진 폴더에서 아트웍을 읽음</string> + <string name="coverloader_shadow_summary">\'/sdcard/Music/.vanilla/ARTIST/ALBUM.jpg\' 에서 아트웍을 읽기 시도</string> + <string name="coverloader_inline_title">태그에서 아트웍을 읽음</string> + <string name="coverloader_inline_summary">파일 태그에서 내장 아트웍을 읽기 시도</string> + <string name="cover_on_lockscreen_title">잠금화면에 아트웍 표시</string> + <string name="cover_on_lockscreen_summary">잠금화면에 현재 재생중인 곡의 아트웍을 표시</string> + <string name="double_tap_title">위젯을 두번 탭</string> + <string name="double_tap_summary">1x1위젯을 두번 탭하면 플레이어가 열림. 위젯을 400ms이하로 탭해야 반응함.</string> + <string name="scrobble_title">ScrobbleDroid API 사용</string> + <string name="scrobble_summary">ScrobbleDroid 이나 간단한 Last.fm Scrobbler를 통하여 Last.fm을 Scrobble 함</string> + <string name="stock_broadcast_title">Stock Broadcasts를 에뮬레이트 함</string> + <string name="stock_broadcast_summary">서드파티 잠금화면 컨트롤, 위젯등과 내장 음악 플레이어로 전송된 broadcasts 에뮬레이팅을 전송함</string> + <string name="help">도움말</string> + <string name="about">정보</string> + <string name="tabs">탭 순서</string> + <string name="customize_tab_order">순서 조정과 라이브러리 탭 보이기</string> + <string name="restore_default">기본 설정으로 돌리기</string> + <!--The following are for the list preferences--> + <string name="last_used_action">마지막 했던 작업</string> + <string name="never_show">더이상 안보임</string> + <string name="show_when_playing">재생 중일때 보이기(기본)</string> + <string name="always_show">항상 보임</string> + <string name="open_main_activity">라이브러리 열기(기본)</string> + <string name="open_mini_popup">미니 팝업 열기</string> + <string name="skip_to_next_song">다음 트랙 무시</string> + <string name="open_full_player">모든 플레이어 열기</string> + <string name="info_on_cover">커버 아트의 정보</string> + <string name="info_below_cover">아래 커버 아트의 정보</string> + <string name="fixed_info">상단에 정보 고정</string> + <string name="do_nothing">아무것도 하지 않음</string> + <string name="open_library">라이브러리 열기</string> + <string name="play_pause">재생/일시중지</string> + <string name="next_song">다음 트랙</string> + <string name="previous_song">이전 트랙</string> + <string name="next_album">다음 앨범</string> + <string name="previous_album">이전 앨범</string> + <string name="cycle_repeat_mode">순환 반복 모드</string> + <string name="cycle_shuffle_mode">순환 섞기 모드</string> + <string name="enqueue_current_album">앨범을 대기열에 추가</string> + <string name="enqueue_current_artist">음악가 대기열로 추가</string> + <string name="enqueue_current_genre">장르 대기열로 추가</string> + <string name="enqueue_current">대기열에 추가..</string> + <string name="more_from_current">이것들을 추가함...</string> + <string name="empty_the_queue">대기열 비우기</string> + <string name="show_queue">대기열 보이기</string> + <string name="hide_queue">대기열 감추기</string> + <string name="dequeue_rest">대기열에 없는 나머지</string> + <string name="toggle_controls">토글 컨트롤</string> + <string name="seek_10s_backward">뒤로 10초 이동</string> + <string name="seek_10s_forward">앞으로 10초 이동</string> + <string name="preferences_action_show_queue">대기열 보이기</string> + <string name="preferences_action_clear_queue">대기열 지우기</string> + <string name="preferences_action_enqueue_current_album">앨범을 대기열에 추가</string> + <string name="preferences_action_enqueue_current_artist">음악가 대기열로 추가</string> + <string name="preferences_action_enqueue_current_genre">장르 대기열로 추가</string> + <string name="jump_to_time">시간으로 이동</string> + <string name="time_separator">:</string> + <string name="hour_hint">시</string> + <string name="minute_hint">분</string> + <string name="second_hint">초</string> + <string name="error_invalid_position">잘못된 위치</string> + <string name="filebrowser_start">파일 검색기 홈</string> + <string name="customize_filebrowser_start">파일 탐색기가 이 디렉토리에서 시작합니다</string> + <string name="select">선택</string> + <string name="save">저장</string> + <string name="autoplaylist_playcounts_title">자동으로 재생목록 생성</string> + <string name="autoplaylist_playcounts_summary">자동으로 생성</string> + <string name="autoplaylist_playcounts_fmt" formatted="false"> 재생목록 %s \'상위 %.0f\'</string> + <string name="autoplaylist_playcounts_disabled">재생 목록을 자동으로 생성하지 않습니다</string> + <string name="autoplaylist_playcounts_name" formatted="false">상위 %d</string> + <string name="playlist_sync_mode_title">재생목록 동기화</string> + <string name="playlist_sync_all">전체 동기화</string> + <string name="playlist_sync_only_import">M3U 읽기, 내보내지 않음</string> + <string name="playlist_sync_only_export">M3U 쓰기, 읽지 않음</string> + <string name="playlist_sync_disabled">비활성</string> + <string name="playlist_sync_folder_title">동기화 폴더</string> + <string name="playlist_sync_folder_summary">폴더를 재생목록 동기화에 사용함</string> + <string name="playlist_export_relative_paths_title">상대 경로를 사용하여 내보내기</string> + <string name="playlist_export_relative_paths_summary">재생 목록과 관련된 참조 파일 경로</string> + <string name="permission_request_summary">Vanilla Music은 음악 라이브러리를 표시하기 위하여 읽기 권한이 필요합니다 +</string> + <string name="reverse_sort">반대로 정렬</string> + <string name="share">공유...</string> + <string name="share_failed">파일 공유 실패</string> + <string name="sendto">전송함...</string> + <string name="no_receiving_apps">해당 미디어 타입을 수신하는 앱을 찾을 수 없습니다!</string> + <string name="duration">주기</string> + <string name="dump_database">데이터베이스 덤프</string> + <string name="dump_database_result">\'%s\'로 데이터베이스 덤프</string> + <string name="force_m3u_import">M3U 강제 읽기</string> + <string name="media_library">미디어 라이브러리</string> + <string name="media_folders_header">색인화된 디렉토리</string> + <string name="media_scan_header">미디어 검색</string> + <string name="media_scan_full">파일 시스템 전체 검색(느림)</string> + <string name="media_scan_drop_db">미디어 데이터베이스 정리</string> + <string name="media_scan_start">검색 시작</string> + <string name="media_scan_force_bastp">내장 태그 리더를 항상 사용함</string> + <string name="media_scan_group_albums">폴더별로 앨범을 묶음</string> + <string name="media_statistics">통계</string> + <string name="media_stats_tracks">트랙 갯수</string> + <string name="media_stats_library_playtime">총 재생 시간(시)</string> + <string name="media_stats_listen_playtime">지금까지 음악 재생 시간</string> + <string name="media_stats_progress">검색 진행중</string> + <string name="media_library_scan_running">미디어 라이브러리 검색중...</string> + <string name="media_scan_preferences">검색 옵션</string> + <string name="media_scan_preferences_change_title">검색 옵션이 변경되었습니다</string> + <string name="media_scan_preferences_change_message">이 옵션을 변경하면 라이브러리를 모두 재 검색합니다. 계속 하시겠습니까?</string> + <string name="folder_picker_spinner_desc">디렉토리 상태 : </string> + <!--Folder selector--> + <string name="hint_long_press_to_modify_folder">길게 눌러 폴더 옵션을 수정</string> + <string name="folder_include">포함</string> + <string name="folder_exclude">제외</string> + <string name="folder_neutral">중립</string> + <!--Plugin system--> + <string name="plugins">플러그인</string> + <string name="plugin_needs_upgrade">%s 플러그인을 최신 버전으로 업그레이드 하세요</string> + <!--Theme names--> + <string name="theme_name_standard_light">기본</string> + <string name="theme_name_standard_dark">기본(어두움)</string> + <string name="theme_name_grey_light">회색</string> + <string name="theme_name_grey_dark">회색(어두움)</string> + <string name="theme_name_orange_light">오랜지</string> + <string name="theme_name_orange_dark">오랜지(어두움)</string> + <string name="theme_name_blue_light">파란색</string> + <string name="theme_name_blue_dark">파란색(어두움)</string> + <string name="theme_name_red_light">빨간색</string> + <string name="theme_name_red_dark">빨간색(어두움)</string> + <string name="theme_name_amoled_dark">진한 검정색(AMOLED)</string> +</resources> diff --git a/app/src/main/res/values-lv/translatable.xml b/app/src/main/res/values-lv/translatable.xml new file mode 100644 index 0000000..b2b25bd --- /dev/null +++ b/app/src/main/res/values-lv/translatable.xml @@ -0,0 +1,349 @@ +<?xml version='1.0' encoding='UTF-8'?> +<resources> + <string name="app_name">Vanilla Music</string> + <string name="ok">Labi</string> + <string name="cancel">Atcelt</string> + <!--Playback Activity (main screen)--> + <string name="no_songs">Jūsu ierīcē netika atrasts neviens celiņš.</string> + <string name="empty_queue">Nav izvēlēts neviens celiņš. Izvēlieties dažus no bibliotēkas vai ievadiet nejaušās izvēles režīmu, nospiežot uz šī ziņojuma.</string> + <string name="settings">Iestatījumi</string> + <string name="no_shuffle">Nejaukt</string> + <string name="shuffle_songs">Jaukt dziesmas</string> + <string name="shuffle_songs_continuously">Sajaukt dziesmas nepārtraukti</string> + <string name="shuffle_albums">Jaukt albumus</string> + <string name="no_repeat">Neatkārtot</string> + <string name="repeat">Atkārtot</string> + <string name="repeat_current_song">Atkārtot pašreizējo dziesmu</string> + <string name="stop_current_song">Apstāties pēc pašreizējās dziesmas</string> + <string name="random">Nejaušība</string> + <string name="random_enabling">Nejaušība ieslēgta</string> + <string name="song_load_failed">Neizdevās ielādēt dziesmu %s. Tā varētu bojāta vai pazudusi.</string> + <string name="queue_cleared">Rinda notīrīta.</string> + <string name="cover_art">Vāciņa attēls</string> + <string name="close_notification">Aizvērt paziņojumu</string> + <string name="_genre">žanrs</string> + <string name="_track">celiņš</string> + <string name="_composer">komponists</string> + <string name="_path">ceļš</string> + <string name="_format">formāts</string> + <string name="_title">nosaukums</string> + <string name="_artist">izpildītājs</string> + <string name="_album">albums</string> + <string name="_year">gads</string> + <string name="_replaygain">rgain</string> + <!--New Playlist Dialog--> + <string name="choose_playlist_name">Izvēlieties repertuāra nosaukumu</string> + <string name="create">Izveidot</string> + <string name="overwrite">Pārrakstīt</string> + <string name="delete_playlist">Dzēst repertuāru %s?</string> + <!--Library--> + <string name="enqueue">Ierindot</string> + <string name="enqueue_as_next">Atskaņot nākamo</string> + <string name="play">Atskaņot</string> + <string name="edit">Rediģēt</string> + <string name="rename">Pārdēvēt</string> + <string name="save_as_playlist">Saglabāt kā repertuāru...</string> + <string name="add_to_playlist">Pievienot repertuāru...</string> + <string name="add_to_homescreen">Pievienot mājas ekrānam...</string> + <string name="add_to">Pievienot...</string> + <string name="playlist">Repertuārs</string> + <string name="homescreen">Mājas ekrāns</string> + <string name="add_to_favorites">Pievienot iecienītajiem</string> + <string name="remove_from_favorites">Izņemt no iecienītajiem</string> + <string name="playlist_favorites">Iecienītie</string> + <string name="new_playlist">Jauns repertuārs...</string> + <string name="expand">Izplest</string> + <string name="expand_or_play_all">Izplest vai atskaņot visu</string> + <string name="delete">Dzēst</string> + <string name="playback_view">Tagad atskaņo</string> + <string name="sort_by">Kārtot pēc</string> + <string name="search">Meklēt</string> + <string name="done">Padarīts</string> + <string name="remove">Izņemt</string> + <string name="play_or_enqueue">Ierindot, ja atskaņo; atskaņot, ja nopauzēts</string> + <string name="open">Atvērt</string> + <string name="go_home">Mājas mape</string> + <string name="jumping_to_song">Dziesma jau ir rindā, pārlec...</string> + <!--As a developer, you should always supply "one" and "other" + strings. Your translators will know which strings are actually + needed for their language. Always include %d in "one" because + translators will need to use %d for languages where "one" + doesn't mean 1 (as explained above). + + Translators should use http://unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules and + http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html, Type cardinal, + to see which categories apply to integer numbers in their languages--> + <plurals name="playing"> + <item quantity="zero">Atskaņo %d celiņus.</item> + <item quantity="one">Atskaņo %dceliņu.</item> + <item quantity="other">Atskaņo %d celiņus.</item> + </plurals> + <plurals name="enqueued"> + <item quantity="zero">Ierindoti %d celiņi.</item> + <item quantity="one">Ierindots %d celiņš.</item> + <item quantity="other">Ierindoti %d celiņi.</item> + </plurals> + <plurals name="added_to_playlist"> + <item quantity="zero">Repertuāram %2$s pievienoti %1$dceliņi.</item> + <item quantity="one">Repertuāram %2$s pievienots %1$d celiņš.</item> + <item quantity="other">Repertuāram %2$s pievienoti %1$d celiņi.</item> + </plurals> + <plurals name="removed_from_playlist"> + <item quantity="zero">No repertuāra %2$s izņemti %1$d celiņi.</item> + <item quantity="one">No repertuāra %2$s izņemts %1$d celiņš.</item> + <item quantity="other">No repertuāra %2$s izņemti %1$d celiņi.</item> + </plurals> + <plurals name="deleted"> + <item quantity="zero">Izdzēsti %d celiņi.</item> + <item quantity="one">Izdzēsts %d celiņš.</item> + <item quantity="other">Izdzēsti %d celiņi.</item> + </plurals> + <string name="delete_file_failed">Neizdevās izdzēst %s.</string> + <string name="deleted_item">Izdzēsa \'%s\'.</string> + <string name="delete_item">Dzēst \'%s\'?</string> + <string name="delete_file">Dzēst failu \'%s\'?</string> + <string name="artists">Izpildītāji</string> + <string name="albums">Albumi</string> + <string name="albumartists">Albuma izpildītāji</string> + <string name="composers">Komponisti</string> + <string name="songs">Celiņi</string> + <string name="playlists">Repertuāri</string> + <string name="genres">Žanri</string> + <string name="files">Faili</string> + <string name="artist">Izpildītājs</string> + <string name="album">Albums</string> + <string name="genre">Žanrs</string> + <string name="folder">Mape</string> + <string name="filename">Faila nosaukums</string> + <string name="file_size">Faila izmērs</string> + <string name="file_time">Mainīšanas laiks</string> + <string name="extension">Paplašinājums</string> + <string name="unknown">Nezināms</string> + <string name="play_all">Atskaņot visu</string> + <string name="enqueue_all">Ierindot visu</string> + <string name="all_songs">Visi celiņi</string> + <string name="details">Detaļas</string> + <string name="more_from_artist">Vairāk no izpildītāja</string> + <string name="more_from_album">Vairāk no albuma</string> + <string name="title">Nosaukums</string> + <string name="number_of_tracks">Celiņu skaits</string> + <string name="year">Gads</string> + <string name="date_added">Pievienošanas datums</string> + <string name="artist_album">Izpildītājs, albums</string> + <string name="artist_year_album">Izpildītājs, gads, albums</string> + <string name="artist_album_track">Izpildītājs, albums, celiņa numurs</string> + <string name="artist_album_title">Izpildītājs, albums, nosaukums</string> + <string name="artist_year">Izpildītājs, gads</string> + <string name="album_track">Albums, celiņa numurs</string> + <string name="song_playcount">Atskaņojumu skaits</string> + <!--Preferences--> + <plurals name="seconds"> + <item quantity="zero">%d sekunžu</item> + <item quantity="one">%d sekunde</item> + <item quantity="other">%d sekundes</item> + </plurals> + <plurals name="minutes"> + <item quantity="zero">%d minūšu</item> + <item quantity="one">%d minūte</item> + <item quantity="other">%d minūtes</item> + </plurals> + <plurals name="hours"> + <item quantity="zero">%d stundu</item> + <item quantity="one">%d stunda</item> + <item quantity="other">%d stundas</item> + </plurals> + <string name="audio">Audio</string> + <string name="volume_during_ducking_title">Skaļums paziņojuma laikā</string> + <string name="volume_during_ducking_summary">Atskaņošanas skaļums:</string> + <string name="ignore_audiofocus_loss_summary">Turpināt atskaņošanu patstāvīga audio fokusa zaudējuma gadījumā</string> + <string name="media_button_title">Austiņu/Bluetooth vadīklas</string> + <string name="media_button_summary">Šis ir nepieciešams arī ICS slēgekrāna vadīklām.</string> + <string name="headset_only_title">Tikai ārēja izvade</string> + <string name="headset_only_summary">Nepieļauj mūzikas atskaņošanu caur iekšējiem skaļruņiem.</string> + <string name="headset_pause_title">Pauzēt, kad atvienotas austiņas</string> + <string name="headset_pause_summary">Pauzēt, kad tiek atvienotas austiņas.</string> + <string name="headset_launch_title">Atskaņot, kad pievienotas austiņas</string> + <string name="headset_launch_summary">Atskaņot, kad tiek pievienotas austiņas. (Jābūt instalētai lietotnei \'Headphone detector\'.)</string> + <string name="headset_launch_app_missing">Šajai iespējai nepieciešams instalēt lietotni \'Headphone detector\'.\nWould vēlaties atvērt Play Store, lai instalētu lietotni?</string> + <string name="replaygain">ReplayGain</string> + <string name="replaygain_summary">Konfigurēt ReplayGain informācijas apstrādi</string> + <string name="replaygain_track_title">Ieslēgt celiņu Replay Gain</string> + <string name="replaygain_track_summary">Atskaņot visus celiņus vienādā skaļumā</string> + <string name="replaygain_album_title">Ieslēgt albuma Replay Gain</string> + <string name="replaygain_album_summary">Saglabāt albumu dinamiku</string> + <string name="replaygain_bump_title">ReplayGain priekšpastiprinājums</string> + <string name="replaygain_untagged_debump_title">Celiņi bez ReplayGain taga</string> + <string name="replaygain_untagged_debump_summary">Samazināt skaļumu par</string> + <string name="replaygain_preamp_note_title">Piezīme</string> + <string name="replaygain_preamp_note_content">Android neļauj paaugstināt skaļumu virs 100%. Priekšpastiprinājuma iestatīšana uz augstām vērtībām var izraisīt problēmas, ja klausaties \'klusu\' mūziku. +\n\nIeteicamās vērtības ir:\n-> -3dB klusai/klasiskajai mūzikai\n-> +3dB ierakstiem pēc-2000. gada</string> + <string name="readahead">Ieslēgt nolasi pirms laika</string> + <string name="readahead_summary">Pirms laika nolasīt pašreiz atskaņoto dziesmu. Šī opcija var novērst skaņas \'raustīšanās\' problēmas. (Kuras izraisa lēna SD atmiņas karte)</string> + <string name="equalizer">Balansieris</string> + <string name="cycle_continuous_shuffling">Nepārtrauktā sajaukšana</string> + <string name="cycle_continuous_shuffling_summary">\"Sajaukšanas režīms\" dziesmas atskaņos pilnīgi nejaušā kārtībā</string> + <string name="notifications">Paziņojumi</string> + <string name="notification_visibility_title">Paziņojuma redzamība</string> + <string name="notification_action_title">Paziņojuma darbība</string> + <string name="playback_screen">Atskaņošanas ekrāns</string> + <string name="playback_on_startup_title">Atvērt palaižot</string> + <string name="playback_on_startup_summary">Palaižot programmu, atvērt atskaņošanas skatu</string> + <string name="display_mode_title">Rādīšanas režīms</string> + <string name="swipe_up_action_title">Darbība žestam uz augšu</string> + <string name="swipe_down_action_title">Darbība žestam uz leju</string> + <string name="cover_press_action_title">Darbība nospiedienam uz vāciņa</string> + <string name="cover_longpress_action_title">Darbība ilgākam nospiedienam uz vāciņa</string> + <string name="library_screen">Bibliotēkas ekrāns</string> + <string name="default_action_title">Noklusētā darbība</string> + <string name="default_playlist_action_title">Noklusētā repertuāra darbība</string> + <string name="accelerometer_shake">Akselelometra kratīšana</string> + <string name="enable_shake_title">Ieslēgt akselerometra kratīšanu</string> + <string name="enable_shake_summary">Aktīvs tikai, atskaņojot mūziku. Dažās ierīcēs nedarbojas, kad ir izslēgts ekrāns.</string> + <string name="shake_action_title">Kratīšanas darbība</string> + <string name="shake_threshold_title">Kratīšanas darbības slieksnis</string> + <string name="misc_features">Citas iespējas</string> + <string name="theme">Tēma</string> + <string name="disable_lockscreen_title">Atslēgt slēgekrānu</string> + <string name="disable_lockscreen_summary">Novērst slēgekrāna aktivizēšanos bibliotēkas vai atskaņošanas ekrānā</string> + <string name="keep_screen_on_title">Paturēt ekrānu ieslēgtu</string> + <string name="keep_screen_on_summary">Ja Vanilla Music ir redzams, paturēt ekrānu (un ierīci) nomodā</string> + <string name="use_idle_timeout_title">Ieslēgt dīkstāves noildzi</string> + <string name="use_idle_timeout_summary">Kad aktīva, atskaņošana tiks apturēta pēc norādītā neaktivitātes perioda</string> + <string name="idle_timeout_title">Dīkstāves noildze</string> + <string name="enable_scroll_to_song_title">Tīt uz dziesmas nosaukumu</string> + <string name="enable_scroll_to_song_summary">Biliotēkas sarakstos tīt uz pašreiz atskaņoto dziesmu/albumu/izpildītāju</string> + <string name="queue_enable_scroll_to_song_title">Tīt uz dziesmas nosaukumu rindā</string> + <string name="queue_enable_scroll_to_song_summary">Mainoties dziesmai, tīt uz pašreiz atskaņoto dziesmu rindā</string> + <string name="jump_to_enqueued_on_play_title">Nospiežot \'Atskaņot\', pāriet uz ierindoto dziesmu</string> + <string name="jump_to_enqueued_on_play_summary">Ja pieprasītā dziesma jau ir rindā, pārlēkt uz tā vietā, lai rindu nodzēstu</string> + <string name="coverloader_android_title">Ielādēt vāku attēlus no Android</string> + <string name="coverloader_android_summary">Vaicāt pēc vāciņa attēla Android iekšējai mēdiju datubāzei</string> + <string name="coverloader_vanilla_title">Ielādēt vāciņa attēlu no mapes</string> + <string name="coverloader_vanilla_summary">Meklēt attēla failus ar nosaukumiem cover.jpg, album.jpg vai artwork.jpg un attēlot tos kā albuma vāku</string> + <string name="coverloader_shadow_title">Ielādēt vāku attēlus no slēptas mapes</string> + <string name="coverloader_shadow_summary">Mēģināt ielādēt vāka attēlu no </string> + <string name="coverloader_inline_title">Ielādēt vāciņa attēlu no faila tagiem</string> + <string name="coverloader_inline_summary">Mēģināt ielādēt iekļauto vāciņa attēlu no faila tagiem</string> + <string name="cover_on_lockscreen_title">Rādīt albuma vāciņu slēgekrānā</string> + <string name="cover_on_lockscreen_summary">Rādīt pašreiz atskaņotās dziesmas albuma vāciņu slēgekrānā</string> + <string name="double_tap_title">Dubultpiesitiena sīkrīks</string> + <string name="double_tap_summary">Izdarot dubultpieskārienu 1x1 izmēra sīkrīkam, tiks atvērts atskaņotājs. Rada 400 ms aizturi, pirms sīkrīks atbildēs uz darbībām.</string> + <string name="scrobble_title">Lietot Scrobble Droid API</string> + <string name="scrobble_summary">Nosūtīt atskaņojumus uz Last.fm, izmantojot Scrobble Droid vai Simple Last.fm Scrobbler</string> + <string name="stock_broadcast_title">Emulēt pamata raidījumus</string> + <string name="stock_broadcast_summary">Sūtīt raidījumus, tādējādi emulējot noklusētā mūzikas atskaņotāja sūtītos, lai būtu iespējama trešo pušu slēgekrānu vadīklu, sīkrīku, u.t.t., kontrole.</string> + <string name="help">Palīdzība</string> + <string name="about">Par</string> + <string name="tabs">Ciļņu kārtība</string> + <string name="customize_tab_order">Regulēt bibliotēkas ciļņu kārtību un redzamību</string> + <string name="restore_default">Atjaunot noklusējumu</string> + <!--The following are for the list preferences--> + <string name="last_used_action">Pēdējā izmantotā darbība</string> + <string name="never_show">Nekad nerādīt</string> + <string name="show_when_playing">Rādīt atskaņošanas laikā (noklusējums)</string> + <string name="always_show">Rādīt vienmērt</string> + <string name="open_main_activity">Atvērt bibliotēku (noklusējums)</string> + <string name="open_mini_popup">Atvērt miniatūru izlecošo logu</string> + <string name="skip_to_next_song">Pāriet uz nākamo dziesmu</string> + <string name="open_full_player">Atvērt pilnu atskaņotāju</string> + <string name="info_on_cover">Informācija uz vāciņa attēla</string> + <string name="info_below_cover">Informācija zem vāciņa attēla</string> + <string name="fixed_info">Informācija fiksētā pozīcijā augšā</string> + <string name="do_nothing">Nedarīt neko</string> + <string name="open_library">Atvērt bibliotēku</string> + <string name="play_pause">Atskaņot/Pauzēt</string> + <string name="next_song">Nākamā dziesma</string> + <string name="previous_song">Iepriekšējā dziesma</string> + <string name="next_album">Nākamais albums</string> + <string name="previous_album">Iepriekšējais albums</string> + <string name="cycle_repeat_mode">Pārslēgt atkārtojuma režīmu</string> + <string name="cycle_shuffle_mode">Pārslēgt jaukšanas režīmu</string> + <string name="enqueue_current_album">Ierindot albumu</string> + <string name="enqueue_current_artist">Ierindot izpildītāju</string> + <string name="enqueue_current_genre">Ierindot žanru</string> + <string name="enqueue_current">Ierindot...</string> + <string name="more_from_current">Vairāk no...</string> + <string name="empty_the_queue">Tukša rinda</string> + <string name="show_queue">Rādīt rindu</string> + <string name="hide_queue">Paslēpt rindu</string> + <string name="dequeue_rest">Noņemt no rindas pārējos</string> + <string name="toggle_controls">Pārslēgt vadīklas</string> + <string name="seek_10s_backward">Iet 10 sekundes atpakaļ</string> + <string name="seek_10s_forward">Iet 10 sekundes uz priekšu</string> + <string name="preferences_action_show_queue">Rādīt rindu</string> + <string name="preferences_action_clear_queue">Notīrīt rindu</string> + <string name="preferences_action_enqueue_current_album">Ierindot albumu</string> + <string name="preferences_action_enqueue_current_artist">Ierindot izpildītāju</string> + <string name="preferences_action_enqueue_current_genre">Ierindot žanru</string> + <string name="jump_to_time">Pārlekt uz laiku</string> + <string name="time_separator">:</string> + <string name="hour_hint">HH</string> + <string name="minute_hint">MM</string> + <string name="second_hint">SS</string> + <string name="error_invalid_position">Neatļauta pozīcija</string> + <string name="filebrowser_start">Failu pārlūka mājas</string> + <string name="customize_filebrowser_start">Failu pārlūks atvērsies šajā mapē</string> + <string name="select">Izvēlēties</string> + <string name="save">Saglabāt</string> + <string name="autoplaylist_playcounts_title">Automātiska repertuāra izveide</string> + <string name="autoplaylist_playcounts_summary">Automātiski izveidot</string> + <string name="autoplaylist_playcounts_fmt" formatted="false">%s \'Top %.0f\' repertuāru</string> + <string name="autoplaylist_playcounts_disabled">Neizveidot automātisko repertuāru</string> + <string name="autoplaylist_playcounts_name" formatted="false">Top %d</string> + <string name="playlist_sync_mode_title">Repertuāra sinhronizācija</string> + <string name="playlist_sync_all">Pilna sinhronizācija</string> + <string name="playlist_sync_only_import">Importēt M3U, nekad eksportēt</string> + <string name="playlist_sync_only_export">Rakstīt M3U, nekad importēt</string> + <string name="playlist_sync_disabled">Atslēgts</string> + <string name="playlist_sync_folder_title">Sinhronizācijas mape</string> + <string name="playlist_sync_folder_summary">Mape, kuru izmantot repertuāra sinhronizācijai</string> + <string name="playlist_export_relative_paths_title">Eksportēt, izmantojot relatīvos ceļus</string> + <string name="playlist_export_relative_paths_summary">Failu ceļus norādīt relatīvi repertuāram</string> + <string name="permission_request_summary">Vanilla Music lasīšanas atļauja vajadzīga, lai parādītu jūsu mūzikas bibliotēku</string> + <string name="reverse_sort">Apgrieztā kārtošana</string> + <string name="share">Dalīties..</string> + <string name="share_failed">Neizdevās kopīgot failu</string> + <string name="sendto">Sūtīt uz...</string> + <string name="no_receiving_apps">Šim mēdija tipam netika atrastas saņemošās lietotnes!</string> + <string name="duration">Ilgums</string> + <string name="dump_database">Izmest datubāzi</string> + <string name="dump_database_result">Datubāze izmesta vietā \'1 %s\'</string> + <string name="force_m3u_import">Piespiedu M3U atkārtota importēšana</string> + <string name="media_library">Multivides bibliotēka</string> + <string name="media_folders_header">Indeksētās mapes</string> + <string name="media_scan_header">Multivides skenētājs</string> + <string name="media_scan_full">Pilna failu sistēmas skenēšana (lēnāk)</string> + <string name="media_scan_drop_db">Izmest mēdiju datubāzi</string> + <string name="media_scan_start">Sākt skenēšanu</string> + <string name="media_scan_force_bastp">Vienmēr izmantot iebūvēto tagu lasītāju</string> + <string name="media_scan_group_albums">Grupēt albumus pēc mapēm</string> + <string name="media_statistics">Statistika</string> + <string name="media_stats_tracks">Celiņu skaits</string> + <string name="media_stats_library_playtime">Kopējais atskaņošanas laiks (stundas)</string> + <string name="media_stats_listen_playtime">Līdz šim atskaņotās mūzikas ilgums stundās</string> + <string name="media_stats_progress">Skenēšanas progress</string> + <string name="media_library_scan_running">Skenē multivides bibliotēku</string> + <string name="media_scan_preferences">Skenētāja opcijas</string> + <string name="media_scan_preferences_change_title">Skenētāja opcijas izmainītas</string> + <string name="media_scan_preferences_change_message">Mainot šo opciju, tiks sākta pilna jūsu bibliotēkas pārskenēšana. Vai vēlaties turpināt?</string> + <!--Folder selector--> + <string name="hint_long_press_to_modify_folder">Ilgais nospiediens, lai mainītu mapes opcijas</string> + <string name="folder_include">Iekļaut</string> + <string name="folder_exclude">Izslēgt</string> + <string name="folder_neutral">Neitrāls</string> + <!--Plugin system--> + <string name="plugins">Spraudņi</string> + <string name="plugin_needs_upgrade">Lūdzu, atjauniniet spraudni 1%s uz jaunāko versiju</string> + <!--Theme names--> + <string name="theme_name_standard_light">Standarta</string> + <string name="theme_name_standard_dark">Standarta (tumšs)</string> + <string name="theme_name_grey_light">Pelēks</string> + <string name="theme_name_grey_dark">Pelēks (tumšs)</string> + <string name="theme_name_orange_light">Oranžs</string> + <string name="theme_name_orange_dark">Oranžs (tumšs)</string> + <string name="theme_name_blue_light">Zils</string> + <string name="theme_name_blue_dark">Zils (tumšs)</string> + <string name="theme_name_red_light">Sarkans</string> + <string name="theme_name_red_dark">Sarkans (tumšs)</string> + <string name="theme_name_amoled_dark">Ellīgi melns (AMOLED)</string> +</resources> diff --git a/app/src/main/res/values-nl/translatable.xml b/app/src/main/res/values-nl/translatable.xml new file mode 100644 index 0000000..15bf8b4 --- /dev/null +++ b/app/src/main/res/values-nl/translatable.xml @@ -0,0 +1,343 @@ +<?xml version='1.0' encoding='UTF-8'?> +<resources> + <string name="app_name">Vanilla Music</string> + <string name="ok">Oké</string> + <string name="cancel">Annuleer</string> + <!--Playback Activity (main screen)--> + <string name="no_songs">Geen nummers aangetroffen op je apparaat.</string> + <string name="empty_queue">Geen nummers geselecteerd. Kies er een aantal uit de bibliotheek of schakel willekeurige modus in door op dit bericht te drukken.</string> + <string name="settings">Instellingen</string> + <string name="no_shuffle">Speel niet willekeurig af</string> + <string name="shuffle_songs">Speel nummers willekeurig af</string> + <string name="shuffle_songs_continuously">Speel nummers voortdurend willekeurig af</string> + <string name="shuffle_albums">Speel albums willekeurig af</string> + <string name="no_repeat">Herhaal niet</string> + <string name="repeat">Herhaal</string> + <string name="repeat_current_song">Herlaad huidige nummer</string> + <string name="stop_current_song">Stop na het huidige nummer</string> + <string name="random">Willekeurig</string> + <string name="random_enabling">Willekeurig afspelen is aangezet</string> + <string name="song_load_failed">Het nummer %s kan niet worden geladen. Misschien is het beschadigd of ontbreekt het.</string> + <string name="queue_cleared">Wachtrij is leeggemaakt.</string> + <string name="cover_art">Albumhoes</string> + <string name="close_notification">Sluit melding</string> + <string name="_genre">genre</string> + <string name="_track">nummer</string> + <string name="_composer">componist</string> + <string name="_path">pad</string> + <string name="_format">bestandsindeling</string> + <string name="_title">titel</string> + <string name="_artist">artiest</string> + <string name="_album">album</string> + <string name="_year">jaar</string> + <string name="_replaygain">rgain</string> + <!--New Playlist Dialog--> + <string name="choose_playlist_name">Kies de naam van de afspeellijst</string> + <string name="create">Creëer</string> + <string name="overwrite">Overschrijf</string> + <string name="delete_playlist">Verwijder afspeellijst %s?</string> + <!--Library--> + <string name="enqueue">Plaats in wachtrij</string> + <string name="enqueue_as_next">Speel als volgende af</string> + <string name="play">Speel af</string> + <string name="edit">Bewerk</string> + <string name="rename">Wijzig naam</string> + <string name="save_as_playlist">Bewaar als afspeellijst...</string> + <string name="add_to_playlist">Voeg toe aan afspeellijst...</string> + <string name="add_to_homescreen">Voeg toe aan beginscherm...</string> + <string name="add_to">Voeg toe aan...</string> + <string name="playlist">Afspeellijst</string> + <string name="homescreen">Beginscherm</string> + <string name="add_to_favorites">Voeg toe aan favorieten</string> + <string name="remove_from_favorites">Verwijder uit favorieten</string> + <string name="playlist_favorites">Favorieten</string> + <string name="new_playlist">Nieuwe afspeellijst...</string> + <string name="expand">Breid uit</string> + <string name="expand_or_play_all">Breid alles uit of speel alles af</string> + <string name="delete">Verwijder</string> + <string name="playback_view">Nu aan het afspelen</string> + <string name="sort_by">Sorteer op</string> + <string name="search">Zoek</string> + <string name="done">Voltooid</string> + <string name="remove">Verwijder</string> + <string name="play_or_enqueue">In wachtrij als er iets afgespeeld wordt; Speel af als er gepauzeerd wordt</string> + <string name="open">Open</string> + <string name="go_home">Persoonlijke map</string> + <string name="jumping_to_song">Het nummer staat al in de wachtrij; bezig met overslaan...</string> + <!--As a developer, you should always supply "one" and "other" + strings. Your translators will know which strings are actually + needed for their language. Always include %d in "one" because + translators will need to use %d for languages where "one" + doesn't mean 1 (as explained above). + + Translators should use http://unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules and + http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html, Type cardinal, + to see which categories apply to integer numbers in their languages--> + <plurals name="playing"> + <item quantity="one">%d nummer wordt afgespeeld.</item> + <item quantity="other">%d nummers worden afgespeeld.</item> + </plurals> + <plurals name="enqueued"> + <item quantity="one">%d nummer in de wachtrij.</item> + <item quantity="other">%d nummers in de wachtrij.</item> + </plurals> + <plurals name="added_to_playlist"> + <item quantity="one">%1$d nummer toegevoegd aan afspeellijst %2$s.</item> + <item quantity="other">%1$d nummers toegevoegd aan afspeellijst %2$s.</item> + </plurals> + <plurals name="removed_from_playlist"> + <item quantity="one">%1$d nummer verwijderd uit afspeellijst %2$s.</item> + <item quantity="other">%1$d nummers verwijderd uit afspeellijst %2$s.</item> + </plurals> + <plurals name="deleted"> + <item quantity="one">%d nummer verwijderd.</item> + <item quantity="other">%d nummers verwijderd.</item> + </plurals> + <string name="delete_file_failed">Kan %s niet verwijderen.</string> + <string name="deleted_item">\'%s\' is verwijderd.</string> + <string name="delete_item">Verwijder \'%s\'?</string> + <string name="delete_file">Verwijder bestand \'%s\'?</string> + <string name="artists">Artiesten</string> + <string name="albums">Albums</string> + <string name="albumartists">Albumartiesten</string> + <string name="composers">Componisten</string> + <string name="songs">Nummers</string> + <string name="playlists">Afspeellijsten</string> + <string name="genres">Genres</string> + <string name="files">Bestanden</string> + <string name="artist">Artiest</string> + <string name="album">Album</string> + <string name="genre">Genre</string> + <string name="folder">Map</string> + <string name="filename">Bestandsnaam</string> + <string name="file_size">Bestandsgrootte</string> + <string name="file_time">Wijzigingstijd</string> + <string name="extension">Extensie</string> + <string name="unknown">Onbekend</string> + <string name="play_all">Speel alles af</string> + <string name="enqueue_all">Alles in wachtrij</string> + <string name="all_songs">Alle nummers</string> + <string name="details">Informatie</string> + <string name="more_from_artist">Meer van artiest</string> + <string name="more_from_album">Meer van album</string> + <string name="title">Titel</string> + <string name="number_of_tracks">Aantal nummers</string> + <string name="year">Jaar</string> + <string name="date_added">Datum toegevoegd</string> + <string name="artist_album">Artiest, album</string> + <string name="artist_year_album">Artiest, jaar, album</string> + <string name="artist_album_track">Artiest, album, nummer</string> + <string name="artist_album_title">Artiest, album, titel</string> + <string name="artist_year">Artiest, jaar</string> + <string name="album_track">Album, nummer</string> + <string name="song_playcount">Aantal keren afgespeeld</string> + <!--Preferences--> + <plurals name="seconds"> + <item quantity="one">%d seconde</item> + <item quantity="other">%d seconden</item> + </plurals> + <plurals name="minutes"> + <item quantity="one">%d minuut</item> + <item quantity="other">%d minuten</item> + </plurals> + <plurals name="hours"> + <item quantity="one">%d uur</item> + <item quantity="other">%d uur</item> + </plurals> + <string name="audio">Audio</string> + <string name="volume_during_ducking_title">Volume tijdens melding</string> + <string name="volume_during_ducking_summary">Afspeelvolume:</string> + <string name="ignore_audiofocus_loss_summary">Blijf afspelen bij permanent verlies van audiofocus</string> + <string name="media_button_title">Koptelefoon-/bluetoothbediening</string> + <string name="media_button_summary">Dit is ook vereist voor ICS-vergrendelschermbediening.</string> + <string name="headset_only_title">Alleen externe uitvoer</string> + <string name="headset_only_summary">Voorkomt dat muziek via de interne luidsprekers wordt afgespeeld.</string> + <string name="headset_pause_title">Pauzeer bij unpluggen</string> + <string name="headset_pause_summary">Pauzeer als de stekker van de koptelefoon uitgenomen wordt.</string> + <string name="headset_launch_title">Speel af bij inpluggen</string> + <string name="headset_launch_summary">Speel af als de koptelefoon aangesloten wordt. (Hiervoor moet de app \'Headphone detector\' geïnstalleerd zijn.)</string> + <string name="headset_launch_app_missing">Voor deze functie moet de app \'Headphone detector\' geïnstalleerd zijn.\nWil je de Play Store openen om deze app te installeren?</string> + <string name="replaygain">ReplayGain</string> + <string name="replaygain_summary">Stel afhandelen van ReplayGain-informatie in</string> + <string name="replaygain_track_title">Zet ReplayGain per nummer aan</string> + <string name="replaygain_track_summary">Speelt alle nummers af met hetzelfde volume</string> + <string name="replaygain_album_title">Zet album-ReplayGain aan</string> + <string name="replaygain_album_summary">Bewaart de dynamiek van het album</string> + <string name="replaygain_bump_title">ReplayGain pre-amp</string> + <string name="replaygain_untagged_debump_title">Nummers zonder ReplayGain-tag</string> + <string name="replaygain_untagged_debump_summary">Verminder volume met</string> + <string name="replaygain_preamp_note_title">Let op</string> + <string name="replaygain_preamp_note_content">Android staat Vanilla Music niet toe het volume tot meer dan 100% te verhogen. Het instellen van de Pre-amp op een hoge waarde kan problemen veroorzaken bij het luisteren van \'stille\' muziek. \n\nAanbevolen waarden zijn:\n-> -3dB voor stille/klassieke muziek\n-> +3dB voor opnamen van na 2000</string> + <string name="readahead">Zet vooruitlezen aan</string> + <string name="readahead_summary">Nummer dat nu afgespeeld wordt, vooruitlezen. Deze optie kan problemen oplossen met wegvallend geluid (veroorzaakt door een trage SD-kaart)</string> + <string name="equalizer">Equalizer</string> + <string name="cycle_continuous_shuffling">Speel voortdurend willekeurig af</string> + <string name="cycle_continuous_shuffling_summary">\'Willekeurige modus\' zal de nummers in volledig willekeurige volgorde afspelen</string> + <string name="notifications">Meldingen</string> + <string name="notification_visibility_title">Zichtbaarheid van meldingen</string> + <string name="notification_action_title">Meldingsactie</string> + <string name="playback_screen">Afspeelscherm</string> + <string name="playback_on_startup_title">Open bij opstarten</string> + <string name="playback_on_startup_summary">Open afspeelschermweergave bij opstarten</string> + <string name="display_mode_title">Weergavemodus</string> + <string name="swipe_up_action_title">Omhoogveegactie</string> + <string name="swipe_down_action_title">Omlaagveegactie</string> + <string name="cover_press_action_title">Actie bij drukken op albumhoes</string> + <string name="cover_longpress_action_title">Actie bij ingedrukt houden van albumhoes</string> + <string name="library_screen">Verzamelingsscherm</string> + <string name="default_action_title">Standaardactie</string> + <string name="default_playlist_action_title">Standaardactie bij afspeellijst</string> + <string name="accelerometer_shake">Schudden met apparaat</string> + <string name="enable_shake_title">Schudden met apparaat aangezet</string> + <string name="enable_shake_summary">Alleen actief tijdens het afspelen van muziek. Op sommige toestellen werkt dit niet wanneer het scherm uit is.</string> + <string name="shake_action_title">Actie bij schudden</string> + <string name="shake_threshold_title">Drempel om actie bij schudden te forceren</string> + <string name="misc_features">Overige functies</string> + <string name="theme">Thema</string> + <string name="disable_lockscreen_title">Zet vergrendelscherm uit</string> + <string name="disable_lockscreen_summary">Voorkomt dat het vergrendelscherm geactiveerd wordt als de verzameling of het afspeelscherm getoond wordt</string> + <string name="keep_screen_on_title">Houd scherm aan</string> + <string name="keep_screen_on_summary">Voorkom slaapstand van scherm (en toestel) zolang Vanilla Music zichtbaar is</string> + <string name="use_idle_timeout_title">Time-out bij geen activiteit aangezet</string> + <string name="use_idle_timeout_summary">Als dit wordt ingeschakeld, dan zal het afspelen stoppen na de ingestelde periode van inactiviteit</string> + <string name="idle_timeout_title">Time-out bij inactiviteit</string> + <string name="enable_scroll_to_song_title">Scrol naar titel van nummer</string> + <string name="enable_scroll_to_song_summary">Scrol naar nummer/album/artiest in de verzameling dat/die op dat moment wordt afgespeeld</string> + <string name="queue_enable_scroll_to_song_title">Scrol naar titel van nummer in wachtrij</string> + <string name="queue_enable_scroll_to_song_summary">Scrol naar nummer dat momenteel in de wachtrij speelt als volgend nummer start</string> + <string name="jump_to_enqueued_on_play_title">Spring naar nummer in wachtrij bij \'Play\'</string> + <string name="jump_to_enqueued_on_play_summary">Als het aangevraagde nummer al in de wachtrij zit, spring er dan naartoe in plaats van de wachtrij op te schonen</string> + <string name="coverloader_android_title">Laad albumafbeeldingen van Android</string> + <string name="coverloader_android_summary">Doorzoek Androids interne mediadatabank op albumafbeeldigen</string> + <string name="coverloader_vanilla_title">Laad Albumafbeeldingen uit map</string> + <string name="coverloader_vanilla_summary">Zoek afbeeldingen met de naam cover.jpg, album.jpg of artwork.jpg en gebruik die als albumhoes</string> + <string name="coverloader_shadow_title">Laad afbeeldingen uit verborgen map</string> + <string name="coverloader_shadow_summary">Probeer afbeeldingen te laden uit \'/sdcard/Music/.vanilla/ARTIST/ALBUM.jpg\'</string> + <string name="coverloader_inline_title">Laad afbeeldingen van bestandstag</string> + <string name="coverloader_inline_summary">Probeer ingebedde afbeelding uit bestandstag te laden</string> + <string name="cover_on_lockscreen_title">Toon albumhoes op vergrendelscherm</string> + <string name="cover_on_lockscreen_summary">Toon de albumhoes van het momenteel afspelende nummer op het vergrendelscherm</string> + <string name="double_tap_title">Dubbeltik widget</string> + <string name="double_tap_summary">Dubbeltikken op de 1x1-widget opent de speler. Er is een 400ms vertraging voordat de widget reageert op acties.</string> + <string name="scrobble_title">Gebruik Scrobble Droid API</string> + <string name="scrobble_summary">Scrobble naar Last.fm door de Scrobble Droid of Simple Last.fm Scrobbler</string> + <string name="stock_broadcast_title">Emuleer standaarduitzendingen</string> + <string name="stock_broadcast_summary">Standaarduitzendingen gebruiken, zoals die van de standaard muziekspeler, om te werken met vergrendelschermbedieningen van derden, widgets, enz.</string> + <string name="help">Hulp</string> + <string name="about">Over</string> + <string name="tabs">Tabbladvolgorde</string> + <string name="customize_tab_order">Pas volgorde en zichtbaarheid van de verzamelingstabbladen aan</string> + <string name="restore_default">Herstel standaardwaarden</string> + <!--The following are for the list preferences--> + <string name="last_used_action">Laatst gebruikte actie</string> + <string name="never_show">Toon nooit</string> + <string name="show_when_playing">Toon tijdens afspelen (standaard)</string> + <string name="always_show">Toon altijd</string> + <string name="open_main_activity">Open verzameling (standaard)</string> + <string name="open_mini_popup">Open mini-uitklapmenu</string> + <string name="skip_to_next_song">Ga naar volgend nummer</string> + <string name="open_full_player">Open volledige speler</string> + <string name="info_on_cover">Informatie op albumhoes</string> + <string name="info_below_cover">Informatie onder albumhoes</string> + <string name="fixed_info">Informatie op vaste plaats bovenaan</string> + <string name="do_nothing">Doe niets</string> + <string name="open_library">Open verzameling</string> + <string name="play_pause">Speel af/Pauzeer</string> + <string name="next_song">Volgend nummer</string> + <string name="previous_song">Vorig nummer</string> + <string name="next_album">Volgend album</string> + <string name="previous_album">Vorig album</string> + <string name="cycle_repeat_mode">Herhaalmodus veranderen</string> + <string name="cycle_shuffle_mode">Shufflemodus veranderen</string> + <string name="enqueue_current_album">Voeg album toe aan wachtrij</string> + <string name="enqueue_current_artist">Voeg artiest toe aan wachtrij</string> + <string name="enqueue_current_genre">Voeg genre toe aan wachtrij</string> + <string name="enqueue_current">Voeg toe aan wachtrij…</string> + <string name="more_from_current">Meer van…</string> + <string name="empty_the_queue">Maak wachtrij leeg</string> + <string name="show_queue">Toon wachtrij</string> + <string name="hide_queue">Verberg wachtrij</string> + <string name="dequeue_rest">Verwijder rest uit wachtrij</string> + <string name="toggle_controls">Toon/verberg bediening</string> + <string name="seek_10s_backward">Spel 10 seconden terug</string> + <string name="seek_10s_forward">Spoel 10 seconden vooruit</string> + <string name="move_to_top">Verplaats naar boven</string> + <string name="move_to_bottom">Verplaats naar onderen</string> + <string name="preferences_action_show_queue">Toon wachtrij</string> + <string name="preferences_action_clear_queue">Maak wachtrij leeg</string> + <string name="preferences_action_enqueue_current_album">Voeg album toe aan wachtrij</string> + <string name="preferences_action_enqueue_current_artist">Voeg artiest toe aan wachtrij</string> + <string name="preferences_action_enqueue_current_genre">Voeg genre toe aan wachtrij</string> + <string name="jump_to_time">Naar tijd springen</string> + <string name="time_separator">:</string> + <string name="hour_hint">UU</string> + <string name="minute_hint">MM</string> + <string name="second_hint">SS</string> + <string name="error_invalid_position">Ongeldige positie</string> + <string name="filebrowser_start">Persoonlijke map bestandsbeheerder</string> + <string name="customize_filebrowser_start">Bestandsbeheerder begint in deze map</string> + <string name="select">Selecteer</string> + <string name="save">Opslaan</string> + <string name="autoplaylist_playcounts_title">Automatische afspeellijst</string> + <string name="autoplaylist_playcounts_summary">Creëer automatisch een</string> + <string name="autoplaylist_playcounts_fmt" formatted="false">%s \'Top %.0f\'-afspeellijst</string> + <string name="autoplaylist_playcounts_disabled">Creëren geen automatische afspeellijst</string> + <string name="autoplaylist_playcounts_name" formatted="false">Top %d</string> + <string name="playlist_sync_mode_title">Afspeellijstsynchronisatie</string> + <string name="playlist_sync_all">Volledige synchronisatie</string> + <string name="playlist_sync_only_import">Importeer M3U, nooit exporteren</string> + <string name="playlist_sync_only_export">Schrijf M3U weg, nooit importeren</string> + <string name="playlist_sync_disabled">Uitgezet</string> + <string name="playlist_sync_folder_title">Synchronisatiemap</string> + <string name="playlist_sync_folder_summary">Te gebruiken map voor synchroniseren van afspeellijst</string> + <string name="playlist_export_relative_paths_title">Exporteer naar relatieve paden</string> + <string name="playlist_export_relative_paths_summary">Refereer bestandspaden relatief t.o.v. de playlist</string> + <string name="permission_request_summary">Vanilla Music moet worden gemachtigd om je muziekverzameling te tonen</string> + <string name="reverse_sort">Draai sorteervolgorde om</string> + <string name="share">Deel...</string> + <string name="share_failed">Kan bestand niet delen</string> + <string name="sendto">Verstuur naar...</string> + <string name="no_receiving_apps">Geen ontvangende apps gevonden voor dit bestandstype!</string> + <string name="duration">Duur</string> + <string name="dump_database">Dump (verwijder) databank</string> + <string name="dump_database_result">Databank is gedumpt naar \'%s\'</string> + <string name="force_m3u_import">Forceer opnieuw importeren M3U</string> + <string name="media_library">Mediaverzameling</string> + <string name="media_folders_header">Geïndexeerde mappen</string> + <string name="media_scan_header">Mediascanner</string> + <string name="media_scan_full">Scan volledige bestandssysteem (langzamer)</string> + <string name="media_scan_drop_db">Maak mediadatabank leeg</string> + <string name="media_scan_start">Start scan</string> + <string name="media_scan_force_bastp">Gebruik altijd de ingebouwde labellezer</string> + <string name="media_scan_group_albums">Groepeer album in mappen</string> + <string name="media_statistics">Statistieken</string> + <string name="media_stats_tracks">Aantal nummers</string> + <string name="media_stats_library_playtime">Totale afspeeltijd (uren)</string> + <string name="media_stats_listen_playtime">Afgespeelde uren tot nu toe</string> + <string name="media_stats_progress">Scan voortgang</string> + <string name="media_library_scan_running">Media bibiotheek aan het scannen…</string> + <string name="media_scan_preferences">Scanneropties</string> + <string name="media_scan_preferences_change_title">Scanneropties zijn veranderd</string> + <string name="media_scan_preferences_change_message">Veranderen van deze optie zorgt ervoor dat de gehele bibliotheek opnieuw gescand wordt. Doorgaan?</string> + <string name="folder_picker_spinner_desc">Directoriestatus:</string> + <!--Folder selector--> + <string name="hint_long_press_to_modify_folder">Lang aanraken voor het veranderen van de mapopties</string> + <string name="folder_include">Sluit in</string> + <string name="folder_exclude">Sluit uit</string> + <string name="folder_neutral">Neutraal</string> + <!--Plugin system--> + <string name="plugins">Plugins</string> + <string name="plugin_needs_upgrade">Upgrade plugin %s a.u.b. naar de laatste versie</string> + <!--Theme names--> + <string name="theme_name_standard_light">Standaard</string> + <string name="theme_name_standard_dark">Standaard (Donker)</string> + <string name="theme_name_grey_light">Grijs</string> + <string name="theme_name_grey_dark">Grijs (Donker)</string> + <string name="theme_name_orange_light">Oranje</string> + <string name="theme_name_orange_dark">Oranje (Donker)</string> + <string name="theme_name_blue_light">Blauw</string> + <string name="theme_name_blue_dark">Blauw (Donker)</string> + <string name="theme_name_red_light">Rood</string> + <string name="theme_name_red_dark">Rood (Donker)</string> + <string name="theme_name_amoled_dark">Pikzwart (AMOLED)</string> +</resources> diff --git a/app/src/main/res/values-no/translatable.xml b/app/src/main/res/values-no/translatable.xml new file mode 100644 index 0000000..6920a0a --- /dev/null +++ b/app/src/main/res/values-no/translatable.xml @@ -0,0 +1,80 @@ +<?xml version="1.0" encoding="utf-8"?> +<!--Generated by crowdin.net--> +<resources> + <string name="app_name">Vanilla Music</string> + <string name="no_songs">Ingen låter finnes på enheten.</string> + <string name="settings">Instillinger</string> + <string name="random_enabling">Tilfeldig aktivert</string> + <string name="song_load_failed">Kunne ikke laste låt %s. Den kan være skadet eller mangler.</string> + <string name="queue_cleared">Kø ryddet.</string> + <string name="choose_playlist_name">Velg Spilleliste Navn</string> + <string name="create">Lage</string> + <string name="overwrite">Overskriv</string> + <string name="enqueue">Kø</string> + <string name="play">Spill</string> + <string name="edit">Endre</string> + <string name="rename">Gi nytt navn</string> + <string name="add_to_playlist">Legg til spilleliste…</string> + <string name="new_playlist">Ny Spilleliste…</string> + <string name="expand">Utvid</string> + <string name="delete">Slett</string> + <string name="playback_view">Spilles Nå</string> + <string name="search">Søk</string> + <string name="artists">Artister</string> + <string name="albums">Album</string> + <string name="songs">Låter</string> + <string name="playlists">Spillelister</string> + <string name="genres">Gjangre</string> + <string name="unknown">Ukjent</string> + <string name="play_all">Soill Alt</string> + <string name="enqueue_all">Kø Alt</string> + <string name="all_songs">Alle Låter</string> + <string name="media_button_title">Bruk Hodetelefon Knapper</string> + <string name="headset_only_title">Kun Ekstern Lydutgang</string> + <string name="headset_pause_title">Pause Når Frakoblet</string> + <string name="headset_pause_summary">Pause når hodetelefonen er frakoblet.</string> + <string name="notification_action_title">Varsel Handling</string> + <string name="display_mode_title">Visningsmodus</string> + <string name="swipe_up_action_title">Sveip Opp Handling</string> + <string name="swipe_down_action_title">Sveip Ned Handling</string> + <string name="cover_press_action_title">Cover Tapp Handling</string> + <string name="cover_longpress_action_title">Lang Cover Trykk Handling</string> + <string name="default_action_title">Standard Handling</string> + <string name="use_idle_timeout_title">Aktiver Tomgang</string> + <string name="use_idle_timeout_summary">Når aktiv, blir avspillingen stoppet etter en gitt periode med inaktivitet</string> + <string name="idle_timeout_title">Tomgang</string> + <string name="double_tap_title">Dobbeltapp Widget</string> + <string name="double_tap_summary">Dobbeltapping på 1x1 widget vil åpne spilleren. Forvent en 400ms forsinkelse før widgeten reagerer på handlingen.</string> + <string name="scrobble_title">Bruk ScrobbleDroid API</string> + <string name="scrobble_summary">Scrobble til Last.FM via ScrobbleDroid eller Simple Last.FM Scrobbler</string> + <string name="stock_broadcast_title">Emuler Innebygd Sendinger</string> + <string name="stock_broadcast_summary">Send sendinger som emulerer den innebygde spilleren til å fungere med tredjeparts låseskjermer, widgets, etc.</string> + <plurals name="playing"> + <item quantity="one">1 låt spilles.</item> + <item quantity="other">%d låter spilles.</item> + </plurals> + <plurals name="enqueued"> + <item quantity="one">1 låt i køen.</item> + <item quantity="other">%d låter i køen.</item> + </plurals> + <plurals name="added_to_playlist"> + <item quantity="one">1 låt lagt til spilleliste %2$s.</item> + <item quantity="other">%1$d låter lagt til spilleliste %2$s.</item> + </plurals> + <plurals name="deleted"> + <item quantity="one">1 låt slettet.</item> + <item quantity="other">%d låter slettet.</item> + </plurals> + <plurals name="seconds"> + <item quantity="one">1 sekund</item> + <item quantity="other">%d sekunder</item> + </plurals> + <plurals name="minutes"> + <item quantity="one">1 minutt</item> + <item quantity="other">%d minutter</item> + </plurals> + <plurals name="hours"> + <item quantity="one">1 time</item> + <item quantity="other">%d timer</item> + </plurals> +</resources> diff --git a/app/src/main/res/values-pl/translatable.xml b/app/src/main/res/values-pl/translatable.xml new file mode 100644 index 0000000..1fbcb85 --- /dev/null +++ b/app/src/main/res/values-pl/translatable.xml @@ -0,0 +1,357 @@ +<?xml version='1.0' encoding='UTF-8'?> +<resources> + <string name="app_name">Vanilla Music</string> + <string name="ok">Potwierdź</string> + <string name="cancel">Anuluj</string> + <!--Playback Activity (main screen)--> + <string name="no_songs">Brak utworów na Twoim urządzeniu.</string> + <string name="empty_queue">Nie wybrano utworów. Wybierz jakieś z biblioteki lub włącz tryb losowego odtwarzania, poprzez stuknięcie w ten komunikat.</string> + <string name="settings">Ustawienia</string> + <string name="no_shuffle">Bez mieszania</string> + <string name="shuffle_songs">Utwory losowo</string> + <string name="shuffle_songs_continuously">Utwory całkowicie losowo</string> + <string name="shuffle_albums">Albumy losowo</string> + <string name="no_repeat">Bez powtarzania</string> + <string name="repeat">Powtarzanie</string> + <string name="repeat_current_song">Powtórz odtwarzany utwór</string> + <string name="stop_current_song">Zatrzymaj po odtwarzanym utworze</string> + <string name="random">Losowo</string> + <string name="random_enabling">Włączono przypadkową kolejność odtwarzania utworów</string> + <string name="song_load_failed">Błąd ładowania utworu %s. Może być uszkodzony lub usunięty.</string> + <string name="queue_cleared">Kolejka wyczyszczona.</string> + <string name="cover_art">Okładka</string> + <string name="close_notification">Zamknij powiadomienia</string> + <string name="_genre">gatunek muzyczny</string> + <string name="_track">numer utworu</string> + <string name="_composer">kompozytor</string> + <string name="_path">ścieżka</string> + <string name="_format">format</string> + <string name="_title">tytuł</string> + <string name="_artist">artysta</string> + <string name="_album">album</string> + <string name="_year">rok</string> + <string name="_replaygain">wzmocnienie</string> + <!--New Playlist Dialog--> + <string name="choose_playlist_name">Nazwa listy odtwarzania</string> + <string name="create">Utwórz</string> + <string name="overwrite">Nadpisz</string> + <string name="delete_playlist">Czy usunąć listę odtwarzania %s?</string> + <!--Library--> + <string name="enqueue">Kolejkowanie</string> + <string name="enqueue_as_next">Odtwórz następny</string> + <string name="play">Odtwórz</string> + <string name="edit">Edytuj</string> + <string name="rename">Zmień nazwę</string> + <string name="save_as_playlist">Zapisz listę odtwarzania jako…</string> + <string name="add_to_playlist">Dodaj do listy odtwarzania…</string> + <string name="add_to_homescreen">Dodaj do ekranu głównego…</string> + <string name="add_to">Dodaj do…</string> + <string name="playlist">listy odtwarzania</string> + <string name="homescreen">ekranu głównego</string> + <string name="add_to_favorites">Dodaj do ulubionych</string> + <string name="remove_from_favorites">Usuń z ulubionych</string> + <string name="playlist_favorites">Ulubione</string> + <string name="new_playlist">Nowa lista odtwarzania…</string> + <string name="expand">Rozszerz</string> + <string name="expand_or_play_all">Rozszerz lub odtwórz wszystkie</string> + <string name="delete">Usuń</string> + <string name="playback_view">Teraz odtwarzane</string> + <string name="sort_by">Sortuj po</string> + <string name="search">Szukaj</string> + <string name="done">Gotowe</string> + <string name="remove">Skasuj</string> + <string name="play_or_enqueue">Kolejkuj, jeżeli odtwarzane; odtwórz, jeżeli wstrzymano</string> + <string name="open">Otwórz</string> + <string name="go_home">Katalog główny</string> + <string name="jumping_to_song">Utwór już na liście odtwarzania, przełączam…</string> + <!--As a developer, you should always supply "one" and "other" + strings. Your translators will know which strings are actually + needed for their language. Always include %d in "one" because + translators will need to use %d for languages where "one" + doesn't mean 1 (as explained above). + + Translators should use http://unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules and + http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html, Type cardinal, + to see which categories apply to integer numbers in their languages--> + <plurals name="playing"> + <item quantity="one">Odtwarzam %d utwór.</item> + <item quantity="few">Odtwarzam %d utwory.</item> + <item quantity="many">Odtwarzam %d utworów.</item> + <item quantity="other">Odtwarzam %d utworów.</item> + </plurals> + <plurals name="enqueued"> + <item quantity="one">Zakolejkowano %d utwór.</item> + <item quantity="few">Zakolejkowano %d utwory.</item> + <item quantity="many">Zakolejkowano %d utworów.</item> + <item quantity="other">Zakolejkowano %d utworów.</item> + </plurals> + <plurals name="added_to_playlist"> + <item quantity="one">Dodano %1$d utwór do listy odtwarzania %2$s.</item> + <item quantity="few">Dodano %1$d utwory do listy odtwarzania %2$s.</item> + <item quantity="many">Dodano %1$d utworów do listy odtwarzania %2$s.</item> + <item quantity="other">Dodano %1$d utworów do listy odtwarzania %2$s.</item> + </plurals> + <plurals name="removed_from_playlist"> + <item quantity="one">Usunięto %1$d utwór z listy odtwarzania %2$s.</item> + <item quantity="few">Usunięto %1$d utwory z listy odtwarzania %2$s.</item> + <item quantity="many">Usunięto %1$d utworów z listy odtwarzania %2$s.</item> + <item quantity="other">Usunięto %1$d utworów z listy odtwarzania %2$s.</item> + </plurals> + <plurals name="deleted"> + <item quantity="one">Usunięto %d utwór.</item> + <item quantity="few">Usunięto %d utwory.</item> + <item quantity="many">Usunięto %d utworów.</item> + <item quantity="other">Usunięto %d utworów.</item> + </plurals> + <string name="delete_file_failed">Nie można usunąć %s.</string> + <string name="deleted_item">Usunięto ‘%s’.</string> + <string name="delete_item">Usunąć \'%s\'?</string> + <string name="delete_file">Czy usunąć plik ‘%s’?</string> + <string name="artists">Artyści</string> + <string name="albums">Albumy</string> + <string name="albumartists">Artyści albumów</string> + <string name="composers">Kompozytorzy</string> + <string name="songs">Utwory</string> + <string name="playlists">Listy odtwarzania</string> + <string name="genres">Gatunki muzyczne</string> + <string name="files">Pliki</string> + <string name="artist">Artysta</string> + <string name="album">Album</string> + <string name="genre">Gatunek muzyczny</string> + <string name="folder">Katalog</string> + <string name="filename">Nazwa pliku</string> + <string name="file_size">Rozmiar pliku</string> + <string name="file_time">Zmodyfikowano</string> + <string name="extension">Rozszerzenie</string> + <string name="unknown">Nieznane</string> + <string name="play_all">Odtwórz wszystkie</string> + <string name="enqueue_all">Kolejkuj wszystkie</string> + <string name="all_songs">Wszystkie utwory</string> + <string name="details">Szczegóły</string> + <string name="more_from_artist">Więcej od tego artysty</string> + <string name="more_from_album">Więcej z tego albumu</string> + <string name="title">Tytuł</string> + <string name="number_of_tracks">Liczba utworów</string> + <string name="year">Rok</string> + <string name="date_added">Data dodania</string> + <string name="artist_album">Artysta, album</string> + <string name="artist_year_album">Artysta, rok, album</string> + <string name="artist_album_track">Artysta, album, numer utworu</string> + <string name="artist_album_title">Artysta, album, tytuł</string> + <string name="artist_year">Artysta, rok</string> + <string name="album_track">Artysta, numer utworu</string> + <string name="song_playcount">Ilość odtworzeń</string> + <!--Preferences--> + <plurals name="seconds"> + <item quantity="one">%d sekunda</item> + <item quantity="few">%d sekundy</item> + <item quantity="many">%d sekund</item> + <item quantity="other">%d sekund</item> + </plurals> + <plurals name="minutes"> + <item quantity="one">%d minuta</item> + <item quantity="few">%d minuty</item> + <item quantity="many">%d minut</item> + <item quantity="other">%d minut</item> + </plurals> + <plurals name="hours"> + <item quantity="one">%d godzina</item> + <item quantity="few">%d godziny</item> + <item quantity="many">%d godzin</item> + <item quantity="other">%d godzin</item> + </plurals> + <string name="audio">Audio</string> + <string name="volume_during_ducking_title">Głośność podczas powiadomień</string> + <string name="volume_during_ducking_summary">Głośność odtwarzania:</string> + <string name="ignore_audiofocus_loss_summary">Podtrzymuj odtwarzanie przy całkowitej utracie koncentracji dźwięku</string> + <string name="media_button_title">Sterowanie przyciskami zestawu słuchawkowego/Bluetooth</string> + <string name="media_button_summary">Wymagane także dla blokady ekranu Androida 4.0+.</string> + <string name="headset_only_title">Jedynie wyjście zewnętrzne</string> + <string name="headset_only_summary">Zapobiega odtwarzaniu dźwięku przez głośnik wewnętrzny urządzenia.</string> + <string name="headset_pause_title">Zapauzuj po odłączeniu</string> + <string name="headset_pause_summary">Pauzuje odtwarzanie dźwięku w momencie odłączenia słuchawek.</string> + <string name="headset_launch_title">Odtwarzaj po podłączeniu</string> + <string name="headset_launch_summary">Automatycznie zacznij odtwarzać dźwięk po podłączeniu słuchawek. (Wymaga zainstalowania aplikacji \'Headphone detector\').</string> + <string name="headset_launch_app_missing">Ta opcja wymaga zainstalowania aplikacji \'Headphone detector\'\nCzy chcesz otworzyć Sklep Play, aby zainstalować aplikację?</string> + <string name="replaygain">ReplayGain</string> + <string name="replaygain_summary">Konfiguracja obsługi wzmocnienia dźwięku</string> + <string name="replaygain_track_title">Włącz wzmocnienie dźwięku względem utworu</string> + <string name="replaygain_track_summary">Odtwarzanie wszystkich utworów z jednakową głośnością</string> + <string name="replaygain_album_title">Włącz wzmocnienie dźwięku względem albumu</string> + <string name="replaygain_album_summary">Zachowanie dynamiki albumu</string> + <string name="replaygain_bump_title">Wstępne wzmocnienie dźwięku</string> + <string name="replaygain_untagged_debump_title">Dla utworów bez znacznika ReplayGain</string> + <string name="replaygain_untagged_debump_summary">Ściszenie dzwięku o</string> + <string name="replaygain_preamp_note_title">Uwaga</string> + <string name="replaygain_preamp_note_content">Android nie pozwala Vanilla Music na podniesienie głośności dźwięku do >100%. Ustawianie wysokiej wartości przedwzmocnienia dźwięku może powodować problemy, jeżeli słuchasz „cichego” utworu. \n\nZalecane wartości to:\n-> -3dB dla cichej/klasycznej muzyki\n-> +3dB dla nagrań po 2000 r.</string> + <string name="readahead">Włączenie wczytywania z wyprzedzeniem</string> + <string name="readahead_summary">Wczytuj z wyprzedzeniem aktualnie odtwarzany utwór. Ta opcja może rozwiązać problem zacinania dźwięku (spowodowany wolną kartą SD).</string> + <string name="equalizer">Korektor dźwięku</string> + <string name="cycle_continuous_shuffling">Ciągłe losowanie</string> + <string name="cycle_continuous_shuffling_summary">W trybie losowym utwory będą odtwarzane całkowicie losowo</string> + <string name="notifications">Powiadomienie</string> + <string name="notification_visibility_title">Widoczność powiadomienia</string> + <string name="notification_action_title">Akcja powiadomienia</string> + <string name="playback_screen">Ekran odtwarzania</string> + <string name="playback_on_startup_title">Otwórz na starcie</string> + <string name="playback_on_startup_summary">Otwieranie ekranu odtwarzania na starcie</string> + <string name="display_mode_title">Tryb wyświetlania</string> + <string name="swipe_up_action_title">Akcja przeciągnięcia w górę</string> + <string name="swipe_down_action_title">Akcja przeciągnięcia w dół</string> + <string name="cover_press_action_title">Akcja kliknięcia w okładkę</string> + <string name="cover_longpress_action_title">Akcja długiego kliknięcia na okładkę</string> + <string name="library_screen">Ekran biblioteki</string> + <string name="default_action_title">Domyślna akcja</string> + <string name="default_playlist_action_title">Domyślna akcja listy odtwarzania</string> + <string name="accelerometer_shake">Potrząśnięcie telefonem - akcelerometr</string> + <string name="enable_shake_title">Włączenie potrząśnięcia telefonem - akcelerometrem</string> + <string name="enable_shake_summary">Aktywne jedynie, gdy muzyka jest odtwarzana. Na niektórych urządzeniach nie działa, gdy ekran jest wygaszony.</string> + <string name="shake_action_title">Akcja potrząśnięcia</string> + <string name="shake_threshold_title">Próg wyzwolenia siły potrząśnięcia</string> + <string name="misc_features">Pozostałe funkcje</string> + <string name="theme">Skórka</string> + <string name="disable_lockscreen_title">Wyłączenie ekranu blokady</string> + <string name="disable_lockscreen_summary">Przeciwdziała włączaniu blokady ekranu w momencie przeglądania biblioteki lub ekranu odtwarzania</string> + <string name="keep_screen_on_title">Trzymaj ekran włączony</string> + <string name="keep_screen_on_summary">Nie wyłączaj ekranu (i urządzenia) podczas gdy Vanilla Music jest aktywny</string> + <string name="use_idle_timeout_title">Włączenie czasu bezczynności</string> + <string name="use_idle_timeout_summary">Gdy aktywne, odtwarzanie zostanie zatrzymane po upływie ustawionej wartości czasu nieaktywności</string> + <string name="idle_timeout_title">Czas bezczynności</string> + <string name="enable_scroll_to_song_title">Przewiń do odtwarzanego utworu</string> + <string name="enable_scroll_to_song_summary">Przewiń do aktualnie odtwarzanego utworu/albumu/artysty w widoku biblioteki</string> + <string name="queue_enable_scroll_to_song_title">Przewiń do odtwarzanego utworu</string> + <string name="queue_enable_scroll_to_song_summary">Przewiń do obecnie odtwarzanego utworu na liście odtwarzania przy zmianie piosenki</string> + <string name="jump_to_enqueued_on_play_title">Przeskocz do utworu w kolejce</string> + <string name="jump_to_enqueued_on_play_summary">Jeżeli żądany utwór już znajduje się w kolejce odtwarzania, przeskocz do niego zamiast wymazywać całą kolejkę</string> + <string name="coverloader_android_title">Załaduj okładkę albumu z systemu Android</string> + <string name="coverloader_android_summary">Sprawdzanie w wewnętrznej bazie systemu Android w poszukiwaniu okładki albumu</string> + <string name="coverloader_vanilla_title">Ładowanie okładki albumu z folderu</string> + <string name="coverloader_vanilla_summary">Szukaj obrazów o nazwie \'cover.jpg\', \'album.jpg\' lub \'artwork.jpg\' i wyświetlaj je jako okładki albumu</string> + <string name="coverloader_shadow_title">Ładowanie okladek albumów z ukrytych folderów</string> + <string name="coverloader_shadow_summary">Spróbuj załadować okładkę albumu z \'/sdcard/Music/.vanilla/ARTIST/ALBUM.jpg\'</string> + <string name="coverloader_inline_title">Wczytaj okładkę ze znaczników</string> + <string name="coverloader_inline_summary">Spróbuj załadować okładkę z zagnieżdżonych znaczników pliku</string> + <string name="cover_on_lockscreen_title">Pokazuj okładkę albumu na ekranie blokady</string> + <string name="cover_on_lockscreen_summary">Wyświetlanie okładki albumu aktualnie odtwarzanego utworu na ekranie blokady</string> + <string name="double_tap_title">Dwukrotne kliknięcie widżetu</string> + <string name="double_tap_summary">Podwójne kliknięcie widżetu 1x1 otworzy odtwarzacz. Wprowadza zwłokę 400ms zanim widget odpowie na akcję.</string> + <string name="scrobble_title">Używanie API Scrobble Droid</string> + <string name="scrobble_summary">Scrobblowanie do Last.fm poprzez Scrobble Droid lub Simple Last.fm Scrobbler</string> + <string name="stock_broadcast_title">Emulowanie systemowych komunikatów</string> + <string name="stock_broadcast_summary">Wysyła komunikaty udające komunikaty wysyłane przez systemowy odtwarzacz muzyki, aby współpracowały z trzecimi aplikacjami blokad ekranów, widżetów, itp.</string> + <string name="help">Pomoc</string> + <string name="about">O Vanilla Music...</string> + <string name="tabs">Kolejność zakładek</string> + <string name="customize_tab_order">Dostosowanie kolejności oraz widoczności zakładek biblioteki</string> + <string name="restore_default">Przywróć domyślne</string> + <!--The following are for the list preferences--> + <string name="last_used_action">Ostatnio używana akcja</string> + <string name="never_show">Nigdy nie pokazuj</string> + <string name="show_when_playing">Pokazuj podczas odtwarzania (domyślne)</string> + <string name="always_show">Zawsze pokazuj</string> + <string name="open_main_activity">Otwórz bibliotekę (domyślne)</string> + <string name="open_mini_popup">Otwórz mini wyskakujące okienko</string> + <string name="skip_to_next_song">Przeskocz do następnego utworu</string> + <string name="open_full_player">Otwórz odtwarzacz</string> + <string name="info_on_cover">Info na okładce albumu</string> + <string name="info_below_cover">Info pod okładką albumu</string> + <string name="fixed_info">Info na stałe na górze</string> + <string name="do_nothing">Nic nie rób</string> + <string name="open_library">Otwórz bibliotekę</string> + <string name="play_pause">Odtwóz/zapauzuj</string> + <string name="next_song">Następny utwór</string> + <string name="previous_song">Poprzedni utwór</string> + <string name="next_album">Następny album</string> + <string name="previous_album">Poprzedni album</string> + <string name="cycle_repeat_mode">Tryb powtarzania</string> + <string name="cycle_shuffle_mode">Tryb odtwarzania losowego</string> + <string name="enqueue_current_album">Kolejkuj album</string> + <string name="enqueue_current_artist">Kolejkuj artystę</string> + <string name="enqueue_current_genre">Kolejkuj gatunek muzyczny</string> + <string name="enqueue_current">Zakolejkuj…</string> + <string name="more_from_current">Więcej od…</string> + <string name="empty_the_queue">Opróżnij kolejkę</string> + <string name="show_queue">Pokaż kolejkę</string> + <string name="hide_queue">Ukryj kolejkę</string> + <string name="dequeue_rest">Usuń resztę z kolejki</string> + <string name="toggle_controls">Przełączaj kontrolki</string> + <string name="seek_10s_backward">Przewiń 10 sekund do tyłu</string> + <string name="seek_10s_forward">Przewiń 10 sekund do przodu</string> + <string name="preferences_action_show_queue">Pokaż kolejkę</string> + <string name="preferences_action_clear_queue">Wyczyść kolejkę</string> + <string name="preferences_action_enqueue_current_album">Kolejkuj album</string> + <string name="preferences_action_enqueue_current_artist">Kolejkuj artystę</string> + <string name="preferences_action_enqueue_current_genre">Kolejkuj gatunek muzyczny</string> + <string name="jump_to_time">Przeskocz do czasu</string> + <string name="time_separator">:</string> + <string name="hour_hint">HH</string> + <string name="minute_hint">MM</string> + <string name="second_hint">SS</string> + <string name="error_invalid_position">Błędny czas</string> + <string name="filebrowser_start">Domyślny katalog przeglądarki plików</string> + <string name="customize_filebrowser_start">Przeglądarka plików zacznie nawigację od tego miejsca</string> + <string name="select">Wybierz</string> + <string name="save">Zapisz</string> + <string name="autoplaylist_playcounts_title">Automatyczne tworzenie listy odtwarzania</string> + <string name="autoplaylist_playcounts_summary">Automatyczne twórz</string> + <string name="autoplaylist_playcounts_fmt" formatted="false">%s listę odtwarzania „Najlepsza %.0f”</string> + <string name="autoplaylist_playcounts_disabled">Nie twórz automatycznie listy odtwarzania</string> + <string name="autoplaylist_playcounts_name" formatted="false">Najczęściej odtwarzane %d</string> + <string name="playlist_sync_mode_title">Synchronizacja list odtwarzania</string> + <string name="playlist_sync_all">Pełna synchronizacja</string> + <string name="playlist_sync_only_import">Importuj M3U, nigdy eksportuj</string> + <string name="playlist_sync_only_export">Zapisz M3U, nigdy importuj</string> + <string name="playlist_sync_disabled">Wyłączono</string> + <string name="playlist_sync_folder_title">Katalog synchronizacji</string> + <string name="playlist_sync_folder_summary">Katalog do synchronizacji list odtwarzania</string> + <string name="playlist_export_relative_paths_title">Eksportuj używając ścieżek względnych</string> + <string name="playlist_export_relative_paths_summary">Ścieżki plików są względne do katalogu z listą odtwarzania</string> + <string name="permission_request_summary">Vanilla Music potrzebuje uprawnień do wyświetlenia Twojej biblioteki muzycznej</string> + <string name="reverse_sort">Odwróć sortowanie</string> + <string name="share">Udostępnij…</string> + <string name="share_failed">Nie udało się udostępnić pliku</string> + <string name="sendto">Wyślij do…</string> + <string name="no_receiving_apps">Brak aplikacji mogącej odebrać ten typ multimedialny!</string> + <string name="duration">Czas trwania</string> + <string name="dump_database">Zrzuć bazę danych</string> + <string name="dump_database_result">Zrzucono bazę danych do „%s”</string> + <string name="force_m3u_import">Wymuś reimport M3U</string> + <string name="media_library">Biblioteka muzyczna</string> + <string name="media_folders_header">Indeksowane katalogi</string> + <string name="media_scan_header">Skaner multimediów</string> + <string name="media_scan_full">Skanuj cały system plików (powolne)</string> + <string name="media_scan_drop_db">Wyczyść bazę danych</string> + <string name="media_scan_start">Rozpocznij skanowanie</string> + <string name="media_scan_force_bastp">Zawsze używaj wbudowanego czytnika etykiet</string> + <string name="media_scan_group_albums">Grupuj albumy według katalogów</string> + <string name="media_statistics">Statystyki</string> + <string name="media_stats_tracks">Liczba utworów</string> + <string name="media_stats_library_playtime">Czas odtwarzania całej biblioteki (w godzinach)</string> + <string name="media_stats_listen_playtime">Do teraz odtworzono (w godzinach)</string> + <string name="media_stats_progress">Trwa skanowanie</string> + <string name="media_library_scan_running">Skanowanie biblioteki muzycznej…</string> + <string name="media_scan_preferences">Opcje skanowania</string> + <string name="media_scan_preferences_change_title">Zmieniono opcje skanowania</string> + <string name="media_scan_preferences_change_message">Zmiana tej opcji spowoduje ponowny skan Twojej biblioteki. Czy chcesz kontynuować?</string> + <string name="folder_picker_spinner_desc">Stan katalogu:</string> + <!--Folder selector--> + <string name="hint_long_press_to_modify_folder">Naciśnij i przytrzymaj, aby zmienić opcje katalogów</string> + <string name="folder_include">Zawrzyj</string> + <string name="folder_exclude">Wyklucz</string> + <string name="folder_neutral">Normalnie</string> + <!--Plugin system--> + <string name="plugins">Wtyczki</string> + <string name="plugin_needs_upgrade">Proszę zaktualizować wtyczkę „%s” do najnowszej wersji</string> + <!--Theme names--> + <string name="theme_name_standard_light">Zwykła</string> + <string name="theme_name_standard_dark">Zwykła (ciemna)</string> + <string name="theme_name_grey_light">Szara</string> + <string name="theme_name_grey_dark">Szara (ciemna)</string> + <string name="theme_name_orange_light">Pomarańczowa</string> + <string name="theme_name_orange_dark">Pomarańczowa (ciemna)</string> + <string name="theme_name_blue_light">Niebieska</string> + <string name="theme_name_blue_dark">Niebieska (ciemna)</string> + <string name="theme_name_red_light">Czerwona</string> + <string name="theme_name_red_dark">Czerwona (ciemna)</string> + <string name="theme_name_amoled_dark">Smolisto czarna (AMOLED)</string> +</resources> diff --git a/app/src/main/res/values-pt-rBR/translatable.xml b/app/src/main/res/values-pt-rBR/translatable.xml new file mode 100644 index 0000000..4ae1262 --- /dev/null +++ b/app/src/main/res/values-pt-rBR/translatable.xml @@ -0,0 +1,218 @@ +<?xml version='1.0' encoding='UTF-8'?> +<resources> + <string name="app_name">Vanilla Music</string> + <!--Playback Activity (main screen)--> + <string name="no_songs">Nenhuma faixa encontrada no seu dispositivo.</string> + <string name="empty_queue">Nenhuma música selecionada. Escolha algumas da biblioteca ou entre no modo aleatório tocando nesta mensagem.</string> + <string name="settings">Configurações</string> + <string name="no_shuffle">Não misturar</string> + <string name="shuffle_songs">Misturar faixas</string> + <string name="shuffle_songs_continuously">Misturar faixas continuamente</string> + <string name="shuffle_albums">Misturar álbuns</string> + <string name="no_repeat">Não repetir</string> + <string name="repeat">Repetir</string> + <string name="repeat_current_song">Repetir faixa atual</string> + <string name="stop_current_song">Parar após faixa atual.</string> + <string name="random">Aleatório </string> + <string name="random_enabling">Modo aleatório ativado</string> + <string name="song_load_failed">Falha ao carregar faixa %s. Arquivo danificado ou ausente.</string> + <string name="queue_cleared">Fila de reprodução limpa</string> + <string name="cover_art">Capa de álbum</string> + <string name="close_notification">Fechar notificação</string> + <string name="_genre">Gênero</string> + <string name="_track">faixa</string> + <string name="_composer">compositor</string> + <string name="_path">local</string> + <string name="_format">formato</string> + <string name="_title">título</string> + <string name="_artist">artista</string> + <string name="_album">álbum</string> + <string name="_year">ano</string> + <string name="_replaygain">tocar novamente</string> + <!--New Playlist Dialog--> + <string name="choose_playlist_name">Escolha o nome da playlist</string> + <string name="create">Criar</string> + <string name="overwrite">Substituir</string> + <string name="delete_playlist">Apagar playlist %s?</string> + <!--Library--> + <string name="enqueue">Colocar na fila</string> + <string name="enqueue_as_next">Reproduzir próximo</string> + <string name="play">Reproduzir</string> + <string name="edit">Editar</string> + <string name="rename">Renomear</string> + <string name="save_as_playlist">Salvar como playlist...</string> + <string name="add_to_playlist">Adicionar para playlist</string> + <string name="add_to_favorites">Adicionar aos favoritos</string> + <string name="remove_from_favorites">Remover dos favoritos</string> + <string name="playlist_favorites">Favoritos</string> + <string name="new_playlist">Nova playlist</string> + <string name="expand">Expandir</string> + <string name="delete">Apagar</string> + <string name="playback_view">Reproduzindo agora</string> + <string name="sort_by">Ordenar por</string> + <string name="search">Procurar</string> + <string name="done">Feito</string> + <string name="remove">Remover</string> + <string name="play_or_enqueue">Colocar na fila; Reproduzir se estiver em pausa</string> + <string name="open">Abrir</string> + <string name="go_home">Diretório principal</string> + <string name="jumping_to_song">Faixa já está na fila, saltando...</string> + <!--As a developer, you should always supply "one" and "other" + strings. Your translators will know which strings are actually + needed for their language. Always include %d in "one" because + translators will need to use %d for languages where "one" + doesn't mean 1 (as explained above). + + Translators should use http://unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules and + http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html, Type cardinal, + to see which categories apply to integer numbers in their languages--> + <string name="delete_file_failed">Falha ao deletar %s.</string> + <string name="deleted_item">\'%s\' deletada.</string> + <string name="delete_item">Deletar \'%s\'?</string> + <string name="delete_file">Deletar o arquivo \'%s\'?</string> + <string name="artists">Artistas</string> + <string name="albums">Álbuns </string> + <string name="composers">Compositores</string> + <string name="songs">Faixas</string> + <string name="playlists">Playlists</string> + <string name="genres">Gêneros</string> + <string name="files">Arquivos</string> + <string name="artist">Artista</string> + <string name="album">Álbum</string> + <string name="genre">Gênero</string> + <string name="folder">Pasta</string> + <string name="filename">Nome do arquivo</string> + <string name="file_size">Tamanho do arquivo</string> + <string name="file_time">Data modificação</string> + <string name="extension">Extensão</string> + <string name="unknown">Desconhecido</string> + <string name="play_all">Tocar tudo</string> + <string name="enqueue_all">Colocar tudo na fila</string> + <string name="all_songs">Todas as faixas</string> + <string name="more_from_artist">Mais do artista</string> + <string name="more_from_album">Mais do álbum</string> + <string name="title">Título</string> + <string name="number_of_tracks">Número de faixas </string> + <string name="year">Ano</string> + <string name="date_added">Data de adição</string> + <string name="artist_album">Artista, álbum</string> + <string name="artist_year_album">Artista, ano, álbum</string> + <string name="artist_album_track">Artista, álbum, número da faixa</string> + <string name="artist_album_title">Artista, álbum, título</string> + <string name="artist_year">Artista, ano</string> + <string name="album_track">Álbum, número da faixa</string> + <string name="song_playcount">Número de reproduções</string> + <!--Preferences--> + <string name="audio">Áudio</string> + <string name="volume_during_ducking_title">Volume durante uma notificação</string> + <string name="volume_during_ducking_summary">Volume de reprodução:</string> + <string name="ignore_audiofocus_loss_summary">Manter reprodução ao perder o foco de áudio</string> + <string name="media_button_title">Controles Headset/Bluetooth</string> + <string name="media_button_summary">Isto é necessário para o controles na Tela de bloqueio ICS</string> + <string name="headset_only_title">Apenas sáida externa</string> + <string name="headset_only_summary">Prevenir que a música seja reproduzida pelos altofalantes internos</string> + <string name="headset_pause_title">Pausar ao desconectar</string> + <string name="headset_pause_summary">Pausa reprodução ao desconectar os headphones.</string> + <string name="headset_launch_title">Reproduzir ao conectar</string> + <string name="headset_launch_summary">Reproduzir ao conectar os headphones (Requer a instalação do app \'Headphone detector\'.)</string> + <string name="headset_launch_app_missing">Esta funcionalidade requer o app \'Headphone detector\'.\nGostaria de abrir a Play Store para instalar o app?</string> + <string name="replaygain">ReplayGain</string> + <string name="replaygain_summary">Configurar ReplayGain</string> + <string name="replaygain_track_title">Ativar ReplayGain por faixa</string> + <string name="replaygain_track_summary">Reproduzir todas as faixas com o mesmo volume</string> + <string name="replaygain_album_title">Ativar álbum ReplayGain</string> + <string name="replaygain_album_summary">Preservar dinâmica do álbum </string> + <string name="replaygain_bump_title">ReplayGain pré-amplificado</string> + <string name="replaygain_untagged_debump_summary">Diminuir volume por</string> + <string name="replaygain_preamp_note_title">Nota</string> + <string name="replaygain_preamp_note_content">Sistemas Android não permitem que o Vanilla Music aumente o volume para valores acima de >100%. A configuração de um valor mais alto do que o recomendado podem gerar problemas se estiver a ouvir músicas calmas.\n\nOs valores recomendados são:\n-> -3dB para músicas Calmas/Clássicas \n-> +3dB gravadas após-2000.</string> + <string name="readahead">Ativar readahead</string> + <string name="equalizer">Equalizador</string> + <string name="cycle_continuous_shuffling">Misturar continuamente</string> + <string name="notifications">Notificações</string> + <string name="notification_action_title">Ação da notificação</string> + <string name="playback_screen">Tela de reprodução</string> + <string name="playback_on_startup_title">Abrir quando iniciar</string> + <string name="playback_on_startup_summary">Abrir lista de reprodução no inicio</string> + <string name="display_mode_title">Modo de exibição</string> + <string name="swipe_up_action_title">Ação ao deslizar para cima</string> + <string name="swipe_down_action_title">Ação ao deslizar para baixo</string> + <string name="cover_press_action_title">Ação ao tocar na capa</string> + <string name="cover_longpress_action_title">Ação ao toque longo na capa</string> + <string name="library_screen">Tela da biblioteca</string> + <string name="default_action_title">Ação padrão</string> + <string name="default_playlist_action_title">Ação padrão para um Playlist</string> + <string name="accelerometer_shake">Acelerômetro shake</string> + <string name="enable_shake_title">Ativar acelerômetro shake</string> + <string name="enable_shake_summary">Ativo somente quando uma faixa estiiver em reprodução. Alguns dispositivos pode não funcionar se a tela de bloqueio estiver ativo.</string> + <string name="shake_action_title">Ação ao agitar</string> + <string name="shake_threshold_title">Limite de agitação</string> + <string name="misc_features">Outras funções</string> + <string name="theme">Tema</string> + <string name="disable_lockscreen_title">Desativar tela de bloqueio</string> + <string name="disable_lockscreen_summary">Impedir a ativação da tela de bloqueio enqunato estiver na biblioteca</string> + <string name="use_idle_timeout_title">Ativar período de inatividade</string> + <string name="use_idle_timeout_summary">Quando ativado, a faixa sera parada apos um período de tempo de inatividade</string> + <string name="idle_timeout_title">Periodo de inatividade</string> + <string name="coverloader_android_title">Carregar capa de álbum do android</string> + <string name="coverloader_android_summary">Consultar na base de dados do android informações sobre a capa do album</string> + <string name="coverloader_vanilla_title">Carregar capa de álbum de uma pasta</string> + <string name="coverloader_vanilla_summary">Procurar por arquivos de imagem nomeados de cover.jpg, album.jpg ou artwork.jpg e mostrar-los como capa de álbum</string> + <string name="coverloader_shadow_title">Carregar capa de álbum de uma pasta oculta</string> + <string name="coverloader_shadow_summary">Tentar carregar uma capa de álbum para \'/sdcard/Music/.vanilla/ARTIST/ALBUM.jpg\'</string> + <string name="cover_on_lockscreen_title">Mostrar capa do album na tela de bloqueio</string> + <string name="double_tap_title">Duplo toque no widget</string> + <string name="double_tap_summary">Ao tocar duas vezes no widget 1x1 o reprodutor será aberto. Pode háver um atraso de 400-600 ms antes de abrir.</string> + <string name="stock_broadcast_title">Emular stock broadcasts</string> + <string name="stock_broadcast_summary">Enviar transmissões pelo reprodutor do Android para poder funcionar com 3rd party de controles, widgets, etc.</string> + <string name="about">Sobre</string> + <string name="tabs">Ordem dos separadores</string> + <string name="customize_tab_order">Ajustar ordem e visibilidade dos separadores</string> + <string name="restore_default">Restaurar padrões</string> + <!--The following are for the list preferences--> + <string name="last_used_action">Ultima ação usada</string> + <string name="never_show">Nunca mostrar</string> + <string name="show_when_playing">Mostrar enquanto reproduz (padrão)</string> + <string name="always_show">Sempre mostrar</string> + <string name="open_main_activity">Abrir biblioteca (padrão)</string> + <string name="open_mini_popup">Abrir mini popup</string> + <string name="open_full_player">Abrir player completo</string> + <string name="info_on_cover">Informações na capa do álbum</string> + <string name="info_below_cover">Informações abaixo da capa do álbum</string> + <string name="fixed_info">Informações no topo</string> + <string name="do_nothing">Nada</string> + <string name="open_library">Abrir biblioteca</string> + <string name="play_pause">Reproduzir/Pausar</string> + <string name="next_album">Próximo álbum</string> + <string name="previous_album">Álbum anterior</string> + <string name="cycle_repeat_mode">Modo ciclo de repetição</string> + <string name="cycle_shuffle_mode">Modo ciclo de misturar</string> + <string name="enqueue_current_album">Colocar ábum na fila</string> + <string name="enqueue_current_artist">Colocar artista na fila</string> + <string name="enqueue_current_genre">Colocar gênero na fila</string> + <string name="empty_the_queue">Fila vazia</string> + <string name="show_queue">Mostrar fila</string> + <string name="hide_queue">Esconder fila</string> + <string name="dequeue_rest">Restirar o resto da fila</string> + <string name="toggle_controls">Alterar controles</string> + <string name="seek_10s_backward">Recuar 10 segundos</string> + <string name="seek_10s_forward">Avançar 10 segundos</string> + <string name="preferences_action_show_queue">Mostrar fila</string> + <string name="preferences_action_clear_queue">Limpar fila</string> + <string name="preferences_action_enqueue_current_album">Colocar ábum na fila</string> + <string name="preferences_action_enqueue_current_artist">Colocar artista na fila</string> + <string name="preferences_action_enqueue_current_genre">Colocar gênero na fila</string> + <string name="filebrowser_start">Pasta inicial do explorador de arquivos</string> + <string name="customize_filebrowser_start">Explorador de arquivos abre esta pasta</string> + <string name="select">Selecionar</string> + <string name="autoplaylist_playcounts_title">Criar playlist automaticamente </string> + <string name="autoplaylist_playcounts_summary">Criar automaticamente uma</string> + <string name="autoplaylist_playcounts_fmt" formatted="false">%s \'Top %.0f\' playlist</string> + <string name="autoplaylist_playcounts_disabled">Não criar uma playlist automaticamnete </string> + <string name="autoplaylist_playcounts_name" formatted="false">Top %d</string> + <string name="permission_request_summary">Vanilla Music precisa de permissão de leitura para mostrar a sua biblioteca de músicas</string> + <string name="reverse_sort">Inverter organização</string> + <!--Folder selector--> + <!--Plugin system--> + <!--Theme names--> +</resources> diff --git a/app/src/main/res/values-pt/translatable.xml b/app/src/main/res/values-pt/translatable.xml new file mode 100644 index 0000000..b16ba40 --- /dev/null +++ b/app/src/main/res/values-pt/translatable.xml @@ -0,0 +1,348 @@ +<?xml version='1.0' encoding='UTF-8'?> +<resources> + <string name="app_name">Vanilla Music</string> + <string name="ok">OK</string> + <string name="cancel">Cancelar</string> + <!--Playback Activity (main screen)--> + <string name="no_songs">Não foram encontradas faixas.</string> + <string name="empty_queue">Não selecionou as faixas. Escolha algumas da sua coleção ou ative o modo aleatório tocando nesta mensagem.</string> + <string name="settings">Definições</string> + <string name="no_shuffle">Não misturar</string> + <string name="shuffle_songs">Baralhar faixas</string> + <string name="shuffle_songs_continuously">Baralhar faixas continuamente</string> + <string name="shuffle_albums">Misturar álbuns</string> + <string name="no_repeat">Não repetir</string> + <string name="repeat">Repetir</string> + <string name="repeat_current_song">Repetir faixa atual</string> + <string name="stop_current_song">Parar após esta faixa</string> + <string name="random">Aleatório</string> + <string name="random_enabling">Modo aleatório ativado</string> + <string name="song_load_failed">Falha ao carregar a faixa %s. Pode estar danificada ou em falta.</string> + <string name="queue_cleared">Fila de reprodução limpa</string> + <string name="cover_art">Capa de álbum</string> + <string name="close_notification">Fechar notificação</string> + <string name="_genre">género</string> + <string name="_track">faixa</string> + <string name="_composer">compositor</string> + <string name="_path">caminho</string> + <string name="_format">formato</string> + <string name="_title">título</string> + <string name="_artist">artista</string> + <string name="_album">álbum</string> + <string name="_year">ano</string> + <string name="_replaygain">ganho</string> + <!--New Playlist Dialog--> + <string name="choose_playlist_name">Escolha o nome da lista de reprodução</string> + <string name="create">Criar</string> + <string name="overwrite">Substituir</string> + <string name="delete_playlist">Apagar a lista de reprodução %s?</string> + <!--Library--> + <string name="enqueue">Colocar na fila</string> + <string name="enqueue_as_next">Reproduzir seguinte</string> + <string name="play">Reproduzir</string> + <string name="edit">Editar</string> + <string name="rename">Mudar nome</string> + <string name="save_as_playlist">Guardar como lista de reprodução...</string> + <string name="add_to_playlist">Adicionar à lista de reprodução...</string> + <string name="add_to_homescreen">Adicionar ao ecrã inicial...</string> + <string name="add_to">Adicionar a...</string> + <string name="playlist">Lista de reprodução</string> + <string name="homescreen">Ecrã inicial</string> + <string name="add_to_favorites">Adicionar aos favoritos</string> + <string name="remove_from_favorites">Remover dos favoritos</string> + <string name="playlist_favorites">Favoritos</string> + <string name="new_playlist">Nova lista de reprodução...</string> + <string name="expand">Expandir</string> + <string name="expand_or_play_all">Expandir ou reproduzir tudo</string> + <string name="delete">Apagar</string> + <string name="playback_view">Em reprodução</string> + <string name="sort_by">Ordenar por</string> + <string name="search">Procura</string> + <string name="done">Terminado</string> + <string name="remove">Remover</string> + <string name="play_or_enqueue">Colocar na fila ou reproduzir se em pausa</string> + <string name="open">Abrir</string> + <string name="go_home">Diretório inicial</string> + <string name="jumping_to_song">A faixa já está na fila de reprodução e será ignorada...</string> + <!--As a developer, you should always supply "one" and "other" + strings. Your translators will know which strings are actually + needed for their language. Always include %d in "one" because + translators will need to use %d for languages where "one" + doesn't mean 1 (as explained above). + + Translators should use http://unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules and + http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html, Type cardinal, + to see which categories apply to integer numbers in their languages--> + <plurals name="playing"> + <item quantity="one">A reproduzir %d faixa.</item> + <item quantity="many">A reproduzir %d faixas.</item> + <item quantity="other">A reproduzir %d faixas.</item> + </plurals> + <plurals name="enqueued"> + <item quantity="one">%d faixa na fila.</item> + <item quantity="many">%d faixas na fila.</item> + <item quantity="other">%d faixas na fila.</item> + </plurals> + <plurals name="added_to_playlist"> + <item quantity="one">%1$d faixa adicionada à lista de reprodução %2$s.</item> + <item quantity="many">%1$d faixas adicionadas à lista de reprodução %2$s.</item> + <item quantity="other">%1$d faixas adicionadas à lista de reprodução %2$s.</item> + </plurals> + <plurals name="removed_from_playlist"> + <item quantity="one">%1$d faixa removida da lista de reprodução %2$s.</item> + <item quantity="many">%1$d faixas removidas da lista de reprodução %2$s.</item> + <item quantity="other">%1$d faixas removidas da lista de reprodução %2$s.</item> + </plurals> + <plurals name="deleted"> + <item quantity="one">%d faixa apagada.</item> + <item quantity="many">%d faixas apagadas.</item> + <item quantity="other">%d faixas apagadas.</item> + </plurals> + <string name="delete_file_failed">Falha ao apagar %s</string> + <string name="deleted_item">%s foi apagado</string> + <string name="delete_item">Apagar %s?</string> + <string name="delete_file">Apagar o ficheiro %s?</string> + <string name="artists">Artistas</string> + <string name="albums">Álbuns</string> + <string name="albumartists">Artistas do álbum</string> + <string name="composers">Compositores</string> + <string name="songs">Faixas</string> + <string name="playlists">Listas de reprodução</string> + <string name="genres">Géneros</string> + <string name="files">Ficheiros</string> + <string name="artist">Artista</string> + <string name="album">Álbum</string> + <string name="genre">Género</string> + <string name="folder">Pasta</string> + <string name="filename">Nome do ficheiro</string> + <string name="file_size">Tamanho do ficheiro</string> + <string name="file_time">Data de modificação</string> + <string name="extension">Extensão</string> + <string name="unknown">Desconhecido</string> + <string name="play_all">Reproduzir tudo</string> + <string name="enqueue_all">Colocar tudo na fila</string> + <string name="all_songs">Todas as faixas</string> + <string name="details">Detalhes</string> + <string name="more_from_artist">Mais deste artista</string> + <string name="more_from_album">Mais deste álbum</string> + <string name="title">Título</string> + <string name="number_of_tracks">Número de faixas</string> + <string name="year">Ano</string> + <string name="date_added">Data de adição</string> + <string name="artist_album">Artista, álbum</string> + <string name="artist_year_album">Artista, ano, álbum</string> + <string name="artist_album_track">Artista, álbum, número de faixa</string> + <string name="artist_album_title">Artista, álbum, título</string> + <string name="artist_year">Artista, ano</string> + <string name="album_track">Álbum, número de faixa</string> + <string name="song_playcount">N.º de reproduções</string> + <!--Preferences--> + <plurals name="seconds"> + <item quantity="one">%d segundo</item> + <item quantity="many">%d segundos</item> + <item quantity="other">%d segundos</item> + </plurals> + <plurals name="minutes"> + <item quantity="one">%d minuto</item> + <item quantity="many">%d minuto</item> + <item quantity="other">%d minuto</item> + </plurals> + <plurals name="hours"> + <item quantity="one">%d hora</item> + <item quantity="many">%d horas</item> + <item quantity="other">%d horas</item> + </plurals> + <string name="audio">Áudio</string> + <string name="volume_during_ducking_title">Volume durante a notificação</string> + <string name="volume_during_ducking_summary">Volume de reprodução:</string> + <string name="ignore_audiofocus_loss_summary">Manter reprodução ao perder o foco áudio</string> + <string name="media_button_title">Auscultadores/bluetooth</string> + <string name="media_button_summary">Necessário para os controlos do ecrã de bloqueio ICS</string> + <string name="headset_only_title">Apenas saída externa</string> + <string name="headset_only_summary">Impede que a música seja reproduzida através dos altifalantes internos</string> + <string name="headset_pause_title">Pausa ao remover</string> + <string name="headset_pause_summary">Pausa na reprodução ao remover os auscultadores</string> + <string name="headset_launch_title">Reproduzir ao inserir</string> + <string name="headset_launch_summary">Reproduzir ao inserir os auscultadores (Requer a instalação da aplicação \'Headphone detector\'.)</string> + <string name="headset_launch_app_missing">Esta funcionalidade requer que a aplicação \'Headphone detector\' esteja instalada.\nGostaria de abrir a loja Google para a instalar?</string> + <string name="replaygain">ReplayGain</string> + <string name="replaygain_summary">Configurar gestão de informações ReplayGain</string> + <string name="replaygain_track_title">Ativar ReplayGain por faixa</string> + <string name="replaygain_track_summary">Reproduzir todas as faixas com igual volume</string> + <string name="replaygain_album_title">Ativar ReplayGain por álbum</string> + <string name="replaygain_album_summary">Manter dinâmica do álbum</string> + <string name="replaygain_bump_title">Amplificação ReplayGain</string> + <string name="replaygain_untagged_debump_title">Faixas sem informação ReplayGain</string> + <string name="replaygain_untagged_debump_summary">Diminuir volume em</string> + <string name="replaygain_preamp_note_title">Nota</string> + <string name="replaygain_preamp_note_content">Os sistemas Android não permitem que o Vanilla Music aumente o volume para valores >100%. A utilização de um valor mais alto do amplificador pode gerar problemas se estiver a ouvir músicas calmas.\n\nOs valores recomendados são:\n-> -3dB para músicas calmas ou clássicas\n-> +3dB para músicas gravadas após o ano 2000.</string> + <string name="readahead">Ativar \'readahead\'</string> + <string name="readahead_summary">\'Readahead\' da faixa atual. A opção pode resolver os erros \'audio dropout\'. (Causados por um cartão SD lento)</string> + <string name="equalizer">Equalizador</string> + <string name="cycle_continuous_shuffling">Mistura contínua</string> + <string name="cycle_continuous_shuffling_summary">O modo de mistura irá reproduzir as faixas aleatoriamente</string> + <string name="notifications">Notificações</string> + <string name="notification_visibility_title">Visibilidade da notificação</string> + <string name="notification_action_title">Ação na notificação</string> + <string name="playback_screen">Ecrã de reprodução</string> + <string name="playback_on_startup_title">Abrir ao iniciar</string> + <string name="playback_on_startup_summary">Abrir vista de reprodução ao iniciar</string> + <string name="display_mode_title">Modo de exibição</string> + <string name="swipe_up_action_title">Ação ao deslizar para cima</string> + <string name="swipe_down_action_title">Ação ao deslizar para baixo</string> + <string name="cover_press_action_title">Ação ao tocar na capa</string> + <string name="cover_longpress_action_title">Ação com toque longo na capa</string> + <string name="library_screen">Ecrã da coleção</string> + <string name="default_action_title">Ação padrão</string> + <string name="default_playlist_action_title">Ação padrão na lista de reprodução</string> + <string name="accelerometer_shake">Acelerador</string> + <string name="enable_shake_title">Ativar acelerador ao agitar</string> + <string name="enable_shake_summary">Apenas ativo se em reprodução. Em alguns dispositivos não funciona se o ecrã de bloqueio estiver ativo.</string> + <string name="shake_action_title">Ação ao agitar</string> + <string name="shake_threshold_title">Limite de agitação</string> + <string name="misc_features">Outras funções</string> + <string name="theme">Tema</string> + <string name="disable_lockscreen_title">Desativar ecrã de bloqueio</string> + <string name="disable_lockscreen_summary">Impede a ativação do ecrã de bloqueio, se na vista de reprodução ou na coleção</string> + <string name="keep_screen_on_title">Manter ecrã ativo</string> + <string name="keep_screen_on_summary">Mantém o ecrã (e o dispositivo) ativo se a aplicação estiver visível</string> + <string name="use_idle_timeout_title">Ativar período de inatividade</string> + <string name="use_idle_timeout_summary">Se ativa, a reprodução será parada após um certo tempo de inatividade</string> + <string name="idle_timeout_title">Período de inatividade</string> + <string name="enable_scroll_to_song_title">Deslocar para o título</string> + <string name="enable_scroll_to_song_summary">Ir para o título da faixa/álbum/artista nas listas da coleção</string> + <string name="queue_enable_scroll_to_song_title">Deslocar para a faixa na fila</string> + <string name="queue_enable_scroll_to_song_summary">Ao alterar de faixa, ir para a faixa em reprodição</string> + <string name="jump_to_enqueued_on_play_title">Ao tocar \'Reproduzir\', ir para a faixa na fila</string> + <string name="jump_to_enqueued_on_play_summary">Se a faixa escolhida já estiver na fila, ir para a faixa em vez de a colocar mais uma vez na fila</string> + <string name="coverloader_android_title">Carregar imagem do Android</string> + <string name="coverloader_android_summary">Consulta a capa do álbum na base de dados interna do Android</string> + <string name="coverloader_vanilla_title">Carregar imagem da pasta</string> + <string name="coverloader_vanilla_summary">Procura as imagens com o nome cover.jpg, album.jpg e artwork.jpg e mostra-as como capa</string> + <string name="coverloader_shadow_title">Carregar imagem de pasta oculta</string> + <string name="coverloader_shadow_summary">Tenta carregar a imagem em \'/sdcard/Music/.vanilla/ARTIST/ALBUM.jpg\'</string> + <string name="coverloader_inline_title">Carregar imagem das etiquetas</string> + <string name="coverloader_inline_summary">Tentar carregar a imagem das etiquetas do ficheiro</string> + <string name="cover_on_lockscreen_title">Mostrar imagem no ecrã de bloqueio</string> + <string name="cover_on_lockscreen_summary">Mostra a imagem do faixa em reprodução no ecrã de bloqueio</string> + <string name="double_tap_title">Duplo toque no widget</string> + <string name="double_tap_summary">Ao clicar duas vezes no widget 1x1, abre o reprodutor. Tem um atraso de 400 ms antes de responder às ações.</string> + <string name="scrobble_title">Usar API Scrobble Droid</string> + <string name="scrobble_summary">Enviar faixas para a Last.fm através de Scrobble Droid ou Simple Last.fm Scrobbler</string> + <string name="stock_broadcast_title">Emular comunicações</string> + <string name="stock_broadcast_summary">Enviar emissões emulando as enviadas pelo reprodutor do Android para poder funcionar com controlos e widgets de terceiros</string> + <string name="help">Ajuda</string> + <string name="about">Sobre</string> + <string name="tabs">Ordem dos separadores</string> + <string name="customize_tab_order">Ajustar ordem e visibilidade dos separadores</string> + <string name="restore_default">Restaurar padrões</string> + <!--The following are for the list preferences--> + <string name="last_used_action">Última ação utilizada</string> + <string name="never_show">Nunca mostrar</string> + <string name="show_when_playing">Mostrar ao reproduzir (padrão)</string> + <string name="always_show">Mostrar sempre</string> + <string name="open_main_activity">Abrir coleção (padrão)</string> + <string name="open_mini_popup">Abrir mini leitor</string> + <string name="skip_to_next_song">Avançar uma faixa</string> + <string name="open_full_player">Abrir reprodutor</string> + <string name="info_on_cover">Informações na capa</string> + <string name="info_below_cover">Informações abaixo da capa</string> + <string name="fixed_info">Informações no topo</string> + <string name="do_nothing">Nada fazer</string> + <string name="open_library">Abrir coleção</string> + <string name="play_pause">Reproduzir/pausa</string> + <string name="next_song">Faixa seguinte</string> + <string name="previous_song">Faixa anterior</string> + <string name="next_album">Álbum seguinte</string> + <string name="previous_album">Álbum anterior</string> + <string name="cycle_repeat_mode">Modo de repetição</string> + <string name="cycle_shuffle_mode">Modo de mistura</string> + <string name="enqueue_current_album">Colocar álbum na fila</string> + <string name="enqueue_current_artist">Colocar artista na fila</string> + <string name="enqueue_current_genre">Colocar género na fila</string> + <string name="enqueue_current">Colocar na fila...</string> + <string name="more_from_current">Mais de...</string> + <string name="empty_the_queue">Limpar fila de reprodução</string> + <string name="show_queue">Mostrar fila</string> + <string name="hide_queue">Ocultar fila</string> + <string name="dequeue_rest">Retirar restantes da fila</string> + <string name="toggle_controls">Alternar controlos</string> + <string name="seek_10s_backward">Recuar 10 segundos</string> + <string name="seek_10s_forward">Avançar 10 segundos</string> + <string name="preferences_action_show_queue">Mostrar fila</string> + <string name="preferences_action_clear_queue">Limpar fila</string> + <string name="preferences_action_enqueue_current_album">Colocar álbum na fila</string> + <string name="preferences_action_enqueue_current_artist">Colocar artista na fila</string> + <string name="preferences_action_enqueue_current_genre">Colocar género na fila</string> + <string name="jump_to_time">Ir para duração</string> + <string name="time_separator">:</string> + <string name="hour_hint">HH</string> + <string name="minute_hint">MM</string> + <string name="second_hint">SS</string> + <string name="error_invalid_position">Posição inválida</string> + <string name="filebrowser_start">Pasta inicial do explorador</string> + <string name="customize_filebrowser_start">O explorador de ficheiros abre esta pasta</string> + <string name="select">Selecionar</string> + <string name="save">Guardar</string> + <string name="autoplaylist_playcounts_title">Criação automática de listas de reprodução</string> + <string name="autoplaylist_playcounts_summary">Criar automaticamente</string> + <string name="autoplaylist_playcounts_fmt" formatted="false">%s uma lista de reprodução \'Top %.0f\'</string> + <string name="autoplaylist_playcounts_disabled">Não criar lista de reprodução automaticamente</string> + <string name="autoplaylist_playcounts_name" formatted="false">Top %d</string> + <string name="playlist_sync_mode_title">Sincronização de listas de reprodução</string> + <string name="playlist_sync_all">Sincronização total</string> + <string name="playlist_sync_only_import">Importar M3U e nunca exportar</string> + <string name="playlist_sync_only_export">Escrever M3U e nunca importar</string> + <string name="playlist_sync_disabled">Desligada</string> + <string name="playlist_sync_folder_title">Pasta de sincronização</string> + <string name="playlist_sync_folder_summary">Pasta a utilizar para sincronizar a lista de reprodução</string> + <string name="playlist_export_relative_paths_title">Exportar utilizando caminhos relativos</string> + <string name="playlist_export_relative_paths_summary">Exportar lista de reprodução utilizando caminhos relativos</string> + <string name="permission_request_summary">O Vanilla Music necessita da permissão de leitura para mostrar a sua coleção</string> + <string name="reverse_sort">Inverter organização</string> + <string name="share">Partilhar...</string> + <string name="share_failed">Falha ao partilhar ficheiro</string> + <string name="sendto">Enviar para...</string> + <string name="no_receiving_apps">Não foram encontradas aplicações para este tipo multimédia!</string> + <string name="duration">Duração</string> + <string name="dump_database">Guardar base de dados</string> + <string name="dump_database_result">Base de dados guardada em \'%s\'</string> + <string name="force_m3u_import">Forçar importação de ficheiros M3U</string> + <string name="media_library">Coleção multimédia</string> + <string name="media_folders_header">Diretórios indexados</string> + <string name="media_scan_header">Analisador multimédia</string> + <string name="media_scan_full">Análise total do sistema (lento)</string> + <string name="media_scan_drop_db">Limpar base de dados multimédia</string> + <string name="media_scan_start">Iniciar análise</string> + <string name="media_scan_force_bastp">Utilizar sempre o leitor nativo</string> + <string name="media_scan_group_albums">Agrupar álbuns por pasta</string> + <string name="media_statistics">Estatísticas</string> + <string name="media_stats_tracks">Número de faixas</string> + <string name="media_stats_library_playtime">Tempo total de reprodução (horas)</string> + <string name="media_stats_listen_playtime">Horas de reprodução até à data</string> + <string name="media_stats_progress">Evolução da análise</string> + <string name="media_library_scan_running">A analisar coleção...</string> + <string name="media_scan_preferences">Opções do analisador</string> + <string name="media_scan_preferences_change_title">Opções alteradas</string> + <string name="media_scan_preferences_change_message">Ao alterar esta opção, irá iniciar uma nova análise da coleção. Gostaria de continuar?</string> + <!--Folder selector--> + <string name="hint_long_press_to_modify_folder">Toque longo para alterar as opções da pasta</string> + <string name="folder_include">Incluir</string> + <string name="folder_exclude">Excluir</string> + <string name="folder_neutral">Neutra</string> + <!--Plugin system--> + <string name="plugins">Suplementos</string> + <string name="plugin_needs_upgrade">Por favor atualize %s para a versão mais recente</string> + <!--Theme names--> + <string name="theme_name_standard_light">Padrão</string> + <string name="theme_name_standard_dark">Padrão (escuro)</string> + <string name="theme_name_grey_light">Cinzento</string> + <string name="theme_name_grey_dark">Cinzento (escuro)</string> + <string name="theme_name_orange_light">Laranja</string> + <string name="theme_name_orange_dark">Laranja (escuro)</string> + <string name="theme_name_blue_light">Azul</string> + <string name="theme_name_blue_dark">Azul (escuro)</string> + <string name="theme_name_red_light">Vermelho</string> + <string name="theme_name_red_dark">Vermelho (escuro)</string> + <string name="theme_name_amoled_dark">Preto (AMOLED)</string> +</resources> diff --git a/app/src/main/res/values-ru/translatable.xml b/app/src/main/res/values-ru/translatable.xml new file mode 100644 index 0000000..24fd176 --- /dev/null +++ b/app/src/main/res/values-ru/translatable.xml @@ -0,0 +1,359 @@ +<?xml version='1.0' encoding='UTF-8'?> +<resources> + <string name="app_name">Vanilla Music</string> + <string name="ok">Ладно</string> + <string name="cancel">Отмена</string> + <!--Playback Activity (main screen)--> + <string name="no_songs">На устройстве нет музыки.</string> + <string name="empty_queue">Дорожки не выбраны. Создайте подборку из фонотеки или коснитесь здесь для включения случайного режима.</string> + <string name="settings">Настройки</string> + <string name="no_shuffle">По порядку</string> + <string name="shuffle_songs">Дорожки вперемешку</string> + <string name="shuffle_songs_continuously">Постоянно перемешивать дорожки</string> + <string name="shuffle_albums">Альбомы вперемешку</string> + <string name="no_repeat">Не повторять</string> + <string name="repeat">Повторять</string> + <string name="repeat_current_song">Повторять эту дорожку</string> + <string name="stop_current_song">Остановить после этой дорожки</string> + <string name="random">Случайно</string> + <string name="random_enabling">Случайный режим включён</string> + <string name="song_load_failed">Не читается дорожка %s. Возможно, файл повреждён или удалён.</string> + <string name="queue_cleared">Очередь очищена.</string> + <string name="cover_art">Обложка альбома</string> + <string name="close_notification">Закрыть уведомление</string> + <string name="_genre">Жанр</string> + <string name="_track">Дорожка</string> + <string name="_composer">Композитор</string> + <string name="_path">Путь</string> + <string name="_format">Формат</string> + <string name="_title">Название</string> + <string name="_artist">Исполнитель</string> + <string name="_album">Альбом</string> + <string name="_year">Год</string> + <string name="_replaygain">ReplayGain</string> + <!--New Playlist Dialog--> + <string name="choose_playlist_name">Дайте имя плей-листу</string> + <string name="create">Создать</string> + <string name="overwrite">Затереть</string> + <string name="delete_playlist">Удалить плей-лист %s?</string> + <!--Library--> + <string name="enqueue">В конец очереди</string> + <string name="enqueue_as_next">Далее в очередь</string> + <string name="play">Воспроизвести</string> + <string name="edit">Изменить</string> + <string name="rename">Переименовать</string> + <string name="save_as_playlist">Создать плей-лист…</string> + <string name="add_to_playlist">Добавить в плей-лист…</string> + <string name="add_to_homescreen">На главный экран…</string> + <string name="add_to">Дабавить…</string> + <string name="playlist">в плей-лист</string> + <string name="homescreen">на главный экран</string> + <string name="add_to_favorites">Добавить в избранные</string> + <string name="remove_from_favorites">Удалить из избранных</string> + <string name="playlist_favorites">Избранные</string> + <string name="new_playlist">Новый плей-лист…</string> + <string name="expand">Показать</string> + <string name="expand_or_play_all">Показать либо воспроизвести всё</string> + <string name="delete">Удалить</string> + <string name="playback_view">Сейчас играет</string> + <string name="sort_by">Сортировка</string> + <string name="search">Найти</string> + <string name="done">Готово</string> + <string name="remove">Убрать</string> + <string name="play_or_enqueue">В очередь при воспроизведении; Воспроизвести при паузе</string> + <string name="open">Открыть</string> + <string name="go_home">Начальная папка</string> + <string name="jumping_to_song">Дорожка уже в очереди, перемотка…</string> + <!--As a developer, you should always supply "one" and "other" + strings. Your translators will know which strings are actually + needed for their language. Always include %d in "one" because + translators will need to use %d for languages where "one" + doesn't mean 1 (as explained above). + + Translators should use http://unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules and + http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html, Type cardinal, + to see which categories apply to integer numbers in their languages--> + <plurals name="playing"> + <item quantity="one">Воспроизводится %d дорожка.</item> + <item quantity="few">Воспроизводится %d дорожки.</item> + <item quantity="many">Воспроизводится %d дорожек.</item> + <item quantity="other">Воспроизводится %d дорожек.</item> + </plurals> + <plurals name="enqueued"> + <item quantity="one">Добавлена %d дорожка.</item> + <item quantity="few">Добавлено %d дорожки.</item> + <item quantity="many">Добавлено %d дорожек.</item> + <item quantity="other">Добавлено %d дорожек.</item> + </plurals> + <plurals name="added_to_playlist"> + <item quantity="one">В плей-лист %2$s добавлена %1$d дорожка.</item> + <item quantity="few">В плей-лист %2$s добавлено %1$d дорожки.</item> + <item quantity="many">В плей-лист %2$s добавлено %1$d дорожек.</item> + <item quantity="other">В плей-лист %2$s добавлено %1$d дорожек.</item> + </plurals> + <plurals name="removed_from_playlist"> + <item quantity="one">Из плей-листа %2$s убрана %1$d дорожка.</item> + <item quantity="few">Из плей-листа %2$s убрано %1$d дорожки.</item> + <item quantity="many">Из плей-листа %2$s убрано %1$d дорожек.</item> + <item quantity="other">Из плей-листа %2$s убрано %1$d дорожек.</item> + </plurals> + <plurals name="deleted"> + <item quantity="one">Удалена %d дорожка.</item> + <item quantity="few">Удалено %d дорожки.</item> + <item quantity="many">Удалено %d дорожек.</item> + <item quantity="other">Удалено %d дорожек.</item> + </plurals> + <string name="delete_file_failed">Сбой при удалении %s.</string> + <string name="deleted_item">\"%s\" удалена.</string> + <string name="delete_item">Убрать \"%s\"?</string> + <string name="delete_file">Удалить файл \"%s\"?</string> + <string name="artists">Исполнители</string> + <string name="albums">Альбомы</string> + <string name="albumartists">Исполнители альбомов</string> + <string name="composers">Композиторы</string> + <string name="songs">Дорожки</string> + <string name="playlists">Плей-листы</string> + <string name="genres">Жанры</string> + <string name="files">Файлы</string> + <string name="artist">исполнителя</string> + <string name="album">альбома</string> + <string name="genre">жанра</string> + <string name="folder">папки</string> + <string name="filename">по имени файла</string> + <string name="file_size">по размеру файла</string> + <string name="file_time">по давности файла</string> + <string name="extension">по типу файла</string> + <string name="unknown">Неизвестный</string> + <string name="play_all">Воспроизвести всё</string> + <string name="enqueue_all">Всё в очередь</string> + <string name="all_songs">Все дорожки</string> + <string name="details">Подробности</string> + <string name="more_from_artist">Ещё от того же исполнителя</string> + <string name="more_from_album">Ещё из того же альбома</string> + <string name="title">по названию</string> + <string name="number_of_tracks">по числу дорожек</string> + <string name="year">по году</string> + <string name="date_added">по дате добавления</string> + <string name="artist_album">по исполнителю и альбому</string> + <string name="artist_year_album">по исполнителю, году и альбому</string> + <string name="artist_album_track">по исполнителю, альбому и номеру дорожки</string> + <string name="artist_album_title">по исполнителю, альбому и названию</string> + <string name="artist_year">по исполнителю и году</string> + <string name="album_track">по альбому и номеру дорожки</string> + <string name="song_playcount">по популярности</string> + <!--Preferences--> + <plurals name="seconds"> + <item quantity="one">%d секунда</item> + <item quantity="few">%d секунды</item> + <item quantity="many">%d секунд</item> + <item quantity="other">%d секунд</item> + </plurals> + <plurals name="minutes"> + <item quantity="one">%d минута</item> + <item quantity="few">%d минуты</item> + <item quantity="many">%d минут</item> + <item quantity="other">%d минут</item> + </plurals> + <plurals name="hours"> + <item quantity="one">%d час</item> + <item quantity="few">%d часа</item> + <item quantity="many">%d часов</item> + <item quantity="other">%d часов</item> + </plurals> + <string name="audio">Звучание</string> + <string name="volume_during_ducking_title">Громкость во время уведомлений</string> + <string name="volume_during_ducking_summary">Громкость воспроизведения:</string> + <string name="ignore_audiofocus_loss_summary">Не останавливаться после полной потери аудио-фокуса</string> + <string name="media_button_title">Управление с проводной гарнитуры/Bluetooth</string> + <string name="media_button_summary">Необходимо для управления воспроизведением с экрана блокировки в ICS (Android 4).</string> + <string name="headset_only_title">Только внешний аудио-вывод</string> + <string name="headset_only_summary">Запрещает воспроизведение музыки через встроенные динамики.</string> + <string name="headset_pause_title">Пауза при отсоединении</string> + <string name="headset_pause_summary">Приостановка при отключении наушников.</string> + <string name="headset_launch_title">Играть при присоединении</string> + <string name="headset_launch_summary">Начинать воспроизведение при подключении наушников. (Необходимо приложение \"Headphone detector\")</string> + <string name="headset_launch_app_missing">Эта возможность требует установки приложения \"Headphone detector\".\nЖелаете установить приложение из Play Store?</string> + <string name="replaygain">Выравнивание громкости (ReplayGain)</string> + <string name="replaygain_summary">Настройка обработки тегов ReplayGain</string> + <string name="replaygain_track_title">Применять ReplayGain дорожки</string> + <string name="replaygain_track_summary">Выравнивает громкость всех дорожек</string> + <string name="replaygain_album_title">Применять ReplayGain альбома</string> + <string name="replaygain_album_summary">Сохраняет динамичность альбома</string> + <string name="replaygain_bump_title">Предусиление дорожек с тегами ReplayGain</string> + <string name="replaygain_untagged_debump_title">Ослабление дорожек без тегов ReplayGain</string> + <string name="replaygain_untagged_debump_summary">Понизить громкость на</string> + <string name="replaygain_preamp_note_title">Имейте в виду</string> + <string name="replaygain_preamp_note_content">Android не позволяет установить громкость больше 100%. Поэтому прослушивание \"тихой\" музыки при большом предусилении может вызывать проблемы. \n\nРекомендуемые значения: \n-> -3dB для тихой/классической музыки \n-> +3dB для записей после 2000 года.</string> + <string name="readahead">Применять опережающий кеш</string> + <string name="readahead_summary">Предварительное кеширование проигрываемой дорожки. Позволяет избавиться от \"выпаданий звуков\", вызываемых медленной картой памяти.</string> + <string name="equalizer">Эквалайзер</string> + <string name="cycle_continuous_shuffling">Непрерывное перемешивание</string> + <string name="cycle_continuous_shuffling_summary">При перемешивании очередь проигрывается в случайном порядке</string> + <string name="notifications">Уведомления</string> + <string name="notification_visibility_title">Отображение уведомления</string> + <string name="notification_action_title">Реакция уведомления</string> + <string name="playback_screen">Экран воспроизведения</string> + <string name="playback_on_startup_title">Показывать после запуска</string> + <string name="playback_on_startup_summary">После запуска перейти к экрану воспроизведения</string> + <string name="display_mode_title">Режим отображения</string> + <string name="swipe_up_action_title">При перелистывании вверх</string> + <string name="swipe_down_action_title">При перелистывании вниз</string> + <string name="cover_press_action_title">При нажатии на обложку</string> + <string name="cover_longpress_action_title">При долгом нажатии на обложку</string> + <string name="library_screen">Экран фонотеки</string> + <string name="default_action_title">Действие по умолчанию</string> + <string name="default_playlist_action_title">Действие по умолчанию для плей-листа</string> + <string name="accelerometer_shake">Управление встряхиванием</string> + <string name="enable_shake_title">Включить управление встряхиванием</string> + <string name="enable_shake_summary">Срабатывает только при воспроизведении музыки. На некоторых устройствах не работает при отключённом экране. </string> + <string name="shake_action_title">При встряхивании</string> + <string name="shake_threshold_title">Порог силы встряхивания</string> + <string name="misc_features">Различные возможности</string> + <string name="theme">Тема оформления</string> + <string name="disable_lockscreen_title">Отключить блокировку экрана</string> + <string name="disable_lockscreen_summary">Не давать включаться блокировке при открытом экране фонотеки или воспроизведения</string> + <string name="keep_screen_on_title">Не гасить экран</string> + <string name="keep_screen_on_summary">Отключать энергосбережение экрана (и устройства) пока Vanilla Music на виду</string> + <string name="use_idle_timeout_title">Задействовать таймер простоя</string> + <string name="use_idle_timeout_summary">Воспроизведение остановится после определенного периода бездействия</string> + <string name="idle_timeout_title">Время ожидания</string> + <string name="enable_scroll_to_song_title">Пролистывать до названия</string> + <string name="enable_scroll_to_song_summary">Пролистывание списков фонотеки к текущей дорожке/альбому/исполнителю.</string> + <string name="queue_enable_scroll_to_song_title">Пролистывать до названия в очереди</string> + <string name="queue_enable_scroll_to_song_summary">Пролистывать к воспроизводящейся дорожке в очереди при смене песни</string> + <string name="jump_to_enqueued_on_play_title">Переход к дорожке из очереди при нажатии \"Воспроизвести\"</string> + <string name="jump_to_enqueued_on_play_summary">Переходить к выбранной дорожке вместо затирания списка очереди, если она уже стоит в очереди.</string> + <string name="coverloader_android_title">Загружать обложки из баз Android</string> + <string name="coverloader_android_summary">Запрашивать обложки из встроенной базы медиа данных ОС Android</string> + <string name="coverloader_vanilla_title">Загружать обложки из папки</string> + <string name="coverloader_vanilla_summary">Искать файлы изображений с именами cover.jpg, album.jpg или artwork.jpg и показывать их в качестве обложек</string> + <string name="coverloader_shadow_title">Загружать обложки из скрытой папки</string> + <string name="coverloader_shadow_summary">Искать и загружать обложки по маске \"/sdcard/Музыка/.vanilla/ИСПОЛНИТЕЛЬ/АЛЬБОМ.jpg\"</string> + <string name="coverloader_inline_title">Загружать обложки из тегов</string> + <string name="coverloader_inline_summary">Загружать встроенные в теги обложки</string> + <string name="cover_on_lockscreen_title">Показывать обложки на экране блокировки</string> + <string name="cover_on_lockscreen_summary">Показывать обложку текущей дорожки на экране блокировки</string> + <string name="double_tap_title">Двойное касание виджета</string> + <string name="double_tap_summary">Двойное касание виджета 1×1 вызовет проигрыватель. Добавляет 400мс задержку к реакции виджета на действия.</string> + <string name="scrobble_title">Задействовать API Scrobble Droid</string> + <string name="scrobble_summary">Отсылать статистику на Last.FM при помощи Scrobble Droid или Simple Last.FM Scrobbler</string> + <string name="stock_broadcast_title">Имитировать стандартное поведение</string> + <string name="stock_broadcast_summary">Отправлять широковещательные сообщения, имитирующие поведение стандартного музыкального проигрывателя, для совместимости со сторонними элементами управления экранов блокировки, виджетами и т.п.</string> + <string name="help">Помощь</string> + <string name="about">О программе</string> + <string name="tabs">Порядок вкладок</string> + <string name="customize_tab_order">Выбрать порядок и видимость вкладок фонотеки</string> + <string name="restore_default">Восстановить по умолчанию</string> + <!--The following are for the list preferences--> + <string name="last_used_action">Последнее использованное действие</string> + <string name="never_show">Никогда не показывать</string> + <string name="show_when_playing">Показывать при воспроизведении (по умолчанию)</string> + <string name="always_show">Показывать всегда</string> + <string name="open_main_activity">Показать фонотеку (по умолчанию)</string> + <string name="open_mini_popup">Показать окошко</string> + <string name="skip_to_next_song">Перейти к следующей дорожке</string> + <string name="open_full_player">Развернуть проигрыватель</string> + <string name="info_on_cover">Сведения посреди обложки</string> + <string name="info_below_cover">Сведения под обложкой</string> + <string name="fixed_info">Сведения вверху экрана</string> + <string name="do_nothing">Ничего не делать</string> + <string name="open_library">Открыть фонотеку</string> + <string name="play_pause">Воспроизвести/Пауза</string> + <string name="next_song">Следующая дорожка</string> + <string name="previous_song">Предыдущая дорожка</string> + <string name="next_album">Следующий альбом</string> + <string name="previous_album">Предыдущий альбом</string> + <string name="cycle_repeat_mode">Сменить режим повтора</string> + <string name="cycle_shuffle_mode">Сменить режим перемешивания</string> + <string name="enqueue_current_album">Заполнить очередь альбомом</string> + <string name="enqueue_current_artist">Заполнить очередь исполнителем</string> + <string name="enqueue_current_genre">Заполнить очередь жанром</string> + <string name="enqueue_current">В конец очереди…</string> + <string name="more_from_current">Ещё того же…</string> + <string name="empty_the_queue">Очистить всю очередь</string> + <string name="show_queue">Показать очередь</string> + <string name="hide_queue">Спрятать очередь</string> + <string name="dequeue_rest">Убрать остаток очереди</string> + <string name="toggle_controls">Тумблер органов управления</string> + <string name="seek_10s_backward">Отмотать на 10 секунд назад</string> + <string name="seek_10s_forward">Промотать на 10 секунд</string> + <string name="move_to_top">Наверх</string> + <string name="move_to_bottom">Вниз</string> + <string name="preferences_action_show_queue">Показать очередь</string> + <string name="preferences_action_clear_queue">Убрать остаток очереди</string> + <string name="preferences_action_enqueue_current_album">Заполнить очередь альбомом</string> + <string name="preferences_action_enqueue_current_artist">Заполнить очередь исполнителем</string> + <string name="preferences_action_enqueue_current_genre">Заполнить очередь жанром</string> + <string name="jump_to_time">Переход по времени</string> + <string name="time_separator">:</string> + <string name="hour_hint">Час</string> + <string name="minute_hint">мин</string> + <string name="second_hint">сек</string> + <string name="error_invalid_position">Неправильное время</string> + <string name="filebrowser_start">Домашняя папка браузера файлов</string> + <string name="customize_filebrowser_start">Браузер файлов открывает эту папку</string> + <string name="select">Выбрать</string> + <string name="save">Сохранить</string> + <string name="autoplaylist_playcounts_title">Автоматическое создание плей-листов</string> + <string name="autoplaylist_playcounts_summary">Автоматически создавать</string> + <string name="autoplaylist_playcounts_fmt" formatted="false">%s плей-лист \"%.0f лучших\"</string> + <string name="autoplaylist_playcounts_disabled">Не создавать плей-лист автоматически</string> + <string name="autoplaylist_playcounts_name" formatted="false">%d лучших </string> + <string name="playlist_sync_mode_title">Синхронизация плей-листов</string> + <string name="playlist_sync_all">Полная синхронизация</string> + <string name="playlist_sync_only_import">Импортировать M3U, без экспорта</string> + <string name="playlist_sync_only_export">Записывать M3U, без импорта</string> + <string name="playlist_sync_disabled">Отключена</string> + <string name="playlist_sync_folder_title">Папка для синхронизации</string> + <string name="playlist_sync_folder_summary">Папка с плей-листами для синхронизации</string> + <string name="playlist_export_relative_paths_title">Применять при экспорте относительные пути</string> + <string name="playlist_export_relative_paths_summary">Ссылки в путях относительно файла плей-листа</string> + <string name="permission_request_summary">Vanilla Music необходимо разрешение на чтение, чтобы отобразить Вашу музыку в фонотеке</string> + <string name="reverse_sort">в обратном порядке</string> + <string name="share">Поделиться…</string> + <string name="share_failed">Не удалось отправить файл</string> + <string name="sendto">Отправить в…</string> + <string name="no_receiving_apps">Нет приложений для обработки такого типа файла!</string> + <string name="duration">Общая длительность</string> + <string name="dump_database">Выгрузить базу данных</string> + <string name="dump_database_result">База данных выгружена в \"%s\"</string> + <string name="force_m3u_import">Заново импортировать плей-листы M3U</string> + <string name="media_library">Библиотека носителей</string> + <string name="media_folders_header">Директории в индексе</string> + <string name="media_scan_header">Сканер носителей</string> + <string name="media_scan_full">Полное сканирование файловой системы (медленное)</string> + <string name="media_scan_drop_db">Очистить базу данных носителя</string> + <string name="media_scan_start">Начать сканирование</string> + <string name="media_scan_force_bastp">Всегда использовать встроенный считыватель тегов</string> + <string name="media_scan_group_albums">Группировать альбомы по папкам</string> + <string name="media_statistics">Статистика</string> + <string name="media_stats_tracks">Количество дорожек</string> + <string name="media_stats_library_playtime">Общая продолжительность в часах</string> + <string name="media_stats_listen_playtime">Воспроизведено музыки на текущий момент</string> + <string name="media_stats_progress">Выполнение сканирования</string> + <string name="media_library_scan_running">Сканируется библиотека носителей…</string> + <string name="media_scan_preferences">Настройка сканера</string> + <string name="media_scan_preferences_change_title">Изменение настроек сканера</string> + <string name="media_scan_preferences_change_message">Изменение этой настройки приведёт к полному сканированию библиотеки. Продолжить?</string> + <string name="folder_picker_spinner_desc">Готовность папки:</string> + <!--Folder selector--> + <string name="hint_long_press_to_modify_folder">Длительное нажатие вызовет настройки папки</string> + <string name="folder_include">Учесть</string> + <string name="folder_exclude">Изъять</string> + <string name="folder_neutral">Оставить</string> + <!--Plugin system--> + <string name="plugins">Модули</string> + <string name="plugin_needs_upgrade">Пожалуйста, обновите модуль %s до последней версии.</string> + <!--Theme names--> + <string name="theme_name_standard_light">Стандартная</string> + <string name="theme_name_standard_dark">Стандартная (тёмная)</string> + <string name="theme_name_grey_light">Серая</string> + <string name="theme_name_grey_dark">Серая (тёмная)</string> + <string name="theme_name_orange_light">Оранжевая</string> + <string name="theme_name_orange_dark">Оранжевая (тёмная)</string> + <string name="theme_name_blue_light">Синяя</string> + <string name="theme_name_blue_dark">Синяя (тёмная)</string> + <string name="theme_name_red_light">Красная</string> + <string name="theme_name_red_dark">Красная (тёмная)</string> + <string name="theme_name_amoled_dark">Совершенно чёрная (OLED)</string> +</resources> diff --git a/app/src/main/res/values-sk/translatable.xml b/app/src/main/res/values-sk/translatable.xml new file mode 100644 index 0000000..9e9a4df --- /dev/null +++ b/app/src/main/res/values-sk/translatable.xml @@ -0,0 +1,80 @@ +<?xml version="1.0" encoding="utf-8"?> +<!--Generated by crowdin.net--> +<resources> + <string name="app_name">Vanilla Music</string> + <string name="no_songs">V zariadení neboli nájdené žiadne skladby.</string> + <string name="settings">Nastavenia</string> + <string name="random_enabling">Náhodný výber zapnutý.</string> + <string name="song_load_failed">Načítanie skladby %s zlyhalo. Môže byť poškodená, alebo chýba.</string> + <string name="queue_cleared">Zoznam vymazaný.</string> + <string name="choose_playlist_name">Vyberte názov zoznamu skladieb</string> + <string name="create">Vytvoriť</string> + <string name="overwrite">Prepísať</string> + <string name="enqueue">Zaradiť do zoznamu</string> + <string name="play">Prehrať</string> + <string name="edit">Upraviť</string> + <string name="rename">Premenovať</string> + <string name="add_to_playlist">Pridať do zoznamu skladieb…</string> + <string name="new_playlist">Nový zoznam skladieb…</string> + <string name="expand">Rozšíriť</string> + <string name="delete">Odstrániť</string> + <string name="playback_view">Práve sa prehráva</string> + <string name="search">Hľadať</string> + <string name="artists">Interpreti</string> + <string name="albums">Albumy</string> + <string name="songs">Skladby</string> + <string name="playlists">Zoznamy skladieb</string> + <string name="genres">Žánre</string> + <string name="unknown">Neznáme</string> + <string name="play_all">Prehrať všetko</string> + <string name="enqueue_all">Pridať do zoznamu všetko</string> + <string name="all_songs">Všetky skladby</string> + <string name="media_button_title">Použiť ovládanie náhlavnej súpravy</string> + <string name="headset_only_title">Iba externý výstup</string> + <string name="headset_pause_title">Pozastaviť pri odpojení</string> + <string name="headset_pause_summary">Pozastaví prehrávanie keď odpojíte sluchátka.</string> + <string name="notification_action_title">Akcia upozornenia</string> + <string name="display_mode_title">Režim zobrazenia</string> + <string name="swipe_up_action_title">Akcia prejedním prstu nahor</string> + <string name="swipe_down_action_title">Prejdením prstom nadol</string> + <string name="cover_press_action_title">Akcia pri ťuknutí na obal</string> + <string name="cover_longpress_action_title">Akcia pri podržaní na obale</string> + <string name="default_action_title">Predvolená akcia</string> + <string name="use_idle_timeout_title">Povoliť časový limit nečinnosti</string> + <string name="use_idle_timeout_summary">Keď je povolené, prehrávanie sa zastaví po danom čase nečinnosti.</string> + <string name="idle_timeout_title">Časový limit nečinnosti</string> + <string name="double_tap_title">Dvojité ťuknutie na miniaplikáciu</string> + <string name="double_tap_summary">Dvojité ťuknutie na 1×1 miniaplikáciu otvorí prehrávač. Vytvorí oneskorenie 0,4 sekúnd pred tým, ako miniaplikácia reaguje na akciu.</string> + <string name="scrobble_title">Použiť ScrobbleDroid API</string> + <string name="scrobble_summary">Scrobble prístup k Last.FM cez ScrobbleDroid alebo Simple Last.FM Scrobbler.</string> + <string name="stock_broadcast_title">Tváriť sa ako originálny prehrávač</string> + <string name="stock_broadcast_summary">Tvári sa ako originálny prehrávač hudby posielaním vysielania pre umožnenie spolupráce s ovládaniami, miniaplikáciami zamykania obrazovky.</string> + <plurals name="playing"> + <item quantity="one">1 prehrávaná skladba.</item> + <item quantity="other">%d prehrávaných skladieb.</item> + </plurals> + <plurals name="enqueued"> + <item quantity="one">1 pridaná skladba.</item> + <item quantity="other">%d pridaných skladieb.</item> + </plurals> + <plurals name="added_to_playlist"> + <item quantity="one">1 skladba pridaná do zoznamu skladieb %2$s.</item> + <item quantity="other">%1$d skladieb pridaných do zoznamu skladieb %2$s.</item> + </plurals> + <plurals name="deleted"> + <item quantity="one">1 skladba odstránená.</item> + <item quantity="other">%d skladieb odstránených.</item> + </plurals> + <plurals name="seconds"> + <item quantity="one">1 sekunda</item> + <item quantity="other">%d sekúnd</item> + </plurals> + <plurals name="minutes"> + <item quantity="one">1 minúta</item> + <item quantity="other">%d minút</item> + </plurals> + <plurals name="hours"> + <item quantity="one">1 hodina</item> + <item quantity="other">%d hodín</item> + </plurals> +</resources> diff --git a/app/src/main/res/values-sr/translatable.xml b/app/src/main/res/values-sr/translatable.xml new file mode 100644 index 0000000..72f5230 --- /dev/null +++ b/app/src/main/res/values-sr/translatable.xml @@ -0,0 +1,332 @@ +<?xml version='1.0' encoding='UTF-8'?> +<resources> + <string name="app_name">Ванила музика</string> + <string name="ok">У реду</string> + <string name="cancel">Одустани</string> + <!--Playback Activity (main screen)--> + <string name="no_songs">Нема нумера на вашем уређају.</string> + <string name="empty_queue">Ништа није изабрано. Изаберите нумере из библиотеке или уђите у насумични режим тапом на ову поруку.</string> + <string name="settings">Поставке</string> + <string name="no_shuffle">Без тумбања</string> + <string name="shuffle_songs">Претумбај нумере</string> + <string name="shuffle_songs_continuously">Претумбавај нумере непрестано</string> + <string name="shuffle_albums">Претумбај албуме</string> + <string name="no_repeat">Не понављај</string> + <string name="repeat">Понављај</string> + <string name="repeat_current_song">Понови текућу нумеру</string> + <string name="stop_current_song">Заустави након текуће нумере</string> + <string name="random">Насумично</string> + <string name="random_enabling">Насумичност укључена</string> + <string name="song_load_failed">Неуспех учитавања нумере %s. Можда је фајл оштећен или га нема.</string> + <string name="queue_cleared">Ред пуштања очишћен.</string> + <string name="cover_art">Омот</string> + <string name="close_notification">Затвори обавештење</string> + <string name="_genre">жанр</string> + <string name="_track">нумера</string> + <string name="_composer">композитор</string> + <string name="_path">путања</string> + <string name="_format">формат</string> + <string name="_title">наслов</string> + <string name="_artist">извођач</string> + <string name="_album">албум</string> + <string name="_year">година</string> + <string name="_replaygain">rgain</string> + <!--New Playlist Dialog--> + <string name="choose_playlist_name">Одредите назив листе нумера</string> + <string name="create">Направи</string> + <string name="overwrite">Пребриши</string> + <string name="delete_playlist">Да обришем листу нумера %s?</string> + <!--Library--> + <string name="enqueue">Стави у ред</string> + <string name="enqueue_as_next">Пусти следећу</string> + <string name="play">Пусти</string> + <string name="edit">Уреди</string> + <string name="rename">Преименуј</string> + <string name="save_as_playlist">Сачувај као листу нумера…</string> + <string name="add_to_playlist">Додај у листу нумера…</string> + <string name="add_to_favorites">Додај у омиљене</string> + <string name="remove_from_favorites">Уклони из омиљених</string> + <string name="playlist_favorites">Омиљене</string> + <string name="new_playlist">Нова листа нумера…</string> + <string name="expand">Рашири</string> + <string name="expand_or_play_all">Рашири или пусти све</string> + <string name="delete">Обриши</string> + <string name="playback_view">Текућа песма</string> + <string name="sort_by">Поређај по</string> + <string name="search">Тражи</string> + <string name="done">Готово</string> + <string name="remove">Уклони</string> + <string name="play_or_enqueue">У ред ако је пуштено; пусти ако је паузирано</string> + <string name="open">Отвори</string> + <string name="go_home">Почетна фасцикла</string> + <string name="jumping_to_song">Песма је већ у реду пуштња, скачем…</string> + <!--As a developer, you should always supply "one" and "other" + strings. Your translators will know which strings are actually + needed for their language. Always include %d in "one" because + translators will need to use %d for languages where "one" + doesn't mean 1 (as explained above). + + Translators should use http://unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules and + http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html, Type cardinal, + to see which categories apply to integer numbers in their languages--> + <plurals name="playing"> + <item quantity="one">%d нумера пуштена.</item> + <item quantity="few">%d нумере пуштене.</item> + <item quantity="other">%d нумера пуштено.</item> + </plurals> + <plurals name="enqueued"> + <item quantity="one">%d нумера стављена у ред.</item> + <item quantity="few">%d нумере стављене у ред.</item> + <item quantity="other">%d нумера стављено у ред.</item> + </plurals> + <plurals name="added_to_playlist"> + <item quantity="one">%1$d нумера додата на листу нумера %2$s.</item> + <item quantity="few">%1$d нумере додате на листу нумера %2$s.</item> + <item quantity="other">%1$d нумера додато на листу нумера %2$s.</item> + </plurals> + <plurals name="removed_from_playlist"> + <item quantity="one">%1$d нумера уклоњена са листе нумера %2$s.</item> + <item quantity="few">%1$d нумере уклоњене са листе нумера %2$s.</item> + <item quantity="other">%1$d нумера уклоњено са листе нумера %2$s.</item> + </plurals> + <plurals name="deleted"> + <item quantity="one">%d нумера обрисана.</item> + <item quantity="few">%d нумере обрисане.</item> + <item quantity="other">%d нумера обрисано.</item> + </plurals> + <string name="delete_file_failed">Брисање %s није успело.</string> + <string name="deleted_item">„%s“ обрисана.</string> + <string name="delete_item">Да обришем „%s“?</string> + <string name="delete_file">Да обришем фајл „%s“?</string> + <string name="artists">Извођачи</string> + <string name="albums">Албуми</string> + <string name="albumartists">Извођачи албума</string> + <string name="composers">Композитори</string> + <string name="songs">Нумере</string> + <string name="playlists">Листе нумера</string> + <string name="genres">Жанрови</string> + <string name="files">Фајлови</string> + <string name="artist">Извођач</string> + <string name="album">Албум</string> + <string name="genre">Жанр</string> + <string name="folder">Фасцикла</string> + <string name="filename">Назив фајла</string> + <string name="file_size">Величина фајла</string> + <string name="file_time">Време измене</string> + <string name="extension">Наставак</string> + <string name="unknown">Непознато</string> + <string name="play_all">Пусти све</string> + <string name="enqueue_all">Стави све у ред</string> + <string name="all_songs">Све нумере</string> + <string name="more_from_artist">Још од извођача</string> + <string name="more_from_album">Још са албума</string> + <string name="title">Наслов</string> + <string name="number_of_tracks">броју нумера</string> + <string name="year">години</string> + <string name="date_added">датуму додавања</string> + <string name="artist_album">извођачу, албуму</string> + <string name="artist_year_album">извођачу, години, албуму</string> + <string name="artist_album_track">извођачу, албуму, нумери</string> + <string name="artist_album_title">извођачу, албуму, наслову</string> + <string name="artist_year">извођачу, години</string> + <string name="album_track">албуму, нумери</string> + <string name="song_playcount">броју пуштања</string> + <!--Preferences--> + <plurals name="seconds"> + <item quantity="one">%d секунда</item> + <item quantity="few">%d секунде</item> + <item quantity="other">%d секунди</item> + </plurals> + <plurals name="minutes"> + <item quantity="one">%d минута</item> + <item quantity="few">%d минуте</item> + <item quantity="other">%d минута</item> + </plurals> + <plurals name="hours"> + <item quantity="one">%d сат</item> + <item quantity="few">%d сата</item> + <item quantity="other">%d сати</item> + </plurals> + <string name="audio">Звук</string> + <string name="volume_during_ducking_title">Јачина звука при обавештењу</string> + <string name="volume_during_ducking_summary">Јачина звука:</string> + <string name="ignore_audiofocus_loss_summary">Настави пуштање по трајном губитку фокуса</string> + <string name="media_button_title">Управљање слушалицама/блутутом</string> + <string name="media_button_summary">Потребно за контроле закључаног екрана за Ајскрим Сендвич.</string> + <string name="headset_only_title">Само спољашњи излаз</string> + <string name="headset_only_summary">Спречава пуштање музике на уграђене звучнике.</string> + <string name="headset_pause_title">Паузирај по искључењу</string> + <string name="headset_pause_summary">Пауза по искључењу слушалица.</string> + <string name="headset_launch_title">Пусти по укључењу </string> + <string name="headset_launch_summary">Пуштање музике по укључењу слушалица. (Захтева апликацију „Откривач слушалица“.)</string> + <string name="headset_launch_app_missing">Ова функција захтева апликацију „Откривач слушалица“.\nЖелите ли да је инсталирате?</string> + <string name="replaygain">Нивелисање звука</string> + <string name="replaygain_summary">Поставке руковања подацима о нивелисању звука</string> + <string name="replaygain_track_title">Укључи нивелисање по нумери</string> + <string name="replaygain_track_summary">Пушта све нумере истом гласноћом</string> + <string name="replaygain_album_title">Укључи нивелисање албума</string> + <string name="replaygain_album_summary">Очувај динамику албума</string> + <string name="replaygain_bump_title">Предпојачање нивелисања</string> + <string name="replaygain_untagged_debump_title">Нумере без ознаке нивелисања</string> + <string name="replaygain_untagged_debump_summary">Умањи јачину звука за</string> + <string name="replaygain_preamp_note_title">Напомена</string> + <string name="replaygain_preamp_note_content">Андроид не дозвољава Ванила музици да повећа јачину звука >100%. Постављање претпојачања на високу вредност може да узрокује проблеме ако слушате „тиху“ музику. \n\nПрепоручене вредности су:\n-> -3dB за тиху/класичну музику\n-> +3dB за снимке након 2000-е</string> + <string name="readahead">Укључи предучитавање</string> + <string name="readahead_summary">Предучитавање текуће нумере. Ова опција може да реши проблеме са „испуштањем звука“ (које узрокује спора СД картица).</string> + <string name="equalizer">Еквилајзер</string> + <string name="cycle_continuous_shuffling">Непрестано тумбање</string> + <string name="cycle_continuous_shuffling_summary">У режиму „тумбања“ нумере се пуштају насумично</string> + <string name="notifications">Обавештења</string> + <string name="notification_visibility_title">Видљивост обавештења</string> + <string name="notification_action_title">Радња обавештења</string> + <string name="playback_screen">Екран пуштања</string> + <string name="playback_on_startup_title">Отвори по покретању</string> + <string name="playback_on_startup_summary">Отвара екран пуштања по покретању</string> + <string name="display_mode_title">Приказ информација</string> + <string name="swipe_up_action_title">Превлачење на горе</string> + <string name="swipe_down_action_title">Превлачење на доле</string> + <string name="cover_press_action_title">Тап на омот</string> + <string name="cover_longpress_action_title">Дужи притисак на омот</string> + <string name="library_screen">Приказ библиотеке</string> + <string name="default_action_title">Подразумевана радња</string> + <string name="default_playlist_action_title">Подразумевана радња листе нумера</string> + <string name="accelerometer_shake">Протресање телефона</string> + <string name="enable_shake_title">Омогући протресање телефона</string> + <string name="enable_shake_summary">Активно само ако је музика пуштена. На неким уређајима не ради када је екран угашен.</string> + <string name="shake_action_title">Протресање</string> + <string name="shake_threshold_title">Праг силе протресања</string> + <string name="misc_features">Разне функције</string> + <string name="theme">Тема</string> + <string name="disable_lockscreen_title">Онемогући закључавање екрана</string> + <string name="disable_lockscreen_summary">Спречава активирање екрана заључавања при екрану пуштања или библиотеке</string> + <string name="keep_screen_on_title">Држи екран укљученим</string> + <string name="keep_screen_on_summary">Држи екран (и уређај) будним док је Ванила музика видљива </string> + <string name="use_idle_timeout_title">Укључи време мировања</string> + <string name="use_idle_timeout_summary">Активирано зауставља пуштање након задатог времена неактивности</string> + <string name="idle_timeout_title">Време мировања</string> + <string name="enable_scroll_to_song_title">Клизај на наслов нумере</string> + <string name="enable_scroll_to_song_summary">Клизање на текућу нумеру/албум/извођача у приказу библиотеке</string> + <string name="queue_enable_scroll_to_song_title">Клизај до наслова нумере у реду</string> + <string name="queue_enable_scroll_to_song_summary">Клизање на текућу нумеру у реду при промени песме</string> + <string name="coverloader_android_title">Учитај омоте са Андроида</string> + <string name="coverloader_android_summary">Шаље упит унутрашњој медија базу података Андроида за омот албума</string> + <string name="coverloader_vanilla_title">Учитај омоте из фасцикле</string> + <string name="coverloader_vanilla_summary">Тражи слике назива „cover.jpg“, „album.jpg“ или „artwork.jpg“ и приказује их као омот албума</string> + <string name="coverloader_shadow_title">Учитај омоте из сакривене фасцикле</string> + <string name="coverloader_shadow_summary">Покушава учитавање омота са „/sdcard/Music/.vanilla/ARTIST/ALBUM.jpg“</string> + <string name="coverloader_inline_title">Учитај омот из фајла</string> + <string name="coverloader_inline_summary">Учитавање уграђених омота из ИД ознака фајла</string> + <string name="cover_on_lockscreen_title">Прикажи омот на екрану закључавања</string> + <string name="cover_on_lockscreen_summary">Приказ омота текуће нумере на екрану закључавања</string> + <string name="double_tap_title">Двотап на виџет</string> + <string name="double_tap_summary">Двотап на 1x1 виџет отвара плејер. Опција поставља застој од 400ms пре одзива виџета на радње.</string> + <string name="scrobble_title">Користи Scrobble Droid АПИ</string> + <string name="scrobble_summary">Скроблуј на Ласт.фм преко Scrobble Droid АПИ-ја или једноставног Ласт.фм скроблера</string> + <string name="stock_broadcast_title">Емулирај уграђена емитовања</string> + <string name="stock_broadcast_summary">Слање емитовања која опонашају емитовања уграђеног музичког плејера, да би функционисале контроле закључаног екрана и виџети осталих апликација, итд.</string> + <string name="help">Помоћ</string> + <string name="about">О програму</string> + <string name="tabs">Редослед језичака</string> + <string name="customize_tab_order">Прилагођавање редоследа и видљивости језичака библиотеке</string> + <string name="restore_default">Врати подразумевано</string> + <!--The following are for the list preferences--> + <string name="last_used_action">претходно коришћена радња</string> + <string name="never_show">никад</string> + <string name="show_when_playing">у току пуштања (подраз.)</string> + <string name="always_show">увек</string> + <string name="open_main_activity">отвара библиотеку (подраз.)</string> + <string name="open_mini_popup">отвара искачуће прозорче</string> + <string name="skip_to_next_song">пушта следећу нумеру</string> + <string name="open_full_player">отвара цео плејер</string> + <string name="info_on_cover">на омоту</string> + <string name="info_below_cover">испод омота</string> + <string name="fixed_info">фиксиран на врху</string> + <string name="do_nothing">не ради ништа</string> + <string name="open_library">отвара библиотеку</string> + <string name="play_pause">пушта/паузира</string> + <string name="next_song">пушта следећу нумеру</string> + <string name="previous_song">пушта претходну нумеру</string> + <string name="next_album">пушта следећи албум</string> + <string name="previous_album">пушта претходни албум</string> + <string name="cycle_repeat_mode">мења режим понављања</string> + <string name="cycle_shuffle_mode">мења режим тумбања</string> + <string name="enqueue_current_album">Стави албум у ред</string> + <string name="enqueue_current_artist">Стави извођача у ред</string> + <string name="enqueue_current_genre">Стави жанр у ред</string> + <string name="enqueue_current">Стави у ред…</string> + <string name="more_from_current">Још од…</string> + <string name="empty_the_queue">Испразни ред</string> + <string name="show_queue">Прикажи ред</string> + <string name="hide_queue">Сакриј ред</string> + <string name="dequeue_rest">Уклони остале из реда</string> + <string name="toggle_controls">мења приказ контрола</string> + <string name="seek_10s_backward">прескаче 10 секунди уназад</string> + <string name="seek_10s_forward">прескаче 10 секунди унапред</string> + <string name="preferences_action_show_queue">приказује ред</string> + <string name="preferences_action_clear_queue">чисти ред</string> + <string name="preferences_action_enqueue_current_album">ставља албум у ред</string> + <string name="preferences_action_enqueue_current_artist">ставља извођача у ред</string> + <string name="preferences_action_enqueue_current_genre">ставља жанр у ред</string> + <string name="filebrowser_start">Почетна страница</string> + <string name="customize_filebrowser_start">Прегледач фајлова почиње од ове фасцикле</string> + <string name="select">Изабери</string> + <string name="save">Сачувај</string> + <string name="autoplaylist_playcounts_title">Аутоматске листе нумера</string> + <string name="autoplaylist_playcounts_summary">Аутоматски направи</string> + <string name="autoplaylist_playcounts_fmt" formatted="false">%s „Најбоље %.0f“ листу</string> + <string name="autoplaylist_playcounts_disabled">Не прави аутоматску листу нумера</string> + <string name="autoplaylist_playcounts_name" formatted="false">Најбољих %d</string> + <string name="playlist_sync_mode_title">Синхронизација листе нумера</string> + <string name="playlist_sync_all">Пуна синхронизација</string> + <string name="playlist_sync_only_import">Увози M3U, никад не извози</string> + <string name="playlist_sync_only_export">Уписуј M3U, никад не увози</string> + <string name="playlist_sync_disabled">Искључена</string> + <string name="playlist_sync_folder_title">Фасцикла синхронизације</string> + <string name="playlist_sync_folder_summary">Фасцикла за синхронизацију листе нумера</string> + <string name="permission_request_summary">Ванила музика захтева дозволу читања да би приказала вашу музичку библиотеку</string> + <string name="reverse_sort">Обрнуто ређање</string> + <string name="share">Дели…</string> + <string name="share_failed">Дељење фајла није успело</string> + <string name="sendto">Пошаљи за…</string> + <string name="no_receiving_apps">Нема апликација за овај тип фајла!</string> + <string name="duration">Трајање</string> + <string name="dump_database">Извези базу података</string> + <string name="dump_database_result">База података избачена у „%s“</string> + <string name="force_m3u_import">Присили поновни увоз M3U </string> + <string name="media_library">Библиотека</string> + <string name="media_folders_header">Индексиране фасцикле</string> + <string name="media_scan_header">Очитавач медија</string> + <string name="media_scan_full">Очитај читав фајлсистем (спорије)</string> + <string name="media_scan_drop_db">Очисти базу података медија</string> + <string name="media_scan_start">Почни очитавање</string> + <string name="media_scan_force_bastp">Увек користи уграђени читач ознака</string> + <string name="media_scan_group_albums">Групиши албуме по фасцикли</string> + <string name="media_statistics">Статистике</string> + <string name="media_stats_tracks">Број нумера</string> + <string name="media_stats_library_playtime">Укупно време пуштања (сати)</string> + <string name="media_stats_listen_playtime">Досадашње време пуштања музике</string> + <string name="media_stats_progress">Напредак очитавања</string> + <string name="media_library_scan_running">Очитавам библиотеку медија…</string> + <string name="media_scan_preferences">Опције скенера</string> + <string name="media_scan_preferences_change_title">Опције скенера измењене</string> + <string name="media_scan_preferences_change_message">Измена ове опције ће покренути потпуно скенирање ваше библиотеке. Желите ли да наставите?</string> + <!--Folder selector--> + <string name="hint_long_press_to_modify_folder">Притисните и задржите да измените опције фасцикле</string> + <string name="folder_include">Укључи</string> + <string name="folder_exclude">Искључи</string> + <string name="folder_neutral">Неутрално</string> + <!--Plugin system--> + <string name="plugins">Прикључци</string> + <!--Theme names--> + <string name="theme_name_standard_light">Стандардна</string> + <string name="theme_name_standard_dark">Стандардна (тамна)</string> + <string name="theme_name_grey_light">Сива</string> + <string name="theme_name_grey_dark">Сива (тамна)</string> + <string name="theme_name_orange_light">Наранџаста</string> + <string name="theme_name_orange_dark">Наранџаста (тамна)</string> + <string name="theme_name_blue_light">Плава</string> + <string name="theme_name_blue_dark">Плава (тамна)</string> + <string name="theme_name_red_light">Црвена</string> + <string name="theme_name_red_dark">Црвена (тамна)</string> + <string name="theme_name_amoled_dark">Мркли мрак (АМОЛЕД)</string> +</resources> diff --git a/app/src/main/res/values-sv/translatable.xml b/app/src/main/res/values-sv/translatable.xml new file mode 100644 index 0000000..fd44d90 --- /dev/null +++ b/app/src/main/res/values-sv/translatable.xml @@ -0,0 +1,341 @@ +<?xml version='1.0' encoding='UTF-8'?> +<resources> + <string name="app_name">Vanilla Music</string> + <string name="ok">OK</string> + <string name="cancel">Avbryt</string> + <!--Playback Activity (main screen)--> + <string name="no_songs">Inga låtar hittades på din enhet.</string> + <string name="empty_queue">Inga låtar valda. Välj några från biblioteket eller ange slumpmässigt läge genom att trycka på det här meddelandet.</string> + <string name="settings">Inställningar</string> + <string name="no_shuffle">Blanda inte</string> + <string name="shuffle_songs">Blanda låtar</string> + <string name="shuffle_songs_continuously">Blanda låtar kontinuerligt</string> + <string name="shuffle_albums">Blanda album</string> + <string name="no_repeat">Upprepa inte</string> + <string name="repeat">Upprepa</string> + <string name="repeat_current_song">Upprepa aktuell låt</string> + <string name="stop_current_song">Stoppa efter aktuell låt</string> + <string name="random">Slumpvis</string> + <string name="random_enabling">Slumpvis aktiverad</string> + <string name="song_load_failed">Det gick inte att läsa låten %s. Det kan vara korrupt eller saknas.</string> + <string name="queue_cleared">Kön rensad.</string> + <string name="cover_art">Omslag</string> + <string name="close_notification">Stäng avisering</string> + <string name="_genre">genre</string> + <string name="_track">låt</string> + <string name="_composer">kompositör</string> + <string name="_path">sökväg</string> + <string name="_format">format</string> + <string name="_title">titel</string> + <string name="_artist">artist</string> + <string name="_album">album</string> + <string name="_year">år</string> + <string name="_replaygain">rgain</string> + <!--New Playlist Dialog--> + <string name="choose_playlist_name">Välj spellistans namn</string> + <string name="create">Skapa</string> + <string name="overwrite">Skriv över</string> + <string name="delete_playlist">Ta bort spellistan %s?</string> + <!--Library--> + <string name="enqueue">Placera i kö</string> + <string name="enqueue_as_next">Spela nästa</string> + <string name="play">Spela</string> + <string name="edit">Redigera</string> + <string name="rename">Byt namn</string> + <string name="save_as_playlist">Spara som spellista…</string> + <string name="add_to_playlist">Lägg till spelista...</string> + <string name="add_to_homescreen">Lägg till startskärmen…</string> + <string name="add_to">Lägg till...</string> + <string name="playlist">Spellista</string> + <string name="homescreen">Startskärmen</string> + <string name="add_to_favorites">Lägg till favoriter</string> + <string name="remove_from_favorites">Ta bort från favoriter</string> + <string name="playlist_favorites">Favoriter</string> + <string name="new_playlist">Ny spellista...</string> + <string name="expand">Expandera</string> + <string name="expand_or_play_all">Expandera eller spela alla</string> + <string name="delete">Ta bort</string> + <string name="playback_view">Spelas nu</string> + <string name="sort_by">Sortera efter</string> + <string name="search">Sök</string> + <string name="done">Klar</string> + <string name="remove">Ta bort</string> + <string name="play_or_enqueue">Placera i kö om spelas; Spela om pausad</string> + <string name="open">Öppna</string> + <string name="go_home">Hemmapp</string> + <string name="jumping_to_song">Låten är redan i kö, hoppar…</string> + <!--As a developer, you should always supply "one" and "other" + strings. Your translators will know which strings are actually + needed for their language. Always include %d in "one" because + translators will need to use %d for languages where "one" + doesn't mean 1 (as explained above). + + Translators should use http://unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules and + http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html, Type cardinal, + to see which categories apply to integer numbers in their languages--> + <plurals name="playing"> + <item quantity="one">%d låt spelas.</item> + <item quantity="other">%d låtar spelas.</item> + </plurals> + <plurals name="enqueued"> + <item quantity="one">%d låtar i kön.</item> + <item quantity="other">%d låtar i kön.</item> + </plurals> + <plurals name="added_to_playlist"> + <item quantity="one">%1$d låt läggs till i spellistan %2$s.</item> + <item quantity="other">%1$d låtar läggs till i spellistan %2$s.</item> + </plurals> + <plurals name="removed_from_playlist"> + <item quantity="one">%1$d låt togs bort från spellistan %2$s.</item> + <item quantity="other">%1$d låtar togs bort från spellistan %2$s.</item> + </plurals> + <plurals name="deleted"> + <item quantity="one">%d låt togs bort.</item> + <item quantity="other">%d låtar togs bort.</item> + </plurals> + <string name="delete_file_failed">Det gick inte att ta bort %s.</string> + <string name="deleted_item">\"%s\" borttagen.</string> + <string name="delete_item">Ta bort \"%s\"?</string> + <string name="delete_file">Ta bort filen \"%s\"?</string> + <string name="artists">Artister</string> + <string name="albums">Album</string> + <string name="albumartists">Albumartister</string> + <string name="composers">Kompositörer</string> + <string name="songs">Låtar</string> + <string name="playlists">Spellistor</string> + <string name="genres">Genrer</string> + <string name="files">Filer</string> + <string name="artist">Artist</string> + <string name="album">Album</string> + <string name="genre">Genre</string> + <string name="folder">Mapp</string> + <string name="filename">Filnamn</string> + <string name="file_size">Filstorlek</string> + <string name="file_time">Ändringstid</string> + <string name="extension">Ändelse</string> + <string name="unknown">Okänd</string> + <string name="play_all">Spela alla</string> + <string name="enqueue_all">Placera alla i kö</string> + <string name="all_songs">Alla låtar</string> + <string name="details">Detaljer</string> + <string name="more_from_artist">Mer från artisten</string> + <string name="more_from_album">Mer från albumet</string> + <string name="title">Titel</string> + <string name="number_of_tracks">Antal låtar</string> + <string name="year">År</string> + <string name="date_added">Datum tillagt</string> + <string name="artist_album">Artist, album</string> + <string name="artist_year_album">Artist, år, album</string> + <string name="artist_album_track">Artist, album, låtnummer</string> + <string name="artist_album_title">Artist, album, titel</string> + <string name="artist_year">Artist, år</string> + <string name="album_track">Album, låtnummer</string> + <string name="song_playcount">Antal gånger spelad</string> + <!--Preferences--> + <plurals name="seconds"> + <item quantity="one">%d sekund</item> + <item quantity="other">%d sekunder</item> + </plurals> + <plurals name="minutes"> + <item quantity="one">%d minut</item> + <item quantity="other">%d minuter</item> + </plurals> + <plurals name="hours"> + <item quantity="one">%d timme</item> + <item quantity="other">%d timmar</item> + </plurals> + <string name="audio">Ljud</string> + <string name="volume_during_ducking_title">Volym vid avisering</string> + <string name="volume_during_ducking_summary">Uppspelningsvolym: </string> + <string name="ignore_audiofocus_loss_summary">Fortsätt spela på permanent ljudfokusförlust</string> + <string name="media_button_title">Headset/Bluetooth-kontroller</string> + <string name="media_button_summary">Detta är också nödvändigt för ICS-låsskärmskontroller.</string> + <string name="headset_only_title">Endast extern utgång</string> + <string name="headset_only_summary">Förhindrar att musik spelas upp via de interna högtalarna.</string> + <string name="headset_pause_title">Pausa när de urkopplas</string> + <string name="headset_pause_summary">Pausa när hörlurarna är urkopplade.</string> + <string name="headset_launch_title">Spela när de är inkopplade</string> + <string name="headset_launch_summary">Spela upp när hörlurarna är inkopplade. (Kräver att appen \"Headphone detector\" installeras.)</string> + <string name="headset_launch_app_missing">Dessa funktioner kräver att appen \"Headphone detector\" installeras.\nVill du öppna Play-butiken för att installera appen?</string> + <string name="replaygain">ReplayGain</string> + <string name="replaygain_summary">Konfigurera hantering av ReplayGain-information</string> + <string name="replaygain_track_title">Aktivera per-låt ReplayGain</string> + <string name="replaygain_track_summary">Spela alla låtar med lika höghet</string> + <string name="replaygain_album_title">Aktivera album ReplayGain</string> + <string name="replaygain_album_summary">Bevara albumdynamik</string> + <string name="replaygain_bump_title">ReplayGain-förförstärkaren</string> + <string name="replaygain_untagged_debump_title">Låtar utan ReplayGain-taggen</string> + <string name="replaygain_untagged_debump_summary">Minska volymen med</string> + <string name="replaygain_preamp_note_title">Observera</string> + <string name="replaygain_preamp_note_content">Android tillåter inte Vanilla Music att höja volymen till >100%. Ställa in förförstärken till ett högt värde kan orsaka problem om du lyssnar på \"tyst\" musik.\n\nRekommendrade värden är:\n-> -3dB för tyst/klassisk musik\n-> +3dB för post-2000 inspelningar</string> + <string name="readahead">Aktivera att läsa vidare</string> + <string name="readahead_summary">Läs vidare den aktuella låten. Det här alternativet kan lösa \"ljudavbrotts\"-problem. (orsakas av ett långsam SD-kort)</string> + <string name="equalizer">Frekvenskorrigerare</string> + <string name="cycle_continuous_shuffling">Blanda kontinuerligt</string> + <string name="cycle_continuous_shuffling_summary">\"Blandningsläge\" kommer att spela upp låtar i helt slumpmässig ordning</string> + <string name="notifications">Aviseringar</string> + <string name="notification_visibility_title">Synlighet för aviseringar</string> + <string name="notification_action_title">Åtgärder för aviseringar</string> + <string name="playback_screen">Uppspelningsskärm</string> + <string name="playback_on_startup_title">Öppna vid start</string> + <string name="playback_on_startup_summary">Öppna uppspelningsvyn vid start</string> + <string name="display_mode_title">Visningsläge</string> + <string name="swipe_up_action_title">Åtgärd för uppsvepning</string> + <string name="swipe_down_action_title">Åtgärd för nersvepning</string> + <string name="cover_press_action_title">Åtgärd för tryck på omslag</string> + <string name="cover_longpress_action_title">Åtgärd för långt tryck</string> + <string name="library_screen">Biblioteksskärm</string> + <string name="default_action_title">Standardåtgärd</string> + <string name="default_playlist_action_title">Standardåtgärd för spellista</string> + <string name="accelerometer_shake">Skakaccelerometer</string> + <string name="enable_shake_title">Aktivera skakaccelerometer</string> + <string name="enable_shake_summary">Endast aktiv när musik spelas. Fungerar inte när skärmen är avstängd på vissa enheter.</string> + <string name="shake_action_title">Årgärd vid skakning</string> + <string name="shake_threshold_title">Tröskelvärde för skakkraft</string> + <string name="misc_features">Diverse funktioner</string> + <string name="theme">Tema</string> + <string name="disable_lockscreen_title">Inaktivera låsskärmen</string> + <string name="disable_lockscreen_summary">Förhindra att låsskärmen aktiveras när biblioteket eller uppspelningsskärmen visas</string> + <string name="keep_screen_on_title">Behåll skärmen på</string> + <string name="keep_screen_on_summary">Behåll skärmen (och enheten) vaken medan Vanilla Music är synlig</string> + <string name="use_idle_timeout_title">Aktivera tidsgräns för inaktivitet</string> + <string name="use_idle_timeout_summary">När den är aktiv stoppas uppspelningen efter den angivna inaktivitetsperioden</string> + <string name="idle_timeout_title">Tidsgräns för inaktivitet</string> + <string name="enable_scroll_to_song_title">Bläddra till låttitel</string> + <string name="enable_scroll_to_song_summary">Bläddra till för närvarande spelande spår/album/artist i bibliotekslistor</string> + <string name="queue_enable_scroll_to_song_title">Bläddra till spårtitel i kön</string> + <string name="queue_enable_scroll_to_song_summary">Bläddra till för närvarande spelande låt i kön vid låtbyte</string> + <string name="jump_to_enqueued_on_play_title">Hoppa till köad låt på \"Spela\"</string> + <string name="jump_to_enqueued_on_play_summary">Om den önskade låten redan finns i kön, hoppa till den istället för att ta bort kön</string> + <string name="coverloader_android_title">Läs in omslag från Android</string> + <string name="coverloader_android_summary">Fråga Androids interna mediedatabas om albumomslag</string> + <string name="coverloader_vanilla_title">Läs in omslag från mapp</string> + <string name="coverloader_vanilla_summary">Sök efter bildfiler som heter cover.jpg, album.jpg eller artwork.jpg och visa dem som skivomslag</string> + <string name="coverloader_shadow_title">Läs in omslag från dold mapp</string> + <string name="coverloader_shadow_summary">Försök att läsa in omslag från \'/sdcard/Music/.vanilla/ARTIST/ALBUM.jpg\'</string> + <string name="coverloader_inline_title">Läs in omslag från filtaggar</string> + <string name="coverloader_inline_summary">Försök att läsa in inbäddade konstverk från filtaggar</string> + <string name="cover_on_lockscreen_title">Visa omslaget på låsskärmen</string> + <string name="cover_on_lockscreen_summary">Visa omslaget av låten som spelas på låsskärmen</string> + <string name="double_tap_title">Dubbeltryck på gränssnittskomponenten</string> + <string name="double_tap_summary">Dubbeltryck på 1x1-gränssnittskomponenten öppnar spelaren. Ådrar sig en 400ms fördröjning innan gränssnittskomponenten svarar på åtgärder.</string> + <string name="scrobble_title">Använd Scrobble Droid API</string> + <string name="scrobble_summary">Skrobbla in till Last.fm genom Scrobble Droid eller Simple Last.fm Scrobbler</string> + <string name="stock_broadcast_title">Emulera lagersändningar</string> + <string name="stock_broadcast_summary">Skicka sändningar som emulerar de som skickas av lagermusikspelaren för att arbeta med tredje parts låsskärmskontroller, gränssnittskomponenter, o.s.v.</string> + <string name="help">Hjälp</string> + <string name="about">Om</string> + <string name="tabs">Flikordning</string> + <string name="customize_tab_order">Justera ordningen och synligheten för biblioteksflikar</string> + <string name="restore_default">Återställ till standardvärden</string> + <!--The following are for the list preferences--> + <string name="last_used_action">Senast använda åtgärd</string> + <string name="never_show">Visa aldrig</string> + <string name="show_when_playing">Visa när du spelar (standard)</string> + <string name="always_show">Visa alltid</string> + <string name="open_main_activity">Öppna bibliotek (standard)</string> + <string name="open_mini_popup">Öppna mini poppupp</string> + <string name="skip_to_next_song">Hoppa till nästa låt</string> + <string name="open_full_player">Öppna den fullständiga spelaren</string> + <string name="info_on_cover">Information om omslag</string> + <string name="info_below_cover">Info under omslagsbild</string> + <string name="fixed_info">Info fast överst</string> + <string name="do_nothing">Gör ingenting</string> + <string name="open_library">Öppna bibliotek</string> + <string name="play_pause">Spela/Pausa</string> + <string name="next_song">Nästa låt</string> + <string name="previous_song">Föregående låt</string> + <string name="next_album">Nästa album</string> + <string name="previous_album">Föregående album</string> + <string name="cycle_repeat_mode">Cirkulera upprepningsläge</string> + <string name="cycle_shuffle_mode">Cykel blandningsläge</string> + <string name="enqueue_current_album">Placera albumet i kön</string> + <string name="enqueue_current_artist">Placera artisten i kön</string> + <string name="enqueue_current_genre">Placera genren i kön</string> + <string name="enqueue_current">Placera i kö</string> + <string name="more_from_current">Mer från…</string> + <string name="empty_the_queue">Tom kön</string> + <string name="show_queue">Visa kön</string> + <string name="hide_queue">Dölj kön</string> + <string name="dequeue_rest">Ta bort resten från kön</string> + <string name="toggle_controls">Växla kontroller</string> + <string name="seek_10s_backward">Sök 10 sekunder bakåt</string> + <string name="seek_10s_forward">Sök 10 sekunder framåt</string> + <string name="preferences_action_show_queue">Visa kön</string> + <string name="preferences_action_clear_queue">Rensa kön</string> + <string name="preferences_action_enqueue_current_album">Placera albumet i kön</string> + <string name="preferences_action_enqueue_current_artist">Placera artisten i kön</string> + <string name="preferences_action_enqueue_current_genre">Placera genren i kön</string> + <string name="jump_to_time">Hoppa till tid</string> + <string name="time_separator">:</string> + <string name="hour_hint">HH</string> + <string name="minute_hint">MM</string> + <string name="second_hint">SS</string> + <string name="error_invalid_position">Ogiltig position</string> + <string name="filebrowser_start">Filhanterarens hemmapp</string> + <string name="customize_filebrowser_start">Filhanteraren startar i den här mappen</string> + <string name="select">Välj</string> + <string name="save">Spara</string> + <string name="autoplaylist_playcounts_title">Automatiskt skapande av spellistor</string> + <string name="autoplaylist_playcounts_summary">Skapa automatiskt en</string> + <string name="autoplaylist_playcounts_fmt" formatted="false">%s \'Topp %.0f\'-spellista</string> + <string name="autoplaylist_playcounts_disabled">Skapa inte en automatisk spellista</string> + <string name="autoplaylist_playcounts_name" formatted="false">Topp %d</string> + <string name="playlist_sync_mode_title">Synkronisering av spellista</string> + <string name="playlist_sync_all">Fullständig synkronisering</string> + <string name="playlist_sync_only_import">Importera M3U, exportera aldrig</string> + <string name="playlist_sync_only_export">Skriv M3U, importera aldrig</string> + <string name="playlist_sync_disabled">Inaktiverad</string> + <string name="playlist_sync_folder_title">Synkroniseringsmapp</string> + <string name="playlist_sync_folder_summary">Mapp som ska användas för synkronisering av spellistor</string> + <string name="playlist_export_relative_paths_title">Exportera med relativa sökvägar</string> + <string name="playlist_export_relative_paths_summary">Referensfilsökvägar i förhållande till spellistan</string> + <string name="permission_request_summary">Vanilla Music behöver läsbehörighet för att visa ditt musikbibliotek</string> + <string name="reverse_sort">Omvänd sortering</string> + <string name="share">Dela…</string> + <string name="share_failed">Det gick inte att dela filen</string> + <string name="sendto">Skicka till…</string> + <string name="no_receiving_apps">Inga mottagande appar hittades för denna medietyp!</string> + <string name="duration">Varaktighet</string> + <string name="dump_database">Dumpa databas</string> + <string name="dump_database_result">Databasen dumpad till \"%s\"</string> + <string name="force_m3u_import">Tvinga M3U återimport</string> + <string name="media_library">Mediabibliotek</string> + <string name="media_folders_header">Indexerade mappar</string> + <string name="media_scan_header">Medieskanner</string> + <string name="media_scan_full">Skanna hela filsystemet (långsammare)</string> + <string name="media_scan_drop_db">Ta bort mediadatabasen</string> + <string name="media_scan_start">Starta skanning</string> + <string name="media_scan_force_bastp">Använder alltid inbyggda taggläsaren</string> + <string name="media_scan_group_albums">Gruppera album efter mapp</string> + <string name="media_statistics">Statistik</string> + <string name="media_stats_tracks">Antal låtar</string> + <string name="media_stats_library_playtime">Total speltid (timmar)</string> + <string name="media_stats_listen_playtime">Timmar av musik som spelats hittills</string> + <string name="media_stats_progress">Skannar</string> + <string name="media_library_scan_running">Skannar mediebibliotek…</string> + <string name="media_scan_preferences">Inställningar för skannern</string> + <string name="media_scan_preferences_change_title">Inställningarna för skannern ändrade</string> + <string name="media_scan_preferences_change_message">Om du ändrar det här inställningen startar du en fullständig omskanning av ditt bibliotek. Vill du fortsätta?</string> + <string name="folder_picker_spinner_desc">Status för mappen:</string> + <!--Folder selector--> + <string name="hint_long_press_to_modify_folder">Långt tryck för att ändra mappalternativ</string> + <string name="folder_include">Inkludera</string> + <string name="folder_exclude">Utesluta</string> + <string name="folder_neutral">Neutral</string> + <!--Plugin system--> + <string name="plugins">Insticksmoduler</string> + <string name="plugin_needs_upgrade">Vänligen uppgradera insticksmodule %s till den senaste versionen</string> + <!--Theme names--> + <string name="theme_name_standard_light">Standard</string> + <string name="theme_name_standard_dark">Standard (Mörk)</string> + <string name="theme_name_grey_light">Grå</string> + <string name="theme_name_grey_dark">Grå (Mörk)</string> + <string name="theme_name_orange_light">Orange</string> + <string name="theme_name_orange_dark">Orange (Mörk)</string> + <string name="theme_name_blue_light">Blå</string> + <string name="theme_name_blue_dark">Blå (Mörk)</string> + <string name="theme_name_red_light">Röd</string> + <string name="theme_name_red_dark">Röd (Mörk)</string> + <string name="theme_name_amoled_dark">Kolsvart (AMOLED)</string> +</resources> diff --git a/app/src/main/res/values-tr/translatable.xml b/app/src/main/res/values-tr/translatable.xml new file mode 100644 index 0000000..639f1de --- /dev/null +++ b/app/src/main/res/values-tr/translatable.xml @@ -0,0 +1,346 @@ +<?xml version='1.0' encoding='UTF-8'?> +<resources> + <string name="app_name">Vanilya Müzik</string> + <string name="ok">Tamam</string> + <string name="cancel">İptal</string> + <!--Playback Activity (main screen)--> + <string name="no_songs">Aygıtınızda hiçbir parça bulunamadı.</string> + <string name="empty_queue">Hiçbir parça seçilmedi. Arşivinizden birkaç tane seçin veya bu iletiye dokunarak rastgele kipine geçin.</string> + <string name="settings">Ayarlar</string> + <string name="no_shuffle">Karıştırma yok</string> + <string name="shuffle_songs">Parçaları karıştır</string> + <string name="shuffle_songs_continuously">Parçaları sürekli karıştır</string> + <string name="shuffle_albums">Albümleri karışık çal</string> + <string name="no_repeat">Yineleme yok</string> + <string name="repeat">Yinele</string> + <string name="repeat_current_song">Şimdiki parçayı yinele</string> + <string name="stop_current_song">Şimdiki parçadan sonra dur</string> + <string name="random">Rastgele</string> + <string name="random_enabling">Rastgele kipi açık</string> + <string name="song_load_failed">%s parçası yüklenemedi. Bozuk veya kayıp olabilir.</string> + <string name="queue_cleared">Kuyruk temizlendi.</string> + <string name="cover_art">Kapak resmi</string> + <string name="close_notification">Bildirimi kapat</string> + <string name="_genre">tür</string> + <string name="_track">parça</string> + <string name="_composer">besteci</string> + <string name="_path">yol</string> + <string name="_format">format</string> + <string name="_title">başlık</string> + <string name="_artist">sanatçı</string> + <string name="_album">albüm</string> + <string name="_year">yıl</string> + <string name="_replaygain">seseşit</string> + <!--New Playlist Dialog--> + <string name="choose_playlist_name">Çalma listesi adını seç</string> + <string name="create">Oluştur</string> + <string name="overwrite">Üzerine yaz</string> + <string name="delete_playlist">Çalma listesi %s silinsin mi?</string> + <!--Library--> + <string name="enqueue">Kuyruğa ekle</string> + <string name="enqueue_as_next">Sonrakini çal</string> + <string name="play">Çal</string> + <string name="edit">Düzenle</string> + <string name="rename">Yeniden adlandır</string> + <string name="save_as_playlist">Çalma listesi olarak kaydet...</string> + <string name="add_to_playlist">Çalma listesine ekle...</string> + <string name="add_to_homescreen">Ana ekrana ekle...</string> + <string name="add_to">Şuraya ekle...</string> + <string name="playlist">Çalma listesi</string> + <string name="homescreen">Ana ekran</string> + <string name="add_to_favorites">Gözdelere ekle</string> + <string name="remove_from_favorites">Gözdelerden kaldır</string> + <string name="playlist_favorites">Gözdeler</string> + <string name="new_playlist">Yeni çalma listesi...</string> + <string name="expand">Genişlet</string> + <string name="expand_or_play_all">Genişlet veya hepsini çal</string> + <string name="delete">Sil</string> + <string name="playback_view">Şimdi çalınıyor</string> + <string name="sort_by">Sırala</string> + <string name="search">Ara</string> + <string name="done">Bitti</string> + <string name="remove">Kaldır</string> + <string name="play_or_enqueue">Çalınıyorsa kuyruğa ekle; duraklatıldıysa çal</string> + <string name="open">Aç</string> + <string name="go_home">Ev dizini</string> + <string name="jumping_to_song">Şarkı zaten kuyrukta, atlanıyor...</string> + <!--As a developer, you should always supply "one" and "other" + strings. Your translators will know which strings are actually + needed for their language. Always include %d in "one" because + translators will need to use %d for languages where "one" + doesn't mean 1 (as explained above). + + Translators should use http://unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules and + http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html, Type cardinal, + to see which categories apply to integer numbers in their languages--> + <plurals name="playing"> + <item quantity="one">%d parça çalınıyor.</item> + <item quantity="other">%d parça çalınıyor.</item> + </plurals> + <plurals name="enqueued"> + <item quantity="one">%d parça kuyruğa alındı.</item> + <item quantity="other">%d parça kuyruğa alındı.</item> + </plurals> + <plurals name="added_to_playlist"> + <item quantity="one"> %1$d parça %2$s oynatmalığına eklendi.</item> + <item quantity="other">%1$d parça %2$s çalma listesine eklendi.</item> + </plurals> + <plurals name="removed_from_playlist"> + <item quantity="one">%1$d parça %2$s oynatmalığından kaldırıldı.</item> + <item quantity="other">%1$d parça %2$s çalma listesinden kaldırıldı.</item> + </plurals> + <plurals name="deleted"> + <item quantity="one">%d parça silindi.</item> + <item quantity="other">%d parça silindi.</item> + </plurals> + <string name="delete_file_failed">%s silinemedi.</string> + <string name="deleted_item">\'%s\' silindi.</string> + <string name="delete_item">\'%s\' silinsin mi?</string> + <string name="delete_file">\'%s\' silinsin mi?</string> + <string name="artists">Sanatçılar</string> + <string name="albums">Albümler</string> + <string name="albumartists">Albüm Sanatçıları</string> + <string name="composers">Besteciler</string> + <string name="songs">Parçalar</string> + <string name="playlists">Listeler</string> + <string name="genres">Türler</string> + <string name="files">Dosyalar</string> + <string name="artist">Sanatçı</string> + <string name="album">Albüm</string> + <string name="genre">Tür</string> + <string name="folder">Klasör</string> + <string name="filename">Dosya adı</string> + <string name="file_size">Dosya boyutu</string> + <string name="file_time">Değiştirilme zamanı</string> + <string name="extension">Uzantı</string> + <string name="unknown">Bilinmeyen</string> + <string name="play_all">Hepsini çal</string> + <string name="enqueue_all">Hepsini kuyruğa ekle</string> + <string name="all_songs">Tüm parçalar</string> + <string name="details">Ayrıntılar</string> + <string name="more_from_artist">Bu sanatçıdan daha fazla</string> + <string name="more_from_album">Bu albümden daha fazla</string> + <string name="title">Başlık</string> + <string name="number_of_tracks">Parça sayısı</string> + <string name="year">Yıl</string> + <string name="date_added">Eklenme günayı</string> + <string name="artist_album">Sanatçı, albüm</string> + <string name="artist_year_album">Sanatçı, yıl, albüm</string> + <string name="artist_album_track">Sanatçı, albüm, parça numarası</string> + <string name="artist_album_title">Sanatçı, albüm, başlık</string> + <string name="artist_year">Sanatçı, yıl</string> + <string name="album_track">Albüm, parça numarası</string> + <string name="song_playcount">Çalma sayısı</string> + <!--Preferences--> + <plurals name="seconds"> + <item quantity="one">%d saniye</item> + <item quantity="other">%d saniye</item> + </plurals> + <plurals name="minutes"> + <item quantity="one">%d dakika</item> + <item quantity="other">%d dakika</item> + </plurals> + <plurals name="hours"> + <item quantity="one">%d saat</item> + <item quantity="other">%d saat</item> + </plurals> + <string name="audio">Ses</string> + <string name="volume_during_ducking_title">Bildirim sırasında ses düzeyi</string> + <string name="volume_during_ducking_summary">Çalma ses düzeyi</string> + <string name="ignore_audiofocus_loss_summary">Sürekli ses odak kaybında çalmayı sürdür</string> + <string name="media_button_title">Kulaklık/Bluetooth denetimleri</string> + <string name="media_button_summary">Bu aynı zamanda ICS kilit ekranı denetimleri için de gereklidir.</string> + <string name="headset_only_title">Yalnızca harici çıkış</string> + <string name="headset_only_summary">Müziğin dahili hoparlörlerden çalınmasını engeller.</string> + <string name="headset_pause_title">Çıkarıldığında duraklat</string> + <string name="headset_pause_summary">Kulaklıklar takılı olmadığında müziği duraklatır.</string> + <string name="headset_launch_title">Takıldığında çal</string> + <string name="headset_launch_summary">Kulaklıklar takıldığında çalmaya başla (\'Kulaklık Bulucu\' uygulamasının yüklü olmasını gerektirir).</string> + <string name="headset_launch_app_missing">Bu özellik \'Kulaklık Bulucu\' uygulamasının yüklü olmasını gerektirir.\nBu uygulamayı yüklemek için Play Store\'u şimdi açmak ister misiniz?</string> + <string name="replaygain">Ses Eşitleme</string> + <string name="replaygain_summary">Ses Eşitleme bilgisinin nasıl kullanılacağını düzenle</string> + <string name="replaygain_track_title">Parça başına Ses Eşitlemeyi etkinleştir</string> + <string name="replaygain_track_summary">Tüm parçaları aynı ses düzeyinde çal</string> + <string name="replaygain_album_title">Albüm Ses Eşitlemeyi etkinleştir</string> + <string name="replaygain_album_summary">Albüm dinamiklerini koru</string> + <string name="replaygain_bump_title">Pre-amp Ses Eşitlemesi</string> + <string name="replaygain_untagged_debump_title">Ses Eşitleme etiketi olmayan parçalar</string> + <string name="replaygain_untagged_debump_summary">Ses düzeyini şu kadar indir:</string> + <string name="replaygain_preamp_note_title">Not</string> + <string name="replaygain_preamp_note_content">Android Vanilya Müzik\'in ses düzeyini >%100\'e çıkartmasına izin vermiyor. Pre-amp\'ı daha yüksek bir değere çıkarmak özellikle \"sessiz\" müzikler dinlerken sorunlara neden olabilir.\n\nTavsiye edilen değerler: sessiz/klasik müzik için \n-> -3dB -2000 yılı sonrası kayıtlar için +3dB\'dir.</string> + <string name="disable_gapless_playback_title">Boşluksuz Çalmayı Devre Dışı Bırak</string> + <string name="disable_gapless_playback_summary">Boşluksuz Çalma’yı devre dışı bırakmak, düzgün olmayan üretici yazılımlarıyla yaşanabilecek sorunları azaltmada yardımcı olabilir</string> + <string name="readahead">Önbelleğe yazmayı etkinleştir</string> + <string name="readahead_summary">Şu anda çalınan parçayı önden oku. Bu seçenek \'ses kaybı\' sorunlarını çözebilir (genelde yavaş SD kart nedenli).</string> + <string name="equalizer">Ses Efektleri</string> + <string name="cycle_continuous_shuffling">Sürekli karıştır</string> + <string name="cycle_continuous_shuffling_summary">\'Karıştır kipi\' parçaları tümüyle rastgele sırada çalar</string> + <string name="notifications">Bildirimler</string> + <string name="notification_visibility_title">Bildirim görünürlüğü</string> + <string name="notification_action_title">Bildirim eylemi</string> + <string name="playback_screen">Çalma ekranı</string> + <string name="playback_on_startup_title">Başlangıçta aç</string> + <string name="playback_on_startup_summary">Başlangıçta çalma görünümünü açar</string> + <string name="display_mode_title">Görüntü kipi</string> + <string name="swipe_up_action_title">Yukarı çekme eylemi</string> + <string name="swipe_down_action_title">Aşağı çekme eylemi</string> + <string name="cover_press_action_title">Kapağa dokunma eylemi</string> + <string name="cover_longpress_action_title">Kapağa uzun dokunma eylemi</string> + <string name="library_screen">Arşiv ekranı</string> + <string name="default_action_title">Öntanımlı eylem</string> + <string name="default_playlist_action_title">Çalma listeleri için öntanımlı eylem</string> + <string name="accelerometer_shake">İvmeölçer sallama</string> + <string name="enable_shake_title">İvmeölçer sallamasını etkinleştir</string> + <string name="enable_shake_summary">Yalnızca müzik çalarken etkindir. Bazı aygıtlarda ekran kapalıyken çalışmaz.</string> + <string name="shake_action_title">Sallama eylemi</string> + <string name="shake_threshold_title">Sallama güç sınırlaması</string> + <string name="misc_features">Diğer özellikler</string> + <string name="theme">Tema</string> + <string name="disable_lockscreen_title">Kilit ekranını devre dışı bırak</string> + <string name="disable_lockscreen_summary">Arşiv veya çalma ekranındayken kilit ekranını devre dışı bırak</string> + <string name="keep_screen_on_title">Ekranı açık tut</string> + <string name="keep_screen_on_summary">Vanilya Müzik görünür olduğu zaman ekranı (ve aygıtı) uyanık tut</string> + <string name="use_idle_timeout_title">Boşta kalma süresini etkinleştir</string> + <string name="use_idle_timeout_summary">Çalma belli bir sürelik etkisizliğin ardından durdurulur</string> + <string name="idle_timeout_title">Boşta kalma süresi</string> + <string name="enable_scroll_to_song_title">Parça adına kaydır</string> + <string name="enable_scroll_to_song_summary">Arşiv listelerinde şu anda çalınan parça/albüm/sanatçı adına kaydır</string> + <string name="queue_enable_scroll_to_song_title">Kuyruktaki parça adına kaydır</string> + <string name="queue_enable_scroll_to_song_summary">Parça değişiminde kuyrukta şu anda çalınan parçaya kaydır</string> + <string name="jump_to_enqueued_on_play_title">\'Çalma\'da kuyruğa eklenmiş parçaya atla</string> + <string name="jump_to_enqueued_on_play_summary">Eğer istenen parça zaten kuyruktaysa kuyruğu temizlemek yerine parçaya atla</string> + <string name="coverloader_android_title">Android\'ten albüm resmi yükle</string> + <string name="coverloader_android_summary">Android iç veritabanını albüm resimleri için sorgula</string> + <string name="coverloader_vanilla_title">Klasörden albüm resmi yükle</string> + <string name="coverloader_vanilla_summary">cover.jpg, album.jpg veya artwork.jpg adlı dosyaları ara ve onları albüm kapağı olarak göster</string> + <string name="coverloader_shadow_title">Albüm resmini gizli klasörden yükle</string> + <string name="coverloader_shadow_summary">\'/sdcard/Music/.vanilla/ARTIST/ALBUM.jpg\' konumundan albüm resmini yüklemeye çalış</string> + <string name="coverloader_inline_title">Dosya etiketlerinden kapak resimleri yükle</string> + <string name="coverloader_inline_summary">Dosya etiketlerinden gömülü albüm kapaklarını yüklemeye çalışır</string> + <string name="cover_on_lockscreen_title">Kilit ekranında kapak resmini göster</string> + <string name="cover_on_lockscreen_summary">Şu anda çalınan parçanın albüm resmini kilit ekranında göster</string> + <string name="double_tap_title">İkili dokunma pencereciği</string> + <string name="double_tap_summary">1x1 widget\'a iki kez basmak çaları açar. 400ms\'lik bir gecikme ile çalışır.</string> + <string name="scrobble_title">Scrobble Droid API\'sini kullan</string> + <string name="scrobble_summary">Last.fm\'e Scrobble Droid veya Simple Last.fm Scrobbler kullanarak işleyin</string> + <string name="stock_broadcast_title">Varsayılan yayınları öykün</string> + <string name="stock_broadcast_summary">Varsayılan müzik çalar tarafından 3. parti kilit ekranı denetimleri ve uygulamacıklar ile çalışması için öykünen yayınlar gönder.</string> + <string name="help">Yardım</string> + <string name="about">Hakkında</string> + <string name="tabs">Sekme sırası</string> + <string name="customize_tab_order">Arşiv sekmelerinin sırası ve görünürlüğünü değiştirir</string> + <string name="restore_default">Öntanımlı düzen</string> + <!--The following are for the list preferences--> + <string name="last_used_action">Son kullanılan eylem</string> + <string name="never_show">Hiçbir zaman gösterme</string> + <string name="show_when_playing">Çalarken göster (varsayılan)</string> + <string name="always_show">Her zaman göster</string> + <string name="open_main_activity">Arşivi aç (varsayılan)</string> + <string name="open_mini_popup">Ufak pıtlayanı aç</string> + <string name="skip_to_next_song">Sonraki parçaya atla</string> + <string name="open_full_player">Tam çaları aç</string> + <string name="info_on_cover">Bilgi kapak resmi üstünde</string> + <string name="info_below_cover">Bilgi kapak resmi altında</string> + <string name="fixed_info">Bilgi üstte sabit</string> + <string name="do_nothing">Hiçbir şey yapmaz</string> + <string name="open_library">Arşivi aç</string> + <string name="play_pause">Çal/Duraklat</string> + <string name="next_song">Sonraki parça</string> + <string name="previous_song">Önceki parça</string> + <string name="next_album">Sonraki albüm</string> + <string name="previous_album">Önceki albüm</string> + <string name="cycle_repeat_mode">Yinele kipini döndür</string> + <string name="cycle_shuffle_mode">Karıştır kipini döndür</string> + <string name="enqueue_current_album">Bu albümü kuyruğa ekle</string> + <string name="enqueue_current_artist">Bu sanatçıyı kuyruğa ekle</string> + <string name="enqueue_current_genre">Bu türü kuyruğa ekle</string> + <string name="enqueue_current">Kuyruğa ekle...</string> + <string name="more_from_current">Daha fazlası...</string> + <string name="empty_the_queue">Kuyruğu boşalt</string> + <string name="show_queue">Kuyruğu göster</string> + <string name="hide_queue">Kuyruğu gizle</string> + <string name="dequeue_rest">Gerisini kuyruktan çıkar</string> + <string name="toggle_controls">Denetimleri göster</string> + <string name="seek_10s_backward">10 saniye geri sar</string> + <string name="seek_10s_forward">10 saniye ileri sar</string> + <string name="move_to_top">Tepeye taşı</string> + <string name="move_to_bottom">Alta taşı</string> + <string name="preferences_action_show_queue">Kuyruğu göster</string> + <string name="preferences_action_clear_queue">Kuyruğu temizle</string> + <string name="preferences_action_enqueue_current_album">Albümü kuyruğa ekle</string> + <string name="preferences_action_enqueue_current_artist">Sanatçıyı kuyruğa ekle</string> + <string name="preferences_action_enqueue_current_genre">Türü kuyruğa ekle</string> + <string name="jump_to_time">Zamana atla</string> + <string name="time_separator">:</string> + <string name="hour_hint">SS</string> + <string name="minute_hint">DD</string> + <string name="second_hint">SS</string> + <string name="error_invalid_position">Geçersiz konum</string> + <string name="filebrowser_start">Dosya yöneticisi ana ekranı</string> + <string name="customize_filebrowser_start">Dosya yöneticisi bu dizinde başlar</string> + <string name="select">Seç</string> + <string name="save">Kaydet</string> + <string name="autoplaylist_playcounts_title">Kendiliğinden çalma listesi oluşturma</string> + <string name="autoplaylist_playcounts_summary">Kendiliğinden oluştur:</string> + <string name="autoplaylist_playcounts_fmt" formatted="false">%s \'En iyi %.0f parça\'</string> + <string name="autoplaylist_playcounts_disabled">Kendiliğinden çalma listesi oluşturma!</string> + <string name="autoplaylist_playcounts_name" formatted="false">En iyi %d</string> + <string name="playlist_sync_mode_title">Çalma listesi eşitlemesi</string> + <string name="playlist_sync_all">Toptan eşitleme</string> + <string name="playlist_sync_only_import">M3U içe aktar ancak dışa aktarma</string> + <string name="playlist_sync_only_export">M3U\'ya yaz, ancak içe aktarma</string> + <string name="playlist_sync_disabled">Kapatılmış</string> + <string name="playlist_sync_folder_title">Eşitleme klasörü</string> + <string name="playlist_sync_folder_summary">Çalma listesi eşitlemesi için kullanılacak klasör</string> + <string name="playlist_export_relative_paths_title">Göreceli yol adları kullanarak dışa aktar</string> + <string name="playlist_export_relative_paths_summary">Çalma listesine göreli dosya yollarına başvur</string> + <string name="permission_request_summary">Vanilya Müzik, müzik arşivinizi görüntüleyebilmek için izninize gereksinim duyar</string> + <string name="reverse_sort">Sıralamayı tersine çevir</string> + <string name="share">Paylaş…</string> + <string name="share_failed">Dosya paylaşımı başarısız</string> + <string name="sendto">Gönder…</string> + <string name="no_receiving_apps">Bu ortam türü için uygun uygulama bulunamadı.</string> + <string name="duration">Süre</string> + <string name="dump_database">Veritabanını yığ</string> + <string name="dump_database_result">Veritabanı \'%s\' yerine yığıldı.</string> + <string name="force_m3u_import">M3U yeniden içe aktarmasını zorla</string> + <string name="media_library">Ortam arşivi</string> + <string name="media_folders_header">İndekslenmiş dizinler</string> + <string name="media_scan_header">Ortam tarayıcısı</string> + <string name="media_scan_full">Tüm dosya dizgesini tara (daha yavaş)</string> + <string name="media_scan_drop_db">Ortam veritabanını temizle</string> + <string name="media_scan_start">Taramayı başlat</string> + <string name="media_scan_force_bastp">Her zaman dahili etiket okuyucuyu kullan</string> + <string name="media_scan_group_albums">Albümleri klasöre göre öbekle</string> + <string name="media_statistics">İstatistikler</string> + <string name="media_stats_tracks">Parça sayısı</string> + <string name="media_stats_library_playtime">Toplam çalma süresi (Saat)</string> + <string name="media_stats_listen_playtime">Saat cinsinden çalınan müzik süresi</string> + <string name="media_stats_progress">Tarama durumu</string> + <string name="media_library_scan_running">Ortam arşivi taranıyor...</string> + <string name="media_scan_preferences">Tarayıcı seçenekleri</string> + <string name="media_scan_preferences_change_title">Tarayıcı seçenekleri değiştirildi</string> + <string name="media_scan_preferences_change_message">Bu seçeneği değiştirmek arşivinizi yeniden taratacaktır. Sürdürmek istiyor musunuz?</string> + <string name="folder_picker_spinner_desc">Dizin Durumu:</string> + <!--Folder selector--> + <string name="hint_long_press_to_modify_folder">Klasör seçeneklerini değiştirmek için uzun basın</string> + <string name="folder_include">İçer</string> + <string name="folder_exclude">Dışarıda tut</string> + <string name="folder_neutral">Nötral</string> + <!--Plugin system--> + <string name="plugins">Eklentiler</string> + <string name="plugin_needs_upgrade">%s eklentisini en son sürüme güncelleyin</string> + <!--Theme names--> + <string name="theme_name_standard_light">Standart</string> + <string name="theme_name_standard_dark">Standart (Koyu)</string> + <string name="theme_name_grey_light">Gri</string> + <string name="theme_name_grey_dark">Gri (Koyu)</string> + <string name="theme_name_orange_light">Turuncu</string> + <string name="theme_name_orange_dark">Turuncu (Koyu)</string> + <string name="theme_name_blue_light">Mavi</string> + <string name="theme_name_blue_dark">Mavi (Koyu)</string> + <string name="theme_name_red_light">Kırmızı</string> + <string name="theme_name_red_dark">Kırmızı (Koyu)</string> + <string name="theme_name_amoled_dark">Kapkara (AMOLED)</string> + <string name="theme_name_start_wearing_purple">Mor Giymeye Başla</string> +</resources> diff --git a/app/src/main/res/values-uk/translatable.xml b/app/src/main/res/values-uk/translatable.xml new file mode 100644 index 0000000..d84d491 --- /dev/null +++ b/app/src/main/res/values-uk/translatable.xml @@ -0,0 +1,359 @@ +<?xml version='1.0' encoding='UTF-8'?> +<resources> + <string name="app_name">Vanilla Music</string> + <string name="ok">Добре</string> + <string name="cancel">Скасувати</string> + <!--Playback Activity (main screen)--> + <string name="no_songs">Не знайдено жодної компоиції на вашому пристрої</string> + <string name="empty_queue">Не обрано жодної композиції. Виберіть кілька з бібліотеки або ввімкніть вибір випадкових композицій, торкнувшись цього повідомлення.</string> + <string name="settings">Налаштування</string> + <string name="no_shuffle">Не перемішувати</string> + <string name="shuffle_songs">Перемішати композиції</string> + <string name="shuffle_songs_continuously">Постійно перемішувати композиції</string> + <string name="shuffle_albums">Перемішати альбоми</string> + <string name="no_repeat">Не повторювати</string> + <string name="repeat">Повторювати</string> + <string name="repeat_current_song">Повторити поточну композицію</string> + <string name="stop_current_song">Зупинитися після поточної композиції</string> + <string name="random">Випадковий</string> + <string name="random_enabling">Випадковий режим увімкнено</string> + <string name="song_load_failed">Не вдалося завантажити композицію %s. Можливо вона пошкоджена або відсутня.</string> + <string name="queue_cleared">Чергу очищено</string> + <string name="cover_art">Обкладинка альбому</string> + <string name="close_notification">Закрити сповіщення</string> + <string name="_genre">жанр</string> + <string name="_track">композиція</string> + <string name="_composer">композитор</string> + <string name="_path">шлях</string> + <string name="_format">формат</string> + <string name="_title">назва</string> + <string name="_artist">виконавець</string> + <string name="_album">альбом</string> + <string name="_year">рік</string> + <string name="_replaygain">вирівнювання гучності</string> + <!--New Playlist Dialog--> + <string name="choose_playlist_name">Виберіть ім\'я списку відтворення</string> + <string name="create">Створити</string> + <string name="overwrite">Перезаписати</string> + <string name="delete_playlist">Видалити список відтворення %s?</string> + <!--Library--> + <string name="enqueue">Додати до черги</string> + <string name="enqueue_as_next">Грати наступною</string> + <string name="play">Грати</string> + <string name="edit">Коригувати</string> + <string name="rename">Змінити назву</string> + <string name="save_as_playlist">Зберегти список відтворення</string> + <string name="add_to_playlist">Додати до списку відтворення</string> + <string name="add_to_homescreen">Додати до стільниці...</string> + <string name="add_to">Додати до...</string> + <string name="playlist">Список відтворення</string> + <string name="homescreen">Стільниця</string> + <string name="add_to_favorites">Додати до улюблених</string> + <string name="remove_from_favorites">Усунути з улюблених</string> + <string name="playlist_favorites">Улюблені</string> + <string name="new_playlist">Новий список відтворення</string> + <string name="expand">Розширити</string> + <string name="expand_or_play_all">Розширити або відтворити всі</string> + <string name="delete">Видалити</string> + <string name="playback_view">Зараз грає</string> + <string name="sort_by">Сортувати за</string> + <string name="search">Пошук</string> + <string name="done">Готово</string> + <string name="remove">Усунути</string> + <string name="play_or_enqueue">Додати до черги якщо відтворюється; Відтворити якщо призупинено</string> + <string name="open">Відкрити</string> + <string name="go_home">Домашня папка</string> + <string name="jumping_to_song">Пісня вже додана до черги, переходимо...</string> + <!--As a developer, you should always supply "one" and "other" + strings. Your translators will know which strings are actually + needed for their language. Always include %d in "one" because + translators will need to use %d for languages where "one" + doesn't mean 1 (as explained above). + + Translators should use http://unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules and + http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html, Type cardinal, + to see which categories apply to integer numbers in their languages--> + <plurals name="playing"> + <item quantity="one">%d композиція відтворюються.</item> + <item quantity="few">%d композиції відтворюються.</item> + <item quantity="many">%d композицій відтворюються.</item> + <item quantity="other">%d композицій відтворюються.</item> + </plurals> + <plurals name="enqueued"> + <item quantity="one">%d композицію додано до черги.</item> + <item quantity="few">%d композиції додано до черги.</item> + <item quantity="many">%d композицій додано до черги.</item> + <item quantity="other">%d композицій додано до черги.</item> + </plurals> + <plurals name="added_to_playlist"> + <item quantity="one">%1$d композицію додано до списку відтворення %2$s.</item> + <item quantity="few">%1$d композиції додано до списку відтворення %2$s.</item> + <item quantity="many">%1$d композицій додано до списку відтворення %2$s.</item> + <item quantity="other">%1$d композицій додано до списку відтворення %2$s.</item> + </plurals> + <plurals name="removed_from_playlist"> + <item quantity="one">%1$d композицію видалено зі списку відтворення %2$s.</item> + <item quantity="few">%1$d композиції видалено зі списку відтворення %2$s.</item> + <item quantity="many">%1$d композицій видалено зі списку відтворення %2$s.</item> + <item quantity="other">%1$d композицій видалено зі списку відтворення %2$s.</item> + </plurals> + <plurals name="deleted"> + <item quantity="one">%d композицію видалено.</item> + <item quantity="few">%d композиції видалено.</item> + <item quantity="many">%d композицій видалено.</item> + <item quantity="other">%d композицій видалено.</item> + </plurals> + <string name="delete_file_failed">Не вдалося видалити %s.</string> + <string name="deleted_item">\'%s\' видалено.</string> + <string name="delete_item">Видалити \'%s\'?</string> + <string name="delete_file">Видалити файл \'%s\'?</string> + <string name="artists">Виконавці</string> + <string name="albums">Альбоми</string> + <string name="albumartists">Виконавці альбома</string> + <string name="composers">Композитори</string> + <string name="songs">Композиції</string> + <string name="playlists">Списки відтворення</string> + <string name="genres">Жанри</string> + <string name="files">Файли</string> + <string name="artist">Виконавець</string> + <string name="album">Альбом</string> + <string name="genre">Жанр</string> + <string name="folder">Тека</string> + <string name="filename">Назва файлу</string> + <string name="file_size">Розмір файлу</string> + <string name="file_time">Час зміни</string> + <string name="extension">Розширення</string> + <string name="unknown">Невідомий</string> + <string name="play_all">Грати все</string> + <string name="enqueue_all">Додати до черги все</string> + <string name="all_songs">Усі композиції</string> + <string name="details">Подробиці</string> + <string name="more_from_artist">Більше від виконавця</string> + <string name="more_from_album">Більше з альбому</string> + <string name="title">Назва</string> + <string name="number_of_tracks">Кількість композицій</string> + <string name="year">Рік</string> + <string name="date_added">Коли додано</string> + <string name="artist_album">Виконовець, альбом</string> + <string name="artist_year_album">Виконавець, рік, альбом</string> + <string name="artist_album_track">Виконавець, альбом, номер композиції</string> + <string name="artist_album_title">Виконавець, альбом, назва</string> + <string name="artist_year">Виконавець, рік</string> + <string name="album_track">Альбом, номер композиції</string> + <string name="song_playcount">Кількість відтворень</string> + <!--Preferences--> + <plurals name="seconds"> + <item quantity="one">%d секунда</item> + <item quantity="few">%d секунди</item> + <item quantity="many">%d секунд</item> + <item quantity="other">%d секунди</item> + </plurals> + <plurals name="minutes"> + <item quantity="one">%d хвилина</item> + <item quantity="few">%d хвилини</item> + <item quantity="many">%d хвилини</item> + <item quantity="other">%d хвилин</item> + </plurals> + <plurals name="hours"> + <item quantity="one">%d година</item> + <item quantity="few">%d години</item> + <item quantity="many">%d години</item> + <item quantity="other">%d годин</item> + </plurals> + <string name="audio">Аудіо</string> + <string name="volume_during_ducking_title">Гучність при сповіщеннях</string> + <string name="volume_during_ducking_summary">Гучність відтворення:</string> + <string name="ignore_audiofocus_loss_summary">Продовжувати відтворення після повної втрати аудіо-фокусу</string> + <string name="media_button_title">Керування з гарнітури/bluetooth</string> + <string name="media_button_summary">Необхідно для керування відтворенням з екрану блокування у ICS</string> + <string name="headset_only_title">Тільки зовнішній аудіо-вихід</string> + <string name="headset_only_summary">Не відтворювати музику через вбудовані гучномовці.</string> + <string name="headset_pause_title">Призупиняти при відключенні</string> + <string name="headset_pause_summary">Призупиняти відтворення коли навушники відключено.</string> + <string name="headset_launch_title">Відтворювати при підключенні</string> + <string name="headset_launch_summary">Продовжувати відтворення коли навушники підключено. (Вимагає встановленого додатку \'Headphone detector\'.)</string> + <string name="headset_launch_app_missing">Ця функція вимагає встановлення додатку \'Headphone detector\'.\nБажаєте відкрити Play Store та встановити додаток?</string> + <string name="replaygain">Вирівнювання гучності</string> + <string name="replaygain_summary">Налаштувати функції вирівнювання гучності.</string> + <string name="replaygain_track_title">Увімкнути вирівнювання для композицій</string> + <string name="replaygain_track_summary">Відтворювати всі композиції на однаковій гучності.</string> + <string name="replaygain_album_title">Увімкнути вирівнювання для альбомів</string> + <string name="replaygain_album_summary">Зберігає динамічність альбомів</string> + <string name="replaygain_bump_title">Рівень підсилення гучності</string> + <string name="replaygain_untagged_debump_title">Композиції не відмічені для вирівнювання</string> + <string name="replaygain_untagged_debump_summary">Зменшити гучність на</string> + <string name="replaygain_preamp_note_title">Примітка</string> + <string name="replaygain_preamp_note_content">Android не дозволяє Vanilla Music збільшувати гучність понад 100%. Встановлення великих значень підсилення звуку може спричинити проблеми з відтворенням тихої музики. \n\nРекомендовані значення:\n-> -3dB для спокійної/класичної музики\n-> +3dB для записів 2000-х.</string> + <string name="readahead">Увімкнути зчитування заздалегідь.</string> + <string name="readahead_summary">Заздалегідь зчитує відтворювану композицію в пам\'ять. Ця функція може вирішити проблеми з пропаданням звуку. (спричинені повільною SD карткою)</string> + <string name="equalizer">Еквалайзер</string> + <string name="cycle_continuous_shuffling">Постійне перемішування</string> + <string name="cycle_continuous_shuffling_summary">Режим перемішування відтворює композиції у випадковому порядку.</string> + <string name="notifications">Сповіщення</string> + <string name="notification_visibility_title">Видимість сповіщення</string> + <string name="notification_action_title">Дія сповіщення</string> + <string name="playback_screen">Екран відтворення</string> + <string name="playback_on_startup_title">Відкривати під час запуску</string> + <string name="playback_on_startup_summary">Відкривати екран відтворення при запуску</string> + <string name="display_mode_title">Інформація про композицію</string> + <string name="swipe_up_action_title">Ковзання вгору</string> + <string name="swipe_down_action_title">Ковзання донизу</string> + <string name="cover_press_action_title">Тиць по обкладинці</string> + <string name="cover_longpress_action_title">Довгий тиць по обкладинці</string> + <string name="library_screen">Екран бібліотеки</string> + <string name="default_action_title">Типова дія</string> + <string name="default_playlist_action_title">Типова дія списку відтворення</string> + <string name="accelerometer_shake">Реакція на струшування</string> + <string name="enable_shake_title">Увімкнути реакцію на струшування смартфона</string> + <string name="enable_shake_summary">Працює лише тоді коли відтворюється музика. Не працює на деяких пристроях якщо екран вимкнено.</string> + <string name="shake_action_title">Дія при струшуванні</string> + <string name="shake_threshold_title">Чутливість струшування</string> + <string name="misc_features">Інші функції</string> + <string name="theme">Тема</string> + <string name="disable_lockscreen_title">Вимкнути блокування екрану</string> + <string name="disable_lockscreen_summary">Не допускати блокування екрану коли відкрито бібліотеку або екран відтворення.</string> + <string name="keep_screen_on_title">Тримати екран увімкненим</string> + <string name="keep_screen_on_summary">Екран не буде гаснути поки Vanilla Music не буде згорнуто або закрито</string> + <string name="use_idle_timeout_title">Увімкнути таймер простою</string> + <string name="use_idle_timeout_summary">Якщо увімкнуто то відтворення буде зупинено після заданого часу неактивності</string> + <string name="idle_timeout_title">Час простою</string> + <string name="enable_scroll_to_song_title">Прокручувати до назви композиції</string> + <string name="enable_scroll_to_song_summary">Прокручувати список елементів у бібліотеці до поточної композиції, альбому або списку відтворення</string> + <string name="queue_enable_scroll_to_song_title">Прокручувати до назви композиції в черзі</string> + <string name="queue_enable_scroll_to_song_summary">Прокручувати композиції в черзі відтворення до поточної композиції при переході до наступної пісні</string> + <string name="jump_to_enqueued_on_play_title">Переходити до пісні в черзі при відтворенні</string> + <string name="jump_to_enqueued_on_play_summary">Якщо пісня вже додана в чергу, переходити до неї замість очищення черги</string> + <string name="coverloader_android_title">Завантажувати обкладинку з Android</string> + <string name="coverloader_android_summary">Завантажувати обкладинку з вбудованої медіа-бібліотеки Android</string> + <string name="coverloader_vanilla_title">Завантажувати обкладинку з теки</string> + <string name="coverloader_vanilla_summary">Шукати зображення з іменами cover.jpg, album.jpg або artwork.jpg і показувати їх як обкладинки альбому</string> + <string name="coverloader_shadow_title">Завантажувати обкладинки з прихованої теки</string> + <string name="coverloader_shadow_summary">Намагатися завантажити обкладинку з теки \'/sdcard/Music/.vanilla/ARTIST/ALBUM.jpg\'</string> + <string name="coverloader_inline_title">Завантажувати обкладинку з тегів файлу</string> + <string name="coverloader_inline_summary">Намагатися завантажити вбудовану обкладинку з медіа тегів файлу</string> + <string name="cover_on_lockscreen_title">Показувати обкладинку на екрані блокування</string> + <string name="cover_on_lockscreen_summary">Показувати обкладинку композиції, яка зараз відтворюється, на екрані блокування</string> + <string name="double_tap_title">Подвійний тиць застосунку</string> + <string name="double_tap_summary">Подвійний тиць застосунку 1х1 відкриє програвач. Включає затримку в 400 мс перед тим як застосунок зреагує на дію.</string> + <string name="scrobble_title">Використовувати Scrobble Droid API</string> + <string name="scrobble_summary">Надсилати дані про відтворювані композиції на Last.fm через Scrobble Droid або Simple Last.fm Scrobbler</string> + <string name="stock_broadcast_title">Відтворювати стандартні розсилки</string> + <string name="stock_broadcast_summary">Надсилати розсилки аналогічні тим які надсилає вбудований програвач щоб взаємодіяти зі сторонніми блокувальниками екрану, пристосунками тощо.</string> + <string name="help">Допомога</string> + <string name="about">Про додаток</string> + <string name="tabs">Порядок вкладок</string> + <string name="customize_tab_order">Налаштуйте порядок та видимість вкладок у бібліотеці</string> + <string name="restore_default">Відновити налаштування за замовчуванням</string> + <!--The following are for the list preferences--> + <string name="last_used_action">Остання виконана дія</string> + <string name="never_show">Ніколи не показувати</string> + <string name="show_when_playing">Показувати під час відтворення (за замовчуванням)</string> + <string name="always_show">Завжди показувати</string> + <string name="open_main_activity">Відкрити бібліотеку (за замовчуванням)</string> + <string name="open_mini_popup">Відкрити спливаюче вікно</string> + <string name="skip_to_next_song">Перейти до наступної композиції</string> + <string name="open_full_player">Відкрити програвач</string> + <string name="info_on_cover">Інформація на обкладинці</string> + <string name="info_below_cover">Інформація під обкладинкою</string> + <string name="fixed_info">Інформація над обкладинкою</string> + <string name="do_nothing">Нічого не робити</string> + <string name="open_library">Відкрити бібліотеку</string> + <string name="play_pause">Відтворення/Пауза</string> + <string name="next_song">Наступна композиція</string> + <string name="previous_song">Попередня композиція</string> + <string name="next_album">Наступний Альбом</string> + <string name="previous_album">Попередній альбом</string> + <string name="cycle_repeat_mode">Перемикати режим повтору</string> + <string name="cycle_shuffle_mode">Перемикати режим перемішування</string> + <string name="enqueue_current_album">Додати альбом в чергу</string> + <string name="enqueue_current_artist">Додати виконавця в чергу</string> + <string name="enqueue_current_genre">Додати жанр в чергу</string> + <string name="enqueue_current">Додати в чергу...</string> + <string name="more_from_current">Більше від...</string> + <string name="empty_the_queue">Очистити чергу</string> + <string name="show_queue">Показати чергу</string> + <string name="hide_queue">Сховати чергу</string> + <string name="dequeue_rest">Видалити з черги решту</string> + <string name="toggle_controls">Перемкнути кнопки керування</string> + <string name="seek_10s_backward">Перемотати на 10 секунд назад</string> + <string name="seek_10s_forward">Перемотати на 10 секунд вперед</string> + <string name="move_to_top">Перемістити нагору</string> + <string name="move_to_bottom">Перемістити донизу</string> + <string name="preferences_action_show_queue">Показати чергу</string> + <string name="preferences_action_clear_queue">Очистити чергу</string> + <string name="preferences_action_enqueue_current_album">Додати альбом в чергу</string> + <string name="preferences_action_enqueue_current_artist">Додати виконавця в чергу</string> + <string name="preferences_action_enqueue_current_genre">Додати жанр в чергу</string> + <string name="jump_to_time">Перейти до часу</string> + <string name="time_separator">:</string> + <string name="hour_hint">ГГ</string> + <string name="minute_hint">ХХ</string> + <string name="second_hint">СС</string> + <string name="error_invalid_position">Некоректна позиція</string> + <string name="filebrowser_start">Домашня тека переглядача файлів</string> + <string name="customize_filebrowser_start">Переглядач файлів починає перегляд з цієї теки</string> + <string name="select">Вибрати</string> + <string name="save">Зберегти</string> + <string name="autoplaylist_playcounts_title">Автоматичне створення списку відтворення</string> + <string name="autoplaylist_playcounts_summary">Автоматично створити </string> + <string name="autoplaylist_playcounts_fmt" formatted="false">%s список відтворення \"Топ %.0f\"</string> + <string name="autoplaylist_playcounts_disabled">Не створювати автоматичний список відтворення</string> + <string name="autoplaylist_playcounts_name" formatted="false">Топ %d</string> + <string name="playlist_sync_mode_title">Синхронізація списку відтворення</string> + <string name="playlist_sync_all">Повна синхронізація</string> + <string name="playlist_sync_only_import">Імпортувати M3U, ніколи не експортувати</string> + <string name="playlist_sync_only_export">Експортувати M3U, ніколи не імпортувати</string> + <string name="playlist_sync_disabled">Вимкнено</string> + <string name="playlist_sync_folder_title">Синхронізація теки</string> + <string name="playlist_sync_folder_summary">Тека для синхронізації списків відтворення</string> + <string name="playlist_export_relative_paths_title">Експортувати відносні шляхи</string> + <string name="playlist_export_relative_paths_summary">Шляхи до файлів будуть експортовані відносно розташування списку відтворення</string> + <string name="permission_request_summary">Vanilla Music потребує дозволу на читання щоб відобразити вашу музичну бібліотеку</string> + <string name="reverse_sort">Впорядкувати в зворотньому напрямку</string> + <string name="share">Поділитися...</string> + <string name="share_failed">Не вдалося поділитися файлом</string> + <string name="sendto">Надіслати до...</string> + <string name="no_receiving_apps">Не знайдено додатків здатних отримати цей тип медіа!</string> + <string name="duration">Тривалість</string> + <string name="dump_database">Зліпок бази даних</string> + <string name="dump_database_result">Зліпок бази даних знято до \"%s\"</string> + <string name="force_m3u_import">Примусово перечитати M3U</string> + <string name="media_library">Медіа бібліотека</string> + <string name="media_folders_header">Індексовані теки</string> + <string name="media_scan_header">Медіа сканер</string> + <string name="media_scan_full">Сканувати файлову систему повністю (повільніше)</string> + <string name="media_scan_drop_db">Очистити медіа бібліотеку</string> + <string name="media_scan_start">Почати сканування</string> + <string name="media_scan_force_bastp">Завжди використовувати вбудований зчитувач медіа тегів</string> + <string name="media_scan_group_albums">Групувати альбоми по теках</string> + <string name="media_statistics">Статистика</string> + <string name="media_stats_tracks">Число композицій</string> + <string name="media_stats_library_playtime">Загальний час відтворення (годин)</string> + <string name="media_stats_listen_playtime">Годин музики відтворено</string> + <string name="media_stats_progress">Прогрес сканування</string> + <string name="media_library_scan_running">Сканування медіа-бібліотеки</string> + <string name="media_scan_preferences">Налаштування сканера</string> + <string name="media_scan_preferences_change_title">Налаштування сканера змінено</string> + <string name="media_scan_preferences_change_message">Зміна цього налаштування спричинить повне сканування вашої бібліотеки. Бажаєте продовжити?</string> + <string name="folder_picker_spinner_desc">Статус теки:</string> + <!--Folder selector--> + <string name="hint_long_press_to_modify_folder">Натисніть та утримуйте щоб змінити налаштування теки</string> + <string name="folder_include">Включити</string> + <string name="folder_exclude">Виключити</string> + <string name="folder_neutral">Ігнорувати</string> + <!--Plugin system--> + <string name="plugins">Втулки</string> + <string name="plugin_needs_upgrade">Будь ласка оновіть втулок %s до найновішої версії</string> + <!--Theme names--> + <string name="theme_name_standard_light">Стандарт</string> + <string name="theme_name_standard_dark">Стандарт (Темна)</string> + <string name="theme_name_grey_light">Сіра</string> + <string name="theme_name_grey_dark">Сіра (Темна)</string> + <string name="theme_name_orange_light">Оранж</string> + <string name="theme_name_orange_dark">Оранж (Темна)</string> + <string name="theme_name_blue_light">Синя</string> + <string name="theme_name_blue_dark">Синя (Темна)</string> + <string name="theme_name_red_light">Червона</string> + <string name="theme_name_red_dark">Червона (Темна)</string> + <string name="theme_name_amoled_dark">Цілковита Пітьма (AMOLED)</string> +</resources> diff --git a/app/src/main/res/values-v21/colors.xml b/app/src/main/res/values-v21/colors.xml new file mode 100644 index 0000000..24d1d9b --- /dev/null +++ b/app/src/main/res/values-v21/colors.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <!-- framework colors --> + <color name="material_grey_200">#eeeeee</color> + <color name="material_grey_300">#e0e0e0</color> + <color name="material_grey_400">#bdbdbd</color> + <color name="material_grey_500">#ffa3a3a3</color> + <color name="material_grey_600">#ff757575</color> + <color name="material_grey_700">#61616161</color> + <color name="material_grey_800">#42424242</color> + <color name="material_grey_900">#ff212121</color> + <color name="button_material_light">#ffd6d7d7</color> + <color name="button_material_dark">#ff5a595b</color> + + <!-- library tabs --> + <color name="tabs_active_indicator">@android:color/background_light</color> + + <!-- themed overlay colors for full playback activity --> + <color name="overlay_background_light">#ffeeeeee</color> + <color name="overlay_foreground_light">#f000</color> + + <color name="overlay_background_dark">#ff303030</color> + <color name="overlay_foreground_dark">#ffffffff</color> + + <!-- defined here due to an Android ~9 bug --> + <color name="start_wearing_purple_background">#FF1B1734</color> +</resources> diff --git a/app/src/main/res/values-v21/theme-amoled_dark.xml b/app/src/main/res/values-v21/theme-amoled_dark.xml new file mode 100644 index 0000000..8715d7f --- /dev/null +++ b/app/src/main/res/values-v21/theme-amoled_dark.xml @@ -0,0 +1,62 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + + *** THIS FILE WAS GENERATED BY 'generate-themes.pl' - DO NOT TOUCH *** + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +--> + +<resources> + <!-- dark theme --> + <style name="Amoled_dark.VanillaBase" parent="android:Theme.Material"> + + <item name="android:colorBackground">@android:color/black</item> + <item name="overlay_background_color">@android:color/black</item> + + <item name="overlay_foreground_color">@color/overlay_foreground_dark</item> + <item name="float_color">@color/material_grey_900</item> + <item name="tabs_background">#ff000000</item> + <item name="now_playing_marker">#ffd8d8d8</item> + <item name="controls_normal">@color/material_grey_600</item> + <item name="controls_active">#ffd8d8d8</item> + <item name="android:colorAccent">#ffd8d8d8</item> + <item name="android:colorPrimary">#ff000000</item> + <item name="android:colorPrimaryDark">#ff000000</item> + <item name="themed_letter_tile_colors">@array/letter_tile_colors_dark</item> + </style> + + <style name="Amoled_dark.Playback" parent="Amoled_dark.VanillaBase"> + <item name="android:actionBarStyle">@style/Universal.PlaybackActionBar</item> + </style> + + <style name="Amoled_dark.BackActionBar" parent="Amoled_dark.VanillaBase"> + <item name="android:actionBarStyle">@style/Universal.PlaybackActionBar</item> + </style> + + <style name="Amoled_dark.Library" parent="Amoled_dark.VanillaBase"> + <item name="android:windowActionBar">false</item> + <item name="android:windowNoTitle">true</item> + </style> + + <style name="Amoled_dark.PopupDialog" parent="android:Theme.Material.Dialog.MinWidth"> + <item name="overlay_background_color">@color/overlay_background_dark</item> + <item name="controls_normal">@color/material_grey_600</item> + <item name="controls_active">#ffd8d8d8</item> + </style> + + <style name="Amoled_dark.BottomSheetDialog" parent="Theme.Design.Light.BottomSheetDialog"> + <item name="android:colorBackground">@color/overlay_background_dark</item> + </style> + +</resources> diff --git a/app/src/main/res/values-v21/theme-blue_dark.xml b/app/src/main/res/values-v21/theme-blue_dark.xml new file mode 100644 index 0000000..0425038 --- /dev/null +++ b/app/src/main/res/values-v21/theme-blue_dark.xml @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + + *** THIS FILE WAS GENERATED BY 'generate-themes.pl' - DO NOT TOUCH *** + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +--> + +<resources> + <!-- dark theme --> + <style name="Blue_dark.VanillaBase" parent="android:Theme.Material"> + <item name="overlay_background_color">@color/overlay_background_dark</item> + <item name="overlay_foreground_color">@color/overlay_foreground_dark</item> + <item name="float_color">@color/material_grey_900</item> + <item name="tabs_background">#FF0277BD</item> + <item name="now_playing_marker">#FF03A9F4</item> + <item name="controls_normal">@color/material_grey_300</item> + <item name="controls_active">#FF03A9F4</item> + <item name="android:colorAccent">#FF03A9F4</item> + <item name="android:colorPrimary">#FF0277BD</item> + <item name="android:colorPrimaryDark">#FF01579B</item> + <item name="themed_letter_tile_colors">@array/letter_tile_colors_dark</item> + </style> + + <style name="Blue_dark.Playback" parent="Blue_dark.VanillaBase"> + <item name="android:actionBarStyle">@style/Universal.PlaybackActionBar</item> + </style> + + <style name="Blue_dark.BackActionBar" parent="Blue_dark.VanillaBase"> + <item name="android:actionBarStyle">@style/Universal.PlaybackActionBar</item> + </style> + + <style name="Blue_dark.Library" parent="Blue_dark.VanillaBase"> + <item name="android:windowActionBar">false</item> + <item name="android:windowNoTitle">true</item> + </style> + + <style name="Blue_dark.PopupDialog" parent="android:Theme.Material.Dialog.MinWidth"> + <item name="overlay_background_color">@color/overlay_background_dark</item> + <item name="controls_normal">@color/material_grey_300</item> + <item name="controls_active">#FF03A9F4</item> + </style> + + <style name="Blue_dark.BottomSheetDialog" parent="Theme.Design.Light.BottomSheetDialog"> + <item name="android:colorBackground">@color/overlay_background_dark</item> + </style> + +</resources> diff --git a/app/src/main/res/values-v21/theme-blue_light.xml b/app/src/main/res/values-v21/theme-blue_light.xml new file mode 100644 index 0000000..9322e06 --- /dev/null +++ b/app/src/main/res/values-v21/theme-blue_light.xml @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + + *** THIS FILE WAS GENERATED BY 'generate-themes.pl' - DO NOT TOUCH *** + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +--> + +<resources> + <style name="Blue_light.VanillaBase" parent="android:Theme.Material.Light.DarkActionBar"> + <item name="overlay_background_color">@color/overlay_background_light</item> + <item name="overlay_foreground_color">@color/overlay_foreground_light</item> + <item name="float_color">@color/material_grey_400</item> + <item name="tabs_background">#FF0277BD</item> + <item name="now_playing_marker">#FF03A9F4</item> + <item name="controls_normal">@color/material_grey_900</item> + <item name="controls_active">#FF03A9F4</item> + <item name="android:colorAccent">#FF03A9F4</item> + <item name="android:colorPrimary">#FF0277BD</item> + <item name="android:colorPrimaryDark">#FF01579B</item> + <item name="themed_letter_tile_colors">@array/letter_tile_colors_light</item> + </style> + + <style name="Blue_light.Playback" parent="Blue_light.VanillaBase"> + <item name="android:actionBarStyle">@style/Universal.PlaybackActionBar</item> + </style> + + <style name="Blue_light.BackActionBar" parent="Blue_light.VanillaBase"> + <item name="android:actionBarStyle">@style/Universal.PlaybackActionBar</item> + </style> + + <style name="Blue_light.Library" parent="Blue_light.VanillaBase"> + <item name="android:windowActionBar">false</item> + <item name="android:windowNoTitle">true</item> + </style> + + <style name="Blue_light.PopupDialog" parent="android:Theme.Material.Light.Dialog.MinWidth"> + <item name="overlay_background_color">@color/overlay_background_light</item> + <item name="controls_normal">@color/material_grey_900</item> + <item name="controls_active">#FF03A9F4</item> + </style> + + <style name="Blue_light.BottomSheetDialog" parent="Theme.Design.Light.BottomSheetDialog"> + <item name="android:colorBackground">@color/overlay_background_light</item> + </style> + + +</resources> diff --git a/app/src/main/res/values-v21/theme-grey_dark.xml b/app/src/main/res/values-v21/theme-grey_dark.xml new file mode 100644 index 0000000..d5096cf --- /dev/null +++ b/app/src/main/res/values-v21/theme-grey_dark.xml @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + + *** THIS FILE WAS GENERATED BY 'generate-themes.pl' - DO NOT TOUCH *** + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +--> + +<resources> + <!-- dark theme --> + <style name="Grey_dark.VanillaBase" parent="android:Theme.Material"> + <item name="overlay_background_color">@color/overlay_background_dark</item> + <item name="overlay_foreground_color">@color/overlay_foreground_dark</item> + <item name="float_color">@color/material_grey_900</item> + <item name="tabs_background">#ff212121</item> + <item name="now_playing_marker">#ffd8d8d8</item> + <item name="controls_normal">@color/material_grey_600</item> + <item name="controls_active">#ffd8d8d8</item> + <item name="android:colorAccent">#ffd8d8d8</item> + <item name="android:colorPrimary">#ff212121</item> + <item name="android:colorPrimaryDark">#ff090909</item> + <item name="themed_letter_tile_colors">@array/letter_tile_colors_dark</item> + </style> + + <style name="Grey_dark.Playback" parent="Grey_dark.VanillaBase"> + <item name="android:actionBarStyle">@style/Universal.PlaybackActionBar</item> + </style> + + <style name="Grey_dark.BackActionBar" parent="Grey_dark.VanillaBase"> + <item name="android:actionBarStyle">@style/Universal.PlaybackActionBar</item> + </style> + + <style name="Grey_dark.Library" parent="Grey_dark.VanillaBase"> + <item name="android:windowActionBar">false</item> + <item name="android:windowNoTitle">true</item> + </style> + + <style name="Grey_dark.PopupDialog" parent="android:Theme.Material.Dialog.MinWidth"> + <item name="overlay_background_color">@color/overlay_background_dark</item> + <item name="controls_normal">@color/material_grey_600</item> + <item name="controls_active">#ffd8d8d8</item> + </style> + + <style name="Grey_dark.BottomSheetDialog" parent="Theme.Design.Light.BottomSheetDialog"> + <item name="android:colorBackground">@color/overlay_background_dark</item> + </style> + +</resources> diff --git a/app/src/main/res/values-v21/theme-grey_light.xml b/app/src/main/res/values-v21/theme-grey_light.xml new file mode 100644 index 0000000..99cf345 --- /dev/null +++ b/app/src/main/res/values-v21/theme-grey_light.xml @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + + *** THIS FILE WAS GENERATED BY 'generate-themes.pl' - DO NOT TOUCH *** + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +--> + +<resources> + <style name="Grey_light.VanillaBase" parent="android:Theme.Material.Light.DarkActionBar"> + <item name="overlay_background_color">@color/overlay_background_light</item> + <item name="overlay_foreground_color">@color/overlay_foreground_light</item> + <item name="float_color">@color/material_grey_400</item> + <item name="tabs_background">#ff212121</item> + <item name="now_playing_marker">#ff000000</item> + <item name="controls_normal">@color/material_grey_600</item> + <item name="controls_active">#ff000000</item> + <item name="android:colorAccent">#ff000000</item> + <item name="android:colorPrimary">#ff212121</item> + <item name="android:colorPrimaryDark">#ff090909</item> + <item name="themed_letter_tile_colors">@array/letter_tile_colors_light</item> + </style> + + <style name="Grey_light.Playback" parent="Grey_light.VanillaBase"> + <item name="android:actionBarStyle">@style/Universal.PlaybackActionBar</item> + </style> + + <style name="Grey_light.BackActionBar" parent="Grey_light.VanillaBase"> + <item name="android:actionBarStyle">@style/Universal.PlaybackActionBar</item> + </style> + + <style name="Grey_light.Library" parent="Grey_light.VanillaBase"> + <item name="android:windowActionBar">false</item> + <item name="android:windowNoTitle">true</item> + </style> + + <style name="Grey_light.PopupDialog" parent="android:Theme.Material.Light.Dialog.MinWidth"> + <item name="overlay_background_color">@color/overlay_background_light</item> + <item name="controls_normal">@color/material_grey_600</item> + <item name="controls_active">#ff000000</item> + </style> + + <style name="Grey_light.BottomSheetDialog" parent="Theme.Design.Light.BottomSheetDialog"> + <item name="android:colorBackground">@color/overlay_background_light</item> + </style> + + +</resources> diff --git a/app/src/main/res/values-v21/theme-orange_dark.xml b/app/src/main/res/values-v21/theme-orange_dark.xml new file mode 100644 index 0000000..d57fcba --- /dev/null +++ b/app/src/main/res/values-v21/theme-orange_dark.xml @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + + *** THIS FILE WAS GENERATED BY 'generate-themes.pl' - DO NOT TOUCH *** + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +--> + +<resources> + <!-- dark theme --> + <style name="Orange_dark.VanillaBase" parent="android:Theme.Material"> + <item name="overlay_background_color">@color/overlay_background_dark</item> + <item name="overlay_foreground_color">@color/overlay_foreground_dark</item> + <item name="float_color">@color/material_grey_900</item> + <item name="tabs_background">#FFE65100</item> + <item name="now_playing_marker">#FFF57F17</item> + <item name="controls_normal">@color/material_grey_300</item> + <item name="controls_active">#FFF57F17</item> + <item name="android:colorAccent">#FFF57F17</item> + <item name="android:colorPrimary">#FFE65100</item> + <item name="android:colorPrimaryDark">#FFBF360C</item> + <item name="themed_letter_tile_colors">@array/letter_tile_colors_dark</item> + </style> + + <style name="Orange_dark.Playback" parent="Orange_dark.VanillaBase"> + <item name="android:actionBarStyle">@style/Universal.PlaybackActionBar</item> + </style> + + <style name="Orange_dark.BackActionBar" parent="Orange_dark.VanillaBase"> + <item name="android:actionBarStyle">@style/Universal.PlaybackActionBar</item> + </style> + + <style name="Orange_dark.Library" parent="Orange_dark.VanillaBase"> + <item name="android:windowActionBar">false</item> + <item name="android:windowNoTitle">true</item> + </style> + + <style name="Orange_dark.PopupDialog" parent="android:Theme.Material.Dialog.MinWidth"> + <item name="overlay_background_color">@color/overlay_background_dark</item> + <item name="controls_normal">@color/material_grey_300</item> + <item name="controls_active">#FFF57F17</item> + </style> + + <style name="Orange_dark.BottomSheetDialog" parent="Theme.Design.Light.BottomSheetDialog"> + <item name="android:colorBackground">@color/overlay_background_dark</item> + </style> + +</resources> diff --git a/app/src/main/res/values-v21/theme-orange_light.xml b/app/src/main/res/values-v21/theme-orange_light.xml new file mode 100644 index 0000000..e08295c --- /dev/null +++ b/app/src/main/res/values-v21/theme-orange_light.xml @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + + *** THIS FILE WAS GENERATED BY 'generate-themes.pl' - DO NOT TOUCH *** + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +--> + +<resources> + <style name="Orange_light.VanillaBase" parent="android:Theme.Material.Light.DarkActionBar"> + <item name="overlay_background_color">@color/overlay_background_light</item> + <item name="overlay_foreground_color">@color/overlay_foreground_light</item> + <item name="float_color">@color/material_grey_400</item> + <item name="tabs_background">#FFE65100</item> + <item name="now_playing_marker">#FFF57F17</item> + <item name="controls_normal">@color/material_grey_900</item> + <item name="controls_active">#FFF57F17</item> + <item name="android:colorAccent">#FFF57F17</item> + <item name="android:colorPrimary">#FFE65100</item> + <item name="android:colorPrimaryDark">#FFBF360C</item> + <item name="themed_letter_tile_colors">@array/letter_tile_colors_light</item> + </style> + + <style name="Orange_light.Playback" parent="Orange_light.VanillaBase"> + <item name="android:actionBarStyle">@style/Universal.PlaybackActionBar</item> + </style> + + <style name="Orange_light.BackActionBar" parent="Orange_light.VanillaBase"> + <item name="android:actionBarStyle">@style/Universal.PlaybackActionBar</item> + </style> + + <style name="Orange_light.Library" parent="Orange_light.VanillaBase"> + <item name="android:windowActionBar">false</item> + <item name="android:windowNoTitle">true</item> + </style> + + <style name="Orange_light.PopupDialog" parent="android:Theme.Material.Light.Dialog.MinWidth"> + <item name="overlay_background_color">@color/overlay_background_light</item> + <item name="controls_normal">@color/material_grey_900</item> + <item name="controls_active">#FFF57F17</item> + </style> + + <style name="Orange_light.BottomSheetDialog" parent="Theme.Design.Light.BottomSheetDialog"> + <item name="android:colorBackground">@color/overlay_background_light</item> + </style> + + +</resources> diff --git a/app/src/main/res/values-v21/theme-red_dark.xml b/app/src/main/res/values-v21/theme-red_dark.xml new file mode 100644 index 0000000..190de51 --- /dev/null +++ b/app/src/main/res/values-v21/theme-red_dark.xml @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + + *** THIS FILE WAS GENERATED BY 'generate-themes.pl' - DO NOT TOUCH *** + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +--> + +<resources> + <!-- dark theme --> + <style name="Red_dark.VanillaBase" parent="android:Theme.Material"> + <item name="overlay_background_color">@color/overlay_background_dark</item> + <item name="overlay_foreground_color">@color/overlay_foreground_dark</item> + <item name="float_color">@color/material_grey_900</item> + <item name="tabs_background">#ffc62828</item> + <item name="now_playing_marker">#ffd50000</item> + <item name="controls_normal">@color/material_grey_300</item> + <item name="controls_active">#ffd50000</item> + <item name="android:colorAccent">#ffd50000</item> + <item name="android:colorPrimary">#ffc62828</item> + <item name="android:colorPrimaryDark">#ffb71c1c</item> + <item name="themed_letter_tile_colors">@array/letter_tile_colors_dark</item> + </style> + + <style name="Red_dark.Playback" parent="Red_dark.VanillaBase"> + <item name="android:actionBarStyle">@style/Universal.PlaybackActionBar</item> + </style> + + <style name="Red_dark.BackActionBar" parent="Red_dark.VanillaBase"> + <item name="android:actionBarStyle">@style/Universal.PlaybackActionBar</item> + </style> + + <style name="Red_dark.Library" parent="Red_dark.VanillaBase"> + <item name="android:windowActionBar">false</item> + <item name="android:windowNoTitle">true</item> + </style> + + <style name="Red_dark.PopupDialog" parent="android:Theme.Material.Dialog.MinWidth"> + <item name="overlay_background_color">@color/overlay_background_dark</item> + <item name="controls_normal">@color/material_grey_300</item> + <item name="controls_active">#ffd50000</item> + </style> + + <style name="Red_dark.BottomSheetDialog" parent="Theme.Design.Light.BottomSheetDialog"> + <item name="android:colorBackground">@color/overlay_background_dark</item> + </style> + +</resources> diff --git a/app/src/main/res/values-v21/theme-red_light.xml b/app/src/main/res/values-v21/theme-red_light.xml new file mode 100644 index 0000000..8ba8c05 --- /dev/null +++ b/app/src/main/res/values-v21/theme-red_light.xml @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + + *** THIS FILE WAS GENERATED BY 'generate-themes.pl' - DO NOT TOUCH *** + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +--> + +<resources> + <style name="Red_light.VanillaBase" parent="android:Theme.Material.Light.DarkActionBar"> + <item name="overlay_background_color">@color/overlay_background_light</item> + <item name="overlay_foreground_color">@color/overlay_foreground_light</item> + <item name="float_color">@color/material_grey_400</item> + <item name="tabs_background">#ffc62828</item> + <item name="now_playing_marker">#ffd50000</item> + <item name="controls_normal">@color/material_grey_900</item> + <item name="controls_active">#ffd50000</item> + <item name="android:colorAccent">#ffd50000</item> + <item name="android:colorPrimary">#ffc62828</item> + <item name="android:colorPrimaryDark">#ffb71c1c</item> + <item name="themed_letter_tile_colors">@array/letter_tile_colors_light</item> + </style> + + <style name="Red_light.Playback" parent="Red_light.VanillaBase"> + <item name="android:actionBarStyle">@style/Universal.PlaybackActionBar</item> + </style> + + <style name="Red_light.BackActionBar" parent="Red_light.VanillaBase"> + <item name="android:actionBarStyle">@style/Universal.PlaybackActionBar</item> + </style> + + <style name="Red_light.Library" parent="Red_light.VanillaBase"> + <item name="android:windowActionBar">false</item> + <item name="android:windowNoTitle">true</item> + </style> + + <style name="Red_light.PopupDialog" parent="android:Theme.Material.Light.Dialog.MinWidth"> + <item name="overlay_background_color">@color/overlay_background_light</item> + <item name="controls_normal">@color/material_grey_900</item> + <item name="controls_active">#ffd50000</item> + </style> + + <style name="Red_light.BottomSheetDialog" parent="Theme.Design.Light.BottomSheetDialog"> + <item name="android:colorBackground">@color/overlay_background_light</item> + </style> + + +</resources> diff --git a/app/src/main/res/values-v21/theme-standard_dark.xml b/app/src/main/res/values-v21/theme-standard_dark.xml new file mode 100644 index 0000000..dc3b27a --- /dev/null +++ b/app/src/main/res/values-v21/theme-standard_dark.xml @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + + *** THIS FILE WAS GENERATED BY 'generate-themes.pl' - DO NOT TOUCH *** + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +--> + +<resources> + <!-- dark theme --> + <style name="Standard_dark.VanillaBase" parent="android:Theme.Material"> + <item name="overlay_background_color">@color/overlay_background_dark</item> + <item name="overlay_foreground_color">@color/overlay_foreground_dark</item> + <item name="float_color">@color/material_grey_900</item> + <item name="tabs_background">#ff37474f</item> + <item name="now_playing_marker">#ff3e677a</item> + <item name="controls_normal">@color/material_grey_300</item> + <item name="controls_active">#ff3e677a</item> + <item name="android:colorAccent">#ff3e677a</item> + <item name="android:colorPrimary">#ff37474f</item> + <item name="android:colorPrimaryDark">#ff263238</item> + <item name="themed_letter_tile_colors">@array/letter_tile_colors_dark</item> + </style> + + <style name="Standard_dark.Playback" parent="Standard_dark.VanillaBase"> + <item name="android:actionBarStyle">@style/Universal.PlaybackActionBar</item> + </style> + + <style name="Standard_dark.BackActionBar" parent="Standard_dark.VanillaBase"> + <item name="android:actionBarStyle">@style/Universal.PlaybackActionBar</item> + </style> + + <style name="Standard_dark.Library" parent="Standard_dark.VanillaBase"> + <item name="android:windowActionBar">false</item> + <item name="android:windowNoTitle">true</item> + </style> + + <style name="Standard_dark.PopupDialog" parent="android:Theme.Material.Dialog.MinWidth"> + <item name="overlay_background_color">@color/overlay_background_dark</item> + <item name="controls_normal">@color/material_grey_300</item> + <item name="controls_active">#ff3e677a</item> + </style> + + <style name="Standard_dark.BottomSheetDialog" parent="Theme.Design.Light.BottomSheetDialog"> + <item name="android:colorBackground">@color/overlay_background_dark</item> + </style> + +</resources> diff --git a/app/src/main/res/values-v21/theme-standard_light.xml b/app/src/main/res/values-v21/theme-standard_light.xml new file mode 100644 index 0000000..066af1c --- /dev/null +++ b/app/src/main/res/values-v21/theme-standard_light.xml @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + + *** THIS FILE WAS GENERATED BY 'generate-themes.pl' - DO NOT TOUCH *** + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +--> + +<resources> + <style name="VanillaBase" parent="android:Theme.Material.Light.DarkActionBar"> + <item name="overlay_background_color">@color/overlay_background_light</item> + <item name="overlay_foreground_color">@color/overlay_foreground_light</item> + <item name="float_color">@color/material_grey_400</item> + <item name="tabs_background">#ff37474f</item> + <item name="now_playing_marker">#ff3e677a</item> + <item name="controls_normal">@color/material_grey_900</item> + <item name="controls_active">#ff3e677a</item> + <item name="android:colorAccent">#ff3e677a</item> + <item name="android:colorPrimary">#ff37474f</item> + <item name="android:colorPrimaryDark">#ff263238</item> + <item name="themed_letter_tile_colors">@array/letter_tile_colors_light</item> + </style> + + <style name="Playback" parent="VanillaBase"> + <item name="android:actionBarStyle">@style/Universal.PlaybackActionBar</item> + </style> + + <style name="BackActionBar" parent="VanillaBase"> + <item name="android:actionBarStyle">@style/Universal.PlaybackActionBar</item> + </style> + + <style name="Library" parent="VanillaBase"> + <item name="android:windowActionBar">false</item> + <item name="android:windowNoTitle">true</item> + </style> + + <style name="PopupDialog" parent="android:Theme.Material.Light.Dialog.MinWidth"> + <item name="overlay_background_color">@color/overlay_background_light</item> + <item name="controls_normal">@color/material_grey_900</item> + <item name="controls_active">#ff3e677a</item> + </style> + + <style name="BottomSheetDialog" parent="Theme.Design.Light.BottomSheetDialog"> + <item name="android:colorBackground">@color/overlay_background_light</item> + </style> + + +</resources> diff --git a/app/src/main/res/values-v21/theme-start_wearing_purple.xml b/app/src/main/res/values-v21/theme-start_wearing_purple.xml new file mode 100644 index 0000000..fce9020 --- /dev/null +++ b/app/src/main/res/values-v21/theme-start_wearing_purple.xml @@ -0,0 +1,62 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + + *** THIS FILE WAS GENERATED BY 'generate-themes.pl' - DO NOT TOUCH *** + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +--> + +<resources> + <!-- dark theme --> + <style name="Start_wearing_purple.VanillaBase" parent="android:Theme.Material"> + + <item name="android:colorBackground">@color/start_wearing_purple_background</item> + <item name="overlay_background_color">@color/start_wearing_purple_background</item> + + <item name="overlay_foreground_color">@color/overlay_foreground_dark</item> + <item name="float_color">#FF420264</item> + <item name="tabs_background">#FF5C038C</item> + <item name="now_playing_marker">#FF896FBC</item> + <item name="controls_normal">@color/material_grey_600</item> + <item name="controls_active">#FF896FBC</item> + <item name="android:colorAccent">#FF896FBC</item> + <item name="android:colorPrimary">#FF5C038C</item> + <item name="android:colorPrimaryDark">#FF420264</item> + <item name="themed_letter_tile_colors">@array/letter_tile_colors_dark</item> + </style> + + <style name="Start_wearing_purple.Playback" parent="Start_wearing_purple.VanillaBase"> + <item name="android:actionBarStyle">@style/Universal.PlaybackActionBar</item> + </style> + + <style name="Start_wearing_purple.BackActionBar" parent="Start_wearing_purple.VanillaBase"> + <item name="android:actionBarStyle">@style/Universal.PlaybackActionBar</item> + </style> + + <style name="Start_wearing_purple.Library" parent="Start_wearing_purple.VanillaBase"> + <item name="android:windowActionBar">false</item> + <item name="android:windowNoTitle">true</item> + </style> + + <style name="Start_wearing_purple.PopupDialog" parent="android:Theme.Material.Dialog.MinWidth"> + <item name="overlay_background_color">@color/overlay_background_dark</item> + <item name="controls_normal">@color/material_grey_600</item> + <item name="controls_active">#FF5C038C</item> + </style> + + <style name="Start_wearing_purple.BottomSheetDialog" parent="Theme.Design.Light.BottomSheetDialog"> + <item name="android:colorBackground">@color/overlay_background_dark</item> + </style> + +</resources> diff --git a/app/src/main/res/values-v21/theme.xml b/app/src/main/res/values-v21/theme.xml new file mode 100644 index 0000000..191145d --- /dev/null +++ b/app/src/main/res/values-v21/theme.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +Copyright (C) 2015 Adrian Ulrich <adrian@blinkenlights.ch> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +--> + +<resources> + <!-- universal styles --> + <style name="Universal.PlaybackActionBar" parent="android:Widget.Material.ActionBar"> + <item name="android:displayOptions">showTitle|homeAsUp</item> + <item name="android:background">?tabs_background</item> + </style> + +</resources> diff --git a/app/src/main/res/values-v21/themes-list.xml b/app/src/main/res/values-v21/themes-list.xml new file mode 100644 index 0000000..e6ae795 --- /dev/null +++ b/app/src/main/res/values-v21/themes-list.xml @@ -0,0 +1,154 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- THIS FILE IS AUTOGENERATED BY generate-themes.pl - DO NOT TOUCH! --> +<resources> + <integer-array name="theme_category_backactionbar"> + <item>@style/BackActionBar</item> + <item>@style/Standard_dark.BackActionBar</item> + <item>@style/Grey_light.BackActionBar</item> + <item>@style/Grey_dark.BackActionBar</item> + <item>@style/Orange_light.BackActionBar</item> + <item>@style/Orange_dark.BackActionBar</item> + <item>@style/Blue_light.BackActionBar</item> + <item>@style/Blue_dark.BackActionBar</item> + <item>@style/Red_light.BackActionBar</item> + <item>@style/Red_dark.BackActionBar</item> + <item>@style/Amoled_dark.BackActionBar</item> + <item>@style/Start_wearing_purple.BackActionBar</item> + </integer-array> + + <integer-array name="theme_category_bottomsheetdialog"> + <item>@style/BottomSheetDialog</item> + <item>@style/Standard_dark.BottomSheetDialog</item> + <item>@style/Grey_light.BottomSheetDialog</item> + <item>@style/Grey_dark.BottomSheetDialog</item> + <item>@style/Orange_light.BottomSheetDialog</item> + <item>@style/Orange_dark.BottomSheetDialog</item> + <item>@style/Blue_light.BottomSheetDialog</item> + <item>@style/Blue_dark.BottomSheetDialog</item> + <item>@style/Red_light.BottomSheetDialog</item> + <item>@style/Red_dark.BottomSheetDialog</item> + <item>@style/Amoled_dark.BottomSheetDialog</item> + <item>@style/Start_wearing_purple.BottomSheetDialog</item> + </integer-array> + + <integer-array name="theme_category_library"> + <item>@style/Library</item> + <item>@style/Standard_dark.Library</item> + <item>@style/Grey_light.Library</item> + <item>@style/Grey_dark.Library</item> + <item>@style/Orange_light.Library</item> + <item>@style/Orange_dark.Library</item> + <item>@style/Blue_light.Library</item> + <item>@style/Blue_dark.Library</item> + <item>@style/Red_light.Library</item> + <item>@style/Red_dark.Library</item> + <item>@style/Amoled_dark.Library</item> + <item>@style/Start_wearing_purple.Library</item> + </integer-array> + + <integer-array name="theme_category_playback"> + <item>@style/Playback</item> + <item>@style/Standard_dark.Playback</item> + <item>@style/Grey_light.Playback</item> + <item>@style/Grey_dark.Playback</item> + <item>@style/Orange_light.Playback</item> + <item>@style/Orange_dark.Playback</item> + <item>@style/Blue_light.Playback</item> + <item>@style/Blue_dark.Playback</item> + <item>@style/Red_light.Playback</item> + <item>@style/Red_dark.Playback</item> + <item>@style/Amoled_dark.Playback</item> + <item>@style/Start_wearing_purple.Playback</item> + </integer-array> + + <integer-array name="theme_category_popupdialog"> + <item>@style/PopupDialog</item> + <item>@style/Standard_dark.PopupDialog</item> + <item>@style/Grey_light.PopupDialog</item> + <item>@style/Grey_dark.PopupDialog</item> + <item>@style/Orange_light.PopupDialog</item> + <item>@style/Orange_dark.PopupDialog</item> + <item>@style/Blue_light.PopupDialog</item> + <item>@style/Blue_dark.PopupDialog</item> + <item>@style/Red_light.PopupDialog</item> + <item>@style/Red_dark.PopupDialog</item> + <item>@style/Amoled_dark.PopupDialog</item> + <item>@style/Start_wearing_purple.PopupDialog</item> + </integer-array> + + <integer-array name="theme_category_vanillabase"> + <item>@style/VanillaBase</item> + <item>@style/Standard_dark.VanillaBase</item> + <item>@style/Grey_light.VanillaBase</item> + <item>@style/Grey_dark.VanillaBase</item> + <item>@style/Orange_light.VanillaBase</item> + <item>@style/Orange_dark.VanillaBase</item> + <item>@style/Blue_light.VanillaBase</item> + <item>@style/Blue_dark.VanillaBase</item> + <item>@style/Red_light.VanillaBase</item> + <item>@style/Red_dark.VanillaBase</item> + <item>@style/Amoled_dark.VanillaBase</item> + <item>@style/Start_wearing_purple.VanillaBase</item> + </integer-array> + + <string-array name="theme_entries"> + <item>@string/theme_name_standard_light</item> + <item>@string/theme_name_standard_dark</item> + <item>@string/theme_name_grey_light</item> + <item>@string/theme_name_grey_dark</item> + <item>@string/theme_name_orange_light</item> + <item>@string/theme_name_orange_dark</item> + <item>@string/theme_name_blue_light</item> + <item>@string/theme_name_blue_dark</item> + <item>@string/theme_name_red_light</item> + <item>@string/theme_name_red_dark</item> + <item>@string/theme_name_amoled_dark</item> + <item>@string/theme_name_start_wearing_purple</item> + </string-array> + + <string-array name="theme_ids"> + <item>0</item> + <item>1</item> + <item>2</item> + <item>3</item> + <item>4</item> + <item>5</item> + <item>6</item> + <item>7</item> + <item>8</item> + <item>9</item> + <item>10</item> + <item>11</item> + </string-array> + + <string-array name="theme_values"> + <item>#ff263238,#fff0f0f0,#ff37474f</item> + <item>#ff263238,#ff2a2a2a,#ff37474f</item> + <item>#ff090909,#fff0f0f0,#ff212121</item> + <item>#ff090909,#ff2a2a2a,#ff212121</item> + <item>#FFBF360C,#fff0f0f0,#FFE65100</item> + <item>#FFBF360C,#ff2a2a2a,#FFE65100</item> + <item>#FF01579B,#fff0f0f0,#FF0277BD</item> + <item>#FF01579B,#ff2a2a2a,#FF0277BD</item> + <item>#ffb71c1c,#fff0f0f0,#ffc62828</item> + <item>#ffb71c1c,#ff2a2a2a,#ffc62828</item> + <item>#ff000000,#ff000000,#ff000000</item> + <item>#FF420264,#ff1B1734,#FF5C038C</item> + </string-array> + + <string-array name="theme_variant"> + <item>light</item> + <item>dark</item> + <item>light</item> + <item>dark</item> + <item>light</item> + <item>dark</item> + <item>light</item> + <item>dark</item> + <item>light</item> + <item>dark</item> + <item>dark</item> + <item>dark</item> + </string-array> + +</resources> diff --git a/app/src/main/res/values-v23/colors.xml b/app/src/main/res/values-v23/colors.xml new file mode 100644 index 0000000..bb5a23c --- /dev/null +++ b/app/src/main/res/values-v23/colors.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <color name="overlay_background_light">#fffafafa</color> +</resources> diff --git a/app/src/main/res/values-vi/translatable.xml b/app/src/main/res/values-vi/translatable.xml new file mode 100644 index 0000000..b39a256 --- /dev/null +++ b/app/src/main/res/values-vi/translatable.xml @@ -0,0 +1,298 @@ +<?xml version='1.0' encoding='UTF-8'?> +<resources> + <string name="app_name">Vanilla Music</string> + <!--Playback Activity (main screen)--> + <string name="no_songs">Không tìm thấy bài hát nào trên máy.</string> + <string name="empty_queue">Chưa chọn bài hát nào. Hãy chọn bài hát từ thư viện nhạc hoặc chạm vào dòng chữ này để phát ngẫu nhiên các bài hát.</string> + <string name="settings">Cài đặt</string> + <string name="no_shuffle">Không trộn bài</string> + <string name="shuffle_songs">Trộn bài</string> + <string name="shuffle_songs_continuously">Trộn bài liên tục</string> + <string name="shuffle_albums">Trộn album</string> + <string name="no_repeat">Không lặp lại</string> + <string name="repeat">Lặp lại</string> + <string name="repeat_current_song">Lặp bài đang phát</string> + <string name="stop_current_song">Dừng sau khi hết bài hát đang phát</string> + <string name="random">Phát ngẫu nhiên</string> + <string name="random_enabling">Bật ngẫu nhiên</string> + <string name="song_load_failed">Không tải được bài hát %s. Có thể tập tin đã mất hoặc bị hỏng.</string> + <string name="queue_cleared">Đã xoá danh sách phát</string> + <string name="cover_art">Ảnh album</string> + <string name="close_notification">Đóng thông báo</string> + <string name="_genre">Thể loại</string> + <string name="_track">Bài số</string> + <string name="_composer">Nhạc sĩ</string> + <string name="_path">đường dẫn</string> + <string name="_format">Định dạng</string> + <string name="_title">Tiêu đề</string> + <string name="_artist">Ca sĩ</string> + <string name="_album">Album</string> + <string name="_year">Năm</string> + <string name="_replaygain">ReplayGain</string> + <!--New Playlist Dialog--> + <string name="choose_playlist_name">Chọn tên danh sách</string> + <string name="create">Tạo</string> + <string name="overwrite">Ghi đè</string> + <string name="delete_playlist">Xoá danh sách %s?</string> + <!--Library--> + <string name="enqueue">Thêm vào danh sách</string> + <string name="enqueue_as_next">Phát sau bài đang nghe</string> + <string name="play">Phát</string> + <string name="edit">Sửa</string> + <string name="rename">Đổi tên</string> + <string name="save_as_playlist">Lưu thành danh sách…</string> + <string name="add_to_playlist">Thêm vào danh sách…</string> + <string name="add_to_favorites">Thêm vào Yêu thích</string> + <string name="remove_from_favorites">Xoá khỏi Yêu thích</string> + <string name="playlist_favorites">Yêu thích</string> + <string name="new_playlist">Danh sách mới…</string> + <string name="expand">Mở rộng</string> + <string name="delete">Xoá</string> + <string name="playback_view">Đang phát</string> + <string name="sort_by">Sắp xếp theo</string> + <string name="search">Tìm kiếm</string> + <string name="done">Xong</string> + <string name="remove">Xoá</string> + <string name="play_or_enqueue">Thêm vào danh sách nếu đang phát nhạc; Phát nếu đang dừng</string> + <string name="open">Mở</string> + <string name="go_home">Thư mục gốc</string> + <string name="jumping_to_song">Bài hát đã có trong danh sách phát, đang chuyển đến bài hát…</string> + <!--As a developer, you should always supply "one" and "other" + strings. Your translators will know which strings are actually + needed for their language. Always include %d in "one" because + translators will need to use %d for languages where "one" + doesn't mean 1 (as explained above). + + Translators should use http://unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules and + http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html, Type cardinal, + to see which categories apply to integer numbers in their languages--> + <plurals name="playing"> + <item quantity="other">Đang phát %d bài hát.</item> + </plurals> + <plurals name="enqueued"> + <item quantity="other">Đã thêm %d bài hát vào danh sách phát.</item> + </plurals> + <plurals name="added_to_playlist"> + <item quantity="other">Đã thêm %1$d bài hát vào danh sách %2$s.</item> + </plurals> + <plurals name="removed_from_playlist"> + <item quantity="other">Đã xoá %1$d bài hát khỏi danh sách %2$s.</item> + </plurals> + <plurals name="deleted"> + <item quantity="other">Đã xoá %d bài hát.</item> + </plurals> + <string name="delete_file_failed">Không xoá được %s.</string> + <string name="deleted_item">Đã xoá \"%s\".</string> + <string name="delete_item">Xoá \"%s\"?</string> + <string name="delete_file">Xoá tập tin \"%s\"?</string> + <string name="artists">Ca sĩ</string> + <string name="albums">Album</string> + <string name="albumartists">Ca sĩ của album</string> + <string name="composers">Nhạc sĩ</string> + <string name="songs">Bài hát</string> + <string name="playlists">Danh sách</string> + <string name="genres">Thể loại</string> + <string name="files">Tập tin</string> + <string name="artist">Ca sĩ</string> + <string name="album">Album</string> + <string name="genre">Thể loại</string> + <string name="folder">Thư mục</string> + <string name="filename">Tên tập tin</string> + <string name="file_size">Kích thước tập tin</string> + <string name="file_time">Thời gian sửa đổi</string> + <string name="extension">Đuôi mở rộng</string> + <string name="unknown">Không rõ</string> + <string name="play_all">Phát tất cả</string> + <string name="enqueue_all">Thêm tất cả vào danh sách phát</string> + <string name="all_songs">Tất cả bài hát</string> + <string name="more_from_artist">Các bài hát khác của ca sĩ</string> + <string name="more_from_album">Các bài hát khác trong album</string> + <string name="title">Tiêu đề</string> + <string name="number_of_tracks">Số bài hát</string> + <string name="year">Năm</string> + <string name="date_added">Được thêm vào ngày</string> + <string name="artist_album">Ca sĩ, album</string> + <string name="artist_year_album">Ca sĩ, năm, album</string> + <string name="artist_album_track">Ca sĩ, album, số thứ tự bài hát</string> + <string name="artist_album_title">Ca sĩ, album, tiêu đề</string> + <string name="artist_year">Ca sĩ, năm</string> + <string name="album_track">Album, số thứ tự bài hát</string> + <string name="song_playcount">Lượt nghe</string> + <!--Preferences--> + <plurals name="seconds"> + <item quantity="other">%d giây</item> + </plurals> + <plurals name="minutes"> + <item quantity="other">%d phút</item> + </plurals> + <plurals name="hours"> + <item quantity="other">%d giờ</item> + </plurals> + <string name="audio">Âm thanh</string> + <string name="volume_during_ducking_title">Âm lượng khi có thông báo</string> + <string name="volume_during_ducking_summary">Âm lượng phát nhạc: </string> + <string name="ignore_audiofocus_loss_summary">Vẫn phát nhạc khi bị mất quyền kiểm soát âm thanh vĩnh viễn</string> + <string name="media_button_title">Điều khiển bằng tai nghe / Bluetooth</string> + <string name="media_button_summary">Cần phải bật để kích hoạt điều khiển màn hình khoá trên Android ICS</string> + <string name="headset_only_title">Chỉ phát qua ngõ ra</string> + <string name="headset_only_summary">Không cho phát nhạc bằng loa của máy.</string> + <string name="headset_pause_title">Tạm dừng khi rút tai nghe</string> + <string name="headset_pause_summary">Tạm dừng nhạc khi rút tai nghe.</string> + <string name="headset_launch_title">Phát khi cắm tai nghe</string> + <string name="headset_launch_summary">Phát nhạc khi cắm tai nghe. (Cần cài đặt ứng dụng \"Nhận diện tai nghe\".)</string> + <string name="headset_launch_app_missing">Muốn sử dụng tính năng này, bạn phải cài ứng dụng \"Nhận diện tai nghe\".\nBạn có muốn vào Cửa hàng Play để cài ứng dụng không?</string> + <string name="replaygain">ReplayGain</string> + <string name="replaygain_summary">Cài đặt xử lí thông tin ReplayGain</string> + <string name="replaygain_track_title">Bật ReplayGain cho từng bài</string> + <string name="replaygain_track_summary">Phát tất cả các bài ở cùng một mức âm lượng</string> + <string name="replaygain_album_title">Bật ReplayGain cho cả album</string> + <string name="replaygain_album_summary">Bảo toàn mối quan hệ về âm lượng giữa các bài trong album</string> + <string name="replaygain_bump_title">Tiền khuếch đại ReplayGain</string> + <string name="replaygain_untagged_debump_title">Với các bài không có thông tin ReplayGain</string> + <string name="replaygain_untagged_debump_summary">Giảm âm lượng đi</string> + <string name="replaygain_preamp_note_title">Chú ý</string> + <string name="replaygain_preamp_note_content">Android không cho phép Vanilla Music tăng âm lượng lên quá 100%. Đặt mức tiền khuếch đại quá cao có thể gây ra vấn đề với các bài hát vốn có âm lượng nhỏ. \n\nNên dùng các giá trị:\n-> -3dB đối với nhạc nhỏ / nhạc cổ điển\n-> +3dB đối với nhạc sau năm 2000</string> + <string name="readahead">Bật đọc trước</string> + <string name="readahead_summary">Đọc trước nội dung bài đang phát. Lựa chọn này có thể giải quyết vấn đề nhạc bị dừng (do thẻ nhớ quá chậm).</string> + <string name="equalizer">Bộ chỉnh âm</string> + <string name="cycle_continuous_shuffling">Trộn bài liên tiếp</string> + <string name="cycle_continuous_shuffling_summary">Chế độ trộn bài sẽ phát nhạc hoàn toàn ngẫu nhiên</string> + <string name="notifications">Thông báo</string> + <string name="notification_visibility_title">Cách hiển thị thông báo</string> + <string name="notification_action_title">Hành động thông báo</string> + <string name="playback_screen">Màn hình phát nhạc</string> + <string name="playback_on_startup_title">Mở khi khởi động</string> + <string name="playback_on_startup_summary">Vào giao diện nghe nhạc khi mở ứng dụng</string> + <string name="display_mode_title">Chế độ hiển thị</string> + <string name="swipe_up_action_title">Khi vuốt lên</string> + <string name="swipe_down_action_title">Khi vuốt xuống</string> + <string name="cover_press_action_title">Khi chạm vào ảnh album</string> + <string name="cover_longpress_action_title">Khi nhấn giữ ảnh album</string> + <string name="library_screen">Màn hình thư viện nhạc</string> + <string name="default_action_title">Hành động mặc định</string> + <string name="default_playlist_action_title">Hành động mặc định khi chạm vào danh sách</string> + <string name="accelerometer_shake">Cảm biến lắc</string> + <string name="enable_shake_title">Bật cảm biến lắc</string> + <string name="enable_shake_summary">Chỉ hoạt động khi đang phát nhạc. Có thể không dùng được khi màn hình tắt đối với một số máy.</string> + <string name="shake_action_title">Khi lắc máy</string> + <string name="shake_threshold_title">Cường độ lắc</string> + <string name="misc_features">Tính năng khác</string> + <string name="theme">Giao diện</string> + <string name="disable_lockscreen_title">Tắt màn hình khoá</string> + <string name="disable_lockscreen_summary">Không cho màn hình khoá hoạt động khi đang trong giao diện thư viện hoặc phát nhạc</string> + <string name="keep_screen_on_title">Giữ màn hình sáng</string> + <string name="keep_screen_on_summary">Giữ màn hình luôn sáng (và máy luôn bật) khi đang trong ứng dụng Vanilla Music</string> + <string name="use_idle_timeout_title">Bật hẹn giờ</string> + <string name="use_idle_timeout_summary">Khi bật tính năng này, nhạc sẽ tự dừng sau một khoảng thời gian không có hành động nào xảy ra</string> + <string name="idle_timeout_title">Hẹn giờ</string> + <string name="enable_scroll_to_song_title">Chuyển đến tên bài</string> + <string name="enable_scroll_to_song_summary">Chuyển đến tên bài hát / album / ca sĩ đang nghe trong các danh sách của thư viện nhạc</string> + <string name="coverloader_android_title">Nạp ảnh từ Android</string> + <string name="coverloader_android_summary">Dùng ảnh trong cơ sở dữ liệu media của Android</string> + <string name="coverloader_vanilla_title">Nạp ảnh từ thư mục</string> + <string name="coverloader_vanilla_summary">Tìm các tập tin ảnh có tên cover.jpg, album.jpg hoặc artwork.jpg để hiện ảnh album</string> + <string name="coverloader_shadow_title">Nạp ảnh từ thư mục ẩn</string> + <string name="coverloader_shadow_summary">Nạp ảnh từ \'/sdcard/Music/.vanilla/ARTIST/ALBUM.jpg\'</string> + <string name="cover_on_lockscreen_title">Hiện ảnh album ở màn hình khoá</string> + <string name="cover_on_lockscreen_summary">Hiện ảnh của bài hát đang phát trên màn hình khoá</string> + <string name="double_tap_title">Nhấn đúp widget</string> + <string name="double_tap_summary">Nhấn đúp tiện ích (widget) 1x1 sẽ mở trình chơi nhạc. Có độ trễ 400ms.</string> + <string name="scrobble_title">Dùng API ScrobbleDroid</string> + <string name="scrobble_summary">Gửi thông tin nhạc đến Last.fm thông qua ScrobbleDroid hoặc Simple Last.fm Scrobbler</string> + <string name="stock_broadcast_title">Giả lập thông báo mặc định</string> + <string name="stock_broadcast_summary">Giả lập tín hiệu của ứng dụng nghe nhạc gốc trên máy để làm việc với các ứng dụng khoá màn hình, điều khiển nhạc, v.v.</string> + <string name="help">Trợ giúp</string> + <string name="about">Giới thiệu</string> + <string name="tabs">Thứ tự thẻ</string> + <string name="customize_tab_order">Sửa thứ tự tab và ẩn tab</string> + <string name="restore_default">Đặt lại về mặc định</string> + <!--The following are for the list preferences--> + <string name="last_used_action">Làm lại hành động cuối cùng</string> + <string name="never_show">Không bao giờ hiện</string> + <string name="show_when_playing">Hiện khi đang phát nhạc (mặc định)</string> + <string name="always_show">Luôn hiện</string> + <string name="open_main_activity">Mở thư viện nhạc (mặc định)</string> + <string name="open_mini_popup">Mở cửa sổ con</string> + <string name="skip_to_next_song">Chuyển bài</string> + <string name="open_full_player">Mở giao diện nghe nhạc đầy đủ</string> + <string name="info_on_cover">Thông tin trên ảnh album</string> + <string name="info_below_cover">Thông tin phía dưới ảnh album</string> + <string name="fixed_info">Thông tin phía trên</string> + <string name="do_nothing">Không làm gì</string> + <string name="open_library">Mở thư viện nhạc</string> + <string name="play_pause">Phát/Dừng</string> + <string name="next_song">Bài tiếp theo</string> + <string name="previous_song">Bài trước</string> + <string name="next_album">Album tiếp theo</string> + <string name="previous_album">Album trước</string> + <string name="cycle_repeat_mode">Chuyển chế độ lặp lại</string> + <string name="cycle_shuffle_mode">Chuyển chế độ trộn bài</string> + <string name="enqueue_current_album">Thêm album vào danh sách phát</string> + <string name="enqueue_current_artist">Thêm ca sĩ vào danh sách phát</string> + <string name="enqueue_current_genre">Thêm thể loại vào danh sách phát</string> + <string name="enqueue_current">Thêm vào danh sách đang phát…</string> + <string name="more_from_current">Các bài hát khác của…</string> + <string name="empty_the_queue">Xoá danh sách phát</string> + <string name="show_queue">Hiện danh sách phát</string> + <string name="hide_queue">Ẩn danh sách phát</string> + <string name="dequeue_rest">Xoá các bài còn lại khỏi danh sách phát</string> + <string name="toggle_controls">Ẩn/Hiện nút điều khiển</string> + <string name="seek_10s_backward">Tua lại 10 giây</string> + <string name="seek_10s_forward">Tua đi 10 giây</string> + <string name="preferences_action_show_queue">Hiện danh sách phát</string> + <string name="preferences_action_clear_queue">Xoá danh sách phát</string> + <string name="preferences_action_enqueue_current_album">Thêm album vào danh sách phát</string> + <string name="preferences_action_enqueue_current_artist">Thêm ca sĩ vào danh sách phát</string> + <string name="preferences_action_enqueue_current_genre">Thêm thể loại vào danh sách phát</string> + <string name="filebrowser_start">Thư mục gốc</string> + <string name="customize_filebrowser_start">Trình duyệt tập tin bắt đầu tại đây</string> + <string name="select">Chọn</string> + <string name="save">Lưu</string> + <string name="autoplaylist_playcounts_title">Tự tạo danh sách</string> + <string name="autoplaylist_playcounts_summary">Tự động tạo</string> + <string name="autoplaylist_playcounts_fmt" formatted="false">danh sách %s \"Top %.0f\"</string> + <string name="autoplaylist_playcounts_disabled">Không tạo danh sách tự động</string> + <string name="autoplaylist_playcounts_name" formatted="false">Top %d</string> + <string name="permission_request_summary">Vanilla Music cần quyền đọc dữ liệu để hiển thị thư viện nhạc của bạn</string> + <string name="reverse_sort">Sắp xếp ngược lại</string> + <string name="share">Chia sẻ…</string> + <string name="share_failed">Không chia sẻ được tập tin</string> + <string name="sendto">Gửi đến…</string> + <string name="no_receiving_apps">Không có ứng dụng nào nhận được loại tập tin này!</string> + <string name="media_library">Thư viện nhạc</string> + <string name="media_folders_header">Thư mục được theo dõi</string> + <string name="media_scan_header">Trình quét nhạc</string> + <string name="media_scan_full">Quét toàn bộ hệ thống (chậm hơn)</string> + <string name="media_scan_drop_db">Xoá cơ sở dữ liệu nhạc</string> + <string name="media_scan_start">Bắt đầu quét</string> + <string name="media_scan_force_bastp">Luôn sử dụng trình đọc thông tin có sẵn</string> + <string name="media_scan_group_albums">Gộp album theo thư mục</string> + <string name="media_statistics">Thống kê</string> + <string name="media_stats_tracks">Số bài hát</string> + <string name="media_stats_library_playtime">Tổng thời gian nghe nhạc (giờ)</string> + <string name="media_stats_listen_playtime">Số giờ đã nghe nhạc</string> + <string name="media_stats_progress">Tiến độ quét</string> + <string name="media_library_scan_running">Đang quét thư viện nhạc…</string> + <string name="media_scan_preferences">Tuỳ chọn quét</string> + <string name="media_scan_preferences_change_title">Đã thay đổi tuỳ chọn quét</string> + <string name="media_scan_preferences_change_message">Thay đổi tuỳ chọn này sẽ quét lại toàn bộ thư viện. Bạn có muốn tiếp tục không?</string> + <!--Folder selector--> + <string name="hint_long_press_to_modify_folder">Nhấn giữ để thay đổi tuỳ chọn thư mục</string> + <string name="folder_include">Bao gồm</string> + <string name="folder_exclude">Bỏ qua</string> + <string name="folder_neutral">Trung lập</string> + <!--Plugin system--> + <string name="plugins">Môđun</string> + <!--Theme names--> + <string name="theme_name_standard_light">Chuẩn</string> + <string name="theme_name_standard_dark">Chuẩn (tối)</string> + <string name="theme_name_grey_light">Xám</string> + <string name="theme_name_grey_dark">Xám (tối)</string> + <string name="theme_name_orange_light">Da cam</string> + <string name="theme_name_orange_dark">Da cam (tối)</string> + <string name="theme_name_blue_light">Xanh da trời</string> + <string name="theme_name_blue_dark">Xanh da trời (tối)</string> + <string name="theme_name_red_light">Đỏ</string> + <string name="theme_name_red_dark">Đỏ (tối)</string> + <string name="theme_name_amoled_dark">Đen tuyền (AMOLED)</string> +</resources> diff --git a/app/src/main/res/values-zh-rCN/translatable.xml b/app/src/main/res/values-zh-rCN/translatable.xml new file mode 100644 index 0000000..d0806d6 --- /dev/null +++ b/app/src/main/res/values-zh-rCN/translatable.xml @@ -0,0 +1,338 @@ +<?xml version='1.0' encoding='UTF-8'?> +<resources> + <string name="app_name">Vanilla Music</string> + <string name="ok">是</string> + <string name="cancel">取消</string> + <!--Playback Activity (main screen)--> + <string name="no_songs">在你的设备上找不到任何曲目。</string> + <string name="empty_queue">未选择曲目。请从库中选择一些曲目或点此消息进入随机模式。</string> + <string name="settings">设置</string> + <string name="no_shuffle">不随机播放</string> + <string name="shuffle_songs">随机播放曲目</string> + <string name="shuffle_songs_continuously">连续随机播放曲目</string> + <string name="shuffle_albums">随机播放专辑</string> + <string name="no_repeat">不重复播放</string> + <string name="repeat">重复播放</string> + <string name="repeat_current_song">重复当前曲目</string> + <string name="stop_current_song">当前曲目后停止</string> + <string name="random">随机</string> + <string name="random_enabling">启用随机</string> + <string name="song_load_failed">不能加载曲目 %s。有可能损坏或丢失。</string> + <string name="queue_cleared">序列已清除</string> + <string name="cover_art">专辑封面</string> + <string name="close_notification">关闭通知</string> + <string name="_genre">类型</string> + <string name="_track">曲目</string> + <string name="_composer">作曲</string> + <string name="_path">路径</string> + <string name="_format">格式</string> + <string name="_title">标题</string> + <string name="_artist">演出者</string> + <string name="_album">专辑</string> + <string name="_year">年份</string> + <string name="_replaygain">重播增益</string> + <!--New Playlist Dialog--> + <string name="choose_playlist_name">选择播放列表名称</string> + <string name="create">创建</string> + <string name="overwrite">覆盖</string> + <string name="delete_playlist">删除播放列表 %s ?</string> + <!--Library--> + <string name="enqueue">序列</string> + <string name="enqueue_as_next">播放下一曲</string> + <string name="play">播放</string> + <string name="edit">编辑</string> + <string name="rename">重命名</string> + <string name="save_as_playlist">保存为播放列表</string> + <string name="add_to_playlist">添加到播放列表</string> + <string name="add_to_homescreen">添加至主屏幕...</string> + <string name="add_to">添加至...</string> + <string name="playlist">播放列表</string> + <string name="homescreen">主屏幕</string> + <string name="add_to_favorites">添加到最爱</string> + <string name="remove_from_favorites">从最爱移除</string> + <string name="playlist_favorites">最爱</string> + <string name="new_playlist">新建播放列表</string> + <string name="expand">展开</string> + <string name="expand_or_play_all">展开或全部播放</string> + <string name="delete">删除</string> + <string name="playback_view">正在播放</string> + <string name="sort_by">排序方式</string> + <string name="search">搜索</string> + <string name="done">完成</string> + <string name="remove">移除</string> + <string name="play_or_enqueue">如果播放序列;如果暫停播放</string> + <string name="open">打开</string> + <string name="go_home">家目录</string> + <string name="jumping_to_song">歌曲已经在队列内,正在跳转</string> + <!--As a developer, you should always supply "one" and "other" + strings. Your translators will know which strings are actually + needed for their language. Always include %d in "one" because + translators will need to use %d for languages where "one" + doesn't mean 1 (as explained above). + + Translators should use http://unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules and + http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html, Type cardinal, + to see which categories apply to integer numbers in their languages--> + <plurals name="playing"> + <item quantity="other">正在播放 %d 首歌曲</item> + </plurals> + <plurals name="enqueued"> + <item quantity="other">%d 首歌曲已加入队列</item> + </plurals> + <plurals name="added_to_playlist"> + <item quantity="other">%1$d 首曲目已添加至播放列表 %2$s</item> + </plurals> + <plurals name="removed_from_playlist"> + <item quantity="other">%1$d 曲目从 %2$s 播放列表中移除</item> + </plurals> + <plurals name="deleted"> + <item quantity="other">%d 曲目已删除</item> + </plurals> + <string name="delete_file_failed">删除 %s 失败。</string> + <string name="deleted_item">“%s”已删除。</string> + <string name="delete_item">删除“%s”?</string> + <string name="delete_file">删除文件“%s”?</string> + <string name="artists">演出者</string> + <string name="albums">专辑</string> + <string name="albumartists">专辑艺术家</string> + <string name="composers">作曲家</string> + <string name="songs">曲目</string> + <string name="playlists">播放清单</string> + <string name="genres">风格</string> + <string name="files">文件</string> + <string name="artist">演出者</string> + <string name="album">专辑</string> + <string name="genre">风格</string> + <string name="folder">文件夹</string> + <string name="filename">文件名</string> + <string name="file_size">文件大小</string> + <string name="file_time">修改日期</string> + <string name="extension">拓展名</string> + <string name="unknown">未知</string> + <string name="play_all">全部播放</string> + <string name="enqueue_all">全部加入序列</string> + <string name="all_songs">全部曲目</string> + <string name="details">详细信息</string> + <string name="more_from_artist">更多来自演出者</string> + <string name="more_from_album">更多来自专辑</string> + <string name="title">标题</string> + <string name="number_of_tracks">曲目号</string> + <string name="year">年份</string> + <string name="date_added">添加日期</string> + <string name="artist_album">演出者,专辑</string> + <string name="artist_year_album">演出者,年份,专辑</string> + <string name="artist_album_track">演出者,专辑,曲目号</string> + <string name="artist_album_title">演出者,专辑,标题</string> + <string name="artist_year">演出者,年份</string> + <string name="album_track">演出者,曲目号</string> + <string name="song_playcount">播放次数</string> + <!--Preferences--> + <plurals name="seconds"> + <item quantity="other">%d 秒</item> + </plurals> + <plurals name="minutes"> + <item quantity="other">%d 分钟</item> + </plurals> + <plurals name="hours"> + <item quantity="other">%d 小时</item> + </plurals> + <string name="audio">音频</string> + <string name="volume_during_ducking_title">通知时的音量</string> + <string name="volume_during_ducking_summary">回放音量:</string> + <string name="ignore_audiofocus_loss_summary">失去焦点时持续播放</string> + <string name="media_button_title">耳机 / 蓝牙控制</string> + <string name="media_button_summary">此特性也需要 ICS 锁屏控制器。</string> + <string name="headset_only_title">仅外部输出</string> + <string name="headset_only_summary">防止经由内部扬声器播放音乐</string> + <string name="headset_pause_title">拔出时暂停</string> + <string name="headset_pause_summary">当耳机拔出时暂停播放</string> + <string name="headset_launch_title">插入时播放</string> + <string name="headset_launch_summary">当耳机插入时播放。(仅当“耳机检测”应用运行时)</string> + <string name="headset_launch_app_missing">此特性需要“耳机检测”应用。\n你想打开 Play Store 来安装此应用吗?</string> + <string name="replaygain">回放增益</string> + <string name="replaygain_summary">配置处理回放增益的信息</string> + <string name="replaygain_track_title">启用每曲目的回放增益</string> + <string name="replaygain_track_summary">以同等响度播放所有音乐</string> + <string name="replaygain_album_title">启用专辑回放增益</string> + <string name="replaygain_album_summary">维持专辑力度变化</string> + <string name="replaygain_bump_title">专辑回放增益</string> + <string name="replaygain_untagged_debump_title">没有回放增益标签的曲目</string> + <string name="replaygain_untagged_debump_summary">降低音量依据</string> + <string name="replaygain_preamp_note_title">注意</string> + <string name="replaygain_preamp_note_content">Android 不允许 Vanilla Music 将音量调到 >100%,将前置放大器设置较高树枝可能会导致聆听比较“安静”的音乐时产生问题。\n\n建议将数值:为安静和古典音乐设置\n-> -3dB \n-> 为新世纪音乐设置+3dB </string> + <string name="disable_gapless_playback_title">禁用无缝播放</string> + <string name="disable_gapless_playback_summary">禁用“无缝播放“功能可能有助解决在固件有故障的设备上遇到的播放问题</string> + <string name="readahead">启用预先读取</string> + <string name="readahead_summary">预读当前播放的曲目。此选项可以解决“音频卡顿”现象 (因为慢速 SD 所引起)。</string> + <string name="equalizer">均衡器</string> + <string name="cycle_continuous_shuffling">继续随机播放</string> + <string name="cycle_continuous_shuffling_summary">“随机模式”会以完全随机顺序播放曲目</string> + <string name="notifications">通知</string> + <string name="notification_visibility_title">通知可见性</string> + <string name="notification_action_title">通知动作</string> + <string name="playback_screen">回放画面</string> + <string name="playback_on_startup_title">启动时打开</string> + <string name="playback_on_startup_summary">启动时打开播放界面</string> + <string name="display_mode_title">显示模式</string> + <string name="swipe_up_action_title">向上滑动</string> + <string name="swipe_down_action_title">向下滑动</string> + <string name="cover_press_action_title">轻触专辑封面动作</string> + <string name="cover_longpress_action_title">长按专辑封面动作</string> + <string name="library_screen">媒体库画面</string> + <string name="default_action_title">默认动作</string> + <string name="default_playlist_action_title">默认播放列表动作</string> + <string name="accelerometer_shake">摇动加速度计</string> + <string name="enable_shake_title">启用摇动加速度计</string> + <string name="enable_shake_summary">只在音乐播放时可用。有些设备在屏幕关闭时不可用。</string> + <string name="shake_action_title">摇动动作</string> + <string name="shake_threshold_title">摇动力度阈值</string> + <string name="misc_features">杂项特性</string> + <string name="theme">主题</string> + <string name="disable_lockscreen_title">禁用锁屏</string> + <string name="disable_lockscreen_summary">在媒体库界面或回放屏幕时禁用锁屏</string> + <string name="keep_screen_on_title">保持屏幕常亮</string> + <string name="keep_screen_on_summary">当Vanilla Music可见时保持屏幕(以及设备)唤醒</string> + <string name="use_idle_timeout_title">启用闲置超时</string> + <string name="use_idle_timeout_summary">启用时,闲置一段时间后会停止播放</string> + <string name="idle_timeout_title">闲置超时</string> + <string name="enable_scroll_to_song_title">滚动到曲目标题</string> + <string name="enable_scroll_to_song_summary">在库列表中滚动到当前播放的曲目/专辑/艺术家</string> + <string name="queue_enable_scroll_to_song_title">滚动到队列中的曲目标题</string> + <string name="queue_enable_scroll_to_song_summary">歌曲更改时滚动到当前播放曲目</string> + <string name="jump_to_enqueued_on_play_title">按“播放”时跳到入列的歌曲</string> + <string name="jump_to_enqueued_on_play_summary">如果请求的曲目已经在队列中,直接跳到请求的曲目而不是清空队列</string> + <string name="coverloader_android_title">从 Android 设备载入</string> + <string name="coverloader_android_summary">查询 Android 内部的媒体数据库来做专辑封面</string> + <string name="coverloader_vanilla_title">从文件夹中载入封面</string> + <string name="coverloader_vanilla_summary">搜索文件名是 cover.jpg、album.jpg 或 artwork.jpg 的图片文件,以其作为专辑封面</string> + <string name="coverloader_shadow_title">从隐藏文件载入封面</string> + <string name="coverloader_shadow_summary">尝试从 \'/sdcard/Music/.vanilla/ARTIST/ALBUM.jpg\' 中载入封面图</string> + <string name="coverloader_inline_title">从文件标签中加载封面</string> + <string name="coverloader_inline_summary">尝试从文件标签中载入封面</string> + <string name="cover_on_lockscreen_title">锁屏时显示专辑封面</string> + <string name="cover_on_lockscreen_summary">在锁屏界面显示当前播放曲目的专辑封面</string> + <string name="double_tap_title">双触小挂件</string> + <string name="double_tap_summary">双击 1 x 1 的小工具将会打开播放器。小工具做出响应之前会有 400 毫秒延迟。</string> + <string name="scrobble_title">使用 </string> + <string name="scrobble_summary">Last.fm 的歌曲记录通过 Scrobble Droid 或 Simple Last.fm Scrobbler</string> + <string name="stock_broadcast_title">仿真原生应用的广播</string> + <string name="stock_broadcast_summary">发送广播以模拟那些由本地原生播放器而产生的效果,例如第三方锁屏控制,小工具等等。</string> + <string name="help">帮助</string> + <string name="about">关于</string> + <string name="tabs">标签页顺序</string> + <string name="customize_tab_order">调整媒体库标签页的顺序及可见性</string> + <string name="restore_default">返回默认</string> + <!--The following are for the list preferences--> + <string name="last_used_action">上次使用的操作</string> + <string name="never_show">永不显示</string> + <string name="show_when_playing">播放时显示 (默认)</string> + <string name="always_show">永远显示</string> + <string name="open_main_activity">打开媒体库 (默认)</string> + <string name="open_mini_popup">打开迷你弹出框</string> + <string name="skip_to_next_song">跳到下一曲目</string> + <string name="open_full_player">打开完整播放器</string> + <string name="info_on_cover">信息在封面之上</string> + <string name="info_below_cover">信息在封面之下</string> + <string name="fixed_info">信息固定在顶部</string> + <string name="do_nothing">什么也不做</string> + <string name="open_library">打开媒体库</string> + <string name="play_pause">播放 / 暂停</string> + <string name="next_song">下一曲目</string> + <string name="previous_song">上一曲目</string> + <string name="next_album">下一专辑</string> + <string name="previous_album">上一专辑</string> + <string name="cycle_repeat_mode">循环重复模式</string> + <string name="cycle_shuffle_mode">循环随机模式</string> + <string name="enqueue_current_album">以专辑加入序列</string> + <string name="enqueue_current_artist">以演出者加入序列</string> + <string name="enqueue_current_genre">以风格加入序列</string> + <string name="enqueue_current">加入序列</string> + <string name="more_from_current">更多来自</string> + <string name="empty_the_queue">清空序列</string> + <string name="show_queue">显示序列</string> + <string name="hide_queue">隐藏序列</string> + <string name="dequeue_rest">剩余的移出序列</string> + <string name="toggle_controls">切换控制器</string> + <string name="seek_10s_backward">向后倒退 10 秒</string> + <string name="seek_10s_forward">向前快进 10 秒</string> + <string name="move_to_top">移动到顶部</string> + <string name="move_to_bottom">移动到底部</string> + <string name="preferences_action_show_queue">显示序列</string> + <string name="preferences_action_clear_queue">清空序列</string> + <string name="preferences_action_enqueue_current_album">以专辑加入序列</string> + <string name="preferences_action_enqueue_current_artist">以演出者加入序列</string> + <string name="preferences_action_enqueue_current_genre">以风格加入序列</string> + <string name="jump_to_time">跳转到</string> + <string name="time_separator">:</string> + <string name="hour_hint">时</string> + <string name="minute_hint">分钟</string> + <string name="second_hint">秒</string> + <string name="error_invalid_position">非法的位置</string> + <string name="filebrowser_start">起始目录</string> + <string name="customize_filebrowser_start">在此目录开始浏览文件</string> + <string name="select">选择</string> + <string name="save">保存</string> + <string name="autoplaylist_playcounts_title">自动创建播放列表</string> + <string name="autoplaylist_playcounts_summary">自动创建</string> + <string name="autoplaylist_playcounts_fmt" formatted="false">%s \'Top %.0f\' 播放列表</string> + <string name="autoplaylist_playcounts_disabled">不要创建自动播放列表</string> + <string name="autoplaylist_playcounts_name" formatted="false">Top %d</string> + <string name="playlist_sync_mode_title">播放列表同步</string> + <string name="playlist_sync_all">完整同步</string> + <string name="playlist_sync_only_import">导入 M3U,永不导出</string> + <string name="playlist_sync_only_export">写入 M3U,永不导入</string> + <string name="playlist_sync_disabled">已停用</string> + <string name="playlist_sync_folder_title">同步文件夹</string> + <string name="playlist_sync_folder_summary">同步播放列表使用的文件夹</string> + <string name="playlist_export_relative_paths_title">导出时使用相对路径</string> + <string name="playlist_export_relative_paths_summary">音乐文件相对于播放列表的路径</string> + <string name="permission_request_summary">Vanilla Music 需要读取权限来显示你的音乐媒体库</string> + <string name="reverse_sort">反序</string> + <string name="share">共享…</string> + <string name="share_failed">无法分享文件</string> + <string name="sendto">发送给…</string> + <string name="no_receiving_apps">没有为此媒体类型找到接收的 app!</string> + <string name="duration">持续时间</string> + <string name="dump_database">导出数据库</string> + <string name="dump_database_result">数据库已导出至“%s”</string> + <string name="force_m3u_import">强制重新导入M3U</string> + <string name="media_library">媒体库</string> + <string name="media_folders_header">索引文件夹</string> + <string name="media_scan_header">媒体扫描器</string> + <string name="media_scan_full">扫描整个文件系统(更慢)</string> + <string name="media_scan_drop_db">清空媒体数据库</string> + <string name="media_scan_start">开始扫描</string> + <string name="media_scan_force_bastp">始终使用内置标签阅读器</string> + <string name="media_scan_group_albums">按文件夹分组封面</string> + <string name="media_statistics">统计</string> + <string name="media_stats_tracks">曲目数</string> + <string name="media_stats_library_playtime">播放总时长(小时)</string> + <string name="media_stats_listen_playtime">到现在为止播放音乐的小时数</string> + <string name="media_stats_progress">扫描进度</string> + <string name="media_library_scan_running">正在媒体库…</string> + <string name="media_scan_preferences">扫描选项</string> + <string name="media_scan_preferences_change_title">已更改扫描选项</string> + <string name="media_scan_preferences_change_message">更改此选项将完全重新开始扫描您的媒体库。你想继续吗?</string> + <string name="folder_picker_spinner_desc">文件夹状态:</string> + <!--Folder selector--> + <string name="hint_long_press_to_modify_folder">长按以编辑文件夹选项</string> + <string name="folder_include">包括</string> + <string name="folder_exclude">排除</string> + <string name="folder_neutral">中性的</string> + <!--Plugin system--> + <string name="plugins">插件</string> + <string name="plugin_needs_upgrade">请更新 %s 插件至最新版本</string> + <!--Theme names--> + <string name="theme_name_standard_light">标准</string> + <string name="theme_name_standard_dark">标准(深色)</string> + <string name="theme_name_grey_light">灰色</string> + <string name="theme_name_grey_dark">灰色(深色)</string> + <string name="theme_name_orange_light">橙色</string> + <string name="theme_name_orange_dark">橙色(深色)</string> + <string name="theme_name_blue_light">蓝色</string> + <string name="theme_name_blue_dark">蓝色(深色)</string> + <string name="theme_name_red_light">红色</string> + <string name="theme_name_red_dark">红色(深色)</string> + <string name="theme_name_amoled_dark">纯黑色 (AMOLED)</string> + <string name="theme_name_start_wearing_purple">Start Wearing Purple</string> +</resources> diff --git a/app/src/main/res/values-zh-rTW/translatable.xml b/app/src/main/res/values-zh-rTW/translatable.xml new file mode 100644 index 0000000..41973e7 --- /dev/null +++ b/app/src/main/res/values-zh-rTW/translatable.xml @@ -0,0 +1,332 @@ +<?xml version='1.0' encoding='UTF-8'?> +<resources> + <string name="app_name">Vanilla Music</string> + <string name="ok">確定</string> + <string name="cancel">取消</string> + <!--Playback Activity (main screen)--> + <string name="no_songs">您的裝置上沒有發現任何曲目。</string> + <string name="empty_queue">沒有選定的歌曲。由媒體庫或是輕點這個訊息進入隨機模式挑選。</string> + <string name="settings">設定</string> + <string name="no_shuffle">不隨機播放</string> + <string name="shuffle_songs">隨機播放曲目</string> + <string name="shuffle_songs_continuously">持續隨機播放曲目</string> + <string name="shuffle_albums">隨機播放專輯</string> + <string name="no_repeat">不重複播放</string> + <string name="repeat">重複播放</string> + <string name="repeat_current_song">重複目前曲目</string> + <string name="stop_current_song">目前曲目後停止</string> + <string name="random">隨機</string> + <string name="random_enabling">啟用隨機</string> + <string name="song_load_failed">載入 %s 歌曲失敗。它可能已損壞或遺失。</string> + <string name="queue_cleared">佇列已清除。</string> + <string name="cover_art">封面</string> + <string name="close_notification">關閉通知</string> + <string name="_genre">流派</string> + <string name="_track">曲目</string> + <string name="_composer">作曲</string> + <string name="_path">路徑</string> + <string name="_format">格式</string> + <string name="_title">標題</string> + <string name="_artist">演出者</string> + <string name="_album">專輯</string> + <string name="_year">年份</string> + <string name="_replaygain">重播增益</string> + <!--New Playlist Dialog--> + <string name="choose_playlist_name">選擇播放清單名稱</string> + <string name="create">建立</string> + <string name="overwrite">覆寫</string> + <string name="delete_playlist">刪除播放清單 %s?</string> + <!--Library--> + <string name="enqueue">佇列</string> + <string name="enqueue_as_next">播下一首</string> + <string name="play">播放</string> + <string name="edit">編輯</string> + <string name="rename">重新命名</string> + <string name="save_as_playlist">儲存為播放清單…</string> + <string name="add_to_playlist">加到播放清單…</string> + <string name="add_to_homescreen">加入到主畫面…</string> + <string name="add_to">增加到…</string> + <string name="playlist">播放清單</string> + <string name="homescreen">主畫面</string> + <string name="add_to_favorites">加到我的最愛</string> + <string name="remove_from_favorites">從我的最愛移除</string> + <string name="playlist_favorites">我的最愛</string> + <string name="new_playlist">新的播放清單…</string> + <string name="expand">展開</string> + <string name="expand_or_play_all">展開或全部播放</string> + <string name="delete">刪除</string> + <string name="playback_view">現在播放</string> + <string name="sort_by">排序依據</string> + <string name="search">搜尋</string> + <string name="done">完成</string> + <string name="remove">移除</string> + <string name="play_or_enqueue">如果播放佇列;如果暫停播放</string> + <string name="open">開啟</string> + <string name="go_home">主目錄</string> + <string name="jumping_to_song">歌曲已經在佇列,轉移...</string> + <!--As a developer, you should always supply "one" and "other" + strings. Your translators will know which strings are actually + needed for their language. Always include %d in "one" because + translators will need to use %d for languages where "one" + doesn't mean 1 (as explained above). + + Translators should use http://unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules and + http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html, Type cardinal, + to see which categories apply to integer numbers in their languages--> + <plurals name="playing"> + <item quantity="other">播放歌曲 %d。</item> + </plurals> + <plurals name="enqueued"> + <item quantity="other">已佇列歌曲 %d</item> + </plurals> + <plurals name="added_to_playlist"> + <item quantity="other">%1$d 歌曲已加入到播放清單 %2$s。</item> + </plurals> + <plurals name="removed_from_playlist"> + <item quantity="other">%1$d 的歌曲已從播放清單 %2$s 中移除。</item> + </plurals> + <plurals name="deleted"> + <item quantity="other">已刪除歌曲 %d</item> + </plurals> + <string name="delete_file_failed">無法刪除 %s。</string> + <string name="deleted_item">已刪除 \'%s\'。</string> + <string name="delete_item">刪除 \'%s\'?</string> + <string name="delete_file">刪除檔案 \'%s\'?</string> + <string name="artists">演出者</string> + <string name="albums">專輯</string> + <string name="albumartists">專輯的演出者</string> + <string name="composers">作曲</string> + <string name="songs">曲目</string> + <string name="playlists">播放清單</string> + <string name="genres">流派</string> + <string name="files">檔案</string> + <string name="artist">演出者</string> + <string name="album">專輯</string> + <string name="genre">流派</string> + <string name="folder">Folder</string> + <string name="filename">檔案名稱</string> + <string name="file_size">檔案大小</string> + <string name="file_time">修改時間</string> + <string name="extension">擴充</string> + <string name="unknown">不明的</string> + <string name="play_all">全部播放</string> + <string name="enqueue_all">佇列全部</string> + <string name="all_songs">所有曲目</string> + <string name="details"> 詳細敘述</string> + <string name="more_from_artist">更多來的自演出者</string> + <string name="more_from_album">更多來自專輯</string> + <string name="title">標題</string> + <string name="number_of_tracks">曲目數</string> + <string name="year">年份</string> + <string name="date_added">已加入資料</string> + <string name="artist_album">演出者、專輯</string> + <string name="artist_year_album">演出者、年份、專輯</string> + <string name="artist_album_track">演出者、專輯、曲目編號</string> + <string name="artist_album_title">演出者、專輯、標題</string> + <string name="artist_year">演出者、年份</string> + <string name="album_track">專輯,曲目編號</string> + <string name="song_playcount">播放次數</string> + <!--Preferences--> + <plurals name="seconds"> + <item quantity="other">%d 秒</item> + </plurals> + <plurals name="minutes"> + <item quantity="other">%d 分</item> + </plurals> + <plurals name="hours"> + <item quantity="other">%d 小時</item> + </plurals> + <string name="audio">音訊</string> + <string name="volume_during_ducking_title">音量在通知</string> + <string name="volume_during_ducking_summary">播放音量:</string> + <string name="ignore_audiofocus_loss_summary">在永久性音訊焦點遺失時繼續播放</string> + <string name="media_button_title">耳機/藍牙控制</string> + <string name="media_button_summary">這也需要由 ICS 螢幕鎖定控制。</string> + <string name="headset_only_title">僅外部輸出</string> + <string name="headset_only_summary">防止經由內部喇叭播放音樂。</string> + <string name="headset_pause_title">耳機拔出時暫停</string> + <string name="headset_pause_summary">拔出耳機時暫停。</string> + <string name="headset_launch_title">耳機插入時播放</string> + <string name="headset_launch_summary">當耳機插入時播放。(需要安裝“耳機偵測”的應用程式。)</string> + <string name="headset_launch_app_missing">此功能需要安裝“耳機偵測”的應用程式。\n您想要開啟 Play 商店以安裝應用程式嗎?</string> + <string name="replaygain">重播增益</string> + <string name="replaygain_summary">組態重播增益資訊的處理</string> + <string name="replaygain_track_title">啟用前置音軌重播增益</string> + <string name="replaygain_track_summary">以同等響度播放所有曲目</string> + <string name="replaygain_album_title">啟用專輯重播增益</string> + <string name="replaygain_album_summary">維持專輯力度變化</string> + <string name="replaygain_bump_title">重播增益前置放大</string> + <string name="replaygain_untagged_debump_title">歌曲無重播增益標記</string> + <string name="replaygain_untagged_debump_summary">降低音量依據</string> + <string name="replaygain_preamp_note_title">注解</string> + <string name="replaygain_preamp_note_content">Android 不允許 Vanilla Music 提高> 100% 的音量。如果您正在聽 \'安靜\' 的音樂,設定前置放大器為一個較高的值,可能會導致問題。\n\n推薦值是:\n-> -3dB 給寂靜的/古典音樂\n-> +3dB 給 post-2000 的錄音</string> + <string name="readahead">啟用預先讀取</string> + <string name="readahead_summary">預讀目前播放的曲目。此選項可以解決\'音頻落後\'的問題。(因較慢的 SD 卡所造成)</string> + <string name="equalizer">等化器</string> + <string name="cycle_continuous_shuffling">連續隨機播放</string> + <string name="cycle_continuous_shuffling_summary">\'隨機模式\'將會在完整地隨機順序播放歌曲</string> + <string name="notifications">通知</string> + <string name="notification_visibility_title">通知明顯度</string> + <string name="notification_action_title">通知啟動</string> + <string name="playback_screen">回播畫面</string> + <string name="playback_on_startup_title">啟動時開啟</string> + <string name="playback_on_startup_summary">啟動時開啟回播檢視</string> + <string name="display_mode_title">顯示模式</string> + <string name="swipe_up_action_title">向上滑動作</string> + <string name="swipe_down_action_title">向下滑動作</string> + <string name="cover_press_action_title">輕點封面動作</string> + <string name="cover_longpress_action_title">長按封面動作</string> + <string name="library_screen">媒體庫畫面</string> + <string name="default_action_title">預定啟動</string> + <string name="default_playlist_action_title">預定播放清單啟動</string> + <string name="accelerometer_shake">搖動速渡感測</string> + <string name="enable_shake_title">啟用搖動速度感測</string> + <string name="enable_shake_summary">僅在播放音樂時的動作。螢幕關閉後在某些裝置上無法工作。</string> + <string name="shake_action_title">搖動啟用</string> + <string name="shake_threshold_title">搖動力度界限</string> + <string name="misc_features">其它各種功能</string> + <string name="theme">主題</string> + <string name="disable_lockscreen_title">停用螢幕鎖</string> + <string name="disable_lockscreen_summary">啟動後,在媒體庫或播放畫面,會阻止螢幕鎖</string> + <string name="keep_screen_on_title">保持螢幕開啟著</string> + <string name="keep_screen_on_summary">當 Vanilla Music 顯現時,保持螢幕(和裝置)開著</string> + <string name="use_idle_timeout_title">啟用閒置超時</string> + <string name="use_idle_timeout_summary">當啟動後,在閒置一段時間後會停止播放 </string> + <string name="idle_timeout_title">閒置超時</string> + <string name="enable_scroll_to_song_title">捲動到歌曲標題</string> + <string name="enable_scroll_to_song_summary">在媒體庫清單,捲動到目前播放的歌曲/專輯/演出者</string> + <string name="queue_enable_scroll_to_song_title">在佇列中捲動來追蹤標題</string> + <string name="queue_enable_scroll_to_song_summary">當佇列中的歌曲更改時,捲動到目前正在播放的曲目</string> + <string name="jump_to_enqueued_on_play_title">跳到在\'播放\'上已佇列的歌曲</string> + <string name="jump_to_enqueued_on_play_summary">如果要求的歌曲已經在佇列中,則跳到它替代更新佇列</string> + <string name="coverloader_android_title">從 Android 載入封面</string> + <string name="coverloader_android_summary">查詢 Androids 內部的媒體資料庫,以用於專輯封面</string> + <string name="coverloader_vanilla_title">從資料夾載入封面</string> + <string name="coverloader_vanilla_summary">尋找名為 cover.jpg、album.jpg 或 artwork.jpg 的影像檔案,並顯示作為專輯封面</string> + <string name="coverloader_shadow_title">從隱藏資料夾載入封面</string> + <string name="coverloader_shadow_summary">試著從 \'/sdcard/Music/.vanilla/ARTIST/ALBUM.jpg\' 載入封面</string> + <string name="coverloader_inline_title">從檔案標籤載入圖片</string> + <string name="coverloader_inline_summary">試著從檔案標籤載入已嵌入的圖片</string> + <string name="cover_on_lockscreen_title">在螢幕鎖定時,顯示封面</string> + <string name="cover_on_lockscreen_summary">在螢幕鎖定畫面上,顯示目前播放歌曲的封面</string> + <string name="double_tap_title">雙點擊小工具</string> + <string name="double_tap_summary">雙點擊 1 x 1 小工具將打開播放機。小工具的操作做出回應之前,會引起400ms的延遲。</string> + <string name="scrobble_title">使用 Scrobble Droid API</string> + <string name="scrobble_summary">Scrobble 透過 Scrobble Droid 到 Last.fm 或單純的 Last.fm Scrobbler</string> + <string name="stock_broadcast_title">模擬股票廣播</string> + <string name="stock_broadcast_summary">放送廣播,模擬那些放送股票音樂播放的工作與第三方螢幕鎖控制、小工具等。</string> + <string name="help">幫助</string> + <string name="about">關於</string> + <string name="tabs">分頁標簽順序</string> + <string name="customize_tab_order">調整排列和要顯現的媒體庫分頁標簽</string> + <string name="restore_default">還原預設值</string> + <!--The following are for the list preferences--> + <string name="last_used_action">最後使用的動作</string> + <string name="never_show">永不顯示</string> + <string name="show_when_playing">在播放時顯示 (預設)</string> + <string name="always_show">總是顯示</string> + <string name="open_main_activity">開啟媒體庫 (預設)</string> + <string name="open_mini_popup">開啟迷你彈出視窗</string> + <string name="skip_to_next_song">跳過下一首</string> + <string name="open_full_player">開啟完整播放</string> + <string name="info_on_cover">資訊在封面上</string> + <string name="info_below_cover">資訊在封面下方</string> + <string name="fixed_info">資訊固定在上方</string> + <string name="do_nothing">什麼也不做</string> + <string name="open_library">開啟媒體庫</string> + <string name="play_pause">播放/暫停</string> + <string name="next_song">下首歌曲</string> + <string name="previous_song">前一首歌曲</string> + <string name="next_album">下張專輯</string> + <string name="previous_album">上張專輯</string> + <string name="cycle_repeat_mode">循環重覆模式</string> + <string name="cycle_shuffle_mode">循環隨機模式</string> + <string name="enqueue_current_album">以專輯儲入佇列</string> + <string name="enqueue_current_artist">以演出者存入佇列</string> + <string name="enqueue_current_genre">以流派存入佇列</string> + <string name="enqueue_current">佇列…</string> + <string name="more_from_current">更多來自…</string> + <string name="empty_the_queue">佇列是空的</string> + <string name="show_queue">顯示佇列</string> + <string name="hide_queue">隱藏佇列</string> + <string name="dequeue_rest">剩餘的移出佇列</string> + <string name="toggle_controls">切換控制</string> + <string name="seek_10s_backward">向後探尋10秒</string> + <string name="seek_10s_forward">向前探尋10秒</string> + <string name="preferences_action_show_queue">顯示佇列</string> + <string name="preferences_action_clear_queue">清除佇列</string> + <string name="preferences_action_enqueue_current_album">以專輯儲入佇列</string> + <string name="preferences_action_enqueue_current_artist">以演出者存入佇列</string> + <string name="preferences_action_enqueue_current_genre">以流派存入佇列</string> + <string name="jump_to_time">跳到時間</string> + <string name="time_separator">:</string> + <string name="hour_hint">HH</string> + <string name="minute_hint">MM</string> + <string name="second_hint">SS</string> + <string name="error_invalid_position">無效的位置</string> + <string name="filebrowser_start">啟始目錄</string> + <string name="customize_filebrowser_start">在此目錄開始瀏覽檔案</string> + <string name="select">選擇</string> + <string name="save">儲存</string> + <string name="autoplaylist_playcounts_title">自動播放清單建立</string> + <string name="autoplaylist_playcounts_summary">自動建立一個</string> + <string name="autoplaylist_playcounts_fmt" formatted="false">%s \'Top %.0f\' 播放清單</string> + <string name="autoplaylist_playcounts_disabled">不要建立自動播放清單</string> + <string name="autoplaylist_playcounts_name" formatted="false">置頂 %d</string> + <string name="playlist_sync_mode_title">播放清單同步</string> + <string name="playlist_sync_all">完整同步</string> + <string name="playlist_sync_only_import">匯入 M3U,永不匯出</string> + <string name="playlist_sync_only_export">寫入 M3U,永不匯入</string> + <string name="playlist_sync_disabled">停用</string> + <string name="playlist_sync_folder_title">同步資料夾</string> + <string name="playlist_sync_folder_summary">同步播放清單使用的資料夾</string> + <string name="playlist_export_relative_paths_title">使用相對路徑匯出</string> + <string name="playlist_export_relative_paths_summary">相對於播放清單的參照檔案路徑</string> + <string name="permission_request_summary">Vanilla 音樂需要讀取的權限,以顯示您的媒體庫</string> + <string name="reverse_sort">反向排序</string> + <string name="share">分享…</string> + <string name="share_failed">無法分享檔案</string> + <string name="sendto">傳送到…</string> + <string name="no_receiving_apps">該媒體類型未找到相應接受的應用程式!</string> + <string name="duration">持續時間</string> + <string name="dump_database">轉儲資料庫</string> + <string name="dump_database_result">資料庫轉儲到 \'%s\'</string> + <string name="force_m3u_import">強制將 M3U 再次輸入</string> + <string name="media_library">媒體庫</string> + <string name="media_folders_header">索引目錄</string> + <string name="media_scan_header">媒體掃描</string> + <string name="media_scan_full">掃描完整的檔案系統 (較慢)</string> + <string name="media_scan_drop_db">更新媒體資料庫</string> + <string name="media_scan_start">開始掃描</string> + <string name="media_scan_force_bastp">始終使用內建的標簽閱讀器</string> + <string name="media_scan_group_albums">按檔案夾群集封面</string> + <string name="media_statistics">統計</string> + <string name="media_stats_tracks">曲目數</string> + <string name="media_stats_library_playtime">總計播放時間 (小時)</string> + <string name="media_stats_listen_playtime">樂音播放到至今的時間</string> + <string name="media_stats_progress">掃描進行中</string> + <string name="media_library_scan_running">正在掃描媒體庫…</string> + <string name="media_scan_preferences">掃描選項</string> + <string name="media_scan_preferences_change_title">掃描選項已更改</string> + <string name="media_scan_preferences_change_message">更改此選項,將開始對您的媒體庫作完整的重新掃描。您想繼續嗎?</string> + <!--Folder selector--> + <string name="hint_long_press_to_modify_folder">長按修改資料夾選項</string> + <string name="folder_include">包含</string> + <string name="folder_exclude">排除</string> + <string name="folder_neutral">中立</string> + <!--Plugin system--> + <string name="plugins">外掛</string> + <string name="plugin_needs_upgrade">請將外掛 %s 升級到最新版本</string> + <!--Theme names--> + <string name="theme_name_standard_light">標準</string> + <string name="theme_name_standard_dark">標準(深色)</string> + <string name="theme_name_grey_light">灰色</string> + <string name="theme_name_grey_dark">灰色(深色)</string> + <string name="theme_name_orange_light">橙色</string> + <string name="theme_name_orange_dark">橙色(深色)</string> + <string name="theme_name_blue_light">藍色</string> + <string name="theme_name_blue_dark">藍色(深色)</string> + <string name="theme_name_red_light">紅色</string> + <string name="theme_name_red_dark">紅色(深色)</string> + <string name="theme_name_amoled_dark">焦黑色(AMOLED)</string> +</resources> diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml new file mode 100644 index 0000000..0cdca2d --- /dev/null +++ b/app/src/main/res/values/attrs.xml @@ -0,0 +1,10 @@ +<resources> + <attr name="overlay_background_color" format="color" /> + <attr name="overlay_foreground_color" format="color" /> + <attr name="float_color" format="color" /> + <attr name="tabs_background" format="color" /> + <attr name="now_playing_marker" format="color" /> + <attr name="controls_normal" format="color" /> + <attr name="controls_active" format="color" /> + <attr name="themed_letter_tile_colors" format="reference" /> +</resources> diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..76b7d80 --- /dev/null +++ b/app/src/main/res/values/colors.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <!-- library tabs --> + <color name="tabs_active_indicator">@android:color/holo_blue_dark</color> +</resources> diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml new file mode 100644 index 0000000..1618b8e --- /dev/null +++ b/app/src/main/res/values/dimens.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> + +<resources> + <dimen name="cover_size">44sp</dimen> + <dimen name="cover_padding">14sp</dimen> + <dimen name="pmark_size">4sp</dimen> + <dimen name="cover_padding_with_pmark">10sp</dimen> + <dimen name="text_padding">14sp</dimen> + <dimen name="row_normal_height">56sp</dimen> + <dimen name="controls_padding">12dip</dimen> + <!-- height of the full playback view controls --> + <dimen name="full_playback_controls_height">120dip</dimen> + <dimen name="track_details_dialog_padding">8dp</dimen> + <dimen name="material_text_subhead">16sp</dimen> + <!-- height of 'full_playback_alt' text --> + <dimen name="full_playback_alt_text">60dip</dimen> +</resources> diff --git a/app/src/main/res/values/dslv_attrs.xml b/app/src/main/res/values/dslv_attrs.xml new file mode 100644 index 0000000..8c779c9 --- /dev/null +++ b/app/src/main/res/values/dslv_attrs.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8" ?> +<resources> + <declare-styleable name="DragSortListView"> + <attr name="collapsed_height" format="dimension" /> + <attr name="drag_scroll_start" format="float" /> + <attr name="max_drag_scroll_speed" format="float" /> + <attr name="float_background_color" format="color" /> + <attr name="remove_mode"> + <enum name="clickRemove" value="0" /> + <enum name="flingRemove" value="1" /> + </attr> + <attr name="track_drag_sort" format="boolean"/> + <attr name="float_alpha" format="float"/> + <attr name="slide_shuffle_speed" format="float"/> + <attr name="remove_animation_duration" format="integer"/> + <attr name="drop_animation_duration" format="integer"/> + <attr name="drag_enabled" format="boolean" /> + <attr name="sort_enabled" format="boolean" /> + <attr name="remove_enabled" format="boolean" /> + <attr name="drag_start_mode"> + <enum name="onDown" value="0" /> + <enum name="onMove" value="1" /> + <enum name="onLongPress" value="2"/> + </attr> + <attr name="drag_handle_id" format="integer" /> + <attr name="fling_handle_id" format="integer" /> + <attr name="click_remove_id" format="integer" /> + <attr name="use_default_controller" format="boolean" /> + </declare-styleable> +</resources> diff --git a/app/src/main/res/values/seekbarpreference_attr.xml b/app/src/main/res/values/seekbarpreference_attr.xml new file mode 100644 index 0000000..c164706 --- /dev/null +++ b/app/src/main/res/values/seekbarpreference_attr.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <declare-styleable name="SeekBarPreference"> + <attr name="sbpMaxValue" format="integer"/> + <attr name="sbpSteps" format="integer" /> + <attr name="sbpSummaryValueMultiplication" format="float"/> + <attr name="sbpSummaryValueAddition" format="float"/> + <attr name="sbpSummaryText" format="string"/> + <attr name="sbpSummaryFormat" format="string"/> + <attr name="sbpSummaryZeroText" format="string" /> + <attr name="sbpCheckBoxText" format="string" /> + <attr name="sbpCheckBoxKey" format="string" /> + </declare-styleable> +</resources> diff --git a/app/src/main/res/values/slidingview_attr.xml b/app/src/main/res/values/slidingview_attr.xml new file mode 100644 index 0000000..63858b4 --- /dev/null +++ b/app/src/main/res/values/slidingview_attr.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <declare-styleable name="SlidingViewPreferences"> + <attr name="slider_handle_id" format="integer"/> + <attr name="slider_slave_id" format="integer"/> + <attr name="slider_always_expanded" format="integer"/> + </declare-styleable> +</resources> diff --git a/app/src/main/res/values/tiles_colors.xml b/app/src/main/res/values/tiles_colors.xml new file mode 100644 index 0000000..3b966c1 --- /dev/null +++ b/app/src/main/res/values/tiles_colors.xml @@ -0,0 +1,52 @@ +<!-- This file was borrowed from AOSP's ContactsCommon/colors.xml --> +<!-- + ~ Copyright (C) 2012 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 + --> + +<resources> + <array name="letter_tile_colors_light"> + <item>#DB4437</item> + <item>#E91E63</item> + <item>#9C27B0</item> + <item>#673AB7</item> + <item>#3F51B5</item> + <item>#4285F4</item> + <item>#039BE5</item> + <item>#0097A7</item> + <item>#009688</item> + <item>#0F9D58</item> + <item>#689F38</item> + <item>#EF6C00</item> + <item>#FF5722</item> + <item>#757575</item> + </array> + + <array name="letter_tile_colors_dark"> + <item>#A81104</item> + <item>#AD1457</item> + <item>#6A1B9A</item> + <item>#4527A0</item> + <item>#283593</item> + <item>#0F52C1</item> + <item>#0277BD</item> + <item>#006064</item> + <item>#00695C</item> + <item>#006A25</item> + <item>#558B2F</item> + <item>#E65100</item> + <item>#D84315</item> + <item>#424242</item> + </array> +</resources> diff --git a/app/src/main/res/values/translatable.xml b/app/src/main/res/values/translatable.xml new file mode 100644 index 0000000..7ce10f6 --- /dev/null +++ b/app/src/main/res/values/translatable.xml @@ -0,0 +1,417 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +Copyright (C) 2010, 2011 Christopher Eby <kreed@kreed.org> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +--> +<resources> + <string name="app_name">Vanilla Music</string> + <string name="ok">OK</string> + <string name="cancel">Cancel</string> + + <!-- Playback Activity (main screen) --> + <string name="no_songs">No tracks found on your device.</string> + <string name="empty_queue">No tracks selected. Pick some from the library or enter random mode by tapping this message.</string> + <string name="settings">Settings</string> + <string name="no_shuffle">No shuffle</string> + <string name="shuffle_songs">Shuffle tracks</string> + <string name="shuffle_songs_continuously">Shuffle tracks continuously</string> + <string name="shuffle_albums">Shuffle albums</string> + <string name="no_repeat">No repeat</string> + <string name="repeat">Repeat</string> + <string name="repeat_current_song">Repeat current track</string> + <string name="stop_current_song">Stop after current track</string> + <string name="random">Random</string> + <string name="random_enabling">Random enabled</string> + <string name="song_load_failed">Failed to load track %s. It may be corrupt or missing.</string> + <string name="queue_cleared">Queue cleared.</string> + <string name="cover_art">Cover art</string> + <string name="close_notification">Close notification</string> + <string name="_genre">genre</string> + <string name="_track">track</string> + <string name="_composer">composer</string> + <string name="_path">path</string> + <string name="_format">format</string> + <string name="_title">title</string> + <string name="_artist">artist</string> + <string name="_album">album</string> + <string name="_year">year</string> + <string name="_replaygain">rgain</string> + <!-- New Playlist Dialog --> + <string name="choose_playlist_name">Choose playlist name</string> + <string name="create">Create</string> + <string name="overwrite">Overwrite</string> + + <string name="delete_playlist">Delete playlist %s?</string> + + <!-- Library --> + <string name="enqueue">Enqueue</string> + <string name="enqueue_as_next">Play next</string> + <string name="play">Play</string> + <string name="edit">Edit</string> + <string name="rename">Rename</string> + <string name="save_as_playlist">Save as playlist…</string> + <string name="add_to_playlist">Add to playlist…</string> + <string name="add_to_homescreen">Add to homescreen…</string> + <string name="add_to">Add to…</string> + <string name="playlist">Playlist</string> + <string name="homescreen">Homescreen</string> + <string name="add_to_favorites">Add to favorites</string> + <string name="remove_from_favorites">Remove from favorites</string> + <string name="playlist_favorites">Favorites</string> + <string name="new_playlist">New playlist…</string> + <string name="expand">Expand</string> + <string name="expand_or_play_all">Expand or play all</string> + <string name="delete">Delete</string> + <string name="playback_view">Now playing</string> + <string name="sort_by">Sort by</string> + <string name="search">Search</string> + <string name="done">Done</string> + <string name="remove">Remove</string> + <string name="play_or_enqueue">Enqueue if playing; Play if paused</string> + <string name="open">Open</string> + <string name="go_home">Home directory</string> + <string name="jumping_to_song">Song is already in queue, jumping…</string> + + <!-- + As a developer, you should always supply "one" and "other" + strings. Your translators will know which strings are actually + needed for their language. Always include %d in "one" because + translators will need to use %d for languages where "one" + doesn't mean 1 (as explained above). + + Translators should use http://unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules and + http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html, Type cardinal, + to see which categories apply to integer numbers in their languages + --> + <plurals name="playing"> + <item quantity="one">%d track playing.</item> + <item quantity="other">%d tracks playing.</item> + </plurals> + <plurals name="enqueued"> + <item quantity="one">%d track enqueued.</item> + <item quantity="other">%d tracks enqueued.</item> + </plurals> + <plurals name="added_to_playlist"> + <item quantity="one">%1$d track added to playlist %2$s.</item> + <item quantity="other">%1$d tracks added to playlist %2$s.</item> + </plurals> + <plurals name="removed_from_playlist"> + <item quantity="one">%1$d track removed from playlist %2$s.</item> + <item quantity="other">%1$d tracks removed from playlist %2$s.</item> + </plurals> + <plurals name="deleted"> + <item quantity="one">%d track deleted.</item> + <item quantity="other">%d tracks deleted.</item> + </plurals> + <string name="delete_file_failed">Failed to delete %s.</string> + + <string name="deleted_item">\'%s\' deleted.</string> + <string name="delete_item">Delete \'%s\'?</string> + <string name="delete_file">Delete file \'%s\'?</string> + + <string name="artists">Artists</string> + <string name="albums">Albums</string> + <string name="albumartists">Album Artists</string> + <string name="composers">Composers</string> + <string name="songs">Tracks</string> + <string name="playlists">Playlists</string> + <string name="genres">Genres</string> + <string name="files">Files</string> + + <string name="artist">Artist</string> + <string name="album">Album</string> + <string name="genre">Genre</string> + <string name="folder">Folder</string> + + <string name="filename">Filename</string> + <string name="file_size">File size</string> + <string name="file_time">Modification time</string> + <string name="extension">Extension</string> + + <string name="unknown">Unknown</string> + <string name="play_all">Play all</string> + <string name="enqueue_all">Enqueue all</string> + <string name="all_songs">All tracks</string> + <string name="details">Details</string> + <string name="more_from_artist">More from artist</string> + <string name="more_from_album">More from album</string> + + <string name="title">Title</string> + <string name="number_of_tracks">Number of tracks</string> + <string name="year">Year</string> + <string name="date_added">Date added</string> + <string name="artist_album">Artist, album</string> + <string name="artist_year_album">Artist, year, album</string> + <string name="artist_album_track">Artist, album, track number</string> + <string name="artist_album_title">Artist, album, title</string> + <string name="artist_year">Artist, year</string> + <string name="album_track">Album, track number</string> + <string name="song_playcount">Playcount</string> + + <!-- Preferences --> + <plurals name="seconds"> + <item quantity="one">%d second</item> + <item quantity="other">%d seconds</item> + </plurals> + <plurals name="minutes"> + <item quantity="one">%d minute</item> + <item quantity="other">%d minutes</item> + </plurals> + <plurals name="hours"> + <item quantity="one">%d hour</item> + <item quantity="other">%d hours</item> + </plurals> + + <string name="audio">Audio</string> + <string name="volume_during_ducking_title">Volume during notification</string> + <string name="volume_during_ducking_summary">Playback volume: </string> + <string name="ignore_audiofocus_loss_summary">Keep playing on permanent audio focus loss</string> + <string name="media_button_title">Headset/Bluetooth controls</string> + <string name="media_button_summary">This is also required for ICS lockscreen controls.</string> + <string name="headset_only_title">External output only</string> + <string name="headset_only_summary">Prevents music from being played through the internal speakers.</string> + <string name="headset_pause_title">Pause when unplugged</string> + <string name="headset_pause_summary">Pause when the headphones are unplugged.</string> + <string name="headset_launch_title">Play when plugged</string> + <string name="headset_launch_summary">Play when the headphones are plugged in. (Requires the \'Headphone detector\' app to be installed.)</string> + <string name="headset_launch_app_missing">This features requires the \'Headphone detector\' app to be installed.\nWould you like to open the Play Store to install the application?</string> + + <string name="replaygain">ReplayGain</string> + <string name="replaygain_summary">Configure handling of ReplayGain information</string> + <string name="replaygain_track_title">Enable per-track ReplayGain</string> + <string name="replaygain_track_summary">Play all tracks at equal loudness</string> + <string name="replaygain_album_title">Enable album ReplayGain</string> + <string name="replaygain_album_summary">Preserve album dynamics</string> + <string name="replaygain_bump_title">ReplayGain pre-amp</string> + <string name="replaygain_untagged_debump_title">Tracks without ReplayGain tag</string> + <string name="replaygain_untagged_debump_summary">Decrease volume by</string> + <string name="replaygain_preamp_note_title">Note</string> + <string name="replaygain_preamp_note_content">Android does not allow Vanilla Music to raise the volume to >100%. Setting the Pre-amp to a high value may cause issues if you are listening to \'quiet\' music. \n\nRecommended values are:\n-> -3dB for silent/classical music\n-> +3dB for post-2000 recordings</string> + + <string name="disable_gapless_playback_title">Disable Gapless Playback</string> + <string name="disable_gapless_playback_summary">Do not use Gapless Playback which might help with playback issues on devices with buggy firmware</string> + + <string name="readahead">Enable readahead</string> + <string name="readahead_summary">Readahead the currently playing track. This option may solve \'audio dropout\' issues. (caused by a slow SD card)</string> + + <string name="equalizer">Equalizer</string> + + <string name="cycle_continuous_shuffling">Continuous shuffle</string> + <string name="cycle_continuous_shuffling_summary">\'Shuffle mode\' will play tracks in completely random order</string> + + <string name="notifications">Notifications</string> + <string name="notification_visibility_title">Notification visibility</string> + <string name="notification_action_title">Notification action</string> + + <string name="playback_screen">Playback screen</string> + <string name="playback_on_startup_title">Open on startup</string> + <string name="playback_on_startup_summary">Open playback view on startup</string> + <string name="display_mode_title">Display mode</string> + <string name="swipe_up_action_title">Swipe up action</string> + <string name="swipe_down_action_title">Swipe down action</string> + <string name="cover_press_action_title">Cover tap action</string> + <string name="cover_longpress_action_title">Cover long press action</string> + + <string name="library_screen">Library screen</string> + <string name="default_action_title">Default action</string> + <string name="default_playlist_action_title">Default playlist action</string> + + <string name="accelerometer_shake">Accelerometer shake</string> + <string name="enable_shake_title">Enable accelerometer shake</string> + <string name="enable_shake_summary">Only active when music is playing. Does not work when screen is off on some devices.</string> + <string name="shake_action_title">Shake action</string> + <string name="shake_threshold_title">Shake force threshold</string> + + <string name="misc_features">Miscellaneous features</string> + <string name="theme">Theme</string> + <string name="disable_lockscreen_title">Disable lockscreen</string> + <string name="disable_lockscreen_summary">Prevent the lockscreen from activating when in the library or playback screen</string> + <string name="keep_screen_on_title">Keep screen on</string> + <string name="keep_screen_on_summary">Keep the screen (and device) awake while Vanilla Music is visible</string> + <string name="use_idle_timeout_title">Enable idle timeout</string> + <string name="use_idle_timeout_summary">When active, playback will be stopped after the given period of inactivity</string> + <string name="idle_timeout_title">Idle timeout</string> + + <string name="enable_scroll_to_song_title">Scroll to track title</string> + <string name="enable_scroll_to_song_summary">Scroll to currently playing track/album/artist in library lists</string> + + <string name="queue_enable_scroll_to_song_title">Scroll to track title in queue</string> + <string name="queue_enable_scroll_to_song_summary">Scroll to currently playing track in the queue on song change</string> + + <string name="jump_to_enqueued_on_play_title">Jump to enqueued song on \'Play\'</string> + <string name="jump_to_enqueued_on_play_summary">If the requested song is already in the queue, jump to it instead of flushing the queue</string> + + <string name="coverloader_android_title">Load artwork from Android</string> + <string name="coverloader_android_summary">Query Androids internal media database for album artwork</string> + + <string name="coverloader_vanilla_title">Load artwork from folder</string> + <string name="coverloader_vanilla_summary">Search for image files named cover.jpg, album.jpg or artwork.jpg and display them as album cover</string> + + <string name="coverloader_shadow_title">Load artwork from hidden folder</string> + <string name="coverloader_shadow_summary">Try to load artwork from \'/sdcard/Music/.vanilla/ARTIST/ALBUM.jpg\'</string> + + <string name="coverloader_inline_title">Load artwork from file tags</string> + <string name="coverloader_inline_summary">Try to load embedded artwork from file tags</string> + + <string name="cover_on_lockscreen_title">Show artwork on lockscreen</string> + <string name="cover_on_lockscreen_summary">Display the artwork of the currently playing track on the lockscreen</string> + + <string name="double_tap_title">Double tap widget</string> + <string name="double_tap_summary">Double-tapping the 1x1 widget will open the player. Incurs a 400ms delay before the widget responds to actions.</string> + <string name="scrobble_title">Use Scrobble Droid API</string> + <string name="scrobble_summary">Scrobble to Last.fm through Scrobble Droid or Simple Last.fm Scrobbler</string> + <string name="stock_broadcast_title">Emulate stock broadcasts</string> + <string name="stock_broadcast_summary">Send broadcasts emulating those sent by the stock music player to work with 3rd party lockscreen controls, widgets, etc.</string> + + <string name="help">Help</string> + <string name="about">About</string> + + <string name="tabs">Tab order</string> + <string name="customize_tab_order">Adjust the order and visibility of library tabs</string> + <string name="restore_default">Restore default</string> + + <!-- The following are for the list preferences --> + <string name="last_used_action">Last used action</string> + + <string name="never_show">Never show</string> + <string name="show_when_playing">Show when playing (default)</string> + <string name="always_show">Always show</string> + + <string name="open_main_activity">Open library (default)</string> + <string name="open_mini_popup">Open mini popup</string> + <string name="skip_to_next_song">Skip to next track</string> + <string name="open_full_player">Open full player</string> + + <string name="info_on_cover">Info on cover art</string> + <string name="info_below_cover">Info below cover art</string> + <string name="fixed_info">Info fixed at top</string> + + <string name="do_nothing">Do nothing</string> + <string name="open_library">Open library</string> + <string name="play_pause">Play/Pause</string> + <string name="next_song">Next track</string> + <string name="previous_song">Previous track</string> + <string name="next_album">Next album</string> + <string name="previous_album">Previous album</string> + <string name="cycle_repeat_mode">Cycle repeat mode</string> + <string name="cycle_shuffle_mode">Cycle shuffle mode</string> + <string name="enqueue_current_album">Enqueue album</string> + <string name="enqueue_current_artist">Enqueue artist</string> + <string name="enqueue_current_genre">Enqueue genre</string> + <string name="enqueue_current">Enqueue…</string> + <string name="more_from_current">More from…</string> + <string name="empty_the_queue">Empty queue</string> + <string name="show_queue">Show queue</string> + <string name="hide_queue">Hide queue</string> + <string name="dequeue_rest">Dequeue rest</string> + <string name="toggle_controls">Toggle controls</string> + <string name="seek_10s_backward">Seek 10 seconds backward</string> + <string name="seek_10s_forward">Seek 10 seconds forward</string> + <string name="move_to_top">Move to top</string> + <string name="move_to_bottom">Move to bottom</string> + <string name="preferences_action_show_queue">Show queue</string> + <string name="preferences_action_clear_queue">Clear queue</string> + <string name="preferences_action_enqueue_current_album">Enqueue album</string> + <string name="preferences_action_enqueue_current_artist">Enqueue artist</string> + <string name="preferences_action_enqueue_current_genre">Enqueue genre</string> + + <string name="jump_to_time">Jump to Time</string> + <string name="time_separator">:</string> + <string name="hour_hint">HH</string> + <string name="minute_hint">MM</string> + <string name="second_hint">SS</string> + <string name="error_invalid_position">Invalid position</string> + + <string name="filebrowser_start">Filebrowser home</string> + <string name="customize_filebrowser_start">Filebrowser starts at this directory</string> + <string name="select">Select</string> + <string name="save">Save</string> + + + <string name="autoplaylist_playcounts_title">Automatic playlist creation</string> + <string name="autoplaylist_playcounts_summary">Automatically create a</string> + <string name="autoplaylist_playcounts_fmt" formatted="false">%s \'Top %.0f\' playlist</string> + <string name="autoplaylist_playcounts_disabled">Do not create an automatic playlist</string> + <string name="autoplaylist_playcounts_name" formatted="false">Top %d</string> + + <string name="playlist_sync_mode_title">Playlist synchronization</string> + <string name="playlist_sync_all">Full synchronization</string> + <string name="playlist_sync_only_import">Import M3U, never export</string> + <string name="playlist_sync_only_export">Write M3U, never import</string> + <string name="playlist_sync_disabled">Disabled</string> + <string name="playlist_sync_folder_title">Synchronization folder</string> + <string name="playlist_sync_folder_summary">Folder to use for playlist synchronization</string> + <string name="playlist_export_relative_paths_title">Export using relative paths</string> + <string name="playlist_export_relative_paths_summary">Reference file paths relative to the playlist</string> + + <string name="permission_request_summary">Vanilla Music needs read permission to display your music library</string> + <string name="reverse_sort">Reverse sort</string> + + <string name="share">Share…</string> + <string name="share_failed">Failed to share file</string> + <string name="sendto">Send to…</string> + <string name="no_receiving_apps">No receiving apps found for this media type!</string> + <string name="duration">Duration</string> + <string name="dump_database">Dump database</string> + <string name="dump_database_result">Database dumped to \'%s\'</string> + <string name="force_m3u_import">Force M3U reimport</string> + + <string name="media_library">Media library</string> + <string name="media_folders_header">Indexed directories</string> + <string name="media_scan_header">Media scanner</string> + <string name="media_scan_full">Scan full filesystem (slower)</string> + <string name="media_scan_drop_db">Flush media database</string> + <string name="media_scan_start">Start scan</string> + <string name="media_scan_force_bastp">Always use built-in tag reader</string> + <string name="media_scan_group_albums">Group albums by folder</string> + <string name="media_statistics">Statistics</string> + <string name="media_stats_tracks">Number of tracks</string> + <string name="media_stats_library_playtime">Total playing time (Hours)</string> + <string name="media_stats_listen_playtime">Hours of music played so far</string> + <string name="media_stats_progress">Scan progress</string> + <string name="media_library_scan_running">Scanning media library…</string> + <string name="media_scan_preferences">Scanner options</string> + <string name="media_scan_preferences_change_title">Scanner options changed</string> + <string name="media_scan_preferences_change_message">Changing this option will start a full rescan of your library. Would you like to continue?</string> + <string name="folder_picker_spinner_desc">Status of Directory:</string> + + <!-- Folder selector --> + <string name="hint_long_press_to_modify_folder">Long press to modify folder options</string> + <string name="folder_include">Include</string> + <string name="folder_exclude">Exclude</string> + <string name="folder_neutral">Neutral</string> + <!-- Plugin system --> + <string name="plugins">Plugins</string> + <string name="plugin_needs_upgrade">Please upgrade plugin %s to the latest version</string> + + <!-- Theme names --> + <string name="theme_name_standard_light">Standard</string> + <string name="theme_name_standard_dark">Standard (Dark)</string> + <string name="theme_name_grey_light">Grey</string> + <string name="theme_name_grey_dark">Grey (Dark)</string> + <string name="theme_name_orange_light">Orange</string> + <string name="theme_name_orange_dark">Orange (Dark)</string> + <string name="theme_name_blue_light">Blue</string> + <string name="theme_name_blue_dark">Blue (Dark)</string> + <string name="theme_name_red_light">Red</string> + <string name="theme_name_red_dark">Red (Dark)</string> + <string name="theme_name_amoled_dark">Pitch Black (AMOLED)</string> + <string name="theme_name_start_wearing_purple">Start Wearing Purple</string> +</resources> diff --git a/app/src/main/res/values/untranslatable.xml b/app/src/main/res/values/untranslatable.xml new file mode 100644 index 0000000..a580377 --- /dev/null +++ b/app/src/main/res/values/untranslatable.xml @@ -0,0 +1,173 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +Copyright (C) 2010 Christopher Eby <kreed@kreed.org> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +--> +<resources> + <string-array translatable="false" name="entry_values"> + <!-- Note: even if this was an integer-array, these would be converted + to strings anyway. + http://code.google.com/p/android/issues/detail?id=2096 --> + <item>0</item> + <item>1</item> + <item>2</item> + <item>3</item> + <item>4</item> + <item>5</item> + <item>6</item> + <item>7</item> + <item>8</item> + </string-array> + <string-array name="swipe_action_values"> + <!-- This must match the order of swipe_action_entries exactly and + contain only values from PlaybackActivity.Action enum. --> + <item>Nothing</item> + <item>Library</item> + <item>PlayPause</item> + <item>NextSong</item> + <item>PreviousSong</item> + <item>NextAlbum</item> + <item>PreviousAlbum</item> + <item>Repeat</item> + <item>Shuffle</item> + <item>EnqueueAlbum</item> + <item>EnqueueArtist</item> + <item>EnqueueGenre</item> + <item>ClearQueue</item> + <item>ShowQueue</item> + <item>ToggleControls</item> + <item>SeekForward</item> + <item>SeekBackward</item> + </string-array> + <string-array name="swipe_action_entries"> + <!-- This must match the order of swipe_action_values exactly --> + <item>@string/do_nothing</item> + <item>@string/open_library</item> + <item>@string/play_pause</item> + <item>@string/next_song</item> + <item>@string/previous_song</item> + <item>@string/next_album</item> + <item>@string/previous_album</item> + <item>@string/cycle_repeat_mode</item> + <item>@string/cycle_shuffle_mode</item> + <item>@string/preferences_action_enqueue_current_album</item> + <item>@string/preferences_action_enqueue_current_artist</item> + <item>@string/preferences_action_enqueue_current_genre</item> + <item>@string/preferences_action_clear_queue</item> + <item>@string/preferences_action_show_queue</item> + <item>@string/toggle_controls</item> + <item>@string/seek_10s_forward</item> + <item>@string/seek_10s_backward</item> + </string-array> + + <!-- START playlist action entries definition --> + <string-array name="default_playlist_action_entries"> + <item>@string/play</item> + <item>@string/enqueue</item> + <item>@string/last_used_action</item> + <item>@string/play_all</item> + <item>@string/enqueue_all</item> + <item>@string/play_or_enqueue</item> + <item>@string/enqueue_as_next</item> + <item>@string/do_nothing</item> + </string-array> + <string-array name="default_playlist_action_entry_values"> + <item>0</item> <!-- play --> + <item>1</item> <!-- enqueue --> + <item>2</item> <!-- last_action_used --> + <item>3</item> <!-- play_all --> + <item>4</item> <!-- enqueue_all --> + <item>7</item> <!-- play_or_enqueue --> + <item>8</item> <!-- enqueue_as_ next --> + <item>5</item> <!-- do_nothing --> + </string-array> + <!-- END playlist action entries definition --> + + <!-- START default action entries definition --> + <string-array name="default_action_entries"> + <item>@string/expand_or_play_all</item> + <item>@string/expand</item> + <item>@string/play</item> + <item>@string/enqueue</item> + <item>@string/last_used_action</item> + <item>@string/play_all</item> + <item>@string/enqueue_all</item> + <item>@string/play_or_enqueue</item> + <item>@string/enqueue_as_next</item> + <item>@string/do_nothing</item> + </string-array> + <string-array name="default_action_entry_values"> + <item>9</item> <!-- expand_or_play_all --> + <item>6</item> <!-- expand --> + <item>0</item> <!-- play --> + <item>1</item> <!-- enqueue --> + <item>2</item> <!-- last_action_used --> + <item>3</item> <!-- play_all --> + <item>4</item> <!-- enqueue_all --> + <item>7</item> <!-- play_or_enqueue --> + <item>8</item> <!-- enqueue_as_next --> + <item>5</item> <!-- do_nothing --> + </string-array> + <!-- END default action entries definition --> + + <!-- START playlist sync mode entries definition --> + <string-array name="playlist_sync_mode_entries"> + <item>@string/playlist_sync_disabled</item> + <item>@string/playlist_sync_all</item> + <item>@string/playlist_sync_only_export</item> + <item>@string/playlist_sync_only_import</item> + </string-array> + <string-array name="playlist_sync_mode_values"> + <item>0</item> <!-- DISABLE (Default) --> + <item>255</item> <!-- SYNC_ALL --> + <item>2</item> <!-- SYNC_MODE_EXPORT --> + <item>1</item> <!-- SYNC_MODE_IMPORT --> + </string-array> + <!-- END playlist sync mode entries definition --> + + <string-array name="notification_visibility_entries"> + <item>@string/show_when_playing</item> + <item>@string/always_show</item> + </string-array> + <string-array name="notification_action_entries"> + <item>@string/open_main_activity</item> + <item>@string/open_mini_popup</item> + <item>@string/open_full_player</item> + <item>@string/skip_to_next_song</item> + </string-array> + <string-array name="display_mode_entries"> + <item>@string/info_on_cover</item> + <item>@string/info_below_cover</item> + <item>@string/fixed_info</item> + </string-array> + + + <!-- START folder_picker_spinner --> + <string-array name="folder_picker_spinner_entries"> + <item>@string/folder_include</item> + <item>@string/folder_exclude</item> + <item>@string/folder_neutral</item> + </string-array> + <!-- END folder_picker_spinner --> + + <string name="empty"></string> + + +</resources> diff --git a/app/src/main/res/xml/four_long_widget.xml b/app/src/main/res/xml/four_long_widget.xml new file mode 100644 index 0000000..d1a637f --- /dev/null +++ b/app/src/main/res/xml/four_long_widget.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<appwidget-provider + xmlns:android="http://schemas.android.com/apk/res/android" + android:minWidth="250dip" + android:minHeight="40dip" + android:initialLayout="@layout/four_long_widget" + android:previewImage="@drawable/preview_widget_four_long" + android:resizeMode="horizontal|vertical" /> diff --git a/app/src/main/res/xml/four_square_widget.xml b/app/src/main/res/xml/four_square_widget.xml new file mode 100644 index 0000000..b1bc19a --- /dev/null +++ b/app/src/main/res/xml/four_square_widget.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<appwidget-provider + xmlns:android="http://schemas.android.com/apk/res/android" + android:minWidth="110dip" + android:minHeight="110dip" + android:initialLayout="@layout/four_square_widget" + android:previewImage="@drawable/preview_widget_four_square" + android:resizeMode="horizontal|vertical" /> diff --git a/app/src/main/res/xml/four_white_widget.xml b/app/src/main/res/xml/four_white_widget.xml new file mode 100644 index 0000000..852a46c --- /dev/null +++ b/app/src/main/res/xml/four_white_widget.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<appwidget-provider + xmlns:android="http://schemas.android.com/apk/res/android" + android:minWidth="250dip" + android:minHeight="40dip" + android:initialLayout="@layout/four_white_widget" + android:previewImage="@drawable/preview_widget_four_white" + android:resizeMode="horizontal|vertical" /> diff --git a/app/src/main/res/xml/one_cell_widget.xml b/app/src/main/res/xml/one_cell_widget.xml new file mode 100644 index 0000000..10f2eeb --- /dev/null +++ b/app/src/main/res/xml/one_cell_widget.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<appwidget-provider + xmlns:android="http://schemas.android.com/apk/res/android" + android:minWidth="40dip" + android:minHeight="40dip" + android:initialLayout="@layout/one_cell_widget" + android:previewImage="@drawable/preview_widget_one_cell" + android:resizeMode="horizontal|vertical" /> diff --git a/app/src/main/res/xml/preference_audio.xml b/app/src/main/res/xml/preference_audio.xml new file mode 100644 index 0000000..3a28769 --- /dev/null +++ b/app/src/main/res/xml/preference_audio.xml @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!-- +Copyright (C) 2012 Christopher Eby <kreed@kreed.org> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +--> +<PreferenceScreen + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:vanilla="http://schemas.android.com/apk/res-auto" + android:persistent="true"> + <PreferenceScreen + android:fragment="ch.blinkenlights.android.vanilla.PreferencesActivity$EqualizerFragment" + android:title="@string/equalizer" + android:summary="" /> + <PreferenceScreen + android:fragment="ch.blinkenlights.android.vanilla.PreferencesActivity$ReplayGainFragment" + android:title="@string/replaygain" + android:summary="@string/replaygain_summary" /> + <ch.blinkenlights.android.vanilla.SeekBarPreference + android:key="volume_during_ducking" + android:dialogLayout="@layout/seekbar_pref" + android:title="@string/volume_during_ducking_title" + android:defaultValue="50" + vanilla:sbpSummaryText="@string/volume_during_ducking_summary" + vanilla:sbpSummaryFormat="%s %.0f%%" + vanilla:sbpMaxValue="100" + vanilla:sbpCheckBoxKey="ignore_audiofocus_loss" + vanilla:sbpCheckBoxText="@string/ignore_audiofocus_loss_summary" + /> + <CheckBoxPreference + android:key="disable_gapless_playback" + android:title="@string/disable_gapless_playback_title" + android:summary="@string/disable_gapless_playback_summary" + android:defaultValue="false" /> + <CheckBoxPreference + android:key="headset_only" + android:title="@string/headset_only_title" + android:defaultValue="false" + android:summary="@string/headset_only_summary" /> + <CheckBoxPreference + android:key="headset_pause" + android:title="@string/headset_pause_title" + android:defaultValue="true" + android:summary="@string/headset_pause_summary" /> + <PreferenceScreen + android:fragment="ch.blinkenlights.android.vanilla.PreferencesActivity$HeadsetLaunchFragment" + android:title="@string/headset_launch_title" + android:summary="@string/headset_launch_summary" /> +</PreferenceScreen> diff --git a/app/src/main/res/xml/preference_coverart.xml b/app/src/main/res/xml/preference_coverart.xml new file mode 100644 index 0000000..cdcf06a --- /dev/null +++ b/app/src/main/res/xml/preference_coverart.xml @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!-- +Copyright (C) 2012 Christopher Eby <kreed@kreed.org> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +--> +<PreferenceScreen + xmlns:android="http://schemas.android.com/apk/res/android" + android:persistent="true"> + <CheckBoxPreference + android:key="coverloader_vanilla" + android:title="@string/coverloader_vanilla_title" + android:summary="@string/coverloader_vanilla_summary" + android:defaultValue="true" /> + + <CheckBoxPreference + android:key="coverloader_shadow" + android:title="@string/coverloader_shadow_title" + android:summary="@string/coverloader_shadow_summary" + android:defaultValue="true" /> + + <CheckBoxPreference + android:key="coverloader_android" + android:title="@string/coverloader_android_title" + android:summary="@string/coverloader_android_summary" + android:defaultValue="true" /> + + <CheckBoxPreference + android:key="coverloader_inline" + android:title="@string/coverloader_inline_title" + android:summary="@string/coverloader_inline_summary" + android:defaultValue="true" /> + + <CheckBoxPreference + android:key="cover_on_lockscreen" + android:title="@string/cover_on_lockscreen_title" + android:summary="@string/cover_on_lockscreen_summary" + android:defaultValue="true" /> +</PreferenceScreen> diff --git a/app/src/main/res/xml/preference_headers.xml b/app/src/main/res/xml/preference_headers.xml new file mode 100644 index 0000000..66cffd1 --- /dev/null +++ b/app/src/main/res/xml/preference_headers.xml @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!-- +Copyright (C) 2010, 2011 Christopher Eby <kreed@kreed.org> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +--> +<preference-headers xmlns:android="http://schemas.android.com/apk/res/android"> + <header + android:fragment="ch.blinkenlights.android.vanilla.PreferencesActivity$AudioFragment" + android:title="@string/audio" /> + <header + android:fragment="ch.blinkenlights.android.vanilla.PreferencesActivity$PlaybackFragment" + android:title="@string/playback_screen" /> + <header + android:fragment="ch.blinkenlights.android.vanilla.PreferencesActivity$LibraryFragment" + android:title="@string/library_screen" /> + <header + android:fragment="ch.blinkenlights.android.vanilla.PreferencesActivity$NotificationsFragment" + android:title="@string/notifications" /> + <header + android:fragment="ch.blinkenlights.android.vanilla.PreferencesActivity$ShakeFragment" + android:title="@string/accelerometer_shake" /> + <header + android:fragment="ch.blinkenlights.android.vanilla.PreferencesActivity$CoverArtFragment" + android:title="@string/cover_art" /> + <header + android:fragment="ch.blinkenlights.android.vanilla.PreferencesActivity$MiscFragment" + android:title="@string/misc_features" /> + <header + android:fragment="ch.blinkenlights.android.vanilla.PreferencesMediaLibrary" + android:title="@string/media_library" /> + <header + android:fragment="ch.blinkenlights.android.vanilla.PreferencesActivity$PlaylistFragment" + android:title="@string/playlists" /> + <header + android:fragment="ch.blinkenlights.android.vanilla.PreferencesTheme" + android:title="@string/theme" /> + <header + android:fragment="ch.blinkenlights.android.vanilla.PreferencesActivity$HelpFragment" + android:title="@string/help" /> + <header + android:fragment="ch.blinkenlights.android.vanilla.PreferencesActivity$AboutFragment" + android:title="@string/about" /> +</preference-headers> diff --git a/app/src/main/res/xml/preference_library.xml b/app/src/main/res/xml/preference_library.xml new file mode 100644 index 0000000..7d5226c --- /dev/null +++ b/app/src/main/res/xml/preference_library.xml @@ -0,0 +1,67 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!-- +Copyright (C) 2012 Christopher Eby <kreed@kreed.org> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +--> +<PreferenceScreen + xmlns:android="http://schemas.android.com/apk/res/android" + android:persistent="true"> + <PreferenceScreen + android:title="@string/tabs" + android:summary="@string/customize_tab_order"> + <intent + android:targetPackage="ch.blinkenlights.android.vanilla" + android:targetClass="ch.blinkenlights.android.vanilla.TabOrderActivity" /> + </PreferenceScreen> + <ch.blinkenlights.android.vanilla.ListPreferenceSummary + android:key="default_action_int" + android:title="@string/default_action_title" + android:entries="@array/default_action_entries" + android:entryValues="@array/default_action_entry_values" + android:defaultValue="9" /> + <ch.blinkenlights.android.vanilla.ListPreferenceSummary + android:key="default_playlist_action" + android:title="@string/default_playlist_action_title" + android:entries="@array/default_playlist_action_entries" + android:entryValues="@array/default_playlist_action_entry_values" + android:defaultValue="3" /> + <CheckBoxPreference + android:key="enable_scroll_to_song" + android:title="@string/enable_scroll_to_song_title" + android:summary="@string/enable_scroll_to_song_summary" + android:defaultValue="false" /> + <CheckBoxPreference + android:key="queue_enable_scroll_to_song" + android:title="@string/queue_enable_scroll_to_song_title" + android:summary="@string/queue_enable_scroll_to_song_summary" + android:defaultValue="false" /> + <CheckBoxPreference + android:key="jump_to_enqueued_on_play" + android:title="@string/jump_to_enqueued_on_play_title" + android:summary="@string/jump_to_enqueued_on_play_summary" + android:defaultValue="true" /> + <PreferenceScreen + android:title="@string/filebrowser_start" + android:summary="@string/customize_filebrowser_start"> + <intent + android:targetPackage="ch.blinkenlights.android.vanilla" + android:targetClass="ch.blinkenlights.android.vanilla.FilebrowserStartActivity" /> + </PreferenceScreen> +</PreferenceScreen> diff --git a/app/src/main/res/xml/preference_misc.xml b/app/src/main/res/xml/preference_misc.xml new file mode 100644 index 0000000..7c4883d --- /dev/null +++ b/app/src/main/res/xml/preference_misc.xml @@ -0,0 +1,67 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!-- +Copyright (C) 2012 Christopher Eby <kreed@kreed.org> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +--> +<PreferenceScreen + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:vanilla="http://schemas.android.com/apk/res-auto" + android:persistent="true"> + <CheckBoxPreference + android:key="disable_lockscreen" + android:title="@string/disable_lockscreen_title" + android:summary="@string/disable_lockscreen_summary" + android:defaultValue="false" /> + <CheckBoxPreference + android:key="keep_screen_on" + android:title="@string/keep_screen_on_title" + android:summary="@string/keep_screen_on_summary" + android:defaultValue="false" /> + <CheckBoxPreference + android:key="use_idle_timeout" + android:title="@string/use_idle_timeout_title" + android:summary="@string/use_idle_timeout_summary" + android:defaultValue="false" /> + <ch.blinkenlights.android.vanilla.IdlePreference + android:key="idle_timeout" + android:title="@string/idle_timeout_title" + android:dialogLayout="@layout/seekbar_pref" + android:dependency="use_idle_timeout" /> + <CheckBoxPreference + android:key="double_tap" + android:title="@string/double_tap_title" + android:summary="@string/double_tap_summary" + android:defaultValue="false" /> + <CheckBoxPreference + android:key="scrobble" + android:title="@string/scrobble_title" + android:defaultValue="true" + android:summary="@string/scrobble_summary" /> + <CheckBoxPreference + android:key="stock_broadcast" + android:title="@string/stock_broadcast_title" + android:summary="@string/stock_broadcast_summary" + android:defaultValue="false" /> + <CheckBoxPreference + android:key="enable_readahead" + android:title="@string/readahead" + android:defaultValue="false" + android:summary="@string/readahead_summary" /> +</PreferenceScreen> diff --git a/app/src/main/res/xml/preference_notifications.xml b/app/src/main/res/xml/preference_notifications.xml new file mode 100644 index 0000000..a5e71d5 --- /dev/null +++ b/app/src/main/res/xml/preference_notifications.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!-- +Copyright (C) 2012 Christopher Eby <kreed@kreed.org> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +--> +<PreferenceScreen + xmlns:android="http://schemas.android.com/apk/res/android" + android:persistent="true"> + <ch.blinkenlights.android.vanilla.ListPreferenceSummary + android:key="notification_visibility" + android:title="@string/notification_visibility_title" + android:entries="@array/notification_visibility_entries" + android:entryValues="@array/entry_values" + android:defaultValue="0" /> + <ch.blinkenlights.android.vanilla.ListPreferenceSummary + android:key="notification_action" + android:title="@string/notification_action_title" + android:entries="@array/notification_action_entries" + android:entryValues="@array/entry_values" + android:defaultValue="0" /> +</PreferenceScreen> diff --git a/app/src/main/res/xml/preference_playback.xml b/app/src/main/res/xml/preference_playback.xml new file mode 100644 index 0000000..b5de782 --- /dev/null +++ b/app/src/main/res/xml/preference_playback.xml @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!-- +Copyright (C) 2012 Christopher Eby <kreed@kreed.org> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +--> +<PreferenceScreen + xmlns:android="http://schemas.android.com/apk/res/android" + android:persistent="true"> + <CheckBoxPreference + android:key="playback_on_startup" + android:title="@string/playback_on_startup_title" + android:summary="@string/playback_on_startup_summary" + android:defaultValue="false" /> + <ch.blinkenlights.android.vanilla.ListPreferenceSummary + android:key="display_mode" + android:title="@string/display_mode_title" + android:entries="@array/display_mode_entries" + android:entryValues="@array/entry_values" + android:defaultValue="2" /> + <ch.blinkenlights.android.vanilla.ListPreferenceSummary + android:key="swipe_up_action" + android:title="@string/swipe_up_action_title" + android:entries="@array/swipe_action_entries" + android:entryValues="@array/swipe_action_values" + android:defaultValue="Nothing" /> + <ch.blinkenlights.android.vanilla.ListPreferenceSummary + android:key="swipe_down_action" + android:title="@string/swipe_down_action_title" + android:entries="@array/swipe_action_entries" + android:entryValues="@array/swipe_action_values" + android:defaultValue="Nothing" /> + <ch.blinkenlights.android.vanilla.ListPreferenceSummary + android:key="cover_press_action" + android:title="@string/cover_press_action_title" + android:entries="@array/swipe_action_entries" + android:entryValues="@array/swipe_action_values" + android:defaultValue="Nothing" /> + <ch.blinkenlights.android.vanilla.ListPreferenceSummary + android:key="cover_longpress_action" + android:title="@string/cover_longpress_action_title" + android:entries="@array/swipe_action_entries" + android:entryValues="@array/swipe_action_values" + android:defaultValue="Nothing" /> +</PreferenceScreen> diff --git a/app/src/main/res/xml/preference_playlist.xml b/app/src/main/res/xml/preference_playlist.xml new file mode 100644 index 0000000..317f5c3 --- /dev/null +++ b/app/src/main/res/xml/preference_playlist.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!-- +Copyright (C) 2018 Adrian Ulrich <adrian@blinkenlights.ch> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +--> +<PreferenceScreen + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:vanilla="http://schemas.android.com/apk/res-auto" + android:persistent="true"> + <ch.blinkenlights.android.vanilla.SeekBarPreference + android:key="playcounts_autoplaylist" + android:negativeButtonText="@null" + android:dialogLayout="@layout/seekbar_pref" + android:title="@string/autoplaylist_playcounts_title" + android:defaultValue="0" + vanilla:sbpMaxValue="100" + vanilla:sbpSteps="25" + vanilla:sbpSummaryText="@string/autoplaylist_playcounts_summary" + vanilla:sbpSummaryFormat="@string/autoplaylist_playcounts_fmt" + vanilla:sbpSummaryZeroText="@string/autoplaylist_playcounts_disabled"/> + <ch.blinkenlights.android.vanilla.ListPreferenceSummary + android:key="playlist_sync_mode" + android:title="@string/playlist_sync_mode_title" + android:entries="@array/playlist_sync_mode_entries" + android:entryValues="@array/playlist_sync_mode_values" + android:defaultValue="0" /> + <PreferenceScreen + android:dependency="playlist_sync_mode" + android:title="@string/playlist_sync_folder_title" + android:summary="@string/playlist_sync_folder_summary"> + <intent + android:targetPackage="ch.blinkenlights.android.vanilla" + android:targetClass="ch.blinkenlights.android.vanilla.PlaylistObserverDirActivity" /> + </PreferenceScreen> + <CheckBoxPreference + android:defaultValue="false" + android:dependency="playlist_sync_mode" + android:key="playlist_export_relative_paths" + android:summary="@string/playlist_export_relative_paths_summary" + android:title="@string/playlist_export_relative_paths_title" /> +</PreferenceScreen> diff --git a/app/src/main/res/xml/preference_replaygain.xml b/app/src/main/res/xml/preference_replaygain.xml new file mode 100644 index 0000000..208b4d0 --- /dev/null +++ b/app/src/main/res/xml/preference_replaygain.xml @@ -0,0 +1,67 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!-- +Copyright (C) 2012 Christopher Eby <kreed@kreed.org> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +--> +<PreferenceScreen + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:vanilla="http://schemas.android.com/apk/res-auto" + android:persistent="true"> + <CheckBoxPreference + android:key="enable_track_replaygain" + android:title="@string/replaygain_track_title" + android:summary="@string/replaygain_track_summary" + android:defaultValue="false" /> + <CheckBoxPreference + android:key="enable_album_replaygain" + android:title="@string/replaygain_album_title" + android:summary="@string/replaygain_album_summary" + android:defaultValue="false" /> + <ch.blinkenlights.android.vanilla.SeekBarPreference + android:key="replaygain_bump" + android:negativeButtonText="@null" + android:dialogLayout="@layout/seekbar_pref" + android:title="@string/replaygain_bump_title" + android:defaultValue="75" + vanilla:sbpMaxValue="150" + vanilla:sbpSummaryFormat="%s%+.1fdB" + vanilla:sbpSummaryValueAddition="-75" + vanilla:sbpSummaryValueMultiplication="0.2" + /> + <!-- x0.2 = /5 --> + <ch.blinkenlights.android.vanilla.SeekBarPreference + android:key="replaygain_untagged_debump" + android:negativeButtonText="@null" + android:dialogLayout="@layout/seekbar_pref" + android:title="@string/replaygain_untagged_debump_title" + android:defaultValue="150" + vanilla:sbpMaxValue="150" + vanilla:sbpSummaryText="@string/replaygain_untagged_debump_summary" + vanilla:sbpSummaryFormat="%s %.1fdB" + vanilla:sbpSummaryValueAddition="-150" + vanilla:sbpSummaryValueMultiplication="0.1" /> + + <Preference + android:selectable="false" + android:title="@string/replaygain_preamp_note_title" + android:summary="@string/replaygain_preamp_note_content" + /> + +</PreferenceScreen> diff --git a/app/src/main/res/xml/preference_shake.xml b/app/src/main/res/xml/preference_shake.xml new file mode 100644 index 0000000..c49613a --- /dev/null +++ b/app/src/main/res/xml/preference_shake.xml @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!-- +Copyright (C) 2012 Christopher Eby <kreed@kreed.org> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +--> +<PreferenceScreen + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:vanilla="http://schemas.android.com/apk/res-auto" + android:persistent="true"> + <CheckBoxPreference + android:key="enable_shake" + android:title="@string/enable_shake_title" + android:summary="@string/enable_shake_summary" + android:defaultValue="false" /> + <ch.blinkenlights.android.vanilla.ListPreferenceSummary + android:key="shake_action" + android:title="@string/shake_action_title" + android:entries="@array/swipe_action_entries" + android:entryValues="@array/swipe_action_values" + android:defaultValue="NextSong" + android:dependency="enable_shake" /> + <!-- Might be nice to show something indicating the current shake force for this preference. --> + <ch.blinkenlights.android.vanilla.SeekBarPreference + android:key="shake_threshold" + android:negativeButtonText="@null" + android:dialogLayout="@layout/seekbar_pref" + android:title="@string/shake_threshold_title" + android:defaultValue="80" + vanilla:sbpMaxValue="300" + vanilla:sbpSummaryValueMultiplication="0.1" + android:dependency="enable_shake" /> +</PreferenceScreen> diff --git a/app/src/main/res/xml/provider_paths.xml b/app/src/main/res/xml/provider_paths.xml new file mode 100644 index 0000000..87ec385 --- /dev/null +++ b/app/src/main/res/xml/provider_paths.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<paths> + <root-path name="rootfs" path="." /> +</paths> diff --git a/app/src/main/res/xml/shortcuts.xml b/app/src/main/res/xml/shortcuts.xml new file mode 100644 index 0000000..f61f2ee --- /dev/null +++ b/app/src/main/res/xml/shortcuts.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8"?> +<shortcuts xmlns:android="http://schemas.android.com/apk/res/android"> + + <shortcut + android:enabled="true" + android:icon="@drawable/shortcut_play" + android:shortcutId="play" + android:shortcutDisabledMessage="@string/play" + android:shortcutLongLabel="@string/play" + android:shortcutShortLabel="@string/play"> + <intent + android:action="ch.blinkenlights.android.vanilla.action.TOGGLE_PLAYBACK" + android:targetClass="ch.blinkenlights.android.vanilla.ShortcutPseudoActivity" + android:targetPackage="ch.blinkenlights.android.vanilla"/> + </shortcut> + + <shortcut + android:enabled="true" + android:icon="@drawable/shortcut_random" + android:shortcutId="random" + android:shortcutDisabledMessage="@string/random" + android:shortcutLongLabel="@string/random" + android:shortcutShortLabel="@string/random"> + <intent + android:action="ch.blinkenlights.android.vanilla.action.RANDOM_MIX_AUTOPLAY" + android:targetClass="ch.blinkenlights.android.vanilla.ShortcutPseudoActivity" + android:targetPackage="ch.blinkenlights.android.vanilla"/> + </shortcut> + +</shortcuts> diff --git a/app/src/main/res/xml/widget_d.xml b/app/src/main/res/xml/widget_d.xml new file mode 100644 index 0000000..cbe81fb --- /dev/null +++ b/app/src/main/res/xml/widget_d.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<appwidget-provider + xmlns:android="http://schemas.android.com/apk/res/android" + android:minWidth="110dip" + android:minHeight="110dip" + android:initialLayout="@layout/widget_d" + android:previewImage="@drawable/preview_widget_d" + android:resizeMode="horizontal|vertical" /> diff --git a/app/src/main/res/xml/widget_e.xml b/app/src/main/res/xml/widget_e.xml new file mode 100644 index 0000000..ae10c63 --- /dev/null +++ b/app/src/main/res/xml/widget_e.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<appwidget-provider + xmlns:android="http://schemas.android.com/apk/res/android" + android:minWidth="250dip" + android:minHeight="40dip" + android:initialLayout="@layout/widget_e" + android:previewImage="@drawable/preview_widget_e" + android:resizeMode="horizontal|vertical" /> diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..6e8005d --- /dev/null +++ b/build.gradle @@ -0,0 +1,20 @@ +buildscript { + repositories { + google() + mavenCentral() + } + dependencies { + classpath 'com.android.tools.build:gradle:7.3.1' + } +} +allprojects { + repositories { + google() + mavenCentral() + } +} +ext { + compileSdkVersion = 34 + targetSdkVersion = 34 + minSdkVersion = 26 +} diff --git a/fastlane/metadata/en-US/images/featureGraphic.png b/fastlane/metadata/en-US/images/featureGraphic.png Binary files differnew file mode 100644 index 0000000..f419521 --- /dev/null +++ b/fastlane/metadata/en-US/images/featureGraphic.png diff --git a/fastlane/metadata/en-US/images/icon.png b/fastlane/metadata/en-US/images/icon.png Binary files differnew file mode 100644 index 0000000..1eefbf7 --- /dev/null +++ b/fastlane/metadata/en-US/images/icon.png diff --git a/fastlane/metadata/en-US/phoneScreenshots/p1.png b/fastlane/metadata/en-US/phoneScreenshots/p1.png Binary files differnew file mode 100644 index 0000000..ea740ec --- /dev/null +++ b/fastlane/metadata/en-US/phoneScreenshots/p1.png diff --git a/fastlane/metadata/en-US/phoneScreenshots/p2.png b/fastlane/metadata/en-US/phoneScreenshots/p2.png Binary files differnew file mode 100644 index 0000000..8c78d0a --- /dev/null +++ b/fastlane/metadata/en-US/phoneScreenshots/p2.png diff --git a/fastlane/metadata/en-US/phoneScreenshots/p3.png b/fastlane/metadata/en-US/phoneScreenshots/p3.png Binary files differnew file mode 100644 index 0000000..c2c2c17 --- /dev/null +++ b/fastlane/metadata/en-US/phoneScreenshots/p3.png diff --git a/fastlane/metadata/en-US/phoneScreenshots/p4.png b/fastlane/metadata/en-US/phoneScreenshots/p4.png Binary files differnew file mode 100644 index 0000000..4f4b333 --- /dev/null +++ b/fastlane/metadata/en-US/phoneScreenshots/p4.png diff --git a/fastlane/metadata/en-US/phoneScreenshots/p5.png b/fastlane/metadata/en-US/phoneScreenshots/p5.png Binary files differnew file mode 100644 index 0000000..036de9f --- /dev/null +++ b/fastlane/metadata/en-US/phoneScreenshots/p5.png diff --git a/fastlane/metadata/en-US/phoneScreenshots/p6.png b/fastlane/metadata/en-US/phoneScreenshots/p6.png Binary files differnew file mode 100644 index 0000000..d1a39e0 --- /dev/null +++ b/fastlane/metadata/en-US/phoneScreenshots/p6.png diff --git a/fastlane/metadata/en-US/phoneScreenshots/p7.png b/fastlane/metadata/en-US/phoneScreenshots/p7.png Binary files differnew file mode 100644 index 0000000..5a3df10 --- /dev/null +++ b/fastlane/metadata/en-US/phoneScreenshots/p7.png diff --git a/fastlane/metadata/en-US/phoneScreenshots/p8.png b/fastlane/metadata/en-US/phoneScreenshots/p8.png Binary files differnew file mode 100644 index 0000000..6c10266 --- /dev/null +++ b/fastlane/metadata/en-US/phoneScreenshots/p8.png diff --git a/fastlane/metadata/en-US/phoneScreenshots/p9.png b/fastlane/metadata/en-US/phoneScreenshots/p9.png Binary files differnew file mode 100644 index 0000000..f8f12fd --- /dev/null +++ b/fastlane/metadata/en-US/phoneScreenshots/p9.png diff --git a/generate-pngs.sh b/generate-pngs.sh new file mode 100755 index 0000000..179de3c --- /dev/null +++ b/generate-pngs.sh @@ -0,0 +1,44 @@ +#!/bin/sh + +# This script can be used to generate PNGs from the SVGs stored in orig/. +# For each SVG in orig/, PNGs will be created in the drawable directories +# for each DPI with the same name as the SVG. If the PNGs already exist +# and are newer than the SVG, they will not be recreated. +# +# Requires: +# - inkscape +# - imagemagick +# - optipng + +gen() { + type=$1 + path=$2 + res=$3 + dpi=$4 + + name=`basename "$path" .svgz` + png="app/src/main/res/$type-$res/$name.png" + if [ "$path" -nt "$png" -o ! -e "$png" ]; then + inkscape --without-gui --export-area-page --export-dpi=$dpi --export-png="$png" $path + echo + fi +} + +for i in orig/drawable/*.svgz; do + gen drawable "$i" mdpi 96 + gen drawable "$i" hdpi 144 + gen drawable "$i" xhdpi 192 + gen drawable "$i" xxhdpi 288 +done + +for i in orig/mipmap/*.svgz; do + gen mipmap "$i" mdpi 96 + gen mipmap "$i" hdpi 144 + gen mipmap "$i" xhdpi 192 + gen mipmap "$i" xxhdpi 288 +done + +# GOOG tells us to use xxx-hdpi only for launcher icons +for i in orig/mipmap/ic*.svgz ; do + gen mipmap "$i" xxxhdpi 384 +done diff --git a/generate-themes.pl b/generate-themes.pl new file mode 100755 index 0000000..fb29f1c --- /dev/null +++ b/generate-themes.pl @@ -0,0 +1,205 @@ +#!/usr/bin/perl +use strict; + +use constant THEMES_OUTDIR => './app/src/main/res/values-v21/'; +use constant THEMES_LIST => './app/src/main/res/values-v21/themes-list.xml'; + +my $THEMES = [ + { name=>"standard_light", id=>0, dark=>0, colorAccent => '#ff3e677a', colorPrimary => '#ff37474f', colorPrimaryDark => '#ff263238', controlsNormal=>'@color/material_grey_900', floatColor=>'@color/material_grey_400', _bg => '#fff0f0f0' }, + { name=>"standard_dark", id=>1, dark=>1, colorAccent => '#ff3e677a', colorPrimary => '#ff37474f', colorPrimaryDark => '#ff263238', controlsNormal=>'@color/material_grey_300', floatColor=>'@color/material_grey_900', _bg => '#ff2a2a2a' }, + { name=>"grey_light", id=>2, dark=>0, colorAccent => '#ff000000', colorPrimary => '#ff212121', colorPrimaryDark => '#ff090909', controlsNormal=>'@color/material_grey_600', floatColor=>'@color/material_grey_400', _bg => '#fff0f0f0' }, + { name=>"grey_dark", id=>3, dark=>1, colorAccent => '#ffd8d8d8', colorPrimary => '#ff212121', colorPrimaryDark => '#ff090909', controlsNormal=>'@color/material_grey_600', floatColor=>'@color/material_grey_900',_bg => '#ff2a2a2a' }, + { name=>"orange_light", id=>4, dark=>0, colorAccent => '#FFF57F17', colorPrimary => '#FFE65100', colorPrimaryDark => '#FFBF360C', controlsNormal=>'@color/material_grey_900', floatColor=>'@color/material_grey_400', _bg => '#fff0f0f0' }, + { name=>"orange_dark", id=>5, dark=>1, colorAccent => '#FFF57F17', colorPrimary => '#FFE65100', colorPrimaryDark => '#FFBF360C', controlsNormal=>'@color/material_grey_300', floatColor=>'@color/material_grey_900',_bg => '#ff2a2a2a' }, + { name=>"blue_light", id=>6, dark=>0, colorAccent => '#FF03A9F4', colorPrimary => '#FF0277BD', colorPrimaryDark => '#FF01579B', controlsNormal=>'@color/material_grey_900', floatColor=>'@color/material_grey_400', _bg => '#fff0f0f0' }, + { name=>"blue_dark", id=>7, dark=>1, colorAccent => '#FF03A9F4', colorPrimary => '#FF0277BD', colorPrimaryDark => '#FF01579B', controlsNormal=>'@color/material_grey_300', floatColor=>'@color/material_grey_900',_bg => '#ff2a2a2a' }, + { name=>"red_light", id=>8, dark=>0, colorAccent => '#ffd50000', colorPrimary => '#ffc62828', colorPrimaryDark => '#ffb71c1c', controlsNormal=>'@color/material_grey_900', floatColor=>'@color/material_grey_400', _bg => '#fff0f0f0' }, + { name=>"red_dark", id=>9, dark=>1, colorAccent => '#ffd50000', colorPrimary => '#ffc62828', colorPrimaryDark => '#ffb71c1c', controlsNormal=>'@color/material_grey_300', floatColor=>'@color/material_grey_900',_bg => '#ff2a2a2a' }, + { name=>"amoled_dark", id=>10, dark=>1, colorAccent => '#ffd8d8d8', colorPrimary => '#ff000000', colorPrimaryDark => '#ff000000', controlsNormal=>'@color/material_grey_600', colorBackground=>'@android:color/black', floatColor=>'@color/material_grey_900', _bg => '#ff000000' }, + { name=>"start_wearing_purple", id=>11, dark=>1, + colorAccent => '#FF896FBC', colorPrimary=> '#FF5C038C', colorPrimaryDark => '#FF420264', controlsNormal=>'@color/material_grey_600', + colorBackground => '@color/start_wearing_purple_background', controlsActive=> '#FF5C038C', floatColor => '#FF420264', + _bg => '#ff1B1734' }, +]; + + +my $XML_ARRAYS = {}; +foreach my $theme_ref (@$THEMES) { + my $theme_name = $theme_ref->{name}; + my $theme_id = $theme_ref->{id} == 0 ? '' : ucfirst($theme_name)."."; # standard_light has no prefix + my $outfile = THEMES_OUTDIR."/theme-$theme_name.xml"; + my $outbuff = get_theme_xml($theme_ref, $theme_id); + + open(OUT, ">", $outfile) or die "Can not write to $outfile: $!\n"; + print OUT $outbuff; + close(OUT); + + # Get all styles found in get_theme_xml output. + foreach my $line (split(/\n/, $outbuff)) { + if (my ($style) = $line =~ /style name=\"([^"]+)\"/) { + my $category = "theme_category_".lc((split(/\./, $style))[-1]); + push(@{$XML_ARRAYS->{'integer-array'}->{$category}}, '@style/'.$style); + } + } + + my $tvarr = join(",", map { $theme_ref->{$_} } qw(colorPrimaryDark _bg colorPrimary)); + # csv list of theme info, such as its id and the primary colors to show in preview + push(@{$XML_ARRAYS->{'string-array'}->{theme_values}}, $tvarr); + # user visible names of themes + push(@{$XML_ARRAYS->{'string-array'}->{theme_entries}}, '@string/theme_name_'.$theme_ref->{name}); + # id <-> sort mapping + push(@{$XML_ARRAYS->{'string-array'}->{theme_ids}}, $theme_ref->{id}); + # set flag whether theme is dark or not + push(@{$XML_ARRAYS->{'string-array'}->{theme_variant}}, $theme_ref->{dark} ? 'dark' : 'light'); +} + + +open(OUT, ">", THEMES_LIST) or die "Cannot write theme list: $!\n"; +print OUT << "EOLIST"; +<?xml version="1.0" encoding="utf-8"?> +<!-- THIS FILE IS AUTOGENERATED BY generate-themes.pl - DO NOT TOUCH! --> +<resources> +EOLIST + +foreach my $array_type (sort(keys(%$XML_ARRAYS))) { + my $lists = $XML_ARRAYS->{$array_type}; + foreach my $name (sort(keys(%$lists))) { + my $items = $lists->{$name}; + print OUT "\t<$array_type name=\"$name\">\n"; + foreach my $item (@$items) { + print OUT "\t\t<item>$item</item>\n"; + } + print OUT "\t</$array_type>\n\n"; + } +} +print OUT "</resources>\n"; + +close(OUT); + + + + + + +sub get_theme_xml { + my($this, $tid) = @_; + +my $DATA = << "EOF"; +<?xml version="1.0" encoding="utf-8"?> +<!-- + + *** THIS FILE WAS GENERATED BY 'generate-themes.pl' - DO NOT TOUCH *** + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +--> + +<resources> +EOF + + my $controlsActive = $this->{controlsActive} || $this->{colorAccent}; + if($this->{dark} == 0) { + $DATA .= << "EOF" + <style name="${tid}VanillaBase" parent="android:Theme.Material.Light.DarkActionBar"> + <item name="overlay_background_color">\@color/overlay_background_light</item> + <item name="overlay_foreground_color">\@color/overlay_foreground_light</item> + <item name="float_color">$this->{floatColor}</item> + <item name="tabs_background">$this->{colorPrimary}</item> + <item name="now_playing_marker">$this->{colorAccent}</item> + <item name="controls_normal">$this->{controlsNormal}</item> + <item name="controls_active">$controlsActive</item> + <item name="android:colorAccent">$this->{colorAccent}</item> + <item name="android:colorPrimary">$this->{colorPrimary}</item> + <item name="android:colorPrimaryDark">$this->{colorPrimaryDark}</item> + <item name="themed_letter_tile_colors">\@array/letter_tile_colors_light</item> + </style> + + <style name="${tid}Playback" parent="${tid}VanillaBase"> + <item name="android:actionBarStyle">\@style/Universal.PlaybackActionBar</item> + </style> + + <style name="${tid}BackActionBar" parent="${tid}VanillaBase"> + <item name="android:actionBarStyle">\@style/Universal.PlaybackActionBar</item> + </style> + + <style name="${tid}Library" parent="${tid}VanillaBase"> + <item name="android:windowActionBar">false</item> + <item name="android:windowNoTitle">true</item> + </style> + + <style name="${tid}PopupDialog" parent="android:Theme.Material.Light.Dialog.MinWidth"> + <item name="overlay_background_color">\@color/overlay_background_light</item> + <item name="controls_normal">$this->{controlsNormal}</item> + <item name="controls_active">$controlsActive</item> + </style> + + <style name="${tid}BottomSheetDialog" parent="Theme.Design.Light.BottomSheetDialog"> + <item name="android:colorBackground">\@color/overlay_background_light</item> + </style> + +EOF + } else { + $DATA .= << "EOF" + <!-- dark theme --> + <style name="${tid}VanillaBase" parent="android:Theme.Material"> + <item name="overlay_background_color">\@color/overlay_background_dark</item> + <item name="overlay_foreground_color">\@color/overlay_foreground_dark</item> + <item name="float_color">$this->{floatColor}</item> + <item name="tabs_background">$this->{colorPrimary}</item> + <item name="now_playing_marker">$this->{colorAccent}</item> + <item name="controls_normal">$this->{controlsNormal}</item> + <item name="controls_active">$this->{colorAccent}</item> + <item name="android:colorAccent">$this->{colorAccent}</item> + <item name="android:colorPrimary">$this->{colorPrimary}</item> + <item name="android:colorPrimaryDark">$this->{colorPrimaryDark}</item> + <item name="themed_letter_tile_colors">\@array/letter_tile_colors_dark</item> + </style> + + <style name="${tid}Playback" parent="${tid}VanillaBase"> + <item name="android:actionBarStyle">\@style/Universal.PlaybackActionBar</item> + </style> + + <style name="${tid}BackActionBar" parent="${tid}VanillaBase"> + <item name="android:actionBarStyle">\@style/Universal.PlaybackActionBar</item> + </style> + + <style name="${tid}Library" parent="${tid}VanillaBase"> + <item name="android:windowActionBar">false</item> + <item name="android:windowNoTitle">true</item> + </style> + + <style name="${tid}PopupDialog" parent="android:Theme.Material.Dialog.MinWidth"> + <item name="overlay_background_color">\@color/overlay_background_dark</item> + <item name="controls_normal">$this->{controlsNormal}</item> + <item name="controls_active">$controlsActive</item> + </style> + + <style name="${tid}BottomSheetDialog" parent="Theme.Design.Light.BottomSheetDialog"> + <item name="android:colorBackground">\@color/overlay_background_dark</item> + </style> +EOF + } +$DATA .= "\n</resources>\n"; + + # Add custom colorBackground if set, inherit from theme otherwise. + # If we force this, we also set overlay_background_color to the same value + # as it is expected to match the background. + if (defined($this->{colorBackground})) { + $DATA =~ s/<item name="(overlay_background_color)">.+<\/item>/ + <item name="android:colorBackground">$this->{colorBackground}<\/item> + <item name="\1">$this->{colorBackground}<\/item> + /; + } + + return $DATA +} diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..646c51b --- /dev/null +++ b/gradle.properties @@ -0,0 +1,2 @@ +android.useAndroidX=true +android.enableJetifier=true diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar Binary files differnew file mode 100644 index 0000000..d3b8398 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.jar diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..5503fab --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip +distributionSha256Sum=cd5c2958a107ee7f0722004a12d0f8559b4564c34daad7df06cffd4d12a426d0 @@ -0,0 +1,164 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..f6d5974 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/orig/assets/16596798443_44b5528514_o.jpg b/orig/assets/16596798443_44b5528514_o.jpg Binary files differnew file mode 100644 index 0000000..59546ca --- /dev/null +++ b/orig/assets/16596798443_44b5528514_o.jpg diff --git a/orig/assets/README.md b/orig/assets/README.md new file mode 100644 index 0000000..5cfdec5 --- /dev/null +++ b/orig/assets/README.md @@ -0,0 +1,9 @@ +Screenshots have been made with the help of Android's [device art generator](https://developer.android.com/distribute/marketing-tools/device-art-generator). + +The app's icon can be found in [../mipmap/icon.svgz](../mipmap/icon.svgz). + +For adding images, see [All About Descriptions, Graphics, and Screenshots](https://f-droid.org/en/docs/All_About_Descriptions_Graphics_and_Screenshots/). + +Feature graphic background [photograph](https://www.flickr.com/photos/dhilowitz/16596798443/) is licensed CC-BY-2.0. + +Feature graphic has been make with [Inkscape](https://inkscape.org/) by including JPG background and SVG image via linking. diff --git a/orig/assets/featureGraphic.svg b/orig/assets/featureGraphic.svg new file mode 100644 index 0000000..783b495 --- /dev/null +++ b/orig/assets/featureGraphic.svg @@ -0,0 +1,160 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="1024" + height="500" + viewBox="0 0 270.93333 132.29167" + version="1.1" + id="svg8" + inkscape:version="0.92.3 (2405546, 2018-03-11)" + sodipodi:docname="featureGraphic.svg" + inkscape:export-filename="../../fastlane/metadata/en-US/images/featureGraphic.png" + inkscape:export-xdpi="96" + inkscape:export-ydpi="96"> + <defs + id="defs2"> + <filter + inkscape:collect="always" + style="color-interpolation-filters:sRGB" + id="filter1330" + x="-0.009" + width="1.018" + y="-0.0135" + height="1.027"> + <feGaussianBlur + inkscape:collect="always" + stdDeviation="1.5875" + id="feGaussianBlur1332" /> + </filter> + </defs> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="1.4326172" + inkscape:cx="381.46967" + inkscape:cy="250" + inkscape:document-units="mm" + inkscape:current-layer="layer1" + showgrid="false" + inkscape:window-width="1920" + inkscape:window-height="1031" + inkscape:window-x="0" + inkscape:window-y="0" + inkscape:window-maximized="1" + units="px" + inkscape:showpageshadow="false" + borderlayer="true" /> + <metadata + id="metadata5"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title /> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1" + transform="translate(0,-164.70832)"> + <image + sodipodi:absref="16596798443_44b5528514_o.jpg" + xlink:href="16596798443_44b5528514_o.jpg" + y="109.85162" + x="-2.6458011" + id="image165" + preserveAspectRatio="none" + height="282.22223" + width="423.33334" + style="opacity:1;filter:url(#filter1330)" + transform="matrix(0.91911764,0,0,0.91911764,-3.1886467,43.765704)" /> + <g + id="g296" + transform="matrix(0.89122807,0,0,0.89122807,76.42427,209.48852)"> + <g + id="g256"> + <path + id="path254" + d="m 42.998,40.184 c 0,1.547 -1.27,2.814 -2.814,2.814 H 7.815 C 6.266,42.999 5,41.73 5,40.184 V 7.814 C 5,6.266 6.267,5.001 7.814,5.001 h 32.37 C 41.732,5.001 43,6.267 43,7.814 Z" + inkscape:connector-curvature="0" + style="fill:#efefef" /> + </g> + <path + id="path263" + d="M 42.999,40.184 43,21.446 c -0.016,-0.015 -0.029,-0.03 -0.045,-0.045 -0.057,-0.056 -0.113,-0.114 -0.169,-0.168 -0.056,-0.056 -0.111,-0.112 -0.166,-0.167 -0.058,-0.057 -0.114,-0.115 -0.17,-0.171 -0.056,-0.056 -0.112,-0.111 -0.167,-0.166 -0.057,-0.057 -0.113,-0.114 -0.17,-0.17 -0.055,-0.056 -0.111,-0.112 -0.168,-0.167 -0.057,-0.057 -0.113,-0.114 -0.17,-0.171 -0.057,-0.056 -0.112,-0.113 -0.17,-0.168 -0.055,-0.055 -0.109,-0.112 -0.166,-0.167 -0.057,-0.056 -0.113,-0.114 -0.17,-0.171 -0.056,-0.055 -0.11,-0.111 -0.168,-0.166 -0.055,-0.057 -0.112,-0.115 -0.17,-0.17 C 40.876,19.323 40.82,19.266 40.765,19.212 40.708,19.155 40.65,19.097 40.593,19.041 40.538,18.985 40.482,18.927 40.424,18.873 40.369,18.817 40.314,18.761 40.259,18.707 40.202,18.649 40.144,18.592 40.088,18.536 40.032,18.48 39.978,18.424 39.921,18.369 39.865,18.312 39.808,18.255 39.751,18.198 39.694,18.143 39.642,18.087 39.586,18.033 39.528,17.976 39.472,17.919 39.413,17.861 39.358,17.805 39.302,17.748 39.245,17.693 39.19,17.638 39.136,17.582 39.078,17.527 39.022,17.47 38.965,17.413 38.908,17.356 38.852,17.301 38.797,17.245 38.741,17.191 38.684,17.134 38.628,17.076 38.569,17.02 38.514,16.965 38.461,16.909 38.406,16.855 38.348,16.798 38.292,16.74 38.233,16.683 38.178,16.627 38.122,16.571 38.067,16.516 38.01,16.459 37.953,16.401 37.895,16.346 37.839,16.289 37.783,16.232 37.727,16.177 37.671,16.121 37.617,16.066 37.561,16.011 37.503,15.954 37.447,15.896 37.389,15.84 37.334,15.785 37.281,15.729 37.225,15.674 37.167,15.617 37.11,15.56 37.053,15.502 36.997,15.447 36.942,15.391 36.885,15.335 36.829,15.279 36.772,15.221 36.715,15.164 36.659,15.109 36.604,15.051 36.546,14.996 36.491,14.941 36.436,14.885 36.38,14.83 36.324,14.772 36.266,14.715 36.208,14.659 36.152,14.604 36.1,14.548 36.044,14.494 35.986,14.436 35.93,14.379 35.871,14.322 35.816,14.266 35.762,14.21 35.706,14.155 35.648,14.097 35.591,14.041 35.535,13.984 35.478,13.927 35.422,13.871 35.366,13.815 35.31,13.759 35.255,13.704 35.2,13.649 35.142,13.591 35.086,13.534 35.027,13.478 34.972,13.422 34.919,13.367 34.861,13.311 32.097,10.501 28.253,8.758 24,8.758 c -8.419,0 -15.243,6.825 -15.243,15.243 0,4.253 1.743,8.097 4.552,10.862 0.054,0.056 0.11,0.111 0.166,0.166 0.056,0.057 0.114,0.113 0.171,0.171 0.055,0.056 0.111,0.11 0.167,0.167 0.055,0.056 0.112,0.111 0.168,0.168 0.056,0.057 0.114,0.115 0.171,0.171 0.055,0.056 0.11,0.11 0.167,0.166 0.056,0.058 0.114,0.114 0.171,0.173 0.055,0.055 0.11,0.11 0.166,0.165 0.056,0.056 0.114,0.114 0.171,0.17 0.055,0.056 0.111,0.112 0.167,0.166 0.055,0.058 0.112,0.114 0.168,0.169 0.055,0.057 0.114,0.115 0.171,0.171 0.055,0.056 0.111,0.112 0.166,0.166 0.057,0.058 0.115,0.115 0.172,0.173 0.055,0.056 0.11,0.111 0.166,0.166 0.056,0.057 0.114,0.114 0.17,0.17 0.055,0.057 0.111,0.111 0.166,0.166 0.056,0.057 0.112,0.113 0.168,0.17 0.057,0.057 0.114,0.113 0.171,0.17 0.055,0.056 0.111,0.111 0.167,0.166 0.057,0.059 0.114,0.113 0.171,0.172 0.055,0.056 0.11,0.111 0.167,0.166 0.056,0.057 0.113,0.113 0.17,0.171 0.055,0.055 0.11,0.11 0.167,0.166 0.055,0.057 0.113,0.114 0.17,0.171 0.055,0.056 0.111,0.111 0.166,0.166 0.055,0.057 0.113,0.113 0.168,0.169 0.056,0.057 0.114,0.114 0.172,0.171 0.055,0.057 0.11,0.111 0.165,0.166 0.057,0.059 0.114,0.115 0.172,0.171 0.054,0.056 0.11,0.111 0.165,0.166 0.057,0.058 0.115,0.114 0.171,0.171 0.055,0.057 0.11,0.112 0.166,0.167 0.056,0.056 0.112,0.112 0.169,0.168 0.056,0.058 0.113,0.114 0.17,0.171 0.056,0.057 0.111,0.112 0.167,0.168 0.057,0.057 0.114,0.113 0.171,0.17 0.055,0.056 0.11,0.111 0.167,0.166 0.055,0.058 0.113,0.113 0.171,0.172 0.054,0.055 0.11,0.11 0.166,0.166 0.055,0.056 0.112,0.112 0.167,0.168 0.056,0.058 0.114,0.115 0.172,0.17 0.055,0.057 0.111,0.113 0.166,0.168 0.057,0.057 0.114,0.115 0.171,0.17 0.055,0.057 0.111,0.113 0.166,0.167 0.057,0.057 0.115,0.114 0.17,0.171 0.055,0.055 0.111,0.111 0.167,0.166 0.056,0.056 0.112,0.113 0.168,0.168 0.015,0.016 0.031,0.029 0.046,0.045 H 40.18 c 1.552,0 2.819,-1.27 2.819,-2.816 z" + inkscape:connector-curvature="0" + style="fill:url(#SVGID_1_)" /> + <circle + id="circle265" + r="15.244" + cy="23.999001" + cx="24" + style="fill:#f26119" /> + <circle + id="circle267" + r="13.372" + cy="23.999001" + cx="24" + style="fill:#383838" /> + <path + id="path269" + d="m 10.227,9.212 c 0,0.561 -0.563,1.014 -1.055,1.014 v 0 C 8.681,10.226 8.116,9.772 8.116,9.212 V 9.131 C 8.116,8.57 8.68,8.116 9.172,8.116 v 0 c 0.491,0 1.055,0.455 1.055,1.015 z" + inkscape:connector-curvature="0" + style="fill:#383838" /> + <path + id="path271" + d="m 39.885,9.212 c 0,0.561 -0.563,1.014 -1.055,1.014 v 0 c -0.493,0 -1.057,-0.454 -1.057,-1.014 V 9.131 c 0,-0.561 0.563,-1.015 1.057,-1.015 v 0 c 0.49,0 1.055,0.455 1.055,1.015 z" + inkscape:connector-curvature="0" + style="fill:#383838" /> + <path + id="path273" + d="m 10.227,38.868 c 0,0.563 -0.563,1.016 -1.055,1.016 v 0 c -0.491,0 -1.056,-0.452 -1.056,-1.016 v -0.08 c 0,-0.563 0.564,-1.015 1.056,-1.015 v 0 c 0.491,0 1.055,0.453 1.055,1.015 z" + inkscape:connector-curvature="0" + style="fill:#383838" /> + <path + id="path275" + d="m 39.885,38.87 c 0,0.56 -0.563,1.015 -1.056,1.015 v 0 c -0.492,0 -1.056,-0.455 -1.056,-1.015 v -0.082 c 0,-0.562 0.563,-1.015 1.056,-1.015 v 0 c 0.491,0 1.056,0.453 1.056,1.015 z" + inkscape:connector-curvature="0" + style="fill:#383838" /> + <circle + id="circle277" + r="5.8270001" + cy="23.999001" + cx="24" + style="fill:#2c2c2c" /> + </g> + <text + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.26458333;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + x="130.43864" + y="228.13228" + id="text300"><tspan + sodipodi:role="line" + id="tspan298" + x="130.43864" + y="228.13228" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:18.34444427px;line-height:1;font-family:Ubuntu;-inkscape-font-specification:'Ubuntu Bold';fill:#ffffff;fill-opacity:1;stroke-width:0.26458333;stroke-miterlimit:4;stroke-dasharray:none;stroke:#000000;stroke-opacity:1">Vanilla</tspan><tspan + sodipodi:role="line" + x="130.43864" + y="246.81067" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:18.34444427px;line-height:1;font-family:Ubuntu;-inkscape-font-specification:'Ubuntu Bold';fill:#ffffff;fill-opacity:1;stroke-width:0.26458333;stroke-miterlimit:4;stroke-dasharray:none;stroke:#000000;stroke-opacity:1" + id="tspan1230">Music</tspan></text> + </g> +</svg> diff --git a/orig/drawable/arrow.svgz b/orig/drawable/arrow.svgz Binary files differnew file mode 100644 index 0000000..c92d7f7 --- /dev/null +++ b/orig/drawable/arrow.svgz diff --git a/orig/drawable/arrow_up.svgz b/orig/drawable/arrow_up.svgz Binary files differnew file mode 100644 index 0000000..6a3aac1 --- /dev/null +++ b/orig/drawable/arrow_up.svgz diff --git a/orig/drawable/fallback_cover.svgz b/orig/drawable/fallback_cover.svgz Binary files differnew file mode 100644 index 0000000..cea08bf --- /dev/null +++ b/orig/drawable/fallback_cover.svgz diff --git a/orig/drawable/fallback_cover_large.svgz b/orig/drawable/fallback_cover_large.svgz Binary files differnew file mode 100644 index 0000000..d258c3e --- /dev/null +++ b/orig/drawable/fallback_cover_large.svgz diff --git a/orig/drawable/file_document.svgz b/orig/drawable/file_document.svgz Binary files differnew file mode 100644 index 0000000..1433a44 --- /dev/null +++ b/orig/drawable/file_document.svgz diff --git a/orig/drawable/file_image.svgz b/orig/drawable/file_image.svgz Binary files differnew file mode 100644 index 0000000..918e835 --- /dev/null +++ b/orig/drawable/file_image.svgz diff --git a/orig/drawable/file_music.svgz b/orig/drawable/file_music.svgz Binary files differnew file mode 100644 index 0000000..5b15d30 --- /dev/null +++ b/orig/drawable/file_music.svgz diff --git a/orig/drawable/folder.svgz b/orig/drawable/folder.svgz Binary files differnew file mode 100644 index 0000000..951e611 --- /dev/null +++ b/orig/drawable/folder.svgz diff --git a/orig/drawable/grabber.svgz b/orig/drawable/grabber.svgz Binary files differnew file mode 100644 index 0000000..f0948e4 --- /dev/null +++ b/orig/drawable/grabber.svgz diff --git a/orig/drawable/menu_add_to_homescreen.svgz b/orig/drawable/menu_add_to_homescreen.svgz Binary files differnew file mode 100644 index 0000000..1a113c3 --- /dev/null +++ b/orig/drawable/menu_add_to_homescreen.svgz diff --git a/orig/drawable/menu_add_to_playlist.svgz b/orig/drawable/menu_add_to_playlist.svgz Binary files differnew file mode 100644 index 0000000..6f3d5e7 --- /dev/null +++ b/orig/drawable/menu_add_to_playlist.svgz diff --git a/orig/drawable/menu_album.svgz b/orig/drawable/menu_album.svgz Binary files differnew file mode 100644 index 0000000..642b5a5 --- /dev/null +++ b/orig/drawable/menu_album.svgz diff --git a/orig/drawable/menu_artist.svgz b/orig/drawable/menu_artist.svgz Binary files differnew file mode 100644 index 0000000..02f5015 --- /dev/null +++ b/orig/drawable/menu_artist.svgz diff --git a/orig/drawable/menu_delete.svgz b/orig/drawable/menu_delete.svgz Binary files differnew file mode 100644 index 0000000..8c7edef --- /dev/null +++ b/orig/drawable/menu_delete.svgz diff --git a/orig/drawable/menu_details.svgz b/orig/drawable/menu_details.svgz Binary files differnew file mode 100644 index 0000000..2a757c3 --- /dev/null +++ b/orig/drawable/menu_details.svgz diff --git a/orig/drawable/menu_edit.svgz b/orig/drawable/menu_edit.svgz Binary files differnew file mode 100644 index 0000000..e8315f4 --- /dev/null +++ b/orig/drawable/menu_edit.svgz diff --git a/orig/drawable/menu_enqueue.svgz b/orig/drawable/menu_enqueue.svgz Binary files differnew file mode 100644 index 0000000..eb2a38a --- /dev/null +++ b/orig/drawable/menu_enqueue.svgz diff --git a/orig/drawable/menu_enqueue_as_next.svgz b/orig/drawable/menu_enqueue_as_next.svgz Binary files differnew file mode 100644 index 0000000..a9d3d55 --- /dev/null +++ b/orig/drawable/menu_enqueue_as_next.svgz diff --git a/orig/drawable/menu_expand.svgz b/orig/drawable/menu_expand.svgz Binary files differnew file mode 100644 index 0000000..48e3f6f --- /dev/null +++ b/orig/drawable/menu_expand.svgz diff --git a/orig/drawable/menu_launch.svgz b/orig/drawable/menu_launch.svgz Binary files differnew file mode 100644 index 0000000..8307674 --- /dev/null +++ b/orig/drawable/menu_launch.svgz diff --git a/orig/drawable/menu_move_to_bottom.svgz b/orig/drawable/menu_move_to_bottom.svgz Binary files differnew file mode 100644 index 0000000..a67d1b2 --- /dev/null +++ b/orig/drawable/menu_move_to_bottom.svgz diff --git a/orig/drawable/menu_move_to_top.svgz b/orig/drawable/menu_move_to_top.svgz Binary files differnew file mode 100644 index 0000000..56b08bc --- /dev/null +++ b/orig/drawable/menu_move_to_top.svgz diff --git a/orig/drawable/menu_play.svgz b/orig/drawable/menu_play.svgz Binary files differnew file mode 100644 index 0000000..15ce1ac --- /dev/null +++ b/orig/drawable/menu_play.svgz diff --git a/orig/drawable/menu_play_all.svgz b/orig/drawable/menu_play_all.svgz Binary files differnew file mode 100644 index 0000000..4b2024c --- /dev/null +++ b/orig/drawable/menu_play_all.svgz diff --git a/orig/drawable/menu_plugins.svgz b/orig/drawable/menu_plugins.svgz Binary files differnew file mode 100644 index 0000000..5e94903 --- /dev/null +++ b/orig/drawable/menu_plugins.svgz diff --git a/orig/drawable/menu_remove.svgz b/orig/drawable/menu_remove.svgz Binary files differnew file mode 100644 index 0000000..6348900 --- /dev/null +++ b/orig/drawable/menu_remove.svgz diff --git a/orig/drawable/next.svgz b/orig/drawable/next.svgz Binary files differnew file mode 100644 index 0000000..9daeb76 --- /dev/null +++ b/orig/drawable/next.svgz diff --git a/orig/drawable/pause.svgz b/orig/drawable/pause.svgz Binary files differnew file mode 100644 index 0000000..2661c8b --- /dev/null +++ b/orig/drawable/pause.svgz diff --git a/orig/drawable/play.svgz b/orig/drawable/play.svgz Binary files differnew file mode 100644 index 0000000..d37d8d7 --- /dev/null +++ b/orig/drawable/play.svgz diff --git a/orig/drawable/previous.svgz b/orig/drawable/previous.svgz Binary files differnew file mode 100644 index 0000000..bdc0abe --- /dev/null +++ b/orig/drawable/previous.svgz diff --git a/orig/drawable/random_active.svgz b/orig/drawable/random_active.svgz Binary files differnew file mode 100644 index 0000000..0941ce8 --- /dev/null +++ b/orig/drawable/random_active.svgz diff --git a/orig/drawable/repeat_active.svgz b/orig/drawable/repeat_active.svgz Binary files differnew file mode 100644 index 0000000..7767ed0 --- /dev/null +++ b/orig/drawable/repeat_active.svgz diff --git a/orig/drawable/repeat_current_active.svgz b/orig/drawable/repeat_current_active.svgz new file mode 100644 index 0000000..354e3f7 --- /dev/null +++ b/orig/drawable/repeat_current_active.svgz @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="48px" height="48px" viewBox="0 0 48 48" enable-background="new 0 0 48 48" xml:space="preserve">
+<g>
+ <path fill="#33B5E5" d="M19.361,23.438h-8.523c-1.104,0-2.002,0.896-2.002,2v8.522c0,1.104,0.896,2.001,2.002,2.001h8.521
+ c1.105,0,2.002-0.896,2.002-2.001v-8.521C21.361,24.335,20.465,23.438,19.361,23.438z M15.941,33.369h-1.662v-5.813h-0.023
+ l-1.398,0.666l-0.283-1.288l1.942-0.902h1.425L15.941,33.369L15.941,33.369z"/>
+ <path fill="#0099CC" d="M34.818,14.614H13.182c-1.199,0-2.174,0.975-2.174,2.174v6.649h2.475v-6.13c0-0.191,0.18-0.347,0.399-0.347
+ h20.235c0.221,0,0.398,0.154,0.398,0.347v10.396c0,0.191-0.18,0.349-0.398,0.349h-5.99v-2.988l-5.8,4.161l5.8,4.161v-2.987h6.691
+ c1.199,0,2.174-0.973,2.174-2.173V16.788C36.992,15.589,36.02,14.614,34.818,14.614z"/>
+</g>
+</svg>
diff --git a/orig/drawable/repeat_inactive.svgz b/orig/drawable/repeat_inactive.svgz Binary files differnew file mode 100644 index 0000000..6a2392e --- /dev/null +++ b/orig/drawable/repeat_inactive.svgz diff --git a/orig/drawable/repeat_inactive_service.svgz b/orig/drawable/repeat_inactive_service.svgz Binary files differnew file mode 100644 index 0000000..ee21205 --- /dev/null +++ b/orig/drawable/repeat_inactive_service.svgz diff --git a/orig/drawable/shortcut_play.svgz b/orig/drawable/shortcut_play.svgz Binary files differnew file mode 100644 index 0000000..1e19e10 --- /dev/null +++ b/orig/drawable/shortcut_play.svgz diff --git a/orig/drawable/shortcut_random.svgz b/orig/drawable/shortcut_random.svgz Binary files differnew file mode 100644 index 0000000..ad595ca --- /dev/null +++ b/orig/drawable/shortcut_random.svgz diff --git a/orig/drawable/shuffle_active.svgz b/orig/drawable/shuffle_active.svgz Binary files differnew file mode 100644 index 0000000..5f0361f --- /dev/null +++ b/orig/drawable/shuffle_active.svgz diff --git a/orig/drawable/shuffle_album_active.svgz b/orig/drawable/shuffle_album_active.svgz Binary files differnew file mode 100644 index 0000000..7972245 --- /dev/null +++ b/orig/drawable/shuffle_album_active.svgz diff --git a/orig/drawable/shuffle_inactive.svgz b/orig/drawable/shuffle_inactive.svgz Binary files differnew file mode 100644 index 0000000..704af7c --- /dev/null +++ b/orig/drawable/shuffle_inactive.svgz diff --git a/orig/drawable/shuffle_inactive_service.svgz b/orig/drawable/shuffle_inactive_service.svgz Binary files differnew file mode 100644 index 0000000..9060c40 --- /dev/null +++ b/orig/drawable/shuffle_inactive_service.svgz diff --git a/orig/drawable/status_icon.svgz b/orig/drawable/status_icon.svgz Binary files differnew file mode 100644 index 0000000..07f1c28 --- /dev/null +++ b/orig/drawable/status_icon.svgz diff --git a/orig/drawable/status_scan_0.svgz b/orig/drawable/status_scan_0.svgz Binary files differnew file mode 100644 index 0000000..10aacbc --- /dev/null +++ b/orig/drawable/status_scan_0.svgz diff --git a/orig/drawable/status_scan_1.svgz b/orig/drawable/status_scan_1.svgz Binary files differnew file mode 100644 index 0000000..50c9abf --- /dev/null +++ b/orig/drawable/status_scan_1.svgz diff --git a/orig/drawable/status_scan_2.svgz b/orig/drawable/status_scan_2.svgz Binary files differnew file mode 100644 index 0000000..f09edbf --- /dev/null +++ b/orig/drawable/status_scan_2.svgz diff --git a/orig/drawable/status_scan_3.svgz b/orig/drawable/status_scan_3.svgz Binary files differnew file mode 100644 index 0000000..6eff8c4 --- /dev/null +++ b/orig/drawable/status_scan_3.svgz diff --git a/orig/drawable/status_scan_4.svgz b/orig/drawable/status_scan_4.svgz Binary files differnew file mode 100644 index 0000000..3c30b0d --- /dev/null +++ b/orig/drawable/status_scan_4.svgz diff --git a/orig/drawable/stop_current_active.svgz b/orig/drawable/stop_current_active.svgz Binary files differnew file mode 100644 index 0000000..72c6879 --- /dev/null +++ b/orig/drawable/stop_current_active.svgz diff --git a/orig/drawable/widget_next.svgz b/orig/drawable/widget_next.svgz Binary files differnew file mode 100644 index 0000000..00834d6 --- /dev/null +++ b/orig/drawable/widget_next.svgz diff --git a/orig/drawable/widget_pause.svgz b/orig/drawable/widget_pause.svgz Binary files differnew file mode 100644 index 0000000..e2abe7e --- /dev/null +++ b/orig/drawable/widget_pause.svgz diff --git a/orig/drawable/widget_play.svgz b/orig/drawable/widget_play.svgz Binary files differnew file mode 100644 index 0000000..0c61947 --- /dev/null +++ b/orig/drawable/widget_play.svgz diff --git a/orig/drawable/widget_previous.svgz b/orig/drawable/widget_previous.svgz Binary files differnew file mode 100644 index 0000000..7bf5d25 --- /dev/null +++ b/orig/drawable/widget_previous.svgz diff --git a/orig/mipmap/ic_normal_background.svgz b/orig/mipmap/ic_normal_background.svgz Binary files differnew file mode 100644 index 0000000..4d2a536 --- /dev/null +++ b/orig/mipmap/ic_normal_background.svgz diff --git a/orig/mipmap/ic_normal_foreground.svgz b/orig/mipmap/ic_normal_foreground.svgz Binary files differnew file mode 100644 index 0000000..1321cde --- /dev/null +++ b/orig/mipmap/ic_normal_foreground.svgz diff --git a/orig/mipmap/icon.svgz b/orig/mipmap/icon.svgz Binary files differnew file mode 100644 index 0000000..ed63c80 --- /dev/null +++ b/orig/mipmap/icon.svgz diff --git a/orig/vinyl.xcf b/orig/vinyl.xcf Binary files differnew file mode 100644 index 0000000..31e2746 --- /dev/null +++ b/orig/vinyl.xcf diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..c4456f3 --- /dev/null +++ b/settings.gradle @@ -0,0 +1 @@ +include "app" diff --git a/update-translations.pl b/update-translations.pl new file mode 100755 index 0000000..6b710de --- /dev/null +++ b/update-translations.pl @@ -0,0 +1,35 @@ +#!/usr/bin/perl +use strict; + +# nasty mapping table +my $LMAP = { + 'el' => 'el-rGR', + 'eu' => 'eu-rES', + 'fa_IR' => 'fa-rIR', + 'zh_CN' => 'zh-rCN', + 'zh_TW' => 'zh-rTW', + 'pt_BR' => 'pt-rBR', + 'hu_HU' => 'hu', + 'it_IT' => 'it', + 'pl_PL' => 'pl', + 'id' => 'in', + 'he_IL' => 'iw', +}; + + +die "Stale 'translations'-dir exists\n" if -d 'translations'; +system("transifex pull -a -w 30 --minimum-perc=30"); + +foreach my $src_file (glob("translations/vanilla-music-1.en-strings/*.xml")) { + if ($src_file =~ /\/([a-zA-Z_]+)\.xml/) { + my $locale = $1; + $locale = $LMAP->{$locale} if exists $LMAP->{$locale}; + my $dst_file = "app/src/main/res/values-$locale/translatable.xml"; + + warn "+ $src_file -> $dst_file\n"; + die "Unknown locale: '$locale', target=$dst_file\n" unless -f $dst_file; + rename($src_file, $dst_file) or die "rename failed: $!\n"; + } +} + +system("rm -rf translations"); |
