Example #1
2
 public long addMyRecentRead(Uri uri) {
   SQLiteDatabase database = myDBHelper.getWritableDatabase();
   ContentValues values = new ContentValues();
   values.put("book_path", uri.toString());
   long id = database.insert("myRecentRead_table", null, values);
   return id;
 }
Example #2
1
 public long addMyRead(String pdfPath, String pageNo, String key) {
   SQLiteDatabase database = myDBHelper.getWritableDatabase();
   ContentValues values = new ContentValues();
   values.put("key", key);
   values.put("book_path", pdfPath);
   values.put("pageNo", pageNo);
   long id = database.insert("myRead_table", null, values);
   return id;
 }
Example #3
0
 public int updateMyRead(String pdfPath, String pageNo, String title) {
   ContentValues values = new ContentValues();
   values.put("book_path", pdfPath);
   values.put("pageNo", pageNo);
   values.put("title", title);
   return myDBHelper
       .getWritableDatabase()
       .update("myRead_table", values, "book_path=?", new String[] {pdfPath});
 }
Example #4
0
  public List<Uri> getAllRecentRead() {
    List<Uri> data = new ArrayList<Uri>();
    SQLiteDatabase db = myDBHelper.getReadableDatabase();
    Cursor cursor = db.query("myRecentRead_table", null, null, null, null, null, "id desc");
    cursor.moveToPosition(-1);
    while (cursor.moveToNext()) {

      Uri uri = Uri.parse(cursor.getString(cursor.getColumnIndex("book_path")));
      data.add(uri);
    }
    return data;
  }
Example #5
0
 public Cursor getRecentRead(String book_path) {
   SQLiteDatabase db = myDBHelper.getReadableDatabase();
   Cursor cursor =
       db.query(
           "myRecentRead_table",
           null,
           "book_path = ?",
           new String[] {book_path},
           null,
           null,
           null);
   return cursor;
 }
Example #6
0
 public HashMap<String, String> queryRead(String book_path) {
   HashMap<String, String> hashMap = new HashMap<String, String>();
   Cursor cursor =
       myDBHelper
           .getReadableDatabase()
           .query(
               "myRead_table", null, "book_path = ?", new String[] {book_path}, null, null, null);
   cursor.moveToPosition(-1);
   while (cursor.moveToNext()) {
     hashMap.put("bookName", cursor.getString(1));
     hashMap.put("pageNo", cursor.getString(2));
     hashMap.put("title", cursor.getString(3));
   }
   return hashMap;
 }
Example #7
0
 public List<Map<String, String>> getAllRead(String book_path) {
   List<Map<String, String>> data = new ArrayList<Map<String, String>>();
   SQLiteDatabase db = myDBHelper.getReadableDatabase();
   Cursor cursor =
       db.query(
           "myRead_table", null, "book_path = ?", new String[] {book_path}, null, null, "id desc");
   cursor.moveToPosition(-1);
   while (cursor.moveToNext()) {
     Map<String, String> map = new HashMap<String, String>();
     map.put("key", cursor.getString(cursor.getColumnIndex("key")));
     map.put("bookName", cursor.getString(cursor.getColumnIndex("book_path")));
     map.put("pageNo", cursor.getString(cursor.getColumnIndex("pageNo")));
     data.add(map);
   }
   return data;
 }
Example #8
0
 public boolean getMyRead(String page, String path) {
   SQLiteDatabase database = myDBHelper.getWritableDatabase();
   Cursor cursor =
       database.query(
           "myRead_table",
           null,
           "pageNo = ? and book_path = ?",
           new String[] {page, path},
           null,
           null,
           null);
   boolean b = cursor.moveToFirst();
   cursor.getColumnCount();
   cursor.close();
   return b;
 }
Example #9
0
 public void deleteMyRead(String pdfPath) {
   SQLiteDatabase db = myDBHelper.getReadableDatabase();
   db.delete("myRead_table", "book_path=?", new String[] {pdfPath});
 }
Example #10
0
 public void deleteMyRecentRead(int id) {
   SQLiteDatabase db = myDBHelper.getReadableDatabase();
   db.delete("myRecentRead_table", "id=?", new String[] {id + ""});
 }