X-Git-Url: https://git.ktnx.net/?p=mobile-ledger.git;a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2FRetrieveAccountsTask.java;h=75c405642293b8b10af761abfa13969fdb0df981;hp=16919b336b62fac88f73489492924c0178c35dfd;hb=8b2a83f10265f8c8e8044b8dd990337283834afd;hpb=1d78d069e125c9c4d66d413a1f862908fca96d83 diff --git a/app/src/main/java/net/ktnx/mobileledger/RetrieveAccountsTask.java b/app/src/main/java/net/ktnx/mobileledger/RetrieveAccountsTask.java index 16919b33..75c40564 100644 --- a/app/src/main/java/net/ktnx/mobileledger/RetrieveAccountsTask.java +++ b/app/src/main/java/net/ktnx/mobileledger/RetrieveAccountsTask.java @@ -1,6 +1,24 @@ +/* + * Copyright © 2018 Damyan Ivanov. + * This file is part of Mobile-Ledger. + * Mobile-Ledger is free software: you can distribute it and/or modify it + * under the term of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your opinion), any later version. + * + * Mobile-Ledger is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License terms for details. + * + * You should have received a copy of the GNU General Public License + * along with Mobile-Ledger. If not, see . + */ + package net.ktnx.mobileledger; import android.content.SharedPreferences; +import android.database.sqlite.SQLiteDatabase; import android.util.Log; import java.io.BufferedReader; @@ -8,20 +26,21 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; +import java.lang.ref.WeakReference; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URLDecoder; import java.util.regex.Matcher; import java.util.regex.Pattern; -import static net.ktnx.mobileledger.MobileLedgerDB.db; - -abstract public class RetrieveAccountsTask extends android.os.AsyncTask { +class RetrieveAccountsTask extends android.os.AsyncTask { int error; private SharedPreferences pref; + WeakReference mContext; - RetrieveAccountsTask() { + RetrieveAccountsTask(WeakReference context) { + mContext = context; error = 0; } @@ -35,104 +54,108 @@ abstract public class RetrieveAccountsTask extends android.os.AsyncTask