Giter VIP home page Giter VIP logo

lyricview's Introduction

LyricView

Demo

A netease-music-like scrolling lyric view.

Features

  • Parsing .lrc file
  • Auto scrolling
  • Text highlight
  • Manual progress select
  • Multi-language display
  • Karaoke effect

Usage

Copy module lrcparser and uilibrary to your project.

Declare it like this in your XML:

  <me.zhehua.uilibrary.LyricView
        android:id="@+id/lv_main"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#212121"/>

And call this to initialize the view in OnCreate():

  mLyricView = (LyricView) findViewById(R.id.lv_main);
  InputStream lrcStream = getResources().openRawResource(R.raw.sample);
  try {
      LyricAdapter lyric = new SimpleLyricAdapter(lrcStream);
      lrcStream.close();
      mLyricView.setLyricAdapter(lyric);
  } catch (IOException e) {
      e.printStackTrace();
  }

Or you can use DoubleLyricAdatper initialized with two streams to show a two-way display lyric view.

If no adpter fits your need, use a custom adatper extending LyricAdapter.

When setLyricAdapter() is called, the lyric view starts to build.

Then call

  mLyricView.startScroll();

to start the scroll.

Be careful that you have to call this after the view in activity is shown.

It's safe to call this in Activity#onWindowFocusChanged(boolean).

If you're not sure about this, get the proper time by calling:

    mLyricView.setReadyListener(new LyricView.OnLyricReadyListener() {
            @Override
            public void onReady(View view) {
                do something...
            }
        });

Contribute

Thanks a lot for contribute to this repo by coding or issues. New PRs on develop branch please~

License

Copyright 2016 Zhehua Zhang

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

zhehuaz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

winterdl saytoonz

lyricview's Issues

How can I synchronise the lyrics with the music?

Hello I'm Sagnik Ganguly, well nothing to say so much as you can see my question is same as the title. I've seen that the library uses a ValueAnimator instead of currently playing music duration so what I want to do is sync the lyrics with the music also I want to control the speed of the lyrics.

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.