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=6e66453b38a6021bd54b8096d147db63e16c7e1e;hp=33f1e9c901cd926d88063c5adb58c204988cced6;hb=674b18d882411b94513d77c0aea39fd929a7a62b;hpb=dbad20143b21c656795ed4da83d5cb5fb1fafe26 diff --git a/app/src/main/java/net/ktnx/mobileledger/RetrieveAccountsTask.java b/app/src/main/java/net/ktnx/mobileledger/RetrieveAccountsTask.java index 33f1e9c9..6e66453b 100644 --- a/app/src/main/java/net/ktnx/mobileledger/RetrieveAccountsTask.java +++ b/app/src/main/java/net/ktnx/mobileledger/RetrieveAccountsTask.java @@ -1,26 +1,46 @@ +/* + * 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; +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; } @@ -31,106 +51,118 @@ abstract public class RetrieveAccountsTask extends android.os.AsyncTask