Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Casanowow Life for love
VLC-Android
Commits
19ccff83
Commit
19ccff83
authored
Mar 02, 2012
by
Sébastien Toque
Browse files
Highlight current audio media
parent
1bf432ee
Changes
5
Hide whitespace changes
Inline
Side-by-side
vlc-android/src/org/videolan/vlc/AudioService.java
View file @
19ccff83
...
...
@@ -506,6 +506,12 @@ public class AudioService extends Service {
return
medias
;
}
public
String
getItem
()
{
return
mCurrentMedia
!=
null
?
mCurrentMedia
.
getPath
()
:
null
;
}
@Override
public
void
next
()
throws
RemoteException
{
AudioService
.
this
.
next
();
...
...
vlc-android/src/org/videolan/vlc/AudioServiceController.java
View file @
19ccff83
...
...
@@ -90,6 +90,15 @@ public class AudioServiceController implements IAudioPlayerControl {
return
new
ArrayList
<
String
>();
}
public
String
getItem
()
{
try
{
return
mAudioServiceBinder
.
getItem
();
}
catch
(
RemoteException
e
)
{
Log
.
e
(
TAG
,
"remote procedure call failed: getItem()"
);
}
return
null
;
}
/**
* Bind to audio service if it is running
*/
...
...
vlc-android/src/org/videolan/vlc/gui/audio/AudioListActivity.java
View file @
19ccff83
...
...
@@ -190,10 +190,13 @@ public class AudioListActivity extends ListActivity {
int
mode
=
getIntent
().
getIntExtra
(
EXTRA_MODE
,
0
);
List
<
Media
>
audioList
;
List
<
String
>
itemList
;
String
currentItem
=
null
;
int
currentIndex
=
-
1
;
if
(
name
==
null
||
mode
==
0
)
{
mTitle
.
setText
(
R
.
string
.
songs
);
itemList
=
AudioServiceController
.
getInstance
().
getItems
();
currentItem
=
AudioServiceController
.
getInstance
().
getItem
();
audioList
=
MediaLibrary
.
getInstance
(
this
).
getMediaItems
(
itemList
);
}
else
{
...
...
@@ -214,9 +217,15 @@ public class AudioListActivity extends ListActivity {
if
(
mSortReverse
)
{
Collections
.
reverse
(
audioList
);
}
for
(
int
i
=
0
;
i
<
audioList
.
size
();
i
++)
{
mSongsAdapter
.
add
(
audioList
.
get
(
i
));
Media
media
=
audioList
.
get
(
i
);
if
(
currentItem
!=
null
&&
currentItem
.
equals
(
media
.
getPath
()))
currentIndex
=
i
;
mSongsAdapter
.
add
(
media
);
}
mSongsAdapter
.
setCurrentIndex
(
currentIndex
);
getListView
().
setSelection
(
currentIndex
);
mSongsAdapter
.
notifyDataSetChanged
();
}
...
...
vlc-android/src/org/videolan/vlc/gui/audio/AudioSongsListAdapter.java
View file @
19ccff83
...
...
@@ -27,6 +27,7 @@ import org.videolan.vlc.Media;
import
org.videolan.vlc.R
;
import
android.content.Context
;
import
android.graphics.Color
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
...
...
@@ -36,10 +37,12 @@ import android.widget.TextView;
public
class
AudioSongsListAdapter
extends
ArrayAdapter
<
Media
>
{
private
ArrayList
<
Media
>
mMediaList
;
private
int
mCurrentIndex
;
public
AudioSongsListAdapter
(
Context
context
,
int
textViewResourceId
)
{
super
(
context
,
textViewResourceId
);
mMediaList
=
new
ArrayList
<
Media
>();
mCurrentIndex
=
-
1
;
}
@Override
...
...
@@ -54,6 +57,10 @@ public class AudioSongsListAdapter extends ArrayAdapter<Media> {
super
.
clear
();
}
public
void
setCurrentIndex
(
int
currentIndex
)
{
mCurrentIndex
=
currentIndex
;
}
@Override
public
View
getView
(
int
position
,
View
convertView
,
ViewGroup
parent
)
{
ViewHolder
holder
;
...
...
@@ -70,6 +77,7 @@ public class AudioSongsListAdapter extends ArrayAdapter<Media> {
Media
media
=
getItem
(
position
);
holder
.
title
.
setText
(
media
.
getTitle
());
holder
.
title
.
setTextColor
(
mCurrentIndex
==
position
?
Color
.
RED
:
Color
.
WHITE
);
holder
.
artist
.
setText
(
media
.
getArtist
()
+
" - "
+
media
.
getAlbum
());
return
v
;
}
...
...
vlc-android/src/org/videolan/vlc/interfaces/IAudioService.aidl
View file @
19ccff83
...
...
@@ -33,6 +33,7 @@ interface IAudioService {
void
load
(
in
List
<
String
>
mediaPathList
,
int
position
);
void
append
(
in
List
<
String
>
mediaPathList
);
List
<
String
>
getItems
();
String
getItem
();
boolean
isPlaying
();
boolean
isShuffling
();
int
getRepeatType
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment