From ee1c20c61a1860df19e31763aa407450c065dc63 Mon Sep 17 00:00:00 2001 From: Alex Baker Date: Sun, 6 Jan 2019 04:59:32 +0000 Subject: [PATCH] Let user turn Google Drive backup off --- .../org/tasks/preferences/BasicPreferences.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/org/tasks/preferences/BasicPreferences.java b/app/src/main/java/org/tasks/preferences/BasicPreferences.java index f8148ba8d..f24771cb9 100644 --- a/app/src/main/java/org/tasks/preferences/BasicPreferences.java +++ b/app/src/main/java/org/tasks/preferences/BasicPreferences.java @@ -177,14 +177,20 @@ public class BasicPreferences extends InjectingPreferenceActivity googleDriveBackup .setOnPreferenceChangeListener( (preference, newValue) -> { - if (newValue != null && (Boolean) newValue) { - if (!playServices.refreshAndCheck()) { - playServices.resolve(this); - } else { + if (newValue == null) { + return false; + } + + if ((Boolean) newValue) { + if (playServices.refreshAndCheck()) { requestLogin(); + } else { + playServices.resolve(this); } + return false; + } else { + return true; } - return false; }); requires(