mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-16 10:56:50 -04:00
Add Kiwix Database
This commit is contained in:
parent
4289a44dce
commit
832766b03b
@ -22,8 +22,8 @@ dependencies {
|
|||||||
compile 'com.android.support:appcompat-v7:23.1.1'
|
compile 'com.android.support:appcompat-v7:23.1.1'
|
||||||
compile 'com.android.support:support-v4:23.1.1'
|
compile 'com.android.support:support-v4:23.1.1'
|
||||||
compile files("$buildDir/native-libs/native-libs.jar")
|
compile files("$buildDir/native-libs/native-libs.jar")
|
||||||
compile 'com.yahoo.squidb:squidb:2.0.0'
|
|
||||||
compile 'com.android.support:design:23.1.1'
|
compile 'com.android.support:design:23.1.1'
|
||||||
|
compile 'com.yahoo.squidb:squidb:2.0.0'
|
||||||
compile 'com.yahoo.squidb:squidb-annotations:2.0.0'
|
compile 'com.yahoo.squidb:squidb-annotations:2.0.0'
|
||||||
apt 'com.yahoo.squidb:squidb-processor:2.0.0'
|
apt 'com.yahoo.squidb:squidb-processor:2.0.0'
|
||||||
compile 'com.squareup.okhttp3:okhttp:3.2.0'
|
compile 'com.squareup.okhttp3:okhttp:3.2.0'
|
||||||
|
55
src/org/kiwix/kiwixmobile/database/KiwixDatabase.java
Normal file
55
src/org/kiwix/kiwixmobile/database/KiwixDatabase.java
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.kiwix.kiwixmobile.database;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import com.yahoo.squidb.data.SquidDatabase;
|
||||||
|
import com.yahoo.squidb.data.adapter.SQLiteDatabaseWrapper;
|
||||||
|
import com.yahoo.squidb.sql.Table;
|
||||||
|
import org.kiwix.kiwixmobile.database.entity.BookDatabaseEntity;
|
||||||
|
|
||||||
|
public class KiwixDatabase extends SquidDatabase {
|
||||||
|
|
||||||
|
private static final int VERSION = 1;
|
||||||
|
|
||||||
|
public KiwixDatabase(Context context) {
|
||||||
|
super(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public String getName() {
|
||||||
|
return "kiwix.db";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Table[] getTables() {
|
||||||
|
return new Table[] {
|
||||||
|
BookDatabaseEntity.TABLE
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override protected boolean onUpgrade(SQLiteDatabaseWrapper db, int oldVersion, int newVersion) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getVersion() {
|
||||||
|
return VERSION;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.kiwix.kiwixmobile.database.entity;
|
||||||
|
|
||||||
|
import com.yahoo.squidb.annotations.TableModelSpec;
|
||||||
|
|
||||||
|
@TableModelSpec(className = "BookDatabaseEntity", tableName = "book")
|
||||||
|
public class BookDataSource {
|
||||||
|
|
||||||
|
public String bookId;
|
||||||
|
|
||||||
|
public String title;
|
||||||
|
|
||||||
|
public String description;
|
||||||
|
|
||||||
|
public String language;
|
||||||
|
|
||||||
|
public String bookCreator;
|
||||||
|
|
||||||
|
public String publisher;
|
||||||
|
|
||||||
|
public String date;
|
||||||
|
|
||||||
|
public String url;
|
||||||
|
|
||||||
|
public String articleCount;
|
||||||
|
|
||||||
|
public String mediaCount;
|
||||||
|
|
||||||
|
public String size;
|
||||||
|
|
||||||
|
public String favicon;
|
||||||
|
|
||||||
|
public String filePath;
|
||||||
|
}
|
27
src/org/kiwix/kiwixmobile/database/entity/LibraryDataSource.java
Executable file
27
src/org/kiwix/kiwixmobile/database/entity/LibraryDataSource.java
Executable file
@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.kiwix.kiwixmobile.database.entity;
|
||||||
|
|
||||||
|
import com.yahoo.squidb.annotations.TableModelSpec;
|
||||||
|
|
||||||
|
@TableModelSpec(className = "LibraryDatabaseEntity", tableName = "library")
|
||||||
|
public class LibraryDataSource {
|
||||||
|
public String libraryVersion;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user