|
@@ -33,7 +33,7 @@ public class UglyDbHelper extends SQLiteOpenHelper {
|
|
|
|
|
|
// All Static variables
|
|
|
// Database Version
|
|
|
- private static final int DATABASE_VERSION = 7;
|
|
|
+ private static final int DATABASE_VERSION = 9;
|
|
|
|
|
|
// Database Name
|
|
|
private static final String DATABASE_NAME = "recordManager";
|
|
@@ -70,6 +70,7 @@ public class UglyDbHelper extends SQLiteOpenHelper {
|
|
|
public static final String KEY_PROFILE_ICON = "profile_icon";
|
|
|
public static final String KEY_PROFILE_EDITABLE = "profile_editable";
|
|
|
public static final String KEY_PROFILE_ACTIVE = "profile_active";
|
|
|
+ public static final String KEY_PROFILE_ICON_NAME = "profile_icon_name";
|
|
|
|
|
|
// Database sql create statements
|
|
|
private static final String CREATE_PROFILE_TABLE = "CREATE TABLE "
|
|
@@ -78,6 +79,7 @@ public class UglyDbHelper extends SQLiteOpenHelper {
|
|
|
+ KEY_PROFILE_NAME + " TEXT,"
|
|
|
+ KEY_PROFILE_DESCRIPTION + " TEXT,"
|
|
|
+ KEY_PROFILE_ICON + " TEXT,"
|
|
|
+ + KEY_PROFILE_ICON_NAME + " TEXT,"
|
|
|
+ KEY_PROFILE_EDITABLE + " INTEGER,"
|
|
|
+ KEY_PROFILE_ACTIVE + " INTEGER"
|
|
|
+ ")";
|
|
@@ -821,12 +823,14 @@ public class UglyDbHelper extends SQLiteOpenHelper {
|
|
|
// looping through all rows and adding to list
|
|
|
if (cursor.moveToFirst()) {
|
|
|
do {
|
|
|
- Profile profile = new Profile(cursor.getInt(0), cursor.getString(1), cursor.getString(2), cursor.getString(3), cursor.getInt(4) == 1);
|
|
|
+ Profile profile = new Profile(cursor.getInt(0), cursor.getString(1), cursor.getString(2), cursor.getString(3), cursor.getInt(5) == 1);
|
|
|
|
|
|
- if(cursor.getInt(5) == 1){
|
|
|
+ if(cursor.getInt(6) == 1){
|
|
|
profile.mActivated = true;
|
|
|
}
|
|
|
|
|
|
+ profile.mIconName = cursor.getString(4);
|
|
|
+
|
|
|
// Adding record to list
|
|
|
profiles.add(profile);
|
|
|
} while (cursor.moveToNext());
|
|
@@ -856,6 +860,7 @@ public class UglyDbHelper extends SQLiteOpenHelper {
|
|
|
values.put(KEY_PROFILE_NAME, profile.mLabel);
|
|
|
values.put(KEY_PROFILE_DESCRIPTION, profile.mText);
|
|
|
values.put(KEY_PROFILE_ICON, profile.mIconPath);
|
|
|
+ values.put(KEY_PROFILE_ICON_NAME, profile.mIconName);
|
|
|
values.put(KEY_PROFILE_ACTIVE, profile.mActivated);
|
|
|
values.put(KEY_PROFILE_EDITABLE, profile.mEditable);
|
|
|
|
|
@@ -863,6 +868,18 @@ public class UglyDbHelper extends SQLiteOpenHelper {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * private static final String CREATE_PROFILE_TABLE = "CREATE TABLE "
|
|
|
+ + TABLE_PROFILES + "("
|
|
|
+ + KEY_PROFILE_ID + " INTEGER PRIMARY KEY AUTOINCREMENT,"
|
|
|
+ + KEY_PROFILE_NAME + " TEXT,"
|
|
|
+ + KEY_PROFILE_DESCRIPTION + " TEXT,"
|
|
|
+ + KEY_PROFILE_ICON + " TEXT,"
|
|
|
+ + KEY_PROFILE_ICON_ID + " INTEGER,"
|
|
|
+ + KEY_PROFILE_EDITABLE + " INTEGER,"
|
|
|
+ + KEY_PROFILE_ACTIVE + " INTEGER"
|
|
|
+ + ")";
|
|
|
+ */
|
|
|
public Profile getProfile(int id) {
|
|
|
String selectQuery = "SELECT * FROM " + TABLE_PROFILES + " WHERE " + TABLE_PROFILES + "." + KEY_PROFILE_ID + " = " + id;
|
|
|
SQLiteDatabase db = this.getReadableDatabase();
|
|
@@ -871,11 +888,13 @@ public class UglyDbHelper extends SQLiteOpenHelper {
|
|
|
Profile profile = null;
|
|
|
|
|
|
if (cursor.moveToFirst()) {
|
|
|
- profile = new Profile(cursor.getInt(0), cursor.getString(1), cursor.getString(2), cursor.getString(3), cursor.getInt(4) == 1);
|
|
|
+ profile = new Profile(cursor.getInt(0), cursor.getString(1), cursor.getString(2), cursor.getString(3), cursor.getInt(5) == 1);
|
|
|
|
|
|
- if(cursor.getInt(5) == 1){
|
|
|
+ if(cursor.getInt(6) == 1){
|
|
|
profile.mActivated = true;
|
|
|
}
|
|
|
+
|
|
|
+ profile.mIconName = cursor.getString(5);
|
|
|
}
|
|
|
|
|
|
cursor.close();
|