Various again

master
Evan Leybourn 2010-11-04 17:09:39 +11:00
parent 448858bad8
commit b876c6df82
11 changed files with 202 additions and 121 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.eleybourn.bookcatalogue" package="com.eleybourn.bookcatalogue"
android:versionName="3.0" android:installLocation="preferExternal" android:versionCode="35"> android:versionName="3.0.1" android:versionCode="36">
<application android:label="@string/app_name" android:icon="@drawable/logo_bc"> <application android:label="@string/app_name" android:icon="@drawable/logo_bc">
<activity android:name=".BookCatalogue" <activity android:name=".BookCatalogue"
android:label="@string/app_name"> android:label="@string/app_name">

7
README
View File

@ -41,6 +41,13 @@ Features include;
case. e.g. "The murder on the links" becomes "The Murder on the Links" 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) * Using ISBN or Barcode scanning will also download a thumbnail (if available)
New in v3.0.1
* Export bug fixed
* Further enhancements to the new ISBN screen
* Filtering by bookshelf on title view is now fixed
* There is now an <Empty Series> when sorting by Series (thanks Vinikia)
* App will now search all fields (Thanks Michael)
New in v3.0 New in v3.0
* Added app2sd support (2.2 users only) * Added app2sd support (2.2 users only)
* You can now assign books to multiple bookshelves (requested by many people) * You can now assign books to multiple bookshelves (requested by many people)

View File

@ -10,4 +10,4 @@
# Indicates whether an apk should be generated for each density. # Indicates whether an apk should be generated for each density.
split.density=false split.density=false
# Project target. # Project target.
target=android-8 target=android-7

View File

@ -9,8 +9,8 @@
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent"> android:layout_height="fill_parent">
<TextView android:id="@+id/isbn" <EditText android:id="@+id/isbn"
android:layout_width="wrap_content" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:hint="@string/isbn" android:hint="@string/isbn"
@ -27,21 +27,21 @@
<Button android:id="@+id/isbn_1" <Button android:id="@+id/isbn_1"
android:textAppearance="?android:attr/textAppearanceLarge" android:textAppearance="?android:attr/textAppearanceLarge"
android:text="1" android:text="1"
android:width="50sp" android:width="75sp"
android:layout_width="50sp" android:layout_width="75sp"
android:layout_height="wrap_content" /> android:layout_height="75sp" />
<Button android:id="@+id/isbn_2" <Button android:id="@+id/isbn_2"
android:textAppearance="?android:attr/textAppearanceLarge" android:textAppearance="?android:attr/textAppearanceLarge"
android:text="2" android:text="2"
android:width="50sp" android:width="75sp"
android:layout_width="50sp" android:layout_width="75sp"
android:layout_height="wrap_content" /> android:layout_height="75sp" />
<Button android:id="@+id/isbn_3" <Button android:id="@+id/isbn_3"
android:textAppearance="?android:attr/textAppearanceLarge" android:textAppearance="?android:attr/textAppearanceLarge"
android:text="3" android:text="3"
android:width="50sp" android:width="75sp"
android:layout_width="50sp" android:layout_width="75sp"
android:layout_height="wrap_content" /> android:layout_height="75sp" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:orientation="horizontal" android:orientation="horizontal"
@ -51,21 +51,21 @@
<Button android:id="@+id/isbn_4" <Button android:id="@+id/isbn_4"
android:textAppearance="?android:attr/textAppearanceLarge" android:textAppearance="?android:attr/textAppearanceLarge"
android:text="4" android:text="4"
android:width="50sp" android:width="75sp"
android:layout_width="50sp" android:layout_width="75sp"
android:layout_height="wrap_content" /> android:layout_height="75sp" />
<Button android:id="@+id/isbn_5" <Button android:id="@+id/isbn_5"
android:textAppearance="?android:attr/textAppearanceLarge" android:textAppearance="?android:attr/textAppearanceLarge"
android:text="5" android:text="5"
android:width="50sp" android:width="75sp"
android:layout_width="50sp" android:layout_width="75sp"
android:layout_height="wrap_content" /> android:layout_height="75sp" />
<Button android:id="@+id/isbn_6" <Button android:id="@+id/isbn_6"
android:textAppearance="?android:attr/textAppearanceLarge" android:textAppearance="?android:attr/textAppearanceLarge"
android:text="6" android:text="6"
android:width="50sp" android:width="75sp"
android:layout_width="50sp" android:layout_width="75sp"
android:layout_height="wrap_content" /> android:layout_height="75sp" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:orientation="horizontal" android:orientation="horizontal"
@ -75,21 +75,21 @@
<Button android:id="@+id/isbn_7" <Button android:id="@+id/isbn_7"
android:textAppearance="?android:attr/textAppearanceLarge" android:textAppearance="?android:attr/textAppearanceLarge"
android:text="7" android:text="7"
android:width="50sp" android:width="75sp"
android:layout_width="50sp" android:layout_width="75sp"
android:layout_height="wrap_content" /> android:layout_height="75sp" />
<Button android:id="@+id/isbn_8" <Button android:id="@+id/isbn_8"
android:textAppearance="?android:attr/textAppearanceLarge" android:textAppearance="?android:attr/textAppearanceLarge"
android:text="8" android:text="8"
android:width="50sp" android:width="75sp"
android:layout_width="50sp" android:layout_width="75sp"
android:layout_height="50sp" /> android:layout_height="75sp" />
<Button android:id="@+id/isbn_9" <Button android:id="@+id/isbn_9"
android:textAppearance="?android:attr/textAppearanceLarge" android:textAppearance="?android:attr/textAppearanceLarge"
android:text="9" android:text="9"
android:width="50sp" android:width="75sp"
android:layout_width="50sp" android:layout_width="75sp"
android:layout_height="50sp" /> android:layout_height="75sp" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:orientation="horizontal" android:orientation="horizontal"
@ -99,27 +99,27 @@
<Button android:id="@+id/isbn_X" <Button android:id="@+id/isbn_X"
android:textAppearance="?android:attr/textAppearanceLarge" android:textAppearance="?android:attr/textAppearanceLarge"
android:text="X" android:text="X"
android:width="50sp" android:width="75sp"
android:layout_width="50sp" android:layout_width="75sp"
android:layout_height="50sp" /> android:layout_height="75sp" />
<Button android:id="@+id/isbn_0" <Button android:id="@+id/isbn_0"
android:textAppearance="?android:attr/textAppearanceLarge" android:textAppearance="?android:attr/textAppearanceLarge"
android:text="0" android:text="0"
android:width="50sp" android:width="75sp"
android:layout_width="50sp" android:layout_width="75sp"
android:layout_height="50sp" /> android:layout_height="75sp" />
<ImageButton android:id="@+id/isbn_del" <ImageButton android:id="@+id/isbn_del"
android:textAppearance="?android:attr/textAppearanceLarge" android:textAppearance="?android:attr/textAppearanceLarge"
android:src="@+drawable/sym_keyboard_feedback_delete" android:src="@+drawable/sym_keyboard_feedback_delete"
android:width="50sp" android:width="75sp"
android:layout_width="50sp" android:layout_width="75sp"
android:layout_height="50sp" /> android:layout_height="75sp" />
</LinearLayout> </LinearLayout>
<Button android:id="@+id/search" <Button android:id="@+id/search"
android:text="@string/search" android:text="@string/search"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:width="150sp" android:width="175sp"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
<TextView android:id="@+id/isbn_search_status" <TextView android:id="@+id/isbn_search_status"

View File

@ -2,37 +2,74 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:orientation="horizontal"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="40dp"> android:layout_height="40dp"
<ImageView android:id="@+id/row_image_view" >
android:layout_width="50dp" <LinearLayout
android:layout_height="wrap_content" android:orientation="horizontal"
android:paddingLeft="10dp"
android:visibility="gone"
/>
<TextView android:id="@+id/row_img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
/>
<TextView android:id="@+id/row_series_num"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="10dp" android:paddingLeft="10dp"
android:gravity="left"
android:layout_weight="0"
>
<ImageView android:id="@+id/row_image_view"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:visibility="gone"
/>
<TextView android:id="@+id/row_img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:gravity="left"
android:paddingTop="10dp" android:paddingTop="10dp"
android:paddingBottom="10dp" android:paddingBottom="10dp"
/> android:layout_weight="1"
<TextView android:id="@+id/row_title" >
<TextView android:id="@+id/row_series_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:lines="1"
/>
<TextView android:id="@+id/row_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:lines="1"
/>
<TextView android:id="@+id/row_author"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:lines="1"
/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingLeft="10dp" android:paddingLeft="10dp"
android:paddingTop="10dp" android:paddingRight="10dp"
android:paddingBottom="10dp" android:gravity="right"
/> android:layout_weight="0"
<TextView android:id="@+id/row_author" >
android:layout_width="wrap_content" <ImageView android:id="@+id/row_read_image_view"
android:layout_height="wrap_content" android:layout_width="30dp"
android:paddingLeft="10dp" android:layout_height="wrap_content"
android:paddingTop="10dp" android:src="@drawable/btn_check_buttonless_off"
android:paddingBottom="10dp" android:visibility="gone"
/> />
<TextView android:id="@+id/row_read"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
/>
</LinearLayout>
</LinearLayout> </LinearLayout>

View File

@ -44,7 +44,6 @@ import android.os.Environment;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import android.os.Message; import android.os.Message;
import android.util.Log;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.widget.TextView; import android.widget.TextView;
@ -106,7 +105,6 @@ public class AdministrationFunctions extends Activity {
mDbHelper.open(); mDbHelper.open();
setContentView(R.layout.administration_functions); setContentView(R.layout.administration_functions);
Bundle extras = getIntent().getExtras(); Bundle extras = getIntent().getExtras();
Log.e("BC", "Admin");
try { try {
if (extras.getString(DOAUTO).equals("export")) { if (extras.getString(DOAUTO).equals("export")) {
finish_after = true; finish_after = true;
@ -118,7 +116,6 @@ public class AdministrationFunctions extends Activity {
} catch (NullPointerException e) { } catch (NullPointerException e) {
//do nothing //do nothing
} }
Log.e("BC", "Setup");
setupAdmin(); setupAdmin();
} catch (Exception e) { } catch (Exception e) {
//Log.e("Book Catalogue", "Unknown Exception - BC onCreate - " + e.getMessage() ); //Log.e("Book Catalogue", "Unknown Exception - BC onCreate - " + e.getMessage() );
@ -135,13 +132,10 @@ public class AdministrationFunctions extends Activity {
*/ */
public void setupAdmin() { public void setupAdmin() {
/* Bookshelf Link */ /* Bookshelf Link */
Log.e("BC", "Setup");
TextView bookshelf = (TextView) findViewById(R.id.bookshelf_label); TextView bookshelf = (TextView) findViewById(R.id.bookshelf_label);
Log.e("BC", bookshelf.toString());
bookshelf.setOnClickListener(new OnClickListener() { bookshelf.setOnClickListener(new OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
Log.e("BC", "Click");
manageBookselves(); manageBookselves();
return; return;
} }
@ -378,7 +372,7 @@ public class AdministrationFunctions extends Activity {
'"' + CatalogueDBAdapter.KEY_PUBLISHER + "\"," + //6 '"' + CatalogueDBAdapter.KEY_PUBLISHER + "\"," + //6
'"' + CatalogueDBAdapter.KEY_DATE_PUBLISHED + "\"," + //7 '"' + CatalogueDBAdapter.KEY_DATE_PUBLISHED + "\"," + //7
'"' + CatalogueDBAdapter.KEY_RATING + "\"," + //8 '"' + CatalogueDBAdapter.KEY_RATING + "\"," + //8
'"' + "bookshelf_id,\"" + //9 '"' + "bookshelf_id\"," + //9
'"' + CatalogueDBAdapter.KEY_BOOKSHELF + "\"," + //10 '"' + CatalogueDBAdapter.KEY_BOOKSHELF + "\"," + //10
'"' + CatalogueDBAdapter.KEY_READ + "\"," + //11 '"' + CatalogueDBAdapter.KEY_READ + "\"," + //11
'"' + CatalogueDBAdapter.KEY_SERIES + "\"," + //12 '"' + CatalogueDBAdapter.KEY_SERIES + "\"," + //12
@ -608,11 +602,9 @@ public class AdministrationFunctions extends Activity {
int num = 0; int num = 0;
/* Iterate through each imported row */ /* Iterate through each imported row */
while (row < export.size()) { while (row < export.size()) {
Log.e("BC", "Row: " + row);
num++; num++;
String[] imported = returnRow(export.get(row)); String[] imported = returnRow(export.get(row));
row++; row++;
Log.e("BC", "A: " + row);
/* Setup aliases for each cell*/ /* Setup aliases for each cell*/
Long id = null; Long id = null;
@ -621,7 +613,6 @@ public class AdministrationFunctions extends Activity {
} catch(Exception e) { } catch(Exception e) {
id = Long.parseLong("0"); id = Long.parseLong("0");
} }
Log.e("BC", "1: " + row);
String family = ""; String family = "";
try { try {
@ -630,7 +621,6 @@ public class AdministrationFunctions extends Activity {
// family is a compulsory field // family is a compulsory field
continue; continue;
} }
Log.e("BC", "2: " + row);
String given = ""; String given = "";
try { try {
given = imported[2]; given = imported[2];
@ -639,7 +629,6 @@ public class AdministrationFunctions extends Activity {
} }
//String author_id = imported[3]; //String author_id = imported[3];
Log.e("BC", "3: " + row);
String title = ""; String title = "";
title = imported[4]; title = imported[4];
try { try {
@ -648,7 +637,6 @@ public class AdministrationFunctions extends Activity {
//title is a compulsory field //title is a compulsory field
continue; continue;
} }
Log.e("BC", "4: " + row);
String isbn = ""; String isbn = "";
try { try {
@ -656,7 +644,6 @@ public class AdministrationFunctions extends Activity {
} catch (Exception e) { } catch (Exception e) {
isbn = ""; isbn = "";
} }
Log.e("BC", "5: " + row);
String publisher = ""; String publisher = "";
try { try {
@ -664,7 +651,6 @@ public class AdministrationFunctions extends Activity {
} catch (Exception e) { } catch (Exception e) {
publisher = ""; publisher = "";
} }
Log.e("BC", "B: " + row);
String date_published = ""; String date_published = "";
try { try {
@ -749,7 +735,6 @@ public class AdministrationFunctions extends Activity {
} catch (Exception e) { } catch (Exception e) {
location = ""; location = "";
} }
Log.e("BC", "C: " + row);
String read_start = ""; String read_start = "";
try { try {
@ -803,7 +788,6 @@ public class AdministrationFunctions extends Activity {
anthology_titles = ""; anthology_titles = "";
} }
Log.e("BC", "D: " + row);
String author = family + ", " + given; String author = family + ", " + given;
try { try {
if (id == 0) { if (id == 0) {
@ -834,7 +818,7 @@ public class AdministrationFunctions extends Activity {
} }
} }
} catch (Exception e) { } catch (Exception e) {
Log.e("BC", "Import Book (Single) Error"); //Log.e("BC", "Import Book (Single) Error");
// do nothing // do nothing
} }
@ -851,7 +835,6 @@ public class AdministrationFunctions extends Activity {
} }
} }
} }
Log.e("BC", num + " " + title);
sendMessage(num, title); sendMessage(num, title);
} }
sendMessage(0, "Complete"); sendMessage(0, "Complete");

View File

@ -31,9 +31,6 @@ import java.io.IOException;
import java.io.OutputStreamWriter; import java.io.OutputStreamWriter;
import java.util.ArrayList; import java.util.ArrayList;
import android.app.backup.BackupAgent;
import android.app.backup.BackupDataInput;
import android.app.backup.BackupDataOutput;
import android.database.Cursor; import android.database.Cursor;
import android.os.ParcelFileDescriptor; import android.os.ParcelFileDescriptor;
@ -41,21 +38,22 @@ import android.os.ParcelFileDescriptor;
* A book catalogue application that integrates with Google Books. * A book catalogue application that integrates with Google Books.
*/ */
/* THIS DOES NOT WORK YET */ /* THIS DOES NOT WORK YET */
public class BookBackupAgent extends BackupAgent { public class BookBackupAgent { //TODO extends BackupAgent
static final int AGENT_VERSION = 1; static final int AGENT_VERSION = 1;
static final String APP_DATA_KEY = "alldata"; static final String APP_DATA_KEY = "alldata";
public int mCount = 0; public int mCount = 0;
public CatalogueDBAdapter mDbHelper; public CatalogueDBAdapter mDbHelper;
/** For convenience, we set up the File object for the app's data on creation */ /** For convenience, we set up the File object for the app's data on creation */
@Override //TODO @Override
public void onCreate() { public void onCreate() {
mDbHelper = new CatalogueDBAdapter(this); mDbHelper = null; //TODO new CatalogueDBAdapter(this);
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see android.app.backup.BackupAgent#onBackup(android.os.ParcelFileDescriptor, android.app.backup.BackupDataOutput, android.os.ParcelFileDescriptor) * @see android.app.backup.BackupAgent#onBackup(android.os.ParcelFileDescriptor, android.app.backup.BackupDataOutput, android.os.ParcelFileDescriptor)
*/ */
/*
@Override @Override
public void onBackup(ParcelFileDescriptor oldState, BackupDataOutput data, ParcelFileDescriptor newState) throws IOException { public void onBackup(ParcelFileDescriptor oldState, BackupDataOutput data, ParcelFileDescriptor newState) throws IOException {
try { try {
@ -191,7 +189,7 @@ public class BookBackupAgent extends BackupAgent {
while (books.moveToNext()); while (books.moveToNext());
} }
/* write to the SDCard */ // write to the SDCard
try { try {
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(AdministrationFunctions.filePath), AdministrationFunctions.UTF8), AdministrationFunctions.BUFFER_SIZE); BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(AdministrationFunctions.filePath), AdministrationFunctions.UTF8), AdministrationFunctions.BUFFER_SIZE);
out.write(export); out.write(export);
@ -220,11 +218,13 @@ public class BookBackupAgent extends BackupAgent {
//I can't test this, so I don't know if it will work //I can't test this, so I don't know if it will work
} }
} }
*/
/* (non-Javadoc) /* (non-Javadoc)
* @see android.app.backup.BackupAgent#onRestore(android.app.backup.BackupDataInput, int, android.os.ParcelFileDescriptor) * @see android.app.backup.BackupAgent#onRestore(android.app.backup.BackupDataInput, int, android.os.ParcelFileDescriptor)
*/ */
@Override //TODO @Override
/* TODO
public void onRestore(BackupDataInput data, int appVersionCode, ParcelFileDescriptor newState) throws IOException { public void onRestore(BackupDataInput data, int appVersionCode, ParcelFileDescriptor newState) throws IOException {
try { try {
data.readNextHeader(); data.readNextHeader();
@ -248,7 +248,7 @@ public class BookBackupAgent extends BackupAgent {
} }
//TODO: As before //TODO: As before
/* Iterate through each imported row */ // Iterate through each imported row
int row = 1; int row = 1;
while (row < export.size()) { while (row < export.size()) {
String[] imported = export.get(row).split("\t"); String[] imported = export.get(row).split("\t");
@ -266,7 +266,7 @@ public class BookBackupAgent extends BackupAgent {
// This import line is too short // This import line is too short
row++; row++;
/* Setup aliases for each cell*/ // Setup aliases for each cell
Long id = null; Long id = null;
try { try {
id = Long.parseLong(imported[0]); id = Long.parseLong(imported[0]);
@ -499,5 +499,6 @@ public class BookBackupAgent extends BackupAgent {
// I can't test this so I don't know if it will work // I can't test this so I don't know if it will work
} }
} }
*/
} }

View File

@ -39,7 +39,6 @@ import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log;
import android.view.ContextMenu; import android.view.ContextMenu;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.Menu; import android.view.Menu;
@ -124,7 +123,6 @@ public class BookCatalogue extends ExpandableListActivity {
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
bookshelf = getString(R.string.all_books); bookshelf = getString(R.string.all_books);
Log.e("BC", "VERSION " + CatalogueDBAdapter.DATABASE_VERSION + " ");
try { try {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
// Extract the sort type from the bundle. getInt will return 0 if there is no attribute // Extract the sort type from the bundle. getInt will return 0 if there is no attribute
@ -138,7 +136,7 @@ public class BookCatalogue extends ExpandableListActivity {
addToCurrentGroup(pos, true); addToCurrentGroup(pos, true);
} }
} catch (Exception e) { } catch (Exception e) {
Log.e("Book Catalogue", "Unknown Exception - BC Prefs - " + e.getMessage() ); //Log.e("Book Catalogue", "Unknown Exception - BC Prefs - " + e.getMessage() );
} }
// This sets the search capability to local (application) search // This sets the search capability to local (application) search
setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL); setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL);
@ -152,7 +150,7 @@ public class BookCatalogue extends ExpandableListActivity {
} }
registerForContextMenu(getExpandableListView()); registerForContextMenu(getExpandableListView());
} catch (Exception e) { } catch (Exception e) {
Log.e("Book Catalogue", "Unknown Exception - BC onCreate - " + e.getMessage() ); //Log.e("Book Catalogue", "Unknown Exception - BC onCreate - " + e.getMessage() );
} }
} }
@ -444,7 +442,7 @@ public class BookCatalogue extends ExpandableListActivity {
this.setTitle(R.string.search_title); this.setTitle(R.string.search_title);
} else { } else {
// Return all books for the given bookshelf // Return all books for the given bookshelf
BooksCursor = mDbHelper.fetchAllSeries(bookshelf); BooksCursor = mDbHelper.fetchAllSeries(bookshelf, true);
numAuthors = BooksCursor.getCount(); numAuthors = BooksCursor.getCount();
this.setTitle(R.string.app_name); this.setTitle(R.string.app_name);
} }
@ -453,11 +451,11 @@ public class BookCatalogue extends ExpandableListActivity {
// Create an array to specify the fields we want to display in the list // Create an array to specify the fields we want to display in the list
String[] from = new String[]{CatalogueDBAdapter.KEY_ROWID}; String[] from = new String[]{CatalogueDBAdapter.KEY_ROWID};
String[] exp_from = new String[]{CatalogueDBAdapter.KEY_ROWID, CatalogueDBAdapter.KEY_SERIES_NUM, CatalogueDBAdapter.KEY_TITLE, CatalogueDBAdapter.KEY_AUTHOR_FORMATTED}; String[] exp_from = new String[]{CatalogueDBAdapter.KEY_ROWID, CatalogueDBAdapter.KEY_SERIES_NUM, CatalogueDBAdapter.KEY_TITLE, CatalogueDBAdapter.KEY_AUTHOR_FORMATTED, CatalogueDBAdapter.KEY_READ};
// and an array of the fields we want to bind those fields to (in this case just text1) // and an array of the fields we want to bind those fields to (in this case just text1)
int[] to = new int[]{R.id.row_family}; int[] to = new int[]{R.id.row_family};
int[] exp_to = new int[]{R.id.row_img, R.id.row_series_num, R.id.row_title, R.id.row_author}; int[] exp_to = new int[]{R.id.row_img, R.id.row_series_num, R.id.row_title, R.id.row_author, R.id.row_read};
// Instantiate the List Adapter // Instantiate the List Adapter
ExpandableListAdapter books = new SeriesBookListAdapter(BooksCursor, this, layout, layout_child, from, to, exp_from, exp_to); ExpandableListAdapter books = new SeriesBookListAdapter(BooksCursor, this, layout, layout_child, from, to, exp_from, exp_to);
@ -545,6 +543,21 @@ public class BookCatalogue extends ExpandableListActivity {
} }
text = ""; text = "";
return; return;
} else if (v.getId() == R.id.row_read) {
boolean field_visibility = mPrefs.getBoolean(FieldVisibility.prefix + "read", true);
ImageView newv = (ImageView) ((ViewGroup) v.getParent()).findViewById(R.id.row_read_image_view);
if (field_visibility == false) {
newv.setVisibility(GONE);
} else {
if (text.equals("1")) {
newv.setImageResource(R.drawable.btn_check_buttonless_on);
} else {
newv.setImageResource(R.drawable.btn_check_buttonless_off);
}
newv.setVisibility(VISIBLE);
}
text = "";
return;
} }
v.setText(text); v.setText(text);
} }
@ -1119,7 +1132,7 @@ public class BookCatalogue extends ExpandableListActivity {
view.setSelectedGroup(currentGroup.get(currentGroup.size()-1)); view.setSelectedGroup(currentGroup.get(currentGroup.size()-1));
} catch (Exception e) { } catch (Exception e) {
Log.e("Book Catalogue", "Unknown Exception - BC gotoCurrentGroup - " + e.getMessage() ); //Log.e("Book Catalogue", "Unknown Exception - BC gotoCurrentGroup - " + e.getMessage() );
} }
return; return;
} }

View File

@ -43,11 +43,10 @@ import android.graphics.Matrix;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.provider.MediaStore; import android.provider.MediaStore;
import android.util.Log;
import android.view.ContextMenu; import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView; import android.widget.AutoCompleteTextView;
@ -254,7 +253,6 @@ public class BookEditFields extends Activity {
mBookshelfButton = (Button) findViewById(R.id.bookshelf); mBookshelfButton = (Button) findViewById(R.id.bookshelf);
mBookshelfText = (TextView) findViewById(R.id.bookshelf_text); mBookshelfText = (TextView) findViewById(R.id.bookshelf_text);
Log.e("BC", "FOO");
mBookshelfButton.setOnClickListener(new View.OnClickListener() { mBookshelfButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) { public void onClick(View v) {
Cursor bookshelves_for_book = null; Cursor bookshelves_for_book = null;
@ -282,7 +280,6 @@ public class BookEditFields extends Activity {
boolean checked = false; boolean checked = false;
int db_book = bookshelves_for_book.getInt(bookshelves_for_book.getColumnIndex(CatalogueDBAdapter.KEY_BOOK)); int db_book = bookshelves_for_book.getInt(bookshelves_for_book.getColumnIndex(CatalogueDBAdapter.KEY_BOOK));
String db_bookshelf = bookshelves_for_book.getString(bookshelves_for_book.getColumnIndex(CatalogueDBAdapter.KEY_BOOKSHELF)); String db_bookshelf = bookshelves_for_book.getString(bookshelves_for_book.getColumnIndex(CatalogueDBAdapter.KEY_BOOKSHELF));
Log.e("BC", "Bookshelf " + db_bookshelf + " " + db_book);
if (db_book == 1 || mBookshelfText.getText().toString().indexOf(db_bookshelf + BOOKSHELF_SEPERATOR) > -1) { if (db_book == 1 || mBookshelfText.getText().toString().indexOf(db_bookshelf + BOOKSHELF_SEPERATOR) > -1) {
checked = true; checked = true;
} }
@ -392,7 +389,7 @@ public class BookEditFields extends Activity {
} }
}); });
} catch (SQLException e) { } catch (SQLException e) {
Log.e("Book Catalogue", "Unknown error " + e.toString()); //Log.e("Book Catalogue", "Unknown error " + e.toString());
} }
} }
@ -456,7 +453,7 @@ public class BookEditFields extends Activity {
try { try {
f = new FileOutputStream(filename); f = new FileOutputStream(filename);
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
Log.e("Book Catalogue", "Thumbnail cannot be written"); //Log.e("Book Catalogue", "Thumbnail cannot be written");
return; return;
} }
x.compress(Bitmap.CompressFormat.PNG, 100, f); x.compress(Bitmap.CompressFormat.PNG, 100, f);
@ -811,7 +808,7 @@ public class BookEditFields extends Activity {
try { try {
f = new FileOutputStream(filename); f = new FileOutputStream(filename);
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
Log.e("Book Catalogue", "Thumbnail cannot be written"); //Log.e("Book Catalogue", "Thumbnail cannot be written");
return; return;
} }

View File

@ -37,6 +37,7 @@ import android.database.Cursor;
import android.os.Bundle; import android.os.Bundle;
import android.view.View; import android.view.View;
import android.widget.Button; import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
@ -50,7 +51,7 @@ import android.widget.Toast;
public class BookISBNSearch extends Activity { public class BookISBNSearch extends Activity {
private static final int CREATE_BOOK = 0; private static final int CREATE_BOOK = 0;
private TextView mIsbnText; private EditText mIsbnText;
private TextView mIsbnStatus; private TextView mIsbnStatus;
private Button mConfirmButton; private Button mConfirmButton;
private CatalogueDBAdapter mDbHelper; private CatalogueDBAdapter mDbHelper;
@ -73,7 +74,7 @@ public class BookISBNSearch extends Activity {
mDbHelper.open(); mDbHelper.open();
setContentView(R.layout.isbn_search); setContentView(R.layout.isbn_search);
mIsbnText = (TextView) findViewById(R.id.isbn); mIsbnText = (EditText) findViewById(R.id.isbn);
mIsbnStatus = (TextView) findViewById(R.id.isbn_search_status); mIsbnStatus = (TextView) findViewById(R.id.isbn_search_status);
mConfirmButton = (Button) findViewById(R.id.search); mConfirmButton = (Button) findViewById(R.id.search);

View File

@ -88,6 +88,8 @@ public class CatalogueDBAdapter {
public static final int ANTHOLOGY_SAME_AUTHOR = 1; public static final int ANTHOLOGY_SAME_AUTHOR = 1;
public static final int ANTHOLOGY_MULTIPLE_AUTHORS = 2; public static final int ANTHOLOGY_MULTIPLE_AUTHORS = 2;
public static final String META_EMPTY_SERIES = "<Empty Series>";
/* Database creation sql statement */ /* Database creation sql statement */
private static final String DATABASE_CREATE_AUTHORS = private static final String DATABASE_CREATE_AUTHORS =
"create table " + DB_TB_AUTHORS + "create table " + DB_TB_AUTHORS +
@ -193,7 +195,7 @@ public class CatalogueDBAdapter {
private final Context mCtx; private final Context mCtx;
public static final int DATABASE_VERSION = 42; public static final int DATABASE_VERSION = 43;
/** /**
* This is a specific version of the SQLiteOpenHelper class. It handles onCreate and onUpgrade events * This is a specific version of the SQLiteOpenHelper class. It handles onCreate and onUpgrade events
@ -513,6 +515,15 @@ public class CatalogueDBAdapter {
//do nothing //do nothing
} }
} }
if (curVersion == 42) {
//do nothing
curVersion++;
message += "* Export bug fixed\n\n";
message += "* Further enhancements to the new ISBN screen\n\n";
message += "* Filtering by bookshelf on title view is now fixed\n\n";
message += "* There is now an <Empty Series> when sorting by Series (thanks Vinikia)\n\n";
message += "* App will now search all fields (Thanks Michael)\n\n";
}
} }
} }
@ -830,7 +841,7 @@ public class CatalogueDBAdapter {
* @return Cursor over all books * @return Cursor over all books
*/ */
public Cursor fetchAllBooks(String order, String bookshelf) { public Cursor fetchAllBooks(String order, String bookshelf) {
return fetchAllBooks(order, "All Books", ""); return fetchAllBooks(order, bookshelf, "");
} }
/** /**
@ -921,7 +932,13 @@ public class CatalogueDBAdapter {
* @return Cursor over all books * @return Cursor over all books
*/ */
public Cursor fetchAllBooksBySeries(String series, String bookshelf) { public Cursor fetchAllBooksBySeries(String series, String bookshelf) {
String where = " AND b." + KEY_SERIES + "='" + encodeString(series) + "'"; String where = " AND ";
if (series.equals(META_EMPTY_SERIES)) {
where += "(b." + KEY_SERIES + "='' OR b." + KEY_SERIES + " IS NULL)";
} else {
series = encodeString(series);
where += "b." + KEY_SERIES + "='" + series + "'";
}
String order = "substr('0000000000' || b." + KEY_SERIES_NUM + ", -10, 10), lower(b." + KEY_TITLE + ") ASC"; String order = "substr('0000000000' || b." + KEY_SERIES_NUM + ", -10, 10), lower(b." + KEY_TITLE + ") ASC";
return fetchAllBooks(order, bookshelf, where); return fetchAllBooks(order, bookshelf, where);
} }
@ -967,7 +984,7 @@ public class CatalogueDBAdapter {
* @return Cursor over all bookshelves * @return Cursor over all bookshelves
*/ */
public Cursor fetchAllBookshelvesByBook(long rowId) { public Cursor fetchAllBookshelvesByBook(long rowId) {
String sql = "SELECT DISTINCT bs." + KEY_ROWID + ", bs." + KEY_BOOKSHELF + " as " + KEY_BOOKSHELF + String sql = "SELECT DISTINCT bs." + KEY_ROWID + " as " + KEY_ROWID + ", bs." + KEY_BOOKSHELF + " as " + KEY_BOOKSHELF +
" FROM " + DB_TB_BOOKSHELF + " bs, " + DB_TB_BOOK_BOOKSHELF_WEAK + " w " + " FROM " + DB_TB_BOOKSHELF + " bs, " + DB_TB_BOOK_BOOKSHELF_WEAK + " w " +
" WHERE w." + KEY_BOOKSHELF + "=bs." + KEY_ROWID + " AND w." + KEY_BOOK + "=" + rowId + " " + " WHERE w." + KEY_BOOKSHELF + "=bs." + KEY_ROWID + " AND w." + KEY_BOOK + "=" + rowId + " " +
" ORDER BY bs." + KEY_BOOKSHELF + ""; " ORDER BY bs." + KEY_BOOKSHELF + "";
@ -1024,6 +1041,16 @@ public class CatalogueDBAdapter {
* @return Cursor over all series * @return Cursor over all series
*/ */
public Cursor fetchAllSeries(String bookshelf) { public Cursor fetchAllSeries(String bookshelf) {
return fetchAllSeries(bookshelf, false);
}
/**
* This will return a list of all series within the given bookshelf
*
* @param bookshelf The bookshelf to search within. Can be the string "All Books"
* @return Cursor over all series
*/
public Cursor fetchAllSeries(String bookshelf, boolean include_blank) {
String where = ""; String where = "";
if (bookshelf.equals("All Books")) { if (bookshelf.equals("All Books")) {
// do nothing // do nothing
@ -1033,6 +1060,7 @@ public class CatalogueDBAdapter {
String sql = "SELECT DISTINCT b." + KEY_SERIES + " as " + KEY_ROWID + String sql = "SELECT DISTINCT b." + KEY_SERIES + " as " + KEY_ROWID +
" FROM " + BOOKSHELF_TABLES + " FROM " + BOOKSHELF_TABLES +
" WHERE " + BOOKSHELF_JOIN + " AND b." + KEY_SERIES + "!= '' " + where + " WHERE " + BOOKSHELF_JOIN + " AND b." + KEY_SERIES + "!= '' " + where +
" UNION SELECT \"" + META_EMPTY_SERIES + "\" as " + KEY_ROWID +
" ORDER BY b." + KEY_SERIES + ""; " ORDER BY b." + KEY_SERIES + "";
return mDb.rawQuery(sql, new String[]{}); return mDb.rawQuery(sql, new String[]{});
} }
@ -1272,7 +1300,13 @@ public class CatalogueDBAdapter {
" FROM " + DB_TB_AUTHORS + " a" + " " + " FROM " + DB_TB_AUTHORS + " a" + " " +
"WHERE (a." + KEY_FAMILY_NAME + " LIKE '%" + query + "%' OR " + "WHERE (a." + KEY_FAMILY_NAME + " LIKE '%" + query + "%' OR " +
"a." + KEY_GIVEN_NAMES + " LIKE '%" + query + "%' OR " + "a." + KEY_GIVEN_NAMES + " LIKE '%" + query + "%' OR " +
"a." + KEY_ROWID + " IN (SELECT " + KEY_AUTHOR + " FROM " + DB_TB_BOOKS + " b WHERE (b." + KEY_TITLE + " LIKE '%" + query + "%' OR b." + KEY_SERIES + " LIKE '%" + query + "%')) )" + "a." + KEY_ROWID + " IN (SELECT " + KEY_AUTHOR + " FROM " + DB_TB_BOOKS + " b " +
"WHERE (b." + KEY_TITLE + " LIKE '%" + query + "%' OR " +
" b." + KEY_ISBN + " LIKE '%" + query + "%' OR " +
" b." + KEY_PUBLISHER + " LIKE '%" + query + "%' OR " +
" b." + KEY_SERIES + " LIKE '%" + query + "%' OR " +
" b." + KEY_NOTES + " LIKE '%" + query + "%' OR " +
" b." + KEY_LOCATION + " LIKE '%" + query + "%')) )" +
where + where +
"ORDER BY " + KEY_FAMILY_NAME + ", " + KEY_GIVEN_NAMES + ""; "ORDER BY " + KEY_FAMILY_NAME + ", " + KEY_GIVEN_NAMES + "";
return mDb.rawQuery(sql, new String[]{}); return mDb.rawQuery(sql, new String[]{});
@ -1295,7 +1329,7 @@ public class CatalogueDBAdapter {
} else { } else {
where += " AND bs." + KEY_BOOKSHELF + "='" + encodeString(bookshelf) + "'"; where += " AND bs." + KEY_BOOKSHELF + "='" + encodeString(bookshelf) + "'";
} }
String sql = "SELECT DISTINCT b." + KEY_ROWID + ", " + String sql = "SELECT DISTINCT b." + KEY_ROWID + " AS " + KEY_ROWID + ", " +
AUTHOR_FIELDS + ", " + AUTHOR_FIELDS + ", " +
BOOK_FIELDS + BOOK_FIELDS +
" FROM " + BOOKSHELF_TABLES + ", " + DB_TB_AUTHORS + " a" + " FROM " + BOOKSHELF_TABLES + ", " + DB_TB_AUTHORS + " a" +
@ -1304,7 +1338,11 @@ public class CatalogueDBAdapter {
"(a." + KEY_FAMILY_NAME + " LIKE '%" + query + "%' OR " + "(a." + KEY_FAMILY_NAME + " LIKE '%" + query + "%' OR " +
" a." + KEY_GIVEN_NAMES + " LIKE '%" + query + "%' OR " + " a." + KEY_GIVEN_NAMES + " LIKE '%" + query + "%' OR " +
" b." + KEY_TITLE + " LIKE '%" + query + "%' OR " + " b." + KEY_TITLE + " LIKE '%" + query + "%' OR " +
"b." + KEY_SERIES + " LIKE '%" + query + "%')" + " b." + KEY_ISBN + " LIKE '%" + query + "%' OR " +
" b." + KEY_PUBLISHER + " LIKE '%" + query + "%' OR " +
" b." + KEY_SERIES + " LIKE '%" + query + "%' OR " +
" b." + KEY_NOTES + " LIKE '%" + query + "%' OR " +
" b." + KEY_LOCATION + " LIKE '%" + query + "%')" +
where + where +
" ORDER BY " + order + ""; " ORDER BY " + order + "";
return mDb.rawQuery(sql, new String[]{}); return mDb.rawQuery(sql, new String[]{});
@ -1333,7 +1371,11 @@ public class CatalogueDBAdapter {
" (a." + KEY_FAMILY_NAME + " LIKE '%" + query + "%' OR " + " (a." + KEY_FAMILY_NAME + " LIKE '%" + query + "%' OR " +
" a." + KEY_GIVEN_NAMES + " LIKE '%" + query + "%' OR " + " a." + KEY_GIVEN_NAMES + " LIKE '%" + query + "%' OR " +
" b." + KEY_TITLE + " LIKE '%" + query + "%' OR " + " b." + KEY_TITLE + " LIKE '%" + query + "%' OR " +
"b." + KEY_SERIES + " LIKE '%" + query + "%')" + " b." + KEY_ISBN + " LIKE '%" + query + "%' OR " +
" b." + KEY_PUBLISHER + " LIKE '%" + query + "%' OR " +
" b." + KEY_SERIES + " LIKE '%" + query + "%' OR " +
" b." + KEY_NOTES + " LIKE '%" + query + "%' OR " +
" b." + KEY_LOCATION + " LIKE '%" + query + "%')" +
" ORDER BY b." + KEY_SERIES + ""; " ORDER BY b." + KEY_SERIES + "";
return mDb.rawQuery(sql, new String[]{}); return mDb.rawQuery(sql, new String[]{});
} }