Code refactoring, PR changes.

This commit is contained in:
krtkush 2018-11-19 23:27:13 +05:30
parent 939cc56951
commit ad5535af81
2 changed files with 4 additions and 10 deletions

View File

@ -70,7 +70,6 @@ public class CheckForNewAppVersionTask extends AsyncTask<Void, Void, String> {
protected String doInBackground(Void... voids) { protected String doInBackground(Void... voids) {
// Make a network request to get latest NewPipe data. // Make a network request to get latest NewPipe data.
if (client == null) { if (client == null) {
client = new OkHttpClient client = new OkHttpClient
@ -84,10 +83,8 @@ public class CheckForNewAppVersionTask extends AsyncTask<Void, Void, String> {
.build(); .build();
try { try {
Response response = client.newCall(request).execute(); Response response = client.newCall(request).execute();
return response.body().string(); return response.body().string();
} catch (IOException ex) { } catch (IOException ex) {
ErrorActivity.reportError(app, ex, null, null, ErrorActivity.reportError(app, ex, null, null,
ErrorActivity.ErrorInfo.make(UserAction.SOMETHING_ELSE, "none", ErrorActivity.ErrorInfo.make(UserAction.SOMETHING_ELSE, "none",

View File

@ -23,14 +23,11 @@ public class UpdateSettingsFragment extends BasePreferenceFragment {
} }
private Preference.OnPreferenceChangeListener updatePreferenceChange private Preference.OnPreferenceChangeListener updatePreferenceChange
= new Preference.OnPreferenceChangeListener() { = (preference, newValue) -> {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
defaultPreferences.edit().putBoolean(getString(R.string.update_app_key), defaultPreferences.edit().putBoolean(getString(R.string.update_app_key),
(boolean) newValue).apply(); (boolean) newValue).apply();
return true; return true;
}
}; };
} }