Inverted start up messages ui and change several prefs defaults

This commit is contained in:
Chumva 2019-10-29 15:04:22 +02:00
parent 5558bacc16
commit 540971005b
4 changed files with 29 additions and 4 deletions

View file

@ -46,6 +46,7 @@
android:icon="@drawable/ic_action_notification"
android:key="do_not_show_startup_messages"
android:layout="@layout/preference_switch_with_descr"
android:persistent="false"
android:summaryOff="@string/shared_string_off"
android:summaryOn="@string/shared_string_on"
android:title="@string/start_up_message_pref" />

View file

@ -1391,7 +1391,7 @@ public class OsmandSettings {
public final OsmandPreference<Integer> SEND_ANONYMOUS_DATA_REQUESTS_COUNT = new IntPreference("send_anonymous_data_requests_count", 0).makeGlobal().cache();
public final OsmandPreference<Integer> SEND_ANONYMOUS_DATA_LAST_REQUEST_NS = new IntPreference("send_anonymous_data_last_request_ns", -1).makeGlobal().cache();
public final OsmandPreference<Boolean> MAP_EMPTY_STATE_ALLOWED = new BooleanPreference("map_empty_state_allowed", true).makeProfile().makeGeneral().cache();
public final OsmandPreference<Boolean> MAP_EMPTY_STATE_ALLOWED = new BooleanPreference("map_empty_state_allowed", false).makeProfile().makeGeneral().cache();
public final CommonPreference<Float> TEXT_SCALE = new FloatPreference("text_scale", 1f).makeProfile().cache();
@ -3020,9 +3020,12 @@ public class OsmandSettings {
return false;
}
;
};
{
RENDERER.setModeDefaultValue(ApplicationMode.BOAT, RendererRegistry.NAUTICAL_RENDER);
RENDERER.setModeDefaultValue(ApplicationMode.SKI, RendererRegistry.WINTER_SKI_RENDER);
}
Map<String, CommonPreference<String>> customRendersProps = new LinkedHashMap<String, OsmandSettings.CommonPreference<String>>();

View file

@ -54,8 +54,16 @@ public class SendAnalyticsBottomSheetDialogFragment extends MenuBottomSheetDialo
items.add(new SubtitleDividerItem(context));
if (app.getSettings().SEND_ANONYMOUS_MAP_DOWNLOADS_DATA.isSet()) {
sendAnonymousMapDownloadsData = app.getSettings().SEND_ANONYMOUS_MAP_DOWNLOADS_DATA.get();
} else {
sendAnonymousMapDownloadsData = true;
}
if (app.getSettings().SEND_ANONYMOUS_APP_USAGE_DATA.isSet()) {
sendAnonymousAppUsageData = app.getSettings().SEND_ANONYMOUS_APP_USAGE_DATA.get();
} else {
sendAnonymousAppUsageData = true;
}
final BottomSheetItemWithCompoundButton[] downloadedMapsItem = new BottomSheetItemWithCompoundButton[1];
downloadedMapsItem[0] = (BottomSheetItemWithCompoundButton) new BottomSheetItemWithCompoundButton.Builder()
.setChecked(sendAnonymousMapDownloadsData)

View file

@ -30,6 +30,7 @@ public class GlobalSettingsFragment extends BaseSettingsFragment implements Send
setupExternalStorageDirPref();
setupSendAnonymousDataPref();
setupShowStartupMessagesPref();
setupEnableProxyPref();
}
@ -66,6 +67,11 @@ public class GlobalSettingsFragment extends BaseSettingsFragment implements Send
}
}
return false;
} else if (prefId.equals(settings.DO_NOT_SHOW_STARTUP_MESSAGES.getId())) {
if (newValue instanceof Boolean) {
boolean enabled = !(Boolean) newValue;
return settings.DO_NOT_SHOW_STARTUP_MESSAGES.set(enabled);
}
}
return super.onPreferenceChange(preference, newValue);
@ -165,6 +171,13 @@ public class GlobalSettingsFragment extends BaseSettingsFragment implements Send
sendAnonymousData.setChecked(enabled);
}
private void setupShowStartupMessagesPref() {
boolean enabled = !settings.DO_NOT_SHOW_STARTUP_MESSAGES.get(); // pref ui was inverted
SwitchPreferenceCompat sendAnonymousData = (SwitchPreferenceCompat) findPreference(settings.DO_NOT_SHOW_STARTUP_MESSAGES.getId());
sendAnonymousData.setChecked(enabled);
}
private void setupEnableProxyPref() {
SwitchPreferenceEx enableProxy = (SwitchPreferenceEx) findPreference(settings.ENABLE_PROXY.getId());
enableProxy.setIcon(getContentIcon(R.drawable.ic_action_proxy));