mirror of
https://github.com/yuliskov/SmartTube.git
synced 2026-05-07 21:40:09 -05:00
player: pixel ratio settings
This commit is contained in:
+18
@@ -1,6 +1,7 @@
|
||||
package com.liskovsoft.smartyoutubetv2.common.app.presenters.settings;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Pair;
|
||||
import com.liskovsoft.sharedutils.helpers.Helpers;
|
||||
import com.liskovsoft.sharedutils.prefs.GlobalPreferences;
|
||||
import com.liskovsoft.smartyoutubetv2.common.R;
|
||||
@@ -47,6 +48,7 @@ public class PlayerSettingsPresenter extends BasePresenter<Void> {
|
||||
AppDialogUtil.appendSeekIntervalDialogItems(getContext(), settingsPresenter, mPlayerData, false);
|
||||
appendRememberSpeedCategory(settingsPresenter);
|
||||
appendEndingTimeCategory(settingsPresenter);
|
||||
appendPixelRatioCategory(settingsPresenter);
|
||||
appendMiscCategory(settingsPresenter);
|
||||
appendTweaksCategory(settingsPresenter);
|
||||
|
||||
@@ -370,6 +372,22 @@ public class PlayerSettingsPresenter extends BasePresenter<Void> {
|
||||
settingsPresenter.appendRadioCategory(getContext().getString(R.string.player_show_ending_time), options);
|
||||
}
|
||||
|
||||
private void appendPixelRatioCategory(AppDialogPresenter settingsPresenter) {
|
||||
List<OptionItem> options = new ArrayList<>();
|
||||
|
||||
ArrayList<Pair<String, Float>> pairs = new ArrayList<>();
|
||||
pairs.add(new Pair<>("1:1", 1.0f));
|
||||
pairs.add(new Pair<>("1.11111:1", 1.11111f));
|
||||
|
||||
for (Pair<String, Float> pair : pairs) {
|
||||
options.add(UiOptionItem.from(pair.first,
|
||||
optionItem -> mPlayerTweaksData.setPixelRatio(pair.second),
|
||||
Helpers.floatEquals(mPlayerTweaksData.getPixelRatio(), pair.second)));
|
||||
}
|
||||
|
||||
settingsPresenter.appendRadioCategory(getContext().getString(R.string.player_pixel_ratio), options);
|
||||
}
|
||||
|
||||
private void appendMiscCategory(AppDialogPresenter settingsPresenter) {
|
||||
List<OptionItem> options = new ArrayList<>();
|
||||
|
||||
|
||||
+12
-1
@@ -53,6 +53,7 @@ public class PlayerTweaksData {
|
||||
private boolean mIsAvcOverVp9Preferred;
|
||||
private boolean mIsChatPlacedLeft;
|
||||
private boolean mIsRealChannelIconEnabled;
|
||||
private float mPixelRatio;
|
||||
|
||||
private PlayerTweaksData(Context context) {
|
||||
mPrefs = AppPrefs.instance(context);
|
||||
@@ -262,6 +263,15 @@ public class PlayerTweaksData {
|
||||
persistData();
|
||||
}
|
||||
|
||||
public void setPixelRatio(float pixelRatio) {
|
||||
mPixelRatio = pixelRatio;
|
||||
persistData();
|
||||
}
|
||||
|
||||
public float getPixelRatio() {
|
||||
return mPixelRatio;
|
||||
}
|
||||
|
||||
private void restoreData() {
|
||||
String data = mPrefs.getData(VIDEO_PLAYER_TWEAKS_DATA);
|
||||
|
||||
@@ -289,6 +299,7 @@ public class PlayerTweaksData {
|
||||
mIsAvcOverVp9Preferred = Helpers.parseBoolean(split, 18, false);
|
||||
mIsChatPlacedLeft = Helpers.parseBoolean(split, 19, false);
|
||||
mIsRealChannelIconEnabled = Helpers.parseBoolean(split, 20, true);
|
||||
mPixelRatio = Helpers.parseFloat(split, 21, 1.0f);
|
||||
}
|
||||
|
||||
private void persistData() {
|
||||
@@ -298,7 +309,7 @@ public class PlayerTweaksData {
|
||||
null, mIsSetOutputSurfaceWorkaroundEnabled, mIsAudioSyncFixEnabled, mIsKeepFinishedActivityEnabled,
|
||||
mIsLiveStreamFixEnabled, mIsPlaybackNotificationsDisabled, mIsTunneledPlaybackEnabled, mPlayerButtons,
|
||||
mIsBufferingFixEnabled, mIsNoFpsPresetsEnabled, mIsRememberPositionOfShortVideosEnabled, mIsSuggestionsDisabled,
|
||||
mIsAvcOverVp9Preferred, mIsChatPlacedLeft, mIsRealChannelIconEnabled
|
||||
mIsAvcOverVp9Preferred, mIsChatPlacedLeft, mIsRealChannelIconEnabled, mPixelRatio
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -457,4 +457,5 @@
|
||||
<string name="real_channel_icon">Показать реальную иконку на кнопке канала</string>
|
||||
<string name="subtitle_yellow_semi_transparent">Жёлтые на полупрозрачном фоне</string>
|
||||
<string name="subtitle_yellow_black">Жёлтые на чёрном фоне</string>
|
||||
<string name="player_pixel_ratio">Соотношение сторон пикселя</string>
|
||||
</resources>
|
||||
@@ -457,4 +457,5 @@
|
||||
<string name="real_channel_icon">Показувати справжній значок на кнопці каналу</string>
|
||||
<string name="subtitle_yellow_semi_transparent">Жовті на напівпрозорому фоні</string>
|
||||
<string name="subtitle_yellow_black">Жовті на чорному фоні</string>
|
||||
<string name="player_pixel_ratio">Співвідношення сторін пікселя</string>
|
||||
</resources>
|
||||
@@ -465,4 +465,5 @@
|
||||
<string name="real_channel_icon">Show real icon on the channel button</string>
|
||||
<string name="subtitle_yellow_semi_transparent">Yellow on semitransparent background</string>
|
||||
<string name="subtitle_yellow_black">Yellow on black background</string>
|
||||
<string name="player_pixel_ratio">Pixel ratio</string>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user