+ Pattern account_name_re = Pattern.compile("/register\\?q=inacct%3A([a-zA-Z0-9%]+)\"");
+ Pattern account_value_re = Pattern.compile(
+ "<span class=\"[^\"]*\\bamount\\b[^\"]*\">\\s*([-+]?[\\d.,]+)(?:\\s+(\\S+))?</span>");
+ Pattern tr_end_re = Pattern.compile("</tr>");
+ Pattern descriptions_line_re = Pattern.compile("\\bdescriptionsSuggester\\s*=\\s*new\\b");
+ Pattern description_items_re = Pattern.compile("\"value\":\"([^\"]+)\"");
+ // %3A is '='
+ private boolean success;
+ public RetrieveTransactionsTask(WeakReference<MainActivity> contextRef) {
+ this.contextRef = contextRef;
+ }
+ private static final void L(String msg) {
+ Log.d("transaction-parser", msg);
+ }
+ @Override
+ protected void onProgressUpdate(Progress... values) {
+ super.onProgressUpdate(values);
+ MainActivity context = getContext();
+ if (context == null) return;
+ context.onRetrieveProgress(values[0]);
+ }
+ @Override
+ protected void onPreExecute() {
+ super.onPreExecute();
+ MainActivity context = getContext();
+ if (context == null) return;
+ context.onRetrieveStart();
+ }
+ @Override
+ protected void onPostExecute(Void aVoid) {
+ super.onPostExecute(aVoid);
+ MainActivity context = getContext();
+ if (context == null) return;
+ context.onRetrieveDone(success);
+ }
+ @Override
+ protected void onCancelled() {
+ super.onCancelled();
+ MainActivity context = getContext();
+ if (context == null) return;
+ context.onRetrieveDone(false);
+ }
+ @SuppressLint("DefaultLocale")