From ad5535af814afc43b77d70237177c6ec13583204 Mon Sep 17 00:00:00 2001 From: krtkush Date: Mon, 19 Nov 2018 23:27:13 +0530 Subject: [PATCH] Code refactoring, PR changes. --- .../org/schabi/newpipe/CheckForNewAppVersionTask.java | 3 --- .../newpipe/settings/UpdateSettingsFragment.java | 11 ++++------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/CheckForNewAppVersionTask.java b/app/src/main/java/org/schabi/newpipe/CheckForNewAppVersionTask.java index cd41ac07e..af9b88ac1 100644 --- a/app/src/main/java/org/schabi/newpipe/CheckForNewAppVersionTask.java +++ b/app/src/main/java/org/schabi/newpipe/CheckForNewAppVersionTask.java @@ -70,7 +70,6 @@ public class CheckForNewAppVersionTask extends AsyncTask { protected String doInBackground(Void... voids) { // Make a network request to get latest NewPipe data. - if (client == null) { client = new OkHttpClient @@ -84,10 +83,8 @@ public class CheckForNewAppVersionTask extends AsyncTask { .build(); try { - Response response = client.newCall(request).execute(); return response.body().string(); - } catch (IOException ex) { ErrorActivity.reportError(app, ex, null, null, ErrorActivity.ErrorInfo.make(UserAction.SOMETHING_ELSE, "none", diff --git a/app/src/main/java/org/schabi/newpipe/settings/UpdateSettingsFragment.java b/app/src/main/java/org/schabi/newpipe/settings/UpdateSettingsFragment.java index 157f52a0e..76d887dd1 100644 --- a/app/src/main/java/org/schabi/newpipe/settings/UpdateSettingsFragment.java +++ b/app/src/main/java/org/schabi/newpipe/settings/UpdateSettingsFragment.java @@ -23,14 +23,11 @@ public class UpdateSettingsFragment extends BasePreferenceFragment { } private Preference.OnPreferenceChangeListener updatePreferenceChange - = new Preference.OnPreferenceChangeListener() { - @Override - public boolean onPreferenceChange(Preference preference, Object newValue) { + = (preference, newValue) -> { - defaultPreferences.edit().putBoolean(getString(R.string.update_app_key), - (boolean) newValue).apply(); + defaultPreferences.edit().putBoolean(getString(R.string.update_app_key), + (boolean) newValue).apply(); - return true; - } + return true; }; }