Changed audiobook to format - included guide/companion
This commit is contained in:
parent
6239c382ad
commit
50f344fc8f
3
README
3
README
@ -41,6 +41,9 @@ Features include;
|
||||
case. e.g. "The murder on the links" becomes "The Murder on the Links"
|
||||
* Using ISBN or Barcode scanning will also download a thumbnail (if available)
|
||||
|
||||
New in v3.1
|
||||
|
||||
|
||||
New in v3.0.1
|
||||
* Export bug fixed
|
||||
* Further enhancements to the new ISBN screen
|
||||
|
@ -125,6 +125,12 @@
|
||||
android:inputType="numberDecimal"
|
||||
/>
|
||||
|
||||
<Spinner android:id="@+id/format"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
/>
|
||||
|
||||
<CheckBox android:id="@+id/anthology"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
@ -132,13 +138,6 @@
|
||||
android:hint="@string/is_anthology"
|
||||
/>
|
||||
|
||||
<CheckBox android:id="@+id/audiobook"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:hint="@string/audiobook"
|
||||
/>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
|
@ -194,7 +194,7 @@
|
||||
<string name="help_title_adminabout">About this App</string>
|
||||
<string name="help_text_adminabout1">This screen will show you the current version of the Book Catalogue you are running as well as links to the app homepage, source code and my email address.</string>
|
||||
<string name="signed">Has this book been signed</string>
|
||||
<string name="audiobook">This book is an Audiobook</string>
|
||||
<string name="audiobook">Audiobook</string>
|
||||
<string name="read_start">Date started reading</string>
|
||||
<string name="read_end">Date finished reading</string>
|
||||
<string name="location">Location of the book</string>
|
||||
@ -207,4 +207,9 @@
|
||||
<string name="searching_amazon_books">Searching Amazon</string>
|
||||
<string name="bookshelf_title">Select bookshelves for this book</string>
|
||||
<string name="bookshelves">Select Bookshelves</string>
|
||||
<string name="format">Format</string>
|
||||
<string name="paperback">Paperback</string>
|
||||
<string name="hardcover">Hard Cover</string>
|
||||
<string name="ebook">eBook</string>
|
||||
<string name="guide">Guide / Companion</string>
|
||||
</resources>
|
||||
|
@ -407,7 +407,7 @@ public class AdministrationFunctions extends Activity {
|
||||
'"' + CatalogueDBAdapter.KEY_LOCATION+ "\"," + //18
|
||||
'"' + CatalogueDBAdapter.KEY_READ_START+ "\"," + //19
|
||||
'"' + CatalogueDBAdapter.KEY_READ_END+ "\"," + //20
|
||||
'"' + CatalogueDBAdapter.KEY_AUDIOBOOK+ "\"," + //21
|
||||
'"' + CatalogueDBAdapter.KEY_FORMAT+ "\"," + //21
|
||||
'"' + CatalogueDBAdapter.KEY_SIGNED+ "\"," + //22
|
||||
'"' + CatalogueDBAdapter.KEY_LOANED_TO+ "\"," + //23
|
||||
'"' + "anthology_titles," + "\"" + //24
|
||||
@ -491,7 +491,7 @@ public class AdministrationFunctions extends Activity {
|
||||
row += "\"" + formatCell(books.getString(books.getColumnIndexOrThrow(CatalogueDBAdapter.KEY_LOCATION))) + "\",";
|
||||
row += "\"" + formatCell(dateReadStartString) + "\",";
|
||||
row += "\"" + formatCell(dateReadEndString) + "\",";
|
||||
row += "\"" + formatCell(books.getString(books.getColumnIndexOrThrow(CatalogueDBAdapter.KEY_AUDIOBOOK))) + "\",";
|
||||
row += "\"" + formatCell(books.getString(books.getColumnIndexOrThrow(CatalogueDBAdapter.KEY_FORMAT))) + "\",";
|
||||
row += "\"" + formatCell(books.getString(books.getColumnIndexOrThrow(CatalogueDBAdapter.KEY_SIGNED))) + "\",";
|
||||
row += "\"" + formatCell(books.getString(books.getColumnIndexOrThrow(CatalogueDBAdapter.KEY_LOANED_TO))+"") + "\",";
|
||||
row += "\"" + formatCell(anthology_titles) + "\"";
|
||||
@ -803,11 +803,11 @@ public class AdministrationFunctions extends Activity {
|
||||
read_end = "";
|
||||
}
|
||||
|
||||
boolean audiobook = false;
|
||||
String format = "";
|
||||
try {
|
||||
audiobook = (imported[21].equals("0")? false:true);
|
||||
format = imported[21];
|
||||
} catch (Exception e) {
|
||||
audiobook = false;
|
||||
format = "";
|
||||
}
|
||||
|
||||
boolean signed = false;
|
||||
@ -842,21 +842,21 @@ public class AdministrationFunctions extends Activity {
|
||||
// Its a new entry, but the ISBN exists
|
||||
id = book.getLong(0);
|
||||
book.moveToFirst();
|
||||
mDbHelper.updateBook(id, author, title, isbn, publisher, date_published, rating, bookshelf, read, series, pages, series_num, notes, list_price, anthology, location, read_start, read_end, audiobook, signed);
|
||||
mDbHelper.updateBook(id, author, title, isbn, publisher, date_published, rating, bookshelf, read, series, pages, series_num, notes, list_price, anthology, location, read_start, read_end, format, signed);
|
||||
importUpdated++;
|
||||
} else {
|
||||
id = mDbHelper.createBook(author, title, isbn, publisher, date_published, rating, bookshelf, read, series, pages, series_num, notes, list_price, anthology, location, read_start, read_end, audiobook, signed);
|
||||
id = mDbHelper.createBook(author, title, isbn, publisher, date_published, rating, bookshelf, read, series, pages, series_num, notes, list_price, anthology, location, read_start, read_end, format, signed);
|
||||
importCreated++;
|
||||
}
|
||||
} else {
|
||||
Cursor book = mDbHelper.fetchBookById(id);
|
||||
int rows = book.getCount();
|
||||
if (rows == 0) {
|
||||
mDbHelper.createBook(id, author, title, isbn, publisher, date_published, rating, bookshelf, read, series, pages, series_num, notes, list_price, anthology, location, read_start, read_end, audiobook, signed);
|
||||
mDbHelper.createBook(id, author, title, isbn, publisher, date_published, rating, bookshelf, read, series, pages, series_num, notes, list_price, anthology, location, read_start, read_end, format, signed);
|
||||
importCreated++;
|
||||
} else {
|
||||
// Book exists and should be updated if it has changed
|
||||
mDbHelper.updateBook(id, author, title, isbn, publisher, date_published, rating, bookshelf, read, series, pages, series_num, notes, list_price, anthology, location, read_start, read_end, audiobook, signed);
|
||||
mDbHelper.updateBook(id, author, title, isbn, publisher, date_published, rating, bookshelf, read, series, pages, series_num, notes, list_price, anthology, location, read_start, read_end, format, signed);
|
||||
importUpdated++;
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ public class BookBackup extends Activity {
|
||||
CatalogueDBAdapter.KEY_LOCATION+ "\t" + //18
|
||||
CatalogueDBAdapter.KEY_READ_START+ "\t" + //19
|
||||
CatalogueDBAdapter.KEY_READ_END+ "\t" + //20
|
||||
CatalogueDBAdapter.KEY_AUDIOBOOK+ "\t" + //21
|
||||
CatalogueDBAdapter.KEY_FORMAT+ "\t" + //21
|
||||
CatalogueDBAdapter.KEY_SIGNED+ "\t" + //22
|
||||
CatalogueDBAdapter.KEY_LOANED_TO+ "\t" + //23
|
||||
"anthology_titles\t" + //24
|
||||
@ -146,7 +146,7 @@ public class BookBackup extends Activity {
|
||||
row += books.getString(books.getColumnIndexOrThrow(CatalogueDBAdapter.KEY_LOCATION)) + "\t";
|
||||
row += dateReadStartString + "\t";
|
||||
row += dateReadEndString + "\t";
|
||||
row += books.getString(books.getColumnIndexOrThrow(CatalogueDBAdapter.KEY_AUDIOBOOK)) + "\t";
|
||||
row += books.getString(books.getColumnIndexOrThrow(CatalogueDBAdapter.KEY_FORMAT)) + "\t";
|
||||
row += books.getString(books.getColumnIndexOrThrow(CatalogueDBAdapter.KEY_SIGNED)) + "\t";
|
||||
row += books.getString(books.getColumnIndexOrThrow(CatalogueDBAdapter.KEY_LOANED_TO)) + "\t";
|
||||
row += anthology_titles + "\t";
|
||||
|
@ -496,7 +496,7 @@ public class BookEditAnthology extends ListActivity {
|
||||
String location = book.getString(book.getColumnIndexOrThrow(CatalogueDBAdapter.KEY_LOCATION));
|
||||
String read_start = book.getString(book.getColumnIndexOrThrow(CatalogueDBAdapter.KEY_READ_START));
|
||||
String read_end = book.getString(book.getColumnIndexOrThrow(CatalogueDBAdapter.KEY_READ_END));
|
||||
boolean audiobook = (book.getInt(book.getColumnIndexOrThrow(CatalogueDBAdapter.KEY_AUDIOBOOK))==0? false:true);
|
||||
String format = book.getString(book.getColumnIndexOrThrow(CatalogueDBAdapter.KEY_FORMAT));
|
||||
boolean signed = (book.getInt(book.getColumnIndexOrThrow(CatalogueDBAdapter.KEY_SIGNED))==0? false:true);
|
||||
int pages = book.getInt(book.getColumnIndexOrThrow(CatalogueDBAdapter.KEY_PAGES));
|
||||
|
||||
@ -506,7 +506,7 @@ public class BookEditAnthology extends ListActivity {
|
||||
Toast.makeText(this, R.string.unknown_error, Toast.LENGTH_LONG).show();
|
||||
finish();
|
||||
} else {
|
||||
mDbHelper.updateBook(mRowId, bookAuthor, bookTitle, isbn, publisher, date_published, rating, bookshelf, read, series, pages, series_num, notes, list_price, anthology, location, read_start, read_end, audiobook, signed);
|
||||
mDbHelper.updateBook(mRowId, bookAuthor, bookTitle, isbn, publisher, date_published, rating, bookshelf, read, series, pages, series_num, notes, list_price, anthology, location, read_start, read_end, format, signed);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -56,6 +56,7 @@ import android.widget.DatePicker;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TabHost;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
@ -74,7 +75,10 @@ public class BookEditFields extends Activity {
|
||||
private EditText mListPriceText;
|
||||
private EditText mPagesText;
|
||||
private CheckBox mAnthologyCheckBox;
|
||||
private CheckBox mAudiobookCheckBox;
|
||||
private Spinner mFormatText;
|
||||
private ArrayList<String> formats = new ArrayList<String>();
|
||||
|
||||
private ArrayAdapter<String> spinnerAdapter;
|
||||
private Button mConfirmButton;
|
||||
private Button mCancelButton;
|
||||
private Long mRowId;
|
||||
@ -169,19 +173,19 @@ public class BookEditFields extends Activity {
|
||||
ArrayAdapter<String> author_adapter = new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line, getAuthors());
|
||||
mAuthorText = (AutoCompleteTextView) findViewById(R.id.author);
|
||||
mAuthorText.setAdapter(author_adapter);
|
||||
field_visibility = mPrefs.getBoolean(visibility_prefix + "author", true);
|
||||
field_visibility = mPrefs.getBoolean(visibility_prefix + CatalogueDBAdapter.KEY_AUTHOR, true);
|
||||
if (field_visibility == false) {
|
||||
mAuthorText.setVisibility(GONE);
|
||||
}
|
||||
|
||||
mTitleText = (EditText) findViewById(R.id.title);
|
||||
field_visibility = mPrefs.getBoolean(visibility_prefix + "title", true);
|
||||
field_visibility = mPrefs.getBoolean(visibility_prefix + CatalogueDBAdapter.KEY_TITLE, true);
|
||||
if (field_visibility == false) {
|
||||
mTitleText.setVisibility(GONE);
|
||||
}
|
||||
|
||||
mIsbnText = (EditText) findViewById(R.id.isbn);
|
||||
field_visibility = mPrefs.getBoolean(visibility_prefix + "isbn", true);
|
||||
field_visibility = mPrefs.getBoolean(visibility_prefix + CatalogueDBAdapter.KEY_ISBN, true);
|
||||
if (field_visibility == false) {
|
||||
mIsbnText.setVisibility(GONE);
|
||||
}
|
||||
@ -189,7 +193,7 @@ public class BookEditFields extends Activity {
|
||||
ArrayAdapter<String> publisher_adapter = new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line, getPublishers());
|
||||
mPublisherText = (AutoCompleteTextView) findViewById(R.id.publisher);
|
||||
mPublisherText.setAdapter(publisher_adapter);
|
||||
field_visibility = mPrefs.getBoolean(visibility_prefix + "publisher", true);
|
||||
field_visibility = mPrefs.getBoolean(visibility_prefix + CatalogueDBAdapter.KEY_PUBLISHER, true);
|
||||
if (field_visibility == false) {
|
||||
mPublisherText.setVisibility(GONE);
|
||||
}
|
||||
@ -234,10 +238,21 @@ public class BookEditFields extends Activity {
|
||||
mAnthologyCheckBox.setVisibility(GONE);
|
||||
}
|
||||
|
||||
mAudiobookCheckBox = (CheckBox) findViewById(R.id.audiobook);
|
||||
field_visibility = mPrefs.getBoolean(visibility_prefix + "audiobook", true);
|
||||
mFormatText = (Spinner) findViewById(R.id.format);
|
||||
spinnerAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item);
|
||||
spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
mFormatText.setAdapter(spinnerAdapter);
|
||||
formats.add(getString(R.string.paperback));
|
||||
formats.add(getString(R.string.hardcover));
|
||||
formats.add(getString(R.string.ebook));
|
||||
formats.add(getString(R.string.audiobook));
|
||||
formats.add(getString(R.string.guide));
|
||||
for (int i=0; i<formats.size(); i++) {
|
||||
spinnerAdapter.add(formats.get(i));
|
||||
}
|
||||
field_visibility = mPrefs.getBoolean(visibility_prefix + "format", true);
|
||||
if (field_visibility == false) {
|
||||
mAudiobookCheckBox.setVisibility(GONE);
|
||||
mFormatText.setVisibility(GONE);
|
||||
}
|
||||
|
||||
mConfirmButton = (Button) findViewById(R.id.confirm);
|
||||
@ -511,7 +526,13 @@ public class BookEditFields extends Activity {
|
||||
mSeriesNumText.setText(book.getString(book.getColumnIndexOrThrow(CatalogueDBAdapter.KEY_SERIES_NUM)));
|
||||
mListPriceText.setText(book.getString(book.getColumnIndexOrThrow(CatalogueDBAdapter.KEY_LIST_PRICE)));
|
||||
mPagesText.setText(book.getString(book.getColumnIndexOrThrow(CatalogueDBAdapter.KEY_PAGES)));
|
||||
mAudiobookCheckBox.setChecked((book.getInt(book.getColumnIndex(CatalogueDBAdapter.KEY_AUDIOBOOK))==0? false:true) );
|
||||
String format = book.getString(book.getColumnIndex(CatalogueDBAdapter.KEY_FORMAT));
|
||||
for (int i=0; i<formats.size(); i++) {
|
||||
if (formats.get(i).equals(format)) {
|
||||
mFormatText.setSelection(i);
|
||||
}
|
||||
}
|
||||
|
||||
anthology_num = book.getInt(book.getColumnIndexOrThrow(CatalogueDBAdapter.KEY_ANTHOLOGY));
|
||||
if (anthology_num == 0) {
|
||||
mAnthologyCheckBox.setChecked(false);
|
||||
@ -617,11 +638,11 @@ public class BookEditFields extends Activity {
|
||||
} else {
|
||||
mAnthologyCheckBox.setChecked(true);
|
||||
}
|
||||
String audiobookValue = book[13];
|
||||
if (audiobookValue.equals("t")) {
|
||||
mAudiobookCheckBox.setChecked(true);
|
||||
} else {
|
||||
mAudiobookCheckBox.setChecked(false);
|
||||
String formatValue = book[13];
|
||||
for (int i=0; i<formats.size(); i++) {
|
||||
if (formats.get(i) == formatValue) {
|
||||
mFormatText.setSelection(i);
|
||||
}
|
||||
}
|
||||
} catch (NullPointerException e) {
|
||||
// do nothing
|
||||
@ -763,7 +784,7 @@ public class BookEditFields extends Activity {
|
||||
} catch (NumberFormatException e) {
|
||||
pages = 0;
|
||||
}
|
||||
boolean audiobook = mAudiobookCheckBox.isChecked();
|
||||
String format = spinnerAdapter.getItem(mFormatText.getSelectedItemPosition());
|
||||
|
||||
if (mRowId == null || mRowId == 0) {
|
||||
/* Check if the book currently exists */
|
||||
@ -777,7 +798,7 @@ public class BookEditFields extends Activity {
|
||||
book.close(); // close the cursor
|
||||
}
|
||||
|
||||
long id = mDbHelper.createBook(author, title, isbn, publisher, date_published, rating, bookshelf, read, series, pages, series_num, notes, list_price, anthology, location, read_start, read_end, audiobook, signed);
|
||||
long id = mDbHelper.createBook(author, title, isbn, publisher, date_published, rating, bookshelf, read, series, pages, series_num, notes, list_price, anthology, location, read_start, read_end, format, signed);
|
||||
if (id > 0) {
|
||||
mRowId = id;
|
||||
File thumb = CatalogueDBAdapter.fetchThumbnail(0);
|
||||
@ -785,7 +806,7 @@ public class BookEditFields extends Activity {
|
||||
thumb.renameTo(real);
|
||||
}
|
||||
} else {
|
||||
mDbHelper.updateBook(mRowId, author, title, isbn, publisher, date_published, rating, bookshelf, read, series, pages, series_num, notes, list_price, anthology, location, read_start, read_end, audiobook, signed);
|
||||
mDbHelper.updateBook(mRowId, author, title, isbn, publisher, date_published, rating, bookshelf, read, series, pages, series_num, notes, list_price, anthology, location, read_start, read_end, format, signed);
|
||||
}
|
||||
/* These are global variables that will be sent via intent back to the list view */
|
||||
added_author = author;
|
||||
|
@ -66,7 +66,7 @@ public class BookEditNotes extends Activity {
|
||||
private String list_price;
|
||||
private int anthology;
|
||||
private int pages;
|
||||
private boolean audiobook;
|
||||
private String format;
|
||||
|
||||
private static final int GONE = 8;
|
||||
|
||||
@ -232,7 +232,7 @@ public class BookEditNotes extends Activity {
|
||||
list_price = book.getString(book.getColumnIndexOrThrow(CatalogueDBAdapter.KEY_LIST_PRICE));
|
||||
anthology = book.getInt(book.getColumnIndexOrThrow(CatalogueDBAdapter.KEY_ANTHOLOGY));
|
||||
pages = book.getInt(book.getColumnIndexOrThrow(CatalogueDBAdapter.KEY_PAGES));
|
||||
audiobook = (book.getInt(book.getColumnIndex(CatalogueDBAdapter.KEY_AUDIOBOOK))==0? false:true);
|
||||
format = book.getString(book.getColumnIndex(CatalogueDBAdapter.KEY_FORMAT));
|
||||
} else {
|
||||
// Manual Add
|
||||
//This should never happen
|
||||
@ -279,7 +279,7 @@ public class BookEditNotes extends Activity {
|
||||
Toast.makeText(this, R.string.unknown_error, Toast.LENGTH_LONG).show();
|
||||
finish();
|
||||
} else {
|
||||
mDbHelper.updateBook(mRowId, author, title, isbn, publisher, date_published, rating, bookshelf, read, series, pages, series_num, notes, list_price, anthology, location, read_start, read_end, audiobook, signed);
|
||||
mDbHelper.updateBook(mRowId, author, title, isbn, publisher, date_published, rating, bookshelf, read, series, pages, series_num, notes, list_price, anthology, location, read_start, read_end, format, signed);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -63,7 +63,8 @@ public class CatalogueDBAdapter {
|
||||
public static final String KEY_LOCATION = "location";
|
||||
public static final String KEY_READ_START = "read_start";
|
||||
public static final String KEY_READ_END = "read_end";
|
||||
public static final String KEY_AUDIOBOOK = "audiobook";
|
||||
public static final String KEY_FORMAT = "format";
|
||||
public static final String OLD_KEY_AUDIOBOOK = "audiobook";
|
||||
public static final String KEY_SIGNED = "signed";
|
||||
|
||||
public static final String KEY_AUTHOR_FORMATTED = "author_formatted";
|
||||
@ -126,7 +127,7 @@ public class CatalogueDBAdapter {
|
||||
KEY_LOCATION + " text, " +
|
||||
KEY_READ_START + " date, " +
|
||||
KEY_READ_END + " date, " +
|
||||
KEY_AUDIOBOOK + " boolean not null default 'f', " +
|
||||
KEY_FORMAT + " text, " +
|
||||
KEY_SIGNED + " boolean not null default 'f' " +
|
||||
")";
|
||||
|
||||
@ -187,14 +188,14 @@ public class CatalogueDBAdapter {
|
||||
"b." + KEY_LOCATION + " as " + KEY_LOCATION + ", " +
|
||||
"b." + KEY_READ_START + " as " + KEY_READ_START + ", " +
|
||||
"b." + KEY_READ_END + " as " + KEY_READ_END + ", " +
|
||||
"b." + KEY_AUDIOBOOK + " as " + KEY_AUDIOBOOK + ", " +
|
||||
"b." + KEY_FORMAT + " as " + KEY_FORMAT + ", " +
|
||||
"b." + KEY_SIGNED + " as " + KEY_SIGNED + ", " +
|
||||
"CASE WHEN " + KEY_SERIES + "='' THEN '' ELSE b." + KEY_SERIES + " || CASE WHEN " + KEY_SERIES_NUM + "='' THEN '' ELSE ' #' || b." + KEY_SERIES_NUM + " END END AS " + KEY_SERIES_FORMATTED;
|
||||
private static String BOOKSHELF_TABLES = DB_TB_BOOKS + " b LEFT OUTER JOIN " + DB_TB_BOOK_BOOKSHELF_WEAK + " w ON (b." + KEY_ROWID + "=w." + KEY_BOOK + ") LEFT OUTER JOIN " + DB_TB_BOOKSHELF + " bs ON (bs." + KEY_ROWID + "=w." + KEY_BOOKSHELF + ") ";
|
||||
|
||||
|
||||
private final Context mCtx;
|
||||
public static final int DATABASE_VERSION = 44;
|
||||
public static final int DATABASE_VERSION = 46;
|
||||
|
||||
/**
|
||||
* This is a specific version of the SQLiteOpenHelper class. It handles onCreate and onUpgrade events
|
||||
@ -415,7 +416,7 @@ public class CatalogueDBAdapter {
|
||||
db.execSQL("ALTER TABLE " + DB_TB_BOOKS + " ADD " + KEY_LOCATION + " text");
|
||||
db.execSQL("ALTER TABLE " + DB_TB_BOOKS + " ADD " + KEY_READ_START + " date");
|
||||
db.execSQL("ALTER TABLE " + DB_TB_BOOKS + " ADD " + KEY_READ_END + " date");
|
||||
db.execSQL("ALTER TABLE " + DB_TB_BOOKS + " ADD " + KEY_AUDIOBOOK + " boolean not null default 'f'");
|
||||
db.execSQL("ALTER TABLE " + DB_TB_BOOKS + " ADD " + OLD_KEY_AUDIOBOOK + " boolean not null default 'f'");
|
||||
db.execSQL("ALTER TABLE " + DB_TB_BOOKS + " ADD " + KEY_SIGNED + " boolean not null default 'f'");
|
||||
} catch (Exception e) {
|
||||
//do nothing
|
||||
@ -427,7 +428,7 @@ public class CatalogueDBAdapter {
|
||||
db.execSQL("UPDATE " + DB_TB_BOOKS + " SET " + KEY_LOCATION + "=''");
|
||||
db.execSQL("UPDATE " + DB_TB_BOOKS + " SET " + KEY_READ_START + "=''");
|
||||
db.execSQL("UPDATE " + DB_TB_BOOKS + " SET " + KEY_READ_END + "=''");
|
||||
db.execSQL("UPDATE " + DB_TB_BOOKS + " SET " + KEY_AUDIOBOOK + "='f'");
|
||||
db.execSQL("UPDATE " + DB_TB_BOOKS + " SET " + OLD_KEY_AUDIOBOOK + "='f'");
|
||||
db.execSQL("UPDATE " + DB_TB_BOOKS + " SET " + KEY_SIGNED + "='f'");
|
||||
} catch (Exception e) {
|
||||
//do nothing
|
||||
@ -490,7 +491,7 @@ public class CatalogueDBAdapter {
|
||||
db.execSQL("INSERT INTO " + DB_TB_BOOK_BOOKSHELF_WEAK + " (" + KEY_BOOK + ", " + KEY_BOOKSHELF + ") SELECT " + KEY_ROWID + ", " + KEY_BOOKSHELF + " FROM " + DB_TB_BOOKS + "");
|
||||
db.execSQL("CREATE TABLE tmp1 AS SELECT _id, " + KEY_AUTHOR + ", " + KEY_TITLE + ", " + KEY_ISBN + ", " + KEY_PUBLISHER + ", " +
|
||||
KEY_DATE_PUBLISHED + ", " + KEY_RATING + ", " + KEY_READ + ", " + KEY_SERIES + ", " + KEY_PAGES + ", " + KEY_SERIES_NUM + ", " + KEY_NOTES + ", " +
|
||||
KEY_LIST_PRICE + ", " + KEY_ANTHOLOGY + ", " + KEY_LOCATION + ", " + KEY_READ_START + ", " + KEY_READ_END + ", " + KEY_AUDIOBOOK + ", " +
|
||||
KEY_LIST_PRICE + ", " + KEY_ANTHOLOGY + ", " + KEY_LOCATION + ", " + KEY_READ_START + ", " + KEY_READ_END + ", " + OLD_KEY_AUDIOBOOK + ", " +
|
||||
KEY_SIGNED + " FROM " + DB_TB_BOOKS);
|
||||
db.execSQL("CREATE TABLE tmp2 AS SELECT _id, " + KEY_BOOK + ", " + KEY_LOANED_TO + " FROM " + DB_TB_LOAN );
|
||||
db.execSQL("CREATE TABLE tmp3 AS SELECT _id, " + KEY_BOOK + ", " + KEY_AUTHOR + ", " + KEY_TITLE + ", " + KEY_POSITION + " FROM " + DB_TB_ANTHOLOGY);
|
||||
@ -532,6 +533,45 @@ public class CatalogueDBAdapter {
|
||||
")");
|
||||
db.execSQL("CREATE UNIQUE INDEX IF NOT EXISTS anthology_pk_idx ON " + DB_TB_ANTHOLOGY + " (" + KEY_BOOK + ", " + KEY_AUTHOR + ", " + KEY_TITLE + ")");
|
||||
}
|
||||
if (curVersion == 44) {
|
||||
//do nothing
|
||||
curVersion++;
|
||||
db.execSQL("CREATE TABLE tmp1 AS SELECT _id, " + KEY_AUTHOR + ", " + KEY_TITLE + ", " + KEY_ISBN + ", " + KEY_PUBLISHER + ", " +
|
||||
KEY_DATE_PUBLISHED + ", " + KEY_RATING + ", " + KEY_READ + ", " + KEY_SERIES + ", " + KEY_PAGES + ", " + KEY_SERIES_NUM + ", " + KEY_NOTES + ", " +
|
||||
KEY_LIST_PRICE + ", " + KEY_ANTHOLOGY + ", " + KEY_LOCATION + ", " + KEY_READ_START + ", " + KEY_READ_END + ", " +
|
||||
"CASE WHEN " + OLD_KEY_AUDIOBOOK + "='t' THEN 'Audiobook' ELSE 'Paperback' END AS " + OLD_KEY_AUDIOBOOK + ", " +
|
||||
KEY_SIGNED + " FROM " + DB_TB_BOOKS);
|
||||
db.execSQL("CREATE TABLE tmp2 AS SELECT _id, " + KEY_BOOK + ", " + KEY_LOANED_TO + " FROM " + DB_TB_LOAN );
|
||||
db.execSQL("CREATE TABLE tmp3 AS SELECT _id, " + KEY_BOOK + ", " + KEY_AUTHOR + ", " + KEY_TITLE + ", " + KEY_POSITION + " FROM " + DB_TB_ANTHOLOGY);
|
||||
db.execSQL("CREATE TABLE tmp4 AS SELECT " + KEY_BOOK + ", " + KEY_BOOKSHELF+ " FROM " + DB_TB_BOOK_BOOKSHELF_WEAK);
|
||||
|
||||
db.execSQL("DROP TABLE " + DB_TB_ANTHOLOGY);
|
||||
db.execSQL("DROP TABLE " + DB_TB_LOAN);
|
||||
db.execSQL("DROP TABLE " + DB_TB_BOOKS);
|
||||
db.execSQL("DROP TABLE " + DB_TB_BOOK_BOOKSHELF_WEAK);
|
||||
|
||||
db.execSQL(DATABASE_CREATE_BOOKS);
|
||||
db.execSQL(DATABASE_CREATE_LOAN);
|
||||
db.execSQL(DATABASE_CREATE_ANTHOLOGY);
|
||||
db.execSQL(DATABASE_CREATE_BOOK_BOOKSHELF_WEAK);
|
||||
|
||||
db.execSQL("INSERT INTO " + DB_TB_BOOKS + " SELECT * FROM tmp1");
|
||||
db.execSQL("INSERT INTO " + DB_TB_LOAN + " SELECT * FROM tmp2");
|
||||
db.execSQL("INSERT INTO " + DB_TB_ANTHOLOGY + " SELECT * FROM tmp3");
|
||||
db.execSQL("INSERT INTO " + DB_TB_BOOK_BOOKSHELF_WEAK + " SELECT * FROM tmp4");
|
||||
|
||||
db.execSQL("DROP TABLE tmp1");
|
||||
db.execSQL("DROP TABLE tmp2");
|
||||
db.execSQL("DROP TABLE tmp3");
|
||||
db.execSQL("DROP TABLE tmp4");
|
||||
|
||||
db.execSQL(DATABASE_CREATE_INDICES);
|
||||
}
|
||||
if (curVersion == 45) {
|
||||
//do nothing
|
||||
curVersion++;
|
||||
db.execSQL("DELETE FROM " + DB_TB_LOAN + " WHERE " + KEY_LOANED_TO + "='null'" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1441,8 +1481,8 @@ public class CatalogueDBAdapter {
|
||||
* @param signed Is this copy signed
|
||||
* @return rowId or -1 if failed
|
||||
*/
|
||||
public long createBook(String author, String title, String isbn, String publisher, String date_published, float rating, String bookshelf, Boolean read, String series, int pages, String series_num, String notes, String list_price, int anthology, String location, String read_start, String read_end, boolean audiobook, boolean signed) {
|
||||
return createBook(0, author, title, isbn, publisher, date_published, rating, bookshelf, read, series, pages, series_num, notes, list_price, anthology, location, read_start, read_end, audiobook, signed);
|
||||
public long createBook(String author, String title, String isbn, String publisher, String date_published, float rating, String bookshelf, Boolean read, String series, int pages, String series_num, String notes, String list_price, int anthology, String location, String read_start, String read_end, String format, boolean signed) {
|
||||
return createBook(0, author, title, isbn, publisher, date_published, rating, bookshelf, read, series, pages, series_num, notes, list_price, anthology, location, read_start, read_end, format, signed);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1472,7 +1512,7 @@ public class CatalogueDBAdapter {
|
||||
* @param signed Is this copy signed
|
||||
* @return rowId or -1 if failed
|
||||
*/
|
||||
public long createBook(long id, String author, String title, String isbn, String publisher, String date_published, float rating, String bookshelf, Boolean read, String series, int pages, String series_num, String notes, String list_price, int anthology, String location, String read_start, String read_end, boolean audiobook, boolean signed) {
|
||||
public long createBook(long id, String author, String title, String isbn, String publisher, String date_published, float rating, String bookshelf, Boolean read, String series, int pages, String series_num, String notes, String list_price, int anthology, String location, String read_start, String read_end, String format, boolean signed) {
|
||||
ContentValues initialValues = new ContentValues();
|
||||
String[] names = processAuthorName(author);
|
||||
Cursor authorId = getAuthorByName(names);
|
||||
@ -1504,7 +1544,7 @@ public class CatalogueDBAdapter {
|
||||
initialValues.put(KEY_LOCATION, location);
|
||||
initialValues.put(KEY_READ_START, read_start);
|
||||
initialValues.put(KEY_READ_END, read_end);
|
||||
initialValues.put(KEY_AUDIOBOOK, audiobook);
|
||||
initialValues.put(KEY_FORMAT, format);
|
||||
initialValues.put(KEY_SIGNED, signed);
|
||||
authorId.close();
|
||||
|
||||
@ -1679,7 +1719,7 @@ public class CatalogueDBAdapter {
|
||||
* @param signed Is this copy signed
|
||||
* @return true if the note was successfully updated, false otherwise
|
||||
*/
|
||||
public boolean updateBook(long rowId, String author, String title, String isbn, String publisher, String date_published, float rating, String bookshelf, boolean read, String series, int pages, String series_num, String notes, String list_price, int anthology, String location, String read_start, String read_end, boolean audiobook, boolean signed) {
|
||||
public boolean updateBook(long rowId, String author, String title, String isbn, String publisher, String date_published, float rating, String bookshelf, boolean read, String series, int pages, String series_num, String notes, String list_price, int anthology, String location, String read_start, String read_end, String format, boolean signed) {
|
||||
boolean success;
|
||||
ContentValues args = new ContentValues();
|
||||
String[] names = processAuthorName(author);
|
||||
@ -1708,7 +1748,7 @@ public class CatalogueDBAdapter {
|
||||
args.put(KEY_LOCATION, location);
|
||||
args.put(KEY_READ_START, read_start);
|
||||
args.put(KEY_READ_END, read_end);
|
||||
args.put(KEY_AUDIOBOOK, audiobook);
|
||||
args.put(KEY_FORMAT, format);
|
||||
args.put(KEY_SIGNED, signed);
|
||||
authorId.close();
|
||||
|
||||
|
@ -60,13 +60,17 @@ public class FieldVisibility extends Activity {
|
||||
*/
|
||||
public void setupFields() {
|
||||
// The fields to show/hide
|
||||
String[] fields = {"author", "title", "thumbnail", "isbn", "series", "series_num", "publisher", "date_published",
|
||||
"bookshelf", "pages", "list_price", "read", "rating", "notes", "anthology", "location", "read_start",
|
||||
"read_end", "audiobook", "signed"};
|
||||
String[] fields = {CatalogueDBAdapter.KEY_AUTHOR, CatalogueDBAdapter.KEY_TITLE, "thumbnail",
|
||||
CatalogueDBAdapter.KEY_ISBN, CatalogueDBAdapter.KEY_SERIES, CatalogueDBAdapter.KEY_SERIES_NUM,
|
||||
CatalogueDBAdapter.KEY_PUBLISHER, CatalogueDBAdapter.KEY_DATE_PUBLISHED, CatalogueDBAdapter.KEY_BOOKSHELF,
|
||||
CatalogueDBAdapter.KEY_PAGES, CatalogueDBAdapter.KEY_LIST_PRICE, CatalogueDBAdapter.KEY_READ,
|
||||
CatalogueDBAdapter.KEY_RATING, CatalogueDBAdapter.KEY_NOTES, CatalogueDBAdapter.KEY_ANTHOLOGY,
|
||||
CatalogueDBAdapter.KEY_LOCATION, CatalogueDBAdapter.KEY_READ_START, CatalogueDBAdapter.KEY_READ_END,
|
||||
CatalogueDBAdapter.KEY_FORMAT, CatalogueDBAdapter.KEY_SIGNED};
|
||||
int[] fieldRs = {R.string.author, R.string.title, R.string.thumbnail, R.string.isbn, R.string.series, R.string.series_num,
|
||||
R.string.publisher, R.string.date_published, R.string.bookshelf, R.string.pages, R.string.list_price,
|
||||
R.string.read, R.string.rating, R.string.notes, R.string.anthology, R.string.location,
|
||||
R.string.read_start, R.string.read_end, R.string.audiobook, R.string.signed};
|
||||
R.string.read_start, R.string.read_end, R.string.format, R.string.signed};
|
||||
boolean[] compulsary = {true, true, false, false, false, false, false, false,
|
||||
true, false, false, false, false, false, false, false, false, false, false, false};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user