Unused ServiceLocator removed

This commit is contained in:
serso 2015-05-30 16:14:30 +02:00
parent 79a1726c71
commit a8d6039083
3 changed files with 15 additions and 32 deletions

View File

@ -34,8 +34,6 @@ import android.support.v4.app.DialogFragment;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction; import android.support.v4.app.FragmentTransaction;
import android.text.TextUtils;
import android.util.Log;
import org.solovyev.android.Android; import org.solovyev.android.Android;
import org.solovyev.android.UiThreadExecutor; import org.solovyev.android.UiThreadExecutor;
@ -47,21 +45,27 @@ import org.solovyev.android.calculator.widget.CalculatorWidgetProvider;
import org.solovyev.android.calculator.widget.CalculatorWidgetProvider3x4; import org.solovyev.android.calculator.widget.CalculatorWidgetProvider3x4;
import org.solovyev.android.calculator.widget.CalculatorWidgetProvider4x4; import org.solovyev.android.calculator.widget.CalculatorWidgetProvider4x4;
import org.solovyev.android.calculator.widget.CalculatorWidgetProvider4x5; import org.solovyev.android.calculator.widget.CalculatorWidgetProvider4x5;
import org.solovyev.android.checkout.*; import org.solovyev.android.checkout.Billing;
import org.solovyev.android.checkout.Checkout;
import org.solovyev.android.checkout.Inventory;
import org.solovyev.android.checkout.ProductTypes;
import org.solovyev.android.checkout.Products;
import org.solovyev.android.checkout.RobotmediaDatabase;
import org.solovyev.android.checkout.RobotmediaInventory;
import org.solovyev.common.listeners.JEvent; import org.solovyev.common.listeners.JEvent;
import org.solovyev.common.listeners.JEventListener; import org.solovyev.common.listeners.JEventListener;
import org.solovyev.common.listeners.JEventListeners; import org.solovyev.common.listeners.JEventListeners;
import org.solovyev.common.listeners.Listeners; import org.solovyev.common.listeners.Listeners;
import org.solovyev.common.threads.DelayedExecutor; import org.solovyev.common.threads.DelayedExecutor;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.concurrent.Executor; import java.util.concurrent.Executor;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/** /**
* User: serso * User: serso
* Date: 12/1/12 * Date: 12/1/12
@ -81,9 +85,6 @@ public final class App {
@Nonnull @Nonnull
private static volatile Application application; private static volatile Application application;
@Nonnull
private static volatile ServiceLocator locator;
@Nonnull @Nonnull
private static volatile DelayedExecutor uiThreadExecutor; private static volatile DelayedExecutor uiThreadExecutor;
@ -128,18 +129,13 @@ public final class App {
********************************************************************** **********************************************************************
*/ */
public static <A extends Application & ServiceLocator> void init(@Nonnull A application) { public static void init(@Nonnull Application application) {
init(application, new UiThreadExecutor(), Listeners.newEventBus(), application); init(application, new UiThreadExecutor(), Listeners.newEventBus());
}
public static void init(@Nonnull Application application, @Nullable ServiceLocator serviceLocator) {
init(application, new UiThreadExecutor(), Listeners.newEventBus(), serviceLocator);
} }
public static void init(@Nonnull Application application, public static void init(@Nonnull Application application,
@Nonnull UiThreadExecutor uiThreadExecutor, @Nonnull UiThreadExecutor uiThreadExecutor,
@Nonnull JEventListeners<JEventListener<? extends JEvent>, JEvent> eventBus, @Nonnull JEventListeners<JEventListener<? extends JEvent>, JEvent> eventBus) {
@Nullable ServiceLocator serviceLocator) {
if (!initialized) { if (!initialized) {
App.application = application; App.application = application;
App.preferences = PreferenceManager.getDefaultSharedPreferences(application); App.preferences = PreferenceManager.getDefaultSharedPreferences(application);
@ -163,13 +159,6 @@ public final class App {
} }
} }
}); });
if (serviceLocator != null) {
App.locator = serviceLocator;
} else {
// empty service locator
App.locator = new ServiceLocator() {
};
}
App.broadcaster = new CalculatorBroadcaster(application); App.broadcaster = new CalculatorBroadcaster(application);
App.vibrator = new Vibrator(application, preferences); App.vibrator = new Vibrator(application, preferences);
App.screenMetrics = new ScreenMetrics(application); App.screenMetrics = new ScreenMetrics(application);
@ -227,6 +216,7 @@ public final class App {
* @param <A> real type of application * @param <A> real type of application
* @return application instance which was provided in {@link App#init(android.app.Application)} method * @return application instance which was provided in {@link App#init(android.app.Application)} method
*/ */
@SuppressWarnings("unchecked")
@Nonnull @Nonnull
public static <A extends Application> A getApplication() { public static <A extends Application> A getApplication() {
checkInit(); checkInit();

View File

@ -60,7 +60,7 @@ import javax.annotation.Nonnull;
formUriBasicAuthPassword="ECL65PO2TH5quIFNAK4hQ5Ng", formUriBasicAuthPassword="ECL65PO2TH5quIFNAK4hQ5Ng",
mode = ReportingInteractionMode.TOAST, mode = ReportingInteractionMode.TOAST,
resToastText = R.string.crashed) resToastText = R.string.crashed)
public class CalculatorApplication extends android.app.Application implements SharedPreferences.OnSharedPreferenceChangeListener, ServiceLocator { public class CalculatorApplication extends android.app.Application implements SharedPreferences.OnSharedPreferenceChangeListener {
/* /*
********************************************************************** **********************************************************************

View File

@ -1,7 +0,0 @@
package org.solovyev.android.calculator;
/**
* Marker interface for service locator
*/
public interface ServiceLocator {
}