Android Open Source - openpomo Statistics






From Project

Back to project page openpomo.

License

The source code is released under:

GNU General Public License

If you think the Android project openpomo 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

/**
 * This file is part of Pomodroid.//  ww  w  .  j a v  a2s .c  o  m
 *
 *   Pomodroid is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   Pomodroid 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 for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with Pomodroid.  If not, see <http://www.gnu.org/licenses/>.
 */
package it.unibz.pomodroid;

import android.os.Bundle;
import android.widget.TextView;
import it.unibz.pomodroid.exceptions.PomodroidException;
import it.unibz.pomodroid.models.*;


/**
 * A simple Activity to show an About Window
 *
 * @author Daniel Graziotin <d AT danielgraziotin DOT it>
 * @see it.unibz.pomodroid.SharedActivity
 */
public class Statistics extends SharedActivity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.statistics);
        DBHelper dbHelper = getDbHelper();

        String activitiesCreated = "0";
        String activitiesCompleted = "0";
        String pomodoroStarted = "0";
        String pomodoroFinished = "0";
        String pomodoroBroken = "0";
        String pomodoroFinishedStarted = "0";

        TextView atvActivitiesCreated = (TextView) findViewById(R.id.atvActivitiesCreated);
        TextView atvActivitiesCompleted = (TextView) findViewById(R.id.atvActivitiesCompleted);
        TextView atvPomodoroStarted = (TextView) findViewById(R.id.atvPomodoroStarted);
        TextView atvPomodoroFinished = (TextView) findViewById(R.id.atvPomodoroFinished);
        TextView atvPomodoroBroken = (TextView) findViewById(R.id.atvPomodoroBroken);
        TextView atvPomodoroFinishedStarted = (TextView) findViewById(R.id.atvPomodorosFinishedStarted);

        try {
            activitiesCreated = new Integer(Activity.getAll(dbHelper).size()).toString();
            activitiesCompleted = new Integer(Activity.getCompleted(dbHelper).size()).toString();
            Integer numPomodoroStarted = new Integer(Event.getAllStartedPomodoros(dbHelper).size());
            pomodoroStarted = numPomodoroStarted.toString();
            Integer numPomodoroFinished = new Integer(Event.getAllFinishedPomodoros(dbHelper).size());
            pomodoroFinished = numPomodoroFinished.toString();
            pomodoroBroken = new Integer(Event.getAllInterruptions(dbHelper).size()).toString();
            Integer numPomodoroFinishedStarted = (int) (((float) numPomodoroFinished / (float) numPomodoroStarted) * 100);
            pomodoroFinishedStarted = numPomodoroFinishedStarted.toString().concat("%");
        } catch (PomodroidException e) {
            // TODO Auto-generated catch block
            e.alertUser(getContext());
        }


        atvActivitiesCreated.setText(activitiesCreated);
        atvActivitiesCompleted.setText(activitiesCompleted);
        atvPomodoroStarted.setText(pomodoroStarted);
        atvPomodoroFinished.setText(pomodoroFinished);
        atvPomodoroBroken.setText(pomodoroBroken);
        atvPomodoroFinishedStarted.setText(pomodoroFinishedStarted);


    }
}




Java Source Code List

it.unibz.pomodroid.About.java
it.unibz.pomodroid.ActivityInventorySheet.java
it.unibz.pomodroid.CleanDatabase.java
it.unibz.pomodroid.EditActivity.java
it.unibz.pomodroid.EditService.java
it.unibz.pomodroid.ListServices.java
it.unibz.pomodroid.PomodoroService.java
it.unibz.pomodroid.Pomodoro.java
it.unibz.pomodroid.Pomodroid.java
it.unibz.pomodroid.Preferences.java
it.unibz.pomodroid.Services.java
it.unibz.pomodroid.SharedActivity.java
it.unibz.pomodroid.SharedListActivity.java
it.unibz.pomodroid.Statistics.java
it.unibz.pomodroid.TabPomodroid.java
it.unibz.pomodroid.TabPreferences.java
it.unibz.pomodroid.TodoTodaySheet.java
it.unibz.pomodroid.TrashSheet.java
it.unibz.pomodroid.exceptions.PomodroidException.java
it.unibz.pomodroid.factories.ActivityFactory.java
it.unibz.pomodroid.models.Activity.java
it.unibz.pomodroid.models.DBHelper.java
it.unibz.pomodroid.models.Event.java
it.unibz.pomodroid.models.Service.java
it.unibz.pomodroid.models.User.java
it.unibz.pomodroid.services.TracTicketFetcher.java
it.unibz.pomodroid.services.XmlRpcClient.java
org.xmlrpc.Test.java
org.xmlrpc.android.Base64Coder.java
org.xmlrpc.android.XMLRPCClient.java
org.xmlrpc.android.XMLRPCException.java
org.xmlrpc.android.XMLRPCFault.java
org.xmlrpc.android.XMLRPCSerializer.java