├── LICENSE ├── OpenLRC ├── .classpath ├── .project ├── AndroidManifest.xml ├── bin │ ├── AndroidManifest.xml │ ├── LRCViewTest.apk │ ├── OpenLRC.apk │ ├── classes.dex │ ├── classes │ │ └── org │ │ │ └── load │ │ │ ├── lrcviewtest │ │ │ ├── BuildConfig.class │ │ │ ├── R$attr.class │ │ │ ├── R$dimen.class │ │ │ ├── R$drawable.class │ │ │ ├── R$id.class │ │ │ ├── R$layout.class │ │ │ ├── R$menu.class │ │ │ ├── R$string.class │ │ │ ├── R$style.class │ │ │ ├── R$styleable.class │ │ │ └── R.class │ │ │ ├── main │ │ │ ├── MainActivity$PreparedListener$1.class │ │ │ ├── MainActivity$PreparedListener.class │ │ │ └── MainActivity.class │ │ │ └── openlrc │ │ │ └── LrcView.class │ ├── dexedLibs │ │ ├── android-support-v4-607383735c4f31468816d6fbc46a286e.jar │ │ ├── android-support-v4-a5c9b7d49427a63f457dfe47151cdc5c.jar │ │ └── annotations-561247cd2d35821bbdd9ca81f8607b6a.jar │ ├── jarlist.cache │ ├── res │ │ └── crunch │ │ │ ├── drawable-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── drawable-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── drawable-xhdpi │ │ │ └── ic_launcher.png │ │ │ └── drawable-xxhdpi │ │ │ └── ic_launcher.png │ └── resources.ap_ ├── gen │ └── org │ │ └── load │ │ └── lrcviewtest │ │ ├── BuildConfig.java │ │ └── R.java ├── ic_launcher-web.png ├── libs │ └── android-support-v4.jar ├── proguard-project.txt ├── project.properties ├── res │ ├── drawable-hdpi │ │ └── ic_launcher.png │ ├── drawable-mdpi │ │ └── ic_launcher.png │ ├── drawable-xhdpi │ │ └── ic_launcher.png │ ├── drawable-xxhdpi │ │ └── ic_launcher.png │ ├── layout │ │ └── activity_main.xml │ ├── menu │ │ └── main.xml │ ├── values-sw600dp │ │ └── dimens.xml │ ├── values-sw720dp-land │ │ └── dimens.xml │ ├── values-v11 │ │ └── styles.xml │ ├── values-v14 │ │ └── styles.xml │ └── values │ │ ├── attrs.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml └── src │ └── org │ └── load │ ├── main │ └── MainActivity.java │ └── openlrc │ └── LrcView.java ├── README.md └── show └── show.png /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | -------------------------------------------------------------------------------- /OpenLRC/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /OpenLRC/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | OpenLRC 4 | 5 | 6 | 7 | 8 | 9 | com.android.ide.eclipse.adt.ResourceManagerBuilder 10 | 11 | 12 | 13 | 14 | com.android.ide.eclipse.adt.PreCompilerBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.jdt.core.javabuilder 20 | 21 | 22 | 23 | 24 | com.android.ide.eclipse.adt.ApkBuilder 25 | 26 | 27 | 28 | 29 | 30 | com.android.ide.eclipse.adt.AndroidNature 31 | org.eclipse.jdt.core.javanature 32 | 33 | 34 | -------------------------------------------------------------------------------- /OpenLRC/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 14 | 15 | 20 | 21 | 22 | 23 | 24 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /OpenLRC/bin/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 14 | 15 | 20 | 21 | 22 | 23 | 24 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /OpenLRC/bin/LRCViewTest.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qibin0506/OpenLRC/dbcb18c002a0f356aa25184ebcd9ba5e583aac2f/OpenLRC/bin/LRCViewTest.apk -------------------------------------------------------------------------------- /OpenLRC/bin/OpenLRC.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qibin0506/OpenLRC/dbcb18c002a0f356aa25184ebcd9ba5e583aac2f/OpenLRC/bin/OpenLRC.apk -------------------------------------------------------------------------------- /OpenLRC/bin/classes.dex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qibin0506/OpenLRC/dbcb18c002a0f356aa25184ebcd9ba5e583aac2f/OpenLRC/bin/classes.dex -------------------------------------------------------------------------------- /OpenLRC/bin/classes/org/load/lrcviewtest/BuildConfig.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qibin0506/OpenLRC/dbcb18c002a0f356aa25184ebcd9ba5e583aac2f/OpenLRC/bin/classes/org/load/lrcviewtest/BuildConfig.class -------------------------------------------------------------------------------- /OpenLRC/bin/classes/org/load/lrcviewtest/R$attr.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qibin0506/OpenLRC/dbcb18c002a0f356aa25184ebcd9ba5e583aac2f/OpenLRC/bin/classes/org/load/lrcviewtest/R$attr.class -------------------------------------------------------------------------------- /OpenLRC/bin/classes/org/load/lrcviewtest/R$dimen.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qibin0506/OpenLRC/dbcb18c002a0f356aa25184ebcd9ba5e583aac2f/OpenLRC/bin/classes/org/load/lrcviewtest/R$dimen.class -------------------------------------------------------------------------------- /OpenLRC/bin/classes/org/load/lrcviewtest/R$drawable.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qibin0506/OpenLRC/dbcb18c002a0f356aa25184ebcd9ba5e583aac2f/OpenLRC/bin/classes/org/load/lrcviewtest/R$drawable.class -------------------------------------------------------------------------------- /OpenLRC/bin/classes/org/load/lrcviewtest/R$id.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qibin0506/OpenLRC/dbcb18c002a0f356aa25184ebcd9ba5e583aac2f/OpenLRC/bin/classes/org/load/lrcviewtest/R$id.class -------------------------------------------------------------------------------- /OpenLRC/bin/classes/org/load/lrcviewtest/R$layout.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qibin0506/OpenLRC/dbcb18c002a0f356aa25184ebcd9ba5e583aac2f/OpenLRC/bin/classes/org/load/lrcviewtest/R$layout.class -------------------------------------------------------------------------------- /OpenLRC/bin/classes/org/load/lrcviewtest/R$menu.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qibin0506/OpenLRC/dbcb18c002a0f356aa25184ebcd9ba5e583aac2f/OpenLRC/bin/classes/org/load/lrcviewtest/R$menu.class -------------------------------------------------------------------------------- /OpenLRC/bin/classes/org/load/lrcviewtest/R$string.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qibin0506/OpenLRC/dbcb18c002a0f356aa25184ebcd9ba5e583aac2f/OpenLRC/bin/classes/org/load/lrcviewtest/R$string.class -------------------------------------------------------------------------------- /OpenLRC/bin/classes/org/load/lrcviewtest/R$style.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qibin0506/OpenLRC/dbcb18c002a0f356aa25184ebcd9ba5e583aac2f/OpenLRC/bin/classes/org/load/lrcviewtest/R$style.class -------------------------------------------------------------------------------- /OpenLRC/bin/classes/org/load/lrcviewtest/R$styleable.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qibin0506/OpenLRC/dbcb18c002a0f356aa25184ebcd9ba5e583aac2f/OpenLRC/bin/classes/org/load/lrcviewtest/R$styleable.class -------------------------------------------------------------------------------- /OpenLRC/bin/classes/org/load/lrcviewtest/R.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qibin0506/OpenLRC/dbcb18c002a0f356aa25184ebcd9ba5e583aac2f/OpenLRC/bin/classes/org/load/lrcviewtest/R.class -------------------------------------------------------------------------------- /OpenLRC/bin/classes/org/load/main/MainActivity$PreparedListener$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qibin0506/OpenLRC/dbcb18c002a0f356aa25184ebcd9ba5e583aac2f/OpenLRC/bin/classes/org/load/main/MainActivity$PreparedListener$1.class -------------------------------------------------------------------------------- /OpenLRC/bin/classes/org/load/main/MainActivity$PreparedListener.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qibin0506/OpenLRC/dbcb18c002a0f356aa25184ebcd9ba5e583aac2f/OpenLRC/bin/classes/org/load/main/MainActivity$PreparedListener.class -------------------------------------------------------------------------------- /OpenLRC/bin/classes/org/load/main/MainActivity.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qibin0506/OpenLRC/dbcb18c002a0f356aa25184ebcd9ba5e583aac2f/OpenLRC/bin/classes/org/load/main/MainActivity.class -------------------------------------------------------------------------------- /OpenLRC/bin/classes/org/load/openlrc/LrcView.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qibin0506/OpenLRC/dbcb18c002a0f356aa25184ebcd9ba5e583aac2f/OpenLRC/bin/classes/org/load/openlrc/LrcView.class -------------------------------------------------------------------------------- /OpenLRC/bin/dexedLibs/android-support-v4-607383735c4f31468816d6fbc46a286e.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qibin0506/OpenLRC/dbcb18c002a0f356aa25184ebcd9ba5e583aac2f/OpenLRC/bin/dexedLibs/android-support-v4-607383735c4f31468816d6fbc46a286e.jar -------------------------------------------------------------------------------- /OpenLRC/bin/dexedLibs/android-support-v4-a5c9b7d49427a63f457dfe47151cdc5c.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qibin0506/OpenLRC/dbcb18c002a0f356aa25184ebcd9ba5e583aac2f/OpenLRC/bin/dexedLibs/android-support-v4-a5c9b7d49427a63f457dfe47151cdc5c.jar -------------------------------------------------------------------------------- /OpenLRC/bin/dexedLibs/annotations-561247cd2d35821bbdd9ca81f8607b6a.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qibin0506/OpenLRC/dbcb18c002a0f356aa25184ebcd9ba5e583aac2f/OpenLRC/bin/dexedLibs/annotations-561247cd2d35821bbdd9ca81f8607b6a.jar -------------------------------------------------------------------------------- /OpenLRC/bin/jarlist.cache: -------------------------------------------------------------------------------- 1 | # cache for current jar dependency. DO NOT EDIT. 2 | # format is 3 | # Encoding is UTF-8 4 | -------------------------------------------------------------------------------- /OpenLRC/bin/res/crunch/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qibin0506/OpenLRC/dbcb18c002a0f356aa25184ebcd9ba5e583aac2f/OpenLRC/bin/res/crunch/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /OpenLRC/bin/res/crunch/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qibin0506/OpenLRC/dbcb18c002a0f356aa25184ebcd9ba5e583aac2f/OpenLRC/bin/res/crunch/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /OpenLRC/bin/res/crunch/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qibin0506/OpenLRC/dbcb18c002a0f356aa25184ebcd9ba5e583aac2f/OpenLRC/bin/res/crunch/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /OpenLRC/bin/res/crunch/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qibin0506/OpenLRC/dbcb18c002a0f356aa25184ebcd9ba5e583aac2f/OpenLRC/bin/res/crunch/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /OpenLRC/bin/resources.ap_: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qibin0506/OpenLRC/dbcb18c002a0f356aa25184ebcd9ba5e583aac2f/OpenLRC/bin/resources.ap_ -------------------------------------------------------------------------------- /OpenLRC/gen/org/load/lrcviewtest/BuildConfig.java: -------------------------------------------------------------------------------- 1 | /** Automatically generated file. DO NOT MODIFY */ 2 | package org.load.lrcviewtest; 3 | 4 | public final class BuildConfig { 5 | public final static boolean DEBUG = true; 6 | } -------------------------------------------------------------------------------- /OpenLRC/gen/org/load/lrcviewtest/R.java: -------------------------------------------------------------------------------- 1 | /* AUTO-GENERATED FILE. DO NOT MODIFY. 2 | * 3 | * This class was automatically generated by the 4 | * aapt tool from the resource data it found. It 5 | * should not be modified by hand. 6 | */ 7 | 8 | package org.load.lrcviewtest; 9 | 10 | public final class R { 11 | public static final class attr { 12 | /**

May be a reference to another resource, in the form "@[+][package:]type:name" 13 | or to a theme attribute in the form "?[package:][type:]name". 14 |

May be a color value, in the form of "#rgb", "#argb", 15 | "#rrggbb", or "#aarrggbb". 16 | */ 17 | public static final int currentTextColor=0x7f010002; 18 | /**

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 19 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 20 | in (inches), mm (millimeters). 21 |

This may also be a reference to a resource (in the form 22 | "@[package:]type:name") or 23 | theme attribute (in the form 24 | "?[package:][type:]name") 25 | containing a value of this type. 26 | */ 27 | public static final int dividerHeight=0x7f010003; 28 | /**

May be a reference to another resource, in the form "@[+][package:]type:name" 29 | or to a theme attribute in the form "?[package:][type:]name". 30 |

May be a color value, in the form of "#rgb", "#argb", 31 | "#rrggbb", or "#aarrggbb". 32 | */ 33 | public static final int normalTextColor=0x7f010001; 34 | /**

Must be an integer value, such as "100". 35 |

This may also be a reference to a resource (in the form 36 | "@[package:]type:name") or 37 | theme attribute (in the form 38 | "?[package:][type:]name") 39 | containing a value of this type. 40 | */ 41 | public static final int rows=0x7f010004; 42 | /**

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 43 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 44 | in (inches), mm (millimeters). 45 |

This may also be a reference to a resource (in the form 46 | "@[package:]type:name") or 47 | theme attribute (in the form 48 | "?[package:][type:]name") 49 | containing a value of this type. 50 | */ 51 | public static final int textSize=0x7f010000; 52 | } 53 | public static final class dimen { 54 | /** Default screen margins, per the Android Design guidelines. 55 | 56 | Customize dimensions originally defined in res/values/dimens.xml (such as 57 | screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here. 58 | 59 | */ 60 | public static final int activity_horizontal_margin=0x7f040000; 61 | public static final int activity_vertical_margin=0x7f040001; 62 | } 63 | public static final class drawable { 64 | public static final int ic_launcher=0x7f020000; 65 | } 66 | public static final class id { 67 | public static final int action_settings=0x7f080001; 68 | public static final int lrc=0x7f080000; 69 | } 70 | public static final class layout { 71 | public static final int activity_main=0x7f030000; 72 | } 73 | public static final class menu { 74 | public static final int main=0x7f070000; 75 | } 76 | public static final class string { 77 | public static final int action_settings=0x7f050001; 78 | public static final int app_name=0x7f050000; 79 | public static final int hello_world=0x7f050002; 80 | } 81 | public static final class style { 82 | /** 83 | Base application theme, dependent on API level. This theme is replaced 84 | by AppBaseTheme from res/values-vXX/styles.xml on newer devices. 85 | 86 | 87 | Theme customizations available in newer API levels can go in 88 | res/values-vXX/styles.xml, while customizations related to 89 | backward-compatibility can go here. 90 | 91 | 92 | Base application theme for API 11+. This theme completely replaces 93 | AppBaseTheme from res/values/styles.xml on API 11+ devices. 94 | 95 | API 11 theme customizations can go here. 96 | 97 | Base application theme for API 14+. This theme completely replaces 98 | AppBaseTheme from BOTH res/values/styles.xml and 99 | res/values-v11/styles.xml on API 14+ devices. 100 | 101 | API 14 theme customizations can go here. 102 | */ 103 | public static final int AppBaseTheme=0x7f060000; 104 | /** Application theme. 105 | All customizations that are NOT specific to a particular API-level can go here. 106 | */ 107 | public static final int AppTheme=0x7f060001; 108 | } 109 | public static final class styleable { 110 | /** Attributes that can be used with a Lrc. 111 |

Includes the following attributes:

112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 |
AttributeDescription
{@link #Lrc_currentTextColor org.load.lrcviewtest:currentTextColor}
{@link #Lrc_dividerHeight org.load.lrcviewtest:dividerHeight}
{@link #Lrc_normalTextColor org.load.lrcviewtest:normalTextColor}
{@link #Lrc_rows org.load.lrcviewtest:rows}
{@link #Lrc_textSize org.load.lrcviewtest:textSize}
122 | @see #Lrc_currentTextColor 123 | @see #Lrc_dividerHeight 124 | @see #Lrc_normalTextColor 125 | @see #Lrc_rows 126 | @see #Lrc_textSize 127 | */ 128 | public static final int[] Lrc = { 129 | 0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003, 130 | 0x7f010004 131 | }; 132 | /** 133 |

This symbol is the offset where the {@link org.load.lrcviewtest.R.attr#currentTextColor} 134 | attribute's value can be found in the {@link #Lrc} array. 135 | 136 | 137 |

May be a reference to another resource, in the form "@[+][package:]type:name" 138 | or to a theme attribute in the form "?[package:][type:]name". 139 |

May be a color value, in the form of "#rgb", "#argb", 140 | "#rrggbb", or "#aarrggbb". 141 | @attr name org.load.lrcviewtest:currentTextColor 142 | */ 143 | public static final int Lrc_currentTextColor = 2; 144 | /** 145 |

This symbol is the offset where the {@link org.load.lrcviewtest.R.attr#dividerHeight} 146 | attribute's value can be found in the {@link #Lrc} array. 147 | 148 | 149 |

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 150 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 151 | in (inches), mm (millimeters). 152 |

This may also be a reference to a resource (in the form 153 | "@[package:]type:name") or 154 | theme attribute (in the form 155 | "?[package:][type:]name") 156 | containing a value of this type. 157 | @attr name org.load.lrcviewtest:dividerHeight 158 | */ 159 | public static final int Lrc_dividerHeight = 3; 160 | /** 161 |

This symbol is the offset where the {@link org.load.lrcviewtest.R.attr#normalTextColor} 162 | attribute's value can be found in the {@link #Lrc} array. 163 | 164 | 165 |

May be a reference to another resource, in the form "@[+][package:]type:name" 166 | or to a theme attribute in the form "?[package:][type:]name". 167 |

May be a color value, in the form of "#rgb", "#argb", 168 | "#rrggbb", or "#aarrggbb". 169 | @attr name org.load.lrcviewtest:normalTextColor 170 | */ 171 | public static final int Lrc_normalTextColor = 1; 172 | /** 173 |

This symbol is the offset where the {@link org.load.lrcviewtest.R.attr#rows} 174 | attribute's value can be found in the {@link #Lrc} array. 175 | 176 | 177 |

Must be an integer value, such as "100". 178 |

This may also be a reference to a resource (in the form 179 | "@[package:]type:name") or 180 | theme attribute (in the form 181 | "?[package:][type:]name") 182 | containing a value of this type. 183 | @attr name org.load.lrcviewtest:rows 184 | */ 185 | public static final int Lrc_rows = 4; 186 | /** 187 |

This symbol is the offset where the {@link org.load.lrcviewtest.R.attr#textSize} 188 | attribute's value can be found in the {@link #Lrc} array. 189 | 190 | 191 |

Must be a dimension value, which is a floating point number appended with a unit such as "14.5sp". 192 | Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), 193 | in (inches), mm (millimeters). 194 |

This may also be a reference to a resource (in the form 195 | "@[package:]type:name") or 196 | theme attribute (in the form 197 | "?[package:][type:]name") 198 | containing a value of this type. 199 | @attr name org.load.lrcviewtest:textSize 200 | */ 201 | public static final int Lrc_textSize = 0; 202 | }; 203 | } 204 | -------------------------------------------------------------------------------- /OpenLRC/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qibin0506/OpenLRC/dbcb18c002a0f356aa25184ebcd9ba5e583aac2f/OpenLRC/ic_launcher-web.png -------------------------------------------------------------------------------- /OpenLRC/libs/android-support-v4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qibin0506/OpenLRC/dbcb18c002a0f356aa25184ebcd9ba5e583aac2f/OpenLRC/libs/android-support-v4.jar -------------------------------------------------------------------------------- /OpenLRC/proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /OpenLRC/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-14 15 | -------------------------------------------------------------------------------- /OpenLRC/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qibin0506/OpenLRC/dbcb18c002a0f356aa25184ebcd9ba5e583aac2f/OpenLRC/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /OpenLRC/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qibin0506/OpenLRC/dbcb18c002a0f356aa25184ebcd9ba5e583aac2f/OpenLRC/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /OpenLRC/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qibin0506/OpenLRC/dbcb18c002a0f356aa25184ebcd9ba5e583aac2f/OpenLRC/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /OpenLRC/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qibin0506/OpenLRC/dbcb18c002a0f356aa25184ebcd9ba5e583aac2f/OpenLRC/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /OpenLRC/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 21 | 22 | -------------------------------------------------------------------------------- /OpenLRC/res/menu/main.xml: -------------------------------------------------------------------------------- 1 |

2 | 3 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /OpenLRC/res/values-sw600dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /OpenLRC/res/values-sw720dp-land/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 128dp 8 | 9 | 10 | -------------------------------------------------------------------------------- /OpenLRC/res/values-v11/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /OpenLRC/res/values-v14/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /OpenLRC/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /OpenLRC/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16dp 5 | 16dp 6 | 7 | 8 | -------------------------------------------------------------------------------- /OpenLRC/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | OpenLRC 5 | Settings 6 | Hello world! 7 | 8 | 9 | -------------------------------------------------------------------------------- /OpenLRC/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 14 | 15 | 16 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /OpenLRC/src/org/load/main/MainActivity.java: -------------------------------------------------------------------------------- 1 | package org.load.main; 2 | 3 | import java.io.File; 4 | 5 | import org.load.lrcviewtest.R; 6 | import org.load.openlrc.LrcView; 7 | 8 | import android.app.Activity; 9 | import android.graphics.BitmapFactory; 10 | import android.media.MediaPlayer; 11 | import android.media.MediaPlayer.OnPreparedListener; 12 | import android.os.Bundle; 13 | import android.os.Environment; 14 | 15 | public class MainActivity extends Activity { 16 | private LrcView mLrc; 17 | private MediaPlayer mPlayer; 18 | private String mDir = Environment.getExternalStorageDirectory() + File.separator + "Download" + File.separator; 19 | 20 | @Override 21 | protected void onCreate(Bundle savedInstanceState) { 22 | super.onCreate(savedInstanceState); 23 | setContentView(R.layout.activity_main); 24 | 25 | // 歌曲路径 26 | String music = mDir + "1.mp3"; 27 | // 歌词路径 28 | String lrc = mDir + "1.lrc"; 29 | 30 | mLrc = (LrcView) findViewById(R.id.lrc); 31 | // 设置背景图片 32 | // 可以选择不设置 33 | // 最好是在真个屏幕设置该图片 34 | // 那样更好看 35 | mLrc.setBackground(BitmapFactory.decodeFile(mDir + "1.png")); 36 | 37 | mPlayer = new MediaPlayer(); 38 | try { 39 | mPlayer.setDataSource(music); 40 | mPlayer.setOnPreparedListener(new PreparedListener()); 41 | mPlayer.prepareAsync(); 42 | 43 | // 设置lrc的路径 44 | mLrc.setLrcPath(lrc); 45 | } catch (Exception e) { 46 | e.printStackTrace(); 47 | } 48 | } 49 | 50 | private class PreparedListener implements OnPreparedListener { 51 | @Override 52 | public void onPrepared(MediaPlayer mp) { 53 | 54 | mPlayer.start(); 55 | new Thread(new Runnable() { 56 | @Override 57 | public void run() { 58 | // 当歌曲还在播放时 59 | // 就一直调用changeCurrent方法 60 | // 虽然一直调用, 但界面不会一直刷新 61 | // 只有当唱到下一句时才刷新 62 | while(mPlayer.isPlaying()) { 63 | // 调用changeCurrent方法, 参数是当前播放的位置 64 | // LrcView会自动判断需不需要下一行 65 | mLrc.changeCurrent(mPlayer.getCurrentPosition()); 66 | 67 | // 当然这里还是要睡一会的啦 68 | try { 69 | Thread.sleep(100); 70 | } catch (InterruptedException e) { 71 | e.printStackTrace(); 72 | } 73 | } 74 | } 75 | }).start(); 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /OpenLRC/src/org/load/openlrc/LrcView.java: -------------------------------------------------------------------------------- 1 | package org.load.openlrc; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.File; 5 | import java.io.FileInputStream; 6 | import java.io.InputStreamReader; 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | import java.util.regex.Matcher; 10 | import java.util.regex.Pattern; 11 | 12 | import org.load.lrcviewtest.R; 13 | 14 | import android.annotation.SuppressLint; 15 | import android.content.Context; 16 | import android.content.res.TypedArray; 17 | import android.graphics.Bitmap; 18 | import android.graphics.Canvas; 19 | import android.graphics.Paint; 20 | import android.util.AttributeSet; 21 | import android.view.View; 22 | 23 | /** 24 | * 显示lrc歌词控件 25 | * @author 亓斌 (qibin@gmail.com) 26 | */ 27 | @SuppressLint("DrawAllocation") 28 | public class LrcView extends View { 29 | private List mLrcs = new ArrayList(); // 存放歌词 30 | private List mTimes = new ArrayList(); // 存放时间 31 | 32 | private long mNextTime = 0l; // 保存下一句开始的时间 33 | 34 | private int mViewWidth; // view的宽度 35 | private int mLrcHeight; // lrc界面的高度 36 | private int mRows; // 多少行 37 | private int mCurrentLine = 0; // 当前行 38 | 39 | private float mTextSize; // 字体 40 | private float mDividerHeight; // 行间距 41 | 42 | private Paint mNormalPaint; // 常规的字体 43 | private Paint mCurrentPaint; // 当前歌词的大小 44 | 45 | private Bitmap mBackground = null; 46 | 47 | public LrcView(Context context, AttributeSet attrs) { 48 | super(context, attrs); 49 | initViews(attrs); 50 | } 51 | 52 | public LrcView(Context context, AttributeSet attrs, int defStyleAttr) { 53 | super(context, attrs, defStyleAttr); 54 | initViews(attrs); 55 | } 56 | 57 | // 初始化操作 58 | private void initViews(AttributeSet attrs) { 59 | // 60 | // 解析自定义属性 61 | TypedArray ta = getContext().obtainStyledAttributes(attrs, 62 | R.styleable.Lrc); 63 | mTextSize = ta.getDimension(R.styleable.Lrc_textSize, 50.0f); 64 | mRows = ta.getInteger(R.styleable.Lrc_rows, 5); 65 | mDividerHeight = ta.getDimension(R.styleable.Lrc_dividerHeight, 0.0f); 66 | 67 | int normalTextColor = ta.getColor(R.styleable.Lrc_normalTextColor, 68 | 0xffffffff); 69 | int currentTextColor = ta.getColor(R.styleable.Lrc_currentTextColor, 70 | 0xff00ffde); 71 | 72 | ta.recycle(); 73 | // 74 | 75 | // 计算lrc面板的高度 76 | mLrcHeight = (int) (mTextSize + mDividerHeight) * mRows + 5; 77 | 78 | mNormalPaint = new Paint(); 79 | mCurrentPaint = new Paint(); 80 | 81 | // 初始化paint 82 | mNormalPaint.setTextSize(mTextSize); 83 | mNormalPaint.setColor(normalTextColor); 84 | mCurrentPaint.setTextSize(mTextSize); 85 | mCurrentPaint.setColor(currentTextColor); 86 | } 87 | 88 | @Override 89 | protected void onSizeChanged(int w, int h, int oldw, int oldh) { 90 | // 获取view宽度 91 | mViewWidth = getMeasuredWidth(); 92 | super.onSizeChanged(w, h, oldw, oldh); 93 | } 94 | 95 | @Override 96 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 97 | super.onMeasure(widthMeasureSpec, heightMeasureSpec); 98 | // 重新设置view的高度 99 | int measuredHeight = MeasureSpec.makeMeasureSpec(mLrcHeight, MeasureSpec.AT_MOST); 100 | setMeasuredDimension(widthMeasureSpec, measuredHeight); 101 | } 102 | 103 | @Override 104 | protected void onDraw(Canvas canvas) { 105 | super.onDraw(canvas); 106 | if (mLrcs.isEmpty() || mTimes.isEmpty()) { 107 | return; 108 | } 109 | 110 | canvas.save(); 111 | // 圈出可视区域 112 | canvas.clipRect(0, 0, mViewWidth, mLrcHeight); 113 | 114 | if (null != mBackground) { 115 | canvas.drawBitmap(Bitmap.createScaledBitmap(mBackground, mViewWidth, mLrcHeight, true), 116 | new android.graphics.Matrix(), null); 117 | } 118 | 119 | // 将画布上移 120 | canvas.translate(0, -((mCurrentLine - 3) * (mTextSize + mDividerHeight))); 121 | 122 | // 画当前行上面的 123 | for (int i = mCurrentLine - 1; i >= 0; i--) { 124 | String lrc = mLrcs.get(i); 125 | float x = (mViewWidth - mNormalPaint.measureText(lrc)) / 2; 126 | canvas.drawText(lrc, x, (mTextSize + mDividerHeight) * i,mNormalPaint); 127 | } 128 | 129 | String currentLrc = mLrcs.get(mCurrentLine); 130 | float currentX = (mViewWidth - mCurrentPaint.measureText(currentLrc)) / 2; 131 | // 画当前行 132 | canvas.drawText(currentLrc, currentX, (mTextSize + mDividerHeight)* mCurrentLine, mCurrentPaint); 133 | 134 | // 画当前行下面的 135 | for (int i = mCurrentLine + 1; i < mLrcs.size(); i++) { 136 | String lrc = mLrcs.get(i); 137 | float x = (mViewWidth - mNormalPaint.measureText(lrc)) / 2; 138 | canvas.drawText(lrc, x, (mTextSize + mDividerHeight) * i, mNormalPaint); 139 | } 140 | 141 | canvas.restore(); 142 | } 143 | 144 | // 解析时间 145 | private Long parseTime(String time) { 146 | // 03:02.12 147 | String[] min = time.split(":"); 148 | String[] sec = min[1].split("\\."); 149 | 150 | long minInt = Long.parseLong(min[0].replaceAll("\\D+", "") 151 | .replaceAll("\r", "").replaceAll("\n", "").trim()); 152 | long secInt = Long.parseLong(sec[0].replaceAll("\\D+", "") 153 | .replaceAll("\r", "").replaceAll("\n", "").trim()); 154 | long milInt = Long.parseLong(sec[1].replaceAll("\\D+", "") 155 | .replaceAll("\r", "").replaceAll("\n", "").trim()); 156 | 157 | return minInt * 60 * 1000 + secInt * 1000 + milInt * 10; 158 | } 159 | 160 | // 解析每行 161 | private String[] parseLine(String line) { 162 | Matcher matcher = Pattern.compile("\\[.+\\].+").matcher(line); 163 | // 如果形如:[xxx]后面啥也没有的,则return空 164 | if (!matcher.matches()) { 165 | System.out.println("throws " + line); 166 | return null; 167 | } 168 | 169 | line = line.replaceAll("\\[", ""); 170 | String[] result = line.split("\\]"); 171 | result[0] = String.valueOf(parseTime(result[0])); 172 | 173 | return result; 174 | } 175 | 176 | // 外部提供方法 177 | // 传入当前播放时间 178 | public synchronized void changeCurrent(long time) { 179 | // 如果当前时间小于下一句开始的时间 180 | // 直接return 181 | if (mNextTime > time) { 182 | return; 183 | } 184 | 185 | // 每次进来都遍历存放的时间 186 | for (int i = 0; i < mTimes.size(); i++) { 187 | // 发现这个时间大于传进来的时间 188 | // 那么现在就应该显示这个时间前面的对应的那一行 189 | // 每次都重新显示,是不是要判断:现在正在显示就不刷新了 190 | if (mTimes.get(i) > time && i >= mCurrentLine + 1) { 191 | System.out.println("换"); 192 | mNextTime = mTimes.get(i); 193 | mCurrentLine = i <= 1 ? 0 : i - 1; 194 | postInvalidate(); 195 | break; 196 | } 197 | } 198 | } 199 | 200 | // 外部提供方法 201 | // 设置lrc的路径 202 | public void setLrcPath(String path) throws Exception { 203 | mLrcs.clear(); 204 | File file = new File(path); 205 | if (!file.exists()) { 206 | throw new Exception("lrc not found..."); 207 | } 208 | 209 | BufferedReader reader = new BufferedReader(new InputStreamReader( 210 | new FileInputStream(file))); 211 | 212 | String line = ""; 213 | String[] arr; 214 | while (null != (line = reader.readLine())) { 215 | arr = parseLine(line); 216 | if (null == arr) { 217 | continue; 218 | } 219 | 220 | // 如果解析出来只有一个 221 | if (1 == arr.length) { 222 | String last = mLrcs.remove(mLrcs.size() - 1); 223 | mLrcs.add(last + arr[0]); 224 | continue; 225 | } 226 | mTimes.add(Long.parseLong(arr[0])); 227 | mLrcs.add(arr[1]); 228 | } 229 | 230 | reader.close(); 231 | } 232 | 233 | // 外部提供方法 234 | // 设置背景图片 235 | public void setBackground(Bitmap bmp) { 236 | mBackground = bmp; 237 | } 238 | } 239 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | OpenLRC 2 | ======= 3 | ##注意:新版本的控件支持歌词的滑动 4 | ## [可以到这里下载](https://github.com/qibin0506/LitePlayer) 5 | 6 | 一个可以在android下显示歌词的控件 7 | 可以设置歌词字体大小,当前行歌词的颜色、其他行歌词的颜色、行间距等。 8 | 9 | 10 | ![image](https://github.com/qibin0506/OpenLRC/blob/master/show/show.png) 11 | 12 | 13 | 使用方法: 14 | 15 | 1、xml布局: 16 | 24 | 25 | 36 | 37 | 38 | 39 | 2、在activity中使用: 40 | 41 | public class MainActivity extends Activity { 42 | private LrcView mLrc; 43 | private MediaPlayer mPlayer; 44 | private String mDir = Environment.getExternalStorageDirectory() + File.separator + "Download" + File.separator; 45 | 46 | @Override 47 | protected void onCreate(Bundle savedInstanceState) { 48 | super.onCreate(savedInstanceState); 49 | setContentView(R.layout.activity_main); 50 | 51 | // 歌曲路径 52 | String music = mDir + "1.mp3"; 53 | // 歌词路径 54 | String lrc = mDir + "1.lrc"; 55 | 56 | mLrc = (LrcView) findViewById(R.id.lrc); 57 | // 设置背景图片 58 | // 可以选择不设置 59 | // 最好是在真个屏幕设置该图片 60 | // 那样更好看 61 | mLrc.setBackground(BitmapFactory.decodeFile(mDir + "1.png")); 62 | 63 | mPlayer = new MediaPlayer(); 64 | try { 65 | mPlayer.setDataSource(music); 66 | mPlayer.setOnPreparedListener(new PreparedListener()); 67 | mPlayer.prepareAsync(); 68 | 69 | // 设置lrc的路径 70 | mLrc.setLrcPath(lrc); 71 | } catch (Exception e) { 72 | e.printStackTrace(); 73 | } 74 | } 75 | 76 | private class PreparedListener implements OnPreparedListener { 77 | @Override 78 | public void onPrepared(MediaPlayer mp) { 79 | 80 | mPlayer.start(); 81 | new Thread(new Runnable() { 82 | @Override 83 | public void run() { 84 | // 当歌曲还在播放时 85 | // 就一直调用changeCurrent方法 86 | // 虽然一直调用, 但界面不会一直刷新 87 | // 只有当唱到下一句时才刷新 88 | while(mPlayer.isPlaying()) { 89 | // 调用changeCurrent方法, 参数是当前播放的位置 90 | // LrcView会自动判断需不需要下一行 91 | mLrc.changeCurrent(mPlayer.getCurrentPosition()); 92 | 93 | // 当然这里还是要睡一会的啦 94 | try { 95 | Thread.sleep(100); 96 | } catch (InterruptedException e) { 97 | e.printStackTrace(); 98 | } 99 | } 100 | } 101 | }).start(); 102 | } 103 | } 104 | } 105 | 106 | -------------------------------------------------------------------------------- /show/show.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qibin0506/OpenLRC/dbcb18c002a0f356aa25184ebcd9ba5e583aac2f/show/show.png --------------------------------------------------------------------------------