GithubHelp home page GithubHelp logo

lyricview's Introduction

LyricView

中文版 readme

download demo apk.

Blog Introduce: https://www.jianshu.com/p/ab735509cc74

Screenshots

screenshot screenshot

Download

    all projects {
	    repositories {
		    ...
		    maven { url 'https://jitpack.io' }
	    }
	}

    dependencies {
    	        implementation 'com.github.Lauzy:LyricView:VERSION_CODE'
    	}

The latest version code is here.

Usage

Xml file:

       <com.lauzy.freedom.library.LrcView
            ...
            app:currentIndicateLrcColor="@color/colorAccent"
            app:indicatorTextColor="@android:color/holo_orange_dark"
            app:playIcon="@drawable/play_music"/>

Functions:

Parse lyric and set lyric data:

      From file:
      List<Lrc> lrcs = LrcHelper.parseLrcFromFile(file);

      From asset:
      List<Lrc> lrcs = LrcHelper.parseLrcFromAssets(context, assetFileName);

      Set lyric datamLrcView.setLrcData(lrcs);

Update the lyric according to playing process:

      mLrcView.updateTime(mMediaPlayer.getCurrentPosition());

Seek to a specific time by indicator:

      mLrcView.setOnPlayIndicatorLineListener(new LrcView.OnPlayIndicatorLineListener() {
                 @Override
                 public void onPlay(long time, String content) {
                     mMediaPlayer.seekTo((int) time);
                 }
             });

Set the description while there is no lyric data:

     mLrcView.setEmptyContent("no data");

Attributes:

        <attr name="lrcTextSize" format="dimension"/>
        <attr name="lrcLineSpaceSize" format="dimension"/>
        <attr name="lrcNormalTextColor" format="reference|color"/>
        <attr name="lrcCurrentTextColor" format="reference|color"/>
        <attr name="lrcTouchDelay" format="integer"/>   //delay of rolling back
        <attr name="noLrcTextSize" format="dimension"/>
        <attr name="noLrcTextColor" format="reference|color"/>
        <attr name="indicatorLineHeight" format="dimension"/>
        <attr name="indicatorTextSize" format="dimension"/>
        <attr name="indicatorTextColor" format="reference|color"/>
        <attr name="currentIndicateLrcColor" format="reference|color"/> //current lyric line color
        <attr name="indicatorTouchDelay" format="integer"/>    //delay of indicator's disappearance
        <attr name="indicatorLineColor" format="reference|color"/> // color of indicator line
        <attr name="indicatorStartEndMargin" format="dimension"/>  //start and end margin of indicator
        <attr name="iconLineGap" format="dimension"/>   // space between indicator's playing icon and line
        <attr name="playIconWidth" format="dimension"/>
        <attr name="playIconHeight" format="dimension"/>
        <attr name="playIcon" format="reference"/>   // indicator's playing icon

License

Copyright (c) 2017-present Lauzy

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.

lyricview's People

Contributors

lauzy avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.