Skip to content

Commit

Permalink
move to the new gradle build system
Browse files Browse the repository at this point in the history
  • Loading branch information
cqr committed May 20, 2013
1 parent 88da0e7 commit 4103191
Show file tree
Hide file tree
Showing 104 changed files with 51 additions and 111 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -6,3 +6,5 @@ local.properties
.project
.classpath
.DS_Store
.gradle
build
17 changes: 17 additions & 0 deletions build.gradle
@@ -0,0 +1,17 @@
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4'
}
}
apply plugin: 'android-library'

dependencies {
}

android {
buildToolsVersion "17"
compileSdkVersion 16
}
85 changes: 0 additions & 85 deletions build.xml

This file was deleted.

Binary file removed res/drawable-hdpi/.DS_Store
Binary file not shown.
File renamed without changes.
File renamed without changes.
Expand Up @@ -31,6 +31,8 @@ public class LockScreenControlsPlugin extends AudioFocusPlugin {

private RemoteControlClient mRemoteControlClient;
private Bitmap mAlbumArt;
private String mArtist;
private String mTitle;

private int mTransportControlFlags = RemoteControlClient.FLAG_KEY_MEDIA_PLAY_PAUSE
| RemoteControlClient.FLAG_KEY_MEDIA_STOP
Expand Down Expand Up @@ -66,15 +68,8 @@ public void onSongChanged(Song song) {
onAlbumArtChangedToUri(song.getAlbumArt());
}

getRemoteControlClient()
.editMetadata(true)
.putString(MediaMetadataRetriever.METADATA_KEY_TITLE,
song.getTitle())
.putString(MediaMetadataRetriever.METADATA_KEY_ARTIST,
song.getArtist())
.putBitmap(
RemoteControlClient.MetadataEditor.BITMAP_KEY_ARTWORK,
mAlbumArt).apply();
onTitleChanged(song.getTitle());
onArtistChanged(song.getArtist());
}

@Override
Expand All @@ -86,24 +81,21 @@ public void onAudioStopped() {

@Override
public void onTitleChanged(String title) {
getRemoteControlClient().editMetadata(false)
.putString(MediaMetadataRetriever.METADATA_KEY_TITLE, title)
.apply();
mTitle = title;
}

@Override
public void onArtistChanged(String artist) {
getRemoteControlClient().editMetadata(false)
.putString(MediaMetadataRetriever.METADATA_KEY_ARTIST, artist)
.apply();
mArtist = artist;
}

@Override
public void onAlbumArtChanged(int resourceId) {
if (getContext() != null) {
mAlbumArt = BitmapFactory.decodeResource(getContext()
.getResources(), resourceId);
}
mAlbumArt = BitmapFactory.decodeResource(getContext().getResources(),
resourceId);
getRemoteControlClient().editMetadata(false).putBitmap(
RemoteControlClient.MetadataEditor.BITMAP_KEY_ARTWORK,
mAlbumArt);
}

@Override
Expand All @@ -112,6 +104,17 @@ public void onAlbumArtChangedToUri(Uri url) {

}

@Override
public void onChangesComplete() {
getRemoteControlClient()
.editMetadata(false)
.putString(MediaMetadataRetriever.METADATA_KEY_TITLE, mTitle)
.putString(MediaMetadataRetriever.METADATA_KEY_ARTIST, mArtist)
.putBitmap(
RemoteControlClient.MetadataEditor.BITMAP_KEY_ARTWORK,
mAlbumArt).apply();
}

private RemoteControlClient getRemoteControlClient() {
if (mRemoteControlClient == null) {
Intent mediaButtonIntent = new Intent(Intent.ACTION_MEDIA_BUTTON);
Expand Down
Expand Up @@ -132,27 +132,31 @@ private void songOrderChanged() {
}

private void songOrderChanged(boolean notify) {
songOrderChanged(notify, notify);
}

private void songOrderChanged(boolean notifyCurrent, boolean notifyNext) {
if (mSongs.size() > 0) {
if (getPlayheadPosition() == -1) {
setPlayheadPosition(1);
}

if (mCurrentSongWas == null || mCurrentSongWas != getNowPlaying()) {
currentSongChanged(notify);
currentSongChanged(notifyCurrent);
}
if (mSongs.size() > 1) {
if (mNextSongWas == null || mNextSongWas != peekNextSong()) {
nextSongChanged(notify);
nextSongChanged(notifyNext);
}
} else if (mNextSongWas != null) {
nextSongChanged(notify);
nextSongChanged(notifyNext);
}
} else {
if (mCurrentSongWas != null) {
currentSongChanged(notify);
currentSongChanged(notifyCurrent);
}
if (mNextSongWas != null) {
nextSongChanged(notify);
nextSongChanged(notifyNext);
}
}
}
Expand Down Expand Up @@ -236,8 +240,7 @@ public synchronized void forward() {
if (getPlayheadPosition() > mSongs.size()) {
setPlayheadPosition(1);
}
mCurrentSongWas = getNowPlaying();
nextSongChanged(true);
songOrderChanged(false, true);
}

public synchronized Song next(boolean notifyChanges) {
Expand Down
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 4103191

Please sign in to comment.