File tree Expand file tree Collapse file tree
app/src/main/java/org/schabi/newpipe/util/image Expand file tree Collapse file tree Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ /*
2+ * SPDX-FileCopyrightText: 2018-2025 NewPipe contributors <https://newpipe.net>
3+ * SPDX-FileCopyrightText: 2025 NewPipe e.V. <https://newpipe-ev.de>
4+ * SPDX-License-Identifier: GPL-3.0-or-later
5+ */
6+
7+ package org.schabi.newpipe.util.image
8+
9+ import android.content.Context
10+ import org.schabi.newpipe.R
11+ import org.schabi.newpipe.extractor.Image.ResolutionLevel
12+
13+ enum class PreferredImageQuality {
14+ NONE ,
15+ LOW ,
16+ MEDIUM ,
17+ HIGH ;
18+
19+ fun toResolutionLevel (): ResolutionLevel {
20+ return when (this ) {
21+ LOW -> ResolutionLevel .LOW
22+ MEDIUM -> ResolutionLevel .MEDIUM
23+ HIGH -> ResolutionLevel .HIGH
24+ NONE -> ResolutionLevel .UNKNOWN
25+ }
26+ }
27+
28+ companion object {
29+ @JvmStatic
30+ fun fromPreferenceKey (context : Context , key : String? ): PreferredImageQuality {
31+ return when (key) {
32+ context.getString(R .string.image_quality_none_key) -> NONE
33+ context.getString(R .string.image_quality_low_key) -> LOW
34+ context.getString(R .string.image_quality_high_key) -> HIGH
35+ else -> MEDIUM // default to medium
36+ }
37+ }
38+ }
39+ }
You can’t perform that action at this time.
0 commit comments