Android Open Source - rgb-tool S Q Lite R G B Tool Helper






From Project

Back to project page rgb-tool.

License

The source code is released under:

Apache License

If you think the Android project rgb-tool 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 com.fastebro.androidrgbtool.helpers;
// w  w w  .j  a va2 s .c o m
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import com.fastebro.androidrgbtool.contracts.ColorDataContract;

public class SQLiteRGBToolHelper extends SQLiteOpenHelper {
    private static final String TEXT_TYPE = " TEXT";
    private static final String INTEGER_TYPE = " INTEGER";
    private static final String COMMA_SEP = ",";

    /**
     * SQLite does not have a separate Boolean storage class.
     * Instead, Boolean values are stored as integers 0 (false) and 1 (true).
     */
    private static final String SQL_CREATE_ENTRIES =
            "CREATE TABLE " + ColorDataContract.ColorEntry.TABLE_NAME + " (" +
                    ColorDataContract.ColorEntry._ID + " INTEGER PRIMARY KEY AUTOINCREMENT," +
                    ColorDataContract.ColorEntry.COLUMN_COLOR_NAME + TEXT_TYPE + COMMA_SEP +
                    ColorDataContract.ColorEntry.COLUMN_COLOR_HEX + TEXT_TYPE + COMMA_SEP +
                    ColorDataContract.ColorEntry.COLUMN_COLOR_RGB_R + INTEGER_TYPE + COMMA_SEP +
                    ColorDataContract.ColorEntry.COLUMN_COLOR_RGB_G + INTEGER_TYPE + COMMA_SEP +
                    ColorDataContract.ColorEntry.COLUMN_COLOR_RGB_B + INTEGER_TYPE + COMMA_SEP +
                    ColorDataContract.ColorEntry.COLUMN_COLOR_RGB_A + INTEGER_TYPE + COMMA_SEP +
                    ColorDataContract.ColorEntry.COLUMN_COLOR_HSB_H + INTEGER_TYPE + COMMA_SEP +
                    ColorDataContract.ColorEntry.COLUMN_COLOR_HSB_S + INTEGER_TYPE + COMMA_SEP +
                    ColorDataContract.ColorEntry.COLUMN_COLOR_HSB_B + INTEGER_TYPE + COMMA_SEP +
                    ColorDataContract.ColorEntry.COLUMN_COLOR_FAVORITE + INTEGER_TYPE +
                    " )";

    private static final String SQL_DELETE_ENTRIES =
            "DROP TABLE IF EXISTS " + ColorDataContract.ColorEntry.TABLE_NAME;

    private static final String DATABASE_NAME = "rgbtool.db";
    private static final int DATABASE_VERSION = 1;


    public SQLiteRGBToolHelper(Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase database) {
        database.execSQL(SQL_CREATE_ENTRIES);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        // TODO: save the current data

        db.execSQL(SQL_DELETE_ENTRIES);
        onCreate(db);

        // TODO: insert the current data
    }
}




Java Source Code List

com.fastebro.androidrgbtool.adapters.ColorListAdapter.java
com.fastebro.androidrgbtool.adapters.ImagePaletteAdapter.java
com.fastebro.androidrgbtool.adapters.RGBToolImagesCursorAdapter.java
com.fastebro.androidrgbtool.adapters.SelectPictureListAdapter.java
com.fastebro.androidrgbtool.contracts.ColorDataContract.java
com.fastebro.androidrgbtool.events.ColorDeleteEvent.java
com.fastebro.androidrgbtool.events.ColorSelectEvent.java
com.fastebro.androidrgbtool.events.PhotoScaledEvent.java
com.fastebro.androidrgbtool.events.PrintColorEvent.java
com.fastebro.androidrgbtool.events.UpdateSaveColorUIEvent.java
com.fastebro.androidrgbtool.fragments.AboutFragment.java
com.fastebro.androidrgbtool.fragments.ColorListDialogFragment.java
com.fastebro.androidrgbtool.fragments.EventBaseDialogFragment.java
com.fastebro.androidrgbtool.fragments.PrintColorDialogFragment.java
com.fastebro.androidrgbtool.fragments.SelectPictureDialogFragment.java
com.fastebro.androidrgbtool.helpers.SQLiteRGBToolHelper.java
com.fastebro.androidrgbtool.managers.RecyclerViewLinearLayoutManager.java
com.fastebro.androidrgbtool.model.PaletteSwatch.java
com.fastebro.androidrgbtool.print.RGBToolPrintDocumentAdapter.java
com.fastebro.androidrgbtool.provider.RGBToolContentProvider.java
com.fastebro.androidrgbtool.render.GLRender.java
com.fastebro.androidrgbtool.tasks.PhotoScalingTask.java
com.fastebro.androidrgbtool.ui.AboutActivity.java
com.fastebro.androidrgbtool.ui.BaseActivity.java
com.fastebro.androidrgbtool.ui.ColorPickerActivity.java
com.fastebro.androidrgbtool.ui.EventBaseActivity.java
com.fastebro.androidrgbtool.ui.ImagePaletteActivity.java
com.fastebro.androidrgbtool.ui.MainActivity.java
com.fastebro.androidrgbtool.ui.RGBToolGalleryActivity.java
com.fastebro.androidrgbtool.utils.AlbumStorageDirFactory.java
com.fastebro.androidrgbtool.utils.BaseAlbumDirFactory.java
com.fastebro.androidrgbtool.utils.UColor.java
com.fastebro.androidrgbtool.utils.UCommon.java
com.fastebro.androidrgbtool.utils.UDatabase.java
com.fastebro.androidrgbtool.utils.UImage.java
com.fastebro.androidrgbtool.utils.UPalette.java
com.fastebro.androidrgbtool.view.CheckableRelativeLayout.java
com.fastebro.androidrgbtool.view.CustomGLSurfaceView.java
com.fastebro.androidrgbtool.widgets.RGBPanelData.java