forked from TeamNewPipe/NewPipe
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BraveNewPipeLegacy: (Kitkat) make sure seekbar_preview_thumbnail_high…
…_quality is not set OutOfMemoryError will be triggered as the seekbar_preview_thumbnail generation is allocating too much memory. This patch only allows low resolution until there might be a better solution
- Loading branch information
1 parent
641cd73
commit c05e38c
Showing
5 changed files
with
86 additions
and
1 deletion.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
app/src/brave/java/org/schabi/newpipe/settings/BraveVideoAudioSettingsBaseFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package org.schabi.newpipe.settings; | ||
|
||
public abstract class BraveVideoAudioSettingsBaseFragment extends BraveBasePreferenceFragment { | ||
} |
4 changes: 4 additions & 0 deletions
4
.../braveConscrypt/java/org/schabi/newpipe/settings/BraveVideoAudioSettingsBaseFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package org.schabi.newpipe.settings; | ||
|
||
public abstract class BraveVideoAudioSettingsBaseFragment extends BraveBasePreferenceFragment { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
...src/braveLegacy/java/org/schabi/newpipe/settings/BraveVideoAudioSettingsBaseFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package org.schabi.newpipe.settings; | ||
|
||
import android.content.Context; | ||
import android.content.SharedPreferences; | ||
import android.os.Build; | ||
|
||
import org.schabi.newpipe.R; | ||
|
||
import androidx.preference.ListPreference; | ||
import androidx.preference.PreferenceManager; | ||
|
||
|
||
public abstract class BraveVideoAudioSettingsBaseFragment extends BraveBasePreferenceFragment { | ||
|
||
public static void makeConfigOptionsSuitableForFlavor(final Context context) { | ||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { | ||
return; | ||
} | ||
|
||
final SharedPreferences prefs = | ||
PreferenceManager.getDefaultSharedPreferences(context); | ||
|
||
// make sure seekbar thumbnail stuff is *not* set to high quality as it | ||
// consumes to much memory which gives OutOfMemoryError Exception on Kitkat | ||
// -> so default to low quality | ||
// -> TODO long run fix the bug of the seekbar_preview_thumbnail implementation | ||
final String seekBarOption = prefs.getString(context.getString( | ||
R.string.seekbar_preview_thumbnail_key), null | ||
); | ||
if ((null == seekBarOption) || (seekBarOption.equals( | ||
context.getString(R.string.seekbar_preview_thumbnail_high_quality)))) { | ||
prefs.edit().putString( | ||
context.getString(R.string.seekbar_preview_thumbnail_key), | ||
context.getString(R.string.seekbar_preview_thumbnail_low_quality)).apply(); | ||
} | ||
} | ||
|
||
@Override | ||
protected void manipulateCreatedPreferenceOptions() { | ||
super.manipulateCreatedPreferenceOptions(); | ||
|
||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { | ||
return; | ||
} | ||
|
||
setListPreferenceData(); | ||
} | ||
|
||
private void setListPreferenceData() { | ||
final ListPreference lp = (ListPreference) findPreference( | ||
getString(R.string.seekbar_preview_thumbnail_key)); | ||
|
||
final CharSequence[] entries = { | ||
getString(R.string.low_quality_smaller), | ||
getString(R.string.dont_show) | ||
}; | ||
|
||
final CharSequence[] entryValues = { | ||
getString(R.string.seekbar_preview_thumbnail_low_quality), | ||
getString(R.string.seekbar_preview_thumbnail_none) | ||
}; | ||
|
||
lp.setEntries(entries); | ||
lp.setEntryValues(entryValues); | ||
// default value has to be set in BraveApp via the static | ||
// method makeConfigOptionsSuitableForFlavor() | ||
//lp.setDefaultValue(getString(R.string.seekbar_preview_thumbnail_low_quality)); | ||
//lp.setValueIndex(0); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters