// Path: src/it/unibz/pomodroid/exceptions/PomodroidException.java
// public class PomodroidException extends Exception {
// 
//     /**
//      * Required by the compiler
//      */
//     private static final long serialVersionUID = 1L;
//     /**
//      * A Custom title for an Exception when displayed to User
//      */
//     private String title = null;
// 
// 
//     /**
//      * Default constructor
//      */
//     public PomodroidException(Exception e) {
//         // call superclass constructor
//         super();
//     }
// 
//     /**
//      * Default constructor
//      */
//     public PomodroidException() {
//         // call superclass constructor
//         super();
//     }
// 
//     /**
//      * Constructor for displaying a custom message
//      */
//     public PomodroidException(String message) {
//         // Call super class constructor
//         super(message);
//     }
// 
//     /**
//      * Constructor for displaying a custom message and title
//      */
//     public PomodroidException(String message, String title) {
//         super(message);
//         this.title = title;
//     }
// 
//     /**
//      * @return title
//      */
//     public String getTitle() {
//         return title;
//     }
// 
//     /**
//      * the title to set
//      *
//      * @param title
//      */
//     public void setTitle(String title) {
//         this.title = title;
//     }
// 
// 
//     /**
//      * This method shows an exception to user, with a Toast
//      *
//      * @param context
//      */
//     public void alertUser(Context context) {
//         Toast.makeText(context, this.getMessage(), Toast.LENGTH_LONG).show();
//     }
// 
//     /**
//      * This method shows a simply message (information)
//      *
//      * @param context
//      * @param title
//      */
//     public void alertUser(Context context, String title) {
//         Toast.makeText(context, title + ": " + this.getMessage(), Toast.LENGTH_LONG).show();
//     }
// 
//     /**
//      * This method shows a simply message (information)
//      *
//      * @param context
//      * @param title
//      */
//     public static void createAlert(Context context, String title, String message) {
//         Toast.makeText(context, title + ": " + message, Toast.LENGTH_LONG).show();
//     }
// 
// }


import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RelativeLayout;
import android.util.Log;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
import it.unibz.pomodroid.exceptions.PomodroidException;
import it.unibz.pomodroid.models.*;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
/**
 * This file is part of Pomodroid.
 *
 *   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;




/**
 * Todo Today Sheet class is an extension of Shared List activity. This class
 * shows to the user which activities have to be done today.
 * <p/>
 * Here we can face the activity, move it into the activity inventory sheet or
 * into the trash sheet.
 *
 * @author Daniel Graziotin <d AT danielgraziotin DOT it>
 * @author Thomas Schievenin <thomas.schievenin@stud-inf.unibz.it>
 * @see it.unibz.pomodroid.SharedListActivity
 */
public class TodoTodaySheet extends SharedListActivity {

    /**
     * @see it.unibz.pomodroid.SharedListActivity#onCreate(android.os.Bundle)
     */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.setResourceLayout(R.layout.ttsactivityentry);
        super.setContext(this);
        super.onCreate(savedInstanceState);

        //TextView textViewEmptySheet = (TextView) findViewById(R.id.atvEmptySheet);
        //textViewEmptySheet.setText(getString(R.string.no_activities_tts));
        //textViewEmptySheet.setVisibility(View.INVISIBLE);
        Button abQuickInsertActivity = (Button) findViewById(R.id.abQuickInsertActivity);

        final EditText aetQuickInsertActivity = (EditText) findViewById(R.id.aetQuickInsertActivity);
        abQuickInsertActivity.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                if (aetQuickInsertActivity.getText().toString().equals(""))
                    return;
                Calendar calendar = new GregorianCalendar();
                try {
                    Activity activity = new Activity(0, 0, new Date(), calendar
                            .getTime(), aetQuickInsertActivity.getText()
                            .toString(), "", "local", Activity
                            .getLastLocalId(dbHelper) + 1, "medium", "you",
                            "task");
                    activity.setTodoToday(true);
                    activity.save(dbHelper);
                    //findViewById(R.id.atvEmptySheet)
                    //		.setVisibility(View.INVISIBLE);
                    refreshSheet();

// Path: src/it/unibz/pomodroid/exceptions/PomodroidException.java
// public class PomodroidException extends Exception {
// 
//     /**
//      * Required by the compiler
//      */
//     private static final long serialVersionUID = 1L;
//     /**
//      * A Custom title for an Exception when displayed to User
//      */
//     private String title = null;
// 
// 
//     /**
//      * Default constructor
//      */
//     public PomodroidException(Exception e) {
//         // call superclass constructor
//         super();
//     }
// 
//     /**
//      * Default constructor
//      */
//     public PomodroidException() {
//         // call superclass constructor
//         super();
//     }
// 
//     /**
//      * Constructor for displaying a custom message
//      */
//     public PomodroidException(String message) {
//         // Call super class constructor
//         super(message);
//     }
// 
//     /**
//      * Constructor for displaying a custom message and title
//      */
//     public PomodroidException(String message, String title) {
//         super(message);
//         this.title = title;
//     }
// 
//     /**
//      * @return title
//      */
//     public String getTitle() {
//         return title;
//     }
// 
//     /**
//      * the title to set
//      *
//      * @param title
//      */
//     public void setTitle(String title) {
//         this.title = title;
//     }
// 
// 
//     /**
//      * This method shows an exception to user, with a Toast
//      *
//      * @param context
//      */
//     public void alertUser(Context context) {
//         Toast.makeText(context, this.getMessage(), Toast.LENGTH_LONG).show();
//     }
// 
//     /**
//      * This method shows a simply message (information)
//      *
//      * @param context
//      * @param title
//      */
//     public void alertUser(Context context, String title) {
//         Toast.makeText(context, title + ": " + this.getMessage(), Toast.LENGTH_LONG).show();
//     }
// 
//     /**
//      * This method shows a simply message (information)
//      *
//      * @param context
//      * @param title
//      */
//     public static void createAlert(Context context, String title, String message) {
//         Toast.makeText(context, title + ": " + message, Toast.LENGTH_LONG).show();
//     }
// 
// }


// Path: src/it/unibz/pomodroid/TodoTodaySheet.java
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RelativeLayout;
import android.util.Log;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
import it.unibz.pomodroid.exceptions.PomodroidException;
import it.unibz.pomodroid.models.*;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;

/**
 * This file is part of Pomodroid.
 *
 *   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;




/**
 * Todo Today Sheet class is an extension of Shared List activity. This class
 * shows to the user which activities have to be done today.
 * <p/>
 * Here we can face the activity, move it into the activity inventory sheet or
 * into the trash sheet.
 *
 * @author Daniel Graziotin <d AT danielgraziotin DOT it>
 * @author Thomas Schievenin <thomas.schievenin@stud-inf.unibz.it>
 * @see it.unibz.pomodroid.SharedListActivity
 */
public class TodoTodaySheet extends SharedListActivity {

    /**
     * @see it.unibz.pomodroid.SharedListActivity#onCreate(android.os.Bundle)
     */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.setResourceLayout(R.layout.ttsactivityentry);
        super.setContext(this);
        super.onCreate(savedInstanceState);

        //TextView textViewEmptySheet = (TextView) findViewById(R.id.atvEmptySheet);
        //textViewEmptySheet.setText(getString(R.string.no_activities_tts));
        //textViewEmptySheet.setVisibility(View.INVISIBLE);
        Button abQuickInsertActivity = (Button) findViewById(R.id.abQuickInsertActivity);

        final EditText aetQuickInsertActivity = (EditText) findViewById(R.id.aetQuickInsertActivity);
        abQuickInsertActivity.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                if (aetQuickInsertActivity.getText().toString().equals(""))
                    return;
                Calendar calendar = new GregorianCalendar();
                try {
                    Activity activity = new Activity(0, 0, new Date(), calendar
                            .getTime(), aetQuickInsertActivity.getText()
                            .toString(), "", "local", Activity
                            .getLastLocalId(dbHelper) + 1, "medium", "you",
                            "task");
                    activity.setTodoToday(true);
                    activity.save(dbHelper);
                    //findViewById(R.id.atvEmptySheet)
                    //		.setVisibility(View.INVISIBLE);
                    refreshSheet();

                    throw new PomodroidException("INFO: Activity saved.");