Add Kiwix Database

This commit is contained in:
Rashiq 2016-05-02 23:08:27 +02:00
parent 4289a44dce
commit 832766b03b
4 changed files with 135 additions and 1 deletions

View File

@ -22,8 +22,8 @@ dependencies {
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
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.yahoo.squidb:squidb:2.0.0'
compile 'com.yahoo.squidb:squidb-annotations:2.0.0'
apt 'com.yahoo.squidb:squidb-processor:2.0.0'
compile 'com.squareup.okhttp3:okhttp:3.2.0'

View 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;
}
}

View File

@ -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;
}

View 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;
}