mirror of
https://github.com/yuliskov/SmartTube.git
synced 2026-01-25 16:10:20 -06:00
refactor
This commit is contained in:
@@ -13,6 +13,7 @@ import com.liskovsoft.smartyoutubetv2.common.app.models.playback.controller.Play
|
||||
import com.liskovsoft.smartyoutubetv2.common.app.models.playback.ui.OptionItem;
|
||||
import com.liskovsoft.smartyoutubetv2.common.app.models.playback.ui.UiOptionItem;
|
||||
import com.liskovsoft.smartyoutubetv2.common.app.presenters.VideoSettingsPresenter;
|
||||
import com.liskovsoft.smartyoutubetv2.common.app.views.ViewManager;
|
||||
import com.liskovsoft.smartyoutubetv2.common.autoframerate.FormatItem;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -155,8 +156,10 @@ public class PlayerUiManager extends PlayerEventListenerHelper {
|
||||
private void updateBackgroundPlayback() {
|
||||
if (mBlockEngine) {
|
||||
mController.blockEngine();
|
||||
ViewManager.instance(mMainActivity).blockTop(true); // open player regarding its position in stack
|
||||
} else {
|
||||
mController.unblockEngine();
|
||||
ViewManager.instance(mMainActivity).blockTop(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ public class ViewManager {
|
||||
private final Map<Class<? extends Activity>, Class<? extends Activity>> mParentMapping;
|
||||
private final Stack<Class<?>> mActivityStack;
|
||||
private Class<?> mRootActivity;
|
||||
private Class<?> mDefaultTop;
|
||||
|
||||
private ViewManager(Context context) {
|
||||
mContext = context;
|
||||
@@ -96,13 +97,13 @@ public class ViewManager {
|
||||
}
|
||||
|
||||
public void startDefaultView(Context context) {
|
||||
Class<?> lastActivity = null;
|
||||
Class<?> lastActivity;
|
||||
|
||||
if (!mActivityStack.isEmpty()) {
|
||||
if (mDefaultTop != null) {
|
||||
lastActivity = mDefaultTop;
|
||||
} else if (!mActivityStack.isEmpty()) {
|
||||
lastActivity = mActivityStack.peek();
|
||||
}
|
||||
|
||||
if (lastActivity == null) {
|
||||
} else {
|
||||
lastActivity = mRootActivity;
|
||||
}
|
||||
|
||||
@@ -152,4 +153,8 @@ public class ViewManager {
|
||||
|
||||
return parentActivity;
|
||||
}
|
||||
|
||||
public void blockTop(boolean block) {
|
||||
mDefaultTop = block ? getTopActivity() : null;
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.5 KiB |
BIN
common/src/main/res/drawable-nodpi/action_subscribe2.png
Normal file
BIN
common/src/main/res/drawable-nodpi/action_subscribe2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.0 KiB |
@@ -22,5 +22,5 @@
|
||||
<string name="auto_frame_rate_enable">Автофреймрейт</string>
|
||||
<string name="auto_frame_rate_correction">Исправлять fps: %s</string>
|
||||
<string name="dialog_background_playback">Фоновое воспроизведение</string>
|
||||
<string name="not_implemented">Не реализовано</string>
|
||||
<string name="not_implemented">Пока не готово</string>
|
||||
</resources>
|
||||
@@ -9,7 +9,7 @@ import androidx.leanback.widget.Action;
|
||||
import androidx.leanback.widget.ArrayObjectAdapter;
|
||||
import androidx.leanback.widget.ObjectAdapter;
|
||||
import androidx.leanback.widget.PlaybackControlsRow;
|
||||
import com.liskovsoft.smartyoutubetv2.tv.ui.playback.actions.BugReportAction;
|
||||
import com.liskovsoft.smartyoutubetv2.tv.ui.playback.actions.VideoStatsAction;
|
||||
import com.liskovsoft.smartyoutubetv2.tv.ui.playback.actions.ChannelAction;
|
||||
import com.liskovsoft.smartyoutubetv2.tv.ui.playback.actions.ClosedCaptioningAction;
|
||||
import com.liskovsoft.smartyoutubetv2.tv.ui.playback.actions.HighQualityAction;
|
||||
@@ -87,7 +87,7 @@ public class VideoPlayerGlue extends PlaybackTransportControlGlue<PlayerAdapter>
|
||||
private final SubscribeAction mSubscribeAction;
|
||||
private final ChannelAction mChannelAction;
|
||||
private final PlaylistAddAction mPlaylistAddAction;
|
||||
private final BugReportAction mVideoStatsAction;
|
||||
private final VideoStatsAction mVideoStatsAction;
|
||||
|
||||
public VideoPlayerGlue(
|
||||
Context context,
|
||||
@@ -112,7 +112,7 @@ public class VideoPlayerGlue extends PlaybackTransportControlGlue<PlayerAdapter>
|
||||
mSubscribeAction = new SubscribeAction(context);
|
||||
mChannelAction = new ChannelAction(context);
|
||||
mPlaylistAddAction = new PlaylistAddAction(context);
|
||||
mVideoStatsAction = new BugReportAction(context);
|
||||
mVideoStatsAction = new VideoStatsAction(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -22,7 +22,7 @@ public class SubscribeAction extends MultiAction {
|
||||
public SubscribeAction(Context context, int highlightColor) {
|
||||
super(R.id.action_subscribe);
|
||||
Drawable[] drawables = new Drawable[2];
|
||||
BitmapDrawable offDrawable = (BitmapDrawable) ContextCompat.getDrawable(context, R.drawable.action_subscribe);
|
||||
BitmapDrawable offDrawable = (BitmapDrawable) ContextCompat.getDrawable(context, R.drawable.action_subscribe2);
|
||||
drawables[INDEX_OFF] = offDrawable;
|
||||
drawables[INDEX_ON] = offDrawable == null ? null
|
||||
: new BitmapDrawable(context.getResources(),
|
||||
|
||||
@@ -6,13 +6,13 @@ import androidx.core.content.ContextCompat;
|
||||
import androidx.leanback.widget.Action;
|
||||
import com.liskovsoft.smartyoutubetv2.tv.R;
|
||||
|
||||
public class BugReportAction extends Action {
|
||||
public BugReportAction(Context context) {
|
||||
super(R.id.action_bug_report);
|
||||
public class VideoStatsAction extends Action {
|
||||
public VideoStatsAction(Context context) {
|
||||
super(R.id.action_video_stats);
|
||||
Drawable uncoloredDrawable = ContextCompat.getDrawable(context, R.drawable.action_bug_report);
|
||||
|
||||
setIcon(uncoloredDrawable);
|
||||
setLabel1(context.getString(
|
||||
R.string.action_bug_report));
|
||||
R.string.action_video_stats));
|
||||
}
|
||||
}
|
||||
@@ -3,5 +3,5 @@
|
||||
<item name="action_subscribe" type="id"/>
|
||||
<item name="action_channel" type="id"/>
|
||||
<item name="action_playlist_add" type="id"/>
|
||||
<item name="action_bug_report" type="id"/>
|
||||
<item name="action_video_stats" type="id"/>
|
||||
</resources>
|
||||
@@ -116,5 +116,5 @@
|
||||
<string name="action_subscribe_on">Subscribe On</string>
|
||||
<string name="action_channel">Open Channel</string>
|
||||
<string name="action_playlist_add">Add to Playlist</string>
|
||||
<string name="action_bug_report">Report Bug</string>
|
||||
<string name="action_video_stats">Video Stats</string>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user