Fix for Bluetooth notification, updated French notifiication

This commit is contained in:
Joshua Bahnsen 2013-04-28 11:37:40 -07:00
parent ca0dd2f547
commit fdc4725389
7 changed files with 135 additions and 60 deletions

View File

@ -8,6 +8,6 @@
# project structure.
# Project target.
target=android-16
target=android-17
android.library.reference.1=android-menudrawer-master\\library
android.library.reference.2=Android-PullToRefresh/library

View File

@ -1,10 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/statusbar"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="fill_parent"
@ -110,4 +109,4 @@
android:src="@drawable/media_forward_normal_dark" />
</LinearLayout>
</LinearLayout>
</FrameLayout>

View File

@ -44,7 +44,7 @@
<string name="menu.exit">Quitter</string>
<string name="menu.settings">Paramètres</string>
<string name="menu.help">Aide</string>
<string name="menu.about">Sur</string>
<string name="menu.about">À propos</string>
<string name="menu.search">Recherche</string>
<string name="menu.navigation">Navigation</string>
<string name="menu.common">Général</string>

View File

@ -745,7 +745,12 @@ public class SelectAlbumActivity extends SubsonicTabActivity {
}
if (entry.getArtist() != null) {
totalDuration += entry.getDuration();
Integer duration = entry.getDuration();
if (duration != null) {
totalDuration += duration;
}
artists.add(entry.getArtist());
}

View File

@ -8,40 +8,61 @@ import android.content.Context;
import android.content.Intent;
public class A2dpIntentReceiver extends BroadcastReceiver {
private static final String PLAYSTATUS_REQUEST = "com.android.music.playstatusrequest";
private static final String PLAYSTATUS_RESPONSE = "com.android.music.playstatusresponse";
private static final String PLAYSTATUS_RESPONSE = "com.android.music.playstatusresponse";
@Override
public void onReceive(Context context, Intent intent) {
DownloadService downloadService = DownloadServiceImpl.getInstance();
if (downloadService != null){
Intent avrcpIntent = new Intent(PLAYSTATUS_RESPONSE);
avrcpIntent.putExtra("duration", (long) downloadService.getCurrentPlaying().getSong().getDuration());
avrcpIntent.putExtra("position", (long) downloadService.getPlayerPosition());
avrcpIntent.putExtra("ListSize", (long) downloadService.getDownloads().size());
switch (downloadService.getPlayerState()){
case STARTED:
avrcpIntent.putExtra("playing", true);
break;
case STOPPED:
avrcpIntent.putExtra("playing", false);
break;
case PAUSED:
avrcpIntent.putExtra("playing", false);
break;
case COMPLETED:
avrcpIntent.putExtra("playing", false);
break;
default:
return;
}
context.sendBroadcast(avrcpIntent);
if (downloadService == null) {
return;
}
if (downloadService.getCurrentPlaying() == null) {
return;
}
Entry song = downloadService.getCurrentPlaying().getSong();
if (song == null) {
return;
}
Intent avrcpIntent = new Intent(PLAYSTATUS_RESPONSE);
Integer duration = song.getDuration();
Integer playerPosition = downloadService.getPlayerPosition();
Integer listSize = downloadService.getDownloads().size();
if (duration != null) {
avrcpIntent.putExtra("duration", (long) duration);
}
if (playerPosition != null) {
avrcpIntent.putExtra("position", (long) playerPosition);
}
if (listSize != null) {
avrcpIntent.putExtra("ListSize", (long) listSize);
}
switch (downloadService.getPlayerState()) {
case STARTED:
avrcpIntent.putExtra("playing", true);
break;
case STOPPED:
avrcpIntent.putExtra("playing", false);
break;
case PAUSED:
avrcpIntent.putExtra("playing", false);
break;
case COMPLETED:
avrcpIntent.putExtra("playing", false);
break;
default:
return;
}
}
}

View File

@ -846,9 +846,15 @@ public class DownloadServiceImpl extends Service implements DownloadService {
.putString(MediaMetadataRetriever.METADATA_KEY_TITLE, title)
.putString(MediaMetadataRetriever.METADATA_KEY_ARTIST, artist)
.putString(MediaMetadataRetriever.METADATA_KEY_ALBUM, album)
.putLong(MediaMetadataRetriever.METADATA_KEY_DURATION, duration)
.apply();
if (duration != null) {
remoteControlClient
.editMetadata(false)
.putLong(MediaMetadataRetriever.METADATA_KEY_DURATION, duration)
.apply();
}
if (bitmap != null) {
remoteControlClient
.editMetadata(false)

View File

@ -54,7 +54,6 @@ import com.thejoshwa.ultrasonic.androidapp.domain.RepeatMode;
import com.thejoshwa.ultrasonic.androidapp.domain.SearchResult;
import com.thejoshwa.ultrasonic.androidapp.domain.Version;
import com.thejoshwa.ultrasonic.androidapp.domain.MusicDirectory.Entry;
import com.thejoshwa.ultrasonic.androidapp.provider.UltraSonicAppWidgetProvider4x1;
import com.thejoshwa.ultrasonic.androidapp.receiver.MediaButtonIntentReceiver;
import com.thejoshwa.ultrasonic.androidapp.service.DownloadFile;
import com.thejoshwa.ultrasonic.androidapp.service.DownloadService;
@ -875,18 +874,38 @@ public class Util extends DownloadActivity {
} else {
Bitmap bitmap = FileUtil.getAlbumArtBitmap(context, song, 0);
avrcpIntent.putExtra("track", song.getTitle());
avrcpIntent.putExtra("track_name", song.getTitle());
avrcpIntent.putExtra("artist", song.getArtist());
avrcpIntent.putExtra("artist_name", song.getArtist());
avrcpIntent.putExtra("album", song.getAlbum());
avrcpIntent.putExtra("album_name", song.getAlbum());
String title = song.getTitle();
String artist = song.getArtist();
String album = song.getAlbum();
Integer duration = song.getDuration();
Integer listSize = downloadService.getDownloads().size();
Integer id = downloadService.getCurrentPlayingIndex() + 1;
Integer playerPosition = downloadService.getPlayerPosition();
avrcpIntent.putExtra("track", title);
avrcpIntent.putExtra("track_name", title);
avrcpIntent.putExtra("artist", artist);
avrcpIntent.putExtra("artist_name", artist);
avrcpIntent.putExtra("album", album);
avrcpIntent.putExtra("album_name", album);
avrcpIntent.putExtra("cover", (Parcelable) bitmap);
avrcpIntent.putExtra("coverart", (Parcelable) bitmap);
avrcpIntent.putExtra("ListSize", (long) downloadService.getDownloads().size());
avrcpIntent.putExtra("id", (long) downloadService.getCurrentPlayingIndex() + 1);
avrcpIntent.putExtra("duration", (long) song.getDuration());
avrcpIntent.putExtra("position", (long) downloadService.getPlayerPosition());
if (playerPosition != null) {
avrcpIntent.putExtra("position", (long) playerPosition);
}
if (id != null) {
avrcpIntent.putExtra("id", (long) id);
}
if (listSize != null) {
avrcpIntent.putExtra("ListSize", (long) listSize);
}
if (duration != null) {
avrcpIntent.putExtra("duration", (long) duration);
}
}
context.sendBroadcast(avrcpIntent);
@ -898,20 +917,45 @@ public class Util extends DownloadActivity {
Intent avrcpIntent = new Intent(CM_AVRCP_PLAYSTATE_CHANGED);
MusicDirectory.Entry song = downloadService.getCurrentPlaying().getSong();
if (song == null) {
return;
}
Bitmap bitmap = FileUtil.getAlbumArtBitmap(context, song, 0);
avrcpIntent.putExtra("track", song.getTitle());
avrcpIntent.putExtra("track_name", song.getTitle());
avrcpIntent.putExtra("artist", song.getArtist());
avrcpIntent.putExtra("artist_name", song.getArtist());
avrcpIntent.putExtra("album", song.getAlbum());
avrcpIntent.putExtra("album_name", song.getAlbum());
String title = song.getTitle();
String artist = song.getArtist();
String album = song.getAlbum();
Integer duration = song.getDuration();
Integer listSize = downloadService.getDownloads().size();
Integer id = downloadService.getCurrentPlayingIndex() + 1;
Integer playerPosition = downloadService.getPlayerPosition();
avrcpIntent.putExtra("track", title);
avrcpIntent.putExtra("track_name", title);
avrcpIntent.putExtra("artist", artist);
avrcpIntent.putExtra("artist_name", artist);
avrcpIntent.putExtra("album", album);
avrcpIntent.putExtra("album_name", album);
avrcpIntent.putExtra("cover", (Parcelable) bitmap);
avrcpIntent.putExtra("coverart", (Parcelable) bitmap);
avrcpIntent.putExtra("ListSize", (long) downloadService.getDownloads().size());
avrcpIntent.putExtra("id", (long) downloadService.getCurrentPlayingIndex() + 1);
avrcpIntent.putExtra("duration", (long) song.getDuration());
avrcpIntent.putExtra("position", (long) downloadService.getPlayerPosition());
if (playerPosition != null) {
avrcpIntent.putExtra("position", (long) playerPosition);
}
if (id != null) {
avrcpIntent.putExtra("id", (long) id);
}
if (listSize != null) {
avrcpIntent.putExtra("ListSize", (long) listSize);
}
if (duration != null) {
avrcpIntent.putExtra("duration", (long) duration);
}
switch (state) {
case STARTED: