Skip to content

Commit 1fbed27

Browse files
Simplify resources.
1 parent 47ab25e commit 1fbed27

File tree

7 files changed

+42
-2345
lines changed

7 files changed

+42
-2345
lines changed

app/src/main/java/org/schabi/newpipe/settings/VideoAudioSettingsFragment.java

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222

2323
public class VideoAudioSettingsFragment extends BasePreferenceFragment {
2424
private final SharedPreferences.OnSharedPreferenceChangeListener listener =
25-
(sharedPreferences, s) -> {
25+
(sharedPreferences, key) -> {
2626
// on M and above, if user chooses to minimise to popup player on exit
2727
// and the app doesn't have display over other apps permission,
2828
// show a snackbar to let the user give permission
2929
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
30-
&& s.equals(getString(R.string.minimize_on_exit_key))) {
31-
final String newSetting = sharedPreferences.getString(s, null);
30+
&& key.equals(getString(R.string.minimize_on_exit_key))) {
31+
final String newSetting = sharedPreferences.getString(key, null);
3232
if (newSetting != null
3333
&& newSetting.equals(getString(R.string.minimize_on_exit_popup_key))
3434
&& !Settings.canDrawOverlays(getContext())) {
@@ -39,7 +39,7 @@ public class VideoAudioSettingsFragment extends BasePreferenceFragment {
3939
view -> checkSystemAlertWindowPermission(getContext()))
4040
.show();
4141
}
42-
} else if (s.equals(getString(R.string.use_inexact_seek_key))) {
42+
} else if (key.equals(getString(R.string.use_inexact_seek_key))) {
4343
updateSeekOptions();
4444
}
4545
};
@@ -50,13 +50,15 @@ public void onCreatePreferences(final Bundle savedInstanceState, final String ro
5050

5151
updateSeekOptions();
5252

53-
// PiP is unavailable on Android Go devices, so disable the popup setting on those devices.
54-
final PackageManager packageManager = requireContext().getPackageManager();
55-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N
56-
&& !packageManager.hasSystemFeature(PackageManager.FEATURE_PICTURE_IN_PICTURE)) {
57-
final ListPreference popupConfig =
58-
findPreference(getString(R.string.popup_configuration_key));
59-
if (popupConfig != null) {
53+
final var popupConfig = findPreference(getString(R.string.popup_configuration_key));
54+
if (popupConfig != null) {
55+
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
56+
// PiP was introduced in Android Nougat.
57+
popupConfig.setVisible(false);
58+
} else if (!requireContext().getPackageManager()
59+
.hasSystemFeature(PackageManager.FEATURE_PICTURE_IN_PICTURE)) {
60+
// PiP is disabled on Android Go devices, so disable the popup setting on those
61+
// devices.
6062
popupConfig.setEnabled(false);
6163
popupConfig.setSummary(getString(R.string.pip_unavailable));
6264
}

app/src/main/res/values-v24/settings_keys.xml

Lines changed: 0 additions & 1338 deletions
This file was deleted.

app/src/main/res/values-v24/strings.xml

Lines changed: 0 additions & 757 deletions
This file was deleted.

app/src/main/res/values/settings_keys.xml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1270,7 +1270,6 @@
12701270
</string-array>
12711271

12721272
<string name="tablet_mode_key">tablet_mode</string>
1273-
12741273
<string name="tablet_mode_auto_key">auto</string>
12751274
<string name="tablet_mode_on_key">on</string>
12761275
<string name="tablet_mode_off_key">off</string>
@@ -1285,6 +1284,18 @@
12851284
<item>@string/off</item>
12861285
</string-array>
12871286

1287+
<string name="popup_configuration_key">popup_configuration</string>
1288+
<string name="popup_mode_pip">pip</string>
1289+
<string name="popup_mode_legacy">legacy</string>
1290+
<string-array name="popup_mode_values">
1291+
<item>@string/popup_mode_pip</item>
1292+
<item>@string/popup_mode_legacy</item>
1293+
</string-array>
1294+
<string-array name="popup_mode_description">
1295+
<item>@string/pip</item>
1296+
<item>@string/legacy</item>
1297+
</string-array>
1298+
12881299
<string name="recaptcha_cookies_key">recaptcha_cookies_key</string>
12891300

12901301
<string name="enable_streams_notifications">enable_streams_notifications</string>

app/src/main/res/values/strings.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@
145145
<string name="settings_category_updates_title">Updates</string>
146146
<string name="settings_category_player_notification_title">Player notification</string>
147147
<string name="settings_category_player_notification_summary">Configure current playing stream notification</string>
148+
<string name="settings_category_player_popup_title">Popup player mode</string>
149+
<string name="settings_category_player_popup_summary">Configure popup player mode</string>
148150
<string name="background_player_playing_toast">Playing in background</string>
149151
<string name="popup_playing_toast">Playing in popup mode</string>
150152
<string name="content">Content</string>
@@ -545,6 +547,11 @@
545547
<string name="list">List</string>
546548
<string name="grid">Grid</string>
547549
<string name="auto">Auto</string>
550+
<!-- Popup configuration -->
551+
<string name="popup_mode">Popup mode</string>
552+
<string name="pip">Picture-in-picture</string>
553+
<string name="legacy">Original</string>
554+
<string name="pip_unavailable">Not configurable on Android Go devices</string>
548555
<!-- Seekbar Preview Thumbnail-->
549556
<string name="seekbar_preview_thumbnail_title">Seekbar thumbnail preview</string>
550557
<string name="high_quality_larger">High quality (larger)</string>

app/src/main/res/xml-v24/video_audio_settings.xml

Lines changed: 0 additions & 238 deletions
This file was deleted.

app/src/main/res/xml/video_audio_settings.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,16 @@
140140
app:singleLineTitle="false"
141141
app:iconSpaceReserved="false" />
142142

143+
<ListPreference
144+
android:defaultValue="@string/popup_mode_legacy"
145+
android:entries="@array/popup_mode_description"
146+
android:entryValues="@array/popup_mode_values"
147+
android:key="@string/popup_configuration_key"
148+
android:summary="%s"
149+
android:title="@string/settings_category_player_popup_title"
150+
app:iconSpaceReserved="false"
151+
app:singleLineTitle="false" />
152+
143153
<SwitchPreferenceCompat
144154
android:defaultValue="false"
145155
android:key="@string/start_main_player_fullscreen_key"

0 commit comments

Comments
 (0)