diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 6d3d81a8..4b06ea10 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -7,12 +7,10 @@
-
-
@@ -159,16 +157,15 @@
android:name=".floating.FloatingCalculatorService"
android:exported="false">
-
-
+
+
-
+
-
-
-
+
+
diff --git a/app/src/main/java/org/solovyev/android/calculator/Preferences.java b/app/src/main/java/org/solovyev/android/calculator/Preferences.java
index e78fffb7..ef335909 100644
--- a/app/src/main/java/org/solovyev/android/calculator/Preferences.java
+++ b/app/src/main/java/org/solovyev/android/calculator/Preferences.java
@@ -142,7 +142,6 @@ public final class Preferences {
Calculations.preferredNumeralBase.tryPutDefault(preferences, editor);
Onscreen.showAppIcon.tryPutDefault(preferences, editor);
- Onscreen.startOnBoot.tryPutDefault(preferences, editor);
Onscreen.theme.tryPutDefault(preferences, editor);
Widget.theme.tryPutDefault(preferences, editor);
@@ -252,7 +251,6 @@ public final class Preferences {
}
public static class Onscreen {
- public static final Preference startOnBoot = BooleanPreference.of("onscreen_start_on_boot", false);
public static final Preference showAppIcon = BooleanPreference.of("onscreen_show_app_icon", true);
public static final Preference theme = StringPreference.ofEnum("onscreen.theme", SimpleTheme.default_theme, SimpleTheme.class);
@@ -425,5 +423,6 @@ public final class Preferences {
static final Preference usePrevAsBack = BooleanPreference.of("org.solovyev.android.calculator.CalculatorActivity_use_back_button_as_prev", false);
static final Preference showEqualsButton = BooleanPreference.of("showEqualsButton", true);
static final Preference autoOrientation = BooleanPreference.of("autoOrientation", true);
+ static final Preference startOnBoot = BooleanPreference.of("onscreen_start_on_boot", false);
}
}
diff --git a/app/src/main/java/org/solovyev/android/calculator/floating/FloatingCalculatorBroadcastReceiver.java b/app/src/main/java/org/solovyev/android/calculator/floating/FloatingCalculatorBroadcastReceiver.java
index f1012594..ab07fb6f 100644
--- a/app/src/main/java/org/solovyev/android/calculator/floating/FloatingCalculatorBroadcastReceiver.java
+++ b/app/src/main/java/org/solovyev/android/calculator/floating/FloatingCalculatorBroadcastReceiver.java
@@ -25,39 +25,19 @@ package org.solovyev.android.calculator.floating;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
-import android.content.SharedPreferences;
-import android.preference.PreferenceManager;
-import org.solovyev.android.calculator.Preferences;
-import org.solovyev.android.calculator.ga.Ga;
import javax.annotation.Nonnull;
-import javax.inject.Inject;
-
-import static org.solovyev.android.calculator.App.cast;
public final class FloatingCalculatorBroadcastReceiver extends BroadcastReceiver {
- @Inject
- SharedPreferences preferences;
- @Inject
- Ga ga;
-
public FloatingCalculatorBroadcastReceiver() {
}
@Override
public void onReceive(@Nonnull Context context,
@Nonnull Intent intent) {
- if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)) {
- cast(context).getComponent().inject(this);
- if (Preferences.Onscreen.startOnBoot.getPreferenceNoError(preferences)) {
- FloatingCalculatorService.showNotification(context);
- ga.onBootStart();
- }
- } else {
- final Intent newIntent = new Intent(intent);
- newIntent.setClass(context, FloatingCalculatorService.class);
- context.startService(newIntent);
- }
+ final Intent newIntent = new Intent(intent);
+ newIntent.setClass(context, FloatingCalculatorService.class);
+ context.startService(newIntent);
}
}
diff --git a/app/src/main/java/org/solovyev/android/calculator/floating/FloatingCalculatorService.java b/app/src/main/java/org/solovyev/android/calculator/floating/FloatingCalculatorService.java
index c0930a05..ca58a8a5 100644
--- a/app/src/main/java/org/solovyev/android/calculator/floating/FloatingCalculatorService.java
+++ b/app/src/main/java/org/solovyev/android/calculator/floating/FloatingCalculatorService.java
@@ -46,8 +46,8 @@ import static org.solovyev.android.calculator.App.cast;
public class FloatingCalculatorService extends Service implements FloatingViewListener, SharedPreferences.OnSharedPreferenceChangeListener {
- private static final String SHOW_WINDOW_ACTION = "org.solovyev.android.calculator.onscreen.SHOW_WINDOW";
- private static final String SHOW_NOTIFICATION_ACTION = "org.solovyev.android.calculator.onscreen.SHOW_NOTIFICATION";
+ private static final String SHOW_WINDOW_ACTION = "org.solovyev.android.calculator.floating.SHOW_WINDOW";
+ private static final String SHOW_NOTIFICATION_ACTION = "org.solovyev.android.calculator.floating.SHOW_NOTIFICATION";
private static final int NOTIFICATION_ID = 9031988; // my birthday =)
private FloatingCalculatorView view;
@@ -63,12 +63,6 @@ public class FloatingCalculatorService extends Service implements FloatingViewLi
@Inject
SharedPreferences preferences;
- public static void showNotification(@Nonnull Context context) {
- final Intent intent = new Intent(SHOW_NOTIFICATION_ACTION);
- intent.setClass(context, FloatingCalculatorBroadcastReceiver.class);
- context.sendBroadcast(intent);
- }
-
public static void show(@Nonnull Context context) {
context.sendBroadcast(createShowWindowIntent(context));
}
diff --git a/app/src/main/res/xml/preferences_onscreen.xml b/app/src/main/res/xml/preferences_onscreen.xml
index 6d90078f..47b776fd 100644
--- a/app/src/main/res/xml/preferences_onscreen.xml
+++ b/app/src/main/res/xml/preferences_onscreen.xml
@@ -30,11 +30,6 @@
a:key="onscreen.theme"
a:title="@string/c_calc_theme" />
-
-