From dfb898175267d557735b3752a14cd51e6d515e90 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Fri, 21 Apr 2017 17:02:21 +0100 Subject: [PATCH] Remove the ACCOUNT_TYPE constant (now a string resource) This corresponds to commit 41dae8bcb3335b9e77d9e73b33e9bb14f8900af9 from DAVdroid, but was done manually. --- app/src/main/java/com/etesync/syncadapter/AccountSettings.java | 2 +- app/src/main/java/com/etesync/syncadapter/App.java | 2 +- app/src/main/java/com/etesync/syncadapter/Constants.java | 3 --- .../java/com/etesync/syncadapter/ui/AccountListFragment.java | 3 ++- .../etesync/syncadapter/ui/setup/SetupEncryptionFragment.java | 2 +- 5 files changed, 5 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/etesync/syncadapter/AccountSettings.java b/app/src/main/java/com/etesync/syncadapter/AccountSettings.java index 4b5ef41c..845a4de0 100644 --- a/app/src/main/java/com/etesync/syncadapter/AccountSettings.java +++ b/app/src/main/java/com/etesync/syncadapter/AccountSettings.java @@ -329,7 +329,7 @@ public class AccountSettings { // peek into AccountSettings to initiate a possible migration AccountManager accountManager = AccountManager.get(context); - for (Account account : accountManager.getAccountsByType(Constants.ACCOUNT_TYPE)) + for (Account account : accountManager.getAccountsByType(App.getAccountType())) try { App.log.info("Checking account " + account.name); new AccountSettings(context, account); diff --git a/app/src/main/java/com/etesync/syncadapter/App.java b/app/src/main/java/com/etesync/syncadapter/App.java index 3d759535..1fa4e0fd 100644 --- a/app/src/main/java/com/etesync/syncadapter/App.java +++ b/app/src/main/java/com/etesync/syncadapter/App.java @@ -310,7 +310,7 @@ public class App extends Application { if (fromVersion < 7) { /* Fix all of the etags to be non-null */ AccountManager am = AccountManager.get(this); - for (Account account : am.getAccountsByType(Constants.ACCOUNT_TYPE)) { + for (Account account : am.getAccountsByType(App.getAccountType())) { try { // Generate account settings to make sure account is migrated. new AccountSettings(this, account); diff --git a/app/src/main/java/com/etesync/syncadapter/Constants.java b/app/src/main/java/com/etesync/syncadapter/Constants.java index 8b203b3b..fa7b1875 100644 --- a/app/src/main/java/com/etesync/syncadapter/Constants.java +++ b/app/src/main/java/com/etesync/syncadapter/Constants.java @@ -13,9 +13,6 @@ import static com.etesync.syncadapter.BuildConfig.DEBUG_REMOTE_URL; public class Constants { - public static final String - ACCOUNT_TYPE = "com.etesync.syncadapter"; - // notification IDs public final static int NOTIFICATION_ACCOUNT_SETTINGS_UPDATED = 0, diff --git a/app/src/main/java/com/etesync/syncadapter/ui/AccountListFragment.java b/app/src/main/java/com/etesync/syncadapter/ui/AccountListFragment.java index 7a403687..a60e8d91 100644 --- a/app/src/main/java/com/etesync/syncadapter/ui/AccountListFragment.java +++ b/app/src/main/java/com/etesync/syncadapter/ui/AccountListFragment.java @@ -29,6 +29,7 @@ import android.widget.ListView; import android.widget.TextView; import com.etesync.syncadapter.AccountsChangedReceiver; +import com.etesync.syncadapter.App; import com.etesync.syncadapter.Constants; import com.etesync.syncadapter.R; @@ -106,7 +107,7 @@ public class AccountListFragment extends ListFragment implements LoaderManager.L @Override @SuppressLint("MissingPermission") public Account[] loadInBackground() { - return accountManager.getAccountsByType(Constants.ACCOUNT_TYPE); + return accountManager.getAccountsByType(App.getAccountType()); } } diff --git a/app/src/main/java/com/etesync/syncadapter/ui/setup/SetupEncryptionFragment.java b/app/src/main/java/com/etesync/syncadapter/ui/setup/SetupEncryptionFragment.java index e49fde38..b93165bf 100644 --- a/app/src/main/java/com/etesync/syncadapter/ui/setup/SetupEncryptionFragment.java +++ b/app/src/main/java/com/etesync/syncadapter/ui/setup/SetupEncryptionFragment.java @@ -146,7 +146,7 @@ public class SetupEncryptionFragment extends DialogFragment implements LoaderMan protected boolean createAccount(String accountName, BaseConfigurationFinder.Configuration config) { - Account account = new Account(accountName, Constants.ACCOUNT_TYPE); + Account account = new Account(accountName, App.getAccountType()); // create Android account Bundle userData = AccountSettings.initialUserData(config.url, config.userName);