Skip to content

Commit

Permalink
Changing license to GPLv2
Browse files Browse the repository at this point in the history
  • Loading branch information
ambrice committed Jul 22, 2010
1 parent 712e62d commit a9179c4
Show file tree
Hide file tree
Showing 11 changed files with 507 additions and 28 deletions.
339 changes: 339 additions & 0 deletions License

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions README
@@ -0,0 +1,7 @@
Timesheet Android application.

Timesheet is an application designed primarily for contractors and freelancers to track the time spent on different tasks.

You can add billable tasks and unbillable tasks (such as "Lunch") and get a daily or weekly report of time spent on each.

- Aaron Brice <aaron@tastycactus.com>
18 changes: 16 additions & 2 deletions src/com/tastycactus/timesheet/ExportActivity.java
@@ -1,7 +1,18 @@
/***
/*
* Copyright (c) 2010 Tasty Cactus Software, LLC
*
* All rights reserved.
* This program 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 2
* of the License, or (at your option) any later version.
*
* This program 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.
*
* Aaron Brice <aaron@tastycactus.com>
*
*/

package com.tastycactus.timesheet;
Expand Down Expand Up @@ -48,6 +59,9 @@ public ExportData(Cursor c, long row_id) {
m_end_date = c.getString(c.getColumnIndex("end_date"));
}

/**
*
*/
public void set_start_date(int year, int month, int day) {
m_start_date = formatDate(year, month, day);
}
Expand Down
17 changes: 14 additions & 3 deletions src/com/tastycactus/timesheet/MergeAdapter.java
@@ -1,7 +1,18 @@
/***
* Copyright (c) 2009 Tasty Cactus Software, LLC
/*
* Copyright (c) 2009-2010 Tasty Cactus Software, LLC
*
* All rights reserved.
* This program 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 2
* of the License, or (at your option) any later version.
*
* This program 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.
*
* Aaron Brice <aaron@tastycactus.com>
*
*/

package com.tastycactus.timesheet;
Expand Down
17 changes: 14 additions & 3 deletions src/com/tastycactus/timesheet/TaskEditActivity.java
@@ -1,7 +1,18 @@
/***
* Copyright (c) 2009 Tasty Cactus Software, LLC
/*
* Copyright (c) 2009-2010 Tasty Cactus Software, LLC
*
* All rights reserved.
* This program 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 2
* of the License, or (at your option) any later version.
*
* This program 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.
*
* Aaron Brice <aaron@tastycactus.com>
*
*/

package com.tastycactus.timesheet;
Expand Down
21 changes: 18 additions & 3 deletions src/com/tastycactus/timesheet/TimeEntriesActivity.java
@@ -1,7 +1,18 @@
/***
* Copyright (c) 2009 Tasty Cactus Software, LLC
/*
* Copyright (c) 2009-2010 Tasty Cactus Software, LLC
*
* All rights reserved.
* This program 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 2
* of the License, or (at your option) any later version.
*
* This program 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.
*
* Aaron Brice <aaron@tastycactus.com>
*
*/

package com.tastycactus.timesheet;
Expand Down Expand Up @@ -38,6 +49,7 @@
import java.util.Map;
import java.util.Vector;

import com.tastycactus.timesheet.TimesheetAppWidgetProvider;
import com.tastycactus.timesheet.TimesheetDatabase;
import com.tastycactus.timesheet.MergeAdapter;

Expand Down Expand Up @@ -365,6 +377,9 @@ public boolean onContextItemSelected(MenuItem item)
m_week_data.requery();
m_merge_adapter.notifyDataSetChanged();
m_totals_adapter.notifyDataSetChanged();
// Update the App Widget in case we deleted the currently-active
// time entry
startService(new Intent(this, TimesheetAppWidgetProvider.UpdateService.class));
return true;
case EDIT_TIME_ENTRY_MENU_ITEM:
Intent i = new Intent(this, TimeEntryEditActivity.class);
Expand Down
15 changes: 13 additions & 2 deletions src/com/tastycactus/timesheet/TimeEntryEditActivity.java
@@ -1,7 +1,18 @@
/***
/*
* Copyright (c) 2009-2010 Tasty Cactus Software, LLC
*
* All rights reserved.
* This program 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 2
* of the License, or (at your option) any later version.
*
* This program 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.
*
* Aaron Brice <aaron@tastycactus.com>
*
*/

package com.tastycactus.timesheet;
Expand Down
24 changes: 21 additions & 3 deletions src/com/tastycactus/timesheet/TimesheetActivity.java
@@ -1,7 +1,18 @@
/***
* Copyright (c) 2009 Tasty Cactus Software, LLC
/*
* Copyright (c) 2009-2010 Tasty Cactus Software, LLC
*
* All rights reserved.
* This program 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 2
* of the License, or (at your option) any later version.
*
* This program 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.
*
* Aaron Brice <aaron@tastycactus.com>
*
*/

package com.tastycactus.timesheet;
Expand All @@ -25,6 +36,7 @@
import android.widget.ListView;
import android.widget.SimpleCursorAdapter;

import com.tastycactus.timesheet.TimesheetAppWidgetProvider;
import com.tastycactus.timesheet.TimesheetDatabase;

public class TimesheetActivity extends ListActivity {
Expand Down Expand Up @@ -108,6 +120,8 @@ public void onListItemClick(ListView lv, View v, int position, long id) {
} else {
m_db.changeTask(id);
}
// Update the App Widget
startService(new Intent(this, TimesheetAppWidgetProvider.UpdateService.class));
}

@Override
Expand Down Expand Up @@ -145,6 +159,8 @@ public boolean onContextItemSelected(MenuItem item) {
case DELETE_TASK_MENU_ITEM:
m_db.deleteTask(info.id);
m_task_cursor.requery();
// Update the App Widget, if necessary
startService(new Intent(this, TimesheetAppWidgetProvider.UpdateService.class));
return true;
}
return false;
Expand All @@ -170,6 +186,8 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) {

if (resultCode == RESULT_OK) {
m_task_cursor.requery();
// Update the App Widget, if necessary
startService(new Intent(this, TimesheetAppWidgetProvider.UpdateService.class));
}
}

Expand Down
25 changes: 21 additions & 4 deletions src/com/tastycactus/timesheet/TimesheetAppWidgetProvider.java
@@ -1,7 +1,18 @@
/***
/*
* Copyright (c) 2010 Tasty Cactus Software, LLC
*
* All rights reserved.
* This program 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 2
* of the License, or (at your option) any later version.
*
* This program 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.
*
* Aaron Brice <aaron@tastycactus.com>
*
*/

package com.tastycactus.timesheet;
Expand Down Expand Up @@ -75,8 +86,14 @@ public void onHandleIntent(Intent intent) {
private RemoteViews buildUpdate(Context context) {
long task_id = m_prefs.getLong("app_task", -1);
long current_id = m_db.getCurrentTaskId();
if (task_id == -1) {
task_id = current_id;

// task_id could be an id that has since been deleted
if (task_id == -1 || !m_db.isValidTask(task_id)) {
if (current_id == 0) {
task_id = m_db.getFirstTaskId();
} else {
task_id = current_id;
}
SharedPreferences.Editor edit = m_prefs.edit();
edit.putLong("app_task", task_id);
edit.commit();
Expand Down
34 changes: 30 additions & 4 deletions src/com/tastycactus/timesheet/TimesheetDatabase.java
@@ -1,7 +1,18 @@
/***
/*
* Copyright (c) 2009-2010 Tasty Cactus Software, LLC
*
* All rights reserved.
* This program 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 2
* of the License, or (at your option) any later version.
*
* This program 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.
*
* Aaron Brice <aaron@tastycactus.com>
*
*/

package com.tastycactus.timesheet;
Expand Down Expand Up @@ -71,6 +82,11 @@ public Cursor getTasks() {
return c;
}

public long getFirstTaskId() {
Cursor c = getTasks();
return c.getLong(0);
}

public Cursor getTask(long id) {
SQLiteDatabase db = getReadableDatabase();
Cursor c = db.query("tasks", new String[] {"_id", "title", "billable"}, "_id = ?", new String[] {Long.toString(id)}, null, null, null);
Expand All @@ -81,8 +97,18 @@ public Cursor getTask(long id) {
public String getTaskName(long id) {
SQLiteDatabase db = getReadableDatabase();
Cursor c = db.query("tasks", new String[] {"title"}, "_id = ?", new String[] {Long.toString(id)}, null, null, null);
c.moveToFirst();
return c.getString(0);
if (c.getCount() > 0) {
c.moveToFirst();
return c.getString(0);
} else {
return "";
}
}

boolean isValidTask(long id) {
SQLiteDatabase db = getReadableDatabase();
Cursor c = db.query("tasks", new String[] {"title"}, "_id = ?", new String[] {Long.toString(id)}, null, null, null);
return c.getCount() > 0;
}

public void newTask(String title, boolean billable) {
Expand Down
18 changes: 14 additions & 4 deletions src/com/tastycactus/timesheet/TimesheetPreferences.java
@@ -1,12 +1,22 @@
/***
* Copyright (c) 2009 Tasty Cactus Software, LLC
/*
* Copyright (c) 2009-2010 Tasty Cactus Software, LLC
*
* All rights reserved.
* This program 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 2
* of the License, or (at your option) any later version.
*
* This program 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.
*
* Aaron Brice <aaron@tastycactus.com>
*
*/

package com.tastycactus.timesheet;

import android.app.Activity;
import android.os.Bundle;
import android.preference.PreferenceActivity;

Expand Down

0 comments on commit a9179c4

Please sign in to comment.