Merge pull request #7782 from osmandapp/settings_improvements
Default preferences improvements
This commit is contained in:
commit
b4d17fe908
4 changed files with 29 additions and 4 deletions
|
@ -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" />
|
||||
|
|
|
@ -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();
|
||||
|
@ -3021,9 +3021,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>>();
|
||||
|
||||
|
|
|
@ -54,8 +54,16 @@ public class SendAnalyticsBottomSheetDialogFragment extends MenuBottomSheetDialo
|
|||
|
||||
items.add(new SubtitleDividerItem(context));
|
||||
|
||||
sendAnonymousMapDownloadsData = app.getSettings().SEND_ANONYMOUS_MAP_DOWNLOADS_DATA.get();
|
||||
sendAnonymousAppUsageData = app.getSettings().SEND_ANONYMOUS_APP_USAGE_DATA.get();
|
||||
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)
|
||||
|
|
|
@ -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));
|
||||
|
|
Loading…
Reference in a new issue