diff --git a/OsmAnd/res/drawable/ic_checkbox_indeterminate.xml b/OsmAnd/res/drawable/ic_checkbox_indeterminate.xml new file mode 100644 index 0000000000..971eacafae --- /dev/null +++ b/OsmAnd/res/drawable/ic_checkbox_indeterminate.xml @@ -0,0 +1,10 @@ + + + diff --git a/OsmAnd/res/layout/global_preference_toolbar.xml b/OsmAnd/res/layout/global_preference_toolbar.xml index 6a5d37f661..a32e3d1192 100644 --- a/OsmAnd/res/layout/global_preference_toolbar.xml +++ b/OsmAnd/res/layout/global_preference_toolbar.xml @@ -35,6 +35,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:ellipsize="end" + android:letterSpacing="@dimen/text_button_letter_spacing" android:maxLines="2" android:textColor="?attr/app_bar_primary_item_color" android:textSize="@dimen/dialog_header_text_size" @@ -46,6 +47,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:ellipsize="end" + android:letterSpacing="@dimen/description_letter_spacing" android:maxLines="2" android:textColor="?attr/pstsInactiveTextColor" android:textSize="@dimen/default_desc_text_size" diff --git a/OsmAnd/res/layout/preference_info.xml b/OsmAnd/res/layout/preference_info.xml index 69717fdf48..0a2270b18a 100644 --- a/OsmAnd/res/layout/preference_info.xml +++ b/OsmAnd/res/layout/preference_info.xml @@ -21,7 +21,6 @@ android:id="@android:id/title" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_gravity="center_vertical" android:letterSpacing="@dimen/description_letter_spacing" android:paddingLeft="@dimen/content_padding" android:paddingTop="@dimen/content_padding_small" diff --git a/OsmAnd/res/layout/preference_permission.xml b/OsmAnd/res/layout/preference_permission.xml index d793433529..7df4bece52 100644 --- a/OsmAnd/res/layout/preference_permission.xml +++ b/OsmAnd/res/layout/preference_permission.xml @@ -4,14 +4,14 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginLeft="@dimen/content_padding_half" - android:layout_marginRight="@dimen/content_padding_half" android:background="?attr/list_background_color"> diff --git a/OsmAnd/res/layout/preference_with_descr.xml b/OsmAnd/res/layout/preference_with_descr.xml index 3ed18db7ae..a4eb1124fb 100644 --- a/OsmAnd/res/layout/preference_with_descr.xml +++ b/OsmAnd/res/layout/preference_with_descr.xml @@ -41,6 +41,7 @@ android:layout_height="wrap_content" android:ellipsize="marquee" android:singleLine="true" + android:letterSpacing="@dimen/text_button_letter_spacing" android:textColor="?android:textColorPrimary" android:textSize="@dimen/default_list_text_size" osmand:typeface="@string/font_roboto_regular" /> diff --git a/OsmAnd/res/layout/preference_with_descr_dialog_and_switch.xml b/OsmAnd/res/layout/preference_with_descr_dialog_and_switch.xml index 0d8eff15f5..59f4022e7e 100644 --- a/OsmAnd/res/layout/preference_with_descr_dialog_and_switch.xml +++ b/OsmAnd/res/layout/preference_with_descr_dialog_and_switch.xml @@ -39,6 +39,7 @@ android:layout_height="wrap_content" android:ellipsize="marquee" android:fadingEdge="horizontal" + android:letterSpacing="@dimen/text_button_letter_spacing" android:maxLines="2" android:textColor="?android:textColorPrimary" android:textSize="@dimen/default_list_text_size" diff --git a/OsmAnd/res/values-ru/phrases.xml b/OsmAnd/res/values-ru/phrases.xml index 95e72ca7b6..5e39bcb1dc 100644 --- a/OsmAnd/res/values-ru/phrases.xml +++ b/OsmAnd/res/values-ru/phrases.xml @@ -72,7 +72,7 @@ Музыкальный магазин Газеты и журналы Оптика - Биопродукты;Экологически чистые продукты;Органическая пища + Биопродукты;Экологически чистые продукты;Органические продукты Товары для активного отдыха Магазин красок Зоомагазин;Товары для животных diff --git a/OsmAnd/res/values/colors.xml b/OsmAnd/res/values/colors.xml index 658b32a8ff..093a1fcb38 100644 --- a/OsmAnd/res/values/colors.xml +++ b/OsmAnd/res/values/colors.xml @@ -422,8 +422,8 @@ #ff8800 #101112 #E68200 - #CCCCCC - #2B2E31 + #000000 + #000000 #17181a #f0f0f0 diff --git a/OsmAnd/res/values/phrases.xml b/OsmAnd/res/values/phrases.xml index 3157ebe8aa..96748f5c3d 100644 --- a/OsmAnd/res/values/phrases.xml +++ b/OsmAnd/res/values/phrases.xml @@ -260,7 +260,7 @@ Musical instruments Newsagent Optometrist - Organic food + Organic products Outdoor store Paint store Pet store diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 4a8b426630..ff82a8f090 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -11,6 +11,7 @@ Thx - Hardy --> + Accessibility mode disabled in your system. Rearrange categories You can add custom categories hide categories that you don’t find necessary and change the sort order of the list. The list can be imported and exported with profiles. You can add a new custom category by selecting one or a few needed categories. diff --git a/OsmAnd/res/xml/accessibility_settings.xml b/OsmAnd/res/xml/accessibility_settings.xml index f69a4fcabf..69e92ecc50 100644 --- a/OsmAnd/res/xml/accessibility_settings.xml +++ b/OsmAnd/res/xml/accessibility_settings.xml @@ -3,6 +3,14 @@ xmlns:tools="http://schemas.android.com/tools" android:title="@string/shared_string_accessibility"> + + + android:title="@string/offline_edition" + tools:icon="@drawable/ic_action_offline" /> Build.VERSION_CODES.LOLLIPOP) { + Drawable bgDrawable = getPaintedIcon(R.drawable.rectangle_rounded, color); + Drawable selectable = getPaintedIcon(R.drawable.ripple_rectangle_rounded, selectedColor); + Drawable[] layers = {bgDrawable, selectable}; + AndroidUtils.setBackground(selectableView, new LayerDrawable(layers)); + } else { + Drawable bgDrawable = getPaintedIcon(R.drawable.rectangle_rounded, color); + AndroidUtils.setBackground(selectableView, bgDrawable); + } + LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) selectableView.getLayoutParams(); + params.setMargins(params.leftMargin, AndroidUtils.dpToPx(app, 6), params.rightMargin, params.bottomMargin); + } + } + } + @Override public void onPreferenceChanged(String prefId) { if (settings.ACCESSIBILITY_MODE.getId().equals(prefId)) { - updateAccessibilityOptions(); + updateAllSettings(); } } @@ -202,8 +294,11 @@ public class AccessibilitySettingsFragment extends BaseSettingsFragment implemen for (int i = 0; i < screen.getPreferenceCount(); i++) { Preference preference = screen.getPreference(i); String prefId = preference.getKey(); - if (!settings.ACCESSIBILITY_MODE.getId().equals(prefId) && !settings.SPEECH_RATE.getId().equals(prefId) - && !RESET_TO_DEFAULT.equals(prefId) && !COPY_PLUGIN_SETTINGS.equals(prefId)) + if (!settings.ACCESSIBILITY_MODE.getId().equals(prefId) + && !settings.SPEECH_RATE.getId().equals(prefId) + && !RESET_TO_DEFAULT.equals(prefId) + && !COPY_PLUGIN_SETTINGS.equals(prefId) + && !ACCESSIBILITY_OPTIONS.equals(prefId)) preference.setEnabled(accessibilityEnabled); } } diff --git a/OsmAnd/src/net/osmand/plus/OsmandApplication.java b/OsmAnd/src/net/osmand/plus/OsmandApplication.java index 68b232df3d..ba6804721f 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandApplication.java +++ b/OsmAnd/src/net/osmand/plus/OsmandApplication.java @@ -886,6 +886,10 @@ public class OsmandApplication extends MultiDexApplication { } else if (mode == AccessibilityMode.OFF) { return false; } + return systemAccessibilityEnabled(); + } + + public boolean systemAccessibilityEnabled() { return ((AccessibilityManager) getSystemService(Context.ACCESSIBILITY_SERVICE)).isEnabled(); } diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java index 6b7adfa15f..7c9feef68a 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java @@ -1784,7 +1784,7 @@ public class OsmandSettings { public static final Integer REC_DIRECTORY = 0; public static final Integer MONTHLY_DIRECTORY = 1; - public static final Integer DAILY_DIRECTORY = 2; +// public static final Integer DAILY_DIRECTORY = 2; public final CommonPreference DISABLE_RECORDING_ONCE_APP_KILLED = new BooleanPreference("disable_recording_once_app_killed", false).makeProfile(); diff --git a/OsmAnd/src/net/osmand/plus/activities/LocalIndexHelper.java b/OsmAnd/src/net/osmand/plus/activities/LocalIndexHelper.java index 240d3492d3..c59dab87fe 100644 --- a/OsmAnd/src/net/osmand/plus/activities/LocalIndexHelper.java +++ b/OsmAnd/src/net/osmand/plus/activities/LocalIndexHelper.java @@ -2,7 +2,6 @@ package net.osmand.plus.activities; import android.content.Context; -import android.os.Build; import android.support.annotation.DrawableRes; import android.support.annotation.StringRes; @@ -75,9 +74,8 @@ public class LocalIndexHelper { return; } String descr = ""; - descr += app.getString(R.string.local_index_tile_data_name, template.getName()); if (template.getExpirationTimeMinutes() >= 0) { - descr += "\n" + app.getString(R.string.local_index_tile_data_expire, template.getExpirationTimeMinutes()); + descr += app.getString(R.string.local_index_tile_data_expire, String.valueOf(template.getExpirationTimeMinutes())); } info.setAttachedObject(template); info.setDescription(descr); diff --git a/OsmAnd/src/net/osmand/plus/activities/SavingTrackHelper.java b/OsmAnd/src/net/osmand/plus/activities/SavingTrackHelper.java index 4e8f2dadc0..c00fa94337 100644 --- a/OsmAnd/src/net/osmand/plus/activities/SavingTrackHelper.java +++ b/OsmAnd/src/net/osmand/plus/activities/SavingTrackHelper.java @@ -216,9 +216,9 @@ public class SavingTrackHelper extends SQLiteOpenHelper { Integer track_storage_directory = ctx.getSettings().TRACK_STORAGE_DIRECTORY.get(); if (track_storage_directory != OsmandSettings.REC_DIRECTORY) { SimpleDateFormat dateDirFormat = new SimpleDateFormat("yyyy-MM"); - if (track_storage_directory == OsmandSettings.DAILY_DIRECTORY) { - dateDirFormat = new SimpleDateFormat("yyyy-MM-dd"); - } +// if (track_storage_directory == OsmandSettings.DAILY_DIRECTORY) { +// dateDirFormat = new SimpleDateFormat("yyyy-MM-dd"); +// } String dateDirName = dateDirFormat.format(new Date(pt.time)); File dateDir = new File(dir, dateDirName); dateDir.mkdirs(); diff --git a/OsmAnd/src/net/osmand/plus/download/ui/LocalIndexesFragment.java b/OsmAnd/src/net/osmand/plus/download/ui/LocalIndexesFragment.java index 72d55890dd..3d59779e6b 100644 --- a/OsmAnd/src/net/osmand/plus/download/ui/LocalIndexesFragment.java +++ b/OsmAnd/src/net/osmand/plus/download/ui/LocalIndexesFragment.java @@ -1236,8 +1236,8 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement return true; } }); - if (info.getType() == LocalIndexType.TILES_DATA && (info.getAttachedObject() instanceof ITileSource) && - ((ITileSource) info.getAttachedObject()).couldBeDownloadedFromInternet()) { + if (info.getType() == LocalIndexType.TILES_DATA + && (info.getAttachedObject() instanceof TileSourceManager.TileSourceTemplate)) { item = optionsMenu.getMenu().add(R.string.shared_string_edit) .setIcon(iconsCache.getThemedIcon(R.drawable.ic_action_edit_dark)); item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { @@ -1248,8 +1248,8 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement } }); } - if (info.getType() == LocalIndexType.TILES_DATA && (info.getAttachedObject() instanceof ITileSource) && - ((ITileSource)info.getAttachedObject()).couldBeDownloadedFromInternet()) { + if (info.getType() == LocalIndexType.TILES_DATA && (info.getAttachedObject() instanceof ITileSource) + && ((ITileSource) info.getAttachedObject()).couldBeDownloadedFromInternet()) { item = optionsMenu.getMenu().add(R.string.clear_tile_data) .setIcon(iconsCache.getThemedIcon(R.drawable.ic_action_remove_dark)); item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { diff --git a/OsmAnd/src/net/osmand/plus/monitoring/MonitoringSettingsFragment.java b/OsmAnd/src/net/osmand/plus/monitoring/MonitoringSettingsFragment.java index 654faeab8d..08528fe019 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/MonitoringSettingsFragment.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/MonitoringSettingsFragment.java @@ -29,7 +29,6 @@ import java.io.Serializable; import java.util.HashMap; import java.util.LinkedHashMap; -import static net.osmand.plus.OsmandSettings.DAILY_DIRECTORY; import static net.osmand.plus.OsmandSettings.MONTHLY_DIRECTORY; import static net.osmand.plus.OsmandSettings.REC_DIRECTORY; import static net.osmand.plus.monitoring.OsmandMonitoringPlugin.MINUTES; @@ -195,11 +194,11 @@ public class MonitoringSettingsFragment extends BaseSettingsFragment implements } private void setupTrackStorageDirectoryPref() { - Integer[] entryValues = new Integer[] {REC_DIRECTORY, MONTHLY_DIRECTORY, DAILY_DIRECTORY}; + Integer[] entryValues = new Integer[] {REC_DIRECTORY, MONTHLY_DIRECTORY}; String[] entries = new String[entryValues.length]; entries[0] = getString(R.string.store_tracks_in_rec_directory); entries[1] = getString(R.string.store_tracks_in_monthly_directories); - entries[2] = getString(R.string.store_tracks_in_daily_directories); +// entries[2] = getString(R.string.store_tracks_in_daily_directories); ListPreferenceEx trackStorageDirectory = (ListPreferenceEx) findPreference(settings.TRACK_STORAGE_DIRECTORY.getId()); trackStorageDirectory.setEntries(entries); diff --git a/OsmAnd/src/net/osmand/plus/monitoring/SettingsMonitoringActivity.java b/OsmAnd/src/net/osmand/plus/monitoring/SettingsMonitoringActivity.java index a8a12a9b2b..135e409ce9 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/SettingsMonitoringActivity.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/SettingsMonitoringActivity.java @@ -37,7 +37,6 @@ import net.osmand.plus.activities.SettingsBaseActivity; import java.util.Map; -import static net.osmand.plus.OsmandSettings.DAILY_DIRECTORY; import static net.osmand.plus.OsmandSettings.MONTHLY_DIRECTORY; import static net.osmand.plus.OsmandSettings.REC_DIRECTORY; @@ -156,11 +155,11 @@ public class SettingsMonitoringActivity extends SettingsBaseActivity { cat.addPreference(createCheckBoxPreference(settings.SAVE_HEADING_TO_GPX, R.string.save_heading, R.string.save_heading_descr)); - Integer[] intValues = new Integer[]{REC_DIRECTORY, MONTHLY_DIRECTORY, DAILY_DIRECTORY}; + Integer[] intValues = new Integer[]{REC_DIRECTORY, MONTHLY_DIRECTORY}; names = new String[intValues.length]; names[0] = getString(R.string.store_tracks_in_rec_directory); names[1] = getString(R.string.store_tracks_in_monthly_directories); - names[2] = getString(R.string.store_tracks_in_daily_directories); +// names[2] = getString(R.string.store_tracks_in_daily_directories); cat.addPreference(createListPreference(settings.TRACK_STORAGE_DIRECTORY, names, intValues, R.string.track_storage_directory, R.string.track_storage_directory_descrp)); } diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingFragment.java index b7c4bd5aaa..cd92fa4592 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingFragment.java @@ -2,8 +2,10 @@ package net.osmand.plus.osmedit; import android.content.Intent; import android.graphics.Typeface; +import android.graphics.drawable.Drawable; import android.support.v4.app.FragmentManager; import android.support.v7.preference.Preference; +import android.support.v7.preference.PreferenceViewHolder; import android.text.SpannableString; import android.view.LayoutInflater; import android.view.View; @@ -21,12 +23,13 @@ import net.osmand.plus.widgets.style.CustomTypefaceSpan; public class OsmEditingFragment extends BaseSettingsFragment implements OnPreferenceChanged { + private static final String OSM_EDITING_INFO = "osm_editing_info"; private static final String OPEN_OSM_EDITS = "open_osm_edits"; private static final String OSM_LOGIN_DATA = "osm_login_data"; @Override protected void setupPreferences() { - Preference osmEditingInfo = findPreference("osm_editing_info"); + Preference osmEditingInfo = findPreference(OSM_EDITING_INFO); osmEditingInfo.setIcon(getContentIcon(R.drawable.ic_action_info_dark)); setupNameAndPasswordPref(); @@ -44,6 +47,15 @@ public class OsmEditingFragment extends BaseSettingsFragment implements OnPrefer AndroidUiHelper.updateVisibility(toolbarSubtitle, true); } + @Override + protected void onBindPreferenceViewHolder(Preference preference, PreferenceViewHolder holder) { + super.onBindPreferenceViewHolder(preference, holder); + if (OSM_EDITING_INFO.equals(preference.getKey())) { + TextView titleView = (TextView) holder.findViewById(android.R.id.title); + titleView.setTextSize(16); + } + } + private void setupNameAndPasswordPref() { Preference nameAndPasswordPref = findPreference(OSM_LOGIN_DATA); nameAndPasswordPref.setSummary(settings.USER_NAME.get()); @@ -53,6 +65,11 @@ public class OsmEditingFragment extends BaseSettingsFragment implements OnPrefer private void setupOfflineEditingPref() { SwitchPreferenceEx offlineEditingPref = (SwitchPreferenceEx) findPreference(settings.OFFLINE_EDITION.getId()); offlineEditingPref.setDescription(getString(R.string.offline_edition_descr)); + offlineEditingPref.setIcon(getOfflineEditingIcon(settings.OFFLINE_EDITION.get())); + } + + private Drawable getOfflineEditingIcon(boolean enabled) { + return enabled ? getActiveIcon(R.drawable.ic_world_globe_dark) : getContentIcon(R.drawable.ic_action_offline); } private void setupOsmEditsDescrPref() { @@ -92,6 +109,14 @@ public class OsmEditingFragment extends BaseSettingsFragment implements OnPrefer return super.onPreferenceClick(preference); } + @Override + public boolean onPreferenceChange(Preference preference, Object newValue) { + if (settings.OFFLINE_EDITION.getId().equals(preference.getKey()) && newValue instanceof Boolean) { + preference.setIcon(getOfflineEditingIcon((Boolean) newValue)); + } + return super.onPreferenceChange(preference, newValue); + } + @Override public void onPreferenceChanged(String prefId) { if (OSM_LOGIN_DATA.equals(prefId)) { diff --git a/OsmAnd/src/net/osmand/plus/settings/ConfigureProfileFragment.java b/OsmAnd/src/net/osmand/plus/settings/ConfigureProfileFragment.java index 967b8a2915..50b5f82f7e 100644 --- a/OsmAnd/src/net/osmand/plus/settings/ConfigureProfileFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/ConfigureProfileFragment.java @@ -38,6 +38,7 @@ import net.osmand.plus.SettingsHelper; import net.osmand.plus.SettingsHelper.ProfileSettingsItem; import net.osmand.plus.UiUtilities; import net.osmand.plus.activities.MapActivity; +import net.osmand.plus.helpers.AndroidUiHelper; import net.osmand.plus.helpers.FontCache; import net.osmand.plus.openseamapsplugin.NauticalMapsPlugin; import net.osmand.plus.profiles.ExportImportProfileBottomSheet; @@ -101,20 +102,16 @@ public class ConfigureProfileFragment extends BaseSettingsFragment implements Co toolbarSubtitle.setText(R.string.configure_profile); toolbarSubtitle.setVisibility(View.VISIBLE); - if (!getSelectedAppMode().equals(ApplicationMode.DEFAULT)) { - view.findViewById(R.id.toolbar_switch_container).setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - ApplicationMode selectedMode = getSelectedAppMode(); - List availableAppModes = ApplicationMode.values(getMyApplication()); - boolean isChecked = availableAppModes.contains(selectedMode); - ApplicationMode.changeProfileAvailability(selectedMode, !isChecked, getMyApplication()); - updateToolbarSwitch(); - } - }); - } else { - view.findViewById(R.id.switchWidget).setVisibility(View.GONE); - } + view.findViewById(R.id.toolbar_switch_container).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + ApplicationMode selectedMode = getSelectedAppMode(); + List availableAppModes = ApplicationMode.values(getMyApplication()); + boolean isChecked = availableAppModes.contains(selectedMode); + ApplicationMode.changeProfileAvailability(selectedMode, !isChecked, getMyApplication()); + updateToolbarSwitch(); + } + }); } @Override @@ -149,6 +146,9 @@ public class ConfigureProfileFragment extends BaseSettingsFragment implements Co updateToolbarSwitch(); TextView toolbarTitle = view.findViewById(R.id.toolbar_title); toolbarTitle.setText(getSelectedAppMode().toHumanString()); + + boolean visible = !getSelectedAppMode().equals(ApplicationMode.DEFAULT); + AndroidUiHelper.updateVisibility(view.findViewById(R.id.switchWidget), visible); } } diff --git a/OsmAnd/src/net/osmand/plus/settings/MainSettingsFragment.java b/OsmAnd/src/net/osmand/plus/settings/MainSettingsFragment.java index 5dd684c876..80ae2ae4ab 100644 --- a/OsmAnd/src/net/osmand/plus/settings/MainSettingsFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/MainSettingsFragment.java @@ -19,6 +19,7 @@ import net.osmand.plus.R; import net.osmand.plus.SettingsHelper.*; import net.osmand.plus.UiUtilities; import net.osmand.plus.activities.MapActivity; +import net.osmand.plus.helpers.AndroidUiHelper; import net.osmand.plus.profiles.SelectProfileBottomSheetDialogFragment; import net.osmand.plus.profiles.SelectProfileBottomSheetDialogFragment.SelectProfileListener; import net.osmand.plus.settings.preferences.SwitchPreferenceEx; @@ -88,9 +89,8 @@ public class MainSettingsFragment extends BaseSettingsFragment { AndroidUtils.setBackground(selectedProfile, backgroundDrawable); } } - if (ApplicationMode.DEFAULT.getStringKey().equals(preference.getKey())) { - holder.findViewById(R.id.switchWidget).setVisibility(View.GONE); - } + boolean visible = !ApplicationMode.DEFAULT.getStringKey().equals(key); + AndroidUiHelper.updateVisibility(holder.findViewById(R.id.switchWidget), visible); } @Override diff --git a/OsmAnd/src/net/osmand/plus/settings/bottomsheets/BasePreferenceBottomSheet.java b/OsmAnd/src/net/osmand/plus/settings/bottomsheets/BasePreferenceBottomSheet.java index 37de56fb93..f6ae08a36c 100644 --- a/OsmAnd/src/net/osmand/plus/settings/bottomsheets/BasePreferenceBottomSheet.java +++ b/OsmAnd/src/net/osmand/plus/settings/bottomsheets/BasePreferenceBottomSheet.java @@ -17,6 +17,7 @@ public abstract class BasePreferenceBottomSheet extends MenuBottomSheetDialogFra public static final String PREFERENCE_ID = "preference_id"; private static final String APP_MODE_KEY = "app_mode_key"; + private static final String PROFILE_DEPENDENT = "profile_dependent"; private String prefId; private Preference preference; @@ -36,12 +37,14 @@ public abstract class BasePreferenceBottomSheet extends MenuBottomSheetDialogFra super.onCreate(savedInstanceState); if (savedInstanceState != null) { appMode = ApplicationMode.valueOfStringKey(savedInstanceState.getString(APP_MODE_KEY), null); + profileDependent = savedInstanceState.getBoolean(PROFILE_DEPENDENT, false); } } @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); + outState.putBoolean(PROFILE_DEPENDENT, profileDependent); if (appMode != null) { outState.putString(APP_MODE_KEY, appMode.getStringKey()); } diff --git a/OsmAnd/src/net/osmand/plus/settings/bottomsheets/EditTextPreferenceBottomSheet.java b/OsmAnd/src/net/osmand/plus/settings/bottomsheets/EditTextPreferenceBottomSheet.java index 81f6675afb..447b34dd24 100644 --- a/OsmAnd/src/net/osmand/plus/settings/bottomsheets/EditTextPreferenceBottomSheet.java +++ b/OsmAnd/src/net/osmand/plus/settings/bottomsheets/EditTextPreferenceBottomSheet.java @@ -8,7 +8,9 @@ import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.view.View; import android.widget.EditText; +import android.widget.RelativeLayout; +import net.osmand.AndroidUtils; import net.osmand.plus.ApplicationMode; import net.osmand.plus.R; import net.osmand.plus.UiUtilities; @@ -47,6 +49,13 @@ public class EditTextPreferenceBottomSheet extends BasePreferenceBottomSheet { View view = UiUtilities.getInflater(ctx, nightMode).inflate(R.layout.preference_edit_text_box, null); editText = view.findViewById(R.id.edit_text); editText.setText(text); + + RelativeLayout editTextLayout = view.findViewById(R.id.text_field_boxes_editTextLayout); + if (editTextLayout != null && editTextLayout.getLayoutParams() instanceof RelativeLayout.LayoutParams) { + RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) editTextLayout.getLayoutParams(); + params.setMargins(params.leftMargin, AndroidUtils.dpToPx(ctx, 19), params.rightMargin, params.bottomMargin); + } + items.add(new SimpleBottomSheetItem.Builder().setCustomView(view).create()); String description = editTextPreference.getDescription();