diff --git a/app/build.gradle b/app/build.gradle index 171b6bde6..eef1794a6 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -8,8 +8,8 @@ android { applicationId "com.google.android.stardroid" minSdkVersion 15 targetSdkVersion 23 - versionCode 1405 - versionName "1.8.1" + versionCode 1407 + versionName "1.8.2" buildConfigField 'String', 'GOOGLE_ANALYTICS_CODE', '""' } signingConfigs { diff --git a/app/src/main/java/com/google/android/stardroid/activities/DynamicStarMapActivity.java b/app/src/main/java/com/google/android/stardroid/activities/DynamicStarMapActivity.java index 950c47cd8..a5d9d208d 100644 --- a/app/src/main/java/com/google/android/stardroid/activities/DynamicStarMapActivity.java +++ b/app/src/main/java/com/google/android/stardroid/activities/DynamicStarMapActivity.java @@ -51,6 +51,7 @@ import com.google.android.stardroid.activities.util.ActivityLightLevelChanger.NightModeable; import com.google.android.stardroid.activities.util.ActivityLightLevelManager; import com.google.android.stardroid.activities.util.FullscreenControlsManager; +import com.google.android.stardroid.base.Lists; import com.google.android.stardroid.control.AstronomerModel; import com.google.android.stardroid.control.AstronomerModel.Pointing; import com.google.android.stardroid.control.ControllerGroup; @@ -141,7 +142,6 @@ public void run() { private RendererController rendererController; private boolean nightMode = false; private boolean searchMode = false; - private boolean disableAutoMode = false; private GeocentricCoordinates searchTarget = GeocentricCoordinates.getInstance(0, 0); private SharedPreferences sharedPreferences; private GLSurfaceView skyView; @@ -213,6 +213,7 @@ public void onCreate(Bundle icicle) { this); initializeModelViewController(); + checkForSensorsAndMaybeWarn(); // Search related setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL); @@ -254,7 +255,6 @@ private void checkForSensorsAndMaybeWarn() { return; } // Missing at least one sensor. Warn the user. - disableAutoMode = true; handler.post(new Runnable() { @Override public void run() { @@ -262,16 +262,15 @@ public void run() { Log.d(TAG, "showing no sensor dialog"); // TODO(jontayler): refactor to use dialog fragments. showDialog(DialogFactory.DIALOG_ID_NO_SENSORS); + // First time, force manual mode. + sharedPreferences.edit().putBoolean(AUTO_MODE_PREF_KEY, false).apply(); + setAutoMode(false); } else { Log.d(TAG, "showing no sensor toast"); Toast.makeText( DynamicStarMapActivity.this, R.string.no_sensor_warning, Toast.LENGTH_LONG).show(); + // Don't force manual mode second time through - leave it up to the user. } - // Force manual mode and remove the button - sharedPreferences.edit().putBoolean(AUTO_MODE_PREF_KEY, false).apply(); - setAutoMode(false); - findViewById(R.id.layer_manual_auto_toggle).setVisibility(View.INVISIBLE); - disableAutoMode = true; } }); } @@ -596,7 +595,6 @@ private void initializeModelViewController() { Log.i(TAG, "Set up controllers @ " + System.currentTimeMillis()); controller = ControllerGroup.createControllerGroup(this); controller.setModel(model); - checkForSensorsAndMaybeWarn(); wireUpScreenControls(); // TODO(johntaylor) move these? magneticSwitcher = new MagneticDeclinationCalculatorSwitcher(model, sharedPreferences); wireUpTimePlayer(); // TODO(widdows) move these? @@ -625,19 +623,13 @@ public void onClick(View v) { buttonViews.add(button); } buttonViews.add(findViewById(R.id.manual_auto_toggle)); - ButtonLayerView manualButtonLayer = (ButtonLayerView) findViewById(R.id.layer_manual_auto_toggle); - - List viewsToShowOrHide = new ArrayList<>(); - if (!disableAutoMode) { - // We don't want this coming back on a screen tap if the phone doesn't support manual mode. - viewsToShowOrHide.add(manualButtonLayer); - } - viewsToShowOrHide.add(providerButtons); + ButtonLayerView manualButtonLayer = (ButtonLayerView) findViewById( + R.id.layer_manual_auto_toggle); fullscreenControlsManager = new FullscreenControlsManager( this, findViewById(R.id.main_sky_view), - viewsToShowOrHide, + Lists.asList(manualButtonLayer, providerButtons), buttonViews); MapMover mapMover = new MapMover(model, controller, this); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index cadfba215..42547ffcb 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -409,15 +409,19 @@ Puppid-Velids Ursids - Your device lacks orientation sensors - automode unavailable - Warning + Your device may lack orientation sensors - automode may not work + Bad news! \n - Unfortunately your device does not have one of the + Unfortunately your device might not have one of the sensors that Sky Map needs.\n\n To show you the sky in the direction your phone is pointing Sky Map - needs both a built-in compass and an accelerometer.\n\n - You can still use Sky Map on this device, - but only in manual mode where you drag, rotate and stretch the map manually with your fingers. + needs both a built-in compass and an accelerometer. Your device reports that it is missing + one of them. The good news is that some devices (for example some Moto E phones) falsely claim + not to have a compass but actually do.\n\n + + If your device really is missing a sensor then auto-mode will not work. However, you + can still use Sky Map on this device in manual mode where you drag, rotate and stretch the + map with your fingers. Do not show this message again