mirror of
https://github.com/yuliskov/SmartTube.git
synced 2026-04-30 09:59:23 -05:00
screen dimming: add 15, 30 sec
This commit is contained in:
+14
-5
@@ -2,6 +2,7 @@ package com.liskovsoft.smartyoutubetv2.common.app.presenters.settings;
|
||||
|
||||
import android.content.Context;
|
||||
import com.liskovsoft.mediaserviceinterfaces.data.MediaGroup;
|
||||
import com.liskovsoft.sharedutils.helpers.Helpers;
|
||||
import com.liskovsoft.sharedutils.helpers.MessageHelpers;
|
||||
import com.liskovsoft.smartyoutubetv2.common.R;
|
||||
import com.liskovsoft.smartyoutubetv2.common.app.models.data.Video;
|
||||
@@ -264,15 +265,23 @@ public class GeneralSettingsPresenter extends BasePresenter<Void> {
|
||||
|
||||
options.add(UiOptionItem.from(
|
||||
getContext().getString(R.string.option_never),
|
||||
option -> mGeneralData.setScreenDimmingTimeoutMin(GeneralData.SCREEN_DIMMING_NEVER),
|
||||
mGeneralData.getScreenDimmingTimeoutMin() == GeneralData.SCREEN_DIMMING_NEVER));
|
||||
option -> mGeneralData.setScreenDimmingTimeoutMs(GeneralData.SCREEN_DIMMING_NEVER),
|
||||
mGeneralData.getScreenDimmingTimeoutMs() == GeneralData.SCREEN_DIMMING_NEVER));
|
||||
|
||||
for (int timeoutSec : Helpers.range(15, 30, 15)) {
|
||||
int timeoutMs = timeoutSec * 1_000;
|
||||
options.add(UiOptionItem.from(
|
||||
getContext().getString(R.string.ui_hide_timeout_sec, timeoutSec),
|
||||
option -> mGeneralData.setScreenDimmingTimeoutMs(timeoutMs),
|
||||
mGeneralData.getScreenDimmingTimeoutMs() == timeoutMs));
|
||||
}
|
||||
|
||||
for (int i = 1; i <= 15; i++) {
|
||||
int timeoutMin = i;
|
||||
int timeoutMs = i * 60 * 1_000;
|
||||
options.add(UiOptionItem.from(
|
||||
getContext().getString(R.string.screen_dimming_timeout_min, i),
|
||||
option -> mGeneralData.setScreenDimmingTimeoutMin(timeoutMin),
|
||||
mGeneralData.getScreenDimmingTimeoutMin() == i));
|
||||
option -> mGeneralData.setScreenDimmingTimeoutMs(timeoutMs),
|
||||
mGeneralData.getScreenDimmingTimeoutMs() == timeoutMs));
|
||||
}
|
||||
|
||||
settingsPresenter.appendRadioCategory(getContext().getString(R.string.screen_dimming), options);
|
||||
|
||||
+3
-3
@@ -59,9 +59,9 @@ public class ScreensaverManager {
|
||||
Log.d(TAG, "Enable screensaver");
|
||||
|
||||
disable();
|
||||
int delayMs = mGeneralData.getScreenDimmingTimeoutMin() == GeneralData.SCREEN_DIMMING_NEVER ?
|
||||
int delayMs = mGeneralData.getScreenDimmingTimeoutMs() == GeneralData.SCREEN_DIMMING_NEVER ?
|
||||
10_000 :
|
||||
mGeneralData.getScreenDimmingTimeoutMin() * 60 * 1_000;
|
||||
mGeneralData.getScreenDimmingTimeoutMs();
|
||||
Utils.postDelayed(mDimScreen, delayMs);
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ public class ScreensaverManager {
|
||||
|
||||
// Disable dimming on certain circumstances
|
||||
if (show && mDimColorResId == DIMMING_RES_ID &&
|
||||
(isPlaying() || isSigning() || mGeneralData.getScreenDimmingTimeoutMin() == GeneralData.SCREEN_DIMMING_NEVER)
|
||||
(isPlaying() || isSigning() || mGeneralData.getScreenDimmingTimeoutMs() == GeneralData.SCREEN_DIMMING_NEVER)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public class GeneralData {
|
||||
private boolean mIsHideShortsFromSubscriptionsEnabled;
|
||||
private boolean mIsHideUpcomingEnabled;
|
||||
private boolean mIsRemapFastForwardToNextEnabled;
|
||||
private int mScreenDimmingTimeoutMin;
|
||||
private int mScreenDimmingTimeoutMs;
|
||||
private int mTimeFormat;
|
||||
private boolean mIsProxyEnabled;
|
||||
private boolean mIsBridgeCheckEnabled;
|
||||
@@ -473,13 +473,13 @@ public class GeneralData {
|
||||
return mIsRemapChannelUpToSearchEnabled;
|
||||
}
|
||||
|
||||
public void setScreenDimmingTimeoutMin(int timeoutMin) {
|
||||
mScreenDimmingTimeoutMin = timeoutMin;
|
||||
public void setScreenDimmingTimeoutMs(int timeoutMs) {
|
||||
mScreenDimmingTimeoutMs = timeoutMs;
|
||||
persistState();
|
||||
}
|
||||
|
||||
public int getScreenDimmingTimeoutMin() {
|
||||
return mScreenDimmingTimeoutMin;
|
||||
public int getScreenDimmingTimeoutMs() {
|
||||
return mScreenDimmingTimeoutMs;
|
||||
}
|
||||
|
||||
public void setTimeFormat(int format) {
|
||||
@@ -665,12 +665,12 @@ public class GeneralData {
|
||||
String pinnedItems = Helpers.parseStr(split, 6);
|
||||
mIsHideShortsFromSubscriptionsEnabled = Helpers.parseBoolean(split, 7, false);
|
||||
mIsRemapFastForwardToNextEnabled = Helpers.parseBoolean(split, 8, false);
|
||||
mScreenDimmingTimeoutMin = Helpers.parseInt(split, 9, 1);
|
||||
//mScreenDimmingTimeoutMs = Helpers.parseInt(split, 9, 1);
|
||||
mIsProxyEnabled = Helpers.parseBoolean(split, 10, false);
|
||||
mIsBridgeCheckEnabled = Helpers.parseBoolean(split, 11, true);
|
||||
mIsOkButtonLongPressDisabled = Helpers.parseBoolean(split, 12, false);
|
||||
mLastPlaylistId = Helpers.parseStr(split, 13);
|
||||
String selectedSections = Helpers.parseStr(split, 14);
|
||||
//String selectedSections = Helpers.parseStr(split, 14);
|
||||
mIsHideUpcomingEnabled = Helpers.parseBoolean(split, 15, false);
|
||||
mIsRemapPageUpToNextEnabled = Helpers.parseBoolean(split, 16, false);
|
||||
mIsRemapPageUpToLikeEnabled = Helpers.parseBoolean(split, 17, false);
|
||||
@@ -692,6 +692,7 @@ public class GeneralData {
|
||||
mSettingsPassword = Helpers.parseStr(split, 33);
|
||||
mIsChildModeEnabled = Helpers.parseBoolean(split, 34, false);
|
||||
mIsHistoryEnabled = Helpers.parseBoolean(split, 35, true);
|
||||
mScreenDimmingTimeoutMs = Helpers.parseInt(split, 36, 60 * 1_000);
|
||||
|
||||
if (pinnedItems != null && !pinnedItems.isEmpty()) {
|
||||
String[] pinnedItemsArr = Helpers.splitArray(pinnedItems);
|
||||
@@ -745,12 +746,13 @@ public class GeneralData {
|
||||
// Zero index is skipped. Selected sections were there.
|
||||
mPrefs.setData(GENERAL_DATA, Helpers.mergeObject(null, mBootSectionId, mIsSettingsSectionEnabled, mAppExitShortcut,
|
||||
mIsReturnToLauncherEnabled,mBackgroundShortcut, pinnedItems, mIsHideShortsFromSubscriptionsEnabled,
|
||||
mIsRemapFastForwardToNextEnabled, mScreenDimmingTimeoutMin,
|
||||
mIsRemapFastForwardToNextEnabled, null,
|
||||
mIsProxyEnabled, mIsBridgeCheckEnabled, mIsOkButtonLongPressDisabled, mLastPlaylistId,
|
||||
null, mIsHideUpcomingEnabled, mIsRemapPageUpToNextEnabled, mIsRemapPageUpToLikeEnabled,
|
||||
mIsRemapChannelUpToNextEnabled, mIsRemapChannelUpToLikeEnabled, mIsRemapPageUpToSpeedEnabled,
|
||||
mIsRemapChannelUpToSpeedEnabled, mIsRemapFastForwardToSpeedEnabled, mIsRemapChannelUpToSearchEnabled,
|
||||
mIsHideShortsFromHomeEnabled, mIsHideShortsFromHistoryEnabled, mIsScreensaverDisabled, mIsVPNEnabled, mLastPlaylistTitle,
|
||||
playlistOrder, pendingStreams, mIsGlobalClockEnabled, mTimeFormat, mSettingsPassword, mIsChildModeEnabled, mIsHistoryEnabled));
|
||||
playlistOrder, pendingStreams, mIsGlobalClockEnabled, mTimeFormat, mSettingsPassword, mIsChildModeEnabled, mIsHistoryEnabled,
|
||||
mScreenDimmingTimeoutMs));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user