Android Open Source - KeepMySecret Db Context






From Project

Back to project page KeepMySecret.

License

The source code is released under:

GNU General Public License

If you think the Android project KeepMySecret listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package keepmysecretapp.app.com.keepmysecretapp.db;
//ww  w  .j a  v  a 2s. c  om
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

import keepmysecretapp.app.com.keepmysecretapp.tables.AuthTable;
import keepmysecretapp.app.com.keepmysecretapp.tables.DataTable;
import keepmysecretapp.app.com.keepmysecretapp.tables.GroupTable;
import keepmysecretapp.app.com.keepmysecretapp.tables.QueryTable;

public class DbContext extends SQLiteOpenHelper {

    private static final String DATABASE_NAME = "secret_storage1";

    private static final int DATABASE_VERSION = 2;

    public static DbContext instance = null;

    private DbContext(Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }

    public static DbContext getInstance(Context context) {
        if (instance == null)
            instance = new DbContext(context);
        return instance;
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

        QueryTable table = new AuthTable();
        db.execSQL(table.getUpgradeQuery());
        db.execSQL(table.getCreationQuery());

        table = new DataTable();
        db.execSQL(table.getUpgradeQuery());
        db.execSQL(table.getCreationQuery());

        table = new GroupTable();
        db.execSQL(table.getUpgradeQuery());
        db.execSQL(table.getCreationQuery());

    }

    @Override
    public void onCreate(SQLiteDatabase db) {

        QueryTable table = new AuthTable();
        db.execSQL(table.getCreationQuery());

        table = new DataTable();
        db.execSQL(table.getCreationQuery());

        table = new GroupTable();
        db.execSQL(table.getCreationQuery());

    }

}




Java Source Code List

keepmysecretapp.app.com.keepmysecretapp.ApplicationTest.java
keepmysecretapp.app.com.keepmysecretapp.activities.MainActivity.java
keepmysecretapp.app.com.keepmysecretapp.activities.creation.CreateNewEntryActivity.java
keepmysecretapp.app.com.keepmysecretapp.activities.edit.EditEntryActivity.java
keepmysecretapp.app.com.keepmysecretapp.activities.presentation.EntryPresentActivity.java
keepmysecretapp.app.com.keepmysecretapp.adapters.DataEntryAdapter.java
keepmysecretapp.app.com.keepmysecretapp.adapters.GroupEntryAdapter.java
keepmysecretapp.app.com.keepmysecretapp.dao.Dao.java
keepmysecretapp.app.com.keepmysecretapp.dao.EntryDao.java
keepmysecretapp.app.com.keepmysecretapp.dao.GroupDao.java
keepmysecretapp.app.com.keepmysecretapp.db.DbContext.java
keepmysecretapp.app.com.keepmysecretapp.db.EntryType.java
keepmysecretapp.app.com.keepmysecretapp.fragments.creation.CreateDataEntryFragment.java
keepmysecretapp.app.com.keepmysecretapp.fragments.creation.CreateGroupFragment.java
keepmysecretapp.app.com.keepmysecretapp.fragments.dialogs.GeneratePasswordDialog.java
keepmysecretapp.app.com.keepmysecretapp.fragments.edit.EditDataFragment.java
keepmysecretapp.app.com.keepmysecretapp.fragments.edit.EditGroupFragment.java
keepmysecretapp.app.com.keepmysecretapp.fragments.other.NavigationDrawerFragment.java
keepmysecretapp.app.com.keepmysecretapp.fragments.other.SideLogic.java
keepmysecretapp.app.com.keepmysecretapp.fragments.presentation.EntryPresentFragment.java
keepmysecretapp.app.com.keepmysecretapp.fragments.presentation.TextKeeperFragment.java
keepmysecretapp.app.com.keepmysecretapp.other.Constants.java
keepmysecretapp.app.com.keepmysecretapp.other.Tools.java
keepmysecretapp.app.com.keepmysecretapp.tables.AuthTable.java
keepmysecretapp.app.com.keepmysecretapp.tables.DataTable.java
keepmysecretapp.app.com.keepmysecretapp.tables.GroupTable.java
keepmysecretapp.app.com.keepmysecretapp.tables.QueryTable.java
keepmysecretapp.app.com.keepmysecretapp.types.CopyTextButtonListener.java
keepmysecretapp.app.com.keepmysecretapp.types.GenerateButtonListener.java
keepmysecretapp.app.com.keepmysecretapp.types.ListEntry.java