-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactored various things and improved the code.
- Loading branch information
JonasCz
authored and
JonasCz
committed
Nov 21, 2015
1 parent
8690359
commit 13861d0
Showing
7 changed files
with
98 additions
and
117 deletions.
There are no files selected for viewing
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,48 @@ | ||
package jonas.tool.saveForOffline; | ||
|
||
|
||
import android.content.Context; | ||
import android.database.sqlite.SQLiteDatabase; | ||
import android.database.sqlite.SQLiteOpenHelper; | ||
|
||
|
||
public class Database extends SQLiteOpenHelper { | ||
|
||
public static final String DATABASE_NAME="SavedPagesMeta.db"; | ||
public static final String TABLE_NAME="main"; | ||
public static final String TITLE="title"; | ||
public static final String FILE_LOCATION="file_location"; | ||
public static final String THUMBNAIL="thumbnail"; | ||
public static final String ORIGINAL_URL="origurl"; | ||
public static final String ID="_id"; | ||
public static final String TIMESTAMP="timestamp"; | ||
public static final String SAVED_PAGE_BASE_DIRECTORY="tags"; | ||
|
||
public Database(Context context) { | ||
super(context, DATABASE_NAME, null, 4); | ||
|
||
} | ||
|
||
@Override | ||
public void onCreate(SQLiteDatabase db) { | ||
String CREATE_TABLE="CREATE TABLE "+TABLE_NAME+" (" | ||
+ID+" INTEGER PRIMARY KEY, " | ||
+TITLE+" TEXT, " | ||
+FILE_LOCATION+" TEXT, " | ||
+THUMBNAIL+" TEXT, " | ||
+ORIGINAL_URL+" TEXT, " | ||
+SAVED_PAGE_BASE_DIRECTORY+" TEXT, " | ||
+TIMESTAMP+" TEXT DEFAULT CURRENT_TIMESTAMP)"; | ||
|
||
db.execSQL(CREATE_TABLE); | ||
|
||
} | ||
|
||
@Override | ||
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { | ||
db.execSQL("DROP TABLE IF EXISTS "+TABLE_NAME); | ||
onCreate(db); | ||
|
||
} | ||
|
||
} |
This file was deleted.
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
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
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