1/* This file is auto-generated from PlaybackControlGlue.java. DO NOT MODIFY. */ 2 3package android.support.v17.leanback.app; 4 5import android.content.Context; 6import android.support.v17.leanback.media.PlaybackGlueHost; 7import android.support.v17.leanback.widget.Action; 8import android.support.v17.leanback.widget.OnActionClickedListener; 9import android.support.v17.leanback.widget.OnItemViewClickedListener; 10import android.support.v17.leanback.widget.PlaybackRowPresenter; 11import android.support.v17.leanback.widget.Presenter; 12import android.support.v17.leanback.widget.Row; 13import android.support.v17.leanback.widget.RowPresenter; 14import android.view.InputEvent; 15import android.view.KeyEvent; 16import android.view.View; 17 18/** 19 * @deprecated Use {@link android.support.v17.leanback.media.PlaybackControlGlue} and 20 * {@link PlaybackSupportFragmentGlueHost} for {@link PlaybackSupportFragment}. 21 */ 22@Deprecated 23public abstract class PlaybackControlSupportGlue extends PlaybackControlGlue { 24 /** 25 * The adapter key for the first custom control on the left side 26 * of the predefined primary controls. 27 */ 28 public static final int ACTION_CUSTOM_LEFT_FIRST = PlaybackControlGlue.ACTION_CUSTOM_LEFT_FIRST; 29 30 /** 31 * The adapter key for the skip to previous control. 32 */ 33 public static final int ACTION_SKIP_TO_PREVIOUS = PlaybackControlGlue.ACTION_SKIP_TO_PREVIOUS; 34 35 /** 36 * The adapter key for the rewind control. 37 */ 38 public static final int ACTION_REWIND = PlaybackControlGlue.ACTION_REWIND; 39 40 /** 41 * The adapter key for the play/pause control. 42 */ 43 public static final int ACTION_PLAY_PAUSE = PlaybackControlGlue.ACTION_PLAY_PAUSE; 44 45 /** 46 * The adapter key for the fast forward control. 47 */ 48 public static final int ACTION_FAST_FORWARD = PlaybackControlGlue.ACTION_FAST_FORWARD; 49 50 /** 51 * The adapter key for the skip to next control. 52 */ 53 public static final int ACTION_SKIP_TO_NEXT = PlaybackControlGlue.ACTION_SKIP_TO_NEXT; 54 55 /** 56 * The adapter key for the first custom control on the right side 57 * of the predefined primary controls. 58 */ 59 public static final int ACTION_CUSTOM_RIGHT_FIRST = 60 PlaybackControlGlue.ACTION_CUSTOM_RIGHT_FIRST; 61 62 /** 63 * Invalid playback speed. 64 */ 65 public static final int PLAYBACK_SPEED_INVALID = PlaybackControlGlue.PLAYBACK_SPEED_INVALID; 66 67 /** 68 * Speed representing playback state that is paused. 69 */ 70 public static final int PLAYBACK_SPEED_PAUSED = PlaybackControlGlue.PLAYBACK_SPEED_PAUSED; 71 72 /** 73 * Speed representing playback state that is playing normally. 74 */ 75 public static final int PLAYBACK_SPEED_NORMAL = PlaybackControlGlue.PLAYBACK_SPEED_NORMAL; 76 77 /** 78 * The initial (level 0) fast forward playback speed. 79 * The negative of this value is for rewind at the same speed. 80 */ 81 public static final int PLAYBACK_SPEED_FAST_L0 = PlaybackControlGlue.PLAYBACK_SPEED_FAST_L0; 82 83 /** 84 * The level 1 fast forward playback speed. 85 * The negative of this value is for rewind at the same speed. 86 */ 87 public static final int PLAYBACK_SPEED_FAST_L1 = PlaybackControlGlue.PLAYBACK_SPEED_FAST_L1; 88 89 /** 90 * The level 2 fast forward playback speed. 91 * The negative of this value is for rewind at the same speed. 92 */ 93 public static final int PLAYBACK_SPEED_FAST_L2 = PlaybackControlGlue.PLAYBACK_SPEED_FAST_L2; 94 95 /** 96 * The level 3 fast forward playback speed. 97 * The negative of this value is for rewind at the same speed. 98 */ 99 public static final int PLAYBACK_SPEED_FAST_L3 = PlaybackControlGlue.PLAYBACK_SPEED_FAST_L3; 100 101 /** 102 * The level 4 fast forward playback speed. 103 * The negative of this value is for rewind at the same speed. 104 */ 105 public static final int PLAYBACK_SPEED_FAST_L4 = PlaybackControlGlue.PLAYBACK_SPEED_FAST_L4; 106 107 public PlaybackControlSupportGlue(Context context, int[] seekSpeeds) { 108 this(context, null, seekSpeeds, seekSpeeds); 109 } 110 111 public PlaybackControlSupportGlue( 112 Context context, int[] fastForwardSpeeds, int[] rewindSpeeds) { 113 this(context, null, fastForwardSpeeds, rewindSpeeds); 114 } 115 116 public PlaybackControlSupportGlue( 117 Context context, 118 PlaybackOverlaySupportFragment fragment, 119 int[] seekSpeeds) { 120 this(context, fragment, seekSpeeds, seekSpeeds); 121 } 122 123 public PlaybackControlSupportGlue( 124 Context context, 125 PlaybackOverlaySupportFragment fragment, 126 int[] fastForwardSpeeds, 127 int[] rewindSpeeds) { 128 super(context, fastForwardSpeeds, rewindSpeeds); 129 setHost(fragment == null ? null : new PlaybackSupportGlueHostOld(fragment)); 130 } 131 132 @Override 133 protected void onAttachedToHost(PlaybackGlueHost host) { 134 super.onAttachedToHost(host); 135 if (host instanceof PlaybackSupportGlueHostOld) { 136 ((PlaybackSupportGlueHostOld) host).mGlue = this; 137 } 138 } 139 140 static final class PlaybackSupportGlueHostOld extends PlaybackGlueHost { 141 final PlaybackOverlaySupportFragment mFragment; 142 PlaybackControlSupportGlue mGlue; 143 OnActionClickedListener mActionClickedListener; 144 145 public PlaybackSupportGlueHostOld(PlaybackOverlaySupportFragment fragment) { 146 mFragment = fragment; 147 mFragment.setOnItemViewClickedListener(new OnItemViewClickedListener() { 148 @Override 149 public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item, 150 RowPresenter.ViewHolder rowViewHolder, Row row) { 151 if (item instanceof Action 152 && rowViewHolder instanceof PlaybackRowPresenter.ViewHolder 153 && mActionClickedListener != null) { 154 mActionClickedListener.onActionClicked((Action) item); 155 } else if (mGlue != null && mGlue.getOnItemViewClickedListener() != null) { 156 mGlue.getOnItemViewClickedListener().onItemClicked(itemViewHolder, 157 item, rowViewHolder, row); 158 } 159 } 160 }); 161 } 162 163 @Override 164 public void setFadingEnabled(boolean enable) { 165 mFragment.setFadingEnabled(enable); 166 } 167 168 @Override 169 public void setOnKeyInterceptListener(final View.OnKeyListener onKeyListenerr) { 170 mFragment.setEventHandler( new InputEventHandler() { 171 @Override 172 public boolean handleInputEvent(InputEvent event) { 173 if (event instanceof KeyEvent) { 174 KeyEvent keyEvent = (KeyEvent) event; 175 return onKeyListenerr.onKey(null, keyEvent.getKeyCode(), keyEvent); 176 } 177 return false; 178 } 179 }); 180 } 181 182 @Override 183 public void setOnActionClickedListener(final OnActionClickedListener listener) { 184 mActionClickedListener = listener; 185 } 186 187 @Override 188 public void setHostCallback(HostCallback callback) { 189 mFragment.setHostCallback(callback); 190 } 191 192 @Override 193 public void fadeOut() { 194 mFragment.fadeOut(); 195 } 196 197 @Override 198 public void notifyPlaybackRowChanged() { 199 mGlue.onRowChanged(mGlue.getControlsRow()); 200 } 201 } 202} 203