diff --git a/com/gallery/GalleryRemote/GalleryComm.java b/com/gallery/GalleryRemote/GalleryComm.java index 177d43a..68c2af0 100644 --- a/com/gallery/GalleryRemote/GalleryComm.java +++ b/com/gallery/GalleryRemote/GalleryComm.java @@ -41,6 +41,11 @@ public abstract class GalleryComm { private static final String MODULE = "GalComm"; int[] capabilities = null; + + /** + * Flag to hold logged in status. Only need to log in once. + */ + protected boolean isLoggedIn = false; /* ------------------------------------------------------------------------- * STATIC INITIALIZATON @@ -105,16 +110,14 @@ public void newAlbum( StatusUpdate su, Album parentAlbum, throw new RuntimeException( "This method is not available on this protocol" ); } - /** - * Causes the GalleryComm instance to fetch the album properties - * for the given Album. - * - * @param su an instance that implements the StatusUpdate interface. - */ public void logOut() { - throw new RuntimeException( "This method is not available on this protocol" ); + isLoggedIn = false; } + public boolean isLoggedIn() { + return isLoggedIn; + } + public boolean hasCapability(int capability) { return java.util.Arrays.binarySearch(capabilities, capability) >= 0; } diff --git a/com/gallery/GalleryRemote/GalleryComm1.java b/com/gallery/GalleryRemote/GalleryComm1.java index 651070c..be00ed8 100644 --- a/com/gallery/GalleryRemote/GalleryComm1.java +++ b/com/gallery/GalleryRemote/GalleryComm1.java @@ -34,7 +34,6 @@ public class GalleryComm1 extends GalleryComm implements GalleryCommCapabilities public static final String PROTOCAL_VERSION = "1"; public static final String SCRIPT_NAME = "gallery_remote.php"; - protected boolean isLoggedIn = false; protected Gallery g = null; int pId = -1; diff --git a/com/gallery/GalleryRemote/GalleryComm2.java b/com/gallery/GalleryRemote/GalleryComm2.java index 77b1686..c196e8f 100644 --- a/com/gallery/GalleryRemote/GalleryComm2.java +++ b/com/gallery/GalleryRemote/GalleryComm2.java @@ -60,11 +60,6 @@ public class GalleryComm2 extends GalleryComm implements GalleryComm2Consts, * INSTANCE VARIABLES */ - /** - * Flag to hold logged in status. Only need to log in once. - */ - protected boolean isLoggedIn = false; - /** * The gallery this GalleryComm2 instance is attached to. */ @@ -164,12 +159,6 @@ public void newAlbum( StatusUpdate su, Album parentAlbum, newAlbumTitle, newAlbumDesc ), async ); } - /** - * Causes the GalleryComm2 instance to fetch the album properties - * for the given Album. - * - * @param su an instance that implements the StatusUpdate interface. - */ public void logOut() { isLoggedIn = false; } @@ -471,6 +460,7 @@ void runTask() { // load and validate the response Properties p = requestResponse( form_data ); if ( p.getProperty( "status" ).equals(GR_STAT_SUCCESS) ) { + ArrayList mAlbumList = new ArrayList(); // parse and store the data int albumCount = Integer.parseInt( p.getProperty( "album_count" ) ); @@ -499,7 +489,7 @@ void runTask() { a.setTitle( p.getProperty( titleKey ) ); a.setGallery( g ); - g.addAlbum( a ); + mAlbumList.add( a ); // map album ref nums to albums ref2album.put( "" + i, a ); @@ -526,6 +516,7 @@ void runTask() { status(su, "Fetched albums"); + g.setAlbumList(mAlbumList); } else { error(su, "Error: " + p.getProperty( "status_text" )); }