Fix navigation settings visibility

This commit is contained in:
Chumva 2019-09-27 18:21:16 +03:00
parent c066b32e14
commit a3ea80f572
3 changed files with 11 additions and 7 deletions

View file

@ -19,6 +19,7 @@ import android.support.design.widget.AppBarLayout;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.content.ContextCompat;
import android.support.v4.view.ViewCompat;
import android.support.v7.preference.EditTextPreference;
import android.support.v7.preference.ListPreference;
import android.support.v7.preference.Preference;
@ -253,6 +254,7 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl
protected void createToolbar(LayoutInflater inflater, View view) {
AppBarLayout appBarLayout = (AppBarLayout) view.findViewById(R.id.appbar);
ViewCompat.setElevation(appBarLayout, 5.0f);
int toolbarRes = getToolbarResId();
if (toolbarRes != -1) {

View file

@ -192,9 +192,7 @@ public class ConfigureProfileFragment extends BaseSettingsFragment {
private void setupNavigationSettingsPref() {
Preference navigationSettings = findPreference("navigation_settings");
navigationSettings.setIcon(getContentIcon(R.drawable.ic_action_gdirections_dark));
if (getSelectedAppMode() == ApplicationMode.DEFAULT) {
navigationSettings.setVisible(false);
}
navigationSettings.setVisible(!getSelectedAppMode().isDerivedRoutingFrom(ApplicationMode.DEFAULT));
}
private void setupConfigureMapPref() {

View file

@ -23,6 +23,7 @@ import android.widget.TextView;
import net.osmand.Location;
import net.osmand.data.PointDescription;
import net.osmand.plus.ApplicationMode;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.R;
import net.osmand.plus.settings.bottomsheets.ChangeGeneralProfilesPrefBottomSheet;
@ -194,10 +195,13 @@ public class CoordinatesFormatFragment extends BaseSettingsFragment {
int newFormat = getCoordinatesFormatForKey(key);
if (newFormat != -1) {
if (settings.COORDINATES_FORMAT.isSetForMode(getSelectedAppMode())) {
settings.COORDINATES_FORMAT.set(newFormat);
updateSelectedFormatPrefs(key);
return (Boolean) newValue;
ApplicationMode selectedAppMode = getSelectedAppMode();
if (settings.COORDINATES_FORMAT.isSetForMode(selectedAppMode)) {
if (!settings.COORDINATES_FORMAT.getModeValue(selectedAppMode).equals(newFormat)) {
settings.COORDINATES_FORMAT.set(newFormat);
updateSelectedFormatPrefs(key);
return true;
}
} else {
FragmentManager fragmentManager = getFragmentManager();
if (fragmentManager != null) {