From 0be3e83d3b3bf8a7428c6a0108881e5aa8b47dd3 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Sun, 27 Jan 2013 15:55:33 +0100 Subject: [PATCH] Initial commit --- .gitignore | 2 + AndroidManifest.xml | 17 ++ ant.properties | 17 ++ build.xml | 92 +++++++++++ local.properties | 10 ++ proguard-project.txt | 20 +++ project.properties | 14 ++ res/drawable-hdpi/add.png | Bin 0 -> 1142 bytes res/drawable-hdpi/ic_launcher.png | Bin 0 -> 4147 bytes res/drawable-hdpi/save.png | Bin 0 -> 1335 bytes res/drawable-ldpi/ic_launcher.png | Bin 0 -> 1723 bytes res/drawable-mdpi/add.png | Bin 0 -> 1090 bytes res/drawable-mdpi/ic_launcher.png | Bin 0 -> 2574 bytes res/drawable-mdpi/save.png | Bin 0 -> 1191 bytes res/layout/add.xml | 21 +++ res/layout/main.xml | 10 ++ res/menu/add_activity.xml | 7 + res/menu/main_activity.xml | 7 + res/values/strings.xml | 9 ++ src/org/ryuslash/Dailies/AddActivity.java | 106 ++++++++++++ src/org/ryuslash/Dailies/DailiesActivity.java | 91 +++++++++++ .../ryuslash/Dailies/DailiesDataSource.java | 152 ++++++++++++++++++ src/org/ryuslash/Dailies/Daily.java | 107 ++++++++++++ src/org/ryuslash/Dailies/SQLiteHelper.java | 51 ++++++ 24 files changed, 733 insertions(+) create mode 100644 .gitignore create mode 100644 AndroidManifest.xml create mode 100644 ant.properties create mode 100644 build.xml create mode 100644 local.properties create mode 100644 proguard-project.txt create mode 100644 project.properties create mode 100644 res/drawable-hdpi/add.png create mode 100644 res/drawable-hdpi/ic_launcher.png create mode 100644 res/drawable-hdpi/save.png create mode 100644 res/drawable-ldpi/ic_launcher.png create mode 100644 res/drawable-mdpi/add.png create mode 100644 res/drawable-mdpi/ic_launcher.png create mode 100644 res/drawable-mdpi/save.png create mode 100644 res/layout/add.xml create mode 100644 res/layout/main.xml create mode 100644 res/menu/add_activity.xml create mode 100644 res/menu/main_activity.xml create mode 100644 res/values/strings.xml create mode 100644 src/org/ryuslash/Dailies/AddActivity.java create mode 100644 src/org/ryuslash/Dailies/DailiesActivity.java create mode 100644 src/org/ryuslash/Dailies/DailiesDataSource.java create mode 100644 src/org/ryuslash/Dailies/Daily.java create mode 100644 src/org/ryuslash/Dailies/SQLiteHelper.java diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7792e06 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +bin/ +gen/ diff --git a/AndroidManifest.xml b/AndroidManifest.xml new file mode 100644 index 0000000..8713671 --- /dev/null +++ b/AndroidManifest.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + diff --git a/ant.properties b/ant.properties new file mode 100644 index 0000000..b0971e8 --- /dev/null +++ b/ant.properties @@ -0,0 +1,17 @@ +# This file is used to override default values used by the Ant build system. +# +# This file must be checked into Version Control Systems, as it is +# integral to the build system of your project. + +# This file is only used by the Ant script. + +# You can use this to override default values such as +# 'source.dir' for the location of your java source folder and +# 'out.dir' for the location of your output folder. + +# You can also use it define how the release builds are signed by declaring +# the following properties: +# 'key.store' for the location of your keystore and +# 'key.alias' for the name of the key to use. +# The password will be asked during the build when you use the 'release' target. + diff --git a/build.xml b/build.xml new file mode 100644 index 0000000..c11c5fe --- /dev/null +++ b/build.xml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/local.properties b/local.properties new file mode 100644 index 0000000..12a0114 --- /dev/null +++ b/local.properties @@ -0,0 +1,10 @@ +# This file is automatically generated by Android Tools. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file must *NOT* be checked into Version Control Systems, +# as it contains information specific to your local configuration. + +# location of the SDK. This is only used by Ant +# For customization when using a Version Control System, please read the +# header note. +sdk.dir=/opt/android-sdk diff --git a/proguard-project.txt b/proguard-project.txt new file mode 100644 index 0000000..f2fe155 --- /dev/null +++ b/proguard-project.txt @@ -0,0 +1,20 @@ +# To enable ProGuard in your project, edit project.properties +# to define the proguard.config property as described in that file. +# +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in ${sdk.dir}/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the ProGuard +# include property in project.properties. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/project.properties b/project.properties new file mode 100644 index 0000000..0840b4a --- /dev/null +++ b/project.properties @@ -0,0 +1,14 @@ +# This file is automatically generated by Android Tools. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file must be checked in Version Control Systems. +# +# To customize properties used by the Ant build system edit +# "ant.properties", and override values to adapt the script to your +# project structure. +# +# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): +#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt + +# Project target. +target=android-15 diff --git a/res/drawable-hdpi/add.png b/res/drawable-hdpi/add.png new file mode 100644 index 0000000000000000000000000000000000000000..ad8ada6bdfa0d08e96c96ef2e8fc6656efc31f34 GIT binary patch literal 1142 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA1|-9oezpTC$r9IylHmNblJdl&R0hYC{G?O` z&)mfH)S%SFl*+=BsWuD@%qp275hW46K32*3xq68pHF_1f1wh>l3^w)^1&PVosU-?Y zsp*+{wo31J?^jaDOtDo8H}y5}EpSfF$n>ZxN)4{^3rViZPPR-@vbR&PsjvbXkegbP zs8ErclUHn2VXFi-*9yo63F|8hm3bwJ6}oxF$}kgLQj3#|G7CyF^YauyCMG83 zmzLNn0bL65LT&-v*t}wBFaZNhzap_f-%!s00+w{G(#^lGsViy(A34k#nsr<$-vFf(ACh=#L&{!#L3yw z&D7A`#K{n**Cju>G&eP`1g19yq1ObbUQlAlEdbi=l3J8mmYU*Ll%J~r_Ow+dZnqfX zG!Lpb1-Dy_a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pi/save.png b/res/drawable-hdpi/save.png new file mode 100644 index 0000000000000000000000000000000000000000..53cf6877eb72ad70368fd9e61fb780d42633a407 GIT binary patch literal 1335 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA1|-9oezpTC$r9IylHmNblJdl&R0hYC{G?O` z&)mfH)S%SFl*+=BsWuD@%qp275hW46K32*3xq68pHF_1f1wh>l3^w)^1&PVosU-?Y zsp*+{wo31J?^jaDOtDo8H}y5}EpSfF$n>ZxN)4{^3rViZPPR-@vbR&PsjvbXkegbP zs8ErclUHn2VXFi-*9yo63F|8hm3bwJ6}oxF$}kgLQj3#|G7CyF^YauyCMG83 zmzLNn0bL65LT&-v*t}wBFaZNhzap_f-%!s00+w{G(#^lGsViu)xy!q!qCao$-vFf(ACh=#L&{!#L3yw z&D7A`#K{n**Cju>G&eP`1g19yq1PFwUQlAlEdbi=l3J8mmYU*Ll%J~r_Ow+d7Ppw0 zo0vEnx>*3tbHVNwh~5<3ZgIrv7JZ;&^g&UJ6xA>xVEO?u;RzSWfhYacJYae+0w!$c zeGexvFfgw4ba4!+xb|0uSaiB=&gzz|) zeHIPOP;}su6zlHbXs5?qvn2gF-PGqjm8BsheUo&jAzoFWWRjvlfM$7PiGfCjb)cOy_?6w^AReP91Tc8>~sHP8V>Ys(CF=aT`Sk=;|pS}XrJPb~T1dys{sdO&0YpQBSz*~us zcN*3-J_EnE1cxrXiq*F~jZje~rkAe3vf3>;eR)3?Ox=jK*jEU7Do|T`2NqP{56w(* zBAf)rvPB_7rsfeKd0^!CaR%BHUC$tsP9m8a!i@4&TxxzagzsYHJvblx4rRUu#0Jlz zclZJwdC}7S3BvwaIMTiwb!98zRf|zoya>NudJkDGgEYs=q*HmC)>GExofw=92}s;l z_YgKLUT5`<1RBwq{f)K~I%M=gRE6d)b5BP`8{u9x0-wsG%H)w^ zRU7n9FwtlfsZSjiSB(k8~Y5+O>dyoSI477Ly?|FR?m))C!ci%BtY!2Sst8Uri#|SFX&)8{_Ou2 z9r5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es5e+wwl|Ri_fY^6l8*)Nc=SU$6iG literal 0 HcmV?d00001 diff --git a/res/drawable-mdpi/ic_launcher.png b/res/drawable-mdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..a07c69fa5a0f4da5d5efe96eea12a543154dbab6 GIT binary patch literal 2574 zcmV+p3i0)cP)Q`Og{P|8RRXpj5bgrSmEzSMfBn+{{vpNxw?;5UX;iv9sYxy_`IQHs$i<61a_iv^L>h8s-`D(`e@|IgS*Fj zNGM876Gf;3D8*1UX9a%v>yJKD*QkCwW2AirU(L{qNA)JghmGItc;(H<$!ABY&gBy1vJIEUj-b8%el*o|VkG)LqNx#TG>Jvj^jIte!!+RY z)T4j$7+PoF1AkRBf}R#^T=-q|PaK1$c<4UH)Hpq3$4WA|xtr!ZQLC=*vNE>O6E9kp+5X0eKB$6>C(lPwI@3#oY zhS_%x7e|j!$yG?ECXmh~EH~^OeuK}+sWoJse3Z3?ha3n`MM9KvA?uqpEnBg4Q46)7 zM$p%a$@l;+O}vfvx%XjH`}a{(-HHth9!JaUwV0*VqGR48^gWNYN<&~7x)y$e!X>e` zZ5!6KZoxbKuV9XUDI%#M1~IVh?pNSdeb~6@$y`v|yk=XK+fHxnDqnUK4&=QRNyIVf zYbDM*cI>~qIy*a7=z7uqkw@agd(<=y-Q7L!ty_23SGdXmahO<;N=wB+j;lNm%=OHC zy zU|>La6h%92y4IPufI$9>Xu!@y`TaNgtg&41@PwMwBdmSm7)xAWDLoqjZ==P2#*k7! z3o1)cVSI3KP_!?d8G^Lg0FtLXC~JYdxi|c%h~lXEixY=%VSFF@!*3&&9>(Rb|iK54Cx5;s~PY5iaV1het%w`dgQFBAJ;aFK zImQC}(|QaCFYUm1JVfzSc)ebv=)ObI)0jwJb``}Zj9J0n0Xgn*Zc(rFM9$xh_makZbm-at_v5^SW zM1y1SW@%+FuIy*WR)i3A2N_q;(YO`O!A|Ts^%z}9ZepCj3ytlw#x%N_fNrKKtPh`< z|1{UqF`4LxHaCQ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A#XI^Ws(K;?_ZB1i;ps&7oM9K80Hcy(u`J{-J! zdbY~~i`~KJeH#OC^tBa#;hyihJ_3vP2NPiZM{(hZJP-=q5YJropPZW7|DylYwX+t; zo|ydJw|oEcCEo{PfA{L?vmf`L4A}KQJA$0Q7k=X2m4k|oa!j;vhU>{?)YW-hl7Xr1vcVv^sZI*_)iaJn7(%p zizD|nDs^{PFwwE@!oRkyV)5LouYY~u*u`hiH$Bgax4IkWa~JIVp1~aX&A)!>c<1Bq zJzc+h?WLl>(Vc()^O^qZZyph**L;ENpbi4y=WoC4yxco}%=>j@(-YE%$>{@s18j_l Aq5uE@ literal 0 HcmV?d00001 diff --git a/res/layout/add.xml b/res/layout/add.xml new file mode 100644 index 0000000..e143bb0 --- /dev/null +++ b/res/layout/add.xml @@ -0,0 +1,21 @@ + + + + + + diff --git a/res/layout/main.xml b/res/layout/main.xml new file mode 100644 index 0000000..db75e40 --- /dev/null +++ b/res/layout/main.xml @@ -0,0 +1,10 @@ + + + + diff --git a/res/menu/add_activity.xml b/res/menu/add_activity.xml new file mode 100644 index 0000000..4d59634 --- /dev/null +++ b/res/menu/add_activity.xml @@ -0,0 +1,7 @@ + + + + diff --git a/res/menu/main_activity.xml b/res/menu/main_activity.xml new file mode 100644 index 0000000..d2f94bd --- /dev/null +++ b/res/menu/main_activity.xml @@ -0,0 +1,7 @@ + + + + diff --git a/res/values/strings.xml b/res/values/strings.xml new file mode 100644 index 0000000..a8be7ce --- /dev/null +++ b/res/values/strings.xml @@ -0,0 +1,9 @@ + + + Dailies + Add + Name + Set alarm? + At: + Save + diff --git a/src/org/ryuslash/Dailies/AddActivity.java b/src/org/ryuslash/Dailies/AddActivity.java new file mode 100644 index 0000000..4ede5fc --- /dev/null +++ b/src/org/ryuslash/Dailies/AddActivity.java @@ -0,0 +1,106 @@ +package org.ryuslash.Dailies; + +import android.app.Activity; +import android.content.Intent; +import android.os.Bundle; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; +import android.widget.CheckBox; +import android.widget.EditText; +import android.widget.TimePicker; + +public class AddActivity extends Activity +{ + private DailiesDataSource datasource; + private long id; + + public void saveDaily() + { + EditText name_entry = (EditText) findViewById(R.id.name_entry); + CheckBox alarm_entry = + (CheckBox) findViewById(R.id.alarm_entry); + TimePicker time_entry = + (TimePicker) findViewById(R.id.time_entry); + + String name = name_entry.getText().toString(); + boolean alarm = alarm_entry.isChecked(); + int hour = alarm ? time_entry.getCurrentHour() : 0; + int minute = alarm ? time_entry.getCurrentMinute() : 0; + + if (id > 0) + datasource.updateDaily(id, name, alarm, hour, minute, null); + else + datasource.createDaily(name, alarm, hour, minute); + } + + @Override + public void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + setContentView(R.layout.add); + + datasource = new DailiesDataSource(this); + datasource.open(); + + Intent intent = getIntent(); + id = intent.getLongExtra(SQLiteHelper.COLUMN_ID, 0l); + + if (id > 0) { + Daily daily = datasource.getById(id); + EditText name_entry = + (EditText) findViewById(R.id.name_entry); + CheckBox alarm_entry = + (CheckBox) findViewById(R.id.alarm_entry); + TimePicker time_entry = + (TimePicker) findViewById(R.id.alarm_entry); + + name_entry.setText(daily.getTitle()); + alarm_entry.setChecked(daily.getAlarm()); + time_entry.setCurrentHour(daily.getHour()); + time_entry.setCurrentMinute(daily.getMinute()); + } + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) + { + MenuInflater inflater = getMenuInflater(); + inflater.inflate(R.menu.add_activity, menu); + return true; + } + + @Override + protected void onDestroy() + { + datasource.close(); + super.onDestroy(); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) + { + switch (item.getItemId()) { + case R.id.add_menu_save: + saveDaily(); + finish(); + return true; + } + + return false; + } + + @Override + protected void onPause() + { + datasource.close(); + super.onPause(); + } + + @Override + protected void onResume() + { + datasource.open(); + super.onResume(); + } +} diff --git a/src/org/ryuslash/Dailies/DailiesActivity.java b/src/org/ryuslash/Dailies/DailiesActivity.java new file mode 100644 index 0000000..91a6353 --- /dev/null +++ b/src/org/ryuslash/Dailies/DailiesActivity.java @@ -0,0 +1,91 @@ +package org.ryuslash.Dailies; + +import java.util.List; + +import android.app.ListActivity; +import android.content.Intent; +import android.os.Bundle; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; +import android.widget.ArrayAdapter; + +public class DailiesActivity extends ListActivity +{ + private DailiesDataSource datasource; + + private List getData() + { + return datasource.getDailiesList(); + } + + @Override + protected void onActivityResult(int requestCode, + int resultCode, + Intent data) + { + super.onActivityResult(requestCode, resultCode, data); + datasource.open(); + } + + /** Called when the activity is first created. */ + @Override + public void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + setContentView(R.layout.main); + + datasource = new DailiesDataSource(this); + datasource.open(); + + List dailies = getData(); + + ArrayAdapter adapter = new ArrayAdapter( + this, android.R.layout.simple_list_item_1, dailies + ); + setListAdapter(adapter); + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) + { + MenuInflater inflater = getMenuInflater(); + inflater.inflate(R.menu.main_activity, menu); + + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) + { + switch (item.getItemId()) { + case R.id.main_menu_add: + showAdd(); + return true; + } + + return false; + } + + @Override + public void onPause() + { + datasource.close(); + super.onPause(); + } + + @Override + protected void onResume() + { + datasource.open(); + super.onResume(); + } + + public void showAdd() + { + Intent intent = new Intent(this, AddActivity.class); + + datasource.close(); + startActivityForResult(intent, 0); + } +} diff --git a/src/org/ryuslash/Dailies/DailiesDataSource.java b/src/org/ryuslash/Dailies/DailiesDataSource.java new file mode 100644 index 0000000..d679f5f --- /dev/null +++ b/src/org/ryuslash/Dailies/DailiesDataSource.java @@ -0,0 +1,152 @@ +package org.ryuslash.Dailies; + +import java.text.DateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import android.content.ContentValues; +import android.content.Context; +import android.database.Cursor; +import android.database.SQLException; +import android.database.sqlite.SQLiteDatabase; + +public class DailiesDataSource +{ + private SQLiteDatabase database; + private SQLiteHelper dbHelper; + private String[] allColumns = { SQLiteHelper.COLUMN_ID, + SQLiteHelper.COLUMN_TITLE, + SQLiteHelper.COLUMN_ALARM, + SQLiteHelper.COLUMN_HOUR, + SQLiteHelper.COLUMN_MINUTE, + SQLiteHelper.COLUMN_LAST_COMPLETED }; + + public DailiesDataSource(Context context) + { + dbHelper = new SQLiteHelper(context); + } + + public void open() throws SQLException + { + database = dbHelper.getWritableDatabase(); + } + + public void close() + { + dbHelper.close(); + } + + private String dateToString(Date date) + { + DateFormat df = DateFormat.getDateInstance(); + return df.format(date); + } + + private ContentValues createValues(String title, boolean alarm, + int hour, int minute, Date date) + { + ContentValues values = new ContentValues(); + + + values.put(SQLiteHelper.COLUMN_TITLE, title); + values.put(SQLiteHelper.COLUMN_ALARM, alarm ? 1 : 0); + values.put(SQLiteHelper.COLUMN_HOUR, hour); + values.put(SQLiteHelper.COLUMN_MINUTE, minute); + + if (date != null) + values.put(SQLiteHelper.COLUMN_LAST_COMPLETED, + dateToString(date)); + + return values; + } + + private ContentValues createValues(String title, boolean alarm, + int hour, int minute) + { + return createValues(title, alarm, hour, minute, null); + } + + public Daily createDaily(String title, boolean alarm, int hour, + int minute) + { + ContentValues values = createValues(title, alarm, hour, minute); + long insertId = database.insert(SQLiteHelper.TABLE_DAILY, null, + values); + Daily daily = new Daily(insertId, title, alarm, hour, minute); + + return daily; + } + + public void updateDaily(long id, String title, boolean alarm, + int hour, int minute, Date last_completed) + { + ContentValues values = createValues(title, alarm, hour, minute, + last_completed); + String whereArgs[] = { "" + id }; + + database.update(SQLiteHelper.TABLE_DAILY, values, "id = ?", + whereArgs); + } + + public void deleteDaily(Daily daily) + { + deleteDaily(daily.getId()); + } + + public void deleteDaily(long id) + { + database.delete(SQLiteHelper.TABLE_DAILY, + SQLiteHelper.COLUMN_ID + " = " + id, null); + } + + public List getDailiesList() + { + List dailies = new ArrayList(); + Cursor cursor = database.query( + SQLiteHelper.TABLE_DAILY, allColumns, null, null, null, + null, "last_completed DESC, hour, minute" + ); + + cursor.moveToFirst(); + + while(!cursor.isAfterLast()) { + Daily daily = cursorToDaily(cursor); + + dailies.add(daily); + cursor.moveToNext(); + } + + cursor.close(); + + return dailies; + } + + public Daily getById(long id) + { + Cursor cursor = database.query(SQLiteHelper.TABLE_DAILY, + allColumns, + SQLiteHelper.COLUMN_ID + " = ?", + new String[] { "" + id }, + null, null, null); + cursor.moveToFirst(); + Daily daily = cursorToDaily(cursor); + cursor.close(); + + return daily; + } + + private Daily cursorToDaily(Cursor cursor) + { + Daily daily = new Daily(); + + daily.setId(cursor.getLong(0)); + daily.setTitle(cursor.getString(1)); + daily.setAlarm(cursor.getInt(2) == 1); + daily.setHour(cursor.getInt(3)); + daily.setMinute(cursor.getInt(4)); + daily.setLastCompleted(cursor.getString(5)); + + return daily; + } +} diff --git a/src/org/ryuslash/Dailies/Daily.java b/src/org/ryuslash/Dailies/Daily.java new file mode 100644 index 0000000..e1bbdba --- /dev/null +++ b/src/org/ryuslash/Dailies/Daily.java @@ -0,0 +1,107 @@ +package org.ryuslash.Dailies; + +import java.util.Date; +import java.text.DateFormat; + +public class Daily +{ + private long id; + private String title; + private boolean alarm; + private int hour; + private int minute; + private Date last_completed; + + public Daily() { } + + public Daily(long id, String title, boolean alarm, int hour, + int minute, Date last_completed) + { + this.id = id; + this.title = title; + this.alarm = alarm; + this.hour = hour; + this.minute = minute; + this.last_completed = last_completed; + } + + public Daily(long id, String title, boolean alarm, int hour, + int minute) + { + this(id, title, alarm, hour, minute, null); + } + + public long getId() + { + return id; + } + + public void setId(long id) + { + this.id = id; + } + + public String getTitle() + { + return title; + } + + public void setTitle(String title) + { + this.title = title; + } + + public boolean getAlarm() + { + return alarm; + } + + public void setAlarm(boolean alarm) + { + this.alarm = alarm; + } + + public int getHour() + { + return hour; + } + + public void setHour(int hour) + { + this.hour = hour; + } + + public int getMinute() + { + return minute; + } + + public void setMinute(int minute) + { + this.minute = minute; + } + + public Date getLastCompleted() + { + return last_completed; + } + + public void setLastCompleted(Date last_completed) + { + this.last_completed = last_completed; + } + + public void setLastCompleted(String last_completed) + { + if (last_completed != null && !last_completed.isEmpty()) { + DateFormat df = DateFormat.getDateInstance(); + setLastCompleted(df.format(last_completed)); + } + } + + @Override + public String toString() + { + return String.format("%02d:%02d %s", hour, minute, title); + } +} diff --git a/src/org/ryuslash/Dailies/SQLiteHelper.java b/src/org/ryuslash/Dailies/SQLiteHelper.java new file mode 100644 index 0000000..0934f4e --- /dev/null +++ b/src/org/ryuslash/Dailies/SQLiteHelper.java @@ -0,0 +1,51 @@ +package org.ryuslash.Dailies; + +import android.content.Context; +import android.database.sqlite.SQLiteDatabase; +import android.database.sqlite.SQLiteOpenHelper; +import android.util.Log; + +public class SQLiteHelper extends SQLiteOpenHelper +{ + public static final String TABLE_DAILY = "daily"; + public static final String COLUMN_ID = "id"; + public static final String COLUMN_TITLE = "title"; + public static final String COLUMN_ALARM = "alarm"; + public static final String COLUMN_HOUR = "hour"; + public static final String COLUMN_MINUTE = "minute"; + public static final String COLUMN_LAST_COMPLETED = "last_completed"; + + private static final String DATABASE_NAME = "dailies.db"; + private static final int DATABASE_VERSION = 1; + + private static final String TABLE_DAILY_CREATE = + "CREATE TABLE " + TABLE_DAILY + " (" + + COLUMN_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + + COLUMN_TITLE + " TEXT NOT NULL, " + + COLUMN_ALARM + " INTEGER NOT NULL, " + + COLUMN_HOUR + " INTEGER NULL, " + + COLUMN_MINUTE + " INTEGER NULL, " + + COLUMN_LAST_COMPLETED + " TEXT NULL " + + ");"; + + public SQLiteHelper(Context context) + { + super(context, DATABASE_NAME, null, DATABASE_VERSION); + } + + @Override + public void onCreate(SQLiteDatabase database) + { + database.execSQL(TABLE_DAILY_CREATE); + } + + @Override + public void onUpgrade(SQLiteDatabase db, int oldV, int newV) + { + Log.w(SQLiteHelper.class.getName(), + "Upgrading database from version " + oldV + " to " + + newV + ", which will destroy all old data"); + db.execSQL("DROP TABLE IF EXISTS " + TABLE_DAILY); + onCreate(db); + } +}