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=21963dd6b37abbbe0b85cc68af4682ab6cbdaf37;hb=674b18d882411b94513d77c0aea39fd929a7a62b;hpb=0da12809143008ee7116162be26564e6e6a562cc diff --git a/app/src/main/java/net/ktnx/mobileledger/RetrieveAccountsTask.java b/app/src/main/java/net/ktnx/mobileledger/RetrieveAccountsTask.java index 21963dd6..6e66453b 100644 --- a/app/src/main/java/net/ktnx/mobileledger/RetrieveAccountsTask.java +++ b/app/src/main/java/net/ktnx/mobileledger/RetrieveAccountsTask.java @@ -1,6 +1,22 @@ +/* + * 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.Context; import android.content.SharedPreferences; import android.database.sqlite.SQLiteDatabase; import android.util.Log; @@ -10,19 +26,20 @@ 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; -abstract public class RetrieveAccountsTask extends android.os.AsyncTask { +class RetrieveAccountsTask extends android.os.AsyncTask { int error; private SharedPreferences pref; - private final Context mContext; + WeakReference mContext; - RetrieveAccountsTask(Context context) { + RetrieveAccountsTask(WeakReference context) { mContext = context; error = 0; } @@ -34,10 +51,8 @@ abstract public class RetrieveAccountsTask extends android.os.AsyncTask