kurioes / pmix

Automatically exported from code.google.com/p/pmix
0 stars 0 forks source link

Message on tap (on song): ~Song null has been added~ #28

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Open Artists, or Albums, etc.
2. Navigate to a song.
3. Tap it.

What is the expected output? What do you see instead?
I don't know the expected output, but I see 'Song null has been added' 
(maybe it actually says something different in English, I have a German 
locale set). The song is still added to the playlist, it's just the wrong 
message. I get the right message when I press the [+] button.

What version of the product are you using? On what operating system?
pmix 0.4-beta4 on HTC Hero (Standard ROM, i.e. Android 1.5 + Sense UI)

Please provide any additional information below.

Original issue reported on code.google.com by Maximili...@gmail.com on 18 Jan 2010 at 11:04

GoogleCodeExporter commented 9 years ago
This may relate to character encoding in the tags.. Or a number of other 
things. Is
it possible for you to provide an MP3 which causes this to happen? I will test 
on my
mpd/pmix.

Original comment by mafro...@gmail.com on 19 Jan 2010 at 4:39

GoogleCodeExporter commented 9 years ago
It happens with every mp3 I've tried. The other thing is that, as I said, the 
name is 
rendered perfectly fine when I press the [+] button on the right, so I don't 
see the 
connection right now.

I'm not at home right now, so I can't send you a sample mp3 right now (I'd have 
to find 
a "free" mp3 first, anyway ;))

Original comment by Maximili...@gmail.com on 19 Jan 2010 at 4:46

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Mind you I haven't done any Android coding yet but I guess I found the source 
of the 
disparity:

I looked at this:

http://code.google.com/p/pmix/source/browse/branches/0.4-
beta4/pmix/src/org/pmix/ui/SongsActivity.java

Code for the [+] action:

PlusListener AddListener = new PlusListener() {
    @Override
    public void OnAdd(CharSequence sSelected, int iPosition)
    {
        Music music = musics.get(iPosition);
        try {
            MPDApplication app = (MPDApplication)getApplication();

            app.oMPDAsyncHelper.oMPD.getPlaylist().add(music);

MainMenuActivity.notifyUser(String.format(getResources().getString(R.string.song
Added),
sSelected), SongsActivity.this);
        } catch (MPDServerException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }

};

Code for the standard tapping/selection action:

protected void onListItemClick(ListView l, View v, int position, long id) {
    Music music = musics.get(position);
    try {
        MPDApplication app = (MPDApplication)getApplication();

        app.oMPDAsyncHelper.oMPD.getPlaylist().add(music);

MainMenuActivity.notifyUser(String.format(getResources().getString(R.string.song
Added),
music.getName()), SongsActivity.this);
    } catch (MPDServerException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

So when pressing [+], instead of calling music.getName() the CharacterSequence 
is 
acquired differently/directly. That would at least explain why [+] works but 
not 
tapping the name.

music.getName() seems to return null... It's really strange, because the music 
object 
is put into the playlist, right? And there the name is fine.

Original comment by Maximili...@gmail.com on 19 Jan 2010 at 5:09

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Ok so a fix is quite easily performed by replacing music.getName() with 
music.getTitle().

The list you select from is built from the title strings not name:

for (Music music : musics) {
   items.add(music.getTitle());
}

So when you press the [+] you get the "title" but when you press the whole 
line, you 
get the "name" of the Music object. I'm not sure what getName() is supposed to 
return 
(or what "name" is supposed to be) but here it seems to return null.

I attached the fixed SongsActivity.java 

(or is there a write access to the svn?)

It has been tested in the Android emulator and tapping the title now shows the 
same 
message as when I press [+].

Original comment by Maximili...@gmail.com on 19 Jan 2010 at 5:51

Attachments:

GoogleCodeExporter commented 9 years ago
Looks like you nailed this one maximili. Can you generate a patch file and post 
that
here please? Sag can include it when he does some more updates to source tree.

Original comment by mafro...@gmail.com on 25 Jan 2010 at 12:46

GoogleCodeExporter commented 9 years ago
Hi,

Thanks for the patch, I added it and it will be in soon released 0.4...

Original comment by stefan.a...@gmail.com on 6 Mar 2010 at 10:58