Remove excessive permissions
This commit is contained in:
@@ -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<Boolean> startOnBoot = BooleanPreference.of("onscreen_start_on_boot", false);
|
||||
public static final Preference<Boolean> showAppIcon = BooleanPreference.of("onscreen_show_app_icon", true);
|
||||
public static final Preference<SimpleTheme> theme = StringPreference.ofEnum("onscreen.theme", SimpleTheme.default_theme, SimpleTheme.class);
|
||||
|
||||
@@ -425,5 +423,6 @@ public final class Preferences {
|
||||
static final Preference<Boolean> usePrevAsBack = BooleanPreference.of("org.solovyev.android.calculator.CalculatorActivity_use_back_button_as_prev", false);
|
||||
static final Preference<Boolean> showEqualsButton = BooleanPreference.of("showEqualsButton", true);
|
||||
static final Preference<Boolean> autoOrientation = BooleanPreference.of("autoOrientation", true);
|
||||
static final Preference<Boolean> startOnBoot = BooleanPreference.of("onscreen_start_on_boot", false);
|
||||
}
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
@@ -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));
|
||||
}
|
||||
|
Reference in New Issue
Block a user