diff options
52 files changed, 105 insertions, 133 deletions
diff --git a/main/src/cgeo/geocaching/CacheDetailActivity.java b/main/src/cgeo/geocaching/CacheDetailActivity.java index 0fc2eaa..1b1b403 100644 --- a/main/src/cgeo/geocaching/CacheDetailActivity.java +++ b/main/src/cgeo/geocaching/CacheDetailActivity.java @@ -46,7 +46,6 @@ import cgeo.geocaching.utils.HtmlUtils; import cgeo.geocaching.utils.ImageUtils; import cgeo.geocaching.utils.Log; import cgeo.geocaching.utils.MatcherWrapper; -import cgeo.geocaching.utils.RunnableWithArgument; import cgeo.geocaching.utils.SimpleCancellableHandler; import cgeo.geocaching.utils.SimpleHandler; import cgeo.geocaching.utils.TextUtils; @@ -58,7 +57,6 @@ import org.apache.commons.lang3.StringEscapeUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.Pair; - import rx.Observable; import rx.Observable.OnSubscribeFunc; import rx.Observer; @@ -66,6 +64,7 @@ import rx.Subscription; import rx.android.observables.AndroidObservable; import rx.concurrency.Schedulers; import rx.subscriptions.Subscriptions; +import rx.util.functions.Action1; import android.R.color; import android.app.AlertDialog; @@ -1058,9 +1057,9 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc if (Settings.getChooseList()) { // let user select list to store cache in new StoredList.UserInterface(CacheDetailActivity.this).promptForListSelection(R.string.list_title, - new RunnableWithArgument<Integer>() { + new Action1<Integer>() { @Override - public void run(final Integer selectedListId) { + public void call(final Integer selectedListId) { storeCache(selectedListId, new StoreCacheHandler(CacheDetailActivity.this, progress)); } }, true, StoredList.TEMPORARY_LIST_ID); @@ -1309,9 +1308,9 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc @Override public void onClick(View view) { new StoredList.UserInterface(CacheDetailActivity.this).promptForListSelection(R.string.list_title, - new RunnableWithArgument<Integer>() { + new Action1<Integer>() { @Override - public void run(final Integer selectedListId) { + public void call(final Integer selectedListId) { switchListById(selectedListId); } }, true, cache.getListId()); diff --git a/main/src/cgeo/geocaching/CacheListActivity.java b/main/src/cgeo/geocaching/CacheListActivity.java index 5e189b3..9c7f692 100644 --- a/main/src/cgeo/geocaching/CacheListActivity.java +++ b/main/src/cgeo/geocaching/CacheListActivity.java @@ -23,6 +23,7 @@ import cgeo.geocaching.loaders.AbstractSearchLoader; import cgeo.geocaching.loaders.AbstractSearchLoader.CacheListLoaderType; import cgeo.geocaching.loaders.AddressGeocacheListLoader; import cgeo.geocaching.loaders.CoordsGeocacheListLoader; +import cgeo.geocaching.loaders.FinderGeocacheListLoader; import cgeo.geocaching.loaders.HistoryGeocacheListLoader; import cgeo.geocaching.loaders.KeywordGeocacheListLoader; import cgeo.geocaching.loaders.NextPageGeocacheListLoader; @@ -30,7 +31,6 @@ import cgeo.geocaching.loaders.OfflineGeocacheListLoader; import cgeo.geocaching.loaders.OwnerGeocacheListLoader; import cgeo.geocaching.loaders.PocketGeocacheListLoader; import cgeo.geocaching.loaders.RemoveFromHistoryLoader; -import cgeo.geocaching.loaders.FinderGeocacheListLoader; import cgeo.geocaching.maps.CGeoMap; import cgeo.geocaching.network.Cookies; import cgeo.geocaching.network.Network; @@ -46,14 +46,13 @@ import cgeo.geocaching.utils.AsyncTaskWithProgress; import cgeo.geocaching.utils.DateUtils; import cgeo.geocaching.utils.GeoDirHandler; import cgeo.geocaching.utils.Log; -import cgeo.geocaching.utils.RunnableWithArgument; import ch.boye.httpclientandroidlib.HttpResponse; - import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.ListUtils; import org.apache.commons.lang3.StringUtils; import org.eclipse.jdt.annotation.NonNull; +import rx.util.functions.Action1; import android.app.Activity; import android.app.AlertDialog; @@ -451,10 +450,10 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA } private void importGpxAttachement() { - new StoredList.UserInterface(this).promptForListSelection(R.string.gpx_import_select_list_title, new RunnableWithArgument<Integer>() { + new StoredList.UserInterface(this).promptForListSelection(R.string.gpx_import_select_list_title, new Action1<Integer>() { @Override - public void run(Integer listId) { + public void call(Integer listId) { new GPXImporter(CacheListActivity.this, listId, importGpxAttachementFinishedHandler).importGPX(); switchListById(listId); } @@ -670,9 +669,9 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA return true; case R.id.menu_sort: final CacheComparator oldComparator = adapter.getCacheComparator(); - new ComparatorUserInterface(this).selectComparator(oldComparator, new RunnableWithArgument<CacheComparator>() { + new ComparatorUserInterface(this).selectComparator(oldComparator, new Action1<CacheComparator>() { @Override - public void run(CacheComparator selectedComparator) { + public void call(CacheComparator selectedComparator) { // selecting the same sorting twice will toggle the order if (selectedComparator != null && oldComparator != null && selectedComparator.getClass().equals(oldComparator.getClass())) { adapter.toggleInverseSort(); @@ -732,9 +731,9 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA */ @Override public void showFilterMenu(final View view) { - new FilterUserInterface(this).selectFilter(new RunnableWithArgument<IFilter>() { + new FilterUserInterface(this).selectFilter(new Action1<IFilter>() { @Override - public void run(IFilter selectedFilter) { + public void call(IFilter selectedFilter) { if (selectedFilter != null) { setFilter(selectedFilter); } else { @@ -787,10 +786,10 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA } private void moveCachesToOtherList() { - new StoredList.UserInterface(this).promptForListSelection(R.string.cache_menu_move_list, new RunnableWithArgument<Integer>() { + new StoredList.UserInterface(this).promptForListSelection(R.string.cache_menu_move_list, new Action1<Integer>() { @Override - public void run(Integer newListId) { + public void call(Integer newListId) { DataStore.moveToList(adapter.getCheckedOrAllCaches(), newListId); adapter.setSelectMode(false); @@ -844,10 +843,10 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA }); break; case R.id.menu_move_to_list: - new StoredList.UserInterface(this).promptForListSelection(R.string.cache_menu_move_list, new RunnableWithArgument<Integer>() { + new StoredList.UserInterface(this).promptForListSelection(R.string.cache_menu_move_list, new Action1<Integer>() { @Override - public void run(Integer newListId) { + public void call(Integer newListId) { DataStore.moveToList(Collections.singletonList(cache), newListId); adapter.setSelectMode(false); refreshCurrentList(); @@ -1021,9 +1020,9 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA if (Settings.getChooseList() && type != CacheListType.OFFLINE) { // let user select list to store cache in new StoredList.UserInterface(this).promptForListSelection(R.string.list_title, - new RunnableWithArgument<Integer>() { + new Action1<Integer>() { @Override - public void run(final Integer selectedListId) { + public void call(final Integer selectedListId) { refreshStored(caches, selectedListId); } }, true, StoredList.TEMPORARY_LIST_ID, newListName); @@ -1324,11 +1323,11 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA } @NonNull - private RunnableWithArgument<Integer> getListSwitchingRunnable() { - return new RunnableWithArgument<Integer>() { + private Action1<Integer> getListSwitchingRunnable() { + return new Action1<Integer>() { @Override - public void run(final Integer selectedListId) { + public void call(final Integer selectedListId) { switchListById(selectedListId); } }; diff --git a/main/src/cgeo/geocaching/CachePopup.java b/main/src/cgeo/geocaching/CachePopup.java index 9186497..5d04ab0 100644 --- a/main/src/cgeo/geocaching/CachePopup.java +++ b/main/src/cgeo/geocaching/CachePopup.java @@ -9,9 +9,9 @@ import cgeo.geocaching.settings.Settings; import cgeo.geocaching.ui.CacheDetailsCreator; import cgeo.geocaching.utils.CancellableHandler; import cgeo.geocaching.utils.Log; -import cgeo.geocaching.utils.RunnableWithArgument; import org.apache.commons.lang3.StringUtils; +import rx.util.functions.Action1; import android.content.Context; import android.content.Intent; @@ -110,9 +110,9 @@ public class CachePopup extends AbstractPopupActivity { if (Settings.getChooseList()) { // let user select list to store cache in new StoredList.UserInterface(CachePopup.this).promptForListSelection(R.string.list_title, - new RunnableWithArgument<Integer>() { + new Action1<Integer>() { @Override - public void run(final Integer selectedListId) { + public void call(final Integer selectedListId) { storeCache(selectedListId); } }, true, StoredList.TEMPORARY_LIST_ID); diff --git a/main/src/cgeo/geocaching/CreateShortcutActivity.java b/main/src/cgeo/geocaching/CreateShortcutActivity.java index 7b91ba1..889eb61 100644 --- a/main/src/cgeo/geocaching/CreateShortcutActivity.java +++ b/main/src/cgeo/geocaching/CreateShortcutActivity.java @@ -2,7 +2,8 @@ package cgeo.geocaching; import cgeo.geocaching.activity.AbstractActivity; import cgeo.geocaching.list.StoredList; -import cgeo.geocaching.utils.RunnableWithArgument; + +import rx.util.functions.Action1; import android.content.Intent; import android.content.Intent.ShortcutIconResource; @@ -21,10 +22,10 @@ public class CreateShortcutActivity extends AbstractActivity { } private void promptForShortcut() { - new StoredList.UserInterface(this).promptForListSelection(R.string.create_shortcut, new RunnableWithArgument<Integer>() { + new StoredList.UserInterface(this).promptForListSelection(R.string.create_shortcut, new Action1<Integer>() { @Override - public void run(final Integer listId) { + public void call(final Integer listId) { final Intent shortcut = createShortcut(listId.intValue()); setResult(RESULT_OK, shortcut); diff --git a/main/src/cgeo/geocaching/EditWaypointActivity.java b/main/src/cgeo/geocaching/EditWaypointActivity.java index 6d0f822..df6e9c5 100644 --- a/main/src/cgeo/geocaching/EditWaypointActivity.java +++ b/main/src/cgeo/geocaching/EditWaypointActivity.java @@ -21,7 +21,6 @@ import com.googlecode.androidannotations.annotations.EActivity; import com.googlecode.androidannotations.annotations.Extra; import com.googlecode.androidannotations.annotations.InstanceState; import com.googlecode.androidannotations.annotations.ViewById; - import org.apache.commons.lang3.StringUtils; import android.app.ProgressDialog; diff --git a/main/src/cgeo/geocaching/Geocache.java b/main/src/cgeo/geocaching/Geocache.java index 156c4b6..e417a8e 100644 --- a/main/src/cgeo/geocaching/Geocache.java +++ b/main/src/cgeo/geocaching/Geocache.java @@ -33,7 +33,6 @@ import cgeo.geocaching.utils.MatcherWrapper; import cgeo.geocaching.utils.UncertainProperty; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; - import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.Predicate; import org.apache.commons.lang3.BooleanUtils; diff --git a/main/src/cgeo/geocaching/LogTrackableActivity.java b/main/src/cgeo/geocaching/LogTrackableActivity.java index 5246fa9..50a837a 100644 --- a/main/src/cgeo/geocaching/LogTrackableActivity.java +++ b/main/src/cgeo/geocaching/LogTrackableActivity.java @@ -3,8 +3,8 @@ package cgeo.geocaching; import butterknife.ButterKnife; import butterknife.InjectView; -import cgeo.geocaching.connector.gc.GCParser; import cgeo.geocaching.connector.gc.GCLogin; +import cgeo.geocaching.connector.gc.GCParser; import cgeo.geocaching.enumerations.LogType; import cgeo.geocaching.enumerations.StatusCode; import cgeo.geocaching.network.Network; diff --git a/main/src/cgeo/geocaching/MainActivity.java b/main/src/cgeo/geocaching/MainActivity.java index 1be09bd..dfe2f50 100644 --- a/main/src/cgeo/geocaching/MainActivity.java +++ b/main/src/cgeo/geocaching/MainActivity.java @@ -19,7 +19,6 @@ import cgeo.geocaching.ui.dialog.Dialogs; import cgeo.geocaching.utils.DatabaseBackupUtils; import cgeo.geocaching.utils.GeoDirHandler; import cgeo.geocaching.utils.Log; -import cgeo.geocaching.utils.RunnableWithArgument; import cgeo.geocaching.utils.Version; import com.google.zxing.integration.android.IntentIntegrator; @@ -299,10 +298,10 @@ public class MainActivity extends AbstractActivity { if (!Settings.isGCPremiumMember()) { return true; } - PocketQueryList.promptForListSelection(this, new RunnableWithArgument<PocketQueryList>() { + PocketQueryList.promptForListSelection(this, new Action1<PocketQueryList>() { @Override - public void run(final PocketQueryList pql) { + public void call(final PocketQueryList pql) { CacheListActivity.startActivityPocket(MainActivity.this, pql); } }); @@ -375,10 +374,10 @@ public class MainActivity extends AbstractActivity { @Override public boolean onLongClick(final View v) { - new StoredList.UserInterface(MainActivity.this).promptForListSelection(R.string.list_title, new RunnableWithArgument<Integer>() { + new StoredList.UserInterface(MainActivity.this).promptForListSelection(R.string.list_title, new Action1<Integer>() { @Override - public void run(final Integer selectedListId) { + public void call(final Integer selectedListId) { Settings.saveLastList(selectedListId); CacheListActivity.startActivityOffline(MainActivity.this); } diff --git a/main/src/cgeo/geocaching/PocketQueryList.java b/main/src/cgeo/geocaching/PocketQueryList.java index a78044f..6613441 100644 --- a/main/src/cgeo/geocaching/PocketQueryList.java +++ b/main/src/cgeo/geocaching/PocketQueryList.java @@ -2,7 +2,6 @@ package cgeo.geocaching; import cgeo.geocaching.activity.ActivityMixin; import cgeo.geocaching.connector.gc.GCParser; -import cgeo.geocaching.utils.RunnableWithArgument; import org.apache.commons.collections4.CollectionUtils; import rx.Observable; @@ -46,7 +45,7 @@ public final class PocketQueryList { return name; } - public static void promptForListSelection(final Activity activity, final RunnableWithArgument<PocketQueryList> runAfterwards) { + public static void promptForListSelection(final Activity activity, final Action1<PocketQueryList> runAfterwards) { final Dialog waitDialog = ProgressDialog.show(activity, activity.getString(R.string.search_pocket_title), activity.getString(R.string.search_pocket_loading), true, true); AndroidObservable.fromActivity(activity, Observable.create(new OnSubscribeFunc<List<PocketQueryList>>() { @@ -64,7 +63,7 @@ public final class PocketQueryList { } }); } - private static void selectFromPocketQueries(final Activity activity, final List<PocketQueryList> pocketQueryList, final RunnableWithArgument<PocketQueryList> runAfterwards) { + private static void selectFromPocketQueries(final Activity activity, final List<PocketQueryList> pocketQueryList, final Action1<PocketQueryList> runAfterwards) { if (CollectionUtils.isEmpty(pocketQueryList)) { ActivityMixin.showToast(activity, activity.getString(R.string.warn_no_pocket_query_found)); return; @@ -82,7 +81,7 @@ public final class PocketQueryList { @Override public void onClick(final DialogInterface dialogInterface, final int itemId) { dialogInterface.dismiss(); - runAfterwards.run(pocketQueryList.get(itemId)); + runAfterwards.call(pocketQueryList.get(itemId)); } }).create().show(); } diff --git a/main/src/cgeo/geocaching/StaticMapsActivity.java b/main/src/cgeo/geocaching/StaticMapsActivity.java index 7811da5..f19ce29 100644 --- a/main/src/cgeo/geocaching/StaticMapsActivity.java +++ b/main/src/cgeo/geocaching/StaticMapsActivity.java @@ -8,7 +8,6 @@ import com.googlecode.androidannotations.annotations.EActivity; import com.googlecode.androidannotations.annotations.Extra; import com.googlecode.androidannotations.annotations.OptionsItem; import com.googlecode.androidannotations.annotations.OptionsMenu; - import org.apache.commons.collections4.CollectionUtils; import android.app.ProgressDialog; diff --git a/main/src/cgeo/geocaching/activity/AbstractViewPagerActivity.java b/main/src/cgeo/geocaching/activity/AbstractViewPagerActivity.java index 049fc7d..ba186d2 100644 --- a/main/src/cgeo/geocaching/activity/AbstractViewPagerActivity.java +++ b/main/src/cgeo/geocaching/activity/AbstractViewPagerActivity.java @@ -5,7 +5,6 @@ import cgeo.geocaching.utils.Log; import com.viewpagerindicator.TitlePageIndicator; import com.viewpagerindicator.TitleProvider; - import org.apache.commons.lang3.tuple.Pair; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; diff --git a/main/src/cgeo/geocaching/apps/AbstractLocusApp.java b/main/src/cgeo/geocaching/apps/AbstractLocusApp.java index d6c2fe6..c26a24d 100644 --- a/main/src/cgeo/geocaching/apps/AbstractLocusApp.java +++ b/main/src/cgeo/geocaching/apps/AbstractLocusApp.java @@ -13,7 +13,6 @@ import menion.android.locus.addon.publiclib.geoData.Point; import menion.android.locus.addon.publiclib.geoData.PointGeocachingData; import menion.android.locus.addon.publiclib.geoData.PointGeocachingDataWaypoint; import menion.android.locus.addon.publiclib.geoData.PointsData; - import org.apache.commons.lang3.time.FastDateFormat; import android.app.Activity; diff --git a/main/src/cgeo/geocaching/apps/cachelist/CacheListApp.java b/main/src/cgeo/geocaching/apps/cachelist/CacheListApp.java index ac5809e..40c4d92 100644 --- a/main/src/cgeo/geocaching/apps/cachelist/CacheListApp.java +++ b/main/src/cgeo/geocaching/apps/cachelist/CacheListApp.java @@ -1,7 +1,7 @@ package cgeo.geocaching.apps.cachelist; -import cgeo.geocaching.SearchResult; import cgeo.geocaching.Geocache; +import cgeo.geocaching.SearchResult; import cgeo.geocaching.apps.App; import android.app.Activity; diff --git a/main/src/cgeo/geocaching/connector/AbstractConnector.java b/main/src/cgeo/geocaching/connector/AbstractConnector.java index 53a3bcb..eeacb5b 100644 --- a/main/src/cgeo/geocaching/connector/AbstractConnector.java +++ b/main/src/cgeo/geocaching/connector/AbstractConnector.java @@ -16,10 +16,10 @@ import cgeo.geocaching.connector.capability.ISearchByViewPort; import cgeo.geocaching.enumerations.CacheType; import cgeo.geocaching.enumerations.LogType; import cgeo.geocaching.geopoint.Geopoint; -import cgeo.geocaching.utils.RunnableWithArgument; import org.apache.commons.lang3.StringUtils; import org.eclipse.jdt.annotation.NonNull; +import rx.util.functions.Action1; import java.util.ArrayList; import java.util.Collection; @@ -255,20 +255,20 @@ public abstract class AbstractConnector implements IConnector { List<UserAction> actions = getDefaultUserActions(); if (this instanceof ISearchByOwner) { - actions.add(new UserAction(R.string.user_menu_view_hidden, new RunnableWithArgument<UserAction.Context>() { + actions.add(new UserAction(R.string.user_menu_view_hidden, new Action1<Context>() { @Override - public void run(Context context) { + public void call(Context context) { CacheListActivity.startActivityOwner(context.activity, context.userName); } })); } if (this instanceof ISearchByFinder) { - actions.add(new UserAction(R.string.user_menu_view_found, new RunnableWithArgument<UserAction.Context>() { + actions.add(new UserAction(R.string.user_menu_view_found, new Action1<UserAction.Context>() { @Override - public void run(Context context) { + public void call(Context context) { CacheListActivity.startActivityUserName(context.activity, context.userName); } })); @@ -283,10 +283,10 @@ public abstract class AbstractConnector implements IConnector { public List<UserAction> getDefaultUserActions() { final ArrayList<UserAction> actions = new ArrayList<UserAction>(); if (ContactsAddon.isAvailable()) { - actions.add(new UserAction(R.string.user_menu_open_contact, new RunnableWithArgument<UserAction.Context>() { + actions.add(new UserAction(R.string.user_menu_open_contact, new Action1<UserAction.Context>() { @Override - public void run(Context context) { + public void call(Context context) { ContactsAddon.openContactCard(context.activity, context.userName); } })); diff --git a/main/src/cgeo/geocaching/connector/UserAction.java b/main/src/cgeo/geocaching/connector/UserAction.java index d0c97bb..da03a95 100644 --- a/main/src/cgeo/geocaching/connector/UserAction.java +++ b/main/src/cgeo/geocaching/connector/UserAction.java @@ -1,8 +1,7 @@ package cgeo.geocaching.connector; -import cgeo.geocaching.utils.RunnableWithArgument; - import org.eclipse.jdt.annotation.NonNull; +import rx.util.functions.Action1; import android.app.Activity; @@ -19,14 +18,15 @@ public class UserAction { } public final int displayResourceId; - private final @NonNull RunnableWithArgument<Context> runnable; + private final @NonNull + Action1<Context> runnable; - public UserAction(int displayResourceId, final @NonNull RunnableWithArgument<UserAction.Context> runnable) { + public UserAction(int displayResourceId, final @NonNull Action1<Context> runnable) { this.displayResourceId = displayResourceId; this.runnable = runnable; } public void run(Context context) { - runnable.run(context); + runnable.call(context); } } diff --git a/main/src/cgeo/geocaching/connector/ec/ECApi.java b/main/src/cgeo/geocaching/connector/ec/ECApi.java index 03fce4d..9d786ea 100644 --- a/main/src/cgeo/geocaching/connector/ec/ECApi.java +++ b/main/src/cgeo/geocaching/connector/ec/ECApi.java @@ -17,7 +17,6 @@ import cgeo.geocaching.network.Parameters; import cgeo.geocaching.utils.Log; import ch.boye.httpclientandroidlib.HttpResponse; - import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.time.FastDateFormat; diff --git a/main/src/cgeo/geocaching/connector/ec/ECLogin.java b/main/src/cgeo/geocaching/connector/ec/ECLogin.java index 52bd423..012bdc9 100644 --- a/main/src/cgeo/geocaching/connector/ec/ECLogin.java +++ b/main/src/cgeo/geocaching/connector/ec/ECLogin.java @@ -10,7 +10,6 @@ import cgeo.geocaching.settings.Settings; import cgeo.geocaching.utils.Log; import ch.boye.httpclientandroidlib.HttpResponse; - import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.ImmutablePair; import org.eclipse.jdt.annotation.Nullable; diff --git a/main/src/cgeo/geocaching/connector/gc/GCConnector.java b/main/src/cgeo/geocaching/connector/gc/GCConnector.java index 5f28d17..a62b1f6 100644 --- a/main/src/cgeo/geocaching/connector/gc/GCConnector.java +++ b/main/src/cgeo/geocaching/connector/gc/GCConnector.java @@ -27,12 +27,12 @@ import cgeo.geocaching.settings.Settings; import cgeo.geocaching.settings.SettingsActivity; import cgeo.geocaching.utils.CancellableHandler; import cgeo.geocaching.utils.Log; -import cgeo.geocaching.utils.RunnableWithArgument; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; +import rx.util.functions.Action1; import android.content.Context; import android.content.Intent; @@ -394,17 +394,17 @@ public class GCConnector extends AbstractConnector implements ISearchByGeocode, public @NonNull List<UserAction> getUserActions() { List<UserAction> actions = super.getUserActions(); - actions.add(new UserAction(R.string.user_menu_open_browser, new RunnableWithArgument<UserAction.Context>() { + actions.add(new UserAction(R.string.user_menu_open_browser, new Action1<UserAction.Context>() { @Override - public void run(cgeo.geocaching.connector.UserAction.Context context) { + public void call(cgeo.geocaching.connector.UserAction.Context context) { context.activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.geocaching.com/profile/?u=" + Network.encode(context.userName)))); } })); - actions.add(new UserAction(R.string.user_menu_send_message, new RunnableWithArgument<UserAction.Context>() { + actions.add(new UserAction(R.string.user_menu_send_message, new Action1<UserAction.Context>() { @Override - public void run(cgeo.geocaching.connector.UserAction.Context context) { + public void call(cgeo.geocaching.connector.UserAction.Context context) { context.activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.geocaching.com/email/?u=" + Network.encode(context.userName)))); } })); diff --git a/main/src/cgeo/geocaching/connector/gc/GCLogin.java b/main/src/cgeo/geocaching/connector/gc/GCLogin.java index f747911..92d488d 100644 --- a/main/src/cgeo/geocaching/connector/gc/GCLogin.java +++ b/main/src/cgeo/geocaching/connector/gc/GCLogin.java @@ -14,7 +14,6 @@ import cgeo.geocaching.utils.MatcherWrapper; import cgeo.geocaching.utils.TextUtils; import ch.boye.httpclientandroidlib.HttpResponse; - import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.ImmutablePair; diff --git a/main/src/cgeo/geocaching/connector/gc/GCParser.java b/main/src/cgeo/geocaching/connector/gc/GCParser.java index f1d0a40..70c3b2a 100644 --- a/main/src/cgeo/geocaching/connector/gc/GCParser.java +++ b/main/src/cgeo/geocaching/connector/gc/GCParser.java @@ -36,7 +36,6 @@ import cgeo.geocaching.utils.SynchronizedDateFormat; import cgeo.geocaching.utils.TextUtils; import ch.boye.httpclientandroidlib.HttpResponse; - import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.StringEscapeUtils; diff --git a/main/src/cgeo/geocaching/connector/oc/OkapiClient.java b/main/src/cgeo/geocaching/connector/oc/OkapiClient.java index 62e9bfc..ff63945 100644 --- a/main/src/cgeo/geocaching/connector/oc/OkapiClient.java +++ b/main/src/cgeo/geocaching/connector/oc/OkapiClient.java @@ -32,7 +32,6 @@ import cgeo.geocaching.utils.Log; import cgeo.geocaching.utils.SynchronizedDateFormat; import ch.boye.httpclientandroidlib.HttpResponse; - import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.time.FastDateFormat; import org.apache.commons.lang3.tuple.ImmutablePair; diff --git a/main/src/cgeo/geocaching/connector/ox/OpenCachingApi.java b/main/src/cgeo/geocaching/connector/ox/OpenCachingApi.java index 2defc52..0137af4 100644 --- a/main/src/cgeo/geocaching/connector/ox/OpenCachingApi.java +++ b/main/src/cgeo/geocaching/connector/ox/OpenCachingApi.java @@ -11,7 +11,6 @@ import cgeo.geocaching.utils.CryptUtils; import cgeo.geocaching.utils.Log; import ch.boye.httpclientandroidlib.HttpResponse; - import org.apache.commons.collections4.CollectionUtils; import org.eclipse.jdt.annotation.NonNull; diff --git a/main/src/cgeo/geocaching/enumerations/CacheType.java b/main/src/cgeo/geocaching/enumerations/CacheType.java index c952ba0..35fe7a1 100644 --- a/main/src/cgeo/geocaching/enumerations/CacheType.java +++ b/main/src/cgeo/geocaching/enumerations/CacheType.java @@ -1,8 +1,8 @@ package cgeo.geocaching.enumerations; +import cgeo.geocaching.CgeoApplication; import cgeo.geocaching.ICache; import cgeo.geocaching.R; -import cgeo.geocaching.CgeoApplication; import java.util.Collections; import java.util.HashMap; diff --git a/main/src/cgeo/geocaching/enumerations/LiveMapStrategy.java b/main/src/cgeo/geocaching/enumerations/LiveMapStrategy.java index 710c3ba..5bcaf4a 100644 --- a/main/src/cgeo/geocaching/enumerations/LiveMapStrategy.java +++ b/main/src/cgeo/geocaching/enumerations/LiveMapStrategy.java @@ -1,7 +1,7 @@ package cgeo.geocaching.enumerations; -import cgeo.geocaching.R; import cgeo.geocaching.CgeoApplication; +import cgeo.geocaching.R; import java.util.EnumSet; diff --git a/main/src/cgeo/geocaching/export/GpxExport.java b/main/src/cgeo/geocaching/export/GpxExport.java index a2e0f93..08fca0b 100644 --- a/main/src/cgeo/geocaching/export/GpxExport.java +++ b/main/src/cgeo/geocaching/export/GpxExport.java @@ -1,8 +1,8 @@ package cgeo.geocaching.export; +import cgeo.geocaching.CgeoApplication; import cgeo.geocaching.Geocache; import cgeo.geocaching.R; -import cgeo.geocaching.CgeoApplication; import cgeo.geocaching.activity.ActivityMixin; import cgeo.geocaching.settings.Settings; import cgeo.geocaching.utils.AsyncTaskWithProgress; diff --git a/main/src/cgeo/geocaching/files/LocalStorage.java b/main/src/cgeo/geocaching/files/LocalStorage.java index 3d0c19a..133f39a 100644 --- a/main/src/cgeo/geocaching/files/LocalStorage.java +++ b/main/src/cgeo/geocaching/files/LocalStorage.java @@ -7,7 +7,6 @@ import cgeo.geocaching.utils.Log; import ch.boye.httpclientandroidlib.Header; import ch.boye.httpclientandroidlib.HttpResponse; - import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; import org.eclipse.jdt.annotation.Nullable; diff --git a/main/src/cgeo/geocaching/filter/DistanceFilter.java b/main/src/cgeo/geocaching/filter/DistanceFilter.java index 54225d2..cddcf72 100644 --- a/main/src/cgeo/geocaching/filter/DistanceFilter.java +++ b/main/src/cgeo/geocaching/filter/DistanceFilter.java @@ -1,9 +1,9 @@ package cgeo.geocaching.filter; +import cgeo.geocaching.CgeoApplication; import cgeo.geocaching.Geocache; import cgeo.geocaching.IGeoData; import cgeo.geocaching.R; -import cgeo.geocaching.CgeoApplication; import cgeo.geocaching.geopoint.Geopoint; import java.util.ArrayList; diff --git a/main/src/cgeo/geocaching/filter/FilterUserInterface.java b/main/src/cgeo/geocaching/filter/FilterUserInterface.java index d77341b..0033b9a 100644 --- a/main/src/cgeo/geocaching/filter/FilterUserInterface.java +++ b/main/src/cgeo/geocaching/filter/FilterUserInterface.java @@ -5,7 +5,8 @@ import cgeo.geocaching.R; import cgeo.geocaching.enumerations.CacheType; import cgeo.geocaching.settings.Settings; import cgeo.geocaching.utils.Log; -import cgeo.geocaching.utils.RunnableWithArgument; + +import rx.util.functions.Action1; import android.app.Activity; import android.app.AlertDialog; @@ -77,7 +78,7 @@ public final class FilterUserInterface { registry.add(new FactoryEntry(res.getString(resourceId), factoryClass)); } - public void selectFilter(final RunnableWithArgument<IFilter> runAfterwards) { + public void selectFilter(final Action1<IFilter> runAfterwards) { final AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setTitle(R.string.caches_filter_title); @@ -89,7 +90,7 @@ public final class FilterUserInterface { FactoryEntry entry = adapter.getItem(itemIndex); // reset? if (entry.filterFactory == null) { - runAfterwards.run(null); + runAfterwards.call(null); } else { try { @@ -105,10 +106,10 @@ public final class FilterUserInterface { builder.create().show(); } - private void selectFromFactory(final IFilterFactory factory, final String menuTitle, final RunnableWithArgument<IFilter> runAfterwards) { + private void selectFromFactory(final IFilterFactory factory, final String menuTitle, final Action1<IFilter> runAfterwards) { final List<IFilter> filters = Collections.unmodifiableList(factory.getFilters()); if (filters.size() == 1) { - runAfterwards.run(filters.get(0)); + runAfterwards.call(filters.get(0)); return; } @@ -119,7 +120,7 @@ public final class FilterUserInterface { builder.setAdapter(adapter, new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int item) { - runAfterwards.run(filters.get(item)); + runAfterwards.call(filters.get(item)); } }); diff --git a/main/src/cgeo/geocaching/filter/ModifiedFilter.java b/main/src/cgeo/geocaching/filter/ModifiedFilter.java index d976b69..2ac088a 100644 --- a/main/src/cgeo/geocaching/filter/ModifiedFilter.java +++ b/main/src/cgeo/geocaching/filter/ModifiedFilter.java @@ -1,8 +1,8 @@ package cgeo.geocaching.filter; +import cgeo.geocaching.CgeoApplication; import cgeo.geocaching.Geocache; import cgeo.geocaching.R; -import cgeo.geocaching.CgeoApplication; import java.util.Collections; import java.util.List; diff --git a/main/src/cgeo/geocaching/list/StoredList.java b/main/src/cgeo/geocaching/list/StoredList.java index 8106073..633b66c 100644 --- a/main/src/cgeo/geocaching/list/StoredList.java +++ b/main/src/cgeo/geocaching/list/StoredList.java @@ -5,10 +5,10 @@ import cgeo.geocaching.DataStore; import cgeo.geocaching.R; import cgeo.geocaching.activity.ActivityMixin; import cgeo.geocaching.ui.dialog.Dialogs; -import cgeo.geocaching.utils.RunnableWithArgument; import org.apache.commons.lang3.StringUtils; import org.eclipse.jdt.annotation.NonNull; +import rx.util.functions.Action1; import android.app.Activity; import android.app.AlertDialog; @@ -67,15 +67,15 @@ public final class StoredList extends AbstractList { res = app.getResources(); } - public void promptForListSelection(final int titleId, @NonNull final RunnableWithArgument<Integer> runAfterwards) { + public void promptForListSelection(final int titleId, @NonNull final Action1<Integer> runAfterwards) { promptForListSelection(titleId, runAfterwards, false, -1); } - public void promptForListSelection(final int titleId, @NonNull final RunnableWithArgument<Integer> runAfterwards, final boolean onlyConcreteLists, final int exceptListId) { + public void promptForListSelection(final int titleId, @NonNull final Action1<Integer> runAfterwards, final boolean onlyConcreteLists, final int exceptListId) { promptForListSelection(titleId, runAfterwards, onlyConcreteLists, exceptListId, StringUtils.EMPTY); } - public void promptForListSelection(final int titleId, @NonNull final RunnableWithArgument<Integer> runAfterwards, final boolean onlyConcreteLists, final int exceptListId, final String newListName) { + public void promptForListSelection(final int titleId, @NonNull final Action1<Integer> runAfterwards, final boolean onlyConcreteLists, final int exceptListId, final String newListName) { final List<AbstractList> lists = new ArrayList<AbstractList>(); lists.addAll(getSortedLists()); @@ -109,7 +109,7 @@ public final class StoredList extends AbstractList { promptForListCreation(runAfterwards, newListName); } else { - runAfterwards.run(lists.get(itemId).id); + runAfterwards.call(lists.get(itemId).id); } } }); @@ -138,17 +138,17 @@ public final class StoredList extends AbstractList { return lists; } - public void promptForListCreation(@NonNull final RunnableWithArgument<Integer> runAfterwards, String newListName) { - handleListNameInput(newListName, R.string.list_dialog_create_title, R.string.list_dialog_create, new RunnableWithArgument<String>() { + public void promptForListCreation(@NonNull final Action1<Integer> runAfterwards, String newListName) { + handleListNameInput(newListName, R.string.list_dialog_create_title, R.string.list_dialog_create, new Action1<String>() { @Override - public void run(final String listName) { + public void call(final String listName) { final int newId = DataStore.createList(listName); new StoredList(newId, listName, 0); if (newId >= DataStore.customListIdOffset) { ActivityMixin.showToast(activity, res.getString(R.string.list_dialog_create_ok)); - runAfterwards.run(newId); + runAfterwards.call(newId); } else { ActivityMixin.showToast(activity, res.getString(R.string.list_dialog_create_err)); } @@ -156,15 +156,15 @@ public final class StoredList extends AbstractList { }); } - private void handleListNameInput(final String defaultValue, int dialogTitle, int buttonTitle, final RunnableWithArgument<String> runnable) { - Dialogs.input(activity, dialogTitle, defaultValue, buttonTitle, new RunnableWithArgument<String>() { + private void handleListNameInput(final String defaultValue, int dialogTitle, int buttonTitle, final Action1<String> runnable) { + Dialogs.input(activity, dialogTitle, defaultValue, buttonTitle, new Action1<String>() { @Override - public void run(final String input) { + public void call(final String input) { // remove whitespaces added by autocompletion of Android keyboard String listName = StringUtils.trim(input); if (StringUtils.isNotBlank(listName)) { - runnable.run(listName); + runnable.call(listName); } } }); @@ -172,10 +172,10 @@ public final class StoredList extends AbstractList { public void promptForListRename(final int listId, @NonNull final Runnable runAfterRename) { final StoredList list = DataStore.getList(listId); - handleListNameInput(list.title, R.string.list_dialog_rename_title, R.string.list_dialog_rename, new RunnableWithArgument<String>() { + handleListNameInput(list.title, R.string.list_dialog_rename_title, R.string.list_dialog_rename, new Action1<String>() { @Override - public void run(final String listName) { + public void call(final String listName) { DataStore.renameList(listId, listName); runAfterRename.run(); } diff --git a/main/src/cgeo/geocaching/loaders/AddressGeocacheListLoader.java b/main/src/cgeo/geocaching/loaders/AddressGeocacheListLoader.java index dd7c7a6..e1573c9 100644 --- a/main/src/cgeo/geocaching/loaders/AddressGeocacheListLoader.java +++ b/main/src/cgeo/geocaching/loaders/AddressGeocacheListLoader.java @@ -1,8 +1,8 @@ package cgeo.geocaching.loaders; import cgeo.geocaching.SearchResult; -import cgeo.geocaching.settings.Settings; import cgeo.geocaching.connector.gc.GCParser; +import cgeo.geocaching.settings.Settings; import android.content.Context; diff --git a/main/src/cgeo/geocaching/loaders/HistoryGeocacheListLoader.java b/main/src/cgeo/geocaching/loaders/HistoryGeocacheListLoader.java index 605f461..fdb35f2 100644 --- a/main/src/cgeo/geocaching/loaders/HistoryGeocacheListLoader.java +++ b/main/src/cgeo/geocaching/loaders/HistoryGeocacheListLoader.java @@ -2,9 +2,9 @@ package cgeo.geocaching.loaders; import cgeo.geocaching.DataStore; import cgeo.geocaching.SearchResult; -import cgeo.geocaching.settings.Settings; import cgeo.geocaching.enumerations.CacheType; import cgeo.geocaching.geopoint.Geopoint; +import cgeo.geocaching.settings.Settings; import android.content.Context; diff --git a/main/src/cgeo/geocaching/loaders/NextPageGeocacheListLoader.java b/main/src/cgeo/geocaching/loaders/NextPageGeocacheListLoader.java index 1104f83..05eac18 100644 --- a/main/src/cgeo/geocaching/loaders/NextPageGeocacheListLoader.java +++ b/main/src/cgeo/geocaching/loaders/NextPageGeocacheListLoader.java @@ -1,8 +1,8 @@ package cgeo.geocaching.loaders; import cgeo.geocaching.SearchResult; -import cgeo.geocaching.settings.Settings; import cgeo.geocaching.connector.gc.GCParser; +import cgeo.geocaching.settings.Settings; import android.content.Context; diff --git a/main/src/cgeo/geocaching/loaders/OfflineGeocacheListLoader.java b/main/src/cgeo/geocaching/loaders/OfflineGeocacheListLoader.java index 5088484..b80a1b8 100644 --- a/main/src/cgeo/geocaching/loaders/OfflineGeocacheListLoader.java +++ b/main/src/cgeo/geocaching/loaders/OfflineGeocacheListLoader.java @@ -1,9 +1,9 @@ package cgeo.geocaching.loaders; -import cgeo.geocaching.SearchResult; -import cgeo.geocaching.settings.Settings; import cgeo.geocaching.DataStore; +import cgeo.geocaching.SearchResult; import cgeo.geocaching.geopoint.Geopoint; +import cgeo.geocaching.settings.Settings; import android.content.Context; diff --git a/main/src/cgeo/geocaching/maps/CGeoMap.java b/main/src/cgeo/geocaching/maps/CGeoMap.java index 65d8861..722b3eb 100644 --- a/main/src/cgeo/geocaching/maps/CGeoMap.java +++ b/main/src/cgeo/geocaching/maps/CGeoMap.java @@ -38,11 +38,11 @@ import cgeo.geocaching.utils.CancellableHandler; import cgeo.geocaching.utils.GeoDirHandler; import cgeo.geocaching.utils.LeastRecentlyUsedSet; import cgeo.geocaching.utils.Log; -import cgeo.geocaching.utils.RunnableWithArgument; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.builder.HashCodeBuilder; +import rx.util.functions.Action1; import android.app.Activity; import android.app.AlertDialog; @@ -661,9 +661,9 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto if (Settings.getChooseList()) { // let user select list to store cache in new StoredList.UserInterface(activity).promptForListSelection(R.string.list_title, - new RunnableWithArgument<Integer>() { + new Action1<Integer>() { @Override - public void run(final Integer selectedListId) { + public void call(final Integer selectedListId) { storeCaches(geocodes, selectedListId); } }, true, StoredList.TEMPORARY_LIST_ID); diff --git a/main/src/cgeo/geocaching/maps/MapProviderFactory.java b/main/src/cgeo/geocaching/maps/MapProviderFactory.java index 2e43e19..b928a1e 100644 --- a/main/src/cgeo/geocaching/maps/MapProviderFactory.java +++ b/main/src/cgeo/geocaching/maps/MapProviderFactory.java @@ -1,7 +1,7 @@ package cgeo.geocaching.maps; -import cgeo.geocaching.R; import cgeo.geocaching.CgeoApplication; +import cgeo.geocaching.R; import cgeo.geocaching.maps.google.GoogleMapProvider; import cgeo.geocaching.maps.interfaces.MapProvider; import cgeo.geocaching.maps.interfaces.MapSource; diff --git a/main/src/cgeo/geocaching/maps/google/GoogleMapProvider.java b/main/src/cgeo/geocaching/maps/google/GoogleMapProvider.java index cb95b2c..38d7d96 100644 --- a/main/src/cgeo/geocaching/maps/google/GoogleMapProvider.java +++ b/main/src/cgeo/geocaching/maps/google/GoogleMapProvider.java @@ -1,7 +1,7 @@ package cgeo.geocaching.maps.google; -import cgeo.geocaching.R; import cgeo.geocaching.CgeoApplication; +import cgeo.geocaching.R; import cgeo.geocaching.maps.AbstractMapProvider; import cgeo.geocaching.maps.AbstractMapSource; import cgeo.geocaching.maps.interfaces.MapItemFactory; diff --git a/main/src/cgeo/geocaching/maps/google/GoogleMapView.java b/main/src/cgeo/geocaching/maps/google/GoogleMapView.java index d02e3c2..c0c7ecd 100644 --- a/main/src/cgeo/geocaching/maps/google/GoogleMapView.java +++ b/main/src/cgeo/geocaching/maps/google/GoogleMapView.java @@ -18,7 +18,6 @@ import cgeo.geocaching.utils.Log; import com.google.android.maps.GeoPoint; import com.google.android.maps.MapView; import com.google.android.maps.Overlay; - import org.apache.commons.lang3.reflect.MethodUtils; import android.app.Activity; diff --git a/main/src/cgeo/geocaching/network/Network.java b/main/src/cgeo/geocaching/network/Network.java index e891d3b..b737fd2 100644 --- a/main/src/cgeo/geocaching/network/Network.java +++ b/main/src/cgeo/geocaching/network/Network.java @@ -34,7 +34,6 @@ import ch.boye.httpclientandroidlib.params.CoreProtocolPNames; import ch.boye.httpclientandroidlib.params.HttpParams; import ch.boye.httpclientandroidlib.protocol.HttpContext; import ch.boye.httpclientandroidlib.util.EntityUtils; - import org.apache.commons.lang3.CharEncoding; import org.apache.commons.lang3.StringUtils; import org.eclipse.jdt.annotation.Nullable; diff --git a/main/src/cgeo/geocaching/network/OAuth.java b/main/src/cgeo/geocaching/network/OAuth.java index c033660..1e22551 100644 --- a/main/src/cgeo/geocaching/network/OAuth.java +++ b/main/src/cgeo/geocaching/network/OAuth.java @@ -3,7 +3,6 @@ package cgeo.geocaching.network; import cgeo.geocaching.utils.CryptUtils; import ch.boye.httpclientandroidlib.NameValuePair; - import org.apache.commons.lang3.StringUtils; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; diff --git a/main/src/cgeo/geocaching/network/OAuthAuthorizationActivity.java b/main/src/cgeo/geocaching/network/OAuthAuthorizationActivity.java index 888cf77..fd6ccc6 100644 --- a/main/src/cgeo/geocaching/network/OAuthAuthorizationActivity.java +++ b/main/src/cgeo/geocaching/network/OAuthAuthorizationActivity.java @@ -10,7 +10,6 @@ import cgeo.geocaching.utils.MatcherWrapper; import ch.boye.httpclientandroidlib.ParseException; import ch.boye.httpclientandroidlib.client.entity.UrlEncodedFormEntity; import ch.boye.httpclientandroidlib.util.EntityUtils; - import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.ImmutablePair; import org.eclipse.jdt.annotation.NonNull; diff --git a/main/src/cgeo/geocaching/settings/RegisterSend2CgeoPreference.java b/main/src/cgeo/geocaching/settings/RegisterSend2CgeoPreference.java index 3e838ab..2ca8df1 100644 --- a/main/src/cgeo/geocaching/settings/RegisterSend2CgeoPreference.java +++ b/main/src/cgeo/geocaching/settings/RegisterSend2CgeoPreference.java @@ -8,7 +8,6 @@ import cgeo.geocaching.ui.dialog.Dialogs; import cgeo.geocaching.utils.Log; import ch.boye.httpclientandroidlib.HttpResponse; - import org.apache.commons.lang3.StringUtils; import android.app.ProgressDialog; diff --git a/main/src/cgeo/geocaching/sorting/CacheComparator.java b/main/src/cgeo/geocaching/sorting/CacheComparator.java index 7932729..b06a4b0 100644 --- a/main/src/cgeo/geocaching/sorting/CacheComparator.java +++ b/main/src/cgeo/geocaching/sorting/CacheComparator.java @@ -1,9 +1,9 @@ package cgeo.geocaching.sorting; -import java.util.Comparator; - import cgeo.geocaching.Geocache; +import java.util.Comparator; + public interface CacheComparator extends Comparator<Geocache> { } diff --git a/main/src/cgeo/geocaching/sorting/ComparatorUserInterface.java b/main/src/cgeo/geocaching/sorting/ComparatorUserInterface.java index 99a535a..8cf3d9d 100644 --- a/main/src/cgeo/geocaching/sorting/ComparatorUserInterface.java +++ b/main/src/cgeo/geocaching/sorting/ComparatorUserInterface.java @@ -2,7 +2,8 @@ package cgeo.geocaching.sorting; import cgeo.geocaching.R; import cgeo.geocaching.utils.Log; -import cgeo.geocaching.utils.RunnableWithArgument; + +import rx.util.functions.Action1; import android.app.Activity; import android.app.AlertDialog; @@ -70,7 +71,7 @@ public class ComparatorUserInterface { registry.add(new ComparatorEntry(res.getString(resourceId), comparatorClass)); } - public void selectComparator(final CacheComparator current, final RunnableWithArgument<CacheComparator> runAfterwards) { + public void selectComparator(final CacheComparator current, final Action1<CacheComparator> runAfterwards) { final AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setTitle(R.string.caches_sort_title); @@ -85,11 +86,11 @@ public class ComparatorUserInterface { ComparatorEntry entry = registry.get(itemIndex); try { if (entry.cacheComparator == null) { - runAfterwards.run(null); + runAfterwards.call(null); } else { CacheComparator comparator = entry.cacheComparator.newInstance(); - runAfterwards.run(comparator); + runAfterwards.call(comparator); } } catch (InstantiationException e) { Log.e("selectComparator", e); diff --git a/main/src/cgeo/geocaching/sorting/DateComparator.java b/main/src/cgeo/geocaching/sorting/DateComparator.java index 76ee955..9df70f9 100644 --- a/main/src/cgeo/geocaching/sorting/DateComparator.java +++ b/main/src/cgeo/geocaching/sorting/DateComparator.java @@ -1,7 +1,7 @@ package cgeo.geocaching.sorting; -import cgeo.geocaching.Geocache; import cgeo.geocaching.CgeoApplication; +import cgeo.geocaching.Geocache; import java.util.ArrayList; import java.util.Date; diff --git a/main/src/cgeo/geocaching/speech/TextFactory.java b/main/src/cgeo/geocaching/speech/TextFactory.java index 2a3b6d7..eb780c6 100644 --- a/main/src/cgeo/geocaching/speech/TextFactory.java +++ b/main/src/cgeo/geocaching/speech/TextFactory.java @@ -2,9 +2,9 @@ package cgeo.geocaching.speech; import cgeo.geocaching.CgeoApplication; import cgeo.geocaching.R; -import cgeo.geocaching.settings.Settings; import cgeo.geocaching.geopoint.Geopoint; import cgeo.geocaching.geopoint.IConversion; +import cgeo.geocaching.settings.Settings; import cgeo.geocaching.utils.AngleUtils; import java.util.Locale; diff --git a/main/src/cgeo/geocaching/twitter/Twitter.java b/main/src/cgeo/geocaching/twitter/Twitter.java index 7213789..1caa2d4 100644 --- a/main/src/cgeo/geocaching/twitter/Twitter.java +++ b/main/src/cgeo/geocaching/twitter/Twitter.java @@ -17,7 +17,6 @@ import cgeo.geocaching.utils.LogTemplateProvider; import cgeo.geocaching.utils.LogTemplateProvider.LogContext; import ch.boye.httpclientandroidlib.HttpResponse; - import org.apache.commons.lang3.StringUtils; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; diff --git a/main/src/cgeo/geocaching/ui/AbstractCachingPageViewCreator.java b/main/src/cgeo/geocaching/ui/AbstractCachingPageViewCreator.java index ed5d182..0c67384 100644 --- a/main/src/cgeo/geocaching/ui/AbstractCachingPageViewCreator.java +++ b/main/src/cgeo/geocaching/ui/AbstractCachingPageViewCreator.java @@ -3,7 +3,6 @@ package cgeo.geocaching.ui; import cgeo.geocaching.activity.AbstractViewPagerActivity.PageViewCreator; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; - import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; diff --git a/main/src/cgeo/geocaching/ui/dialog/Dialogs.java b/main/src/cgeo/geocaching/ui/dialog/Dialogs.java index 865ba70..4f6de39 100644 --- a/main/src/cgeo/geocaching/ui/dialog/Dialogs.java +++ b/main/src/cgeo/geocaching/ui/dialog/Dialogs.java @@ -1,10 +1,10 @@ package cgeo.geocaching.ui.dialog; import cgeo.geocaching.CgeoApplication; -import cgeo.geocaching.utils.RunnableWithArgument; import org.apache.commons.lang3.StringUtils; import org.eclipse.jdt.annotation.Nullable; +import rx.util.functions.Action1; import android.app.Activity; import android.app.AlertDialog; @@ -310,7 +310,7 @@ public final class Dialogs { * @param okayListener * listener to be run on okay */ - public static void input(final Activity context, final int title, final String defaultValue, final int buttonTitle, final RunnableWithArgument<String> okayListener) { + public static void input(final Activity context, final int title, final String defaultValue, final int buttonTitle, final Action1<String> okayListener) { final EditText input = new EditText(context); input.setInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_CLASS_TEXT); input.setText(defaultValue); @@ -322,7 +322,7 @@ public final class Dialogs { @Override public void onClick(DialogInterface dialog, int which) { - okayListener.run(input.getText().toString()); + okayListener.call(input.getText().toString()); } }); builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { diff --git a/main/src/cgeo/geocaching/ui/dialog/LiveMapInfoDialogBuilder.java b/main/src/cgeo/geocaching/ui/dialog/LiveMapInfoDialogBuilder.java index 6ad59ec..702b85d 100644 --- a/main/src/cgeo/geocaching/ui/dialog/LiveMapInfoDialogBuilder.java +++ b/main/src/cgeo/geocaching/ui/dialog/LiveMapInfoDialogBuilder.java @@ -1,8 +1,8 @@ package cgeo.geocaching.ui.dialog; +import cgeo.geocaching.CgeoApplication; import cgeo.geocaching.R; import cgeo.geocaching.settings.Settings; -import cgeo.geocaching.CgeoApplication; import android.app.Activity; import android.app.AlertDialog; diff --git a/main/src/cgeo/geocaching/utils/RunnableWithArgument.java b/main/src/cgeo/geocaching/utils/RunnableWithArgument.java deleted file mode 100644 index 6137efd..0000000 --- a/main/src/cgeo/geocaching/utils/RunnableWithArgument.java +++ /dev/null @@ -1,7 +0,0 @@ -package cgeo.geocaching.utils; - -public interface RunnableWithArgument<T> { - - abstract void run(final T argument); - -} diff --git a/main/src/cgeo/geocaching/utils/TextUtils.java b/main/src/cgeo/geocaching/utils/TextUtils.java index efbb2d7..c4e1128 100644 --- a/main/src/cgeo/geocaching/utils/TextUtils.java +++ b/main/src/cgeo/geocaching/utils/TextUtils.java @@ -4,7 +4,6 @@ package cgeo.geocaching.utils; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; - import org.eclipse.jdt.annotation.Nullable; import java.util.regex.Matcher; |