parent
93d4d37f1c
commit
7c18df20cf
|
@ -81,6 +81,10 @@ public class Settings {
|
||||||
public static final String KEY_PREF_SHOW_NOW_PLAYING_PANEL = "pref_show_nowplayingpanel";
|
public static final String KEY_PREF_SHOW_NOW_PLAYING_PANEL = "pref_show_nowplayingpanel";
|
||||||
public static final boolean DEFAULT_PREF_SHOW_NOW_PLAYING_PANEL = true;
|
public static final boolean DEFAULT_PREF_SHOW_NOW_PLAYING_PANEL = true;
|
||||||
|
|
||||||
|
// Seek mode
|
||||||
|
public static final String KEY_PREF_NOTIFICATION_SEEK_JUMP = "pref_notification_seek_jump";
|
||||||
|
public static final boolean DEFAULT_PREF_NOTIFICATION_SEEK_JUMP = false;
|
||||||
|
|
||||||
// Pause during calls
|
// Pause during calls
|
||||||
public static final String KEY_PREF_PAUSE_DURING_CALLS = "pref_pause_during_calls";
|
public static final String KEY_PREF_PAUSE_DURING_CALLS = "pref_pause_during_calls";
|
||||||
public static final boolean DEFAULT_PREF_PAUSE_DURING_CALLS = false;
|
public static final boolean DEFAULT_PREF_PAUSE_DURING_CALLS = false;
|
||||||
|
|
|
@ -241,6 +241,12 @@ public class Player {
|
||||||
public static final class Seek extends ApiMethod<PlayerType.SeekReturnType> {
|
public static final class Seek extends ApiMethod<PlayerType.SeekReturnType> {
|
||||||
public final static String METHOD_NAME = "Player.Seek";
|
public final static String METHOD_NAME = "Player.Seek";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Seek constants
|
||||||
|
*/
|
||||||
|
public static final String BACKWARD = "smallbackward";
|
||||||
|
public static final String FORWARD = "smallforward";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Seek through the playing item (by time)
|
* Seek through the playing item (by time)
|
||||||
* @param playerId Player id for which to stop playback
|
* @param playerId Player id for which to stop playback
|
||||||
|
@ -263,6 +269,17 @@ public class Player {
|
||||||
addParameterToRequest("value", value);
|
addParameterToRequest("value", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Seek through the playing item (by step)
|
||||||
|
* @param playerId Player id for which to stop playback
|
||||||
|
* @param value step (smallbackward/smallforward)
|
||||||
|
*/
|
||||||
|
public Seek(int playerId, String value) {
|
||||||
|
super();
|
||||||
|
addParameterToRequest("playerid", playerId);
|
||||||
|
addParameterToRequest("value", value);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getMethodName() { return METHOD_NAME; }
|
public String getMethodName() { return METHOD_NAME; }
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,9 @@ public class IntentActionsService extends Service {
|
||||||
ACTION_REWIND = "rewind",
|
ACTION_REWIND = "rewind",
|
||||||
ACTION_FAST_FORWARD = "fast_forward",
|
ACTION_FAST_FORWARD = "fast_forward",
|
||||||
ACTION_PREVIOUS = "previous",
|
ACTION_PREVIOUS = "previous",
|
||||||
ACTION_NEXT = "next";
|
ACTION_NEXT = "next",
|
||||||
|
ACTION_JUMP_BACKWARD = "jump_backward",
|
||||||
|
ACTION_JUMP_FORWARD = "jump_forward";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() { }
|
public void onCreate() { }
|
||||||
|
@ -79,6 +81,16 @@ public class IntentActionsService extends Service {
|
||||||
new Player.GoTo(playerId, Player.GoTo.NEXT),
|
new Player.GoTo(playerId, Player.GoTo.NEXT),
|
||||||
null, null);
|
null, null);
|
||||||
break;
|
break;
|
||||||
|
case ACTION_JUMP_BACKWARD:
|
||||||
|
hostConnection.execute(
|
||||||
|
new Player.Seek(playerId, Player.Seek.BACKWARD),
|
||||||
|
null, null);
|
||||||
|
break;
|
||||||
|
case ACTION_JUMP_FORWARD:
|
||||||
|
hostConnection.execute(
|
||||||
|
new Player.Seek(playerId, Player.Seek.FORWARD),
|
||||||
|
null, null);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ import android.content.res.Resources;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
import android.support.v4.app.NotificationCompat;
|
import android.support.v4.app.NotificationCompat;
|
||||||
import android.support.v4.app.TaskStackBuilder;
|
import android.support.v4.app.TaskStackBuilder;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -35,6 +36,7 @@ import android.widget.RemoteViews;
|
||||||
import com.squareup.picasso.Picasso;
|
import com.squareup.picasso.Picasso;
|
||||||
import com.squareup.picasso.Target;
|
import com.squareup.picasso.Target;
|
||||||
import org.xbmc.kore.R;
|
import org.xbmc.kore.R;
|
||||||
|
import org.xbmc.kore.Settings;
|
||||||
import org.xbmc.kore.host.HostConnectionObserver;
|
import org.xbmc.kore.host.HostConnectionObserver;
|
||||||
import org.xbmc.kore.host.HostManager;
|
import org.xbmc.kore.host.HostManager;
|
||||||
import org.xbmc.kore.jsonrpc.notification.Player;
|
import org.xbmc.kore.jsonrpc.notification.Player;
|
||||||
|
@ -227,14 +229,22 @@ public class NotificationObserver
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the actions, depending on the type of media
|
// Create the actions, depending on the type of media and the user's preference
|
||||||
PendingIntent rewindPendingIntent, ffPendingIntent, playPausePendingIntent;
|
PendingIntent rewindPendingIntent, ffPendingIntent, playPausePendingIntent;
|
||||||
playPausePendingIntent = buildActionPendingIntent(getActivePlayerResult.playerid, IntentActionsService.ACTION_PLAY_PAUSE);
|
playPausePendingIntent = buildActionPendingIntent(getActivePlayerResult.playerid, IntentActionsService.ACTION_PLAY_PAUSE);
|
||||||
|
boolean useSeekJump = PreferenceManager
|
||||||
|
.getDefaultSharedPreferences(this.mService)
|
||||||
|
.getBoolean(Settings.KEY_PREF_NOTIFICATION_SEEK_JUMP, Settings.DEFAULT_PREF_NOTIFICATION_SEEK_JUMP);
|
||||||
if (getItemResult.type.equals(ListType.ItemsAll.TYPE_SONG)) {
|
if (getItemResult.type.equals(ListType.ItemsAll.TYPE_SONG)) {
|
||||||
rewindPendingIntent = buildActionPendingIntent(getActivePlayerResult.playerid, IntentActionsService.ACTION_PREVIOUS);
|
rewindPendingIntent = buildActionPendingIntent(getActivePlayerResult.playerid, IntentActionsService.ACTION_PREVIOUS);
|
||||||
rewindIcon = R.drawable.ic_skip_previous_white_24dp;
|
rewindIcon = R.drawable.ic_skip_previous_white_24dp;
|
||||||
ffPendingIntent = buildActionPendingIntent(getActivePlayerResult.playerid, IntentActionsService.ACTION_NEXT);
|
ffPendingIntent = buildActionPendingIntent(getActivePlayerResult.playerid, IntentActionsService.ACTION_NEXT);
|
||||||
ffIcon = R.drawable.ic_skip_next_white_24dp;
|
ffIcon = R.drawable.ic_skip_next_white_24dp;
|
||||||
|
} else if (useSeekJump) {
|
||||||
|
rewindPendingIntent = buildActionPendingIntent(getActivePlayerResult.playerid, IntentActionsService.ACTION_JUMP_BACKWARD);
|
||||||
|
rewindIcon = R.drawable.ic_chevron_left_white_24dp;
|
||||||
|
ffPendingIntent = buildActionPendingIntent(getActivePlayerResult.playerid, IntentActionsService.ACTION_JUMP_FORWARD);
|
||||||
|
ffIcon = R.drawable.ic_chevron_right_white_24dp;
|
||||||
} else {
|
} else {
|
||||||
rewindPendingIntent = buildActionPendingIntent(getActivePlayerResult.playerid, IntentActionsService.ACTION_REWIND);
|
rewindPendingIntent = buildActionPendingIntent(getActivePlayerResult.playerid, IntentActionsService.ACTION_REWIND);
|
||||||
rewindIcon = R.drawable.ic_fast_rewind_white_24dp;
|
rewindIcon = R.drawable.ic_fast_rewind_white_24dp;
|
||||||
|
|
|
@ -349,6 +349,9 @@
|
||||||
<string name="show_notification">Show notification while playing</string>
|
<string name="show_notification">Show notification while playing</string>
|
||||||
<string name="show_now_playing_panel">Show now playing panel while playing</string>
|
<string name="show_now_playing_panel">Show now playing panel while playing</string>
|
||||||
<string name="show_now_playing_panel_summary">Displays an expandable panel at the bottom of the screen when media is playing</string>
|
<string name="show_now_playing_panel_summary">Displays an expandable panel at the bottom of the screen when media is playing</string>
|
||||||
|
<string name="notification_seek_jump">Use steps for seeking</string>
|
||||||
|
<string name="notification_seek_jump_speed">Change playback speed when seeking from notification</string>
|
||||||
|
<string name="notification_seek_jump_step">Use skip steps when seeking from notification</string>
|
||||||
<string name="pause_during_calls">Pause during phone call</string>
|
<string name="pause_during_calls">Pause during phone call</string>
|
||||||
<string name="use_hardware_volume_keys">Use device volume keys</string>
|
<string name="use_hardware_volume_keys">Use device volume keys</string>
|
||||||
<string name="vibrate_on_remote">Vibrate on touch</string>
|
<string name="vibrate_on_remote">Vibrate on touch</string>
|
||||||
|
|
|
@ -64,6 +64,14 @@
|
||||||
android:title="@string/show_notification"
|
android:title="@string/show_notification"
|
||||||
android:defaultValue="false"/>
|
android:defaultValue="false"/>
|
||||||
|
|
||||||
|
<SwitchPreference
|
||||||
|
android:key="pref_notification_seek_jump"
|
||||||
|
android:dependency="pref_show_notification"
|
||||||
|
android:title="@string/notification_seek_jump"
|
||||||
|
android:summaryOff="@string/notification_seek_jump_speed"
|
||||||
|
android:summaryOn="@string/notification_seek_jump_step"
|
||||||
|
android:defaultValue="false"/>
|
||||||
|
|
||||||
<SwitchPreferenceCompat
|
<SwitchPreferenceCompat
|
||||||
android:key="pref_pause_during_calls"
|
android:key="pref_pause_during_calls"
|
||||||
android:title="@string/pause_during_calls"
|
android:title="@string/pause_during_calls"
|
||||||
|
|
Loading…
Reference in New Issue