diff options
5 files changed, 32 insertions, 19 deletions
diff --git a/main/src/cgeo/geocaching/CacheListActivity.java b/main/src/cgeo/geocaching/CacheListActivity.java index 50c6ab7..b581411 100644 --- a/main/src/cgeo/geocaching/CacheListActivity.java +++ b/main/src/cgeo/geocaching/CacheListActivity.java @@ -405,7 +405,7 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA prepareFilterBar(); - currentLoader = (AbstractSearchLoader) getSupportLoaderManager().initLoader(type.ordinal(), extras, this); + currentLoader = (AbstractSearchLoader) getSupportLoaderManager().initLoader(type.getLoaderId(), extras, this); // init if (CollectionUtils.isNotEmpty(cacheList)) { @@ -1064,7 +1064,7 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA } final Bundle b = new Bundle(); b.putStringArray(Intents.EXTRA_CACHELIST, geocodes); - getSupportLoaderManager().initLoader(CacheListLoaderType.REMOVE_FROM_HISTORY.ordinal(), b, this); + getSupportLoaderManager().initLoader(CacheListLoaderType.REMOVE_FROM_HISTORY.getLoaderId(), b, this); } public void importWeb() { @@ -1283,7 +1283,7 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA showFooterLoadingCaches(); listFooter.setOnClickListener(null); - getSupportLoaderManager().restartLoader(CacheListLoaderType.NEXT_PAGE.ordinal(), null, CacheListActivity.this); + getSupportLoaderManager().restartLoader(CacheListLoaderType.NEXT_PAGE.getLoaderId(), null, CacheListActivity.this); } } @@ -1339,7 +1339,7 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA showFooterLoadingCaches(); DataStore.moveToList(adapter.getCheckedCaches(), listId); - currentLoader = (OfflineGeocacheListLoader) getSupportLoaderManager().initLoader(CacheListType.OFFLINE.ordinal(), new Bundle(), this); + currentLoader = (OfflineGeocacheListLoader) getSupportLoaderManager().initLoader(CacheListType.OFFLINE.getLoaderId(), new Bundle(), this); currentLoader.reset(); ((OfflineGeocacheListLoader) currentLoader).setListId(listId); ((OfflineGeocacheListLoader) currentLoader).setSearchCenter(coords); @@ -1444,12 +1444,12 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA return true; } - public static void startActivityUserName(final Activity context, final String userName) { + public static void startActivityFinder(final Activity context, final String userName) { if (!isValidUsername(context, userName)) { return; } final Intent cachesIntent = new Intent(context, CacheListActivity.class); - cachesIntent.putExtra(Intents.EXTRA_LIST_TYPE, CacheListType.USERNAME); + cachesIntent.putExtra(Intents.EXTRA_LIST_TYPE, CacheListType.FINDER); cachesIntent.putExtra(Intents.EXTRA_USERNAME, userName); context.startActivity(cachesIntent); } diff --git a/main/src/cgeo/geocaching/SearchActivity.java b/main/src/cgeo/geocaching/SearchActivity.java index 3193a2e..7a90a49 100644 --- a/main/src/cgeo/geocaching/SearchActivity.java +++ b/main/src/cgeo/geocaching/SearchActivity.java @@ -347,7 +347,7 @@ public class SearchActivity extends AbstractActivity { return; } - CacheListActivity.startActivityUserName(this, usernameText); + CacheListActivity.startActivityFinder(this, usernameText); } private void findByOwnerFn() { diff --git a/main/src/cgeo/geocaching/connector/AbstractConnector.java b/main/src/cgeo/geocaching/connector/AbstractConnector.java index eeacb5b..ca05439 100644 --- a/main/src/cgeo/geocaching/connector/AbstractConnector.java +++ b/main/src/cgeo/geocaching/connector/AbstractConnector.java @@ -269,7 +269,7 @@ public abstract class AbstractConnector implements IConnector { @Override public void call(Context context) { - CacheListActivity.startActivityUserName(context.activity, context.userName); + CacheListActivity.startActivityFinder(context.activity, context.userName); } })); } diff --git a/main/src/cgeo/geocaching/enumerations/CacheListType.java b/main/src/cgeo/geocaching/enumerations/CacheListType.java index 7efd705..1fce282 100644 --- a/main/src/cgeo/geocaching/enumerations/CacheListType.java +++ b/main/src/cgeo/geocaching/enumerations/CacheListType.java @@ -1,23 +1,32 @@ package cgeo.geocaching.enumerations; +import cgeo.geocaching.loaders.AbstractSearchLoader.CacheListLoaderType; + public enum CacheListType { - OFFLINE(true), - POCKET(false), - HISTORY(true), - NEAREST(false), - COORDINATE(false), - KEYWORD(false), - ADDRESS(false), - USERNAME(false), - OWNER(false), - MAP(false); + OFFLINE(true, CacheListLoaderType.OFFLINE), + POCKET(false, CacheListLoaderType.POCKET), + HISTORY(true, CacheListLoaderType.HISTORY), + NEAREST(false, CacheListLoaderType.NEAREST), + COORDINATE(false, CacheListLoaderType.COORDINATE), + KEYWORD(false, CacheListLoaderType.KEYWORD), + ADDRESS(false, CacheListLoaderType.ADDRESS), + FINDER(false, CacheListLoaderType.FINDER), + OWNER(false, CacheListLoaderType.OWNER), + MAP(false, CacheListLoaderType.MAP); /** * whether or not this list allows switching to another list */ public final boolean canSwitch; - CacheListType(final boolean canSwitch) { + public final CacheListLoaderType loaderType; + + CacheListType(final boolean canSwitch, final CacheListLoaderType loaderType) { this.canSwitch = canSwitch; + this.loaderType = loaderType; + } + + public int getLoaderId() { + return loaderType.getLoaderId(); } } diff --git a/main/src/cgeo/geocaching/loaders/AbstractSearchLoader.java b/main/src/cgeo/geocaching/loaders/AbstractSearchLoader.java index 7524b76..e3306f3 100644 --- a/main/src/cgeo/geocaching/loaders/AbstractSearchLoader.java +++ b/main/src/cgeo/geocaching/loaders/AbstractSearchLoader.java @@ -28,6 +28,10 @@ public abstract class AbstractSearchLoader extends AsyncTaskLoader<SearchResult> MAP, REMOVE_FROM_HISTORY, NEXT_PAGE; + + public int getLoaderId() { + return ordinal(); + } } private Handler recaptchaHandler = null; |
