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: 2023-2025 NewPipe contributors <https://newpipe.net>
3+ * SPDX-License-Identifier: GPL-3.0-or-later
4+ */
5+
6+ package org.schabi.newpipe.util.image
7+
8+ import android.content.Context
9+ import org.schabi.newpipe.R
10+ import org.schabi.newpipe.extractor.Image.ResolutionLevel
11+
12+ enum class PreferredImageQuality {
13+ NONE ,
14+ LOW ,
15+ MEDIUM ,
16+ HIGH ;
17+
18+ fun toResolutionLevel (): ResolutionLevel {
19+ return when (this ) {
20+ LOW -> ResolutionLevel .LOW
21+ MEDIUM -> ResolutionLevel .MEDIUM
22+ HIGH -> ResolutionLevel .HIGH
23+ NONE -> ResolutionLevel .UNKNOWN
24+ }
25+ }
26+
27+ companion object {
28+ @JvmStatic
29+ fun fromPreferenceKey (context : Context , key : String? ): PreferredImageQuality {
30+ return when (key) {
31+ context.getString(R .string.image_quality_none_key) -> NONE
32+ context.getString(R .string.image_quality_low_key) -> LOW
33+ context.getString(R .string.image_quality_high_key) -> HIGH
34+ else -> MEDIUM // default to medium
35+ }
36+ }
37+ }
38+ }
You can’t perform that action at this time.
0 commit comments