Handle icon 404s without crashing. Resume settings without crashing on API > 17.
The image loading code for the app cards was presuming that the icon returned did indeed exist. In this case, it crashed due to trying to decode a `null` image. I noticed that when returning to the settings fragment (e.g. by closing then reopening F-Droid while viewing), it will attempt to re-remove the priviledged preference. This causes a crash, so we check to see that we still have the preference before deciding to remove it.
This commit is contained in:
parent
517321356d
commit
5aa44a4d74
@ -150,7 +150,7 @@ public class AppCardController extends RecyclerView.ViewHolder implements ImageL
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
|
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
|
||||||
if (featuredImage != null) {
|
if (featuredImage != null && loadedImage != null) {
|
||||||
new Palette.Builder(loadedImage).generate(new Palette.PaletteAsyncListener() {
|
new Palette.Builder(loadedImage).generate(new Palette.PaletteAsyncListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onGenerated(Palette palette) {
|
public void onGenerated(Palette palette) {
|
||||||
|
@ -227,7 +227,9 @@ public class PreferencesFragment extends PreferenceFragment
|
|||||||
// way to easily install from here.
|
// way to easily install from here.
|
||||||
if (Build.VERSION.SDK_INT > 19 && !installed) {
|
if (Build.VERSION.SDK_INT > 19 && !installed) {
|
||||||
PreferenceCategory other = (PreferenceCategory) findPreference("pref_category_other");
|
PreferenceCategory other = (PreferenceCategory) findPreference("pref_category_other");
|
||||||
other.removePreference(pref);
|
if (pref != null) {
|
||||||
|
other.removePreference(pref);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
pref.setEnabled(installed);
|
pref.setEnabled(installed);
|
||||||
pref.setDefaultValue(installed);
|
pref.setDefaultValue(installed);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user