Android Open Source online music player _android

Source: Internet
Author: User
Tags drawtext

Cover Chart:

Brief introduction

    1. The Wave music is an open source Android online music player.
    2. Play local music and online music
    3. Online music charts, such as hot songs, new songs, etc.
    4. Gao Music's vinyl album cover
    5. Lyrics Show, automatically search lyrics
    6. Night mode
    7. Timed shutdown

Update description
v 1.0
I release

Todo

Online music can be downloaded and added to my music list
Online music Automatic Caching
Edit Music Information

Project Disclosure API
Online music: Baidu Music
Weather data: German map

Open Source Technology

Okhttp-utils
Android-universal-image-loader

Critical code

Black Gum album cover drawing process

@Override protected void OnDraw (Canvas Canvas) {//1. Draw the top dotted line mtopline.setbounds (0, GetTop (), getwidth (), GetTop () + M
  Toplineheight);
  Mtopline.draw (canvas); 2. Draw the black vinyl record outside the translucent border mcoverborder.setbounds (Mdiscpoint.x-mcoverborderwidth, Mdiscpoint.y-mcoverborderwidth, MDis Cpoint.x + mdiscbitmap.getwidth () + mcoverborderwidth, Mdiscpoint.y + mdiscbitmap.getheight () + MCoverBorderWidt
  h);
  Mcoverborder.draw (canvas); 3. Draw black glue//Set rotation center and rotation angle, setrotate and pretranslate order is important mdiscmatrix.setrotate (Mdiscrotation, Mdisccenterpoint.x,
  MDISCCENTERPOINT.Y);
  Set Picture start coordinates mdiscmatrix.pretranslate (mdiscpoint.x, MDISCPOINT.Y);
  Canvas.drawbitmap (Mdiscbitmap, Mdiscmatrix, NULL);
  4. Draw cover Mcovermatrix.setrotate (Mdiscrotation, Mcovercenterpoint.x, MCOVERCENTERPOINT.Y);
  Mcovermatrix.pretranslate (Mcoverpoint.x, MCOVERPOINT.Y);
  Canvas.drawbitmap (Mcoverbitmap, Mcovermatrix, NULL); 5. Draw the pointer mneedlematrix.setrotate (mneedlerotation, Mneedlecenterpoint.x, MneedlecenteRPOINT.Y);
  Mneedlematrix.pretranslate (Mneedlepoint.x, MNEEDLEPOINT.Y);
Canvas.drawbitmap (Mneedlebitmap, Mneedlematrix, NULL);

 }

Lyrics drawing Process

@Override protected void OnDraw (Canvas Canvas) {Super.ondraw (Canvas);
 
  Center y coordinate Float centery = getheight ()/2 + MTEXTSIZE/2 + manimoffset;
    No lyrics file if (!HASLRC ()) {Float CenterX = (getwidth ()-mcurrentpaint.measuretext (label))/2;
    Canvas.drawtext (Label, CenterX, CenterY, Mcurrentpaint);
  Return
  ///Draw Current line String currstr = Mlrctexts.get (mcurrentline);
  float Currx = (getwidth ()-Mcurrentpaint.measuretext (CURRSTR))/2;
 
  Canvas.drawtext (Currstr, Currx, CenterY, Mcurrentpaint);
    Draws the for (int i = mCurrentLine-1 i >= 0; i--) {String upstr = mlrctexts.get (i) above the current line;
    float UpX = (getwidth ()-Mnormalpaint.measuretext (UPSTR))/2;
    float upy = centery-(mtextsize + mdividerheight) * (mcurrentline-i);
    Out of screen stop drawing if (Upy-mtextsize < 0) {break;
  } canvas.drawtext (Upstr, UpX, Upy, Mnormalpaint); //To draw the for (int i = mcurrentline + 1; i < mlrctimes.size (); i++) {String downstr = MLRCTexts.get (i);
    float Downx = (getwidth ()-Mnormalpaint.measuretext (DOWNSTR))/2;
    Float DownY = centery + (mtextsize + mdividerheight) * (I-mcurrentline);
    Out of screen stop drawing if (DownY > GetHeight ()) {break;
  } canvas.drawtext (Downstr, Downx, DownY, Mnormalpaint);

 }
}

Above is the Android open source online music player data collation, follow-up continue to supplement the relevant information, thank you for the support of this site!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.