Android Open Source - AStory db Save






From Project

Back to project page AStory.

License

The source code is released under:

Apache License

If you think the Android project AStory 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.Litterfeldt.AStory.dbConnector;
//from   w  w w.j  a  va2 s . co m
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;

import com.Litterfeldt.AStory.models.SaveState;

public class dbSave {
    public static void setSave(Context c,SaveState s){
        dbConnector.getInstance(c).write().execSQL("DELETE FROM "+dbConnector.TABLE_NAME_SAVED_STATE+";");
        ContentValues initialValues = new ContentValues();
        initialValues.put(dbConnector.COLUMN_SAVED_STATE_BOOK_ID,s.bookId());
        initialValues.put(dbConnector.COLUMN_SAVED_STATE_CHAPTER_ID,s.chapterId());
        initialValues.put(dbConnector.COLUMN_SAVED_STATE_CURRENT_TIME_POS,s.time_pos());
        dbConnector.getInstance(c).write().insert(dbConnector.TABLE_NAME_SAVED_STATE, null, initialValues);

    }
    public static SaveState getSave(Context c){
        Cursor cursor = dbConnector.getInstance(c).read().query(dbConnector.TABLE_NAME_SAVED_STATE,
                new String[]{dbConnector.COLUMN_SAVED_STATE_BOOK_ID,
                        dbConnector.COLUMN_SAVED_STATE_CHAPTER_ID,
                        dbConnector.COLUMN_SAVED_STATE_CURRENT_TIME_POS},
                null,null,null,null,null);
        boolean notEmpty = cursor.moveToLast();
        if (notEmpty){
            return new SaveState(cursor.getInt(0),cursor.getInt(1),cursor.getInt(2));
        }else{
            return null;
        }
    }
}




Java Source Code List

com.Litterfeldt.AStory.adapters.LibraryAdapter.java
com.Litterfeldt.AStory.customClasses.CoreApplication.java
com.Litterfeldt.AStory.customClasses.CustomMediaPlayer.java
com.Litterfeldt.AStory.dbConnector.dbBook.java
com.Litterfeldt.AStory.dbConnector.dbConnector.java
com.Litterfeldt.AStory.dbConnector.dbSave.java
com.Litterfeldt.AStory.fragments.LibraryFragment.java
com.Litterfeldt.AStory.fragments.PlayerFragment.java
com.Litterfeldt.AStory.models.Book.java
com.Litterfeldt.AStory.models.Chapter.java
com.Litterfeldt.AStory.models.FileSystem.java
com.Litterfeldt.AStory.models.SaveState.java
com.Litterfeldt.AStory.services.AudioplayerService.java
com.Litterfeldt.AStory.pagerView.java
com.handmark.pulltorefresh.library.ILoadingLayout.java
com.handmark.pulltorefresh.library.IPullToRefresh.java
com.handmark.pulltorefresh.library.LoadingLayoutProxy.java
com.handmark.pulltorefresh.library.OverscrollHelper.java
com.handmark.pulltorefresh.library.PullToRefreshAdapterViewBase.java
com.handmark.pulltorefresh.library.PullToRefreshBase.java
com.handmark.pulltorefresh.library.PullToRefreshExpandableListView.java
com.handmark.pulltorefresh.library.PullToRefreshGridView.java
com.handmark.pulltorefresh.library.PullToRefreshHorizontalScrollView.java
com.handmark.pulltorefresh.library.PullToRefreshListView.java
com.handmark.pulltorefresh.library.PullToRefreshScrollView.java
com.handmark.pulltorefresh.library.PullToRefreshWebView.java
com.handmark.pulltorefresh.library.extras.PullToRefreshWebView2.java
com.handmark.pulltorefresh.library.extras.SoundPullEventListener.java
com.handmark.pulltorefresh.library.internal.EmptyViewMethodAccessor.java
com.handmark.pulltorefresh.library.internal.FlipLoadingLayout.java
com.handmark.pulltorefresh.library.internal.IndicatorLayout.java
com.handmark.pulltorefresh.library.internal.LoadingLayout.java
com.handmark.pulltorefresh.library.internal.RotateLoadingLayout.java
com.handmark.pulltorefresh.library.internal.Utils.java
com.handmark.pulltorefresh.library.internal.ViewCompat.java