Reuse prefs object
This commit is contained in:
parent
5da6034c76
commit
a8821e75bf
@ -22,9 +22,6 @@
|
||||
|
||||
package org.solovyev.android.calculator;
|
||||
|
||||
import org.solovyev.android.Check;
|
||||
import org.solovyev.android.calculator.floating.FloatingCalculatorService;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Application;
|
||||
import android.app.Dialog;
|
||||
@ -39,7 +36,6 @@ import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.IBinder;
|
||||
import android.os.Looper;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v4.app.Fragment;
|
||||
@ -57,6 +53,9 @@ import android.view.ViewGroup;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.ArrayAdapter;
|
||||
|
||||
import org.solovyev.android.Check;
|
||||
import org.solovyev.android.calculator.floating.FloatingCalculatorService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
@ -75,9 +74,9 @@ public final class App {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
public static void init(@Nonnull CalculatorApplication application) {
|
||||
public static void init(@Nonnull CalculatorApplication application, @NonNull SharedPreferences prefs) {
|
||||
App.application = application;
|
||||
App.preferences = PreferenceManager.getDefaultSharedPreferences(application);
|
||||
App.preferences = prefs;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
@ -137,7 +137,7 @@ public class CalculatorApplication extends android.app.Application implements Sh
|
||||
}
|
||||
|
||||
private void onPostCreate(@Nonnull final SharedPreferences prefs, @Nonnull Languages languages) {
|
||||
App.init(this);
|
||||
App.init(this, prefs);
|
||||
languages.init();
|
||||
|
||||
prefs.registerOnSharedPreferenceChangeListener(this);
|
||||
|
Loading…
Reference in New Issue
Block a user