Default behaviour on song selection
#1
Hey Guys

I just created a little fix for http://code.google.com/p/android-xbmcrem...ail?id=352. May you can use it:

With this fix, i'm able to change the default behaviour in the xbmcremote settings:
Image


I changed the following things (i'm not a talented coder Big Grin)

/XBMC Remote/res/values/arrays.xml

Code:
[...]
<resources>
    <string-array name="KeyguardPreferenceValues">
        <item>0</item>
        <item>1</item>
        <item>2</item>
    </string-array>
    <string-array name="KeyguardPreferenceEntries">
        <item>Never</item>
        <item>On Remote</item>
        <item>Always</item>
    </string-array>
[color=blue][b]    <string-array name="SelectionPreferenceValues">
        <item>0</item>
        <item>1</item>
    </string-array>
    <string-array name="SelectionPreferenceEntries">
        <item>Queue Song</item>
        <item>Play Song</item>
    </string-array>[/b][/color]
</resources>


/XBMC Remote/res/xml/preferences.xml

Code:
    <PreferenceCategory android:title="Screen Behaviour">
        <ListPreference
            android:key="setting_disable_keyguard"
            android:title="Disable the Keyguard?"
            android:summary="Click to set Keyguard (screen lock) behaviour for the app."
            android:entries="@array/KeyguardPreferenceEntries"
            android:entryValues="@array/KeyguardPreferenceValues"
            android:defaultValue="0" />
    </PreferenceCategory>
[color=blue][b]    <PreferenceCategory android:title="Selection Action">
        <ListPreference
            android:key="setting_default_selectaction"
            android:title="Default Action on selection"
            android:summary="Click to set default selection action for the app."
            android:entries="@array/SelectionPreferenceEntries"
            android:entryValues="@array/SelectionPreferenceValues"
            android:defaultValue="0" />
    </PreferenceCategory>[/b][/color]
    <PreferenceCategory android:title="Remote Keypress">
        <CheckBoxPreference
            android:key="setting_send_repeats"
            android:title="Explicitly Send Repeats"


/XBMC Remote/src/org/xbmc/android/remote/presentation/controller/SongListController.java

Code:
[...]
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.BitmapFactory;
import android.os.Handler;
[color=blue][b]import android.preference.PreferenceManager;[/b][/color]
import android.view.ContextMenu;
import android.view.Menu;
import android.view.MenuItem;
[...]

[...]
mList.setOnItemClickListener(new OnItemClickListener() {
    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
        if(isLoading()) return;
        final Song song = (Song)mList.getAdapter().getItem(((ThreeLabelsItemView)view).position);
[color=blue][b]        final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mActivity.getApplicationContext());
        final String SelectionType = prefs.getString("setting_default_selectaction", "");
        if (SelectionType.equals("0"))
        {
            if (mAlbum == null)
            {
                mMusicManager.addToPlaylist(new QueryResponse(mActivity, "Song added to playlist.", "Error adding song!"), song, mActivity.getApplicationContext());
            }
            else
            {
                mMusicManager.addToPlaylist(new QueryResponse(mActivity, "Playlist empty, added whole album.", "Song added to playlist."), mAlbum, song, mActivity.getApplicationContext());
            }
        }
        else if (SelectionType.equals("1"))
        {[/b]
[/color]            if (mAlbum == null) {
                mMusicManager.play(new QueryResponse(
                    mActivity,
                    "Playing \"" + song.title + "\" by " + song.artist + "...",
                    "Error playing song!",
                    true
                ), song, mActivity.getApplicationContext());
            } else {
                mMusicManager.play(new QueryResponse(
                    mActivity,
                    "Playing album \"" + song.album + "\" starting with song \"" + song.title + "\" by " + song.artist + "...",
                    "Error playing song!",
                    true
                ), mAlbum, song, mActivity.getApplicationContext());
            }
        }
[color=blue][b]    }[/b][/color]
});
[...]


Kind regards
Milvus
Reply
#2
YES!!! THANK YOU for fixing this!

Next (n00b)question, how do i install your version?
Reply
#3
you have to download the sources, apply my changes and finally compile the version with the android sdk & eclipse.

see:
http://code.google.com/p/android-xbmcrem...wiki?r=713

I have an apk with my changes included, but if you use it, it's just another version of the XBMC Remote on your phone (a second app) and it won't be updated automatically, if the team releases a new updates.
Hopefully a developer adds my changes to the official code, then it will be available in all future updates of xbmc remote for android.

So, if you can't wait for this feature, use my apk:
http://www.mediafire.com/?ba7yddtaxxhp5x1
Reply
#4
No, i can't wait so I will install your version instead, until the official gets an update. I don't know how to compile things, just use them Wink
I will return some feedback to you when I've tried it.
Thanks again!

EDIT:
Well, didn't need to try for long Sad
Force close on my Desire (stock 2.2) with message "Process org.xbmc.android.wgayremote stopped unexpectedly. Try again"
BTW; "wgayremote"??
Reply
#5
@milvus I've added your changes into the source. Thanks.
Reply
#6
gfoldv Wrote:@milvus I've added your changes into the source. Thanks.

Is the app updated on market with this changes?
Reply
#7
Not yet.
Reply
#8
I notice a few threads reporting this same problem, is this change still not rolled into the official release?

My mate with Sonos is making me jealous!
Reply

Logout Mark Read Team Forum Stats Members Help
Default behaviour on song selection0