|
|
@ -2,7 +2,6 @@ package org.tasks.preferences;
|
|
|
|
|
|
|
|
|
|
|
|
import static com.todoroo.andlib.utility.AndroidUtilities.atLeastJellybeanMR1;
|
|
|
|
import static com.todoroo.andlib.utility.AndroidUtilities.atLeastJellybeanMR1;
|
|
|
|
import static com.todoroo.andlib.utility.AndroidUtilities.atLeastLollipop;
|
|
|
|
import static com.todoroo.andlib.utility.AndroidUtilities.atLeastLollipop;
|
|
|
|
import static com.todoroo.andlib.utility.AndroidUtilities.preLollipop;
|
|
|
|
|
|
|
|
import static java.util.Arrays.asList;
|
|
|
|
import static java.util.Arrays.asList;
|
|
|
|
import static org.tasks.dialogs.ExportTasksDialog.newExportTasksDialog;
|
|
|
|
import static org.tasks.dialogs.ExportTasksDialog.newExportTasksDialog;
|
|
|
|
import static org.tasks.dialogs.ImportTasksDialog.newImportTasksDialog;
|
|
|
|
import static org.tasks.dialogs.ImportTasksDialog.newImportTasksDialog;
|
|
|
@ -268,13 +267,7 @@ public class BasicPreferences extends InjectingPreferenceActivity
|
|
|
|
singleCheckedArrayAdapter,
|
|
|
|
singleCheckedArrayAdapter,
|
|
|
|
getMapProvider(),
|
|
|
|
getMapProvider(),
|
|
|
|
(dialog, which) -> {
|
|
|
|
(dialog, which) -> {
|
|
|
|
if (which == 0) {
|
|
|
|
if (which == 1) {
|
|
|
|
if (preLollipop()) {
|
|
|
|
|
|
|
|
toaster.longToast(R.string.requires_android_version, 5.0);
|
|
|
|
|
|
|
|
dialog.dismiss();
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if (which == 1) {
|
|
|
|
|
|
|
|
if (!playServices.refreshAndCheck()) {
|
|
|
|
if (!playServices.refreshAndCheck()) {
|
|
|
|
playServices.resolve(this);
|
|
|
|
playServices.resolve(this);
|
|
|
|
dialog.dismiss();
|
|
|
|
dialog.dismiss();
|
|
|
@ -302,13 +295,7 @@ public class BasicPreferences extends InjectingPreferenceActivity
|
|
|
|
singleCheckedArrayAdapter,
|
|
|
|
singleCheckedArrayAdapter,
|
|
|
|
getPlaceProvider(),
|
|
|
|
getPlaceProvider(),
|
|
|
|
(dialog, which) -> {
|
|
|
|
(dialog, which) -> {
|
|
|
|
if (which == 0) {
|
|
|
|
if (which == 1) {
|
|
|
|
if (preLollipop()) {
|
|
|
|
|
|
|
|
toaster.longToast(R.string.requires_android_version, 5.0);
|
|
|
|
|
|
|
|
dialog.dismiss();
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if (which == 1) {
|
|
|
|
|
|
|
|
if (!playServices.refreshAndCheck()) {
|
|
|
|
if (!playServices.refreshAndCheck()) {
|
|
|
|
playServices.resolve(this);
|
|
|
|
playServices.resolve(this);
|
|
|
|
dialog.dismiss();
|
|
|
|
dialog.dismiss();
|
|
|
@ -329,28 +316,19 @@ public class BasicPreferences extends InjectingPreferenceActivity
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
int placeProvider = getPlaceProvider();
|
|
|
|
int placeProvider = getPlaceProvider();
|
|
|
|
placeProviderPreference.setSummary(
|
|
|
|
placeProviderPreference.setSummary(choices.get(placeProvider));
|
|
|
|
placeProvider == -1 ? getString(R.string.none) : choices.get(placeProvider));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private int getPlaceProvider() {
|
|
|
|
private int getPlaceProvider() {
|
|
|
|
if (playServices.isPlayServicesAvailable()) {
|
|
|
|
return playServices.isPlayServicesAvailable() && inventory.hasPro()
|
|
|
|
if (preLollipop()) {
|
|
|
|
? preferences.getInt(R.string.p_place_provider, 0)
|
|
|
|
return inventory.hasPro() ? 1 : -1;
|
|
|
|
: 0;
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return inventory.hasPro() ? preferences.getInt(R.string.p_place_provider, 0) : 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return atLeastLollipop() ? 0 : -1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private int getMapProvider() {
|
|
|
|
private int getMapProvider() {
|
|
|
|
if (playServices.isPlayServicesAvailable()) {
|
|
|
|
return playServices.isPlayServicesAvailable()
|
|
|
|
return preLollipop() ? 1 : preferences.getInt(R.string.p_map_provider, 0);
|
|
|
|
? preferences.getInt(R.string.p_map_provider, 0)
|
|
|
|
} else {
|
|
|
|
: 0;
|
|
|
|
return preLollipop() ? -1 : 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void requestLogin() {
|
|
|
|
private void requestLogin() {
|
|
|
|