This repository has been archived by the owner on Jun 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
schordas
committed
Jul 27, 2015
1 parent
ca8fc33
commit bbff4cc
Showing
8 changed files
with
98 additions
and
63 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module external.linked.project.id="android-content-provider" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4"> | ||
<component name="FacetManager"> | ||
<facet type="java-gradle" name="Java-Gradle"> | ||
<configuration> | ||
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" /> | ||
<option name="BUILDABLE" value="false" /> | ||
</configuration> | ||
</facet> | ||
</component> | ||
<component name="NewModuleRootManager" inherit-compiler-output="true"> | ||
<exclude-output /> | ||
<content url="file://$MODULE_DIR$"> | ||
<excludeFolder url="file://$MODULE_DIR$/.gradle" /> | ||
</content> | ||
<orderEntry type="inheritedJdk" /> | ||
<orderEntry type="sourceFolder" forTests="false" /> | ||
</component> | ||
</module> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 18 additions & 14 deletions
32
app/src/main/java/com/sam_chordas/android/androidflavors/data/FlavorsDBHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,42 @@ | ||
package com.sam_chordas.android.androidflavors; | ||
package com.sam_chordas.android.androidflavors.data; | ||
|
||
import android.content.Context | ||
import android.content.Context; | ||
import android.database.sqlite.SQLiteDatabase; | ||
import android.database.sqlite.SQLiteOpenHelper; | ||
import android.util.Log; | ||
|
||
public class FlavorsDBHelper extends SQLiteOpenHelper{ | ||
public static final String LOg_TAG = FlavorsDBHelper.class.getSimpleName(); | ||
|
||
|
||
public class FlavorsDBHelper extends SQLiteOpenHelper { | ||
public static final String LOG_TAG = FlavorsDBHelper.class.getSimpleName(); | ||
|
||
//name & version | ||
private static final String DATABASE_NAME = "flavors.db"; | ||
private static final int DATABASE_VERSION = 1; | ||
|
||
public FlavorsDBHelper(Context context){ | ||
public FlavorsDBHelper(Context context) { | ||
super(context, DATABASE_NAME, null, DATABASE_VERSION); | ||
} | ||
|
||
@Override | ||
public void onCreate(SQLiteDatabase sqLiteDatabase){ | ||
public void onCreate(SQLiteDatabase sqLiteDatabase) { | ||
final String SQL_CREATE_MOVIE_TABLE = "CREATE TABLE " + | ||
TABLE_FLAVORS + "(" + _ID + | ||
" INTEGER PRIMARY KEY AUTOINCREMENT, " + COLUMN_VERSION_NAME + | ||
+ " TEXT NOT NULL, " + COLUMN_ICON + " BLOB NOT NULL, " + | ||
COLUMN_VERSION_NUMBER + " TEXT NOT NULL);"; | ||
FlavorsContract.FlavorEntry.TABLE_FLAVORS + "(" + FlavorsContract.FlavorEntry._ID + | ||
" INTEGER PRIMARY KEY AUTOINCREMENT, " + | ||
FlavorsContract.FlavorEntry.COLUMN_VERSION_NAME | ||
+ " TEXT NOT NULL, " + FlavorsContract.FlavorEntry.COLUMN_ICON + | ||
" BLOB NOT NULL, " + | ||
FlavorsContract.FlavorEntry.COLUMN_VERSION_NUMBER + " TEXT NOT NULL);"; | ||
|
||
sqLiteDatabase.execSQL(SQL_CREATE_MOVIE_TABLE); | ||
} | ||
|
||
@Override | ||
public void onUpgrade(SQLiteDatabase sqLiteDatabase, int oldVersion, int newVersion){ | ||
Log.w(LOG_TAG, "Upgrading database from version " + oldVersion + " to " + | ||
public void onUpgrade(SQLiteDatabase sqLiteDatabase, int oldVersion, int newVersion) { | ||
Log.w(LOG_TAG, "Upgrading database from version " + oldVersion + " to " + | ||
newVersion + ". OLD DATA WILL BE DESTROYED"); | ||
|
||
sqLiteDatabase.execSQL("DROP TABLE IF EXISTS " + TABLE_FLAVORS); | ||
sqLiteDatabase.execSQL("DROP TABLE IF EXISTS " + FlavorsContract.FlavorEntry.TABLE_FLAVORS); | ||
|
||
onCreate(sqLiteDatabase); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters