Android Open Source - ccardstats Get Stats Task






From Project

Back to project page ccardstats.

License

The source code is released under:

GNU General Public License

If you think the Android project ccardstats listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.github.marwinxxii.ccardstats.gui;
//  w w w  .ja v  a  2s. c  om
import java.util.Map;

import com.github.marwinxxii.ccardstats.db.DBHelper;

import android.os.AsyncTask;

public class GetStatsTask extends AsyncTask<Void, Void, Map<Integer, double[]>> {
    
    public enum FilterType {
        MONTH, YEAR;
    }
    
    private SimpleListActivity context;
    private String card;
    private FilterType filter;
    private int year, month;
    
    public GetStatsTask(SimpleListActivity context, String card, FilterType filter,
            int year, int month) {
        this.context = context;
        this.card = card;
        this.filter = filter;
        this.year = year;
        this.month = month;
    }

    @Override
    protected Map<Integer, double[]> doInBackground(Void... params) {
        DBHelper helper = new DBHelper(context);
        Map<Integer, double[]> result;
        switch (filter) {
            case MONTH:
                result=helper.getMonthStats(card, year, month);
                result.put(-1, helper.getMonthTotalStats(card, year, month));
                break;
            default:
                result=helper.getYearStats(card, year);
                result.put(-1, helper.getYearTotalStats(card, year));
                break;
        }
        helper.close();
        return result;
    }
    
    @Override
    protected void onPostExecute(Map<Integer, double[]> result) {
        context.onTaskComplete(result);
    }

}




Java Source Code List

com.github.marwinxxii.ccardstats.Application.java
com.github.marwinxxii.ccardstats.SmsReceiver.java
com.github.marwinxxii.ccardstats.db.Card.java
com.github.marwinxxii.ccardstats.db.DBHelper.java
com.github.marwinxxii.ccardstats.gui.CardListActivity.java
com.github.marwinxxii.ccardstats.gui.GetStatsTask.java
com.github.marwinxxii.ccardstats.gui.ListActivity.java
com.github.marwinxxii.ccardstats.gui.MonthStatsActivity.java
com.github.marwinxxii.ccardstats.gui.PreferencesActivity.java
com.github.marwinxxii.ccardstats.gui.SimpleListActivity.java
com.github.marwinxxii.ccardstats.gui.TextMappingAdapter.java
com.github.marwinxxii.ccardstats.gui.YearStatsActivity.java
com.github.marwinxxii.ccardstats.helpers.DateHelper.java
com.github.marwinxxii.ccardstats.helpers.MoneyHelper.java
com.github.marwinxxii.ccardstats.notifications.NotificationReader.java
com.github.marwinxxii.ccardstats.notifications.NotificationService.java
com.github.marwinxxii.ccardstats.notifications.SberbankService.java
com.github.marwinxxii.ccardstats.notifications.SmsNotification.java
com.github.marwinxxii.ccardstats.notifications.SmsParser.java
com.github.marwinxxii.ccardstats.notifications.SmsReader.java