From: Marius Gavrilescu Date: Tue, 11 Jun 2013 10:35:59 +0000 (+0300) Subject: Remove database classes, ic_launcher-web and more cleanups X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=c9b1e441bd865f57bf2c3ea671c8945e48a8203a;p=unical.git Remove database classes, ic_launcher-web and more cleanups --- diff --git a/.classpath b/.classpath index a900c98..5381274 100644 --- a/.classpath +++ b/.classpath @@ -1,6 +1,6 @@ - + diff --git a/ic_launcher-web.png b/ic_launcher-web.png deleted file mode 100644 index a256e1c..0000000 Binary files a/ic_launcher-web.png and /dev/null differ diff --git a/src/ro/ieval/unical/DatabaseInteract.java b/src/ro/ieval/unical/DatabaseInteract.java deleted file mode 100644 index 520eba8..0000000 --- a/src/ro/ieval/unical/DatabaseInteract.java +++ /dev/null @@ -1,79 +0,0 @@ -package ro.ieval.unical; - -import java.util.ArrayList; -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 DatabaseInteract { - private SQLiteDatabase database; - private MySQLiteHelper dbHelper; - private String[] allColumns = { - MySQLiteHelper.ID, MySQLiteHelper.title, - MySQLiteHelper.description, MySQLiteHelper.date, - MySQLiteHelper.duration, MySQLiteHelper.repeat, - MySQLiteHelper.repeatIn, MySQLiteHelper.location - }; - - public DatabaseInteract(Context context) { - dbHelper = new MySQLiteHelper(context); - database=dbHelper.getWritableDatabase(); - } - - public void open() throws SQLException { - database=dbHelper.getWritableDatabase(); - } - - public void close() { - dbHelper.close(); - } - - //Insert event - public void insertEvent(Event e) { - ContentValues values = new ContentValues(); - values.put(allColumns[0], e._id); - values.put(allColumns[1], e.title); - values.put(allColumns[2], e.description); - values.put(allColumns[3], e.date); - values.put(allColumns[4], e.duration); - values.put(allColumns[5], e.repeat); - values.put(allColumns[6], e.repeatInterval); - values.put(allColumns[7], e.location); - database.insert(MySQLiteHelper.Name, null, values); - } - //Delete event - public void deleteEvent(String id) { - database.delete(MySQLiteHelper.Name, MySQLiteHelper.ID + "=" + id, null); - } - //Search event - //Get all events - public List getAllEvents() { - List events=new ArrayList(); - Cursor cursor=database.query(MySQLiteHelper.Name,allColumns,null,null,null,null,null); - - for(cursor.moveToFirst();!cursor.isAfterLast();cursor.moveToNext()) { - Event ev=cursorToEvent(cursor); - events.add(ev); - } - return events; - } - - private Event cursorToEvent(Cursor cursor) { - // TODO Auto-generated method stub - Event e = new Event(); - e._id=cursor.getString(0); - e.title=cursor.getString(1); - e.description=cursor.getString(2); - e.date=cursor.getInt(3); - e.duration=cursor.getInt(4); - if(cursor.getInt(5)==1) e.repeat=true; - else e.repeat=false; - e.repeatInterval=cursor.getInt(6); - e.location=cursor.getString(7); - return e; - } -} diff --git a/src/ro/ieval/unical/DeleteEventDialog.java b/src/ro/ieval/unical/DeleteEventDialog.java index 8dc2267..40fe582 100644 --- a/src/ro/ieval/unical/DeleteEventDialog.java +++ b/src/ro/ieval/unical/DeleteEventDialog.java @@ -14,7 +14,7 @@ public final class DeleteEventDialog extends DialogFragment { .setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int id) { - + // Nothing happens here yet } }) .setNegativeButton(R.string.no, new DialogInterface.OnClickListener() { diff --git a/src/ro/ieval/unical/EventAdapter.java b/src/ro/ieval/unical/EventAdapter.java index 7aa4833..577ea0c 100644 --- a/src/ro/ieval/unical/EventAdapter.java +++ b/src/ro/ieval/unical/EventAdapter.java @@ -13,7 +13,7 @@ public class EventAdapter extends ArrayAdapter { private final Event[] values; private final Context context; - public EventAdapter(final Context context, final Event[] values) { + public EventAdapter(final Context context, final Event[] values) {//NOPMD super(context,R.layout.event_row_layout,values); this.context=context; this.values=values; diff --git a/src/ro/ieval/unical/MySQLiteHelper.java b/src/ro/ieval/unical/MySQLiteHelper.java deleted file mode 100644 index dbadca5..0000000 --- a/src/ro/ieval/unical/MySQLiteHelper.java +++ /dev/null @@ -1,56 +0,0 @@ -package ro.ieval.unical; - -import android.content.Context; -import android.database.sqlite.SQLiteDatabase; -import android.database.sqlite.SQLiteOpenHelper; -import android.util.Log; - -public class MySQLiteHelper extends SQLiteOpenHelper { - public static final String Name="Events"; - - public static final String ID = "_id"; - public static final String title = "Title"; - public static final String description = "Description"; - public static final String date = "Date"; - public static final String duration = "Duration"; - public static final String repeat = "repeat"; - public static final String repeatIn = "repeatInterval"; - public static final String location = "Location"; - - private static final int dbversion=1; - - private static final String Database_create = "create table " + Name + "(" + - //ID + " integer primary key autoincrement, " + - ID + " text primary key, " + - title + " text not null, " + - description + " text, " + - date + " integer, " + - duration + " integer, " + - repeat + " integer, "+ - repeatIn + " integer, " + - location + " text);" - ; - - public MySQLiteHelper(Context context) { - super(context,Name, null, dbversion); - // TODO Auto-generated constructor stub - } - - @Override - public void onCreate(SQLiteDatabase db) { - // TODO Auto-generated method stub - db.execSQL(Database_create); - - } - - @Override - public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { - // TODO Auto-generated method stub - Log.w(MySQLiteHelper.class.getName(), - "Upgrading database from version " + oldVersion + " to " - + newVersion + ", which will destroy all old data"); - db.execSQL("DROP TABLE IF EXISTS " + Name); - onCreate(db); - } - -} \ No newline at end of file